From 44a47fb8769744e824e8ff149fd8519d7743a935 Mon Sep 17 00:00:00 2001 From: DotnetBuild Date: Wed, 16 Aug 2017 15:16:07 +0900 Subject: [PATCH] Release 4.0.0-preview1-00051 --- Version.txt | 4 +- ....nupkg => Tizen.NET.4.0.0-preview1-00051.nupkg} | Bin 1599556 -> 1599550 bytes ...> Tizen.NET.4.0.0-preview1-00051.symbols.nupkg} | Bin 1968921 -> 1968914 bytes ...> Tizen.NET.Private.4.0.0-preview1-00051.nupkg} | Bin 1934555 -> 1934548 bytes ...NET.Private.4.0.0-preview1-00051.symbols.nupkg} | Bin 2359419 -> 2359410 bytes binaries/frameworks/Tizen.Multimedia.dll | Bin 70656 -> 70656 bytes build/Open.snk | Bin 0 -> 596 bytes build/common.props | 20 + build/common.targets | 3 + build/dependencies.props | 7 + build/version.props | 8 + packaging/csapi-tizenfx.spec | 2 +- pkg/Tizen.NET.Private.nuspec | 20 + pkg/Tizen.NET.Private.sln | 1154 ++ pkg/Tizen.NET.nuspec | 218 + src/ElmSharp.Wearable/ElmSharp.Wearable.csproj | 13 + src/ElmSharp.Wearable/ElmSharp.Wearable.sln | 28 + .../ElmSharp.Wearable/CircleDatetimeSelector.cs | 134 + .../ElmSharp.Wearable/CircleGenList.cs | 204 + .../ElmSharp.Wearable/CircleProgressBar.cs | 338 + .../ElmSharp.Wearable/CircleScroller.cs | 328 + .../ElmSharp.Wearable/CircleSlider.cs | 375 + .../ElmSharp.Wearable/CircleSpinner.cs | 153 + .../ElmSharp.Wearable/MoreOption.cs | 89 + .../ElmSharp.Wearable/MoreOptionItem.cs | 95 + .../ElmSharp.Wearable/MoreOptionItemEventArgs.cs | 10 + .../ElmSharp.Wearable/MoreOptionList.cs | 121 + .../ElmSharp.Wearable/PointerEventArgs.cs | 11 + .../ElmSharp.Wearable/RotarySelector.cs | 95 + .../ElmSharp.Wearable/RotarySelectorItem.cs | 163 + .../RotarySelectorItemEventArgs.cs | 11 + .../ElmSharp.Wearable/RotarySelectorList.cs | 96 + .../Interop/Interop.Eext.CircleDatetime.cs | 27 + .../Interop/Interop.Eext.CircleGenList.cs | 40 + .../Interop/Interop.Eext.CircleObject.cs | 141 + .../Interop/Interop.Eext.CircleProgressBar.cs | 28 + .../Interop/Interop.Eext.CircleScroller.cs | 39 + .../Interop/Interop.Eext.CircleSlider.cs | 33 + .../Interop/Interop.Eext.CircleSpinner.cs | 31 + .../Interop/Interop.Eext.CircleSurface.cs | 37 + .../Interop/Interop.Eext.MoreOption.cs | 65 + .../Interop/Interop.Eext.Rotary.cs | 28 + .../Interop/Interop.Eext.RotarySelector.cs | 51 + src/ElmSharp.Wearable/Interop/Interop.Evas.cs | 28 + src/ElmSharp.Wearable/Interop/Interop.Libraries.cs | 25 + src/ElmSharp/ElmSharp.csproj | 9 + src/ElmSharp/ElmSharp.sln | 22 + src/ElmSharp/ElmSharp/AccessRole.cs | 438 + src/ElmSharp/ElmSharp/AccessibleObject.cs | 248 + src/ElmSharp/ElmSharp/AccessibleRelation.cs | 371 + src/ElmSharp/ElmSharp/AccessibleUtil.cs | 90 + src/ElmSharp/ElmSharp/Background.cs | 158 + src/ElmSharp/ElmSharp/Box.cs | 239 + src/ElmSharp/ElmSharp/Button.cs | 177 + src/ElmSharp/ElmSharp/Calendar.cs | 479 + src/ElmSharp/ElmSharp/Check.cs | 79 + .../ElmSharp/CheckStateChangedEventArgs.cs | 49 + src/ElmSharp/ElmSharp/Color.cs | 339 + src/ElmSharp/ElmSharp/ColorChangedEventArgs.cs | 49 + src/ElmSharp/ElmSharp/ColorSelector.cs | 190 + src/ElmSharp/ElmSharp/ColorSelectorItem.cs | 50 + src/ElmSharp/ElmSharp/Conformant.cs | 45 + src/ElmSharp/ElmSharp/Container.cs | 83 + src/ElmSharp/ElmSharp/ContextPopup.cs | 250 + src/ElmSharp/ElmSharp/ContextPopupItem.cs | 53 + src/ElmSharp/ElmSharp/DateChangedEventArgs.cs | 53 + src/ElmSharp/ElmSharp/DateTimeSelector.cs | 184 + .../ElmSharp/DisplayedMonthChangedEventArgs.cs | 53 + src/ElmSharp/ElmSharp/EcoreAnimator.cs | 88 + src/ElmSharp/ElmSharp/EcoreEvent.cs | 210 + src/ElmSharp/ElmSharp/EcoreKeyEventArgs.cs | 68 + src/ElmSharp/ElmSharp/EcoreMainloop.cs | 144 + .../ElmSharp/EcoreSynchronizationContext.cs | 77 + src/ElmSharp/ElmSharp/EdjeObject.cs | 328 + src/ElmSharp/ElmSharp/EffectBase.cs | 38 + src/ElmSharp/ElmSharp/Elementary.cs | 339 + src/ElmSharp/ElmSharp/ElmScrollConfig.cs | 40 + src/ElmSharp/ElmSharp/Entry.cs | 1025 ++ src/ElmSharp/ElmSharp/EvasCanvas.cs | 173 + src/ElmSharp/ElmSharp/EvasKeyEventArgs.cs | 150 + src/ElmSharp/ElmSharp/EvasMap.cs | 146 + src/ElmSharp/ElmSharp/EvasObject.cs | 964 ++ src/ElmSharp/ElmSharp/EvasObjectEvent.cs | 446 + src/ElmSharp/ElmSharp/FlipSelector.cs | 193 + src/ElmSharp/ElmSharp/FlipSelectorItem.cs | 50 + src/ElmSharp/ElmSharp/FloatingButton.cs | 160 + src/ElmSharp/ElmSharp/GenGrid.cs | 606 + src/ElmSharp/ElmSharp/GenGridItem.cs | 183 + src/ElmSharp/ElmSharp/GenItem.cs | 129 + src/ElmSharp/ElmSharp/GenItemClass.cs | 255 + src/ElmSharp/ElmSharp/GenList.cs | 751 ++ src/ElmSharp/ElmSharp/GenListItem.cs | 317 + src/ElmSharp/ElmSharp/GestureLayer.cs | 835 ++ src/ElmSharp/ElmSharp/Hoversel.cs | 207 + src/ElmSharp/ElmSharp/HoverselItem.cs | 45 + src/ElmSharp/ElmSharp/IAccessibleObject.cs | 37 + src/ElmSharp/ElmSharp/Icon.cs | 115 + src/ElmSharp/ElmSharp/Image.cs | 688 ++ src/ElmSharp/ElmSharp/Index.cs | 260 + src/ElmSharp/ElmSharp/IndexItem.cs | 59 + src/ElmSharp/ElmSharp/ItemObject.cs | 366 + src/ElmSharp/ElmSharp/ItemObjectExtension.cs | 44 + src/ElmSharp/ElmSharp/Label.cs | 209 + src/ElmSharp/ElmSharp/Layout.cs | 352 + src/ElmSharp/ElmSharp/List.cs | 253 + src/ElmSharp/ElmSharp/ListItem.cs | 50 + src/ElmSharp/ElmSharp/MultiButtonEntry.cs | 407 + src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs | 86 + src/ElmSharp/ElmSharp/NaviItem.cs | 126 + src/ElmSharp/ElmSharp/Naviframe.cs | 259 + src/ElmSharp/ElmSharp/Panel.cs | 137 + src/ElmSharp/ElmSharp/Panes.cs | 193 + src/ElmSharp/ElmSharp/Point.cs | 84 + src/ElmSharp/ElmSharp/Point3D.cs | 92 + src/ElmSharp/ElmSharp/Polygon.cs | 67 + src/ElmSharp/ElmSharp/Popup.cs | 291 + src/ElmSharp/ElmSharp/PopupItem.cs | 42 + src/ElmSharp/ElmSharp/ProgressBar.cs | 224 + src/ElmSharp/ElmSharp/Radio.cs | 97 + src/ElmSharp/ElmSharp/ReadingInfoType.cs | 48 + src/ElmSharp/ElmSharp/Rect.cs | 144 + src/ElmSharp/ElmSharp/Rectangle.cs | 41 + src/ElmSharp/ElmSharp/Scroller.cs | 794 ++ src/ElmSharp/ElmSharp/Size.cs | 99 + src/ElmSharp/ElmSharp/Slider.cs | 328 + src/ElmSharp/ElmSharp/SmartEvent.cs | 242 + src/ElmSharp/ElmSharp/Spinner.cs | 254 + src/ElmSharp/ElmSharp/Table.cs | 160 + src/ElmSharp/ElmSharp/Toolbar.cs | 463 + src/ElmSharp/ElmSharp/ToolbarItem.cs | 141 + src/ElmSharp/ElmSharp/Transit.cs | 386 + src/ElmSharp/ElmSharp/TransitEffect.cs | 461 + src/ElmSharp/ElmSharp/Utility.cs | 160 + src/ElmSharp/ElmSharp/Widget.cs | 442 + src/ElmSharp/ElmSharp/Window.cs | 1058 ++ src/ElmSharp/ElmSharp/WrapType.cs | 44 + src/ElmSharp/Interop/Interop.Ecore.cs | 76 + src/ElmSharp/Interop/Interop.Eext.Event.cs | 38 + .../Interop/Interop.Eext.FloatingButton.cs | 48 + src/ElmSharp/Interop/Interop.Eina.cs | 28 + .../Interop/Interop.Elementary.Accessibility.cs | 249 + src/ElmSharp/Interop/Interop.Elementary.Bg.cs | 60 + src/ElmSharp/Interop/Interop.Elementary.Box.cs | 94 + src/ElmSharp/Interop/Interop.Elementary.Button.cs | 78 + .../Interop/Interop.Elementary.CalendarView.cs | 108 + .../Interop/Interop.Elementary.ColorPicker.cs | 82 + .../Interop/Interop.Elementary.CtxPopup.cs | 66 + .../Interop/Interop.Elementary.DateTimePicker.cs | 80 + src/ElmSharp/Interop/Interop.Elementary.Entry.cs | 401 + .../Interop/Interop.Elementary.FlipSelector.cs | 54 + .../Interop/Interop.Elementary.GenGridView.cs | 207 + .../Interop/Interop.Elementary.GenListView.cs | 262 + .../Interop/Interop.Elementary.GestureLayer.cs | 138 + .../Interop/Interop.Elementary.Hoversel.cs | 67 + src/ElmSharp/Interop/Interop.Elementary.Image.cs | 142 + src/ElmSharp/Interop/Interop.Elementary.Index.cs | 103 + src/ElmSharp/Interop/Interop.Elementary.Item.cs | 116 + src/ElmSharp/Interop/Interop.Elementary.Label.cs | 80 + src/ElmSharp/Interop/Interop.Elementary.List.cs | 60 + .../Interop/Interop.Elementary.MultiButtonEntry.cs | 94 + .../Interop/Interop.Elementary.Naviframe.cs | 87 + src/ElmSharp/Interop/Interop.Elementary.Panel.cs | 48 + src/ElmSharp/Interop/Interop.Elementary.Panes.cs | 75 + src/ElmSharp/Interop/Interop.Elementary.Popup.cs | 101 + .../Interop/Interop.Elementary.ProgressBar.cs | 78 + .../Interop/Interop.Elementary.ScrollView.cs | 147 + src/ElmSharp/Interop/Interop.Elementary.Slider.cs | 119 + src/ElmSharp/Interop/Interop.Elementary.Spinner.cs | 103 + src/ElmSharp/Interop/Interop.Elementary.Table.cs | 55 + src/ElmSharp/Interop/Interop.Elementary.Toolbar.cs | 134 + src/ElmSharp/Interop/Interop.Elementary.Win.cs | 444 + src/ElmSharp/Interop/Interop.Elementary.cs | 795 ++ src/ElmSharp/Interop/Interop.Eo.cs | 38 + src/ElmSharp/Interop/Interop.Evas.Image.cs | 54 + src/ElmSharp/Interop/Interop.Evas.cs | 818 ++ src/ElmSharp/Interop/Interop.Libc.cs | 67 + src/ElmSharp/Interop/Interop.Libdl.cs | 60 + src/ElmSharp/Interop/Interop.Libraries.cs | 31 + .../Interop/Interop.Account.cs | 153 + .../Interop/Interop.AccountProvider.cs | 92 + .../Interop/Interop.AccountService.cs | 118 + .../Interop/Interop.Libraries.cs | 33 + .../Tizen.Account.AccountManager.csproj | 14 + .../Tizen.Account.AccountManager.sln | 34 + .../Tizen.Account.AccountManager/Account.cs | 619 + .../Tizen.Account.AccountManager/AccountEnums.cs | 166 + .../AccountErrorFactory.cs | 204 + .../AccountProvider.cs | 366 + .../Tizen.Account.AccountManager/AccountService.cs | 606 + .../AccountSubscriberEventArgs.cs | 73 + .../Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 28 + .../Interop/Interop.Uaf.Authenticator.cs | 68 + .../Interop/Interop.Uaf.Client.cs | 35 + .../Tizen.Account.FidoClient.csproj | 14 + .../Tizen.Account.FidoClient.sln | 34 + .../AuthenticatorInformation.cs | 126 + .../Tizen.Account.FidoClient/ErrorFactory.cs | 91 + .../UafAuthenticatorFinder.cs | 211 + .../Tizen.Account.FidoClient/UafClient.cs | 247 + .../Tizen.Account.FidoClient/UafEnumerations.cs | 312 + .../Tizen.Account.FidoClient/UafMessage.cs | 39 + .../Tizen.Account.FidoClient/UafResponse.cs | 39 + src/Tizen.Account.OAuth2/Interop/Interop.Common.cs | 55 + src/Tizen.Account.OAuth2/Interop/Interop.Error.cs | 44 + .../Interop/Interop.Libraries.cs | 28 + .../Interop/Interop.Manager.cs | 70 + .../Interop/Interop.Request.cs | 129 + .../Interop/Interop.Response.cs | 62 + src/Tizen.Account.OAuth2/Interop/Interop.Types.cs | 38 + .../Tizen.Account.OAuth2.csproj | 14 + src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.sln | 34 + .../Tizen.Account.OAuth2/AccessToken.cs | 55 + .../Tizen.Account.OAuth2/AuthenticationScheme.cs | 45 + .../Tizen.Account.OAuth2/AuthorizationRequest.cs | 76 + .../Tizen.Account.OAuth2/AuthorizationResponse.cs | 108 + .../Tizen.Account.OAuth2/Authorizer.cs | 490 + .../Tizen.Account.OAuth2/ClientCredentials.cs | 49 + .../ClientCredentialsAuthorizer.cs | 168 + .../ClientCredentialsTokenRequest.cs | 42 + .../CodeGrantAuthorizationRequest.cs | 40 + .../Tizen.Account.OAuth2/CodeGrantAuthorizer.cs | 343 + .../Tizen.Account.OAuth2/CodeGrantTokenRequest.cs | 48 + .../ImplicitGrantAuthorizationRequest.cs | 39 + .../ImplicitGrantAuthorizer.cs | 246 + .../Tizen.Account.OAuth2/OAuth2ErrorFactory.cs | 127 + .../Tizen.Account.OAuth2/OAuth2ErrorResponse.cs | 72 + .../Tizen.Account.OAuth2/RefreshToken.cs | 36 + .../Tizen.Account.OAuth2/RefreshTokenRequest.cs | 46 + .../ResourceOwnerPwdCredentialsAuthorizer.cs | 182 + .../ResourceOwnerPwdCredentialsTokenRequest.cs | 51 + .../Tizen.Account.OAuth2/TokenRequest.cs | 76 + .../Tizen.Account.OAuth2/TokenResponse.cs | 116 + .../Interop/Interop.Alarm.cs | 102 + .../Interop/Interop.Libraries.cs | 23 + .../Tizen.Applications.Alarm.csproj | 14 + .../Tizen.Applications.Alarm.sln | 46 + .../Tizen.Applications/Alarm.cs | 181 + .../Tizen.Applications/AlarmErrorFactory.cs | 58 + .../Tizen.Applications/AlarmManager.cs | 412 + .../Interop/Interop.AttachPanel.cs | 71 + .../Interop/Interop.Libraries.cs | 7 + .../Tizen.Applications.AttachPanel.csproj | 13 + .../Tizen.Applications.AttachPanel.sln | 40 + .../Tizen.Applications.AttachPanel/AttachPanel.cs | 263 + .../AttachPanelInternal.cs | 76 + .../ContentCategory.cs | 57 + .../Tizen.Applications.AttachPanel/EventType.cs | 25 + .../ResultEventArgs.cs | 51 + .../StateEventArgs.cs | 44 + .../Tizen.Applications.AttachPanel/StateType.cs | 21 + src/Tizen.Applications.Badge/GlobalSuppressions.cs | Bin 0 -> 954 bytes .../Interop/Interop.Badge.cs | 65 + .../Interop/Interop.Libraries.cs | 23 + .../Tizen.Applications.Badge.csproj | 14 + .../Tizen.Applications.Badge.sln | 34 + .../Tizen.Applications/Badge.cs | 71 + .../Tizen.Applications/BadgeControl.cs | 286 + .../Tizen.Applications/BadgeErrorFactory.cs | 61 + .../Tizen.Applications/BadgeEventArgs.cs | 64 + .../Interop/Interop.AppCommon.cs | 96 + .../Interop/Interop.AppControl.cs | 138 + .../Interop/Interop.ApplicationManager.cs | 356 + .../Interop/Interop.Bundle.cs | 82 + .../Interop/Interop.Glib.cs | 30 + .../Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 31 + .../Tizen.Applications.Common.csproj | 14 + .../Tizen.Applications.Common.sln | 34 + .../DefaultCoreBackend.cs | 155 + .../Tizen.Applications.CoreBackend/EventType.cs | 123 + .../Tizen.Applications.CoreBackend/ICoreBackend.cs | 52 + .../Tizen.Applications/AppControl.cs | 1038 ++ .../Tizen.Applications/AppControlData.cs | 149 + .../Tizen.Applications/AppControlLaunchMode.cs | 34 + .../Tizen.Applications/AppControlOperations.cs | 159 + .../AppControlReceivedEventArgs.cs | 40 + .../Tizen.Applications/AppControlReplyCallback.cs | 26 + .../Tizen.Applications/AppControlReplyResult.cs | 44 + .../Tizen.Applications/Application.cs | 140 + .../ApplicationDisabledEventArgs.cs | 46 + .../ApplicationEnabledEventArgs.cs | 46 + .../Tizen.Applications/ApplicationEventState.cs | 40 + .../Tizen.Applications/ApplicationInfo.cs | 406 + .../Tizen.Applications/ApplicationInfoFilter.cs | 70 + .../ApplicationInfoMetadataFilter.cs | 28 + .../ApplicationLaunchedEventArgs.cs | 31 + .../Tizen.Applications/ApplicationManager.cs | 608 + .../ApplicationRunningContext.cs | 269 + .../ApplicationTerminatedEventArgs.cs | 31 + .../Tizen.Applications/ApplicationType.cs | 37 + .../Tizen.Applications/Bundle.cs | 714 ++ .../Tizen.Applications/CoreApplication.cs | 217 + .../Tizen.Applications/DeviceOrientation.cs | 44 + .../DeviceOrientationEventArgs.cs | 40 + .../Tizen.Applications/DirectoryInfo.cs | 173 + .../Tizen.Applications/LocaleChangedEventArgs.cs | 42 + .../Tizen.Applications/LowBatteryEventArgs.cs | 40 + .../Tizen.Applications/LowBatteryStatus.cs | 39 + .../Tizen.Applications/LowMemoryEventArgs.cs | 40 + .../Tizen.Applications/LowMemoryStatus.cs | 44 + .../Tizen.Applications/ReceivedAppControl.cs | 146 + .../Tizen.Applications/RecentApplicationControl.cs | 67 + .../Tizen.Applications/RecentApplicationInfo.cs | 72 + .../RegionFormatChangedEventArgs.cs | 41 + .../Tizen.Applications/ResourceManager.cs | 125 + .../Tizen.Applications/SafeAppControlHandle.cs | 63 + .../Tizen.Applications/SafeBundleHandle.cs | 63 + .../TizenSynchronizationContext.cs | 128 + .../Interop/Interop.DataControl.cs | 466 + .../Interop/Interop.Libraries.cs | 23 + .../CloneCursorCore.cs | 259 + .../Tizen.Applications.DataControl.csproj | 18 + .../Tizen.Applications.DataControl.sln | 40 + .../Tizen.Applications.DataControl/BulkData.cs | 361 + .../Tizen.Applications.DataControl/Consumer.cs | 973 ++ .../Tizen.Applications.DataControl/ErrorFactory.cs | 60 + .../Tizen.Applications.DataControl/ICursor.cs | 81 + .../Tizen.Applications.DataControl/MatrixCursor.cs | 629 ++ .../Tizen.Applications.DataControl/Provider.cs | 1091 ++ .../Tizen.Applications.DataControl/Results.cs | 385 + .../Tizen.Applications.DataControl/Types.cs | 106 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.MessagePort.cs | 47 + .../Tizen.Applications.MessagePort.csproj | 13 + .../Tizen.Applications.MessagePort.sln | 40 + .../Tizen.Applications.Messages/MessagePort.cs | 306 + .../MessagePortErrorFactory.cs | 57 + .../MessageReceivedEventArgs.cs | 35 + .../Tizen.Applications.Messages/RemoteValues.cs | 39 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Notification.cs | 311 + .../Tizen.Applications.Notification.csproj | 13 + .../Tizen.Applications.Notification.sln | 40 + .../Notification.cs | 505 + .../NotificationAccessorySet.cs | 95 + .../NotificationAccessorySetBinder.cs | 144 + .../NotificationActiveStyle.cs | 264 + .../NotificationBinder.cs | 233 + .../NotificationButtonAction.cs | 86 + .../NotificationEnumerations.cs | 215 + .../NotificationErrorFactory.cs | 56 + .../NotificationIndicatorStyle.cs | 62 + .../NotificationLockStyle.cs | 61 + .../NotificationMakerBase.cs | 40 + .../NotificationManager.cs | 480 + .../NotificationProgress.cs | 124 + .../NotificationProgressBinder.cs | 75 + .../NotificationReplyAction.cs | 111 + .../NotificationSafeHandle.cs | 53 + .../NotificationStyle.cs | 38 + .../NotificationStyleBinder.cs | 286 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.NotificationEventListener.cs | 298 + ...n.Applications.NotificationEventListener.csproj | 13 + ...izen.Applications.NotificationEventListener.sln | 40 + .../NotificationAccessoryArgsBinder.cs | 65 + .../NotificationButtonActionArgsBinder.cs | 58 + .../NotificationDeleteEventArgs.cs | 30 + .../NotificationDeleteEventArgsBinder.cs | 30 + .../NotificationEventArgs.cs | 185 + .../NotificationEventArgsAccessory.cs | 75 + .../NotificationEventArgsActiveStyle.cs | 89 + .../NotificationEventArgsBinder.cs | 210 + .../NotificationEventArgsButtonAction.cs | 50 + .../NotificationEventArgsEnumerations.cs | 488 + .../NotificationEventArgsIndicatorStyle.cs | 48 + .../NotificationEventArgsLockStyle.cs | 48 + .../NotificationEventArgsProgress.cs | 45 + .../NotificationEventArgsReplyAction.cs | 52 + .../NotificationEventArgsStyle.cs | 29 + .../NotificationEventListenerErrorFactory.cs | 48 + .../NotificationListenerManager.cs | 417 + .../NotificationProgressArgsBinder.cs | 50 + .../NotificationReplyActionArgsBinder.cs | 101 + .../NotificationStyleArgsBinder.cs | 94 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Package.cs | 115 + .../Interop/Interop.PackageManager.cs | 231 + .../Tizen.Applications.PackageManager.csproj | 13 + .../Tizen.Applications.PackageManager.sln | 40 + .../Tizen.Applications/CertCompareResultType.cs | 47 + .../Tizen.Applications/CertificateType.cs | 37 + .../Tizen.Applications/InstallationMode.cs | 33 + .../Tizen.Applications/Package.cs | 348 + .../Tizen.Applications/PackageCertificate.cs | 98 + .../Tizen.Applications/PackageDrm.cs | 77 + .../Tizen.Applications/PackageEventState.cs | 41 + .../Tizen.Applications/PackageEventType.cs | 45 + .../Tizen.Applications/PackageFilter.cs | 82 + .../Tizen.Applications/PackageManager.cs | 1152 ++ .../Tizen.Applications/PackageManagerEventArgs.cs | 59 + .../Tizen.Applications/PackageSizeInformation.cs | 78 + .../Tizen.Applications/PackageType.cs | 70 + .../Tizen.Applications/PermissionType.cs | 39 + .../Tizen.Applications/SafePackageManagerHandle.cs | 50 + .../SafePackageManagerRequestHandle.cs | 50 + .../Tizen.Applications/StorageType.cs | 33 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Preference.cs | 77 + .../Tizen.Applications.Preference.csproj | 14 + .../Tizen.Applications.Preference.sln | 34 + .../Tizen.Applications/Preference.cs | 463 + .../PreferenceChangedEventArgs.cs | 31 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.WidgetViewerEvas.cs | 95 + .../Tizen.Applications.RemoteView.csproj | 15 + .../Tizen.Applications.RemoteView.sln | 40 + .../Tizen.Applications/RemoteView.cs | 231 + .../Tizen.Applications/RemoteViewFactory.cs | 101 + .../Tizen.Applications/RemoteWindow.cs | 53 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Service.cs | 54 + .../ServiceCoreBackend.cs | 190 + .../Tizen.Applications.Service.csproj | 13 + .../Tizen.Applications.Service.sln | 40 + .../Tizen.Applications/ServiceApplication.cs | 42 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.ToastMessage.cs | 28 + .../Tizen.Applications.ToastMessage.csproj | 13 + .../Tizen.Applications.ToastMessage.sln | 40 + .../Tizen.Applications/ToastMessage.cs | 59 + .../Tizen.Applications/ToastMessageErrorFactory.cs | 45 + .../Interop/Interop.Application.cs | 61 + .../Interop/Interop.Libraries.cs | 23 + .../UICoreBackend.cs | 214 + .../Tizen.Applications.UI.csproj | 13 + .../Tizen.Applications.UI.sln | 40 + .../Tizen.Applications/CoreUIApplication.cs | 96 + .../Interop/Interop.Libraries.cs | 24 + .../Interop/Interop.Watch.cs | 158 + .../WatchCoreBackend.cs | 300 + .../WatchEventType.cs | 59 + .../Tizen.Applications.WatchApplication.csproj | 14 + .../Tizen.Applications.WatchApplication.sln | 46 + .../Tizen.Applications/AmbientEventArgs.cs | 36 + .../Tizen.Applications/AmbientTickType.cs | 67 + .../Tizen.Applications/SafeWatchTimeHandle.cs | 45 + .../Tizen.Applications/TimeEventArgs.cs | 35 + .../Tizen.Applications/TimeTickResolution.cs | 39 + .../Tizen.Applications/WatchApplication.cs | 342 + .../Tizen.Applications/WatchTime.cs | 234 + .../Tizen.Applications/WatchWindow.cs | 37 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.Widget.cs | 140 + .../WidgetCoreBackend.cs | 238 + .../Tizen.Applications.WidgetApplication.csproj | 14 + .../Tizen.Applications.WidgetApplication.sln | 46 + .../Tizen.Applications/WidgetApplication.cs | 82 + .../Tizen.Applications/WidgetBase.cs | 210 + .../Tizen.Applications/WidgetType.cs | 143 + .../Tizen.Applications/WidgetWindow.cs | 39 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.WidgetService.cs | 106 + .../Tizen.Applications.WidgetControl.csproj | 13 + .../Tizen.Applications.WidgetControl.sln | 40 + .../Tizen.Applications/WidgetControl.cs | 708 ++ .../Tizen.Applications/WidgetLifecycleEventArgs.cs | 71 + .../Interop/Interop.Download.cs | 110 + .../Interop/Interop.Libraries.cs | 24 + .../Tizen.Content.Download.csproj | 13 + .../Tizen.Content.Download.sln | 40 + .../Tizen.Content.Download/DownloadEnumerator.cs | 129 + .../Tizen.Content.Download/DownloadErrorFactory.cs | 94 + .../Tizen.Content.Download/Notification.cs | 237 + .../ProgressChangedEventArgs.cs | 46 + .../Tizen.Content.Download/Request.cs | 858 ++ .../StateChangedEventArgs.cs | 46 + .../Interop/Interop.AudioInformation.cs | 118 + .../Interop/Interop.Glib.cs | 31 + .../Interop/Interop.ImageInformation.cs | 91 + .../Interop/Interop.Libc.cs | 28 + .../Interop/Interop.Libraries.cs | 26 + .../Interop/Interop.MediaBookmark.cs | 50 + .../Interop/Interop.MediaContent.cs | 54 + .../Interop/Interop.MediaFace.cs | 68 + .../Interop/Interop.MediaFilter.cs | 56 + .../Interop/Interop.MediaFolder.cs | 87 + .../Interop/Interop.MediaGroup.cs | 81 + .../Interop/Interop.MediaInformation.cs | 287 + .../Interop/Interop.MediaPlaylist.cs | 96 + .../Interop/Interop.MediaStorage.cs | 66 + .../Interop/Interop.MediaTag.cs | 78 + .../Interop/Interop.VideoInformation.cs | 115 + .../Tizen.Content.MediaContent.csproj | 14 + .../Tizen.Content.MediaContent.sln | 34 + .../Tizen.Content.MediaContent/Album.cs | 224 + .../Tizen.Content.MediaContent/AudioInformation.cs | 455 + .../ContentCollection.cs | 50 + .../Tizen.Content.MediaContent/ContentColumns.cs | 1130 ++ .../Tizen.Content.MediaContent/ContentDatabase.cs | 714 ++ .../Tizen.Content.MediaContent/ContentEventArgs.cs | 113 + .../Tizen.Content.MediaContent/ContentFilter.cs | 365 + .../Tizen.Content.MediaContent/ContentManager.cs | 268 + .../Tizen.Content.MediaContent/FaceRect.cs | 59 + .../Tizen.Content.MediaContent/Group.cs | 137 + .../Tizen.Content.MediaContent/ImageInformation.cs | 347 + .../Tizen.Content.MediaContent/MediaBookmark.cs | 129 + .../MediaContentEnums.cs | 411 + .../MediaContentError.cs | 79 + .../Tizen.Content.MediaContent/MediaFace.cs | 226 + .../Tizen.Content.MediaContent/MediaFolder.cs | 330 + .../Tizen.Content.MediaContent/MediaInformation.cs | 897 ++ .../Tizen.Content.MediaContent/PlayList.cs | 341 + .../Tizen.Content.MediaContent/Storage.cs | 219 + .../Tizen.Content.MediaContent/Tag.cs | 217 + .../Tizen.Content.MediaContent/VideoInformation.cs | 431 + src/Tizen.Content.MimeType/Interop/Interop.Glib.cs | 30 + src/Tizen.Content.MimeType/Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 25 + src/Tizen.Content.MimeType/Interop/Interop.Mime.cs | 36 + .../Tizen.Content.MimeType.csproj | 14 + .../Tizen.Content.MimeType.sln | 34 + .../Tizen.Content.MimeType/MimeExceptionFactory.cs | 55 + .../Tizen.Content.MimeType/MimeUtil.cs | 96 + src/Tizen.Context/Interop/Interop.AppHistory.cs | 69 + src/Tizen.Context/Interop/Interop.Libraries.cs | 23 + .../AppHistoryErrorFactory.cs | 58 + .../Tizen.Context.AppHistory/AppStatistics.cs | 73 + .../Tizen.Context.AppHistory/AppStatisticsData.cs | 34 + .../Tizen.Context.AppHistory/BatteryStatistics.cs | 203 + .../BatteryStatisticsData.cs | 36 + .../Tizen.Context.AppHistory/UsageStatistics.cs | 191 + .../UsageStatisticsData.cs | 52 + src/Tizen.Context/Tizen.Context.csproj | 14 + src/Tizen.Context/Tizen.Context.sln | 34 + src/Tizen.Convergence/Interop/Interop.Common.cs | 41 + .../Interop/Interop.Internal.Conv.Channel.cs | 67 + .../Interop/Interop.Internal.Conv.Device.cs | 62 + .../Interop/Interop.Internal.Conv.Manager.cs | 79 + .../Interop/Interop.Internal.Conv.Payload.cs | 79 + .../Interop/Interop.Internal.Conv.Service.cs | 107 + src/Tizen.Convergence/Interop/Interop.Libc.cs | 27 + src/Tizen.Convergence/Interop/Interop.Libraries.cs | 28 + src/Tizen.Convergence/Tizen.Convergence.csproj | 14 + src/Tizen.Convergence/Tizen.Convergence.sln | 34 + .../InternalAppCommunicationService.cs | 163 + .../Tizen.Convergence/InternalChannel.cs | 116 + .../Tizen.Convergence/InternalDevice.cs | 116 + .../Tizen.Convergence/InternalDeviceFinder.cs | 133 + .../InternalDeviceFoundEventArgs.cs | 35 + .../Tizen.Convergence/InternalErrorFactory.cs | 71 + .../Tizen.Convergence/InternalPayload.cs | 219 + .../Tizen.Convergence/InternalService.cs | 192 + .../InternalServiceErrorOccuredEventArgs.cs | 35 + .../InternalServiceEventOccuredEventArgs.cs | 40 + .../Interop/Interop.Libraries.cs | 24 + .../Interop/Interop.Location.cs | 157 + .../Tizen.Location.Geofence.csproj | 14 + .../Tizen.Location.Geofence.sln | 34 + .../Tizen.Location.Geofence/Fence.cs | 302 + .../Tizen.Location.Geofence/FenceData.cs | 129 + .../Tizen.Location.Geofence/FenceStatus.cs | 126 + .../Tizen.Location.Geofence/GeofenceEnum.cs | 197 + .../GeofenceErrorFactory.cs | 174 + .../Tizen.Location.Geofence/GeofenceEventArgs.cs | 164 + .../Tizen.Location.Geofence/GeofenceManager.cs | 298 + .../Tizen.Location.Geofence/NamespaceDoc.cs | 33 + .../Tizen.Location.Geofence/VirtualPerimeter.cs | 269 + src/Tizen.Location/Interop/Interop.Libraries.cs | 24 + src/Tizen.Location/Interop/Interop.Location.cs | 212 + src/Tizen.Location/Tizen.Location.csproj | 14 + src/Tizen.Location/Tizen.Location.sln | 34 + src/Tizen.Location/Tizen.Location/GpsSatellite.cs | 359 + src/Tizen.Location/Tizen.Location/Location.cs | 246 + .../Tizen.Location/LocationBoundary.cs | 364 + .../Tizen.Location/LocationChangedEventArgs.cs | 44 + src/Tizen.Location/Tizen.Location/LocationError.cs | 111 + src/Tizen.Location/Tizen.Location/Locator.cs | 965 ++ .../Tizen.Location/LocatorEnumerations.cs | 64 + src/Tizen.Location/Tizen.Location/LocatorHelper.cs | 58 + src/Tizen.Location/Tizen.Location/NamespaceDoc.cs | 21 + .../SatelliteStatusChangedEventArgs.cs | 55 + .../Tizen.Location/ServiceStateChangedEventArgs.cs | 42 + .../Tizen.Location/SettingChangedEventArgs.cs | 47 + .../Tizen.Location/ZoneChangedEventArgs.cs | 71 + src/Tizen.Log/Interop/Interop.Dlog.cs | 67 + src/Tizen.Log/Tizen.Log.csproj | 9 + src/Tizen.Log/Tizen.Log.sln | 22 + src/Tizen.Log/Tizen/Log.cs | 224 + src/Tizen.Maps/Interop/Interop.Address.cs | 174 + src/Tizen.Maps/Interop/Interop.AddressList.cs | 66 + src/Tizen.Maps/Interop/Interop.Area.cs | 65 + src/Tizen.Maps/Interop/Interop.Coordinates.cs | 75 + src/Tizen.Maps/Interop/Interop.CoordinatesList.cs | 72 + src/Tizen.Maps/Interop/Interop.ErrorCode.cs | 107 + src/Tizen.Maps/Interop/Interop.Libraries.cs | 23 + src/Tizen.Maps/Interop/Interop.Place.Attribute.cs | 55 + src/Tizen.Maps/Interop/Interop.Place.Category.cs | 80 + src/Tizen.Maps/Interop/Interop.Place.Contact.cs | 55 + src/Tizen.Maps/Interop/Interop.Place.Editorial.cs | 55 + src/Tizen.Maps/Interop/Interop.Place.Filter.cs | 111 + src/Tizen.Maps/Interop/Interop.Place.Image.cs | 79 + .../Interop/Interop.Place.Link.Object.cs | 68 + src/Tizen.Maps/Interop/Interop.Place.Media.cs | 60 + src/Tizen.Maps/Interop/Interop.Place.Rating.cs | 53 + src/Tizen.Maps/Interop/Interop.Place.Review.cs | 84 + src/Tizen.Maps/Interop/Interop.Place.cs | 239 + src/Tizen.Maps/Interop/Interop.PlaceList.cs | 46 + src/Tizen.Maps/Interop/Interop.Preference.cs | 227 + src/Tizen.Maps/Interop/Interop.Route.Maneuver.cs | 137 + src/Tizen.Maps/Interop/Interop.Route.Segment.cs | 124 + src/Tizen.Maps/Interop/Interop.Route.cs | 154 + src/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs | 103 + src/Tizen.Maps/Interop/Interop.Service.cs | 202 + src/Tizen.Maps/Interop/Interop.View.Event.Data.cs | 179 + src/Tizen.Maps/Interop/Interop.View.Marker.cs | 102 + src/Tizen.Maps/Interop/Interop.View.Object.cs | 73 + src/Tizen.Maps/Interop/Interop.View.Overlay.cs | 72 + src/Tizen.Maps/Interop/Interop.View.Polygon.cs | 79 + src/Tizen.Maps/Interop/Interop.View.Polyline.cs | 91 + src/Tizen.Maps/Interop/Interop.View.Snapshot.cs | 32 + src/Tizen.Maps/Interop/Interop.View.cs | 258 + src/Tizen.Maps/Tizen.Maps.csproj | 34 + src/Tizen.Maps/Tizen.Maps.sln | 40 + src/Tizen.Maps/Tizen.Maps/Area.cs | 85 + src/Tizen.Maps/Tizen.Maps/Direction.cs | 62 + src/Tizen.Maps/Tizen.Maps/DistanceUnit.cs | 42 + src/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs | 102 + src/Tizen.Maps/Tizen.Maps/Geocoordinates.cs | 104 + src/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs | 74 + src/Tizen.Maps/Tizen.Maps/GestureType.cs | 58 + src/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs | 41 + .../Tizen.Maps/IPlaceSearchPreference.cs | 60 + .../Tizen.Maps/IRouteSearchPreference.cs | 62 + src/Tizen.Maps/Tizen.Maps/Log.cs | 56 + src/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs | 77 + src/Tizen.Maps/Tizen.Maps/MapObject.cs | 40 + src/Tizen.Maps/Tizen.Maps/MapService.cs | 385 + src/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs | 118 + src/Tizen.Maps/Tizen.Maps/MapTypes.cs | 42 + src/Tizen.Maps/Tizen.Maps/MapView.cs | 780 ++ src/Tizen.Maps/Tizen.Maps/Marker.cs | 266 + .../Tizen.Maps/MultiReverseGeocodeRequest.cs | 67 + src/Tizen.Maps/Tizen.Maps/NamespaceDoc.cs | 132 + src/Tizen.Maps/Tizen.Maps/Overlay.cs | 191 + src/Tizen.Maps/Tizen.Maps/Place.cs | 264 + src/Tizen.Maps/Tizen.Maps/PlaceAddress.cs | 252 + src/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs | 84 + src/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs | 71 + src/Tizen.Maps/Tizen.Maps/PlaceCategory.cs | 108 + src/Tizen.Maps/Tizen.Maps/PlaceContact.cs | 71 + src/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs | 70 + src/Tizen.Maps/Tizen.Maps/PlaceFilter.cs | 135 + src/Tizen.Maps/Tizen.Maps/PlaceImage.cs | 80 + src/Tizen.Maps/Tizen.Maps/PlaceLink.cs | 65 + src/Tizen.Maps/Tizen.Maps/PlaceList.cs | 74 + src/Tizen.Maps/Tizen.Maps/PlaceMedia.cs | 56 + src/Tizen.Maps/Tizen.Maps/PlaceRating.cs | 58 + src/Tizen.Maps/Tizen.Maps/PlaceReview.cs | 93 + src/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs | 102 + src/Tizen.Maps/Tizen.Maps/Polygon.cs | 154 + src/Tizen.Maps/Tizen.Maps/Polyline.cs | 171 + src/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs | 67 + src/Tizen.Maps/Tizen.Maps/Route.cs | 182 + src/Tizen.Maps/Tizen.Maps/RouteFeature.cs | 70 + src/Tizen.Maps/Tizen.Maps/RouteFeatureWeight.cs | 46 + src/Tizen.Maps/Tizen.Maps/RouteManeuver.cs | 96 + src/Tizen.Maps/Tizen.Maps/RouteOptimization.cs | 53 + src/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs | 123 + src/Tizen.Maps/Tizen.Maps/RouteSegment.cs | 88 + src/Tizen.Maps/Tizen.Maps/SearchPreference.cs | 254 + src/Tizen.Maps/Tizen.Maps/ServiceData.cs | 96 + src/Tizen.Maps/Tizen.Maps/ServiceRequestType.cs | 85 + src/Tizen.Maps/Tizen.Maps/SnapshotType.cs | 34 + src/Tizen.Maps/Tizen.Maps/TransportMode.cs | 46 + src/Tizen.Maps/Tizen.Maps/TurnInstruction.cs | 86 + src/Tizen.Maps/res/maps_marker_pin_48.png | Bin 0 -> 1185 bytes src/Tizen.Maps/res/maps_marker_pin_72.png | Bin 0 -> 1725 bytes src/Tizen.Maps/res/maps_marker_sticker_48.png | Bin 0 -> 961 bytes src/Tizen.Maps/res/maps_marker_sticker_72.png | Bin 0 -> 1379 bytes src/Tizen.Messaging.Push/Interop/Interop.Glib.cs | 30 + src/Tizen.Messaging.Push/Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.PushClient.cs | 113 + .../Tizen.Messaging.Push.csproj | 14 + src/Tizen.Messaging.Push/Tizen.Messaging.Push.sln | 34 + .../Tizen.Messaging.Push/PushClient.cs | 191 + .../PushConnectionStateEventArgs.cs | 85 + .../Tizen.Messaging.Push/PushExceptionFactory.cs | 83 + .../Tizen.Messaging.Push/PushImpl.cs | 243 + .../Tizen.Messaging.Push/PushMessageEventArgs.cs | 121 + .../Tizen.Messaging.Push/ServerResponse.cs | 73 + src/Tizen.Messaging/Interop/Interop.Email.cs | 70 + src/Tizen.Messaging/Interop/Interop.Libraries.cs | 24 + src/Tizen.Messaging/Interop/Interop.Messages.cs | 124 + .../Tizen.Messaging.Email/EmailAttachment.cs | 36 + .../Tizen.Messaging.Email/EmailEnumerations.cs | 34 + .../Tizen.Messaging.Email/EmailErrorFactory.cs | 96 + .../Tizen.Messaging.Email/EmailMessage.cs | 229 + .../Tizen.Messaging.Email/EmailRecipient.cs | 36 + .../Tizen.Messaging.Email/EmailSender.cs | 72 + .../Tizen.Messaging.Email/NamespaceDoc.cs | 26 + .../Tizen.Messaging.Messages/CBMessage.cs | 30 + .../Tizen.Messaging.Messages/Message.cs | 335 + .../MessageReceivedEventArgs.cs | 44 + .../Tizen.Messaging.Messages/MessagesAddress.cs | 45 + .../Tizen.Messaging.Messages/MessagesAttachment.cs | 45 + .../MessagesEnumerations.cs | 152 + .../MessagesErrorFactory.cs | 74 + .../Tizen.Messaging.Messages/MessagesEvent.cs | 125 + .../Tizen.Messaging.Messages/MessagesManager.cs | 77 + .../MessagesManagerImpl.cs | 233 + .../MessagesSearchFilter.cs | 48 + .../Tizen.Messaging.Messages/MmsMessage.cs | 162 + .../Tizen.Messaging.Messages/NamespaceDoc.cs | 25 + .../Tizen.Messaging.Messages/PushMessage.cs | 30 + .../Tizen.Messaging.Messages/SmsMessage.cs | 49 + src/Tizen.Messaging/Tizen.Messaging.csproj | 14 + src/Tizen.Messaging/Tizen.Messaging.sln | 34 + .../AudioIO/AudioCapture.cs | 397 + .../AudioIO/AudioDataAvailableEventArgs.cs | 36 + .../AudioIO/AudioIOEnums.cs | 80 + .../AudioIO/AudioIOStateChangedEventArgs.cs | 48 + .../AudioIO/AudioIOUtil.cs | 95 + .../AudioIO/AudioPlayback.cs | 386 + .../AudioPlaybackBufferAvailableEventArgs.cs | 30 + .../Interop/Interop.AudioIO.cs | 137 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.TonePlayer.cs | 33 + .../Interop/Interop.WavPlayer.cs | 36 + src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs | 31 + .../Tizen.Multimedia.AudioIO.csproj | 13 + .../Tizen.Multimedia.AudioIO.sln | 58 + .../TonePlayer/TonePlayer.cs | 136 + .../TonePlayer/TonePlayerError.cs | 57 + .../TonePlayer/ToneType.cs | 470 + src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs | 31 + .../WavPlayer/WavPlayer.cs | 119 + .../WavPlayer/WavPlayerError.cs | 58 + src/Tizen.Multimedia.Camera/Camera/Camera.cs | 1004 ++ .../Camera/CameraCapabilities.cs | 794 ++ .../Camera/CameraCapturingEventArgs.cs | 52 + .../Camera/CameraDeviceStateChangedEventArgs.cs | 46 + .../Camera/CameraDisplaySettings.cs | 175 + src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs | 860 ++ .../Camera/CameraErrorFactory.cs | 89 + .../Camera/CameraErrorOccurredEventArgs.cs | 46 + .../Camera/CameraException.cs | 53 + .../Camera/CameraFocusStateChangedEventArgs.cs | 39 + .../Camera/CameraInterruptStartedEventArgs.cs | 44 + .../Camera/CameraInterruptedEventArgs.cs | 53 + .../Camera/CameraSettings.cs | 1160 ++ .../Camera/CameraStateChangedEventArgs.cs | 54 + src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs | 47 + src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs | 39 + .../Camera/FaceDetectedEventArgs.cs | 40 + .../Camera/FaceDetectionData.cs | 77 + .../Camera/HdrCaptureProgressEventArgs.cs | 38 + .../Camera/IPreviewPlane.cs | 22 + src/Tizen.Multimedia.Camera/Camera/Location.cs | 56 + .../Camera/MediaPacketPreviewEventArgs.cs | 38 + .../Camera/PreviewEventArgs.cs | 38 + src/Tizen.Multimedia.Camera/Camera/PreviewFrame.cs | 117 + src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs | 39 + src/Tizen.Multimedia.Camera/Camera/StillImage.cs | 79 + src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs | 55 + .../Interop/Interop.Camera.cs | 282 + .../Interop/Interop.CameraCapabilities.cs | 160 + .../Interop/Interop.CameraDisplay.cs | 58 + .../Interop/Interop.CameraSettings.cs | 235 + .../Interop/Interop.Libraries.cs | 23 + .../Tizen.Multimedia.Camera.csproj | 13 + .../Tizen.Multimedia.Camera.sln | 52 + .../Interop/Interop.Libraries.cs | 27 + .../Interop/Interop.MediaCodec.cs | 124 + .../Interop/Interop.MediaTool.cs | 14 + .../MediaCodec/BufferStatusChangedEventArgs.cs | 41 + .../MediaCodec/InputProcessedEventArgs.cs | 43 + .../MediaCodec/MediaCodec.cs | 691 ++ .../MediaCodec/MediaCodecError.cs | 54 + .../MediaCodec/MediaCodecErrorOccurredEventArgs.cs | 40 + .../MediaCodec/MediaCodecStatus.cs | 34 + .../MediaCodec/MediaCodecType.cs | 47 + .../MediaCodec/OutputAvailableEventArgs.cs | 37 + .../MediaCodec/SupportedCodecType.cs | 52 + .../Tizen.Multimedia.MediaCodec.csproj | 13 + .../Tizen.Multimedia.MediaCodec.sln | 52 + .../Interop/Interop.AudioEffect.cs | 53 + .../Interop/Interop.Display.cs | 46 + .../Interop/Interop.Libraries.cs | 24 + .../Interop/Interop.Player.cs | 287 + .../Player/AudioEffect.cs | 126 + .../Player/BufferingProgressChangedEventArgs.cs | 45 + .../Player/CapturedFrame.cs | 47 + .../Player/DownloadProgress.cs | 61 + .../Player/EqualizerBand.cs | 106 + .../Player/MediaBufferSource.cs | 140 + .../Player/MediaSource.cs | 46 + .../MediaStreamBufferStatusChangedEventArgs.cs | 45 + .../Player/MediaStreamConfiguration.cs | 172 + .../Player/MediaStreamSeekingOccurredEventArgs.cs | 41 + .../Player/MediaStreamSource.cs | 296 + .../Player/MediaUriSource.cs | 56 + .../Player/PlaybackInterruptedEventArgs.cs | 44 + src/Tizen.Multimedia.MediaPlayer/Player/Player.cs | 1326 +++ .../Player/PlayerDisplaySettings.cs | 155 + .../Player/PlayerEnums.cs | 287 + .../Player/PlayerError.cs | 156 + .../Player/PlayerErrorOccurredEventArgs.cs | 44 + .../Player/PlayerTrackInfo.cs | 150 + .../Player/StreamInfo.cs | 334 + .../Player/SubtitleUpdatedEventArgs.cs | 46 + .../Player/VideoFrameDecodedEventArgs.cs | 39 + .../Player/VideoStreamChangedEventArgs.cs | 59 + .../Tizen.Multimedia.MediaPlayer.csproj | 13 + .../Tizen.Multimedia.MediaPlayer.sln | 52 + .../Interop/Interop.Libc.cs | 11 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.MetadataEditor.cs | 36 + .../Interop/Interop.MetadataExtractor.cs | 55 + .../MetadataEditor/MetadataEditor.cs | 537 + .../MetadataEditor/MetadataEditorAttr.cs | 35 + .../MetadataEditor/MetadataEditorError.cs | 70 + .../MetadataExtractor/Artwork.cs | 48 + .../MetadataExtractor/Metadata.cs | 398 + .../MetadataExtractor/MetadataExtractor.cs | 318 + .../MetadataExtractor/MetadataExtractorAttr.cs | 57 + .../MetadataExtractor/MetadataExtractorError.cs | 61 + .../MetadataExtractor/SyncLyrics.cs | 48 + .../MetadataExtractor/ValueConverter.cs | 48 + .../ObjectDescriptionBuilder.cs | 59 + .../Tizen.Multimedia.Metadata.csproj | 13 + .../Tizen.Multimedia.Metadata.sln | 40 + .../Interop/Interop.Libraries.cs | 26 + .../Interop/Interop.Radio.cs | 136 + src/Tizen.Multimedia.Radio/Radio/Radio.cs | 391 + src/Tizen.Multimedia.Radio/Radio/RadioError.cs | 69 + .../Radio/RadioInterruptedEventArgs.cs | 43 + .../Radio/RadioInterruptedReason.cs | 29 + src/Tizen.Multimedia.Radio/Radio/RadioState.cs | 37 + .../Radio/ScanUpdatedEventArgs.cs | 45 + .../Tizen.Multimedia.Radio.csproj | 14 + .../Tizen.Multimedia.Radio.sln | 52 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Recorder.cs | 121 + .../Interop/Interop.RecorderFeatures.cs | 49 + .../Interop/Interop.RecorderSettings.cs | 119 + .../Recorder/AudioStreamDeliveredEventArgs.cs | 67 + .../Recorder/MuxedStreamEventArgs.cs | 53 + src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs | 482 + .../Recorder/RecorderEnums.cs | 217 + .../Recorder/RecorderErrorFactory.cs | 83 + .../Recorder/RecorderFeatures.cs | 192 + .../Recorder/RecorderInterruptedEventArgs.cs | 53 + .../Recorder/RecorderSettings.cs | 449 + .../Recorder/RecorderStateChangedEventArgs.cs | 53 + .../Recorder/RecordingErrorOccurredEventArgs.cs | 46 + .../Recorder/RecordingLimitReachedEventArgs.cs | 37 + .../Recorder/RecordingProgressEventArgs.cs | 44 + .../Tizen.Multimedia.Recorder.csproj | 15 + .../Tizen.Multimedia.Recorder.sln | 64 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.MediaController.cs | 202 + .../Interop/Interop.ScreenMirroring.cs | 100 + .../MediaController/CustomCommandEventArgs.cs | 57 + .../MediaController/CustomCommandReplyEventArgs.cs | 57 + .../MediaController/MediaControllerClient.cs | 595 + .../MediaController/MediaControllerEnums.cs | 236 + .../MediaController/MediaControllerError.cs | 57 + .../MediaController/MediaControllerLog.cs | 25 + .../MediaController/MediaControllerMetadata.cs | 123 + .../MediaController/MediaControllerPlayback.cs | 76 + .../MediaController/MediaControllerServer.cs | 302 + .../MediaController/MetadataUpdatedEventArgs.cs | 49 + .../PlaybackStateCommandEventArgs.cs | 49 + .../MediaController/PlaybackUpdatedEventArgs.cs | 49 + .../MediaController/RepeatModeUpdatedEventArgs.cs | 49 + .../MediaController/ServerInformation.cs | 45 + .../MediaController/ServerUpdatedEventArgs.cs | 42 + .../MediaController/ShuffleModeUpdatedEventArgs.cs | 49 + .../ScreenMirroring/EventArgs.cs | 52 + .../ScreenMirroring/InteropHelper.cs | 30 + .../ScreenMirroring/ScreenMirroring.cs | 533 + .../ScreenMirroring/ScreenMirroringAudioInfo.cs | 100 + .../ScreenMirroring/ScreenMirroringEnums.cs | 148 + .../ScreenMirroring/ScreenMirroringError.cs | 69 + .../ScreenMirroring/ScreenMirroringVideoInfo.cs | 84 + .../Tizen.Multimedia.Remoting.csproj | 13 + .../Tizen.Multimedia.Remoting.sln | 52 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.StreamRecorder.cs | 186 + .../StreamRecorder/StreamRecorder.cs | 1054 ++ .../StreamRecorder/StreamRecorderEnums.cs | 197 + .../StreamRecorder/StreamRecorderErrorFactory.cs | 60 + .../StreamRecorderNotifiedEventArgs.cs | 66 + .../StreamRecorderVideoResolution.cs | 87 + .../StreamRecordingBufferConsumedEventArgs.cs | 42 + .../StreamRecordingErrorOccurredEventArgs.cs | 55 + .../StreamRecordingLimitReachedEventArgs.cs | 42 + .../Tizen.Multimedia.StreamRecorder.csproj | 13 + .../Tizen.Multimedia.StreamRecorder.sln | 46 + src/Tizen.Multimedia.Util/ImageUtil/BitmapFrame.cs | 50 + src/Tizen.Multimedia.Util/ImageUtil/GifFrame.cs | 61 + .../ImageUtil/ImageColorSpace.cs | 172 + .../ImageUtil/ImageDecoder.cs | 382 + .../ImageUtil/ImageEncoder.cs | 462 + src/Tizen.Multimedia.Util/ImageUtil/ImageFormat.cs | 41 + .../ImageUtil/ImageRotation.cs | 50 + .../ImageUtil/ImageTransform.cs | 596 + .../ImageUtil/ImageTransformer.cs | 91 + src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs | 129 + .../ImageUtil/ImageUtilError.cs | 81 + .../ImageUtil/JpegDownscale.cs | 41 + .../ImageUtil/PngCompression.cs | 65 + .../Interop/Interop.ImageUtil.Decode.cs | 80 + .../Interop/Interop.ImageUtil.Encode.cs | 91 + .../Interop/Interop.ImageUtil.Transform.cs | 89 + .../Interop/Interop.ImageUtil.cs | 38 + .../Interop/Interop.Libraries.cs | 24 + .../Interop/Interop.ThumbnailExtractor.cs | 56 + .../ThumbnailExtractionResult.cs | 42 + .../ThumbnailExtractor/ThumbnailExtractor.cs | 240 + .../ThumbnailExtractor/ThumbnailExtractorError.cs | 74 + .../Tizen.Multimedia.Util.csproj | 13 + .../Tizen.Multimedia.Util.sln | 46 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.MediaVision.BarCode.cs | 68 + .../Interop/Interop.MediaVision.Common.cs | 192 + .../Interop/Interop.MediaVision.Face.cs | 153 + .../Interop/Interop.MediaVision.Image.cs | 111 + .../Interop/Interop.MediaVision.Surveillance.cs | 91 + src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs | 61 + .../MediaVision/BarcodeDetectionConfiguration.cs | 56 + .../MediaVision/BarcodeDetectionTarget.cs | 43 + .../MediaVision/BarcodeDetector.cs | 119 + .../MediaVision/BarcodeGenerationConfiguration.cs | 106 + .../MediaVision/BarcodeGenerator.cs | 357 + .../MediaVision/BarcodeImageConfiguration.cs | 135 + .../MediaVision/BarcodeImageFormat.cs | 42 + .../MediaVision/BarcodeType.cs | 71 + .../MediaVision/Colorspace.cs | 86 + .../MediaVision/EngineConfiguration.cs | 187 + .../MediaVision/ErrorCorrectionLevel.cs | 46 + .../MediaVision/EyeCondition.cs | 43 + .../MediaVision/FaceDetectionConfiguration.cs | 196 + .../MediaVision/FaceDetector.cs | 105 + .../MediaVision/FaceRecognitionConfiguration.cs | 56 + .../MediaVision/FaceRecognitionModel.cs | 310 + .../MediaVision/FaceRecognitionModelType.cs | 43 + .../MediaVision/FaceRecognitionResult.cs | 60 + .../MediaVision/FaceRecognizer.cs | 327 + .../MediaVision/FaceTracker.cs | 104 + .../MediaVision/FaceTrackingModel.cs | 182 + .../MediaVision/FaceTrackingResult.cs | 51 + .../MediaVision/FacialExpression.cs | 73 + .../MediaVision/ImageFillConfiguration.cs | 88 + .../MediaVision/ImageObject.cs | 300 + .../MediaVision/ImageRecognitionConfiguration.cs | 214 + .../MediaVision/ImageRecognitionResult.cs | 44 + .../MediaVision/ImageRecognizer.cs | 156 + .../MediaVision/ImageTracker.cs | 130 + .../MediaVision/ImageTrackingConfiguration.cs | 226 + .../MediaVision/ImageTrackingModel.cs | 173 + .../MediaVision/MediaVisionError.cs | 128 + .../MediaVision/MediaVisionSource.cs | 248 + .../MediaVision/MovementDetectedEventArgs.cs | 43 + .../MediaVision/MovementDetectionConfiguration.cs | 81 + .../MediaVision/MovementDetector.cs | 118 + .../PersonAppearanceDetectedEventArgs.cs | 58 + .../PersonAppearanceDetectionConfiguration.cs | 75 + .../MediaVision/PersonAppearanceDetector.cs | 122 + .../MediaVision/PersonRecognitionConfiguration.cs | 63 + .../MediaVision/PersonRecognitionInfo.cs | 54 + .../MediaVision/PersonRecognizedEventArgs.cs | 43 + .../MediaVision/PersonRecognizer.cs | 128 + .../MediaVision/QrConfiguration.cs | 80 + src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs | 46 + .../MediaVision/Quadrangle.cs | 58 + .../MediaVision/SurveillanceConfiguration.cs | 29 + .../MediaVision/SurveillanceEngine.cs | 159 + .../MediaVision/SurveillanceSource.cs | 76 + .../Tizen.Multimedia.Vision.csproj | 13 + .../Tizen.Multimedia.Vision.sln | 34 + src/Tizen.Multimedia/AssemblyAttrs.cs | 68 + src/Tizen.Multimedia/AudioManager/AudioDevice.cs | 110 + .../AudioDeviceConnectionChangedEventArgs.cs | 42 + .../AudioDeviceStateChangedEventArgs.cs | 42 + src/Tizen.Multimedia/AudioManager/AudioManager.cs | 198 + .../AudioManager/AudioManagerEnumerations.cs | 326 + .../AudioManager/AudioManagerErrorFactory.cs | 120 + .../AudioManager/AudioStreamPolicy.cs | 334 + src/Tizen.Multimedia/AudioManager/AudioVolume.cs | 107 + .../AudioManager/FocusStateChangedEventArgs.cs | 48 + .../AudioManager/MaxVolumeLevel.cs | 46 + .../StreamFocusStateChangedEventArgs.cs | 43 + .../AudioManager/VolumeChangedEventArgs.cs | 42 + src/Tizen.Multimedia/AudioManager/VolumeLevel.cs | 55 + src/Tizen.Multimedia/Common.Internal/Features.cs | 34 + src/Tizen.Multimedia/Common.Internal/FileUtil.cs | 44 + .../Common.Internal/IBufferOwner.cs | 64 + .../Common.Internal/LibcSupport.cs | 13 + .../Common.Internal/MultimediaDebug.cs | 31 + .../Common.Internal/MultimediaLog.cs | 76 + .../Common.Internal/ObjectKeeper.cs | 77 + .../Common.Internal/ValdiationUtil.cs | 56 + .../Common/CodecNotSupportedException.cs | 66 + src/Tizen.Multimedia/Common/ColorSpace.cs | 112 + src/Tizen.Multimedia/Common/Display.cs | 108 + src/Tizen.Multimedia/Common/FileFormatException.cs | 41 + src/Tizen.Multimedia/Common/Flips.cs | 42 + src/Tizen.Multimedia/Common/IMediaBuffer.cs | 219 + src/Tizen.Multimedia/Common/Point.cs | 103 + src/Tizen.Multimedia/Common/Range.cs | 123 + src/Tizen.Multimedia/Common/Rectangle.cs | 174 + src/Tizen.Multimedia/Common/Rotation.cs | 44 + src/Tizen.Multimedia/Common/Size.cs | 102 + src/Tizen.Multimedia/Common/Visibility.cs | 33 + src/Tizen.Multimedia/Interop/Interop.Device.cs | 53 + src/Tizen.Multimedia/Interop/Interop.EvasObject.cs | 18 + src/Tizen.Multimedia/Interop/Interop.Libc.cs | 25 + src/Tizen.Multimedia/Interop/Interop.Libraries.cs | 28 + src/Tizen.Multimedia/Interop/Interop.MediaTool.cs | 157 + .../Interop/Interop.StreamPolicy.cs | 56 + src/Tizen.Multimedia/Interop/Interop.Volume.cs | 32 + src/Tizen.Multimedia/MediaTool/MediaFormat.cs | 808 ++ .../MediaTool/MediaFormatAacType.cs | 37 + .../MediaTool/MediaFormatMimeType.cs | 363 + .../MediaTool/MediaFormatTextType.cs | 39 + src/Tizen.Multimedia/MediaTool/MediaPacket.cs | 750 ++ .../MediaTool/MediaPacketBuffer.cs | 172 + .../MediaTool/MediaPacketBufferFlags.cs | 45 + .../MediaTool/MediaPacketVideoPlane.cs | 93 + src/Tizen.Multimedia/MediaView/MediaView.cs | 36 + src/Tizen.Multimedia/Tizen.Multimedia.csproj | 15 + src/Tizen.Multimedia/Tizen.Multimedia.sln | 52 + src/Tizen.NUI/Tizen.NUI.csproj | 27 + src/Tizen.NUI/Tizen.NUI.sln | 46 + .../src/internal/AccessibilityActionSignal.cs | 148 + .../internal/AccessibilityFocusOvershotSignal.cs | 146 + src/Tizen.NUI/src/internal/AccessibilityManager.cs | 2723 +++++ src/Tizen.NUI/src/internal/ActivatedSignalType.cs | 148 + src/Tizen.NUI/src/internal/AdaptorSignalType.cs | 103 + src/Tizen.NUI/src/internal/Alignment.cs | 318 + src/Tizen.NUI/src/internal/AngleAxis.cs | 146 + src/Tizen.NUI/src/internal/AngleThresholdPair.cs | 150 + .../AnimatablePropertyComponentRegistration.cs | 109 + .../src/internal/AnimatablePropertyRegistration.cs | 114 + src/Tizen.NUI/src/internal/AnimationSignal.cs | 147 + src/Tizen.NUI/src/internal/Any.cs | 294 + src/Tizen.NUI/src/internal/Application.cs | 1323 +++ .../src/internal/ApplicationControlSignal.cs | 148 + .../src/internal/ApplicationExtensions.cs | 150 + src/Tizen.NUI/src/internal/ApplicationSignal.cs | 148 + src/Tizen.NUI/src/internal/AsyncImageLoader.cs | 138 + src/Tizen.NUI/src/internal/BaseObject.cs | 97 + src/Tizen.NUI/src/internal/BlendEquationType.cs | 27 + src/Tizen.NUI/src/internal/BlendFactorType.cs | 39 + src/Tizen.NUI/src/internal/BlendModeType.cs | 27 + src/Tizen.NUI/src/internal/BufferImage.cs | 170 + src/Tizen.NUI/src/internal/Builder.cs | 316 + src/Tizen.NUI/src/internal/ButtonSignal.cs | 148 + src/Tizen.NUI/src/internal/Camera.cs | 500 + .../src/internal/ChildPropertyRegistration.cs | 109 + src/Tizen.NUI/src/internal/ConnectionTracker.cs | 93 + .../src/internal/ConnectionTrackerInterface.cs | 77 + src/Tizen.NUI/src/internal/ControlKeySignal.cs | 151 + src/Tizen.NUI/src/internal/CustomActor.cs | 104 + src/Tizen.NUI/src/internal/CustomActorImpl.cs | 239 + .../src/internal/CustomAlgorithmInterface.cs | 147 + src/Tizen.NUI/src/internal/DaliEnumConstants.cs | 110 + src/Tizen.NUI/src/internal/DaliEventHandler.cs | 41 + src/Tizen.NUI/src/internal/DaliException.cs | 139 + .../src/internal/DefaultItemLayoutProperty.cs | 50 + .../src/internal/DefaultItemLayoutType.cs | 28 + src/Tizen.NUI/src/internal/DefaultRuler.cs | 101 + src/Tizen.NUI/src/internal/DepthFunctionType.cs | 32 + src/Tizen.NUI/src/internal/DepthTestModeType.cs | 27 + src/Tizen.NUI/src/internal/DepthWriteModeType.cs | 27 + src/Tizen.NUI/src/internal/DirectionType.cs | 26 + src/Tizen.NUI/src/internal/DisposeQueue.cs | 68 + src/Tizen.NUI/src/internal/DragAndDropDetector.cs | 116 + src/Tizen.NUI/src/internal/EncodedBufferImage.cs | 102 + src/Tizen.NUI/src/internal/EventThreadCallback.cs | 122 + src/Tizen.NUI/src/internal/FaceCullingModeType.cs | 28 + src/Tizen.NUI/src/internal/FixedRuler.cs | 106 + src/Tizen.NUI/src/internal/FloatSignal.cs | 148 + src/Tizen.NUI/src/internal/FocusChangedSignal.cs | 148 + .../src/internal/FocusGroupChangedSignal.cs | 147 + src/Tizen.NUI/src/internal/FrameBuffer.cs | 106 + src/Tizen.NUI/src/internal/FrameBufferImage.cs | 119 + src/Tizen.NUI/src/internal/FriendAssembly.cs | 29 + src/Tizen.NUI/src/internal/GaussianBlurView.cs | 248 + .../src/internal/GaussianBlurViewSignal.cs | 148 + src/Tizen.NUI/src/internal/GestureDetector.cs | 124 + src/Tizen.NUI/src/internal/HoverSignal.cs | 150 + src/Tizen.NUI/src/internal/Image.cs | 208 + src/Tizen.NUI/src/internal/ImageSignal.cs | 148 + src/Tizen.NUI/src/internal/ImfEventSignalType.cs | 149 + src/Tizen.NUI/src/internal/ImfVoidSignalType.cs | 154 + src/Tizen.NUI/src/internal/InputMethodOptions.cs | 133 + src/Tizen.NUI/src/internal/Item.cs | 150 + src/Tizen.NUI/src/internal/ItemContainer.cs | 425 + src/Tizen.NUI/src/internal/ItemFactory.cs | 177 + src/Tizen.NUI/src/internal/ItemIdContainer.cs | 453 + src/Tizen.NUI/src/internal/ItemLayout.cs | 199 + src/Tizen.NUI/src/internal/ItemRange.cs | 166 + src/Tizen.NUI/src/internal/ItemView.cs | 492 + src/Tizen.NUI/src/internal/KeyEventSignal.cs | 147 + src/Tizen.NUI/src/internal/KeyInputFocusManager.cs | 107 + src/Tizen.NUI/src/internal/KeyInputFocusSignal.cs | 149 + .../src/internal/KeyboardTypeSignalType.cs | 146 + src/Tizen.NUI/src/internal/LinearConstrainer.cs | 229 + src/Tizen.NUI/src/internal/LoadingState.cs | 27 + .../src/internal/LongPressGestureDetectedSignal.cs | 149 + .../src/internal/LongPressGestureDetector.cs | 232 + src/Tizen.NUI/src/internal/ManualPINVOKE.cs | 1043 ++ src/Tizen.NUI/src/internal/Matrix.cs | 321 + src/Tizen.NUI/src/internal/Matrix3.cs | 217 + src/Tizen.NUI/src/internal/Model3dView.cs | 309 + src/Tizen.NUI/src/internal/NDalic.cs | 981 ++ src/Tizen.NUI/src/internal/NDalicPINVOKE.cs | 11226 +++++++++++++++++++ src/Tizen.NUI/src/internal/NUICoreBackend.cs | 252 + src/Tizen.NUI/src/internal/NUIEventType.cs | 47 + src/Tizen.NUI/src/internal/NativeImage.cs | 113 + src/Tizen.NUI/src/internal/NativeImageInterface.cs | 116 + src/Tizen.NUI/src/internal/Object.cs | 41 + src/Tizen.NUI/src/internal/ObjectCreatedSignal.cs | 148 + .../src/internal/ObjectDestroyedSignal.cs | 148 + src/Tizen.NUI/src/internal/ObjectRegistry.cs | 242 + src/Tizen.NUI/src/internal/PageFactory.cs | 118 + src/Tizen.NUI/src/internal/PagePanSignal.cs | 147 + .../src/internal/PageTurnLandscapeView.cs | 92 + src/Tizen.NUI/src/internal/PageTurnPortraitView.cs | 92 + src/Tizen.NUI/src/internal/PageTurnSignal.cs | 147 + src/Tizen.NUI/src/internal/PageTurnView.cs | 603 + .../src/internal/PanGestureDetectedSignal.cs | 148 + src/Tizen.NUI/src/internal/PanGestureDetector.cs | 523 + src/Tizen.NUI/src/internal/PathConstrainer.cs | 248 + .../src/internal/PinchGestureDetectedSignal.cs | 147 + src/Tizen.NUI/src/internal/PinchGestureDetector.cs | 199 + src/Tizen.NUI/src/internal/PreFocusChangeSignal.cs | 152 + .../src/internal/ProgressBarValueChangedSignal.cs | 148 + src/Tizen.NUI/src/internal/PropertyCondition.cs | 100 + src/Tizen.NUI/src/internal/PropertyNotification.cs | 239 + src/Tizen.NUI/src/internal/PropertyNotifySignal.cs | 148 + src/Tizen.NUI/src/internal/PropertyRangeManager.cs | 141 + src/Tizen.NUI/src/internal/PropertyRanges.cs | 42 + src/Tizen.NUI/src/internal/PropertyRegistration.cs | 110 + src/Tizen.NUI/src/internal/RefObject.cs | 129 + src/Tizen.NUI/src/internal/Registry.cs | 116 + src/Tizen.NUI/src/internal/RenderBufferFormat.cs | 28 + src/Tizen.NUI/src/internal/RenderModeType.cs | 29 + src/Tizen.NUI/src/internal/RenderTask.cs | 554 + src/Tizen.NUI/src/internal/RenderTaskList.cs | 120 + src/Tizen.NUI/src/internal/RenderTaskSignal.cs | 110 + src/Tizen.NUI/src/internal/RenderingType.cs | 26 + src/Tizen.NUI/src/internal/ResizedSignal.cs | 146 + src/Tizen.NUI/src/internal/Ruler.cs | 217 + src/Tizen.NUI/src/internal/RulerDomain.cs | 195 + src/Tizen.NUI/src/internal/RulerPtr.cs | 339 + .../src/internal/SWIGTYPE_p_CallbackBase.cs | 36 + .../SWIGTYPE_p_Configuration__ContextLoss.cs | 34 + .../src/internal/SWIGTYPE_p_Dali__CallbackBase.cs | 36 + .../src/internal/SWIGTYPE_p_Dali__Constraint.cs | 34 + .../SWIGTYPE_p_Dali__CustomActorImpl__Extension.cs | 34 + .../internal/SWIGTYPE_p_Dali__FunctorDelegate.cs | 36 + .../internal/SWIGTYPE_p_Dali__Internal__Texture.cs | 34 + .../SWIGTYPE_p_Dali__Internal__TypeRegistry.cs | 34 + ...i__IntrusivePtrT_Dali__Toolkit__ItemLayout_t.cs | 34 + .../SWIGTYPE_p_Dali__RectT_unsigned_int_t.cs | 34 + .../src/internal/SWIGTYPE_p_Dali__RenderSurface.cs | 40 + ...ool_fDali__Actor_Dali__TouchEvent_const_RF_t.cs | 34 + ...ibilityManager_R_Dali__TouchEvent_const_RF_t.cs | 34 + ..._Dali__DevelActor__VisibilityChange__TypeF_t.cs | 34 + ...__SignalT_void_fDali__DragAndDropDetectorF_t.cs | 34 + ...__Toolkit__Control_Dali__Toolkit__ControlF_t.cs | 34 + ...li__Toolkit__TextEditor__InputStyle__MaskF_t.cs | 34 + ...ali__Toolkit__TextField__InputStyle__MaskF_t.cs | 34 + ...i__SignalT_void_fuint32_t_Dali__PixelDataF_t.cs | 34 + .../SWIGTYPE_p_Dali__Toolkit__ClampState.cs | 34 + ..._p_Dali__Toolkit__Internal__AsyncImageLoader.cs | 34 + ..._Dali__Toolkit__Internal__Control__Extension.cs | 34 + ...PE_p_Dali__Toolkit__Internal__TransitionData.cs | 34 + ...TYPE_p_Dali__Toolkit__Internal__Visual__Base.cs | 34 + ...TYPE_p_Dali__Toolkit__ItemFactory__Extension.cs | 34 + .../src/internal/SWIGTYPE_p_Dali__TouchEvent.cs | 34 + .../src/internal/SWIGTYPE_p_FunctorDelegate.cs | 34 + .../internal/SWIGTYPE_p_KeyboardFocusManager.cs | 34 + .../internal/SWIGTYPE_p_PropertyInputContainer.cs | 34 + src/Tizen.NUI/src/internal/SWIGTYPE_p_double.cs | 34 + .../src/internal/SWIGTYPE_p_f_float__float.cs | 34 + ...Dali__Property__Index__Dali__Property__Value.cs | 34 + ...t_int_r_q_const__Dali__Property__Value__void.cs | 34 + ...t__std__string_p_Dali__FunctorDelegate__bool.cs | 34 + ..._string_r_q_const__Dali__Property__Map__bool.cs | 34 + ...p_q_const__Dali__Any__AnyContainerBase__void.cs | 34 + .../internal/SWIGTYPE_p_f_r_Dali__Vector2__bool.cs | 34 + ...ContainerBase__p_Dali__Any__AnyContainerBase.cs | 34 + ...SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.cs | 34 + src/Tizen.NUI/src/internal/SWIGTYPE_p_float.cs | 34 + src/Tizen.NUI/src/internal/SWIGTYPE_p_int.cs | 34 + .../src/internal/SWIGTYPE_p_std__type_info.cs | 34 + src/Tizen.NUI/src/internal/SWIGTYPE_p_uint8_t.cs | 34 + .../src/internal/SWIGTYPE_p_unsigned_char.cs | 34 + .../src/internal/SWIGTYPE_p_unsigned_int.cs | 34 + .../src/internal/SWIGTYPE_p_unsigned_short.cs | 34 + .../src/internal/ScrollStateChangedSignal.cs | 149 + .../src/internal/ScrollViewPagePathEffect.cs | 86 + .../src/internal/ScrollViewSnapStartedSignal.cs | 147 + src/Tizen.NUI/src/internal/ScrollableSignal.cs | 147 + src/Tizen.NUI/src/internal/SignalConnectorType.cs | 109 + src/Tizen.NUI/src/internal/SignalObserver.cs | 112 + src/Tizen.NUI/src/internal/Size.cs | 403 + .../src/internal/SliderMarkReachedSignal.cs | 149 + .../src/internal/SliderValueChangedSignal.cs | 148 + src/Tizen.NUI/src/internal/SlotObserver.cs | 113 + src/Tizen.NUI/src/internal/SnapType.cs | 26 + src/Tizen.NUI/src/internal/StageWheelSignal.cs | 148 + .../src/internal/StateChangedSignalType.cs | 144 + src/Tizen.NUI/src/internal/StatusSignalType.cs | 148 + src/Tizen.NUI/src/internal/StencilFunctionType.cs | 32 + src/Tizen.NUI/src/internal/StencilOperationType.cs | 32 + src/Tizen.NUI/src/internal/StringValuePair.cs | 148 + src/Tizen.NUI/src/internal/StyleChangedSignal.cs | 147 + .../src/internal/TapGestureDetectedSignal.cs | 147 + src/Tizen.NUI/src/internal/TapGestureDetector.cs | 227 + src/Tizen.NUI/src/internal/TextEditorSignal.cs | 150 + src/Tizen.NUI/src/internal/TextFieldSignal.cs | 150 + src/Tizen.NUI/src/internal/TimePeriod.cs | 145 + src/Tizen.NUI/src/internal/TimerSignalType.cs | 149 + src/Tizen.NUI/src/internal/ToolkitPropertyRange.cs | 28 + src/Tizen.NUI/src/internal/TooltipPositionType.cs | 27 + src/Tizen.NUI/src/internal/TouchDataSignal.cs | 149 + src/Tizen.NUI/src/internal/TouchPoint.cs | 207 + src/Tizen.NUI/src/internal/TouchPointContainer.cs | 425 + src/Tizen.NUI/src/internal/TouchSignal.cs | 148 + src/Tizen.NUI/src/internal/Type.cs | 32 + src/Tizen.NUI/src/internal/TypeAction.cs | 110 + src/Tizen.NUI/src/internal/TypeRegistration.cs | 162 + src/Tizen.NUI/src/internal/TypeRegistry.cs | 125 + src/Tizen.NUI/src/internal/Uint16Pair.cs | 220 + src/Tizen.NUI/src/internal/VectorBase.cs | 139 + src/Tizen.NUI/src/internal/VectorUint16Pair.cs | 223 + src/Tizen.NUI/src/internal/VectorUnsignedChar.cs | 223 + src/Tizen.NUI/src/internal/VideoViewSignal.cs | 140 + src/Tizen.NUI/src/internal/ViewImpl.cs | 966 ++ src/Tizen.NUI/src/internal/ViewMode.cs | 28 + .../src/internal/ViewResourceReadySignal.cs | 149 + src/Tizen.NUI/src/internal/ViewSignal.cs | 148 + .../src/internal/ViewVisibilityChangedSignal.cs | 149 + src/Tizen.NUI/src/internal/ViewWrapperImpl.cs | 615 + src/Tizen.NUI/src/internal/VoidSignal.cs | 154 + src/Tizen.NUI/src/internal/WeakEventHandler.cs | 32 + src/Tizen.NUI/src/internal/WheelSignal.cs | 149 + src/Tizen.NUI/src/internal/WidgetViewSignal.cs | 97 + .../src/internal/WindowFocusSignalType.cs | 148 + .../src/internal/dotnetcore/AddedException.cs | 54 + src/Tizen.NUI/src/internal/dotnetcore/HandleRef.cs | 55 + src/Tizen.NUI/src/internal/doublep.cs | 138 + src/Tizen.NUI/src/internal/floatp.cs | 138 + src/Tizen.NUI/src/internal/intp.cs | 138 + src/Tizen.NUI/src/internal/uintp.cs | 139 + src/Tizen.NUI/src/internal/ushortp.cs | 138 + src/Tizen.NUI/src/public/Adaptor.cs | 518 + src/Tizen.NUI/src/public/AlphaFunction.cs | 365 + src/Tizen.NUI/src/public/Animatable.cs | 185 + src/Tizen.NUI/src/public/Animation.cs | 1155 ++ .../src/public/BaseComponents/CustomView.cs | 715 ++ .../src/public/BaseComponents/FlexContainer.cs | 265 + .../src/public/BaseComponents/ImageView.cs | 395 + .../src/public/BaseComponents/Scrollable.cs | 491 + .../src/public/BaseComponents/TableView.cs | 705 ++ .../src/public/BaseComponents/TextEditor.cs | 1375 +++ .../src/public/BaseComponents/TextField.cs | 1359 +++ .../src/public/BaseComponents/TextLabel.cs | 835 ++ .../src/public/BaseComponents/VideoView.cs | 306 + src/Tizen.NUI/src/public/BaseComponents/View.cs | 3900 +++++++ .../public/BaseComponents/VisibilityChangeType.cs | 26 + .../src/public/BaseComponents/VisualView.cs | 492 + src/Tizen.NUI/src/public/BaseHandle.cs | 343 + src/Tizen.NUI/src/public/Color.cs | 572 + src/Tizen.NUI/src/public/CustomView/Spin.cs | 389 + src/Tizen.NUI/src/public/CustomViewRegistry.cs | 490 + src/Tizen.NUI/src/public/Degree.cs | 145 + src/Tizen.NUI/src/public/DirectionBias.cs | 27 + src/Tizen.NUI/src/public/FilterModeType.cs | 31 + src/Tizen.NUI/src/public/FocusManager.cs | 752 ++ src/Tizen.NUI/src/public/Geometry.cs | 124 + src/Tizen.NUI/src/public/Gesture.cs | 218 + src/Tizen.NUI/src/public/Hover.cs | 269 + src/Tizen.NUI/src/public/ImfManager.cs | 1624 +++ src/Tizen.NUI/src/public/InputMethod.cs | 380 + src/Tizen.NUI/src/public/Key.cs | 372 + src/Tizen.NUI/src/public/KeyFrames.cs | 149 + src/Tizen.NUI/src/public/Layer.cs | 463 + src/Tizen.NUI/src/public/LongPressGesture.cs | 172 + src/Tizen.NUI/src/public/NUIApplication.cs | 229 + src/Tizen.NUI/src/public/NUIConstants.cs | 1552 +++ src/Tizen.NUI/src/public/PaddingType.cs | 319 + src/Tizen.NUI/src/public/PanGesture.cs | 355 + src/Tizen.NUI/src/public/Path.cs | 212 + src/Tizen.NUI/src/public/PinchGesture.cs | 198 + src/Tizen.NUI/src/public/PixelData.cs | 105 + src/Tizen.NUI/src/public/PixelFormat.cs | 78 + src/Tizen.NUI/src/public/Position.cs | 1029 ++ src/Tizen.NUI/src/public/Position2D.cs | 380 + src/Tizen.NUI/src/public/Property.cs | 1603 +++ src/Tizen.NUI/src/public/PropertyBuffer.cs | 88 + src/Tizen.NUI/src/public/Radian.cs | 160 + src/Tizen.NUI/src/public/Rectangle.cs | 442 + src/Tizen.NUI/src/public/RelativeVector2.cs | 416 + src/Tizen.NUI/src/public/RelativeVector3.cs | 448 + src/Tizen.NUI/src/public/RelativeVector4.cs | 480 + src/Tizen.NUI/src/public/RelayoutContainer.cs | 121 + src/Tizen.NUI/src/public/Renderer.cs | 468 + src/Tizen.NUI/src/public/Rotation.cs | 521 + src/Tizen.NUI/src/public/Sampler.cs | 94 + src/Tizen.NUI/src/public/ScrollViewEffect.cs | 75 + src/Tizen.NUI/src/public/Shader.cs | 108 + src/Tizen.NUI/src/public/Size2D.cs | 386 + src/Tizen.NUI/src/public/StyleManager.cs | 255 + src/Tizen.NUI/src/public/TTSPlayer.cs | 282 + src/Tizen.NUI/src/public/TapGesture.cs | 201 + src/Tizen.NUI/src/public/Texture.cs | 119 + src/Tizen.NUI/src/public/TextureSet.cs | 112 + src/Tizen.NUI/src/public/TextureType.cs | 25 + src/Tizen.NUI/src/public/Timer.cs | 210 + src/Tizen.NUI/src/public/Touch.cs | 243 + src/Tizen.NUI/src/public/TransitionData.cs | 103 + src/Tizen.NUI/src/public/TypeInfo.cs | 114 + src/Tizen.NUI/src/public/UIComponents/Button.cs | 732 ++ .../src/public/UIComponents/CheckBoxButton.cs | 90 + src/Tizen.NUI/src/public/UIComponents/Popup.cs | 997 ++ .../src/public/UIComponents/ProgressBar.cs | 357 + .../src/public/UIComponents/PushButton.cs | 231 + .../src/public/UIComponents/RadioButton.cs | 100 + src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs | 578 + .../src/public/UIComponents/ScrollView.cs | 919 ++ src/Tizen.NUI/src/public/UIComponents/Slider.cs | 760 ++ .../src/public/UIComponents/ToggleButton.cs | 123 + src/Tizen.NUI/src/public/Vector2.cs | 565 + src/Tizen.NUI/src/public/Vector3.cs | 727 ++ src/Tizen.NUI/src/public/Vector4.cs | 726 ++ src/Tizen.NUI/src/public/ViewWrapper.cs | 76 + src/Tizen.NUI/src/public/VisualBase.cs | 219 + src/Tizen.NUI/src/public/VisualFactory.cs | 118 + src/Tizen.NUI/src/public/VisualMaps.cs | 2329 ++++ src/Tizen.NUI/src/public/Wheel.cs | 336 + src/Tizen.NUI/src/public/WidgetView.cs | 671 ++ src/Tizen.NUI/src/public/WidgetViewManager.cs | 122 + src/Tizen.NUI/src/public/Window.cs | 1419 +++ .../Interop/Interop.Bluetooth.cs | 597 + .../Interop/Interop.Glib.cs | 30 + .../Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 25 + .../Tizen.Network.Bluetooth.csproj | 13 + .../Tizen.Network.Bluetooth.sln | 40 + .../Tizen.Network.Bluetooth/BluetoothAdapter.cs | 506 + .../BluetoothAdapterImpl.cs | 636 ++ .../Tizen.Network.Bluetooth/BluetoothAudio.cs | 105 + .../Tizen.Network.Bluetooth/BluetoothAudioImpl.cs | 174 + .../Tizen.Network.Bluetooth/BluetoothAvrcp.cs | 262 + .../Tizen.Network.Bluetooth/BluetoothAvrcpImpl.cs | 419 + .../Tizen.Network.Bluetooth/BluetoothData.cs | 499 + .../Tizen.Network.Bluetooth/BluetoothDevice.cs | 695 ++ .../BluetoothEnumerations.cs | 1202 ++ .../Tizen.Network.Bluetooth/BluetoothError.cs | 103 + .../Tizen.Network.Bluetooth/BluetoothEventArgs.cs | 1044 ++ .../Tizen.Network.Bluetooth/BluetoothGatt.cs | 966 ++ .../Tizen.Network.Bluetooth/BluetoothGattImpl.cs | 707 ++ .../Tizen.Network.Bluetooth/BluetoothHid.cs | 79 + .../Tizen.Network.Bluetooth/BluetoothHidImpl.cs | 148 + .../Tizen.Network.Bluetooth/BluetoothLeAdapter.cs | 831 ++ .../BluetoothLeAdapterImpl.cs | 452 + .../Tizen.Network.Bluetooth/BluetoothProfile.cs | 28 + .../BluetoothServerSocket.cs | 149 + .../Tizen.Network.Bluetooth/BluetoothSocket.cs | 265 + .../Tizen.Network.Bluetooth/BluetoothStructs.cs | 390 + .../Interop/Interop.Connection.cs | 337 + .../Interop/Interop.Libraries.cs | 30 + .../Tizen.Network.Connection.csproj | 14 + .../Tizen.Network.Connection.sln | 34 + .../Tizen.Network.Connection/CellularProfile.cs | 402 + .../Tizen.Network.Connection/ConnectionError.cs | 93 + .../ConnectionInternalManager.cs | 945 ++ .../Tizen.Network.Connection/ConnectionManager.cs | 628 ++ .../Tizen.Network.Connection/ConnectionProfile.cs | 450 + .../ConnectionProfileManager.cs | 268 + .../Tizen.Network.Connection/ConnectionTypes.cs | 284 + .../IAddressInformation.cs | 383 + .../Tizen.Network.Connection/WiFiProfile.cs | 247 + .../Interop/Interop.IoTConnectivity.Client.cs | 244 + .../Interop/Interop.IoTConnectivity.Common.cs | 368 + .../Interop/Interop.IoTConnectivity.Server.cs | 169 + .../Interop/Interop.Libraries.cs | 25 + .../Tizen.Network.IoTConnectivity.csproj | 14 + .../Tizen.Network.IoTConnectivity.sln | 34 + .../Tizen.Network.IoTConnectivity/Attributes.cs | 860 ++ .../CacheUpdatedEventArgs.cs | 37 + .../DeviceInformationFoundEventArgs.cs | 70 + .../Tizen.Network.IoTConnectivity/FindingError.cs | 74 + .../FindingErrorOccurredEventArgs.cs | 44 + .../IoTConnectivityClientManager.cs | 966 ++ .../IoTConnectivityErrorFactory.cs | 103 + .../IoTConnectivityServerManager.cs | 315 + .../Tizen.Network.IoTConnectivity/LiteResource.cs | 179 + .../Tizen.Network.IoTConnectivity/NamespaceDoc.cs | 12 + .../Tizen.Network.IoTConnectivity/ObservePolicy.cs | 37 + .../Tizen.Network.IoTConnectivity/ObserveType.cs | 45 + .../ObserverNotifiedEventArgs.cs | 44 + .../PlatformInformationFoundEventArgs.cs | 119 + .../PresenceEventType.cs | 42 + .../PresenceReceivedEventArgs.cs | 58 + .../QualityOfService.cs | 37 + .../RemoteResource.cs | 893 ++ .../RemoteResponse.cs | 50 + .../Representation.cs | 362 + .../Tizen.Network.IoTConnectivity/Request.cs | 103 + .../Tizen.Network.IoTConnectivity/Resource.cs | 510 + .../ResourceFoundEventArgs.cs | 54 + .../ResourceInterfaces.cs | 312 + .../ResourceOptions.cs | 474 + .../ResourcePolicy.cs | 64 + .../Tizen.Network.IoTConnectivity/ResourceQuery.cs | 563 + .../Tizen.Network.IoTConnectivity/ResourceState.cs | 37 + .../Tizen.Network.IoTConnectivity/ResourceTypes.cs | 268 + .../Tizen.Network.IoTConnectivity/Response.cs | 148 + .../Tizen.Network.IoTConnectivity/ResponseCode.cs | 62 + .../StateChangedEventArgs.cs | 37 + src/Tizen.Network.Mtp/Interop/Interop.Glib.cs | 30 + src/Tizen.Network.Mtp/Interop/Interop.Libc.cs | 27 + src/Tizen.Network.Mtp/Interop/Interop.Libraries.cs | 25 + src/Tizen.Network.Mtp/Interop/Interop.Mtp.cs | 116 + src/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj | 14 + src/Tizen.Network.Mtp/Tizen.Network.Mtp.sln | 34 + .../Tizen.Network.Mtp/MtpDevice.cs | 184 + .../Tizen.Network.Mtp/MtpEnumerations.cs | 284 + .../Tizen.Network.Mtp/MtpErrorFactory.cs | 85 + .../Tizen.Network.Mtp/MtpEventArgs.cs | 62 + .../Tizen.Network.Mtp/MtpManager.cs | 83 + .../Tizen.Network.Mtp/MtpManagerEvent.cs | 95 + .../Tizen.Network.Mtp/MtpManagerImpl.cs | 116 + .../Tizen.Network.Mtp/MtpObject.cs | 393 + .../Tizen.Network.Mtp/MtpStorage.cs | 230 + .../Tizen.Network.Mtp/NamespaceDoc.cs | 44 + src/Tizen.Network.Nfc/Interop/Interop.Glib.cs | 30 + src/Tizen.Network.Nfc/Interop/Interop.Libc.cs | 27 + src/Tizen.Network.Nfc/Interop/Interop.Libraries.cs | 25 + src/Tizen.Network.Nfc/Interop/Interop.Nfc.cs | 281 + src/Tizen.Network.Nfc/Tizen.Network.Nfc.csproj | 13 + src/Tizen.Network.Nfc/Tizen.Network.Nfc.sln | 40 + .../Tizen.Network.Nfc/NfcCallbackData.cs | 114 + .../Tizen.Network.Nfc/NfcCardEmulationAdapter.cs | 480 + .../Tizen.Network.Nfc/NfcEnumerations.cs | 441 + .../Tizen.Network.Nfc/NfcErrorFactory.cs | 90 + .../Tizen.Network.Nfc/NfcEventArgs.cs | 320 + .../Tizen.Network.Nfc/NfcManager.cs | 432 + .../Tizen.Network.Nfc/NfcManagerEvent.cs | 139 + .../Tizen.Network.Nfc/NfcManagerImpl.cs | 271 + .../Tizen.Network.Nfc/NfcNdefMessage.cs | 207 + .../Tizen.Network.Nfc/NfcNdefRecord.cs | 322 + src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2p.cs | 182 + .../Tizen.Network.Nfc/NfcP2pAdapter.cs | 127 + .../Tizen.Network.Nfc/NfcSecureElement.cs | 86 + src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs | 298 + .../Tizen.Network.Nfc/NfcTagAdapter.cs | 127 + src/Tizen.Network.Nsd/Interop/Interop.Libraries.cs | 26 + src/Tizen.Network.Nsd/Interop/Interop.Nsd.cs | 117 + src/Tizen.Network.Nsd/Tizen.Network.Nsd.csproj | 14 + src/Tizen.Network.Nsd/Tizen.Network.Nsd.sln | 34 + .../Tizen.Network.Nsd/DnssdBrowser.cs | 123 + .../Tizen.Network.Nsd/DnssdService.cs | 438 + src/Tizen.Network.Nsd/Tizen.Network.Nsd/Globals.cs | 58 + .../Tizen.Network.Nsd/INsdBrowser.cs | 50 + .../Tizen.Network.Nsd/INsdService.cs | 54 + .../Tizen.Network.Nsd/NamespaceDoc.cs | 30 + .../Tizen.Network.Nsd/NsdEnumerations.cs | 93 + .../Tizen.Network.Nsd/NsdError.cs | 77 + .../Tizen.Network.Nsd/NsdEventArgs.cs | 100 + .../Tizen.Network.Nsd/SsdpBrowser.cs | 123 + .../Tizen.Network.Nsd/SsdpService.cs | 281 + .../Interop/Interop.Glib.cs | 30 + .../Interop/Interop.Libc.cs | 27 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.Smartcard.cs | 83 + .../Tizen.Network.Smartcard.csproj | 14 + .../Tizen.Network.Smartcard.sln | 34 + .../Tizen.Network.Smartcard/SmartcardChannel.cs | 252 + .../SmartcardErrorFactory.cs | 74 + .../Tizen.Network.Smartcard/SmartcardManager.cs | 47 + .../SmartcardManagerImpl.cs | 121 + .../Tizen.Network.Smartcard/SmartcardReader.cs | 155 + .../Tizen.Network.Smartcard/SmartcardSession.cs | 242 + .../Interop/Interop.Libraries.cs | 25 + src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs | 330 + src/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj | 13 + src/Tizen.Network.WiFi/Tizen.Network.WiFi.sln | 40 + .../ConnectionStateChangedEventArgs.cs | 60 + .../DeviceStateChangedEventArgs.cs | 46 + .../Tizen.Network.WiFi/IWiFiEap.cs | 45 + .../RssiLevelChangedEventArgs.cs | 46 + .../Tizen.Network.WiFi/WiFiAP.cs | 524 + .../Tizen.Network.WiFi/WiFiAddressInformation.cs | 271 + .../Tizen.Network.WiFi/WiFiConfiguration.cs | 232 + .../Tizen.Network.WiFi/WiFiEap.cs | 325 + .../Tizen.Network.WiFi/WiFiEapConfiguration.cs | 266 + .../Tizen.Network.WiFi/WiFiEnumerations.cs | 198 + .../Tizen.Network.WiFi/WiFiErrorFactory.cs | 100 + .../Tizen.Network.WiFi/WiFiManager.cs | 378 + .../Tizen.Network.WiFi/WiFiManagerImpl.cs | 434 + .../Tizen.Network.WiFi/WiFiNetwork.cs | 336 + .../Tizen.Network.WiFi/WiFiNetworkChange.cs | 234 + .../Tizen.Network.WiFi/WiFiSecurity.cs | 174 + .../Interop/Interop.Libraries.cs | 25 + .../Interop/Interop.WiFiDirect.cs | 231 + .../Tizen.Network.WiFiDirect.csproj | 18 + .../Tizen.Network.WiFiDirect.sln | 34 + .../Tizen.Network.WiFiDirect/NamespaceDoc.cs | 7 + .../Tizen.Network.WiFiDirect/WiFiDirectData.cs | 160 + .../WiFiDirectEnumerations.cs | 649 ++ .../Tizen.Network.WiFiDirect/WiFiDirectError.cs | 65 + .../WiFiDirectEventArgs.cs | 382 + .../Tizen.Network.WiFiDirect/WiFiDirectManager.cs | 1628 +++ .../WiFiDirectManagerImpl.cs | 1248 +++ .../Tizen.Network.WiFiDirect/WiFiDirectPeer.cs | 754 ++ .../WiFiDirectPersistentGroup.cs | 57 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.PhonenumberUtils.cs | 38 + .../Tizen.PhonenumberUtils.csproj | 14 + .../Tizen.PhonenumberUtils.sln | 34 + .../Tizen.PhonenumberUtils/NamespaceDoc.cs | 7 + .../Tizen.PhonenumberUtils/PhonenumberUtils.cs | 152 + .../PhonenumberUtilsEnumerations.cs | 1138 ++ .../PhonenumberUtilsErrorFactory.cs | 61 + .../Interop/Interop.Calendar.Database.cs | 79 + .../Interop/Interop.Calendar.Filter.cs | 48 + .../Interop/Interop.Calendar.Libraries.cs | 24 + .../Interop/Interop.Calendar.List.cs | 48 + .../Interop/Interop.Calendar.Query.cs | 40 + .../Interop/Interop.Calendar.Record.cs | 82 + .../Interop/Interop.Calendar.Reminder.cs | 35 + .../Interop/Interop.Calendar.Service.cs | 39 + .../Interop/Interop.Calendar.Vcalendar.cs | 36 + src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.csproj | 14 + src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.sln | 34 + .../Tizen.Pims.Calendar/CalendarDatabase.cs | 563 + .../Tizen.Pims.Calendar/CalendarErrorFactory.cs | 114 + .../Tizen.Pims.Calendar/CalendarFilter.cs | 440 + .../Tizen.Pims.Calendar/CalendarList.cs | 245 + .../Tizen.Pims.Calendar/CalendarManager.cs | 91 + .../Tizen.Pims.Calendar/CalendarQuery.cs | 151 + .../Tizen.Pims.Calendar/CalendarRecord.cs | 452 + .../Tizen.Pims.Calendar/CalendarReminder.cs | 102 + .../Tizen.Pims.Calendar/CalendarStructs.cs | 113 + .../Tizen.Pims.Calendar/CalendarTypes.cs | 458 + .../Tizen.Pims.Calendar/CalendarVcalendar.cs | 105 + .../Tizen.Pims.Calendar/CalendarViews.cs | 1448 +++ .../Tizen.Pims.Calendar/NamespaceDoc.cs | 24 + .../Tizen.Pims.Calendar/ReminderEventArgs.cs | 42 + .../Interop/Interop.Activity.cs | 33 + .../Interop/Interop.Contacts.cs | 45 + .../Interop/Interop.Database.cs | 118 + src/Tizen.Pims.Contacts/Interop/Interop.Filter.cs | 54 + src/Tizen.Pims.Contacts/Interop/Interop.Group.cs | 39 + .../Interop/Interop.Libraries.cs | 26 + src/Tizen.Pims.Contacts/Interop/Interop.List.cs | 56 + src/Tizen.Pims.Contacts/Interop/Interop.Person.cs | 70 + .../Interop/Interop.PhoneLog.cs | 32 + src/Tizen.Pims.Contacts/Interop/Interop.Query.cs | 44 + src/Tizen.Pims.Contacts/Interop/Interop.Record.cs | 84 + src/Tizen.Pims.Contacts/Interop/Interop.Setting.cs | 59 + src/Tizen.Pims.Contacts/Interop/Interop.Sim.cs | 36 + src/Tizen.Pims.Contacts/Interop/Interop.Vcard.cs | 51 + src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.csproj | 14 + src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln | 34 + .../Tizen.Pims.Contacts/ContactsDatabase.cs | 709 ++ .../Tizen.Pims.Contacts/ContactsErrorFactory.cs | 80 + .../Tizen.Pims.Contacts/ContactsFilter.cs | 424 + .../Tizen.Pims.Contacts/ContactsList.cs | 241 + .../Tizen.Pims.Contacts/ContactsManager.cs | 284 + .../Tizen.Pims.Contacts/ContactsQuery.cs | 147 + .../Tizen.Pims.Contacts/ContactsRecord.cs | 396 + .../Tizen.Pims.Contacts/ContactsVcard.cs | 121 + .../Tizen.Pims.Contacts/ContactsViews.cs | 3236 ++++++ .../DBStatusChangedEventArgs.cs | 37 + .../NameDisplayOrderChangedEventArgs.cs | 35 + .../NameSortingOrderChangedEventArgs.cs | 35 + .../Tizen.Pims.Contacts/NamespaceDoc.cs | 23 + .../Interop/Interop.CkmcErrors.cs | 46 + .../Interop/Interop.CkmcManager.cs | 140 + .../Interop/Interop.CkmcTypes.cs | 214 + .../Interop/Interop.Libraries.cs | 23 + .../NamespaceDoc.cs | 41 + .../Tizen.Security.SecureRepository.csproj | 14 + .../Tizen.Security.SecureRepository.sln | 34 + .../Tizen.Security.SecureRepository/Certificate.cs | 129 + .../CertificateManager.cs | 306 + .../Crypto/AesCbcCipherParameters.cs | 34 + .../Crypto/AesCfbCipherParameters.cs | 34 + .../Crypto/AesCipherParameters.cs | 44 + .../Crypto/AesCtrCipherParameters.cs | 57 + .../Crypto/AesGcmCipherParameters.cs | 73 + .../Crypto/Cipher.cs | 158 + .../Crypto/CipherAlgorithmType.cs | 67 + .../Crypto/CipherParameterName.cs | 51 + .../Crypto/CipherParameters.cs | 77 + .../Crypto/DsaSignatureParameters.cs | 33 + .../Crypto/EcdsaSignatureParameters.cs | 33 + .../Crypto/HashAlgorithm.cs | 46 + .../Crypto/RsaOaepCipherParameters.cs | 34 + .../Crypto/RsaPaddingAlgorithm.cs | 38 + .../Crypto/RsaSignatureParameters.cs | 44 + .../Crypto/SafeCipherParametersHandle.cs | 113 + .../Crypto/Signature.cs | 184 + .../Crypto/SignatureAlgorithmType.cs | 38 + .../Crypto/SignatureParameterName.cs | 38 + .../Crypto/SignatureParameters.cs | 73 + .../Tizen.Security.SecureRepository/DataFormat.cs | 39 + .../Tizen.Security.SecureRepository/DataManager.cs | 130 + .../EllipticCurveType.cs | 38 + .../Tizen.Security.SecureRepository/Key.cs | 120 + .../Tizen.Security.SecureRepository/KeyManager.cs | 304 + .../Tizen.Security.SecureRepository/KeyType.cs | 58 + .../Tizen.Security.SecureRepository/Manager.cs | 114 + .../Tizen.Security.SecureRepository/OcspStatus.cs | 68 + .../Tizen.Security.SecureRepository/Permission.cs | 39 + .../PinnedObject.cs | 56 + .../Tizen.Security.SecureRepository/Pkcs12.cs | 192 + .../Pkcs12Manager.cs | 125 + .../Tizen.Security.SecureRepository/Policy.cs | 75 + .../SafeAliasListHandle.cs | 45 + .../SafeCertificateListHandle.cs | 102 + .../SafeRawBufferHandle.cs | 62 + src/Tizen.Security.TEEC/.gitignore | 1 + src/Tizen.Security.TEEC/Interop/Interop.Errors.cs | 39 + .../Interop/Interop.Libraries.cs | 23 + src/Tizen.Security.TEEC/Interop/Interop.Libteec.cs | 130 + src/Tizen.Security.TEEC/Interop/Interop.Types.cs | 79 + src/Tizen.Security.TEEC/Tizen.Security.TEEC.csproj | 14 + src/Tizen.Security.TEEC/Tizen.Security.TEEC.sln | 34 + .../Tizen.Security.TEEC/Libteec.cs | 608 + .../Tizen.Security.TEEC/NamespaceDoc.cs | 78 + src/Tizen.Security/Interop/Interop.Libraries.cs | 23 + src/Tizen.Security/Interop/Interop.Privilege.cs | 46 + src/Tizen.Security/Tizen.Security.csproj | 14 + src/Tizen.Security/Tizen.Security.sln | 46 + src/Tizen.Security/Tizen.Security/Privilege.cs | 212 + src/Tizen.Sensor/Interop/Interop.Libraries.cs | 24 + src/Tizen.Sensor/Interop/Interop.Sensor.cs | 136 + src/Tizen.Sensor/Tizen.Sensor.csproj | 13 + src/Tizen.Sensor/Tizen.Sensor.sln | 40 + .../EventArgs/AccelerometerDataUpdatedEventArgs.cs | 54 + .../FaceDownGestureDetectorDataUpdatedEventArgs.cs | 38 + .../EventArgs/GravitySensorDataUpdatedEventArgs.cs | 54 + .../EventArgs/GyroscopeDataUpdatedEventArgs.cs | 54 + ...copeRotationVectorSensorDataUpdatedEventArgs.cs | 70 + .../HeartRateMonitorDataUpdatedEventArgs.cs | 38 + .../HumiditySensorDataUpdatedEventArgs.cs | 38 + ...nVehicleActivityDetectorDataUpdatedEventArgs.cs | 38 + .../EventArgs/LightSensorDataUpdatedEventArgs.cs | 38 + ...LinearAccelerationSensorDataUpdatedEventArgs.cs | 54 + .../EventArgs/MagnetometerDataUpdatedEventArgs.cs | 54 + ...eterRotationVectorSensorDataUpdatedEventArgs.cs | 70 + .../OrientationSensorDataUpdatedEventArgs.cs | 54 + .../EventArgs/PedometerDataUpdatedEventArgs.cs | 94 + .../PickUpGestureDetectorDataUpdatedEventArgs.cs | 38 + .../PressureSensorDataUpdatedEventArgs.cs | 38 + .../ProximitySensorDataUpdatedEventArgs.cs | 38 + .../RotationVectorSensorDataUpdatedEventArgs.cs | 70 + .../RunningActivityDetectorDataUpdatedEventArgs.cs | 38 + .../EventArgs/SensorAccuracyChangedEventArgs.cs | 46 + .../EventArgs/SleepMonitorDataUpdatedEventArgs.cs | 38 + ...ationaryActivityDetectorDataUpdatedEventArgs.cs | 38 + .../TemperatureSensorDataUpdatedEventArgs.cs | 38 + .../UltravioletSensorDataUpdatedEventArgs.cs | 38 + .../UncalibratedGyroscopeDataUpdatedEventArgs.cs | 78 + ...UncalibratedMagnetometerDataUpdatedEventArgs.cs | 78 + .../WalkingActivityDetectorDataUpdatedEventArgs.cs | 38 + .../WristUpGestureDetectorDataUpdatedEventArgs.cs | 38 + .../Tizen.Sensor/Plugins/Accelerometer.cs | 152 + .../Tizen.Sensor/Plugins/ActivityDetector.cs | 49 + .../Plugins/FaceDownGestureDetector.cs | 136 + .../Tizen.Sensor/Plugins/GravitySensor.cs | 205 + src/Tizen.Sensor/Tizen.Sensor/Plugins/Gyroscope.cs | 153 + .../Plugins/GyroscopeRotationVectorSensor.cs | 169 + .../Tizen.Sensor/Plugins/HeartRateMonitor.cs | 139 + .../Tizen.Sensor/Plugins/HumiditySensor.cs | 137 + .../Plugins/InVehicleActivityDetector.cs | 138 + .../Tizen.Sensor/Plugins/LightSensor.cs | 137 + .../Plugins/LinearAccelerationSensor.cs | 205 + .../Tizen.Sensor/Plugins/Magnetometer.cs | 205 + .../Plugins/MagnetometerRotationVectorSensor.cs | 234 + .../Tizen.Sensor/Plugins/OrientationSensor.cs | 205 + src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs | 196 + .../Tizen.Sensor/Plugins/PickUpGestureDetector.cs | 148 + .../Tizen.Sensor/Plugins/PressureSensor.cs | 138 + .../Tizen.Sensor/Plugins/ProximitySensor.cs | 137 + .../Tizen.Sensor/Plugins/RotationVectorSensor.cs | 222 + .../Plugins/RunningActivityDetector.cs | 138 + .../Tizen.Sensor/Plugins/SleepMonitor.cs | 141 + .../Plugins/StationaryActivityDetector.cs | 138 + .../Tizen.Sensor/Plugins/TemperatureSensor.cs | 138 + .../Tizen.Sensor/Plugins/UltravioletSensor.cs | 138 + .../Tizen.Sensor/Plugins/UncalibratedGyroscope.cs | 177 + .../Plugins/UncalibratedMagnetometer.cs | 229 + .../Plugins/WalkingActivityDetector.cs | 138 + .../Tizen.Sensor/Plugins/WristUpGestureDetector.cs | 136 + src/Tizen.Sensor/Tizen.Sensor/Sensor.cs | 533 + .../Tizen.Sensor/SensorEnumerations.cs | 322 + .../Tizen.Sensor/SensorErrorFactory.cs | 62 + src/Tizen.System.Feedback/Feedback/Feedback.cs | 375 + .../Feedback/FeedbackPattern.cs | 33 + src/Tizen.System.Feedback/Feedback/FeedbackType.cs | 41 + .../Interop/Interop.Feedback.cs | 59 + .../Interop/Interop.Libraries.cs | 23 + .../Tizen.System.Feedback.csproj | 14 + .../Tizen.System.Feedback.sln | 34 + .../.vs/Tizen.System.Information/v14/.suo | Bin 0 -> 3584 bytes .../Interop/Interop.Libraries.cs | 24 + .../Interop/Interop.RuntimeInfo.cs | 104 + .../Interop/Interop.SystemInfo.cs | 79 + .../RuntimeInfo/CpuUsage.cs | 77 + .../RuntimeInfo/Enumerations.cs | 143 + .../RuntimeInfo/MemoryInformation.cs | 107 + .../RuntimeInfo/RuntimeInfoErrorFactory.cs | 75 + .../RuntimeInfo/RuntimeInformation.cs | 891 ++ .../RuntimeKeyStatusChangedEventArgs.cs | 35 + .../SystemInfo/SystemInfo.cs | 272 + .../Tizen.System.Information.csproj | 14 + .../Tizen.System.Information.sln | 34 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.MediaKey.cs | 60 + .../Tizen.System.MediaKey.csproj | 14 + .../Tizen.System.MediaKey.sln | 34 + src/Tizen.System.MediaKey/Tizen.System/MediaKey.cs | 176 + .../Interop/Interop.PlatformConfig.cs | 41 + .../Tizen.System.PlatformConfig.csproj | 14 + .../Tizen.System.PlatformConfig.sln | 34 + .../Tizen.System/PlatformConfig.cs | 37 + .../Interop/Interop.Libraries.cs | 23 + .../Interop/Interop.Storage.cs | 96 + src/Tizen.System.Storage/Storage/DirectoryType.cs | 71 + src/Tizen.System.Storage/Storage/Storage.cs | 224 + src/Tizen.System.Storage/Storage/StorageArea.cs | 36 + src/Tizen.System.Storage/Storage/StorageManager.cs | 53 + src/Tizen.System.Storage/Storage/StorageState.cs | 46 + .../Tizen.System.Storage.csproj | 14 + src/Tizen.System.Storage/Tizen.System.Storage.sln | 34 + .../Interop/Interop.SystemSettings.cs | 52 + .../Tizen.System.SystemSettings.csproj | 14 + .../Tizen.System.SystemSettings.sln | 34 + .../Tizen.System.SystemSettings/SystemSettings.cs | 1929 ++++ .../SystemSettingsEnums.cs | 216 + .../SystemSettingsEventArgs.cs | 712 ++ .../SystemSettingsExceptionFactory.cs | 61 + src/Tizen.System/Device/Battery.cs | 339 + src/Tizen.System/Device/DeviceEventArgs.cs | 86 + src/Tizen.System/Device/DeviceExceptionFactory.cs | 73 + src/Tizen.System/Device/Display.cs | 255 + src/Tizen.System/Device/Haptic.cs | 202 + src/Tizen.System/Device/IR.cs | 89 + src/Tizen.System/Device/Led.cs | 220 + src/Tizen.System/Device/Power.cs | 78 + src/Tizen.System/Interop/Interop.Device.cs | 101 + src/Tizen.System/Interop/Interop.Libraries.cs | 23 + src/Tizen.System/Tizen.System.csproj | 14 + src/Tizen.System/Tizen.System.sln | 34 + src/Tizen.Tapi/Interop/Interop.Libraries.cs | 25 + src/Tizen.Tapi/Interop/Interop.Tapi.cs | 371 + src/Tizen.Tapi/Tizen.Tapi.csproj | 14 + src/Tizen.Tapi/Tizen.Tapi.sln | 34 + src/Tizen.Tapi/Tizen.Tapi/Call.cs | 1187 ++ src/Tizen.Tapi/Tizen.Tapi/CallData.cs | 928 ++ src/Tizen.Tapi/Tizen.Tapi/CallEnumerations.cs | 1597 +++ src/Tizen.Tapi/Tizen.Tapi/CallStructs.cs | 362 + src/Tizen.Tapi/Tizen.Tapi/Modem.cs | 442 + src/Tizen.Tapi/Tizen.Tapi/ModemData.cs | 228 + src/Tizen.Tapi/Tizen.Tapi/ModemEnumerations.cs | 118 + src/Tizen.Tapi/Tizen.Tapi/ModemStructs.cs | 102 + src/Tizen.Tapi/Tizen.Tapi/Network.cs | 812 ++ src/Tizen.Tapi/Tizen.Tapi/NetworkData.cs | 1275 +++ src/Tizen.Tapi/Tizen.Tapi/NetworkEnumerations.cs | 490 + src/Tizen.Tapi/Tizen.Tapi/NetworkStructs.cs | 506 + src/Tizen.Tapi/Tizen.Tapi/Oem.cs | 151 + src/Tizen.Tapi/Tizen.Tapi/OemData.cs | 56 + src/Tizen.Tapi/Tizen.Tapi/OemStructs.cs | 42 + src/Tizen.Tapi/Tizen.Tapi/Phonebook.cs | 364 + src/Tizen.Tapi/Tizen.Tapi/PhonebookData.cs | 816 ++ src/Tizen.Tapi/Tizen.Tapi/PhonebookEnumerations.cs | 181 + src/Tizen.Tapi/Tizen.Tapi/PhonebookStructs.cs | 263 + src/Tizen.Tapi/Tizen.Tapi/SatData.cs | 2097 ++++ src/Tizen.Tapi/Tizen.Tapi/SatEnumerations.cs | 471 + src/Tizen.Tapi/Tizen.Tapi/SatStructs.cs | 947 ++ src/Tizen.Tapi/Tizen.Tapi/Sim.cs | 1595 +++ src/Tizen.Tapi/Tizen.Tapi/SimData.cs | 2236 ++++ src/Tizen.Tapi/Tizen.Tapi/SimEnumerations.cs | 1779 +++ src/Tizen.Tapi/Tizen.Tapi/SimStructs.cs | 1083 ++ src/Tizen.Tapi/Tizen.Tapi/SmsData.cs | 184 + src/Tizen.Tapi/Tizen.Tapi/SmsEnumerations.cs | 323 + src/Tizen.Tapi/Tizen.Tapi/SmsStructs.cs | 162 + src/Tizen.Tapi/Tizen.Tapi/Ss.cs | 534 + src/Tizen.Tapi/Tizen.Tapi/SsData.cs | 784 ++ src/Tizen.Tapi/Tizen.Tapi/SsEnumerations.cs | 836 ++ src/Tizen.Tapi/Tizen.Tapi/SsStructs.cs | 312 + src/Tizen.Tapi/Tizen.Tapi/TapiEnumerations.cs | 621 + src/Tizen.Tapi/Tizen.Tapi/TapiEventArgs.cs | 118 + src/Tizen.Tapi/Tizen.Tapi/TapiHandle.cs | 685 ++ src/Tizen.Tapi/Tizen.Tapi/TapiManager.cs | 170 + src/Tizen.Tapi/Tizen.Tapi/TapiUtility.cs | 382 + src/Tizen.Telephony/Interop/Interop.Call.cs | 87 + src/Tizen.Telephony/Interop/Interop.Libraries.cs | 29 + src/Tizen.Telephony/Interop/Interop.Modem.cs | 39 + src/Tizen.Telephony/Interop/Interop.Network.cs | 90 + src/Tizen.Telephony/Interop/Interop.Sim.cs | 66 + src/Tizen.Telephony/Interop/Interop.Telephony.cs | 78 + src/Tizen.Telephony/Tizen.Telephony.csproj | 14 + src/Tizen.Telephony/Tizen.Telephony.sln | 34 + src/Tizen.Telephony/Tizen.Telephony/Call.cs | 124 + src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs | 257 + .../Tizen.Telephony/ChangeNotificationEventArgs.cs | 319 + .../Tizen.Telephony/ExceptionFactory.cs | 77 + src/Tizen.Telephony/Tizen.Telephony/Modem.cs | 154 + src/Tizen.Telephony/Tizen.Telephony/Network.cs | 831 ++ src/Tizen.Telephony/Tizen.Telephony/Sim.cs | 465 + src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs | 309 + .../Tizen.Telephony/StateEventArgs.cs | 40 + src/Tizen.Telephony/Tizen.Telephony/Telephony.cs | 241 + src/Tizen.Tracer/Interop/Interop.Libraries.cs | 15 + src/Tizen.Tracer/Interop/Interop.Tracer.cs | 31 + src/Tizen.Tracer/Tizen.Tracer.csproj | 14 + src/Tizen.Tracer/Tizen.Tracer.sln | 34 + src/Tizen.Tracer/Tizen/Tracer.cs | 95 + .../Interop/Interop.EinaList.cs | 35 + .../Interop/Interop.InputMethod.cs | 327 + .../Interop/Interop.Libraries.cs | 31 + .../Tizen.Uix.InputMethod.csproj | 15 + .../Tizen.Uix.InputMethod.sln | 40 + .../AccessibilityStateChangedEventArgs.cs | 38 + .../CursorPositionUpdatedEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/DataSetEventArgs.cs | 49 + .../DisplayLanaguageChangedEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/EditorWindow.cs | 72 + .../Tizen.Uix.InputMethod/FocusedInEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/FocusedOutEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/InputMethodContext.cs | 493 + .../InputMethodDeviceInformation.cs | 187 + .../Tizen.Uix.InputMethod/InputMethodEditor.cs | 2133 ++++ .../InputMethodExceptionFactory.cs | 83 + .../LanguageSetSetEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/LayoutSetEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/OptionWindow.cs | 51 + .../OptionWindowCreatedEventArgs.cs | 54 + .../OptionWindowDestroyedEventArgs.cs | 38 + .../Tizen.Uix.InputMethod/PreEditAttribute.cs | 78 + .../ReturnKeyStateSetEventArgs.cs | 38 + .../ReturnKeyTypeSetEventArgs.cs | 38 + .../RotationChangedEventArgs.cs | 38 + .../SurroundingTextUpdatedArgs.cs | 58 + .../Interop/Interop.InputMethodManager.cs | 58 + .../Interop/Interop.Libraries.cs | 30 + .../Tizen.Uix.InputMethodManager.csproj | 14 + .../Tizen.Uix.InputMethodManager.sln | 34 + .../InputMethodManager.cs | 158 + .../InputMethodManagerExceptionFactory.cs | 64 + src/Tizen.Uix.Stt/Interop/Interop.Libraries.cs | 30 + src/Tizen.Uix.Stt/Interop/Interop.Stt.cs | 188 + src/Tizen.Uix.Stt/Tizen.Uix.Stt.csproj | 14 + src/Tizen.Uix.Stt/Tizen.Uix.Stt.sln | 34 + .../DefaultLanguageChangedEventArgs.cs | 53 + .../Tizen.Uix.Stt/EngineChangedEventArgs.cs | 74 + .../Tizen.Uix.Stt/ErrorOccurredEventArgs.cs | 193 + .../Tizen.Uix.Stt/ExceptionFactory.cs | 151 + .../Tizen.Uix.Stt/RecognitionResultEventArgs.cs | 149 + src/Tizen.Uix.Stt/Tizen.Uix.Stt/ResultTime.cs | 87 + .../Tizen.Uix.Stt/StateChangedEventArgs.cs | 51 + src/Tizen.Uix.Stt/Tizen.Uix.Stt/SttClient.cs | 1519 +++ src/Tizen.Uix.Stt/Tizen.Uix.Stt/SupportedEngine.cs | 64 + .../Interop/Interop.Libraries.cs | 30 + .../Interop/Interop.SttEngine.cs | 198 + src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.csproj | 14 + src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.sln | 34 + .../Tizen.Uix.SttEngine/ExceptionFactory.cs | 107 + .../Tizen.Uix.SttEngine/SttEngine.cs | 801 ++ src/Tizen.Uix.Tts/Interop/Interop.Libraries.cs | 29 + src/Tizen.Uix.Tts/Interop/Interop.Tts.cs | 172 + src/Tizen.Uix.Tts/Tizen.Uix.Tts.csproj | 14 + src/Tizen.Uix.Tts/Tizen.Uix.Tts.sln | 34 + .../Tizen.Uix.Tts/DefaultVoiceChangedEventArgs.cs | 52 + .../Tizen.Uix.Tts/EngineChangedEventArgs.cs | 65 + .../Tizen.Uix.Tts/ErrorOccurredEventArgs.cs | 161 + .../Tizen.Uix.Tts/ExceptionFactory.cs | 127 + src/Tizen.Uix.Tts/Tizen.Uix.Tts/SpeedRange.cs | 63 + .../Tizen.Uix.Tts/StateChangedEventArgs.cs | 52 + src/Tizen.Uix.Tts/Tizen.Uix.Tts/SupportedVoice.cs | 72 + src/Tizen.Uix.Tts/Tizen.Uix.Tts/TtsClient.cs | 1069 ++ .../Tizen.Uix.Tts/UtteranceEventArgs.cs | 41 + .../Interop/Interop.Libraries.cs | 30 + .../Interop/Interop.TtsEngine.cs | 180 + src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.csproj | 14 + src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.sln | 34 + .../Tizen.Uix.TtsEngine/ExceptionFactory.cs | 101 + .../Tizen.Uix.TtsEngine/TtsEngine.cs | 626 ++ .../Interop/Interop.Libraries.cs | 29 + .../Interop/Interop.VoiceControl.cs | 156 + .../Interop/Interop.VoiceControlCommand.cs | 169 + .../Tizen.Uix.VoiceControl.csproj | 14 + .../Tizen.Uix.VoiceControl.sln | 34 + .../CurrentLanguageChangedEventArgs.cs | 51 + .../ErrorOccuredEventArgs.cs | 158 + .../Tizen.Uix.VoiceControl/ExceptionFactory.cs | 148 + .../Tizen.Uix.VoiceControl/RecognitionResult.cs | 83 + .../RecognitionResultEventArgs.cs | 46 + .../ServiceStateChangedEventArgs.cs | 51 + .../StateChangedEventArgs.cs | 51 + .../Tizen.Uix.VoiceControl/VoiceCommand.cs | 209 + .../Tizen.Uix.VoiceControl/VoiceCommandList.cs | 337 + .../Tizen.Uix.VoiceControl/VoiceControlClient.cs | 958 ++ .../Interop/Interop.ChromiumEwk.Context.cs | 41 + .../Interop/Interop.ChromiumEwk.CookieManager.cs | 46 + .../Interop/Interop.ChromiumEwk.Error.cs | 49 + .../Interop/Interop.ChromiumEwk.Settings.cs | 60 + .../Interop/Interop.ChromiumEwk.View.cs | 127 + src/Tizen.WebView/Interop/Interop.ChromiumEwk.cs | 29 + src/Tizen.WebView/Interop/Interop.Elementary.cs | 37 + src/Tizen.WebView/Interop/Interop.Evas.cs | 27 + src/Tizen.WebView/Interop/Interop.Libraries.cs | 24 + src/Tizen.WebView/Tizen.WebView.csproj | 13 + src/Tizen.WebView/Tizen.WebView.sln | 28 + src/Tizen.WebView/Tizen.WebView/Chromium.cs | 39 + src/Tizen.WebView/Tizen.WebView/Context.cs | 78 + src/Tizen.WebView/Tizen.WebView/CookieManager.cs | 82 + .../Tizen.WebView/JavaScriptMessage.cs | 104 + src/Tizen.WebView/Tizen.WebView/Settings.cs | 94 + .../Tizen.WebView/SmartCallbackArgs.cs | 93 + .../Tizen.WebView/SmartCallbackLoadErrorArgs.cs | 150 + src/Tizen.WebView/Tizen.WebView/WebView.cs | 342 + src/Tizen/Interop/Interop.CommonError.cs | 35 + src/Tizen/Interop/Interop.Dlog.cs | 48 + src/Tizen/Tizen.Common/Color.cs | 349 + src/Tizen/Tizen.Internals.Errors/ErrorCode.cs | 122 + src/Tizen/Tizen.Internals.Errors/ErrorFacts.cs | 47 + src/Tizen/Tizen.csproj | 9 + src/Tizen/Tizen.sln | 22 + 1934 files changed, 344537 insertions(+), 3 deletions(-) rename binaries/{Tizen.NET.4.0.0-preview1-00050.nupkg => Tizen.NET.4.0.0-preview1-00051.nupkg} (96%) rename binaries/{Tizen.NET.4.0.0-preview1-00050.symbols.nupkg => Tizen.NET.4.0.0-preview1-00051.symbols.nupkg} (97%) rename binaries/{Tizen.NET.Private.4.0.0-preview1-00050.nupkg => Tizen.NET.Private.4.0.0-preview1-00051.nupkg} (97%) rename binaries/{Tizen.NET.Private.4.0.0-preview1-00050.symbols.nupkg => Tizen.NET.Private.4.0.0-preview1-00051.symbols.nupkg} (97%) create mode 100644 build/Open.snk create mode 100644 build/common.props create mode 100644 build/common.targets create mode 100644 build/dependencies.props create mode 100644 build/version.props create mode 100644 pkg/Tizen.NET.Private.nuspec create mode 100644 pkg/Tizen.NET.Private.sln create mode 100644 pkg/Tizen.NET.nuspec create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable.csproj create mode 100755 src/ElmSharp.Wearable/ElmSharp.Wearable.sln create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs create mode 100644 src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Evas.cs create mode 100644 src/ElmSharp.Wearable/Interop/Interop.Libraries.cs create mode 100644 src/ElmSharp/ElmSharp.csproj create mode 100755 src/ElmSharp/ElmSharp.sln create mode 100755 src/ElmSharp/ElmSharp/AccessRole.cs create mode 100755 src/ElmSharp/ElmSharp/AccessibleObject.cs create mode 100755 src/ElmSharp/ElmSharp/AccessibleRelation.cs create mode 100755 src/ElmSharp/ElmSharp/AccessibleUtil.cs create mode 100644 src/ElmSharp/ElmSharp/Background.cs create mode 100644 src/ElmSharp/ElmSharp/Box.cs create mode 100644 src/ElmSharp/ElmSharp/Button.cs create mode 100755 src/ElmSharp/ElmSharp/Calendar.cs create mode 100755 src/ElmSharp/ElmSharp/Check.cs create mode 100755 src/ElmSharp/ElmSharp/CheckStateChangedEventArgs.cs create mode 100644 src/ElmSharp/ElmSharp/Color.cs create mode 100755 src/ElmSharp/ElmSharp/ColorChangedEventArgs.cs create mode 100755 src/ElmSharp/ElmSharp/ColorSelector.cs create mode 100755 src/ElmSharp/ElmSharp/ColorSelectorItem.cs create mode 100755 src/ElmSharp/ElmSharp/Conformant.cs create mode 100755 src/ElmSharp/ElmSharp/Container.cs create mode 100755 src/ElmSharp/ElmSharp/ContextPopup.cs create mode 100755 src/ElmSharp/ElmSharp/ContextPopupItem.cs create mode 100755 src/ElmSharp/ElmSharp/DateChangedEventArgs.cs create mode 100755 src/ElmSharp/ElmSharp/DateTimeSelector.cs create mode 100755 src/ElmSharp/ElmSharp/DisplayedMonthChangedEventArgs.cs create mode 100755 src/ElmSharp/ElmSharp/EcoreAnimator.cs create mode 100755 src/ElmSharp/ElmSharp/EcoreEvent.cs create mode 100755 src/ElmSharp/ElmSharp/EcoreKeyEventArgs.cs create mode 100755 src/ElmSharp/ElmSharp/EcoreMainloop.cs create mode 100755 src/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs create mode 100644 src/ElmSharp/ElmSharp/EdjeObject.cs create mode 100755 src/ElmSharp/ElmSharp/EffectBase.cs create mode 100644 src/ElmSharp/ElmSharp/Elementary.cs create mode 100644 src/ElmSharp/ElmSharp/ElmScrollConfig.cs create mode 100755 src/ElmSharp/ElmSharp/Entry.cs create mode 100644 src/ElmSharp/ElmSharp/EvasCanvas.cs create mode 100644 src/ElmSharp/ElmSharp/EvasKeyEventArgs.cs create mode 100755 src/ElmSharp/ElmSharp/EvasMap.cs create mode 100644 src/ElmSharp/ElmSharp/EvasObject.cs create mode 100644 src/ElmSharp/ElmSharp/EvasObjectEvent.cs create mode 100755 src/ElmSharp/ElmSharp/FlipSelector.cs create mode 100755 src/ElmSharp/ElmSharp/FlipSelectorItem.cs create mode 100755 src/ElmSharp/ElmSharp/FloatingButton.cs create mode 100644 src/ElmSharp/ElmSharp/GenGrid.cs create mode 100644 src/ElmSharp/ElmSharp/GenGridItem.cs create mode 100644 src/ElmSharp/ElmSharp/GenItem.cs create mode 100644 src/ElmSharp/ElmSharp/GenItemClass.cs create mode 100644 src/ElmSharp/ElmSharp/GenList.cs create mode 100644 src/ElmSharp/ElmSharp/GenListItem.cs create mode 100644 src/ElmSharp/ElmSharp/GestureLayer.cs create mode 100644 src/ElmSharp/ElmSharp/Hoversel.cs create mode 100755 src/ElmSharp/ElmSharp/HoverselItem.cs create mode 100755 src/ElmSharp/ElmSharp/IAccessibleObject.cs create mode 100755 src/ElmSharp/ElmSharp/Icon.cs create mode 100644 src/ElmSharp/ElmSharp/Image.cs create mode 100755 src/ElmSharp/ElmSharp/Index.cs create mode 100755 src/ElmSharp/ElmSharp/IndexItem.cs create mode 100644 src/ElmSharp/ElmSharp/ItemObject.cs create mode 100755 src/ElmSharp/ElmSharp/ItemObjectExtension.cs create mode 100755 src/ElmSharp/ElmSharp/Label.cs create mode 100644 src/ElmSharp/ElmSharp/Layout.cs create mode 100755 src/ElmSharp/ElmSharp/List.cs create mode 100644 src/ElmSharp/ElmSharp/ListItem.cs create mode 100755 src/ElmSharp/ElmSharp/MultiButtonEntry.cs create mode 100755 src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs create mode 100755 src/ElmSharp/ElmSharp/NaviItem.cs create mode 100755 src/ElmSharp/ElmSharp/Naviframe.cs create mode 100755 src/ElmSharp/ElmSharp/Panel.cs create mode 100755 src/ElmSharp/ElmSharp/Panes.cs create mode 100755 src/ElmSharp/ElmSharp/Point.cs create mode 100755 src/ElmSharp/ElmSharp/Point3D.cs create mode 100755 src/ElmSharp/ElmSharp/Polygon.cs create mode 100755 src/ElmSharp/ElmSharp/Popup.cs create mode 100755 src/ElmSharp/ElmSharp/PopupItem.cs create mode 100755 src/ElmSharp/ElmSharp/ProgressBar.cs create mode 100755 src/ElmSharp/ElmSharp/Radio.cs create mode 100755 src/ElmSharp/ElmSharp/ReadingInfoType.cs create mode 100644 src/ElmSharp/ElmSharp/Rect.cs create mode 100755 src/ElmSharp/ElmSharp/Rectangle.cs create mode 100755 src/ElmSharp/ElmSharp/Scroller.cs create mode 100755 src/ElmSharp/ElmSharp/Size.cs create mode 100755 src/ElmSharp/ElmSharp/Slider.cs create mode 100755 src/ElmSharp/ElmSharp/SmartEvent.cs create mode 100755 src/ElmSharp/ElmSharp/Spinner.cs create mode 100755 src/ElmSharp/ElmSharp/Table.cs create mode 100644 src/ElmSharp/ElmSharp/Toolbar.cs create mode 100755 src/ElmSharp/ElmSharp/ToolbarItem.cs create mode 100755 src/ElmSharp/ElmSharp/Transit.cs create mode 100755 src/ElmSharp/ElmSharp/TransitEffect.cs create mode 100644 src/ElmSharp/ElmSharp/Utility.cs create mode 100755 src/ElmSharp/ElmSharp/Widget.cs create mode 100644 src/ElmSharp/ElmSharp/Window.cs create mode 100755 src/ElmSharp/ElmSharp/WrapType.cs create mode 100644 src/ElmSharp/Interop/Interop.Ecore.cs create mode 100644 src/ElmSharp/Interop/Interop.Eext.Event.cs create mode 100755 src/ElmSharp/Interop/Interop.Eext.FloatingButton.cs create mode 100644 src/ElmSharp/Interop/Interop.Eina.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Accessibility.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Bg.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Box.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Button.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.CalendarView.cs create mode 100755 src/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.CtxPopup.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Entry.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.GenGridView.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.GenListView.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.GestureLayer.cs create mode 100755 src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Image.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Index.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Item.cs create mode 100755 src/ElmSharp/Interop/Interop.Elementary.Label.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.List.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.MultiButtonEntry.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Naviframe.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Panel.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Panes.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Popup.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs create mode 100755 src/ElmSharp/Interop/Interop.Elementary.Slider.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Spinner.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Table.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Toolbar.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.Win.cs create mode 100644 src/ElmSharp/Interop/Interop.Elementary.cs create mode 100644 src/ElmSharp/Interop/Interop.Eo.cs create mode 100644 src/ElmSharp/Interop/Interop.Evas.Image.cs create mode 100644 src/ElmSharp/Interop/Interop.Evas.cs create mode 100644 src/ElmSharp/Interop/Interop.Libc.cs create mode 100644 src/ElmSharp/Interop/Interop.Libdl.cs create mode 100644 src/ElmSharp/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Account.AccountManager/Interop/Interop.Account.cs create mode 100644 src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs create mode 100644 src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs create mode 100644 src/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj create mode 100755 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.sln create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs create mode 100644 src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs create mode 100755 src/Tizen.Account.FidoClient/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Account.FidoClient/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Authenticator.cs create mode 100755 src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Client.cs create mode 100644 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.csproj create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.sln create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/AuthenticatorInformation.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/ErrorFactory.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafAuthenticatorFinder.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafClient.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafEnumerations.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafMessage.cs create mode 100755 src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafResponse.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Common.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Error.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Account.OAuth2/Interop/Interop.Manager.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Request.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Response.cs create mode 100644 src/Tizen.Account.OAuth2/Interop/Interop.Types.cs create mode 100644 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.csproj create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.sln create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AccessToken.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthenticationScheme.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationResponse.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/Authorizer.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentials.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsAuthorizer.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsTokenRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizationRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizer.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantTokenRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizationRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizer.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorFactory.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorResponse.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshToken.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshTokenRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsAuthorizer.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsTokenRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenRequest.cs create mode 100755 src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenResponse.cs create mode 100755 src/Tizen.Applications.Alarm/Interop/Interop.Alarm.cs create mode 100755 src/Tizen.Applications.Alarm/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.csproj create mode 100755 src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.sln create mode 100755 src/Tizen.Applications.Alarm/Tizen.Applications/Alarm.cs create mode 100755 src/Tizen.Applications.Alarm/Tizen.Applications/AlarmErrorFactory.cs create mode 100755 src/Tizen.Applications.Alarm/Tizen.Applications/AlarmManager.cs create mode 100755 src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs create mode 100755 src/Tizen.Applications.AttachPanel/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ResultEventArgs.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateEventArgs.cs create mode 100755 src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs create mode 100755 src/Tizen.Applications.Badge/GlobalSuppressions.cs create mode 100755 src/Tizen.Applications.Badge/Interop/Interop.Badge.cs create mode 100755 src/Tizen.Applications.Badge/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications.Badge.csproj create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications.Badge.sln create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications/Badge.cs create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications/BadgeControl.cs create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications/BadgeErrorFactory.cs create mode 100755 src/Tizen.Applications.Badge/Tizen.Applications/BadgeEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.AppCommon.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.AppControl.cs create mode 100644 src/Tizen.Applications.Common/Interop/Interop.ApplicationManager.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.Bundle.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.Glib.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Applications.Common/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications.Common.csproj create mode 100755 src/Tizen.Applications.Common/Tizen.Applications.Common.sln create mode 100755 src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/EventType.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlData.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlOperations.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlReceivedEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyCallback.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyResult.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/Application.cs create mode 100644 src/Tizen.Applications.Common/Tizen.Applications/ApplicationDisabledEventArgs.cs create mode 100644 src/Tizen.Applications.Common/Tizen.Applications/ApplicationEnabledEventArgs.cs create mode 100644 src/Tizen.Applications.Common/Tizen.Applications/ApplicationEventState.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoMetadataFilter.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationLaunchedEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs create mode 100644 src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationTerminatedEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ApplicationType.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientationEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/DirectoryInfo.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/LocaleChangedEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/LowBatteryEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/LowBatteryStatus.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/LowMemoryEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/LowMemoryStatus.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/RegionFormatChangedEventArgs.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/ResourceManager.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/SafeAppControlHandle.cs create mode 100755 src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs create mode 100644 src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs create mode 100755 src/Tizen.Applications.DataControl/Interop/Interop.DataControl.cs create mode 100755 src/Tizen.Applications.DataControl/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.Core/CloneCursorCore.cs create mode 100644 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.csproj create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.sln create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/BulkData.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Consumer.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ErrorFactory.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ICursor.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/MatrixCursor.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Provider.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Results.cs create mode 100755 src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Types.cs create mode 100755 src/Tizen.Applications.MessagePort/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.MessagePort/Interop/Interop.MessagePort.cs create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.csproj create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.sln create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePort.cs create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePortErrorFactory.cs create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessageReceivedEventArgs.cs create mode 100755 src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/RemoteValues.cs create mode 100755 src/Tizen.Applications.Notification/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Notification/Interop/Interop.Notification.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notification.csproj create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notification.sln create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySetBinder.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationErrorFactory.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationIndicatorStyle.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationLockStyle.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationMakerBase.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgress.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgressBinder.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationSafeHandle.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyle.cs create mode 100755 src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.csproj create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.sln create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationAccessoryArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationButtonActionArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgs.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsAccessory.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsButtonAction.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsIndicatorStyle.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsLockStyle.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsProgress.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsReplyAction.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsStyle.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventListenerErrorFactory.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationProgressArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationReplyActionArgsBinder.cs create mode 100755 src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs create mode 100755 src/Tizen.Applications.PackageManager/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs create mode 100755 src/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.csproj create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.sln create mode 100644 src/Tizen.Applications.PackageManager/Tizen.Applications/CertCompareResultType.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/CertificateType.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs create mode 100644 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageDrm.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventState.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventType.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageFilter.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManagerEventArgs.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageSizeInformation.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/PackageType.cs create mode 100644 src/Tizen.Applications.PackageManager/Tizen.Applications/PermissionType.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerHandle.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerRequestHandle.cs create mode 100755 src/Tizen.Applications.PackageManager/Tizen.Applications/StorageType.cs create mode 100755 src/Tizen.Applications.Preference/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Preference/Interop/Interop.Preference.cs create mode 100755 src/Tizen.Applications.Preference/Tizen.Applications.Preference.csproj create mode 100755 src/Tizen.Applications.Preference/Tizen.Applications.Preference.sln create mode 100755 src/Tizen.Applications.Preference/Tizen.Applications/Preference.cs create mode 100755 src/Tizen.Applications.Preference/Tizen.Applications/PreferenceChangedEventArgs.cs create mode 100755 src/Tizen.Applications.RemoteView/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.RemoteView/Interop/Interop.WidgetViewerEvas.cs create mode 100644 src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.csproj create mode 100755 src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.sln create mode 100755 src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteView.cs create mode 100755 src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteViewFactory.cs create mode 100755 src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteWindow.cs create mode 100755 src/Tizen.Applications.Service/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.Service/Interop/Interop.Service.cs create mode 100755 src/Tizen.Applications.Service/Tizen.Applications.CoreBackend/ServiceCoreBackend.cs create mode 100755 src/Tizen.Applications.Service/Tizen.Applications.Service.csproj create mode 100755 src/Tizen.Applications.Service/Tizen.Applications.Service.sln create mode 100755 src/Tizen.Applications.Service/Tizen.Applications/ServiceApplication.cs create mode 100755 src/Tizen.Applications.ToastMessage/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.ToastMessage/Interop/Interop.ToastMessage.cs create mode 100755 src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.csproj create mode 100755 src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.sln create mode 100755 src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessage.cs create mode 100755 src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessageErrorFactory.cs create mode 100755 src/Tizen.Applications.UI/Interop/Interop.Application.cs create mode 100755 src/Tizen.Applications.UI/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.UI/Tizen.Applications.CoreBackend/UICoreBackend.cs create mode 100755 src/Tizen.Applications.UI/Tizen.Applications.UI.csproj create mode 100755 src/Tizen.Applications.UI/Tizen.Applications.UI.sln create mode 100755 src/Tizen.Applications.UI/Tizen.Applications/CoreUIApplication.cs create mode 100755 src/Tizen.Applications.WatchApplication/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.WatchApplication/Interop/Interop.Watch.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchCoreBackend.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchEventType.cs create mode 100644 src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.csproj create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.sln create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientEventArgs.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientTickType.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/SafeWatchTimeHandle.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeEventArgs.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeTickResolution.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchApplication.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchTime.cs create mode 100755 src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchWindow.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Interop/Interop.Widget.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications.CoreBackend/WidgetCoreBackend.cs create mode 100644 src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.csproj create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.sln create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetApplication.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetBase.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetType.cs create mode 100755 src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs create mode 100755 src/Tizen.Applications.WidgetControl/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Applications.WidgetControl/Interop/Interop.WidgetService.cs create mode 100644 src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.csproj create mode 100755 src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.sln create mode 100755 src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetControl.cs create mode 100755 src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetLifecycleEventArgs.cs create mode 100755 src/Tizen.Content.Download/Interop/Interop.Download.cs create mode 100755 src/Tizen.Content.Download/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Content.Download/Tizen.Content.Download.csproj create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download.sln create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/DownloadEnumerator.cs create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/Notification.cs create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/ProgressChangedEventArgs.cs create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/Request.cs create mode 100755 src/Tizen.Content.Download/Tizen.Content.Download/StateChangedEventArgs.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.AudioInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.Glib.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.ImageInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaContent.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaFolder.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaGroup.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaPlaylist.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.MediaTag.cs create mode 100755 src/Tizen.Content.MediaContent/Interop/Interop.VideoInformation.cs create mode 100644 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.sln create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentCollection.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentColumns.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentEventArgs.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceRect.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Group.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentEnums.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs create mode 100755 src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Glib.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Content.MimeType/Interop/Interop.Mime.cs create mode 100644 src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType.sln create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs create mode 100755 src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs create mode 100644 src/Tizen.Context/Interop/Interop.AppHistory.cs create mode 100644 src/Tizen.Context/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/AppHistoryErrorFactory.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/AppStatistics.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/AppStatisticsData.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatistics.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatisticsData.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/UsageStatistics.cs create mode 100644 src/Tizen.Context/Tizen.Context.AppHistory/UsageStatisticsData.cs create mode 100644 src/Tizen.Context/Tizen.Context.csproj create mode 100755 src/Tizen.Context/Tizen.Context.sln create mode 100755 src/Tizen.Convergence/Interop/Interop.Common.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Internal.Conv.Channel.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Internal.Conv.Device.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Internal.Conv.Manager.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Internal.Conv.Payload.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Internal.Conv.Service.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Libc.cs create mode 100755 src/Tizen.Convergence/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Convergence/Tizen.Convergence.csproj create mode 100755 src/Tizen.Convergence/Tizen.Convergence.sln create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalAppCommunicationService.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalChannel.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalDevice.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFinder.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFoundEventArgs.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalErrorFactory.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalPayload.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalService.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalServiceErrorOccuredEventArgs.cs create mode 100755 src/Tizen.Convergence/Tizen.Convergence/InternalServiceEventOccuredEventArgs.cs create mode 100755 src/Tizen.Location.Geofence/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Location.Geofence/Interop/Interop.Location.cs create mode 100644 src/Tizen.Location.Geofence/Tizen.Location.Geofence.csproj create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence.sln create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/Fence.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceData.cs create mode 100644 src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceStatus.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEnum.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceErrorFactory.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEventArgs.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceManager.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/NamespaceDoc.cs create mode 100755 src/Tizen.Location.Geofence/Tizen.Location.Geofence/VirtualPerimeter.cs create mode 100755 src/Tizen.Location/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Location/Interop/Interop.Location.cs create mode 100644 src/Tizen.Location/Tizen.Location.csproj create mode 100755 src/Tizen.Location/Tizen.Location.sln create mode 100755 src/Tizen.Location/Tizen.Location/GpsSatellite.cs create mode 100755 src/Tizen.Location/Tizen.Location/Location.cs create mode 100755 src/Tizen.Location/Tizen.Location/LocationBoundary.cs create mode 100755 src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs create mode 100755 src/Tizen.Location/Tizen.Location/LocationError.cs create mode 100755 src/Tizen.Location/Tizen.Location/Locator.cs create mode 100755 src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs create mode 100755 src/Tizen.Location/Tizen.Location/LocatorHelper.cs create mode 100755 src/Tizen.Location/Tizen.Location/NamespaceDoc.cs create mode 100755 src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs create mode 100755 src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs create mode 100755 src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs create mode 100755 src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs create mode 100644 src/Tizen.Log/Interop/Interop.Dlog.cs create mode 100644 src/Tizen.Log/Tizen.Log.csproj create mode 100755 src/Tizen.Log/Tizen.Log.sln create mode 100644 src/Tizen.Log/Tizen/Log.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Address.cs create mode 100755 src/Tizen.Maps/Interop/Interop.AddressList.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Area.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Coordinates.cs create mode 100755 src/Tizen.Maps/Interop/Interop.CoordinatesList.cs create mode 100755 src/Tizen.Maps/Interop/Interop.ErrorCode.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Attribute.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Category.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Contact.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Editorial.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Filter.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Image.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Link.Object.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Media.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Rating.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.Review.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Place.cs create mode 100755 src/Tizen.Maps/Interop/Interop.PlaceList.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Preference.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Route.Maneuver.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Route.Segment.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Route.cs create mode 100755 src/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs create mode 100755 src/Tizen.Maps/Interop/Interop.Service.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Event.Data.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Marker.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Object.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Overlay.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Polygon.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Polyline.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.Snapshot.cs create mode 100755 src/Tizen.Maps/Interop/Interop.View.cs create mode 100644 src/Tizen.Maps/Tizen.Maps.csproj create mode 100755 src/Tizen.Maps/Tizen.Maps.sln create mode 100755 src/Tizen.Maps/Tizen.Maps/Area.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Direction.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/DistanceUnit.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Geocoordinates.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/GestureType.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Log.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapObject.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapService.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapTypes.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MapView.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Marker.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/NamespaceDoc.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Overlay.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Place.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceAddress.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceCategory.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceContact.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceFilter.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceImage.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceLink.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceList.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceMedia.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceRating.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceReview.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Polygon.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Polyline.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/Route.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteFeature.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteFeatureWeight.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteManeuver.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteOptimization.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/RouteSegment.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/SearchPreference.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/ServiceData.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/ServiceRequestType.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/SnapshotType.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/TransportMode.cs create mode 100755 src/Tizen.Maps/Tizen.Maps/TurnInstruction.cs create mode 100755 src/Tizen.Maps/res/maps_marker_pin_48.png create mode 100755 src/Tizen.Maps/res/maps_marker_pin_72.png create mode 100755 src/Tizen.Maps/res/maps_marker_sticker_48.png create mode 100755 src/Tizen.Maps/res/maps_marker_sticker_72.png create mode 100644 src/Tizen.Messaging.Push/Interop/Interop.Glib.cs create mode 100644 src/Tizen.Messaging.Push/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Messaging.Push/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Messaging.Push/Interop/Interop.PushClient.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push.csproj create mode 100755 src/Tizen.Messaging.Push/Tizen.Messaging.Push.sln create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushClient.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushConnectionStateEventArgs.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushMessageEventArgs.cs create mode 100644 src/Tizen.Messaging.Push/Tizen.Messaging.Push/ServerResponse.cs create mode 100755 src/Tizen.Messaging/Interop/Interop.Email.cs create mode 100644 src/Tizen.Messaging/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Messaging/Interop/Interop.Messages.cs create mode 100644 src/Tizen.Messaging/Tizen.Messaging.Email/EmailAttachment.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Email/EmailEnumerations.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Email/EmailErrorFactory.cs create mode 100644 src/Tizen.Messaging/Tizen.Messaging.Email/EmailMessage.cs create mode 100644 src/Tizen.Messaging/Tizen.Messaging.Email/EmailRecipient.cs create mode 100644 src/Tizen.Messaging/Tizen.Messaging.Email/EmailSender.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Email/NamespaceDoc.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/CBMessage.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessageReceivedEventArgs.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAddress.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAttachment.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEnumerations.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesErrorFactory.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEvent.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManager.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManagerImpl.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesSearchFilter.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/MmsMessage.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/NamespaceDoc.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/PushMessage.cs create mode 100755 src/Tizen.Messaging/Tizen.Messaging.Messages/SmsMessage.cs create mode 100644 src/Tizen.Messaging/Tizen.Messaging.csproj create mode 100755 src/Tizen.Messaging/Tizen.Messaging.sln create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs create mode 100644 src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs create mode 100644 src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs create mode 100644 src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs create mode 100644 src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs create mode 100644 src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs create mode 100644 src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj create mode 100755 src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.sln create mode 100644 src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs create mode 100644 src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerError.cs create mode 100644 src/Tizen.Multimedia.AudioIO/TonePlayer/ToneType.cs create mode 100644 src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs create mode 100644 src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs create mode 100644 src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/Camera.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraCapabilities.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs create mode 100644 src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs create mode 100644 src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs create mode 100644 src/Tizen.Multimedia.Camera/Camera/CameraException.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraInterruptStartedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs create mode 100644 src/Tizen.Multimedia.Camera/Camera/Location.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/PreviewFrame.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/StillImage.cs create mode 100755 src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs create mode 100755 src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs create mode 100755 src/Tizen.Multimedia.Camera/Interop/Interop.CameraCapabilities.cs create mode 100644 src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs create mode 100755 src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs create mode 100644 src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj create mode 100755 src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.sln create mode 100644 src/Tizen.Multimedia.MediaCodec/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaCodec.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaTool.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/BufferStatusChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/InputProcessedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodec.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecError.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecErrorOccurredEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecStatus.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecType.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/OutputAvailableEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/MediaCodec/SupportedCodecType.cs create mode 100644 src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.csproj create mode 100755 src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.sln create mode 100644 src/Tizen.Multimedia.MediaPlayer/Interop/Interop.AudioEffect.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Display.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/Player.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj create mode 100755 src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.sln create mode 100644 src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs create mode 100644 src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs create mode 100755 src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs create mode 100644 src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs create mode 100644 src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorError.cs create mode 100755 src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs create mode 100755 src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs create mode 100755 src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs create mode 100644 src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs create mode 100644 src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs create mode 100755 src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs create mode 100644 src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs create mode 100644 src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs create mode 100644 src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj create mode 100755 src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.sln create mode 100644 src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/Radio.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/RadioError.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/RadioState.cs create mode 100644 src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs create mode 100644 src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj create mode 100755 src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.sln create mode 100644 src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs create mode 100644 src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs create mode 100644 src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs create mode 100644 src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs create mode 100644 src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj create mode 100755 src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.sln create mode 100644 src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs create mode 100644 src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs create mode 100644 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs create mode 100644 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/EventArgs.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/InteropHelper.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringAudioInfo.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringError.cs create mode 100644 src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringVideoInfo.cs create mode 100644 src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj create mode 100755 src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.sln create mode 100644 src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs create mode 100644 src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj create mode 100755 src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.sln create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/BitmapFrame.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/GifFrame.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageColorSpace.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageDecoder.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageEncoder.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageFormat.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageRotation.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageTransform.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageTransformer.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/ImageUtilError.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/JpegDownscale.cs create mode 100644 src/Tizen.Multimedia.Util/ImageUtil/PngCompression.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs create mode 100755 src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractionResult.cs create mode 100755 src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs create mode 100644 src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorError.cs create mode 100644 src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj create mode 100755 src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.sln create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs create mode 100644 src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs create mode 100755 src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs create mode 100644 src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj create mode 100755 src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.sln create mode 100644 src/Tizen.Multimedia/AssemblyAttrs.cs create mode 100755 src/Tizen.Multimedia/AudioManager/AudioDevice.cs create mode 100644 src/Tizen.Multimedia/AudioManager/AudioDeviceConnectionChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia/AudioManager/AudioDeviceStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia/AudioManager/AudioManager.cs create mode 100755 src/Tizen.Multimedia/AudioManager/AudioManagerEnumerations.cs create mode 100644 src/Tizen.Multimedia/AudioManager/AudioManagerErrorFactory.cs create mode 100755 src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs create mode 100755 src/Tizen.Multimedia/AudioManager/AudioVolume.cs create mode 100644 src/Tizen.Multimedia/AudioManager/FocusStateChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia/AudioManager/MaxVolumeLevel.cs create mode 100755 src/Tizen.Multimedia/AudioManager/StreamFocusStateChangedEventArgs.cs create mode 100755 src/Tizen.Multimedia/AudioManager/VolumeChangedEventArgs.cs create mode 100644 src/Tizen.Multimedia/AudioManager/VolumeLevel.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/Features.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/FileUtil.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/LibcSupport.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs create mode 100644 src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs create mode 100644 src/Tizen.Multimedia/Common/CodecNotSupportedException.cs create mode 100644 src/Tizen.Multimedia/Common/ColorSpace.cs create mode 100644 src/Tizen.Multimedia/Common/Display.cs create mode 100644 src/Tizen.Multimedia/Common/FileFormatException.cs create mode 100644 src/Tizen.Multimedia/Common/Flips.cs create mode 100644 src/Tizen.Multimedia/Common/IMediaBuffer.cs create mode 100644 src/Tizen.Multimedia/Common/Point.cs create mode 100644 src/Tizen.Multimedia/Common/Range.cs create mode 100644 src/Tizen.Multimedia/Common/Rectangle.cs create mode 100644 src/Tizen.Multimedia/Common/Rotation.cs create mode 100644 src/Tizen.Multimedia/Common/Size.cs create mode 100644 src/Tizen.Multimedia/Common/Visibility.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.Device.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.EvasObject.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.MediaTool.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.StreamPolicy.cs create mode 100644 src/Tizen.Multimedia/Interop/Interop.Volume.cs create mode 100755 src/Tizen.Multimedia/MediaTool/MediaFormat.cs create mode 100644 src/Tizen.Multimedia/MediaTool/MediaFormatAacType.cs create mode 100755 src/Tizen.Multimedia/MediaTool/MediaFormatMimeType.cs create mode 100755 src/Tizen.Multimedia/MediaTool/MediaFormatTextType.cs create mode 100644 src/Tizen.Multimedia/MediaTool/MediaPacket.cs create mode 100644 src/Tizen.Multimedia/MediaTool/MediaPacketBuffer.cs create mode 100644 src/Tizen.Multimedia/MediaTool/MediaPacketBufferFlags.cs create mode 100644 src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs create mode 100755 src/Tizen.Multimedia/MediaView/MediaView.cs create mode 100644 src/Tizen.Multimedia/Tizen.Multimedia.csproj create mode 100755 src/Tizen.Multimedia/Tizen.Multimedia.sln create mode 100755 src/Tizen.NUI/Tizen.NUI.csproj create mode 100755 src/Tizen.NUI/Tizen.NUI.sln create mode 100755 src/Tizen.NUI/src/internal/AccessibilityActionSignal.cs create mode 100755 src/Tizen.NUI/src/internal/AccessibilityFocusOvershotSignal.cs create mode 100755 src/Tizen.NUI/src/internal/AccessibilityManager.cs create mode 100755 src/Tizen.NUI/src/internal/ActivatedSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/AdaptorSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/Alignment.cs create mode 100755 src/Tizen.NUI/src/internal/AngleAxis.cs create mode 100755 src/Tizen.NUI/src/internal/AngleThresholdPair.cs create mode 100755 src/Tizen.NUI/src/internal/AnimatablePropertyComponentRegistration.cs create mode 100755 src/Tizen.NUI/src/internal/AnimatablePropertyRegistration.cs create mode 100755 src/Tizen.NUI/src/internal/AnimationSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Any.cs create mode 100755 src/Tizen.NUI/src/internal/Application.cs create mode 100755 src/Tizen.NUI/src/internal/ApplicationControlSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ApplicationExtensions.cs create mode 100755 src/Tizen.NUI/src/internal/ApplicationSignal.cs create mode 100755 src/Tizen.NUI/src/internal/AsyncImageLoader.cs create mode 100755 src/Tizen.NUI/src/internal/BaseObject.cs create mode 100755 src/Tizen.NUI/src/internal/BlendEquationType.cs create mode 100755 src/Tizen.NUI/src/internal/BlendFactorType.cs create mode 100755 src/Tizen.NUI/src/internal/BlendModeType.cs create mode 100755 src/Tizen.NUI/src/internal/BufferImage.cs create mode 100755 src/Tizen.NUI/src/internal/Builder.cs create mode 100755 src/Tizen.NUI/src/internal/ButtonSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Camera.cs create mode 100755 src/Tizen.NUI/src/internal/ChildPropertyRegistration.cs create mode 100755 src/Tizen.NUI/src/internal/ConnectionTracker.cs create mode 100755 src/Tizen.NUI/src/internal/ConnectionTrackerInterface.cs create mode 100755 src/Tizen.NUI/src/internal/ControlKeySignal.cs create mode 100755 src/Tizen.NUI/src/internal/CustomActor.cs create mode 100755 src/Tizen.NUI/src/internal/CustomActorImpl.cs create mode 100755 src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs create mode 100755 src/Tizen.NUI/src/internal/DaliEnumConstants.cs create mode 100755 src/Tizen.NUI/src/internal/DaliEventHandler.cs create mode 100755 src/Tizen.NUI/src/internal/DaliException.cs create mode 100755 src/Tizen.NUI/src/internal/DefaultItemLayoutProperty.cs create mode 100755 src/Tizen.NUI/src/internal/DefaultItemLayoutType.cs create mode 100755 src/Tizen.NUI/src/internal/DefaultRuler.cs create mode 100755 src/Tizen.NUI/src/internal/DepthFunctionType.cs create mode 100755 src/Tizen.NUI/src/internal/DepthTestModeType.cs create mode 100755 src/Tizen.NUI/src/internal/DepthWriteModeType.cs create mode 100755 src/Tizen.NUI/src/internal/DirectionType.cs create mode 100755 src/Tizen.NUI/src/internal/DisposeQueue.cs create mode 100755 src/Tizen.NUI/src/internal/DragAndDropDetector.cs create mode 100755 src/Tizen.NUI/src/internal/EncodedBufferImage.cs create mode 100755 src/Tizen.NUI/src/internal/EventThreadCallback.cs create mode 100755 src/Tizen.NUI/src/internal/FaceCullingModeType.cs create mode 100755 src/Tizen.NUI/src/internal/FixedRuler.cs create mode 100755 src/Tizen.NUI/src/internal/FloatSignal.cs create mode 100755 src/Tizen.NUI/src/internal/FocusChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/FocusGroupChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/FrameBuffer.cs create mode 100755 src/Tizen.NUI/src/internal/FrameBufferImage.cs create mode 100755 src/Tizen.NUI/src/internal/FriendAssembly.cs create mode 100755 src/Tizen.NUI/src/internal/GaussianBlurView.cs create mode 100755 src/Tizen.NUI/src/internal/GaussianBlurViewSignal.cs create mode 100755 src/Tizen.NUI/src/internal/GestureDetector.cs create mode 100755 src/Tizen.NUI/src/internal/HoverSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Image.cs create mode 100755 src/Tizen.NUI/src/internal/ImageSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ImfEventSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/ImfVoidSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/InputMethodOptions.cs create mode 100755 src/Tizen.NUI/src/internal/Item.cs create mode 100755 src/Tizen.NUI/src/internal/ItemContainer.cs create mode 100755 src/Tizen.NUI/src/internal/ItemFactory.cs create mode 100755 src/Tizen.NUI/src/internal/ItemIdContainer.cs create mode 100755 src/Tizen.NUI/src/internal/ItemLayout.cs create mode 100755 src/Tizen.NUI/src/internal/ItemRange.cs create mode 100755 src/Tizen.NUI/src/internal/ItemView.cs create mode 100755 src/Tizen.NUI/src/internal/KeyEventSignal.cs create mode 100755 src/Tizen.NUI/src/internal/KeyInputFocusManager.cs create mode 100755 src/Tizen.NUI/src/internal/KeyInputFocusSignal.cs create mode 100755 src/Tizen.NUI/src/internal/KeyboardTypeSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/LinearConstrainer.cs create mode 100755 src/Tizen.NUI/src/internal/LoadingState.cs create mode 100755 src/Tizen.NUI/src/internal/LongPressGestureDetectedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/LongPressGestureDetector.cs create mode 100755 src/Tizen.NUI/src/internal/ManualPINVOKE.cs create mode 100755 src/Tizen.NUI/src/internal/Matrix.cs create mode 100755 src/Tizen.NUI/src/internal/Matrix3.cs create mode 100755 src/Tizen.NUI/src/internal/Model3dView.cs create mode 100755 src/Tizen.NUI/src/internal/NDalic.cs create mode 100755 src/Tizen.NUI/src/internal/NDalicPINVOKE.cs create mode 100755 src/Tizen.NUI/src/internal/NUICoreBackend.cs create mode 100755 src/Tizen.NUI/src/internal/NUIEventType.cs create mode 100755 src/Tizen.NUI/src/internal/NativeImage.cs create mode 100755 src/Tizen.NUI/src/internal/NativeImageInterface.cs create mode 100755 src/Tizen.NUI/src/internal/Object.cs create mode 100755 src/Tizen.NUI/src/internal/ObjectCreatedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ObjectDestroyedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ObjectRegistry.cs create mode 100755 src/Tizen.NUI/src/internal/PageFactory.cs create mode 100755 src/Tizen.NUI/src/internal/PagePanSignal.cs create mode 100755 src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs create mode 100755 src/Tizen.NUI/src/internal/PageTurnPortraitView.cs create mode 100755 src/Tizen.NUI/src/internal/PageTurnSignal.cs create mode 100755 src/Tizen.NUI/src/internal/PageTurnView.cs create mode 100755 src/Tizen.NUI/src/internal/PanGestureDetectedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/PanGestureDetector.cs create mode 100755 src/Tizen.NUI/src/internal/PathConstrainer.cs create mode 100755 src/Tizen.NUI/src/internal/PinchGestureDetectedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/PinchGestureDetector.cs create mode 100755 src/Tizen.NUI/src/internal/PreFocusChangeSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ProgressBarValueChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyCondition.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyNotification.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyNotifySignal.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyRangeManager.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyRanges.cs create mode 100755 src/Tizen.NUI/src/internal/PropertyRegistration.cs create mode 100755 src/Tizen.NUI/src/internal/RefObject.cs create mode 100755 src/Tizen.NUI/src/internal/Registry.cs create mode 100755 src/Tizen.NUI/src/internal/RenderBufferFormat.cs create mode 100755 src/Tizen.NUI/src/internal/RenderModeType.cs create mode 100755 src/Tizen.NUI/src/internal/RenderTask.cs create mode 100755 src/Tizen.NUI/src/internal/RenderTaskList.cs create mode 100755 src/Tizen.NUI/src/internal/RenderTaskSignal.cs create mode 100755 src/Tizen.NUI/src/internal/RenderingType.cs create mode 100755 src/Tizen.NUI/src/internal/ResizedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Ruler.cs create mode 100755 src/Tizen.NUI/src/internal/RulerDomain.cs create mode 100755 src/Tizen.NUI/src/internal/RulerPtr.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_CallbackBase.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Configuration__ContextLoss.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CallbackBase.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Constraint.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CustomActorImpl__Extension.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__FunctorDelegate.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__Texture.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__TypeRegistry.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RectT_unsigned_int_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ClampState.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__TouchEvent.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_FunctorDelegate.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_KeyboardFocusManager.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_PropertyInputContainer.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_double.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_float__float.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_Dali__Vector2__bool.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_float.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_int.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_std__type_info.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_uint8_t.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_char.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_int.cs create mode 100755 src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_short.cs create mode 100755 src/Tizen.NUI/src/internal/ScrollStateChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ScrollViewPagePathEffect.cs create mode 100755 src/Tizen.NUI/src/internal/ScrollViewSnapStartedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ScrollableSignal.cs create mode 100755 src/Tizen.NUI/src/internal/SignalConnectorType.cs create mode 100755 src/Tizen.NUI/src/internal/SignalObserver.cs create mode 100755 src/Tizen.NUI/src/internal/Size.cs create mode 100755 src/Tizen.NUI/src/internal/SliderMarkReachedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/SliderValueChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/SlotObserver.cs create mode 100755 src/Tizen.NUI/src/internal/SnapType.cs create mode 100755 src/Tizen.NUI/src/internal/StageWheelSignal.cs create mode 100755 src/Tizen.NUI/src/internal/StateChangedSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/StatusSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/StencilFunctionType.cs create mode 100755 src/Tizen.NUI/src/internal/StencilOperationType.cs create mode 100755 src/Tizen.NUI/src/internal/StringValuePair.cs create mode 100755 src/Tizen.NUI/src/internal/StyleChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/TapGestureDetectedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/TapGestureDetector.cs create mode 100755 src/Tizen.NUI/src/internal/TextEditorSignal.cs create mode 100755 src/Tizen.NUI/src/internal/TextFieldSignal.cs create mode 100755 src/Tizen.NUI/src/internal/TimePeriod.cs create mode 100755 src/Tizen.NUI/src/internal/TimerSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/ToolkitPropertyRange.cs create mode 100755 src/Tizen.NUI/src/internal/TooltipPositionType.cs create mode 100755 src/Tizen.NUI/src/internal/TouchDataSignal.cs create mode 100755 src/Tizen.NUI/src/internal/TouchPoint.cs create mode 100755 src/Tizen.NUI/src/internal/TouchPointContainer.cs create mode 100755 src/Tizen.NUI/src/internal/TouchSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Type.cs create mode 100755 src/Tizen.NUI/src/internal/TypeAction.cs create mode 100755 src/Tizen.NUI/src/internal/TypeRegistration.cs create mode 100755 src/Tizen.NUI/src/internal/TypeRegistry.cs create mode 100755 src/Tizen.NUI/src/internal/Uint16Pair.cs create mode 100755 src/Tizen.NUI/src/internal/VectorBase.cs create mode 100755 src/Tizen.NUI/src/internal/VectorUint16Pair.cs create mode 100755 src/Tizen.NUI/src/internal/VectorUnsignedChar.cs create mode 100755 src/Tizen.NUI/src/internal/VideoViewSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ViewImpl.cs create mode 100755 src/Tizen.NUI/src/internal/ViewMode.cs create mode 100755 src/Tizen.NUI/src/internal/ViewResourceReadySignal.cs create mode 100755 src/Tizen.NUI/src/internal/ViewSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ViewVisibilityChangedSignal.cs create mode 100755 src/Tizen.NUI/src/internal/ViewWrapperImpl.cs create mode 100755 src/Tizen.NUI/src/internal/VoidSignal.cs create mode 100755 src/Tizen.NUI/src/internal/WeakEventHandler.cs create mode 100755 src/Tizen.NUI/src/internal/WheelSignal.cs create mode 100755 src/Tizen.NUI/src/internal/WidgetViewSignal.cs create mode 100755 src/Tizen.NUI/src/internal/WindowFocusSignalType.cs create mode 100755 src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs create mode 100755 src/Tizen.NUI/src/internal/dotnetcore/HandleRef.cs create mode 100755 src/Tizen.NUI/src/internal/doublep.cs create mode 100755 src/Tizen.NUI/src/internal/floatp.cs create mode 100755 src/Tizen.NUI/src/internal/intp.cs create mode 100755 src/Tizen.NUI/src/internal/uintp.cs create mode 100755 src/Tizen.NUI/src/internal/ushortp.cs create mode 100755 src/Tizen.NUI/src/public/Adaptor.cs create mode 100755 src/Tizen.NUI/src/public/AlphaFunction.cs create mode 100755 src/Tizen.NUI/src/public/Animatable.cs create mode 100755 src/Tizen.NUI/src/public/Animation.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/CustomView.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/FlexContainer.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ImageView.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/TableView.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/TextField.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/VideoView.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/View.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/VisibilityChangeType.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/VisualView.cs create mode 100755 src/Tizen.NUI/src/public/BaseHandle.cs create mode 100755 src/Tizen.NUI/src/public/Color.cs create mode 100755 src/Tizen.NUI/src/public/CustomView/Spin.cs create mode 100755 src/Tizen.NUI/src/public/CustomViewRegistry.cs create mode 100755 src/Tizen.NUI/src/public/Degree.cs create mode 100755 src/Tizen.NUI/src/public/DirectionBias.cs create mode 100755 src/Tizen.NUI/src/public/FilterModeType.cs create mode 100755 src/Tizen.NUI/src/public/FocusManager.cs create mode 100755 src/Tizen.NUI/src/public/Geometry.cs create mode 100755 src/Tizen.NUI/src/public/Gesture.cs create mode 100755 src/Tizen.NUI/src/public/Hover.cs create mode 100755 src/Tizen.NUI/src/public/ImfManager.cs create mode 100755 src/Tizen.NUI/src/public/InputMethod.cs create mode 100755 src/Tizen.NUI/src/public/Key.cs create mode 100755 src/Tizen.NUI/src/public/KeyFrames.cs create mode 100755 src/Tizen.NUI/src/public/Layer.cs create mode 100755 src/Tizen.NUI/src/public/LongPressGesture.cs create mode 100755 src/Tizen.NUI/src/public/NUIApplication.cs create mode 100755 src/Tizen.NUI/src/public/NUIConstants.cs create mode 100755 src/Tizen.NUI/src/public/PaddingType.cs create mode 100755 src/Tizen.NUI/src/public/PanGesture.cs create mode 100755 src/Tizen.NUI/src/public/Path.cs create mode 100755 src/Tizen.NUI/src/public/PinchGesture.cs create mode 100755 src/Tizen.NUI/src/public/PixelData.cs create mode 100755 src/Tizen.NUI/src/public/PixelFormat.cs create mode 100755 src/Tizen.NUI/src/public/Position.cs create mode 100755 src/Tizen.NUI/src/public/Position2D.cs create mode 100755 src/Tizen.NUI/src/public/Property.cs create mode 100755 src/Tizen.NUI/src/public/PropertyBuffer.cs create mode 100755 src/Tizen.NUI/src/public/Radian.cs create mode 100755 src/Tizen.NUI/src/public/Rectangle.cs create mode 100755 src/Tizen.NUI/src/public/RelativeVector2.cs create mode 100755 src/Tizen.NUI/src/public/RelativeVector3.cs create mode 100755 src/Tizen.NUI/src/public/RelativeVector4.cs create mode 100755 src/Tizen.NUI/src/public/RelayoutContainer.cs create mode 100755 src/Tizen.NUI/src/public/Renderer.cs create mode 100755 src/Tizen.NUI/src/public/Rotation.cs create mode 100755 src/Tizen.NUI/src/public/Sampler.cs create mode 100755 src/Tizen.NUI/src/public/ScrollViewEffect.cs create mode 100755 src/Tizen.NUI/src/public/Shader.cs create mode 100755 src/Tizen.NUI/src/public/Size2D.cs create mode 100755 src/Tizen.NUI/src/public/StyleManager.cs create mode 100755 src/Tizen.NUI/src/public/TTSPlayer.cs create mode 100755 src/Tizen.NUI/src/public/TapGesture.cs create mode 100755 src/Tizen.NUI/src/public/Texture.cs create mode 100755 src/Tizen.NUI/src/public/TextureSet.cs create mode 100755 src/Tizen.NUI/src/public/TextureType.cs create mode 100755 src/Tizen.NUI/src/public/Timer.cs create mode 100755 src/Tizen.NUI/src/public/Touch.cs create mode 100755 src/Tizen.NUI/src/public/TransitionData.cs create mode 100755 src/Tizen.NUI/src/public/TypeInfo.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/Button.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/Popup.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/PushButton.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/RadioButton.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/ScrollView.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/Slider.cs create mode 100755 src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs create mode 100755 src/Tizen.NUI/src/public/Vector2.cs create mode 100755 src/Tizen.NUI/src/public/Vector3.cs create mode 100755 src/Tizen.NUI/src/public/Vector4.cs create mode 100755 src/Tizen.NUI/src/public/ViewWrapper.cs create mode 100755 src/Tizen.NUI/src/public/VisualBase.cs create mode 100755 src/Tizen.NUI/src/public/VisualFactory.cs create mode 100755 src/Tizen.NUI/src/public/VisualMaps.cs create mode 100755 src/Tizen.NUI/src/public/Wheel.cs create mode 100755 src/Tizen.NUI/src/public/WidgetView.cs create mode 100755 src/Tizen.NUI/src/public/WidgetViewManager.cs create mode 100755 src/Tizen.NUI/src/public/Window.cs create mode 100755 src/Tizen.Network.Bluetooth/Interop/Interop.Bluetooth.cs create mode 100644 src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs create mode 100644 src/Tizen.Network.Bluetooth/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Network.Bluetooth/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.csproj create mode 100755 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.sln create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapter.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudio.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudioImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcp.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcpImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothData.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothDevice.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEnumerations.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEventArgs.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGatt.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGattImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHid.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHidImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapter.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothProfile.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothServerSocket.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothSocket.cs create mode 100644 src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs create mode 100755 src/Tizen.Network.Connection/Interop/Interop.Connection.cs create mode 100644 src/Tizen.Network.Connection/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.Connection/Tizen.Network.Connection.csproj create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection.sln create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionTypes.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs create mode 100755 src/Tizen.Network.Connection/Tizen.Network.Connection/WiFiProfile.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Client.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Common.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Server.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.csproj create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.sln create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/CacheUpdatedEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/DeviceInformationFoundEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingError.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingErrorOccurredEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityErrorFactory.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/LiteResource.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/NamespaceDoc.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObservePolicy.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserveType.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserverNotifiedEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PlatformInformationFoundEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceEventType.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceReceivedEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/QualityOfService.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResponse.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Request.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceFoundEventArgs.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourcePolicy.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceState.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Response.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResponseCode.cs create mode 100755 src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/StateChangedEventArgs.cs create mode 100644 src/Tizen.Network.Mtp/Interop/Interop.Glib.cs create mode 100644 src/Tizen.Network.Mtp/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Network.Mtp/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.Mtp/Interop/Interop.Mtp.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj create mode 100755 src/Tizen.Network.Mtp/Tizen.Network.Mtp.sln create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpDevice.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEnumerations.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpErrorFactory.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEventArgs.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManager.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerEvent.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerImpl.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs create mode 100644 src/Tizen.Network.Mtp/Tizen.Network.Mtp/NamespaceDoc.cs create mode 100644 src/Tizen.Network.Nfc/Interop/Interop.Glib.cs create mode 100644 src/Tizen.Network.Nfc/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Network.Nfc/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.Nfc/Interop/Interop.Nfc.cs create mode 100644 src/Tizen.Network.Nfc/Tizen.Network.Nfc.csproj create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc.sln create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs create mode 100644 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEnumerations.cs create mode 100644 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcErrorFactory.cs create mode 100644 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEventArgs.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs create mode 100644 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerEvent.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerImpl.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefMessage.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefRecord.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2p.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2pAdapter.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcSecureElement.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs create mode 100755 src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTagAdapter.cs create mode 100755 src/Tizen.Network.Nsd/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Network.Nsd/Interop/Interop.Nsd.cs create mode 100644 src/Tizen.Network.Nsd/Tizen.Network.Nsd.csproj create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd.sln create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/Globals.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs create mode 100644 src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEnumerations.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdError.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEventArgs.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs create mode 100755 src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs create mode 100644 src/Tizen.Network.Smartcard/Interop/Interop.Glib.cs create mode 100644 src/Tizen.Network.Smartcard/Interop/Interop.Libc.cs create mode 100644 src/Tizen.Network.Smartcard/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.Smartcard/Interop/Interop.Smartcard.cs create mode 100644 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.csproj create mode 100755 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.sln create mode 100644 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardChannel.cs create mode 100644 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardErrorFactory.cs create mode 100755 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManager.cs create mode 100755 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManagerImpl.cs create mode 100644 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardReader.cs create mode 100644 src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardSession.cs create mode 100755 src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs create mode 100644 src/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi.sln create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs create mode 100644 src/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs create mode 100755 src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs create mode 100644 src/Tizen.Network.WiFiDirect/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Network.WiFiDirect/Interop/Interop.WiFiDirect.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.csproj create mode 100755 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.sln create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/NamespaceDoc.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectData.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEnumerations.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectError.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEventArgs.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManager.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManagerImpl.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPeer.cs create mode 100644 src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPersistentGroup.cs create mode 100755 src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs create mode 100644 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj create mode 100755 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln create mode 100644 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/NamespaceDoc.cs create mode 100644 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs create mode 100644 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs create mode 100644 src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Database.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Filter.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Libraries.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.List.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Query.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Record.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Reminder.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Service.cs create mode 100644 src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Vcalendar.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.csproj create mode 100755 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.sln create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarErrorFactory.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarFilter.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/NamespaceDoc.cs create mode 100644 src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Activity.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Contacts.cs create mode 100644 src/Tizen.Pims.Contacts/Interop/Interop.Database.cs create mode 100644 src/Tizen.Pims.Contacts/Interop/Interop.Filter.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Group.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.List.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Person.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.PhoneLog.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Query.cs create mode 100644 src/Tizen.Pims.Contacts/Interop/Interop.Record.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Setting.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Sim.cs create mode 100755 src/Tizen.Pims.Contacts/Interop/Interop.Vcard.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.csproj create mode 100755 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsErrorFactory.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsFilter.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsList.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsManager.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsQuery.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsRecord.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsVcard.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsViews.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/DBStatusChangedEventArgs.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameDisplayOrderChangedEventArgs.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameSortingOrderChangedEventArgs.cs create mode 100644 src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NamespaceDoc.cs create mode 100644 src/Tizen.Security.SecureRepository/Interop/Interop.CkmcErrors.cs create mode 100644 src/Tizen.Security.SecureRepository/Interop/Interop.CkmcManager.cs create mode 100644 src/Tizen.Security.SecureRepository/Interop/Interop.CkmcTypes.cs create mode 100644 src/Tizen.Security.SecureRepository/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Security.SecureRepository/NamespaceDoc.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.csproj create mode 100755 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.sln create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Certificate.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/CertificateManager.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCbcCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCfbCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCtrCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesGcmCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Cipher.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherAlgorithmType.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameterName.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/DsaSignatureParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/EcdsaSignatureParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/HashAlgorithm.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaOaepCipherParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaPaddingAlgorithm.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaSignatureParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SafeCipherParametersHandle.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Signature.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureAlgorithmType.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameterName.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameters.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataFormat.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataManager.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/EllipticCurveType.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Key.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyManager.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyType.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Manager.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/OcspStatus.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Permission.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/PinnedObject.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12Manager.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Policy.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeAliasListHandle.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeCertificateListHandle.cs create mode 100644 src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeRawBufferHandle.cs create mode 100644 src/Tizen.Security.TEEC/.gitignore create mode 100644 src/Tizen.Security.TEEC/Interop/Interop.Errors.cs create mode 100644 src/Tizen.Security.TEEC/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Security.TEEC/Interop/Interop.Libteec.cs create mode 100644 src/Tizen.Security.TEEC/Interop/Interop.Types.cs create mode 100644 src/Tizen.Security.TEEC/Tizen.Security.TEEC.csproj create mode 100755 src/Tizen.Security.TEEC/Tizen.Security.TEEC.sln create mode 100644 src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs create mode 100644 src/Tizen.Security.TEEC/Tizen.Security.TEEC/NamespaceDoc.cs create mode 100644 src/Tizen.Security/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Security/Interop/Interop.Privilege.cs create mode 100644 src/Tizen.Security/Tizen.Security.csproj create mode 100755 src/Tizen.Security/Tizen.Security.sln create mode 100755 src/Tizen.Security/Tizen.Security/Privilege.cs create mode 100644 src/Tizen.Sensor/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Sensor/Interop/Interop.Sensor.cs create mode 100644 src/Tizen.Sensor/Tizen.Sensor.csproj create mode 100755 src/Tizen.Sensor/Tizen.Sensor.sln create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/AccelerometerDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/FaceDownGestureDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/GravitySensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/HeartRateMonitorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/HumiditySensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/InVehicleActivityDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/LightSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/LinearAccelerationSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/OrientationSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/PedometerDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/PickUpGestureDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/PressureSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/ProximitySensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/RotationVectorSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/RunningActivityDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/SensorAccuracyChangedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/SleepMonitorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/StationaryActivityDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/TemperatureSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/UltravioletSensorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedGyroscopeDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedMagnetometerDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/WalkingActivityDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/EventArgs/WristUpGestureDetectorDataUpdatedEventArgs.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/Accelerometer.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/ActivityDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/FaceDownGestureDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/GravitySensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/Gyroscope.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/GyroscopeRotationVectorSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/HeartRateMonitor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/HumiditySensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/InVehicleActivityDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/LightSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/LinearAccelerationSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/Magnetometer.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/MagnetometerRotationVectorSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/OrientationSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/PickUpGestureDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/PressureSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/ProximitySensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/RotationVectorSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/RunningActivityDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/SleepMonitor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/StationaryActivityDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/TemperatureSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/UltravioletSensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedGyroscope.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedMagnetometer.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/WalkingActivityDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Plugins/WristUpGestureDetector.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/Sensor.cs create mode 100755 src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs create mode 100644 src/Tizen.Sensor/Tizen.Sensor/SensorErrorFactory.cs create mode 100644 src/Tizen.System.Feedback/Feedback/Feedback.cs create mode 100644 src/Tizen.System.Feedback/Feedback/FeedbackPattern.cs create mode 100644 src/Tizen.System.Feedback/Feedback/FeedbackType.cs create mode 100644 src/Tizen.System.Feedback/Interop/Interop.Feedback.cs create mode 100644 src/Tizen.System.Feedback/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.System.Feedback/Tizen.System.Feedback.csproj create mode 100755 src/Tizen.System.Feedback/Tizen.System.Feedback.sln create mode 100644 src/Tizen.System.Information/.vs/Tizen.System.Information/v14/.suo create mode 100644 src/Tizen.System.Information/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.System.Information/Interop/Interop.RuntimeInfo.cs create mode 100644 src/Tizen.System.Information/Interop/Interop.SystemInfo.cs create mode 100755 src/Tizen.System.Information/RuntimeInfo/CpuUsage.cs create mode 100755 src/Tizen.System.Information/RuntimeInfo/Enumerations.cs create mode 100755 src/Tizen.System.Information/RuntimeInfo/MemoryInformation.cs create mode 100644 src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs create mode 100755 src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs create mode 100755 src/Tizen.System.Information/RuntimeInfo/RuntimeKeyStatusChangedEventArgs.cs create mode 100755 src/Tizen.System.Information/SystemInfo/SystemInfo.cs create mode 100644 src/Tizen.System.Information/Tizen.System.Information.csproj create mode 100755 src/Tizen.System.Information/Tizen.System.Information.sln create mode 100755 src/Tizen.System.MediaKey/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.System.MediaKey/Interop/Interop.MediaKey.cs create mode 100644 src/Tizen.System.MediaKey/Tizen.System.MediaKey.csproj create mode 100755 src/Tizen.System.MediaKey/Tizen.System.MediaKey.sln create mode 100755 src/Tizen.System.MediaKey/Tizen.System/MediaKey.cs create mode 100755 src/Tizen.System.PlatformConfig/Interop/Interop.PlatformConfig.cs create mode 100644 src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.csproj create mode 100755 src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.sln create mode 100755 src/Tizen.System.PlatformConfig/Tizen.System/PlatformConfig.cs create mode 100644 src/Tizen.System.Storage/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.System.Storage/Interop/Interop.Storage.cs create mode 100644 src/Tizen.System.Storage/Storage/DirectoryType.cs create mode 100644 src/Tizen.System.Storage/Storage/Storage.cs create mode 100644 src/Tizen.System.Storage/Storage/StorageArea.cs create mode 100644 src/Tizen.System.Storage/Storage/StorageManager.cs create mode 100644 src/Tizen.System.Storage/Storage/StorageState.cs create mode 100644 src/Tizen.System.Storage/Tizen.System.Storage.csproj create mode 100755 src/Tizen.System.Storage/Tizen.System.Storage.sln create mode 100644 src/Tizen.System.SystemSettings/Interop/Interop.SystemSettings.cs create mode 100644 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.csproj create mode 100755 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.sln create mode 100755 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs create mode 100755 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEnums.cs create mode 100755 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs create mode 100644 src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs create mode 100755 src/Tizen.System/Device/Battery.cs create mode 100644 src/Tizen.System/Device/DeviceEventArgs.cs create mode 100644 src/Tizen.System/Device/DeviceExceptionFactory.cs create mode 100644 src/Tizen.System/Device/Display.cs create mode 100644 src/Tizen.System/Device/Haptic.cs create mode 100644 src/Tizen.System/Device/IR.cs create mode 100644 src/Tizen.System/Device/Led.cs create mode 100644 src/Tizen.System/Device/Power.cs create mode 100644 src/Tizen.System/Interop/Interop.Device.cs create mode 100644 src/Tizen.System/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.System/Tizen.System.csproj create mode 100755 src/Tizen.System/Tizen.System.sln create mode 100755 src/Tizen.Tapi/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Tapi/Interop/Interop.Tapi.cs create mode 100644 src/Tizen.Tapi/Tizen.Tapi.csproj create mode 100755 src/Tizen.Tapi/Tizen.Tapi.sln create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Call.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/CallData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/CallEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/CallStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Modem.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/ModemData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/ModemEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/ModemStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Network.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/NetworkData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/NetworkEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/NetworkStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Oem.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/OemData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/OemStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Phonebook.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/PhonebookData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/PhonebookEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/PhonebookStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SatData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SatEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SatStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Sim.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SimData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SimEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SimStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SmsData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SmsEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SmsStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/Ss.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SsData.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SsEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/SsStructs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/TapiEnumerations.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/TapiEventArgs.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/TapiHandle.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/TapiManager.cs create mode 100755 src/Tizen.Tapi/Tizen.Tapi/TapiUtility.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Call.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Modem.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Network.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Sim.cs create mode 100755 src/Tizen.Telephony/Interop/Interop.Telephony.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony.csproj create mode 100755 src/Tizen.Telephony/Tizen.Telephony.sln create mode 100644 src/Tizen.Telephony/Tizen.Telephony/Call.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/Modem.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/Network.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/Sim.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs create mode 100644 src/Tizen.Telephony/Tizen.Telephony/Telephony.cs create mode 100755 src/Tizen.Tracer/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Tracer/Interop/Interop.Tracer.cs create mode 100644 src/Tizen.Tracer/Tizen.Tracer.csproj create mode 100755 src/Tizen.Tracer/Tizen.Tracer.sln create mode 100755 src/Tizen.Tracer/Tizen/Tracer.cs create mode 100755 src/Tizen.Uix.InputMethod/Interop/Interop.EinaList.cs create mode 100755 src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs create mode 100755 src/Tizen.Uix.InputMethod/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.csproj create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.sln create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/AccessibilityStateChangedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/CursorPositionUpdatedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DataSetEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DisplayLanaguageChangedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedInEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedOutEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodContext.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodDeviceInformation.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LanguageSetSetEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LayoutSetEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindow.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowCreatedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowDestroyedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/PreEditAttribute.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyStateSetEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyTypeSetEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/RotationChangedEventArgs.cs create mode 100755 src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/SurroundingTextUpdatedArgs.cs create mode 100755 src/Tizen.Uix.InputMethodManager/Interop/Interop.InputMethodManager.cs create mode 100755 src/Tizen.Uix.InputMethodManager/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.csproj create mode 100755 src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.sln create mode 100755 src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManager.cs create mode 100755 src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManagerExceptionFactory.cs create mode 100755 src/Tizen.Uix.Stt/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Uix.Stt/Interop/Interop.Stt.cs create mode 100644 src/Tizen.Uix.Stt/Tizen.Uix.Stt.csproj create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt.sln create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/DefaultLanguageChangedEventArgs.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/EngineChangedEventArgs.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/ErrorOccurredEventArgs.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/ExceptionFactory.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/RecognitionResultEventArgs.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/ResultTime.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/StateChangedEventArgs.cs create mode 100644 src/Tizen.Uix.Stt/Tizen.Uix.Stt/SttClient.cs create mode 100755 src/Tizen.Uix.Stt/Tizen.Uix.Stt/SupportedEngine.cs create mode 100755 src/Tizen.Uix.SttEngine/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Uix.SttEngine/Interop/Interop.SttEngine.cs create mode 100755 src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.csproj create mode 100755 src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.sln create mode 100755 src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/ExceptionFactory.cs create mode 100755 src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/SttEngine.cs create mode 100755 src/Tizen.Uix.Tts/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Uix.Tts/Interop/Interop.Tts.cs create mode 100644 src/Tizen.Uix.Tts/Tizen.Uix.Tts.csproj create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts.sln create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/DefaultVoiceChangedEventArgs.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/EngineChangedEventArgs.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/ErrorOccurredEventArgs.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/ExceptionFactory.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/SpeedRange.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/StateChangedEventArgs.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/SupportedVoice.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/TtsClient.cs create mode 100755 src/Tizen.Uix.Tts/Tizen.Uix.Tts/UtteranceEventArgs.cs create mode 100755 src/Tizen.Uix.TtsEngine/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Uix.TtsEngine/Interop/Interop.TtsEngine.cs create mode 100755 src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.csproj create mode 100755 src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.sln create mode 100755 src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/ExceptionFactory.cs create mode 100755 src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/TtsEngine.cs create mode 100755 src/Tizen.Uix.VoiceControl/Interop/Interop.Libraries.cs create mode 100755 src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControl.cs create mode 100755 src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControlCommand.cs create mode 100644 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.csproj create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.sln create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/CurrentLanguageChangedEventArgs.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ErrorOccuredEventArgs.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ExceptionFactory.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResult.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResultEventArgs.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ServiceStateChangedEventArgs.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/StateChangedEventArgs.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommand.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs create mode 100755 src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceControlClient.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.Context.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.CookieManager.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.Error.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.Settings.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.View.cs create mode 100644 src/Tizen.WebView/Interop/Interop.ChromiumEwk.cs create mode 100644 src/Tizen.WebView/Interop/Interop.Elementary.cs create mode 100644 src/Tizen.WebView/Interop/Interop.Evas.cs create mode 100644 src/Tizen.WebView/Interop/Interop.Libraries.cs create mode 100644 src/Tizen.WebView/Tizen.WebView.csproj create mode 100755 src/Tizen.WebView/Tizen.WebView.sln create mode 100644 src/Tizen.WebView/Tizen.WebView/Chromium.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/Context.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/CookieManager.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/JavaScriptMessage.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/Settings.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/SmartCallbackArgs.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/SmartCallbackLoadErrorArgs.cs create mode 100644 src/Tizen.WebView/Tizen.WebView/WebView.cs create mode 100644 src/Tizen/Interop/Interop.CommonError.cs create mode 100644 src/Tizen/Interop/Interop.Dlog.cs create mode 100644 src/Tizen/Tizen.Common/Color.cs create mode 100644 src/Tizen/Tizen.Internals.Errors/ErrorCode.cs create mode 100644 src/Tizen/Tizen.Internals.Errors/ErrorFacts.cs create mode 100644 src/Tizen/Tizen.csproj create mode 100755 src/Tizen/Tizen.sln diff --git a/Version.txt b/Version.txt index 7ab9fbf..8ca1916 100644 --- a/Version.txt +++ b/Version.txt @@ -1,4 +1,4 @@ Prefix:4.0.0 -Suffix:preview1-00050 -Number:50 +Suffix:preview1-00051 +Number:51 VCS:068efec82af922340ce34c144b284262de13cda3 diff --git a/binaries/Tizen.NET.4.0.0-preview1-00050.nupkg b/binaries/Tizen.NET.4.0.0-preview1-00051.nupkg similarity index 96% rename from binaries/Tizen.NET.4.0.0-preview1-00050.nupkg rename to binaries/Tizen.NET.4.0.0-preview1-00051.nupkg index 8bc6634360fc63608f1976ba5ce2587c83bd8c79..2bc3e170c03437b5de441c3e100a50a414b8bd85 100644 GIT binary patch delta 33380 zcmY(J18|;A)c4!iwr$(CZ8WycE4J;VF&f*AZ6^&H^NEwjZ_{tSnfIO9IoEIgyL)!e z*}3<^-h;D7J+nrrO0u9}XkWg3f%@X$g(RDs?}3Y)h)NDztTyQHnl6cR>Vtj!6vJ5~ znFE!Ew(IQ)Dos#=xp21MTfus1Ve{eIsBr|f z*cTP^f^;k)mQ-KmMlnXbz93MGE1tt41r|buU|^Cjf^>59v|*p_7msBNit`cqLgxsf zMv=JVT!k6{Wl__g!$4b=l#0*#t+_vgDwAk3Lt>obEwIJYFAv5ijsTpT(Yg2q=D^4@ z0TEwh0WJsSVFl@X# ztlVhxp5L(5?RQaPzaj5(SM@h7!c&6h($LeYy|7J;H-{JK|C^f9@AHAlvR?@S>t9Sr zVV9vj13NDCYsB;=miTFP;XhGC8u&5A2{x?Fq?bm|nj97_j=#@hp3;hKSuT{Y?M(dn zcz+7VetUY7)#HnSc)*h4?WD2RKo8Jp*Vyn^m#e4U#>AXD)9jbM7k_|)Zf&9o!+L|9 zmWJn&F)q^ROFSb{wcl5?J^eWYRCXM?4PA&4p!*cGNKJhij8JZ285d2p-sIqY!>8}u zItNo!f6u41nbsbvoQM2nlXKQkS=rjWBgsDC92E?^_-ibYVq;*qAgWKhTI#AOLz`3A z7kWyE0@Od(^=Gw)CG?8S_xO1lTOKPYa6oy+|CY=bu2j24!piQJk2SLeU?Xz*ew0bn z)7|k)Z`*F1RRh|8cOuuCDM5UAFTu3oh9$lPG#Co{5w=$2T6O*ln6Ju`j@D?c=OTzTMAAw9kXFE?n z>w4NrAUcInEvqI|9217=RF&|qhz8z@&SncO2*<>K=qeltjZwdNnCfuSD^eQG1w6-Pq`oC8( zD_#9p{i9Ea&H(Xa_ym{{5C-H=;8_J(CHn-lHxN*`Pr!x-bz}d81Od?Me~O?iXc5|{ zvTq350QCtOmY}|DS_b+Fy#Q#R-6sTHfLhUh!UYysi1H`6ScCmS_ylDyu)2S} zKx4t+AU+l3WH2kfPw<@qyT$wjrz5Zv)=$vG1#kJ+3ylW+koQx0H3OIUH)k;qaJ7Ga zvZBCk{`rAS1V=~uY(wxJ91;8z7)!yE5kFzD8C>n_C*ZV#>%n}2XCHX~KZS1qeEy$9 zq$Th&kiS)B?JMB;pG`XN!14aMS$hJ%!}(NZ&>%$q4TXveAxHSB81X<1{!0&~B!sTj zrxH>Jkw*OqcoE+{68=*$N`WN(=O-);vajw_k(Pv7qWAig#zHw7w$ z@l*Le0CoCrxnd`wc$hzxu{S6wbi~hXv8l2}@5b*Abm$07PeIy6&lR( zv!P-zG$iFeua(eb|HAbjgI@fX0JT|Y7vq1amriT1eiSdLRQrDsgm8A4S~7k4vSGDGsDC*RdQ=lQWF2D){RVQRZp0aoDbm{i`ojV3 zd}V)%Oy+}AmGn1oQSQM2)$P;Fl&e=NL`UIqM9uU}=4<>a`cg>81al1s%K#vFYCtmi zZ4tkq)1LqL-B`PR=F(=6Z$rYbERH9YsD13uhjD({Qgl%Ly!mn}8VP4fStjQZEOvu@ zC{$f8#Ev&MQAfBQ@k8&+(R0iPM5WEkSFRgo`7+nU)A65bOUtOb&D9nRLe3QsdrAbl zii39NVz{V19MiZQ%<=@#%+3T8nMG&6tNw{T0in1cPIc`~tr9@F%YUe9x*B5mBj zHMdBiVX9+`&iIHjU7|nqm!Z`8o+vEOvq2Q|cQ|SEW_;=6c2w%)pqNp5vFPUKQ7*ugQ)kdu5`jS#D{k;{1f3@ z8tuaOKK}`He_Wh%PTUuIj#Y>D^ZZ{(z3^u5vqZh>3{^h#qYmxA-#D5$d%c2Q(_YTr zIPQSEY}rz;K7SYJ-U9&qg+AyF1M{2{^JN5mx0Ubk2>j_H(N6OL`X-yUYx~CgcH=VW z_3-)Lf8youfQ$c_C_Lc7BPDv@dStR}W$SZZN&evMc+I zA2;y53h6!6-~0pr)5HrmKE!0nFK-o#5v9J3&QM(Bm5Tvw-2e(M8S@-8^>ElIo_>!M z|HMKaL_M6Zn&0qtBkAX^u=23%eC?Ym z&Sqyg(j~w0K2xu>BE>%F#|`#?D;8JUkZ4@-%TL2G70wpThaB6CSQ z(Id_`>YmBZloRoH!t*CGbkTAxm+73#lD^;s19$$*Ra;}i-h!|#iux<*uI%6^IJRf< zD|bZt6L$Qr_oVt$!X5vet82<9)bP6LqfPDuGOA`-6bn5p7nG`%(!z$sVNAg>b=8-Q zvaF`-f?C!A2{=@;kfSNr*wmX?Q!Od>a0c0gwT=(}>FqA8qknaChTjZ;wAEEEt%8~G z1Cg9dZ?k}-{2G|PV*!T-3|4cJ5ly$O0!xBCS&)hM zyI-ZVsgNfIy%k)SSzqgVDU5ir8_N3UwAUJBsx>0BHDJHU5IMLWJ#c3<`XNkMnysN0 zUT)HNhXFYG= zs9>6OYRv=|)rn#kTCV}kUcFlSK%bAET6{f7+}_XJkC(+0$sya-XvJu}G$~t0jPN9; zo5Jk|V>{;;ZE~UP|4Z^>OIwfc@SG5Moy(hPVO%k>j}hsSo7iN+VWm80U#;s!7)!9H zIT=2fN|Q#6N~tMj7Zu)f)DGz#^7F6%nB5>NQVowiTwD@~+KNI@QTsiM zz8T*>DR>$+xVSX(Yc`$yzTSvddOJRj$WPY9)i2(d!6m-}V4RpO>qpArRaj@ldk}U= z*H~w@b3BZk7xAGO-rI80oVy@a6<$uNxKldjd2NRU-1lZ=|FAyOqx}5F18IY)Ncct> z_CX!niul~-Np%=iCGnByWr!iUKBBVZyY0j#=`!`5S|xbjb~`{Tm^mF=)x<~2(}%@> zA^F--aX6YE!2UQL%RpZVcG6HBZXt+qVMl;i;mhi0?is1qLM!KR=ZkNj!Xh<6{IAri zCa-RX-y= zc;OX#(n#^Y3yV&kQM>Y9mWwF17o<3L=FK*Oj?Bd;fvrEDbX*~(vv~Ez`SfYS-a08% z`5G(oV`0sQEERJg;#?o;E%i!G^~-waaQcPy{d{e2-Y+7w8+u;M~sM=aYIY_Br@DtO>lkk}c zGBeXp02haEJ^D4Uo)6zG2E!Qix-Nz7>XkcMp0t=N%UW)wH)1N%jtBiOY7{uropi4=HZD-X2wW9Aj zj6!cGUks`d@3<~X-(A#d`iRfM7QW)qTER#|4aD>$j!wR&S2!3XsT+zX2(09mHvCt- zvp`6@AwAy1naZDSnmJPJ;9ciu&{eXg?~$QnH)hm?LCVT1!Q8|_hO6VV^yH&@1p3?c zJ=XPs)9vB1=nSu_^cttAL*YCB`S$60ESueUlipl_*2m#(s7%L!$EsG%IQUuQ_tNTZ zOCauA!)iP1`ZTWKtqg55cUQ-#tvPYMzWXmj7U_K@PAlKO#A2?WH*sIQHzr&n zMfWF=uyYzV`(P&6bnKu0XBZ4}##kKp!V6IOAbV_eXucqP0~PS0N#Y^#R5-^{o200) znW6kB?9CoK0~uGR4#LR4rT6)O@Onpk4l4#f!8MwD?9G**%RtvKsr11SZHY;+A=dDg z`+>w@gkfMEqyg1(h2G$pWd?1EZ*#voRDCVCjzd^neGSrsWbjR_-yElGgd3&&D=C1| zqp&BnTDOMf856eNg9q&831YYiB>&J^SXcvqKp|`)$Eu>g+Vlwk6hDyRy%*N)>uDb^`Ir3TS z=)~p_OSf35Zp`X{av0h?Zyn#T2ONNlDM<@Ia%SY$#Zg?8+BqLQa)!iQJ0r9Z9<^sI zK)-=^mNs!{)}J$B)|ozbce6u#qCwm&pJtzW!XYaMx#p!Cwlpp2#yj#LnGEt4eDP~b za8aScr3FuMx!p0~`@*5O*stH=(5ZxoPzJd2sRR4v+>lwk>5gA>Gq0z`_tJojC=Uil zdJ*>;enDM%k7~-X#7Z0HhG&>2J^HBYSTXi@9sw%r8iXd|`;eqw$@^VrD@HlBZrQp~ zADXF&g%G7m%%cu`8wG-LLS{fkKt8>ZH(X8&sCtK5k`D1}IsT@^gNylgYpAnZL@)B`z$ z<{PlMRBn}Z#_1~Dg)Oe9spNZDSrH@|D?o$`D3x|n@#_|cD!{wt*PR~j;>f${&rpV) z9hU-Wc(jBiYg{1y?LgdE)of9J-pC-&1DDlLQ3w}(Px%I$3bVQLYk|qMl0P^sCwie` zT#P^AYyDzcOB7UmOAS0o1#9+Dva4YC-*iK@=RLBj6)f>F_Bt`qVf0%Tlhh3DFC@?mZbz>Y9)4uZ+Ds=t;-)OWrqXU+t!}U%}<+0A1+BJ-X zLu}YH^uNM4Q-tTj@)L0C9?|7S#7zxP1yNxdJVfm0S4glbL034?SV47&!|8SGm} znS#oo9;j8irYbm08w7})EU!CL*zXm|aN9yNDgHZqBUytyzT_W3e zTMQ-X^=7~f{y0{1xzstG$>O$YAb=HJ9TNxzS7fQFG$+~+vDh9rTIi?ex~StySAOi^ ztmvm)${0BTX|i+=GtU#m$n2X+oYkSonaT>>ZA!nJ^C}dp{Jc^i&f-esk+#4x00Nue zLc4nUPJw&q`7_kjGco<}(3MMZ#$KW>IcP~OBSO=6aVBb~H~rD1M?~4n1yddx5rqfW z3zv?I8R=fZTGl+w8B98-rtH0ADJ497SWHRDHc7R8!IAYM=?2Nx_W)xORcJDsjPF|TJ;eUI)Xd0pWalWjFLtxf zwSq$#Yv!4V@&4ngWIOswIF*Yd$5WWQlO3$Z)6axc8!Wu8n={=lS>qpSSmoRLa{3hr zJV3Jn9UW5AF@wU$ZvQp*&^Y-#UW)}%=?U8wCqn7sdeoLU|Oa%x6$Qzk; zt|zA&{sRd+yP;aWk02^2r_wh+w~wrwrwm0mKhi^jhTMprW+*>NFP=v6E0R77jzeWW zf`(^V^!F^YXPf1jCt3qAOKWLhn^cQ|7?6F+D-=FYQyB>=iNjW@5OuA9T94O7mWW8Q zF9PdSOFHx+s8>DT?Gcs0j$0M3U+<ZK?+Jfl|pA8^8}wojb0AxuU+p35Q== zRwdcChS2g}ab9o4s)KwzM8SuwQ_eCDBdaLHn81)X*W<}v6vm07AUPRr1taPUP&U=` zCEg(GOvQ$8a>VsZZ2jqTV$cB#jo6o{jOTs+l>`2aeYzEmF*Rm4yJR6^M{v#nCr_o} zy($(z`O?~K4{yFmRXxgQz4kOk%TqK!UG_rCZqs;P6K$lvR@gvFsd4*$uW#50~Is}Z18{J}F7aej`Na&$I z60Y-Y=n_ze9@y^N z9f+u~lI^_SD#y7lb9*6*T-I%2l0}Pi!4T!K?$rI}Uw$C<9v1PyDcZ%^ z5vniGt#{0=w~g^~{O{tu;&){f8+XtJztJ2MvfI~0^bSe%m@{Z+Rgy^^EA}Kv#fy{+ z=Pc(arqS(LnMIn`YRnmA0|t$4r{%4hvep8qhy!eKvrZD#CCZ6K)Q)3C$m}J8s$Dn z7DQS6COjd6Wsywhe0hez@!w*f(8@-i*jOzExQBd`P|IrTR0PaUDJR*Y7eXs2NJTTE zQ7^|1sWsvOir}B{-m6{o z1G}|{ti8@_Jr3psz{SgnH{T?4T-}dg%$2MiRl1kjFK38{^*QF)6RrfwuG}KnF)Vk; zJfbPEJs({=*IeR+h}TF!xyVez<9y?)$oS1yCEBQKx1$q9e6~x;V>TzP=xhBni*_qB zRn~Rybdm>QZ-84dZ^mCnP=iDlHtY}8ducQz;9sC!yuShI z7wOJ8A=$|ZByaZUKRqY^{QKC$1wXFiCntsYfbIOm%SNKoT&jvMrI)-&uC1984J_1BcZ)5VB_{Ly z!Pu?o)1hS~8-FA$yc{WE>`RC%u%I%L!Zy!m*vsqRnEH98bO6e@f$o&<2+24G*g9Brhr(Orr;dphfQV|&7T?@y7UQ4 zdi9SQI{@;vZ?d$6)B=KkFwWNL4GA1m>j7`{cQUEgdyRe`JBwhR_{p3f(}H&W=v~3=t~cEBbrgO6o-OyID2hb=Lp2At!5yMmr!_CByv+kY zG1N1(Gsqi$k1qPfmWL@eMDqbwul{@aM6I-@WYCQq{K-F^ z*&7Z6Ka{(pPcPQ$3uB?Rf2^&ftxGog?V5g!z{=dgQFOYgHyj0pprX+!GJkVh*bld? zjPQ-!7=G8AMo$dUK%CTf`4Dmom=A@D+{pAgZ#Zl~gwN^F_RAlXg~#ip1XbLt<|fV; z>0P9)?>vq>E*Q)GF)u@xm`8GkTJqa`OT+>ZN5eVP)dp{mHB4ctL&5J{R9Os++tdfH ztA)!aKEz!NeRN=4s1x;G7(v9uzfBha1^OAc>aIbh; z4-AZeZn68-y&vZ`!qEfiGsJ?v)ye_oK%_5CGjmzpWf~kW-xi}s9e&=W>>Z&TCu_I1 z5`!OO>~XV|T2*5)>&DkkmD&l9pSM%3NW3`f(C8BqH zDU%8vjsdU?OsQn(~?W42XY0uXZ!H7!YmWI@j~`6bdvCx6|VRr;d|Z ztD8ReZ6oGH_VIwx)txEHl|!vB8)BlVBmuSZ2j|xbV|;q-=N4gh73?qW7ZPNdr&2&F zDGwnzriBs%k0GIkK(aGNlV?SrQ%Fzng(HNa^_AxZXZeO!)Slk%3r7G1&;2A5DM6XS zlC%6FwpkHEA;ZRysT3+^7h^8X#-Bb*5((h~3y%UXPr9FYtmqY@G3(GyDl<;G7!~oO zry}QEk95xG4Lob?4R^xKg0!%Kx9yzIa=)Pr1vL_>AY5Q<{iETvGW4!`58nXbQ?6&iycMv;?H83t-#R7W0v<&*$gYy|~ zr^PMzrm%B9w^5t*W=DQvI^OIF_u0zOV-tdUALK-{3ABduuVQL|1C!6=*FW$@oJtdR zS4gjE&3wZ}Pe{MO?y^BHJIc3;P%cuA-TxclXPCdC`t^0r@@QnWcYDCTEq_jj@;m<( zS5f#L^hM}VTPRgrN7;@(gKn~d*$i=E1Lt_fIryK1mmX)TX2&mc61Fqyg{0sUyU60y zjD5Y>Z&ewy6IX^303}xUSNG7_Z)v``D(Kd~OT?^yGr<`*1$VomAwQj~FuVw*=})>G zh(@L{KT8zq$2?Pk_{~tM7W(~Qg+$iw&aWnjitufLobxP^$}C7YLac*~PLbBT3`sf4_(HrZ*su3z^#JaE;lZn(r(f>)$H$bmO z!^z@JuUe3;?QGkg(3Lx3T(Tdm_n;O;<)bx+gfESL44opTXo{RwdTt{9iv(#(%|NMP z=k?gDEzSVB8~9>X5qyJ>Fs``&8b9gb{El|Gjb(SU9rcbl4~PSHSC9>p{)e1gJ%{tu zQ3l?E%as@Z<Qzb z-A<=tDHY=OATKrZ?R2IK;-osbM$((knQ~q_(L)R|7x|KX_BtYcBVF(yjS%2YI9|Y+%jOmo47MCnD%2dxb+EcN zw*OaxKhzh^el43pl(D`b7aOu{j=S3Z{c{V>T;C+O3Dq3#ZiKs0g~4M$OE&xYVMnJn z;vBGcAeQYM@ovvFCobyINKj}`$IgCk2JfRiV6a@5{(rIRp&_q3EYC^%WvmMO1%BF1 zd4_Z|Ozp^(oIr>t@nkgy6oT*u(V2R#Y9i7g;qM1Ayh1?<6nz|d*U}53c>K8vIxlZL zW#Ckpl*4|qsNB)4I}ljR7QXAv3{N~XYNEP&`Bm#Eu9e?~ds{1BvX0iqa)Wg!NN`vG z-H1l^-SPv?>bk(8@Zw5z*{OKjydsXylj6`TW?0tbkwhPR1HW3bd2B3*5kH43^aSrH$p+DIo&4)1uTL?Y%n^1nuOKarYo-_H zAujEkU*NH=ZvrwbbtH1lx+*=pA`oUsy?wM(l{>b#VsiA&rXY^ix^(vOG$XBX=7N#M zOt|y=?nFv$v=4ua6gt#R>ch+pP3Ci_97BqWrJJtcJX2D!vsu&3LF3FdW^gc7oAGc3 zAEVN(_2;N&P8)Y*og98=$8-2w#9CQD+aOU_Yy%>UyDKl0s z_#~@Kx8TV-)JfN;?)Xb#8zMEF-)mS3pRmQEqaq*rx+*NFWf_`d)PjTmh`ov8GWieM ztEkRLJprB5B0OaUuqU9(O^uV&I^iaMb*4qgtt;?sq}5z|zKg7+*_PJ*PhtD5pj3cP zlx$?ubmCQ}cO)r#O_0r%br)t$JjJxe{wpNHZJhat8wE+O&MTWc!4AXDX=y4`_OUMV zCRVE-Thta=Y+*N96kBx5u=D0j7;?UC&Be5M=K6nh#ka>#965w;Mea~5O+1nRE!GUb z)1#I<_`d_{;2Nyn7JVY*a6|5Lpkl8$Y-$sCMsup-# zwV`R((%~swSp0)ctOyjcY-|Uu5#~}&%m*4`w_(Q@&DKtJ-VtjCB)%Mjwv5ne2U!>7 zfez(s1Y5J@9rS0`k|;T}a~^*F(Z|M-47Ac`L`hQ|9ICc16gZpN5IOHJTrDXvE;@$cya;}s!UBG1C_)~C{GI8V~;#muj?$Lb`u z{oao}EI$p%T+KJ)tKRyk=Nhk9L;$JO)M#l#XTM8CpZD{>5Pq{jh zJ)UuLT(S(b#}Yc8o;z%d5AMXa1LIU1jtSpQtu28eo{XrZyhw3E4y`m9F|)mgwo-PWp;w@)ndg3&eC_gm7tBf0YQ za<*1<)dOe6U-+ue>Y`lMR{MHq*tXkMQJQh&1OSjMIj}C3_}u@R-D& ze*Z{;@l8w@47{Y{J%PVMA0~GwIE1lKiS!tf;6rz8x-!;)FkFb%J<8D6wAG zC__kj$?3XY6RX-H$DKu?flCBHL&&WZ+P6 zuy$+gfo1vo=iX_o1mW^NLsWAitFZ&iY{$8HeXI5?cD+XcPo`bpLzc;9m~hNHf&9hW zSB2z=^-e?$)^#X<3(0d(N2L_%Vl&Kr^I6o*HtbbwM$xV=tc&=IptY&>i#+5RSACytnmGJK+94iw4K|3Oo1nHt@MkG$G ziB%9b8CxIqUdv1K++~(*t}((OAdb3}p0WP`C^IQl=xg-ulDwBSGghz5WEQZ zDx1aKZ42jGKU|7B%CWyZ5|b(ZwaBKQj0~4&y?(6V_h@S(mawmDSV zPXMg-A3>WjmhastFVtOBx?GIcGxhm>xG^;$XS;}`JbpN`{a&67fAE&&P|fhK5l4Ix zcDEN2kA}9-{(wwpmp)#0uYUaOv+{<0*nhCkw$^X=0Z$O~yZ!-HaA=s2;|ienu?s2s5aW^2DlIci z7cuHRrcLl$)AW(is`HiLI!P?d4AR(ob~>Aq+^ss7bBk?g2fNm+-YO}yWH?#Qdh*IO z$(E!=x>ZwKrBr_AS>5u=Iu?Jeddu|UMGks;$%N8qEc3Ix+OPuqf+SE&EsWKHrc%iYvO6u zx2l<|88myU=Bj&0?b`~c(E&@%o9+nXqpWH~P4gLcUBVjMESnYqku_#b2M5hxPzT}d z=4Yg-=y%9fe2wucEq{Moxbq%Eu`1>{BuY*AioN69Wf99C8n2$eEX}IKu7_Tb_{o%Y zu2~}xWbVA?dfJ%B0rKaTV{9?#Tkv%gKoYwOF8$bgC4YCAW`ay744{3{IuMD}K#U2f zA4iUyhd~&QRW-H&?ho=| z0}P3kpVictq#e<7slaURTWwq9crffFb5`*=$82}p*f=Z1GfR!g(+0?#Adj#bH7Ev* z7-dAo_;F|=1O z<#r`)qPcvcHSMw-lM0V4=g5*Rt8sOe8!l5WMOB?s*D6ERU*l;!tVy^jn{J0voK%EM zkxxR(v*o_3l+SfV`w8=-gl?9R(PXxY2litxTn`J)M__X7}wT} zDmaHu5Gz}=lmSk?%uHpDnf76!dNa4_W{CdVa+ln|sN}31TsSqswxu<@0_KN+TRqTj zl-@y~Z$J>*Un2XLcoNR<=`RbDk>unHd+VTBE_opTz=iQ1$Nn>71lL!Vn#7Wz(4^ z1(K`+jtCsHXA#cuciIxU3uXn;Q6s}g*vB|x;t*L08rXu9LX3ztk%aaIk`RQ>acr{y zfPy&~&oSGaSvC^SKFg5vh8pb6J2t zzx%m7`N|-pnuD2`B8ES1uhg4Lnm#4~_`Djkf2c78UpD#RyPcX!Z0xw$mAOQA{85`D z$OThS&jyR?Xx-2Iqq?Lau?yxz2&58 z+OD2+L&Rq;e&bo!Yo`5*E4`;csY3H26G+soyqxe}ZdmS)KTy>4Ih?{^&zNY@|5>FC z7@YO+oTLgj-LTo%EBhQC-SBt`Tm8{NY&0!eXJtIR^t8eR^)IfG& zq$scc)w?)vy8bwnLxe!hUW>-?TZ(_O38)2zmF|eUzb=kJ@KRo0jw6o3OrbLE0lRP+ z->wSf!O$zp({!J?ziLyaq8!t0dMWhOVh5{ilfoSNKKR>-%5Rt7w8BIF)|;V6&fA)+ zQUgrONF5-f+8V}(vUI-4f@D^QO8~*sOQU=y;RIC+>;jNyVpqb%&xR=cl$;Kik9lLg z+H+=8l#y+|Ig1{!OoCf0j_hcTT>T|i{P%L9p}DRiuaB^rse znJv##j>z72e{hC}AxFq|%?Coy~s($sQ|44?T1d5n2 zwnp-cm@u!MUn3zpDkw-|1N?JlL{0;Ygd7S+n5w_&Ox>ZC%4T$AwlMKWpWrOl!CS%T zO+0C4+V3Cbjc6T`mTt2cDo04Lx{>C>4LoJP{C=H!lSsoxWK6FSd)70eRCDTyy4@3Y zvmfT0i+#;A%4VrFrOcT&Jk6gr1Wq}x)1T#E#r%JMZ@B=1qZKFGBj(LMH;=28SKdE1@A$9m9|-SR9~w1ov@0E{2OjmW4DUTa_RY#J zZAx}Z;L}FxHf=AiXR~8}-y6!x z`I%QsC(XaJA>ZaAT=$}u`Xxm*%)cbz5Otg>)b|Bs!EfB;fa9M2pzw~)E&qn@P?|y$ zAC5QI%$j(?M8^CX?w<63@Y-c*rhQqWjn^wMt7Mkba+~Fd!fZC+!tz#KTTJjj(I)h2 z`F-UVyhGkvaB=;t)dGJ6AbYRoK!9Q7wTJlP^lQrpcpH&*wM>-? ziphBM>T>EeZ~NV&wP30a-f-3km14@fFhAU#x&*sRBRnYnqPy@R(AGz(J=G&+^A5Zu6W^D$ta z$CPPY^dFymMb_e>?nOC?OUjf&lZZ^JwB zb3~ulcch<}+>s~-I)7snzx+lho^h!L)jK2l6?_L@;{!z?}_>PPrM{1#&4 zH{9H_uOr9=iMA_7of3cG8zfTVhc>^aNu2wJKA%~UFx>}p;!0iIm|_Eeq*K(s>{-K} zX`}8`jjdG_u-754=K;QAchG^a$NAF@&~({!(`(H>%PZ@`N(9SR z4n}2Av2<7q^3HLjK5A`fvHJn=F5qirfpONo%G0^f9y#p2;@b{fYTww`bjor^+#oU^ zA*cDKkbBTN7{5bLU#f2n&->9e8gh$}7IrC;7W#&`85+L}A8b>7&`k7xe}%ktaDGp? zfluohVhK+L_SjUStUdZ)WQzHr1$Hn_JVbM^7}GxRxTPI)o}y%4p;G_M(Kw+ju4#F+ zbzq;s-7^%fZdadWz55YF~l57^@i+8BM zd^vHyFe&D3QXEsbkZnjl*<5cmEprb#H+_yM760BWHLF99aN=xvd9xPGM2qsa=PEO49Ok?%uD!8U5lWCQKcLkVAj zbfT$1-b9R_!E%rk$lYw2$JYX4Gjin53OI9_Z(1zfSmQ=S*0_+ci5mSf#f{(C=XF-Y z?%3Lptw{gwt~!0ynn8rRh7!HvxWCO6NL@NI8xy&+Ga8e*Ihl_z4$sY|1rGV9a!hi7 z_}eHEFZu7jr6Nh%lbMrGFw=~CUD>z5X3qBLQ+CFGCf+GeBV33y2k5CcnK?7Nucp(Q zj$2c%lr9e}{NreBg<0;<&E<*exS9W%zRTxqPdxeM2#$NzAy3uoBhEbZhMpK4o;TLR z9T5jvQY?%^;Y`_2Uz&ELpD34Ju2r~26nE&5SxxNwk{_iz^<}v7=<;(O4 zyL?k>(Ox*DWZ@MU6JDjsCKXLI4-CbzlU7lFNVi8r0&$BNlCOPEgPC|ENlt^8hp!5y zKAHbnj6G`4AChH`Da4_c9&uN=QXVVjOeatm?= z%2c70yK48-UkQEW%F&`o$7i1a5~VL01SXYa$Wz80$tU}!Em0NO)Wt0MR^SU}a+`9U zng5~XupKgOj=EAV{7sWtNBrN2M!+s6((d+jRc+BDZ(+qluHL#BD{p0)PJYT zRBS?E2!#C2{fE{U@noE>#DH6~UCryuOzk!e0=w`<6@n7%67wlpvkbqw{7OR;u}&a| zPIlqcY?@_N^VIsmI$@J!6K0cU(@OKediZ*86JryYZkkA1x*WJj*FQNAh!jA|t z9`>a7fU(1`ZSErM3(bGuMvy~mNmT>?3&MGy3G60RQS%+H27LV_?gAmLXt`JJ^orS2_fp3;d>{#!{I)vF74PrXer7*whRzf z$L1fyKFe|$Fzln+0Ujgbo``y3v=*Rr5YM`B6W74qqs)J^1cTW}0K)}x@r;@3`x(nP z<$;pFJkLQcD7B%w%+sA|@^;z{*nE{r9?PG2b7aB9C(bm1p^_QwlJKMo*YLM5^B;qR zV$WVTxKf&M{;(%qO&*C`$R7mr>AUZNiv(|xiH1osCEQ;5#JM@IhQ)sKJ)+N|G|GyL zloFfddOVr3M@R1wfU68bvzvJfJ#oe@x9oeufz+%lFyehU$j#i_RjddyR!nL)F=3k7 zCsm8*NhH7pgu4g$dHyR>YAF;4`{ZB~T$z98d)JLpI3*hC-~SY?HIQ|e6!L9sCRvg! zfpUboT58s8T?L^oAF(dKjB=I=Z%3KyXVJH`o^-Bo;B1*iG=`hXR3K4u1hs4(c;}4S`i++qkV4tO>U`mJ#YYEPqM;00A~Q1Lh0-=`z;*Ti6{}Zd+)o+GB0e$sQCiu(UsqZx7qEhNztC#QjqRLr_$YB(jXw+(xEgWAbMz}ks3-uq@<<0Bt*Kq8$m!2L6A2G z?z>lgzdzmxELq>xd+*t6Mn7k7r@A1FNOs66UIpyd1Uy|<;esJ^bY5t_W1+}y@j--v zq6%eL+qN!uMySgdk5~2u2~B#d2sL|82x)t<2#I=~Uw5$zYEodb)X=DDJISWJyNI%o zJrnN?aU<#UbHnNMJGuqvXMq0!?ZXG0Ga^Nur1xTx9`#3xreO%!1`gJ*Y{5tZFQweHl)Js0@vLR2W8AxDu} zr#GQf8TcUYeg91Ruy8UTrhQe+Vi=!TH2z5M(X+}@evR)1#nxWJI_bKbF0k{6b9suK z!Gi3c8s`D^u3R~s?``F^&STHj#BxgW!$+8&>!@W(&SW)~=(?Wg)_2Qqn~mWJKUZn$ zxKDqicM^cFyr{Xzk$wD1q+2PYo%$tOaet#f}e=e%R;of$V}$p?&y8t3Xy z)Fg7Q9-QWAofn*Q>~`y@Os#uS=P5o( zomFgmrfJAANuBMu>9bndog}HyApWw;y5u`gUY;Go=+Aye2gRi{^?tdgQ6!H zeUt0QFsIr2tgObDA7s7Bf4)2lSqrK@bTiLq4-J&{Ug3Pj{!!ckZ{TaES7KoYr8)Yq zv@prM<-zSAunI!hKx>B2g+Yj<(}jI&hWv$nJ2g(p?azmKq&afr0G5tWQ{qqSmli<# zcJf8TuqIcOE8$g^-iPi_QwZ+R?)GA1N#f5s_i=E>g)ZYygstlcP+jT>(l^~0*`7=b z5xJp1;6V7*$&MXe@H4Ula60~Jj9`?-IIGn7(XA6F!OU&dsn<0@C?v~2tzOI(7 zyQxzeW|BpfRLj2V?%|S4hwMkyp4HwgdbP8u;%ZtAVtWXQr1Crj-4C7Ob?V<%6m%M` zZ#&o@C&4~sV@?n28qn&h?7hsVF4kkFwk+o9pPky?BnzMS?;;8jQwc38QxG$8l010< z9b;o5N9FC6e-Nc;`>3!XYrNtyR9oG#JL=3sdwk`q-ILPSE>0cE>0PaC(Rm%Kg-*M6 za>RlH9rFugJBN5;g`@K``1)Ggj=L^DllaLUKU%?DQ=dV9sY z4=p>|@ejlEiJV>tuD3y=6Oz1w0#iIfzeG#oM;4o zQ6-Av*V#QvE~|=gWVdAf9F$zJHTd`xa z7xNhtvhXafc0I2tK(|{jK0VqoSR4uYMN^7Cd!aQ;-lUeE`*79h;)LoGC#oQatCnW-}Rw21amuyt1r-mw27b})Ak zb@Wzie0XBI^V+_ur8iIod4olkS#b+3DeB*a-?7yZX0Uq&E^O(p8In*#>vf()->SaNx14 zaWy+xs64-{BvxnL0Q8UCU9j@h2HOq&c3p6Ei^-$$)6eXpf`$7xopwK^j^J;#6?F1X zBa+ncq3G&!bt*OF@%Oy-#7I#q={&3~v+*)a(L)X(ubOyTTAf)R%DTIow-n)M4|5i% zr*8j%scvU}XW+2QfPK$A?B3YRqv_|g#>OHYB+x+I_lnfvG5DWjg5s0u2_C$|(Xiv} z3|iNrjgYtOM6*PXbV1X@^gw%7o!2BxVHO?8MO5Ej&a5nxEY z%z3eFwbt1-8{Ki!+`xTVT#FXq&RjMg6Xt9X+A>o!4ZB zd=r`X*wvoTr6aO7s%gw_8|^zCL-s$KnmOLGF5rkVUF}7Y2a*H!c3?;PTrHJ-|4T<`0}njwMP z2`dk}C}XF6#=cB^>yPANq+o5k7=V5EGv;K-!>>8>(`56kB1?mqh?KTdBfCoFf9K1n z>0jH5EEyW-Lme_nGFqThD{7PL6ieWi>8_szTYi(a#%BJ$ttWyGc_TCYdy$RGpLi3J zKKNp6z3ne+F1}+-O3mLM|Jp|k?bcjv$4{SvpYH1jx6L_X84b4WxN$zdZLNXfzb@o= z>*+XSk+!R8Xeavdj5U+Yaev&$Jo0ICw>oJ$!?z!6_UXhQ%e-{^yPP!B1T|)q-*tss zNt9qBloDp+kr?K>W^9jq6k~}OC3q72tZ;RPYU;tFp`6Y9-Ea~HN^Q?`-*iumLFYBL zM-d#3(qg05MXMg|o)M!_ZPiI1VNu+-9mK_x6LO)EDgto zB%Fw_+Z}yE&RJJ_JfcuI->THnGBqiSLguae$X2EXq0X-I3!@9nJdLO?p-c@n`IG8Y z;?K3jP2vK@Zwkd zM|LI^nRgyqk7^McW0m);X46X##@bJvi#>f9{E5WY7JEgqdU1(^{JP-o5NBSO*u`xyd`?N)x4&rGt7U`D;|Dp=Un0=nU-nMJVSaCq3H9Yo#Vzr4B@dvN1&C5K}4FN$U zvx9rD+V}+7DbMZWO%c&h_d5&c8jB!ET30*M?VO>9f(ui$PTfL^J zS@KrN6j>7%te>>;OcY6*4mBTW4~vSL;BPB3&G5|DT0_rSAkh{0p?NwO)=;pQPPg); z^RY8;QYjmnfdDE}SO@Xv9Y!BS9tCwe%wgfTYDnQ6gWsyF`ATSQQWp=N>V!Ac&F^-L zkDB#`CwAide_}Kjz@U=8JbP5St}X1Lfc}2gh+EDMHboLIg~4n3HAbW7TL(q@D>_C` z3u>oj#NACI*66M_$oZjMW(@NkY^1j`mn`9`J^tni!_8i?3{iqzIuv>@KAoPnD`;7l zH0!+MO_?!#Xxf@L=zn`oEc0z4N+XtSSoxdK#1)5EPjxT*5&EO#mKT(IKH)V-I7{)k zw5tTchGFIdoi3arK{FXlH3O4nh)qpaXiizcBzkUQ%;fE?@2BT1T{EEz!A0WRCOeFa ziu#T_c*o)?+r@lEya94PCGGOk+3CZ2PS0&ZjA|o!(!@Om2sstd*dK4E>62{MUb1#h z$GC@Yo#9spsw54zAZlG6x80&2Q0-`dvGyID8^Q*1RUQ?(raPThlARJ#p1N^3$9Gz= ztn}I$@H}DSDOTOys^S_Nc`qs1foJ|oRD{}7#*~#rkT#Ap1EX<4*XOa|)4Br@w(oqE zZH-+5t~ecc5^Y6ogNVxyR-9(aL(<(s<=V;7zz=pB-+RPMwKAMXxKT(fBFO!+s;3)g zuP6;RB5={>j`7C1Z_@DNa$r=j&MH9KM^NCJ5vH!S-?^^1ZB_l08}@pyc!on@ z9%CT&sv+r$3}d79`sy~{(zgB%;C|-O!Uu$ zo5p9QHp^%>d3|lrpgcVH1LW;Ekh{bkqFV zLnqsZ`))5VsSM@K2$Sd1SFICY*;0Bb@EPy{odj7LRm4Aay~y-*D+QN7jW_gKRj7H* z!w%0Ul2p|-+_RkRWxzXEj>Ky=&!01$2p;|bqvYLh^Myaw5GdXee%rV}INJ*O#uFyY z+5WoXd|3Y0<5$?n@l+wM&A=^McJt34WyqQ%GWcDGWnf4(N*Q9yL|FGvXojixET%kP zbw63aE+4XFX(rj(@+&BItYV#O#y;fM2!^!;F1$=PFl%|3KCAFmI$c8QX05N(P>rr1c#m-%aE&_byJJpyP!RcMy0sJ1ECHFflJz{}X;B152l zl}*{gA!9{FmNj#9jy~Cqt^SNazC6KxjYt)N+ zFYYF()`#WV#E08zL%ombM%5Qp&*qwm`wnZ#Io)cl4>N7|kEkBA5{f6#ybIhb%3Nre z+rgFW;Z(dx%-@WQS`T9=!`nifK<$WGBKdMg1>>UsShSw?80J+yXh|IOqB&d?79qLj z>hwyAvnIZbOoroD?igKZX;vprE$L|13}ygfs6GR<>(*98cZIn7n zDVB1XA(Xl0r^T&Z=T9hGhqy{Tp$Xh;-h_H_)=-IB$xj3r!gwDs6ut!~8}G7Veq+xH z{^X3ro-~-AhVe#~xJiq9g-q_}1_|>8ZFXPSAgPkc&}L*B_~BJct%Gy4H2APX$6)T^ ztmIVAOGd@gU)#&ii{3IKXQX&d zIJXcYNS^Fswtl7k z$a`Bt{(z+Y$PLj$XU*AbjX+PE;KM9W1#^B{^8lW$)CTgP{5hFoOJ7w8u~CVSvElr} zFf;Rl@&TEQ2CP1c7q=A0r0ku$8p%BAN6(u4&I;v^w>F7uDh0ju+E`xe=fUD(C_G+A zwR+*3C`l_Un2opeR+HWM#g7hA?o|gfFKXLu^a^frk?6T7v-(QB6{lwH7!$x581d|5 zCwX?xHb`ck|I6-W)Z24*Nw4Of1`)IHqNim;t5bY}uuj>w(yJ0Q^&rpas2}{qEhqlL zkLo8NgvG&CG3ZZz@FKt_WSC(^FJ=1JxrI7n;zA{N5#-Ufg@+LLX!$q%$aP;9>d-p$ zqjK`SRfRly)-hHp_iK6yJcYeq`>lBU3$OLh5Bs zK?aZik5LFtpRv2d)7E&VIDD-#8=7~Oa~AE+>H|T_UjoUS0tFx0VR65MCH8N%#%Az# zI>>xQ#TLXWk`Vq$OykVIvt{6P_&o__Byvw9;#_2S#&2vUsDQkVsK;?dC||~jWP^-5 z_$XMv8w+c$MYU*MZYIKeM?FrChu}S4bSGgwb?L{x?Z;5zyjanCRAHx;!*_p|Phn4A56i+66~erl45}Oc(Q+3WivJ@1vDLifeAXyCWlBfK<_7U| z={pl8BN;u1qt2(6WDmnL*MKL#0HHz?`LCP>1TjdML@ggVcC0bJcXeFi6Hv0iLPP2l zJGP*%Mz zPxdn$dP_@XFVnV-O+ziWET6xdc0iBH6iqW7Zb^^J=Z?q-C7-)BGiY=O!%7mcc-L;f z3^c@%RuxDJJ`d^t+J*&NOf0xXoZ$=Wms@4<*~VUUbGCHcGf+2aI)3tCu=&>q&rD(C z!D7wtFusKaGtmXfy}0{q=(~V0Mo0X`OrrTV=gA0XSgh%W%vaWS&I8%?!Lwxs3#%dH zG4)@k?QRlhp)Y>AD6GVd4>`o|TBI6IHG3yb;dcEC}GhuqEvMp-5S-RNrQ& zY+CTFbslSC%yzp4I+QWAZqDBy8*kG^={s5@qbgvT_)6SZQ5ni-o9s$BgX6(MT=~ z$aY^dqG3Kb=hUF&jgiTVWt(!|*^VNr2C0g>pm6w}{n zKW(iwEgZLE${7}j!QRgxh*!gF77mv$yG-RCkY|S$yFEOe>zz2?{(_v4iooWLk@q!+ zv3l_ZEoF&d(ZM8)ni$EE-4mKSQ>G!C%_^(`V4Yw^HRhm0D*`yW45KvbSgl7p&y!Tm z;|;cJoP!KKH_@1R+{9Q@^!h!X*plns7P{j3LikBQ{R8p)X>$uI1K#l$D#FwJz5UK5 zbJfice&CxI^wp?tyxF?%%%<)*V*HFF*^of+5jpdtjokzzSh`P>8!+*)-)TF0|9N74 z4&F$GHLcM?LCT?SB&Yf(ABV|_kH!m>>oG)VIFA6&+bPvc2TOKXT|sVFZtu$SX4{vi<==6PYaXzIbQNvkoSGmBIz?|Bds+&`ARE28oX?ymi z#Z8|bYvi=pj6Pe-xYVYrH8YOrwvBYfIEPJnuZ^DR5g9KmPL}nFNWVds-hG>C)QyMP zyOWiTvL+49(%B&mr`qF97924}{GziO{n2CZy}k1q3eHKI-8k{O80m9ocKzBJy0x=B zEf5y{mbAEJ?+klL8YK)WM+{$0IvHE$;Q!#m9OJ5f5#1@6(CbrZ6d9RIt1?Zb)zppy zYx$Y6{6hEkO4s~&- z`zMk18WD^x^rGN5hZcmF5%mstM)a!~M=jk^=WdQEhsji;$~BAYXs;C#=VgxBynCor zDKufb)TddH)ZnX>OF_TcU!Cuo>P|Df)cTj=%%_}oQpFRmFrM1B zwo9nZ^+-DWp6jTuiHf4=sio@n%9zLm2B!NL7^Q+(#>)od#4 z=IZ9$!;^JOb+hmS;uvncrUw3ZHqeH$0^@ob&Du_1}yG%Df{Hn9gjzR6mz?` z#C z`qED|ZBp*pa(UG~b8&%j*+A5j~qYYrOb9g>0hsiO%OfA%}7f zQOgrD#r3SZ2Q71t=ZP)dyAV+plh(3>`Q_Mi^qC!}#%ErspjQcZxZs6y-d?k_isQM= ziSM$3S-+=C5FYFq%Y2M9aj=EZ%l*06@t*NpF6=m~i5PseJg5l%s1}3{<#*8k= zYlOgL%r~5l=ma*)W)}g@_Q*&br(5LJE6qIQuPHz5bW)fXFE%7@3Mx>{L*ZZbN#X3n592ww^{6~^jO~Yi9RlKKTLeqQ$SaiNq4pFp@;-|P3+o}&dlpgFs8rioz;@n%ZI|Vt;4A1C4Qg5am zGl?0nq;FCtRUW*ZS<$kV{H7xCGNX;1U+4}!S}d_?+(jQs(Go`- zo0KH76x+~x;$>|3^jvfMV%<}e%vX2Y74qu{+Qn>=y3uCsLtJgO!U2S4Oj;uLX21EK zbv;PJinR8Gl>fc6R~1?KfM7EwHH<#)c`$4R)_>n9{4_51J-)}*V-n<MLz zw<5fl1V#7Qo8#9o98#W2J#ne|GDMiS)^B0pBq(Jt`sMz#=sS@&0$+ok%Ah>38sCU7 z^JRW`i_R0}%l-I9Ss=$R3V?^B>m}*;Z ztv|~m%R#OX?R;Na49W-!1&u|1IpqNzd!JtAXF*;KHX`Iw9;OYIg}32~!IiNatYR;} zJSWiLqgiYW7NkL2*-N=y%b->js4#jEUNpkd&`U{HTXxQZi+RrY`oj)pU!g#k) z?H6`q*USki!~B$*eA#tB{@5C5JB*AZm7-qF?baLzW2P3ZG^;#uNv)rAr>+YGU5d$8 zcUU%zk#0=hZ9vYtGt zJN`$hX_5W>TdBv?ZhKk9Bfdk#9u9P|YgH{myNgjX@D*2LrndGZc^QZ4v-`^ZxcBpMnpE^&SebK7M ziM^G6zGw2fMq=?-@F6GlS=SdB??UePV@|UlE4#c;FF&6;yI@_OiS89UUv97LX3QPF z$pNl*#%dNV&bKXIoL*I0Oa2@H*(gmU|P%PaWIyhceTp7vENfrO4*dkC)#}eW4QbK{tw+1!z;(k-5DJ3RmSL~fWFpfm?HPZ6iu~> zd`2r0FUE!AT?7MdXRm!<6cY3Cw)eD;`ZCgd%qNRlm@8|) zGa-2~U!1`b$#i%ZxgYId7526l`|vq4x_=Qg#ah;n`jHY)(yJYk*_$XHCh{&QZC8j) zJjfyexB7xKgcI%t`wi=PZ5vDufdEoqNPTA`>e46+qS zCM@FxQ)DDGRP(vvp}Po$sQuxYadWs)i#tfG!QV>P+MQR=1_WSS2lLU}^=-N_+Ja=* z@4MI+mmjRSW7WGLTxFKgA``GAK^9gQl$7@{1hya2`N3p#=2McF8wujD>iCo;mMLX- zyG28)OP->khv52P)@9!2*uUqlayPIqQa6kOl3eR2wbWR8P!YT9SlP>m?11F%H@#+r zqV<{$XVD?c1q$Tw5y9{Mfs z{#(N#9GXx2`7y;Qjm)B~1HP}B6UYe~nx)d3{P9MRfG^GMpJTf8 zyzaCntgPEmp^|dp9;=;rKGP8N|F$$NmJ&y`V0uWg)b{=WTOa^y73JtIEoMc5yj0>X zJE1!d=IuHQQ&4|+{gTHVC#&lY-guu&_rNENk0(bH9g!G@PB+(=MTXBnI#oNF*N{*4 zmeSJ1SENtMl%pIHNalx1bgr2h&~r$oH;)z6E{Xutj$vaFxOXCi{hW)iwJvC0I#flL z>T&tOy*fV;tTtm3myF36mQc)nCypH_{5f8-&{`w(_AzY#ASwBWvYAr>s=>2ZR9iHG zQ_`sAf#4^vV^K8I2w8EFJh$ccLTf_~;C_bN!0_tHbl}tlf(5U_DLF2gM!;0r@U!G4 zqM)H3+z_;Cd`x^y+z5PCn)h`0{Qi_ z@)4$pi2%(T)$K4|d{&$H3uluV?VRM*I~}as)5(3}u)6Vd4JLf7Wg@j9`cKcZG{gv( zv8kxTKZ?9vj^fIFx5U*_vFyTzHE73>@+xF?+l7G~J#Y23mkkT$KBhukvXw%=vO9RTRJrWpocUW=rdl&-Dv|p_Tby>x-LoI`}w4nq-|)=Z$*z zy&s+;RZT}aANR34etV{J_8kAmo5B@An8}eqMNQIlp5HWMVG{eoX;c5vmHK76QR``{ zGw(B%WO1y%`#Rj@i`tF-TkO^zjz4i0*($kO`ge-0o)}vQR#PuX3e=~8A7PjHp?IYM zM?9}%4~8qav0!k%66S?R^t`oL&LaK2x_HIiP~pzc-=L!m8{L!bIl1oj>m7_@I+fx< zlBik~8+X-bS03yitM02Nm7|7E-}?TQT(T#Lh5JPvL++4hdtPP#+~TCNs~Gn%=K z#I}rn4bVT8%biXajcv2r4PSh=qGw6%D>=g_@@vD7e)N0jsXXjrJeoR9?AN)veErq; z?cj9r4uP7-*J0-!LVKjiD82~99sphm9{Sqzd@ZcQ3 z{)z54pI_M%WN)_2^vPNUO;Jfp^rMKvt)3)(J9;5as}5jJ*px87kY9D5U*$bvF&MU1gxgyqlf=U zkTR@=NrfIqpK}&{`La@wm+}6CHCkW&v}DE5z(phvuDh~#*bJGbx*KyY!dHBI&0P~? z@YYWRGY-y$mbvUq3*SX9-{u|<*oE%NuCWWf^_7&F)Az)9SL#b2Y!G-NIQYTiJxVE! zqTXAqO8fQ^^-VY3g1Z+FS-vvJ=l9Xm`O3%Z+YgDs)U4fwF-N(F*xq$gR`vIqQ_pG! zXU7KKy_(5%Qn7F+i7pOCR|xpAsPHoX0QPod#du}LtCpgAZRAc!s&A>MBT@U_ZimMu z_3y_n)lm0hinD+x*1R-5#st5yz;A5u8>hzf821e$0(goMIbMAeNNc9?W*LH9%toC8#OSAS8xM_3RKPl7iF>nFx^sE-j+8)g4L-fka*a zZ3Y>HBmJ#NN1i96=8z(WdIQw5lm`KD9ltAAn8YTznEIP3qT$7fJmY_>P z3AeauLad1hQsIZh2=G)z-HF%W@-*JWZ+Jl3TuAJJ0aD%?VpSTD`b`p#VS!XF zq+A3fnZzI+W+stG11Xe;Bo}V4g^xrRZl741BpDf`WpX4tYzW?Yscs~A;IC+eagZk}mwcetY*=gD zYcwCAu8pO@60l=F2p|$8*Oyrgx+06^i7A!F(Ox_)%DC$kyNPmD_3IZ~^wg{JYX6`F zFITLnn6=iGd;ylKZ;_cXER{0p9}xxC3aRqa$;4sHDkVwSJ=te z;v86M#KNBHe%3f5zwBkj9NA4=xm&1!rnuxVwY_LJyUIKe9@l3k+`QSki1%cNcfhDqw}n>(IcYM;zyCqWMp@L$SZzX&nqPTY(S;88s60m z-Sn2=RDPjD;L~2S;7#;C7H5zFif2d3$)Kx4z4#ucc8X$;EXg6rXLX)Ja z#J!4GKed0I(PYOp;2uDl3S4Bkt`r}&L|2_7X{aC|5<>num=FO1IYoc~c7jkAYWSg5 z@FV%UK_)*E1cD1Lk^e3cpj;42O#>HlWK`13)Bm{+@IR-q2bN!MKfh-9mI-ofT5g%v~g2K-(1N!06Ro6cd zwlI_m&gBpWxtvq~aGiyr@YB(Na5xwJ@;@#HFe!ZFVG9mnqa(pRFaum7H(Y5EkQ*#< z&1C~3L~dNBz`1-XNC53P3L~&20wtn_=SyDwsMZz@0%^YoX81?G(`Nt4qH=gSKK?Ul zT$Q>EHcV~;P>17h)kwfq6be6X4Ja1{y<+(OV`<0^2^F{$y$KUr41_9S|3KPeP-3{k zV>tKe-ap*>J*3+}qu5Oby�R0tN6SpiBU+IFuYN&n^x!?HvAPVgfMn8~ZVEMBW>Y z@Nrl@{(r)+PxB&fK!HGn?toL`kIa7nxDwEN*VCb{FZd}$&fG%AJ|1SVPr468x1bH@_|CfgexJW|b=imX+a6pqB7?y!DfmSeqOmY;w zzh+jV6exqvaxDX>vY_At`chEL>&QNRIT1Mmr*U{Un8I&yK_G|LH}XYNH`A&QZbbO$ z4b%523N}C^eN#~mX%LAH`xn6gVAB5-4~|^K+#r&#L7i7NP%LV2!VK{3b+;fxAZ6g{ z;QPZbLDs+G82@X&unl9`$>V@3Ob`h7ADRq+s|-}?dXaWC)@R=Wmmd^dq<;$40YjkB zb?*J$;jy=GgC?MVj|xuBO$=piC|H2CEEMNjo^1Ho*ab8y3&#EDC_1+ND~}8G$=;M@ zMixw-yW<9-xd+9+j%-$n?u!{B1Y!+3X8R+26hQMH6n@+u5OojKESbE~6qkeIUr&we z7^r8x6gxrxbmS0-=pX83$N$RH!i_wX1C0!v-7qoaq1eEbH58Wyto_M5ud%P-l${3+ z2>xN?BO&U|!UpB9XBUe+xQ@`sQQ@}+GN7~!6%BYK4~1T@`7(^Ds%MxG2tgO(1Ahun;EeLH%OuIA5H{tDBM7j3LxZN_8$ZVViaylnGT2WX8wcFfh7ef{4`47 z3=VN^{0?c%prZY+nG-Hk{7i!gjFblgVfZ89H-M`ml=nI-K?kz?^k8uaz`^-bi1XJ! zP8Jn!T>nr6D;y8rW0au`fQS+ldOg5mCe<0AuptoUl+*Csf1FTu?X)cozz1=^IMoY%IWo*mZ(m4Vm}0)+NA5eVd2BHT7Pz^Vd; zpE3$atAIt9P(TClRG`!VOy!@|4(Ad%p#j`ZXl%f&%FWnq!?|iv*IefRH7ss2Vx2PZ zO#^J1@BZNy7cf(W@?Q^2CgIat`QQfAru4T^V#l><24GtCCX5|b&|yH|HJ2Rl8$!Pg zTwS7}0Rn1JoNHSehQDUug(w>Qd&gswo z4mI=K{?`{V(64?|hXpt^{NO(b6JXG|2}4W+g#5jJhXVeAQs59_(0|ZvU_s-bT|RC9 zP1rWLHuM?)Uh!#}e<`2>lA1SRXlQ~4hjM?%<29jBc*-Sk=y>9H=;$8^^8pCWuKx~c zJh;(vxQ1vk{!RHd07B?M&4U|((g-4i(${ z4(;1upaFAQH`U&OMk`>heY5T}wLyJ7Zp`08 zU(<#XU(d?x!%%HOeL@5XSl{0+42$0tq;zi5(9{8KVfFqFC4kViE!kKDw1a%8Hc?EWo|L z@9Bkrw83=&{0u-nI?)@w0~*5Hz-NQ&BFw>oYAHCt^uKP+5EZPDXZR3^2Lb{FjQzJO z1JE#p3WG6)8GYW?Os~y7I|Ihu4dQ>c- z6uw=%{oTZ<0p>(iEhE)9?*gSrZEVxtNsgM{;zzfwxLnZ zU`NUH5&~iQEgJ{~5AZjJihy<+;dXkS{A=eH@XPqRRyZag@Fd_rfb)MmF#Ps%0z&_X zgP35rCf)yvYNED6@HN;oU9BVhrF04mnLv5rqnr{PCV25rXZdGq_6eXhg^GcZo0@`C z28WCo@Yf`!1=3BS;Oi8i7S0r+{)g#HO^oyJG-qeli?sqfy?Z8qZ#Bj8|H)(iH_asw zR4>@UrV0Yiwm)Mq1)|NaW9Tyj-Hn@EtFr(^4{w^f?Qg7lb>K9DYq9=O6~>3e0Jk?W z9nks^dJAv@<-wR?4?!c$?*AbqAae@N#P+^s@&YX8*Q-Rx9Ap+1UNgCXm*&^%NpL1@ z%|9tj-7vS|Os7d=;PoUi1Hfi+tuA5#GG*6^0cipf2H?5HwR#lDM5H1BG%cYNfH46H zCfncJtcdv!8&q(=hkz;lImj){a5Xw$%<`sfDjZW;w*eb!1h6amQxX->u)G;r?&v&8 zRCrZsAQ0X^ic<_^Swdyu>#4oXrc?>MW!ixq;-50e(r}OD0F@P#5iS{4goaW89~|Gm zTf}s^8%dZI6nwu1Bw2xJhPwUBLj$I*uJhl417U$T0KN6Ku$VQ-D=4_(J-OjU!Fhz$ zH@xIU61?jk9<;m-2aFg01qcBOc_`-fjZ&A4d|#Lfj1Ih4G5nG18^GKKY$L%8&|X1J z($OK13yHsFpg7Q*UVqT$I;t%jaQJ>eZXM}R=q!9mmfLxYMR3P|%qS;hZ9U$$weprFDHgn@sSxgZb) KLGVcq@_ztST0?aJ delta 33168 zcmY(K1yCJJw5}7}-QC?GxCZy&?(Xg~xVsa4;}8h$?!nzPxCaf+3+Gkcy0>a-%~yYS zueO<8)7@)#O&bkN8=-%b1&6@+^yw4KCwp}iStZl&VJL~{lz{C^f^7DWwxg2hZDJf* za!C$v654|EC5>qeWtjp!B=$o`=K789RrFRvxuN#RMa)u&oZHbBH_+h^uAmE#zaDGg zxg_aXt{kL^V67Z8CX+jXwG{D|q-uis^!Vq6p}IpYb)T*w)lCr(1)`ggw10&7-XuLT zZX;KIVSCzhs|JdiHH@S+QodOD8e(P7WUx`P4`AMit=MkPs7=MY>`&6>7wt*Q-?G3} zw>v3;Np3c2f9re0`)#n0F^B-i#&S$<|CPaY9BNK}fSK2*11GYZ{f7hoU~5>h3WzX7 z|Kv0N4D&|5cciF6sA(#~QXH7KmM9nJ26uz&!**&61%JMsS=8J*3Ftz@~+#DM)g z3rg6fR7XFJg|S6t5XyClwwg~_Lq&x<5BX9i1=KJnk%fvUd2S#$8uI}C{ED}1NLk95 zX&3NzHU9GWD67kl0EL7j#n;ZH{)6sQm2+&nlEL>j_UOP)bSr# z3|%1yx>Vr)gl;`K>XxuvG6nIobU$>gU?2h3yt@P1E7lC}T)g61`MCj8;Jb4CcxaqO z(8I-vvyWdh8Vv;3@+7 zy(&)HSy64SD{@tDyHcW=l*u#+4?hM`kN4vZucwS=y;V*3UnPi1aI3>!JoqFr+uEM` zEVlO55xreY5UX_TR0Kt=D(o0O{3Sd7^HjeW#18Wo98FAZ^>8w_W#ertv){1}?oYOa zwuLG~WrsI=m^f>s?VH)99iu~b0%Es;{bBt5XmZTQvRZ$L|2@0GeBjM|;Gh3gf!V7! zGuD3AJN$r{3@|^Y4}c#AV?zA^zGbjwiVwhi1p`O;06bW5w=W-%C>GgB!F)ibCAcs82Vnbxmx6yl4*=e4_W{A@;8ye>aDf96qVxf-))4DRNFT3agycq% z0s6l;lOY`?7J|Du%?rZzKQ|Du5C~8odC`&~toT2`ZwlfD`vaU0A&%KUKo1|X3F!kc z=^zjIKH$|1QsTc(h zp%|w?lmF)@JPo?H=0lN@gjt~a08)DxPLdDMii7F>&oe;^ObGLb0_ul3`ENqw#$k9_ zKa|l|7^(l7fq@Ro>-eF33x7?kewCS6w zIB?B{tO(95upjBYNh=2f=|si|vH%w>EM-bSNQH3*MKX#so0B=3aFobE6r8%MYi+fS z4tzBtD#lt=lpVGnhNhc_p59oS`yY?V*1xI0JE?N(Bee8WMDJKQZ z;4MEH_UGmKgLy&>bW8skdvCiM<~d@eK8x|EJw-KJl-0UPZ+>9s^W8MhYX=zXdp9;O z5KR|-*!*(NGa1h_)m*IE*E(Wzf46WC8-xoQIh#=jQOd3 zTOc+5QI1WHG^58$Z5h$9WV(u_n@VfYUw%~#bPKS5L3>+@^F9oiZkL3g`(*|zaz&r|8h@#lM{Tm3dQ2R7@NLXi3+jl`kmxlTL(gihMZ#VC8QlYVKJ-OHsbfpkqZ;?r9Br|R_2AfFLTF zRR+7F8bMCYj<8m3jrRbIBHfw=X}|VPtO^~Pr{9Q~!Rd~gbkWe_gb)ZQVww1o@OV5< zeL^T^t$brJcIN3M=4ZYc1lgQpTz)3L#DgWgK|ITwbPqy2+p#=bI7V!Ru>evDTh-Pv zUHl^s!Try6QV#y~u-9wbTNllw?}b~=X1pBB4y}C-qQS4`{|Z7qGp4^L&yR+aad7eskpqTw(lXVUPWJnpdL zA)JHvdsc=AI}`4rpEbNIX{NGK+_^~+l#!@ew6rn;$w_+=MKC$!mDJxCo+CFY*OJeq z6Ngoj%DnduD3o%N_C|`NK2k#^rX4fm5{{)ZEY%GY(RV6?~VLrTw+0Ys@o=qfwDzElNSf#8`$@; zu0&nD&*>%vzatrE{@~=|*!kKwl-tZqai&Xt=6j-DYW@^^uNOAZg{xRpVMC_=M?iku z9+4L+wMBtUBeJb)V#HZ(SD(x=>9;l9Y`yHM{8SlKM=VRDP*}L{GknsO>4S`hY~wh{W>ZU3xJt+c`1A7hx&Hlwxqx(TCd<`xtW_87`=w6Y(0{ zJ|0Y0R_9RxgU*P0@zAz9N+p$WV}4+g)9I}i2-Keg(swKnFaRP&5d%{(%z>h|KXn&> z6pLw7u#zFFtumq+7M0=2P~}Q933mFF+Z#Z3+>s%PXo1KO^;%#Wz{HN$HN1 zwPd@b^rn%-LA`~hVzRRGdCZbwA%tc*q~lyQ=evK$ai&HmFKjn7@1km-wC=q zI7UeFIbvCqn=1|2wbloN%P8T#AjZ*bUdX1SuEE-S8lj6q_e(h@B9}!)p;yx>i?yuV z4E(|b<~ir3_@QwpA4JYGgBVjOu2k3EYxA+9aEVjeX22hdjyLP;N+W@pZ{BeeJiTJv zY>qqf0hDE8*LE zs8IW#L&_K2S1edVmYmqe=+f9X_Wt*jp*3hfU49IgLAAp7fsUV1k)?Jr4-wRvK z=P=4eoYNeHfAnVb$I#XaP;?03F5Q~)uP0v_D*{8M0=VqE-Yk=6zm`{no#KXix4+A( za1Z_E#)<}87>YY&ZN@b*J?q`zm{{0#@4#4j<@&8z)o;=uud-x2zbmWf!x_7K&JjnR z?Mz@5!{!)+=H^$vIhXiqUv$z3p1zBcN)P*+Ro9h64+vUv+2Wnw^TGS&t=ndsb+!H@ zVgAdEWs-e|{wV)ug;n@=>|(l*jk z4zD(*?M?G1Rn@r>nh}P~DFsIw*=RW{8Mb zO#6R#90$d)uwbagD1{}9%py&pV8c{Il+b)r^>pukLyt$<;pcdWjOm=v96%Cf|s+V3vlvBFn7et7#Fdc=c45bpI*~ zPsz-Kd*^S<5^pcUN=xW`XY6ys&Z!lX)j>NBSRl`KSCPFuVqEcqMx5BW+ps%{mVpBb z9Vpn?g}&TP$k&}z!pt7F&8aTtVE8_nnDI%iAeYoxBs1J(+{(i@O+`0zw4WlWR5J3! zEE=1d57C4zKADQz{N#N%Jn<#Tp6pJZd@GrJ^K;EHS>Vt&QC<4g5dNy8S07j+pP5FF zhjO~b-}Ozp`Gp97Os&L zAI{iXI4-y z*Lus}w#PzIyeI(>+2Mriu?e9Rz5-%y5ZYb`LXVLSnMCma6YrXgr6 z8~!}zkVE{$n#iGJr#J}fo(LesVU`mxxQ5 zbo`9GZ;AG3xs8TpvgC7^m9tp4{&(FF$l&j$$vV%tHij~PsW#&Aw$)Icrf=Z0gh0)oaZ)-RaQn%kpkBQ=|~^e>o_jtAK`YzK(q*oqQ11NT|G3YUQvZfz@WedN>K zMnS@=^-LmuedtIpKdA45ssz|KRx1aZ&AOb-nEw{IYn`ek>5vA}%`oLvb*|BJ&DzGi zBa>@vKimZ?)_9tPzGEB_+a5N(6}Zdf)bDxLO+tbr^1ENJ9YHPQ@mp)EXM--sx= zxaA|352wCtRA8se`WS&u^n%1URV?*$=|Yq{xtGp0U1o(}BOdFot=eApOZc_V)I86V7>vJ;A1b%`!prM?!- zj8ZzFK4KrE`H524zF}dZx;Vz^mhNI=Gl|CSmLK05+CiFU{Vt%ctY%4HAS8*aR3nCU zV>hY1W>;O(;-CW}yOu?kJ1S%4Yz{%S+?>Wyx{5AFWShj+3^<1)cWHd9MfuMmh~ZwF zBm()i)kwTLIzK7LppH@FpNKG2{(M%}C@it6wmAy&WRGfLDt#DNQ-O@f^AqNL%a`*| z_D++6&%rwpv|pGQ{PO*zEmsj?X-58Cjz?WkrrrtS#hDOD)+mq+6^M^?J9C;12uC<* z`}5s&NqG#UwCk6_D0{VFG203k>8KxouYZH%Ae&S4fY5mX<*)ni<4ps5{Kgh%A;fDDMQm%(vG!jLo4h$VsN#X zaXD8&$D$li;N4T^vg^|L*9I@yqAcen%z# zXo zp<*cG$S7aTRLfoUqh+>`%X}}R;Kcju?V0pS{f4)s`&h0(IXidooC}vuBw;giuPmuW z!z{Nv27!i3t5Sd=v2KsxGUi_J#*S}IbfZclkh1{2TZ}wZj~vmK%j#Dnd+U{c5xfC* z+4KZ#;~odAI7YnwjdojpXVQbqr55KNJ-v^hZP9S|i{EscOewed`=?ja)(k<+5J#LZ zIEpAqylB!*6YG2*M7{_r6cGo~eNLj;{G@dSaVo1d5}2qS(E2rSLFGPfDm*vTTRD3U zO}n0SkO-F;pvc{F>SKidQ|6kc?xdw9olZbd#M=+dC#UQ*;m=d&(LQ!aI_(Y&{aNsM zHyjmZH2|Y^{YHB1_gzj>Y~)vNwU6AWc zJj$-KUT<(`py<%#bwF>=w<~6~)3daBE_2-NGwZd_S>bxrsb~rhOSG?OdrMPhy|1Cv z-2yU_{^K3vB_*pm9m4!2Q%SWdbPk}+jD`gx?TTG$;%w$F zUQrO+(hBJ+<^zoJ;WyPt;b`CL9}Rc3(>clJuxJB;hBNzOu&u z%$aQWZ6*!nMxXvA9c9BV9stal=fz7hPq;;XAv!SP4H(jNdll<-ro|-tBrfN7oqJkG zBFe0M9s*gNOv0{xx8dGtzzL8_bxnT-64YiRO`-S12vis96 zKFZxYR{MX7CV9yDoTIDDGvA}zHQ57QaxBkto>hu#SNwPnikRE1XPv-|b;lm$J8#*1 zW0`lR07S)}v&dH8$$-MwpV<;W_(sb8Hgujc)*e?RONib)HeABXj-ec1BP(Pcd0h%cH3rYirHS7!mo%WMO;#|5dZ}+4OtY$Z9G^s7~5o$ z#GXbp3e*;bJYk0s*qai$ce1(e(c65vEwaj}*nsCs_80->ya#zeZ3Fev9$t@=i?Cm*78|eO^tPaIuRrs~)`CBh?m^(EJ!? zW|WDwPO&j)AmZSB6N2X$4VUsH`NF+G+7ji9I3nrsmZh8kQDJ~vwUu%81n1%EnZb7( zXlqxawFA898g}LfvQovU=E0(eEdNQ+7W~MJiGIUW!NrLz)mo@;5p5n`M_l3d9ovCz z;?2z(tMV+Za?@DNFA~RKB2I^~nun~%@t?X)msyFDz_WiF5psPjIm7ApU?bH7#@HKu z&r`4$L#g%HxOCc^#euc$hQT_qqis||@fm?>AggW0(^HIjW z|8~GtpeLSDdF2TfjeXM(wCuH4=3|;BizECJHVr0I59{;h;?*J)smngKPTG6Tp;WHw z5znd10y0~%bSJe%2kD(sLxSrjDimO=bg~YK$wYW$V&&;b3 zp-R`GjG3pr$%;PJ1lAQ~8hWDR+a44Q2hAPiq(fJ(Ht%GyLY6zcAf5 zg_u$0DMy&lqc_Aee{b)>MqTn2CgeC9a>=`?C80x$lRTUGVIOcI(bT(%lT)!fpSzPn zt1+eLy-J(wZ}~LpYI-KLt}w7fr?Qs|xlHQIv%6m365K$EI9tPEQw{TM)C&8)dp@Nk z0B!Wu1Px1Wb;M@&j`pt&ShmIp`H3ZYLeY|g`trvpe}|LGEkf^mzs{p)w}NUHHx~$L zuG}hSCdi_C*`iRHt{;g*1+ymoz)R==0)f9?v{HS^vG$MVfJR z2e!Be7q?jAv6SrQpsZoAR>@*{ZA>t-K`_|~_XfhoL)lKZ8&X}jvSrRQBAvh!ffX=M z{=u8HF#`DnKAtqBDVInJ0vzN)k_Ku<-_s zH7q`{JttAv7qS#_UT)_}@|#lYml$AkLE_IOGb~2On<_!_85Q8R zxQPe(N&0h?9~}Ix^_hZxU9(7q_;fku^8m#uN!=F~XO-0ZL#0-C~W7{NiR}8>cTd#l>w+ zBy#crxZA82o>_CqWz(O<`S>)=)!f?Tx_vH zx_5|LwVg#P)spIh0XImIW7)7ZfEEd85gvw+ue+XZXB@Ai4{ z68lh2=bQW%Kcj^2r>R(;WS!2ZOFbh5`e>+Et8W~7`du2M$2HIG%OU!~q6tOp~e%K;YiWz((jLLQ(t>CGG=H&6%D)&?I%fefn(QML2mZ zd5c)WH&;ET7`FSUYHgxmv^9b2?%82*VaUh7m3}0YX>aUZpRfC*k2hm8SEgi?CqyT4b*Ibr_ro))-;gv%@)yOOwpW+P zxp2F;Tpip&tlY~dKu-&;XjmxnkvU14iYfQ#GTha?^sCCR)q?VxZrk&3d;|nvUovTu zA&NzF#}$K;pOvbXR3hG`X=kvZ+|5ga=UPigV0Bh1_}C)4XBRRBP`XauQ5FU0qpb;l zYxj>uPL5JPk)8ta&zMzi<`(^;t(#}Mo}R*i=HXSkytuS+GAlKcXTB|@T&O-CY&tr_ z#W`~5wWWhBbQNUaR{oFz+F?H*{`T>FWpx$mE9w&#Vx6T?Kq)Q@Av>an5rd2&qlH4T zGsTc+$DBb*PxM6~hGX=V=fh<)#3$rH<2{t(+J522FbV9NX! zDrOgBF2li?KK(Tk$_4%o4N;zaFY#!~DZ>xk|C@QmBq0bg6xJ(q3o%ei(- zE=pR?pxK($!q;2Y_~p)skvcOtt@}@86#!R8=kq7s{v*VBXMBE$ZWG4%D@#ELuFtO} zJ?%^tf6K)9DB5zK9pj@L_~AT+IaVK8?=O*S;4ds1hNLaI_$QBcJiq#E^VpL{6<*MK zrjMzYs;sy~l%2&o)A@WB-0S*@Bg1$m+3lgof!$fDaC7*(T!xFaCu@Xw<6~{;-S|9oL z&l2?P7>w|z;?otZ+L>k|yD6kV1-QurCZ1Z8Yu|1hgX#v*fR* z@C#W*3?}ocWZ&ouo5>)q*`nxCj^resHS3hg(!~y4;HMnnQ%7TC^v5uc%+m;Tm?#_$ z>ojQ}Nzw&UNk)m(ImE(MAicpTXVA4mO6YvF(3)Yy*i*1m7`U0enW_uZC8q#M?UQ`p z@Zf87o_F+{oNS@YM=pu1muAp=@a^1@1Hzkd+RE^Y_b`_(uhxw0<*;_+#w&YUVf}XY zQLGd?8qK>*-c14<GBA%WARIJI?!;Mc%y@f}3VuWjpV;zpUvJ@Q9H$i(RP4$8xWk z8swdB(|1zw5*NbW%6o(}{oBCX@-yiCUdRf+5Zm2AwF&*0vqUE&H(C7FxWqsb^)_!XTyNUIzTtqr6rx9EaOeO`$*NVp8!lZ4Il)T?>k~6!0-Nu`VZ5_Pq zID^PJKudKml5%-QPZ}l6>;ggQet`&-KqLpeEPMji&5PSm67mvXguPi?0#E;Lg!x_y zsOh~Vo~2=*#zbk#m_)n30j?ZuYaqdwVsVyI$RjtTn3#;RvLfMNK$TD7!d_+t$ItmM zC2d2~-oQM`yX81c9bFiA`VfpiqqDOKZFdAu@b7VD$#LVwCXC~d3~yOQY?J6>U{Gw1 z4NGUJGHN*b=np@rIb996`1x#NWJPPy)-iXYQhbs%wX6hH07Zl&?FLtl*|06ljEITi z32JP;7)5X31y?lE|C^Yrw0l(n5Tq*t0By)^ zneYl_SyCQe(vg496KN>Rup}PO@=mMUQy!CA;EPb47iu8dl{};RLRppZ-h3)oR1e>l zAc!K)H}>O4BljY-3@470&xSDjY!v&XsK8u(WC>Nag_J*6001g(NufC=fX%DK=2PC0 zX~FwBUy&z0gf5KcD={o1W{?@1?|L4ecba!!VPxshfZRu z&n0w;hr?5u3|R1zYwXoP+sJid+#FyYLDMFh5-eLbj23&RYacZVw$mz6z+X={J89_W z(khvhq8aCOljzH}EfD|3Qzq7TgBB~@J&FnoT_>ND_{XTJoE=ZbSuO|3a-7wTcYBSX z!0a+0I4amc5ACULk1iZsail~6+7yY?ZRqQbp^628EkJC064U?OIL#(_oR0=w7@pxi z)JqW=R`P;0;~L3Xv>s)7fzsKj&WNOr$hsyQG8LY2PT5X5QoMoeG0ryV)6sP=gJdvvO}@ z4LHi&+P*YS6Dw2la$WsfIpfgG9QDSNjHX(epP)xX;o8NFMgnj%BV?VS7N`?RNzDVD zdpIyRl*)x$N>F`PVS6^32lZ0seOhRYJy>iz0D*+gbJ{_7tR-JzWubk%FE*-xEyXPc z89%G+Ud+pMBH}XzUJwnmc?t{%&86(HVFokGdh$CWC`8%*vpbT{8Y{$PswGvS17%yt z%&ievm0?5d4CbF#lrQEm9p6d{%Q6c7NM{O4T(Lf~Wv7YJs_h}|@gEEP!` z0Dz-aNvgv1hs#!?Vu}QdC8J{Y@AroqU`ZlH(FV3tz>&~}`k`S`9S$P|hoFK{7NwH# z%7YwKU^hsW%;xz%iMZFy+Vqv z(F77rWT3F)VaeX|f><4~3jrE~dnH2#fPcu67=*K?`QV=N=TP=&%E@uxGSD7J_-JzG zpd~)I9oOy?m+DYVFqh=%Okt1dgLOmAli%}t#; zC+wg{YS-El{$b`ZAy)9Xh+lzG!Li%E=fo8NJ*-32Q%8B@%j(Ck{5!6ug5&!+DTwAm z^n+tMoE5vrJ<|Ty8`**Jg9K=1Mrc46PMZ2yAZU4vWK1}*R>v?ySZTrOsx}?J$|B`b zojLr9`Z%q4Kpz$x=MHL6A8`#a1>Xm8or$9GL^jH}xwjK7CrdN#NHK;}LVi5UXbq|z z63k;0hrve@#O^{p1n9#X;P7I$Aa${S1AE_qW^IzKw;0lQ$S*l-tzAQGFx+OnlPE;4 zbip3do;j}N!nL%!?^|ADIJ#Zt6V4fEGW40K_2?&&c#kN#e}gHN5j)?2uEeqX)Ll=0 z|CyU)6l1my{hH3Tf#n_*hY_{$jobFibl)=d4pboM*GcJi69CuQOjxVfD+;z_b)M0N zoSSf@&IqP)Zb8|GK9(DpPT7Y1?-m?0fb`5TAcqycfwLkl=|NmVyU%C0FZkcPx7+eqi z8B3QLC70YG>J@*TERp^2Z^T74N2d=AQPqddt>ox@M(R+q^8QQs&@Sc!O`x(BIz{2_ zBn;63KTPrOCpg0!hd>RCkUlb?e_8|7ujvjzuu)p$$c#|VgzIw3faF&~N@O^wUN@J? zzmd=E-R4AKsr@^`gUhOrLnaEv|IZFrxFQP@J$pPzre5?8n{0(MSB@vXL6@nFzxlz$ z(VD*thU|UVpqT$`uZoKLRy`g~SO6n-GqYs0a4ewNy7E#|F$FWJ?1PHzCUpnKMch<|j z-#4RQkqI&?njL@c(m&{@>}1~WF24uy#-5g|UUpAgd|xU2X*A1Gk8B`%!%+`x1$cbl z>^rR8>cIo|!+sV3vMop$FC<%Lg`J%8&se@~am%k* zj0O{I&l+W}Q=I=SL5|)1PpQbN8J~tP)lw_ECii7xD{6&*cb;05_c!q7PMr6j@itEQ zeuvSY5CDPhR9n$B?r|$mj%JGl^>;g?LpepwY9aan zhgmcYIIoB*J+X|~zd0T)3I!3JgQ)3muum8XqWQGEj0bKp}R(Oz+ra-vh~ z8SfO-n40GK)LNBgh=LIg%VoxlH%^u?n(Mr3aev*7Ru3LXEzuJ*V%-FS@tDfW(HQ zxVglN?x8jKU>c))H7iQ4WR4A@YWDn*?!PF>-l|D^@Yq`D>_eQR)Q93p7sQ4yZm~D~ z;NqtCuKI@gE1Bs$T=jp@ExBKHLW~k=2t$ zI#X&;Pc}1lla+|SbW|>!?b*LI0DiSD?SU`*(K%c=mY%W6F3-=5V zOo=_0y{3hCWs&)|IKQdQ7#)&=%gged`7Q}F8^KE=xGEa=JR*Z{{0rT%%zv&&;uGR5 z{M6`coL^bn3E*3zHvMf41ahVL&t7JQfvM1kp9m@0zRQoXftzBtdeiGKy=+|cCUIH^ z=B^#`3#bzl+zZ-M<=^kvvSBNeMf zXkwfE9PVdosJnX#SqH_~@|s(BFJHB94wZ6`qE2K`3Pi*H<;H3*?hekq4}FXf$-6J#HaSq+|9JKnfPFkhTo1y#9gS z^yJ=kf7%~HPc-VzfVPLVUF`D5Qb%0hpBtx|KNO4`FuSJRxzo#{6;RJ-q_;5|mGaAc zWG^Cx#O=%|6i`a155pb9CALT}=4lKv6mDB>fBUMKJ103u)bnoaaYLh(R?P1eQJ=Em zHOy>HhtjKfrwM)+FOJmpHlg)X!liRzS=mz^M1R#FxJm|10KO^}wCFO!*rC_AZ0@Z~Hznr#i2ASo%B?R^LY-*g`H`@4#HXtJrZ z3+?+e8VH*zOOWFRuLJ#Od^%h^ynNiB8xVI+#SazYXm;80j_G%dsk)`i+(e5edh6np zQ`KhDx|r)YXX~q{z#VQ*?h(AMm{Z!7w>9n4DiSAH-{kB-2)_CE^0DNC%cW5f>C1^VL)t`8}(f)e}`x60_ zTB_v|y~-{WzVz!xwtvYxgA#u}*NYXnjJ}k1N%C7uqv@5kcY0r@tFhlkmp%(f$~0%nXq1FBzmWV)c-1;AEEdo~Ft82>D8szN zw14fq|6b~4s4Ea!`$My8!u5j^*G8|BQZm`+UdpomI`kzwT`38H7Qioz6y?+V^Cr%h zt~Uzf5FuE--=se9n(d!#0&an2r8DO4uYso@ypWrl?TDxFFFu8S|BFZ||8HgL{lOQs z$H`uE|9|0;igGMB=|!*;^KI<14GJ@qdyub>$~!JQ^df`))*GRRj$7$#QvEE8C~aUP zTI$9JvJAecLKId93phlN&-L<|d80H<@N+<>iCr;^00*+jBYHY&^1q`13Dl}jIpRBu zAOi~>MLr)LyUCgcvue)n&ZMDlMu(xFdAlR<3^zOs_~rpa#fUur`PD$XTGB(BH(sH&oFRC4_}0ElAyZSn|21 zO)}J3s?5FF<|yShA%_ST_{Ol}KTPlWdI%$4Zp!e*c1;ucsb(POx=tz}Iv5 z4JMS2@Ea~OT$0%=dpH{&M;SoGe@R!P7OAew{661gF9m^^QD?tL z9mmT_PqDIKXY&orvvhpS?gjy6OXo-2^&-h$|EQ>}$4SKpEs4GMm0 zJm1v6yutbPuPSCPE1bHPH?8L-dwt2w}LHb#|kZ2$K;OWvw)r>{H&iN^z32lqJOp9 zrwfrMs3idyWD)@gWO4zp_Jl5EpG5z@M!`dE1E(tDOmH|S5XR`Rv!F=9tRUR+S!KfH z8{F}@s??!jsB0U>tk!5_m`l}+t_}av_kqTWmPOaCqckHn{gM1La z<{MR7YwAt2(;HIL4l;um*V0Bgf$(E^#tn?D;Am2N3K#1;#Nl5W2a{v{w3SkV5>%zl zQdA|uzBXpo_ke4M6d-kf>)TuKBNq?w?Ga0M%Q#bX6kx@p6>sF*@uQs0g&=l}zHKj1 zcu3jr7FIwbFzEuJ34NvXZ;;7`aKl<8thWEktLKMs%y1_pby#tis8pj_tgfK4GL>yG z`S|Hj!^yu&rt?Dm*ZX0`-aEYN^}BiMOSd@XyFq!rMBZdHFZw>Q;jNVjRf^$S=S(>z;M?eAU9V^d58N*RB0IU!4k{f;*d^ z*c@nDo5HdRE8I0NE#%gV5%Ji+N@x~b8*7%U0njaiZUid|Z%{6}v>{LMFN+m_igZVt zoob{jGO${Z>Rzx;cq>~VgIqH%;#^ZMQfl%ps%t<3oP9e7hx}V ziMI_(ymik?ylt72zhCaY++=S#w8NO7k;RGg^kT8HuEHvz+RZG_!RYIdl~vORQNWYa z%!aX+f>~kx2&8_(7DcF58caYqq`(k`0(4_IpfALX=ao!?*%dnGuA-39p9-myx2GU}Ix*s{Z6K$&v%ueMLyz_)$)Jb>?g)cpAYZ$gJK}~zh4H{DCV`+to8d51A*y(`V!1tmlckjP zUSvEE|Cw7^hu{i&7}Y|VKz0bVJL`rojlWi1|NZMkX01rC%typW+((bE$gj+= z!mpfixz2Xi?hEJoV1dx)0o3)@+k*wg3~k~qv>Yd5Pa}FoW_2Vm5KZHYo(boQJ^u&b z>=6C!+N*tQ;qv zOvZ?#I^Kkp3rS*U!WuzN*c(kQ^cM@E#+Y@7#Y6z@x8UqYPY>OQzddFx&WrtI`Q3xl zA@7CV8qVSOB%Azzhjl!OA5+%#R*I4!ZTNNN9PK56)MJJ6Xeo8pOH&GUf_~<8N-w|> z{SZ0cU3*K*>Tgk3W`EO47=cWl4*5pYV3B?C# zJ?a0p1*&zjgiUH8j?0pGi@XMjidg0H>XM<~j;(uNwCy`VJ<*TIaBT?hrZ+8`0wjAv zgu;&u_D+(pv7W?fTN-toq;OQf8Kin()b?$A=8z_#z159O^dX$hcgCdxR;1Lji4#Z4 zd-EV-wrKXYy>Nkp-!TQHcu4v0eR2rScup4-fT7&*>7j4}%q=!fa^TyA z5!|!^w4&%LvDfWV1zUo7|0nOH@Ot?{p7c;x7_z4E@c{D;? zxhF+14>wtg$P-I{+Y$u2B20>7TI}I?o5z<&)jNSr8~iBoUotjO%Z^PI1}xm+yp2ee zfqywTyi4L-)I-(zcgv>31iuv!K34@{KUV}H+f;fYX$en_)rP_8)r900{N|AgRFhKU z#!n;bggZ&lhqf6ph54RqvI@oTFKMVbE3F41X z9rU4pRZ9s^sPJ^SGkJq8qB|S9$Mi%4%He!!{4n(c7DgV~l`-`P(369jSHENcu!}}- zW<_)zL5sAWQv&!mKl`A@yTepNm#)VDUtwgLA~bFc0FsAP=0rphG!8HyeBc?L{^5 zIib8x>TA(hue3wV$*mzz`O;)!MwFMtiQ>hrp~ph&gfSDPTnL+;R^DiFKPcpXnny!5 z31bZA@$9a$!``%Due)?|EyiA7q6)sG%a>=;8A_H>1gZ^uRnL_VO7%*in!n1K4PK^{ zP220)x74}vs{be{xAqaz$CrtX#U$G zj1PsS2R}G-yBy8FDPU;lk2Ro zy*?H@0e}AW_2L<+YvFPBw=@q$2~CC+^$QMfZ}I%>lBXY-u9O3S4;)k5f>-+Sev0t< zzjS_L<{guH+c4#?6xSK;p?XVfixmWRc}Ns%Jb%eNPp!&VUXeP9=8ROBXb|+l&KaeU z%b+^{cvTGhfTbKvQmA7zBgJc(0!?9UPt1H? zHN$s)7_|pRZ{-)#W$YtU20VId)0+aD9*fOV<(6BXYZ$Q4QoV8h?Dx5LAXUP!MJ&AE zI_?K|A%i37RUuZgL3!v0#;TV+pRPViynNECzF+2@Juk3;+a;w z1lHMy2nk9f!nFNDl6)C509!|}E#;?mxCPL?MRM6Pp}`sFPVg&NuXDM1sVP zcV59Bz8<6%(D}2sb@}aGOB0$?8}?4_#K^77GZq~UjkTyNdpl09tPY+HE$L$7_bRQt z?3uK2I9Q(hE(eKxVj|1m42zxdv{W?rcYn~iovv@HCs0<4y(+5a87=YYfbF>calJ1y z(6W#&7OT}Px&xm=BFl|GVCM2tr}=eFRiEMdmV^C%Dzy3y=G=ttqkFnaJK;rC<$6q1 zmgU^j3-7l!Nuw8^g{_B)Dn(XQ%844gNSp*hrdV0YP(BRHYR1XiI+nJyPuDm>wAJhf z;?BLar`PuEyx*p{sa}y}g>@>&7xsKEb=kI)Ap+lHvb6m1+X0?v&4;D=yZXjk&f9K3 zQ~5BQd#$iF(w{=kiXQZIu6Phl&H+JhFdl>-yPyO%gi?-EUoq-hCxDiU^WX_=WUWxT44kl%5@Os-%1CNx>+*+k}Pe(jMxz~jsw zFFWV8ft}61>I84Aq|ahj9^_}h-=NDI#`O8TPBiW)cMiYE5HqmgrD^v${rh#7o#Ux# z_W^V64fkb~l<|UM^rMNToxU0oLqsT>=o9mLkxxe#dW~};oTK=u)yzS!48(dgy(xCX z2#eAU4nnK1P+D@^hbYYWFbqk>mYd3VALDpBwEA^@83P}z2n!Xy;{Gr-8D}1lQdmvt z!&aQ+sF2xGRaFr^8{CY-Ww=f1H*_ZIyv#n%5tUdXn|0|Om{#3UwBH-b=0FB*-PwT* zur2?>ikFXxWPBIys;4BjGfsKO(@Jj-{SoU$3gBmdb-;n<7Zg>VxlWrfUz#nfPQc`fJ8P4|XZPnB@I+Xyk#!tF}Y_sYyZOGlRz zg{6$0oXs0t27b}@oi`M1mb3Mp2#>AAEp(zy)A)=fuWDQ>@2+-mW|dXq2IX+8Bpv(i zbkLxVp*3$m?Dz$_^i(rmx%5hh(ujsrPfA)G2P>d-U`Igtb-D!Igh>=kgH)hHW%jm`cgM)I0l?DV;G3K%NQ?N zWmK{4jLM!q&`(*t!&cTSw9HwPFQ%LraiK2W!Vwy+WP65Si7QRGWr+vXv>BkWF(>~K=4HRoZF!XOFnhk9P`v_GL&B$ zPZzg1SH_Z0acXjEV224>xwwEXkLoPAe+wI{lUSoU>-HTdE!21`Q=QT zDb9-!3yZP?%J05pQy=?ITNLpDKAwXse~S5M|7*J`sdVL&d{0U&D9^j6V=r~qe2}!} z$x0VmT3IT&O~&S}P2SRe&(VV4A@lf&3$VV;KI(cA?av0^)gK!!v(R#!u`xPZXB47W0*BjE)^kG6yi#l;Oo*{YAz4sHluTdn9&++O(H zd98qD{-ieo%|?13aG{b<%qxmz()2^3qkNeyL*u*~NG^$*gM9-^UrlVgOsVGAl`fF^ zB)_m_=CVE~dM}f1ZfvO3$Sv*=%0zqOgNxnh9)5bFc?t|65_B8UsZ~!-SWrgDJaeU| z(R2Kg5PqZ+{NClsbC&&6T}i(A#nR($(mm1mY;IA7jl;nYqHNFz^MkUC=S!~z-xk&; z%f}KAiW-q1m@vuGvezoFi+{+E^wnm3a{n9psqR3XSY>{DUDQak3K56AaMAbUbI~25 ztd)0AuI06u*1|R|D<3RuF7?Nw z>Tk0}{eE=MBaWdS$N1w~$GNGiW2jR5n}>WI9>*9w2~m1r)1gnoiLjmWc|Mj;y6=+V zzU+Lr-UcB}jtCmDU&GtJrMT54MFubZuLskg>)^h~NI5n4LzzY+xG{!ZZO-G~P%XrS zQ{6A*4-MhI-#HvhHp)q&A{)m$td-4P(Bt2TM1r^-z&g;=w&8|BMYRA$=!jj4+8#O zrH4~b_$@!G{DAoCU8vOKPCxPQdgEAXpX94-6OmptJ1Y;oDZyle1{6*}zgeke^)c9J zJYU(fFLgB*>!3HY{-8xJ@fXD(FN~g;H4PHm+G4LIo2;NKA-g`MHQin+ z&m~fEwRbwMP4{m__L<*`d{Fd!ica;z{_~XRkd`_BIT7Fl{aA`EK^vEt} z&P0^FS?Lz#`6Lnf4S?6 z?<_~B|B8dbj^MajW|g>@>)jfPw<(uF;XGbb@3ZS7-qelN=gdQ?wU^?|d&ZwXi^CQd zjZjO*iF!b#)Z)GFeNvV?Mx|ReD-DhBM&1!u)7o#I8DtfGr_Ec>Yu+mG01j$1{&kXxU^O%qNc4gx~&NLj<&G)4e9U>MN^kRaWOuKy4nUQ_QIWL>Q78eGz+IrZ+~#{iW1G8I`1Ark@$8k<1SFQ zr1h}1B6Zyv2oCahzY9 zoY|F(OxHzu`B@rbj9{G|3#mU#N7eSK3u?H=-H%^@-f)5QdI4L3U-r)qnD=&zzI$<}?79U2MmP!d+8$4-M{3U7MKp>5ELXB-Amq zDP4UhyHlzn7Thk!)0Q0OEn6u+uJe)6?mf@NQ2F?X8%BdhSWWoYtF?8sT;!b${OvWT z2IzA^G7pz~Vy4}X-R>Nn1C}M(;%8>PuZn$6U7v56m<~f9dD%PjjeXe3(*2zE`m@Q{ zI##v5vWyW4n^FO`OhGaeMH>;4fx*e9tso7iyWD1v>O05vHCd~}beCHoQOY_b-$=*y3~XvDAn9BP5e8%=tLgNTCiOdF%;h=&tc zo7M!LCZV*pCvRf0KjKn+WfH^u?9YKCZP1+(`JC6EM8a|HHS)EeOOm*6Hw$UTn$&BF z`M$~>-1zNQ3X9wUZGVob33x4o1qYxdfMU%u2OSDUZNm|JQ{i%L)DXWMLi*@4a$Xmg zi6|-gFos-+ZMz+>{so3?4P_f8Z-Nh-o#a(rcHfJ~_z(^#R-Avdjq|AHY}*jrG>!O# zIWK}ZuAE4qap*fyUg^5^6a0#JimV^9F%~Qz8chwTy0`1>c~U^{=yL6LS7<1 z=CE;qiiqwKPQJ+EAn)>dInw8;t65=COD)+(AFuS{UF}odDCJB5f4eZ~;xbE#!$}l! zzcKqRmQYd768r~6BU~{yx`P}wWbH1Ic;=qSpoHtLIV>TSy4@%$7@&21|x58j)6Zmozk($;r-1Ml9 z&E!X_RR-}KPF2^+qm0DkMVyCUWeT#}UmZ3Du%&)>7clwaHoPV^o>4&Q#6kf6pdv41 zrz~e|!OA;=>I*SlpwiTl!hna&-H&Kq@Qxwo^7|M+MB^n=@ho(;7#FCrc8*e!bF=r> zus=g_d^5;s-Vd|UmxUz^KVzzUzg_BjfauciRrDkJt<8h}1)r&}sKdv#ZVx1)YU(8l zd%CM36-RB{)2`!$f`slf%DemNt{ciJ3nTSSdhU0xv3GVIDoSzmSXbiStreHE$@fi6 z`2;^2;UQAl0Ok+b#GF-XS_7dh>*tQaK@sdw#jQ{xvk<1$ft6~n3dT$pMW$6$%V(Ti z1l`BsmM^U21QjfX_S!#oT^M@6`-wih>tSJy=}Xx+ZAB7>v#WO4E3Jxj&^_UAet%XN zqsL##&irse5@Vx=VN;qRNoJ2ArV(YL{agke`i`+?%~MvB_}G_rvnoYUaG&Q1TEs(t zsG+&CSCMnB%F0k;e^5j5AP39HA#db}=zK=sXXE8U-- zfnHZlc$BKkk8lW-ck+aA1u(7*^A-)zxXMukJY1O!I%g_1KseMQ3ADhuu-q0B&(sR{A{m;thpx)VGGqPv|32~4+u3KnC@#e*Z*JkxE zXHbdCb`7x9Yf)w-@3Z!2-#M#6Q8cH35?HuIc9Dc-C|^E8<&>5m4@4_Kh({Q%UUOLjeo_l^bxzS=q-LZmV9|^YICCDvqjms5autB z%`4!w7)^t`7uCnFhI>`P1K5yt<7P+ zIBB)vX9!wME}BAR;gpLSO61QWBZXFm^z1`pQ^{g~Iff=OuF4If%v>E&2#-$Y&WZZF zxJ(dhTkJ4jMUqQgJ(ehduSZi1G~R^9*34TUU#AJf3w5d=IDUU^Qg7xey2!ybk$X66 zmm0zw6Nkr8(GxF4uPZ8v@i<2o}=(|f5@ek8U7Kx~ z=o!k+EZFft#>Rg7?p6PKvS66_j9glI$|tnuo-M+wZJ|ig?z2~oT>&{)t%Sey;_VS- znKMWOn?w>d(hrqB*nVuKT-4&6>_) z^M-FX@eN(a_b>c39Qe5zFd0d2e#QM%D)q(6JU8oAoymoc#^kWk*8rI_!oZ?SdWj6l z7|gVgi@{$ec56x5UmI|q(1}07Dwl0yuP=VSlOFARMa^np)zq5h;d%Dy6Euk^f(w^) zle;6<`3ISXZXZ!yWdN%{5sDIm|MJd5V+tpoPFA&w)x;8uE0?a}k`0r@>&NxabqNga zv^8fcIW~$#dAWyOLwCfS-Ng5=S@@?(|0u4fWz1!SLz0xd@2Ht)H6%+P zm1osgz_J=mz!n%uO(m`#K zdy+kw%JxS1n`WxPJa_P6>ZMccCuh|1ipux1CZ08%il6Q*ES)a5<1FXfQ})n5jp|>s z)ZTdU=_~KKjRJb>b&d7_Yu@`}I*cD8LMr5Ycg?e?W4R8G(sYi7UgB>;>4#1P7i%OZ zlw~NqCU-ItJ&H;3Q{J6?DAK~6wEfugn(eE4Hm^q9MQ5Ez&tdP=%;Q?g40bfN@`#&*{`4rUnl~wv_y1Kts)Xpst;n4QQ~B_1ESBq?pU^%@!#IktVt%@*_g@u%@LD~v40&T_kI-Lc#$f3jUbNU3 zwPj(cT)@d(b}XXzfNeooIVy&HJaR)vz_@2FEE!>}gH=STnk}L1xx-`d2g`s;-GZj7 z%PS8IN0ui~O@;ikDz!HasgG2>3e%aj(s^gIl?s5q(Rv&`-lOE9a%E_nX4BE|noYxr z#;Lf>(j@2BTyO&0p7y9uX}?~9mDq`+qeaE{xD6Ih*KK?h^EcWLRT$LlDQr#?#QAfa ze|=MV?>@24pZ9pc?YVC?&8ULo1)oNsTY3LP$=7VBMPpBFf!*>8$C12DYqn_;(}du( zhHuBsD!ZHhm843s!0LvbMU3{WbZNP z8kk-uq*D&7&5Ydf2tR9!Ct5GlAr9FLD>=XHBC}LmUu++FohaL*U2j3;YLHwoG)wk! zZf0l>dQxdXnMY;RBr99ks5u(*Op1YpU?f<#)Of^VdbFbYi?z*t=u=`cuQaWgw;9S+ zIwM`Ox)t`;;m!U5A+lHvPNl_9r;Vr|xjwEhN!xp?cQmB>MCF7-+*1OtpMkbuemkg} zZa_O1+X8+i=#v)b1NsRs3GnroiZK(vW?hZmtlvH3#hl`-_lWNkNM`mcU5Je>c$xpb zq}b%3wBzHInseRAPz2QEU7g;D)T4vqlNYPPLoS4GRIa{}U?j(`pJIpy^1fV*9WJfB zK5P!KvaWD-w%SU~=b0s+yT|D&%88!9LB~2dJnRbyE2KngkhMQ*rPlNq=CoxRsC6^b zUu^M{8mB~$?^gXA^z3r`F9t|V-|5pq4MJ#E>PeZ=`J%Pd z9auCuISk0RdE7RNwMUGb=(Hjek8Bhf@2@_^ZKx&Ad70^idP&5pD5A9fz3BB5R6EJG znFx$0g`M5v3XAU^xTNqE@en~9n>vXj(0RY8Ca>4^mJQ3;R|N@3%_rAjPPVcSKvo1T z#KQI0?-Hg2qW{LF?zZ|VBCrH0H zf}dht?3?@CzC_AewH>Kh9ejo^)yvf3xhAgOvu|c=zr2UU3}?8?@Ym)|HNwfdy>Vur zOtrTWja6VVd=k>28jn2y$cm0)_8uDwq0#SBfa{`SLdSxD3#hHs)3_m{qWq^H%u`hi za0ZVdZF1waUz2Avu^Wov_J{)W3JNy_RY*E!WAN@#@yGWZvw9K~WQf?;dYO2r9s@I3 z2@PF?QR4UppO&;bHy=R^FnT8x+@{x7eb46?MNgvEulFmynfMqSD{Y+Vy_M^quT+^1 z*NE}s){{C8af0>=)_l-#7kwAyJ}T_}zW0%D<=3#vi-AWcOf-+b5!C1?6RWaqvP+Dqxw`-H7j@X(g{&uN2{dA*8 zszdNWW_S{v?)RXPB<)gLEed6YkZH%UxencX(=2VxzWMghjfSXx?@G1241!_h>HZki z0$Ni^z9$2imvy6!oy396g!#5}Z=A(g$Q@h6b+#V;cxMm*^^c%V)u^%7+u(X|J<1SyKeQe{=55e?FgK(HPN7jC{yj ztuS}(p=epd4K+?4%CNQCRR4^THwZEUaAq30NUGI79yB`K87HO6IyT&X>>9p8nkK!hi z%Mbn18$VC6f^WZlE$IJbS)J9T_DENpga1vV@JQ6ljV!1$Dp@%#LFs`RXRYyBxyYeb ztrU}rz%s%|rSBWB^+&N?+D74){q0vfoKr^dRH0pHD*OdqqUqCeNvyQls&eSSrevL6 zV;Yq}8luQ@mc(mk;SYNAC!O(o6#kwWb6)qEn(2xk!!7fBH4io|Ol*iSp3k4t_EOnq z95V(QiH_?EaoQiy*Nqkq1#SRN*b*Uz4jziKxO8mo_s?Hp=yw^b8uvr)ThKA8oz&bf z41N}f7Nnmu%=VL>xTYzf&$U?qH7A0oTdt@HzgyHMbpUO_F3jClDIGv;$Gk`A+#a;_ zZe0&9c}+@tM)KLi^PrkyQb4F3lM2d{6wtS~-=SMr4!#pdLFbOJS3L>B&KLOAVmdhq zEiYNomxh@?_)QHCk@-eNa)cWVAKOJ~9d1;zHjw3%**`A)u2QU8I4ZJ1q4kX5QJoMy zt10@&XAz_DE%@|%@2#0W*?tiUC$Qw6gBM(+Bq>HdF>haE$W+Za$8V=6vvgsAYE^Q( zAqzpy>8g!Y3EUb-YL!Z!@x`Km4dJ}$A3h5eIZF$K9K0`AZ& zox_B+NVK{~dUOwD3^K4?ncit2F?!+}zjULz;V*Z(-ffjMc z)6+TVukNR99Y5Z>it$5#P>G){?veXg41{seSDdb(JU01t&-L;Po>l_M85EBxjEbzc ze)ucC4_s%lQOo^y{=8499t0u?m(_V|4|8bT?%A!G68W8#9KLa!tzg=tK4TB2q6y+Q z(YPixzI#6r?;|cF9LmgRx~a4?TVu93lX3nLX2sGDdGQ((jI>AQR;%{yw73@9SaPl| z`m1-h5hYqqwDL*lmxFT%;RB&Y+H=(H9Q5}R2p`lqq3!pWD(m@)jg%hW6O5vcr4BK} zmcr{wLK~w!BM;uhYYpoB&|l9;`E`JhqKgRW9+Ei{9#R`x7%sU?f^32mXZR;1gz?Pp z03mp?r8t7`A<5y5++(Eix!dK7M2y=S{7D4~!1a+<7x;${1qJqxE$-gf%Az@95e_n$ zTEtXA+~}-Z>fYT+x!T#`J+HbJkbXu)FJ1NqFBsXNA+4J3lw>eAM=*)PWiEG~eA%QC z^%G^SkiS&lDhq{7f+sqQvgiZcr=*(RJ(&~VEf6867xycgG}=5K z5}sMTCV><}7lnR7lv(F)Cp>zlzJD><8`KHDs85`v9Cj~<;JpUXoX`l!U-P>8KE=bN zhJ?DyJxE6?Bjx1?R`qxw7+8uELp;_|jnNUiDFR*U?L5UT*hVpw(p<6=EFx|24`67HHy$J@~+%u`i4#l!xk|A_2Pqp#QoAkdwQ4_Zi`9JwCiAq>iv@-yq=|G3ql*zR$FIDZ}H7YA3F)sL?HDawJuotF)Am z0)MKPoabcE0!tR6s6OFxmrbR4tK_l?L7#1Ny|-*gOfq zFl%Sd{T!+1fdoa=97t|Zizvf$al#M;fl3iZPp0)QA`G>c7)4s> z8_hvKGs3hLtlXY>YCK8$lr`+7y^yA_BC%aeNS0`_J5t|YP|sN7SRA27jFK<8O4>=@vFMTAvkun7m8N|Fq4}uF zDbFd%smS@PNKsy!rwN5zsv-*_Brmm85}KV8x~-dm7&AoG2o)D=7(XQC^1Gui73{^G z&!VDO_Oje}(-cbD;qb$$w^uzsF{3iX;{$)u%=k^310U9x@A@sw8Ci%&rK`5a4j$5FE5*kniddZc zGpLhqN72zVJ*3MTVK}UEqah|iC56&-ezP|_d5BfI)dqiz-IV^_MDOu9Tuc14tw8$( zj|4PnWqWAvbLXBvR>%4F3s>%^nXdv6QUhAU=GFpM1Rh-(x^6xlTv3bicp>Fn7vAc;^*V|IMzH{kF9f~mb2Xl;ASJ<>KK$JcX+-)MbCka%^GkSDCBIg)L6Im*cVJ_~q;-vBb~xUq=E^ zcaPl<{% z4n8v5+k(WYYI3Kbx$Jsj>~ ze!H6ZEb&0DLMHI^2nVb6m~07pa=Is87a?@l;8nnyYeXj~}(6q{MfkN+0AP2xXKC;(Z3p;Ox4SnCFC~)OUhKA!4&68fhpHB4sY8n#-3&6XP)2!Xb@+iETnfZdDT74~!&36cRakt2B|>(G zt|C*;CQiF+Rdt-J^0>c#e#IrcR@0WvP%@�eYH^ntR=n_NFtppYLy+1U6s)Ye%gH zk|9hnW^j|5aQ$OU@E;5O#|Hm#8uX8GGa2A@8-9@CHMfDZY7TFq8lSoxVdP1Ct{o zC1OOz0^QN!w%9TpyC-$R+ zMUEB$G0wUJ2X`qBN|0AT(8hvGz?vI;-8i3s6~Cpm06)8%r?Zu%oAZmMs0B{k=X)3d z;a#(lber+cGY8dd3!3wxoniG2QKCQvAA|_Hwpz!vA1rQXtM_Q^A&OmcX{}gUb=^3LPG0$LOXbAf!q&IjtG!ojip zOBDdyVQcOIZh7y{cj4LATzAbvDOgcXnt z5EHpgO;rR$W9)8F20+ap5d}#5%_@bl(Eb0g?f@4ewfiK;FI49 zE>aK-fLQ8xE8`S8f4KH zAOlhb$lO4-^ld{ZhoOyiHz)`2^S3PK0}#b-_-#fL{04LB21A{?exvo^x0_KR=e#LD z3J*+#_2%z?GU5ad9zbB5;{ogsK~<#b->O~@A+VkDfCv~`K8p;j5}<%BS_Xm%e0q2r z?E#GS_V^F$rezq&favJ?4ax^p$lS_yfG9!_0e~kDAp>yD5V3$983;DuD+a;22~e2X zGX;?fj7u91j_rTKgM&i_q+}tmEgJ!-ENDYV7-oYO=#+&(VBkCqB$I=IbO5>BZR-@0 z13{n4ThK@j1rrFDyNx3i#=)J3aajMW{VCq>m8St`^T#NE$H4*M%HPJJDi7Mo_zJT@ z4aCUb)+q-DvR~hV%OH4@mJF4`%n>b^j~N^sZ1DVZBmp=I5HVN=stRDiCK*tHDnwLP z;FZE{pd~PL6WosxL}`KVztJlg8sz;Ol~BBuRaXSj?XVk^9Eetgz_xA#vS6sr%in1H zOH^cFS@E_-eTT99QcwZ&kUM0+eI*ENb4x%(2~0su4uDsNkOSVo!6+C=-~t1g|EplH z))*c9kijv7{_lZRIYs$)ToncFA>h1(nV<)t%C|8mz`*358}PpdEZ;#(_&wP8=JEGv z`wW0rxgBk#R6rYTSGNI6;@?3}xkkeP5>#%J%mTTHsQ7naNwNZ4Dz|b>SI2Ow96KyIQuaeAyQ15TJefpCA#6+u3KWbgb}{awT?w8Y54fF=L# z2>3vi`fW$pQwP1K=b!^zq3A4tkj8C=6*WL~yZ{}*n?+{_fZu2l3_Y5;LAd~bt>1Oe zqo>9t0M!OMI?LblIo4Ut$4PKN%USq8dcZSHh{R3r6PSMR$`EXq zaBhE3CKtepCPaoBc44FWetGmQxT)$1*wFqx;}kyvK50Vu0AH=!#G*eUaInSCp99_Ex2&+vtpz0=&;tI@Z#4clngc^Mk1>HneQ@}l*MWd* zJYW|F?vvr&f{eO1pr|egmd@RPG(cy}U34H^7Xq%qfK(VKJmxM;{Dy<|uk2mHQg*GX z!euCc(S85B&*lJldJqZFiiRH8Wh1eG1buJ}pX<4c0c7gkn6H2_zTUfK?CC+kwHJV^ z4`NK||6sU(H&mF@P|cQK)pDTIF*rEJKa~MLJpkhMA%dWtcc2|a5i9~&==TAvM>h^B zAAw*M^$kb^m_CAl>s`PP1~Q8L0nvdzP@Ed{Qvlsae60kU1+So({^h4t^0$0WHUSbq zW&i<~ZvdMCXemGDe>fcf6@9cyu>%^+>es(ZW((vR+>~q;W~uetA4?bjo8e6g;)Y;- zw2**KLkQpBV>7HY!U|spBEiLZ?B(B0TNmgsgve5XGHbL~a2XIV0Pr%0`Cn=AD8mfX z0XaqxWI)B}#-oW5=#kj^9|j@JM0n9-eFv}y!GYr^thfC+#=LJO&u+Ev7=zkRgKse< z;~R@cFf8Rc45I)zcL|Y!j9W%IjB&N|4+9O@H->;Kao`%p7{3F+TY&9Q+ynyNSOD}* zK#UOVW52OG9Dl6=VCDF8^Wg7Vi&Ncd!fqu1*CscC;h2IZYh?dnkb`cVV3?K0Emmd< zA%Ug8|2n4(4ZLLd1ztIWmskIDEEwNPW@r%I0dUN2%u<_yCfLkw8D?e>@OB8`3&S`( z|H07yEBd6NTrXAFR8#c#j6>jitEucubeHvi2TEAdWo#wi>A@*rFZ6G<>e7GIaQ@4o zd~DJ&CN=0#6%Gz|3G?S*Xt>e*uO?Tr^ZnIJEbwlK(cem5DHaeON-!cJ?*$70c8%u; z2Y3IEQSg%jpkV>w2MZEm0TzS~AAq+3hbw0b2s$uqaZ|lT7^9ErmI2;qK?TSyZy0Qr zAOn;89|k($W_iM1&G8TxG)c@RdrlHz*u}+|DKvHQfwe%pqjW1 zsP<+brbY&U_lwW~sLf5857Z?U; zp4Aq#@}B*-6>HnuutbRyu|I$cxL{v^EuH=x)IgFggcdf4!fs79gLfy^K^fR;^v^-Z b2LVL*AS~4XfA_3_dv*|F6cqv3nDzewWrD5% diff --git a/binaries/Tizen.NET.4.0.0-preview1-00050.symbols.nupkg b/binaries/Tizen.NET.4.0.0-preview1-00051.symbols.nupkg similarity index 97% rename from binaries/Tizen.NET.4.0.0-preview1-00050.symbols.nupkg rename to binaries/Tizen.NET.4.0.0-preview1-00051.symbols.nupkg index eb06db79db0f811238b2fdd1220d3c189b5357f2..2d07b3d033d5dd076555cbc2f99c8817b599d272 100644 GIT binary patch delta 33126 zcmY(I1yCGK7p`&l;KAM9-QC>@?(RAPg1fr}m*DQf-5mlXxCV#dclrLhRrglSo@aO7 zGu@}(9^0ABH1DJ|Z$L#J5(*Ox3=9s;$p=loN9ZmU9UKho0rWuxtu=PFuy}{jHVWq;W#JuqdxA?7R1nTxGkC-OGSA

cW3wh&2e} zND^(>TF5Sqo;EoxS{;3##W|su*s@+I;rKoA@BQsD9PjnoKf(Xm6phad1Y%oH#g>76s)pnDM|CNxjbL$LBS@SKQ+HP8RsB#|mmtD?jLuF-a z^KWU+0oSMy#Km7@iBuZ{!v#@&y45n5MH#x>`u^}!dQ^~sx$Zx!wXES+|EmAfPHv;ULEdU3J+xNpvlAi94Uk2L_HTj4WgUB>?_b|@u$c(`AU9U~`ARmKDEb&N!US7_ z-5!hBAhJ$D5`E;UY(dt1tbad&EXG6z z9fV|?lnLLVz`*L@()*$zNm^&$A^V^{gwHK@ZB}q#VEq#R3F#mKqjeSv%HyMXDP*XC zPajz|^?9$cADhGeZ}UqMsA?!sLLMblIV6bEv{3yHAR?qgX_A8Yr47oK9>j@Vs8Cf9 zRXL%Z@jn`>R!DV?MgaqR>rQ|7gl0&;7$-z(g;9adL;+sGy(Ep)k@PvUoa-<|hy{D`A2^nkT4*vHxg3vKa;&4a9;W81Vm0 zn&vnk>HQc!ak_Fk3`6Vs7|iN_0>d1#wG=Aoq(+lo@CZwst};W2oc?tS2CnsH8b;%z zFPSZv&<}^E|G;R1gGjLpV~FtKgb7+$BOe49m;_`x%PtIW>&Q8b3sQ3P0ULJ-BNVMAd-9Akndga+}D9rg|%#7!kw|BpfFX~K$s zFi#&=kr>1?U)XOSbLtWTJM^(@a3{bT*npVw2unr|Vk-e$IxUFGQgB2cx}zE#Cgew< za#VvdWS~MlVbV$4k%-d^)(GL#{Wk~^Tl+QP7(Yt7)P_sM`bcHZNEI=F0RuZiOz&GK zAWkRw1iO5xG(S@f`DO5 z{upQ{q0RcAkY5J3@-dBGEpQn^AfnyDNn?Ph0}F5aVbK6CybUslj8yQaANAnT!c%-u zh#tPb4n*)@@SPkWcB3IIQ-PSmjlfL;;-of$(T64UUl95~D*J1J5Xuaqdny9K$NVRj zAe?^a0W}ExtRS{;BX}Z$$a0Dxiv{k}?2E|n4EovPj5v!2Vt5oH95sju^@x-ojMG*WhXK^vi0-B!=7=I;e#}(8J`x7W$9VP3vgJ%EL3@!-x(Nd^UF(w{k`LvF zAlnT__Y-u@EWrJrQ28Bc1@S|;v-ebx1PR`O{}bA(kqka6!)iwgCjc>b3CZE3OT=GD z>>m`~K_X}Q*ibp}hd?(1$a9>J4H;UqF_7mGKnae7$Oj)5Yce3egN~F|O>5-V4{MQq zk%>R7W{g3up#`9{y`@)#E0d_qsR_YAZnwcz7komI2Obhs#NcIUM2A>p z!_Z{eTr4p}qC^Ly5LzT9aZWp0nt!jOiPl$_uX@f&25EXNd8{7;>$>o$>#=|tts&kUTjrFCa zP*nG-nA^Qunv|biiWWLT6YMPbK||<(eT*ga3&f$O3HR4bvDW^VA5NHOD|=HEa_`*g z#IKEVp_OXBOruk({(ZTiemdmM_WZWfXncRnncnyl7aCNybzkTsY zI>HS|?|YvQpJLu&D(#-Zd9GO%%iI%B#(!!oEq~H)uC`(lajk&aRUy(>UgUF0U?;fm z$Iu2aOp!fHw*YV%garf0%=~Hp!Y$EaD$e)j$;1jq9P2WqaN-%% zA@c%6CiZw!#5_Hc@ByN5QVM>3-Zzahhk!(9`ezTy%loiE4}{)j`IWuK_iN-{rSu-! zFM&aSwF$ya4{+G>%UdO4#A$D$Gn5zk6=EP;H-Lf*<~%2D1AGpu$3G**KXE^eab@47 z>8@H)<=xxEOCnP$rZAN?9mJN4 zQkyBH;3cCKI~+ZUw7d%}^cuUT@Kf81OrfYGYNwRdD5KzIqg4Z`vft4;3`)t(`P52_ z49)qn=3!%G@R`VLzC{!#vL#8mfQA(6W55lb&&!gRBq>mxG{Bd$`=t$C`Oeiqng#fV zuDr1SGtT@?hCEMhZ#2&IjYcq!WqOze;JAtO9nssdk0r92X*WjMvP(C5L&0ONy!3(D zy-h&tb>f2ufB zP9oTeESSjDMbEQbrgtV!{)`_2+y*XJZH#hhI0(Am zksD5lcKkil)K*NW;rB4aoZJKC)Ge~87JAsusnsiGMU6?rSVCgzsxO%3+0EC5b!@*T z;M2&%j;37U(Qe{SwWK&A8D$gKI^X{_*jZS|0{3u5-uwz{udiBKg)k8SAw8GA`i?>k z9+ZNL3FOI$8k9W*bQgIfRXyiN==?_TDB`?BiSLcMN~Py6Tn3LBN==DykF1 zA+%l#p0j$j^qw&vE4BD)khHy@wVxo1FOo~XtI>wpbZJt)juholLO+Gq1HpbSAlmF) zHSm}8`IfGMz`+?Y@G_S-)55%B<`^T^qcE|_g3nHU#<^P8i!zqrNOwHEKb0nn8q1~P z2n^V3xTAzN*g=o~6Iyb>(aOUp;XfyuwAhkJtKTMRo2u_~m@eT`KIEz><{z_c?OmHvil&-bT?%;e7IWOi% zHN3m!qCIy`sxG>mRB@|v#P`yU2zc(!$p2%1V#N6Qg%8#aN16DQI_#Y`wiWfM&70;R zs!HlT(Z?8DdVNG~$$#60L)vZXJFQyCp8fV$oe+Xl zWGn+~CB#KbdANlr#*GsNWFV1I78}`*pp~=@;Q5*|vK47bu zgOKETPj9JLX{ui~I72cltfwqwwHahPc{1zHYN`pB{if<~hfs%U^e zxdHJrRbgp&M=3|s36iRz+on9YAipZ=QBW{*z*l{03Oom!7Pu8d_hAf12gPDYt$62k zamMbVR`Ul!HjeNWuht4?I$9v6CvkN0CB4GQC`r>;GC^o1x3uAJ@$Us<`VHCf9`01Z zZ1c>KVkh6a0HdywHAAlqJ%=%qCTwzcb}7~-E{e~3eoK#j>W7ej+}~o|@3}qhFN#hH zs!Ff$i#n9P3!ZJCtjBUVj5is~ebsqCxCxc(*!No1sTqepjr?9(y=@J|U1`~Dhh078 z@y9*=a^L zlQtMT|Ax`;9meMk^C_$t`uMZS+(U1!;#>xnmRY4AzIaPaf*q-rufh*BCKGHU+h8rY zmP@P#=PV0&b3(hj)uHMug>`)5;_54i9yFsb68)C=Wh1;8<>2H1Mvv02%xc{lu6In> zdJh4zryWHdv?Bwqdl*v4_APRj_{1IV=A>0+Nlu4nIG4{4rwl6T+tZSV#L0ICO5DW#fizRqu6Q*k1-pYLpz>c@RaDMt)mm0Lu}m=rTQ_e z1FB(|^Za!J!(K?hXB=sIykYtwPgN!I};K138mumA1zmZeM9#9Mygvh>@ZT=Xz) zW`D~N)}uxa06&>bbLxS)XkR*-c2tAB+i_hL-x{mXYXU|4Qxa6ftuIS#B!lnBbbMQk z5|YO21g#*kVWeGY5zUkrE`N1{Fo$0I9wXVisbQg0#J8#Kelk;(>C{vAuAP31Q5Q1K zT%sSaLpVO-Ft2O(ejFF?k&wxNNuIC_Dou7($n^5E-B^RD?_g06>=35^*TtoBo2*lA zchN39Nds*a|AWekVCh&PlFxujX(x@KesQQ0vPXX1$-xf3qKDxOb=c`qDUe1$Ph7Ib z0}U`aOI;G|R$_q3^9%S7~>9cQLNOfogu zl1HnHC6a?x(bn|IS%POCf&+Cq79VbJ6|NBw)chLS)zfzZ+`-SE zep)@1Fboe}xsYV;CFxRtm)0>MHh+_3p>=sR98G#amA_ap=c5x-x_3W!>o}j0?G>(N z&%>F)VQ^{6-aV30As|G=k(O?g*4PssSuc`pkWOxsmhhmbjf;cZjX!d6SNLtV%=6TF zHl|~?FGO-KL~__Oeqr=H|0rk;JU`B6cMxG)&N1^@kn*FYnoXXfUPsL34 z9#*B>u~x!q+?=@{!#rIa5Un16CY;#e5_Dak>Tk)L{?NcJ-!@b*tU%!dnvED3(2|ar zlty;?ukeP(Dd!1Vtk6o2Ikvb_O0V7&VlE>W*QEAZg1l!cAW$G)DQt7Sxitvy$v8QU zHR}C@KS6S$BoIP!%9*c#_9@%d&W~ zTb_BOH-fUZl?ArRb(ly2`NzCM(X%wQk>HXzJhcjO_X@c6cztxKh$P1%s7{Tf13#jA z^|PHGaVfmGRnhwOZaNf#TGgGVYQPXEm43DZ0thsD<0@Dy>MLCE1!d*clI?4Vt?!iQ z4MuD_DA&I!`B8K#SjS;!6@4=$GUm_qdUO;=aG@$lPR3lpjsgS9rh35Qjj~SF>;xu9 z+`(e&Po5Hk_u1$qz@jpq_5@e<1vB;-R~lW)@FP8 z3Ph?KP(K;8rzu;nV#iJB`Wnnv*>aIk$<{M8-5!It;%5&^8^2|IbzsAF4|F+tE%93? zi94o~S9l*~Rcr#fG@48wF!m`coWEN4{iW0+VqV3jL9Am2bz8@M%cF z+4M!4j^LEe-#*qua_~ukec9^G;Kxno*&l;fFl^CFeMr9cHrMi?cK_}mRHc<{*Y#Ef z?sd7Fb8+;tZY#4adi-;yD6e&w?$^NbeVMnghe-klRtJbse|~DcWo^A_ zj8_nRlkAneEu-4Fg)jJn>70<=z9wdHKxV+2K|iaOOzvEwC=MpFG;06*Bgx^`kGLj5oAOOvA{vXKNmi@hr@dl%^OSPsj*U>N@1l#C zoZpIpWY#MQe(#UqMksLd>K*t)wA9JA&`nC-H(_O!#bA)KOu#H~Vd;CKm>UDh^<|<07 zt%jt2qp<@$8koDCQ38F+c{kigWE{!e$_U(nI$s375!sw0Y^uP`bv6oIYc`xn<0}v? zm*vsrRnEHAn!tre2^u|2@LciWtvWC4Yk8$9@4iPO_NTR$-@eshU53OZy@rR49RTIp z7kPSOS|Quh^$Pc}5p|eq%JezW##*hTJ?-k-#MV<+TiRHo z2)=)(k@Al(!}7J>qVi6{%YSUY$jf^;NM?jRyZa>8iz#7-R@fM1WLpa>n$j}lokp-u z{AA6KX~DdD@U39=G#G9HAH|x#L*P549-sVM^80sC`8SIPC zIHSZxL#UKL6CDTxw3hmWM;HC#$itBsqI-v`*Zi}5tWjE1GU!1G{TP_8ih+tv7|Pqx zXAo-x#$0F{7;7(W@0N{qvt}40v@*AU7@htN1C@$OSlQ$RU9h<=?1x8IM)<}~jG+5< zqc^sA5Ps^L;x|ewgmQc4shB0VjmId=X+dAxi&|-dYD7E4s8^m23N*zx`e?^U}LXNG}9B_e{)yezE7} zT>$qs%Hciv6U>64&B{LYK%_riGizDhMH&*nz!tMt9bw*u{4KEpH+#3P3R3`c>`}9g zMpa`m`v!QYTJ40_&l?*F<#Rv6>kHbm$zg1)!iCIfZJ{XV{%Vr={+4&V{VSu0C%^!R@9HaPzqkQWn&ey1J;xpFqy~4S`ep7{? z0AK7ymnIpiL_BX&IavKkwR%N8;$4<@4hP25vMgkwy>%3RW3`f>EuwdPDN_)w=j4mheDtU?OsQn)-?K6o`Mus`jw78W3;aIy3P0774NpcQD|Crj3(ZtD8RaZzJVK z_wz!~*PkiLRrpk2HpD_#Nd{>X2rZ}=#{Bru&nw32F5F+-FCxq~PosoZQvQwXh#pP? zI);oE2F<|~Q;{8OPAR<(6O|Z&-d~X)n(Yf_QG5CtCMppSGWU~0tOR2USHb#+#Ad}e zDmf0OOqEaxhZsv)4#D(UvPc*=L}UzPMe@DGBW0g&TC+~=LR~3)j6?yL4R}(f!7hTpmKn9MXsz zYuSVaVc;YTtaL(XxvcfJZKXz(pZ$UenzqDDRXnnNQbP1gIWHzMME?ART525WjPa+Z z1jVBXsjOqTqtrI)rz3*`4?2slBH3+cNpBDiQfp8={K^H425A|Lv-@W=ye^Ado=stA z0v@Aw>&?!BqzwGo6P~k`p+{y!^?vAy7895aXW$YVfD?<~1NcAWB5sulhfB1Vv}S?f zqDQn}P`B9-7aiqWMHuHPN1lHN1exZqX?}svSs#w9_HGY2w&l<1QGXY_nQte$fTdFWHCcp*uXtraR&V_;kn0^rr8;6PRf2pvydEmVh3H4mbtGN@3ksp zcH+`l3ZTaA2KNk|{gUSYSq;nfPl<%>9~LCjrjTxTO!UVyHKu2gG{Z@^eeuXN)+eb# z!K3?6By%-TBo-Q4#(vuyfueGMNPlhp2V1(J8V97oiY&+2b5c*?BS+ z1C+kSXPoCSxYd&yO$$T; z6tlf03b0X&9+A{C+v|X^S&L z?*_nZDnhOaQO1?`Ug9UcT;DJcws9SxKhu{CVEMrh5*lI7tt*n@8u3rMvDP1YfQx(nT{5|j@WbZ z8G%@mx1UNg*E(bL;C&9sU&$A|$RmV!6OI<}=dyW)g+r`|R0_3+a-D3hOdbDQLf$nO zEq*Oqz?88+qZb>qZH~J;kj+8j&-G36n$gUC-ih!usW5u@+LFzAcF@tOi#i9a?Mr04 zM!Y$)%t?xSH4+s%GH`O9Ss?rA4j3)hrT_n5tL_`}y2J8Zbf3qn@Sc&UJyd7NH^Vdz z-6@Gg_!5s-V<2IOuTfoT=c*d-QF1QF z$)a*+i|!y`F#|@+m;n^4Bk`+J~6}cW)EbBcpHS((#>OI!OVp5B)OQMkI_n+H>2eu zJP$oTcfVC{{?Sgj34QE*O=bgNI59gmNItBPL+qym$;Jp>p#?IGS}t z@DA)oSnj11w!D|dvo!6~n5ilgqE(ydg=z%Vn#l-Z*c~V3^HQ4}hs%sr(iQWvF2$*L zq?g%836(t0W9sRa+cUJ_;47snLZmMd>_Et=ep~V!;;aZp89)WhGE&f~xx`Y{Te&4NF zsh#e@AF)EGx=BNXxuMB?-jpL)Nr`mx75pb^8cq&dx;c3KxyB4GmTC(=o{*zY3~T*4 z>Y3A~9a+Z*-#H1KK#N2x`@7e4M_ ziVjWk^{HFIQpAQxE!Vdiw!%j|iRh@v`@XIUD_VJ`<`|8Tkbe@d;-6Up2OZVa=c68h z&S^2evI4|oNY$ps$!WcCvw%ADBJ|c3WDfFbo?ZV%cJgd%+y2L}y;evXKrc!@GHE*T zGSfGb9IGbS?$WjkrzW0iT5InG7Ud?+a>Rp*ELZP^!;|PY)9;hgRF>=`ee_M-)&P#E zEsEH}Zi*<5=$2vE&6zOteEXX7Y01p>zYN7UM~_@N#2!VSa4SuGk$)F!hTj-Jl{*E# z0h-WS?7rA}^j*{6`;sv#fa%>z**v7gOj;_~G43r98Re!)DKYZWtreb@;$(O-98O}sp*AY!&Z#7sow$pr z$5kwVZ|}h|KEn{G5xkrv&EimM^AmWBae45OxYbp#V`sr;^X+~a0luhP5p30lrd`Q~ zr|{qk4mPo)P|0&}?6*c($~3X=Yf0RM9i2DZy43kbtQnE{a}C-v!>8?Mol^!mm9G(P z%~EzSp4v)d)@kbrseNVY2mLW`Ih z?|N7mw(Yx_V-l^kf$OEX9+gDU+Xv=LVv0n*g+Hy2rPD~>a`)KDHuU5nWnbf1ML0H09lLCn%Sm9tA?LyrOWfD5eCR#e`H(Cku=v(YO zNe+FvEsTdGGZKabnb<&SJh-yYNwp@KGh~_YR`N|~`lH|606d3N{j7JcLc*Au$PU44 zLy6nE#98%-%Rz=j_G@uzuCsJ&xI%&qU9#DNE@pxdlOPdi<+qgx47qmbRn9Yq5i}m< zLS4`+mLoMO_AvOSq&ZJ1?S3!u#SGF*vCOza)3APOiznQnk-Y)$Cor)4ffjdYgo0*+ z)p-^Y%2F^CK&}Z~l@y7Xsai?{Di%XgR0ByH2`8{3ngCNB!b=uYL<8ZOl1^bd9uEed z97;}xUevuqV!IflL%eXj+$+W8GF0MkIqn9_&!HsrSWCQHbT}qDA|iDdMGV6bYpAoN zqei4B#IP1s2*E5?QcI3S*;~FsR%e`|UV7tO)h`SJz_7J&A?}9GKg*QML;0f_7w0AG zAV*x0qv^SWw)l`vJO?Oljp3LOZt2sxqMw-mT$}2i0-n1vXjM3+3TDtW`$Z$M3ymua zW^}$&`eZ<8)`=IIN=>_1`f1L3<}gOC0TF2yn8p^Jvx8sida@JY#p8qM;(rSyp+3N&d~eUDlvk_ z_?37#TJ=$WZi)3)5&hMVYlr{vjy2i?(+d$8p2v{MC2@b7_K}~&$e^05n)WkQ3So-0 zm$I#oo;z^)N?f($9VlSlaiw+HT$pIV({yG)~sAf#x2r)L3UVSDhFPkNbihASQk&>v61%p>7NGC)R>-9}CL{yht zuIjaMtF2NlRBOLpCA&|knbrm)#`=bs)&>#6jK{tr|6-yj!k3FOZ5`;w$W7OYJBp9t zl2n|`w%I`OgM#qd!e#K2E^KtA9yS6H^FQ-pwW0KIszAJN!m_r=H(CuDITh@$-I#je zTL1aEdlD-}yu8O0)m+GK>clqNaVA;csymBU@AZ{0)1mJ^%j_adH0F&+@%$BBDLG=j z6IF|S9WKyH`V7)pC55)w0%uS2$XfM`oJEh!_SI$8vOuz4xgQxqGI>e4&jAbYb>cV8 z4-SXwUs!kX5EdYvtJZ_6S)Y+}r%n@uWR`a)1|b|blJH(PB9jd5yk|x%PNIoj7%>^o z@Y9`+kM^0{EX7=7gwfYH+EPa5{(Xo)v=?np7%x(VWsT&&DOYLdgeT&vmu=wnO9CJDGvhzlkvY7*;_hB0$D0F}*8fEVQ1tp8E4R>j@pGGEo%?s& z6O%vPTr?!vZ$loYIULH7CGy|p7)Rc+Py|6e7=(QdML+_r>aL0yQ>4&dgDQr@G!=(p zA?xwOFi|LeWNGn*SX0~h?Qhmq0}J0v++QjmQ9!H2@A7K3w{N@39aV_vS;$}2BJOru zG}re2Lflz_^Z9|4LKzg%%|E`QBjwqyU$Zj&7ro1}TKtjpOHWz^K0Pb9IaNAN0POYe z!J9GGZ`~Nrv|Tj%Jj_=!_4$3DV`{#g?x2$M1>no~`*<_`BUo1WWI=d^I^vJAv%Qdb zIJABG4`MpI^x>j=_5Ej`jW6N@U(dG-3A{WT;kZ}k@`d(1xw|*SfYNNiCj=^G?&nJ^ z4p4mH^e#JP^v8bY{J}ZfTEE=~Ji^TH1b(eT!o-0cSAx8YT}Uy68IO!sYnfp=kJ0Qg zZ$jRhW{iwhpRa`0OJZYXlEpJ{(A$*eZPmM&TWrJJ-?3%)RZF3#z|V3uP*kl+wk9vq zubSE_r3tXi>Q+?MvjRoUmg&Xw9IW)pGmhE9HYAH@hJ_P`Ay)lW-CST1GrhXa@-#pP zFTH3o?Z|qkqfNkK$i5L3dVHbrPRKrvUc)HmsO875?e}ZYnfH$LRvUDQqrBa+Zy~0?$-nVZALggL^KykdD*YZ6oWfi|$dSfRlg^|-TUM^*m)0em=o?dgSnzfoq zyQgZdx`*7ct#BF(u-3lrjxasUsz%keoZ-|buCdRuYY`G#W7T$Y(*6avAKq?xN}h^! zi(Vzr7_Zg>I<`K~dkw{^S>}+bG!ZKIj`Nm9EWc~Lc>l7tsFJuEdPWnZP}RF)k3f;T z^_lBwV;u)5pIVOaB;aqL*UbQFyeg#hBiohyong8O3cWCZ{#j>VEK&bc{Ir)D|Q49J)w$3YhoNz>Ywhgt9Ew%Eq zn)ZUcBYG|sn9Y5yZHpWaL7ZgGDn8?y?T#B8XNP%Ws}XzLfS42J6V;%F#72;yj;I(v z3M~}m6IIY|iDE1GB+-2RUBcZmqe#Js;$)7=H>%-F;#U7vn|ca0c4m=U6+z08qCvM^ z>H|d-9p&v3nP5%4P4jqsv;+g^urv=2O{BjwHg{|&F#dI@qZk4aYsK_W-)GY0b`@Qc zxqOl}-Lf3B3a>2J$dWCaaZR;r9&;XLb-fe!Dr5Cu<7s^CNuN_TJq~2JX^591A4ODW z%l*}a1R}$ zR<>rT0^A0fnW|hf?ZYDV79P{hF#R{>Zn;5G$yqs{ku-$cmew2!Snt2y7(jMo^e+13 z1+|pac;q=1L`*79BO-H9-?$!PLn;!wr{1VRI^esvyJZLct-EkHGATfm^W>}LnBA~I z9WkJsVWL`A0A4TLQDdXSu0D|g`7}N!j#=84lIdI+ zTbb?st~C+D<9L22&eb06@IXrDHIb(0x0wC2z)8%ZqMg8=9-O2`Fev4 zSuHvy{CQO9GU6s7XgHn7rN^P5vXFdw046KXb?~t!$fzGX4*w``@axS5Ob4|7zgdw7 zD?*n*dns_+$3c;mFMjV_v!?bJ?2v+qfcM~IXwX|4;*~Kz4ew*bjU8ln*UmtcXlOtR<=uJbDlcqsRhp`jYgyQe~Sgakec0h(>Y21L}5BO%BC~T3Z&VE zoKd)DPa|BBZ*`?|7c2^*qeg}g@s98%Bw?}=wD5!{MVL`*B8eRfq+y6%<2Ysk00U<* zo@=%_vuq@ubCxOR^;3v1|JeM-f+-zCw;{SQ*5Zb(_{26w$Bq^LkxGBqzqL{e9W65w znRNo;84&=ljq(k%@dA?Bi%G=<{*R(cYUpzapGe_jOcYd<+)u)Q?|hMozhoEjK<9Hs z%9TN84JQi;W$eJuy)v(AX@)oe;P+z6`L4kfa?#{R=y75$wej1{q0B9^VRT{I^+{%BfYUcPRH_^o zzmzeJ#~-}(3ygoF<^hmjfvr!s7MYVsJGJgq6xNpxzGA`1_e0ba5?`nC628Db-R!>u z<3HS!6dalM0d29{Li2@iOQR64ox3YF6Xow?=z&HAW$LLOCuS~Mk(oG8`8&Gzd<*P1 zlb({*DXzIEToP%jTdGQoM#3xvBQW7Q12`^%lzy)6V_@;F@H26>!2Cd~eA3Cx5xhe^ z_lB6?T>Qq9zRyhiB~N-!fl7t;c_xskU3oF#yWFtc9lx)v?RPMR&6zRLV)(O47ce^Q z;X6(hZMx>Lb5!*^IK1Zb5w-cJhuUafw9d|aa1n4NXrtt+95>fh9475zv4 z{BmYcWk!Xbcg%d?J43^F;f+h0bu;cClz4WARg@!1e)lrgjn|^AqmZS%yc}nIrI|ui`h8B(GJzd6 z>iwY?jK}Fd%Ru#}Ol1X@oAgrnsl^U<`6i_~%01}UW3@kSf9OSr0&O=#4_&vlS7ioR zmeD#OMs>AJ59AsA(S<2&4we9-$LB`HOyUWe7Q_W0&&;8OMUVqk^f5UdDIe$BcD3i! zt|%kha&s2z>oVErT1j+gOY~~6T**Jng~pcp%KU!%4%1Cd7ByVGJ=K@zMDlO6vZwZZ zkBvuTa#Ai$(hq#V&9LhEU`w-`AzT4t^ zXq+Oyr8Gh2#N3>7^1vgRCpQzxb`y|9v;C4>6|^M(z3dfaLDjFm^htVDYM_V(dut@W zhy~}$^(7Lfqk@Vo_G@6yjM&Ln6A`C^5tiyNdQ-QUrScganJp}W(Z~49b;vdd1{06k znT~shc_TUp>lK~NCS`A&wpN~UZv9TP?^(fB%TaRs5M-AqHcCYJsgJx z=3-y+OtRT3&8c&yjZgBYje!&HtMn(u7s)_+pkjO6_yqP}_A}TGb_U~3)5Qf|;D<6Ve^|KJk^?(oFlZR2#ofP*%w-xAivLA(h4K*K_L|OH+d2#s>eo2Vett)>*GTjg3FL)v5awPY{O;x_&EgCDe?SJmrG z#)XFCH z-3zwCECvJ&3F_3$%doyU=D zTnrqad_mXYqwU2wj!VjvL6z<<;xQo_l;U9>FO`z$Q#z9JrMH*zg*Aw|b!;Oz4sgbr zH*{v4m;NnP40Qg%E`I)lQas~U4QX&n@+;&PxyBEUNW>SHNXi$}lRSX9oI_MNHaFg44Gi=DbsF;qJbCmio<>fp#k?#4?x>()5D-O`!uht3pWueTQ%ep zlbW^DTCi`9Gwoq(LyN-?fPaBdCku+Z?nRNojsDPS_l3}Y;6nG>v8Gd=H{u$V^$XlYj{3@q0yLEjJ&W*nY_^dn}@OKo9O;F%{$#h@Antj8zhB5MJmv_OX|E?j>{DI{~k(bIxOw+zVXlzd1S=jKwt_ueJ`n zW28IQ;>M+SlH4*b2`SNBx$2ynhJ4=M;2ZGi+JhIqRNu|&r1u&1v3H!xy>~{sN1#gX ztyhln-AQ}woqrLB)^Uki<-PhuUFJe1U);CV7XUjBIH{8Hs=yrRY)|d}H6G}=kLHHL zen{hH%DF>fJ$PJ%UREoW)|O#B`ZAY8Jj3zRo%3d;{>5iKzkUd@xtDCSkWjKi^BL^e z^W3bMze#ya>0G`c`FL}^)x69z_{{t%qEzyGv&^g>Bg%0gBmD7=9{xO}9#9P1%uwuP z4YbRk+Ca;o+Lg#`uSk)+s(g;V{p5f#Khs24Y;3zE(>rII@K&%y2CYx1mhC`0Poobx zucOaC52a5(FVxbQaNq1fdhVnj&9Sf?>t5%;u9kjoS{&Lkk(jn#BgXg3lW~5o<#S?O z>t?Wf!#PT^W{Y3Kbe-T=_m*>$VnqASL|}RCo>Xx2o?+gi1t*bf4Ta3m#P5?$)wx44 zVGFqoWXnThO-sNx_uTVsnVH5{*yGR^rv%65#P`~U#P`;X(f4QGcY#CHRi@#LZxOqy zN_CP7F`i-?68aqX9KkDTaFwS~BxC(>QB5Y36(U*Cc7Gz@hR{OnG*~GH+Tn*1z=3p< zsUZGD?4KbDuvF;X9GOQ~LJ~6ylut_dbD6I?Y~8ryCM33>VG$Fx`sIonzi`g$t%lul zw4vLOgU+scebw5*#QMfky^^2*SSpdbb!0Xs@@8i=Ci8N$9%3JySxgHZ2u$Ueh*!p771(iJG4?|C+xk=4?+q2IL5j`_!RN)f=MD-1mka8y%cA)*~H~ z23u1tjKkqiIZj`gccdSymR_t?ctjL;=uy~A?DQBJ_e*ppEHQeDk;#XOgoZ~_smf8^rGs6nvaX zZ(qj_z}q~sJd%ig zH9?#2lL`MlH4VL%5PoU}UPv~HwJTT)B_%=|GkoX5a4_6Q)1@051TRC~$B_ZS?%e!i z*l$@O1A%i?_p8^4q&KQT7`+uF1I&{?(!>>T`ylssmS`~h5MVk-FP^bbe>-Ixr`}fy zROH*wg`_pslzY52Pu@3vtH~>I3;msFK7HpcXp!hOGSN6mu7uYopENh;#ke?NzDN8?oK97Fky>h# z(ts~h{_yZE0&tf@Y4)&eVI0QSjFw>bv1-OXCk+g zmMF<{m%ec=Y}9d(`BM~ORiU>8Ag%(-18>|jZLxPfQ|>g1NVk|#kXPVqF68}+z(U%i zSh3qzI^>Gg=5XTQx)%yI(}!e4knrzS3uvW4a&AnM=0ZQUnPl@e(^+LiDEG1=+?~lL zKMrWQ3dBf3{*UsU2wpcV@#=o<-UT7}eNJ7i_E%LEETer&S?#={#I2QR#UO}6L|m(1 zxKxHU!&Tc(mbz#>=3cim(od%|v{pwflr3*>M_)FWLtkc0{gg7V!y%6)9Z~tCDfXpe z1)|{O;i+$47tTdAhTw*;-nva5%Q6DHA}Dt6Df02Nl1-CZ>;uHRw;EKCa%jU0yD06|3IC}3i@>nQy+kFr~ z5UD~X_JOSn!z6Xp+QsIvAd$&nEs@6HB@yi)HWBfl^T$3`K@CbQmUdD-|1(summuUHpnd&{dqb?KlUyPe?a_3GHAz0`u2`B#%7l_Y`ca~| zCFnwUhd65D6&J!@7ttHEm@A;-Z}UiyHgS~UBEH>yW=w7~)s9mK_j2H$J5iwo`g}!Z zox#LjCGb~y?-w`Pr=@d6Ank{87Q=+3vYA(Uuin*E@T*@Hms@)Y>tyKexqxn?ZsjTS z$BJ`*tKSARxpL)mme|T`-NxUlise@nMNTsL>8NH)E@roU(RIBoXzG_gFq_5|_ET={ zenEGpcNsvSw5GAfk$Vv)(*HcOiBfBgJ?BFF@*9!Q{_O_}=fVr>?~86qlA4T3>bGid zR3-8sG_UiuZi{a@3NuURTyOQMFQ*Zd9!jss6%XdVmuV`s>%3}Qz5WhA`_A}2edoP) zE(WtsjdZ$$p&xfX{vz57x>~rxiA9wcmNg!LeAm=I`xZ~qrL-bu@`R_a>aVi-thQt?_-Mr}!Lo zcDe11h9Sosb*|%{&sI%;vZO+@cxa#Xmn)vaLOY84LhMAt@}Q~UMe=lxStsTKkMJw{ z!b1DcVynvhsP_ski9SbuF_`sNIz0K&hNQ9W3e6w1DnLnziU$UUM1}8N&qB6?>Q3Fvi`c^hWxY2!!`OSo9q>ng_If3ib_31P|D;Dq z7H*6k`~p=IfkrzreeMiGB%SW;J2K_(?7OIOzhDfV7Lw=70l?TgLaj-^twSxqT?Z+5 z%@Z12F|I@p*?M35zsAb+joe{cExD>W-Bt&s(B+S@zV`O`?AVlnj zuE_!aXTS^DSQ>PKa~uq$$3Z0exI5qx;3nrr@ddQ_tD-hPdtzlmb9&d_!Ic!bWp&n~ zy}qFab?xWTYiAY*_xk2EaS7T=D-U~SZCp;);G0!{(RF4({$5D*th=R>xv#5b$6?yM zx|w8I4b_IPntP<=`YHQaooAgli(bQ0nz*V~v)B=Q61hANVgE~~1f8aw>f&CbodXB^ zi)7H(T&#r&T?1NO<)hFd>T*41YRht-k)`>AJ&MSc4}HWTV#?uPDiy>`oFp&blTEX+ z08n@bCev1P?2oze(4N`+Y4@h$ql;5_N=9D?TWn$XR;kmWog9gv zK=;b(^!HPIvC^rPMFM@T1II&`-^u&{#~v$?YuY=qUq!Or9cyj^lfu9Z8>{R-^YINw zd)zqw?!lMnpGLoISX)R#a5jUDs9EpL^btmK~fVaA5WWNs^2p|4}80 z5;WSqN~x@ka%8t;9STac-fnP9=8b(H5<0=?S(e_Z4zV{z=AanFCX=PJ0{89*!%YkMn375$Zb7$_mzC5$lo zu~N6g5dN~}wQ0E>mR298gEu9qR5hbI$PD#;L4sM=4a4}3)6vEBoO{1H#;)rsitccB zF$U)N%2BVoh!G;Y*jw`$(e?9Ny`}|Gt`)-MCK3M>L-B6SOW<)|Vo{pmY0%eul;*1J zLEuaNNW)aIRqyg+Ph5A07N5?9(VZbz3WDz!L&IlDo>+&~;)&QDub#IWD}P^61*u+| zw2({-Ml2Yv&1?1TLDtp#y>65?|LJzc^;E*WK`TR>vE0yKTDB$(`pZwyG!mCEM)DT=a~t=Mtc%lV9n zSa{a9`uysP(d~B1ug|_4tWAdep{YP$y3<+$w5nzlyxcOnyQKQY_@FdH^SP+|<&Xi7 z$M130VCLetX#g#Cc>5CUUt-4s?#>6}6*=UpCx_Jg5HxR-wcfwZ0v zSy!K{_jz+6|3Ho>W~%C!-qV^&8!y9DJ){6Y?d;o%x~!&f*2BZX^(aSskh4G&b=Oxc zH9K>L(bGNy_9OF%XVal)3x2f5#v4Nq zdpnn63MrO{e9ad-TV*I~K;2QvOQBkv37okC%l<(Jz&;nXr>b^zMCJ@1DGd2$v!1c5 z`YmT5u(qhGFC7>iJ6*sX_n4YFqFNVo#F%akB1;7HeQ^3%FP9XdNb)Ld*yzi%8uGc9 zOosUZx~ZOQ2}9V4w_L?ndiB3u&2yW0m;Vr3iK<-Qv`CD4M^R?7^nyNq$*G#yx*ntb zvNT+WpAusGQvXHJVp^c}yilfOs>k?KEx&_wwQj7l4Bj`jLR6j8R|Vg%IDRUXMS-h5 zQ|1oQMEA9&eupee^e_w^?)g@3TbLqoZtqrZ&L z@S%*GBpalI7nmg#R=f;{q@bhfnd5AVMbbSRu$sKSspg;e$ZJ$BXQ|YBU(&wa+E~vh!l-Cz&B?0;Ns0yN7 zd{V;#*UW>-9x;{#QNlOD?@G58spd7;4CQQAo<@?=1GPPGeKR~U$DFs>UPW;@N{dZd zmu-1;c}7jebk-&JfMU2Y9K^-RbhnBPO0BrMpBNM?L~AGlG0bN}EDfi}C7g(Hx*UB% zZdo@6JYtYJbCertnOc=Z;a04NDK_WF$edl}SEp8)d0J3H$(WjLissa)#NU}8!S5mZ z$V-IrCYJ*52c{Ye}6?s;q+mAW{gR@e}joNoGP2 z8S4gJ<|?5?pk&0adP@E52@E?cmspaloc{X-V+*A8#pC|YDM8=P(lb5}0n2&SQ*XT+ z)jGVHx4xaZuS)Gdd8^ojr4`N1Jp=d1;Ie~c3nxI|t<*Al8ErIz*M8c+vNNg9Vt8pi zrA1+a=XZo=hb!gTBqMhA4reuKzAeaJ ziwEJdMZwebFQ!g{lOh9~YxS7HgYo$rltErk%&-c?ju~gnh35x6TNCT5nuv&=NpGgoUHJ%5!{SKyb%^;kr6@lnQ;%{RTToq3Zh*w73F zP!J=!Nrt{N`XKNqs6D}&5YACWjN}+QudCzxLTi(@cJfvyvbk~PuwQ)2Y&bHhm*B%U zMsop7D(U;1R~0+j!X66fB}+!!a(1A3(gZ0?Uelj(>I3K9lo?@97(Fehoi-2-_lQ|z z`#RxnPvx@Wm>F;ob7byWB2@-Hm?uuOdBxMm2=?hv>b?JVech#?W&Nd1CyzIE(eR~d zN8#89jAgN`oKoZ#Y}<&c&*4d%4qQAV&pbfpAUS)Z;Nu4;&JIx4gyVp%tw1& zI7NaMGnwi~=PD6eTdmNXvcYrc1xayp7};0Xw=8{&;j6)A;s++*8P^o`9lzsWh^HQu z^Of-i$oYKfl9$fSn9y_bvk5V3h~`Nb_ZTJOR6t{Yy_c>}y4P^e+Pe_v9=U%*P#372 zJl2k&b$`)`N;j&~-3($KKDjjnjTR`sDs|0px~`$PCIVi&aX2URTCi*m+8OY?Vd5!Q zIoPk|8lNnYlfNva0LzTJUY-i3r;jUrlFApMWcFH$#%G zsBI8Q)ybyQVpT|nTew^o01fiBPBTZZc&Rog3W;`0Nkjy>Lu&{6agWNQ zormWPdo}`Nf_1jAYuKFeIXQv?w~erLt^IFx#cgYw=G}012E{WS0t*=fskaQtH)R-G ztar8!_}0(AptGZ`D)fr0ttlG$B)%f}-i1CWI=_q)E5sZbYs^IVPPlbuNouc>X4iMj z?dD7$t6Wb^i~jY(m-5%=?4YV(gEb5I)^?KfSwV8mA2N#;X-h^Pz1hyh_HIENSDq_p z_dyBmq|B+94d|zVo1VL2g4nl*{l%pKaiC26XvD0bKjgwuLB41H?xmCM%VW3qSX74c zW<)8=8C%v#VYWao1wI2la4%uDdM(LsT`vkf-5SA-Z!^tTvY7V_>wmL~Q#EeM(nk7y z-@mxrv6gkY4d;|wJs8v;xEh*aVAlRJV@ctsbadG%!sI#`Clz+gPH=7~uNfZ&+dXow zL98h*g<=Z{U)G<+F^lKT=uzNy6oodq>N=a^LsLh82mH)^E(&<+uv}m}hl~{!MfT#^ zE&5zPj@mmy`Km!{qr%>n3rNo zyPJ)rOnU5wcv+qC{S42o7R5`S6|4@0UusGDy&uaZ6`;Z*TviJYq0}Bf_P1x?2+K&~ z_%4$+CW2h(rQ6VK*dpN)x-nsiXqMGCG?o%5Mk}QI77eEz6X{P3Av2@tPV5%FY+Pii>$X2Ld-cMSm4=S)ph_uxv z^S*d8rM9MWv)o29eA)oubZf9a&9Xf{qk7FsB%Vl<7kE^bwc5P=9ZzzAQ}HgTXzx?Z zP6T}={yxGiN_X5k>5m&K5Eorf*-rLrkXPN9B}vfxwn$M>l;pOnQ|Wdk@~P}a&bCx+a_23LTxzzdsV?k$rqRVe%Q%=r77e4K8Y->t)n4U(Aq+`;U3fHOEGg8s=uh=AGx}{ zFHhL3Ku352YGTSKH1x+V2%-iJO?u~eWH99iQAZ(n^{AswQO7)w2X4@ZGq?Y?Ks|K+ zhP;1@_k18ck$c;lNbi$1nM8x+H$qHd{2ok&^WYTYLpH2)_Uzzq&WP;EV;Sj~pH)a& zwYWDaBw~r}mY1LjWL%;cAzYeFyM$yy#O8ICtXe&i<;L5q7CMjTOPK*(LLtH@YWy4i~ zyYnsu1zUgnsHiY@--v=+^35A%srM}1YCohwuf^vI-AiuB@ms4D)(O8&Uwt9Ttp6O- zchQK%(E0!h3E25yoZOXpbC0OJ^C=On9Ztr%od{m?@(`=zCv6WehJ^eHY1f$>f``tw zv)4AEo;KmvC7x>LqV%>=d|Rnqq%rwh3dQ!}+7J?>FFwYGE2|UC%&ST#6f)|drWjtl z3S5)QJa<*n74ja>`l8-yr5@BhlKL7!Z@o^IkNSn61Q0Th*I9#JV{OCuzU@5d5lX7LKSqxHb;`%`aYf z(5wtIs4P@wn4MdwJML4s*$5%@#B?b45^iWBI25OD@`%^ET7XD-ycU8Y&bGC!OcpA<`-x3eE2m5hdXTSF7dV_ zf$0;0R;3M1Ud^&am$TYvkkXGpKx?4jD?4oNJW$feen)&JZ?A*QPZS(M>@o@A-y}57 z{NMKtoKCNjktd^%)T3@iCKmmt7lVocjl=_vn?gl0PNcgO+`(tT`u*70%k3&#;y$uS#yW#f)8U=pn4S4rTWS43$~ z*96MO7Zt*KmcirxEUu4f{51BB){TkoGU zp~OT<*fp8AytRM)8_k!U1+n-v7*re_|VR3Ujto<1lSp@0Wovfo(ad^mWB zL|hrLC-AYkuRxp#(KL~nLn{4ZNT>c{GM<)E3&8T;8z5eG_sxEhLvMY(GBo|b*fiX7 z-_kE{!2vxcOEledqCMkN5qDH(IA9rdam?rxgqSh>a(h;Mb(OmtQ9=+g@} z^h2;PW_QBfVv_j*=j9}4M7-&)%um)X&J)?4v6~Hg3#)PCX|+GsU2YOL;qQODC~SV3 z8FxrHv`90YZ}U!`!|lqEOBy<476jvha3t(MkRfKfQk^f&+qC0b>%7*$TB$`;(-l%;A{$z}eQwPA)rfymYCtCS)mBk<@noVQ#g$x6jq& zt*xi$+oaeTi5@SkiXR&Hh79zz&C4dolk_SP3D0_?o}JRN@&jGX^6XC;IGDr3L2y4s zxHt38=qe|g!huXN8hq4FpNY`dXCf+>%MJ7!+dhfsSf0glPQd6 zn|I#hb8RUN@=oRJ8yI_~`;ArW1t=ZNH22Ac6He~j`px+B`fB;X86_3{Cv$4KFQgSS zZEz#%vSj@`UyJmV9)w>Hv;D!x)W5R_m$W+hi5<1cQTm=O9DRJv3$>H!;>! zy%CQ$wg6oWp$DEHMBfC|zLJzIm|IX8@Xowf7GB^V9C7}#T-T=gi@>~ixL#%V^ZpBG zHZ{jd<98e>hJ=Ez0L-s;4-<_*89uFU;MtxLr-R&Mzoe#o{K;x-TBFtC)KlGPPPK17 z4s)|T#;ZW~#J$xiMyxKM;;>Ylj7gDUDjL5s*`<%sX<1r1L*>dxs~>sJtxQrs&0eJC z`1)4&O@!=c7O$DOqG@z3%k4WsjZ&fuQr^rG(*qotCb%`GyT~6*6~Yh8Uw1awT!QJks3|zB%VdO&6Y%V zx-0bhzQ4Pj*OI8`tg@?FrK?H7&9x&27@TACh0Vpcq-}1T_fXop3MLNvlo~}x7tks%5Now|;ey(KXMT4`Nd)1y#vR5b2Y&6+ zGGgdvPgp^bPg|VfC1E)n`g!epSH#+Q2-bUlxbx<4|JJy@IwRjQY1BBm_3)S$?S z;EoN=?IsoJv0a9~)w$|&&oSfaZ#NX@nGIRd_a^HtVszh;lLQUONArpvS@#E)kqMS- zZ9N@53zVA+o{{WjQNyna-2L`sm5##)$pe}Rua@2i)$BJH&?I+tPRDrFUC3EKCA<|X!hZ>e5<(yv0~QPXrxSLNqoz}9sZ zv3;-!)-Jsm+)V`Kq^zM(%z0%h3ezQ}utbx8R#9m4cQ}qA|5cjin!$OOz^XKss<7lU zD?IDzSTb3?`>~$Nbs5{zYo@$}QZ`BZQfFvb$f1fu)bf%-aVNV`vwivX3W=qA9|H1P z@^)@8zZ`qMKC|Qe%wm`_daZD`3w}5!#fnJGrAyc6M^UA&T+eA6WJ`=Tm(3~qN8=3 zPyuzDZ9IUFz^~tXDb35*nv?bf6(|LoNb(Pjc4`G&3yTc?Xtc|@{yJ{S)?c>UEBAf= zTHf`IJ|6Q3NPNjtKv$MYcdPTIUFnI@+ihF>K+V+Bc4U{Z`4PFQkHBTaH29XA$u7_k zLJD2_pBDVoGPOW&fzsHg2J#Z0V~D; zr(Fs~jf7odHp%^HOZFkIwpx*3T3uXPV)i!wm4O{SxWr9q?OCZ0&u+r1vkAa@y13LJ zx=((=piR)o3!}*EPw^!L9{aCJkruxpc4gvAUEW#ckxYl)V3@gyeAwmurRx~g_!*?qIoR-lWsT*eK!|o_I6V$|5}A_5qNoaZ z@`Qa@uVzS)SDlR*se*@TS9vujQZcwDewS4&^oJjzIv>qiORyjf+U8LzMgzTSZJ@%` zNo3h1NAn<%qM`DZ1rO_%@#EL;Sb?cDMesBIMh!pMja{>5r3{Nw>x*P}{Q2YS$+|!k zq-m5*s&1&u9E@37w9>5dBwrf*oqKg%;LxR*Y;`AOBN(4d%bR?}g8U{zq@|Ze0Y7V4 z+C$^Z=jbApCrt+R$_1vyG$E?FeT<tF_A zMg-yyn9_(3U&jNfnc5qDE=$gE0y3X?k-{gqYTV#A(W^Y6tE5$j!+PEOyh!zQtjUnF zHOVmy$|Ui3}`xl91A}9SaiwHK$T$~Q<2Z{g7AXyy)cF=_ThXq+^6`k^^x?_f>#`q z?vDgg@AMx4v}%zAw6mtTojm16BZl$6qqgPM)4$==|4?_tapqh`birMuY|Gj_A!fw4 z`rL&r<`{8 zDR`pk6T!!muYrz00z!YXJe*BIKu)46o zyA#1OFGYBR5qj4&&W9i=`IoX;^8qTsOW0KVG=cNdC{=-2JRoe!HX0!-E>b^RZZEV> zqyX-Bc+K=-Zx#aQ@8B(X6|Mnz6zT!Ikq1u<)V?RA@?`5X>lk zfmettWt7L!RIg{*U}V~8BHx3vJX1I}QDUd6YmtvKMMwhEd{#M#;3Z(SDOtUl%k1I= z)P3(}Jy=K?76&!XWT-O{U~dqsj?;bf%T^a7+Q6Zrj_eW1*@)pP$Xn-XuikKB!ydDv zPYny%I&h%}pcig^^s-?A9%CtdO0iNXvSgY27}fU)sI?H|p+LWsvLCfg@J*jBCE`VX z{HY2LK29jlM`N-0q5Pb1?Wf4$Qwy&}NRN@?d5WKL5Pt*7@hps5edSGf-W#7??9sv- z|Dr%tr29a>j&L9AO&{ULXpEv43)Q#2-0&D<7Lvi9%>@quv6+b!97c;`yQc&r&qPJL z!=KrTk*e)%E+~poVKVSk>5~l(%JZtfF0o|6|7NYFrPUFm&oKv2)GtC8t|)*X&gdR) z%$7bNU*I1CLaX$_(HA%Ab?|Y9Yn63MTQM3u_I`PdSi2DId@;=Kc>YfL#*g6F=h96< zkja@qb$#+eq5lG7X)^ojb?eC4gW7$DQO9+fGw(a)6mjg~7dqU4HSLy>eRgXP$KSYX zY&Bf%Bj3xd-WXd5)={rY3N)odzQQi)Yx!m~u6SYh5eQFkch%r_Gr|j>*sr5p&LX2k zO}zSPxNz^#IoTBbZvR|Yet~<_PB){NPK|hwB#IX0?o+j;P0iyAm1C9UDwOaA)T^HW z$$?}R?)Q!K1>>SE3*Xu6%%U=y4}N^;$TVJbz0y4Y!1>Thcb^GP&Gb71m^80Z$Hx9V z_S@v`{sdaXyjvRe*ew8E_KA+RKdhE#ws9GW?Hm0WrF$z^u#h1d-)VOkx%O^T&yw0# za*fz+og8} zOY(84p=uAmZBs77&C|d5;vd&vEB-i=57d3{t$zdJ=Mmu&xg4JvAOv|nbVOzz{OODZ z-ArTb?*B|B3p}j?*?7Ns5?zsXlr}oTsYcV!$kQ03@-!7axO+k6$;W85Z7>gEqHm_Y zqNEV*yaacq(I}=y09@&09jDFIk61|u&0B(|H@fFOe{yFjKJT09Q*;QLZVru}b0zP& zU66Q!-kY=nE46jKe>W8SqA7E_J)m+<|$Vd;0?^}URG>cUbCTNAJD6cpa;qm1dS8(_3Jps{hjC@nJGZ3DnM{Ooyw_xrDxPUn9uN_(F4=)>l70 zMKL^Z4bg+^sVoDVA=7++Oa5KtrthG+Yf>Ek&ZS`H$*s@^mz`;8Ui1bA_e{Vc*^%rv zyHJj=q|CCuCuUxSFI})f;HBW$SC10p3K~Vd9PAqVu1U2$H{If=cQ09f(#sbO(>?K( zPtdm?7XztUy9;AYagVd*^#W^02F*Gh1u?4v{l&>l$mxuQAtBX7d>TMLeOpd?-ok`2-vmrqOIJh`^sBIO* z;>nW&9W40^2>CuB3<^1D7eFAzGPKF90L2y=1XtB4e4s-b=up%_U6t@`D9WG)Q>|_k zf>2|t%QqAhP{i}5u(5;S+YJg`CJ2tA1110v%whn@LEG)}17e{%PhkKPw7*OVfCnQq zB_A(NZ4`(ZQW@ZJao39hsNh%kK&*OA8vqg17RlBXPziM{BJ%}!LWhnG1E@m{qShk- z8VJxX4$fKi8X>cSV*^WN0XXVkM+5qybK%PZq(R3V&joBl$E+;|eCB~RK!NAui-Z_| z6>)+)ivj%g3Cn;KsNEOG4}b^Ep-D0N(*+g{q{kQFm$Z~m>u0V36j0Bp6H-b`bO>tG zQcgn+l$bdw7ug|*WI{;@t&=%WWJ_j0%*og(UiK-8T6)5 zazPWjN~cVLT9?ITQy#D(xOmsU8>JM&f);8QDIf5lg}OsZ;8SQ}1|Rr<0WHi@0_|ZM zX=b22Gn5I}1g2s_3k;?}NqlI*#u?~M1ubku1B=n1g{UOpDmt|AItw^X3@u310l|pS z!dxTp1v0e2*bYR6M{|KJ5ZX*K3s|57C;&3&72q`&v=$Vw;1%W*`U z5VWus;^O6Sad)(`ba9MdiCE&o3;v1e7uq=&ZnYQdID7h)eMxgMs3WAVK7#MXGplck zTbE9mZ4rtphCYl!Ybhzbsb?Ft+$RANcD8y3oo86%N`*DzWnW{ypPF2$w}SMP_FO@S zCXpF@C}A9cB&9E3=`@)D^EUomRvm-h9oT(2-=IHV{xJKQ4@_?C88?Z1jrwy8Kmi8wJJF zU-F7Sb_z?$hYYB+wj%r5$o9M?IF;V(5c+i0uX+=g#N&?9li}L|Iq7wEsMktBs@KT& zNRk|ae3qwS^Hu_53Ma+9)857gKL#*)103rG4c~Xye-_O)QH}HyZ%yM2O69N-`n*xkRt->WeHC00t&)=gD1OyDiEOVhQaGcXzT{Qgpd?HFnIR}%RNA22r1kP zgQQ0|?*-~ZNR>Vq{2!t-&U zIfN{I1ndb|&G``~9)WifMkY=IO(DvQN6?yr)xJ)_#v_@AfzKnXP6G`fN}(AT#6QB1 z86f0(3f7s0LE9rR&H=3;WYi;^K7#H%&=5jaJp$GOtY*6a8?WyX7#3l*phZ}0?GZ$l zV70_0pa!J*-XjPv!)lSsKqDym2(l}%TILE+6GEOng4`;smb?m7g^;_Cz_$jg1*`#I zK*)(lpjn62oY!F+KJW;%8?c(s22cy49DRf*o3NVaCT!oQ9)W8MR*T+(C2{Zwa@(+4 z_BPNA(j0yV2Ih~@xdS@}pX|Z_^0Ej$Ft>MMhmFi046+{K&mL?E4EAAA^9Z;HFp1+M z3_Sw#cNiJ^2s@7;dkEXc!biaT0joLxfNkTqN1!``)%=cN=`K71|1r?$Z}Yt5W1uPx z?md5h*er0t(uWufV3wai$juZi`V&Zr$mIVQ33?>sprmaH zF4(n)3;-Vd34}aBfLEa;@+9FSNp=Dw*-jv2qag7kY4b?>KuM2FVz9<3kPX~>0>q<+ zP2AnQy@Esi0;`<@AtsREm{Z7T z8pNc~6rO;g&r;yUQ`p=Np%D?YzauzckuxCV<_cCkgGBb-|BhgSN#=lf(52(3o<#cT z1XV8A7eWWI!uJ*zO14eW9GIJH>|ieW`$IJgIh zCFMVNOnC1v={Q6RSWFiG{{P z)nIY(^c4^vdXz+}7CWFRL#DA02gmu3**v#^Dmgf;Ucdh5y5K4Aam`!YLT);ELjP`* z0e*Q6l!RoMbqyJ8rwi5v_{TLY>w75YyA0(3|9O6;g^106L8b%3pa9d_P|(31YQZ(X z9@j+V`F?*mIUHQ{9UL6wxcsjV2JpZ2WH+!Om~S9G?Fsx9;Si)i`}Zn*fGUR6{!(<` z03lD?-~}ituk#lft@Hmjy^8kQZ&_sFx6{);x$;E!0o+?@tLh`xeL# zJ#HlIXlCaj8U>1fYc}8fH8A;a*d$nfL&x%hklqyZV8`FE-F*iotu|mJEx7qnISeJ6 z(E(5;Eg0(#)*N^TA)^@p;3@_HJJ|jXhz%Y7gUSJ_JR%&NBE%+^?eF{`r73=xlm*=J z*nR@q-ctB4lHwlLDeFCijFNznw9toqh}$VR3`)Y={7qtk`BoqIjh$I9-U{M(`po3t zhlsZ8f9pdbdMfDZz^mM`V?nZktj<5vLk64u0YXfN!Rdb>qxpsbz^4%a7VyrW$AM0A zvdYjP%ld%x?}j50Fe&@Lj{x-tNI%rk0PsdGfEk?p0GnSil%&miB>&fy@mcJ~L^|Z; zG=2gH$NG=;YfYr45{36pG@_zJ%qfQT@FX#viV8wCLnx``zoRRI7IAn3P0dR0n|B?GCcnyI{0D2*a5)D{1A%VOo-~U^K>;UT+Y=8(G z%mERSL4iLd7(bkn7F_a3HbcpyFc?V>{(}h16$=SM)?jmli4toE>Uffu7lR{}w?! zpg=aG3m^OuoeGdd0K^1ip;AF#`oI*ZkU%%({|%sljZmp@p@G-X z00%QH09H2z;)9b1fw(lVaaX8!H6SyPf?NXG|1kqk&Bu<=sAyoy7ge>~SCDCVxBOd4 zVEUh)iNMYflWFLferS*}wVWR#STT@aptPYqW-|tjj7I+_g87g02hx-l9U|~f`i}sO z!^`m>w+LwB;Ph4YWMW9hkdqm*`v3JY0LP(Iu|jibg?7YR_t?=DI@MoOK1`1zft+al zkemEJTlO?QN~JI!Gu6PLqJ$>`J7G{gfo&4>)wc;A4sHi>Inem85#iu~9YC;j2ar|# d|MQ(#T^Sj2nS_HIf&8gcgoBgsf;`;8{U2pOB{Bd2 delta 33361 zcmY(K1ymeA)aWVh?(XhTT#I{gm*VbjgBEvLDDGA$zDR*mthl=u_fn)dZ~1@keCNG$ zX76t|_a?cy$;{3qnbb_*>`Y(aqY?}(E)*0LB9w~`rc!QSaS+x!D5!ss4+?BM<l-9CwO|?QCa!&Gmqhn|AD$+z($HMzbhezV@SF zNh`Df(5}HV)m}^7Rc}DBkJUnzKqa)IDG`xnT2Sd)+?;MaIWzf#yZ74O^pLCll{x4~ z_@JG(j`mF}_EY+JJ*mY7^t_LI;k0-C`$}_H9TrIH*w-A^?udOOdYE7`uOE3jwn+Sn zMM*QvUk&XL;Q+3Jn|-EBt}Oq2;<5&n*?vpli$>B|WTH*j-TAS5KoFR1QqO4-TS7HWdx9MgjeJTV=~EF6Sz17NEvd?GEg#d2lmY)Gjh4St1^IOP zM5e4y5UZ5W>(RR3Ll)S0MbCS<94!@jWynvEgff21z}JM+(YY?Vw|fzGg_(z*w3JJe z2RA^Zd^>oKewbDIpkUtB!qU;0Fl$RG$+0H)6@UNscvE~!ye3j6bOf1kQ2M|VM!vwQK zh#(2$j0&N*3JeDpgykkM%d`-Ngv0P6Lf8@q1N)}$0Ks^_hmdO=hWyR$;|5IKTl(uU zOeroJhIxPiQfvURnBmaLx+NT=>ola!?A*tM#(V1NFU)c(IHlaCU6b^Rfo7o9j6MZ z&KBX#N&uYc4rlaM-IX^S8a#yWg5c~$Aarbp`;7~s+63G+0ff@~aK}6lauCCFzJR&V$R49L&NNO(D{H*bXUI<8=GAlD>TP~kg53J~WI85&4=nhXW} z83d1w12N66h7WtIne-dH<6F%!E%5l55Ec%=zxywK6TD|bJ#Uer_v*?tgn_s5!=H>` zWCvmTJpwfigkVxc5EF!IvWVnwdS?wpT$ndU73urssUePf!-J^WQ7J$@_XtR!o)t1g zaE~@3=bKA^bP-eV-b{J2G9--Pp`Z>?Kq;AI|Cz#p$k)i=!EH{6HgDcgdLmlBc^m16 zC`S91CDpb>OaloDsvj4W;)louewUAEhV-ToF>Wmwh72dBFaM(`s6bqN>u{e|#4Irg zF>es%up!h#K(c>}Qy(Fc9U6pe^hhUfP7yI7(Y{fP1?gu!gzwgnI(Z@N!bD!6hcKNV znV%BEFeDbCbszVm$g0OuP*&78y&J$z> zymvY+{wTt(ke{utC{sibM#Z8aGC-KzfI{~c_SPwsFK^wXzJxOW7667#6i;&qb0tx6 z-@2>85EYy9t-S^oIf~|VkfEdp`oxOH3<3_wkiam3sIGKxT7@ns<{yy1*h0ep)uMu1 zi%>^V-n2K4-pVo%t#9!EYLURbwWykJj^eeWMv+38H;?M{<^jqYD$g6mf1}cHzU5X6 z{wmUi4Cw-bx7@5C)gv+la4|O8C^E##nG9|JE$rH?Xs?j-46JR727U`Snm-!FTlm@H z(dy_RTx&o>db8i}M1y|ohNE9-PO=c{VxS|uoyVp$=%tWwfnf#FGo2yKsX*VSLWk5I z!QWwN%LxTFX9*3$5=7?&_Y9+Zb0R`Cy{XIl{UFf?bR~cv35hN}B%<0pi#82Yf!oa* zTOwAnKNeX>%d?@*!4Rbm4GVWQHr9#27+23r*VuTp!~2iVMEk#tVP)L)3vqF8kMrl; zfb;f)`~c^G3%Ut0D->HOv%Z3YU}#_1{vL%tqpuy8LxP7~45#tIOea`Y3rhM|An+ZJ zaNve@K_|f0)VscMj%K+Kz#Wu#md$pSt?gmYv-&+D|96|fkXe<*Ic|u4Ec|Qm*JESj z3#?xg@#>22%<-T)w?s3N?v=Tfsj`0fX)mFfl~2`j_R#AO1goq_7heNB@3CJN6a5cD zraI+NW{0hi`_0{b@}W!AelQG*H*<_Ymtd-aw|)a5Hri0L2V{+=4L{GxnKSVopSt14 znw;i*jw>~hQgb3+Id1(7x)=#roUDx%sNB;6zW8}`CsVCzMMJGtLDhlY6$kvnGk@&_ zswVGT3OmXvLTD&vJrxP6>rj=ooyZ!rSB3VWX+id!=z9$}(zQ4Uf_&+KQqJ-B$@fQN498^B_8M2Fqo=-Z(m~c6VQ}C)^Qu#sML~R}R{g~snbW7;8Tq!5 zN0gYLKwC+ol z8`tQ~&zyjK@@AcVe7DFim+-zvCwZ4(7NozcTbt)#s@IZDcPk;@C71S}E>hvo){u;mYuksX%%P|6ls&b%VpUAPT#gH-O4DI28^@R ziX8k;SsYLD8utA{*cy4QUNS#xPZ#litdcy;Gd&qF7^h9XjPgGTsXUa2+{1O4x{=0a zoBj$c-oWNUFB{`97gN9BCdgo*zQ2MQ2XgSkTDOMmqHJUC4D~E|mQ8X=eH@Xxt zkEVv<%lu=^2Hk4fsY1$-W@@GX?mn%0Uh3|zQu#M+r0kSyc4G38e0E~0@sX_}1t+y# zTXZQFb*k)$Jn?{CzYzYu+d5+4{tsV8{L5wy^b^;_@NHR<`C&J*-X|)?%=4FySmag0_q<5iI7d-x+_#}k#sW=dm~R`QOAl)8ONW1rjV z8hZJ~ybg9`>%Zb4K$En+)p6|UKhk!7*g4a9=^nh_p>rcI!h%Y*h znva>2@rpCPzmtu&2|uB$9 zlY1QCQRxXY#x;_PJfCN0(eM*Y=mT_zphiRJi46&E#1$XInHY;0$@exA+M# zSB|Ss`{yj0vtQ+tJLw!crA}A%$$A{yQ^~l$&z8SNK%%9tM?TR0z%rammy z+w=Kzq^q2?#V2{MK=0`$j1uoBBzHlM(buU(NS&W_t;8_Usc zauub+Fs?tNC)vwdqP@jw$GwjMRU<{ zZb!*DfG=U^j5m=c*PYZZp4&AZ+bgJQV>ad4x%Bua3}^>4g9Yg~mysv0F%Y)su_-jS z8$dklZ`9$KbGi04dKn<0NPRquCgo(5`IXEP*xg+Tz5D z>GYM0Kv)W7>lkCJOxzIP@uK&QzV_@B_9tA^RjJ37f?1Pq)eaLyRG9vp%{&WOt+-kU z1Ro0;3^CO_tkBT#+4uf!yADX><0CRi(@DscTE$o*#LHRlmpuS$Bv~$?6X^V)L!yQv z6oQL@kA{xvbx!0u@yAtXA~W74b!>Po&)&v9X>|cA#woHCIJH4f79S}#5f_KLV=C>E z>X^`Kg^aZpjs9s!Oe)U7_!n*|QEV+BDaaarVf*Ptkk=rsWQctfGEbB1t*LZz$hI7W zfHuB;v+i^pr-%%cxX^O*h`+xXS7|)1L7X}0nAKXy!wr0}uo9ME#wc&JNn^drx>iAH zos0wXcAlVX*02f2FPK|e4>EpUc(9am_$Ksfb{t5VJJFLi@lrnV66Bd@G0$sap|v>N z9QABy+!R`_lAXyyjCryt(*02Z{6tPNs@-lz#x>XMMKT6(ZBU;XikobD3|;06C*7{) z_)V6jo_pz)Z9aGn26yIbZMs}b0fjqPMOD6<*fcRd#+y{u*M>bNra{i$^TcG&geW{U zV~Oah)50CeEN$e4ccgWS;zT<$!s*c2GJShI4luLS&^VGg?M3Xfsw4a_WIEJ zL&T!qZVn>ht%C@54k85{5eFnG^)Z7-Zi%q=KcayMml*-<1s863@{*!f4!Q7kVkE~< z5)}A6_P(tz-I5-a3Q5x{f#n7xRSvqgX>yOB?cAk%OuiUJz=eOYOf!5Waxhc;N57s# zyrqr#Fm;8JBTh-3kQ*=A8WJ{Uvv$so4epF%iqQk>o1C+!9u07>JNA<&a+fA=gzj;5 zmn;Eo0tR*hCKx9>En;M~YuV%?CI~TpLGWM1v`7iA?3VZSz(#x=c#w&a)h?}a5S*z3 z7_q9h(KAjNY+x?*YhsoAtG8J7s$i@57u-V%$Ai|FB5%dKrd{902{;(kJibMm-{|7X zl~2ABe^zX(N$KUr1*g{9BTx><;(geO!To^NcaKm9sz#5q`(^tM2Qr03E#tW4dEG+# z7REt-?D;!_D@k<^uR^q{p^T^XY66f_z^CG4<1m>GO zb{$W952{(>D`Fj1d;Uf$eQz`+t zm^9`CU%3r}o3p}{-_M+sla=M`Q2B#TUEfnHgvftGn9cfC>~s1QJ$l$LF~2E&8uWRI!6cz%G@zQ+0H0<^*S*^Sg+l zrj8RdPez$oqfLS2#bZ(Pmq%++pO+bk>0Xjt`d*Wu>~K)rAi!rHYozA!iF$*=o|W+6 z*G;DIN@?L^1X`5e2Bm1BV;#DXq2V{WQTQXQqz7_b%|GunbW6(Z>KqQke0gHq*emYF zv^C+9h=U~fUJ8|cH2gE=QSyk7#hmBI2i|`BV1|Xfb*&Yba?1wd+q&aj;vn5NF)gOP}bcPWpUbe#p{u zlylDjBP1j)X=61P!-zM;CK3|S25m#jY4fy^J~{UR|Ko7t}}th!d95% z+FQpes`*OGR#>ujD#o{^EH7ZMUYy_3}@|gztxQ9%9rC zhuUwvQRYwYR{C7kMdD;vTV}(2?Y9O(WTaC7wDJ5FQc8mZfm6#*ss8k3z>1T!aZ)N( z)jjApYpH>NI1`ha^mk1&MOQYJGWG_6+OKUhCH&UASw+YGAFfXomYdf7<-AApMXPuO z!e>4B4P(f_9KA|ZHqA2vD!8P&n(gW#W)wz0#Fp@O!`HV1>*HE9Q-HjAgq<>s!6uC8 zj(o15dZlYW(0TYe^hN6futjtfuIU>6{4dUH>6P6WIiEpBVC3XBnyF3KJ1A+xYa+eM z;oqNLJx424X){6@;qX}URGHEVFFpLTy<(b$;u1+202FW>#~q|#Bt}?Mr<=@9e}~e#ju&T>(aX8%M6Elfm9oQcO>svCu3S{)Wz>y;5c3~(2hwM$Tg$Hv?iV2M z3y_EDp3k?SqbKra;5pECOxR7V0~3QPe1knd(WYJ5;Fn^WfOf1gG{HX>#@$>Ukq}Ko zKVbfqD7)qXz*I>8sX$EEecI~};|`P_SUmR|?*?|quXOoVfM>JEyxwvB4LB`Xi#?G_ z7vzi!lF_L2#JeMH@{Lksq7s1}h%S^=ycX3VT`C7QIvvZKT>S%A(zm>c&Ok6#qyWy;utKZ@k4y+KYh92e$1&~|^PYVFlTgT@p4YQ< zuR9YSHI$5U(BJ%%Msj8MOouqj>a31d#X`)sT#_FGB9uFq+S%Rovy0=xqWS$ybvQwF zMxzY8jwnNW%A)K?+V4p)(@OR54IZvT3=>p-mv8{eKlq4Hg?a?8UuHy|Fo!%d=*ofL zS@Z^g39~^%K+NA%EdhyUvwzrZNd(7dCdJ>qjhS(yV?XHpx|`&}{}p3SFTnLegO})q zC)PUHL2VxNndpQkm}%i&`PQ{A7%GnPF7I8Qk&)os52Nmh9|+|~DuQP@6+}*D_qWB- zvl~rZ<9G?)1OvinZ5uC~bMCZ&l=Nc`^~x(XQ1bjOSN5y$ud1MR!-uTZ`(?Ru^4H=` z>Icm>gNkgkyNNRl`_qb8aOm#nX(_w#~LU2gu-TLaG%C%_}3v^Id+wmH0nj|4dH&q_PVW*K_Z$R`VHotjv2->?q~L>OA0wjkBnSY zKowe72~%y07zrEEF^w|iM+-JBR-0;pgv&3at8(R6>e-%=>q6yC?)=^@Y*>BX0#$EG zIlw|}fXQ8K9Px{qDp$d7{}IdAbhYdUB%bl#o}a3Re_`(bmKM$z8lPe*C%LzJw~{*U z;S_6CH*mR2WgsT2_ZDUj%<72IfzrF2;ECc*lwZ>pCe4#Y=f_I) ztC4}FOa;W>6HB&kxc41XuC7+OG-jAIT1V@LDP6V=tD+~s?^M+`R6Fb_K8rMT0kACeKobNvDDa>4=w9H_&W{N;H9U-D|G^S zQNnYm&-NNKV}F-kQQH1@bQAo928y2-0eTHd6t?(G_qUR!MeCz~r_WUYOR$Sg_Y19S z=`pctcq8QYekMHVv(bxc{D{V+D`Mo~3)*S0zyCms5ltIAMxq0a+|A^o_<_xFfy3NT z0F1a)#?AQgiS$jt&2fp{sQTk>jl^e&`JANONy^2!^ zH-|n?HqUW0sO|;s22@Z2OmUavjGXy((Hptj2E*$}+%3^6oXk`kXZ>Fym{79DG{TO;tr~1@rZq z1L4mi^Q6VDrY~I{3Tz|WNM%2Wh{|N|E2yvbE1L%z)NPhlN5x{A#nRk}u3#N}G@Oij z;B<^?+Gc&DLBg0AT!3}jSE1DPUvLjFWBHRDiysYNhJ{=OBMMD*;K8A?} z-YL`lURVaEaBzEHUsl%9N~zoz)bah79u-6E&pBT9v2oi1<_28+Nw5AatF0`x4~DUK z0bO&1!t54??{<-o{J%`Rs>`HQzcNjr>GR|n7=KSpt!(olONsQ2?9BBiW}8&yVlGM~@ubt7YSOvBl}VgBVZ*HU>RCh1#cMEYX&>FJHaBWJRt1j$ilu+vJNc6-u1( zq7p%8gZQdimlq0}!p0y1phevFzarcr&;GkiP1Yp&)6&fUsPLO|qe#eg%L9Mz=k?>j z1;K%`;YXEC5jNRCsL2GuG{dfk3*%3yEOGG9b{~0-O}ceQj_PGQpjG~C>*Ue7n{47p z?i#IJc(!g-?eosPmc51Qr_FI9Z{P2x=Vrnpo1jDSY-e--rb43!6XI!y*-9N71)EkF z?{X8+MaaQybpFggq1{c*rR)SYX6Xv9yox~F?Fhq^mF;fF-*=B#L4yjsY46pxJDxpa zW}}>5@(qaw@bfPo0AqdZ(joDfdyZ5EdiMOoizrX)iVvE@D@9fHJ&tD|g-J<2JY_Sc z!InwokEw;FJ*w9(YDT{*FijJ{ds|n8&$d_mLNZ*g7UqubnVHWP#q2(Q#as|&iL)pB zZO}IwGcm&OKy?BnJ>u1RS=;nUwQrmn`T9zPT1V9y2@x?RDlXSgoCda0@nZ$}a2py9 zmE|epG*k?5GFMZ>*agFh8hrkC_wT3R2QE+XpQS$~#JOe|RWZvdBd8Bq5T)VbshQw0 zoh)%xc<`ptLG`#86v%9WD#AqEX1FDSpk-VPav*Q|2knP4Y!wP++pp5=RT1=xyzJQ@ zBc+| zmgFy?_>AOUxAS>N`Z6b0-mj?Xh4>y0jI8<$w2F z{-cw<`d_8AFl|TPqia%Jvk0<}1n6xX2dZy5q!nD%F7kczUP))|hF{Mfx}d&DWG)Xq`490M3F%KOT?`qttUvQ~lr(MS z9wx}+U^Bid7F;F6!<$BUdaRVmzY@N_Ul7`DBfSC(X*l`6{Nn=2qM*gpFLYxa9VtI& z>(X?2P2I>R$(~F2YwVIu_iX_$OOM58x8imrB?R84TCF%oeC38&`DrrO=H;exSkDo5 z*0-u9Iv+OtX@I8ENON7j?mLzP1D`m;c>v0nA!`nNN4w9dA3_5~?VKu2(TkhHjmLfLbB z%J^$kC5e&>T7X_3`9giv`_oVV-`AyT(XTd1MK(qYVt?%i#lk&|=dR?z)boPIF^?&# zmO^|MJ-ty+Fh+{k)$YXy2UySaQHN?N(jZx!yidYEEaW_qmGbfB<_i3OL?=KVznG2m zT_}MYYs_bteX3GFLN??ls(%hfSPOI)Kc5`btN7sRqD5lwlMsR&ZL@x+iZ6>x8HgON z+6q5qd7&Qp=vULAX4%o`f`<)-93DrWF@`1 z|FrF1Ov78e*!U!;T=3~Zx157VGz^qWgh2shdlZr7ucSs`5myEb zNY8TP8xGdQ4#ge*5h(_Pw28_dPse{P>n}LE=8xCNOmJmXmSc%xO7do25h-(+b$qrW zXQzFDA6+ZMH12;Ql8OobDDA1>U0Vc%X-JinW9JoOiKf|!&Ki`5^F)jFrm~F*Mjk1b z*JL>p8}wc3^j*q&l3Z=>KG~KBv}FL|ne(ot|9fDqkLMmxM+b-btxq(~+aIq>6dUpu zuPbj_2#M#|(j8nd(|jqAY_80*r5MZc&urY)7?qzFj#ir!ZzkW7JEeb5SDW<;K2a`h zLg`2r!;}#o{ra^ivUOlxd=4bM9Nu3!H%hNMoA@9E%6IAWQ|Grwa8og4oz7d)Uh1)ez8Rl<{Z{>h zS$6WLN93X)udfC*Fz=__(yNQTp6|xC(a-S<+kkvhta8aLPWqL(bL3OFlYY4>$r{M& zxVevCzkEWTag5JP_Gi9hk<74QrS#7$>;#3L5iBHxMwPsjKc8Bwc!(9nrvmxbE*th1x#~E9n1Z_u;I(BiO zj`AB`pjgnZ0NH^VB^+A2Ipn7(PY4R76P|a*-Bmm=8^8Fytbe%sXCRU^Y;+}}))OG* zE#F$$1FnkKj!!L96dH6w{FjgiWkSa3!`>vykqlewW1Q$%BB%I~7yxvTk3#tWq(vn&qGwX|2X;s_1rci!j$t6Z=X8MgE# zE_59c)7PJ%Yt5Pyrt$tfW4^aW{Qj}Lq%y1Mk3zPX>?PMdXTBIzNKpNI<4|Z@HiFhU z4EY$Q5C8_dR!$4CFG{Hf3r{j!It>f2Z?7-X6kiTKmMOH87MYScG6)-w{$L0-JOT@v zt~7&ENTt|C6KS1F-D*yFg!4{=+D9wiiEzt&I9j#|^#Ku<03RcXDO@(DPL>ziTk+Zt z{uxecl`)ijJPVVD7+>jHsF=%@paftvy;V131w;mIDT)bK_3pgW{~RbCPP)17*@ik3 zN*qp1@3$p|cM>^4@oNpnhx5ywOqcwyyt8kve+YV9%NqXpUbb)&OZ(@$82m!h>cUCA zB09e;XzhCAVsqIEH|qfHDW6=%lMu~@jU_k#05q;yvuS~%E1K&A)XKCZ$KpC?ZgSei*9KBVEmlJS_M>tPA9QoSC#bQ<8e;V84L-vo((@CJUs1Z@>9og@Hljh(jSSSi*V+}nknm!p?>s20yBt1_1J zX%)T`4%%mfkTpQAn8$-*5HLY8B^1JIL+|GK2>rT_z}2eMWHV^uQdoZ4-mr?+Y_`R9 zBU^$|<3TWJFn!d(Ph{(K`*UfP_3(O0SR${#)huAV!KaT>_BFcv_64y*QTl8hp@z^2 zs;7zO_MHIb2<}WH&R=HFX3kqILN=_H7XiojQ$Lp&w&6pIhmR|^S^?xPFj<3IuN3sQ z-C0%#Mt<_44jZ)YnGIbB&S-uph^_+zg7El$^hefyW&CLGO&cmX>Xqz*NQL;iME|ef zS#AYw(+~BfIV6TGXEO=5xkLY?`zQw?)ukLBog(@odCOmaYqU5Xb&ZmKWr_;{Z3o9x z0^fd+hi*acT9$Nyttrdd2^dUMyA?mE&pKbc$wR6Y*C$jOzWx0BKa?ue0ADpO@o$^M z7~?$R8*yOf)40SwldMsv@ErV$KCk2L3P2>UeUte$yj_pz-_`B>|B>BwN(Ug2YHmhO z()znez<7v-}B3wV}yaVnX_+bc_4+ya8BlI(tIJUv$$^Mtq9JD$5b&ioEpC z8%s1FX{L9t^P=&!AuD#sIn~M-sPUe-8UH)|DWvDR5ld*Eb}JeFK}lwlRjPHu4meqzry`fnRWvF=x;Tb2BP;j zSsDs@;~FD9a9*(=1;6(mBDb->U>47oH`3 zUOyK8{h8&M6bSXE-;87QPF#L)wOSx;y4fBX6tq5}Nk8+rzV#kV_!yjP(JH2)uS(G{ z!t=;zMN)!RFBW98#%T303@x*Id0mqm)M)#BF_1KrpwlXkYx}3Q)+fDT#5JbQ{aMiYYol_p70}k0q|KgeJO2Zbu!b~~v35&h zO@OXdr!WrXCALzl_ylD`vRR&5s5U|Om@vlU-q(tZ#*Llgo5)XFnzheYL1BL#YY)%P z8R6&|fizpF5{lB@xT=Wa1C-`)b?Oo{b(qURen}=gMEc@9oOJY<{GTr>ADusWzF+(D zSFE^`&=`2PzFaVd20UHuOSr};nAJ?3&F;1Ru3pd)hktEu9t9Q!zTZZWuAwUevkc3 zl$sZp(ZqJ6s?FXyC#>DBp-3K%dQhb}YQBEFhzoA?YaklF8L1oCmtSO|V8g!(EiRP2 z_ii}syG;#OgaPJ?+)&sn67#ja1uXK&VT> z#hAK@Qo~7Y_y>n+r->T0VMEPxcW0iD%|K9tM`!5MUR)kOp{?(*#z6wS&~ocsd!NM3 zk#HVANhQs*+d(b-muzy^4d=olxPUw#!o%=)lfoCgAA4pF^8OLpHlKxDiNT0ki5~_| zN%-Kw=3)>XHiY#}M4@?>nl)Uh!=N#590iU^AQv0MkFW)=wXaI3N8b`22AshhXaevL z9}JJzY%Z63awmxoqpk-g4p2RP+<)AE4>eIi7I<|m1Zc^;&-thF*En)HNNlAQf82i# z)hXFEMYW{xUGkff*ipg|-sJnJJ^kr`3Pwdq@HB8yg5wj49IB_9`Hy=Hn03fb4co%U zCUjwOz7nXGK=Z4`J}xkCFj@8GhC3IjTK^jmX#cS*w0gteMpfa762>^SX(`*HP>x5; z6`gPDB-$PA+HcUjVpM_vKPh37XKFq=7L}K(mOD5r)P&p!M|@2p303Tn)D9?orJYEk za4K}*QH!H+D9jUhWPrc9rB!lKOQ@>9_Vx?Z{^(MJ#s;Vz#uj`k3`aWIvB}Q-q@NH< zX{Y&Q1oP~*wSSj3-i`5nOwcrvE`tAqHvT!rF;vVx7c({^^E;nwxMPL*UDaY$8&5b# z)^?%bP=6L0|HeO^cag`sji*4z-RcfO)qRC4QQ)`r6TPph=FNEBQ{Dog$~aZ5vuTAb z+!po1$^fPF7;zaVD_T{|im8Jr*C^Rds`EKU(=65NcE{g=n%3^A?$J#`>$?I7*cH`t zyQK^#+{De(n^Tc2n*Nz$Uu4Q+jQlN_g4BtaJvf(lwFYpWbxAMNipPOK&1xnb#UTPL zvRt*)&0GGfe*>B)VNGK92fPuBRX;oZN{jdyL=H9t(q6d25A)h-XUDqo6#zLxk@h)< zYO5#~_oJE#A;Za5^y?yn66~r>#0mtjB zrgdbRrMm~y>mznC0ey}b?-lWPoNq}W0M*N@-3=iH9DGDVlQiBk@)H##uW?xuXIEX#x-9 zu<@T48DWs|2%<~0SlwQ$PXBXmaGC{-4ZfY>sCTd~u}S!Retxbiu_|Oc3d`Pm$qJF* z8Vq{_PuTYpz1G2y-H>X^oL8Vyr17~99;Ig0X}Vpw=X;H9k8KvofnfXf$OG3+(5ieN z=K^L2^e=rK^L-`OKrC@uyZw1W^83domF$8M##WSBAlt&Jj8l{sL-HO6#K{6#3XsLB zh02rJUMM!TF;o){Fm#%zZ?>xA>*=cfb4IT6BB*fUD0JC$7^5ib)-3l=2pBlVsvhd_ ze`-{w1!LpQjXdn;dz?)et-G(k00WVu2>%lOEq7Y|4@|R^HdIHcT{v2Dk9~w?@)ai& zxvzp!88@GrYC`9giYlHV&8=B`7YZ6?!C(MrIPo`z3TQYH+;Co`Vb-;9Qe-8>Cv2#^ zesC7@Pg!K?aMoJ;bI;N#uPZ}l@`gR%J1oWW!qx3P)hP4-@t7=Oy~3Kk$oj@8U6S3A zq8hgSH2&=RvL6gH8XpBx(xnWltH-GpFdewREEMAZlz#{xJXxRky2Ej!w!;D3 zklZUh%f3+eWc19r>~Y+{JdFp1+`oI#5dUF%{LSjwLI1TqR~&TZ(4OIu?R?O&dhhUZ z_VoVM`{fHD42%OTiyavb>mz@K^@ACJ%^vN0!^^!9m60D$P9qfQn;72}+G8Gl)BdWT z^X&zf(Or6%?u^_rCNUercbA?*`}+gmQ8w5`qj?3N$ynKxdW@HcT5fx5Zx_?MMuw$& zbmXtxtg=3I2ZbJ)>@~ROJY>3m^3Uwh^~1lSO{+owOg6#Yl6<62#}fqE(foJvPVkt( z$N^?8PsDUwh^>HDsGGJ z6giwdKJuL%1!us!i6n!PnL|gd;nui0+naGQ!#R6nB2*$HX@5Z|QE6P4Nox=Pf^r8C0&sAWy!zp~B~k%%td8F0Nj};2Ox^hF$Qjm_0&W@rHZwonG{!Sv7_~I2 zctbsxlfaxNm(WU+y4VcClco!gkE#oX{ewTh(dTQiHtZwSHvA(RSDG2X*cD|a$Q5Dc zpnV~@&I{^X@&SHP6cK|`6c&R<6uL9H8zUek_-BjQfq|)8Ek!mAvRg6k$dJ33WYLTm z^3iEc^27`B(U_L}fmx(y2kwmiNXuuB+G!&Pk;O0lE!Axco^|iz9LDzyt}<*=@&~;@ zZtJpjow+Bi?(67vBwHOoP20Ia-Rij4q_#=Ce3(jQFA@QBGuTm9RJASQ%201rXQ3zI z$eUFqj70B+KC?aJ3hefR-nxy!>c_vhUPUT#AC+~5s3bO$+L_MJ^$L6NkI}{A$Ru;Q zg0vhHE2iI%JUzco5_cz zaE-g}EKOj{mxK^?2Txa<8pnCTeMeFaYb;eVV4Be|~Rq89aYWMZ*I1U$lj8pll zbHh~XQ#nc1Ww;I`U5njlmkMjgZX2(SkULvZfZdY?qq00A1RIFmuz7!9Pe;${(kK~? zaag|CP9)h7n{~wAJLta{opCJvhFjT8c3w!NTrUm^@yxm9nmJpsv8=eoTOPi4J`--# z6jt@-4w9ZNo-&}dt;LV>EXa(w_G3dk3a%BOfib|J;co_vN)cM1OQV`KN-rE}l7lM~ zWFBI?v1cY*m`hFV=H+|l?UP?B=c(aV%}e=KHA>Z6{Yx8KtxJ(wbxMOAZK%&2PCl$` zw!+($*ODBWtC%a4flZw#BiM`2#kGQ@j^#AHG>d3rNL^XS z5=M(c!#MMqs{+~%|7$421A!E3o%%pB>H#gT6g*%Q&x>#_Z2*PAO_n8nooZP;^nfW! zlW{0)Cv9_WF??;#7!_LSM9L~*fW(qK5uq*b@QGzcb6d6)&8P#~4i0RB6zmuT*(>i9 zkt2vUc4R#Pzwc-{fxf@ipKF-a6eSpteZ}jM=>8%)!GgT^KJsrivVt|24fX+xKu`RY z^911I5e#$SV%`Bd!rG_U6RAws)f%yJ7mK?}6EN-dwt`4w_uEef9@}c2febqL*AkytFQRw0a;CpgWS1Mh{f5;EHt*foq|2#N95&lS=}}j z3skAc_9>-oX;&G!ri1s+sE5CfaFm?!;th6VF=4cgH&k{t0(75IP3gVM-ttpjY3YECB2}aYF7S9=?qzJ z&%6S6fIv?YUCr;RX0H6z1O{~4WHm>m{>j~^Em-DS#ljgYB=8TIXCKa5d0J8Da)2c3 z+{!<_Dpi^{?g+g+Ep?f>+_^k?B(NM$8N}tqb7tKk6|_8Ji!p&Nnm z4SrU2t3T1`;(e+k zyzryrgjW2-TbE?P#g8t#J#LSxEa8u>968KMraNl?-DW(5>0@~Ay|0f^^uHfgZSD(w z)P+3*QxUHvJ-Y5ux0D+qfRB9=We|JL-_3M&F{Y@$HM2|?r1JOG8Y2}9IZv(W49OtiFf~!yK(=i zmEJ-o9G_CPn8$}7Nsmf*U#ZX1ZbfG(G-LdW#kh{yw`UZLggE{&0HtXjm9;#LPDs7E z9D09;SmnY@9s(A4gePL|%TvXWXwwp#**May;Ay(dw_fhHp2${$Z@2$DsMOWJq^E%} zS$8ahwV9^>DMs^Q&^;g>a9E<%%qn4r(e=oar%2?J4*j3TzB(+5uYI5HlxA5#Lg|)n zrMr>tZV&;1rBh0TMH;0`y1N@e5a|XH=|;fcEWFqIiSPTzZ*{NxoaedEb86ANeT?yBjYYNtO>5Jk z<15Y>s*kp*xe=0^)#`|Bz^trRI#t3zQD+v?+hvB06>l=g*4o>g0&<+}KV6DgZse}} zbPyB8{>c-{jUun}h=OhLc(hXz(!{{KeN&7t#;7XK=cv3-XNtMvt-9fS-i22y^$I{k zJb(-fZv+(m7u=61U*6{&{F_6q2Pc<_%&5N$7UR2=Bx?G25QM_@q?0SS}}gc8=*So&a7X_hVK0U5jk~Tm3NHF zYBeD1#oxh?D`6}|YW6nUfhJKe4?YSu#trk0>@j9%j+pp(yCC?oA*nxQjCBYA71 zuL&mkR(*3JftU$*L^ICF2VErQcN_*mSF}L$1_c8OSQD8CEQ!8mYJx|TO$uxU@h1eVBM$#MLhT9u(ECYST z2Rv~0u8QP}NLDN5qi~Ez>M_>j&XBuoNfHSI%6pOo(V~`+Q-MvQw-Y6t2-_VNuh3%8 z!Lq+iqao@wUnw4y=#)Uz z|CBN5y-zNkw$-t1u65>7Jufb^^b*j@)V6kqT)(}RrpOyF`t)1%I;hE%Bagk<`h~{z zyK6_`yw8Q0Um5(glyb!8a$3r@U9a<-=B0Oxr*Q@R6k5BLX^;8NZXU@mt1YvAI;{|# zm&MOBbk$nG7H?bnM(DzJp)XLAw%2OuM9FYnV z^a8%xIHDAA>NUjx56rLg7&S-lDNVh{l25GF|E-$(kySaHM@hdIdc%)P4zZ7B0DqLq zR~OWD$I9bT(I4=^tT{6HEIXejWgD5?@77(D*682pDKbNqQ)YgprpGoz^~rJFXT7FB zMNGe0B)rcu_MEHWsXh5^0d|sJS;$x9xt(;jNhij9kH~Ynf&#k?;U$G8q@fnaxv()BIdcPD^;zb8paf z_;J`qNZpZ}X(4N5@N@4q_6XJv5xd7@2U1?i`fr809^D8aLzH{7z8*rX8Sm0##a>-j zV?h=!HR8muFTX~JQ5q1X9u|=0Nr9j^TKuiazb(Vfpj|s;H_a1j9I>v1e{yuH`Uk(m zSCjR3l^KW;4{IsoVo&qmzC9DLY$QN&X(Y(pc6-Y5YL=hK4PBiL{;tPMz(5&th_fHM zM~8z*n6NeA5#;9WMqUn?yZl_6*Vef>p+2=`>)=X)+_Ln|ti8UW26g#h&%v3+&b_`l zO+@r@g@uPLqb4ppbEx-HfY1sfC~rF~=9{~@ys5A2^N!s#U1J@-(i)sqVHNjiv6Um% z(>l*OZzgE-e40p%Mw9R!d@`9d7eT*?(|fI^kJXjE`kOm;wudRuM?$znkm>m^JKN;Z z3xQ#qVZsWL;f~|3%kPwDn2tRbYH4ps zFAJY{cPzURPtJlftt@i-OriNgxcCr`W&K4;2KH_vzUgVLnm6-0_1;3aCpxdaSmRzPjYfB+ITLE;j>#kxT`#?rs~>HV6I@`*JEyw-+g0_`}jJ zE|dIkbMIp5US8PTpeCmI(P*sNm(K{4@N>tJ@mzBF*VR{6Pjlll&G|k{jD)bIVtr-G z>00C{c|<%llByx#E>G0CqhVsSnEs(6LUzv%E2(bnr@&;bdn3r*^v*4-pWBfwPI}g3 z3nzZtS{g+Lrz0;{_*M3v3 zE!QQKjFXAQz20geeMAVW@N3gLp_P+sorYN^%3#ur+Sc?+v z@jAhAxF2m)OSHqY{dxGjCq`r&hHW9`=N=+JPV~dwZn)tV`zv z(|$D13Im_$1?JK-+hYIJa@CcKdi{0}C5kp>F3N&f89!xVHpujgXmg%K+>*SreMv>X zvGC~E{UcK~4QnB72gfsBB;2O7mxTD!G1POLo0V0RoUzrqHbtewO({BNtv*xY$T5%Y zU2SahRzIpHcvJH2H^;<4#F?ElpgQAC$-Jki-b&xMvL=^S98Y;rK+9{NPh>@}bc#`S zUVu^b$KK`4hZ`{}%4N(iqy%BeYB+XmyVierqk#LWl?YQM+@=KMpwwhtGP;a7EP3qg za!&8Ye?!xIPG7i5#@c%#Jf;G#z=1YZZ5>-y*|0>`Rpsc?BD2^9!tPQ*KK9Gus9qIQ zW6pNiegnDWLOo8gU<_BT z;FrnXMy496aZJV?@*dXY76xvTrn#|LoX_kgw%*14;2)?tv`1ixqdHGSF(KkwRkWEsBwE4x62Tl#l4!>qAEItX_AZ{w-9j?z6dq$Q zFQuY|DP+Q?l+=_Z2OnoODiFtX{J4fMe0|pyFJDrJpI1r_Ein!>y{BYkoQ9TqcpGon zd)7szENw*5vgcLY**Zd!4_;vIkq{b*X!PShlf2@x>&BK%Su(}Cu$T$MR%vRPa%@MNd}m)wxYT^}Y5MXUV`o?4&*Mu3tbDB~ z1+v$&R=cXz`r~|j1L-cMNGF2xh;FU%>GBI(h|-ncr|n!2Ja$?zAb36SIdd9*OT3An z_?irKzT!c|Uz?T}Nu}xrM@M-xnTN!_swcZ4ZVK}DEBP?7>oldDS6ea<@=AJV&BSSW zMf^o7&D2m|p@B=(E`*Wx%nJ{v!8QEiO#K2ngh<$BK&MhQIblW_Ar6P#vapv;C%WtHH zb3tDD!@B)DA$z0+;9y72NU%BKl#dTbX`e>5_Ml0aRF!%h`KNe6!md*6{+hxZzXc|W zkoi+A$eB)0!VU$dku22hxvEc+CtTBT%CnxzEY791w=D&&8WvvIIGn1UqpF{?gniDt z<`BnFPv83DS;o4ks$wcr`E}bnR znrtC75}*3dy^FD{i}FuBbblO8uh+tDNJ%&}^+6a%Be*b!ovp57KT*xU4X1iiz#9_G z^`v7s1~ke+rX(H9Gpv!tmf!93AqtzWp&MH}v*lQxQtaB+<+p2boloj>J6=#UKS*sG zGvP2RK7^Ecl{RaMKr}e&vYtXWrxU}*!X=J4`(yv@tbrL)`s99p=T|=8&XVJ)*SzN6 zmCi}Mb*`1_@TOn;c7C!iu}$<=w2DY8oSBh@c1hy0Li`FQAU`csGJBs|sf8{d*p@gO zinP<4Sbo(YHo&eNSpP&TG5)UT`?bMqlg2?3YipdfB%@^v1!U(pw8p!OWjVx3&bAJx zHEF&r$X;_hk1I2RGO1F!JOTc%`yyRyBmOOswlh5DQ-@0ED5G-|Wc+aqR_%7S& z?eUMRWK@cZI6tZee@?y$2gq+9HEkg8}*z@ zq50M3tFzLaF)HoS8A(W77xJE{ipF8nw?P)+0ZpDd9@7@S=Wr0K@gIjg-RWCaE0~#R zoGCx^^PY>vOe(;2cC>osr9p{SuHJsvwJ9Axzf`kRH9hRC)9vF=8o7x2Gm=cfIHbih z6ir}(w%-vf81t~)U?(Il8Mz5CV4BT6`D>Z)r9MeOIDlq+BDqQ;As@{~7RM>eK?yWmF{-u@}w1Zo>S%D=i< z4NPuZ%r+Y3dFDt|-t`>yHAJlsv0vR8UD_0nOxH$v z_?YWsj$mJ&3aAFAp=x^62GrkSan^BvQ8&Oo8Y^xW$eyj_SP()N5a@y)VauW@dqp0y z3qnR3N%y6~Rey7De!C*q&aQ`Ib+Vow3wBODI@WtUb!TMUt1C3o9AEpiRpIs*2)#r} zB&bb>yEQ57m2`#dxYlLH>0AUCJS zBF0^wF6bv$Q1jv}(Myw_4@F)V&Y?R-#>0@89=49p#=h=lYOiO0TsIoq#IDj+lrkV= zRmjJY%1>ehw-O`i>78v`^V49t%4~Nl57=+6Nn0Fmy0^{D%g60)@t}Y1rcv<&jX2s6 zTyPkedDpp1+u&oe@8^R{b{L_$bS;5!R?K>fZM^G`DgES4+w5}O3EXv~eQ&;u4KYF- zyQzfhzg+eCmPt{F{?OHZwj{2g5$)yrn1XKEtbz$~s`jTq$#ieBJA=;tl_p47gzScN zW(bc&aFvyrN~Hik>-8%ei9=DQeeY}OxycfPPpTx!s!N?)9$r0iFMT&8$!3Rb%a(iu z!;v|+y;C=a%{gm~juaCrESu}9MuFe(6I&TZBcI;sjp)zV$W~(7Mmst=PY{K-Y2^;$ zht1Ew8ouCGzcb3UVOx39gBvyffp&@K$7ia7QoBPBG&wWUgr&3r5!e{L(a;0 zKV)WaNiI)@EW`yX_|d%FI0xQD_`{c7#b0r&QRjFNkzbZ^YxD~7cmjLdlF;2Kgx31( zQw+{`Jn#=j5v+Azc3erluH?v29$zvs`?ZhAcRo&uqTXH1c3Z$^ zIsKZx>{Ao)8hZ0~&}KjInt3(`1cKU%EApw_>CT`&ZYh}j7mU^VbGrJ*uwVT3havuS-pOX5N1=1$U4aNlw|V>>xtI`$UuP zGTA9Qz21-Xx@)VK>(x+;x6;Qcyc?)_qaCG~0VUWi2)Mq^#C~wv)4CQl{*RN~6{8n(fKlP)uiN`>*xKX_&T}t=yDEvv#Zop5~m95rW z->c8Hah4x>v5E5JDzeXnF?PUQOCq#k`o^MJPxHkCcZJQt1=OTjnO)?k>Y%G^6iLC(oKSi@O|;CiQnXub@y z(wBzC4+k>Ve%UQ?K0-Bro4h)j&KtzZ9(Ub zSw$R`s$2Xa%$ryCK>-nL5c!=DVv}IT)&Auwk8*|#W_iX{RP#U%PQtF!aPxN-GW>F8 zLkDf&JFoTK;C+N&JaRL$#PX)>owgtg!`)Xo?vYeRI_jG6HGMK8h}rF{U}JhbFOIoY z{d8OMX`<8t;oAn3iMA^#49EaO^_si1I?1Uw?RI4{KmQ^3YqW?Lz7Ty=MUO(q9Hr%< zgua0KqCs}%kz=075#hP?-gU#J0`K>h-+V3T$U4X0(rJhyzLSl6gATc?oNy~ql^tQ{ zE9>A6=JaD&9_A_Rr*W16`@LA647g$}(L*@aAoDlFy*A$!5Y5mS9gp}CBZ816n_u&~ z_OfNqgC~ESo?+*fj}XFwyU|5>*L6Up%am34;u0Cp=XW03Wuvh*oImd4OtnMKpmw}u zC_#1!4WyektKnm6{9^Kl7>Ui(SF!wvTu;4tCuhX3Ez6(Pe0Q5(pZs|qt1Ne<9W;X% zbp7>JdZ3rzk0APtlI9;{)OF3FteHtPqWtxRd94%8kF=wD1oLhn!wH><{jKuC>>Y$U zrYj;1$C}k3p502=&hdM?_KGV<=1$-B-fdj%l+En7AXnM zx&8zejQUxBvvNgq@Y9#IYN=B)&Rk>hh6oqA{jQlt7=KPgaBW8S<{K(;>AoJeY7NRa z@h2>OS?HJ5DDtLY2%(u%WG7izy5h}CR1Qhm@i1Z=+#*iULIsmS8HSoYu~!bfC4%le zDBqv;cpO26ANwgfcC_k8{9Sh3A|dc@tvGiwQrGmsk_q`z*vAvoXCAt#*8&6)Vnl}> zBhR*7Q57S(7&*!8Q6%MuS)bhO_b3+jh&D_Jc~ysf!+UNw3wevfaz(FE`sCDU#pP?q zPl9S^(PQnL*vw60=eQ5-i{Ej23qKQ-Vat}qq%`F48(795?-nHBbRa+)B~G}~jkjieB} z^%Tp8uS1jfH{6EARL@zS-lYn{3v{R++5h@zRA=HWyui*mk#js_lM>AHHWvSBd3T&J z{uamnOo-XxKvq#%Du!aeec@ z_4|Ks`%OmDo8EH0kw|&BJjcayTWfT!r8YTi@WW5)lE}aChF&aP{4G{$@b%yyBb&9v ztRMBbujxczVwXubvegxZ?xjV0-%_*aSv0m}y18GjtUwZpBRKKMx4GJ59M3^&+P%cJ z6@Dyyg(wOLzDs*A48aas9V{y4s|m$sw@#hI#al)Rcb;{j+Jt)OtxXvU_6;IY91vBy;^3zio!#IYZskufT(;?-Yg3a_usvoVa5Xk7^QK6Kz3CyIbL(ny3bI zU4cia7cX#LUsB7;D?Z7b2&}&lz1W*yyjW_(UCOhi?52Mc)wgD@x%F=42hWw297fAs zwPrs{?w2Au%yS_DC5nSbrkT_+oX01rS|>yA3AQ2hLudR8)#4M1QecnCz4QdPB65P{ zfwQlL8hDe|-@8Au{!q>0QH#Cqs1@oy?s=1OS|gs$hUU0o`7zdXS2p_4k)wRZ{@F`; z+ZycL;NJzvmg^zTb06^?F7)13<6}yfP<;2Ruio?*6q4Muf>-G5+WEZ`xmRy28@`Lp ze7E--(kreX3l1ydrJMTlL;jq{;<+IEhAP$0t1CNwaKp4`e*MN+z&Eo( zb6cPKMA@StjY%VoXC_M_AKE)whpWSLk~CDN2x(PsJQ-fIsy|b^5S3b-su}2$`=eXH5_A`JoH1a#-ct2)bMN zWosPqW~mlQ@OD`7)lDbJTxD~iZRBHubhl=m8L_ioQvT2k=>6=sp;^dTg&t)tl|iGl zbU}mq=-WVvr_6*SLE0sTBWBa1Sy!BT@LA_%NcpwW8M~;v7=GVV+WfiQfG)az%^Vyv_~n2V4UXsZ z6CPr~8!qMFPW+j1Hu$vp=#mF(ilfdgu9q)~$){vKCMN%V-ml^!qob1c@3$(BwIf3j z5Tk)woe_zbM@47vRt1Ngh(0OZ{v^XpirKut6!qtMzYsHAQgL_Olaj|h zLoxf9!&#UEBc7d(Wpa4f8!9N59IXawd)Y#*?l#O}&DdY#Vxqgy?DMvO+Uni$x89mh zK7k?5W+XquAwk*(%Z; zF>IvMh)g)Kl4p3b`UbDQh9vuah6CyiF^jyA!sf5SkFQZ}#9O~bV7@Ns=n|D%7hPsSY`WOzL<8Ddj7%$PA(TXy{w8tX^$(BXlIia@25|+ws zNKLB1lXEE^#&)6VcshYUP1gRr8WPd}##u_RHfO9B4(fV^JM(&~t(ADJ9Q)~tfEv|! z%n=k+c=GnZQ(pj$ejg0%i;9Ts^Zl+N))H@GhYSky-h4GpQPRU5JSAe*k#e^(>tog38i1OP|YD!y|bECPI$eJ+0Ziy)Ubc0)pUC>cRcp{zluYi$6 z%@S)3u%cY>wEfs@yY}O0=GG?fJX^?CeN^A83YFY+!ePbfzPHNxw8rAkUiV|&)Q&cE zkoYqZoDxSEO0kd%#wI%*wjeFCF~vjJ}GvSm*l4P{#-3Bd!dc*W#2tWr-P311o-j7i6?wuf@p?23HqK9M2{ByFUD5VXS*M>e_!|h1Lj*W%kLYVh z3x@o+pbj`o1Ub) z(XZFJi4Qe9g1Aeju#uok*eazTZQdr#)mkAy4tu@5bi|3-h;z-?SeAkr8sh0 z=z<<~WC(j3@T*01GGZDY(!%fcGtPO9^^TFBjS6K8Ht2iWL}?svRj|~9vP*3}3w|jT zDHn_iZGklc318L<(6bn0d=HEmg>NRHKlozFxMIB_5Kd^$H4D$bKuK1Fd}i9V_B2B| z`--5A9%SzH6rxeV<&-^CkJQ2#BUjJ$)FRLW9yNm0&H=SW7V{+O*KrvZp#pMe30Blq zZv6(0`s1?PtEh3BH_J$bN&|e(N7!gVUd{OkY;qcVD-%37G$l2&~ErVC<>p&6Blo>?x+fw#B8vJRzUiIM=_le7vSrM(SK;leu+)! zWoBE^F9K7DBj62v&^nG^i$tq^sYCZ%N-rJ9nQ=f3iNPJu@V&h`H&bGS)AZiEA{{2Q zBEqxeNAFebB}W-iy`qhg?b5V>*VN7G$md`M(q`jyP~z2p21}rIlCdF*A^Q77s~{1g ziaT6$<#g-w3Vqfsv zz(1%@^DGwgGTm3G+x}yzb0pjx%$Yavz2K0U=W>wr5I62L^vIq6k^fQKUbMrE$+GM6 z@~yhnPl)sE-J_E=UeUmr#N?=cVej!pSk(T1n-O9e&ei`-K@J~Vx6D3 z%R4rZU2gZ!5R2}t(e|570?0M-SCwQ8eg77biyuPIKPwrxlU(Tt|^X^OH8-+!a(eLLr2ks@$~~*)%SXZPtv5eJ+cSKiSWe zGagW1vISAm1aKLt-H{tUdXj+u9ghJH<=Z;lRO+R*A#1GBIPVCPd`Y{kXtfb$>Pu6L zRogaNJTpyf8D}Tm)knLCV$Ek7d1UlULD@v`{tyGrS?V@+`p5A^&#N8K4!eyNb$mod zN=_g1M^VR62bp79Gx1WdLBd(dMf8T^sQ3^ZPkI=zud@LGaal#rl!UXrSO|Mf!v!r`ge zqx)EyG$+i00Y*~`SW1Xn9kq*H`+Lc^dwV=rm3MrSfyDHZrJwMFkoD?QtLQGs24k}M z6TwciIdc?CMh&Pdlr;jr61}U;V5xX_3}!{)=Xh_()n9dI1ieAqS8KrS7D2gCYlsoH z#_N>P3a|M7MTf_C`%5?^`;rlfDhbR+fjCC%h1@xV-xBCLK7>O~b%!s){&ANph#Acv zA-f0f2bv_>96l1hNu4^O1VSfRH$TdxW4{9)BSY7>2=obc;#t%R2RXaV`yqIbK{N+6 zLW++(F5YkOv8YKyTxFi8A(fKzum>r-J?Hl?!F@|I)?S6#9YU%QByx?;+P87x5YZOrnm4_}34@?Br1y185)#vxzMqpq zw@7KsR>V+G^P(fSS2FQD66c!7A{fKAYTQ!WK{d6(4TP%JpRjbV6rw5*H}Il{3&sQL;DGdz<@!QN&HKO)q5#!Z&VvmRe7~8 z38NEB& zX49`rl7+(^4;^Od$bOP75$aD^NbS}VuJxKA=PcDzA_-JO?)nfgf5S#Nf`j z*-4D4@*cBL17oWx;CFhMrksV#Yj?HRi7T1kWP29n@$x;<=#aP&fH!s%TQDs+9g3rp z_26(tfGy%7wkwCoosWYXe+b2NG9sCyN$*MgdPn`u64&emHDZ)v(OKL^9Nny2`oJ|u&V5U&AO3cU^JMy*W zB3JQ@-4^7|NHEa($ox))&b-n>P%u-uuX^wWKgE#r@sX@(R_v3>SsuEv4Yv=z4Vbb+ z`2<%UbP%e+t)_Q_<*K}3g|I&EqjK3NA9j9WSerGnWphsvsf08O(yktP(UHVG5j@$^ zWdKEQb2T1%S?fGWkI4HpE6W4g`-$=Nk>QcAa7NrV&5;+&`++_)QwC;|QOU}kv7;As zSqgD+h(cypzE4#tcBANM8eh<5jyyfCbfF<3LnVjMbo{h6IeUR!veOEGiqn|(%Sgv_ z9IiQT+M2Izf?EudxV$@bu-7D z*GU-OI9ToHBnolkf-sHfCieV7Y<>-H3Fp)@yK$3K%z5p_eYSR*_r3mRoWg5$n##!Q zV5uZ>+@R$=G;-f~wrVx!$KkFF<-&1)9N5_#;&ixZJ~qGhr_@>L+8Vdb!~WEK{AOmG zMC^CkpA$ZatK0t9al&`b~w}Vi~pZSZyZXJUDwydiq;K7b+u|Eeg+10$3n}bw|(;@YxTarb`N}emrpxnX{t`q)ZNcF+C_$Pjlo?zL+dW>tx9Ij z5I#`N@o+cO=hcM3gd>@9DgTQTT*lk**1Vw6u&z}D-h_ePevFgZO1rkWQ7cMH0tc$JL3Y9r28n=YwnAHOWan?F zxENaloHC|cGylZbO3PeZZ=)W@KrgFKAP87nSHi8K8OAgFNG#J@ZQh16^!T*T`l6;+ z8RAqkTv||8MHiSW(?{P9&VGc$t;F|4T5;mVV)MP75EVqMjN60fGa^a)(=c?zK=Tx` zJ^D4*#`WsCFpTW*11)FuUr&D2yP@dfvxM|n*f|Xi=q$#OyuU2`gDkLy2|X+ zu}54VTaLB}j4mGG1aEE1>w(MhG*}yOCPZI!2GI^((DuYw)=OOf&2sC(W*uqQg`0n@Y-W-&w7}l=RO$oDDEEvOFSHvEj5sQxx1gq9Lg877 z{fxg@z~5Sdb!>u#_ zraP*?i*?oWo8kV3DJt;<;EFQAYlpiR;{sni;ENA@AJw}T6J!9AKH>P21oilngw>V+ zx0jEosTIJ0Gotw_01XO>w_z$>FP4Z&`2aK|BKaW)ptLbb8BG4>)SbkL5GHrSRy~Py z;04J17{Ehw;7NJwlOsrOy#U60cv2Jw0Mi&r$$(bW*J_Yn$N*TDM*8etT*+H4UW5Zs zw7On{c509^*OOP0io$fPUiOfB!jy!*ERlM^go>oLNfTj0Mzg<2e<;AJ{47~)6GaRM zr^yEg%~l~}uD|9dOCbgri7I5BFby9qGcrvD0E^4Wq+uF8M_pveFfF5q1u_IS0HZO; zqhLH@F!=(^e!@$>P72_R3b_w5OhJfphcwn14^Y7hhyLLuXRVLcBKL!7C!t%Bm%_B9 z>fFfrU>a8YugJ+^i0(~pWdoqgD!DeS&;9722@rrE=s{Aja?8&^aWI~<0EhwBl@w8s z2TW86+X|!(lQc4M1y#VrhVXqsp0M~45g=8V*3)bhNDYR}F(7!@(6DBM(qM50KY=!2 zamtH88C(D=E`a7>;#^OEfjnUG(l0=YFfFJZ5(;y40F@q7Oku-1Ch%(B49W`3mJc)_ z2?NjpL!iX2*JG#n$O^D-4JZg;Qb+i96xp!htO}rzhE2d#1VtZA!K)*RA|KWo>lg}c zSS#B;P;kInbC6E)0VX^anM1L|f&R^3LSSd;)uoylpVeAa{ri3NtV!%acutaDwcnKYru*?R3A%Z3N>cCJ$SmH|~SQ#0X zpl%1F!lS|3J*Yv~0%h+2^Fqum`78wl%(%ID1gv;?&AH7iEKM!>xGbKTaq)6nnRBqY zxI0>yyEwjEjGE`b3q8Q}3-6qXq}z^j{B~5uINlvc(5JTg32ZG-4AY`a2s4Wl!8P$Jks z$w_*aG9Nt$z308V)5Q+uU3tD|=XJOzpE#JH`w`sP%MOXRp@^vZEm!-eHbmkH{HeXW zD~1CN@r}HVZv8k$2Jt5yqQAu$Goo?kn(!;zeLS760*jS!2 zU~zrRrifskEvyOrM6BP+X*Sj3<=};iXYa-YbnV{EZ_VlHxGpz+`!Sqj8sr?(W8~kI z&e{1wF@~M|w=YXbN_3F%bV%l5+3Pk8%g%7?M{lueVo4sAXj3f@L6k0#ZIQ&-_;}2Z zBEDPjlF(jGk^K}dXYt&~BkQc22bHz0&W~k$DbK%Z%Ul{IsY+$D;?G$ATzkyckh)S( zm$ZxM;8|fpaQ^s?jNrmHA*EREzQ%XO{nxIM1+22oW39)S? zFiQ2^L*@fq^xac5`|qLh0dNNHbM_A~@Bs9KU_+pI@B^$qfY=b&3^0Ct0OaBOoXrCa zKLFdvy)j_~Yz{Eb9^mEZeXeyB3~0SU*~ac6>jCh_!N3&(>iGZ*4!#dS4&z)IGRAz|0i*CBWpIzK7@s*qjCfD=Ad@ z+db4j0QC&m0x*U?z|RLz`3}|tjKvRtJbRxrnZ2*C{Q)TF?sI-~_rC8Bz&(GTi=79n z0mWAyfNSAC7qS4>hZ!G0c=0}$vItfOjJppYx^$mQSOO~n#^ncKUB1t~Sq3Wu#-Rrw zTe;8KtlUp{=L3+h-sjv`!5RRw{{cX2_c`aa`*|OE0LJzET-f@3Bi0^3bmKmkx&bx@ zieEo~-sXL-Y4iRV1Z~}e?*lAu-5)kW+xPI{0WP-hhd}+uJ(N8F+Ri=2>H&Hlfad4D zG2j7~9zb~aej2kM0O{9#&gR$sG#q+xRPEsY%#1t$VmKA!LKDu2K+vpW zTomZw0T`PaIDzNj#}qs*;o*KgLx!XNt0<7dnk0DO;~#Ef$^7<345Z2t)Q1{!||2IL%};{YE~r;r#{1q+n?2n^f@ zK$(vKquA1ajGllI*2K-XAj~f~IQD-;(Ez%O8p3Q=$VQzZj9$AH_We{d?Gt0!Q7pi$(f zK-Gn5qz_$MNh3wY`R80iU0{r*ioY00(Av|7L27jqw_qj*0>6O!*N|)WkV0317n8AB zI5_+>9-cz{7i3#TKr+@BxS9LsL=8j5&h975{|u;8eET5=bnxtcl;&W@sbBwT2=xUR z_$%HXDbl~&%XtpaTKUNydUQ|oJO=}ElF$g4CsyU}p3w)-GR&iD_Lm2^QG^O#0LHws zzl@mBh>QD{e1Lg=b^YD533y<~4b@lSq|dOMIX5^s-hT{v@B$fB;tEWgde%P~FB=!? za0LeL9HBl}K$uCD|2nYP|Ht|K*Uk06Ln>+gRT4^eecx=RYak?&)qfqRP=^PHAIwqd z_BTiSgX0U#vGeLL2fLT!|2Z)D&sfQy*Z>`R4-ZHCkA5L}!%A|&j%gV*Na>0r{<}xP5r5||0eqnG2e3#}QGa=0J(BwaOxKebXvZHg)Bie!m8x|*HGudb z$Z&AX{}?p}X!{>9py3Mr4GYop={^LMa1e|Ko4mxK91mqKpgU-ZE4;~?bU6dEWe`~yceCh-)D8i=p_@52NNO@OE5 zhMh;OB?O;o(c$1!AN`xN0W8Iclpv_e4Hy-Qj6jJ8qZjY}`tTkb4i4Vn-*nl>|DhvL zlE9dM?dag(p8VBEAO&WJF)5(R>=angGGLr2%Af&=l-#f}rI!nD3xkJ)a{vyDf1X&U&n8m=DASkdMB!TAthpuO|zp?@Z z_CWeKz460;>A=PtN{S40_hCc=vBCRa9UnTY*A}3k%-~a}VM}IZ-KT|JOAb!+x=! z5g3URci^t$Z{q+5Hw5KCrR1iD?O#91b3tx_1q*gXfL$2=`aENVMW%u(83D54pHUy` z>_7$T^izNE09$IHf7(zG8h~U*|E1$W^@hRNuxZmK2ki?`0x^M0@IRZN=M1BRpcTnr zG-y5AL-YYypy`;udC<`xJmlzrCm{L19!#haIwfq|4|RZfOtK$5c>w*sTh!5d6~@34 zPy;Lh6o2&zNO9FYP!Ap=Cu0D`hZ`Sk0vHdq$pc12P&*jP*$yUz`e9IF{k7Lmz@Q{X lr0W1f1v|jZBLAP8epLlzKocAeZWQ=eCkqFs)CC4|{}1~8@3;T} diff --git a/binaries/Tizen.NET.Private.4.0.0-preview1-00050.nupkg b/binaries/Tizen.NET.Private.4.0.0-preview1-00051.nupkg similarity index 97% rename from binaries/Tizen.NET.Private.4.0.0-preview1-00050.nupkg rename to binaries/Tizen.NET.Private.4.0.0-preview1-00051.nupkg index f01cb2a8f52fcc92b9a899d2616896c41cfee177..a8b93ae94c7eb98d0f40ee5851fe06aad47d42c4 100644 GIT binary patch delta 33709 zcmY(I18`qY)b|@FjcwbuZQHi(+{U(@#%OFeHhwXhq>b4)Y5cbTcb=K&nc4a7XU?88 z_nzHZ+`F66UQ5wlXe#m$kQkpneS-buYe_5Wu;^jj?&r;!2~-5`^`md)A##PDHoy8`Q@dTG|zRK z^KNmV1a6b-cX_$@-~}2i76G)Qfx~#WfvdDJ7WKIi`oiFhI8F`&ewQ{fk3Gq~?nq*- z5=j?Ol|&f8j%})xnGRL*tt>*nmV_!!ipWX^qP*n&lY9ZO^bOkGBsz+J0uiK?vfKAD zv}ZUy((b;3>S~C%W8)!S39YcZ;sHT2Pm<1yYBRJ|Na{IV}&%jqcbUrswpxPc!4`2X!5Z050(R8=r$ zAoQv;<2)%ttp!PbP22=dzDW>Ul4w)TQg(UVYlHig{Z8c={vMNze`6^PG645uNBD!K zq`yDtHa5~I6;*)Fo=aCYHttJun^yUjg}BX4;=1Jh1ERNB5GG?%6#fqjL)hQw<~01r zPzy$~&LFN}xy@#3E-w>nN!_L<6DtuIAVtU|f5a;6iYTN~5=9=sa`8xehl zIM#{kl2Xhol4!{9QC!Jd3ck({sF0<0i=No9Q|LUNQ^7EbnFlKK>RXrU*lu|XCu+Yv z$r|x6cDCFRu1DrLm~YG|kadDV3X9FG3%}fGt)DjD+;x2QgZ$q^8>$G=t_T5kRSWLq z+b-M)*3SJ8{v3k^GW`Q@Z16RTf1oM=?#cNN#$CZnF#dsK1b8pzKVZlM4?zD1)%D;5 zj{h|gLWHUQgIgzvhX0z%LLh7f{#j7^Ax_x;!OIQAA^$(vV}jK9&xcnG5)hQP$vK7iWvfhLiI0zx)N&sKg&}uRHo2>k&?u+E4So- zBTX`ur4WeQdtaf@{_8ss3A7F3zaV}l=z)fR@V*Tl#{3V$kYKn-{y`5D3?J)1_+t#i z=K}XHXNE7ecDRy*}d-O_^^0Q0PLPcqQIuCi&5ISU^ zU>))-^!A2P%gqi<$XlU@=Ot6 z_A35T%)s*b8UdaOK=RRoVF}zOeZizZ|NYfWw{h;$epp~rDzGAfFP)@w;?IX!Va0N6 zNaKRlN;(D^cUeU?_Ypj9lVUh*Lq7CRKU|WoNCVP`{+FZYxDV)R`xh{t8&<^%kL1(I z?;6W1==!a-)=VO9RnU7XMEc50e6C6C1P_B~+5nmvqF4Dg04DQ!(EuX5a5kWLTeOsl z^P_b-xr!0n;*in6XR|6}(#RvfM5$?}Yn#FBh&oehF#LzH%=w-;Jm0fX4C_|}S1d5f|K`Tg8Sw=P_(oZ~6fd%oU?`A2K`|Yr zt8C72Q}s|Ka5|a%j>oV_IuL}<@XAH8=8X5kNVVo1x-J|l{>l~hBp&k0)w}a2S~Lis zVB1;T?^a(nX$ShluOIP=_$`Be@#{d)6lM@U-Z?k^3nSN>bLV;C50rjH%lCPbeodwt zf5vg=&R=g_E!_RSA+H%PXK!40z+J9=IR^7nzvi{RNN8WoO# z$u9ISo|IP)5ka1x`&Z;w_nSX%5c`!f`)Eyqf`4lhM4BC9vlUjhOT>xO-o|DrFYznH zL9}lIMVHJ4&e{fe98^!g#!A2Apigk+-e>5pS=DU25s98!Q>?j0$M3Vg!X%h>u|_=g z2O+=*ZQ&rD(0@~Eqg+oRQ!1q}lQkR0l8aHBE2iKjqZKt-Qq0f-h$QCQb&AiOe=Esx+A`MauPWO5wf+ z++c;gECnf&0<|eae0h5&9jMCpZU)jUKp3j>;=%U>i+36F0=fP11haPV(EPQY_!jPCsxR39 z4@}#HU^ki(bcIuZ;~3!7Qgt>z$CW7!#{W#a+Kv+cV3;u62c=wEZBM3kC8#*&l3{(5!!^I9Ev`*o`Qd%+y2Avr?gVE>He~7Yf`3t<-E! zi24b`w<#O0W_oZ!o!~i~DX!j;7*06~dfby6&WLvXKG)P%OseDeG{l(R2jtW(bEp>k z*eLAuln zYxjNDcO53(4w=;sa9U!D9^Qx@x-%XB5G5|p)zXM;G&8kG!kh}jJi*^@xbAoZQwIbX zsh_RYXTVEfzd>YT%r6t)U-jBFTyFWb|MrLl!xnOT}r(LBj(nyvZJF z@{iE6BeqrnS{eTZ(X{2ZL`LHdNykj%fa7c#m+}!;RVn|N4f~i)DpkUng59l*hDvTp z@jX}lh{2(t;KsN4O^Oor$oRvhWwDs;7$h}~U-Ot-iJjBJr!m7z%VR(0GXcu`MpJs( zox}u^KzVbIz(g}9_rfaXsriaQlstZ=4Q7G|QRhsp4R%MD!{`Muf2z^FZC7p31*y8| zN=nt=BO~8yCp_S_Hz)sx{h1N%y9pnRJ+?CO8+F77ZG1cObB7PjVN8wGN3yRmmh{G$ z+H$~-D~GiE%vV~q(0zxUFMv)cYbLI`xxb8$KU>gZ>a~mVXsjUa$LT~C=4z;`mhxyD zQJgy`67;G-&LC^wSfdU`C6|{#V&@DFxjFLha@)FshP|@!-~Fg#c7jADjyYXksYJ%7 zUG6pn&K0f%ztZ+(%+rF+(<;y8?+b#@y~#DPi8=@(s|;jO5`Pt!oB+@0Jq0f-B~&|$ zGF(3wEH^`rtR$zm|M)QQgjviJG?o@JW{mpjrO^~>ttw7Lv>vimfxsnsJ~G=HRazQX z49*b@iyJA6S#5{ePM^(tb6V;mWy4eh43RI+g5>-|tLp?aBSek|=4W-3*VI%94MYM* zokRs@(px!nI?{F`hX71;T^*7ge*ka*_kKq&L(|^b?`n9U#*8Dm<)O@ zMI9SeyV{;~SgR}AZe=&)yV^9C9?m?s6uW+NdP?F2DzrRYBZ~$GkQ)%cP!*T=c9nCq zoFb?ix^KyY3G%BV9|wmp2Y%6~roeTyZG&Ak^cY2BbW|*b&;k-&HpCfwOWG|S3E4Oz zSH0V-nCWQa`jW?|Uo)$mjZ!p?C6k0!^UIrlm;PKNrr(sE?Bh-s%(ciKD|Pm32sG*` zTQ~I1(sP_JZNVaEXP07a;iACT^Iv}QS3iRIY8bm}Id&Z57T*Y4OPTx;3xL|i`?@FzU}cxpM?p7v)- z_oyGEd*k}X{jiBx`W#e3{0u=@h^#o0n}Q?TbM}nHUa}K`_zik*Z}Z|OKY#e`%sKbBnGYUD#m!xD#6In`jqx$)*9AveBvTD`Unuc>?s4XH+8Ebuo7jCv#B zV@uN`j-8nX_HdP!q<1fbj-8>f*3XG7M#k)!2{CRGoMlWMS`Ow-S$1bm+}-@7KhYv> zRm^ZoKjD&BfLZs|k650S_T(RXkWK}E3%&TUExe>u<=#f1ywd6Nv##ycRnE+yE>#6()+NKe(C#NH(O=}jb8bNaeum*sl_mrYV4yfLVG2mN@7+(O-M1b ze=totw)bv1y&UMiX9 z%p-HjfpjeGxCVKz(}pUZ4Q8?T6p}W23S`usA4_~RgWuR}Vn>`3g2vkvtst>sw0(IA z&5Sn=e{GX6hhFDCBiVm*v!r#nHkb-`k6=1?x5wkD;Z}#(YM;+^BbSziE4m( z+R_syde3fIT5M}@t@>4A*^?_?u9(>ih3nFed~u`Gh9Mz7i)?k#AS>!I5)Xcq*RA&; zfs6N8$aKiGKv)KuCbuSZc4ftWqDjC3u*>Bi0ATwU;TW1(X|klMC1Fq2<=V z@4xAX>n?cb)GFB!V(oQfV}3SlTT0O|cEa))kBwcAk)jl00QqI?-x4|}2mw@Bo2vS8 z&dM2I1&Worzd>y_Tc0s3%SIZUmMh|%wRCEkiiX*9W*fw%Qj;xvw!2y(I9iu%&z_zq zc@=ziq^`u|L#=OYajz$M7?VV>tAnYEn7L2dzoZgM`1QQSMpQ75t2`bk75de!_CEbk zB~DnxABQQ%deNraOBY2Mu?N6uh@!cvFI#U;fRH#Nh|FhD_o6Y9AWh8_X zTN@V)i%?>ttpXBnidyPS7%vVq@L1CGV5mHHc2f>iEoY9Nf-zsd|GdB#!ps_wPMXuD z%$?2-+-=FeTk$KEssZ1xlt^=UlKEt$HwKECB$ne!mN#=f% z9tAjQ9aCb9cS#mn*EhrQlt*Ow%S8)5Ix(dOj|=y%i#geT;d=H0>^W=(*OuJ9V;L0! zLU?Rx=?-a)ec`c<64@r{)DCG0PkP#f1lYaAV^T@~)gS6? z+V=o+3Qc$_hg`sV=sooQyUg6!b9DDOQ~++P|Fx2H1$*|HnA!g0nsg`TY9x)j3)fSG zm#ZVZ_0#vHQ@|dFpy%dHe_P({n+8thj-i5K6%t>o5d#BC$}yAD*zVvp?#LwN0zsQK zO8E)LHaAlF^}9mcRrJ!j)P7sA&s-Ha68Ia1UA_;u2H^u4C#SJSqrWgZ1hn}XQ+*ZlqKM*Rf&64!EPk#qe?}kIF&$lYor|d6E&)z@AipH;U=t!Hg5FN zAraK8?zYqdhCsRWi#-rXpvjw1#ah)^<%%aLE3cO7P)BTYue@L|X4^%%5vJr%(XC*U zfR$4MgqaZ;^XGd%If;LEr7B8I#aP9P`BX8}_bJgR=S=N?^$0Q0X7_uAlKu!GXD*dgcCY>g^zJo#g-n8 z7PCjR1Ij9wFE#_eDfNh$mo|GPd@s5bXizZ2za?E4+A}1fk0`j9y-L#&oY4h1#Cu8( zKP#}WSic*5yUjlTW$^Y1OY}+~g0Hi~tunYXpf?y@Ydf=99`OuYmG3JTa0ix7jp4;zO+i#l_6$IZU`z7xxs5bB5 zihg0ZB;|Iliy0h}8L(#2&#R@9yHxE-kxQ1S7K3a+RI`{)?5tuf>vdL4@?VC{9A*`5 zTXNRF&?XqIBNE!@7B*0hYk|cie1%mgIQcvfyy)`R*kS&U{1y1=uhsvW^fCBhNpa|dMpD-%M zpE%fUgm^~+QqU{v8`Oj>PpPLlVi&`!sK~{$V$m-oPCdlyvz+!b!)@fb=31*VfKIHj z)JU5r9Mj+}`Ia6L4(CTSMq-kjc7OE!QhAHCO69K2aH_AOOBkGCr9dj{y-ytYN@sa= zC)Ze>y?c;T9pN`nxTC%u!{BVs&)7U6+HI`V-TG(V*dS&S=|o?UP-IsPbG8HaO>%jF z-4$O#$m vn12F^O%fmh0HoBFhmvl9no*ChjD1P{*b-jZN1Ogis<6y#7|(FHKE~K zDE4a3Pj!Zu`cG%bhmCnwxKkcPsUEyyxN&TEsC?pS@O>XWKd*TtiIJ~SfJ(8srpJZm zHL=MXFctckYtN$-WkQZi>0=I8o!D!`4C_u?OLg`Qzf7_RQ9poJxnM2`kQ3G-70NFH z-{JtsDv#T0~CJl4Iyc3{1oZuRr+IlxxmB{7J_ zZ`g{5<5Jib9YbmYyUn8Rj6vw4)2*^9#=w)2HFPJrA#3L*AqmZ!-F`f z7pNeE{DABB#Lr46FStmGQT)Q)^m1~7x#|}GvrB-dPLW_)*zn^=VI@$YN_>g9jBOY9=qv;u6Hcv|7^NqPz+rLZ4R6g+t5EWgCmNE+<#ur*t zo66%!zfHc(k11ssHvO?TL_`Ggp2{|J++uALMPvvACqyU_9}li;11F;5eOr)z4*MP0t@PH7P!%DI>l2UTB#_YE2y4#uQ!E_j1e?? zoW*;XEo-HTq)r33wn)P}D2$lSEm=4q|i*y|rE(h7!tAP1$pwS-`N;_HBlG?r9e)#)kE6!MA3q2Mbe!Z+krRD%Y?D z?LSoJzVzlln<2`|KI|>HSx1hwHWdv@4Q(ai>ub7{)o8k zcM2ql59IGIvxmfzFA1+UYBMvJ=8s07p4;ara-EY2r<%kWny^zG8b2`X91T?L_xrIM zg23{{L$({dv2Ns*W_$*oh}fUk+kX1hM)VjGm-QPSHFp7&>n8H_#I!=ff3VIr7>$Ws z(i;Ik%y$Zz_It9Xsg-ttXyF66!w34g+;ilAl*Eu}eyHc+H+ey~>a`c7RCah1CWrfkcZc}lG0rJ*(GV&X&cy~n1MTI$ zk+CH|I0~>OM(92u8#RBeoM@ESl?{7RLOlg#Dj&mO5r*@24H(4Reqt`R3yOD;c5u(d zyj?ep6Iulw9K~ja9K%pi2`ihPq6)TlM11qi$%@?EjT7{^Y4*Vq55`M>R}7=H{`{d- zl^>lsdkljMhzYnJI(+(rw)l9RlBAA*)!M@SBD;&S{guz&)X``jZLQJUV;xIG`bg+I4^0je^A7ES$6E2qi9cx%(*OhH+}<2oI^g`dp-_a_ zU5GMZtiRq7+nO$;U**PO_xGST^n&zW3c@Ra&I1!OpkL~BbsxyRgLL#j{tUfnXuEnq zJro^4*UDPaaG8O?FR;z*-9T7yDSt<-z|G#PtHKn>9Dm$ut5MTj%DxHKtyVwf{r%Qf zLixg<@aB^Ce0mfMvv@IkR$C~>Ww2J}!o`@&_4O@EXpbUiBB#P_>%DXMWQYqGtBo^* zXLfl5+8E##_6mnzk0vP4v6b(<#rc}mO?@Z2zE-&uIc%x$6X1!x>e8e_mWdZkD~G5* ztJbcnM}5fBg0P{ztSUkmJKM+MHrJ~8*`oRml*Z?Q;VkACX|INJj%cDB1+M^@iE=fDTe_RDbW!`ucNa`3mTb6(cNk z)npL1K~REv5zJ4IgS=v_9>RmAgCfFg3p7e7WtCxM$MmogP;q3m&?t^(7>eweAf?Q@ zQyAjU^Z|jM6H~c9}Yx3eI{*H42 zoBgH=G+4)s%2+{H)^8RQk-9f(S8nTLx?xPIm7$c(q0Kn)RxOy|2F}93YB#u+>w163 zc6wCh`48~mSu2cm#bdi?C3yd|i&7#(M0^u!sY!%$#_wJd6i=q4vQCjsQai}##|A~7 zbe3O4ay!mb-oYKE)**TLm5Ue+GO`%w56goFgr6 z;-0KJhx(KB(&t9g>hcLB#@6JFU^e@C{qE zX4J;A4Juy!kQS8&IMF)YDYjZe==zmzJguNt*bj~;~Onf z8@C;UGCoC9CsNdmb74Ip7j1xM_?=N;h*5)%o6V0=y(m}L&7m`?Cx6PUY(LcCK_i65 zUk8LjD2sUvmnNZXftpi(ZZ7+S3}r^cNTuoL>#=V~f)Q#j@X59+^o9^=QhEP1aoXGM z9pi8Z$MI$-<{fzfkOUmBV49|b4!L>y4i{)+jQoUGsxN*Qf(Y}Wj-;H$a*{-zw4d`5 zIavOfmFh1ri9bjFsc%>@9mCA(Urx4LyzP(eWYDvb3G;kVl$kR*o$G-LcB@Gi+G@1USZ)-n-P^_?U8(E+iNqY|4QhG=91-)6-(#}_7~JrW45hH4@WW( z1RiK$n%A5Lguff*Wm;wQ_@ynE^Zc-@TNfDwtRG0^x<$P^v4AASy_<=OoftSd&n*%C zb%%^r8Z!Sc);u&7^hOl8>b^|W;JzTvdaBNmZ$)Svc~BCG@FkzD#X&$5-ypluf@-Fs zjgtQU5F;oSmO?YcQ}igmAW0+yRWbPb5vT&EqU2mo(My^6xeu7`E3%&czp3;w!GDJ62T*3_etc zzHy`S=8t5CxSNEv(ybE{A5QlCn#mDTd{IcUPoT|z3;VKzjT%YEpvvxx>rYx zl3S}g3A8oMp*mkNjfoNOE1UVLkalTP^5xvBXZ20oAzMo99KI&I6_axmuQt6(D-@bO zW0y0t3&v#TT*6QS;T-Vt@JU#=ub!hR$lN?pPUc-vyhD3YR{LqiZ6D={EG-8#=Bmns zD7B_~;Tpm9<}yNP_9rQYyws*Akunq2bfvtk%L(dTnH3H(LS-)t7<&3{W_C#cgB7GM zrg+|z8Du{eZ)ang@pPW3t5p?wc|t3rBp+${z``P*Lt_h&WuqsRZ`o7r(-Va>NABmZ zo37fmvmKXbXgLFYwBDn)PoN!bhX)Epl`!Wm9JmuJx7R)VC06X*Fm3o5G%{Vtn|2H% zDUoThiuX)S!^vSs2ZF-`HD__L)LQcKgdU?atPkd?XV02-<(wRT~kX;wM~* z*qG>tfu1UBT6w0{IE~QIKN4@^_$)!gPHO54F;77EtQcQK5&Q{+YD@Fo zYWpf82YD^eUceGNd9ID!;8VnYI|L1&7b72?GMjvr?H5gsSr=k|W!HmUmq<0Mwf_o( zbemu`=1E1CulLH~Mf8*D=V^I5OYX5g>K0CWAVtTm)*NL*2!! zWcJ2yhSJ;PC$2nV&k`@#)fT?!-%E9)?~Le`&Oz^hCX^PtA65Z<&+ONMRJ1B!cCQ+- zFYWjt&i|#8#lSa#<2YCku#U7hQGtu{A zf-uGJSAfLhuCIP)+_th;uPV*=9F^|bwU6N?OwIRwEDSpiz07gRHrl|=azdX<^55GB z<||@~WWL2;?N8;i2tMRHOW9!b$C_jggMN>EY~PJ2JghboYu*NELCx2zVt`EganCRe z;hSlZLfP;3@4NNxFyGcvY6k+yG}Eha ziQkntn=Ic)Qc&ZqaPLrIndpd!)S(s83`1=o&r^<@5uV{A+El>>b682OIF@AZ_=;Iw zuuJ;sjqg-V7zBV(8{uM{O`ShhX;(+`$8)YO%QnGII3mZhpu>*D&~98uNN$bMxKM8C zGf>HQj6ZHI4bOouJz2CWoKi(|D4K(!(OAXC)kSkUUnzaFz%?7hi_N5FU9J2z=e_f2 z&b}-*Y_GZc`Ny*^nqKpKy(PapQmD+VoKZI(cHuL}pV=Se{e=gkccJ3N9^7+Fxv zIDFb8(;?(ojP5^)|B1S|8$^a=9Jb{V<>AchCB^fla!N?}H@kt;vT^ z^Zk>HNl(;@dU5;cbR_aJp!*r0;+f3Zdm49MaG>QI5mO$C z9x;cBv4Y@vl8woG9}e;lYLKSxi<#D7P_)qG7PdPULCW!-&|kvvf|xPOWv?rE2|`>r{^^HM9B<_;|li zv-)5{=*jpu#2-u)C3tc%X6-}0X!)5s3CD?XT#|~@xwe}~{*d6_+c*sV(#6eg)T2fK zd?7v`W(QIqrwaJT77S~fe6#h4k#o_(`mLEaj?J&{d#CYI#4GzuF|EbyX3lK$UFVXG z?Yi^0jox4QvKMi<17`2VlnH<<0w%$UUYfsrC3YHU|ot$$#r#sgW1=tU?%)iU93M>OB=;Zod1f%D~<THhqFVf8RD=S% zjT=^m|J0`lG_rH{2YfcS{PD7P?c@7^tsnd&Utidz z1a5(?aKamNVv%c!FNo z4f;}pfPoD&sRVH!znEqSJsBOV);7m-5vSQ_(So==%NQN2zEBONm%_%%B#Ud{sJA7} z+pc#BTI#?!*tKK#Q%j?#z{_znP*kl;wIMIjubJ5{rwO#m=~YzKv;M1^ZL>=kd6=2i z=N$9J9SD{$42!1>Bdq#sy7|BoMrLh?)mfkpZf41J#<9(ASBHS*h(j|n)Z}9Gy^uo! zy@pZRaoe{&yRSEYSKfQlJMF()9Od1%L$h@Fq%dU{?KRrc&4EKR5H9yf@K+}rd96NT z($?^Lr8jqD(il0d66MmiIQ@w066rO!YgucVwEJp6wSDAH9mTVlfQ|M|Z0bkw)Xy&FrDNN`Ep($x(Lo{Unr#r7T|D z@F^=u=E+RdUSUT&y1AYtkK-C}Tm;v9gUrWR~Mw!tfUl5|Xaz5{uHCAIp!miCgoD;AUv%;&$=cSKKy!cVj2l%8|V z_a;nCvO_5%eHMNHPvo-EO?aF z^-eu%jMaZkX7I76;HPbQ9?Edj5HCkRiKxz32B=d%H-%?{N}4;(2ts=LY|7xb!eGErOTx;;ZMF-?T&?GoS=R{=uQ$%PvC&b_fXI-12A?y>JZ)RqY(BJ|%+5j2x(MM(BEK`|{I|O=w_Xs4jB7_d zLn6coKHI((!O!VJmpx-5C5|xpkGRLQFQiAI&|NhoKLf@^5-|x}g&c}Xpgd=#5jiS- zGH+QSXrsLFY1;p|9uYxEl5W@+UA7?SDdQdk?v7RN{Ug>N9zuU@i)VRrxW~Wuzufvl z^yXl=yibS#%6z*5CPlrSh5W``^HFJEZV@4BMJI&u$Azw7Fjj%|KOT8bGT%O5KIPq zhM&TN-!tH^jqzxBpQ3KhQ z&Pme36`mGhMy`t{b}EvFCU#5Um!ro1=wP(S{Oh0R4XI)+|D zRAbDgO*`?a9ki}pYrJEX!H7TW<(4{H<|Hy31j2J70B#56J4W**1hY4jiYeSLMV0jM zmry>D;-|P6$QZfrgn?iAqLY8fF5&)N&lM?GhnY2;EhUt(g7Eug-qbP-u>rvU)r|8) zgDLc~#h=jg)Iw_Wr@Lc?dvwX2q>^SXWK384e!(C0Wi6>)NLRYRAXsmkJHlP2 z_?z$(iNYzW*;Pv_YT8I1`vt`WcM{iXIYlMECZ-Zm{5M3y4!SbylM-ExobfX5j0NoU zuWXSiib|RSAYc?#n08~DSsCE86g&AtRvdaOdz1Ta_1@=WXXwI3@sSpB#i!}Royf6t z7duotg(gd;_-8?<}*Y5q9f6 zs3>f%9R0*X5FbXUDI~tk6eO9zJl`IC0F&Q5QWTt+4ghVjyJCyQNGqdI@7?=rHB;rU z6R1H(1QqJ(o~P!nTG83q&xO0X4}6R4x6@vdwP|kor(6;ls@tkcj7GvN1Y^*VIz!m5 zf|UMl9uuDu-QeaD>Vbu!cKMXkxnnrTM(#~9e^BD)v%c?K=M_(8Uy(|c_C+?3tX+LM z<+swb(wlgotnGg|gT*G5~7j3!Wuy<1RKRmkO^A)xIqlesVQL@3# ze0UjnEoiIcrkpUJI+QHyXxqd%fZBVkYZt0XJHV!gQc+<6sd5fW@0=R2MU;M4ZJ>Ri z_IxRG!liyvopzN$yo=c+d=}8sVjcTS{^DwGSY=Lyo_E4x=qp3hSK-YonhkUAZe~m{!GJ3Sm!9Ay1h27(YLgqRC5SxEL;6C zuONLqqtNAof;<;IrMY5N`U6hU3V~fU>VuJ2w5Qntt0483Y-I(O+styfnWZjv`4%M* zJYD;O*;V1-)yDPQu}O0lt(zB0eRzT<35i)9^Ge_!p@1(Eza zt?Zct-&6DPgq)OXi}WKOFmj4oJ=W#-+M__xj)u838L?mBelcsX_4fxmFd9Au^O)dg zvDfBzWSl0ytu#gE%-ouH`p6?$AU7Ayb{m*Nv-6r-6TB?{wc_n>x-~z*1~MnXV5xx; z7Od^D!V(tjYq!^E=&mX%viL7Sd2?c?Ura@ui^f=LP4s5&Fv{h#y0Y6?1Y=L|RvHj( zKO0OvX=gj_9~F%09Fmvsuo)Fs0UT?TfkH z6ZLc&6#&J*7MSL;Ra;Q!%^IH;&Kd)!+}D}Uim#GE^gz|lr12@tpWK&Ew-B#oL0|fp zjK`i=8{cnv0HUK+SNbE?tpQK(tJPQjKlbm0ubdx9?>Qe@b)NLAUFiqjjjv4aeL(Kb z>Mng+Zd&luX8I0&KfX_@8~Wol)j`RRi^(@R`P~bdvGfZ~BF#3W0NHiKyF0*#yT{NE z*4FKrUq>$^sJp4q{vuNUqMr68O+6y0Ea?z^k|jLg1$;4Z()@typ7Eggj={6=hT%|_ zN}CXYKi|@hbkSVS>KWml{DAn{eR-~PMXH0}H#nzkp4(=J?TE^9{>z2Ut){Mo@Ne-J z%v!~L)fa+8{(2}$!<@CEAS57nukJvIY3#L+^x_n(?E|WV#I9DZq*<17lS!*&nft{- z^ESmcOLZQpMe7P_SrQi^Uop+y=`Y|vytP|dca$cfh zOVrLL_0=1u@w`Sz;RU{WUc34&&E_Rh4+!rwx|o~0d7-~Uv=_FFP!Bdem9iGz#PReu zVqL(NYhDVPoPI^s;iK(GJ4r~%mO+;8E#WaG8kXW=oh+A<7*INv@}qZ<@`EvmyL0Lw zI0rpGN#}}B z9cQ+^rfV&(fj!r1&R8oJ%^aCv{u$F=m!g3;)T-k_7oh?7cTYgueaq9JJ@>4jq6a4# zGFLSeok`8cc|F80&xQ7=y{XOd8^FIvsFMT9-SDc&;7)(!y!T4zFm$PV<5brz&l`1v z%zA{H5s*gdP48^>4mW$LxjniN$k1%eD@I=2qfA~L5awxY_AYv`L-Rp5)&KPs=GNKm zJ?RE9qi=*QG9B3CP>Zqi9(<826@(M|iFM*Fo`1!h@j<{V>yq~rBlilM{s%g6vt9;a+s>@ue6pH(``vIR$0#9pXysI#Vx;xW*e@q5B z9iX@)u^-X6n{n<^*bJYPpjOmNWprd2kH3QQi03%IdvM;aHop396gG~)xAv256%$H! zX})|q@wzZC#&MB8I>U0Yz7NB+f*%v|#u%t?5gbCOeQ@<)AB@<;pT_{R(Hhrki?8q;W2 zSk#`XQiG&IoR^q}gg(auN62ahZ1q_T$;2RROpEDsl}HYh{jccv5tLAS4OWVwPPmaI zFd&m;CYV1N>wBmI3>9iGNA~fxki?t<<+BnVDEm!^trus~l*A4n20mG9P_DGugmXb} zE#i)&1J#!N@9L^IP^%q6tZyvUFNy!lN{QUPE4w+FH#e&}m6x0K2=>pNsI8$z#%qeRohIDEO4}9W2mgL?KdV z=~yEE%@k!}Kqm6%%q-M;QskL6STWf&=AK|Zq?8D4+~~b4!{O)vO^sV+_K1&Dv!vwPYWNz z#1hZGH~2Ez2tn{CJuTkJ+o&Hz3z@s`!AnGM(aFXsa%H@}g{1j;ug0Z;3w`3x;&iIY zOVmj+@<&JSQGkaWQmdy`8zX7fEwB80(t*spJTT^WILyo1-&3j#K2b{UI5lOF zJs?w0;6ozB14Md#3H14|$Y`Wd9qdy=PVr>_ec!uYwBi}@=%B%;Se>DqyOc1KiMdp1 ziX`eW)>@f)%MCT8hC<|q!V2nn8iJpyJl{)9GWs%kB7w6Ns(Bp-QNHR@B3q+I7+ZwJ ziu3(ophJ(PKS95q=F03nG=ynLcwK-=3mNtaKr9NtYVT+clj=d9x@6YPM1ewg#iB3? zt9Il1X$x}%Az0JE$_&oi>}o~vouHI%Hc@7O>8CRIs56G!RZpDot;^`VIwH(GU`hqe ztH|Sx2C$TypZFr*XbAWZFS?V+Kt99A{r%j1WPv)a53L}*NECRs*Tj`+HvJ?xF|=O3 zn>QuK2Z{QoSWYSeNV?H1nDSg|(1@4r=FyAs5gZl8xI5!4B#*1RawUlHK_3;zu)84$ zHjinHtn+{!Gi#~$+c(zJ&5p_y^|SM1_BOy)0e?OC1l7lQYsBaaTs3UOi7V$5-n0f{ z12qRCTQvnD8A^{1bi~7%bj0RVt_e!N+m+JgLC7Z?A>PZ>LvSygT?dp7BHhJ*=Kd9+ z{nM(H?gu!d43Kz41@&8^de^WO@dV=4Tb1Z9_olzoO^VBC_Ow5;q3E)X~F-0lA6 z#xR_0#ZaBR#~__V#K4?%P9CM_RwY27YbR0Ea1zfceN8YEe-a#taKj$?;)Xo(suqa%=(<5zz@2oLsY%DCflk9t7OLtAyW>5;j04%TfFBKFc)}(; z5X!um#sV6cae5o5HgAOqCEY{^PTyI7gucJ>^Q2Lf$PW@j-{5C?(R}TLQ=XLq)R|>ky4~YflEnB2?)}i5+a>ScZeV% zDd=x^;s1WW_4|3A|30qg+5nF3$U@brIU=$(PUj)gRDO9;^cY+4eT^L1nVjZ#`kogBjlD|S z783;G!D=mC_m~b1jzfu67qu68@_sy%=)IfONTa*Ro%=)j_#zwB6UKC&O6lRr7dtMmQ9Zw*u{w_J8RN0>XTB@VkcK<=c!s%C} zsYj+)8S9Vr^03+OSIcKO8wc~}6U|`WW2ylaj?Spxv#Iu>&i72~accGh&!!i#Qzo)J zs5{9KQY=x+7Sb>o1g`Kgsh~U0*&w-!1v(OX-njWfnkF9tajFkY%T;CpMW?9bUazj| z^oGX`e$vx)Ib{y#+QvN7ba}3ufveTMDYD8<(ocKr-kk^(7CKU072+ismxYf<%ur_V zOu4Za_(YvB7Zy6bmRe8~#<)`UNDAByj>D-txi63(YYdKWQ*L^qTMkW5QrR{#CM|rt zJC3R{s+X2)+pB_f8h1VW;q5bM6)AM6JuC3iC{ot#(y2X5>C&l_j^G{kr-MSud_`&i@4i?| z@=v>`)SfcYHeZ}4>F*qa%HEHkk-RB-JIhRE$v@q{M?f$sc9nQ6Zr4D9?$JP! zx#`8q<@-g9%nM702kBRzKbomLbRT~&0>X@sLYlDA=M(Cs=tcDoI&)TDlbKdLja z;pFTIMr&S}vTm!Zuf|yXzU$)7;p|=4lrAm9P+{xi#I8rc%NcRL5F)w6PMyCQ89U`| zqiPl8Y16)w{#naHwzQgdIY`qxT6XDx`>@upHh{yRel}fNL$^t47b%%iNr0r+(k=0R zV{TP(x5@gpv(t|hXk{Mmmr;Eq27R^Nr$uyS2JCb;Wdehlp$r?uryM}8OJ((V039-LkXd9n%Y4{fp}af9Q7)QXxI zS8f~5PvJ>+YxQ0!g7J?dpN{eceepRlpMRX^v09o?iJ*2<=*HSL4nZE zI|ZH7bJ^bd-u5zrj{8=ZH14_%B@T>w)#uIygitdnv;qT#h$c_JTU@27(sf=_6C9y} z1)Y}{4ON!>2{XbJ9IoAy-uVwUJw-P^4QEjrI{jjX%v{+O8d?zO_+@LWLGAIK@j#u=I4?e>;1 zL4k5hJ+z9GTspciX#66{H&2q%C=rrsEZwDZ4B6{RDoQs#2(P?CZ+f5853v-EHcpdT z2q@e0Bk*=^4(v!ATL0upMf~;0r-8#{Kir)v=_I`N2X|Xc)xOSaXdIh0lTU~~|6;uO zS+{2s=GK76`Z0RK2W#c0YI{+lY0isaZ;2gucg<9EUr}*9d&1S~?vu=Rb`qxEWmY<9Se148_Mz9w@ zOsCe>LUMYGcP6zb;_bej^RCW%d7IGn{_<-w7gNXglbs`D0kjq-(TnjJ9GZ`!l~1=^ zcrPlj$d?mc6$G7|kv!8HYjv|$3%;r**W`q5 z0EUO&9(aWs!=1( z3isvu;iPH2>prNiu=h7kGe8Zcu91cIp=%B}l zd)Mmuor$N1UxFD-O(nX(6k&vKRp_FjFNiWHraFg0owauZsCeySIiS^_TS$)@>?u;>PFXJ|sZa1S#DeQU&MJ0?yFzMk-WS1pYJs{B%?cQ7Tl z^yGd<&dGeZ^=W4_sAA39LQSs1bJc3}ghzU_&QG<1?`@-0D=2I`X+@_8^72dI#J8!V z!B_!S8qSW(p_33(UgkpLy7LfiF25S843L>bc_$sJr(DsAP*&aG+E(nlkx3ya`iNPI z$pWKBX@_FBR1&{JZ{sX1!8hw@ZWSKb@)dP19Gel|jcr!_D43K|8HBTyJ6O?LcFUBK zPPj8MAy5hvW3ImIXJGM9?{y?>E1s9EM%#}31RrwS>xdIdguVK@&N<{A>zX>r&K_}Q zQ@QR<23o~FZ0*&g%w#?~TXV{Ul7Fc1*B|V0)6Njpno)hz6KyN=4i~AMG>-^uT;Q3t zJ@!G0BTJ05?oke3s`+1gVFf&BY?;b^!h>RNRT4CBH$b)Wd6>f8Q)yv*fnA^({V4@olYP;&Cav@%t6ii`lt3k!X9CJ% zY(;3Sgsm0YKh_H))-F2o8LBKwaVef0b9(IdP~}+vdPTzIy3BcmO*8@t$7z|JUUBQ) zcgrV{;5s~`+BXIr=F*FpL01#)@1#boi&h2oj>fz8bP>GLrS6ocBw1STiM3COSyze^ z`lOr1Q_zK;`W%nBzAIKgv-wb!R`$Zl=cnh}+Q78i&LY&&V$|B-aT4~k62mDtmzlB_ zNMypEpViSA=8R%H+Iqy3XXo}_eKEC0&6wHi?HCsg>L@uB@)5E5tU-AYU~sNcOE~#3 zs3Y$|iPNh9b^B-OMbp!FfKCcbZs_g8QRr7&&CG6Ad+mtD?@kXK&8o6*S=x>3lAGea z?_14dk{^EQ^!Y;Sp=HEJu!95s%6;=iRW&sCM zCC$0dkq8{NigIKh5Gg-+?J8dbl`m?9bVX+2pg*iej;U=UIo4C^zK7DbXAm z6Me6{WUjdsH0|^#Z3u!l$vMx<>{_rf2j2 zd?RCTWo5gFte#0q(D^BtbAm+~Uh!t(G%x4}x`;k(*q7is5vuNJ?h)}M=(?5cAn6cJ z{(gVOZRUMsrdO0=Cp9MQ2b?B%9|+Q}j24n^l#ok^@;|NV>m}GN&47-HTy}WlymlX$ zHvX_278h}U6|b7horsqwJZ#MbSKlt=LSNdUrtz~E{(8T3mUCDkYZ%?CG3AN^YqQ<@ z>bB6*(K{?|%mw9cY0X6ylfa}0#9uqH`XxWl;m3=yN5`A8F+CD*nVgl|tf1cr8umIr zG{h}4kkVy#`SPyJ<%k>lKEi0x8mXm?{Afy)QsDdZkFmPLa`k+A78j~gLIjR6fsk@scwM>S0@0fm+ZrA#=-?Lud1^o9THXN$%V3i%?w-LZNiEH+R&9-6{~9Pi+9XjL!61Sw)m)!=$_?4+ISRfX{mB%4ll5# zd+{|Nktn@Sa+>2UBUnD3siquobvI*r-~1cx^^ed!oC~lZv<5Ej zkUlJdR_L!^-(=h@OyXVtzYM2y*nEpdd{5BlaUvVVttlsx$??`DR!}MMU=&O+ zmY3&r6Vy|V=gjc7rr}Y#uWIMfagC36;$5)~&HS3f$N6MkKXlr!*CuVSr1!x{Fu%*a zHC52aO>lO@eDLm>WOY+XLo0*n`yffi=)#&>dNO6*RV;h{VMC!*3+GRDKdOZXPcE*? z5;x1SkQt$kZ22U{A$SGhbkI*@0l7YzZ294IF=(A1v@pl%;_kkLEHg*3xBaxn*m3`e zwsk;ww=XJ*e=UI2;FTSPOug(!5*%@&4>-z45vis-T)0QvIT0V-QMglvGc#~rtCP3r z@~==S{@ehwUozwkJRhdKYc{eOn*sZgs-^bfIR<)S=z(hl|7cEagh()_G8M|g`lqYP zPM2Y?gjCJ+D*xtBKZW8e2h!qWn3>K}6Kwk(8LsUX6~=FwQ1Q$9`l`u2=IGM=CJ%Lyo-Xu$drnEz@?Lp~C8I6LQz|Pm4w*_QgCl0MUp+8?2xuKF#Ex+P5Xfg>LO8))+2R{P5=!ER@T@96lVc%?GpKgsFc zg}-hYxgDIOppC`uYQ5A3~>`^+L#gDZ%=-xSd} zF*QPSh$O{ue@}-ujGnczP(%?wPIR%Imz~cU=Z2(pb!~2t2g~1@dN-EUcQEdLYC~li zoxKM5{sP2G%#^?5(lUwwR+ z4LzPF!x~bqTAM4~#}fQjq^edunOr;hQZw&4xpAUz5M7j!(*_tRPi)p+tfVD zX3Hk{%@=2^xNOM`^U=1#mWeS<4S!o#EDBm44acro(00Cs3h<1q;aq+1*$7 zxUhBrah$Hi%b8@WZQkQC-sdmPHx#~ecJl7uULQVRX12B+F`dx-b=v7Aa~}2hr-$;& ztH}}P#2xE&dzDJbjRE|VBi#ncv`%1I=IEd9u)-z zeV5>0d2`5AG1?dfVT;oiqH}vqinT<4kF;CKq)RatJz_kYd+Y9rljqyobe47rf~*?v6@Ds-57*b`xl&mW1YcubI%Z?_cn0K?GkY z6u#v8?7k`F*<2DHkS5gAH~c{VBd6{?Xa>MG{mO$EqoH7Om5D*&hPdp>LJ;$sHLJJHhpX($~z ziYvDtMZrvk*6ln_aV-Gv7%#3lAB&8AZoK;|03K!=>Bf5wpHhh*s6G-PJQF` z);)JFP1iBgM?9&8!cEPLERP*7FRXyjH_@uHbG{`B{&n#ezIUu%;7ejp?@rgxFFve6xASv2|JLSZ$c;C4T4uqNr)yen z-_xG`iVWLczG{-k{(Zl_f%zeoAoSI3PG5;ZqaK5M_FvF9Ec14ztDA3|HMPp;MK+!4 zO}1F`yeJixoYfkPpLiP(P}o#_0dDo;CF)^iDwx>`>16KJ%ki^DS`1mz<-2`r)JN7N zX;?L8^!K!zsZBodnGo&-U+v@gZqcOvz!H<#*a8N%FJ!tcodnRfpIKj>QYCi@;!d1LS4y9m6eQ=^`SkrX=(32jVFxgHytD4RvvpzGR+X7=lRRV^ZTqyn z`CyAeuJuKQ0x$2T*;ia69wpZ^`-4iAkKA3Q`84C5Ppl3`diXP+q)_&okc=<%qY<}8 z6-QT)^^bPP462#NE#1=OZ+-C|s!)xt*eZQrZ>@y9FnhxOjpf~Hu_=e80qx?Hrl7k8 zG)$X=rCREp59!>TcyF_tx$s^lbE`JVt$!=ae#q-6S2pzw=b=M;r;Ns2pS)W#e~}_dM5uG5FCME*Xytrgba?O0XCbT1S}rwiEN*peyngRP*ehqM z#_6Fqk0Pho(LC3S@mYRp>h49njI(-8IGs=_VG4d1X1b{T6W>UzNjxKDQ_oduy4S)j zn}@%3)^(je(ciIJ&$>b1CG7;-u!y#6#NpkLwnrV`{LGv`lxEW#}+WaXMmBwwptf=zZA6N5%yv9t-L{h?BkaLRTEc(-8HHX~jp&?`!T@ zNsCP04zo*<_&(EH5NIg)!16+(ttRgN@v|fK((=PZy{mq!w@y6|Y45!LNPTw11Y0I8$;eM=a%Qb>-F&=e;<}vyybrOy0{x zPSxQw<=Ma~@hLyow_{Zs33ardb9grXlVxvdZYS#<-~Tiq=KP*V(&m^-Wj&`sr)|z< zp4`T}2N`WKWi2m4Sdly5klpq3@`Q*R{~f0i9PmEySI!<;=_Ft z*)Awk`&&r;{Ga+=@0jND;fLwZUMQtT3hUn!jh^f@GTV7>%Ibl-MhZ;7I3nnZPvWv^ z^$_9hjE%kThCyAs(keim0IB@iO=DHI*p$2}s!Su&NS?oAvR)(NSy*KBOS?_c^K7p< z$8gSZvn=SYi;}0WAtC!9RC?A=ME^FM{%VJ%W68eB!!-w|FrBoLHZ+fCp9dA+CqU+m z(~+9b$2y^(kW-m5el-)Nm1>3sh?K;$7%9oTjw5|H_(XNoLs-^H2*dC9k72ss$N3~r zGauJ(a)KA7PYJ8G)pdOC>g5xWqcGhLIayRWu95ZRtC!JV z=2|-!8y=!%KV#`sE@~j@l(J9h#hi7D^mNdT2I#mj8OXR>L+1O|4M0gN@_JKpPwt#Q ztI8n;?sH+%L783!M?hDggZE6LPhY)!OYF1d0!E$rh|;NhH|}x4R*XNJsN^npYvLM? zbJ{~WUyr(PBcz3EgVsiFqH;##-|l^pd?WE%S)h{;^ zO~bBd)~E?n9^a2H9ph>0hfvj5TyPNLUa%%qe#H$-qc1|5>@}(X#%=1EJtb#clvY=C zdp$(>WgSH)lnR_q)2QKvF~`H2t;-Uy)seufV_|PyVtQr>Wqy>b!r9X#q@8iCrs3}6v~i<3rUx_FA0lW^VwNL6)=Z9DbFbP$4&gXvc*8w;{etm)TZ*bpFsN8Cx_`7&&xk^|9n2& zPB)=}?Qffi{013+G|a=XUA+{O1-<-YY@U_&@R!YP;KIVf;xc*nJnK8Bsbw910V%~J zsy2nNtQe%GK;?= z4tVL#d%i&h7Ya^(@LHU$>K-xm)IbwY{>FHFxkjANc)sqHfXpV%z%h z>F;Vg*`GuE54_9g#?A+o&Fh7H_9yZRf3Nax?DZ9wLt1hIwvw_IuJ)n7*B`ZHU38no zb4g#ml5D*=8|^*WJJVk={_UE*GeZ!t${L>%I?x^uRpGzS9XORmp1kpfaGgU`7(DGaBB} zlG|qv#lbXJ@F40)$9x>wP7>O<4ciNWM7T^Tcc2x|+Q*~s5{46o6ZvBgly89owY|rM z@C;E6(j(?wldpC~(k=~uQ!{8r6EjSi6LbianG71g{28;Rq?PdzzwVosE51AL9Eu0Q z3{7kH%03w@k?reFY?5KZ51A2q^Bx2p(zvG-bG^%%A&-dNn1;pg?2At_aEbgN!(9yc z!N3NUie2)q?252yM?(b@UE+m`^6iO#kzehS&D%utF;ntD>-de#CV(mtN*Jn-Dvz2{ zMxppZ&VxF+n31AF(j!EHmE7W6&z8JTEQ45F4-Qqn7syNinHm}GDI1>Yf;lP*Cc4$! z=m-l^3Ho4k_NzIK&<|A8c=F|h}=?h`F_>Q9oOo9Ayj7+?~pHRCTO||Tm*~GuQ2Y? zLrJ1zxP-FXGpk3(cMnxWo_pH(iPkOhGLA1jDWH}zUAtZKy!7b`pD1IiQslgM;sze6 zVm3Q75|34k{4+B}&U-aBlcNhdz7ets7;+6gtM`jAMQeHT5+hEh_cz0FQ!;czrYMs9 zQeOq6N*UB|Vhq=ea* z@}Wrgz{Wlrj-M2KCc-u#N=jHP^;#8rA=#3#Y|%=G_#;8tVt24G0tPWgBYFI88(TwF zMA@08i;GE{MwKR1K5J!{=Ijf7&z?d}($X%M*A`AR0fl~R?fmqj$H4zqd(z6fJuNyV zAK?#;W4}jQqEC*NMy1kT(Jq)D&@6Sl-NzRR#al%?WMROqDprz9#&8t7r8Do?U6O`= z=Ko6xcao~1H)7*$0i#afb0L9zZ7gJRC>G<~Kn@i#Gv(*{>B6QWs$7VTS&+nloH@^X zP#9GRI@yJGc4*%Lt-(BAc&8*1RPO~Bhsd2{G5laY()Nb%dHE={+q5q4_wO`>NZ@st zf<3aPUvNa>?z!=Nbt9e=q>8FH!RnmAe-bXIWO+OLbEta6EFSF^eb{Gt^!H)70#H1f zR(dg8K5(!DzdvRNYAF9B!Y1ZtzF)#VUm{rxDxXplQfY;Lt{8okx_RA9j!W!WmdN3M#@c)&7tz1nJPDJZL?C0IdU>U|5|8ws(>e{beoZDYg2c)45lbKp<#CXeO8Y4^}gLAZ`NSE7qYKSL*Y7`7aOD1&HvU3M80Hz5JA)8>PpB7B&9GMFPBs`ck0y4iDK!sG`7^ zA=^s9#Jk-ubBcYM1z+APkd)}!HmoJt!u9PTSssd0@#moZ*pn9(XUaj||6%2ekBHRd zXevIdb+IE0@!%av$*!n74pLyv^_4FwQnWa?1l}7`^!Fm>m9%sli zjYQfj!4#z;LKMa79c9Xu(Wg`p5(&ku2*fv(HtTi{bO*KEc1xc(>E8>mJVmMb66^kB zfZO%xk=l7M@!9K=6;Y_!p-5F-%9p~BFRUdg+zY2IgNMI0uQE;APt)B6AE~8E;|<)q z&riLm*F3nzZRg|qlVFjnny+o}YniRDskLY=-GZ!0V+QQU>5?nUR+QQkeeZ0K;>ruz&=g z#PP^v9|_d&cYAc!_OFh3==lWp#@6>Vim-$CQ2PL1#@O=g-SnYBUQPO5R)K~%b(S=& zh^{Z{j0v%tYk&YrQc#wmimVvJXBqx1lOY`KP*BNOEwBCfw|H4+oeSbdU;U%NUwKnh zueU4=soF)&S3V6L@uh5f{UG;)J~nHCROsmk{A?^xV^ngEA>-)Mrp=*R_Q&fCZZ@zs zN~e5PqliRnllKj^{mKQ^^z0(9%LjdhPZH$TY_9$I7^ye!S;l2RT{o+Nmbl!l)zJr+ z%F2%o(TDFZ8DTfO<(b;75c*}tH6{MSN___;8rXg4c$gjot$X*u=gC;ODzuGFjfudJ zcNS~;s#;W#^`6ceLy%!cs!CMYB8m?m%k5iS#%!N^oAWQDSAzPjJd#x0f`B&#rI=!f&BJcud6DC}5txYFk>S~K6pon3+tC8q5zKQI+zaFAELwrQX468 z>X1*ci|@jj%Vcq61K^##dYly|gjBdr)9*@UnA8x!5Q+wqGKCP-;m+eUE5rHvnQJi~6a#9s#NAXwNJeWEJ7cQBB)9%E-aa!GDlixb!Khm<#U)dNi9S6$#f5$G zU|)RLm!R(KlrV!8t}~gA=q|!J%aTNR_u!QMC?Y8nc!y`5s00_@nLQvvLX=iopd((P zKrDdRF*g;9BW&D6Bw%EVnyzk7j9A>6aSQ!hLVkO`pk(v%@$AO>%ZWlDzbwSo-!w9cvK*=D8;z=&~WR8?@g;T9$ zO6>3s?G{-8ExeP8PA-Xofbhu8HsKxNV{#rMc*hPMjDi@{nHXG#=upyuD-nhbvVy-O zq*{5wg(z@l2SKnCC&I8Y^(3!od=ThY3-H?wg{uzR0{jLa&QjqD#zlvBTD`$XV0fo0 z8eEHj9;AVl5Mx%AfFB@u=qtelXmB3>I+X z8Vsf&K~%+h$wJ|TFz!l}f(bD&qXfky!m;O;6deeuW_yaS2&p1>3KcTME*mo0<@HHVYj(Agse^=f}$58`m=;$0%7WCB?S>;&#jG7B;dg31^e9=0R&XCMzM~M zuo>^H>hl<^9#{4(AjgFzST}k^u}FkKbVe2i%W*-VW3NAh072a;8f7!W2Q|c$d5GFs z#%z?8h!}!zL@CVyA4(&P5{#%oX5UC@hA1=EJw!=?fELdv(-Bh&LZb2^!GlLGmp9Tj z2UsA`V}L#sjUIldW7V;cQ6XW&Rk71iy+rt;g_)|I7*2tTQY9g_9l17DLkpZTicjr~ zxUHn=sO=DLc%w*dEewY+A5qUDnAa1jYY;pc`P7t%y;WC4JwgrViTXgziiVgqH@m@0 zTWk>Mj@fnSAhd>%)a`$y_Pj1%wx63_iir#Y{l>p8U$!(wjZv30K}`!^KA>ibx)QF= zX_|T!Ve!3rYHu8b-nYBoQWNn&AS6?OVT=?OQsIKfThuv-dSWRj)VVcqNvTqrEOK~f zzLO>&u_eO0X=v#XDmpvt%kQFsK#pX9{4qHlko^QgRkyuHql*d`klCjBjhLP61&tnJ zS0&*pXT&h6~;O%|&>+4E&h!y;r zOym06O9NsGzaG)JrVHM?ZjAr2{d7x3_h#<#Kheudj3=T5!6i-t|24^&l$n z>+gCHZFsA2A7Tt|Gw(yx;qABk5Dj=MsSnYCxAFSd^W4(Eo|mEl#P~l&;))C)>J0E@ z;O}sbnWBY7VHH>bJ6QAYheHe#V7SD*1xOe|s1UsWIrl+=|1!dQS_U_~X@(GL1h278 zx~et&Xg36b`2OJSZn)vaZ^Xpq)>1=4CI$UlR?|(|T2~r=D#(FA+<(aVE@A@Oz7S5p z!UzHnYk-Flga+m6Cqf%P&~5~QZ$e-QPG#W2g4@mtxNu=%1GL815SK9=azsG4;CTl8 z00CaWsUxvB)Cpq%6 zZUSKfLc%Dqd2C%={+`{x2?_|r`-kLvpv~lZ2mdyKjhrTn19X@`7y&s`2)ythU}XxU z&eq>hb4?*62si(myMRD!e<*C5yWu^9@xnFWnL%if>zIKjW-tTW10bmX%fJ>dIa^M6 z1;jg`zoy0qgqT63;fmVeiV7_eijvJCqzIq@S zHAq|JOy!9&TssnohgW-rx$A6H8U-M+ri%0(>v^Ppj0En4DaOvQiSO!V` zk{fpHf?%u7^@lTP0c~rDB-|Ns*05K z5gP~rVtf9ZJpLVB_!<6{q5x8DAh-wtOJ@T#N-ZQ1XaWVq@P}2yx+DNY8wwS$WCI~Z z@QVA+S_AMH5eNdo(v<&vSl^Id^YYq4;72l`Y6~+IdF+NNH%5vL#M)lFJsl3+ogoE? zC?K=|A3GTi|NmNB{`f*!bhx|dL4U=*JvOp`WXS;)yPKIjFU3SFhC4P07AO8=8wjK* zd?WD6?)uIwvV)nxXMID3r@+8>JA{Xm?O})nlnh7+g)sgvvtFDCQZiD))XV(6<%|G# z`|B80=YXTIXhg^r@)##Npu|cEA5=CC(PvwGS)8U=IaK4mSenD8*K% z=pYb*`riR35}h0_Kng55z&5Ardn7C%111G`f0+Z^0=$253OMxwPGvksP^p1nDP#-) zss`I#s*cxECXO&%2OSL8dV?>iL2!V=8@wKl8xa4C<0m^^OA?{Mg~D;Vf-1&eV09rrO7b=Y&jAduGx2qf~yW+(yNA3zil`?>3DZiNBt zxuYlx1iJkPQ+70BNO^$Vj2~C22-=#3|kUyh!~Ln;AVDov;HdGu)~0n8U&L3V|Gm4 z2wpb8y&Fsl6g{|hzN|Y;jeP&V5E?M71KYLsVGsgDu&coNT=NKa_mV{YomE5t9qte* z_>%vID^Z(=t)MO}@=Kng;sP2T*RwVEfCb=Hbb#Ln76xJUeTjgg8>9h_Xkq<>paG{I z5csnLfa3{6YVfZSxllA*K+E%5n-v^!hIt#V4PNsXD7`^i;0ToE24SJV{bz=RUNGdV z=rwZJ>pE_j!-)hEa3T$GPl5si$nv^&NEsa2u)Ibp@G z@@Ld6w!h|=^M)YqPh)SGk|cLHkp;-~hJX==&3~Q>|H=>+!>?I+EHN;6{9XS~@*^p< zBNhn@9h{th9|l_hpASSHu~LgB*d3j8AW#ek(qD156?owTQ9v*qyZEUq;($Q@kN-|C zM}Y$$h%Ca;jJ?;-w_#7ohOm?I&rH&G;o8vFMND)c$oG0xVtrw=OYbu}&30`YYGe1^E51b4^cwn3l?+Yb{H%IE4Re-56;^SPWo0<|!<7`ZLEI z0QUVM@TYHpJpgv|I3ZD8C#~g3R2YB95h$Evk@SWGmVaI+uv6Al11hjp`VD(l_%oL# zr@P@brK7_8TN{5MOxs)L8xB}%i3tP-Uhn;9aL7gUUkLFwjvNtUga9=__Xt9a*kmY8^S>BiA@+CU-}|Q((0X(oGvXe>{Kr8DXv11yM3EW|o_pc| zpC3VR5lh*gtByq@40GKX@?RNYg5tFheGp6o%z-lS_Baquqy`9+sIdT8mPwCLLc2{7 z=MFQ3?djiV{8-{Y{6xUFpzHZxz%@nX|ASxwQo+~TQzICLyeYaycEyM>fY=)(6OQG{=Zj|@Rt;TBOH;O{|6xl>Y&$C>VqQ{TmLA<05C(Y5y}u45^-{a*g((# zgB!#VhM=&Q()^PmVgn^NP%|9r@4SIvc_IdIc?01+fkB?#H2>s!IKcfU5JJSZ`uB~= z-^pRZ+P?xMK;4rYtKqshw{IZVZ5j*!H}rb-s6t^7*ToG4%LV`Mjg9?azLy<#m>qfl zowJ1k@u3hw#O_^LYx=+kOC~1l{@ygZz;ftyVn`DP8_SLbay=zjVn~CS4dycnvrO1a zvP)P_`Dad8APV^>CxpNM1U|wwM9N=N|5xmg0w>^)!vYu~ED<32H;}=4QvhE$gb`sY m{8dmZEa%^aF=_w7Gy`~sL%9Ec-w*+<;Sex7hAIRm{Qm%cjJvV` delta 33285 zcmY(K18`VRwD8;5wr$&JY}>ZY8{4*>#%$O$w(Z7l?Br|z-^`o$W_Hf~&Dq_%zO#Go z*@Z~=^+I||89J!RpCE^BMv!9(B&981 z@6p*pLzFGk`zQD}`fc4E4kf3sirn1`z)@2QQtg-Av5%=M)g(ODUpprW;uCJ<_$&#f z5LUTnM5I3gZ>bP1iCB(i4`ZGCgvLxX+aaG}U~iNo*b$fEvMNJ197mrnuOSyLv2|T( zn1PcC@QigcQ{r~ZA787{heSuAjQZFV1x^v0&!3%48HMwSiJQugm6UJT5M2#0h;#}K zH#t;dS!i#2)1K2wI5P~xz;rtTXbGKp$YQUnPCa;xxojePE!vOEJF4rgqjAopBJ7jC zXsTBwGNl`v3uI}%M4K?X>9Nb1ZF9=etKvQ$wC{2P8~z~ww|h<%d)tzgzA^&+J1+EI zBHGf|Jak5gf#h_f54vbxwzR3_YNU1ZJxck7;ol4@>X24v%gV@h#-BbvGG`~=-tRlR zJdfG&W|JGub89pczv5Wgn60^Sgiw5D=&3qvr^t`g6^TW(7rHHl?g%)^H}>lzou%HT z*`j7N^8>~v5dP}l)qT|*SrY(}QG$voW0ru%VIphf0lY!Y#YN$Fq5j%7$kxYGDv&h3 z4>|ACdL9dKTIZwd3P;@oF{Lg>X@6x@y0957g~ggq=|yMq@=#8oXr z+j86bTg>1vy)Sk0?Snw;Gf>8a=qRmv1MZwv-)w$TaUHS7a|cUUiB!G35+Mw^MTJkg zINXAoU${Zd>K?(+wOKq#{|6Jj1!%}uThQs~u*r`o zEIb~uf|v!70bxsi;X=iJt*}nv6H8X4?>_GR`q49*+f7M~HYJU79asL=buYK5`kM5* z+7Afsg<*2v-B}aCI3FOPB8_+}Ef3U{@ruttR?r&h|NdGj7%3#Te|KPv~ zOcw^>-|{SY{!to*{CBm|r5mlG5vI=sfx@@>*n(vt|4WDI4^~0^7s~tc!SMen`n$mH zaQ?xMWiVO7e*pOirepOFObx;D;r>CeEqKCz^+yi^N22(rp{xL(`A_rQ4W2H5_^(_s zLaC)&(!b>zen~f^!X`++a>9pB_fx}%Ynyume<%HyZI%ea68<0XGC=gz|AUV$h!Dnq z5P|^7LG%y07$A9=|G|?1B#$HXzgPDqtsV}f^UgrZ0G!a!|psJf@DyqHSIY3c9;ozUTN{ z{y56>vG=(mpAs;Gwfth(pP%m!;t4j;EA?mmv*UW0`^SZQ*J7N8Xc@#+8lR8Q{; zd1NX^N&2fX`j^ff{?zzqSr%F1jGta=EAWP8Gc`=T6k3D+a%-YRcK|Cp%Exk?_ff!1 zrv&W$s2R+Fv9m`WNU_3C$|1pK#xam$B!#w}-#~zc+L!qw{6>R@UzY?lY3Q$SJrEO3 zb_*V-6)Mn4*&&~d4_?~cR9Lij=6X`Z&dEMmUM@We#OtaNU)C$X)TVze@)tX7^SAvu$@YL( z*hoKLOJRv^877Jp;>w~{QfPh;K5)GREKTbeY3u^ec49*S-kCR#>2Ma@Z*<*NbtM)-;5Bi z^y%-(xWC&9CkS!&+wSripunE#IlH#Q9u7Gb61JUz&h4;|cz>5sHpUePhTXOoNqjGFJ%GG;2j1|cu|=K zBfdpjD9i|@6O6_JN>@zG2pjg@Ku@o)^{bEQOvZjVVKRt`EZMs4l8(7ic8&MA7g%L} zqTw((N7C@0e6FyQA*{pC2WGk_I}@&wx_X|~G*g)Y2`7@7aY=e7mePbwBv$Pa zCCDU6;$xCHgH{7P7>7=qP`-yhJ*6?Oo0SpH9OHs_#rYOTo$&kKkj44rl0kWso=Iap zX%b0!qn?ZJJb!WF_P@>kn?p8{O^e<+@bOi>^i)&nx(krlj75LEAoi}{z3oMF0MJr^gJoKX{c$aUp%E@)Z({t(n}T~S%A*Q-+O4wTvu~k8DJ>8WZ;snR`Om4ZENKdYnpyMU6_K--=r4-b3?CCDW zKE_-}niHaKGG2qr$AjV8>LMy&&>3DY9@17vsjM1i+z&)zCVgoUk`f5GijCCuf)aPM z?vrHX*vC>v%g!z#P!KjS6-6H?>G;!l`A4CYIt3#ctkxHu=_SGiHPJ;ou5VxNi~tSPl<( z>v7Lu!vmGzWwHB}ECYedl7is7>9oaq_FV>UaRTGK^K$&qgcINc&v9-LV=Bp+>biGh zK3)6{yY1TV?*_h!rkHAj-*e+?dvR~Zg)S6h#K@5_*%JDera#;5; z-&M@`^wh-ucpON2S*b@axuTRv=qY9H=#gMf|FOJ~Zg#9<1T}?Ed4Y-WTF@p#dy&b( zwdZM7$d9_`G~G^n@{mwTWHXB9P34OJu@NfR`R9oI4f`Df+K?$Xwk5he_Jg(mGi7KU z(odHU&1F!n_;aAEE{gQRq|& z`Px`vsGJ|0bU?x%E!Zh;sBb4rMultWkqaXlWN|3&h`9~h#PqyxlWlTw&%Fz6 z^_}y#W=+3Ivz*GZ?ZTdno)1Ut-UVA6X^u0VRSb(`42qjy<<@-SyM4*&FVOToq*Pky z-^{wMYLb+Zui)Mtww9g^L5W=vj@bW7VvOIe(Tn2rz4I*OVLBNQVvgLRSDwfuSgx+wM^VQ%rPhu>J?6CXf^W{fxRxHh<=tJ+Be~W`PA^fM5Vgkd z%|wxK8)|vDC$hpSzLpxkhDT3zS@%&{Xj*y!)Vp9uhHz&IT1s3ei~g4zW^RM1j1J04 zz#>4J_EoCD#(66Dc5*f4K;VvF|WFmi{|@cV#X`E zidfcYkxX}+aVH1cIvw4{)_I1YQccetvt(>)K13C^^kOPvQ^)gZc*90u(p+#!6VqCBWff zwfmK?vs}9F=6ki0;U@Tk698$(xId-yXua)k`_n=}tT6*B50w`Jy-Dgc>vp8~_{#jI zBfwcLs$lSlZ+xp)KTj~UhuBK^MO^dl-N8bI&HTq=#%bPA0zK)zc0?)xDs6~NMre9g z0eTRRD=-9UWy6=x7;=Q0SRXlb;uHsF{WBuOVU7!B$$iR!%2~8mKT9_RJUGiV zS?3ko#!&i^Vly6RM-Ay^<`yhObV<}143Or!$DPC#k(zfE#M?BkW5x}q6$Ryy?hm7>{gUAw4#lyU{T0PWk)8$}9 zKh&jI?^Z2K2RD#vgQ~1)bd8p6(>CTAnObN0?k-TZ&fO}Qg?3D6d(`?-=q{bxwC~wC z1r7?A%dt%Q8$nRE;>}a&53pugg-0PV$vw02BLwz%BF2LOr)@yB%O%i;xY6a}dDXhZ z245;pRWCYWQKNvOg=&ZsW$_8~R#?f!tpL7qIQ4C_3Nu~C$EfI3FGy@l#Zo_yCPcZL zYxzRcWlrcl;<@R@s^jgTj8FSq%~NjPu1;wd9E;`wN_Uk+w>)$=7eEVZV}o;W#@aeD z@^t%U!GRSlAXCgtt-R>_$)fGwoDn3;K6h4zUz(>*?A>BeG(Z`d&CYM(%+8jCq3MCqicXfq{YS;uxn}zK4#PM1VO3q$Vxx)dSrK08s*aVlIVx)4;xLZV zRd6vP*&?*2!#WzdPvc!HDR>Qm5BJ(4;xDkRMc~oVsUshUI6;noAwX04^Ho`+xXh~7 z<~YccHL9JV{Aof>1w0LW_X8%QlYw znO4%YN7w302B2vxVaMFFsTFn;F}PMrzmmtVV^Jy3v#-o)_e-;UvIPZ}M7Mfm-#CX4 zxw5u1mes_P7x&Ix-7LKMR@IVMxMn8Ov!yiG=b&DY!C29SUy|LnHk=H=ymo?HzDTizBRTxzvx z(_6xQJdeMUl`DAOg;OUIzm2g^hS;Kcj!O;=PebL0Qh*_$?oWXg^!?z?UEliX7L`OG zcM)>06hItmLX7ChWA>|;x${cD4BiB}YJJ(kJ_%NFjCg;Hc3b&m(1XdN6yq8@dx)TJ z*KqfX-*THuskC|g)2C@`1}AEWCB_>ZMUW&`GUcX;adA*Yx>QswEC!_eoJOi&y-CZ z10oNm-y58-(%rApT?`I9>ikaL2%6u0Ehl)L1UirqiG#No^5QIh$ZC&BCv&Mq>49KA z(o*f`sPhG==y(B(pV*nzF94EM$}cG#@}BcPZ%}8TMb4~F1GjL+P*$r7nXAo+f&nGv zidk;rwEL7}d|+&au+9oK?}~GU3pwuzFo-{Sp3;#zuM2e@seXkF^hart@4~G@@JYb0nwckqt7+{j^ zo&7fb4V@8$t)-;*3YjiFq10DlmdIVEvbaxK0={yAxI-1}Vz>s1R8*=>DM*h->Xtu# zh1%U|Teuib;ygg}LLVJ6ZkftyZK=CfaK8AxrB@)X3U7EJV_{{1D>ko$yi$r|IllRY z(yG>kZ4<@rTRDG{9tE2O?4%O#jXAz9cdFC3jX0DGb!Jp5%7#@eVBS1GUV?GbEs~w! z(1<5sNYm|Iw9lCuo#cy{tlv%EStEh0bDB-GX;nr?t8@WUdk*eTERMF4THSF`x8=8;+-!>+WNY z-wtWmHI=*!_?lpSnF$KOxIbUu~(Ja-hWwRyf5lmYq z7V(;`25UOGkTEmIQ5l=|o^TUdJ3&Da$)U z_%)$~uuEzVoIHqz43feQ4m1jsZ8A~f&lVIiC&&42yOh%~w0EjkVvad@!>#(jc0T&hiNr1j zPkgd%Da%h#9N<=KWn4SSakO@BkYxjD?P|1sh!b7U%J@W5t`OBWSn`zZKUK61J2Gpc z-#lG-c`8G(9_m{{osZKMSG;r2a%h`)d%Mo8JV&kEIu6v25;+DFa5#+DKV?5p)akZf zWhY9!`gaf@HpPqiaoQ^!>6BW$e4@^`Zhf`HIXVhqq+xn|`Qeuf4hu(>hfe;g_&w zFqL}Lln>0ut3@bKR($y}W$!hQRK2E0IIk`vy&c;aEwWkYdwto2#8MV%5PW=H+bsJW z>QRdA*(;#1hOtph7)#KAjWGGjxCR!gbQ4OSdB&5h;8TldT}7gyCo-|)K}L7j)#hwui%}n-^FpnBaS|a2om*wz9$_|?< zpQHR8POG=^y&wF#k6+yiYhB!2z@#|yY8V;7OPXX#LZy4YCk_=d8tnSnrsY|>R#}~C zHXw5iOypCd4?fkBDf~%3db{s{nl!yi{-qmBh=GMzD52f?jT7zL-6dVTZ|e6Bh~)75 z%JQgkn!61ftY3x3@yp#!S=}yD^kciwr9ZK;OU0kdNp24-ng<({ELPUX1tOaTlAW+` z!E8K~?R0y=)pe`e=RG6RxepBM0uBW@R!{S24|j47|Y#w+FAE}&p8nmiSj zv`Bp#nHZLw@hmGm!4y=IxI=@DH>s?laS81?2*TJ&Qp9+;oTo@{%dOvHfUQOGqagLD zQsYls*^ZMl*1hhq7#(kl1c_HyGUb1Y#-AEx?up6l67z5RkJglyn*~1FqhZVBS|g#HX`LlkpoBeH8|h5 z_6X1*!RE3yB?NDiQ>a`1Me>o4(5p&Sp8h@R;H4y)lY&(ZTGyLu^_P)#H|&-aaYj-6 zxBCHdU;n*Qjjn>yHbNUG_WIJ&j#eVse!q^c5lv#ss9y_g3=@-<`7{k^7}IV88D={f z3g2|1o_x9&uy`3vbiVGxoOowVeJY71R((=W!E3SRYU_2yB~`S0;3tN9hIZz7)GjqJuP_U=3=!OIE67wS@z2;NZ^!=?ce?82FLg9eui? zR$my4to>tcC2U=?(Qa4uVg#0F4~`$U*h#%u&HUpxPraZ_ zsJ!8Pa+=RAG(*8afkR*Er#Qf1oncCq4hY;|9oP)Lf-8w1BFBE>u0Pk)2U;aBcFtby zd+?`DB<|qLc;{=!6~gwORjp0rjkYJT-95VuE)9A4w$qOVGwqGNn+kMa^l@fw<}1`K zq%2xN-OKdTuL6$dBl6}RdG@zeRx)GhX++DJbIX0vc0+U$*LHhse?Pq<`wdC4C9^B+ zcD%bp&WGE5c5RzkBC{gej z5^4w}J5w|{R`gkf^x9KMLKu2qIbLiQL$qS<^yO1X0w8zxC)u}B6gfg!%kQF_l_3<; zYz&!-p`vy%=F)8R=`-IVAzWbZQQ+lB_Y;q&y+YFF9e$8Xk5Mi}MSSn6%sJPkpY?eM z&+2=}9XGQeE^6d$Ki9R~X)H&9vP-In=66E=Za5mQb%XN9d39JTgdw#en4B?`6+70v z85~5{fe={k#8Y=(E!Vw*5mj}U4-~RsjvAwIMfWQYnBhrf5h{q)b$0>+ISOq-a#AU0%o$`RFpgOsj?THP9dNZp-1AuW z*)O!)^N`YV2hG;47Qfvw$FFopj5M0TXgz!(sRB4Nx?jKO_8-G9IOFnx^_tMfUt0=* zaejR-``O7*^;jXwOV*M5>KGs0%m?Ek#J2X#{BVU>4|{3RJS1hw$v1Vp>-o)RhufYw zs`!%HGksjWTxHcIqT)Q(na1a?q%%q#s-42OJsvjE`MUWGx-AQrk(5O+-Zr=PK3=^GEmVF8Xj>=e4$IHl-R~;h> zsD0!*zlzhcqS3>iiOp0oYiF7X@1^{Z29pN7(O+~(P*b$YgXB{@gMFbWsH3sj;ZTm* z%#y#I!7gT((3vc#k|@#^w~>I|utd=!9m|TpYBnm9q>CQ8z)m~DrjEtN=#Qfvo2TLF zFpxPMHEL2n6Q%Q~5{(h4vx$bQfO~_G&!TFDl+pNTp|nAXvZi3B&~Y((Gt?HROH2b2 z+NTA+;lVek+@GkoxjBNF&z$1fZ*4`N!FTh=4sahrX{*C;-ou=_JX*6dSHs#ZoA0b0 z#Z5ao$FY*AC{&-)`L_uW5C$QxE^DQdpID#lOFaASc(-jl%68r#kId=fu<()fOFhUZ zC$jIE8l>HBGxw75;+I0+%KP}U{X4+N%4^ZZgP;{|F{ZnLYAfmqN10AWUb5JoahZVx z@_UGt`Gb71`nN4F$2V@$=9J@9rz0)xt_YofVPpruccX4| ztL!_O@CQ55kZohqOO|x)6?bKFktdYC3*#!%)2v$Fth+FV?`*$hSQ2ps)VXJe@QQi~ zWnFh?^uC8z;L6Cs`)KwPEY*jzpBw!jT&d#!ZV_K-p}Qn-V?87g?4q}DE7?Y}$gLOo znka9|!(r0f7ybsSD}7hxTy%7V{7w;mtdJ<0E{>XO#QW1k!WBj)4?|)h-}`4o?BC-T zjjomh5pZvg^zLv-T;hdA5A#O+Xrqg~M1J+_%|@w`1H3kZFX}lS($Cg1<5!a4s-TEA z-|@O7?^}i&+=+))6)9|9q!&T)b(vbK?%}FsYn+}dR*xoD?L zXRQ9`)TJZcc@N3t?hLn@$X;R-Gbe%0>RANm6N5=1;*El_w-9lM1UXOEZE|MM=v};- z==R~;u5%G7ThVgkn}lq>(TheIBP)MUde#*rIS|PPD+8N=ar@>rl!Um<8)0wOk-*)* z7h%4iQq=lc7SGgtKxLvdZA_%y-waa;vOSRCOSUveF6faLQc6fdUR{-NIH1Zae`znh zisk40NKW0{x<9Z$^l3Q()kqV@l|BUJPw(t(Lfsp|9sGMjSz^L?sTJ)cB*R-q0n;S9 z^smW!o&`f^s5)vm`uGoDQCqqicIoT+B^B*$c$@Mk$isz#Fzmq`#u5tCV|9ArPc2Qe1|TTY$`;Y{fsXT^7t5A<&mZKfxV( zB3o9SVUMHTf34nsE$)hYyS@KrS?1H83J9hxI+pxTK;E3pIUVSP*O`*poP?U?;E1_-s3q zEop-7NDx30;~oG0y@hKDQknzH$!AlDbuNl^N`!yDDYA?r$3oJdGXN+mZBL;(!Gq4P z#^hDrm2StW8}iwCvHWc-JO%6^U0J&8T9C|D4o({%fn0*r+G|5MMfRZ2#yYJ_6d%jY zQLV`oNj6#9&@I3FVqK3Ou3hS;R9;Md<4MnR==W0Mw1#w&)1jNqT~k}>H3PYyoc^q< z`bi@`{mUhEnVZd1nFLt$l5OeJK-tW5qTd=|96`}0m=>s5F^m@dr0ElP(es&@<-8nRI?H}Q{AYb7g=w6kn3g5?CW z8_&)@)D`LTb&+39iDkzCS*E1<>KqdOvQ5 zXq%bdfn<;i*-Ov#6_Os=Y-wp5Nr!L6)(at$9;d3qI|V&-9-(z>9z?XB`I+Bt#JFuY zBiuNr&K0Z)*&2}Pn_A4Mx}QyO4*LcvRWjxJq}Nl)3c5AI>1O`Z**g^qw_&S04z3;( zI(PNK#2RpvzO#L6nITjr=i$8mdr-!rnmz7|CmKt&G(Sa+h{Cpu8H)s9W=BZ6LoJXe zlaks7y7#f5ZpoF4x0N7%S%vM}XdX66n*Y*5q5p}&vJ2pe>%68N_QqQB7FQSB$NOR; z^V^c$p^@-0%k0Oz%_PFVlHmkVL7JyPu~A*g3>#)JB5fpp!WV@o+kbUO@L6XDn@Y8$ zD0U$42${Vz0;w@V8dnJG`;OMqWJyIvrOB|T>A z0-|IjbpQa0QX`=X)gLZXjf^fFESijr-ha>^YJeeu5Jer>Nd`ki6Y7V8PH{907aW2N zLSB+e#3NVapaQ)~tYo&pJI3^+OyZ#$V~4e4JQ^Y11or|3hKYd~PaP~CSu4&4;x2vX z1@R6pvQ8C9FqwhGii06@$5X`Yh*=C!89XQ%(gA!!mV`xE>zYsQDSwV+j;Ea*4=e-i zv4oDNW)IurgFCV9zHq7z#RPLooXr;hG<~veu7B}+-N+bKWEU@(MppavH4>x1psHY6 zvyj{?14OM}ugF+@%E{bEZN?*q>MTH|VQa<7+XtR`-f)(y@Rs!M2(BWzf~^f*sYw*o zr4|Uqo*|x{J7;aMz2f4hK+Aw;#NyEynh5E~pl{mE|0h^QocYtlVld5)C=Q1w0=XjN zOzplc{53dl;aR3uP{01l_)+ih*Zj=4BB(EVHae?geAoxMH|Xn0?js{h|E5z^9C6qm zzc*O%)^c2h^->n`!H;|0efyFj#uL>EfSXuBm&haW09Re)=FqaK$7)CX%;n$GMdx!7 zhv`D^QT#I7Xb)YF^9;4sAu(l`F|C=sFB(Yw)lS-xlIV=Juc%{p;WN!b{;se`HP-5z?vwdym4jp<5vMNSPB^4 zx+wt^7lQ9>GvUmbKiwnkM?Xjoji1DeW@iNlbYY|@PxymY#)-y-5*u_3GlY~Dovs_w zaceA6uGAUBuPIN`N(c0zF|qC;2KC|B;ZtyZ;5Qh^ice*tjNAIUQF602A9awy@}YB#KyFD2D)jSOY8`^mc?ERz;A{O-SZenI?-NeTRaw^B)cC@Xdxh z%=hBOh}ABbL)x<^4V>7Pb`QT+*6EJ#R(OSS2U-n%CL28ZiNrr6${s$T%B4jwHX*CA z?7s9ikv@FoA{s-RYec=FacyRLK*pj+Zu#J{WuN)ALb(eOSTuTCzS9c8bhqI*DD;Vd z>{?x9bRgy>9IMlVXk1v3cc6~v1*VgCApU&>#|$96(hbOBM7VET5KEA(W#)%U#ni@m zfA6Aw;I>RT))HkD8aACz!`x*F{FCA#>jzz%czkjWy24Jngm zqj=w1Ayp)u-M`C?z)<`9#||dDN*0kI6!$+lT;+-=K=A7EB$0aAH*B&U&R9K>_yJj= zGV$RD6-RCUDG;*%PX@*OC;L=nbp*o1{z-@{wE47nqg%AiGz;TT@JG2>JHU(LL1kqy z;&7X`A-^xWG1LY16Xlh=tM3@5o#6wiXuhnGEGPOXh|%y~RcQ(N({Tcm=z|~M%l@r9 zj&XOR())8O`W+E3qpHoZZjbg!KV>)bVQ=L#h$r@}QuV5L#v*IAxXx&ftqIXU+WK|Wu>BJU)DQEOAIPyFqQ8`ApA&L&DmZ6S+~$&7wJOMIr!rf2ouAS?pcU8I zz1T=<=OVAsE+D5y-AhX8TP$1jOL3{XCy zV|0;mWVNy5DrwU!uZjhH{4!VlW$oV%#3Jp-dCD+o>SXTx2)_Zz$8*Zxt|nQ0R4d+O zin37{#pw+uSza|NT&FqyO1xaVhdRl~npvM__FBnRU6Y3j(N(qL$K989<%3O}`BUeE zSDejL-rr%gr+7f1JH>W1m3!Rki=){RUeo>V*buk*8EMLe%iV+fP^_YVj!CP4vX(qy z!x-x;l^Jd^e7%65#Riqx%P5H0`t@CPj$fnY`_*9laIAW(B$`1N=Bx-xDY{_rae$}+ z+C?mG@ta1`RaBmE3X?*?=7UE{!_=3EYS9_&mT*Dj?bNOEF=|espC>(GhHOuo6izyb|d35T`ITIuu1wE@}!wWZth2IYoOTSN4sp z8-b!uEIr`s=4$?soGL+%L)@&?7z60$Sw;z;NkQFjnv~vY%=cnc(Nq@0Kq1$ljG`EQ zqP1ew0XDN}Do`F_Ra!!6(Z6FnRuWo7a8X1_dy9EWj~C6W=HF9fUu~Xek zp{PRnn*rm(-b;mg^;@&zfU<~hh)Yk>2&9G6ye3cpr&%IHQ!nI1k3!IeY@7?5@{ID1 zos=7$+C+aZug1{2z^nE{S(+di?x<3F+<5bJ8Lh3+s{woTeyn!zP;!};kRIbUu&6-z z*}dVo{~;+@8WdP4bb@6lkIPeY=Q7D90M)yqb7$b3Q9t6c&{6Dmm+3aO2ru0-Ef=iV zq5;G=9mUMWS9Oo9K?l?5-D{bV@+5L?;8k-Lj&=XKNcPoC*@MP5K;|4_9j88(PPxE0 zv%AIK@_~w(+Pmr-7OZBbb93Tajup`6rej&|6^!TTz`KU~h2J`Z<{C8idxZvWG5ByD zN=MdCmFP^XLA=<^+D%o%kLsvgI@_}Kl+94 zPk3`VaVtpQosMcCvN8!Ax9kfF!F_T)u#SVjPV-)|DfZ4Clo%l`&!4&C1jM4jV{8$%Kig>^}_PGE(QUM@d zzUiE9SX{66=1k)phu;lO9l^PJIRAX^3e=Z_;rg^K0Lbv&FF9xOHW+glaV2z_}_I|9nOS-TdpRVOj9n zgupAvQT(OF*SMg%p&P)pL~ecj5eVc-@}0lU2?5igPjzr9Ile2;v4LBncX~4$Z+$GB zv?g&{hvu$ba*N25lU$41)0J8GEIH6sT6KW0wPJT*)t0w~ywn>Js9sXjN~TGH1gn4} z0>{i*gfsk|*N}1fxDX~reC#yq%wj|o92;>Bi+@I-K7lT(;D%5gF;2~)#DEQR4Qg)zDVA}72KBY z2akWCH!Z1mwxcD~l%)CU4 zR$A-Qlrz;f;>MVpIA`nYm%v>v4z3ZLo|rT0)#PFs2+tH5Pr%(bm!L;4Nfi)Qu#E0r z#aN5>-&oon_n8VE{&5E$D&1{8{TAJ&{I0mvl-6?TM+aoBu{yL?^x?H$`07u-+-g7G zL)XC-rIu^CM6a<5hA)ra%JeULXOQDA>X^pawwl|`>gmMbNrJ{KrJw=bjIENHE{HU7xVIR9C76TdZW-DunU*-{Z^(t z7<@x{p6WCA|LY8?Aj@={UIIP2(7`IxEI&)W5B~nFyz8<{D?I3Ly%~DsxShV9{`D&q zE=v9wRV(Z~kZEF9%EZrxDEy3?&hQlq8xTjX`I0NPyHsRgp`*a-qhmK!-)vUP(c4|~ z=Yl})gIns%mglt{U#}eruE^YePX_7<<{zbGew(-E`jk00u+H zAs^$sP4`;8j|?(ow&cf292i@2PCaaW(h2oL6m(M+HBnqhaLR(%?I%+K=Zr~)I#Z3gH_JS^?56BrlijE* zyUj`z8+h%(TeU3bAD8K3x?AM=tBg7-(c;XGMERiIx5;jEB5qr77X|LJ-)Y_&#E`8~#ag*`^#9`{-1UHpTjH??=c;ehcT^lj2F;Q8x^ zvfxjH(>k+v8?DbDIfCi8Ha}8bGVPB#)}L)YF5cKb-9NGbUSJZSUG7M=*&Ms!)$*qV zwtLl{b*>M_u!*^LpVY$J9_{fK<^OukXNA zyq^@%S>QXUaHjw38~=vD@E*LTP>K=WaL7D{S_-Hle)UULn#{3orHnTFDDYjq0>4Kb zLwwio+uF4LggtCaAvAsoe5v|&{YPMC*$elHf1WbuGwLK>R%)6lb}hGj73~FJVOB3> z1bd}Y%^I$WQ99lfrhBbIoc{=-xl6ScBwzbTUNR`G(|EmYdi#L!>t9pIyi_&J=;&LW z<`CaZ(}=kXoug~XXCVc^((+OaB3*q(;Yz}bwv=+1FpWubu*_6QiVPuLNxRWGh`T`< zzIk)%hTRFYqnyaMW1NsWlFk8oj<9onj*xRlKbHJ!-M(B3zd$VWLm?9JgCUaggLEeJ zAo?Ww|7sC9(l&6aAZ6}WRr{Z? zsyCnJsc*evLq@*798iE{0IzMRml_e&nFyAuO?w(HS%Z0k*u>8tvpYnHqL zu0Jm1N@`l$65Ur2Na0tuBs#_(kmp)j0aE_u2f`A}l^(H$( zZHG=M6BLp-G44JLX67|$C1ktVm3b(A9g>P#+8{DmQmVNy=5i1#jPHSzFPI{5wMv5t za7SclA`pOX3>)O7sP-2`7W@p+yCl=1;TI%+($r&KD^ZI(lhHe4s_?)HJ3KleZD`tr zsSq_u8zb5|m0j@?c-;;VEATdbXn$M3zfSRXA=%vU6DQ_V5Qny=QwWC}135YwP2t== znYU~%an2w7Q?xJ#?4dWAFjD5s7AQxwT)i>3_EUg|i$Ca*gK6 zZ~_!)w{b<>vZ>G?TE!&bm1)x*Wy(jD&Q+~+CU7v7Gd~DVnKJdu-q zWZ@rE9X0g&n|o6>o+goS3?^FS8ZQvH5T@k0Gpj^G6vfxTD zgIk1dS==(Z=KA+CiS&AjUfH{nkEoBZkC=}hZ;4-pUzJ}a`AVbho*g^K#$ch~)*-~r z_Q#V2*(`P99i%J={LdEDs?6F*U?7^x7c~>c6?5Saz|kf0+qF;o&cfyQAFu>4gyUdZ zbDn`BaZ2lR#NY%3aUL)ScZQKLK3zdrBy^)%tSc{aCJ<>Ow%T|TW=;h0-AQXWSs`x} z+0aoYe2sDIE{n+kYQ^B3XHO5^h{vC1?aoX6Bn7>LGa;YFy&BHp4@6shfQNNFksm|$ z&31~C0Co6H^*r?zp5$|t@>n@#_FHQTWrBX@O-diY7X1`C(c5rG&EPjh#h)Qtx_xP?GFYQN!A32i=#$sChF?ClRFo;?~j^IEfe}O(?G=;C8mq7_4 z@0BD-6w1RJZYB{I_MEQ|W0@NKQR&wCSr4h`G0i=S+8ll(SaurL0dH)yh zr0^!WLGJWWS16K~Y*~?jkEngcl77dnO2shAL2iu@SFR~x^rJ1N64J!--?n&xu5eRg z=ob4}-sbU@QB6)DGX~$w{FjXl)N*1|g#Zh87;htDW#DfLHt(`H7xhqezP*Z>FagCv z{MVWw%-5y}P#yH4eOF5fPpI;AxHtKLE}=Oe zdO-I?0V-j9>iy950~SY~S(VZC2T+rP+Sb@J0O%#753>@QuAn7q&uM<#+qz#66TM-o zq0843rN1XVQ0F*zeM^8q*u)R?We4!9UzjEzOu9kOq<^a?4cvo$#HohH8`92A@4}P_ z8ugwGZnC54jkTaDjoqUWkHMp%k6k4U(Q+!`!O^r4$*J0lWR<+-8H+rF4u&~n4hA?Q z4hGyvq`SaFF#}1Bn9t~vY8gd*v94J+aC0YPE|S%$m{brcn27?FT_Jbe2k0@g)yyDA zKTX}B;vVoNUyY&xW%L;BHDt^8{IKFqgaiAZ%p0*EZ;)ImWTleSYGbKl(&>%bUh>bf z*VP);fbwSzjdn`f_eCoWtIie&HpPdk8Z%FBwLEnT7vLr4MI5hmy0Z9H@g=Ckh^dsZ z%0g7-CF#YEue9#}74{WiQFcxL3sTZu%K{?Z0@AI7bPCel4I;giARr(r+(@IOAkq!e zNDC6uf>I(#mw^AhclqAuef+-b`mgSF&ON_5GjnRroV}KvBD~M+!TRdCGBdf&W%oVL z3L0k>H_Ru9#DY~@IyG+Yi5#Ajsw`?R^1eAJ7oWYC-AJdu$n*L@>Jaf~UF&CIwC;rm z*+0^}RAhA6Qnb$a9zK-L&wd;Dnd3q&82HRLzA1WPm>8gfmj6fpH-6p$^r0O`{$g>B z$uI1OGMiEbA?;o=#oCWwa?UVn+wlQJ7>D`q{x1tMHalV?5%U@!y2Zn&P(9 z$6w;Byr?n$t(EqgMl)wq_{+GcW%vA1nX{MM_|OZf8_>1x58buc8;SK5 zFFU_pe35zis99^L^kMek)XD+eZFVL%w>i47gg%6)Q(M^;gIQjfUhTeoCZKseX zUjYgb>Wj9d{I-p@0y;Km&YMQH`4c?J|Ku7}_V#^2tD@=ccxNI*IiRmWL@*(G@f5Hi z#-WCH`H7imz;_6@A8#=eUL#Lh{pb_!Nmcws^~Ue*>G~) z0faY2(6)uxtM*!iu*ZPP)4Qbc%ue&NfHT@uNv&+{{+hNc^? zn;ySYZ{xXk*=VN+QlAvv>1Ke5#Mm@DD70I?8{Q_PlVuM+#GM$|c)U7U} zgU)3Px4iDAc90AxdU%Y9KFzyKV197yaE|>VJ(x*%$+>JwtVC2Wkw)l*Kcu#e)$_6=PNv-yly$xc@q_{Si9EZ&6%7zx+i7mDKec3LBuu%A0kR%DDHQt;Be zT z^Y~bTWpGMiCA}X{@eAjBnN1ZHWpPvCjaavgH)#X184X?QR8(bFxg*qf;{u{M+%B&l=L z;g+AIoATun7gXGxOUirAC5Jw5?^+DqJbaXl2qAZkp1Ku$6d&p5NPQc+2NE1}BJ zp}2IQG1b7TC16|@GyaCNr-Nhu(rc|Ge|nMarucZcESGyGU@+2{B7A`Dul{8wyp!baDCpzOwYG!CS12yD%){;pe%t(PkWK_cCYaQp0hTbzR%mJnLQssuDeHp}^CO zb|}I9Rci4~KJFc5RLbz-$&Ar?$ag*e8Dq&tC42wT==gHtLYJFq+TRG2HB3vCJvDbv zY_i^Z!1+ANX@`Hh?AB@F>CQL~IDf}1Io3&3E4k38H(}y8kdv1tA_y+&-4aoI9Xzf| ztTg%27++`rdYDo4F)UsnPyEwZcLQg&!U!J625lElN;A74RpZQX0^xf;3rGLAy|DFz z2e@x9?C6IC7UsEHcn3kC_AR($jjvV~dH#UG}9{ z(W{23y20DES6(KT=Ry=`w9q$+^TadpW_3_fWH7Cn?d6>#b# zP)=R2#6Pwfixie8xldf2t6+UwWqfSBcZ&mFJ~xX~liAApC<5Dq?dZ%&f?f5Y=K<~g z!DA93LLa;qo=UyDm4#_HE}B%kG@y)p>aMD4?2;#eZ%7sP|s-V-0K zFxzyHu{gug-cj^p?*tvcKtEQM=8>}9rdE~lh=|C?43AQbeev0AUMjk8pA~|jz`VkY>dqy80>Kp_8*T_3e zm^CZMMy=?dD1^DQFc~<1e-^#3AO6Yh(POTiSX13sy;~*8gw%b#hbjX^AUjD7Glh}bs4LrV)!gE7c5Vtrr)ukSEI^^V;K zLmGbc&6IC5@wer>&)HZNXF3d4DVTC3aHs<6-gnO@EX}L1`53P6PJF9@d{>ZjY3zY> z3_TIR8*sNfO?bmF`!t$?wNN-RLV&exARaozPou7wAT*$x&0EkJ@G6#oxxSO&epd6I z3cbvkqsMR0x3vLjcbtTwaiUP|HN2#q>}QeGTuV2z7s#X|Vo&Pm40GFY9c(-jDRW-; zUQC-Iio1OOK#b1sk?xs>7SS)Nm>r$E!RDAsQ=BC`p^WraOCXXx{`l#&f z373=27I9TE-2-o$Z_dBVrBru!bUCO_4{FBro7srDQ}lS8S>yB0p`^j%lz0b(V7TUl2Pw}+{Ejk%(iH>MyR!B>^lUBjrr<{jI3;K+I%C33xre?S{ zX9muwH=khHIr2CxflylViDoiU>>UQxriUvJ4@+~08Sa-($-@&nFt?;Nb$1#k`?w`P z>Iu~fSvHH@fxzuX)^~(DGgj@s;$`97O8rrge@7;MOcm1J*5a3+4p4kOefq`Fp>*Wv zMB7Qra;Lr4utzj`@HqC*U7X=4Usb zSjpV+(~f>DnID%5o+35#x_6t)QdeBD_LDJh4D?vYdVaBbaB){tc6I$;rWKZst>;q{T6c+mt5)!njtRl; z@Y@e!Inx#Va}w9Z#5#ao0%a@>znC39arj^Z^|nH^)^EX;$y3_6f% zp3#l*OEdFsLy6I*XEkgssuw?@*Gtr;!dsODTau$5DwZpc=zn2%_#}AN|88W^1Fudy zsw#T;)$$5XF6LGS+2*oK9sIE<)XVLLlzE4*$MyYF!1`^r^od2+t75-n_s1J%<^%8t zK8~)phd*y+-T#*L`kUGC3PGiznt}-pk7@y-LP0VItc4Q8$mnp*UX%&nQ)#VJJ+ zvZBr2ig)YOtV-h6s?hcKolKg+&_P!RvSWS|EB{(=MF$c*zU=~7$p!~t$lM$TvEwqD zZx#M_gFaZrvehZqo6OrVF6jKza6bp!wUa@z?$c>c&^rY>>2*WH+Y7R)x^aGv-h-g;@-))}j_(!%#G^59t@)>YAF#evZMLhHRBqc;TRBwM1*fz# zjl(>+G#WIXa!{_obBuF!b04LMZq?80BZ-=weK>F|sB>wS=fL}wwTmcr_SMY=q4oC+ zg{4kAJ~;Qpxr`PeX$lmrb{WxIVPctKV(RDAlGRUJ*##P;dIz{kM#Og#94Z}nlIaY^GukDQztl5%#n?>HVKYSBU_=Om@&LM^WEr^du-l!ub=CM!^jg0g1 zYs||4w-?g>9bB{-%W|(}X1dF_h!Z!PVOF`ldO>{SqiDKDvra%$Fl^a62Nw>~$hh$}mu&g7+r&e5_>&=ZAIyP$@ z1yesSG#Xj?|G^XAz?`Q#;IngrOGs{0j6KidqigqjIoR!eU#HBdno+ieB~kVH$LhfQ zv1*wB*=Awr*?E>KpNk|lYkf8;fml(_Jlba!6JjYI)A7f`*$;6wj<_E^s__f{O4#|P z7pqk^9>^BN_Lui4-6p0Bp~5+bvFT{oeQSBCGt+vjY}b!hS}0GAZz`HF0M63E_vwdt z$GyIi2E^~0NK`eK5~s(0SWAAOQDKzG=TdR0HpEUfQpCTvu27KO`f9Hsm?!m{r-<2i zkAY>mk&FU*7cO$dA4lXxY?bB=&)PhE!tkAnIYf1Q|6Z?`0_hhVA2jC(OXVHBBgsUW zR1&NEy6m$ISzG(5n7P@%mI=SXiTpF5OrHjLSW2Uw4TN#jeA+B=-@WG6<5P4L_ulSK z&#d40I`+UpwZ|Qq*s5BY!p@FL>azV7feH5!3Q-ErNww{rboW)Yl-a@B1_MvhOTw*f zr?L_v1MbCykITjHc$B+G$Nj<|3<^@JuL3iBJW{UeRm~xAu9Z{g@X#l`aFvZnN{a}N zrQXF#pECALE)|X?Z0j)oTjU)F(bmsxltk}Y_5W)9(tc*_g%%)rm(BH9Q0V{C zb~4C@nWlZ@DYLHhwdcx-f!E=e6{B7yTFQfbBJbJ+BW?w=FAfM5^)k6D!GiBDj)k6b zlo+A!>C%K)5uI6Yib-ec4vjonkC#HvRxYT1RCCh2n%e%bMh z!H_e%=kfxq;+&$UXPpYs~EMahRE4P?-ny3u5 z^9R`c^2#GolnzA2x1e+7oF?yZwVf&ba?xzj4QHVRAv}8{=$fJgY}X0mv|f{J@(~qF zz&2}S1ye9OCVnkg&@M#1-nYE%W0-a(M)pL8VyA8J_L?WQT8se4EgEMmd6fYk*7NNy zwW2QR`cVnLs;EigJ5JN^r-a<6EV`wv2X0?IKDYfKt8$m#yPunowLD{&tqs>qgv(f= zlc4i}jU$QeE0<4g*N9V(K8Svb&rr;@U;QIa?8-jD z;-g;vc`kv}%`!CJ(b33l^R{<8IF~?ITLK->1 z_72an@Z@CH;rN8Ax#o}QDf1~pq3F$q+x?e`J+r@!dw;J5kHxT9UI+xrr9NMr5#YY4 zF+0=O9vd)O4^}v#2q`*ek;#yKik}v7*7wKEVfjV&dL7XtX6Xk6?-Uz&Yl|OmrN{YS zFmfB&G&E;Rc}s>*E=93Ez@(^?*)!{vyQw+D3%KU=@@m ze^gw1lRcLmf*~u*>a3Gz)33-9n`hHqz_k=d&Jz;D$Wk#e9tx)`jNz&q7In-NKVq+C z`;7Ry>2o!S!#tUk z#^2i8Pt)J;e@V6mXX!r_ovV@^Ra1cZjBRBkc@@)=rF=a6T%=1pX8)!0HP5fVqxa-PwOg2 zLN<4-Bi>jzqW6?quvxoC7tM9YZdh5X74UPG9!MD6;h7azi+xHr60@o=V%j+!m5e_8 zfm=eZlIL0JV<%t4A0GqiHM2SzZm+!XoVgwanu`TxmFuk;Gwy5n6sB|PrVCAFs}=y= zL$yQ(Li@@6@6_NeIt}{+%XW2#+Q-rg^JDxQ)8Wr}e(4SQmGl@C*hn2ZJ6o0gOjzae zcHbn!vV5a=SDj7M5oUM%OjE9*_MinTGB;pWW6D@p#uW`gT3r zWzN)_P-Oevne$*?rY+9|jrp_iw7MS$jq2NLLFKfn@dM?l@O#+zXUpF8EENkBh(}qP z4)c!f1Ya|ps{U!W)ijM(k_i2T$6Uwp`dK>tfac`jb+71?mPE>xQhln3wWznJ=j~8y z&6T;vBCqXpgw83Pv2*#Rp<}4E8Z`2w2f{I3XV`DsBY14?G&;|pHq|9o3)wp;Sy%Y~+E&0zl%xY@@VgF(3myTymkm&E(s zDBh@F{Gh>0j$b*(lMWGjITt@rQhvGD7;Ix(=I&~o_}rNhr>M7JsEv0AJ*XxhN68(N#>qpoQvMrNO@E#Smbx7Zv`*_DK<#v%ECA_|&jp_-m(07gG zm71>70R_j3P!YMAU;)$2Xh z`r6DimUw=ly-s{VeFxMnN+Z?l$&)&Sb;Xchlp%Qqg{z|KG#{p( zlH6brPV7A3_9idLkZ`Q_G4s+m04B4Z)wTDt>gtKXd!?S4a`lO5?WX|(266`xF7PhVs?XYU!W` zz8+P6*8AX)gUL71zw*iP6TGSDz&lY75|7I-dTub1tr3ix1zCw{8z!nBezKq`7;d_( zD5jt6PfKm>aBr~Ims*x2+bof0nW*Cq=&f^czFh109bJuKQf7rBLEhOXlLm9Q8n?I#N9(X~ceTCI zj+EMkw32F- zEX>5KO&u-g>>B(=t&_GSFTMN6Qt7*g`eipo(Y<21oIjpMFGcsK+%gwUCt2$0;jD`w zF!nTf9RKmi=+G*yTzK1*Yd`%aA@o7QSn|8Qfb{xrTyPM=CyB7S_rYG+t_H?V|IMhWJ(7&kuTzzdgMCjHs1X&1jT>9Xe zGDxBUZ^uy=E@+obpHO$6c11p~C)hY5GrQ(t6>DL5SO`w2Va@>0Zx*VmhTv}ZMiK0sCzKsZ zMGa&fl6I-RII|8>p7yHg03$cf4GP!R(D{!m29V@sIlW2Qu)C+BRmHTxeQq2ExZsQ6 z?q53}?iap8{G81_{p;dBwKV8k-_e$enU!R8eH0~M8fP8}n;Y$6-X4<35wAD)b%@p7 zTP^3VgXWYv`WF6FFV-j=l30c5hLJz05o6&t$NduaWC*Q^jOEuSTaK^x-^HTItp%ph zMCa&fiZKr@TbJ1~HF8eLT3MjhZftPfasjuT{yL0ij`(|Z0&F&6K4{oasGVG}o0akQ zlYj2L!zWk8Y%jr&JfxzxQl82B+qM0rMRNqYOfKj*r?H?B2wt zFP*IgIbS?+o7j3@Y`}?AOn#U``clhTeux9xFU}m(DP14&19Q^`D!KS!H**Nv=!xsz z!{l(67U~7lRjpS!W-bnA|V!_p%XQwqMGm!2@Py z$CCVyyL-*En>VvB_b3g15G`&vz&8cG-@|P>vxh#MuaLpdC_iha;2MWCOC7IE+=wSiWX|Zn&R+C((UIa{?#fh+=?t)efwa`9a!>O`2F+h4a2*dyz|^pI7EB z-_2q2xZ$vDP8o3WcJGbzR2j!F#uMIf2BuH}Gwn-SQ&QF>k}t&U5Uj~>%;RY%_NF`u zW+TFboGK+Bl%=c8@X{Vw+AKM?-XyltBT#a8Gh8Cwye89hsGCp2vJjp_fffQc(VJ#$ zZeUnqkYKdnL=n>|JX3ro#~=L_1AQd(CqRLiY&pL08yHF?gE!cj{7BpVF{p@} z!@sIy0K|UsS|b0!;RuGE11nObtSqK|F7Z&a@i~0;YpZQF^Bvn;DHmH?LZ=m%BJyFB zEb^sqNWw9V>e4Eik7@eib3|Xj+@^D9=oZZCvA@z+iv`JbFLA*Xo_XVPsY%`;4y4t2 z*qIp~h_kI-Pt+-eb*x<F) zFwc>GLRyAP5-Gmdn*!lnI3egcUBv4+@;Eaj7$g?8I^=Tb?J&cFSc|spHZl7dx|5DkN-M+{uHkh@G^B*+Db?_Y zO1uy8YZCDJuC`<1f=w)AIh}b2(IVQqpy>XX5uuF^%=3s29h@FLezfN37A1}vzAvvM zVj!2d^dCCgMR{werFc2M3>uV(olJa0?rQ3edp(LcAkRb#lj_my29_6ctBPC-grRCC zvWy-J2F-fDE%EnXMajBa5%Q-8sakM8Us*DC+GV^Bx3Nk}dW=Q><%MuSqbYr#;w`tq z?bV~-Tpxw}ayGDts7^nWY6dl4NSkad2l(lprDtd_+!=lyu?jO5&NisI(m zJnP2igi-M8>=`|s^5m3EmM>=%uG^$Gi}32(l^ zATwb%!1DT1!Q{L(Xhpt~ytB{#go~dQ2Vno~9FLzFRfPZBk)!c4v0U zA&H_ISr)x>C=bMvR__(eB#Z z=BO7Q3Rein5%DgH!nlVeynVRA`!>p<*N`fkQ1BTrz}=R^nj`l(guIB+t2tW#5n1j| zLOTNmb6jkG5q)$nQ53o;P%gpl&9Tx>iKqDzuSgenwK4Q}MwH$?8;?ic+K*m*&6-s1 znpYt%@Wo-q5I{%#);6UL=bYP)EH+ISp}-TE%`>>;*B#9E8xalb67lUE7}hw7TXH|2 zGfvtPS?yy#8KRqamvxZ6Zq=#y%QoDASpMc6YNjt5{L1{Y{3`rmMJmdAf(=-7a%EZ6 zV#;#!ZzHpFA~)}6TzlHjP!E@usvFs(y%liXP%hj@AfHQJrS#=H|21N(m+Tqk@@(s{H|7{gkKOh>E_cYiO$sL;hpEhk2@>yCEp}DFwrL1 zcO;oGXT&HiPw%SLbJ3~Wy~xZR-VL%Bpw;wESQ8h_OfoTe&GlT9*}B3;Ts%vor>gI+ zC|$qe-mbEAb^`0zv=H;~cdu7L^?1tt1!Si_%y5Rj)yC(2Wm>{8)uh9!yj; z*tBq_wjYibhj$4|Hd@dQ2piIWni=?xK$;RK>_u8f1!dqb7B~BUeQWy_MDXEs^SQe~ zVCJh}^wi+ysOjb4MUe-W`{Tbh9t3?jRkwT3RmB!My+LdDEj`vtN_r-#|m=TlaqsKAZ=F^o+x$8TdO7wGky@@b) zf4JMuy!G(x@}E+7^)q{-Rv+gB>yh)RH7c3k>3{Y`;GSOFpGQn%P0rc_WiI*v_@CM1 zzD@(O-q!5X1;m#(s$~BBQW^;{61z}8N_G$4Dzwiw_uG?Lq`v5xrCP2F`nmZlsC)6C zO_{0k07u9B==%q${ycM7$437*j}I;CR_<^SX!YJeC+GX6q_Cu2r80$(<9#B6<^$+F z{P6gfbj=g7vquT>9VcI88p?%I+6_J(seiYp?0NRhdOFBn7&;Wyv1B5g^s&1acYnIV zsWoxPj-H;(g(1C2iJD~kDn#7RO?oHvBg8p8D zeX2+_(lqBA?+RSLU^9I0?NiYcw->v=;FA-n!@6l&r&P8y-_bU0p*NbdkL(J%@5Q1= z62%CTIeP8{h7$JJ6i15TVK$}KWxzEuG^g2yNd;av@2--W9g`A9tgfgS!ODnrdFlyA zrSGE9B(Tyo6Kkf zP8kbW30uU8q5~_}&vBUe!3q!e^-E-a9Uh14?~pum@z-4xK}co%da@f>S(3+{sRS!6 zhq!C^z)FD(o{T?OS*yoeMrOAen8Q0#LgwHJYHe2%yn)DtV*-Ss(X!VaGvnU@v+mSM zD&jvxX4|QQ8mu&llG-|e z6{cKLRb;vy_jb~|#2}?+l++ukkMorDAu{bxE+$zj4gxBaAS6Sk9g@01mLY&3M9=Dy z)y?XX-`7Iw7JE2r1%SE(0J%~+jyi`t@;szk!ZC6MP(Ypj4EYs zVNp_IBY6oZP1nE*?;#~GGSiV67S%P>*x*TXpxfa?AVu-OGeT^{*r>vA>QYFl0#Got z*16su2LkE13$%}tG5|S_Fv2=j1}cA~={;;zzmOX0_^1l6ff_6XsT{e$%77Ww93faK zcBR6{0xNaiRQpt5r8JJJ775v;Q7IzLDJ`LLM)J^9QW0T-Je+k@dT3xJw4SO14cWa} zS*D-n=n#l4?tkTO3TmWsM+f<~nyF-wHt}^+(IG{s_fyFug(iKX>OzjI!8}z8a?E~V zQ9C1BnOvu~Ml!b(Qdc3H`%+Pp5rG2ZSg9S6#vO@J-$XJ)#i=J)k*2&_W_Jp}gg`D? zz(M1!&=+h7GP5IT!w zUU&(uLGmQ$Lurufqr3?E35p!UyPd=Iix?0H7wl>}gJEQKZC%g}3{XT#AM`ygSTPxg zYJsBEkkx_J>;)pbzAb2*p>(wt>Q7&;mbn5Qch%?=9uRDuaJ z@{3ssi3-{Zirf;i6|&;z7qzmsw6qlvw7YF>X(PaIQzx$sQ$j;41Y+;OVvudYtbzbk z1$GPh1SZh~^i*Kd;IO<@fq@nmKKU% zTN`EwK9^|2?7)&t2WAhJK{_yNuw2rCJpfBdT~xbtUDWfDE=&ugE9;^9k);Py2A|jU zVA^0Qp${_xOF$o{29_)OFmX)-JqvaZ)n*B0>(OtVG ziUWi#P_qD9J}^8$+7JeActFz-0T~#epp+_Vd?5P@DF>0khO0&ghA{BB00h*042o{q+*;SsjPtPISw8WXavJ&1eZW2)5|}V5{R=P0|Mbk6#u-~xdAj|7%PBh z1fxc>icH*jWz2$L@PI&s|KUT_*d0);jz%zg(2N)(7#;dlJc>AE1S4kvRfTC&y-{^T zuydn9c>mR2A;lOb1vZp1Mp!y0j|<58!c zlq-XWYEa?_BL?o7pn7d&f`FFmub^}j80c$&a**0HhorIshX~#qpl$yI0EpiF%eGc# zd{FpJK-m-qx*fp86d^%G5lLkN+!gT&fVZY7YwAI$%;E~tGJ|0N7p5?9?*c?-2nZd4Wnjxh8K z1j6|*dnY8W+O-A32mupw)L^)pBSe0W`3J%Rh83VV{5CEwe~XST@-=iqoW2lx2n3w% ze_l*0BtUx+lrF^r2Kp?3+5#bTWcNQrY{19@1|B0o5QvO1kp2%lHqdHuwF*QJd1zT3 z5JF#~LBQ;T|Ga8}T??21aypdbUmV~wA|MUOUrexEq);eOZVAHzY%Q5^PSo4mO7ZhyxJ^kg-P@s%4Kr z;;{e{2N(r_2u>-0RQoH>xH1==!L$Z}1Ttbn82*upsPz+|_^0h*)JPlbm~rP8i6Ib< z1_(s(U#uJeu>(vV$&?qkC0UOLff$-YAbkH~dH{Gjpia&T2gH<`ky3#>9||OrQjq}X z4k+J(>xh5|7?2PfpyddoK<<>=L!qNt*bqn}!Xw}Qm(+H)E8a^sDk7lS5hbP{6jRA} z1ra-4iE-(x_JASQ=94J2zm5T8K`Ovgkm}a|azXFZlD*;x5dmk*-@7 zC)7}{J0UdZxn4oM&ZsS?>I~ZBjid?!na(J0`5vSe#v!S40Fety0;3CpYMyo_AtQ~7 z6!3F_;UmYPwK*UbinwU7GD09i{~CwFlB)*9T8NW%>Ppr+D2u%E3gUHzA^ow6D}u^W zM+I2wVDJH{t|-05AT_X_3P`G_5&{0WqDGRy4MCM@ypo{n1|vlpg8pJ~@&{r_UcP`#koxo! z6)@_7*n14Rh;d$XM>RMBA)WavC_oo+Br1Bqh>%CP3Tu}#6XL$&ix{bYZ(^H;k20l)enQ~|6#=hc06FD$mI<*j6>ZKUgeqE-zR7@aKjS@ zUIqXoPsDEXM64%J)BmKKy$<9fx{B2Kw)H239gzyRxccv-CyMnyjgW!PbuWaZT@e)V zlRo00RrI#^|)u}QIF{toZ5zoS@X&T*~-$-XcmrnolygO`0I6~jH2;Ybae?zIh`dqln1Z&^-X>KTKgCTk+ckmwU4un_E%VVivh)thzgMldJzgt z+y(N}fl(n5@D;%i&h0LOf?m+~9|Rfb;R8}3C|Dx|0UM0}7n~4++Dkl4}XV^7H=%BO*2;p!^DM2jRN)e_+14L;IUKP?WAI?8>(H}&3T&Va58?6Ohoh#W z1;h`i{=o_P|Bn&XsHnMhgox4noBuxgTv)G~hR%><06DCP19Qd+CE6nbA^M%j6^@7; z@%~pd9kH45j1qB9_Od}BbpM<+h*~_b7y$!6cm(hxVRUHo07oQ@3F%$H&s|#4AdoG@ uOlbeB%@W`g3FDFa|9u?8>*4KcW9^}(iitSLA&>&ZzdA&)L8t;lJpDi6tR(LM diff --git a/binaries/Tizen.NET.Private.4.0.0-preview1-00050.symbols.nupkg b/binaries/Tizen.NET.Private.4.0.0-preview1-00051.symbols.nupkg similarity index 97% rename from binaries/Tizen.NET.Private.4.0.0-preview1-00050.symbols.nupkg rename to binaries/Tizen.NET.Private.4.0.0-preview1-00051.symbols.nupkg index be08dbc7951f115415d249750f78949ffa043de0..d41a4c0beaacb3d1080bde68552d7d3a9b8232e1 100644 GIT binary patch delta 38015 zcmY(K1yCJLu(pGf;O_43?(XjH?(Qt^?he5vxO?#699#k9 z_x71NHM6rjwa-CGVAmf9pezRgiT>%+C)iJpKFD%Ge*%>-!9IO@|2W`2tVXUD_HIm! z|1>>WK@NfiIpQMZon&uI!INtf>9~yw$xwXaEtn+RK6DyJMt9N3>H8N3(j%8FAHuE7 zwX?0WJH05eH4cqcnZZ02`xBRP^a ziH2Yi9o~6Kxc+EI!>4NuOml=og4h*A-EUz(y~ke&FC&+5aRRP+wdOZs8%pUWa@e-m z;AX7lvr}+(LVSwtIf;&{563!vqYvP5=)7dXC@7R{i=RF1JC06TH655DOp3x@Ii~t) zSz~d~&5h@!)bzu(kFpTTYbv+h2faB_0jn%*+;C#3LoP~UP@jt%X;I=`HBm~a6<1Hu1q2Vyae9jB^+F#(~Mof&6I8LBOaa;sv-pXHha zup|gKWG!Ttet52Pov__1AHm&Wkn*iBra}7Syl)G=Gne%D2j0X+8m6M~)7o+B$i&74 zCAVpoZ<>o)Unj0f+}$I1i3VaYBt_x1w_~tb5RzNYh9-62# zr~9a&U&zfU+J=lE^PV<#VF)0WQ}7|MdfTOm&nTLjo}2&TV7H0By>w6}yq66TS(W|F z2ut?WHf)sptj72Hly0ri2$uqMM6w;i|&+Sw#{x*&VVAX-mP^ zxdCO;)NYYuYc_K2hcikT22ryBB_2JiQf-?}FQG)O*GCycZidd5TY|O79DB3%X?fC4 zFi0WM={2F}Yt6Nj#_QXTufCA~`>zdEf@oKQ0K2ROcl2o&X#{KM`Ug)(U;&K(zy}L_ zl^pTk5L$kMx?|+{7&}>+AVh4UOy#ebu$l2ym@w_}{NQ{X|C}dWz)R5ofl~x{FUCJ$ z%mepF`v>3Z!3P}vt0I61Q~3vXjt~w1RaJyQ*zo_Cg0G)GB8KfFMObD(A(mvjc|SxZ z+dtpeYls8Bf3VL8ss3LOpC}{-@_#|}AOvekq>mu#OlN5<_VyH2NHwH?zK14|`d|Km zggxXu%0Ivfgsdd_FUZ?)GolLrBS<>aMGs4`9ia%a4ga6ZNDt&K?my^Wfs`lu2cI7x z^=$rur7;u%{67e{hf4adbyy)#$dvyqG?h?u|5=`Up)v*k%OF7{vwTDLk-<1qMG~H< zz5fLYl^p3`N9H%Hm(nAA)DVBlH0i=2Y=0w$7C`uS839Js*Ny?(1rKv?mm}Mf6WmsJ-QH5hfhGV|8 zNl0LwcD1$sT1OUXtgT%21W5#IcrAIXG}RHj)-rnvb9_tWa-;TRDZA=s4@>&r{OBODmf8R|DE0$tI8s{yS)6q$}$||zC4&iW`6vAN}@}YnE;t+R5>XY2}KOa8Dy+c>q zJ%e#yvnW)!C!b7wS6^C2(`&7@Vib0*g5Fgo)KgmIbxC5wzaK=^0#Hp6Jj=HLFzGJ~ z`ViTLGycU}BBhiZ@2ykGRSa0>2Mqe&8&w$-hVJ<#icQm9TlA)fRGE^4;XjR}&vwP& zc%KYoSiZu`V6+m*9Cf169EHUFU=WXe%9D_hPa$n&Xjc-MidLWSYi=B!7MmA`Ym~7~ z@gyAyh63r~7t>O>$m9$+RS#7HClkqUxbzDo1A%z-FP!A7PPoqul&emmYeJ!7FPveI zVj(Y_z1x4IMFR2gx17X$Z}eo6wxQpB`w`eFUL2-E>5$N%ye_3v2ulfBNpUHTr0D?`Yhh)( zc$^r`O>CCZBAA*L#V7y1U{cH}Iz7p{1dvc@mfXqLH|jl3Bh8!wPuqu2&bW;t&aXQr@;X4OcD) zn7z~!-F$wZ>`T_i1=BLd--%`bU1AqtJNP@cRGrSva%M__@jcP3v?Isg8zc<(K`E71 z+mUKs3MfoDBJe_|cTgtRh#PEUns-*aFrjeExG*5iH|w1$%vKT$bR!5PGxpGNFIVWE z$&o$dh61;N%Qai$BECX!ZAu0!neH4=$GG;V3M;q729pi~?ssGc(;{7e&NQ?XlIr+8 z4A7_c09iGQ9Lj}0)^jSgY8eqDk_hI|xQ5ybCOJ0qbs=rrpd?&sIhY@5S2#4A*wbxk zj_`)LMD@=1fAn`2)-k|5ToE>dVC?l&%4@z%27pU}GFO*isKA0VmSNC=0%;K=b8(E} z(yq&BC!PNK}sGh7; zzlWX*?cZ>_GvsX6Gt_Kc&vMboBWT&WL~) zP{C{)(~6m6oM@l?5#ig;IbD0!(jV5$5+ldLp z0di*U0g0xJZiQ6<)8t&mAaWj`;yM%ly@*q$<~o~$^Fj2ys2}C%?v{%d=$u4NWI3hk zV+G0k(g_E6?#{~nWqV>k{cg+)V~3?g^hy=+P7~jb^wi-^eGpS4`JU`!gekQ?rn=<6 z?ZPhQHvN@GHFVE@J4ic}B@;)@%um|ek2P>1^~zakG*$q>c|RG?!dMA)(Nr33BaCz7 zK!jf5&lzOt8*9`?ujKUPPwbq=CNo3&Q*KjN(6C$f<4-@zn5_U|i9=48XDXr5Ntc^7 zzEgz@{_nJ1X|uFov$V=nxx0ekGcPg?EW!@_$SQpq(wx8M zEjB_9EhVOat-s#%++pT(_>HB73>l-ox@pvfnkx$95v>QTRUmK)?)S{LM&*{qW&JaF zgW^VtViucW){`f*-kg@YNSQDde*>iR(?D6j(CRvY%n0G5fw>uNrBzjB0)63tQAZK} z>GW21?T)nV$RP|g9c|(~g;{a35u2uA&$3lWD# zm9Dl&ZIaGytYPOCGF-91gz|lD_-qY zOtdsWTwn5!sh7+uC&LsCBZ(xzmHhIiKc&AGi0C$CCi=M21#-=^$4Z@i8v+b_%GM0L zvUDBBOHG5!>fwSLyZbN<$xbb%Z@m_*9KWz_12m1Nhock;(56#SH_G~t;K zp!P%Y+UnAJMl^;H^rKDTCG}Q3!&aZ7tg@S>dN1zJ9X|!1(4YyyEWBaxdx!RULw|}W zg*wJF0X_8RD}b^vG|j60aK+lHYc#VTOFyr zl3&LqDy_W&??W~;79X_4tr+7$tppa$s%ksKBBRPG(Ib~5w-JX_>k7zSnciOw^37H|tA8&noR)OgGB1+^N zXmSH1UYeZB@&i*f=`n6&b7aTU>oWz)Y5R}K%@NjK@p8Sm)ghG#^m)Dp{!uS@01r!w z4q@!nB%p`0v?RTIK6LC9nWcVKcp)-o*Hn;U1OGH*^1xy+Z_=VWbNu%D7u~TYNvlGJ zWBM_toIK2$k6y&mjFbo8*u7LL_-p9-&n=-v#VWTpe5K`1=b*0(2fpGze@A{!CqjZX z#8XHg+NGa%2FuUBnvvMe0J37d7@ZkJJ?jL7^c1{msm7D5?O2+gzO?8w#9YOT zbG-2iQrp%cwvgO~rSwbP?YP=7$*cFuHT>|Sot|6>Q?AB3>>{vJB&;N20aOJQGW!S9 zq+)x&)Z28ObI^8u5*r~5rqc^My=Cr^G4Ylgx-1X-osSZs#pG`p%5v1q4&bJeYD_;c zmF!E!()>^->vddL!L`OH_L@Z0LQ8>+y7gs_kEZt>n@Q}5Q-oK4oum;UGKjV-FQK0H z!se@O5@Ofw++!epH#I1BiVBOj*ubf&%YXZ#OZY+#125pNe>PC*3?muE<*J30o1nEJ(8GAPbP6>jPm>Vj3aZXAZ zU-^p_yT3tgG+Uk014}ZI`X}WI*rzR>nkFJ)b{yIIaj8_KOCIemmhcW%C0jEmXGxv~ zUmU0^F?dnx8(ZA!@$bhZ;BD(*sv@TElJ+hr1rvThZL$&;%;6~g2#^f@>RNl3exMvD zBiqoce&%YUvbt6HSMtVqYu^1U6M!e>)AP>L!Lpz&*yy7)o3)=cFAZRPCy$AqqN z_nyL=W-m??w<0EWnu-vGF~y5%GDuOm5(&6jsXT)sO}1VZ82Qse2}y)nn685IeRu zE*KWR#9B)kB-RwQ*qQL7I6&WhQP-Wm^2o_mDL|#1DS8sdZ0YXHJZ}gSi+?&vPL~o_ zIva4iDf4E@r&y}`{Zf%6hdY^9#tPdI2yT51@97&j0q#D}pQ5dviW@|RuUtql^%M8V zf0oiVAu@lHV5V_-HTaS8fFyUZV9rY`s(9~y?$&iaE7LDj&sKmni$(9!lDm5(t&C3q zhb1M|A*H@2G`3zM(Y+sQ0T#)#%Z{ou6 zdHzwr8hC!3%ktXscSj)%SIy2fgY}k`bT*L!IZ z@#|G~T516Upj_(N4hX>4;7O=rscNip!4;5^Q%$w6BeK3zn%5t*>7rN)zVYNKIb@%eR{T>; z*3+KA%DzC>9{q~uxH^l6L#i-|GZa^li?{OVZVhXILV10zmoI;`nm*N&erJY~^(tn< zq>iute2pz9F{Ml+ear1JSUYa+u$0kTR*(ZLwtJw<(QBFCI&s1=t(^S(4;F?5Wz?($B#BBxT#_i{# z-{{Usxt(jG`Uj-?ELn7Os;OkoRlAa85+y3dAZrli42B~ci)hPQoh74O(6FifjDk%| z&RP&nf__d5l|)@lk5`n6tHC%}Je%aGLXXC%N4kov#ghTzu24eAfh`XXkOx_pOkD8Y ziCmhv!5~B&d_^`%{1s-VRQ)f9W|LU#`Bh{Qog=IiNM*V6jssurERXKw z9LuwF3v{d__y!7h(6gl1O6&&iSyIDbC&<)30nX!sV2 zwUYBojsCg*(<#zHW1c0>q&s1%JC7(%9P2F#uUHyf-+RxmD{cuQq$^~gQgpWIVZM1) zbmAIJnJ(taz-%bx7td#{Pp_eZ=>g&7|859 zY{|`jA!LJwE;)|XW?pwnFL>VRT3HpN@4>(lx}DsRwSAoshD|kJ`x?vc8^(DLvlZ@E zQ-u6r8m^dg!{@ETJ{kzye_=8r7+9oJy0-xn5ben{Db>vdq;B>ZJU*p<|5)~LBTVQ9 z$V(&Lh^g2^6RhT_C)`Yb(VxnOFR@2S&o)8^(Vp;Tu`0N z<4(UxzQ~UOO6faD5|^g3F5Kq$Ug z3GbR&nnoet^iJsOKu?-sOva>rY?8!{?DG$QXw>m-0#%jQT8&8lLS_T{)X{glWB3P@ z3U0WLNZC_+mA-HVY8&&15!#%8*;IxFbvN^0Yc!om;mQ*(R}|0|RL{B9o4`iK2pB%h z;NH)awNgh?rGZOwf zlkWhA1vqfk@gVO`hP#Ey5-2pPD{Fg8EHIi`J`A?`DNPDJIU-TMN9SC z;TrQhs34KfN;eK&5&5vD?5WSxe^_zrCPOXvqzeUo-Rh>`TeIZ7xrzR_UG6#ME7*c^ zayMF-ktdZ!R8GO4_Wba6;?%M3&U<-E2TBWnae&^M_!+2Lbh(i?o-Fr;6{}G{1f2F; zdE&%-vNz|M10sp%gcobo>FEoz2g6TK?X%>$PRRt5O=9#-SSj|6@94G;`pR~D{a6iw zVEJMpTMb^A*K&%}-UE+>Y)@-#zkF*WdJKrl`V9`7y8wzcV>vn^8bP7In5XLuMug7k zjesx48@Y7*9ck0#ayx&t(EjIxd%D@=CS6C7QuD}(-?lAKfB(9$z(4}l3Qi^Xx1)WjZB(fr&-F=c9MHSJ*t8DbMa;=3FOljx~PNP^Rzq1s^wV_`<_*Sua>W{X8 z{lJ*NW6ysti6PZ^SIfg|@`P^HZ7)cv?C>H;4)+f44)Mihm{sJYCQvM#jSYkb+RJ?+ zV@rOr7hs8x(7r=9YW!Y4RxhtB8}^`pdJN1|IfB6?27;i6S@0N>k zvt|${xB}WgjLi%?f}x}oQZhL~5oqm*_~wz56}hn!C*XeF?2RcFjGO+Z5JqA3n2nGib<##!-|MVAi;o&MJNe%C^wT0_hW(RreE3fk}H_YY1xaW}ztV4MtZG~KsOUbp^0ocWpFuC^d8yqL_!oTbdqyTeuhjGME`Vzr@$jDP33|c6W@Vph zDB7R4m8GKLA_Ja}e~ZbhfuP_*?v_ZNi>+5jnK6JV{;1VPy{5U8Z3C=ZwSLm;`;Cpb z(zzeO^##q@)F>uK@j~{DmSBwYV6F7Ivk|Au%WIV2E_u#)PKE2{Tj%ic5GOEJ8)pi~ z(SM%bEgXJ194AM^Qo8jL<84+m@fq*>TIF11zp2cJk1P73L!Am)CRQ+|6r%Q| zQoEuS^)5pL!h-g+tO#A`Z2$3jW3`%(HL8DNDO&)!@9Z6US%5Frmf%2lXfk?chU$sr z6i9r=sP(Y48WQW=I@9;|77n(IbkOI8qDhclYnVCn?;znq@$>qkr#D-cFOSw(F~Uq+ zO$uQX2qmB!!Swhr$Ro<)E;Lv=C@jP}PpybtRvAWmLeFwlx1hkRt^_;h_jSo7s#9= zjfQrELqJ7PAlpkmQt}DYoO9|VlbxVijEVZzSCx0BPX_XPg~}O!#hbLSA}em<>p0`L z-fOBrg>}fNj1_QU`DQ*IsdKG*>AE(i6ULZY8A`zv+Ke4<*@6MC?<54Qbc1WUto3(n zrAJks{R9u5u|!W-II?|Gg!4-~FC{cUz%!ThGvbg2h5^=`w@xyMt)meaqo-cRObFMo4 z$c(Vj4<*@R620jROk5psV)lCg`-@P*r9A0yiTsk$%0F82i2M`sHW&P&t8%LZ^*rs! z^Usg~1# z))K}<`M1G!3%OH*co#Rq%DRhd`r(b&Y`hur_@{MzhQ~g zj9Oc?LB*>b(4bHQ#~MdY(elc+>9D*iI|$b#S>F~}Z1KtGjwdX`m$9n3baY0oeWHbH z2^TeEpIeQ~M(d**d}rVvVo;~$V)bQEE6UYzweL*o$)7YW+Y8mdR}Z1~ z(*_|E$Y30OP7_x$N69HaGn4sAiaf1usND4H<;bTa!4Rbv_+(QRdQE^hp|tmsIOXN~ zhJLV(?Qp#v^M*7JNB|C(Filf|2VC5J2lF&BhQ30})#rZ-K?M0whmuaBIZ48gT2Fb2 z?96{nOZDa%#hxPn);BDhjA3N;FD2V9-1NtG((77Fhk4v9NY5Id%=SPZ*M`>m z&C4Wvi6eyq&t?~~Z5!{E4l#y{0WNEdr5o9f7QT*{Ai1nS42fH`^6a(lINi@ahh(p0 z3tnVVf;>q_3%Hk;K*t&w~un=4bt|4Qh)#-hc~WeeyEwr7-5Bi79ccL!1s z1TJV`ipPu^gtrsrX;NkQ5Y(2-adyzvt%C#t*7n77U8CL{nL!d_Ud@EXj`SQHXBG&4 zIzxub4VnKJYwnv0dLs&4be_j+aGnunJXB`MHY3yz-6;r#d6SP<;~=1ku8~}6KsA%m zhDjeU#PExSBvB1;72M0ui4zGxRrEf-_$t7O2pOm2R7s_?MQ<>$m@9JIpB+b!W~^+K=bWRN~XTbBwbn*yg4^&S$*TTNEYJT2QSI4#boToD@`v_@`WZ( zSmjJ?0x_9+7cdk+I6IsiToUHZi^pgR5*K%rqghuJ&(Lm^VA=CLx~`t9scjNKZwaY` zA(l633fYgz)7hA2G?gdfVp&C2p3ur5!Anv;Fu%ZS-`E0VS?fyXTl7?W_e3GilKJ}S zq^opoZ^h*qSWH77uJ!2d;cG?P;(|g^#LajL2W~~n?Q{-)ixxXIOc{IujZ78tq#eOX zh-aFw;671NbFkaef%YiGmTPT0_!zO*4nYm*#>hpd%p_lC`$m&t)P>kx+V)`8B~s34?!CYu z-XvI#c~Fw(>%Opi68>WRbyA+roO`5)vWeXuz#g+j9$(x`9>X5nHtM=L8-Y@2Uw1wu zk-h$hzVznkku#6Tqr?+-rG+>8&tl!^8v|OUQ{Wq*0j0_2i&;R|GxK#I6}1YO*{w$C zOFO!cv%8`UG|8B|_P!?>f!3pVvRYe0#Iv7e^;rMaN3T{v&^N>CAt`FoR>g*TZwbdB zJ3~T&T99ci|Fo1K&7I|N5*LQltdI{!;3alzsA9v+fyw3FH68ccaxWFphJu?2=(*bph@*xC2nqb#LcSoSr= zZz7J)TWwt$e52M3N&Pv8?U_Dj?B|?Q1Upr(5pK;d4 zKp0|o%Ru5$*H_|X8LXWUZ%KYYc1e5_;%nRnrL`(ybGyf@kQVm27vkp`*#pzi}O>vuzPcgu~$n%4muQ1jJ_C?K7F)H4i2 z@M=;dUIHT&LakM-Q>8>qYuQ3WOZ7%0P8NHMSs=l#C%c9EkYYwmpClb0D1`%CftONm zl08eB{n<*c1zGP$m>YoOaH^N{&RI+lR~OwSaBU!d+mJk`7IisHpUieGCdGM{X$@P9 zpQS@OSJcCVA8HaT?5y;*5``+;3AM^`<}ilLtyHY@vBh$vD#;e{xg`bUDXBH+CAOGF zaw(dfP;448NM-SaJuX8lD24d$MShIV6i_ku?TIqA`n&s*7f|zf$;Qfon8~6`M-VxLEpW%z5Qe zp9U>7Y^}QZ`o*&>m|Ssxy&=0jl&{RJWN*h%X%FXUz@v+uQ<_=vh!q z*t}XJQz2xS3~s-O{)w8HD@2Aw9G1l)#lhHAICpe{rGw<6SI^p(zID2_&%Ff8jq$s8 z^WCGfaZl8;T5-*)jaWQHK3(O8v7InWZztpducALkC=;T=n? z2f7y=FglMaolorkHsd2Vg_=bPs+sXKRSac}w&W&C(D{N#{zU5JHH9-LFwpXikTH)~ zmx$fiNM7J9$=dj>4;$$x6-Yzp*;I2dFj{b86Uz+~Kjmmw@WU`bh1zPm=KIUYbyP6# zH$QUo=W^EdALkC7zT#J%I0y3Rcbw@xgv~errXsqhVQK*Tfxosz5t12W7y;^L%B#;5 z#bv8_NlAZVCwvO!u|UY`B*~<3a-*I}maxi_%T=QmcCA&~g-U(URjT`>s%d=)T)c0n zX?-vO^hEqC!cRu>5?t9B)ApfW)cj2CgrmebP6>snT$>FA# zt`LtGqXV&zLmB*i6NaTtuGwnD(5YyD?Z(s#+xqwS-II7pqUAltnAT!8QzzEBt}}_o zcAYt#Mz0{=Y=?pS9J7lEk+?TPh4WW1#nhhjBWsm2 zGG<*;+gF!W%OZ(Jr9lL6iPR;f0S64g*NM-xFeDOkaADoWLx`UQRI3YFw>~TDPL&}5 z!6fHS^l^&BjwZO*iOMELKJS|qO%QKk6M{>{F+jW1_R%_Xng zrn%^NLVb}eu4pFvMX^c)5}Hh?VHzSpeXXDeH;j0uD1Pe&_k#*?+U+tk3I>MMC}uf+7$pqHjV>>}5N+w0xc$Yls&C0KE_4>i-o3#El;;XOeW6t1dcMS9|Ih~x?}}3ff6Ql&Zya;&joSmjBlP@E zU{DP_Iu^`?BE((%LYe{eM0Bib+br{WoJOB{3&Pe6Lv*a#d^MDA3M&hv4355o?xqw^ zyY2;Ou>*a7$Ck}kHI0rOH^)_9L8UI$nyf^xW_qifI>0igS3yPB>O(c!W){!$Ffyyp z*yoBn;4Pl%7f$F$SoBtP@_|M4%-Rmi(*SLp%#x{$BkP^64t|Rf`(`AliG}7nLHh(c zb;Goywr{((U#~xA-aC?8t&dwA#qE}TvsCzm5JeZw73$*kzI`(gF8hH0p%aZfmhUlX ztGK;V8#^&+3>=n;vT2(fzC?A2bQ)W=EVYbUeKnxkJ~GFS;u#FUTI;$u%JeX&7D>x; zmP3!I&OXPkO;B`=Ma#)a>nH4fWT)jRSvtloN)3N=qH5d6*utCl8i`l6%p+B9AyDd{ z;HijOe%E~Q{%LJdBYrjVj4VK|qI<;_g(!RL1M2HwnE)uB+KzC*>%tVL+zt=C`0-7T|9{sjF)tNlI2ci9b!-+@tRIWo>`Swj%#$;md%8Q>NU4Hx00If ziF=Ka+Rup$UbYmxv`vo#X)bD_rRYatmAOiPHL9nElD(w)A4DG3KSL&~O03fJXS6HE zgje`t^XcGQrg>)8FxBffRhib-Oscp>j*+U{b5sB>{p@TN&e_gU;YJIOnO5k*n@YF* z;F#2$JUn=Hp^l|Bha#5ypc{RNUex|YpMv1FvO13fr=qASg&8;mcB&iKLre$-0{8SA zRR{-M_fEIm;6Du)?uI5saI&7f_3U#S7D!|I6d;al_tVaGVSuJ<+9#gG$8N%4<{Ubv zZ3W=*!v0}oc-S)_JS3OF>%=}s(^fW<4{a;Gz2CDYOmLjY=fpAh?KbGf69R!@^{{71 zmvlyKEl7DvI7fh+LzP?qh}FBh;D>GDG;bE?=+9ozjSoa` z4!ZN(xG)Z1CeXT&)dl@@e^08uM4E`;|(@G|NqDR?xK(526zsJfVJW(Yc` zz;*bsF4%AoGXeLgU^wXJ0=f%I@9&)OgB5{GpuHrR?c=cUim~52=bWki1sjAwGT=S@ z7#{qV0e5ADOU?5bbz=w78-27<)cM$J;ix%^-##^c<_Qa?CO2y`qKs@{P}LESS>L_ZpxW zVJvRgicM~#cI{Z<9w`q-{9P-z(AG2~mR`pfniU3cIw;=In=c@kycm^DKL1uwP7i+$ z&{;Dl$O71|q&;|s;dRgBR>@db( zhaZaPTF;y<7z37coKDx42L#pa)Jd06%ha{@yL|P? zOPHlvoz<0_r&R|~c(KyaHU)^Ys+EsRUn&?U5)WPm`6tk*xB-M$U<>WmB6|vcr{0~C z-1^eNS2P6SeuRo#JZQQg$r$G8X8#?S_~xD>@5s0hXo=nyn=eFK8iso9++C@fD19AA z2{gp7P)qkXF>}$3&c=Ew+|jw`U0}PJ@|37ebIm{D6wgrEQc+|u6k^67gO1c5!g3Ly z@N;z^|CH$Zc{ZUQm>+7FOF5Z6`s~oiwIS*UO5AwT^O^0un>U(OCI&nnaLjGGUArEmHwv~fwjZpQVE0>{pv zhGHzm?_S!v`8xdNXSy3K4Uk(LEyibX`6j`aX)pon6eU=<+on1CniiO924RJ1qc`Rm zsE2D9x>Qh*=Zvd3TdYF2&mmI5zoSaEKk|b5I5S`wsMeCLB+q=4S^jx?v5QTvMG-`? z2laZa`rGX{oybU_?PmC)>$cXa^bqqhau@gy9Zk~%IeLE-A#$68C4lhpxmh8bXp*`O zZUHDTb0}jLU`G;pOwEKZ#JaX!?K`zA$;!3doWlrOCdI3lKykK2sr{5M@q4-0$Wl*< z&ri=`rlrNAj0-|w)q|!rO9n6PLet?wdS2Xa7z@(&PKD|1f)=Jzoga# zFUftac>U;tnx6xiQ(&-EKnXME)>vT)GuD;sOEh#>6(wnWP+;Dy=t+=?uv5_(bFH!N z^euY1Tvk_h8?!*{G465$g3TBG$w#eh$GyXXG3^7g@@-Zll_*Iz53+ptp~u|k-!Idz zk{LKiOqq4!Px>ZQ>MngTH@hMpj-&jb_?H5cT-IuHs=OJalfoGz;DqZc^GV@FB9IQK z+MX~vf%%*J{OJbbr7SS0f6-{{X{GV)h8rL}Tydd0WZ4|>@VZ=i;rna%M)1P%j`)`I zu36_nx6+lq@74Ii_|^yHUa#!XrRAmtKW?ON)Ai$dr@Ep&Tv6_q{5+p{m6h8$mmW($ z*C5nrL-dzfL%6*Kyt#S|d|_=|pZK(OGXlGt3hmA#_0H>Qp3~GK0?U#P&?cC}{hz@X z0w&D%Iqw+ui*M;Y3a{x8WGJ-=;Q8_`Y)KZ(WG$cI@5uIvuH2SpJC`Lp_#xx01yf{bG?eI(~6U~TVE z9mKY^vL($j6dR11B}-h-_8K>7W)rQe%js8qowpCRLg~8rqd8;LN@;H*0`RvQk{oW; zYX$TfkG`kkFpXz5g7VLB)pJ_auW8oLiMl{|pW*rJ?DaF< zErOkpMTApFUeA%`!{Ck^KZn`S+`mU{Zrzfp|=Qi zez1hXzSxA4zUZE00YvvCuVHopqpf{=xArx^VwBN zGXr0a-Dygj)9erqbxS&zz3Vu#?KE6!arEstS8~Q$F{x)s1@ccBce@nyy`WYc_PYr5 zxxRYPcU3S$NTd%=q*;0Yeg1<12y~Oe_nKIt- zd1RdP9%E!*VAKDCXkAbj*R;Jlx^Rx+?^sHkm)?o%g^Me=29^Xi%kdHO?cz-H7x%}V)Nl*Sd$<(g8DH`m+ED?CHa%%7slCBC*w z&*?HC9tSdfKEBb#orll`N?}^*OP#ENPH7|?C}||SGU@FVN#a*!yx3bb2h{o57TQuH z+a>9KkZsai(Gn??9)W7E1I;|O9>l!19@{*m9^JfPTXWKVs|U%slU^+Q!g9QOg9Dpt z=DBHUc-v%h#(JG7?@v#Lc~Bc(azguNha(SP)g87CJoW{kX+Xm5aynLzAZi5{0eg%-sY6#*qZ!a z-<15`zVYMzndhDV5NVZhG%GA>S4FWwLO#w@R9#$;{hmE!B?GqlG=_M55H_a8WU5Ly z2g>eu^xFt>sGT|s`B3NQk&lm8Gl{2z`I0fehswiHqV%$7A6*HG&&pFgDdK{%U$t3# zu_sK3ZSi2>k~IfqOPh^3=5<#iZrM9fY{))lSKWbHtq>wTBguXVyx*3JWNuyA&B;8u zSsqCr8FEdQLJ-Ii)X5RLX$K0$x zX1-~UW86rz`xxoh*?F@&FXl5^&Rf&&RBrdI0u$)$#W|jzTPu?_@Us7yzbWKxPd*0Z z2~GGkpiDO!AkE(QhaVdroHaMXACiPvQ!Y%v;!ZoxT$p!d9;=jJtW|kLm3HZp+f45H zQygZx^yMD!Q5W+d?r8A>mCFo>JN(n?u|BwDqb;_l%|SQ#LUH$Tx>0 zf(eV5QZEB8!`b*_DK5ho2QP}{e%XJl#vgR%56H8}6%)|P4|%HGsSceyQl<=NF096@ zy=fg{4n23HAwKV+>49Id@d$AT%hsS)y6X%wTnfME%hRFCB<3CilI71?gl5&`DAT50 zsmFWfZ8253G^MPCHc$%|@|*JA*?-XU*bkUDf4EaEd~}mVSK>#D#vsopGj4Zv<(*8c zOPd|!=|1j`j^@5-3jy+pEE=rZ1vXG>Tni=gUxj9I%Tpx+Kiz!n!x7I|u@)Yim-98R zx|U02i*imf=hFk$h|giijbG`rm0A!PgJFL2{H60pI-X!JGvv|gRQLHbTfa?<$RToG zgQyI*#BxI3Dl4F&u+r2*q8rSqn_E0RmtkGgI=#NXPShgRg4LqcveG)V9=YD%!qft( zm*LP;I~vi=eLJ@CQ}}Iz=sk*@mm}pZX#4=I!&8)Fq4nco1SPzlOfC3N2=3c#gqL(4 zqjv0@y&`_WrSbmD_QOH&Q7XMwXhw|*P-Tb9rI!tp~V$ZJf(8%aNc&I*Da`biId@(Q?p zko_}9IGlS3FrK57&RVFwow80)?JEZ=@b2eB&=_gRKHi$AZf9IW&ey0Gu>MW7L=j4U z|>CAmqV&zmiGc=#3txXU88dRVqGkYwHP$h{@)OV7yx zW4;H&JS_b^rApxArDP71ljhk2()IY>#Dd&Fq-Rio_kTrNJ&kgIj{|~QH`Zm@n zg5*4r|H)1RN4nYMlfd}UTKP`iq$n>W%Bw;-i7+7HNI1u;E$v)J>1t83un|8omIZVFa2&?N}C5Emu!e| zCtVN0HGg{LUpk0*8~=stx4+ge%Tn5(;0)40;vpr}AMxrPgI0uNh!-yv!Vm6Ef1{lc zlh){Ie`0xuRK>VAe*VHA4XB6ruJ(Ol`i{Hz^112@(@wO^fZn<8R6pb?%R8$ohM~wQ zde31&=%bbi*@2N*_28-Zf$G&kH_macGuXV)kc9Mm$Z30s*Kavy0FrU!MWvJ$zog$6 z9QbgRYCt%)a;BIkYTUlv`NM^7Fwu&xGI57aGJ$}OG2xUvO2?&w4^P`ptf1~FmQ(tY zU@G<~FcRU4H4@~CG!k?Tlj)5B%K|htAw6P9Yh+dP$Gdl3!_VVPxJlQfV^Kq=VI>Pz z^@QE>>|?}%?3lq12hlxX6aHUeUjbEB^SynM?(XKIbR!@kp@agG(t@CrN(mxhToeJ3 zGLS<_h?KN+ND2s&(%mgc2nYgxbMEE;`pWNJ>pM%=9QLzk&z{=z%p4Z8&8qRsIv8b0 z8)7y@>2Qz`mR!L$>s%u?;&-?&ClkS)qQQ5$<#oeF=!2T~rCr1I%>Hzg;qPpIvxvy7 z-kZiZ?-k~r*4@s?w)Hx5Io@dA6}1<#r^b@fk&*mMckgkzn`ny2dwVs5y_b91@+rCL z!C!eFT-Huf97?LpF>>2WEpJj=wCW*0^FZ@s{Uzjv@z!Iii{pCZ!pT3L$~Ij{C}%Mk z7kc|cVXK+OXJPLVlS|qU_NAfQ7Zvq+B6at4?r5J)`K`Z`Vz8I7C!Cg$+3&Vz!oJmW z;^ObjZAOj7{-rGai`AEJmW}N!VfEd!IEb5lXqZgIcezkG?uOX|u@uT7f=kFEL|WI7 z)}?EO9?U6jF^!Iup7g`9>3ob4r*4*PCrPSiY9>l*o3}x~$q1NG%g=aO->RnS%Nn|q zq)6(RfAS$NT(`*87=~0GgCd)5*B8c?JuLH7=x0yLw%^q=6YghEcAEE@E^LZYRIgA7 zY_!eU7EeoaU^+-6eQlQgq}zXpF;2M8nJ?8NXq!7N&GC)=nC5Bx19jKeJ}VExh)cFF zi>HK|(T7*7S3EMvMMb{WSTr@GNqe}`jdM}1=z3V@<(P!&YoXiB%m?(O4dWM+Q9t-b zqowxlsYta4qwW;rFNT-qN7PRobSg&NeXF~cbtj>1COZk-uyMZJ@fv=>3W=J<%{Xn%_yrADWs6u-qA% z>ar~q>AqaPL{8o-a}cq0#Km*QEOzY{;b?& z*fcNZK6^aAt$Ld&2Q~CFwn&sF5T`R?`Lbl2KI_|-W6YD}7 z#h%69{Kloju?pG-74j=sk&J5M)J<2NBQBS}Ey!pvpIyA+_#+DSA(>>b%gB_|NOL7H zoju!_kNsM@h=n$2O z!J^Z$>#wNO%ub)KqugTeG5kzFS6?%JTk7i>)_A+?NsZQ>lTME0&rjF4TqS(fo-=7{ zn^$8#%El{FZz+yF~8~x<-wUh}z6N74=6(hE7bpb7Q!0z>2!?VYTZgd8*{E^Qm?H zBZ=-t?sjJ-9M-J&SzHY4Gwrzy3wLj%Qe2V8O*K~WuW<7`DVPOYKw|la4)_LVePrrMUHPM{g7@kpUQU(!m=jcj&90Inhz-sB&4~XfuU+{Vmqj#@FewX6sKr9N<;tC$+F%JsoToBR}Sy zz3NHsexuT-Hlls@iyITw(vL5#84I_}73#j$FdweS=}n zvCIa#SdQ;Wf6A{)xw|YT<&@Y=E>bvMo_s@l%fcbQx32T6H=7m8Ja{}jj$h|qu=>uz zEs?!ELb}NaCl!esl~~OgF0_2Bd~6A=2DGcVWJc4bZ-fr%Zdl)tbMn@%yt-w%^un>I zy2VcuXO3Uv^L$d0%U0<@z=gtaAHu26Oy0qd?7UyaQ`4Tw(+e=fH!GJh_Ag%W<~(`D zue9MMz3rTe@$g{RBx(y+P)KL96#LCtP35BT)@0LD1o5r!Oob_hv_-3&Z8RSo6w>Jk z%t0m_?yjV1+8uRfzRRxUM%m2aRPnnGVg6^@=ADGCvao%0jGt9Y&|`LAH{nO_TcAKU!FgSh(=QDza!Um5NUWadzmvt?OFrD zHNsF=0%H;nf_uejAJ4E@h5L!pme=L;T~vv>Ka%cjwYpUllt?&EK6u$eWPkGdOhfH( zSQ^vFm;2U3wI5Yj3Q_eTQNw`-A`v3VQX{@k7FiozbxvtJAZe^mzF;zw>`Oc^r2Swd z{)9lKw(jtv`Kt2|#OfzYD<^#04B;@#=@#6xj~gF3zbH|Se5OHn^J%Mj&iO*d{;RxZ zDUXd}JOv}ZkiOm%&Db_B`Q>JvTrM$kNPAsQYiqaiY`b>|O9Fob>P61m{I2Pp4$hq6 z)?&)&0Q;*Zm!1s8`q>W1Bq+vsbe=MJuo$OPPqGm&ai>Uzt+r=7b!l7p`^BsfsK7J2 zf0;mT!BFW}z{uH8C%-Ju-_M(|vC>q^bDOsA+7?!rFY&yXC;Glzz6#;D_zsM}4?YyzsUy zuPXbb1ta_Ex`-D(@&x!JrS-pjGJd(wVi8#jzvMApbPyx|^tPr1MfD={^zF~}yZp)y zB^7nFKko@7GC8gG`dEkFt!mO?jOX6`IpY{l_bJcIsIAdiFHTx_=;FJ^;Ol2|NU(Bg zk}2uUQr!|3zkZVEkC3Cj<9{!6dWda6f80#fZuC?zJvXbN=idEzPvQ=j8Nr(&!cNNa z-L_fN9(A4}-C?!GQJ+v@VnjC-6c~)AGfXqDi`H|QW~hhiX|NJm_XS)t>*+k}OiNbh zW*H~%$BS}^QQKCgseuj#7dN%B?lC^`O1wY@-U_?)ejPT2d)6yh z^VmLWXP=6z%kZY-@=#Re>HU~Z^PkzPP2nuC$|7NSv?buW(#VvAvN?Q3jdYq6*d(It zWPL*XakziVxoOQgg<4i{<0sRa8Dirtht!qn2)pyq{!%4?`juQ^xnN+n|w3V@s+oh-P73g{{HjOCk6r`)VZ`S)Y5gG_y!(3J^%6VjyD~y z6eOO!YTIo*aFq-dDD){InZT zr`Yqu`z%;ouW?vF>o}uTje^g4kaN?f#r~E&CKug=wM~oRo`D%IW2-^#KXQ*sQGgy(kh+vC{;e zjr3e@S!Oml_fav+B-j6t&7XMqLHum(vKddo8izqw&j*(2kBldNO4!>4rZLV*Nn=~B zoqt*@DJ{gh=NMsmf&g!|A#Z#*FKajQ8z}XEgM3 z-d?c8(L?#0M9tlk!#3o?ONZ*7g@yHgB4Z_kmBczjNXtLt!)be(ytjU6o9u~}R!nZs!pJHB@Ja&Sf2=yH=n zw^eI!WCPWsW*%!PVm9T2-J7|yhG#s~3EvN!i>W%G2IwP{h$Sq)KiB=dS?$S1zd#H}Q?f0q9yD01q?)4N6oZCGt#s*__EJ~vZVg}5k* zyVhwwL3N?5+Z$X(WS;lY7L&f71JlbhQ)Cq)c&BvM0&zBwu zGz>m>4_?@%D)!Ti>Zm?paPXrRAK9)|Ux5;6UE4E5wWn&{%yf%)-YI0-p<&&*E$kA} zV8cJv;$SL%hgUpXYjL4SwDaqGMa6nb>!)(E?4Bx?0`$_HuS61vE60p{Zb{!QTay*s zmMpBTY?N{%uRj@SFK7RRE`M#xc_=?1{&tXR9Ww#=vrfG$HznAny3%OoGU;Tc#R7{y zH<7Po#i71R?bo^!zj0~pH~Tc{7v_I?nzT^Rg;GTLiQkMliIJ`Eo{@rmQTf1ave_1e zgd2WoJbvucW{guRJe9Vy(~FW5n>mC+1Y_zA3OeH&=02})QZ3aHw#W^PkcG?e1&3Sk zBJZ8~*gLE=pT{wGzvK4qh6zcwvAhBIt-+k^Tbn|te1Fq%8?2AjbenzBjQZbHhHPSo z%{>~DTxcC{KbhS29Njp05>ZXh7eic1xb8RQIrmhWbZ@ySBa>NyRpn*-vp#8G5IAxf z=dJHub+*5{dix;>o0*ywP4r0ov~A>5dsZ)XNmEIvfjUXIi0+q>7n8A3q4Z>PZ$-=X z0&TBR)cRgul$MUJdyz8Tq0MFJyLWb0zO{-|odvA}p!tLm%q!|LCaL$lUTe4Str zVIvKj^-r#qu##jFJitvh4Ywp`(x{}9OgtRwu(?n{7y?z}saL5M6x(GiTRQpPpiEd0 zWx`^An#@`)ta6==DQRe9kFdXqOy?f8TK;Rt5s_^2$*rM6##SenE6DuH-?(pnJYFT< zqnAJxv9j%4biB|(A9hv#;@nhOCao=+Y760~KY^x$DfGQAWV z3H69hPymZz=c=#cN#UpQk-|$Vu^qCwX~e(u3=jxHh$@d_LJw7F}h1Y zR!xj^7)H&<*p zM0ZVAvRyykf4 zx001ORxz?fq4-%uV?Q!|{#DrQGwwXfg%f>v_0K2hzwNT2M3JAeW|MBAyox)n(LH%s z6)cAeQJiseeySu=5|PKGB8;Ef!rnG&h#jskzc*5|LsYFV>OI5Ulsk6lJoMqdEpK^s2nPpX+7Wwz(xPsG)iaBW2 z4W24+RT?U^$9!b%UAEW9`U>>PuN3n z>ptlcbhC$Dc*#1+9mH4t%Laehr5Sf&o#Mjhpx0tE-ZaLqY#Gj$DmGISpP~FjtiI_V zZLus!vMH40-|T`d6x9(QNBl;M?xTU&6qD+&IeNZ*&g9l-9gG*Qbk2vyfj?a}QPVNP z$w7r$ck&nON-Fl3dLW?AggrL<<={izt&ZC-qIF^myehx^k_`XQ8WSGEjrq2f|a zgQd8&Oj7fm^OFS8S+zC#x{cc>JTA|;c+F578&ZE57BApSkE?2@v{#zL=}_Ba(x`4N z3ZOI3@v$%)9qZ!b8@ss1q@s%|50jwCCBKsQ&Rv^+l<|{iNqR%U#ZUP2bR~t--o~~3 zFHF)<5hz@7uZ>dU;CbArDSnbleBVkd#I>oU6_KokO7W z#4|kX=V`j?tw;Vh%li;C+5Sb(3Ge)rz(Vz@@S(B-Ra%9_Wa^*43Q}CgQX^PA(|KZr z^YolAvr%B?WzHLIcp{Q-wGcP&)%WD89u7_rrdhx2%wsqilXv*+dAUTMC9&kS3mg^) ztD&irPQ2xaKBd5vj0EvVKf4j+trqTQ@76@{zM?Y7v*UPIIAT-hqSOB5;x|9$kABiO z9Z1FAp(5KBYF;KtG~7`6jz=aS4sK z>!XUJN!>!MG4=KHb94`sPxj?}P58Xt?Xq)?>1uG|40PuZlF7WH_FW`{`Z+cUZS^PN zC0pX{#`*&)YF2(!P(YbR{Q`sAhV1@lYHPCThZlJ9!dc>MSaUBHzg75r>cM-df?};m zI=#r|K50~PT*As)K8}at`fts2Jm~XPp&6TdTLypM zce=`~8>_U7F81aQs!6XqGl$Cx1BR0|=?bdh+;4gZ zW+%CeDn_oXe&yDB7ID5I4O>vSL&3HjsH;m*-N)=01;e^#7$?t%XKGfUY0 ztCC+Rzu)=VE$=2PQuqQ2k`2g4o~+xcDYeY(z0RA`CH0(aHGw)po3iRmuv*?htXR96 z5JUFut2-kteS3@Fa9+n^33?N!eNW*j9)HNmnj@XH){kPR!*&w#WJn##(><3ga7Gs* z-69REOd(__cr4s#7N%DwVB6iW7o}w#VY*o2^2E$@o`6sMw!A=$aht~-duAgdncw2y zXqu&TKG3}%w6VwGg6w0p!ww&f;88Pcdp&~lXJ~#UNK3R;h3ca2m z>*gV;^T~J`Ll*y4wv~;Im;m)ZI*=Vjzlh=_)ATkIX5(NjC_XH7y=_H0d1t?!bVo%)TY*R%)?NbB=X z*&93jtRl;bHS;Xk9{rZy+eErx`*K)N@3VGz5zoyzoU$wXXU_-U?t33x>#p8#|Ka}L zfWg@kk$i{3G11q2u??|CDH$6@c($JQyWgsBn+TD9-O08>CL37f+BMcBzM>_vQ!eNg zw##p^Gq&7dl0dyWCvZo$&9u?@lHDNQ+|}ge{=&+0S1PKMlLIPt40}J?2tUs{EjO&& z7T)vT+dHiyV~@V-wg_b-4>EOV*|(0n$uP;&25a1R!a(%g$u18?^Vc00L%M$VJ6l{! zq53IF(j!{@FuXzfb&F4?d1z=Vr{*B7!N)psRQ0cfr5n+&QIsE_FF%j+`%q_KezIOD zViZp;cBof^j(_>f_nrIu=>lcTknzLi**nV%dluCN@hR6L+bx2x2i8=sFEA)oJVkOLyHP>-Ek?vG_+(j4kHW-D54dR8>J4!FjYTT@4{^ znigRbCw0WCp68=f3h`8{6fPUiWYVQ2_Sn6V^5y$VYY)9HBKcY=OfFjG_Q@wKf8!*-;4i`6UKB$qiSP*ieP^L&M{+m! zr!BE_L!NezBA zyc`M*ZOV*p#cZR>#&K6n`Q6K6R++==Z+-RANNrkB@R>WGTNr)2R2$dp?k4iI!sRB% zi$6cwg%IpUd9$S2hbD`rj9f@g*?d{>wz_cpNhN7}#8!0YiSO~aXGLl{V|c>aeKVQJ zJHGVKMW!1IZUx@Gyj|!1)=Ipo+Dt*bFJRQfo1r0{$9+~+5%pOuR6=gWw#hGxK|0%D z`c(UdpK8BqkBsFr8 zwf}ABZY&#u;Q}G=C`L8!h!J-y5r8j6XAD-Qq>|BLpsX#HbJZ z^quMRbb9}_VD3c;o7)KKHLu?6_blfk4Yw|TX_dK=FD!R$i%DZPsZ76mnovC-F3=$!lak&0U{2(Qw(GF$%p6m6Qj?X=bx3K%x z7O+~xzO*=+USyWaBrRImE~s^Jgzu1G*JKZP4fEi*MiroT%|aMs8_A(_H(r|$z;S~ zKKuTKTWW51Oepx;PzuAIQby-^jizg_I%KYy-<`2{^wW>Ytj2YHI?$$?|AKYIEEcPB z_iG*M%ZX@Y++ihUOqPzHw^U~MDO0txZ^CGD+8$l(ay_l+D2ea+`$q@+@2wQ-!1#y7 z^8)na3Of`9i(2{~7xY&Ul|l<1uiUGX8>EGI&32KW*yrPZ@XDL=$Ir7y6|TJtms(eR3&l)3MPbnMrDLp#B`?Mg5 z3NjWXU`HWeJ@7|Oq1rB)2k*Rk`JT#S;TAp4P&0O&!G*AgsS6=qywY+jLRAqn#5ZE@ zD&27{`PNC3Hq&Nf>MX5f+Wqa)pxiszH&Wl9+*QHVzur3+k$0c(Dn6Gd?zc-3mFJ)o z--H+Q^7GMuBWanEtT z;<9kqr027)aS62=7k-hJ&=sV`$rb0F(;Ryntl?kya!x=#@Y@4wT}h7dN`Gk%f~l1l zqEc?{B0u%+wcxC;!WAv7Or?2y{1ha6JTE>hk@&@Mq+|6qnU{VOvT#f6Q!-1BDM>#! z>wEfT2}2!Ccuh%is00jIKn8eLAQuS+%q1o9f1ZSEzQD1)%+h6vkG*FK!{6pvkcv=JNkEO$WY*Rzfq z_8x5_uj>&f-kl)p@^f{l(aIt?g_pbcb(Du~A#y-HE)w{zxi=cue~_9<1(=O&7he4C4T(g%9R%-XU7ly z*G1TO8^56>#!|O`h*GFCJ zC$8f2ht;L1RSqw3@=X}`@ZOXqcTU(}(*K$9mc`W%@6$ckbhpW_g;wC}7 z`q~|wc)DWqbtT1|1p-eb0Ve_SDaV4UXvkG6Wg=y!TCT?i1o9;Xin<;+oH!o|0w}e( zOwQ{nt#LmlCa_d-rL2u5com53{YRZ54_2gN_Dy~>bLs?BarRk~*NSJGx0${C6*8ly8`n%$@=e!?%td4b z+m(EXr7Cf1jh2V<`kOi;>JExe@&1ORuH>}}Bs&ZvO_TAy_o$qa9cRw3o$2Kil=?wS zGVc9@lNTi)I^q7I-v3$+E)G5AKIvm=(bY49%G33V$@91#SJYf_Yk!~M6~~c%O!3$V zM;Rw7n?d!tk}Gp$1{Xt~oU5-251rMw#sy`MP)?b!Mq;Lv+lVXTCzwy*2J(_xj9KDf z6X02obakG>%EW66PJA^&5jMVrJ?+1lJ5%Q}z1uE@5?vb&Uo5XRdTuDqME1T>XnazC z%AK^_73+6m9w!bpe-vVDdhEi*6=JEyt6aV)mCK_s(UX7f_sY zmw+&U!iS_Rkw|#;yu0Qpzt&KrXDo>5QeUNs%G|Yrm&;CtEs{7lu-$zJXUuU8UI>zp z-*|<8fdfSy93m*0SQB5^)xENzA@$7dnx}NhxCmGG#G_PZd5f8Ina{EUr$nW>s?-8T z-6Q5mX;c&WxUqz-LzJIhQ5CpUbgj2*O#hC*;tPDGvc~Dl=>*cn!pRZ-JN;|(Pe`KT z41D_-UVBEr@{X1_E}bXp*kb-Uog<)TsMqA7%1T0w(v=Af^yd{kU&mYgjOw$fyK*$m zJE=7d$v&o65Ox=USU&3kamp0@ejbHjlOa ztC1}<6p8!FkFhS%n|WwEd{Ob}@tb2+QzJZ8s+(u%n0J zfUxH|GaHnKG#|G@Mg~nqms*d;fNo+|(wgM=#6FzYx_Y_FdZ#1I5s$xB)qQ#1XzX>e z=JnL99UC5_D8&!$Ezf(p(vLPLy5wVCv5i@-vrN>!Un7%xOgfFbaf*|qAVW61D+ER^AML4K+8TQX!1L}_Zuo{TC7X`W-d zmA`hr%vYAQ)`H$Oq5nC55Xq{u@RBpthy+tmsX1X?580z9N@`cnB@R5+@*gH;Tj1~; zP{zymBN0cDvQ%-%Tob_e>>fo0_tQIregpehHWKPP%oI$zj|cL)?nO_~ zKI!~S5kOE(MM6bF5kjTK@t%vSS0e{Y{dp#j8kxRs3I8My?_@dSJmT7h`s$U7LTtsA zY9W>U#Hz8VGFzG5t+Tp+*^E6<3(UqH-Fm3vUmmNRrDvA25=|?YBmv!es(G4<+_$QC0U^O3k&&|UsB!%8J@xo>K?o$OTUWq zQat0lFl{qRReZ4h`Ui=K3k@%mGCV3JUS3L-ldWGgDW+Z^xzk8J*&e3h#n0Bd*l z!B5xnX=>0zO1`%%nvBOL!{HQF+j%*;`k?dn^7J~hQ-d1vY{VzU^Gz69TGS+TZ@s_9 zPuXm1U|>)aW+L2=MbjjU4APLI4B~MQvJi~>td{BJE6^cFG|`6HQA~*@$YpM3Qh%`Y520q(9J#9)L)m9>Rvuu&m(`i zP~nLpo&n3;DV^ad{nZ~@t6EX{ctL~s+uxZLKS%M4JuKr+?Ubt=ToNj_3W={+{Pw6O z!D7g5TYvMB$nTHHg9Ioh;lT#;m5Oop@bK@e52hsQU!lf{_lMg(=2B5xjdJbPzsIr@ zszlA@7t9aak#|*72jk^l);cT)kKdazzQ%rEaY$13aLyOmy&bfphT889XOELV+|yAj z|GmBFKdY`tyStjXBJ^f*{%bf-eMj~1-tfKDVYTNmfjYl`*+>5fvX0BSPq|vMqw#G; z&Clqex5+N*w79IO>{e&*XKIw^@0#F*#lzZg)NT*a+`{)52EX-ul%4k-uF%}XmDu(+ z5gm>u9`Uj;ty3|C{`G@eTrWa(W*~9u*Y^`lG!$hx2hNHmn70$_Jw{}HEf%rs{uZuy zLw}E|{EpG4&tY;O)0+h=6Q&wz%c(Ezo1#(kw|~%iq8?uP$eL$p9Vq zA6y2*W2}2d>Ev|R&3$$ChbDL(mnTe#DxH%pu1!&R#)nlz91=$7KoQ2apK9;MhM-Dv zK6yO)`s5<2npYD^ZXz;FIC)SgEx~h1e}?nENnEr>kl#4Ahv=zuCk4%T2bwBV_JgPH zw^+MHKBt`Bl1^CLlbIBCu*`fHI!Pqf`*@jQ<=l*r%-j2lDkCPI#P4$NBmGVNwxl~g zc)Z8W<9wo%5Z{j2=nxz*BJkzDuHB1{}R-i_Y^gH!?DA8Hd#+^Pq+n-SV@y~Jf!1OiL+pkj=Q$t>*EX6ZlPX@%^&-HYo zty@{H_c&nx_gz6HiZTS;=u2^IjS1Xs;QMHX$_R2!!Y|Lp2?AKqH{X~OjD_@xfctF% zpu{i+i4whif@$<^Hd2Cwhv-{;q#Ovd(V1pL32&*PFU5JJN1v?e3^EB~K}q|#Y|z98 zlB(o+521-OY<)?EXy^m{(zr!5e*u2URU}sQhF{i7iKme8OV0@LwmSUM%1v^Y6Mj)u zBe{dV%%}1y$-E{kNy#EHfL{Xlc1XZ~Qt+P){3kEj+o6c#fi2 zSZ9LtZsD*)6Uof@kV!3)q{MBPN*ZnXJuY<=0a|%+Q^2^43MdO=E@dCF~R3 z09xYEOlOGh;;JP&7jzek;L<0cp-w{jNwnnxHhK}Xof#4OUG$Am8QH7TV8?Wx2FO^gt;m#oIq z^P{WJlu7@F5X&3_* zAI8{82U5}$Mm1V2??A(H#uCGFrUF|aBj8|;!Uky)l6e(whv%o5JIO(6Eya8aPM@kW zOT&1L2J%%>nLc`ovj-VEkwxGLr?5@ZpD3)>Q5IRm$>h&;<#;7ppcG7H?GE?O+LI3N|%V~K@-ZnI!{57*zz zmPH=!n4()Omh&K`F=Q2?gq?YJZ$-Wo^sR{%B$h-cUh>$MwGqyE!HpICf*J7o0c!zl zAS-}%4L0y5j5QrDU+pF94FQnme`Fmc18I0GD=FNwZ@#krpob0DFTKq(CIhuhz+A94 zv&3o(D_-1XRY#XxRq6AL84rOt#R1O?>5^U|Ha^(GZwfXFxOpk)*e=60x1(pPhf{t= zwsg21yP4UPVUK9J*;sMmlD6J?^?b)gAV%e&u1Xx)5^p}X1K7Y_5w-@n3JUUU5Fbc; zZP{*}fHO$nV7i0^8K?!J7q@VEO71wYiNP7toY)Fs%NCw&G;m+I`Lo@C+k7OFjTc6gY*xXylp6wduYw2a!E7J(@2 zht@+0MM^r{*d5{G&IGa-h=O#bg#9c(NCl_Z8Kgm~%E(~}&w+PB9E`BM%9tY#cGLVS z#~o^rcDZv%!IO>PA;&AY8gYIcwQzx!ksOimB;Ly9DE|o3JSWbZa2#NH$Z2WsLIsFb9%sJOJWwS?U@>k^?fq&gOsJ#;4>8HB#E4}A$Kgr9*FC4evR zgRj(t6f=-?Cls+>UBO}^)78W}L4)|eOG_bC29o83GB%`_kHrR6WFX-s3~B{JY>9j< zh;kf{2CBiMBZOS?u}B2|&P$>BJiq6HurTP9rw9amqvD_E8>ILislpC>@L3w^5y}l9 z69fV#Y=54cP~v;!S-8N7_rMEPc_`^U5{bU<5#r6nxN;^FAeC+~!UA<>B1s|NOe75l zYe_ zLiArI5Qz9(jQ;a1Bp13OTIJHk5_&*q^?%BPy0VbxIbo-ss*k?2q6SKW$Cc)tv7t#q zdLHOXHj)|k$|oDNa`a=gR1#{-##DF=mg0arDS@s8B$|VSX%D261Ek+Kjx3NaAju)V zPe^ifk+N^fH*t=Nl>Dm-{lYkyB3VUn$RNU8BndjhIeYBA2KX||QwYT08H7}hG61Rq z6CTJr7nFNm9|z*3V-tazaxp#*z|ukMBVBeI912J{4+%32NInlh(zlMF$9YI9OtXZG z8|ZU_BEcY#{mVzZ$-@{wge?>$pryP}yg5B38bX^9P4-brVgmWkA`sGl znJK9}%8-)}`WiUW3R3Lse&G3QdM;?SABO~D{BYC&3hNIqk~xC>!dM8gzs&sFMrS}m z3OhLDkQc~+9woI*%+)>cmA(uJgwS6ZOu)^X1xPl?cNvKbDSkr|LY*Hl^_cts9JzZ7 z1G_q~;R;{Bb?f*H`sQ$tx%DKlXa}O^Uxo=G-2xn0NCDCR=MBL@Kry9AI!q^UMg0CC2PzPE zT$dB-C`Bs5jYUxg3gmPkgpzuZlK(Y4n0>7KxYdA>cj%z>ujT-4QHF%~%1}FOQy0vtd|)Cp*ui|o{6=Smk@CmfU$4Kqk8@p5rkDn%mv-# zWF&@+@{b0TaKTrc?_MB-1=g{k6BAj1Jck~nGiF6!;^FITEsxKJ;Zg{z0;~-jmW(*i zvkHuBu@zu6RF7bgkqRVyXD_r43ro16+Df2)bqk3DNmU}r(dIwiR=O?#N00Nz=YXgh zMqlnB2ho4EVJd3w#am5~6NG*~ko5&h$&SsV*&SGwMf~!G|0>Zabbti`-yIC1<=+vCm*{Uv9sK!fTPr=xO)ojN^EW5`n(gVq%m)9cV%^PH3$b9%k}fWROoC#`9o+ zV0Rc$!|{&^@*M~3Lh}(c1VcRUXfRO6IFblrt;ggNt_RSGuSbx5Js@nLJ}6jvVF*a4 zz#0=eL_-dJsmD}x5QbKHY5#$UA)Nzo76a1)IIHX@fUBN9!tZ{<%#ILPDr$2iwUlT1 z&*ARZ_oaLkUP>Gg2$;G3d1N812BZYK|DSJ5Fmf>h2rNB+_rGZh+CDGzpaJ7cSOX}v zzUrvdt9mS?(7+M22t&jRw2;^W?MXp-H&_T-Ykz$Z=6Gp1o1fXek%u+k{~^aj;Z1<48K%bTntVMo&IZ0#h~* z43xhaEBLD-uAh;7FbBmIcD-(MeBoKxcggPoIe7_>vp;>v`lT)~$> z(GH;KzbP{lwAPF~j}BRMc&h#3V1wWQdiC$wUqJ}1HzRqWnry(sgIX|68`A=2LOdG= znP@@6XK@hm7a;5q!3fcG_39Ulx*LqNC}I%6ONsxho_|ixjx$tkXzk0r|lrSfg^;~0Rj%7vxNUuvCy!~?LAxwM5)E`CK-tAKq{fT zcj?u9OADyH1{eo_uPnbJVC&qF(l-!CLOL-0^`--qOA!Sl9MEtF5@7BJj2hQFb9k*@2Gs&&KZ$z(Tb45P<;m<6lpIGsfh-E+jZQ zfnIchVqP6$WNTy$L{Lu`l7a)6_%_>imkxAiCDJbX*E5Y0yE;rx={+jdJ>5r{+(p8w{+v^S1i zGwVU;zu5!wQ$A%tQ&y-52;uxX53}Sy5`o^MKOSmOVGJ0aO45s@hdXHFMdsuUFbPV* ze)8`<^fO4g7pVm6jNgt7ECz$&Gcfn}lv9BcdXZ}ADo-q*sRA2W0^l#$KL6{{DmrqR zzYpDuN`1g(!{#F);HyMXSRWD`@IY}eBDc%{(^U~@2_yUogeQ=k(4zq`cK|IVgVg(x zr0}@uFulQ91d5}vJ|1YgPGi&=r5LH9j3f2(8O5@zpcYzSNb~;7Kk)hH3Pv3eRD9?+ zPzSz{4uE1G+QR@hq%(k|h8yAnSI^HM#L1>u=jqkkSa+_Pr5cC;uvJhZQOwL656eSVj;8C5oW?r`k-Ofj|WP#GEAQV#!3s%M(y#}^PONpG6XdS6Z>D!Au-E83>JLrftJR> zoTFkq5+Wy%^gt*#0X!aLf+(iI*#Iju3po@xfoV!J%hibq&^8`m0s1?#OL}}0k_Z&AO_f<7 zu|p)+e+`|JnX?r>z_oW^lKwq(%pme9^w7CD1qxx&!xRGOECuA#esr{C;8fV}2y!Ao zJp9|yQVUS#0xcIbH-(9?vDg{bJ7Co(*E${vuGym7^3TyLAtXPI9w6G&!285oN3icS z5**t@F|hEr0V{^`E@3o(!9o#Rv=GgBi6QkFv<;IPfJnL>A)y&`_)sDS$%m2Y2dt3W zXTb7ck_#PR5VBc-Kmlk(0=hbjHsl5ipN6si;jGX{4AKrGVlP=Cv1UManCH;yf^$F^ z_wh&_O-vtRkZ>6BX+1)OT(C)my`28%tPFo#pDzh4AGbS?FCkAM@_Eb>^5@$V0&(uI zaq?gZZ61B3N(L3rWBQ=^+m`GG_+k;$*>MjCMkNzkdI7B7=uSyRqaecD_lf@P+ z#eWA9TBvIg9Z1NQfT1d8Hq0@q>QT+uhrKi!z%b?l(-%HM`q#saR^^2*akJ4t8uRES zVH`HX#&?7qR^pICc)v0HE01`f=pG0J)IrAyqYYSPkqV%35|%-3UhuUI9JZp*PD!AZ zWpv{l!bpuR8WDgrzM+Mt-+)la0WD;Qpl?X$!u@O|T7PXpBX9jSumROUprb>J*DgdgizAdQ7Y*O2F6 zovnX9Kpy92InawWq!PS@#I3%0wg?tW6F`Li-VrD(KwaOFr=Xf~0z8Oi9o=3+>mc~u zId=q{V<&+gtfPleFbr7eV}OozbZA7WUzZboq4$ zKpuOppE%Z3+<_QPmq2zR^k{{vWz}DR+5-&8=>72%-T{bX6A3 zMnV8tO|g^y&w=!H&4C>%Kxv5sx_MZu>|q$03H`2$!A7lK~=0Q3>?L5lzCFfJCU zQ^sJx1ezU><{8lQA820J4BJt=im?-Rl>`5HNMPRr3YG2{1#osr1Gh|{4O6QI=$+qy zCjGsQ+I)b~1QhXqmbot2RG=S50Zj_&w$Y@JcN+i~BL4x1A&+g$8XFe;`u2m52t;l_ z-m!hwL@un(0#$EgI4pL>=piSFn!n4B513eJZ5tgCgm*wO_z$6VP#jdV1AiQ;0<7iE z4yLSseNaBO$U49KClC0&5oipy^K}rGF+<>cG9d&gA1B-{e?B%JU#D|7|4}D{f_|b$ zZOl(FOYLyD;Il_0G=dSXz`{rPXdw&4yNl+4XLo_n0PsKbc_jMeF>n`cBML_D^By5+ zzW0C8_RqKL<6&Az0|rsg@qDQT+n(gI5yb92nl`x zA%i?x$OWGM$q#^BMd&b#p%VM<31I7(nMa8~{rM8b?UV z0h*ze!$LySBO&?-@;?^)KOfSM^C&AwRn*OuJ$c#G*s HkoEroUJ~T@ delta 37483 zcmY(K18^o?u=jUk+qRu-%#Cf^wmGqF+u4{KXJgym*c&_fcHgh+*1c6{{`0Gz)2E)( zGxOA$o}L^3_^+>jH$Xue6b$XlmoHFXY}JsYf82Z|V}1Sd<@4_b``4=PWNPEg$nZ~7 z62`6inUF*uLq39L_)~2pV|9L;EQ)fJfPMPY#o^B$2NVal=<5q9OHhTlaZP0RcTJc* zn#CQ%F=JnO>8PWTI;_bL(ev>ic#>b+c>}Gh{fY-pNdN)`nF>*wm(K_nFH+*&*B??T zh&y9u53`jzLv8W-cU4;cY{@NTdOQyGBrbcR{oekBYSu1yqtidB^Hxd`tD7;#*|`x1sEzzMW@9(KVU}X zxOKQ&==XB`TaX(LSdI1ZIrb0Z*5&_i2u~GyT9XvNG6MZO&h(zbT2j~CbcTol?>jm@j=$l}CN-GlRBI%B z#j&(DU2|m*rua${WYzSEsv*EAgR0`vRV`T;`U4fAw_MRl+S2YZ+%dP8g(SyVEKGaFK z5Bx39Kq(WVgOth*xKn0bli5l6b@&?h9V}r5Qq}TGxDezP6+Y?Wa5HLN!3H&}TR3+s z#d77v_sjJTM#8DR;cUyjA*B?RCb2}lpG@@Tput~lK&PWZCqE*w@VG_uqZfn+ge>@k z3KaS^Lpy{{ELf3#c)RuMMa^hzHzqP#7dOncU-?cKDr#46yv{e@L>z`^6TeVh!`me1V|KREPt1rVpaK{8$ zA^Qi4ydbXM{=tYNNDRi(Vtv%V z_Z(eX-zf%N8qydkTq}n?sLg*4C4r!py#E}KdO%ND|H11G=poNP*kb@w`L7SxcQACM ze-;HLuq4EPa9{|g1M}bL`OiN~B9Z?a-Ea+!Fl{Cf6u#Bl1}qc#Uq4JguyW$RP}Y|R zhX2pd-wAey^ACP5gUJy71IR}(ZOeaPVgQa0_urUN->bb9(EpCflIAFcN0=6801n>T zXajEW-(1lH!I3EbIZ&2^&-`b3?gCHa|IbsDP;%*(^slEun!XzWbJ_G8_wj<>u0ai9A6 zm@+DZws|EW;O2b!p6z}4^C;Kb&ijgdir*C0;)_9lUY;L_2iQQ5k*R1!sjo)pUpjX9QsSOvSY(LPdp%WG;0;P=s+oEyGza}; z*F*~M0M>6PAIq^`NB%P%;;{3hrZ59WPVTuNMe@CrLjp~VV<1IH@~u0+0e^GVFY`zE z4f^%JE(vH-(O=)XAtoAa7u-+Fm7x=}f5`AA*pjSur6T)ZdF# zqe61^8#2;4-cu4U8JM5q1OCNKli%W>PbMf&@kOkZZuQ5{Jsd@R&9(x;TXT#m&PA8G zFr-^Fm$O9A-}dJu+WcQ(BYb@EHgJ7?=Ot0n+;oG51fJFRuja76v?}&X+|EsNpy&o;~&HB#vWh?P#(YBK* zH`|K+&tLY!LGNaN9U)%n)83PCf43G)5aR5&-sLesfj!f6bZ&<}9CFCVZ#w}U+o2zE ze$Jz8j4SpGyRDsoL62zN_V2*=L!-~O?{BHYZ=FOv)!F zU+J%aJMC^6SQ9O(c@il`j<FN@S~T9mp;(;wp; zZ``skrT)+0?fQ;*ks10UK80H-%m^hDj7I#5S4_+Z8+KhlcaM+NtGCEZ`hFN;5{R)3 z*}Bb=wwYm8wb!^OSVdlf!7w>{;_#n5&d`$~ti#U-X1XU^W6t8*I_}j}6X{6K+{AG5 z2;?kkYAL>?#QpGMs2tKN%FM;rh%NHpNsB1esSXVzs>%;hO8qR7rnCK<0^aTsix9&79g=1 z3;%dR>|McubF)N0;eM>|*$>#q^(1_1zs0;tokcVLdy| zo+kd4=Y@K?^-IiyZsJrak+-&Qbl zjnZeb)8#~b9dLXJ44t%`OC?(8(xk6Afxw;LR@IiIke2{ri@ff7n#(tc6C9f}+2tl8 zUD+0b_Lqd3Ln2-Ghsr7niRGMj1{kv&fszUq*(6K-jE5xZ#p3*0B;j-+v6ZF!v=VHV z3qrbYf)en_C7>o_Pj|_7(Pr9G91yjWaq67j?hMzK7m@yhPVl;MkT%+irByKFz98Z= zX-kWclz{(LOoWanl$e86p9CZOK9&+%R#q{AypX<$2>L*A`=5r(Kk_Bi$rwpsHJ0g7 zbW2LGB*-#l8F;(DlscLUxuelr!L^xXHLmYph!?t`ta_(BS0PiZ5Sgt2!v%(jfwib# zcZMUMLWHFmYARv%MnWd>=;OiYCuawB*KO~}$^b7t<%_w3G|iM`XYzWIZA6QZd|U?@ zEUIm{bshUROGZu}7D?AdT#!NCh?ZX(Rl%8RHp;K5)6r6M9>3#tcCic*WOGEa$hTIT zFzc-j2Un27dxmN@2kytrapNmEwHrmv2!_Yh=(lpB;zag zNE?SMJM2daS!Iq{Dswr;O&P{blBmP35Y3*PH06_uvtC)tMhv&P1h#6&wu!S9{bJ6i zR>Y$AqL9>;4#$y~!#am~E}}-Kr^a^2<3QreN*#Lf6{UE5cL{TQw>Wd!&*g{r zs40BP3rvL9{8nk&iwt(oJrBzQKGZ$O={DMvhxiI2>rpf>Di{2ZjSzv3KS$(m*zXw7 z2243I%~54BAFTbK$wTXqzB;^U&V#B&p97t>k)#*K6;|C>SeZpX&F0Z6gq%|C1%V%Z z>HX2v^?YQVeAvr(CcGO-*GBR~WqjDIdtOXa=c6lYL5{IQeLI=b%A7-woET9ci$k$T z%&pkQCg**dY?F(7Zk=eW?;O81s{4(bWR;g~7WSldz1d^-F4$s8vz_oPqgfoHQCxj1 zw&oMw?TSx-fu`*trO-nEX4Y|G(*=OQW#?_~g?(?FQ7@f#o2=`NAK|OGgmK`I32>S8 zsdtS7a~k4NCdpHL)%sx1gy&Vk+d-Ya_`!o5I6mFdRJYIsk(r7#L8L zBIJVN#ikJ^kkR61hb1o?xasz3XCS%0$Jq4+u$Wig3feZwHMRt5(Wey`ymM|vHT3As z?{2#8Nj2WGx(Q;0sMWr2#tMYnP|L&J5#^R~HPrCc+`1~uI*&?%(^3ndUimxHggZ;n zl49DK^uJs&bLvH;wNXy|7Xi|2H)ZLoWBOHJNchR!`%T-^C@GjCdomVQfp7PdvJIzI zP;*D^^D0X@Xg)8-raTg>h@}nYNp!dAce1c8(^0K#9cKv2RrFlZOGYMULsX$lFDAm) zwcMWur#?j4Q$0yjAEi?tzAib&i)?zvD$AoyVei_yjRB>y8L6~5NWj@PZ?}SE>l*>? zxav;>eCCBFSKJBaEs_gu0ljVK;p<$UxQC4_&*_rHOIMAO?HAV}zm8m$ZTmZ6Ab;<+ zpu$5Lg*3ulcbnMkPP<1>-`CD<5eNSr3zoHNA{IezmZv?Qwv8bF>71pF?Ggtr|N47Y z4tv=qKyia_q==+R-xn21<$)@RSzE>$4Y=SR10+6PR`%~JFR@;6yz2@?w4e3z1 zs5}tpjgqICwO9qtI zjwtE~jaE%P;F2NnWRPXkW`H1;r8s^o;DEWiXr+x)%aT(M@ocY|AHRAdgMe2LGQ!gr zB9mVQ5A)V?^-!Z#hn*4qP={i@OQkdoTwk&ks-n8VB}%4M%ZPhqYMteW8-L|GSBpR< z+A*QcQOiexn^aEYzDL6pI4E2W`!eZo1Ob`yHxI!-z?wxR9)LAw_4`eE5ptl()@F%rt3l z!@^VDK+!E_3%y*LV5Kh3omCQ@ zvXI>z04=nY4bI*PYwN_&!}XUrJ5~_CbP+SP(xT5Nie4^MYRYGW2R^zH0R+VKY+1a58ZTJmv- z6XduT0yO16UzOC0N-b-wj{`keBik6to+eb4!Q*gz1=&CHW!#m#QYBz>a8CK{7AFV4 z0hy=mx$zxmaS^WPj&uHDaEI-GGEJ71#tRkqeADTr zuNTede!@gJ==tO7-D25G=M+D|bzMUE>HJ;Fsbh}3w!*NMT(PYi6}W0dU+Jk(xvVNl zEBXG^oFQgpFr&pud8!jR(@dOp?_7OJ2Q+NNZJE0_HA8R02iHpIS91BZ%`4=%_mwzo ze`%CWHlx6j=v0mD8)fq%SJZUGuo_$N;NH2ZnT9pps#x#{RnJ6tG?(OfAJhpj7%4dO zNqn=Z2_pkAuN~o*FA}f+1W$Q6SN zBmnS}xy^V)T1TAcCWeV#6eVl6BD!&j#1+qJzv+s#I0dMwr)ritegPkEJE&;0Ek14h~e$I%)WKfcb;jNL7N~~EiXIRCqc>%;qQ-8 zt}CAmx-hwvqMT!A58>2p>TbSqTdq^d71ob``ZR1z;Y19uM0tWD2@*w%r(88KE)EJw zmkNu7M1eH#(MQglwK={GrN4?Wkn%h;Hv;Kj5t?$VjLDRdB#RQKde>)N)anKe+ zZmjuF8LbhiBu>>xT@cJiTB`kQHC}&ZZBJnF6FZ~o1wfKa{w0Y+-hJNZ1?mJ89~r+7 z= z;1;eJN^4XgbF>&yFrXw|Fw2Y`cb~G24vZ`j)>)zEU2v{&A?G~+2C*lPQ#w+ob-~Uf zm9LNiekjdyow$_<-U*qRjFl^0c~JqlRCV3$fbg@=L|J<`x-;UcoXECjaCaGR&MJvV z!VW9$EfoQx)_Vy615C2Lf4fb4LuUkGYcB4&LZ(ZLFY%F|C32IlDC$!Zhp$*5ZdU=j z7_NpQ6_IRJ4AiBOyyc5qp>}iJ7Ak@hKlj(T&_joeU8ZteTk5J2m@j&7?%|KE#2a2n zUsze-jL9t~uaIP4j%#|Mw5%~^+eESbUdETGOTi`%JE;hKXO64QndCtG_dq>C&KuM}Aiud75U%7>O{V;AH+FMUQnw=WiKmCo%F3#Xe*8qh5NJd2p!l`w~U;l=C%5 zM~7>nSEqZb7qaw3mg^#`4BNKk`Jpg;eyfpr5(v!;;?8ZomUm9l9~{uo9RXOLY>B3V}5;u)a&S+nCm zgiQ+UQEbudwa-zNu)H&bT@#86Ij3a9$$_X#BgyaJK%+p}BoQU_HlvUsx5?!R+K)ir zmdbpR%=e7l<;!fd_%z66*C$vA3vsARYb|;mPHmoS`kneK!5NmN@Bb8)*vE3|{XOYw?R|{EIUq(&T!V$T(#9;l&mh z*9i(X`DxOnTY;nn(l=3f;*)I)89ss{f7cpIqnb(fqqTGWOlwFh7sK^KoTxfh#wU_8 z`N-D6;-@UXslsj8ky&HCrs;yqQ)!Cz5T9b|JeAn%-jb0| z+M%YM*6KoZ%T!6YZ~T`2RLW6f9xxxL8ZJ*+{^jSCo##AK)tWBhyqdJsc1%N*@MeL} z^<^UxOKF6D(D8Lmlgx97dkMBj55N2x#zqlg3_(3M!sILC8d!+pO$dF)8F!MrcMYCZ zC5gJO@WhTg8Qo!PCn@pJwTty9Nen?j%zJ?Q?gkCjK$k{A(qSip9!5+(A@J+UTcbXX z&;o<{`9Vm(U~~Lt_EOfQ)!w}OgUq4$6h|(o;qUT(F32}j=R+=fOljHyD&+VB{@l;Y zYp_{|w2c8V)|yoOetKEp$ow?VdSTcbR6sc8e)9B80C%HGu) z-GpXo4ws!=mc_Zj>$#k?Q`D zFjT;(zw2w0nrq=wX?dnmkIXqRkw=L>_*6qC|0n6_?YjFlEUsQ$|B2X?l!EkeiazSEq66$b~#JZkL^O2^kQR|h&`8)+#Z%U z4c04~udI*rM>O##Ibz>}S-UIQ>hyrC=~T7NdxWQP9YQh#W=TJ|6E{b|UqB~vrx}+O zv_HkC8O={_d)eN=2=(RE2KJ;`zCB%=Vs(+Gp!(@>tvU!!52vuwiNR2Y-!3Zo>NE2j zQC@kDSID|vK*3xzddM$nl6p5VF)TUZS(JN#$tx#vg#;OGQdvRc656p7gnlDQ7Ukx2 znj*a|vwDjLwid;X0@Wf*j6Q8-+E30{_qsx(wY@0f#b1#DPV?KiLSJz|wu-~U$9nH+ z$oF;g#L3o?SkqNvj8#~PmKA`dnVq5h+s!ttMvwm#v5@@=59~8}nOWzKPaO8UO_pPq zn($Ul+}w7}t>$J=piNy#N*r1qp--6WMJgj=+n5H>1p}ZIuX_=%nx1Lr4&>c{IlrbH zNodly5-BwZA2@tlgY$W73kMApXew=0MDQ{`g}UWiBp>+*xvEg%?%$&hT1u2Y$zN5c zb-Afhdl^}G#coa(V-&%EyB{F;@!Km=@60c0CA4<@R##He-a;hP@7vxvqCrd<`D=lV zVPeuEkER|CW7>5f-E=2i{=0VMlXuqw77v55_Sb!w6R*svPesv$%1`Pkcum$EE#1!8 z#PT+G{DcsXkdACG9QtWFb}D?iyy+-E2%xppGc2lTLnRkeWRT_)tX_3@$x@}XreMGo z9Q>I-P5u}X13!YRy-z2^@(W|3m0ygFxQ%lb+U=@tH2?DK!BIq7;4vfx1);p*DKcMk zTjmef%=EDJ-_e^cH;o<`!T~rbAF{#Z=1`w2iW*`v2f9NCi6btCDGfb(_0Rj7~1DhdNaK&*$ zN=6JljYt`DPMHtdZm@R3 z+HSYa@26K}-yuo1q;K-O?eESJ^I^6hx!Tx+7`az3fUYJ=@vuO|Gh?D81w-!fRhWxe z*>~m9wStPe9-9jV9z4A7Zy8icU?sx26Y_ycuZq>n%Hf}q)U%inZf0dc^FPZ*ptV;k zd04`G<`y&fkh)Jlk(T&qqpa|MYxR#uOpQ^#5T5~YujtjTX6F6EKex_xJUj#g%)+X5 zxUs2Y|GprdI`?TK=0Ns#XVKOkF3FKWtuGs7qNyYSwe$n$(+aJ9di=%po!Ld;SMe`F z0p>X>Ii!;EV3K26C=u{z5^4w}TN5-{R`gkfw3<^$LKu1p24Z}_CHCb z#wZse!+&&FWS{HM&w9UuXZF40j+>ej7dG&;o$FZaG?bx0*(R1p@i`*@Fc=Nfyg~Wn zv^uOA%#czZM9vt(iXCIt1P-EOPY5h`;Hf#Smg!uhC;g_%y6f$2;*O;*(sDWW(?93 z7{@FRN9UYY_PAQYZn-S`-!8P;a*msj*Fz$bs>k|8VdR8qH&UEhG-_0|n>W7)g9Im( zW$yz2qf(ZX@ltZ7Rfh-yYH!(&uVS>UX!NjWqBE7uS{bH7d&xhgz@z{#^cQUs)MPF4 zK)Ga(ARj0S>L~1Qa45%Yrb*w=U>CEB>5LatNEB#`T1mieSR!eWj%CDNH5!yi(nOA& zVW%BnQ^sPV^~TYT%~J8S8OZF98Z@Y%iPHE|h{g!i*hIpV!M#ApXHhkSOKH3{QCguy zSd%f6={Om^7;1{r#HRsqtoCe=d}`vPpr>xOWgZyc(<+G zO154fkIZReu<#LeOWnvPCo=CD>ZDz+Gxrj4VwZwmO8fY;{X4+N%4^}pgMcM&5vH5I zN(<@+V?F_iO+$%O{hY71hSVVu{*P=>2V@0=H%lP z$0JRx&T#F2ZDa?)ccpH1t>`$Fti3RT z?`XSZSQ2&t)VOAc@CthfWn6Y=bbo}E<4ViIdu#L)EY*d5J2(74xKhdY!#u9QTxW^@ z#%hQ^$XR#cR-%<;kxMt?H9^jVo87plFYFCeN9wN9sqp9s`JE!{SUy1{O$;^1kf+yJ z+yzED7ejm@&#N~)=I`SdjgF>05pZvY^lpDhTa%2g!+J+_?e=uQ^OAJ zFsX!mWQRC9)6N7O9;*GqK zmmqPwI5~IbZBj<}=v|zt$oApeu2Uf?Tj6rUo48D#;fs1HBP(BETILlbIS|1HD-9cu zar@>vl!&;@6K-eP9?#Xk7jCwnT-fqi8pqUhKxM2rZA7Hi-vmi7?DVQZQycFF7cU? zb4qzBG9Qu~60tlooIu!p;L*AUs zJ|YSC3-sKaYFxBB-4ra;W-Hv3**4}D$g&_mx}qV?%oA!VPq!eP$nr{U*jE~tSmX(p zUl3>_*b_ge_(oox{@HpaQ``vK9?y>?$}|4sM>FRVq!c@rqxYsD>s%!3lrZ0XV?-%M zwz-5Khd)qQ(w0nhf(M;fg~_9|E7gWmJLJ9dV)5HXXbRXty0UQ7F(;X;7@Rgb0=WdK zvD1QXjOa$6jd5HTFFKZ;qgsAEq~97~96`|{nC35E zF^CfRr0Ezl46@ZMmBZagGd*qU=g=&jlAxMkcNP1UYf~UP%2h7%>lP(OvS$n#8nQt) zC*hA_O9d;Al#@&jg2e>0EBDSiUV-VAe^6wQzAnm3!#+(IsQgH&9Ha>XyX(;RTLWct zJR5+}<}|whwRwhx|0Ev;vM4OwZK#hdBDC}kVb&#ry?7(i;u5K=ON|~u4W4;jI(RxP z{erx&L8q~c><|36^?uxTkycaP1BpOqvX}1ZDR#6?AKa z!_}LjVVRnid z9*J!mJr)7L%#M(Bg_t8xCMLEHbnRn7-I6O6Z7V|jvJBm~);MgGF#Dy6Lf?zQvJ2pe zX}_i(_QY856jc@3#ra?&^VyKyp^@-1OYcX&%_P9TlHmkWL7F8)u~A(~4;!R2B5fpn z!WRZB*?o0G@Lp#In@X{uD6%JS51zd<1gSP?ikU_K^N#e*460M1w5UA2;E!Ymzt}bN zGgB`A7k}TnZ@K{>7W9}c3y2aC)cyb{O0~EORDYOs6*9U|kVq0TdjCOxh(3lmLL_xS z2N?_zO^7cFI>pg2Tu?AF2zhY|5w~oiy)yJBv7+e$&luB_5{bJ?v@O<-(P+3>BisuV z7$yc{9CeUbM2#35h?~@%C&W9r@H$lh!DKoTD-MSA9d{wK17;CGrT?I4KnL&+Sr8Ut zt!q5FCI2~+KAv`TIIsw?!xB86nmufb3+lkO{lcL#6dlANel}awYw~2(RQKZhx{*Gr z@J%d#8d>$%*9eS!{mT4ljRJDdbP&}#-9jU=DMvGJ)fx9}sxyD(`mGg5FK>9}d4pNb zf?LwNBe?RUa<*1<#YPcS=Ncdcdxm&+?wqyW=8BV#0xcby5sO=WXd<{DgT8S$@1L*= zJMpE8Mq`>DQ5+6W1aL;gn%I6{_?vLv!m~&zr+)pF{cML!mdOgAez*>-HsGlsmEm05`UTE|x>$2Ch2E z&7fscj#ZENn9IJWiOlC94%3C)qxfdD(jK}T=Nf3KL1M}vRU_imag-voNV72k_R)}+ zNylS9x|nGV@15Px3K8E#S2-TDTe?(SbZ#R^frWURt1pHO-SYz z=|=M*J^TF9^PlzW@J$9g%=cnNh*i#*Lt3*Z^&Hq1whzBn*6EJ#R(J$+23icfC+pq& ziNrp`OCLU<%A`atHX*C9Y`^q0l0JOpBpO4TYe2oBacN?DK*pj+ZvNo3`8M-wg>n}n zpm6lGY^Mc)>1xHVm+un>*|oe#Z%53HKUSj$QNJ)JZ$}-^4M-zzNBp}BiXK3Cr5ljJ z2zT2yCl)7J%g76njIN3G`q4@Iz-5tqtSQ1MIBYVXin+@Y@F&?_#uvIK;rQen$^+U> z;;y#A_;lPMOyrX~%0F$_FQOc%?Ij4<`MYXaQ3rNrOy;LRk@PLsJimmhWx5ggS4wS8 z$=28Yy7~Wm;e4gm+lCd6T_aFk)K?50Mxe8n!NPD1z#Lnp?%z z^@`A`XzBHc|I{Jk4T-0`9WqVk}L788#dk!W2~A;_<$@|p7`*EilsLD9kK(;v%{iS%@oS>s){yCGvHmB^W zWqx)WmFc?6{FKH4t(f-i#YSQqCwaA2J~=h&USe|JV(Fr9vUBA#yGAp*wPo(M80P)x?Y|r%toHD&+I>NniDswtYVkjj$W%F2$g!mA>;O z{0<}?&nbPsnq=`-DSwkL%tB!lqt~Bgc~viWnP&g1csaHYwGt84v))bLY9v;5j33HH zR#l50cVF6+4mNS-Pn`~4aW+qReuvVY;sF6}6x&f$Zn3K`4yH?ZjrY4_LtJKOq{$b~ zcMonuF$#X!#x49xnsS8oW2~=Krnp7$b^N~O8&sw*qadQ|*LPLfz6}=dSA%iGF={Om zX!@O)v%)AP=mJ5<{v!Hl7csa+Z|a3tk-0+2O!E1g5AMnJV-68DPVZcHKN@5TO@X$C zI8}yti^X0jtSY=zs_GrV4NmeFwfrd9kH~VB!ZX+{p(Y6u?&=uzQ>+N*XAe_+Qbz{D zTHaq4q#L2PzJWJ3)yEf?RNxd;K$69mBEsVRsEXjiBiN=OMUoBYRp`L(}kl6$5x z--}R1QdkTE1YH8t3#0Xj){0OE*i56SK)HofXbGi6{+{Ep;*dgui$Y4;Tg+2>yeJ+` zPon}Zn&z>u5nBU`9crHPh2=`$^%)oTUdq*~-kKB!l!SePox2l9Ak7`;HGq6Ljbdq< zIzdNz6oO7Rfd)Y9@U>pQUpP8M-@`zMw_S0Xsr#N_1L5L zV>N?^63euN^cc4Rh516yZuQ6g4~aoipuj?bBP>H%Y_6&sr*RGesO}Y=8w1CT+7YL@ zwnCSibeD;FSjm=2nLzm#4IsAZAZjMIs&ixoI+#lDR>O>xE1qKwuadoRtn;@-vafo| z4m747GW!VYIOVBi${D`tn`_K1FQ}-Aor|79{%S@V7YDAzSUzn|8kWUg{&==Fyi1sG z*sT+2j($VGXGp*ngE!})R7A~GvG%ko#EbQ;?Nk-~sJ8N@lO3x<6X09#+!6405S7D$ zW#KWZbQA-@z1p(yvtRK3geQjsx199d@u(UiGlRfk%PzkF+&jk|>p1A^G|v^ALeJb$ z&LfsZ(}n*nKPaE6z_HJapgTHPHX``L|NTBLB4!fk%M7=u5MYQGQi@7l3Pl-17J{0LYc#J%5`M1g1ltYT=Tz zeO8`h0=7i%bZ0i+`dBzCm{vY{(AYXKiCg|2|gEiZF9 z$u}ZU-NeR~4C8!pR(=Nr_L;MAC-^(hA)~T!K}?Lem}%CT#qdZtHsWd)zw`h-0v%L= z4Z%1#{$o5#ApetWDvr=L-O4B9%jXJnFF>@?dF-r4>_YI z^zIoq&b0CB|TKQCm|oIi#|gqcDdsv2EhZ1uFe?xx1e>zkQU= zoD!YF8@V_4IU!NXDi`*PDbHANnr63WLTHt}Qu#AQOCof{^ujM;N^;69iGJn?3BDmTbxNB%t6OF zKgs4Nx^g7}aV*}S3)YpUVYE&sRa4yB(=7;h1zJTY6{%Du?KI1a>m=AAT$Le3ftj|c zFtIZ~>#~n)zV@kvNKqaLI4k+oFh2h(Pz}FNk!5S9?8-k zfSXSaLAP$A3LqqJ5!JPdu@>dGv9vwzJry$i^A0>js>^EnEvi%LU16y)wfWMQ4#-?% zwQni!!)v+l(VKj^)q1>#u7xX1DbsY0T4NOmTOPfY?qBvwC&yjL^<)OFqOK&J6TO{+ zbMazjtfZ4{p<|ClrZQT0 zZ$!26@0v$NC4Aa&`c`28d8k*Y*68l%@8v$ah5~{0KU8bR96!jht#zx&#gn`rBrF0Mxj0UCRE1zTZ!^u@D1g8s?W^tZ!x624AX5|G4$j@JF9e)+${M%`1`ZcuJbOf z(4e2yX2_AlcG`N{*RN2xD0yR4EwJ-IhOuo46CWF*&@*Zp!&fM5Kn%J1OOEL7QlY-N zwmgrww(V41lW7fmPgnJy3j)~>F3B?+?(4?m2q`hgChVa=6{=twDyY6$O1^ z>}5aK`C>|E(`oYq7z`PQe2n!n*=zAS(odJ(k{c(nXKc|Vym70!ax%Ew?+J0-S z3RsjbD0}}qv8s))0cpcup(p`TCXB7&JW?h|N7N4y&`lN81TjH@DRW}iUZ#AG8RK*{ zrfM@UmU(iSO_{$byHS^K)+>>0;57$tRWclZoTrQEZjtA&(rc+iiZa?0QE~=^#`A?^SL<;bB`hXrt4I(RU1I%_89Nw_ZWeD+-K=`u@91- zl%56q1IByMw@F|B=dT}10=@dDwWjaZnx8+j1=4PLH37wk3S&mxa>rj#nj_2(b1lF z0eqc`(<+)fwow^viCVC@pXAqG;5{gJqW@bP|AxTu9<(N3f)Q4K$UKHx0;nK<^-WQn z%(iNwj57Vm_gTFHzegNHeAnyS+O+zFJ#0-TG0;qifD%AqBuvbCdNWT)ao&io*)G6tkHyjYzYx zOqEFr4Io`eyU^K*yFeMfdvWN5-to7goXE9doRB(@&H=g(uyei+kaI^rm;7p6zg!Bv zKrHh?ArkR{A(HZebi{WfdMEh(YUV%E(s!&T%m9UPEJPa{cH$Q*nB#{zIj@SJ`hYo^ zP?0z?2ytmgo6{U?4t1`c)v@MX&Kzj2Y+G`v`4(k8d7yQhVxEvYP1Tg%9i&*W70IW+KBPVwFTd5Ypkm+^~9XG(a8qlYJ5OJ#%mY3eOnQ+eR6}V*oP_wP-WXt}ppqE*POh)Lln`+*9&F zkDwe1o^f{}iokbrzb2_{FjtHv{2IIO+`7JSCv^7$5=WKy35sQN;q&UG(mE52CLb14appJ% z?UB#cnjbnBj4Qvv*S6#BmSTxE3w`}vvL2Y{F4oLV${x^HNAK(|cp8*>ETcOss-jiwJ_#5ngE?*$Yzk@uqLJAD{Intzw#K-mk2kMx#?z_ zVtva+iJnEP_>b~M67Y4SV)k{VV#OA(;`$b|V(1pNVqY6`k_+pz?`zvF5SFFYxF-hd z6vYhdq7tySX~gu+x)CmI7h1(dwj3n*_8s6SWb616RW^@AIdF3qn+imu?eFu~=3Q4ReS04s5^BS}wvhD23Jd~a`NqG%zAQ>zv)m$iZ z8Hgpuj{wRSOkubh#ld*EBQi8$2tX&A4f0Y%>kA?ae!9qAqDkTK3lbk`$}x|ni20rI z=$#Q&SU|Zg9-W{TG;RD;u&RW$A?=*MFfQ+mTQ=udrw_gf9Tn+G^sHBkTYEW1jyHFH((jE=`E)uKDfkc%vtt6b@bXJ;y7eh`|- z!+qsc(#E@n97Z-*!jm3C?#a64Nxw8~k0akUm&{5sq2S_@OV2$kp2N@XS(Ie)=In_h zulill#GJbxLy15ZFK+`qFunh_14dIVl|N?+-P#NK?#@&#LB?lS3gD(+ntCNyB#N*_ zogkDZC9cwx+LgwS`IMr|q%pg)UYNBDJItl`yMWH)%lr*f*oofX84;j2F>24nSu=M< zR3uKdFjpI#nzaX<$jUsj@QtaA8hHNo-js=B3i;r*PM1S@{yIT8!V<)pH|kTGlzus4 zG@e0V2(wDp?~(}QbDg7>iib6r@Xro9F!Mr9_igV$N~o98xQ=m+k&l6T_`SCTMok1T5JlyKngQd2x$p;I?-c&+ z(x-K2?)>`?SUecQaS*K;_duZ-rPVoNP&|SdH<-N}!$>HvjsPqYx?v60l_xn9h?F5) zO`I_^2ZGq{q!pZupcjfv$S4!O`nXl6`J_L!LQwXzhr3SrW3OqO(^5Z4e$U`c@Mlqv zx>MK#(H1Y@ZWTx5%aC=movg@D9d=VSPkn_a@m#4iRz{ii){;yaua|L?+y}5lJw;6P z)ZbAv_)byrrOTA8U%V!KP=0)wV@%u@Z1?%2Epb%Z6?GT;^cdfb_9$Qc@HeygmZ(BA zIr@rsQoR33a*_1FH%F)(;Z?}be9EvpC#l2D_(%y9Cpni_vo_d5_hmC`+ziu+2kO0e zFR}7WMLd@#@J99~FciP(BzmD#4{Unp5vCx$)C`UFz?{r>CnWq=B~-Hs6Gkfje%%_q zO|`${i47e7jxH#}LCF97B?IS#<9JC17|0CI-4g6qcszuc9SO!m-C<%S1$ci5^>2$dM*QV(|FoDxDm z+F~juO(^?qgBRceHzkU0zK`W)7FQA3=m;{S|D)7z*+^eCJ0?XCFn5FTG9*?4{`O$= zDvfnk3sK|UE1wDFS17=Ltq#O|tqer8uJS<86r3Kf4~5aK3(hV0%_R|_Dxu1Wn@Z9J za~iJ)X;-|w_bd@|ag2*@_v^W)cTz&N4O}b!~LtIP%P@gswM$niSZ&_AMQNUNZbJEvD%V zT%z`v=EJ?M{RJ`66RHxjd_7U}d(s_sj$_xS7zlt(_&{H_2fzA-Y5c*Y6ZlN}_vc9g z_h28fDj{(Ov~$zDFvS9fJtu>k-_Uf&n$Z-;?$LuHuJiITZ2WXj+M6RqTW_ zi{EmMgr7kNL!B@O{hbg8{cpt6oZ+FEfy4&PXLJeG^g`Ykm&_Zuxsx$xiK-M#Du`sv z1pbQ7;5)7Z^yt|tW{{&^6IZC%2YiWF!ze%rJz8rG+2TDfw5S8&z^<2hBj)1`k~5jC zM1op%EJai*twGCE?pfx#O1%nD`mCnWN>2TMg?$BBRa^5n4bt6xkVcU1QUU1{1f;ve z00fSrf`EV+Y!oDv1_|kIkQN1z4h2M{8wJ0$&*8mZ{om*L_Pso7GryTxvu4$-IY(B( zu&b$SZMnC&{%+oD#{e0VluOS3$ioMRYRs7fxvzfcABNS~iew7sIiEK=e01n3pIMYc z^no|TL?>NoEWNJqlJ8+w&A8f<^)Q)Ch*o{8E@D$^=O?A+w88Y5SKGz1;}=tFm`$dI zUT!PwfPdEY_3$>MclLJbx95JEN`^cM`iH{Tt|?}w=H2|jccdKxeGnd6mOe6z3(~~Q z{AKckIAfdXniF5c6Q4ESdJXK}0A=oOuzC&ZeM%PoHBKYuBtnGb3!TJU<70F6&HGvZz&v z=x~hP70u>xXFSR#d20Up?g!klrQ|d3z4)@OM(%QDXS=g>>!QXEaWa);Rbr_WPA+m~ODi8+oApYzTfR62aJ zO3ZYmz`?ZG-q>D&zZ6$h@}za<=#$cu8+H2Y1=mu0N9MPYUgKlw>2(or&IK|ZMr?+E zxm&T}XPYAwdFNc>I@?k?eoCuf%Fe^L#yCQy=XbE33-zr`J|IyanC-D{GS!6gi3=uDbFWlL-sl3!J(oH^ax2 zxfmYv(cfOvHrV%E({hrTwW(A=8R@LNo`1B`%!bf*#r29neyDalNg>9lhF*RJGl4-( zl&aIl>xoIt%hHl|i}@ut*L8@Df`Aq|JpOKJkuiGWcKCd_yjEmkvAX;fFQuJO`XNC< zCcFDvZ{eCdbDF-o&5OPe$jP>Srm_o1&%E+Ui2z;33`XUdVRV?|fnlMUR?~&wJ?y8OO0)m-k$L;y+Fb;WV0c zFC3A{mllg-5Z@OGt*9(19TubD9}AXv9Em*hocIHOdds9pJ|*o??{gy=e@&X^B_kWF z$>e9n_cd1Bh@V!>eUo`#?qAL1Z+q;Q+9~FFCQfbi>H=x%nOP4^XDu@Uo7cC3%q1%? ziHGxjJ}8%u-AW&&%CR60&3a}X96kftWRxaVz;N(hsshkBi zQb_)WZH3&-)}d+DsGLY2RpJ}|ThGiDS`DwUtcKI%B$;pAeRG6Yo8HjPVk1Fh!Kg4* z{d)B}nZH|IQ1h35@Fj`xyRt{3ABNt?+J+=#zhMm!%6;s9@kMP(Nn!LzSPkA;i)F^3 z?tOXBsWSt@QSo_dDL=1;K7Z4gv)*=B$c+hEx3WUtDKxc9H5|ezk#n2d{C37^0auc5 zCcb7Dqi#G{!HYs9jzu}p>QW?5jE331Q>@KYiJQ{&cF!;Fw3hGtu)1MuVB{=!$-{F; z5{IlN=`uCNa18s{{Cvq9*0ZstW-hq}JvE7@cJ)C+%D6Ec?!GRrnX@nT;{#cxR%>Ho zkjetyFCf!_ngq#h{6L*g3#sp?W<0mW@tCIPincTq4@~p$md>-_S@b_jACIu&)4up( zd?GQ7P{YWxY0k_)nnrv?QSjfjf%ig9M*C@H{ zruiK~x5~83U(A{Hh}>(kGXn$Js|?&j_V|g+<$W()nRG}l5nAa}+dF5LFnda1OJO2KmzGAKL-DoZ6eJp!&RhlJx3Z$VO!=s0y{tl{9+n9tanTf@9{C5Xk3g~SG z(GJ0)9{Lpm30!q^Yx>LSK4=4*mTvbnCn&o z@|x>=>9SZR1lm;Odhb_fNIdC%sBkFZ9Ov{2Q}#4pV-oU-nhuog3t* zDSKaLpKj@uGZb;Lys>67j)-aa#pUF4ZHbZU0tdpM3T2*rjHqgOi4a|B~@c-`hgs& ze8aXd_ri0tJJC^r{PuTauT?Vqq^$`H49R~sxa>8gn^~Se&J^(Uku(2U#{=4T7m{qR zSZGy=D!Sd}L+k{QlUDgg?ClutLEYHYEtXt*Z{82uvEILM+xs-9sr#3Q5nCo<@4Rl@ z6IkE7q%1Kuk-y!-xF#Q$Dk^_*VYBOlyb$uf?M6ZJy~&r-McHLfHDc(x%JkdIAL*}*g#~2w zm~}4QU7^orx#M{@lEt2SC@4szpu?#2QkPBmg*S$AjISQbQnwV4be83$hfMG@-yPp3 zM(&ul#V;`vS!qCi=k$Y~UdO2ENt9?SNj*C?_nVobY)pMnbjyCl9yUSc~Zb4QHAh z0bNjKQTt@hX3uh<(L2{vd*lJ6rPZ9Z~M4 zo*1S+5e6N#Sn(dC)H7MFLC>N{xT;!7E~V6MYO*RFy88U^&8rA{e$GvjDO#GzV38<( zJ@w&TdVyI)>J*jYov8gvX0!BWLKg?0ING$AokydVb~wrJS38?ONCh|NZw}p%wEv{D zOCM-@s8c~cd?UE|m3zMH<3Mev`$;(?BN|W>J%JE1Bzq9~%|S1voyW=G-t?MlzV{V{ z#?v;AAB<=%NlM;+euYpOc$E9;(DH^&br+qpGwIw@t7$?lT<@C*>*dMU>9jiDt{&TE zNx^lv0b@&%=W^~1ap`_ozn2hwr?%XbPdqa>v-(4)UwXRwLIm;=zJ=2P-drfI%G1(WIzvYrPY9-HHW9r+_ z=5}bA3N}{`^1_~gFfVIQ+P9A>wl)OERg0(uGo>N!qK}^+_#aYHO*MZB91(5`o^~@| zksi={QKG2eOUljjVEJmTL)K6KF1ji>bO_=2xg`J~bLy28YH zPrR+CxEwtlHp;%A>@FXj*Hd2jdhsrYtVNlt&ES0X)W?MI;Wm#grsG04U#ZHQM^(;; z(Sd_+%s533xO$zM5jjf8mGWf%h*e&dYc~b52uP4W!YEyAJC<1}2?IkDTd54bwCR3t z6|%HBs-VS|TzbcS=U41==9dz|#$g zTo;x__EyucUWm~DAvXWw_b26eIer{UMsiZupIKJmJ|6FcmFJ<#hzRA~@i8qxo3Zk`|=cO{u>dCsE}c~6?j z&x=FBy5+jhsjUOZJ}*^q-=^(ZZor=Ry(KH_9^~b#uAUP8A68N>eNK7#*{Xk@S=Mz&36`^r8$Xx)fZcJ-@4DwsX1)U`!|e?YsRfCh@UEI<h*M?+7q#~3#{;0bD|3U*dzzxaw|WI0=|fHb{QvU=7i&5>v`rM$rMj9L!wPcE$YIL*?IO@`u|K{CQ1R4~&`Q z6&QZfk93pM$<7K1u<2!Errx;bqOz{YzZ!U`HugT>@|8ZFuKrZ>!qtGbik_+rP}iZ^|gZAey$L75jBQ6>xM6S`EUfzQ= z5e+68T@>NtYPy@yuF#%%L5_=e+vEHjnO#mv z>ouQ|JFg|5rKByWPQSl95qC!`g!A&3-STMcuff84q1p@8rkh>Z(i(gVeFxZ^gCvWN z)c#g?5zafWVn{!cvwY=KApRUIOr~nyk`Q@MJeWbreeNahagf(z#lRK;#^gDbmr7&p z#Vh1-%XKVv>7B;G!b5|YM&{#gP;CgyoP8Q05{X|=rtqrJ>)5g~Zt4!><MIITx-%WhtZ(tZI^Eoa|4{F$O9>>*Fj zU6o2nB9oIgiTOd(l3YRP%FsQ@)N6#gyMi}vlm~>&khZ?+#A{HFfl|fr166$rR>_$| z=?H$Z@EGbkeXf6EIM#5sa3kQ1qIib3@JIw{5b|`3@VjraEf>4;tHIwjkt?k$AWw>F zTzq<2x5PY7*rViFyN{P{AV*~L>xHb;hG(1AAwr3teWk3v`1H)F3?yfM0VxQgk1$5vyVXjeW?DUrhNk`eDXTgu8-B5r!> z+8pU;Bw1iG6X&}gq0bRP-8(rjdu46o4=qrBDcA3vPrKr*h zrR>(0H}r*D^`gVx12ob!z8|$$*OR;#v=hdAE2>R>DUV54R^1Bo$xH>OW8co@z82DG z9~=q@yWA^AtFr)&Z3-!P>Xg=nA_e9T+{13&KZDd?Tw6N8_n&X+SGu<8EajP=7OIVI=$Egr(JL(Vx=HNL*%0389`T$`PH%OVkn_{;ZyoUEn`3PnF@)NY9ojF; zD84Z28@T^9Mgc2TBdhF2`F`EXRq?EW)4WSZQq)L6vM(*v$1Q7YX8fr+=l5~RgMMTZ z>{nYmV}z1%q!_H94QnJ%fT+^)Igzc1)T)=yA5JDbi&2^1z7{KuEy@!h`F=$C(6LaW z?33T{=l9=sV|6cXTnZZ@4?FyDE%|mp$k(vbFY;@@_On;i-V;iB%Bd(_nUh&RSW9^+ zs!cZYC$cBL`Eh5xro3ykwd;^w9F*pzu%@3?2elb=Z2bBd^5lW4q-Nvw&t zxILj3dx!tab=yKrBVOxU*CzA_j(Xb6tup!&vya8ixx~^LH_Wute{5*>CU=C#`}0@7 z%8xgSiz!RvKisKvlH|EH@ib=$UqD1XsykjXjfoLie5Z9C8I#Bq^UM8iJnyV}7v9IC zEf(3n_vxeZ!Cqd2bjEfo{6~?@N=Mg~vM?(MG()c}B4bL&9Ji03%VNqj>2J7ye`!@= z<1IfSe0DH>bHpX_j`)LE3ZBB&IC+W%k=2pAcI$7OyFPB@IS7p1@pzx@Cg$Gb;7Z~6 z%p*js8+kBF%BH2fNA;`muA5IJ@yAEji{y#BjneO8lGW0k7ksk?UCqBmBdHWW1@mbRIe&%4!=y=2uW&X#&+f>p zxhHSID*pI-#l1_^=BMgwUTC>jDMVfM4L?S%D0uoXjrgvS;?FdZ5wO_>KUdw&tw8Xm z^J3sAD|5RWW;k@KosPw}R&b_`2yM zZMmHcw--ZRVzG}m${zbZc4g98UWj;A!`7AI3%(dVxkq|qpIt*!n>%IjcIBSp-pcso z-c$qGRHiFy>*;s&vYP33Z} zn{78=Y?mn~pCR!4;`lPwc3C5O-BYA+#9iXDrfV5V#+@J8xQ?IidXK%N@YpkdP)b3h zme2etq_T8AR8~%P-U(Byxn=3cQshddwMN7;iNNv74`jQtMJ!8rt|ZscyRVwN;tuER z@4T{c#p)=q;j#CO$eC!5TC%g(&Jy7-*p@RrCp0dr9rb{DAacP(>PqWq_*1O@MnO51 zH$o2!?zvqD|M(cvDIYh~^?K$<RIMziy|04I zRDA1c_iJrry0=gQ)=_fSzX&GXkcop-*2^O70YJALj2zTxb<=zb_+5bE=~V=(V)s>j3? ze^RN{*N5)C87~}#h8e6MhCQ$Rwq2vMx)@x{s1?&woQS-Le`&n%b;oS3XqIfa?UnvB z@7F`H%|^<;JFV1?V&=y&y(8kP-#Zd7l6EQvc#mAd9Ar6j(-kuIiiJ4*}%%dD4-tr=Z4~4k|-}m$c zLb4YVq79fDF4wUe`t^u7^L3W_*qBY!20h4TcY3t>vAyh7(Cxe4cHcNX;{CombS#`c zqrU#Alfn9}85h$04(D_QBR`=;w2{7>fT4)6IrFlZ&qA(o@0DsUqsaIzCrw`N*_-5* zWprszUU=aDq!rYZ)0+RD^YRA1i*o(P`$RXgn_3hvPP{$ml^~HLMvJVfZlb$SDE>wF z>3n%xLC*!(l3P+LV^2$o-`Ab#q@R|yQ;0B|r=&>;dH&6f7-@+|$BLs^3C)+qR6TpS z$z4_P;`!+q5%JAdRe_iQ#h-n}uc?zbdZ`i|a|6@wx#p=j>Neoi=!37xC0@05yJtvl zdi$Hr+^=ih3Kk#F7EsNNSsO$!wOk_`xiQpGPupKe!ZRadz%~%G0WsxlJy^SLAwzI_ zl?9xOa%tSNLJpD6DmP=hEpsw&ey~l{F(>QVrmt5YDEs>KqakT!F2)*dXhv4{g0v1p za1ir*Rrcte!APx$CQVa&0SH7ROU02Moo*C>CK7S1~2*y&&>uN zj7`YzM9m+s7k;w}FyGc%*f%Xw?-(oA8ICY`5F~1KhUwJAB zFuT_(nk-%3eQOaXy&8VD?%O4kSPm_>!#rFk=5n+67bR*W8HevItF67ty`oE8?Qe&9 zYi|y=Jb#&DD3~Di{hMc7=Do3GyQ=$bbhw-1Z!V4=`)S&jiXyK(?M`-fSk|u~bPsSK zn@_ZRD#>}qfIdRS-81Bsb}M6kMpFB?*@D;CObQXwSbk9g?r#qwW+S>2&RR<+QOtI9 z@K@d;vG6s$7xQ-4e8=v2vE=F%fvqG2DbwZH_fKDM1|?N}9ufq9#`dLj@Qo>bL9eo{ zONzphuc~Bwqn<3JAU*M!UL&aUH*7@8uI#^-+cYXu;nR_t!uq83ec`29AE{S;AI4O$ z>ujTELNA3bvY9|fGOJlWX;}TSAR<*)oe)}7E_bPV&L;I7TW%^v>7}Ra2h*{grnohh zVE^RNtK57wT)EdVrX;V{bXAWJF39m7j2$4_*qoEMc|$Gb2QJBoxNe*-@5}BEU4T4D zmF`%$`Dv<=a|tzYA3P&6Yrdj;rGuW^j*C}sr<6N8>~<)@Ewi*9p&zH|N~=TKy=$cK z)9%x@sOMBuwa7aqb`p%cg!?*cB|+?h1ROM;4YwxW&YNO9ol`OXsC@hU!L8CS&dhF2ctn(`CmQtu>CKGAnq?c>7_h_=RcOELj}U~be@GoAQ0 zB8{|(mAtZuMTMZ5;S9DCc4$zv9u76Wvd5uldLUBu`deKmBL)4?Xrqm%HICLxuKRat zE@H+#FuY~l#1TYJN|G2!)7&;=B0LfDg<`ET>3W`0fbFVQ#o{kV(+&CBJ7+WBe#%}K z5Z~{jUnh&(zPI5oO&Pk;uoCStVl(YKJ$+>8^bP4fx<8ujVfy%H%3)(Ir}xpNP9Dc zmrZehVvRY#t}|Ttbm87K-gT>A9Ns^_P#8UA*hf`uQef?tB`j4~NT~HEqy--sUU!kwU&T_Wd(qY@D}5tqhJCuTXNwQ+y)l#lZXc znQQ3zzVj8KSgQfaUVhE|Mh(SME28I@Z5?J^8xZ7n#w6DZw zXfQ*Omd2y(4Z^269@3mE^&nVpwbnKbQs~X!=8%qJk72)KL#jg2{FtC0vCkZ~NKtpI z=|e{aFYDJ%8kS~S91a{?915Izf^c%?3lG&Es)$6);9w2B_zuy4&Q=i)AI0tBI0X>H_R2~-KjC~zojDh#Pru$o!SvZ8F7 zR+}&hUzi2wGQGkdl!%%UVH9?G(v5kwi@<|`n)#);PvA`oVs`qwzUt?aa0(d3g~N3H z&Pj*nlRcp8Z+t`47_%scoNQ~_BhOmKvrsXdbdkuM+XxjqT*m5cfqcZ1sViZ|h@aPpuGOMP6r8!xL* zKUP^#6SzQnOWRVJ-Dk?Q&iHzL%%x}H%AR(lB1yqoHvEs~XD!?|*iRuH?Be6^;Zc8j zEE!aDg|$oVtXJ>q!tM`&x8eb5OL$~-2k-JYm(#`DV(t&b+wKWw24Y{Ja5;7HmKMD| zxt-}?l+lXWwX#a%E3Q(k1> zxP4gVpR4=7Zygs%!In3pnQC?_wyjg1G9YO6$fJ1p8Iw^r(pbuTBQFb6F{P2=T)ES# zZ+dlJ?)@hzoH5$2#$mUR7s3dn{By!_F5*e9?kt_j3wP->qe~?fdkFOiHl=Z=soV>t z&SCefi!ixCmA)R^%tpf%9hI5G8j(&GjwKBh%kld2%{S8$={+IJF(O>3x%DGC-1wq{ z&kcWr8;@sFK5Dd0YLaJNC*Z;n#R7k8o7RDU!fRa_pP`LZ^gfHjL!|4>I&L$^o$9Z0 zG0l89_5^AxD&HTme{>|X+rq!!$2{q+?4o?iu2pT#G0c=)6>*N9^OLTKhKRC=rpWCa zO$}qQYCL9@!W4QL4VB5fyQyh+moFt_Kj>zwLMkd$4s0@>4LW6}5_VNIQ$RI@s_491s>^f z*_SxT%BJXcly;q$X6{zo+|W==jpcqnD$dpa#qU{g6_G}F7S+L3E+kvmLd~PDLVZaV zt?&-9jY19XXG`A+o$ad6q=^mD=-sWAMa*slaM8ta%Wf^1@iIj(idL@&IGb`O-_LwC zsv*v_@{N#(^2$cA{EN6n&W!-UCvQ9KYE+oh@!_Onz-L5qHhpuo**Q;=zf_O8O3K*y;_pp@s<=n|vT=cFia z(V!~~SEi3!rHK0aCmeQy-pHOQ(P8;8Yybjh+>CvnZ%*HiSM^tx}hIlC={X~)c zy=ITwzGK(kV5y5ZYhw4)@1l14jR3Kox$VqPl|KiV17?TWtOC}i@*@W<>vr!&u3C@2 znN9z?zO2qVvDq2N;vIu`weQZoK+dne)6Xo*`xT%QvwE0qUZQkO9GU0#)260UL!ehj-e*+lv3Z+X2Ku21>( zuv|_3(0LJmJqFr;vxUSWUO14izxTp=WEDqn*rXxw%E)O7ghWTw@GNhf{tKTvyjjHw zfs*9D2VJ8tF~~|NuH(#jNfMt4J{nY%#V(0k!IZM1d-|)YdxMvg2RY@r(Pd&xs^1l` z&G>6Do-Lu-pC%vyt4NM_BuD!0m9)=i=8>vd%VC>&52W|K9&fB6KMp7M8$H)QpmSvS zg1PL-#8H>J>y*`gF$(K0S)>@1tMB^FTcjNhxp!rVaBCAQlaac~dZRr3l%g-|HWsL? z_9#j3EX-?~vlNmW3008}DxPl+Lv-&U+F~3lRSv&N874}Y1#StdXPd7RhFv{9rkuns zcy#rQbEI1fS=OemolRo*gm4Sbg=ctuVk0J!P%AkLcAtv*gn>mq^Ys!E3F$l;mrZZE zAx|rh)wz;#ky#D$Uq8N*(;Vv=t0ik$vXViqHI_APK9ARiUo78SU)Tw)IcEF!RX&xH z(ga+nYi%q|3H zP=g`Op;J%2;Fnod!m&5-OZ^Vv;zjr+ONmG+5Pn&#BAP?MFFg}PyXvU>Z-N_|)x|i# z{Wq3Svne}I<3pH{e*dXO51YxCVIwdXYCLZr* z%Jbx~K=~l0KgtyT1IlZ}FeM$ADvEg z^(d-t()ZLCVE#&zG3r;SHXQQOn4nY{NYE?^!jQZj4FT$MA~hrp3+iSe$4nX*1{fM> zpi$$4U+BKl1hT>}kML*@QQnWeMazP^gz5DYT2GWh=5$&yR9yzSv@EFWk9=xqzvIAC zR*kf$ap9MHZM2_I6zeWpV^q(Sf1~wA^$a&IT`CIdJViH)(wxUiCydfFE=+eo28(}G zqPq?AWM4i{hvK!+pu39=BePm`53t}DZ(X`o6vf(*?gz>oOAETY_$asM6-nvx;$dLS z5JLlXII@+z_H+_>u#mMY-5nI~7hgIK)R@A5N=JoK!<xNCT5(XO9@8KcNmGDDvJGCt6De2$)) z5tLL`^d!Wf4K)u^vO%{J*r_U2GZ_egRD@OyL#0*?W2qyM z_{GMQhz-g_1k)<)xCm~hcVwV6lVswCOXLM6DHyNRV2Yw72AZeC1SiFCLBBy~<(b*h zb1bb9fm?agf=LAzaMs%}T|yauTYCv#4I2YP0}n!7$2BuZiC?J}$#ex9wlF9_*ccC7 zzgNHnTPRvN_kf8S_SGK5qz@aS@tnyXZfe0RCRO3(}6YZ9lWT?RF1x9DWU@mk>6M~&=Ifca%ySRG)#6i?PNSkCA=D>dwYmwT*kaJ?TASh--n{Y2J}+@Kt2 zWNpEP4Ns%Kfu92$+I$gG$^f^q6_Mf-R(7_tR=`?9`&lo-1NiM{RstSS4id5r!&YQd zuu-yuvgRz?Be)4B6P=d4Au44GZq|XkWGrSdT~qTd4>rzf`g* z@`DmF$3`y&N_hr$D|kjF39&Q4^m0@7WK=H&8az}G0XNYd&Y^dwdp7KyZ)TGyv{{q9r&>!LLe^oL^v=OP=#8 z-2P|koI`Lsy-YY?mBU_rAQv`vg%$(j`w{F_zDji>ggY%@DCIz8!QEiageU)!BRK}fmwI?yBcNLnG&q&&8i+pFI-1J}6Sx!I-4JeY=YPD8xBh=Kn3%YfjEJbXos5K?gt+5b z2@&bDcD6Fo65?W&T-gY9Ow4S^BL@+Qy2%c8|0Z;tgAif!1ghY>BzwVCoC;u8(1ZE+ z`%!^(auGc2Fq1dmrds)H!1WCWgY7p5csqv;*~(+lK)JaHdXzo|3A$VUQUFQBz~KFZ zRRWsHMZgytLJWBbW~|k(&}=S(1`;u5VS!xp5b&-B1px%xlMV}__<|6EIslaeuK(j9 z?#>wrv{HdTl&Z^PK?c6y;{>*Rv<8uUprOGR3%XrHD+C3fP-9@KeK?BB3q5=bcAM!F zXdQ+)ld&L^^O>q6i|&rhIy7_w)gmsy_4~(c8q7fxpRsyKu1Q~#laa%OPVuwR6@OLwQ-vtRSoBYEx z8A!hv0f)L!Ofk?x5{lNM7m7m->6ajgQR6MZYBD^R8OUj1V89Lh{Zyu+`EB|^KmAI@ zAwvnl>a0qDy6U=rVAB6`uPncR0yaE?jWICbQ1$my1kIEn;Oj3T);B=W(JnMwf?E+quZ>5IMJ+pwT@xj25{9Oll z<99g)_rqzZ!GVnoGOtD}cdrI&Mq^H(qG|*+O3iHpx>s6WKuQo3K;8xcf zv<8kEpkYdt5E=|-;DjD-AqXLl6DS0RYIaVb^&LV|sJ8|IA6=j^7<#2dgq9+gWFUtG zYS9YiYXS77>I4d@MNpwu{JVy=zuu?=Tl)WA@!vv4wdfW9D=gZ?MGR}@hJ@7H0J%_2qHYZe@T`-!b>k#lM5ZZvDX9d3@B1oYgtxLBaK&yKwhzYu1 zkD!DFl40rtHVX92s9~d^hL-A2mQUM3SH4aiVD~4`2YkY~lffcy9N!!=I<#ZQ3wLB0=mj->{)p@*=p!HwS#J*3l! zhO8O^G{i>vFDVe)qdQ)DM~IQz1t@=liGlcC2Y9QJMhS30yFd+U`TTvR#`ueuEggE- zgy4kKo6t3yHGvu8(TpZ0Hl6I@T;#RRyzrz01MTmrJJ5ulx@65jlIH*|sn?8N6Kj`?;4x`8@u1TG!Cj`6_vcB85n>IT%dQz)t!gzQEylJPJ#n-xV>IrATmPt6l_ z%LGo8=KMQu`~opRlTDsEx6RnX#T_*x#Ff{A?8^VQSJQ9d^0Ig7F z0N^-J|Bb_e-hcT~Eb*zbCCH(D1$h*%-@ORl7@(2?gcxe|Sbk|%MFEd;knMu!lilm3#!t0LU1SL0s<< zVwg8NuLlP z3j`IzwAy=UnztG;A@t)D%3s8z01%0V0UnXRXByl&zw@bok3P&ySPE`d6Rbp|2L6>9 zIvhoSbP_~5253LopusWVBK0v;Wo9t#DFUW3L$z!aMcK&bU+Yog9QJjN4J3ie+LT#BLnB};4m1vHI9&g=Stni`5q|{hdcyp z$e$;JG7aeVID!lQ5QPFdHGwjp5d@T2N)~7U&iww@U{=S#B%uYX4ZGXl;Z2PVEXe|~ z9UyT3%i!Nx;Ip~>jJbfi4cQ5(j{UXzXf8vec(CK-wP&q%YB8`4nj*x=*AR+1ZLMM zHElKm>8raSFaGBa|2-4U?nz2T0QF6wtelzxR^HD=1Ku1|WRTD_3Q(K|fPFQ3u-uqN zfW#&g18CUz#LWMMlBb||Xzp1UVPZHzra2IJ|K(2a7o{E#C@?VIfkE_V9%K&En?bqr z!3?OjN)XbA1IeKo1U;yB1*RW0Z17_XJ%10D$N1_A&&-{+Q5-6900Hr^3S*B zH4=gFQ_)@eF1tE zeE$LPp@&}(Ab$_#z`*wq7~n+(d)q(&_T%r*5B`qM(!x>PaPUVAna-p1yUYVM@v&$C zJ}h7$-Vew8E2AL$2+awn693CnueG20MU!G+9M}I{c_yU1fVco_uSpJ| ztpy`p8XPwN3?J|GqP3$^j-M7#1}*`IV#U8l1Hy|4@c9^|vj}M6-_W#Qr|5{G)I|g< z02*LG@c<1x013kXvaz8qD2fSel-%qX7~+3SPT-%fi1X~g#(wdY&PK506@ygUpFCUS ztS2!noN65TiZb%+S1^olXj#z_q~sEU99F_OxNYeJR)KRs(Vy$0Io*kpm?cz$@|S=- zE5iwKV+lb8%VRz6{rC->7o1cvFl7HQw3F$C6=WSLAj@wkBRszWC8xMfkl&Fe48!Vn zG6IIyfZr!ULK4nz|9*J*ehZO8{L3hHa?8M%?!r*hcLXb(FC>NT0RZkm>`CXji+mUu zilvwsU<3Wvb5{Nz_LHde%ZZF8cbf($SPicO$Nw3fbUFS@21KgFr2jr=d0m3^zXL-g zUC>-`V)DN_6{;R$@+JU#koMm@dJ@$59krwH13lRK*HKMHMW-}Sz*htb91r9*e8=Dg zt6Xl`-@BY6&p=h{DDf_ssHwn)N+150`_=P&mY#umj~DrO4l)!{*+3}6PA1te{q!C< zIc@xJ9!Dq@@PNu^Hb6c19N7LzCsO`#8iv>6HzL(k79fT%8~J-fx)0fIqBf+IO`t_6 zf(=rMU=xPEZ=zQELzp;Qd7@fz3)L>YEkIYQiuqUYNFI8^4-$){kO$xg>O=N` zrW+Z*5ma)K0BSo?CwuX0XCyd1#{B$y9ULF!_$O7!3pB~>15H(1zlrz|93eut_E8nZ z!>~6F_~`q8Ny+~jiyx~>rQ(?|Fn-PdooI}LFb@!7@C-fQ+Rr)-mSq8!zekZJhzU{2 zziS7mNfLJe>b%E`A__s{2Pi|n!$e836HYi%gd`5pzDu5&s&N3zLn8S3GxWPJal(&E zD?UBpKOZ+cm<$#GOU}O+0C`DHNTmgs1CovS&??{u9{P0%YUYqfAtI3O4;0b*2OuV> zpQuko6N_P@y9p;8`LRK(XyPwG#3Cbte1C#41tb>#Gu+7^(wcVyYc(dx-@$h=mvYAXrKX9aF}+4 zYDWnSP+mp@sNirP4V*d#fQuU%P&-D=E(@6U;X0az3Ikzg*f!mg^0T`jVHQ~T_gTdxU_YSKg^=DalnFL4;E{#~o}p=ZfQDU{iGbc^BB-IsUkH+aKEmGk s1y0lLPYJk$6#jo7WS{Zz_jIuL(bvKSTObC;9{A7S6a!;32Tq3nKbeSs)Bpeg diff --git a/binaries/frameworks/Tizen.Multimedia.dll b/binaries/frameworks/Tizen.Multimedia.dll index a0247bd2012bc584e4fbaa2663e6186cb0a1f782..3edf5a56ccf06396a269ddcebca706c2449de933 100644 GIT binary patch delta 252 zcmV%GG_oOCOIfHEUmnc?^OQ2Gz?Q! z&_o7fElv4T)1FF4U|7o7Qas6&Z*+)WGP=Yr6*n=RVvad6qVp{MOJ^+sQn#!N0aOSc C<7O8C delta 252 zcmVd_jRiTJ}mv&}Oq-?$8{62)%9KHO>>8QKQ83u=z^?m(@!GQvNt- z=3?L9Oo{-w@`Hkv1bEE=yUxP;f}(Vg*~?VR6AD^WI5K$wf48g)0aOS< Cp>Li5 diff --git a/build/Open.snk b/build/Open.snk new file mode 100644 index 0000000000000000000000000000000000000000..4aed427a6396b34cf526ba67eba2ef1aa8ed5735 GIT binary patch literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098e6|n$9NI`27(i>uI`xg|PlLP)aMw9(J zGS`PLiB+0Usce`L3@&2sq>9REJKeq)2~4Q!E-crXaLQQ^wsN_%akbX~Aa;RsA@(g~ zgX&PlZM`2iv4y0OtpFBg9&&{E&su*IOi9+JmoGDUH$Tp+~Xpxr?M%!Ato1~zp ztQ8v&b46Kiw{X%&rZFlg=jk#M3)0>Gg**|YHLZg>vR}d$uiF{vj{dtRG`bWkPL8eP zmKJgM%}Suu=(hlsKZ!Hm#;(J2&zsoqB$06LDs?g5upC=Le?(O2F-_)ujtdU@Z}Kf& zNyRaSwc58g49~EvFIZ2sy3C0uDhW$E^ibmzKV)hmWj<1c)!f5L%Ml##T)P=Ge%isP zC2w68IWv}%tulzT`q!gGprdbw&q+<1;QD?Xg>x2m2)T5bG8zo4H`rjQMXFGZ8yKP5 z)Qdyeaj5@eh8_KI%Jbs&;oURkPN|Q-vG6lElAIVbYrO5_S68rzw7L;cfPnsAwog~m z1t62@R)s@#rMT4PfjBWA-7DeBAGB3U9=Bg6BEku;C`sIKx_&n;i!Fux#)}-WL~d#s z?v$eKqFI literal 0 HcmV?d00001 diff --git a/build/common.props b/build/common.props new file mode 100644 index 0000000..1d154e4 --- /dev/null +++ b/build/common.props @@ -0,0 +1,20 @@ + + + + True + True + False + $(NoWarn);1570;1591 + + + + True + $(MSBuildThisFileDirectory)Open.snk + true + + + + + + + diff --git a/build/common.targets b/build/common.targets new file mode 100644 index 0000000..4de98b5 --- /dev/null +++ b/build/common.targets @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/build/dependencies.props b/build/dependencies.props new file mode 100644 index 0000000..cbab6eb --- /dev/null +++ b/build/dependencies.props @@ -0,0 +1,7 @@ + + + + 4.3.0 + + + \ No newline at end of file diff --git a/build/version.props b/build/version.props new file mode 100644 index 0000000..9115119 --- /dev/null +++ b/build/version.props @@ -0,0 +1,8 @@ + + + + 4.0.0 + preview1 + + + \ No newline at end of file diff --git a/packaging/csapi-tizenfx.spec b/packaging/csapi-tizenfx.spec index 4891225..023a5cb 100644 --- a/packaging/csapi-tizenfx.spec +++ b/packaging/csapi-tizenfx.spec @@ -5,7 +5,7 @@ Name: csapi-tizenfx Summary: Assemblies of Tizen .NET -Version: 4.0.0.50 +Version: 4.0.0.51 Release: 1 Group: Development/Libraries License: Apache-2.0 diff --git a/pkg/Tizen.NET.Private.nuspec b/pkg/Tizen.NET.Private.nuspec new file mode 100644 index 0000000..c7ccaf8 --- /dev/null +++ b/pkg/Tizen.NET.Private.nuspec @@ -0,0 +1,20 @@ + + + + Tizen.NET.Private + 4.0.0-preview1 + Samsung Electronics + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + A set of Tizen.NET APIs. This includes all of the APIs built on top of Tizen Platform. + © Samsung Electronics Co., Ltd All Rights Reserved + + + + + + + diff --git a/pkg/Tizen.NET.Private.sln b/pkg/Tizen.NET.Private.sln new file mode 100644 index 0000000..70d094d --- /dev/null +++ b/pkg/Tizen.NET.Private.sln @@ -0,0 +1,1154 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElmSharp", "..\src\ElmSharp\ElmSharp.csproj", "{0D605E7E-16C9-4712-B552-8E12A7E5DC1F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElmSharp.Wearable", "..\src\ElmSharp.Wearable\ElmSharp.Wearable.csproj", "{4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.AccountManager", "..\src\Tizen.Account.AccountManager\Tizen.Account.AccountManager.csproj", "{9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.FidoClient", "..\src\Tizen.Account.FidoClient\Tizen.Account.FidoClient.csproj", "{1DC41002-4450-41E3-BC10-DFC6CBCD79D7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Account.OAuth2", "..\src\Tizen.Account.OAuth2\Tizen.Account.OAuth2.csproj", "{CDBB2633-FE0B-485E-B864-DCA9240E6F7D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Alarm", "..\src\Tizen.Applications.Alarm\Tizen.Applications.Alarm.csproj", "{6B8722E8-94A4-4739-B0E3-14F1B158BC81}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.AttachPanel", "..\src\Tizen.Applications.AttachPanel\Tizen.Applications.AttachPanel.csproj", "{3BACD1BC-613C-4A68-87F2-789B5937FBF6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Badge", "..\src\Tizen.Applications.Badge\Tizen.Applications.Badge.csproj", "{0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Common", "..\src\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{A4B36D9E-EB03-474E-B806-F6DE49391C13}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.DataControl", "..\src\Tizen.Applications.DataControl\Tizen.Applications.DataControl.csproj", "{51AA2490-864E-44E3-A5DF-ED27501EF572}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.MessagePort", "..\src\Tizen.Applications.MessagePort\Tizen.Applications.MessagePort.csproj", "{77F493B8-C41A-45A8-87F4-C07400070118}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.NotificationEventListener", "..\src\Tizen.Applications.NotificationEventListener\Tizen.Applications.NotificationEventListener.csproj", "{B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Notification", "..\src\Tizen.Applications.Notification\Tizen.Applications.Notification.csproj", "{B459C1AE-938F-48BC-8720-7621DDB794A1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.PackageManager", "..\src\Tizen.Applications.PackageManager\Tizen.Applications.PackageManager.csproj", "{8AB5E861-FCBA-4A03-98A4-A99276167C9A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Preference", "..\src\Tizen.Applications.Preference\Tizen.Applications.Preference.csproj", "{38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.RemoteView", "..\src\Tizen.Applications.RemoteView\Tizen.Applications.RemoteView.csproj", "{DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.Service", "..\src\Tizen.Applications.Service\Tizen.Applications.Service.csproj", "{F8FE708E-3840-4A50-970B-8633CDAB4B27}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.ToastMessage", "..\src\Tizen.Applications.ToastMessage\Tizen.Applications.ToastMessage.csproj", "{80548ED6-43AB-4849-9AD9-0C4CCB474E8D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.UI", "..\src\Tizen.Applications.UI\Tizen.Applications.UI.csproj", "{68FF3769-AE67-4B4E-A70B-5317A7079A26}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.WatchApplication", "..\src\Tizen.Applications.WatchApplication\Tizen.Applications.WatchApplication.csproj", "{1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.WidgetApplication", "..\src\Tizen.Applications.WidgetApplication\Tizen.Applications.WidgetApplication.csproj", "{9669CF47-ACDD-4827-9A3B-B794723274DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.WidgetControl", "..\src\Tizen.Applications.WidgetControl\Tizen.Applications.WidgetControl.csproj", "{26B1B984-955F-4576-B916-636DF40FB266}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Content.Download", "..\src\Tizen.Content.Download\Tizen.Content.Download.csproj", "{117CFB40-0142-4691-95F3-12898C5151F4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Content.MediaContent", "..\src\Tizen.Content.MediaContent\Tizen.Content.MediaContent.csproj", "{A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Content.MimeType", "..\src\Tizen.Content.MimeType\Tizen.Content.MimeType.csproj", "{ADD58969-549B-4D81-BEA4-63E53E945346}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Context", "..\src\Tizen.Context\Tizen.Context.csproj", "{6CF16C69-D77E-4206-B341-627B79055EEE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Convergence", "..\src\Tizen.Convergence\Tizen.Convergence.csproj", "{0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Location.Geofence", "..\src\Tizen.Location.Geofence\Tizen.Location.Geofence.csproj", "{C3F485D7-68AC-4984-8B33-722EF662CF76}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Location", "..\src\Tizen.Location\Tizen.Location.csproj", "{F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Log", "..\src\Tizen.Log\Tizen.Log.csproj", "{DC7B1462-603C-4A7C-A508-7CDDFAD522FD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Maps", "..\src\Tizen.Maps\Tizen.Maps.csproj", "{A549B415-38F0-43D2-B849-169AEADB4546}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Messaging.Push", "..\src\Tizen.Messaging.Push\Tizen.Messaging.Push.csproj", "{4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Messaging", "..\src\Tizen.Messaging\Tizen.Messaging.csproj", "{4D00FBBA-C166-468F-9E01-7F2CE7170D94}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.AudioIO", "..\src\Tizen.Multimedia.AudioIO\Tizen.Multimedia.AudioIO.csproj", "{43B3461B-D18E-4171-8408-D5CF57C62CA3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Camera", "..\src\Tizen.Multimedia.Camera\Tizen.Multimedia.Camera.csproj", "{6E85CF59-EFBB-4A3A-829D-0548C4F8055B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.MediaCodec", "..\src\Tizen.Multimedia.MediaCodec\Tizen.Multimedia.MediaCodec.csproj", "{4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.MediaPlayer", "..\src\Tizen.Multimedia.MediaPlayer\Tizen.Multimedia.MediaPlayer.csproj", "{F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Metadata", "..\src\Tizen.Multimedia.Metadata\Tizen.Multimedia.Metadata.csproj", "{4490279B-E22A-445D-97C2-A0F9D842DAB1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Radio", "..\src\Tizen.Multimedia.Radio\Tizen.Multimedia.Radio.csproj", "{388EBC74-C8BF-487A-866B-8A000927FD54}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Recorder", "..\src\Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj", "{D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Remoting", "..\src\Tizen.Multimedia.Remoting\Tizen.Multimedia.Remoting.csproj", "{24BB2C29-5581-4A81-9CB8-4B9C5958F191}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.StreamRecorder", "..\src\Tizen.Multimedia.StreamRecorder\Tizen.Multimedia.StreamRecorder.csproj", "{84B1AADF-A0FE-4A7F-A949-B09E09876D3C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia", "..\src\Tizen.Multimedia\Tizen.Multimedia.csproj", "{332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Util", "..\src\Tizen.Multimedia.Util\Tizen.Multimedia.Util.csproj", "{DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Multimedia.Vision", "..\src\Tizen.Multimedia.Vision\Tizen.Multimedia.Vision.csproj", "{3FF44973-5B72-4B9F-83E7-58E4C316E1E7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Bluetooth", "..\src\Tizen.Network.Bluetooth\Tizen.Network.Bluetooth.csproj", "{0C6E767F-18A4-4CDD-B088-F7C6138F0565}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Connection", "..\src\Tizen.Network.Connection\Tizen.Network.Connection.csproj", "{2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.IoTConnectivity", "..\src\Tizen.Network.IoTConnectivity\Tizen.Network.IoTConnectivity.csproj", "{DECDDA97-C90D-40C4-9D9A-A5A125D052AC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Mtp", "..\src\Tizen.Network.Mtp\Tizen.Network.Mtp.csproj", "{5CC05A2D-2779-4880-A28C-6800A85B5D9C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Nfc", "..\src\Tizen.Network.Nfc\Tizen.Network.Nfc.csproj", "{D9DC78AA-A9D1-4232-837C-0CF20846B3D6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Nsd", "..\src\Tizen.Network.Nsd\Tizen.Network.Nsd.csproj", "{393B4BDE-A451-41A7-A789-4473782BDF2D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.Smartcard", "..\src\Tizen.Network.Smartcard\Tizen.Network.Smartcard.csproj", "{28634B14-E0AD-423D-9A49-3650E0D15FC0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.WiFiDirect", "..\src\Tizen.Network.WiFiDirect\Tizen.Network.WiFiDirect.csproj", "{BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Network.WiFi", "..\src\Tizen.Network.WiFi\Tizen.Network.WiFi.csproj", "{99AFD4A2-9246-4077-8412-AB7DFACEDC8F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.NUI", "..\src\Tizen.NUI\Tizen.NUI.csproj", "{15153B43-717A-4EC7-811F-4F710837E52F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.PhonenumberUtils", "..\src\Tizen.PhonenumberUtils\Tizen.PhonenumberUtils.csproj", "{A4C62F2A-DFF0-43FA-9515-F12EB3756601}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Pims.Calendar", "..\src\Tizen.Pims.Calendar\Tizen.Pims.Calendar.csproj", "{2DCF26D7-98A5-4656-954E-3406CFB08686}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Pims.Contacts", "..\src\Tizen.Pims.Contacts\Tizen.Pims.Contacts.csproj", "{B7F19C82-AD09-41CF-AE9E-AFF27688DB68}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Security.SecureRepository", "..\src\Tizen.Security.SecureRepository\Tizen.Security.SecureRepository.csproj", "{8575483D-B37F-4C5A-B922-6A73787A6CF0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Security.TEEC", "..\src\Tizen.Security.TEEC\Tizen.Security.TEEC.csproj", "{D627334B-835C-4190-BF4A-9459C50D04D3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Security", "..\src\Tizen.Security\Tizen.Security.csproj", "{8144C3F4-95D2-4179-A7AA-839699EBF374}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Sensor", "..\src\Tizen.Sensor\Tizen.Sensor.csproj", "{6D5251AE-1567-444C-B5D9-D00C54104A1D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.Feedback", "..\src\Tizen.System.Feedback\Tizen.System.Feedback.csproj", "{94768F01-A559-439F-96A6-F6970116A36F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.Information", "..\src\Tizen.System.Information\Tizen.System.Information.csproj", "{01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.MediaKey", "..\src\Tizen.System.MediaKey\Tizen.System.MediaKey.csproj", "{2477737B-DD06-4635-B508-1CB7EE01E805}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.PlatformConfig", "..\src\Tizen.System.PlatformConfig\Tizen.System.PlatformConfig.csproj", "{B2B0B253-1090-44B4-86EC-361D956E88D8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.Storage", "..\src\Tizen.System.Storage\Tizen.System.Storage.csproj", "{30568DC1-552D-4967-A819-2E2086D9A37E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System.SystemSettings", "..\src\Tizen.System.SystemSettings\Tizen.System.SystemSettings.csproj", "{E79C72F5-176F-4935-91F5-79A5C84B0DD5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.System", "..\src\Tizen.System\Tizen.System.csproj", "{CD30D882-6FEE-46F2-A004-AB136BAA97AC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Tapi", "..\src\Tizen.Tapi\Tizen.Tapi.csproj", "{471CBB4B-E6E7-430C-96DD-514CE60FB472}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Telephony", "..\src\Tizen.Telephony\Tizen.Telephony.csproj", "{1DD172EF-123C-415B-B278-F67579C2B3CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen", "..\src\Tizen\Tizen.csproj", "{C8124B80-00A6-44EF-A828-7068AB09975A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Tracer", "..\src\Tizen.Tracer\Tizen.Tracer.csproj", "{9ABC91A3-9B8E-46C8-A580-34E1DF79E872}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.InputMethodManager", "..\src\Tizen.Uix.InputMethodManager\Tizen.Uix.InputMethodManager.csproj", "{BA0A7D4D-2689-4B6D-8F14-1532112E225C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.InputMethod", "..\src\Tizen.Uix.InputMethod\Tizen.Uix.InputMethod.csproj", "{CC8D1830-ECDB-4083-8D60-A83B2876FA62}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.SttEngine", "..\src\Tizen.Uix.SttEngine\Tizen.Uix.SttEngine.csproj", "{712DF299-955A-4321-8320-0FD8A1988FF4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.Stt", "..\src\Tizen.Uix.Stt\Tizen.Uix.Stt.csproj", "{C7810220-7BC8-4C4B-8613-9575E1C48AA5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.TtsEngine", "..\src\Tizen.Uix.TtsEngine\Tizen.Uix.TtsEngine.csproj", "{9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.Tts", "..\src\Tizen.Uix.Tts\Tizen.Uix.Tts.csproj", "{4D0771DE-46FB-481E-B3F9-42980EED680C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Uix.VoiceControl", "..\src\Tizen.Uix.VoiceControl\Tizen.Uix.VoiceControl.csproj", "{34484E72-8CEF-4784-81F5-041754B21BB1}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.WebView", "..\src\Tizen.WebView\Tizen.WebView.csproj", "{8D3289A5-591B-421D-A79C-776B9AC74B95}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|x64.ActiveCfg = Debug|x64 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|x64.Build.0 = Debug|x64 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|x86.ActiveCfg = Debug|x86 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Debug|x86.Build.0 = Debug|x86 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|Any CPU.Build.0 = Release|Any CPU + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|x64.ActiveCfg = Release|x64 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|x64.Build.0 = Release|x64 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|x86.ActiveCfg = Release|x86 + {0D605E7E-16C9-4712-B552-8E12A7E5DC1F}.Release|x86.Build.0 = Release|x86 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|x64.ActiveCfg = Debug|x64 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|x64.Build.0 = Debug|x64 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|x86.ActiveCfg = Debug|x86 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Debug|x86.Build.0 = Debug|x86 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|Any CPU.Build.0 = Release|Any CPU + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|x64.ActiveCfg = Release|x64 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|x64.Build.0 = Release|x64 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|x86.ActiveCfg = Release|x86 + {4E8F5601-3178-46E6-9BCC-D3A6CE81FDB1}.Release|x86.Build.0 = Release|x86 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|x64.ActiveCfg = Debug|x64 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|x64.Build.0 = Debug|x64 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|x86.ActiveCfg = Debug|x86 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Debug|x86.Build.0 = Debug|x86 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|Any CPU.Build.0 = Release|Any CPU + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|x64.ActiveCfg = Release|x64 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|x64.Build.0 = Release|x64 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|x86.ActiveCfg = Release|x86 + {9B861D1E-6556-4061-9D0A-EFAFDA6D28ED}.Release|x86.Build.0 = Release|x86 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|x64.ActiveCfg = Debug|x64 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|x64.Build.0 = Debug|x64 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|x86.ActiveCfg = Debug|x86 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Debug|x86.Build.0 = Debug|x86 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|Any CPU.Build.0 = Release|Any CPU + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|x64.ActiveCfg = Release|x64 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|x64.Build.0 = Release|x64 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|x86.ActiveCfg = Release|x86 + {1DC41002-4450-41E3-BC10-DFC6CBCD79D7}.Release|x86.Build.0 = Release|x86 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|x64.ActiveCfg = Debug|x64 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|x64.Build.0 = Debug|x64 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|x86.ActiveCfg = Debug|x86 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Debug|x86.Build.0 = Debug|x86 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|Any CPU.Build.0 = Release|Any CPU + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x64.ActiveCfg = Release|x64 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x64.Build.0 = Release|x64 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x86.ActiveCfg = Release|x86 + {CDBB2633-FE0B-485E-B864-DCA9240E6F7D}.Release|x86.Build.0 = Release|x86 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|x64.ActiveCfg = Debug|x64 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|x64.Build.0 = Debug|x64 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|x86.ActiveCfg = Debug|x86 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Debug|x86.Build.0 = Debug|x86 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|Any CPU.Build.0 = Release|Any CPU + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|x64.ActiveCfg = Release|x64 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|x64.Build.0 = Release|x64 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|x86.ActiveCfg = Release|x86 + {6B8722E8-94A4-4739-B0E3-14F1B158BC81}.Release|x86.Build.0 = Release|x86 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|x64.ActiveCfg = Debug|x64 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|x64.Build.0 = Debug|x64 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|x86.ActiveCfg = Debug|x86 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Debug|x86.Build.0 = Debug|x86 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|Any CPU.Build.0 = Release|Any CPU + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|x64.ActiveCfg = Release|x64 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|x64.Build.0 = Release|x64 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|x86.ActiveCfg = Release|x86 + {3BACD1BC-613C-4A68-87F2-789B5937FBF6}.Release|x86.Build.0 = Release|x86 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|x64.ActiveCfg = Debug|x64 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|x64.Build.0 = Debug|x64 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|x86.ActiveCfg = Debug|x86 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Debug|x86.Build.0 = Debug|x86 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|Any CPU.Build.0 = Release|Any CPU + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|x64.ActiveCfg = Release|x64 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|x64.Build.0 = Release|x64 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|x86.ActiveCfg = Release|x86 + {0E1B996F-1ADA-44EA-B2E4-A32050BF5E9C}.Release|x86.Build.0 = Release|x86 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|x64.ActiveCfg = Debug|x64 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|x64.Build.0 = Debug|x64 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|x86.ActiveCfg = Debug|x86 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Debug|x86.Build.0 = Debug|x86 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|Any CPU.Build.0 = Release|Any CPU + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|x64.ActiveCfg = Release|x64 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|x64.Build.0 = Release|x64 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|x86.ActiveCfg = Release|x86 + {A4B36D9E-EB03-474E-B806-F6DE49391C13}.Release|x86.Build.0 = Release|x86 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|Any CPU.Build.0 = Debug|Any CPU + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|x64.ActiveCfg = Debug|x64 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|x64.Build.0 = Debug|x64 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|x86.ActiveCfg = Debug|x86 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Debug|x86.Build.0 = Debug|x86 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|Any CPU.ActiveCfg = Release|Any CPU + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|Any CPU.Build.0 = Release|Any CPU + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|x64.ActiveCfg = Release|x64 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|x64.Build.0 = Release|x64 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|x86.ActiveCfg = Release|x86 + {51AA2490-864E-44E3-A5DF-ED27501EF572}.Release|x86.Build.0 = Release|x86 + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|x64.ActiveCfg = Debug|x64 + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|x64.Build.0 = Debug|x64 + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|x86.ActiveCfg = Debug|x86 + {77F493B8-C41A-45A8-87F4-C07400070118}.Debug|x86.Build.0 = Debug|x86 + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|Any CPU.Build.0 = Release|Any CPU + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|x64.ActiveCfg = Release|x64 + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|x64.Build.0 = Release|x64 + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|x86.ActiveCfg = Release|x86 + {77F493B8-C41A-45A8-87F4-C07400070118}.Release|x86.Build.0 = Release|x86 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|x64.ActiveCfg = Debug|x64 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|x64.Build.0 = Debug|x64 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|x86.ActiveCfg = Debug|x86 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Debug|x86.Build.0 = Debug|x86 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|Any CPU.Build.0 = Release|Any CPU + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|x64.ActiveCfg = Release|x64 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|x64.Build.0 = Release|x64 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|x86.ActiveCfg = Release|x86 + {B740FCEA-A2BF-4F0E-B4C0-C1F1ACBEA680}.Release|x86.Build.0 = Release|x86 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|x64.ActiveCfg = Debug|x64 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|x64.Build.0 = Debug|x64 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|x86.ActiveCfg = Debug|x86 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Debug|x86.Build.0 = Debug|x86 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|Any CPU.Build.0 = Release|Any CPU + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|x64.ActiveCfg = Release|x64 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|x64.Build.0 = Release|x64 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|x86.ActiveCfg = Release|x86 + {B459C1AE-938F-48BC-8720-7621DDB794A1}.Release|x86.Build.0 = Release|x86 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|x64.ActiveCfg = Debug|x64 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|x64.Build.0 = Debug|x64 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|x86.ActiveCfg = Debug|x86 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Debug|x86.Build.0 = Debug|x86 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|Any CPU.Build.0 = Release|Any CPU + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|x64.ActiveCfg = Release|x64 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|x64.Build.0 = Release|x64 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|x86.ActiveCfg = Release|x86 + {8AB5E861-FCBA-4A03-98A4-A99276167C9A}.Release|x86.Build.0 = Release|x86 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|x64.ActiveCfg = Debug|x64 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|x64.Build.0 = Debug|x64 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|x86.ActiveCfg = Debug|x86 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Debug|x86.Build.0 = Debug|x86 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|Any CPU.Build.0 = Release|Any CPU + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|x64.ActiveCfg = Release|x64 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|x64.Build.0 = Release|x64 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|x86.ActiveCfg = Release|x86 + {38CFEE4D-1272-41EF-ABC8-C2AB7A6BAE34}.Release|x86.Build.0 = Release|x86 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|x64.ActiveCfg = Debug|x64 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|x64.Build.0 = Debug|x64 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|x86.ActiveCfg = Debug|x86 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Debug|x86.Build.0 = Debug|x86 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|Any CPU.Build.0 = Release|Any CPU + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|x64.ActiveCfg = Release|x64 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|x64.Build.0 = Release|x64 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|x86.ActiveCfg = Release|x86 + {DE8F9D90-02EB-44B1-9C64-038EB1D21E8D}.Release|x86.Build.0 = Release|x86 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|x64.ActiveCfg = Debug|x64 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|x64.Build.0 = Debug|x64 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|x86.ActiveCfg = Debug|x86 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Debug|x86.Build.0 = Debug|x86 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|Any CPU.Build.0 = Release|Any CPU + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|x64.ActiveCfg = Release|x64 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|x64.Build.0 = Release|x64 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|x86.ActiveCfg = Release|x86 + {F8FE708E-3840-4A50-970B-8633CDAB4B27}.Release|x86.Build.0 = Release|x86 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|x64.ActiveCfg = Debug|x64 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|x64.Build.0 = Debug|x64 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|x86.ActiveCfg = Debug|x86 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Debug|x86.Build.0 = Debug|x86 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|Any CPU.Build.0 = Release|Any CPU + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|x64.ActiveCfg = Release|x64 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|x64.Build.0 = Release|x64 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|x86.ActiveCfg = Release|x86 + {80548ED6-43AB-4849-9AD9-0C4CCB474E8D}.Release|x86.Build.0 = Release|x86 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|x64.ActiveCfg = Debug|x64 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|x64.Build.0 = Debug|x64 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|x86.ActiveCfg = Debug|x86 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Debug|x86.Build.0 = Debug|x86 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|Any CPU.Build.0 = Release|Any CPU + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|x64.ActiveCfg = Release|x64 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|x64.Build.0 = Release|x64 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|x86.ActiveCfg = Release|x86 + {68FF3769-AE67-4B4E-A70B-5317A7079A26}.Release|x86.Build.0 = Release|x86 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|x64.ActiveCfg = Debug|x64 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|x64.Build.0 = Debug|x64 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|x86.ActiveCfg = Debug|x86 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Debug|x86.Build.0 = Debug|x86 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|Any CPU.Build.0 = Release|Any CPU + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|x64.ActiveCfg = Release|x64 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|x64.Build.0 = Release|x64 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|x86.ActiveCfg = Release|x86 + {1E2CC8BB-6C8E-4A03-B25C-D08F5502E24D}.Release|x86.Build.0 = Release|x86 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|x64.ActiveCfg = Debug|x64 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|x64.Build.0 = Debug|x64 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|x86.ActiveCfg = Debug|x86 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Debug|x86.Build.0 = Debug|x86 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|Any CPU.Build.0 = Release|Any CPU + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|x64.ActiveCfg = Release|x64 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|x64.Build.0 = Release|x64 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|x86.ActiveCfg = Release|x86 + {9669CF47-ACDD-4827-9A3B-B794723274DC}.Release|x86.Build.0 = Release|x86 + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|x64.ActiveCfg = Debug|x64 + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|x64.Build.0 = Debug|x64 + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|x86.ActiveCfg = Debug|x86 + {26B1B984-955F-4576-B916-636DF40FB266}.Debug|x86.Build.0 = Debug|x86 + {26B1B984-955F-4576-B916-636DF40FB266}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26B1B984-955F-4576-B916-636DF40FB266}.Release|Any CPU.Build.0 = Release|Any CPU + {26B1B984-955F-4576-B916-636DF40FB266}.Release|x64.ActiveCfg = Release|x64 + {26B1B984-955F-4576-B916-636DF40FB266}.Release|x64.Build.0 = Release|x64 + {26B1B984-955F-4576-B916-636DF40FB266}.Release|x86.ActiveCfg = Release|x86 + {26B1B984-955F-4576-B916-636DF40FB266}.Release|x86.Build.0 = Release|x86 + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|x64.ActiveCfg = Debug|x64 + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|x64.Build.0 = Debug|x64 + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|x86.ActiveCfg = Debug|x86 + {117CFB40-0142-4691-95F3-12898C5151F4}.Debug|x86.Build.0 = Debug|x86 + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|Any CPU.Build.0 = Release|Any CPU + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|x64.ActiveCfg = Release|x64 + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|x64.Build.0 = Release|x64 + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|x86.ActiveCfg = Release|x86 + {117CFB40-0142-4691-95F3-12898C5151F4}.Release|x86.Build.0 = Release|x86 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|x64.ActiveCfg = Debug|x64 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|x64.Build.0 = Debug|x64 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|x86.ActiveCfg = Debug|x86 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Debug|x86.Build.0 = Debug|x86 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|Any CPU.Build.0 = Release|Any CPU + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|x64.ActiveCfg = Release|x64 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|x64.Build.0 = Release|x64 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|x86.ActiveCfg = Release|x86 + {A88B9C02-02C5-42CE-8D77-369EB5E6D3E4}.Release|x86.Build.0 = Release|x86 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|x64.ActiveCfg = Debug|x64 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|x64.Build.0 = Debug|x64 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|x86.ActiveCfg = Debug|x86 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Debug|x86.Build.0 = Debug|x86 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|Any CPU.Build.0 = Release|Any CPU + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|x64.ActiveCfg = Release|x64 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|x64.Build.0 = Release|x64 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|x86.ActiveCfg = Release|x86 + {ADD58969-549B-4D81-BEA4-63E53E945346}.Release|x86.Build.0 = Release|x86 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|x64.ActiveCfg = Debug|x64 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|x64.Build.0 = Debug|x64 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|x86.ActiveCfg = Debug|x86 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Debug|x86.Build.0 = Debug|x86 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|Any CPU.Build.0 = Release|Any CPU + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|x64.ActiveCfg = Release|x64 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|x64.Build.0 = Release|x64 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|x86.ActiveCfg = Release|x86 + {6CF16C69-D77E-4206-B341-627B79055EEE}.Release|x86.Build.0 = Release|x86 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|x64.ActiveCfg = Debug|x64 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|x64.Build.0 = Debug|x64 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|x86.ActiveCfg = Debug|x86 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Debug|x86.Build.0 = Debug|x86 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|Any CPU.Build.0 = Release|Any CPU + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|x64.ActiveCfg = Release|x64 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|x64.Build.0 = Release|x64 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|x86.ActiveCfg = Release|x86 + {0EA2DB94-3A00-4F43-B4AE-0F58A2FE13A6}.Release|x86.Build.0 = Release|x86 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|x64.ActiveCfg = Debug|x64 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|x64.Build.0 = Debug|x64 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|x86.ActiveCfg = Debug|x86 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Debug|x86.Build.0 = Debug|x86 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|Any CPU.Build.0 = Release|Any CPU + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|x64.ActiveCfg = Release|x64 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|x64.Build.0 = Release|x64 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|x86.ActiveCfg = Release|x86 + {C3F485D7-68AC-4984-8B33-722EF662CF76}.Release|x86.Build.0 = Release|x86 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|x64.ActiveCfg = Debug|x64 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|x64.Build.0 = Debug|x64 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|x86.ActiveCfg = Debug|x86 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Debug|x86.Build.0 = Debug|x86 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|Any CPU.Build.0 = Release|Any CPU + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|x64.ActiveCfg = Release|x64 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|x64.Build.0 = Release|x64 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|x86.ActiveCfg = Release|x86 + {F9C442C8-DD85-498C-9D7A-4848B4DBBAF2}.Release|x86.Build.0 = Release|x86 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|x64.ActiveCfg = Debug|x64 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|x64.Build.0 = Debug|x64 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|x86.ActiveCfg = Debug|x86 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Debug|x86.Build.0 = Debug|x86 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|Any CPU.Build.0 = Release|Any CPU + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|x64.ActiveCfg = Release|x64 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|x64.Build.0 = Release|x64 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|x86.ActiveCfg = Release|x86 + {DC7B1462-603C-4A7C-A508-7CDDFAD522FD}.Release|x86.Build.0 = Release|x86 + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|x64.ActiveCfg = Debug|x64 + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|x64.Build.0 = Debug|x64 + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|x86.ActiveCfg = Debug|x86 + {A549B415-38F0-43D2-B849-169AEADB4546}.Debug|x86.Build.0 = Debug|x86 + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|Any CPU.Build.0 = Release|Any CPU + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|x64.ActiveCfg = Release|x64 + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|x64.Build.0 = Release|x64 + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|x86.ActiveCfg = Release|x86 + {A549B415-38F0-43D2-B849-169AEADB4546}.Release|x86.Build.0 = Release|x86 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|x64.ActiveCfg = Debug|x64 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|x64.Build.0 = Debug|x64 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|x86.ActiveCfg = Debug|x86 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Debug|x86.Build.0 = Debug|x86 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|Any CPU.Build.0 = Release|Any CPU + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|x64.ActiveCfg = Release|x64 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|x64.Build.0 = Release|x64 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|x86.ActiveCfg = Release|x86 + {4C3EB42E-FAA5-4F05-AAD5-24D5DEFA2CD3}.Release|x86.Build.0 = Release|x86 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|x64.ActiveCfg = Debug|x64 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|x64.Build.0 = Debug|x64 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|x86.ActiveCfg = Debug|x86 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Debug|x86.Build.0 = Debug|x86 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|Any CPU.Build.0 = Release|Any CPU + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|x64.ActiveCfg = Release|x64 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|x64.Build.0 = Release|x64 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|x86.ActiveCfg = Release|x86 + {4D00FBBA-C166-468F-9E01-7F2CE7170D94}.Release|x86.Build.0 = Release|x86 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|x64.ActiveCfg = Debug|x64 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|x64.Build.0 = Debug|x64 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|x86.ActiveCfg = Debug|x86 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Debug|x86.Build.0 = Debug|x86 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|Any CPU.Build.0 = Release|Any CPU + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|x64.ActiveCfg = Release|x64 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|x64.Build.0 = Release|x64 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|x86.ActiveCfg = Release|x86 + {43B3461B-D18E-4171-8408-D5CF57C62CA3}.Release|x86.Build.0 = Release|x86 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|x64.ActiveCfg = Debug|x64 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|x64.Build.0 = Debug|x64 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|x86.ActiveCfg = Debug|x86 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Debug|x86.Build.0 = Debug|x86 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|Any CPU.Build.0 = Release|Any CPU + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|x64.ActiveCfg = Release|x64 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|x64.Build.0 = Release|x64 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|x86.ActiveCfg = Release|x86 + {6E85CF59-EFBB-4A3A-829D-0548C4F8055B}.Release|x86.Build.0 = Release|x86 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|x64.ActiveCfg = Debug|x64 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|x64.Build.0 = Debug|x64 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|x86.ActiveCfg = Debug|x86 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Debug|x86.Build.0 = Debug|x86 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|Any CPU.Build.0 = Release|Any CPU + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|x64.ActiveCfg = Release|x64 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|x64.Build.0 = Release|x64 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|x86.ActiveCfg = Release|x86 + {4FF30C99-1F45-470D-BDE4-AA38A75B6AD4}.Release|x86.Build.0 = Release|x86 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|x64.ActiveCfg = Debug|x64 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|x64.Build.0 = Debug|x64 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|x86.ActiveCfg = Debug|x86 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Debug|x86.Build.0 = Debug|x86 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|Any CPU.Build.0 = Release|Any CPU + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|x64.ActiveCfg = Release|x64 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|x64.Build.0 = Release|x64 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|x86.ActiveCfg = Release|x86 + {F795D2B1-6471-4C3F-82DB-AC8F27DEEFE7}.Release|x86.Build.0 = Release|x86 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|x64.ActiveCfg = Debug|x64 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|x64.Build.0 = Debug|x64 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|x86.ActiveCfg = Debug|x86 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Debug|x86.Build.0 = Debug|x86 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|Any CPU.Build.0 = Release|Any CPU + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|x64.ActiveCfg = Release|x64 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|x64.Build.0 = Release|x64 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|x86.ActiveCfg = Release|x86 + {4490279B-E22A-445D-97C2-A0F9D842DAB1}.Release|x86.Build.0 = Release|x86 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|Any CPU.Build.0 = Debug|Any CPU + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|x64.ActiveCfg = Debug|x64 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|x64.Build.0 = Debug|x64 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|x86.ActiveCfg = Debug|x86 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Debug|x86.Build.0 = Debug|x86 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|Any CPU.ActiveCfg = Release|Any CPU + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|Any CPU.Build.0 = Release|Any CPU + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|x64.ActiveCfg = Release|x64 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|x64.Build.0 = Release|x64 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|x86.ActiveCfg = Release|x86 + {388EBC74-C8BF-487A-866B-8A000927FD54}.Release|x86.Build.0 = Release|x86 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|x64.ActiveCfg = Debug|x64 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|x64.Build.0 = Debug|x64 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|x86.ActiveCfg = Debug|x86 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Debug|x86.Build.0 = Debug|x86 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|Any CPU.Build.0 = Release|Any CPU + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|x64.ActiveCfg = Release|x64 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|x64.Build.0 = Release|x64 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|x86.ActiveCfg = Release|x86 + {D9AF6F5C-65A5-4C44-A3F6-3B6509E6065E}.Release|x86.Build.0 = Release|x86 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|Any CPU.Build.0 = Debug|Any CPU + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|x64.ActiveCfg = Debug|x64 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|x64.Build.0 = Debug|x64 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|x86.ActiveCfg = Debug|x86 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Debug|x86.Build.0 = Debug|x86 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|Any CPU.ActiveCfg = Release|Any CPU + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|Any CPU.Build.0 = Release|Any CPU + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|x64.ActiveCfg = Release|x64 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|x64.Build.0 = Release|x64 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|x86.ActiveCfg = Release|x86 + {24BB2C29-5581-4A81-9CB8-4B9C5958F191}.Release|x86.Build.0 = Release|x86 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|x64.ActiveCfg = Debug|x64 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|x64.Build.0 = Debug|x64 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|x86.ActiveCfg = Debug|x86 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Debug|x86.Build.0 = Debug|x86 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|Any CPU.Build.0 = Release|Any CPU + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|x64.ActiveCfg = Release|x64 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|x64.Build.0 = Release|x64 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|x86.ActiveCfg = Release|x86 + {84B1AADF-A0FE-4A7F-A949-B09E09876D3C}.Release|x86.Build.0 = Release|x86 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|x64.ActiveCfg = Debug|x64 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|x64.Build.0 = Debug|x64 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|x86.ActiveCfg = Debug|x86 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Debug|x86.Build.0 = Debug|x86 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|Any CPU.Build.0 = Release|Any CPU + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|x64.ActiveCfg = Release|x64 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|x64.Build.0 = Release|x64 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|x86.ActiveCfg = Release|x86 + {332D8741-D321-4CFE-A5DB-6DFE6F08A7A6}.Release|x86.Build.0 = Release|x86 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|x64.ActiveCfg = Debug|x64 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|x64.Build.0 = Debug|x64 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|x86.ActiveCfg = Debug|x86 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Debug|x86.Build.0 = Debug|x86 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|Any CPU.Build.0 = Release|Any CPU + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|x64.ActiveCfg = Release|x64 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|x64.Build.0 = Release|x64 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|x86.ActiveCfg = Release|x86 + {DFC3C500-66EB-45B2-BBC2-BBFE7E8466A4}.Release|x86.Build.0 = Release|x86 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|x64.ActiveCfg = Debug|x64 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|x64.Build.0 = Debug|x64 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|x86.ActiveCfg = Debug|x86 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Debug|x86.Build.0 = Debug|x86 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|Any CPU.Build.0 = Release|Any CPU + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|x64.ActiveCfg = Release|x64 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|x64.Build.0 = Release|x64 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|x86.ActiveCfg = Release|x86 + {3FF44973-5B72-4B9F-83E7-58E4C316E1E7}.Release|x86.Build.0 = Release|x86 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|x64.ActiveCfg = Debug|x64 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|x64.Build.0 = Debug|x64 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|x86.ActiveCfg = Debug|x86 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Debug|x86.Build.0 = Debug|x86 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|Any CPU.Build.0 = Release|Any CPU + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|x64.ActiveCfg = Release|x64 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|x64.Build.0 = Release|x64 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|x86.ActiveCfg = Release|x86 + {0C6E767F-18A4-4CDD-B088-F7C6138F0565}.Release|x86.Build.0 = Release|x86 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|x64.ActiveCfg = Debug|x64 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|x64.Build.0 = Debug|x64 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|x86.ActiveCfg = Debug|x86 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Debug|x86.Build.0 = Debug|x86 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|Any CPU.Build.0 = Release|Any CPU + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|x64.ActiveCfg = Release|x64 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|x64.Build.0 = Release|x64 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|x86.ActiveCfg = Release|x86 + {2B3432AC-1D3C-4EC0-94CE-6D14D515A3E0}.Release|x86.Build.0 = Release|x86 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|x64.ActiveCfg = Debug|x64 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|x64.Build.0 = Debug|x64 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|x86.ActiveCfg = Debug|x86 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Debug|x86.Build.0 = Debug|x86 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|Any CPU.Build.0 = Release|Any CPU + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|x64.ActiveCfg = Release|x64 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|x64.Build.0 = Release|x64 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|x86.ActiveCfg = Release|x86 + {DECDDA97-C90D-40C4-9D9A-A5A125D052AC}.Release|x86.Build.0 = Release|x86 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|x64.ActiveCfg = Debug|x64 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|x64.Build.0 = Debug|x64 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|x86.ActiveCfg = Debug|x86 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Debug|x86.Build.0 = Debug|x86 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|Any CPU.Build.0 = Release|Any CPU + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|x64.ActiveCfg = Release|x64 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|x64.Build.0 = Release|x64 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|x86.ActiveCfg = Release|x86 + {5CC05A2D-2779-4880-A28C-6800A85B5D9C}.Release|x86.Build.0 = Release|x86 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|x64.ActiveCfg = Debug|x64 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|x64.Build.0 = Debug|x64 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|x86.ActiveCfg = Debug|x86 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Debug|x86.Build.0 = Debug|x86 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|Any CPU.Build.0 = Release|Any CPU + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|x64.ActiveCfg = Release|x64 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|x64.Build.0 = Release|x64 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|x86.ActiveCfg = Release|x86 + {D9DC78AA-A9D1-4232-837C-0CF20846B3D6}.Release|x86.Build.0 = Release|x86 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|x64.ActiveCfg = Debug|x64 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|x64.Build.0 = Debug|x64 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|x86.ActiveCfg = Debug|x86 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Debug|x86.Build.0 = Debug|x86 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|Any CPU.Build.0 = Release|Any CPU + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|x64.ActiveCfg = Release|x64 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|x64.Build.0 = Release|x64 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|x86.ActiveCfg = Release|x86 + {393B4BDE-A451-41A7-A789-4473782BDF2D}.Release|x86.Build.0 = Release|x86 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|x64.ActiveCfg = Debug|x64 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|x64.Build.0 = Debug|x64 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|x86.ActiveCfg = Debug|x86 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Debug|x86.Build.0 = Debug|x86 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|Any CPU.Build.0 = Release|Any CPU + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|x64.ActiveCfg = Release|x64 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|x64.Build.0 = Release|x64 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|x86.ActiveCfg = Release|x86 + {28634B14-E0AD-423D-9A49-3650E0D15FC0}.Release|x86.Build.0 = Release|x86 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|x64.ActiveCfg = Debug|x64 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|x64.Build.0 = Debug|x64 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|x86.ActiveCfg = Debug|x86 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Debug|x86.Build.0 = Debug|x86 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|Any CPU.Build.0 = Release|Any CPU + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|x64.ActiveCfg = Release|x64 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|x64.Build.0 = Release|x64 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|x86.ActiveCfg = Release|x86 + {BC7F3F8C-2997-455C-9D98-4B45F0CDF2C8}.Release|x86.Build.0 = Release|x86 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|x64.ActiveCfg = Debug|x64 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|x64.Build.0 = Debug|x64 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|x86.ActiveCfg = Debug|x86 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Debug|x86.Build.0 = Debug|x86 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|Any CPU.Build.0 = Release|Any CPU + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|x64.ActiveCfg = Release|x64 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|x64.Build.0 = Release|x64 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|x86.ActiveCfg = Release|x86 + {99AFD4A2-9246-4077-8412-AB7DFACEDC8F}.Release|x86.Build.0 = Release|x86 + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|x64.ActiveCfg = Debug|x64 + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|x64.Build.0 = Debug|x64 + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|x86.ActiveCfg = Debug|x86 + {15153B43-717A-4EC7-811F-4F710837E52F}.Debug|x86.Build.0 = Debug|x86 + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|Any CPU.Build.0 = Release|Any CPU + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|x64.ActiveCfg = Release|x64 + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|x64.Build.0 = Release|x64 + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|x86.ActiveCfg = Release|x86 + {15153B43-717A-4EC7-811F-4F710837E52F}.Release|x86.Build.0 = Release|x86 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|x64.ActiveCfg = Debug|x64 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|x64.Build.0 = Debug|x64 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|x86.ActiveCfg = Debug|x86 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Debug|x86.Build.0 = Debug|x86 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|Any CPU.Build.0 = Release|Any CPU + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|x64.ActiveCfg = Release|x64 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|x64.Build.0 = Release|x64 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|x86.ActiveCfg = Release|x86 + {A4C62F2A-DFF0-43FA-9515-F12EB3756601}.Release|x86.Build.0 = Release|x86 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|x64.ActiveCfg = Debug|x64 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|x64.Build.0 = Debug|x64 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|x86.ActiveCfg = Debug|x86 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Debug|x86.Build.0 = Debug|x86 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|Any CPU.Build.0 = Release|Any CPU + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|x64.ActiveCfg = Release|x64 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|x64.Build.0 = Release|x64 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|x86.ActiveCfg = Release|x86 + {2DCF26D7-98A5-4656-954E-3406CFB08686}.Release|x86.Build.0 = Release|x86 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|x64.ActiveCfg = Debug|x64 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|x64.Build.0 = Debug|x64 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|x86.ActiveCfg = Debug|x86 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Debug|x86.Build.0 = Debug|x86 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|Any CPU.Build.0 = Release|Any CPU + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|x64.ActiveCfg = Release|x64 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|x64.Build.0 = Release|x64 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|x86.ActiveCfg = Release|x86 + {B7F19C82-AD09-41CF-AE9E-AFF27688DB68}.Release|x86.Build.0 = Release|x86 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|x64.ActiveCfg = Debug|x64 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|x64.Build.0 = Debug|x64 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|x86.ActiveCfg = Debug|x86 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Debug|x86.Build.0 = Debug|x86 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|Any CPU.Build.0 = Release|Any CPU + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|x64.ActiveCfg = Release|x64 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|x64.Build.0 = Release|x64 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|x86.ActiveCfg = Release|x86 + {8575483D-B37F-4C5A-B922-6A73787A6CF0}.Release|x86.Build.0 = Release|x86 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|x64.ActiveCfg = Debug|x64 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|x64.Build.0 = Debug|x64 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|x86.ActiveCfg = Debug|x86 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Debug|x86.Build.0 = Debug|x86 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|Any CPU.Build.0 = Release|Any CPU + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|x64.ActiveCfg = Release|x64 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|x64.Build.0 = Release|x64 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|x86.ActiveCfg = Release|x86 + {D627334B-835C-4190-BF4A-9459C50D04D3}.Release|x86.Build.0 = Release|x86 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|x64.ActiveCfg = Debug|x64 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|x64.Build.0 = Debug|x64 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|x86.ActiveCfg = Debug|x86 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Debug|x86.Build.0 = Debug|x86 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|Any CPU.Build.0 = Release|Any CPU + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|x64.ActiveCfg = Release|x64 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|x64.Build.0 = Release|x64 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|x86.ActiveCfg = Release|x86 + {8144C3F4-95D2-4179-A7AA-839699EBF374}.Release|x86.Build.0 = Release|x86 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|x64.ActiveCfg = Debug|x64 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|x64.Build.0 = Debug|x64 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|x86.ActiveCfg = Debug|x86 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Debug|x86.Build.0 = Debug|x86 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|Any CPU.Build.0 = Release|Any CPU + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|x64.ActiveCfg = Release|x64 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|x64.Build.0 = Release|x64 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|x86.ActiveCfg = Release|x86 + {6D5251AE-1567-444C-B5D9-D00C54104A1D}.Release|x86.Build.0 = Release|x86 + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|x64.ActiveCfg = Debug|x64 + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|x64.Build.0 = Debug|x64 + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|x86.ActiveCfg = Debug|x86 + {94768F01-A559-439F-96A6-F6970116A36F}.Debug|x86.Build.0 = Debug|x86 + {94768F01-A559-439F-96A6-F6970116A36F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94768F01-A559-439F-96A6-F6970116A36F}.Release|Any CPU.Build.0 = Release|Any CPU + {94768F01-A559-439F-96A6-F6970116A36F}.Release|x64.ActiveCfg = Release|x64 + {94768F01-A559-439F-96A6-F6970116A36F}.Release|x64.Build.0 = Release|x64 + {94768F01-A559-439F-96A6-F6970116A36F}.Release|x86.ActiveCfg = Release|x86 + {94768F01-A559-439F-96A6-F6970116A36F}.Release|x86.Build.0 = Release|x86 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|x64.ActiveCfg = Debug|x64 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|x64.Build.0 = Debug|x64 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|x86.ActiveCfg = Debug|x86 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Debug|x86.Build.0 = Debug|x86 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|Any CPU.Build.0 = Release|Any CPU + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|x64.ActiveCfg = Release|x64 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|x64.Build.0 = Release|x64 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|x86.ActiveCfg = Release|x86 + {01BAA4A0-81BF-4C3B-9074-F3D17E4BDB2C}.Release|x86.Build.0 = Release|x86 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|x64.ActiveCfg = Debug|x64 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|x64.Build.0 = Debug|x64 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|x86.ActiveCfg = Debug|x86 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Debug|x86.Build.0 = Debug|x86 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|Any CPU.Build.0 = Release|Any CPU + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|x64.ActiveCfg = Release|x64 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|x64.Build.0 = Release|x64 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|x86.ActiveCfg = Release|x86 + {2477737B-DD06-4635-B508-1CB7EE01E805}.Release|x86.Build.0 = Release|x86 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|x64.ActiveCfg = Debug|x64 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|x64.Build.0 = Debug|x64 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|x86.ActiveCfg = Debug|x86 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Debug|x86.Build.0 = Debug|x86 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|Any CPU.Build.0 = Release|Any CPU + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|x64.ActiveCfg = Release|x64 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|x64.Build.0 = Release|x64 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|x86.ActiveCfg = Release|x86 + {B2B0B253-1090-44B4-86EC-361D956E88D8}.Release|x86.Build.0 = Release|x86 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|x64.ActiveCfg = Debug|x64 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|x64.Build.0 = Debug|x64 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|x86.ActiveCfg = Debug|x86 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Debug|x86.Build.0 = Debug|x86 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|Any CPU.Build.0 = Release|Any CPU + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|x64.ActiveCfg = Release|x64 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|x64.Build.0 = Release|x64 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|x86.ActiveCfg = Release|x86 + {30568DC1-552D-4967-A819-2E2086D9A37E}.Release|x86.Build.0 = Release|x86 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|x64.ActiveCfg = Debug|x64 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|x64.Build.0 = Debug|x64 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|x86.ActiveCfg = Debug|x86 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Debug|x86.Build.0 = Debug|x86 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|Any CPU.Build.0 = Release|Any CPU + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|x64.ActiveCfg = Release|x64 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|x64.Build.0 = Release|x64 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|x86.ActiveCfg = Release|x86 + {E79C72F5-176F-4935-91F5-79A5C84B0DD5}.Release|x86.Build.0 = Release|x86 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|x64.ActiveCfg = Debug|x64 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|x64.Build.0 = Debug|x64 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|x86.ActiveCfg = Debug|x86 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Debug|x86.Build.0 = Debug|x86 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|Any CPU.Build.0 = Release|Any CPU + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|x64.ActiveCfg = Release|x64 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|x64.Build.0 = Release|x64 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|x86.ActiveCfg = Release|x86 + {CD30D882-6FEE-46F2-A004-AB136BAA97AC}.Release|x86.Build.0 = Release|x86 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|Any CPU.Build.0 = Debug|Any CPU + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|x64.ActiveCfg = Debug|x64 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|x64.Build.0 = Debug|x64 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|x86.ActiveCfg = Debug|x86 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Debug|x86.Build.0 = Debug|x86 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|Any CPU.ActiveCfg = Release|Any CPU + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|Any CPU.Build.0 = Release|Any CPU + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|x64.ActiveCfg = Release|x64 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|x64.Build.0 = Release|x64 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|x86.ActiveCfg = Release|x86 + {471CBB4B-E6E7-430C-96DD-514CE60FB472}.Release|x86.Build.0 = Release|x86 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|x64.ActiveCfg = Debug|x64 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|x64.Build.0 = Debug|x64 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|x86.ActiveCfg = Debug|x86 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Debug|x86.Build.0 = Debug|x86 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|Any CPU.Build.0 = Release|Any CPU + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|x64.ActiveCfg = Release|x64 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|x64.Build.0 = Release|x64 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|x86.ActiveCfg = Release|x86 + {1DD172EF-123C-415B-B278-F67579C2B3CC}.Release|x86.Build.0 = Release|x86 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|x64.ActiveCfg = Debug|x64 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|x64.Build.0 = Debug|x64 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|x86.ActiveCfg = Debug|x86 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Debug|x86.Build.0 = Debug|x86 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|Any CPU.Build.0 = Release|Any CPU + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|x64.ActiveCfg = Release|x64 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|x64.Build.0 = Release|x64 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|x86.ActiveCfg = Release|x86 + {C8124B80-00A6-44EF-A828-7068AB09975A}.Release|x86.Build.0 = Release|x86 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|x64.ActiveCfg = Debug|x64 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|x64.Build.0 = Debug|x64 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|x86.ActiveCfg = Debug|x86 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Debug|x86.Build.0 = Debug|x86 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|Any CPU.Build.0 = Release|Any CPU + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|x64.ActiveCfg = Release|x64 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|x64.Build.0 = Release|x64 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|x86.ActiveCfg = Release|x86 + {9ABC91A3-9B8E-46C8-A580-34E1DF79E872}.Release|x86.Build.0 = Release|x86 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|x64.ActiveCfg = Debug|x64 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|x64.Build.0 = Debug|x64 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|x86.ActiveCfg = Debug|x86 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Debug|x86.Build.0 = Debug|x86 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|Any CPU.Build.0 = Release|Any CPU + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|x64.ActiveCfg = Release|x64 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|x64.Build.0 = Release|x64 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|x86.ActiveCfg = Release|x86 + {BA0A7D4D-2689-4B6D-8F14-1532112E225C}.Release|x86.Build.0 = Release|x86 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|x64.ActiveCfg = Debug|x64 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|x64.Build.0 = Debug|x64 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|x86.ActiveCfg = Debug|x86 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Debug|x86.Build.0 = Debug|x86 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|Any CPU.Build.0 = Release|Any CPU + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|x64.ActiveCfg = Release|x64 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|x64.Build.0 = Release|x64 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|x86.ActiveCfg = Release|x86 + {CC8D1830-ECDB-4083-8D60-A83B2876FA62}.Release|x86.Build.0 = Release|x86 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|x64.ActiveCfg = Debug|x64 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|x64.Build.0 = Debug|x64 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|x86.ActiveCfg = Debug|x86 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Debug|x86.Build.0 = Debug|x86 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|Any CPU.Build.0 = Release|Any CPU + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|x64.ActiveCfg = Release|x64 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|x64.Build.0 = Release|x64 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|x86.ActiveCfg = Release|x86 + {712DF299-955A-4321-8320-0FD8A1988FF4}.Release|x86.Build.0 = Release|x86 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|x64.ActiveCfg = Debug|x64 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|x64.Build.0 = Debug|x64 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|x86.ActiveCfg = Debug|x86 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Debug|x86.Build.0 = Debug|x86 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|Any CPU.Build.0 = Release|Any CPU + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|x64.ActiveCfg = Release|x64 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|x64.Build.0 = Release|x64 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|x86.ActiveCfg = Release|x86 + {C7810220-7BC8-4C4B-8613-9575E1C48AA5}.Release|x86.Build.0 = Release|x86 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|x64.ActiveCfg = Debug|x64 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|x64.Build.0 = Debug|x64 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|x86.ActiveCfg = Debug|x86 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Debug|x86.Build.0 = Debug|x86 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|Any CPU.Build.0 = Release|Any CPU + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|x64.ActiveCfg = Release|x64 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|x64.Build.0 = Release|x64 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|x86.ActiveCfg = Release|x86 + {9334A6A6-5ED6-454F-ADCB-53BFE9AB065D}.Release|x86.Build.0 = Release|x86 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|x64.ActiveCfg = Debug|x64 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|x64.Build.0 = Debug|x64 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|x86.ActiveCfg = Debug|x86 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Debug|x86.Build.0 = Debug|x86 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|Any CPU.Build.0 = Release|Any CPU + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|x64.ActiveCfg = Release|x64 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|x64.Build.0 = Release|x64 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|x86.ActiveCfg = Release|x86 + {4D0771DE-46FB-481E-B3F9-42980EED680C}.Release|x86.Build.0 = Release|x86 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|x64.ActiveCfg = Debug|x64 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|x64.Build.0 = Debug|x64 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|x86.ActiveCfg = Debug|x86 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Debug|x86.Build.0 = Debug|x86 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|Any CPU.Build.0 = Release|Any CPU + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|x64.ActiveCfg = Release|x64 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|x64.Build.0 = Release|x64 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|x86.ActiveCfg = Release|x86 + {34484E72-8CEF-4784-81F5-041754B21BB1}.Release|x86.Build.0 = Release|x86 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|x64.ActiveCfg = Debug|x64 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|x64.Build.0 = Debug|x64 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|x86.ActiveCfg = Debug|x86 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Debug|x86.Build.0 = Debug|x86 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|Any CPU.Build.0 = Release|Any CPU + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x64.ActiveCfg = Release|x64 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x64.Build.0 = Release|x64 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x86.ActiveCfg = Release|x86 + {8D3289A5-591B-421D-A79C-776B9AC74B95}.Release|x86.Build.0 = Release|x86 + EndGlobalSection +EndGlobal diff --git a/pkg/Tizen.NET.nuspec b/pkg/Tizen.NET.nuspec new file mode 100644 index 0000000..6a38d0a --- /dev/null +++ b/pkg/Tizen.NET.nuspec @@ -0,0 +1,218 @@ + + + + Tizen.NET + 4.0.0-preview1 + Samsung Electronics + Samsung Electronics + false + https://www.apache.org/licenses/LICENSE-2.0 + https://www.tizen.org/ + https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png + A set of Tizen.NET APIs. This includes all of the APIs built on top of Tizen Platform. + © Samsung Electronics Co., Ltd All Rights Reserved + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable.csproj b/src/ElmSharp.Wearable/ElmSharp.Wearable.csproj new file mode 100644 index 0000000..5efcc98 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable.sln b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln new file mode 100755 index 0000000..5079bfe --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp.Wearable", "ElmSharp.Wearable.csproj", "{01AE2E3A-C08E-431C-97B3-A18D536FCD52}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{393A27E0-A1FF-4BC7-9B44-2B2803080AC2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {01AE2E3A-C08E-431C-97B3-A18D536FCD52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01AE2E3A-C08E-431C-97B3-A18D536FCD52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01AE2E3A-C08E-431C-97B3-A18D536FCD52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01AE2E3A-C08E-431C-97B3-A18D536FCD52}.Release|Any CPU.Build.0 = Release|Any CPU + {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {393A27E0-A1FF-4BC7-9B44-2B2803080AC2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs new file mode 100644 index 0000000..7834970 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleDatetimeSelector.cs @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + ///

+ /// The Circle DateTime Selector is a widget to display and handle datetime value by rotary event + /// Inherits + /// + public class CircleDateTimeSelector : DateTimeSelector + { + IntPtr circleHandle; + + /// + /// Creates and initializes a new instance of the Circle DateTime class + /// + /// The parent of new Circle DateTime instance + public CircleDateTimeSelector(EvasObject parent) : base(parent) { } + + /// + /// Sets or gets the disabled state of the Circle DateTime Selector + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(circleHandle); + } + set + { + Interop.Eext.eext_circle_object_disabled_set(circleHandle, value); + } + } + + /// + /// Sets or gets the color of the marker + /// + public Color MarkerColor + { + get + { + int r, g, b, a; + Interop.Eext.eext_circle_object_item_color_get(circleHandle, "default", out r, out g, out b, out a); + return new Color(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(circleHandle, "default", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the line width of the marker + /// + public int MarkerLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "default", value); + } + } + + /// + /// Sets or gets the radius at which the center of the marker lies + /// + public double MarkerRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + var handle = base.CreateHandle(parent); + + IntPtr surface = IntPtr.Zero; + + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent); + } + + circleHandle = Interop.Eext.eext_circle_object_datetime_add(RealHandle, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while (!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(circleHandle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(circleHandle, true); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs new file mode 100644 index 0000000..c987009 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleGenList.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// + /// The Circle GenList Selector is a widget to display and handle genlist items by rotary event + /// Inherits + /// + public class CircleGenList : GenList + { + IntPtr circleHandle; + + /// + /// Creates and initializes a new instance of the Circle GenList class + /// + /// The parent of new Circle GenList instance + public CircleGenList(EvasObject parent) : base(parent) { } + + /// + /// Sets or gets the disabled state of the Circle GenList Selector + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(circleHandle); + } + set + { + Interop.Eext.eext_circle_object_disabled_set(circleHandle, value); + } + } + + /// + /// Sets or gets the color of the scroll background + /// + public Color VerticalScrollBackgroundColor + { + get + { + int r, g, b, a; + Interop.Eext.eext_circle_object_item_color_get(circleHandle, "vertical,scroll,bg", out r, out g, out b, out a); + return new Color(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(circleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the line width of the scroll background + /// + public int VerticalScrollBackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "vertical,scroll,bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "vertical,scroll,bg", value); + } + } + + /// + /// Sets or gets the redius of the scroll background + /// + public double VerticalScrollBackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "vertical,scroll,bg"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "vertical,scroll,bg", value); + } + } + + /// + /// Sets or gets the color of the scroll bar + /// + public Color VerticalScrollBarColor + { + get + { + int r, g, b, a; + Interop.Eext.eext_circle_object_item_color_get(circleHandle, "default", out r, out g, out b, out a); + return new Color(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(circleHandle, "default", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the line width of the scroll bar + /// + public int VerticalScrollBarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(circleHandle, "default", value); + } + } + + /// + /// Sets or gets the redius of the scroll bar + /// + public double VerticalScrollBarRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(circleHandle, "default", value); + } + } + + /// + /// Sets or gets the policy if the scroll bar is visible + /// + /// + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, IntPtr.Zero, out policy); + return (ScrollBarVisiblePolicy)policy; + } + set + { + int h; + Interop.Eext.eext_circle_object_genlist_scroller_policy_get(circleHandle, out h, IntPtr.Zero); + Interop.Eext.eext_circle_object_genlist_scroller_policy_set(circleHandle, (int)h, (int)value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + var handle = base.CreateHandle(parent); + + IntPtr surface = IntPtr.Zero; + + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent); + } + + circleHandle = Interop.Eext.eext_circle_object_genlist_add(RealHandle, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while(!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(circleHandle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(circleHandle, true); + + return handle; + } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs new file mode 100644 index 0000000..95fcbae --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleProgressBar.cs @@ -0,0 +1,338 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + + /// + /// The Circle ProgressBar is a widget for visually representing the progress status of a given job/task with the circular design. + /// + public class CircleProgressBar : EvasObject + { + private IntPtr _circleHandle; + + /// + /// Creates and initializes a new instance of the Circle Progressbar class. + /// + /// The parent of new Circle Progressbar instance + public CircleProgressBar(EvasObject parent) : base(parent) + { + } + + + /// + /// Sets or gets the value of ProgressBar. + /// + public double Value + { + get + { + return Interop.Eext.eext_circle_object_value_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_value_set(_circleHandle, value); + } + } + + /// + /// Sets or gets the maximum value of ProgressBar. + /// + public double Maximum + { + get + { + double max = 0; + double min = 0; + Interop.Eext.eext_circle_object_value_min_max_get(_circleHandle, out min, out max); + return max; + } + set + { + double min = Minimum; + Interop.Eext.eext_circle_object_value_min_max_set(_circleHandle, min, value); + } + } + + /// + /// Sets or gets the minimum value of ProgressBar. + /// + public double Minimum + { + get + { + double max = 0; + double min = 0; + Interop.Eext.eext_circle_object_value_min_max_get(_circleHandle, out min, out max); + return min; + } + set + { + double max = Maximum; + Interop.Eext.eext_circle_object_value_min_max_set(_circleHandle, value, max); + } + } + + /// + /// Sets or gets the angle value of ProgressBar. + /// + public double BarAngle + { + get + { + return Interop.Eext.eext_circle_object_angle_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_angle_set(_circleHandle, value); + } + } + + /// + /// Sets or gets the angle value of Background ProgressBar. + /// + public double BackgroundAngle + { + get + { + return Interop.Eext.eext_circle_object_item_angle_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_set(_circleHandle, "bg", value); + } + } + + /// + /// Sets or gets the angle offset value of ProgressBar. + /// + public double BarAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_angle_offset_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_angle_offset_set(_circleHandle, value); + } + } + + /// + /// Sets or gets the angle offset value of Background ProgressBar. + /// + public double BackgroundAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_item_angle_offset_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_offset_set(_circleHandle, "bg", value); + } + } + + /// + /// Sets or gets the maximum angle value of ProgressBar. + /// + public double BarAngleMaximum + { + get + { + double max = 0; + double min = 0; + Interop.Eext.eext_circle_object_angle_min_max_get(_circleHandle, out min, out max); + return max; + } + set + { + double min = BarAngleMinimum; + Interop.Eext.eext_circle_object_angle_min_max_set(_circleHandle, min, value); + } + } + + /// + /// Sets or gets the minimum angle value of ProgressBar. + /// + public double BarAngleMinimum + { + get + { + double max = 0; + double min = 0; + Interop.Eext.eext_circle_object_angle_min_max_get(_circleHandle, out min, out max); + return min; + } + set + { + double max = BarAngleMaximum; + Interop.Eext.eext_circle_object_angle_min_max_set(_circleHandle, value, max); + } + } + + /// + /// Sets or gets disable status of Circle ProgressBar. + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); + } + set + { + Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value); + } + } + + /// + /// Sets or gets color of ProgressBar. + /// + public Color BarColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_color_get(_circleHandle, out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_color_set(_circleHandle, value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets color of Background ProgressBar. + /// + public Color BackgroundColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "bg", out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "bg", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets line width of ProgressBar. + /// + public int BarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value); + } + } + + /// + /// Sets or gets line width of Background ProgressBar. + /// + public int BackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "bg", value); + } + } + + /// + /// Sets or gets radius of ProgressBar. + /// + public double BarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(_circleHandle, value); + } + } + + /// + /// Sets or gets radius of Background ProgressBar. + /// + public double BackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "bg", value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr surface = IntPtr.Zero; + + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + + _circleHandle = Interop.Eext.eext_circle_object_progressbar_add(parent.Handle, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while (!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(_circleHandle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true); + return parent.Handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs new file mode 100644 index 0000000..c786615 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleScroller.cs @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// + /// Circle scroller provides scrollbar with circular movement and is scrolled by rotary event. + /// + public class CircleScroller : Scroller + { + private IntPtr _circleHandle; + + /// + /// Creates and initializes a new instance of the CircleScroller class. + /// + /// The to which the new CircleScroller will be attached as a child. + public CircleScroller(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets disabled state of the circle scroller object. + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value); + } + } + + /// + /// Sets or gets the value of HorizontalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public override ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Eext.eext_circle_object_scroller_policy_get(_circleHandle, out policy, IntPtr.Zero); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy; + Interop.Eext.eext_circle_object_scroller_policy_set(_circleHandle, (int)value, (int)v); + } + } + + /// + /// Sets or gets the value of VerticalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public override ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Eext.eext_circle_object_scroller_policy_get(_circleHandle, IntPtr.Zero, out policy); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy; + Interop.Eext.eext_circle_object_scroller_policy_set(_circleHandle, (int)h, (int)value); + } + } + + /// + /// Sets or gets color of the vertical scroll bar. + /// + public Color VerticalScrollBarColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_color_get(_circleHandle, out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_color_set(_circleHandle, value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets color of the horizontal scroll bar. + /// + public Color HorizontalScrollBarColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "horizontal,scroll,bar", out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "horizontal,scroll,bar", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets color of the vertical scroll background. + /// + public Color VerticalScrollBackgroundColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "vertical,scroll,bg", out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "vertical,scroll,bg", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets color of the horizontal scroll background. + /// + public Color HorizontalScrollBackgroundColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "horizontal,scroll,bg", out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "horizontal,scroll,bg", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets line width of the vertical scroll bar. + /// + public int VerticalScrollBarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(_circleHandle, value); + } + } + + /// + /// Sets or gets line width of the horizontal scroll bar. + /// + public int HorizontalScrollBarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "horizontal,scroll,bar"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "horizontal,scroll,bar", value); + } + } + + /// + /// Sets or gets line width of the vertical scroll background. + /// + public int VerticalScrollBackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "vertical,scroll,bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "vertical,scroll,bg", value); + } + } + + /// + /// Sets or gets line width of the horizontal scroll background. + /// + public int HorizontalScrollBackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "horizontal,scroll,bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "horizontal,scroll,bg", value); + } + } + + /// + /// Sets or gets radius of the vertical scroll bar. + /// + public double VerticalScrollBarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(_circleHandle, value); + } + } + + /// + /// Sets or gets radius of the horizontal scroll bar. + /// + public double HorizontalScrollBarRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "horizontal,scroll,bar"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "horizontal,scroll,bar", value); + } + } + + /// + /// Sets or gets radius of the vertical scroll background. + /// + public double VerticalScrollBackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "vertical,scroll,bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "vertical,scroll,bg", value); + } + } + + /// + /// Sets or gets radius of the horizontal scroll background. + /// + public double HorizontalScrollBackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "horizontal,scroll,bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "horizontal,scroll,bg", value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = base.CreateHandle(parent); + IntPtr surface = IntPtr.Zero; + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + + _circleHandle = Interop.Eext.eext_circle_object_scroller_add(RealHandle, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while (!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(_circleHandle, w, h); + } + Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true); + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs new file mode 100644 index 0000000..8cf026c --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSlider.cs @@ -0,0 +1,375 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + /// + /// Circle slider is circular designed widget to select a value in a range by rotary event. + /// + public class CircleSlider : EvasObject + { + public event EventHandler Changed; + + SmartEvent _changedEvent; + + /// + /// Creates and initializes a new instance of the CircleSlider class. + /// + /// The EvasObject to which the new CircleSlider will be attached as a child. + public CircleSlider(EvasObject parent) : base(parent) + { + _changedEvent = new SmartEvent(this, "value,changed"); + + _changedEvent.On += (s, e) => Changed?.Invoke(this, EventArgs.Empty); + } + + /// + /// Sets or gets the step by which the circle slider bar moves. + /// + /// + /// This value is used when circle slider value is changed by an drag or rotary event + /// The value of the slider is increased/decreased by the step value. + /// + public double Step + { + get + { + return Interop.Eext.eext_circle_object_slider_step_get(RealHandle); + } + set + { + Interop.Eext.eext_circle_object_slider_step_set(RealHandle, (double)value); + } + } + + /// + /// Sets or gets disabled state of the circle slider object. + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_disabled_set(RealHandle, value); + } + } + + /// + /// Sets or gets color of the circle slider bar. + /// + public Color BarColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_color_get(RealHandle, out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_color_set(RealHandle, value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets color of the circle slider background. + /// + public Color BackgroundColor + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + Interop.Eext.eext_circle_object_item_color_get(RealHandle, "bg", out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(RealHandle, "bg", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the line with of the circle slider bar. + /// + public int BarLineWidth + { + get + { + return Interop.Eext.eext_circle_object_line_width_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_line_width_set(RealHandle, value); + } + } + + /// + /// Sets or gets the line with of the circle slider background. + /// + public int BackgroundLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(RealHandle, "bg", value); + } + } + + /// + /// Sets or gets the angle in degree of the circle slider bar. + /// + public double BarAngle + { + get + { + return Interop.Eext.eext_circle_object_angle_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_angle_set(RealHandle, value); + } + } + + /// + /// Sets or gets the angle in degree of the circle slider background. + /// + public double BackgroundAngle + { + get + { + return Interop.Eext.eext_circle_object_item_angle_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_set(RealHandle, "bg", value); + } + } + + /// + /// Sets or gets the angle offset for the slider bar. + /// offset value means start position of the slider bar. + /// + public double BarAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_angle_offset_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_angle_offset_set(RealHandle, value); + } + } + + /// + /// Sets or gets the angle offset for the circle slider background. + /// offset value means start position of the slider background. + /// + public double BackgroundAngleOffset + { + get + { + return Interop.Eext.eext_circle_object_item_angle_offset_get(RealHandle, "bg"); + } + set + { + Interop.Eext.eext_circle_object_item_angle_offset_set(RealHandle, "bg", value); + } + } + + /// + /// Sets or gets the minimum angle of the circle slider bar. + /// + public double BarAngleMinimum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max); + return min; + } + set + { + double max = BarAngleMaximum; + Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, (double)value, max); + } + } + + /// + /// Sets or gets the maximum angle of the circle slider bar. + /// + public double BarAngleMaximum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_angle_min_max_get(RealHandle, out min, out max); + return max; + } + set + { + double min = BarAngleMinimum; + Interop.Eext.eext_circle_object_angle_min_max_set(RealHandle, min, (double)value); + } + } + + /// + /// Sets or gets the minimum values for the circle slider. + /// + /// + /// This defines the allowed minimum values to be selected by the user. + /// If the actual value is less than min, it is updated to min. + /// Actual value can be obtained with Value.By default, min is equal to 0.0. + /// + public double Minimum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max); + return min; + } + set + { + double max = Maximum; + Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, (double)value, max); + } + } + + /// + /// Sets or gets the maximum values for the circle slider. + /// + /// + /// This defines the allowed maximum values to be selected by the user. + /// If the actual value is bigger then max, it is updated to max. + /// Actual value can be obtained with Value.By default, min is equal to 0.0, and max is equal to 1.0. + /// Maximum must be greater than minimum, otherwise the behavior is undefined. + /// + public double Maximum + { + get + { + double min; + double max; + Interop.Eext.eext_circle_object_value_min_max_get(RealHandle, out min, out max); + return max; + } + set + { + double min = Minimum; + Interop.Eext.eext_circle_object_value_min_max_set(RealHandle, min, (double)value); + } + } + + /// + /// Gets or sets the value displayed by the circle slider. + /// + /// + /// The value must to be between Minimum and Maximum values. + /// + public double Value + { + get + { + return Interop.Eext.eext_circle_object_value_get(RealHandle); + } + set + { + Interop.Eext.eext_circle_object_value_set(RealHandle, (double)value); + } + } + + /// + /// Gets or sets the radius value for the circle slider bar. + /// + public double BarRadius + { + get + { + return Interop.Eext.eext_circle_object_radius_get(RealHandle); ; + } + set + { + Interop.Eext.eext_circle_object_radius_set(RealHandle, value); + } + } + + /// + /// Gets or sets the radius value for the circle slider background. + /// + public double BackgroundRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(RealHandle, "bg"); ; + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(RealHandle, "bg", value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr surface = IntPtr.Zero; + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + + IntPtr handle = Interop.Eext.eext_circle_object_slider_add(parent, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while (!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(handle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(handle, true); + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs new file mode 100644 index 0000000..e85d589 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/CircleSpinner.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Wearable +{ + + /// + /// The Circle Spinner is a widget to display and handle spinner value by rotary event + /// Inherits . + /// + public class CircleSpinner : Spinner + { + private IntPtr _circleHandle; + private double _angleRatio = 1.0; + + /// + /// Creates and initializes a new instance of the Circle Spinner class. + /// + /// The parent of new Circle Spinner instance + public CircleSpinner(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets the circle spinner angle per each spinner value. + /// + public double AngleRatio + { + get + { + return _angleRatio; + } + set + { + _angleRatio = value; + Interop.Eext.eext_circle_object_spinner_angle_set(_circleHandle, _angleRatio); + } + } + + /// + /// Sets or gets disabled state of the circle spinner object. + /// + public bool Disabled + { + get + { + return Interop.Eext.eext_circle_object_disabled_get(_circleHandle); ; + } + set + { + Interop.Eext.eext_circle_object_disabled_set(_circleHandle, value); + } + } + + /// + /// Sets or gets the line width of the marker + /// + public int MarkerLineWidth + { + get + { + return Interop.Eext.eext_circle_object_item_line_width_get(_circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_line_width_set(_circleHandle, "default", value); + } + } + + /// + /// Sets or gets the color of the marker + /// + public Color MarkerColor + { + get + { + int r, g, b, a; + Interop.Eext.eext_circle_object_item_color_get(_circleHandle, "default", out r, out g, out b, out a); + return new Color(r, g, b, a); + } + set + { + Interop.Eext.eext_circle_object_item_color_set(_circleHandle, "default", value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the radius at which the center of the marker lies + /// + public double MarkerRadius + { + get + { + return Interop.Eext.eext_circle_object_item_radius_get(_circleHandle, "default"); + } + set + { + Interop.Eext.eext_circle_object_item_radius_set(_circleHandle, "default", value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = base.CreateHandle(parent); + + IntPtr surface = IntPtr.Zero; + + if (parent is Conformant) + { + surface = Interop.Eext.eext_circle_surface_conformant_add(parent.Handle); + } + else if (parent is Naviframe) + { + surface = Interop.Eext.eext_circle_surface_naviframe_add(parent.RealHandle); + } + else if (parent is Layout) + { + surface = Interop.Eext.eext_circle_surface_layout_add(parent.Handle); + } + + _circleHandle = Interop.Eext.eext_circle_object_spinner_add(RealHandle, surface); + if (surface == IntPtr.Zero) + { + EvasObject p = parent; + while (!(p is Window)) + { + p = p.Parent; + } + var w = (p as Window).ScreenSize.Width; + var h = (p as Window).ScreenSize.Height; + Interop.Evas.evas_object_resize(_circleHandle, w, h); + } + + Interop.Eext.eext_rotary_object_event_activated_set(_circleHandle, true); + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs new file mode 100644 index 0000000..7f75cc1 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOption.cs @@ -0,0 +1,89 @@ + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace ElmSharp.Wearable +{ + public class MoreOption : Layout + { + + public IList Items { get; private set; } + + public event EventHandler Selected; + public event EventHandler Clicked; + public event EventHandler Opened; + public event EventHandler Closed; + + SmartEvent _selectedEvent; + SmartEvent _clickedEvent; + SmartEvent _openedEvent; + SmartEvent _closedEvent; + + public MoreOption(EvasObject parent) : base(parent) + { + Items = new MoreOptionList(this); + + _selectedEvent = new SmartEvent(this, "item,selected", (d, o, info) => new PointerEventArgs { Pointer = info }); + _clickedEvent = new SmartEvent(this, "item,clicked", (d, o, info) => new PointerEventArgs { Pointer = info }); + _openedEvent = new SmartEvent(this, "more,option,opened"); + _closedEvent = new SmartEvent(this, "more,option,closed"); + + _selectedEvent.On += (s, e) => + { + MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Selected?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected }); + }; + + _clickedEvent.On += (s, e) => + { + MoreOptionItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Clicked?.Invoke(this, new MoreOptionItemEventArgs() { Item = selected }); + }; + + _openedEvent.On += (s, e) => Opened?.Invoke(this, EventArgs.Empty); + _closedEvent.On += (s, e) => Closed?.Invoke(this, EventArgs.Empty); + + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Eext.eext_more_option_add(parent); + } + + public MoreOptionDirection Direction + { + get + { + int dir = Interop.Eext.eext_more_option_direction_get(this); + return (MoreOptionDirection)dir; + } + + set + { + Interop.Eext.eext_more_option_direction_set(this, (int)value); + } + } + + public bool IsOpened + { + get + { + return Interop.Eext.eext_more_option_opened_get(this); + } + + set + { + Interop.Eext.eext_more_option_opened_set(this, value); + } + } + } + + public enum MoreOptionDirection + { + Top, + Bottom, + Left, + Right + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs new file mode 100644 index 0000000..ad5bf58 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItem.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class MoreOptionItem + { + const string MainTextPartName = "selector,main_text"; + const string SubTextPartName = "selector,sub_text"; + const string IconPartName = "item,icon"; + + string _mainText; + string _subText; + Image _icon; + IntPtr _handle; + + public IntPtr Handle + { + get + { + return _handle; + } + set + { + if (_handle == value) return; + _handle = value; + if (_mainText != null) + Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText); + if (_subText != null) + Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText); + if (_icon != null) + Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon); + } + } + + public MoreOptionItem() + { + _icon = null; + } + + public string MainText + { + set + { + if (_mainText == value) return; + _mainText = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_text_set(Handle, MainTextPartName, _mainText); + } + } + + get + { + return _mainText; + } + } + + public string SubText + { + set + { + if (_subText == value) return; + _subText = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_text_set(Handle, SubTextPartName, _subText); + } + } + + get + { + return _subText; + } + } + + public Image Icon + { + set + { + if (_icon == value) return; + _icon = value; + if (Handle != IntPtr.Zero) + { + Interop.Eext.eext_more_option_item_part_content_set(Handle, IconPartName, _icon); + } + } + get + { + return _icon; + } + } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs new file mode 100644 index 0000000..7bc9723 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionItemEventArgs.cs @@ -0,0 +1,10 @@ + +using System; + +namespace ElmSharp.Wearable +{ + public class MoreOptionItemEventArgs : EventArgs + { + public MoreOptionItem Item { get; set; } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs new file mode 100644 index 0000000..577bc8e --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/MoreOptionList.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class MoreOptionList : IList + { + MoreOption Owner { get; set; } + + List Items { get; set; } + + public int Count => Items.Count; + + public bool IsReadOnly => false; + + public MoreOptionItem this[int index] + { + get + { + return Items[index]; + } + + set + { + Items[index] = value; + } + } + + public MoreOptionList(MoreOption owner) + { + Owner = owner; + Items = new List(); + } + + public void Add(MoreOptionItem item) + { + item.Handle = Interop.Eext.eext_more_option_item_append(Owner); + Items.Add(item); + } + + public void AddFirst(MoreOptionItem item) + { + item.Handle = Interop.Eext.eext_more_option_item_prepend(Owner); + Items.Insert(0, item); + } + + public void AddLast(MoreOptionItem item) + { + Add(item); + } + + public int IndexOf(MoreOptionItem item) + { + return Items.IndexOf(item); + } + + public void Insert(int index, MoreOptionItem item) + { + if (Items.Count < index + 1 || index < 0) + throw new ArgumentOutOfRangeException("index is not valid in the MoreOption"); + + MoreOptionItem target = Items[index]; + item.Handle = Interop.Eext.eext_more_option_item_insert_after(Owner, target.Handle); + Items.Insert(index, item); + } + + public void RemoveAt(int index) + { + if (Items.Count < index + 1 || index < 0) + throw new ArgumentOutOfRangeException("index is not valid in the MoreOptionList"); + + MoreOptionItem item = Items[index]; + Interop.Eext.eext_more_option_item_del(item.Handle); + item.Handle = IntPtr.Zero; + Items.RemoveAt(index); + } + + public void Clear() + { + Interop.Eext.eext_more_option_items_clear(Owner); + foreach (MoreOptionItem item in Items) + { + item.Handle = IntPtr.Zero; + } + Items.Clear(); + } + + public bool Contains(MoreOptionItem item) + { + return Items.Contains(item); + } + + public void CopyTo(MoreOptionItem[] array, int arrayIndex) + { + Items.CopyTo(array, arrayIndex); + } + + public bool Remove(MoreOptionItem item) + { + if (Items.Contains(item)) + { + Interop.Eext.eext_more_option_item_del(item.Handle); + Items.Remove(item); + return true; + } + return false; + } + + public IEnumerator GetEnumerator() + { + return Items.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return Items.GetEnumerator(); + } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs new file mode 100644 index 0000000..d746824 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/PointerEventArgs.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class PointerEventArgs : EventArgs + { + public IntPtr Pointer { get; set; } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs new file mode 100644 index 0000000..eb0181c --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelector.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelector : Layout + { + const string IconPartName = "selector,icon"; + const string ContentPartName = "selector,content"; + const string BgPartName = "selector,bg_image"; + + const string ItemSelectedEventName = "item,selected"; + const string ItemClickedEventName = "item,clicked"; + + public event EventHandler Selected; + public event EventHandler Clicked; + + SmartEvent _selectedEvent; + SmartEvent _clickedEvent; + Image _normalBgImage; + + public IList Items { get; private set; } + + public RotarySelector(EvasObject parent) : base(parent) + { + Items = new RotarySelectorList(this); + + _selectedEvent = new SmartEvent(this, "item,selected", (d, o, info) => new PointerEventArgs { Pointer = info }); + _clickedEvent = new SmartEvent(this, "item,clicked", (d, o, info) => new PointerEventArgs { Pointer = info }); + _selectedEvent.On += (s, e) => + { + RotarySelectorItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Selected?.Invoke(this, new RotarySelectorItemEventArgs { Item = selected }); + }; + + _clickedEvent.On += (s, e) => + { + RotarySelectorItem selected = Items.FirstOrDefault(i => i.Handle == e.Pointer); + Clicked?.Invoke(this, new RotarySelectorItemEventArgs { Item = selected }); + }; + } + + public RotarySelectorItem SelectedItem + { + get + { + IntPtr selectedPtr = Interop.Eext.eext_rotary_selector_selected_item_get(this); + if (selectedPtr == IntPtr.Zero) return null; + RotarySelectorItem item = Items.FirstOrDefault(i => i.Handle == selectedPtr); + return item; + } + + set + { + if (!Items.Contains(value)) return; + Interop.Eext.eext_rotary_selector_selected_item_set(this, value.Handle); + } + } + + void setPart(ref Image prop, string partName, State state, Image img) + { + if (prop == img) return; + prop = img; + if (this != null) + { + Interop.Eext.eext_rotary_selector_part_content_set(this, partName, (int)state, prop); + } + } + void setPart(ref Color prop, string partName, State state, Color color) + { + if (prop == color) return; + if (this != null) + { + Interop.Eext.eext_rotary_selector_part_color_set(this, partName, (int)state, color.R, color.G, color.B, color.A); + } + } + + public Image BackgroundImage { set => setPart(ref _normalBgImage, BgPartName, State.Normal, value); get => _normalBgImage; } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr ptr = Interop.Eext.eext_rotary_selector_add(parent); + Interop.Eext.eext_rotary_object_event_activated_set(ptr, true); + return ptr; + } + + internal enum State + { + Normal, + Pressed + } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs new file mode 100644 index 0000000..d6abba8 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItem.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelectorItem + { + const string MainTextPartName = "selector,main_text"; + const string SubTextPartName = "selector,sub_text"; + const string IconPartName = "item,icon"; + const string BgPartName = "item,bg_image"; + const string SelectorIconPartName = "selector,icon"; + + string _mainText; + string _subText; + + Color _mainTextColor; + Color _subTextColor; + + Image _normalIconImage; + Image _pressedIconImage; + Image _disabledIconImage; + Image _selectedIconImage; + + Image _normalBgImage; + Image _pressedBgImage; + Image _disabledBgImage; + Image _selectedBgImage; + + Color _normalBgColor; + Color _pressedBgColor; + Color _disabledBgColor; + Color _selectedBgColor; + + Image _selectorIconImage; + + IntPtr _handle; + + public IntPtr Handle + { + set + { + if (_handle == value) return; + _handle = value; + + if (_handle == null) return; + + setPart(ref _mainText, MainTextPartName); + setPart(ref _subText, SubTextPartName); + setPart(ref _mainTextColor, MainTextPartName, ItemState.Normal); + setPart(ref _subTextColor, SubTextPartName, ItemState.Normal); + + setPart(ref _normalIconImage, IconPartName, ItemState.Normal); + setPart(ref _pressedIconImage, IconPartName, ItemState.Pressed); + setPart(ref _disabledIconImage, IconPartName, ItemState.Disabled); + setPart(ref _selectedIconImage, IconPartName, ItemState.Selected); + + setPart(ref _normalBgImage, BgPartName, ItemState.Normal); + setPart(ref _pressedBgImage, BgPartName, ItemState.Pressed); + setPart(ref _disabledBgImage, BgPartName, ItemState.Disabled); + setPart(ref _selectedBgImage, BgPartName, ItemState.Selected); + + setPart(ref _normalBgColor, BgPartName, ItemState.Normal); + setPart(ref _pressedBgColor, BgPartName, ItemState.Pressed); + setPart(ref _disabledBgColor, BgPartName, ItemState.Disabled); + setPart(ref _selectedBgColor, BgPartName, ItemState.Selected); + + setPart(ref _selectorIconImage, SelectorIconPartName, ItemState.Normal); + } + + get + { + return _handle; + } + } + + void setPart(ref Image prop, string partName, ItemState state) + { + if (prop != null) + { + Interop.Eext.eext_rotary_selector_item_part_content_set(Handle, partName, (int)state, prop); + } + } + void setPart(ref Color prop, string partName, ItemState state) + { + if (prop != default(Color)) + { + Interop.Eext.eext_rotary_selector_item_part_color_set(Handle, partName, (int)state, prop.R, prop.G, prop.B, prop.A); + } + } + + void setPart(ref string prop, string partName) + { + if (prop != null) + { + Interop.Eext.eext_rotary_selector_item_part_text_set(Handle, partName, prop); + } + } + + void setPart(ref Image prop, string partName, ItemState state, Image img) + { + if (prop == img) return; + prop = img; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_content_set(Handle, partName, (int)state, img); + } + } + + void setPart(ref Color prop, string partName, ItemState state, Color color) + { + if (prop == color) return; + prop = color; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_color_set(Handle, partName, (int)state, color.R, color.G, color.B, color.A); + } + } + + void setPart(ref string prop, string partName, string txt) + { + if (prop == txt) return; + prop = txt; + if (Handle != null) + { + Interop.Eext.eext_rotary_selector_item_part_text_set(Handle, partName, txt); + } + } + + public string MainText { set => setPart(ref _mainText, MainTextPartName, value); get => _mainText; } + public string SubText { set => setPart(ref _subText, SubTextPartName, value); get => _subText; } + + public Color MainTextColor { set => setPart(ref _mainTextColor, MainTextPartName, ItemState.Normal, value); get => _mainTextColor; } + public Color SubextColor { set => setPart(ref _subTextColor, SubTextPartName, ItemState.Normal, value); get => _subTextColor; } + + public Image NormalIconImage { set => setPart(ref _normalIconImage, IconPartName, ItemState.Normal, value); get => _normalIconImage; } + public Image PressedIconImage { set => setPart(ref _pressedIconImage, IconPartName, ItemState.Pressed, value); get => _pressedIconImage; } + public Image DisabledIconImage { set => setPart(ref _disabledIconImage, IconPartName, ItemState.Disabled, value); get => _disabledIconImage; } + public Image SelectedIconImage { set => setPart(ref _selectedIconImage, IconPartName, ItemState.Selected, value); get => _selectedIconImage; } + + + public Image NormalBackgroundImage { set => setPart(ref _normalBgImage, BgPartName, ItemState.Normal, value); get => _normalBgImage; } + public Image PressedBackgroundImage { set => setPart(ref _pressedBgImage, BgPartName, ItemState.Pressed, value); get => _pressedBgImage; } + public Image DisabledBackgroundImage { set => setPart(ref _disabledBgImage, BgPartName, ItemState.Disabled, value); get => _disabledBgImage; } + public Image SelectedBackgroundImage { set => setPart(ref _selectedBgImage, BgPartName, ItemState.Selected, value); get => _selectedBgImage; } + + public Color NormalBackgroundColor { set => setPart(ref _normalBgColor, BgPartName, ItemState.Normal, value); get => _normalBgColor; } + public Color PressedBackgroundColor { set => setPart(ref _pressedBgColor, BgPartName, ItemState.Pressed, value); get => _pressedBgColor; } + public Color DisabledBackgroundColor { set => setPart(ref _disabledBgColor, BgPartName, ItemState.Disabled, value); get => _disabledBgColor; } + public Color SelectedBackgroundColor { set => setPart(ref _selectedBgColor, BgPartName, ItemState.Selected, value); get => _selectedBgColor; } + + public Image SelectorIconImage { set => setPart(ref _selectorIconImage, SelectorIconPartName, ItemState.Normal, value); get => _selectorIconImage; } + + internal enum ItemState + { + Normal, + Pressed, + Disabled, + Selected + } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs new file mode 100644 index 0000000..401be2f --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorItemEventArgs.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + public class RotarySelectorItemEventArgs : EventArgs + { + public RotarySelectorItem Item { get; set; } + } +} diff --git a/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs new file mode 100644 index 0000000..2f73984 --- /dev/null +++ b/src/ElmSharp.Wearable/ElmSharp.Wearable/RotarySelectorList.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace ElmSharp.Wearable +{ + class RotarySelectorList : IList + { + RotarySelector _owner; + List Items { get; set; } + + public RotarySelectorList(RotarySelector owner) + { + this._owner = owner; + Items = new List(); + } + + public RotarySelectorItem this[int index] { get => Items[index]; set => Items[index] = value; } + + public int Count => Items.Count; + + public bool IsReadOnly => false; + + public void Add(RotarySelectorItem item) + { + item.Handle = Interop.Eext.eext_rotary_selector_item_append(_owner); + Items.Add(item); + } + + public void Clear() + { + Interop.Eext.eext_rotary_selector_items_clear(_owner); + } + + public bool Contains(RotarySelectorItem item) + { + return Items.Contains(item); + } + + public void CopyTo(RotarySelectorItem[] array, int arrayIndex) + { + Items.CopyTo(array, arrayIndex); + } + + public IEnumerator GetEnumerator() + { + return Items.GetEnumerator(); + } + + public int IndexOf(RotarySelectorItem item) + { + return Items.IndexOf(item); + } + + public void Insert(int index, RotarySelectorItem item) + { + if (Items.Count <= index || index < 0) + { + throw new ArgumentOutOfRangeException("index is not valid in the RotarySelector"); + } + RotarySelectorItem target = Items[index]; + item.Handle = Interop.Eext.eext_rotary_selector_item_insert_after(_owner, target.Handle); + Items.Insert(index, item); + } + + public bool Remove(RotarySelectorItem item) + { + if (Items.Contains(item)) + { + Interop.Eext.eext_rotary_selector_item_del(item.Handle); + Items.Remove(item); + return true; + } + return false; + } + + public void RemoveAt(int index) + { + if (Items.Count < index + 1 || index < 0) + { + throw new ArgumentOutOfRangeException("index is not valid in the RotarySelector"); + } + + RotarySelectorItem target = Items[index]; + Interop.Eext.eext_rotary_selector_item_del(target.Handle); + target.Handle = IntPtr.Zero; + Items.RemoveAt(index); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return Items.GetEnumerator(); + } + } +} diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs new file mode 100644 index 0000000..4bbd8d9 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleDatetime.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_datetime_add(IntPtr datetime, IntPtr surface); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs new file mode 100644 index 0000000..b3581ca --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleGenList.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_genlist_add(IntPtr genlist, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_set(IntPtr circleGenlist, int policyHorisontal, int policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, out int policyHorisontal, out int policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, out int policyHorisontal, IntPtr policyVertical); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_genlist_scroller_policy_get(IntPtr circleGenlist, IntPtr policyHorisontal, out int policyVertical); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs new file mode 100644 index 0000000..e1940f6 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleObject.cs @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_add(IntPtr obj, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_circle_object_disabled_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_line_width_set(IntPtr obj, int lineWidth); + + [DllImport(Libraries.Eext)] + internal static extern int eext_circle_object_line_width_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_set(IntPtr obj, double angle); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_angle_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_offset_set(IntPtr obj, double offset); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_angle_offset_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_angle_min_max_get(IntPtr obj, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_min_max_get(IntPtr obj, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_value_set(IntPtr obj, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_value_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_color_get(IntPtr obj, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_radius_set(IntPtr obj, double radius); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_radius_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_line_width_set(IntPtr obj, string item, int lineWidth); + + [DllImport(Libraries.Eext)] + internal static extern int eext_circle_object_item_line_width_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_set(IntPtr obj, string item, double angle); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_angle_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_offset_set(IntPtr obj, string item, double offset); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_angle_offset_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_set(IntPtr obj, string item, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, out double min, IntPtr max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_angle_min_max_get(IntPtr obj, string item, IntPtr min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_set(IntPtr obj, string item, double min, double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, out double min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, out double min, IntPtr max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_min_max_get(IntPtr obj, string item, IntPtr min, out double max); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_value_set(IntPtr obj, string item, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_value_get(IntPtr obj, string item); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_color_set(IntPtr obj, string item, int r, int g, int b, int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_color_get(IntPtr obj, string item, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_item_radius_set(IntPtr obj, string item, double radius); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_item_radius_get(IntPtr obj, string item); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs new file mode 100644 index 0000000..8c60209 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleProgressBar.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_progressbar_add(IntPtr parent, IntPtr surface); + + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs new file mode 100644 index 0000000..2502100 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleScroller.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_scroller_add(IntPtr scroller, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_set(IntPtr obj, int policy_h, int policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, IntPtr policy_h, IntPtr policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, out int policy_h, IntPtr policy_v); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_scroller_policy_get(IntPtr obj, IntPtr policy_h, out int policy_v); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs new file mode 100644 index 0000000..d2eeef3 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSlider.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_slider_add(IntPtr parent, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern void eext_circle_object_slider_step_set(IntPtr obj, double value); + + [DllImport(Libraries.Eext)] + internal static extern double eext_circle_object_slider_step_get(IntPtr obj); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs new file mode 100644 index 0000000..eb221eb --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSpinner.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_spinner_add(IntPtr spinner, IntPtr surface); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_object_spinner_angle_set(IntPtr spinner, double angle); + + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs new file mode 100644 index 0000000..4b5f820 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.CircleSurface.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_conformant_add(IntPtr conformant); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_layout_add(IntPtr layout); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_naviframe_add(IntPtr naviframe); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_circle_surface_del(IntPtr surface); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs new file mode 100644 index 0000000..95b1de8 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.MoreOption.cs @@ -0,0 +1,65 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_add(IntPtr parent); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_direction_set(IntPtr obj, int direction); + + [DllImport(Libraries.Eext)] + internal static extern int eext_more_option_direction_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_append(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_del(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_domain_translatable_part_text_set(IntPtr item, string part_name, string domain, string text); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_insert_after(IntPtr obj, IntPtr after); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_insert_before(IntPtr obj, IntPtr before); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_part_content_get(IntPtr obj, string part_name); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_part_content_set(IntPtr item, string part_name, IntPtr content); + + [DllImport(Libraries.Eext, EntryPoint = "eext_more_option_item_part_text_get")] + static extern IntPtr _eext_more_option_item_part_text_get(IntPtr item, string part_name); + + internal static string eext_more_option_item_part_text_get(IntPtr item, string part_name) + { + var ptr = _eext_more_option_item_part_text_get(item, part_name); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_item_part_text_set(IntPtr item, string part_name, string text); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_item_prepend(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_items_clear(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_more_option_items_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_more_option_opened_get(IntPtr obj); + + [DllImport(Libraries.Eext)] + internal static extern void eext_more_option_opened_set(IntPtr obj, bool opened); + } +} diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs new file mode 100644 index 0000000..5348d39 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.Rotary.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_object_event_activated_set(IntPtr circleObject, bool activated); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs b/src/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs new file mode 100644 index 0000000..457cfbb --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Eext.RotarySelector.cs @@ -0,0 +1,51 @@ +using System; +using System.Runtime.InteropServices; + + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_add(IntPtr parent); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_append(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_prepend(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_insert_after(IntPtr obj, IntPtr after); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_insert_before(IntPtr obj, IntPtr before); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_del(IntPtr item); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_items_clear(IntPtr obj); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_text_set(IntPtr item, string part_name, string text); + [DllImport(Libraries.Eext)] + internal static extern string eext_rotary_selector_item_part_text_get(IntPtr item, string part_name); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_domain_translatable_part_text_set(IntPtr item, string part_name, string domain, string text); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_content_set(IntPtr item, string part_name, int state, IntPtr content); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_item_part_content_get(IntPtr item, string part_name, int state); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_content_set(IntPtr obj, string part_name, int state, IntPtr content); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_part_content_get(IntPtr obj, string part_name, int state); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_color_set(IntPtr item, string part_name, int state, int r, int g, int b, int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_item_part_color_get(IntPtr item, string part_name, int state, out int r, out int g, out int b, out int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_color_set(IntPtr obj, string part_name, int state, int r, int g, int b, int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_part_color_get(IntPtr obj, string part_name, int state, out int r, out int g, out int b, out int a); + [DllImport(Libraries.Eext)] + internal static extern void eext_rotary_selector_selected_item_set(IntPtr obj, IntPtr item); + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_rotary_selector_selected_item_get(IntPtr obj); + + } +} diff --git a/src/ElmSharp.Wearable/Interop/Interop.Evas.cs b/src/ElmSharp.Wearable/Interop/Interop.Evas.cs new file mode 100644 index 0000000..dbe48e8 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Evas.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Evas + { + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_resize(IntPtr obj, int w, int h); + } +} \ No newline at end of file diff --git a/src/ElmSharp.Wearable/Interop/Interop.Libraries.cs b/src/ElmSharp.Wearable/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..3668358 --- /dev/null +++ b/src/ElmSharp.Wearable/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static class Libraries + { + internal const string Elementary = "libelementary.so.1"; + internal const string Eext = "libefl-extension.so.0"; + internal const string Evas = "libevas.so.1"; + } +} diff --git a/src/ElmSharp/ElmSharp.csproj b/src/ElmSharp/ElmSharp.csproj new file mode 100644 index 0000000..88c3f81 --- /dev/null +++ b/src/ElmSharp/ElmSharp.csproj @@ -0,0 +1,9 @@ + + + + + netstandard1.6 + + + + diff --git a/src/ElmSharp/ElmSharp.sln b/src/ElmSharp/ElmSharp.sln new file mode 100755 index 0000000..a762491 --- /dev/null +++ b/src/ElmSharp/ElmSharp.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "ElmSharp.csproj", "{14E1F109-06BC-4BB7-9146-704A71EC2522}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {14E1F109-06BC-4BB7-9146-704A71EC2522}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14E1F109-06BC-4BB7-9146-704A71EC2522}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14E1F109-06BC-4BB7-9146-704A71EC2522}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14E1F109-06BC-4BB7-9146-704A71EC2522}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/ElmSharp/ElmSharp/AccessRole.cs b/src/ElmSharp/ElmSharp/AccessRole.cs new file mode 100755 index 0000000..b49b2a2 --- /dev/null +++ b/src/ElmSharp/ElmSharp/AccessRole.cs @@ -0,0 +1,438 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Accessible +{ + /// + /// Enumeration for AccessRole. + /// + public enum AccessRole + { + /// + /// Invalid + /// + Invalid, + /// + /// AcceleratorLabel role + /// + AcceleratorLabel, + /// + /// Alert role + /// + Alert, + /// + /// Animation role + /// + Animation, + /// + /// Arrow role + /// + Arrow, + /// + /// Calendar role + /// + Calendar, + /// + /// Canvas role + /// + Canvas, + /// + /// CheckBox role + /// + CheckBox, + /// + /// CheckMenuItem role + /// + CheckMenuItem, + /// + /// ColorChooser role + /// + ColorChooser, + /// + /// ColumnHeader role + /// + ColumnHeader, + /// + /// ComboBox role + /// + ComboBox, + /// + /// DateEditor role + /// + DateEditor, + /// + /// DesktopIcon role + /// + DesktopIcon, + /// + /// DesktopFrame role + /// + DesktopFrame, + /// + /// Dial role + /// + Dial, + /// + /// Dialog role + /// + Dialog, + /// + /// DirectoryPane role + /// + DirectoryPane, + /// + /// DrawingArea role + /// + DrawingArea, + /// + /// FileChooser role + /// + FileChooser, + /// + /// Filler role + /// + Filler, + /// + /// FocusTraversable role + /// + FocusTraversable, + /// + /// FontChooser role + /// + FontChooser, + /// + /// Frame role + /// + Frame, + /// + /// GlassPane role + /// + GlassPane, + /// + /// HtmlContainer role + /// + HtmlContainer, + /// + /// Icon role + /// + Icon, + /// + /// Image role + /// + Image, + /// + /// InternalFrame role + /// + InternalFrame, + /// + /// Label role + /// + Label, + /// + /// LayeredPane role + /// + LayeredPane, + /// + /// List role + /// + List, + /// + /// ListItem role + /// + ListItem, + /// + /// Menu role + /// + Menu, + /// + /// MenuBar role + /// + MenuBar, + /// + /// MenuItem role + /// + MenuItem, + /// + /// OptionPane role + /// + OptionPane, + /// + /// PageTab role + /// + PageTab, + /// + /// PageTabList role + /// + PageTabList, + /// + /// Panel role + /// + Panel, + /// + /// PasswordText role + /// + PasswordText, + /// + /// PopupMenu role + /// + PopupMenu, + /// + /// ProgressBar role + /// + ProgressBar, + /// + /// PushButton role + /// + PushButton, + /// + /// RadioButton role + /// + RadioButton, + /// + /// RadioMenuItem role + /// + RadioMenuItem, + /// + /// RootPane role + /// + RootPane, + /// + /// RowHeader role + /// + RowHeader, + /// + /// ScrollBar role + /// + ScrollBar, + /// + /// ScrollPane role + /// + ScrollPane, + /// + /// Separator role + /// + Separator, + /// + /// Slider role + /// + Slider, + /// + /// SpinButton role + /// + SpinButton, + /// + /// SplitPane role + /// + SplitPane, + /// + /// StatusBar role + /// + StatusBar, + /// + /// Table role + /// + Table, + /// + /// TableCell role + /// + TableCell, + /// + /// TableColumnHeader role + /// + TableColumnHeader, + /// + /// TableRowHeader role + /// + TableRowHeader, + /// + /// TearoffMenuItem role + /// + TearoffMenuItem, + /// + /// Terminal role + /// + Terminal, + /// + /// Text role + /// + Text, + /// + /// ToggleButton role + /// + ToggleButton, + /// + /// ToolBar role + /// + ToolBar, + /// + /// ToolTip role + /// + ToolTip, + /// + /// Tree role + /// + Tree, + /// + /// TreeTable role + /// + TreeTable, + /// + /// Unknown + /// + Unknown, + /// + /// Viewport role + /// + Viewport, + /// + /// Window role + /// + Window, + /// + /// Extended role + /// + Extended, + /// + /// Header role + /// + Header, + /// + /// Footer role + /// + Footer, + /// + /// Paragraph + /// + Paragraph, + /// + /// Ruler role + /// + Ruler, + /// + /// Application role + /// + Application, + /// + /// Autocomplete role + /// + Autocomplete, + /// + /// Editbar role + /// + Editbar, + /// + /// Embedded role + /// + Embedded, + /// + /// Entry role + /// + Entry, + /// + /// Chart role + /// + Chart, + /// + /// Caption role + /// + Caption, + /// + /// DocumentFrame role + /// + DocumentFrame, + /// + /// Heading role + /// + Heading, + /// + /// Page role + /// + Page, + /// + /// Section role + /// + Section, + /// + /// RedundantObject role + /// + RedundantObject, + /// + /// Form role + /// + Form, + /// + /// Link role + /// + Link, + /// + /// InputMethodWindow role + /// + InputMethodWindow, + /// + /// TableRow role + /// + TableRow, + /// + /// TreeItem role + /// + TreeItem, + /// + /// DocumentSpreadsheet role + /// + DocumentSpreadsheet, + /// + /// DocumentPresentation role + /// + DocumentPresentation, + /// + /// DocumentText role + /// + DocumentText, + /// + /// DocumentWeb role + /// + DocumentWeb, + /// + /// DocumentEmail role + /// + DocumentEmail, + /// + /// Comment role + /// + Comment, + /// + /// ListBox role + /// + ListBox, + /// + /// Grouping role + /// + Grouping, + /// + /// ImageMap role + /// + ImageMap, + /// + /// Notification role + /// + Notification, + /// + /// InfoBar role + /// + InfoBar + } +} diff --git a/src/ElmSharp/ElmSharp/AccessibleObject.cs b/src/ElmSharp/ElmSharp/AccessibleObject.cs new file mode 100755 index 0000000..08eedcb --- /dev/null +++ b/src/ElmSharp/ElmSharp/AccessibleObject.cs @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Accessible +{ + /// + /// The delegate to define how to provide informations for or . + /// + /// The sender obj. + /// Return information for Name or Description. + public delegate string AccessibleInfoProvider (AccessibleObject obj); + + /// + /// It's a base abstract class for . + /// It provides available definitions for the screen reader, such as , , , etc. + /// There's many the relationship between two accessible objects, like , , , , etc. + /// + public abstract class AccessibleObject : EvasObject, IAccessibleObject + { + + AccessibleInfoProvider _nameProvider; + AccessibleInfoProvider _descriptionProvider; + + Interop.Elementary.Elm_Atspi_Reading_Info_Cb _nameProviderInternal; + Interop.Elementary.Elm_Atspi_Reading_Info_Cb _descriptionProviderInternal; + + /// + /// Gets or sets the reading information types of an accessible object. + /// + ReadingInfoType IAccessibleObject.ReadingInfoType + { + get + { + return (ReadingInfoType)Interop.Elementary.elm_atspi_accessible_reading_info_type_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_reading_info_type_set(RealHandle, + (Interop.Elementary.Elm_Accessible_Reading_Info_Type)value); + } + } + + /// + /// Gets or sets the role of the object in accessibility domain. + /// + AccessRole IAccessibleObject.Role + { + get + { + return (AccessRole)Interop.Elementary.elm_atspi_accessible_role_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_role_set(RealHandle, + (Interop.Elementary.Elm_Atspi_Role)value); + } + } + + /// + /// Gets or sets highlightable of given widget. + /// + bool IAccessibleObject.CanHighlight + { + get + { + return Interop.Elementary.elm_atspi_accessible_can_highlight_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_can_highlight_set(RealHandle, value); + } + } + + /// + /// Gets or sets the translation domain of "name" and "description" properties. + /// Translation domain should be set if application wants to support i18n for accessibily "name" and "description" properties. + /// When translation domain is set values of "name" and "description" properties will be translated with dgettext function using current translation domain as "domainname" parameter. + /// It is application developer responsibility to ensure that translation files are loaded and binded to translation domain when accessibility is enabled. + /// + string IAccessibleObject.TranslationDomain + { + get + { + return Interop.Elementary.elm_atspi_accessible_translation_domain_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_translation_domain_set(RealHandle, value); + } + } + + /// + /// Gets or sets an accessible name of the object. + /// + string IAccessibleObject.Name + { + get + { + return Interop.Elementary.elm_atspi_accessible_name_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_name_set(RealHandle, value); + } + } + + /// + /// Gets or sets contextual information about object. + /// + string IAccessibleObject.Description + { + get + { + return Interop.Elementary.elm_atspi_accessible_description_get(RealHandle); + } + set + { + Interop.Elementary.elm_atspi_accessible_description_set(RealHandle, value); + } + } + + /// + /// Gets or sets the delegate for . + /// + AccessibleInfoProvider IAccessibleObject.NameProvider + { + get + { + return _nameProvider; + } + + set + { + if (_nameProviderInternal == null) + { + _nameProviderInternal = (data, obj) => _nameProvider(this); + } + if (value == null) + { + _nameProvider = null; + Interop.Elementary.elm_atspi_accessible_name_cb_set(RealHandle, null, IntPtr.Zero); + } + else + { + _nameProvider = new AccessibleInfoProvider(value); + Interop.Elementary.elm_atspi_accessible_name_cb_set(RealHandle, _nameProviderInternal, IntPtr.Zero); + } + } + } + + /// + /// Gets or sets the delegate for . + /// + AccessibleInfoProvider IAccessibleObject.DescriptionProvider + { + get + { + return _descriptionProvider; + } + + set + { + if (_descriptionProviderInternal == null) + { + _descriptionProviderInternal = (data, obj) => _descriptionProvider(this); + } + if (value == null) + { + _descriptionProvider = null; + Interop.Elementary.elm_atspi_accessible_description_cb_set(RealHandle, null, IntPtr.Zero); + } + else + { + _descriptionProvider = new AccessibleInfoProvider(value); + Interop.Elementary.elm_atspi_accessible_description_cb_set(RealHandle, _descriptionProviderInternal, IntPtr.Zero); + } + } + } + + /// + /// Creates and initializes a new instance of the AccessibleObject class with parent EvasObject class parameter. + /// + /// Parent EvasObject class + public AccessibleObject(EvasObject parent) : base(parent) + { + } + + /// + /// Creates and initializes a new instance of the AccessibleObject class. + /// + public AccessibleObject() : base() + { + } + + /// + /// Defines the relationship between two accessible objects. + /// Relationships can be queried by Assistive Technology clients to provide customized feedback, improving overall user experience. + /// AppendRelation API is asymmetric, which means that appending, for example, relation from object A to B, do not append relation from object B to object A. + /// + /// The relationship between source object and target object of a given type. + void IAccessibleObject.AppendRelation(IAccessibleRelation relation) + { + if (relation.Target == null) throw new ArgumentException("Target of Accessibility relation can not be null"); + Interop.Elementary.elm_atspi_accessible_relationship_append(RealHandle, relation.Type, relation.Target.Handle); + } + + /// + /// Removes the relationship between two accessible objects. + /// + /// The relationship between source object and target object of a given type. + void IAccessibleObject.RemoveRelation(IAccessibleRelation relation) + { + if (relation.Target == null) throw new ArgumentException("Target of Accessibility relation can not be null"); + Interop.Elementary.elm_atspi_accessible_relationship_remove(RealHandle, relation.Type, relation.Target.Handle); + } + + /// + /// Highlights accessible widget. + /// + public void Highlight() + { + Interop.Elementary.elm_atspi_component_highlight_grab(RealHandle); + } + + /// + /// Clears highlight of accessible widget. + /// + public void Unhighlight() + { + Interop.Elementary.elm_atspi_component_highlight_clear(RealHandle); + } + } +} diff --git a/src/ElmSharp/ElmSharp/AccessibleRelation.cs b/src/ElmSharp/ElmSharp/AccessibleRelation.cs new file mode 100755 index 0000000..4d24e98 --- /dev/null +++ b/src/ElmSharp/ElmSharp/AccessibleRelation.cs @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace ElmSharp.Accessible +{ + /// + /// IAccessibleRelation is a interface which defines the relationship between two accessible objects. + /// + public interface IAccessibleRelation + { + + AccessibleObject Target { get; set; } + int Type { get; } + } + + /// + /// To define label info for accessible object. + /// + public class LabelledBy : IAccessibleRelation + { + /// + /// Gets or sets the target object which is LabelledBy. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the LabelledBy type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_LABELLED_BY; } + } + } + + /// + /// To define label info for accessible object. + /// + public class LabelFor : IAccessibleRelation + { + /// + /// Gets or sets the target object which is LabelFor. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the LabelFor type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_LABEL_FOR; } + } + } + + /// + /// To define control relationship for accessible object. + /// + public class ControllerFor : IAccessibleRelation + { + /// + /// Gets or sets the target object which is ControllerFor. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the ControllerFor type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_CONTROLLER_FOR; } + } + } + + /// + /// To define control relationship for accessible object. + /// + public class ControlledBy : IAccessibleRelation + { + /// + /// Gets or sets the target object which is ControlledBy. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the ControlledBy type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_CONTROLLED_BY; } + } + } + + /// + /// To define member relationship for accessible object. + /// + public class MemberOf : IAccessibleRelation + { + /// + /// Gets or sets the target object which is MemberOf. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the MemberOf type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_MEMBER_OF; } + } + } + + /// + /// To define tooltip for accessible object. + /// + public class TooltipFor : IAccessibleRelation + { + /// + /// Gets or sets the target object which is TooltipFor. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the TooltipFor type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_TOOLTIP_FOR; } + } + } + + /// + /// To define child for accessible object. + /// + public class ChildOf : IAccessibleRelation + { + /// + /// Gets or sets the target object which is ChildOf. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the ChildOf type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_NODE_CHILD_OF; } + } + } + + /// + /// To define parent for accessible object. + /// + public class ParentOf : IAccessibleRelation + { + /// + /// Gets or sets the target object which is ParentOf. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the ParentOf type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_NODE_PARENT_OF; } + } + } + + /// + /// To define extend for accessible object. + /// + public class Extended : IAccessibleRelation + { + /// + /// Gets or sets the target object which is Extended. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the Extended type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_EXTENDED; } + } + } + + /// + /// To define the custom reading order. + /// + public class FlowsTo : IAccessibleRelation + { + /// + /// Gets or sets the target object which is FlowsTo. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the FlowsTo type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_FLOWS_TO; } + } + } + + /// + /// To define the custom reading order. + /// + public class FlowsFrom : IAccessibleRelation + { + /// + /// Gets or sets the target object which is FlowsFrom. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the FlowsFrom type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_FLOWS_FROM; } + } + } + + /// + /// To define subwindow for accessible object. + /// + public class SubwindowOf : IAccessibleRelation + { + /// + /// Gets or sets the target object which is SubwindowOf. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the SubwindowOf type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_SUBWINDOW_OF; } + } + } + + /// + /// To define embed for accessible object. + /// + public class Embeds : IAccessibleRelation + { + /// + /// Gets or sets the target object which is Embeds. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the Embeds type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_EMBEDS; } + } + } + + /// + /// To define embed for accessible object. + /// + public class EmbeddedBy : IAccessibleRelation + { + /// + /// Gets or sets the target object which is EmbeddedBy. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the EmbeddedBy type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_EMBEDDED_BY; } + } + } + + /// + /// To define popup for accessible object. + /// + public class PopupFor : IAccessibleRelation + { + /// + /// Gets or sets the target object which is PopupFor. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the PopupFor type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_POPUP_FOR; } + } + } + + /// + /// To define parent window for accessible object. + /// + public class ParentWindowOf : IAccessibleRelation + { + /// + /// Gets or sets the target object which is ParentWindowOf. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the ParentWindowOf type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_PARENT_WINDOW_OF; } + } + } + + /// + /// To define description for accessible object. + /// + public class DescriptionFor : IAccessibleRelation + { + /// + /// Gets or sets the target object which is DescriptionFor. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the DescriptionFor type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_DESCRIPTION_FOR; } + } + } + + /// + /// To define description for accessible object. + /// + public class DescribedBy : IAccessibleRelation + { + /// + /// Gets or sets the target object which is DescribedBy. + /// + public AccessibleObject Target { get; set; } + + /// + /// Gets the DescribedBy type. + /// + public int Type + { + get { return (int)Interop.Elementary.Elm_Atspi_Relation_Type.ELM_ATSPI_RELATION_DESCRIBED_BY; } + } + } +} diff --git a/src/ElmSharp/ElmSharp/AccessibleUtil.cs b/src/ElmSharp/ElmSharp/AccessibleUtil.cs new file mode 100755 index 0000000..720fca4 --- /dev/null +++ b/src/ElmSharp/ElmSharp/AccessibleUtil.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace ElmSharp.Accessible +{ + /// + /// Enumeration for ReadingStatus. + /// + public enum ReadingStatus + { + /// + /// Unknown status + /// + Unknown, + /// + /// Cancelled status + /// + Cancelled, + /// + /// Stopped status + /// + Stoppped, + /// + /// Skipped status + /// + Skipped + } + + /// + /// AccessibleUtil provides a method to set the reading information. + /// + public static class AccessibleUtil + { + + static void AtspiSignalCallback(IntPtr data, string say_signal) + { + GCHandle gch = GCHandle.FromIntPtr(data); + TaskCompletionSource tcs = (TaskCompletionSource) gch.Target; + if (say_signal.Equals("ReadingCancelled")) + { + tcs.SetResult(ReadingStatus.Cancelled); + } + else if (say_signal.Equals("ReadingStopped")) + { + tcs.SetResult(ReadingStatus.Stoppped); + } + else if (say_signal.Equals("ReadingSkipped")) + { + tcs.SetResult(ReadingStatus.Skipped); + } + else + { + tcs.SetException(new InvalidOperationException("unknown signal : " + say_signal)); + } + + gch.Free(); + } + + /// + /// Reads given text by screen reader. + /// + /// The reading text. + /// If true, reading can be discarded by subsequent reading requests, if false the reading must finish before next reading request can be started. + /// Return a task with reading status. + public static Task Say(string text, bool discardable) + { + var tcs = new TaskCompletionSource(); + GCHandle gch = GCHandle.Alloc(tcs); + Interop.Elementary.elm_atspi_bridge_utils_say(text, discardable, AtspiSignalCallback, GCHandle.ToIntPtr(gch)); + return tcs.Task; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Background.cs b/src/ElmSharp/ElmSharp/Background.cs new file mode 100644 index 0000000..e5348b0 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Background.cs @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Background is a widget that use for setting (solid) background decorations to a window (unless it has transparency enabled) + /// or to any container object. + /// + public class Background : Layout + { + /// + /// Creates and initializes a new instance of the Background class. + /// + /// The EvasObject to which the new Background will be attached as a child. + public Background(EvasObject parent) : base(parent) + { + Style = "transparent"; + } + + /// + /// Sets or gets color to Background. + /// + public override Color Color + { + get + { + int r = 0; + int g = 0; + int b = 0; + int a = 0; + var swallowContent = GetPartContent("elm.swallow.rectangle"); + if (swallowContent != IntPtr.Zero) + { + Interop.Evas.evas_object_color_get(swallowContent, out r, out g, out b, out a); + } + return new Color(r, g, b, a); + } + set + { + var swallowContent = GetPartContent("elm.swallow.rectangle"); + if (swallowContent == IntPtr.Zero) + { + Interop.Elementary.elm_bg_color_set(RealHandle, value.R, value.G, value.B); + swallowContent = GetPartContent("elm.swallow.rectangle"); + } + Interop.Evas.evas_object_color_set(swallowContent, value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets image to Background. + /// + public string File + { + get + { + return Interop.Elementary.BackgroundFileGet(RealHandle); + } + set + { + Interop.Elementary.elm_bg_file_set(RealHandle, value, IntPtr.Zero); + } + } + + /// + /// Sets or gets the mode of display for a given background widget's image. + /// + /// + /// This sets how the background widget will display its image. + /// This will only work if the File was previously set with an image file on obj. + /// The image can be display tiled, scaled, centered or stretched. scaled by default. + /// + public BackgroundOptions BackgroundOption + { + get + { + return (BackgroundOptions)Interop.Elementary.elm_bg_option_get(RealHandle); + } + set + { + Interop.Elementary.elm_bg_option_set(RealHandle, (Interop.Elementary.BackgroundOptions)value); + } + } + + /// + /// Set the size of the pixmap representation of the image set on a given background widget. + /// This method just makes sense if an image file was set. + /// This is just a hint for the underlying system. + /// The real size of the pixmap may differ depending on the type of image being loaded, being bigger than requested. + /// + /// The new width of the image pixmap representation. + /// The new height of the image pixmap representation. + public void SetFileLoadSize(int w, int h) + { + if (File != null) + { + Interop.Elementary.elm_bg_load_size_set(RealHandle, w, h); + } + else + { + throw new Exception("This method just makes sense if an image file was set."); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_bg_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } + + /// + /// Enumeration for the background type. + /// + public enum BackgroundOptions + { + /// + /// Centers the background image + /// + Center, + + /// + /// Scales the background image, retaining the aspect ratio + /// + Scale, + + /// + /// Stretches the background image to fill the UI component's area. + /// + Stretch, + + /// + /// Tiles the background image at its original size + /// + Tile + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Box.cs b/src/ElmSharp/ElmSharp/Box.cs new file mode 100644 index 0000000..3436c64 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Box.cs @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Box is a container used to arranges UI components in a linear order. + /// + public class Box : Container + { + private Interop.Elementary.BoxLayoutCallback _layoutCallback; + + /// + /// Creates and initializes a new instance of the Box class. + /// + /// The EvasObject to which the new Box will be attached as a child. + public Box(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets IsHorizontal value which describe pack direction, vertical is default. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_box_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_box_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the box to arrange its children homogeneously. + /// + public bool IsHomogeneous + { + get + { + return Interop.Elementary.elm_box_homogeneous_get(RealHandle); + } + set + { + Interop.Elementary.elm_box_homogeneous_set(RealHandle, value); + } + } + + /// + /// Adds an object at the end of the pack list. + /// + /// + /// Packs "content" object into the Box, placing it last in the list of children objects. + /// The actual position the object will get on screen depends on the layout used. + /// If no custom layout is set, it will be at the bottom or right, + /// depending if the Box is vertical or horizontal, respectively. + /// + /// The oject be packed + public void PackEnd(EvasObject content) + { + Interop.Elementary.elm_box_pack_end(RealHandle, content); + AddChild(content); + } + + /// + /// Adds an "content" object to the beginning of the pack list. + /// + /// + /// Pack "content" object into the Box obj, placing it first in the list of children objects. + /// The actual position the object will get on screen depends on the layout used. + /// If no custom layout is set, it will be at the top or left, + /// depending if the Box is vertical or horizontal, respectively. + /// + /// The object to be packed. + public void PackStart(EvasObject content) + { + Interop.Elementary.elm_box_pack_start(RealHandle, content); + AddChild(content); + } + + /// + /// Adds an "content "object to the Box after the "after" object. + /// + /// + /// This will add the "content" to the Box indicated after the object indicated with "after". + /// If "after" is not already in the Box, results are undefined. + /// After means either to the right of the "after" object or below it depending on orientation. + /// + /// The object will be added in Box + /// The object has been added in Box + public void PackAfter(EvasObject content, EvasObject after) + { + Interop.Elementary.elm_box_pack_after(RealHandle, content, after); + AddChild(content); + } + + /// + /// Adds an "content "object to the Box before the "before" object. + /// + /// + /// This will add the "content" to the Box indicated before the object indicated with "before". + /// If "before" is not already in the Box, results are undefined. + /// before means either to the left of the "before" object or below it depending on orientation. + /// + /// The object will be added in Box + /// The object has been added in Box + public void PackBefore(EvasObject content, EvasObject before) + { + Interop.Elementary.elm_box_pack_before(RealHandle, content, before); + AddChild(content); + } + + /// + /// Remove the "content" oject from Box without deleting it. + /// + /// The object to unpack + public void UnPack(EvasObject content) + { + Interop.Elementary.elm_box_unpack(RealHandle, content); + RemoveChild(content); + } + + /// + /// Removes all objects from Box container. + /// + public void UnPackAll() + { + Interop.Elementary.elm_box_unpack_all(RealHandle); + ClearChildren(); + } + + /// + /// Whenever anything changes that requires the Box in obj to recalculate the size and position of its elements, + /// the function cb will be called to determine what the layout of the children will be. + /// + /// The callback function used for layout + public void SetLayoutCallback(Action action) + { + _layoutCallback = (obj, priv, data) => + { + action(); + }; + Interop.Elementary.elm_box_layout_set(RealHandle, _layoutCallback, IntPtr.Zero, null); + } + + /// + /// Sets the color of exact part to Box's layout parent. + /// + /// The name of part class, it could be 'bg', 'elm.swllow.content'. + /// The color value. + public override void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + /// + /// Gets the color of exact part of Box's layout parent. + /// + /// The name of part class, it could be 'bg', 'elm.swllow.content'. + /// + public override Color GetPartColor(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + + /// + /// Force the box to recalculate its children packing. + /// If any children was added or removed, box will not calculate the values immediately rather leaving it to the next main loop iteration. + /// While this is great as it would save lots of recalculation, whenever you need to get the position of a just added item you must force recalculate before doing so. + /// + public void Recalculate() + { + Interop.Elementary.elm_box_recalculate(RealHandle); + } + + /// + /// Clear the box of all children. + /// Remove all the elements contained by the box, deleting the respective objects. + /// + public void Clear() + { + Interop.Elementary.elm_box_clear(RealHandle); + ClearChildren(); + } + + /// + /// Sets or gets the alignment of the whole bounding box of contents. + /// + /// Horizontal alignment + /// Vertical alignment + public void SetBoxAlignment(double horizontal, double vertical) + { + Interop.Elementary.elm_box_align_set(RealHandle, horizontal, vertical); + } + + /// + /// Sets or gets the space(padding) between the box's elements. + /// + /// Horizontal padding + /// vertical padding + public void SetPadding(int horizontal, int vertical) + { + Interop.Elementary.elm_box_padding_set(RealHandle, horizontal, vertical); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + RealHandle = Interop.Elementary.elm_box_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Button.cs b/src/ElmSharp/ElmSharp/Button.cs new file mode 100644 index 0000000..3ed6aa8 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Button.cs @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Button is a widget works as a clickable input element to trigger events. + /// + public class Button : Layout + { + private SmartEvent _clicked; + private SmartEvent _repeated; + private SmartEvent _pressed; + private SmartEvent _released; + + /// + /// Creates and initializes a new instance of the Button class. + /// + /// + /// The EvasObject to which the new Button will be attached as a child. + /// + public Button(EvasObject parent) : base(parent) + { + _clicked = new SmartEvent(this, this.RealHandle, "clicked"); + _repeated = new SmartEvent(this, this.RealHandle, "repeated"); + _pressed = new SmartEvent(this, this.RealHandle, "pressed"); + _released = new SmartEvent(this, this.RealHandle, "unpressed"); + + _clicked.On += (sender, e) => + { + Clicked?.Invoke(this, EventArgs.Empty); + }; + + _repeated.On += (sender, e) => + { + Repeated?.Invoke(this, EventArgs.Empty); + }; + + _pressed.On += (sender, e) => + { + Pressed?.Invoke(this, EventArgs.Empty); + }; + + _released.On += (sender, e) => + { + Released?.Invoke(this, EventArgs.Empty); + }; + } + + /// + /// Clicked will be triggered when Button is clicked. + /// + public event EventHandler Clicked; + + /// + /// Repeated will be triggered when Button is pressed without releasing it. + /// + public event EventHandler Repeated; + + /// + /// Pressed will be triggered when the Button is pressed. + /// + public event EventHandler Pressed; + + /// + /// Released will be triggered when the Button is released after being pressed. + /// + public event EventHandler Released; + + /// + /// Sets or gets the autorepeat feature of a given Button. + /// + /// + /// Autorepeat feature means autorepeat event generated when the button is kept pressed. + /// When set AutoRepeat to false, no autorepeat is performed and buttons will trigger Clicked event when they are clicked. + /// When set to true, keeping a button pressed continuously trigger Repeated event until the button is released. + /// The time it takes until it starts triggering Repeated is given by AutoRepeatInitialTime, + /// and the time between each new emission is given by AutoRepeatGapTimeout. + /// + public bool AutoRepeat + { + get + { + return !Interop.Elementary.elm_button_autorepeat_get(RealHandle); + } + set + { + Interop.Elementary.elm_button_autorepeat_set(RealHandle, value); + } + } + + /// + /// Sets or gets the initial timeout before the Repeat event is generated. + /// + public double AutoRepeatInitialTime + { + get + { + return Interop.Elementary.elm_button_autorepeat_initial_timeout_get(RealHandle); + } + set + { + Interop.Elementary.elm_button_autorepeat_initial_timeout_set(RealHandle, value); + } + } + + /// + /// Sets or gets the interval between each generated Repeat event. + /// + public double AutoRepeatGapTimeout + { + get + { + return Interop.Elementary.elm_button_autorepeat_gap_timeout_get(RealHandle); + } + set + { + Interop.Elementary.elm_button_autorepeat_gap_timeout_set(RealHandle, value); + } + } + + [Obsolete("DeleteColorClass is obsolete, please use EdjeObject.DeleteColorClass(string)")] + public void DeleteColorClass(string part) + { + Interop.Elementary.edje_object_color_class_del(Handle, part); + } + + /// + /// Sets or gets the BackgroundColor of a given Button in normal and pressed status. + /// + public override Color BackgroundColor + { + set + { + if (value.IsDefault) + { + EdjeObject.DeleteColorClass("button/bg"); + EdjeObject.DeleteColorClass("button/bg_pressed"); + EdjeObject.DeleteColorClass("button/bg_disabled"); + } + else + { + SetPartColor("bg", value); + SetPartColor("bg_pressed", value); + SetPartColor("bg_disabled", value); + } + _backgroundColor = value; + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_button_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Calendar.cs b/src/ElmSharp/ElmSharp/Calendar.cs new file mode 100755 index 0000000..ef87281 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Calendar.cs @@ -0,0 +1,479 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// Enumeration for event periodicity, used to define if a mark should be repeated beyond event's day. It's set when a mark is added. + /// + public enum CalendarMarkRepeatType + { + /// + /// Default value. Marks will be displayed only on event day. + /// + Unique, + + /// + /// Marks will be displayed every day after event day. + /// + Daily, + + /// + /// Marks will be displayed every week after event day. + /// + Weekly, + + /// + /// Marks will be displayed every month day that coincides to event day. + /// + Monthly, + + /// + /// Marks will be displayed every year that coincides to event day. + /// + Annually, + + /// + /// Marks will be displayed every last day of month after event day. + /// + LastDayOfMonth + } + + /// + /// Enumeration for the mode, which determine how user could select a day. + /// + public enum CalendarSelectMode + { + /// + /// Default value. a day is always selected. + /// + Default, + + /// + /// A day is always selected. + /// + Always, + + /// + /// None of the days can be selected. + /// + None, + + /// + /// User may have selected a day or not. + /// + OnDemand + } + + /// + /// Enumeration used to define which fields of a tm struct will be taken into account + /// + [Flags] + public enum CalendarSelectable + { + /// + /// None will be taken into account + /// + None = 0, + /// + /// Year will be taken into account + /// + Year = 1 << 0, + /// + /// Month will be taken into account + /// + Month = 1 << 1, + /// + /// Day will be taken into account + /// + Day = 1 << 2 + } + + /// + /// The CalendarMark is a Item for marking a Calendar's type,date and repeat type. + /// + public class CalendarMark + { + internal IntPtr Handle; + + /// + /// A string used to define the type of mark. + /// + public string Type; + + /// + /// A time struct to represent the date of inclusion of the mark. + /// + public DateTime Date; + + /// + /// Repeat the event following this periodicity. + /// + public CalendarMarkRepeatType Repeat; + + /// + /// Creates and initializes a new instance of the CalendarMark class. + /// + /// Type of mark + /// Date of inclusion of the mark + /// Repeat type + public CalendarMark(string type, DateTime date, CalendarMarkRepeatType repeat) + { + Handle = IntPtr.Zero; + Type = type; + Date = date; + Repeat = repeat; + } + } + + /// + /// The Calendar is a widget that helps applications to flexibly display a calender with day of the week, date, year and month. + /// + public class Calendar : Layout + { + SmartEvent _changed; + DateTime _cacheSelectedDate; + SmartEvent _displayedMonthChanged; + int _cacheDisplayedMonth; + + Interop.Elementary.Elm_Calendar_Format_Cb _calendarFormat; + DateFormatDelegate _dateFormatDelegate = null; + + /// + /// Creates and initializes a new instance of the Calendar class. + /// + /// + /// The EvasObject to which the new Calendar will be attached as a child. + /// + public Calendar(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (sender, e) => + { + DateTime selectedDate = SelectedDate; + DateChanged?.Invoke(this, new DateChangedEventArgs(_cacheSelectedDate, selectedDate)); + _cacheSelectedDate = selectedDate; + }; + + _displayedMonthChanged = new SmartEvent(this, this.RealHandle, "display,changed"); + _displayedMonthChanged.On += (sender, e) => + { + int currentDisplayedMonth = DisplayedTime.Month; + DisplayedMonthChanged?.Invoke(this, new DisplayedMonthChangedEventArgs(_cacheDisplayedMonth, currentDisplayedMonth)); + _cacheDisplayedMonth = currentDisplayedMonth; + }; + + _calendarFormat = (t) => { return _dateFormatDelegate(t); }; + } + + /// + /// DateChanged will be triggered when the date in the calendar is changed. + /// + public event EventHandler DateChanged; + + /// + /// DisplayedMonthChanged will be triggered when the current month displayed in the calendar is changed. + /// + public event EventHandler DisplayedMonthChanged; + + /// + /// This delegate type is used to format the string that will be used to display month and year. + /// + /// DateTime + /// + public delegate string DateFormatDelegate(DateTime time); + + /// + /// Sets or gets the minimum for year. + /// + public int MinimumYear + { + get + { + int minimumYear; + int unused; + Interop.Elementary.elm_calendar_min_max_year_get(RealHandle, out minimumYear, out unused); + return minimumYear; + } + set + { + int maximumYear; + int unused; + Interop.Elementary.elm_calendar_min_max_year_get(RealHandle, out unused, out maximumYear); + if (maximumYear < 1902) + { + maximumYear = DateTime.MaxValue.Year; + } + Interop.Elementary.elm_calendar_min_max_year_set(RealHandle, value, maximumYear); + } + } + + /// + /// Sets or gets the maximum for the year. + /// + public int MaximumYear + { + get + { + int maximumYear; + int unused; + Interop.Elementary.elm_calendar_min_max_year_get(RealHandle, out unused, out maximumYear); + return maximumYear; + } + set + { + int minimumYear; + int unused; + Interop.Elementary.elm_calendar_min_max_year_get(RealHandle, out minimumYear, out unused); + Interop.Elementary.elm_calendar_min_max_year_set(RealHandle, minimumYear, value); + } + } + + /// + /// Sets or gets the first day of week, who are used on Calendar. + /// + public DateTime DisplayedTime + { + get + { + var tm = new Interop.Libc.SystemTime(); + Interop.Elementary.elm_calendar_displayed_time_get(RealHandle, out tm); + ///TODO + ///If the defect is fixed, it will be removed. + var daysInMonth = DateTime.DaysInMonth(tm.tm_year + 1900, tm.tm_mon + 1); + var day = tm.tm_mday; + + if (day > daysInMonth) + { + day = daysInMonth; + } + + DateTime date = new DateTime(tm.tm_year + 1900, tm.tm_mon + 1, day, tm.tm_hour, tm.tm_min, tm.tm_sec); + + return date; + } + } + + /// + /// Sets or gets the first day of week, who are used on Calendar. + /// + public DayOfWeek FirstDayOfWeek + { + get + { + return (DayOfWeek)Interop.Elementary.elm_calendar_first_day_of_week_get(RealHandle); + } + set + { + Interop.Elementary.elm_calendar_first_day_of_week_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets the weekdays names to be displayed by the Calendar. + /// + /// + /// The usage should be like this; + /// List weekDayNames = new List() { "S", "M", "T", "W", "T", "F", "S" }; + /// Calendar.WeekDayNames = weekDayNames; + /// + public IReadOnlyList WeekDayNames + { + get + { + IntPtr stringArrayPtr = Interop.Elementary.elm_calendar_weekdays_names_get(RealHandle); + string[] stringArray; + IntPtrToStringArray(stringArrayPtr, 7, out stringArray); + return stringArray; + } + set + { + if (value != null && value.Count == 7) + { + Interop.Elementary.elm_calendar_weekdays_names_set(RealHandle, value.ToArray()); + } + } + } + + /// + /// Sets or gets the selected date. + /// + /// + /// Selected date changes when the user goes to next/previous month or select a day pressing over it on calendar. + /// + public DateTime SelectedDate + { + get + { + var tm = new Interop.Libc.SystemTime(); + Interop.Elementary.elm_calendar_selected_time_get(RealHandle, ref tm); + if (tm.tm_year == 0 && tm.tm_mon == 0 && tm.tm_mday == 0) + { + return DateTime.Now; + } + return tm; + } + set + { + Interop.Libc.SystemTime tm = value; + Interop.Elementary.elm_calendar_selected_time_set(RealHandle, ref tm); + _cacheSelectedDate = value; + } + } + + /// + /// Sets or gets the interval on time updates for an user mouse button + /// hold on calendar widgets' month/year selection. + /// + public double Interval + { + get + { + return Interop.Elementary.elm_calendar_interval_get(RealHandle); + } + set + { + Interop.Elementary.elm_calendar_interval_set(RealHandle, value); + } + } + + /// + /// Gets or sets the select day mode used. + /// + public CalendarSelectMode SelectMode + { + get + { + return (CalendarSelectMode)Interop.Elementary.elm_calendar_select_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_calendar_select_mode_set(RealHandle, (Interop.Elementary.Elm_Calendar_Select_Mode)value); + } + } + + /// + /// Gets or sets fields of a datetime will be taken into account, when SelectedDate set is invoked. + /// + public CalendarSelectable Selectable + { + get + { + return (CalendarSelectable)Interop.Elementary.elm_calendar_selectable_get(RealHandle); + } + set + { + Interop.Elementary.elm_calendar_selectable_set(RealHandle, (int)value); + } + } + + /// + /// Gets or sets date format the string that will be used to display month and year. + /// By default it uses strftime with "%B %Y" format string. + /// It should allocate the memory that will be used by the string, that will be freed by the widget after usage.A pointer to the string and a pointer to the time struct will be provided. + /// + public DateFormatDelegate DateFormat + { + get + { + return _dateFormatDelegate; + } + set + { + _dateFormatDelegate = value; + if (value != null) + { + Interop.Elementary.elm_calendar_format_function_set(RealHandle, _calendarFormat); + } + else + { + Interop.Elementary.elm_calendar_format_function_set(RealHandle, null); + } + } + } + + /// + /// Add a new mark to the calendar. + /// + /// A string used to define the type of mark. It will be emitted to the theme, that should display a related modification on these days representation. + /// A time struct to represent the date of inclusion of the mark. For marks that repeats it will just be displayed after the inclusion date in the calendar. + /// Repeat the event following this periodicity. Can be a unique mark (that don't repeat), daily, weekly, monthly or annually. + /// Item for a calendar mark. + public CalendarMark AddMark(string type, DateTime date, CalendarMarkRepeatType repeat) + { + CalendarMark mark = new CalendarMark(type, date, repeat); + Interop.Libc.SystemTime tm = date; + IntPtr nativeHandle = Interop.Elementary.elm_calendar_mark_add(RealHandle, type, ref tm, (Interop.Elementary.Elm_Calendar_Mark_Repeat_Type)repeat); + mark.Handle = nativeHandle; + + return mark; + } + + /// + /// Delete mark from the calendar. + /// + /// Item for a calendar mark + public void DeleteMark(CalendarMark mark) + { + Interop.Elementary.elm_calendar_mark_del(mark.Handle); + } + + /// + /// Draw calendar marks. + /// + public void DrawMarks() + { + Interop.Elementary.elm_calendar_marks_draw(RealHandle); + } + + /// + /// Remove all calendar's marks. + /// + public void ClearMarks() + { + Interop.Elementary.elm_calendar_marks_clear(RealHandle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_calendar_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + static void IntPtrToStringArray(IntPtr unmanagedArray, int size, out string[] managedArray) + { + managedArray = new string[size]; + IntPtr[] IntPtrArray = new IntPtr[size]; + + Marshal.Copy(unmanagedArray, IntPtrArray, 0, size); + + for (int iterator = 0; iterator < size; iterator++) + { + managedArray[iterator] = Marshal.PtrToStringAnsi(IntPtrArray[iterator]); + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Check.cs b/src/ElmSharp/ElmSharp/Check.cs new file mode 100755 index 0000000..ae153d8 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Check.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The check is a widget allows for toggling a value between true and false. + /// + public class Check : Layout + { + private SmartEvent _changed; + private bool _currentState; + + /// + /// Creates and initializes a new instance of the Check class. + /// + /// + /// The EvasObject to which the new Check will be attached as a child. + /// + public Check(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (sender, e) => + { + StateChanged?.Invoke(this, new CheckStateChangedEventArgs(_currentState, IsChecked)); + }; + } + + /// + /// StateChanged will be triggered when the IsChecked in the Check is changed. + /// + public event EventHandler StateChanged; + + /// + /// Sets or gets whether the given Check is checked or not. + /// + /// + /// When object is checked, the value will set to true, Conversely will set to false. + /// + public bool IsChecked + { + get + { + _currentState = Interop.Elementary.elm_check_state_get(RealHandle); + return _currentState; + } + set + { + Interop.Elementary.elm_check_state_set(RealHandle, value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_check_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/CheckStateChangedEventArgs.cs b/src/ElmSharp/ElmSharp/CheckStateChangedEventArgs.cs new file mode 100755 index 0000000..461798f --- /dev/null +++ b/src/ElmSharp/ElmSharp/CheckStateChangedEventArgs.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// The CheckStateChangedEventArgs is EventArgs to record Check's state. + /// Include old state and new state. + /// + public class CheckStateChangedEventArgs : EventArgs + { + /// + /// Gets the OldState property.The return type is bool. + /// + public bool OldState { get; private set; } + + /// + /// Gets the NewState property.The return type is bool. + /// + public bool NewState { get; private set; } + + /// + /// Creates and initializes a new instance of the CheckStateChangedEventArgs class. + /// + /// Old state of Check which to use this CheckStateChangedEventArgs. + /// New state of Check which to use this CheckStateChangedEventArgs. + public CheckStateChangedEventArgs(bool oldState, bool newState) + { + this.OldState = oldState; + this.NewState = newState; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Color.cs b/src/ElmSharp/ElmSharp/Color.cs new file mode 100644 index 0000000..9b27f0f --- /dev/null +++ b/src/ElmSharp/ElmSharp/Color.cs @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Globalization; + +namespace ElmSharp +{ + /// + /// The Color is a struct to record Check's state. + /// + public struct Color + { + readonly int _a; + readonly int _r; + readonly int _g; + readonly int _b; + + readonly Mode _mode; + + enum Mode + { + Default, + Rgb + } + + /// + /// Gets a default Color instance. + /// + /// + /// In default Color instance,Mode type is Default,RGBA all set as -1. + /// + public static Color Default + { + get { return new Color(-1, -1, -1, -1, Mode.Default); } + } + + /// + /// Gets whether the Color instance's mode is default or not. + /// Return type is bool. + /// + public bool IsDefault + { + get { return _mode == Mode.Default; } + } + + /// + /// Gets A value of RGBA. + /// A means the Alpha in color. + /// + public int A + { + get { return _a; } + } + + /// + /// Gets R value of RGBA. + /// R means the Red in color. + /// + public int R + { + get { return _r; } + } + + /// + /// Gets G value of RGBA. + /// G means the Green in color. + /// + public int G + { + get { return _g; } + } + + /// + /// Gets B value of RGBA. + /// B means the Blue in color. + /// + public int B + { + get { return _b; } + } + + /// + /// Creates and initializes a new instance of the Color class. + /// With RGB parameters. + /// + /// Red of RGB + /// Green of RGB + /// Blue of RGB + public Color(int r, int g, int b) : this(r, g, b, 255) + { + } + + /// + /// Creates and initializes a new instance of the Color class. + /// With RGBA parameters. + /// + /// Red of RGBA + /// Green of RGBA< + /// Blue of RGBA< + /// Alpha of RGBA< + public Color(int r, int g, int b, int a) : this(r, g, b, a, Mode.Rgb) + { + } + + Color(int r, int g, int b, int a, Mode mode) + { + _mode = mode; + if (mode == Mode.Rgb) + { + _r = Clamp(r, 0, 255); + _g = Clamp(g, 0, 255); + _b = Clamp(b, 0, 255); + _a = Clamp(a, 0, 255); + } + else // Default + { + _r = _g = _b = _a = -1; + } + } + + public override int GetHashCode() + { + int hashcode = _r.GetHashCode(); + hashcode = (hashcode * 397) ^ _g.GetHashCode(); + hashcode = (hashcode * 397) ^ _b.GetHashCode(); + hashcode = (hashcode * 397) ^ _a.GetHashCode(); + return hashcode; + } + + public override bool Equals(object obj) + { + if (obj is Color) + { + return EqualsInner(this, (Color)obj); + } + return base.Equals(obj); + } + + /// + /// Compare whether two Color instance is same or not. + /// + /// A Color instance. + /// A Color instance. + /// The result whether two instance is same or not. + /// Return type is bool.If they are same, return true. + /// + public static bool operator ==(Color a, Color b) + { + if (ReferenceEquals(a, b)) + return true; + + if ((object)a == null || (object)b == null) + return false; + + return EqualsInner(a, b); + } + + /// + /// Compare whether two Color instance is different or not. + /// + /// A Color instance. + /// A Color instance. + /// The result whether two instance is different or not. + /// Return type is bool.If they are different, return true. + /// + public static bool operator !=(Color a, Color b) + { + return !(a == b); + } + + static bool EqualsInner(Color color1, Color color2) + { + if (color1._mode == Mode.Default && color2._mode == Mode.Default) + return true; + return color1._r == color2._r && color1._g == color2._g && color1._b == color2._b && color1._a == color2._a; + } + + public override string ToString() + { + return string.Format(CultureInfo.InvariantCulture, "[Color: R={0}, G={1}, B={2}, A={3}]", R, G, B, A); + } + + /// + /// Gets a Color instance with a hexadecimal string parameter. + /// + /// Hexadecimal string. + /// New instance of Color struct. + public static Color FromHex(string hex) + { + hex = hex.Replace("#", ""); + switch (hex.Length) + { + case 3: //#rgb => ffrrggbb + hex = string.Format("ff{0}{1}{2}{3}{4}{5}", hex[0], hex[0], hex[1], hex[1], hex[2], hex[2]); + break; + case 4: //#argb => aarrggbb + hex = string.Format("{0}{1}{2}{3}{4}{5}{6}{7}", hex[0], hex[0], hex[1], hex[1], hex[2], hex[2], hex[3], hex[3]); + break; + case 6: //#rrggbb => ffrrggbb + hex = string.Format("ff{0}", hex); + break; + } + return FromUint(Convert.ToUInt32(hex.Replace("#", ""), 16)); + } + + /// + /// Gets a Color instance with a Unsigned integer parameter. + /// + /// Unsigned integer indicates RGBA. + /// New instance of Color struct. + public static Color FromUint(uint argb) + { + return FromRgba((byte)((argb & 0x00ff0000) >> 0x10), (byte)((argb & 0x0000ff00) >> 0x8), (byte)(argb & 0x000000ff), (byte)((argb & 0xff000000) >> 0x18)); + } + + /// + /// Gets a Color instance with R,G,B,A parameters. + /// + /// Red in RGBA. + /// Green in RGBA. + /// Blue in RGBA. + /// Alpha in RGBA. + /// New instance of Color struct. + public static Color FromRgba(int r, int g, int b, int a) + { + return new Color(r, g, b, a); + } + + /// + /// Gets a Color instance with R,G,B,A parameters. + /// + /// Red in RGB. + /// Green in RGB. + /// Blue in RGB. + /// New instance of Color struct. + public static Color FromRgb(int r, int g, int b) + { + return FromRgba(r, g, b, 255); + } + + internal static int Clamp(int self, int min, int max) + { + return Math.Min(max, Math.Max(self, min)); + } + + #region Color Definitions + /// + /// The Tansparent is a predefined Color, it's rgba value is (0, 0, 0, 0). + /// + public static readonly Color Transparent = FromRgba(0, 0, 0, 0); + /// + /// The Aqua is a predefined Color instance, it's rgb value is (0, 255, 255). + /// + public static readonly Color Aqua = FromRgb(0, 255, 255); + /// + /// The Black is a predefined Color instance, it's rgb value is (0, 0, 0). + /// + public static readonly Color Black = FromRgb(0, 0, 0); + /// + /// The Blue is a predefined Color instance, it's rgb value is (0, 0, 255). + /// + public static readonly Color Blue = FromRgb(0, 0, 255); + /// + /// The Fuchsia is a predefined Color instance, it's rgb value is (255, 0, 255). + /// + public static readonly Color Fuchsia = FromRgb(255, 0, 255); + /// + /// The Gray is a predefined Color instance, it's rgb value is (128, 128, 128). + /// + public static readonly Color Gray = FromRgb(128, 128, 128); + /// + /// The Green is a predefined Color instance, it's rgb value is (0, 128, 0). + /// + public static readonly Color Green = FromRgb(0, 128, 0); + /// + /// The Lime is a predefined Color instance, it's rgb value is (0, 255, 0). + /// + public static readonly Color Lime = FromRgb(0, 255, 0); + /// + /// The Maroon is a predefined Color instance, it's rgb value is (128, 0, 0). + /// + public static readonly Color Maroon = FromRgb(128, 0, 0); + /// + /// The Navy is a predefined Color instance, it's rgb value is (0, 0, 128). + /// + public static readonly Color Navy = FromRgb(0, 0, 128); + /// + /// The Olive is a predefined Color instance, it's rgb value is (128, 128, 0). + /// + public static readonly Color Olive = FromRgb(128, 128, 0); + /// + /// The Orange is a predefined Color instance, it's rgb value is (255, 165, 0). + /// + public static readonly Color Orange = FromRgb(255, 165, 0); + /// + /// The Purple is a predefined Color instance, it's rgb value is (128, 0, 128). + /// + public static readonly Color Purple = FromRgb(128, 0, 128); + /// + /// The Pink is a predefined Color instance, it's rgb value is (255, 102, 255). + /// + public static readonly Color Pink = FromRgb(255, 102, 255); + /// + /// The Red is a predefined Color instance, it's rgb value is (255, 0, 0). + /// + public static readonly Color Red = FromRgb(255, 0, 0); + /// + /// The Silver is a predefined Color instance, it's rgb value is (192, 192, 192). + /// + public static readonly Color Silver = FromRgb(192, 192, 192); + /// + /// The Teal is a predefined Color instance, it's rgb value is (0, 128, 128). + /// + public static readonly Color Teal = FromRgb(0, 128, 128); + /// + /// The White is a predefined Color instance, it's rgb value is (255, 255, 255). + /// + public static readonly Color White = FromRgb(255, 255, 255); + /// + /// The Yellow is a predefined Color instance, it's rgb value is (255, 255, 0). + /// + public static readonly Color Yellow = FromRgb(255, 255, 0); + #endregion + } +} diff --git a/src/ElmSharp/ElmSharp/ColorChangedEventArgs.cs b/src/ElmSharp/ElmSharp/ColorChangedEventArgs.cs new file mode 100755 index 0000000..b1090de --- /dev/null +++ b/src/ElmSharp/ElmSharp/ColorChangedEventArgs.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// Event ColorChanged of ColorSelector contain ColorChangedEventArgs as a parameter. + /// Refer to type. + /// + public class ColorChangedEventArgs : EventArgs + { + /// + /// Gets old color in color changed event. + /// + public Color OldColor { get; private set; } + + /// + /// Gets new color in color changed event. + /// + public Color NewColor { get; private set; } + + /// + /// Creates and initializes a new instance of the ColorChangedEventArgs class. + /// + /// old color + /// new color + public ColorChangedEventArgs(Color oldColor, Color newColor) + { + this.OldColor = oldColor; + this.NewColor = newColor; + } + } +} diff --git a/src/ElmSharp/ElmSharp/ColorSelector.cs b/src/ElmSharp/ElmSharp/ColorSelector.cs new file mode 100755 index 0000000..cf16a99 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ColorSelector.cs @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for mode of ColorSelector + /// + public enum ColorSelectorMode + { + /// + /// Only color palette is displayed, default + /// + Palette, + /// + /// Only color selector is displayed + /// + [Obsolete("Components is obsolete as of version 1.2.3 and is no longer supported.")] + Components, + /// + /// Both Palette and selector is displayed + /// + [Obsolete("Both is obsolete as of version 1.2.3 and is no longer supported.")] + Both, + /// + /// Only color picker is displayed + /// + [Obsolete("Picker is obsolete as of version 1.2.3 and is no longer supported.")] + Picker, + /// + /// This mode is not supported. If you use this, nothing will be shown + /// + [Obsolete("Plane is obsolete as of version 1.2.3 and is no longer supported.")] + Plane, + /// + /// This mode is not supported. If you use this, it will be shown same with Palette mode + /// + [Obsolete("PallettePlane is obsolete as of version 1.2.3 and is no longer supported.")] + PallettePlane, + /// + /// This mode is not supported. If you use this, it will be shown same with Palette mode + /// + [Obsolete("All is obsolete as of version 1.2.3 and is no longer supported.")] + All + } + + /// + /// The ColorSelector is a widget to set a series of colors. + /// It also allows to load/save colors from/to config with a unique identifier. + /// + /// + /// By default, the colors are loaded/saved from/to config using "default" identifier. + /// The colors can be picked by user from the color set by clicking on individual + /// color item on the palette or by selecting it from selector. + /// + public class ColorSelector : Layout + { + private readonly SmartEvent _changed; + private Color _currentColor; + + /// + /// Creates and initializes a new instance of the ColorSelector class. + /// + /// + public ColorSelector(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, "changed", (data, obj, info) => + { + return new ColorChangedEventArgs(_currentColor, SelectedColor); + }); + } + + /// + /// ColorChanged will be triggered when the SelectedColor changed. + /// + public event EventHandler ColorChanged + { + add { _changed.On += value; } + remove { _changed.On -= value; } + } + + /// + /// Gets or sets color of colorselector. + /// + public Color SelectedColor + { + get + { + int r, g, b, a; + Interop.Elementary.elm_colorselector_color_get(Handle, out r, out g, out b, out a); + _currentColor = new Color(r, g, b, a); + return _currentColor; + } + set + { + Interop.Elementary.elm_colorselector_color_set(Handle, value.R, value.G, value.B, value.A); + _currentColor = new Color(value.R, value.G, value.B, value.A); + } + } + + /// + /// Gets Alpha of a default Color Class(Value is -1). + /// + public override int Opacity + { + get + { + return Color.Default.A; + } + + set + { + Console.WriteLine("ColorSelector instance doesn't support to set Opacity."); + } + } + + /// + /// Gets or sets Colorselector's mode. + /// + public ColorSelectorMode Mode + { + get + { + return (ColorSelectorMode)Interop.Elementary.elm_colorselector_mode_get(Handle); + } + set + { + if (ColorSelectorMode.Palette == value) + { + Interop.Elementary.elm_colorselector_mode_set(Handle, (Interop.Elementary.Elm_Colorselector_Mode)value); + } + } + } + + /// + /// Get or set current palette's name. + /// + public string PaletteName + { + get + { + return Interop.Elementary.elm_colorselector_palette_name_get(Handle); + } + set + { + Interop.Elementary.elm_colorselector_palette_name_set(Handle, value); + } + } + + /// + /// Adds a new color item to palette. + /// + /// Color item to add + /// A new color palette Item. + public ColorSelectorItem AddPaletteColor(Color color) + { + ColorSelectorItem item = new ColorSelectorItem(); + item.Handle = Interop.Elementary.elm_colorselector_palette_color_add(Handle, color.R, color.G, color.B, color.A); + return item; + } + + /// + /// Clear the palette items. + /// + public void ClearPalette() + { + Interop.Elementary.elm_colorselector_palette_clear(Handle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_colorselector_add(parent.Handle); + } + } +} diff --git a/src/ElmSharp/ElmSharp/ColorSelectorItem.cs b/src/ElmSharp/ElmSharp/ColorSelectorItem.cs new file mode 100755 index 0000000..10205e2 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ColorSelectorItem.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// A instance to the ColorSelector item added. + /// + public class ColorSelectorItem : ItemObject + { + internal ColorSelectorItem() : base(IntPtr.Zero) + { + } + + /// + /// Gets or sets the Palette item's color + /// + public Color Color + { + get + { + int r, g, b, a; + Interop.Elementary.elm_colorselector_palette_item_color_get(Handle, out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + if (Handle != IntPtr.Zero) + { + Interop.Elementary.elm_colorselector_palette_item_color_set(Handle, value.R, value.G, value.B, value.A); + } + } + } + } +} diff --git a/src/ElmSharp/ElmSharp/Conformant.cs b/src/ElmSharp/ElmSharp/Conformant.cs new file mode 100755 index 0000000..84da0e3 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Conformant.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The check is a widget that can be used in elementary apps + /// to account for space taken up by the indicator, + /// virtual keypad & softkey windows when running the illume2 module of E17. + /// + public class Conformant : Widget + { + /// + /// Creates and initializes a new instance of the Conformant class. + /// + /// The parent is a given container which will be attached by Conformant + /// as a child.It's type. + public Conformant(Window parent) : base(parent) + { + Interop.Evas.evas_object_size_hint_weight_set(Handle, 1.0, 1.0); + Interop.Elementary.elm_win_conformant_set(parent.Handle, true); + parent.AddResizeObject(this); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_conformant_add(parent.Handle); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Container.cs b/src/ElmSharp/ElmSharp/Container.cs new file mode 100755 index 0000000..6abb589 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Container.cs @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// It inherits . + /// The Container is a abstract class. + /// Other class inherits it to Elementary is about displaying + /// its widgets in a nice layout. + /// + public abstract class Container : Widget + { + HashSet _children = new HashSet(); + + /// + /// Creates and initializes a new instance of class which inherit from Container. + /// + /// The parent is a given object which will be attached by Container + /// as a child.It's type. + public Container(EvasObject parent) : base(parent) + { + } + + /// + /// Sets the background color of a given Container. + /// + public override Color BackgroundColor + { + set + { + if (value.IsDefault) + { + SetPartColor("bg", Color.Transparent); + } + else + { + SetPartColor("bg", value); + } + _backgroundColor = value; + } + } + + protected IEnumerable Children => _children; + + protected void AddChild(EvasObject obj) + { + _children.Add(obj); + obj.Deleted += OnChildDeleted; + } + + protected void RemoveChild(EvasObject obj) + { + _children.Remove(obj); + } + + protected void ClearChildren() + { + _children.Clear(); + } + + void OnChildDeleted(object sender, EventArgs a) + { + _children.Remove((EvasObject)sender); + } + } +} diff --git a/src/ElmSharp/ElmSharp/ContextPopup.cs b/src/ElmSharp/ElmSharp/ContextPopup.cs new file mode 100755 index 0000000..3be2baa --- /dev/null +++ b/src/ElmSharp/ElmSharp/ContextPopup.cs @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// Enumeration of ContextPopup direction type. + /// + public enum ContextPopupDirection + { + /// + /// ContextPopup show appear below clicked area + /// /// + Down, + /// + /// ContextPopup show appear to the right of the clicked area + /// + Right, + /// + /// ContextPopup show appear to the left of the clicked area + /// + Left, + /// + /// ContextPopup show appear above the clicked area + /// + Up, + /// + /// ContextPopup does not determine it's direction yet + /// + Unknown + } + + /// + /// It inherits . + /// The ContextPopup is a widget that when it shown, pops up a list of items. + /// + public class ContextPopup : Layout + { + HashSet _children = new HashSet(); + SmartEvent _dismissed; + Interop.Evas.SmartCallback _onSelected; + + /// + /// Creates and initializes a new instance of the ContextPopup class. + /// + /// The parent is a given container which will be attached by ContextPopup + /// as a child.It's type. + public ContextPopup(EvasObject parent) : base(parent) + { + _dismissed = new SmartEvent(this, this.RealHandle, "dismissed"); + _dismissed.On += (sender, e) => + { + Dismissed?.Invoke(this, EventArgs.Empty); + }; + _onSelected = (data, obj, info) => + { + ContextPopupItem item = ItemObject.GetItemById((int)data) as ContextPopupItem; + item?.SendSelected(); + }; + } + + /// + /// Dismissed is raised when the ContextPopup item is dismissed. + /// + /// + /// Outside of ContextPopup was clicked or it's parent area is changed or the language is changed. and then ContextPopup is dismissed. + /// + public event EventHandler Dismissed; + + /// + /// Gets the current direction of a ContextPopup. + /// + /// + /// Once the ContextPopup showed up, the direction would be determined. + /// + public ContextPopupDirection Direction + { + get + { + return (ContextPopupDirection)Interop.Elementary.elm_ctxpopup_direction_get(RealHandle); + } + } + + /// + /// Gets or sets the value of current ContextPopup object's orientation. + /// True for horizontal mode, False for vertical mode (or errors) + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_ctxpopup_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_ctxpopup_horizontal_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether ContextPopup hide automatically + /// or not when parent of ContextPopup is resized. + /// + /// + /// Default value of AutoHide is False. + /// + public bool AutoHide + { + get + { + return !Interop.Elementary.elm_ctxpopup_auto_hide_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_ctxpopup_auto_hide_disabled_set(RealHandle, !value); + } + } + + /// + /// Clears all items in the given ContextPopup object. + /// + public void Clear() + { + Interop.Elementary.elm_ctxpopup_clear(Handle); + } + + /// + /// Sets the direction priority of a ContextPopup. + /// + /// 1st priority of direction + /// 2nd priority of direction + /// 3th priority of direction + /// 4th priority of direction + public void SetDirectionPriorty(ContextPopupDirection first, ContextPopupDirection second, ContextPopupDirection third, ContextPopupDirection fourth) + { + Interop.Elementary.elm_ctxpopup_direction_priority_set(RealHandle, (int)first, (int)second, (int)third, (int)fourth); + } + + /// + /// Gets the direction priority of a ContextPopup. + /// + /// 1st priority of direction to be returned + /// 2nd priority of direction to be returned + /// 2nd priority of direction to be returned + /// 4th priority of direction to be returned + public void GetDirectionPriority(out ContextPopupDirection first, out ContextPopupDirection second, out ContextPopupDirection third, out ContextPopupDirection fourth) + { + int firstOut, secondOut, thirdOut, fourthOut; + Interop.Elementary.elm_ctxpopup_direction_priority_get(Handle, out firstOut, out secondOut, out thirdOut, out fourthOut); + first = (ContextPopupDirection)firstOut; + second = (ContextPopupDirection)secondOut; + third = (ContextPopupDirection)thirdOut; + fourth = (ContextPopupDirection)fourthOut; + } + + /// + /// Adds a new item to a ContextPopup object with label. + /// + /// The Label of the new item + /// + /// A ContextPopupItem added or NULL, on errors + /// + public ContextPopupItem Append(string label) + { + return Append(label, null); + } + + /// + /// Adds a new item to a ContextPopup object with label and icon. + /// + /// The Label of the new item + /// Icon to be set on new item + /// A ContextPopupItem added or NULL, on errors + public ContextPopupItem Append(string label, EvasObject icon) + { + ContextPopupItem item = new ContextPopupItem(label, icon); + item.Handle = Interop.Elementary.elm_ctxpopup_item_append(RealHandle, label, icon, _onSelected, (IntPtr)item.Id); + AddInternal(item); + return item; + } + + /// + /// Dismiss a ContextPopup object. The ContextPopup will be hidden and the "clicked" signal will be emitted. + /// + public void Dismiss() + { + Interop.Elementary.elm_ctxpopup_dismiss(RealHandle); + } + + /// + /// Gets the possibility that the direction would be available + /// + /// A direction user wants to check + /// + /// Get false if you cannot put it in the direction. Gets true if it's possible. + /// + public bool IsAvailableDirection(ContextPopupDirection direction) + { + return Interop.Elementary.elm_ctxpopup_direction_available_get(RealHandle, (int)direction); + } + + /// + /// Gets Alpha of a default Color Class. + /// + public override int Opacity + { + get + { + return Color.Default.A; + } + + set + { + Console.WriteLine("ContextPopup instance doesn't support to set Opacity."); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_ctxpopup_add(parent.Handle); + } + + void AddInternal(ContextPopupItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((ContextPopupItem)sender); + } + } +} diff --git a/src/ElmSharp/ElmSharp/ContextPopupItem.cs b/src/ElmSharp/ElmSharp/ContextPopupItem.cs new file mode 100755 index 0000000..35c908b --- /dev/null +++ b/src/ElmSharp/ElmSharp/ContextPopupItem.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits . + /// A instance to the ContextPopup item added. + /// + public class ContextPopupItem : ItemObject + { + internal ContextPopupItem(string text, EvasObject icon) : base(IntPtr.Zero) + { + Text = text; + Icon = icon; + } + + /// + /// Gets the Text property of the given ContextPopupItem. + /// + public string Text { get; internal set; } + + /// + /// Gets the Icon(type is ) property of the given ContextPopupItem. + /// + public EvasObject Icon { get; internal set; } + + /// + /// Selected will be triggered when the ContextPopupItem is Selected. + /// + public event EventHandler Selected; + + internal void SendSelected() + { + Selected?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/src/ElmSharp/ElmSharp/DateChangedEventArgs.cs b/src/ElmSharp/ElmSharp/DateChangedEventArgs.cs new file mode 100755 index 0000000..25d622c --- /dev/null +++ b/src/ElmSharp/ElmSharp/DateChangedEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// The DateChanged event in Calendar and DateTimeChanged event in DateTimeSelector. + /// contain DateChangedEventArgs as a parameter. + /// + public class DateChangedEventArgs : EventArgs + { + /// + /// Gets the OldDate property of the given DateChangedEventArgs. + /// + public DateTime OldDate { get; private set; } + + /// + /// Gets the NewDate property of the given DateChangedEventArgs. + /// + public DateTime NewDate { get; private set; } + + /// + /// Creates and initializes a new instance of the DateChangedEventArgs class. + /// + /// + /// Old date when DateChanged event or DateTimeChanged event triggered + /// + /// + /// New date when DateChanged event or DateTimeChanged event triggered + /// + public DateChangedEventArgs(DateTime oldDate, DateTime newDate) + { + this.OldDate = oldDate; + this.NewDate = newDate; + } + } +} diff --git a/src/ElmSharp/ElmSharp/DateTimeSelector.cs b/src/ElmSharp/ElmSharp/DateTimeSelector.cs new file mode 100755 index 0000000..584c236 --- /dev/null +++ b/src/ElmSharp/ElmSharp/DateTimeSelector.cs @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration of datetime field types for DateTimeSelector. + /// + public enum DateTimeFieldType + { + Year, + Month, + Date, + Hour, + Minute, + AmPm + } + + /// + /// It inherits + /// DateTimeSelector is a widget to display and input date & time values. + /// This widget displays date and time as per the system's locale settings + /// (Date includes Day, Month & Year along with the defined separators and Time includes Hour, Minute & AM/PM fields. Separator for AM/PM field is ignored. + /// + public class DateTimeSelector : Layout + { + SmartEvent _changed; + DateTime _cacheDateTime; + + /// + /// Creates and initializes a new instance of the DateTimeSelector class. + /// + /// The parent is a given container which will be attached by DateTimeSelector + ///as a child.It's type. + public DateTimeSelector(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (s, e) => + { + DateTime newDateTime = DateTime; + DateTimeChanged?.Invoke(this, new DateChangedEventArgs(_cacheDateTime, newDateTime)); + DateTime = newDateTime; + }; + } + + /// + /// ItemSelected is raised when Datetime field value changed. + /// + public event EventHandler DateTimeChanged; + + /// + /// Gets or sets the datetime format. + /// + /// + /// format is a combination of allowed LIBC date format specifiers like: "%b %d, %Y %I : %M %p". + /// + public string Format + { + get + { + return Interop.Elementary.elm_datetime_format_get(RealHandle); + } + set + { + Interop.Elementary.elm_datetime_format_set(RealHandle, value); + } + } + + /// + /// Gets or sets the upper boundary of DateTime field. + /// + public DateTime MaximumDateTime + { + get + { + var tm = new Interop.Libc.SystemTime(); + Interop.Elementary.elm_datetime_value_max_get(RealHandle, ref tm); + return tm; + } + set + { + Interop.Libc.SystemTime tm = value; + Interop.Elementary.elm_datetime_value_max_set(RealHandle, ref tm); + } + } + + /// + /// Gets or sets the lower boundary of DateTime field. + /// + public DateTime MinimumDateTime + { + get + { + var tm = new Interop.Libc.SystemTime(); + Interop.Elementary.elm_datetime_value_min_get(RealHandle, ref tm); + return tm; + } + set + { + Interop.Libc.SystemTime tm = value; + Interop.Elementary.elm_datetime_value_min_set(RealHandle, ref tm); + } + } + + /// + /// Gets or sets the current value of DateTime field. + /// + public DateTime DateTime + { + get + { + var tm = new Interop.Libc.SystemTime(); + Interop.Elementary.elm_datetime_value_get(RealHandle, ref tm); + return tm; + } + set + { + Interop.Libc.SystemTime tm = value; + Interop.Elementary.elm_datetime_value_set(RealHandle, ref tm); + _cacheDateTime = value; + } + } + + /// + /// Gets whether a field can be visible. + /// + /// Enumeration + /// + /// The field is visible or not. + /// Type is bool.If visible, return true. + /// + public bool IsFieldVisible(DateTimeFieldType type) + { + return Interop.Elementary.elm_datetime_field_visible_get(RealHandle, (int)type); + } + + /// + /// Sets the field limits of a field. + /// + /// Enumeration + /// minimum limit + /// maximum limit + public void SetFieldLimit(DateTimeFieldType type, int minimum, int maximum) + { + Interop.Elementary.elm_datetime_field_limit_set(RealHandle, (int)type, minimum, maximum); + } + + /// + /// Gets whether a field can be visible. + /// + /// Enumeration + /// When set as true, the field type visible. + public void SetFieldVisible(DateTimeFieldType type, bool visible) + { + Interop.Elementary.elm_datetime_field_visible_set(RealHandle, (int)type, visible); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_datetime_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/DisplayedMonthChangedEventArgs.cs b/src/ElmSharp/ElmSharp/DisplayedMonthChangedEventArgs.cs new file mode 100755 index 0000000..8407f6d --- /dev/null +++ b/src/ElmSharp/ElmSharp/DisplayedMonthChangedEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// The DisplayedMonthChangedEvent in Calendar contain + /// DisplayedMonthChangedEventArgs as a parameter. + /// + public class DisplayedMonthChangedEventArgs : EventArgs + { + /// + /// Gets the OldMonth property of the given DisplayedMonthChangedEventArgs. + /// + public int OldMonth { get; private set; } + + /// + /// Gets the NewMonth property of the given DisplayedMonthChangedEventArgs. + /// + public int NewMonth { get; private set; } + + /// + /// Creates and initializes a new instance of the DisplayedMonthChangedEventArgs class. + /// + /// + /// old month of date when DisplayedMonthChangedEvent triggered. + /// + /// + /// new month of date when DisplayedMonthChangedEvent triggered. + /// + public DisplayedMonthChangedEventArgs(int oldMonth, int newMonth) + { + this.OldMonth = oldMonth; + this.NewMonth = newMonth; + } + } +} diff --git a/src/ElmSharp/ElmSharp/EcoreAnimator.cs b/src/ElmSharp/ElmSharp/EcoreAnimator.cs new file mode 100755 index 0000000..64a548d --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreAnimator.cs @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// EcoreAnimator is a helper class, it provides functions to manager animations. + /// + public static class EcoreAnimator + { + static readonly Dictionary> _taskMap = new Dictionary>(); + static readonly Object _taskLock = new Object(); + static int _newTaskId = 0; + + static Interop.Ecore.EcoreTaskCallback _nativeHandler; + + static EcoreAnimator() + { + _nativeHandler = NativeHandler; + } + + /// + /// Gets current system time as a floating point value in seconds. + /// + /// Current system time + public static double GetCurrentTime() + { + return Interop.Ecore.ecore_time_get(); + } + + /// + /// Adds an animator to call at every animation tick during main loop execution. + /// + /// The function to call when it ticks off + /// A handle to the new animator + public static IntPtr AddAnimator(Func handler) + { + int id = RegistHandler(handler); + return Interop.Ecore.ecore_animator_add(_nativeHandler, (IntPtr)id); + } + + /// + /// Removes the specified animator from the animator list. + /// + /// The specified animator handle + public static void RemoveAnimator(IntPtr anim) + { + int taskId = (int)Interop.Ecore.ecore_animator_del(anim); + _taskMap.Remove(taskId); + } + + static int RegistHandler(Func task) + { + int taskId; + lock (_taskLock) + { + taskId = _newTaskId++; + } + _taskMap[taskId] = task; + return taskId; + } + + static bool NativeHandler(IntPtr userData) + { + int task_id = (int)userData; + Func userAction = null; + _taskMap.TryGetValue(task_id, out userAction); + return (userAction != null) ? userAction() : false; + } + + } +} diff --git a/src/ElmSharp/ElmSharp/EcoreEvent.cs b/src/ElmSharp/ElmSharp/EcoreEvent.cs new file mode 100755 index 0000000..e42310c --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreEvent.cs @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// The EcoreEventType is type of EcoreEvent. + /// It includes some predefined instance. + /// + public class EcoreEventType + { + /// + /// Key down Ecore event type. + /// + public static readonly EcoreEventType KeyDown = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_KEY_DOWN"); + /// + /// Key Up Ecore event type. + /// + public static readonly EcoreEventType KeyUp = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_KEY_UP"); + /// + /// Mouse Button Down Ecore event type. + /// + public static readonly EcoreEventType MouseButtonDown = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_BUTTON_DOWN"); + /// + /// Mouse Button Up Ecore event type. + /// + public static readonly EcoreEventType MouseButtonUp = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_BUTTON_UP"); + /// + /// Mouse Button Cancel Ecore event type. + /// + public static readonly EcoreEventType MouseButtonCancel = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_BUTTON_CANCEL"); + /// + /// Mouse Move Ecore event type. + /// + public static readonly EcoreEventType MouseMove = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_MOVE"); + /// + /// Mouse Wheel Ecore event type. + /// + public static readonly EcoreEventType MouseWheel = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_WHEEL"); + /// + /// Mouse In Ecore event type. + /// + public static readonly EcoreEventType MouseIn = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_IN"); + /// + /// Mouse Out Ecore event type. + /// + public static readonly EcoreEventType MouseOut = new EcoreEventType(Interop.Libraries.EcoreInput, "ECORE_EVENT_MOUSE_OUT"); + + private string _lib; + private string _name; + private int _typeValue; + + private EcoreEventType(string lib, string name) + { + _lib = lib; + _name = name; + _typeValue = -1; + } + + /// + /// Gets the value associated with the specified type. + /// + /// The value of type. + public int GetValue() + { + if (_typeValue < 0) + { + IntPtr hDll = Interop.Libdl.LoadLibrary(_lib); + if (hDll != IntPtr.Zero) + { + IntPtr pValue = Interop.Libdl.GetProcAddress(hDll, _name); + if (pValue != IntPtr.Zero) + { + _typeValue = Marshal.ReadInt32(pValue); + } + Interop.Libdl.FreeLibrary(hDll); + } + } + return _typeValue; + } + } + + /// + /// The EcoreEvent is a class to help to create events are being notified of events. + /// + /// Kinds of EventArgs + public class EcoreEvent : IDisposable where TEventArgs : EventArgs + { + public delegate TEventArgs EventInfoParser(IntPtr data, EcoreEventType type, IntPtr info); + + private bool _disposed = false; + private EcoreEventType _eventType; + private readonly EventInfoParser _parser; + private readonly List _nativeCallbacks = new List(); + + /// + /// Creates and initializes a new instance of the EcoreEvent class. + /// + /// EcoreEventType + public EcoreEvent(EcoreEventType type) : this(type, null) + { + } + + /// + /// Creates and initializes a new instance of the EcoreEvent class. + /// + /// EcoreEventType + /// EventInfoParser + public EcoreEvent(EcoreEventType type, EventInfoParser parser) + { + _eventType = type; + _parser = parser; + } + + ~EcoreEvent() + { + Dispose(false); + } + + private struct NativeCallback + { + public Interop.Ecore.EcoreEventCallback callback; + public IntPtr nativeHandler; + public EventHandler eventHandler; + } + + /// + /// On Event Handler of EcoreEvent. + /// + public event EventHandler On + { + add + { + EventHandler handler = value; + var cb = new Interop.Ecore.EcoreEventCallback((data, type, info) => + { + TEventArgs ea = _parser == null ? (TEventArgs)EventArgs.Empty : _parser(data, _eventType, info); + handler(this, ea); + }); + IntPtr hNative = Interop.Ecore.ecore_event_handler_add(_eventType.GetValue(), cb, IntPtr.Zero); + _nativeCallbacks.Add(new NativeCallback { callback = cb, eventHandler = handler, nativeHandler = hNative }); + } + remove + { + EventHandler handler = value; + var callbacks = _nativeCallbacks.Where(cb => cb.eventHandler == handler); + foreach (var cb in callbacks) + { + Interop.Ecore.ecore_event_handler_del(cb.nativeHandler); + } + } + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // Place holder to dispose managed state (managed objects). + } + foreach (var cb in _nativeCallbacks) + { + Interop.Ecore.ecore_event_handler_del(cb.nativeHandler); + } + _nativeCallbacks.Clear(); + _disposed = true; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + } + + /// + /// Event class for EcoreEvent + /// + public class EcoreEvent : EcoreEvent + { + /// + /// Creates and initializes a new instance of the EcoreEvent class. + /// + /// EcoreEventType + public EcoreEvent(EcoreEventType type) : base(type) + { + } + } +} + diff --git a/src/ElmSharp/ElmSharp/EcoreKeyEventArgs.cs b/src/ElmSharp/ElmSharp/EcoreKeyEventArgs.cs new file mode 100755 index 0000000..d057716 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreKeyEventArgs.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// The EcoreKeyEventArgs is a EventArgs to record Ecore event's key name and key code. + /// + public class EcoreKeyEventArgs : EventArgs + { + /// + /// Gets the KeyName property.The return type is string. + /// + public string KeyName { get; private set; } + /// + /// Gets the KeyCode property.The return type is int. + /// + public int KeyCode { get; private set; } + + /// + /// Creates and initializes a new instance of the EcoreKeyEventArgs class. + /// + /// data + /// type + /// information + /// new instance of the EcoreKeyEventArgs class + public static EcoreKeyEventArgs Create(IntPtr data, EcoreEventType type, IntPtr info) + { + var evt = Marshal.PtrToStructure(info); + return new EcoreKeyEventArgs { KeyName = evt.keyname, KeyCode = (int)evt.keycode }; + } + + [StructLayout(LayoutKind.Sequential)] + struct EcoreEventKey + { + public string keyname; + public string key; + public string str; + public string compose; + public IntPtr window; + public IntPtr root_window; + public IntPtr event_window; + public uint timestamp; + public uint modifiers; + public int same_screen; + public uint keycode; + public IntPtr data; + public IntPtr dev; + } + } +} diff --git a/src/ElmSharp/ElmSharp/EcoreMainloop.cs b/src/ElmSharp/ElmSharp/EcoreMainloop.cs new file mode 100755 index 0000000..505e2c0 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreMainloop.cs @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// EcoreMainloop is a helper class, it provide functions relative Ecore's main loop. + /// + public static class EcoreMainloop + { + static readonly Dictionary> _taskMap = new Dictionary>(); + static readonly Object _taskLock = new Object(); + static int _newTaskId = 0; + + static Interop.Ecore.EcoreTaskCallback _nativeHandler; + + static EcoreMainloop() + { + Interop.Ecore.ecore_init(); + Interop.Ecore.ecore_main_loop_glib_integrate(); + _nativeHandler = NativeHandler; + } + + /// + /// Checks if you are calling this function from the main thread. + /// + /// True is the calling function is the same thread, false otherwise. + public static bool IsMainThread => Interop.Eina.eina_main_loop_is(); + + /// + /// Runs the application main loop. + /// + public static void Begin() + { + Interop.Ecore.ecore_main_loop_begin(); + } + + /// + /// Quits the main loop once all the events currently on the queue have been processed. + /// + public static void Quit() + { + Interop.Ecore.ecore_main_loop_quit(); + } + + /// + /// Adds an idler handler. + /// + /// The action to call when idling + public static void Post(Action task) + { + int id = RegistHandler(() => { task(); return false; }); + Interop.Ecore.ecore_idler_add(_nativeHandler, (IntPtr)id); + } + + /// + /// Calls callback asynchronously in the main loop. + /// + /// The action wanted to be called + public static void PostAndWakeUp(Action task) + { + int id = RegistHandler(() => { task(); return false; }); + Interop.Ecore.ecore_main_loop_thread_safe_call_async(_nativeHandler, (IntPtr)id); + } + + /// + /// Calls callback synchronously in the main loop. + /// + /// The action wanted to be called + public static void Send(Action task) + { + int id = RegistHandler(() => { task(); return false; }); + Interop.Ecore.ecore_main_loop_thread_safe_call_sync(_nativeHandler, (IntPtr)id); + } + + /// + /// Creates a timer to call the given function in the given period of time. + /// + /// The interval in seconds. + /// The given function. + /// A timer object handler on success, NULL on failure. + public static IntPtr AddTimer(double interval, Func handler) + { + int id = RegistHandler(handler); + return Interop.Ecore.ecore_timer_add(interval, _nativeHandler, (IntPtr)id); + } + + /// + /// Removes the specified timer from the timer list. + /// + /// The specified timer handler + public static void RemoveTimer(IntPtr id) + { + int taskId = (int)Interop.Ecore.ecore_timer_del(id); + _taskMap.Remove(taskId); + } + + static int RegistHandler(Func task) + { + int taskId; + lock (_taskLock) + { + taskId = _newTaskId++; + } + _taskMap[taskId] = task; + return taskId; + } + + static bool NativeHandler(IntPtr user_data) + { + int task_id = (int)user_data; + Func userAction = null; + if (_taskMap.TryGetValue(task_id, out userAction)) + { + bool result = false; + + if (userAction != null) + result = userAction(); + + if (result == false) + _taskMap.Remove(task_id); + + return result; + } + return false; + } + } +} diff --git a/src/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs b/src/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs new file mode 100755 index 0000000..0fa013b --- /dev/null +++ b/src/ElmSharp/ElmSharp/EcoreSynchronizationContext.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Threading; + +namespace ElmSharp +{ + + /// + /// Provides a synchronization context for the efl application. + /// + public class EcoreSynchronizationContext : SynchronizationContext + { + /// + /// Initializes a new instance of the EcoreSynchronizationContext class. + /// + public EcoreSynchronizationContext() + { + } + + /// + /// Initilizes a new EcoreSynchronizationContext and install into current thread + /// + /// + /// It is equivalent + /// + /// SetSynchronizationContext(new EcoreSynchronizationContext()); + /// + /// + public static void Initialize() + { + SetSynchronizationContext(new EcoreSynchronizationContext()); + } + + /// + /// Dispatches an asynchronous message to a Ecore main loop. + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// The Post method starts an asynchronous request to post a message. + public override void Post(SendOrPostCallback d, object state) + { + EcoreMainloop.PostAndWakeUp(() => + { + d(state); + }); + } + + /// + /// Dispatches a synchronous message to a Ecore main loop + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// + /// The Send method starts a synchronous request to send a message. + public override void Send(SendOrPostCallback d, object state) + { + EcoreMainloop.Send(() => + { + d(state); + }); + } + } +} diff --git a/src/ElmSharp/ElmSharp/EdjeObject.cs b/src/ElmSharp/ElmSharp/EdjeObject.cs new file mode 100644 index 0000000..6bd1fb6 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EdjeObject.cs @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// The EdjeObject is a class that evas object exist in + /// + public class EdjeObject + { + IntPtr _edjeHandle; + Dictionary _signalDatas = new Dictionary(); + + internal EdjeObject(IntPtr handle) + { + _edjeHandle = handle; + } + + /// + /// Checks whether an edje part exists in a given edje object's group definition. + /// This function returns if a given part exists in the edje group bound to object obj + /// + /// This call is useful, for example, when one could expect a given GUI element, depending on the theme applied to obj. + /// The part's name to check for existence in obj's group + /// TRUE, if the edje part exists in obj's group, otherwise FALSE + public EdjeTextPartObject this[string part] + { + get + { + if (Interop.Elementary.edje_object_part_exists(_edjeHandle, part)) + { + return new EdjeTextPartObject(_edjeHandle, part); + } + return null; + } + } + + /// + /// Sends/emits an edje signal to a given edje object. + /// + /// The signal's "emission" string + /// The signal's "source" string + public void EmitSignal(string emission, string source) + { + Interop.Elementary.edje_object_signal_emit(_edjeHandle, emission, source); + } + + /// + /// Deletes the object color class. + /// This function deletes any values at the object level for the specified object and color class. + /// + /// Deleting the color class defined in the theme file. + /// The color class to be deleted + public void DeleteColorClass(string part) + { + Interop.Elementary.edje_object_color_class_del(_edjeHandle, part); + } + + /// + /// Sets the object color class. + /// + /// The color class name. + /// The object Red value. + /// The object Green value. + /// The object Blue value. + /// The object Alpha value. + /// The outline Red value. + /// The outline Green value. + /// The outline Blue value. + /// The outline Alpha value. + /// The shadow Red value. + /// The shadow Green value. + /// The shadow Blue value. + /// The shadow Alpha value. + /// True if succeed, otherwise False + public bool SetColorClass(string colorClass, int red, int green, int blue, int alpha, int outlineRed, int outlineGreen, int outlineBlue, int outlineAlpha, + int shadowRed, int shadowGreen, int shadowBlue, int shadowAlpha) + { + return Interop.Elementary.edje_object_color_class_set(_edjeHandle, colorClass, red, green, blue, alpha, outlineRed, outlineGreen, outlineBlue, outlineAlpha, + shadowRed, shadowGreen, shadowBlue, shadowAlpha); + } + + /// + /// Gets the object color class. + /// + /// The color class name. + /// The object Red value. + /// The object Green value. + /// The object Blue value. + /// The object Alpha value. + /// The outline Red value. + /// The outline Green value. + /// The outline Blue value. + /// The outline Alpha value. + /// The shadow Red value. + /// The shadow Green value. + /// The shadow Blue value. + /// The shadow Alpha value. + /// True if succeed, otherwise False + public bool GetColorClass(string colorClass, out int red, out int green, out int blue, out int alpha, out int outlineRed, out int outlineGreen, out int outlineBlue, out int outlineAlpha, + out int shadowRed, out int shadowGreen, out int shadowBlue, out int shadowAlpha) + { + return Interop.Elementary.edje_object_color_class_get(_edjeHandle, colorClass, out red, out green, out blue, out alpha, out outlineRed, out outlineGreen, out outlineBlue, out outlineAlpha, + out shadowRed, out shadowGreen, out shadowBlue, out shadowAlpha); + } + + /// + /// Sets Edje text class. + /// + /// The text class name. + /// Font name. + /// Font size. + /// True if succeed, otherwise False + public bool SetTextClass(string textClass, string font, int fontSize) + { + return Interop.Elementary.edje_object_text_class_set(_edjeHandle, textClass, font, fontSize); + } + + /// + /// Gets Edje text class. + /// + /// The text class name. + /// Font name. + /// Font size. + /// True if succeed, otherwise False + public bool GetTextClass(string textClass, out string font, out int fontSize) + { + return Interop.Elementary.edje_object_text_class_get(_edjeHandle, textClass, out font, out fontSize); + } + + /// + /// Adds Action for an arriving edje signal, emitted by a given Ejde object. + /// + /// The signal's "emission" string + /// The signal's "source" string + /// The action to be executed when the signal is emitted + public void AddSignalAction(string emission, string source, Action action) + { + if (emission != null && source != null && action != null) + { + var signalData = new SignalData(emission, source, action); + if (!_signalDatas.ContainsKey(signalData)) + { + var signalCallback = new Interop.Elementary.Edje_Signal_Cb((d, o, e, s) => + { + action(e, s); + }); + + Interop.Elementary.edje_object_signal_callback_add(_edjeHandle, emission, source, signalCallback, IntPtr.Zero); + _signalDatas.Add(signalData, signalCallback); + } + } + } + + /// + /// Deletes a signal-triggered action from an object. + /// + /// The signal's "emission" string + /// The signal's "source" string + /// The action to be executed when the signal is emitted + public void DeleteSignalAction(string emission, string source, Action action) + { + if (emission != null && source != null && action != null) + { + var signalData = new SignalData(emission, source, action); + + Interop.Elementary.Edje_Signal_Cb signalCallback = null; + _signalDatas.TryGetValue(signalData, out signalCallback); + + if (signalCallback != null) + { + Interop.Elementary.edje_object_signal_callback_del(_edjeHandle, emission, source, signalCallback); + _signalDatas.Remove(signalData); + } + } + } + + class SignalData + { + public string Emission { get; set; } + public string Source { get; set; } + + public Action Action { get; set; } + + public SignalData(string emission, string source, Action action) + { + Emission = emission; + Source = source; + Action = action; + } + + public override bool Equals(object obj) + { + SignalData s = obj as SignalData; + if (s == null) + { + return false; + } + return (Emission == s.Emission) && (Source == s.Source) && (Action == s.Action); + } + + public override int GetHashCode() + { + int hashCode = Emission.GetHashCode(); + hashCode ^= Source.GetHashCode(); + hashCode ^= Action.GetHashCode(); + return hashCode; + } + } + } + + /// + /// An EdjeTextPartObject is a class dealing with parts of type text. + /// + public class EdjeTextPartObject + { + string _part; + IntPtr _edjeHandle; + + internal EdjeTextPartObject(IntPtr edjeHandle, string part) + { + _edjeHandle = edjeHandle; + _part = part; + } + + /// + /// Gets the name of the EdjeTextPartObject + /// + public string Name { get { return _part; } } + + /// + /// Gets or sets the text for an object part. + /// + public string Text + { + get + { + return Interop.Elementary.edje_object_part_text_get(_edjeHandle, _part); + } + set + { + Interop.Elementary.edje_object_part_text_set(_edjeHandle, _part, value); + } + } + + /// + /// Sets or gets the style of the object part. + /// + public string TextStyle + { + get + { + return Interop.Elementary.edje_object_part_text_style_user_peek(_edjeHandle, _part); + } + set + { + if (value == null) + { + Interop.Elementary.edje_object_part_text_style_user_pop(_edjeHandle, _part); + } + else + { + Interop.Elementary.edje_object_part_text_style_user_push(_edjeHandle, _part, value); + } + } + } + + /// + /// Gets the geometry of a given edje part, in a given edje object's group definition, relative to the object's area. + /// + public Rect Geometry + { + get + { + int x, y, w, h; + Interop.Elementary.edje_object_part_geometry_get(_edjeHandle, _part, out x, out y, out w, out h); + return new Rect(x, y, w, h); + } + } + + /// + /// Gets the native width and height. + /// + public Size TextBlockNativeSize + { + get + { + int w; + int h; + IntPtr part = Interop.Elementary.edje_object_part_object_get(_edjeHandle, _part); + Interop.Evas.evas_object_textblock_size_native_get(part, out w, out h); + return new Size(w, h); + } + } + + /// + /// Gets the formatted width and height. + /// + public Size TextBlockFormattedSize + { + get + { + int w; + int h; + IntPtr part = Interop.Elementary.edje_object_part_object_get(_edjeHandle, _part); + Interop.Evas.evas_object_textblock_size_formatted_get(part, out w, out h); + return new Size(w, h); + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/EffectBase.cs b/src/ElmSharp/ElmSharp/EffectBase.cs new file mode 100755 index 0000000..19eddb0 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EffectBase.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// EffectBase class for the TransitEffect + /// + public abstract class EffectBase + { + /// + /// EffectEneded event will be triggered when be effect ended. + /// + public event EventHandler EffectEnded; + + internal abstract IntPtr CreateEffect(IntPtr transit); + + internal void SendEffectEnd() + { + EffectEnded?.Invoke(this, EventArgs.Empty); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Elementary.cs b/src/ElmSharp/ElmSharp/Elementary.cs new file mode 100644 index 0000000..7984f83 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Elementary.cs @@ -0,0 +1,339 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; +using System.IO; + +namespace ElmSharp +{ + /// + /// Focus Autoscroll Mode + /// + public enum FocusAutoScrollMode + { + /// + /// Directly show the focused region or item automatically + /// + Show, + /// + /// Do not show the focused region or item automatically + /// + None, + /// + /// Bring in the focused region or item automatically which might invole the scrolling + /// + BringIn + } + + /// + /// The Elementary is a General Elementary,a VERY SIMPLE toolkit. + /// + public static class Elementary + { + private static readonly string _themeFilePath = "/usr/share/elm-sharp/elm-sharp-theme.edj"; + + /// + /// Gets or sets the configured finger size. + /// + public static int FingerSize + { + get + { + return Interop.Elementary.elm_config_finger_size_get(); + } + set + { + Interop.Elementary.elm_config_finger_size_set(value); + } + } + + /// + /// Gets or sets the enable status of the focus highlight animation + /// + public static bool IsFocusHighlightAnimation + { + get + { + return Interop.Elementary.elm_config_focus_highlight_animate_get(); + } + set + { + Interop.Elementary.elm_config_focus_highlight_animate_set(value); + } + } + + /// + /// Gets or sets the system mirrored mode. + /// This determines the default mirrored mode of widgets. + /// + public static bool IsMirrored + { + get + { + return Interop.Elementary.elm_config_mirrored_get(); + } + set + { + Interop.Elementary.elm_config_mirrored_set(value); + } + } + + /// + /// Gets or sets the enable status of the focus highlight. + /// + public static bool CanFocusHighlight + { + get + { + return Interop.Elementary.elm_config_focus_highlight_enabled_get(); + } + set + { + Interop.Elementary.elm_config_focus_highlight_enabled_set(value); + } + } + + /// + /// Gets or sets the base scale of the application. + /// + public static double AppBaseScale + { + get + { + return Interop.Elementary.elm_app_base_scale_get(); + } + set + { + Interop.Elementary.elm_app_base_scale_set(value); + } + } + + /// + /// Gets or sets the global scaling factor. + /// + public static double Scale + { + get + { + return Interop.Elementary.elm_config_scale_get(); + } + set + { + Interop.Elementary.elm_config_scale_set(value); + } + } + + /// + /// Gets or sets the amount of inertia a scroller imposes during region bring animations. + /// + public static double BringInScrollFriction + { + get + { + return Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_get(); + } + set + { + Interop.Elementary.elm_config_scroll_bring_in_scroll_friction_set(value); + } + } + + /// + /// Gets of sets focus auto scroll mode. + /// + public static FocusAutoScrollMode FocusAutoScrollMode + { + get + { + return (FocusAutoScrollMode)Interop.Elementary.elm_config_focus_autoscroll_mode_get(); + } + set + { + Interop.Elementary.elm_config_focus_autoscroll_mode_set((Interop.Elementary.Elm_Focus_Autoscroll_Mode)value); + } + } + + /// + /// Initializes Elementary. + /// + public static void Initialize() + { + Interop.Elementary.elm_init(0, null); + } + + /// + /// Shuts down Elementary. + /// + public static void Shutdown() + { + Interop.Elementary.elm_shutdown(); + } + + /// + /// Runs Elementary's main loop. + /// + public static void Run() + { + Interop.Elementary.elm_run(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static void ThemeOverlay() + { + if (File.Exists(_themeFilePath)) + { + AddThemeOverlay(_themeFilePath); + } + } + + /// + /// Prepends a theme overlay to the list of overlays + /// + /// The Edje file path to be used. + public static void AddThemeOverlay(string filePath) + { + Interop.Elementary.elm_theme_overlay_add(IntPtr.Zero, filePath); + } + + /// + /// Delete a theme overlay from the list of overlays + /// + /// The name of the theme overlay. + public static void DeleteThemeOverlay(string filePath) + { + Interop.Elementary.elm_theme_overlay_del(IntPtr.Zero, filePath); + } + + /// + /// Free a theme + /// + public static void FreeTheme() + { + Interop.Elementary.elm_theme_free(IntPtr.Zero); + } + + /// + /// Set the theme search order for the given theme + /// + /// Theme search string + /// This sets the search string for the theme in path-notation from first theme to search, to last, delimited by the : character. Example:"shiny:/path/to/file.edj:default" + public static void SetTheme(string theme) + { + Interop.Elementary.elm_theme_set(IntPtr.Zero, theme); + } + + /// + /// Flush the current theme. + /// + public static void FlushTheme() + { + Interop.Elementary.elm_theme_flush(IntPtr.Zero); + } + + /// + /// This flushes all themes (default and specific ones). + /// + public static void FlushAllThemes() + { + Interop.Elementary.elm_theme_full_flush(); + } + + /// + /// Deletes a theme extension from the list of extensions. + /// + /// The name of the theme extension. + public static void DeleteThemeExtention(string item) + { + Interop.Elementary.elm_theme_extension_del(IntPtr.Zero, item); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static double GetSystemScrollFriction() + { + return BringInScrollFriction; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static void SetSystemScrollFriction(double timeSet) + { + BringInScrollFriction = timeSet; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static string GetProfile() + { + return Interop.Elementary.elm_config_profile_get(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static void SetScale(double scale) + { + Scale = scale; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static double GetScale() + { + return Scale; + } + + /// + /// Flush all caches. + /// Frees all data that was in cache and is not currently being used to reduce memory usage. This frees Edje's, Evas' and Eet's cache. + /// + public static void FlushAllCashe() + { + Interop.Elementary.elm_cache_all_flush(); + } + + /// + /// Changes the language of the current application. + /// + /// The language to set, must be the full name of the locale. + public static void SetLanguage(string language) + { + Interop.Elementary.elm_language_set(language); + } + + /// + /// Sets a new policy's value (for a given policy group/identifier). + /// + /// The policy identifier + /// The policy value, which depends on the identifier + /// + public static bool SetPolicy(uint policy, int value) + { + return Interop.Elementary.elm_policy_set(policy, value); + } + + /// + /// Reloads Elementary's configuration, bounded to the current selected profile. + /// + public static void ReloadConfig() + { + Interop.Elementary.elm_config_reload(); + } + + /// + /// Flushes all config settings and then applies those settings to all applications using elementary on the current display. + /// + public static void FlushAllConfig() + { + Interop.Elementary.elm_config_all_flush(); + } + } +} diff --git a/src/ElmSharp/ElmSharp/ElmScrollConfig.cs b/src/ElmSharp/ElmSharp/ElmScrollConfig.cs new file mode 100644 index 0000000..974d74f --- /dev/null +++ b/src/ElmSharp/ElmSharp/ElmScrollConfig.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; + +namespace ElmSharp +{ + /// + /// The ElmScrollConfig is a scrollable views's config + /// + public static class ElmScrollConfig + { + [EditorBrowsable(EditorBrowsableState.Never)] + public static double BringInScrollFriction + { + get + { + return Elementary.BringInScrollFriction; + } + set + { + Elementary.BringInScrollFriction = value; + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Entry.cs b/src/ElmSharp/ElmSharp/Entry.cs new file mode 100755 index 0000000..50f3c4a --- /dev/null +++ b/src/ElmSharp/ElmSharp/Entry.cs @@ -0,0 +1,1025 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// Enumeration for describing InputPanel layout type. + /// + public enum InputPanelLayout + { + /// + /// InputPanel layout type default. + /// + Normal, + + /// + /// InputPanel layout type number. + /// + Number, + + /// + /// InputPanel layout type email. + /// + Email, + + /// + /// InputPanel layout type url. + /// + Url, + + /// + /// InputPanel layout type phone. + /// + PhoneNumber, + + /// + /// InputPanel layout type ip. + /// + Ip, + + /// + /// InputPanel layout type month. + /// + Month, + + /// + /// InputPanel layout type number. + /// + NumberOnly, + + /// + /// InputPanel layout type error type. Do not use it directly! + /// + Invalid, + + /// + /// InputPanel layout type hexadecimal. + /// + Hex, + + /// + /// InputPanel layout type terminal type, esc, alt, ctrl, etc. + /// + Terminal, + + /// + /// InputPanel layout type password. + /// + Password, + + /// + /// Keyboard layout type date and time. + /// + DateTime, + + /// + /// InputPanel layout type emoticons. + /// + Emoticon + } + + /// + /// Enumeration that defines the "Return" key types on the input panel (virtual keyboard). + /// + public enum InputPanelReturnKeyType + { + /// + /// Default key type + /// + Default, + + /// + /// Done key type + /// + Done, + + /// + /// Go key type + /// + Go, + + /// + /// Join key type + /// + Join, + + /// + /// Login key type + /// + Login, + + /// + /// Next key type + /// + Next, + + /// + /// Search string or magnifier icon key type + /// + Search, + + /// + /// Send key type + /// + Send, + + /// + /// Sign-in key type + /// + Signin + } + + /// + /// Enumeration that defines the autocapitalization types. + /// + public enum AutoCapital + { + /// + /// No autocapitalization when typing + /// + None, + + /// + /// Autocapitalize each typed word + /// + Word, + + /// + /// Autocapitalize the start of each sentence + /// + Sentence, + + /// + /// Autocapitalize all letters + /// + All + } + + /// + /// Enumeration that defines the entry's copy & paste policy. + /// + public enum CopyAndPasteMode + { + /// + /// Copy & paste text with markup tag + /// + Markup, + + /// + /// Copy & paste text without item(image) tag + /// + NoImage, + + /// + /// Copy & paste text without markup tag + /// + PlainText + } + + /// + /// Enumeration that defines the text format types. + /// + public enum TextFormat + { + /// + /// Plain type + /// + Plain, + + /// + /// Markup type + /// + Markup + } + + /// + /// Enumeration that defines the types of Input Hints. + /// + public enum InputHints + { + /// + /// No active hints + /// + None, + + /// + /// suggest word auto completion + /// + AutoComplete, + + /// + /// typed text should not be stored. + /// + SensitiveData, + } + + /// + /// Enumeration that defines the input panel (virtual keyboard) language modes. + /// + public enum InputPanelLanguage + { + /// + /// Automatic language mode + /// + Automatic, + + /// + /// Alphabet language mode + /// + Alphabet, + } + + /// + /// The entry is a convenience widget that shows a box in which the user can enter text. + /// + public class Entry : Layout + { + SmartEvent _clicked; + SmartEvent _changedByUser; + SmartEvent _cursorChanged; + SmartEvent _activated; + + Dictionary, Interop.Elementary.Elm_Entry_Item_Provider_Cb> _itemsProvider = new Dictionary, Interop.Elementary.Elm_Entry_Item_Provider_Cb>(); + Dictionary, Interop.Elementary.Elm_Entry_Filter_Cb> _textFilters = new Dictionary, Interop.Elementary.Elm_Entry_Filter_Cb>(); + + /// + /// Creates and initializes a new instance of the Entry class. + /// + /// The EvasObject to which the new Entry will be attached as a child. + public Entry(EvasObject parent) : base(parent) + { + _clicked = new SmartEvent(this, this.RealHandle, "clicked"); + _clicked.On += (s, e) => Clicked?.Invoke(this, EventArgs.Empty); + + _changedByUser = new SmartEvent(this, this.RealHandle, "changed,user"); + _changedByUser.On += (s, e) => ChangedByUser?.Invoke(this, EventArgs.Empty); + + _cursorChanged = new SmartEvent(this, this.RealHandle, "cursor,changed"); + _cursorChanged.On += (s, e) => CursorChanged?.Invoke(this, EventArgs.Empty); + + _activated = new SmartEvent(this, this.RealHandle, "activated"); + _activated.On += (s, e) => Activated?.Invoke(this, EventArgs.Empty); + } + + /// + /// Activated will be triggered when the entry in Activated stated. + /// + public event EventHandler Activated; + + /// + /// Clicked will be triggered when the entry is clicked. + /// + public event EventHandler Clicked; + + /// + /// ChangedByUser will be triggered when the entry changed by user. + /// + public event EventHandler ChangedByUser; + + /// + /// CursorChanged will be triggered when the Cursor in the entry is changed. + /// + public event EventHandler CursorChanged; + + /// + /// Sets or gets the entry to the single line mode. + /// + public bool IsSingleLine + { + get + { + return Interop.Elementary.elm_entry_single_line_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_single_line_set(RealHandle, value); + } + } + + /// + /// Sets or gets the entry to the password mode. + /// + public bool IsPassword + { + get + { + return Interop.Elementary.elm_entry_password_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_password_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the entry is editable. + /// + public bool IsEditable + { + get + { + return Interop.Elementary.elm_entry_editable_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_editable_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the entry is empty. + /// + public bool IsEmpty + { + get + { + return Interop.Elementary.elm_entry_is_empty(RealHandle); + } + } + + /// + /// Sets or gets text currently shown in the object entry. + /// + public override string Text + { + get + { + return Interop.Elementary.elm_entry_entry_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_entry_set(RealHandle, value); + } + } + + /// + /// Sets or gets the style on the top of the user style stack. + /// + /// If there is styles in the user style stack, the properties in the top style of user style stack will replace the properties in current theme. The input style is specified in format tag='property=value' (i.e. DEFAULT='font=Sans font_size=60'hilight=' + font_weight=Bold'). + public string TextStyle + { + get + { + return Interop.Elementary.elm_entry_text_style_user_peek(RealHandle); + } + set + { + Interop.Elementary.elm_entry_text_style_user_push(RealHandle, value); + } + } + + /// + /// Sets or gets the current position of the cursor in the entry. + /// + public int CursorPosition + { + get + { + return Interop.Elementary.elm_entry_cursor_pos_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_cursor_pos_set(RealHandle, value); + } + } + + /// + /// Sets or gets the scrollable state of the entry. + /// + public bool Scrollable + { + get + { + return Interop.Elementary.elm_entry_scrollable_get(RealHandle); + } + set + { + // HACK: Enabling the scrollable property of an entry causes its internal + // hierarchy to change, making the internal edje object inaccessible. + // Access it before the property is set, to cache the edje object's handle. + if (value) + { + var dummy = EdjeObject; + } + Interop.Elementary.elm_entry_scrollable_set(RealHandle, value); + } + } + + /// + /// Sets or Gets the autocapitalization type on the immodule. + /// + public AutoCapital AutoCapital + { + get + { + return (AutoCapital)Interop.Elementary.elm_entry_autocapital_type_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_autocapital_type_set(RealHandle, (Interop.Elementary.AutocapitalType)value); + } + } + + /// + /// Sets or Gets the entry object's 'autosave' status. + /// + public bool IsAutoSave + { + get + { + return Interop.Elementary.elm_entry_autosave_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_autosave_set(RealHandle, value); + } + } + + /// + /// Sets or Gets entry text paste/drop mode. + /// + public CopyAndPasteMode CopyAndPasteMode + { + get + { + return (CopyAndPasteMode)Interop.Elementary.elm_entry_cnp_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_cnp_mode_set(RealHandle, (Interop.Elementary.CopyAndPasteMode)value); + } + } + + /// + /// Gets the geometry of the cursor. + /// + public Rect CursorGeometry + { + get + { + int x, y, w, h; + Interop.Elementary.elm_entry_cursor_geometry_get(RealHandle, out x, out y, out w, out h); + return new Rect(x, y, w, h); + } + } + + /// + /// Gets whether a format node exists at the current cursor position. + /// + public bool IsCursorFormat + { + get + { + return Interop.Elementary.elm_entry_cursor_is_format_get(RealHandle); + } + } + + /// + /// Gets if the current cursor position holds a visible format node. + /// + public bool IsCursorVisibelFormat + { + get + { + return Interop.Elementary.elm_entry_cursor_is_visible_format_get(RealHandle); + } + } + + /// + /// Sets or Gets the value of input hint. + /// + public InputHints InputHint + { + get + { + return (InputHints)Interop.Elementary.elm_entry_input_hint_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_hint_set(RealHandle, (Interop.Elementary.InputHints)value); + } + } + + /// + /// Sets or gets the language mode of the input panel. + /// + public InputPanelLanguage InputPanelLanguage + { + get + { + return (InputPanelLanguage)Interop.Elementary.elm_entry_input_panel_language_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_language_set(RealHandle, (Interop.Elementary.InputPanelLanguage)value); + } + } + + /// + /// Sets or gets the input panel layout variation of the entry. + /// + public int InputPanelVariation + { + get + { + return Interop.Elementary.elm_entry_input_panel_layout_variation_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_layout_variation_set(RealHandle, value); + } + } + + /// + /// Sets or gets the line wrap type to use on multi-line entries. + /// + public WrapType LineWrapType + { + get + { + return (WrapType)Interop.Elementary.elm_entry_line_wrap_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_line_wrap_set(RealHandle, (Interop.Elementary.WrapType)value); + } + } + + /// + /// Sets or gets whether the entry should allow to use the text prediction. + /// + public bool PredictionAllowed + { + get + { + return Interop.Elementary.elm_entry_prediction_allow_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_prediction_allow_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the return key on the input panel should be disabled or not. + /// + public bool InputPanelReturnKeyDisabled + { + get + { + return Interop.Elementary.elm_entry_input_panel_return_key_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_return_key_disabled_set(RealHandle, value); + } + } + + /// + /// Sets or gets the attribute to show the input panel in case of only an user's explicit Mouse Up event. + /// It doesn't request to show the input panel even though it has focus. + /// If true, the input panel will be shown in case of only Mouse up event. (Focus event will be ignored.) + /// + public bool InputPanelShowByOnDemand + { + get + { + return Interop.Elementary.elm_entry_input_panel_show_on_demand_get(RealHandle); + } + set + { + Interop.Elementary.elm_entry_input_panel_show_on_demand_set(RealHandle, value); + } + } + + /// + /// Sets the file (and implicitly loads it) for the text to display and then edit. + /// + /// The path to the file to load and save + /// The file format + public void SetFile(string file, TextFormat textFormat) + { + Interop.Elementary.elm_entry_file_set(RealHandle, file, (Interop.Elementary.TextFormat)textFormat); + } + + /// + /// Converts a markup (HTML-like) string into UTF-8. + /// + /// The string (in markup) to be converted + /// The converted string (in UTF-8) + public static string ConvertMarkupToUtf8(string markup) + { + return Interop.Elementary.elm_entry_markup_to_utf8(markup); + } + + /// + /// Moves the cursor by one position to the right within the entry. + /// + /// + public bool MoveCursorNext() + { + return Interop.Elementary.elm_entry_cursor_next(RealHandle); + } + + /// + /// Moves the cursor one place to the left within the entry. + /// + /// TRUE on success, otherwise FALSE on failure + public bool MoveCursorPrev() + { + return Interop.Elementary.elm_entry_cursor_prev(RealHandle); + } + + /// + /// Moves the cursor one line up within the entry. + /// + /// TRUE on success, otherwise FALSE on failure + public bool MoveCursorUp() + { + return Interop.Elementary.elm_entry_cursor_up(RealHandle); + } + + /// + /// Moves the cursor one line down within the entry. + /// + /// TRUE on success, otherwise FALSE on failure + public bool MoveCursorDown() + { + return Interop.Elementary.elm_entry_cursor_down(RealHandle); + } + + /// + /// Moves the cursor to the beginning of the entry. + /// + public void MoveCursorBegin() + { + Interop.Elementary.elm_entry_cursor_begin_set(RealHandle); + } + + /// + /// Moves the cursor to the end of the entry. + /// + public void MoveCursorEnd() + { + Interop.Elementary.elm_entry_cursor_end_set(RealHandle); + } + + /// + /// Moves the cursor to the beginning of the current line. + /// + public void MoveCursorLineBegin() + { + Interop.Elementary.elm_entry_cursor_line_begin_set(RealHandle); + } + + /// + /// Moves the cursor to the end of the current line. + /// + public void MoveCursorLineEnd() + { + Interop.Elementary.elm_entry_cursor_line_end_set(RealHandle); + } + + /// + /// Sets the input panel layout of the entry. + /// + /// The layout type + public void SetInputPanelLayout(InputPanelLayout layout) + { + Interop.Elementary.elm_entry_input_panel_layout_set(RealHandle, (Interop.Elementary.InputPanelLayout)layout); + } + + /// + /// Sets the attribute to show the input panel automatically. + /// + /// If true the input panel appears when the entry is clicked or has focus, otherwise false + public void SetInputPanelEnabled(bool enabled) + { + Interop.Elementary.elm_entry_input_panel_enabled_set(RealHandle, enabled); + } + + /// + /// Sets the "return" key type. This type is used to set the string or icon on the "return" key of the input panel. + /// + /// The type of "return" key on the input panel + public void SetInputPanelReturnKeyType(InputPanelReturnKeyType keyType) + { + Interop.Elementary.elm_entry_input_panel_return_key_type_set(RealHandle, (Interop.Elementary.ReturnKeyType)keyType); + } + + /// + /// Hides the input panel (virtual keyboard). + /// + /// + /// Note that the input panel is shown or hidden automatically according to the focus state of the entry widget. + /// This API can be used in case of manually controlling by using SetInputPanelEnabled(false). + /// + public void HideInputPanel() + { + Interop.Elementary.elm_entry_input_panel_hide(RealHandle); + } + + /// + /// Selects all the text within the entry. + /// + public void SelectAll() + { + Interop.Elementary.elm_entry_select_all(RealHandle); + } + + /// + /// Drops any existing text selection within the entry. + /// + public void SelectNone() + { + Interop.Elementary.elm_entry_select_none(RealHandle); + } + + /// + /// Forces calculation of the entry size and text layouting. + /// + public void ForceCalculation() + { + Interop.Elementary.elm_entry_calc_force(RealHandle); + } + + /// + /// Gets the string by the cursor at its current position. + /// + /// + public string GetCursorContent() + { + return Interop.Elementary.elm_entry_cursor_content_get(RealHandle); + } + + /// + /// Begins a selection within the entry as though the user were holding down the mouse button to make a selection. + /// + public void BeginCursorSelection() + { + Interop.Elementary.elm_entry_cursor_selection_begin(RealHandle); + } + + /// + /// Appends the text of the entry. + /// + /// The text to be displayed + public void AppendText(string text) + { + Interop.Elementary.elm_entry_entry_append(RealHandle, text); + } + + /// + /// Inserts the given text into the entry at the current cursor position. + /// + /// + public void InsertTextToCursor(string text) + { + Interop.Elementary.elm_entry_entry_insert(RealHandle, text); + } + + /// + /// Ends a selection within the entry as though the user had just released the mouse button while making a selection. + /// + public void EndCursorSelection() + { + Interop.Elementary.elm_entry_cursor_selection_end(RealHandle); + } + + /// + /// Writes any changes made to the file that is set by File. + /// + public void SaveFile() + { + Interop.Elementary.elm_entry_file_save(RealHandle); + } + + /// + /// Show the input panel (virtual keyboard) based on the input panel property of entry such as layout, autocapital types, and so on. + /// + /// + /// Note that input panel is shown or hidden automatically according to the focus state of entry widget. + /// This API can be used in the case of manually controlling by using SetInputPanelEnabled(false). + /// + public void ShowInputPanel() + { + Interop.Elementary.elm_entry_input_panel_show(RealHandle); + } + + /// + /// This appends a custom item provider to the list for that entry. + /// + /// This function is used to provide items. + public void AppendItemProvider(Func func) + { + if (func != null) + { + if (!_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + + itemProviderCallback = (d, o, t) => + { + return func?.Invoke(t); + }; + Interop.Elementary.elm_entry_item_provider_append(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Add(func, itemProviderCallback); + } + } + } + + /// + /// This prepends a custom item provider to the list for that entry. + /// + /// This function is used to provide items. + public void PrependItemProvider(Func func) + { + if (!_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + + itemProviderCallback = (d, o, t) => + { + return func?.Invoke(t); + }; + Interop.Elementary.elm_entry_item_provider_prepend(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Add(func, itemProviderCallback); + } + } + + /// + /// This removes a custom item provider to the list for that entry. + /// + /// This function is used to provide items. + public void RemoveItemProvider(Func func) + { + if (_itemsProvider.ContainsKey(func)) + { + Interop.Elementary.Elm_Entry_Item_Provider_Cb itemProviderCallback; + _itemsProvider.TryGetValue(func, out itemProviderCallback); + + Interop.Elementary.elm_entry_item_provider_remove(RealHandle, itemProviderCallback, IntPtr.Zero); + _itemsProvider.Remove(func); + } + } + + /// + /// Append a markup filter function for text inserted in the entry. + /// + /// This function type is used by entry filters to modify text. + public void AppendMarkUpFilter(Func filter) + { + if (!_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) => + { + var text = Marshal.PtrToStringAnsi(t); + + var updateText = filter(this, text); + + if (updateText != text) + { + Interop.Libc.Free(t); + t = Marshal.StringToHGlobalAnsi(updateText); + } + }; + Interop.Elementary.elm_entry_markup_filter_append(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Add(filter, textFilterCallback); + } + } + + /// + /// Prepend a markup filter function for text inserted in the entry. + /// + /// This function type is used by entry filters to modify text. + public void PrependMarkUpFilter(Func filter) + { + if (!_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback = (IntPtr d, IntPtr e, ref IntPtr t) => + { + var text = Marshal.PtrToStringAnsi(t); + + var updateText = filter(this, text); + + if (updateText != text) + { + Interop.Libc.Free(t); + t = Marshal.StringToHGlobalAnsi(updateText); + } + }; + Interop.Elementary.elm_entry_markup_filter_prepend(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Add(filter, textFilterCallback); + } + } + + /// + /// Remove a markup filter + /// + /// This function type is used by entry filters to modify text. + public void RemoveMarkUpFilter(Func filter) + { + if (_textFilters.ContainsKey(filter)) + { + Interop.Elementary.Elm_Entry_Filter_Cb textFilterCallback; + _textFilters.TryGetValue(filter, out textFilterCallback); + + Interop.Elementary.elm_entry_markup_filter_remove(RealHandle, textFilterCallback, IntPtr.Zero); + _textFilters.Remove(filter); + } + } + + /// + /// This executes a "copy" action on the selected text in the entry. + /// + public void CopySelection() + { + Interop.Elementary.elm_entry_selection_copy(RealHandle); + } + + /// + /// This executes a "cut" action on the selected text in the entry. + /// + public void CutSelection() + { + Interop.Elementary.elm_entry_selection_cut(RealHandle); + } + + /// + /// This executes a "paste" action in the entry. + /// + public void PasteSelection() + { + Interop.Elementary.elm_entry_selection_paste(RealHandle); + } + + /// + /// This disabled the entry's selection. + /// + /// If true, the selection are disabled. + public void DisableSelection(bool disable) + { + Interop.Elementary.elm_entry_selection_handler_disabled_set(RealHandle, disable); + } + + /// + /// Get any selected text within the entry. + /// + /// Selection's value + public string GetSelection() + { + return Interop.Elementary.elm_entry_selection_get(RealHandle); + } + + /// + /// This selects a region of text within the entry. + /// + /// The starting position. + /// The end position. + public void SetSelectionRegion(int start, int end) + { + Interop.Elementary.elm_entry_select_region_set(RealHandle, start, end); + } + + /// + /// Sets the visibility of the left-side widget of the entry + /// + /// true if the object should be displayed, false if not. + public void SetIconVisible(bool isDisplay) + { + Interop.Elementary.elm_entry_icon_visible_set(RealHandle, isDisplay); + } + + /// + /// Set whether the return key on the input panel is disabled automatically when entry has no text. + /// + /// If enabled is true, the return key is automatically disabled when the entry has no text. + public void SetInputPanelReturnKeyAutoEnable(bool enable) + { + Interop.Elementary.elm_entry_input_panel_return_key_autoenabled_set(RealHandle, enable); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_entry_add(parent.Handle); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/EvasCanvas.cs b/src/ElmSharp/ElmSharp/EvasCanvas.cs new file mode 100644 index 0000000..6f778c6 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EvasCanvas.cs @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// Low level Evas canvas functions. Sub groups will present more high level ones, though. + /// Most of these functions deal with low level Evas actions, like: + /// create/destroy raw canvases, not bound to any displaying engine + /// tell a canvas i got focused(in a windowing context, for example) + /// tell a canvas a region should not be calculated anymore in rendering + /// tell a canvas to render its contents, immediately + /// Most users will be using Evas by means of the Ecore_Evas wrapper, which deals with all the above mentioned issues automatically for them.Thus, you'll be looking at this section only if you're building low level stuff. + /// The groups within present you functions that deal with the canvas directly, too, and not yet with its objects.They are the functions you need to use at a minimum to get a working canvas. + /// + public class EvasCanvas + { + IntPtr _handle = IntPtr.Zero; + Dictionary _eventDatas = new Dictionary(); + + internal EvasCanvas(IntPtr evasObject) + { + _handle = CreateHandle(evasObject); + } + + /// + /// Gets or sets the image cache. + /// This function returns the image cache size of canvas in bytes. + /// + public int ImageCacheSize + { + get + { + return Interop.Evas.evas_image_cache_get(_handle); + } + set + { + Interop.Evas.evas_image_cache_set(_handle, value); + } + } + + /// + /// Flush the image cache of the canvas. + /// + public void FlushImageCache() + { + Interop.Evas.evas_image_cache_flush(_handle); + } + + /// + /// Add a damage rectangle. + /// + /// The rectangle's top left corner's horizontal coordinate. + /// The rectangle's top left corner's vertical coordinate. + /// The rectangle's width. + /// The rectangle's height. + public void AddDamageRectangle(int x, int y, int width, int height) + { + Interop.Evas.evas_damage_rectangle_add(_handle, x, y, width, height); + } + + /// + /// Add an "obscured region" to an Evas canvas. + /// + /// The rectangle's top left corner's horizontal coordinate. + /// The rectangle's top left corner's vertical coordinate. + /// The rectangle's width. + /// The rectangle's height. + public void AddObscuredRectangle(int x, int y, int width, int height) + { + Interop.Evas.evas_obscured_rectangle_add(_handle, x, y, width, height); + } + + /// + /// Remove all "obscured regions" from an Evas canvas. + /// + public void ClearObscuredRectangle() + { + Interop.Evas.evas_obscured_clear(_handle); + } + + /// + /// Adds or registers a event to a given canvas event. + /// + /// The type of event that triggers + /// The action to be called when the event is triggered + public void AddEventAction(EvasObjectCallbackType type, Action action) + { + if (action != null) + { + var eventData = new EventData(type, action); + + if (!_eventDatas.ContainsKey(eventData)) + { + var evasCallback = new Interop.Evas.EvasCallback((d, o, t) => action()); + Interop.Evas.evas_event_callback_add(_handle, (Interop.Evas.ObjectCallbackType)type, evasCallback, IntPtr.Zero); + _eventDatas.Add(eventData, evasCallback); + } + } + } + + /// + /// Deletes a event to a given canvas event. + /// + /// The type of event that triggers + /// The action to be called when the event is triggered + public void DeleteEventAction(EvasObjectCallbackType type, Action action) + { + if (action != null) + { + var eventData = new EventData(type, action); + Interop.Evas.EvasCallback evasCallback = null; + _eventDatas.TryGetValue(eventData, out evasCallback); + + if (evasCallback != null) + { + Interop.Evas.evas_event_callback_del(_handle, (Interop.Evas.ObjectCallbackType)type, evasCallback); + _eventDatas.Remove(eventData); + } + } + } + + IntPtr CreateHandle(IntPtr evasObject) + { + return Interop.Evas.evas_object_evas_get(evasObject); + } + + class EventData + { + public EvasObjectCallbackType Type { get; set; } + public Action Action { get; set; } + + public EventData(EvasObjectCallbackType type, Action action) + { + Type = type; + Action = action; + } + + public override bool Equals(object obj) + { + EventData e = obj as EventData; + if (e == null) + { + return false; + } + return (Type == e.Type) && (Action == e.Action); + } + + public override int GetHashCode() + { + int hashCode = Type.GetHashCode(); + hashCode ^= Action.GetHashCode(); + return hashCode; + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/EvasKeyEventArgs.cs b/src/ElmSharp/ElmSharp/EvasKeyEventArgs.cs new file mode 100644 index 0000000..8955904 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EvasKeyEventArgs.cs @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// The EvasKeyEventArgs is an EvasKey EventArgs + /// + public class EvasKeyEventArgs : EventArgs + { + IntPtr _nativeEventInfo; + + EvasEventFlag _eventFlags; + + /// + /// BackButton name in Platform + /// + public const string PlatformBackButtonName = "XF86Back"; + /// + /// MenuButton name in Platform + /// + public const string PlatformMenuButtonName = "XF86Menu"; + /// + /// HomeButton name in Platform + /// + public const string PlatformHomeButtonName = "XF86Home"; + + /// + /// Gets the name of Key + /// + public string KeyName { get; private set; } + + public EvasEventFlag Flags + { + get + { + IntPtr offset = Marshal.OffsetOf("event_flags"); + return (EvasEventFlag)Marshal.ReadIntPtr(_nativeEventInfo, (int)offset); + } + set + { + IntPtr offset = Marshal.OffsetOf("event_flags"); + Marshal.WriteIntPtr(_nativeEventInfo, (int)offset, (IntPtr)value); + } + } + + EvasKeyEventArgs(IntPtr info) + { + _nativeEventInfo = info; + var evt = Marshal.PtrToStructure(info); + KeyName = evt.keyname; + } + + /// + /// Creates and initializes a new instance of the EvasKeyEventArgs class. + /// + /// data info + /// object + /// information + /// EvasKey eventArgs + static public EvasKeyEventArgs Create(IntPtr data, IntPtr obj, IntPtr info) + { + return new EvasKeyEventArgs(info); + } + + /// + /// Event structure for Key Down event callbacks. + /// + [StructLayout(LayoutKind.Sequential)] + struct EvasEventKeyDown + { + /// + /// Name string of the key pressed + /// + public string keyname; + /// + /// Data to be passed to the event + /// + public IntPtr data; + /// + /// Modifier keys pressed during the event + /// + public IntPtr modifiers; + /// + /// Locks info + /// + public IntPtr locks; + /// + /// Logical key: (example, shift+1 == exclamation) + /// + public string key; + /// + /// UTF8 string if this keystroke has produced a visible string to be ADDED + /// + public string str; + /// + /// UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one + /// + public string compose; + + public uint timestamp; + + /// + /// Event_flags + /// + public EvasEventFlag event_flags; + /// + /// + /// + public IntPtr dev; + /// + /// Keycode + /// + public uint keycode; + }; + } + + /// + /// Flags for Events + /// + [Flags] + public enum EvasEventFlag + { + /// + /// No fancy flags set + /// + None = 0, + /// + ///This event is being delivered but should be put "on hold" until the on hold flag is unset. the event should be used for informational purposes and maybe some indications visually, but not actually perform anything + /// + OnHold = 1, + } + +} diff --git a/src/ElmSharp/ElmSharp/EvasMap.cs b/src/ElmSharp/ElmSharp/EvasMap.cs new file mode 100755 index 0000000..b67264e --- /dev/null +++ b/src/ElmSharp/ElmSharp/EvasMap.cs @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The EvasMap is an opaque handle to map points. + /// + public class EvasMap + { + IntPtr _evasMap; + bool _ownership; + + /// + /// Creates and initializes a new instance of the EvasMap class. + /// + /// The number of points in the map + public EvasMap(int count) + { + _evasMap = Interop.Evas.evas_map_new(count); + _ownership = true; + } + + internal EvasMap(IntPtr handle) + { + _evasMap = handle; + _ownership = false; + } + + ~EvasMap() + { + if (_ownership) + { + Interop.Evas.evas_map_free(_evasMap); + } + } + + internal IntPtr Handle + { + get + { + return _evasMap; + } + } + + /// + /// Gets or sets the flag of the object move synchronization for map rendering. + /// + public bool IsMoveSync + { + get + { + return Interop.Evas.evas_map_util_object_move_sync_get(_evasMap); + } + set + { + Interop.Evas.evas_map_util_object_move_sync_set(_evasMap, value); + } + } + + /// + /// Populates source and destination map points to exactly match the object. + /// + /// The object to use unmapped geometry to populate map coordinates + /// + /// The point Z coordinate hint (pre-perspective transform)This value is used for all four points. + /// + public void PopulatePoints(EvasObject obj, int z) + { + Interop.Evas.evas_map_util_points_populate_from_object_full(_evasMap, obj, z); + } + + /// + /// Populates the source and destination map points to match the given geometry. + /// + /// The geometry value contains X coordinate,Y coordinate,the width and height to use to calculate second and third points + /// The Z coordinate hint (pre-perspective transform) This value is used for all four points. + public void PopulatePoints(Rect geometry, int z) + { + Interop.Evas.evas_map_util_points_populate_from_geometry(_evasMap, geometry.X, geometry.Y, geometry.Width, geometry.Height, z); + } + + /// + /// Rotates the map around 3 axes in 3D. + /// + /// The amount of degrees from 0.0 to 360.0 to rotate around X axis + /// The amount of degrees from 0.0 to 360.0 to rotate around Y axis + /// The amount of degrees from 0.0 to 360.0 to rotate around Z axis + /// The rotation's center horizontal position + /// The rotation's center vertical position + /// The rotation's center vertical position + public void Rotate3D(double dx, double dy, double dz, int cx, int cy, int cz) + { + Interop.Evas.evas_map_util_3d_rotate(_evasMap, dx, dy, dz, cx, cy, cz); + } + + /// + /// Changes the map point's coordinate. + /// + /// The index of point to change ,this must be smaller than map size. + /// 3D Point coordinate + public void SetPointCoordinate(int idx, Point3D point) + { + Interop.Evas.evas_map_point_coord_set(_evasMap, idx, point.X, point.Y, point.Z); + } + + /// + /// Gets the map point's coordinate. + /// + /// The index of point to change ,this must be smaller than map size. + /// The coordinates of the given point in the map. + public Point3D GetPointCoordinate(int idx) + { + Point3D point; + Interop.Evas.evas_map_point_coord_get(_evasMap, idx, out point.X, out point.Y, out point.Z); + return point; + } + + /// + /// Changes the map to apply the given zooming. + /// + /// The horizontal zoom to use + /// The vertical zoom to use + /// The zooming center horizontal position + /// The zooming center vertical position + public void Zoom(double x, double y, int cx, int cy) + { + Interop.Evas.evas_map_util_zoom(_evasMap, x, y, cx, cy); + } + } +} diff --git a/src/ElmSharp/ElmSharp/EvasObject.cs b/src/ElmSharp/ElmSharp/EvasObject.cs new file mode 100644 index 0000000..9c5b71b --- /dev/null +++ b/src/ElmSharp/ElmSharp/EvasObject.cs @@ -0,0 +1,964 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace ElmSharp +{ + public enum TooltipOrientation + { + None, + TopLeft, + Top, + TopRight, + Left, + Center, + Right, + BottomLeft, + Bottom, + BottomRight, + } + + public enum AspectControl + { + None = 0, /* Preference on scaling unset */ + Neither = 1, /* Same effect as unset preference on scaling */ + Horizontal = 2, /* Use all horizontal container space to place an object, using the given aspect */ + Vertical = 3, /* Use all vertical container space to place an object, using the given aspect */ + Both = 4 /* Use all horizontal @b and vertical container spaces to place an object (never growing it out of those bounds), using the given aspect */ + } + + /// + /// The EcasObject is a base class for other widget class + /// + public abstract class EvasObject + { + private IntPtr _realHandle = IntPtr.Zero; + private EvasCanvas _evasCanvas; + + private event EventHandler _backButtonPressed; + + private event EventHandler _moreButtonPressed; + + private Interop.Eext.EextEventCallback _backButtonHandler; + private Interop.Eext.EextEventCallback _moreButtonHandler; + + public IntPtr Handle { get; protected set; } + public EvasObject Parent { get; private set; } + + public IntPtr RealHandle + { + get + { + return _realHandle == IntPtr.Zero ? Handle : _realHandle; + } + protected set + { + _realHandle = value; + } + } + + EvasObjectEvent _deleted; + EvasObjectEvent _keyup; + EvasObjectEvent _keydown; + EvasObjectEvent _moved; + EvasObjectEvent _resized; + EventHandler _renderPost; + Interop.Evas.EvasCallback _renderPostCallback = null; + Interop.Elementary.Elm_Tooltip_Content_Cb _tooltipContentCallback = null; + + GetTooltipContentDelegate _tooltipContentDelegate = null; + + readonly HashSet _eventStore = new HashSet(); + + /// + /// Creates and initializes a new instance of the EvasObject class with parent EvasObject class parameter. + /// + /// Parent EvasObject class + protected EvasObject(EvasObject parent) : this() + { + Debug.Assert(parent == null || parent.IsRealized); + Realize(parent); + } + + /// + /// Creates and initializes a new instance of the EvasObject class. + /// + protected EvasObject() + { + _backButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _backButtonPressed?.Invoke(this, EventArgs.Empty); }); + _moreButtonHandler = new Interop.Eext.EextEventCallback((d, o, i) => { _moreButtonPressed?.Invoke(this, EventArgs.Empty); }); + + OnInstantiated(); + + _tooltipContentCallback = (d, o, t) => + { + return _tooltipContentDelegate?.Invoke(); + }; + } + + // C# Finalizer was called on GC thread + // So, We can't access to EFL object + // And When Finalizer was called, Field can be already released. + //~EvasObject() + //{ + // Unrealize(); + //} + + /// + /// Deleted will be triggered when widght is deleted + /// + public event EventHandler Deleted; + + /// + /// KeyUp will be triggered when key is loose + /// + public event EventHandler KeyUp; + + /// + /// KeyDown will be triggered when key is preesd down + /// + public event EventHandler KeyDown; + + /// + /// BackButtonPressed will be triggered when Back button is pressed + /// + public event EventHandler BackButtonPressed + { + add + { + if (_backButtonPressed == null) + { + Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler, IntPtr.Zero); + } + _backButtonPressed += value; + } + remove + { + _backButtonPressed -= value; + if (_backButtonPressed == null) + { + Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_BACK, _backButtonHandler); + } + } + } + + /// + /// MoreButtonPressed will be triggered when More button is pressed + /// + public event EventHandler MoreButtonPressed + { + add + { + if (_moreButtonPressed == null) + { + Interop.Eext.eext_object_event_callback_add(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler, IntPtr.Zero); + } + _moreButtonPressed += value; + } + remove + { + _moreButtonPressed -= value; + if (_moreButtonPressed == null) + { + Interop.Eext.eext_object_event_callback_del(RealHandle, Interop.Eext.EextCallbackType.EEXT_CALLBACK_MORE, _moreButtonHandler); + } + } + } + + /// + /// Moved will be triggered when widght is moved + /// + public event EventHandler Moved + { + add { _moved.On += value; } + remove { _moved.On -= value; } + } + + /// + /// Current widget's size Resized Event Handler + /// + public event EventHandler Resized + { + add { _resized.On += value; } + remove { _resized.On -= value; } + } + + /// + /// Current widget RenderPost Event Handler + /// + public event EventHandler RenderPost + { + add + { + _renderPost += value; + if (_renderPostCallback == null) + { + _renderPostCallback = new Interop.Evas.EvasCallback((o, e, d) => _renderPost?.Invoke(this, EventArgs.Empty)); + Interop.Evas.evas_event_callback_add(Interop.Evas.evas_object_evas_get(RealHandle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback, IntPtr.Zero); + } + } + remove + { + _renderPost -= value; + if (_renderPost?.GetInvocationList().Length == 0) + { + Interop.Evas.evas_event_callback_del(Interop.Evas.evas_object_evas_get(RealHandle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback); + _renderPostCallback = null; + } + } + } + + /// + /// Called back when a widget's tooltip is activated and needs content. + /// + /// + public delegate EvasObject GetTooltipContentDelegate(); + + /// + /// Get widget's status of Realized or not. + /// + public bool IsRealized { get { return Handle != IntPtr.Zero; } } + + /// + /// Gets EvasCanvas + /// + public EvasCanvas EvasCanvas + { + get + { + if (_evasCanvas == null) + _evasCanvas = new EvasCanvas(Handle); + return _evasCanvas; + } + } + + /// + /// Gets the current class's Name. + /// + public string ClassName + { + get + { + return Interop.Eo.eo_class_name_get(Interop.Eo.eo_class_get(RealHandle)); + } + } + + /// + /// Sets or gets the horizontal pointer hints for an object's weight. + /// + public double WeightX + { + get + { + return Interop.Evas.GetWeightX(Handle); + } + set + { + Interop.Evas.SetWeightX(Handle, value); + } + } + + /// + /// Sets or gets the vertical pointer hints for an object's weight. + /// + public double WeightY + { + get + { + return Interop.Evas.GetWeightY(Handle); + } + set + { + Interop.Evas.SetWeightY(Handle, value); + } + } + + /// + /// Sets or gets the horizontal alignment hint of an object's alignment. + /// + public virtual double AlignmentX + { + get + { + return Interop.Evas.GetAlignX(Handle); + } + set + { + Interop.Evas.SetAlignX(Handle, value); + } + } + + /// + /// Sets or gets the vertical alignment hint of an object's alignment. + /// + public virtual double AlignmentY + { + get + { + return Interop.Evas.GetAlignY(Handle); + } + set + { + Interop.Evas.SetAlignY(Handle, value); + } + } + + /// + /// Sets or gets the Width hints for an object's minimum size. + /// + public int MinimumWidth + { + get + { + int w, h; + Interop.Evas.evas_object_size_hint_min_get(RealHandle, out w, out h); + return w; + } + set + { + int h = MinimumHeight; + Interop.Evas.evas_object_size_hint_min_set(RealHandle, value, h); + } + } + + /// + /// Sets or gets the Height hints for an object's minimum size. + /// + public int MinimumHeight + { + get + { + int w, h; + Interop.Evas.evas_object_size_hint_min_get(RealHandle, out w, out h); + return h; + } + set + { + int w = MinimumWidth; + Interop.Evas.evas_object_size_hint_min_set(RealHandle, w, value); + } + } + + /// + /// Gets the visible state of the given Evas object. + /// + public bool IsVisible + { + get + { + return Interop.Evas.evas_object_visible_get(Handle); + } + } + + /// + /// Sets or gets the position and (rectangular) size of the given Evas object. + /// + public Rect Geometry + { + get + { + int x, y, w, h; + Interop.Evas.evas_object_geometry_get(Handle, out x, out y, out w, out h); + Rect rect = new Rect(x, y, w, h); + return rect; + } + set + { + Interop.Evas.evas_object_geometry_set(Handle, value.X, value.Y, value.Width, value.Height); + } + } + + /// + /// Sets or gets the general or main color of the given Evas object. + /// + public virtual Color Color + { + get + { + int r, g, b, a; + Interop.Evas.evas_object_color_get(RealHandle, out r, out g, out b, out a); + return Color.FromRgba(r, g, b, a); + } + set + { + Interop.Evas.SetPremultipliedColor(RealHandle, value.R, value.G, value.B, value.A); + } + } + + /// + /// Sets or gets the map enabled state. + /// + public bool IsMapEnabled + { + get + { + return Interop.Evas.evas_object_map_enable_get(Handle); + } + set + { + Interop.Evas.evas_object_map_enable_set(Handle, value); + } + } + + /// + /// Sets or gets current object transformation map. + /// + public EvasMap EvasMap + { + get + { + IntPtr evasMap = Interop.Evas.evas_object_map_get(Handle); + return new EvasMap(evasMap); + } + set + { + Interop.Evas.evas_object_map_set(Handle, value.Handle); + } + } + + /// + /// Sets or gets whether an object is to repeat events. + /// + public bool RepeatEvents + { + get + { + return Interop.Evas.evas_object_repeat_events_get(RealHandle); + } + set + { + Interop.Evas.evas_object_repeat_events_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether events on a smart object's member should get propagated up to its parent. + /// + public bool PropagateEvents + { + get + { + return Interop.Evas.evas_object_propagate_events_get(RealHandle); + } + set + { + Interop.Evas.evas_object_propagate_events_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether an object is set to pass (ignore) events. + /// + public bool PassEvents + { + get + { + return Interop.Evas.evas_object_pass_events_get(RealHandle); + } + set + { + Interop.Evas.evas_object_pass_events_set(RealHandle, value); + } + } + + /// + /// Sets or Gets style for this object tooltip. + /// + public string TooltipStyle + { + get + { + return Interop.Elementary.elm_object_tooltip_style_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_tooltip_style_set(RealHandle, value); + } + } + + /// + /// Sets or gets the orientation of Tooltip. + /// + public TooltipOrientation TooltipOrientation + { + get + { + return (TooltipOrientation)Interop.Elementary.elm_object_tooltip_orient_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_tooltip_orient_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets size restriction state of an object's tooltip. + /// + public bool TooltipWindowMode + { + get + { + return Interop.Elementary.elm_object_tooltip_window_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_tooltip_window_mode_set(RealHandle, value); + } + } + + /// + /// Sets the content to be shown in the tooltip object. + /// + public GetTooltipContentDelegate TooltipContentDelegate + { + get + { + return _tooltipContentDelegate; + } + set + { + _tooltipContentDelegate = value; + if (value != null) + { + Interop.Elementary.elm_object_tooltip_content_cb_set(RealHandle, _tooltipContentCallback, IntPtr.Zero, null); + } + else + { + Interop.Elementary.elm_object_tooltip_content_cb_set(RealHandle, null, IntPtr.Zero, null); + } + } + } + + /// + /// Gets the movement freeze by 1 + /// This gets the movement freeze count by one. + /// + public int TooltipMoveFreezeCount + { + get + { + return Interop.Elementary.elm_object_tooltip_move_freeze_get(RealHandle); + } + } + + /// + /// Sets or gets whether an Evas object is to freeze (discard) events. + /// + public bool AllEventsFrozen + { + get + { + return Interop.Evas.evas_object_freeze_events_get(RealHandle); + } + set + { + Interop.Evas.evas_object_freeze_events_set(RealHandle, value); + } + } + + /// + /// Sets or gets the layer of its canvas that the given object will be part of. + /// + public virtual int Layer + { + get + { + return Interop.Evas.evas_object_layer_get(Handle); + } + set + { + Interop.Evas.evas_object_layer_set(Handle, value); + } + } + + /// + /// Clips one object to another. + /// + /// The object to clip object by + public void SetClip(EvasObject clip) + { + Interop.Evas.evas_object_clip_set(Handle, clip); + } + + /// + /// Sets the hints for an object's alignment. + /// + /// The horizontal alignment hint as double value ranging from 0.0 to 1.0,The default alignment hint value is 0.5 + /// The vertical alignment hint as double value ranging from 0.0 to 1.0,The default alignment hint value is 0.5 + public void SetAlignment(double x, double y) + { + Interop.Evas.evas_object_size_hint_align_set(Handle, x, y); + } + + /// + /// Sets the hints for an object's weight. + /// + /// The non-negative double value to use as horizontal weight hint + /// The non-negative double value to use as vertical weight hint + public void SetWeight(double x, double y) + { + Interop.Evas.evas_object_size_hint_weight_set(Handle, x, y); + } + + /// + /// Sets the text for an object's tooltip. + /// + /// The text value to display inside the tooltip + public void SetTooltipText(string text) + { + Interop.Elementary.elm_object_tooltip_text_set(RealHandle, text); + } + + /// + /// Unsets an object's tooltip. + /// + public void UnsetTooltip() + { + Interop.Elementary.elm_object_tooltip_unset(RealHandle); + } + + /// + /// This increments the tooltip movement freeze count by one. + /// If the count is more than 0, the tooltip position will be fixed. + /// + public void PushTooltipMoveFreeze() + { + Interop.Elementary.elm_object_tooltip_move_freeze_push(RealHandle); + } + + /// + /// This decrements the tooltip freeze count by one. + /// + public void PopTooltipMoveFreeze() + { + Interop.Elementary.elm_object_tooltip_move_freeze_pop(RealHandle); + } + + /// + /// Force hide tooltip of object. + /// + public void HideTooltip() + { + Interop.Elementary.elm_object_tooltip_hide(RealHandle); + } + + /// + /// Force show tooltip of object. + /// + public void ShowTooltip() + { + Interop.Elementary.elm_object_tooltip_show(RealHandle); + } + + /// + /// Makes the current object visible. + /// + public void Show() + { + Interop.Evas.evas_object_show(Handle); + } + + /// + /// Makes the current object invisible. + /// + public void Hide() + { + Interop.Evas.evas_object_hide(Handle); + } + + /// + /// Changes the size of the current object. + /// + /// The new width + /// The new height + public void Resize(int w, int h) + { + Interop.Evas.evas_object_resize(Handle, w, h); + } + + /// + /// Moves the current object to the given location. + /// + /// The X position to move the object to. + /// The Y position to move the object to. + public void Move(int x, int y) + { + Interop.Evas.evas_object_move(Handle, x, y); + } + + /// + /// Lowers obj to the bottom of its layer. + /// + public void Lower() + { + Interop.Evas.evas_object_lower(Handle); + } + + /// + /// Define IntPtr operator + /// + /// Parent object + public static implicit operator IntPtr(EvasObject obj) + { + if (obj == null) + return IntPtr.Zero; + return obj.Handle; + } + + /// + /// Requests keyname key events be directed to current obj. + /// + /// The key to request events for + /// Set TRUE to request that the obj is the only object receiving the keyname events,otherwise set FALSE + /// If the call succeeded is true,otherwise is false + public bool KeyGrab(string keyname, bool exclusive) + { + return Interop.Evas.evas_object_key_grab(Handle, keyname, 0, 0, exclusive); + } + + /// + /// Removes the grab on keyname key events. + /// + /// The key the grab is set for + public void KeyUngrab(string keyname) + { + Interop.Evas.evas_object_key_ungrab(Handle, keyname, 0, 0); + } + + /// + /// Mark smart object as changed. + /// + public void MarkChanged() + { + Interop.Evas.evas_object_smart_changed(RealHandle); + } + + /// + /// Call the calculate smart function immediately. + /// This will force immediate calculations needed for renderization of this object. + /// + public void Calculate() + { + Interop.Evas.evas_object_smart_calculate(RealHandle); + } + + /// + /// Sets the hints for an object's aspect ratio. + /// + /// The policy or type of aspect ratio to apply to object + /// The integer to use as aspect width ratio term + /// The integer to use as aspect height ratio term + public void SetSizeHintAspect(AspectControl aspect, int w, int h) + { + Interop.Evas.evas_object_size_hint_aspect_set(Handle, (int)aspect, w, h); + } + + /// + /// Gets the hints for an object's aspect ratio. + /// + /// The policy or type of aspect ratio to apply to object + /// The integer to use as aspect width ratio term + /// The integer to use as aspect height ratio term + public void GetSizeHintAspect(out AspectControl aspect, out int w, out int h) + { + int aspectRatio; + Interop.Evas.evas_object_size_hint_aspect_get(Handle, out aspectRatio, out w, out h); + aspect = (AspectControl)aspectRatio; + } + + /// + /// Stack immediately below anchor. + /// + /// The object below which to stack. + public void StackBelow(EvasObject anchor) + { + Interop.Evas.evas_object_stack_below(Handle, anchor); + } + + /// + /// Stack immediately above anchor. + /// + /// The object above which to stack. + public void StackAbove(EvasObject anchor) + { + Interop.Evas.evas_object_stack_above(Handle, anchor); + } + + /// + /// Raise to the top of its layer. + /// + public void RaiseTop() + { + Interop.Evas.evas_object_raise(Handle); + } + + /// + /// Get the geometry of a line number. + /// + /// the line number. + /// x coord of the line. + /// y coord of the line. + /// w coord of the line. + /// h coord of the line. + /// + public bool GetTextBlockGeometryByLineNumber(int lineNumber, out int x, out int y, out int w, out int h) + { + return Interop.Evas.evas_object_textblock_line_number_geometry_get(RealHandle, lineNumber, out x, out y, out w, out h); + } + + internal IntPtr GetData(string key) + { + return Interop.Evas.evas_object_data_get(RealHandle, key); + } + + internal void SetData(string key, IntPtr data) + { + Interop.Evas.evas_object_data_set(RealHandle, key, data); + } + + internal IntPtr DeleteData(string key) + { + return Interop.Evas.evas_object_data_del(RealHandle, key); + } + + /// + /// The callback of Invalidate Event + /// + protected virtual void OnInvalidate() + { + } + + /// + /// The callback of Instantiated Event + /// + protected virtual void OnInstantiated() + { + } + + /// + /// The callback of Realized Event + /// + protected virtual void OnRealized() + { + } + + /// + /// The callback of Unrealize Event + /// + protected virtual void OnUnrealize() + { + } + + /// + /// Creates a widget handle. + /// + /// Parent EvasObject + /// Handle IntPtr + protected abstract IntPtr CreateHandle(EvasObject parent); + + /// + /// For this object bind Parent object.Init handle and all kinds of EvasObjectEvent. + /// + /// Parent object + public void Realize(EvasObject parent) + { + if (!IsRealized) + { + Parent = parent; + Handle = CreateHandle(parent); + Debug.Assert(Handle != IntPtr.Zero); + + (parent as Window)?.AddChild(this); + + OnRealized(); + _deleted = new EvasObjectEvent(this, EvasObjectCallbackType.Del); + _keydown = new EvasObjectEvent(this, RealHandle, EvasObjectCallbackType.KeyDown, EvasKeyEventArgs.Create); + _keyup = new EvasObjectEvent(this, RealHandle, EvasObjectCallbackType.KeyUp, EvasKeyEventArgs.Create); + _moved = new EvasObjectEvent(this, EvasObjectCallbackType.Move); + _resized = new EvasObjectEvent(this, EvasObjectCallbackType.Resize); + + _deleted.On += (s, e) => MakeInvalidate(); + _keydown.On += (s, e) => KeyDown?.Invoke(this, e); + _keyup.On += (s, e) => KeyUp?.Invoke(this, e); + } + } + + /// + /// Removes current object relationship with others. + /// + public void Unrealize() + { + if (IsRealized) + { + if (_renderPostCallback != null) + { + Interop.Evas.evas_event_callback_del(Interop.Evas.evas_object_evas_get(Handle), Interop.Evas.ObjectCallbackType.RenderPost, _renderPostCallback); + _renderPostCallback = null; + } + + OnUnrealize(); + IntPtr toBeDeleted = Handle; + Handle = IntPtr.Zero; + + DisposeEvent(); + + (Parent as Window)?.RemoveChild(this); + + Interop.Evas.evas_object_del(toBeDeleted); + Parent = null; + } + } + + private void MakeInvalidate() + { + Deleted?.Invoke(this, EventArgs.Empty); + OnInvalidate(); + Handle = IntPtr.Zero; + + MakeInvalidateEvent(); + + (Parent as Window)?.RemoveChild(this); + Parent = null; + _deleted = null; + } + + private void DisposeEvent() + { + foreach (var evt in _eventStore) + { + evt.Dispose(); + } + _eventStore.Clear(); + } + + private void MakeInvalidateEvent() + { + foreach (var evt in _eventStore) + { + evt.MakeInvalidate(); + } + _eventStore.Clear(); + } + + internal void AddToEventLifeTracker(IInvalidatable item) + { + _eventStore.Add(item); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/EvasObjectEvent.cs b/src/ElmSharp/ElmSharp/EvasObjectEvent.cs new file mode 100644 index 0000000..6799be3 --- /dev/null +++ b/src/ElmSharp/ElmSharp/EvasObjectEvent.cs @@ -0,0 +1,446 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace ElmSharp +{ + /// + /// IInvalidatable is a interface which can be overrided by its children class. + /// Inherits IDisposable + /// + public interface IInvalidatable : IDisposable + { + void MakeInvalidate(); + } + + /// + /// Enumeration for EvasObjectCallbackType + /// + public enum EvasObjectCallbackType + { + /// + /// Mouse In Event CallbackType. + /// + MouseIn, + + /// + /// Mouse Out Event CallbackType + /// + MouseOut, + + /// + /// Mouse Button Down Event CallbackType + /// + MouseDown, + + /// + /// Mouse Button Up Event CallbackType + /// + MouseUp, + + /// + /// Mouse Move Event CallbackType + /// + MouseMove, + + /// + /// Mouse Wheel Event CallbackType + /// + MouseWheel, + + /// + /// Multi-touch Down Event CallbackType + /// + MultiDown, + + /// + /// Multi-touch Up Event CallbackType + /// + MultiUp, + + /// + /// Multi-touch Move Event CallbackType + /// + MultiMove, + + /// + /// Object Being Freed (Called after Del) + /// + Free, + + /// + /// Key Press Event CallbackType + /// + KeyDown, + + /// + /// Key Release Event CallbackType + /// + KeyUp, + + /// + /// Focus In Event CallbackType + /// + FocusIn, + + /// + /// Focus Out Event CallbackType + /// + FocusOut, + + /// + /// Show Event CallbackType + /// + Show, + + /// + /// Hide Event CallbackType + /// + Hide, + + /// + /// Move Event CallbackType + /// + Move, + + /// + /// Resize Event CallbackType + /// + Resize, + + /// + /// Restack Event CallbackType + /// + Restack, + + /// + /// Object Being Deleted (called before Free) + /// + Del, + + /// + /// Hold Event CallbackType, Informational purpose event to indicate something + /// + Hold, + + /// + /// Size hints changed Event CallbackType + /// + ChangedSizeHints, + + /// + /// Image has been preloaded + /// + ImagePreloaded, + + /// + /// Canvas got focus as a whole + /// + CanvasFocusIn, + + /// + /// Canvas lost focus as a whole + /// + CanvasFocusOut, + + /// + /// Called just before rendering is updated on the canvas target + /// + RenderFlushPre, + + /// + /// Called just after rendering is updated on the canvas target + /// + RenderFlushPost, + + /// + /// Canvas object got focus + /// + CanvasObjectFocusIn, + + /// + /// Canvas object lost focus + /// + CanvasObjectFocusOut, + + /// + /// Image data has been unloaded (by some mechanism in Evas that throw out original image data) + /// + ImageUnloaded, + + /// + /// Called just before rendering starts on the canvas target + /// + RenderPre, + + /// + /// Called just after rendering stops on the canvas target + /// + RenderPost, + + /// + /// Image size is changed + /// + ImageResize, + + /// + /// Devices added, removed or changed on canvas + /// + DeviceChanged, + + /// + /// Axis is changed + /// + AxisUpdate, + + /// + /// Canvas Viewport size is changed + /// + CanvasViewportResize + } + + /// + /// Event class for EvasObject + /// + /// Kinds of EventArgs + public class EvasObjectEvent : IInvalidatable where TEventArgs : EventArgs + { + /// + /// SmartEventInfoParser delegate of EvasObjectEvent class + /// + /// data + /// obj + /// info + /// delegate handle + public delegate TEventArgs SmartEventInfoParser(IntPtr data, IntPtr obj, IntPtr info); + + private bool _disposed = false; + private EvasObject _sender; + private IntPtr _handle; + private readonly EvasObjectCallbackType _type; + private readonly SmartEventInfoParser _parser; + private readonly List _nativeCallbacks = new List(); + + /// + /// Creates and initializes a new instance of the EvasObjectEvent. + /// + /// EvasObject class belong to + /// EvasObjectCallbackType + /// SmartEventInfoParser + public EvasObjectEvent(EvasObject sender, EvasObjectCallbackType type, SmartEventInfoParser parser) : this(sender, sender.Handle, type, parser) + { + } + + [EditorBrowsableAttribute(EditorBrowsableState.Never)] + public EvasObjectEvent(EvasObject sender, IntPtr handle, EvasObjectCallbackType type, SmartEventInfoParser parser) + { + _sender = sender; + _handle = handle; + _type = type; + _parser = parser; + sender.AddToEventLifeTracker(this); + } + + /// + /// Creates and initializes a new instance of the EvasObjectEvent. + /// + /// EvasObject class belong with + /// SmartEventInfoParser + public EvasObjectEvent(EvasObject sender, EvasObjectCallbackType type) : this(sender, type, null) + { + } + + ~EvasObjectEvent() + { + Dispose(false); + } + + private struct NativeCallback + { + public Interop.Evas.EventCallback callback; + public EventHandler eventHandler; + } + + /// + /// On Event Handler of EvasObjectEvent + /// + public event EventHandler On + { + add + { + if (_handle == IntPtr.Zero) + { + return; + } + EventHandler handler = value; + var cb = new Interop.Evas.EventCallback((data, evas, obj, info) => + { + TEventArgs ea = _parser == null ? (TEventArgs)EventArgs.Empty : _parser(data, obj, info); + handler(_sender, ea); + }); + _nativeCallbacks.Add(new NativeCallback { callback = cb, eventHandler = handler }); + int i = _nativeCallbacks.Count - 1; + Interop.Evas.evas_object_event_callback_add(_handle, (Interop.Evas.ObjectCallbackType)_type, _nativeCallbacks[i].callback, IntPtr.Zero); + } + + remove + { + if (_handle == IntPtr.Zero) + { + return; + } + EventHandler handler = value; + var callbacks = _nativeCallbacks.Where(cb => cb.eventHandler == handler); + foreach (var cb in callbacks) + { + Interop.Evas.evas_object_event_callback_del(_handle, (Interop.Evas.ObjectCallbackType)_type, cb.callback); + } + } + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // Place holder to dispose managed state (managed objects). + } + if (_handle != IntPtr.Zero) + { + foreach (var cb in _nativeCallbacks) + { + Interop.Evas.evas_object_event_callback_del(_handle, (Interop.Evas.ObjectCallbackType)_type, cb.callback); + } + } + _nativeCallbacks.Clear(); + _disposed = true; + } + } + + /// + /// Destroy Current Obj + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Make current instance invalidate + /// + public void MakeInvalidate() + { + _sender = null; + _handle = IntPtr.Zero; + } + } + + /// + /// Event class for EvasObject + /// + public class EvasObjectEvent : IInvalidatable + { + private EvasObjectEvent _evasObjectEvent; + + private event EventHandler _handlers; + + private bool _disposed = false; + + /// + /// Creates and initializes a new instance of the EvasObjectEvent. + /// + /// EvasObject class belong to + /// EvasObjectCallbackType + public EvasObjectEvent(EvasObject sender, EvasObjectCallbackType type) : this(sender, sender.Handle, type) + { + } + + [EditorBrowsableAttribute(EditorBrowsableState.Never)] + public EvasObjectEvent(EvasObject sender, IntPtr handle, EvasObjectCallbackType type) + { + _evasObjectEvent = new EvasObjectEvent(sender, handle, type, null); + } + + ~EvasObjectEvent() + { + Dispose(false); + } + + /// + /// On Event Handler of EvasObjectEvent + /// + public event EventHandler On + { + add + { + if (_handlers == null) + { + _evasObjectEvent.On += SendEvent; + } + _handlers += value; + } + + remove + { + _handlers -= value; + if (_handlers == null) + { + _evasObjectEvent.On -= SendEvent; + } + } + } + + private void SendEvent(object sender, EventArgs e) + { + _handlers?.Invoke(sender, e); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + _evasObjectEvent.Dispose(); + } + _disposed = true; + } + } + + /// + /// Destroy Current Obj + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Make current instance invalidate + /// + public void MakeInvalidate() + { + _evasObjectEvent.MakeInvalidate(); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/FlipSelector.cs b/src/ElmSharp/ElmSharp/FlipSelector.cs new file mode 100755 index 0000000..bffb713 --- /dev/null +++ b/src/ElmSharp/ElmSharp/FlipSelector.cs @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// A flip selector is a widget to show a set of text items,one at a time.with the same sheet switching style as the clock widget, when one changes the current displaying sheet. + /// + public class FlipSelector : Layout + { + SmartEvent _selected; + SmartEvent _overflowed; + SmartEvent _underflowed; + + /// + /// Creates and initializes a new instance of the FlipSelector. + /// + /// Parent EvasObject + public FlipSelector(EvasObject parent) : base(parent) + { + _selected = new SmartEvent(this, Handle, "selected"); + _overflowed = new SmartEvent(this, Handle, "overflowed"); + _underflowed = new SmartEvent(this, Handle, "underflowed"); + + _selected.On += SelectedChanged; + _overflowed.On += OverflowedChanged; + _underflowed.On += UnderflowedChanged; + } + + /// + /// Selected will be triggered when be Selected + /// + public event EventHandler Selected; + /// + /// Overflowed will be triggered when Overflowed + /// + public event EventHandler Overflowed; + /// + /// Underflowed will be triggered when be Underflowed + /// + public event EventHandler Underflowed; + + /// + /// Sets or gets the interval on time updates for an user mouse button hold on a flip selector widget. + /// + public double Interval + { + get + { + return Interop.Elementary.elm_flipselector_first_interval_get(Handle); + } + set + { + Interop.Elementary.elm_flipselector_first_interval_set(Handle, value); + } + } + + + /// + /// Gets the currently selected item in a flip selector widget. + /// + public FlipSelectorItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_flipselector_selected_item_get(Handle); + return ItemObject.GetItemByHandle(handle) as FlipSelectorItem; + } + } + + /// + /// Gets the first item in the given flip selector widget's list of items. + /// + public FlipSelectorItem FirstItem + { + get + { + IntPtr handle = Interop.Elementary.elm_flipselector_first_item_get(Handle); + return ItemObject.GetItemByHandle(handle) as FlipSelectorItem; + } + } + + /// + /// Gets the last item in the given flip selector widget's list of items. + /// + public FlipSelectorItem LastItem + { + get + { + IntPtr handle = Interop.Elementary.elm_flipselector_last_item_get(Handle); + return ItemObject.GetItemByHandle(handle) as FlipSelectorItem; + } + } + + /// + /// Appends a (text) item to a flip selector widget. + /// + /// text value + /// + /// A handle to the item added or NULL, on errors + /// + /// + /// The widget's list of labels to show will be appended with the given value. If the user wishes so, a callback function pointer can be passed, which will get called when this same item is selected. + /// + public FlipSelectorItem Append(string text) + { + FlipSelectorItem item = new FlipSelectorItem(text); + item.Handle = Interop.Elementary.elm_flipselector_item_append(Handle, text, null, (IntPtr)item.Id); + return item; + } + + /// + /// Prepend a (text) item to a flip selector widget. + /// + /// Prepend text + /// A handle to the item added or NULL, on errors + /// + /// The widget's list of labels to show will be prepended with the given value. If the user wishes so, a callback function pointer can be passed, which will get called when this same item is selected. + /// + public FlipSelectorItem Prepend(string text) + { + FlipSelectorItem item = new FlipSelectorItem(text); + item.Handle = Interop.Elementary.elm_flipselector_item_prepend(Handle, text, null, (IntPtr)item.Id); + return item; + } + + /// + /// To remove the given item. + /// + /// FlipSelector's item + public void Remove(FlipSelectorItem item) + { + if (item as FlipSelectorItem != null) + item.Delete(); + } + + /// + /// Programmatically select the next item of a flip selector widget. + /// + /// + /// The selection will be animated. Also, if it reaches the beginning of its list of member items, it will continue with the last one backwards. + /// + public void Next() + { + Interop.Elementary.elm_flipselector_flip_next(Handle); + } + + /// + /// Programmatically select the previous item of a flip selector widget. + /// + public void Prev() + { + Interop.Elementary.elm_flipselector_flip_prev(Handle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_flipselector_add(parent.Handle); + } + + void SelectedChanged(object sender, EventArgs e) + { + SelectedItem?.SendSelected(); + Selected?.Invoke(this, EventArgs.Empty); + } + + void OverflowedChanged(object sender, EventArgs e) + { + Overflowed?.Invoke(this, e); + } + + void UnderflowedChanged(object sender, EventArgs e) + { + Underflowed?.Invoke(this, e); + } + } +} diff --git a/src/ElmSharp/ElmSharp/FlipSelectorItem.cs b/src/ElmSharp/ElmSharp/FlipSelectorItem.cs new file mode 100755 index 0000000..3210e3b --- /dev/null +++ b/src/ElmSharp/ElmSharp/FlipSelectorItem.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Iterm class of FlipSelector + /// + public class FlipSelectorItem : ItemObject + { + /// + /// Sets or gets the Text of FlipSelectorItem + /// + public string Text { get; private set; } + + /// + /// Selected will be triggered when Selected + /// + public event EventHandler Selected; + + /// + /// Creates and initializes a new instance of the FlipSelectorItem. + /// + /// FlipSelectorItem's text + public FlipSelectorItem(string text) : base(IntPtr.Zero) + { + Text = text; + } + + internal void SendSelected() + { + Selected?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/src/ElmSharp/ElmSharp/FloatingButton.cs b/src/ElmSharp/ElmSharp/FloatingButton.cs new file mode 100755 index 0000000..5252a1f --- /dev/null +++ b/src/ElmSharp/ElmSharp/FloatingButton.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The FloatingButton is a widget that to add floating area for buttons. + /// + public class FloatingButton : Layout + { + /// + /// Creates and initializes a new instance of the FloatingButton class. + /// + /// Created on this parent container.. + public FloatingButton(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets floatingbutton mode. + /// + public FloatingButtonMode Mode + { + get + { + return (FloatingButtonMode)Interop.Eext.eext_floatingbutton_mode_get(Handle); + } + set + { + Interop.Eext.eext_floatingbutton_mode_set(Handle, (int)value); + } + } + + /// + /// Gets floatingbutton Position. + /// + public FloatingButtonPosition Position + { + get + { + return (FloatingButtonPosition)Interop.Eext.eext_floatingbutton_pos_get(Handle); + } + } + + /// + /// Sets or gets movability for a given floatingbutton widget. + /// + public bool MovementBlock + { + get + { + return Interop.Eext.eext_floatingbutton_movement_block_get(Handle); + } + set + { + Interop.Eext.eext_floatingbutton_movement_block_set(Handle, value); + } + } + + /// + /// Get Opacity's value of the given FloatingButton. + /// + public override int Opacity + { + get + { + return Color.Default.A; + } + + set + { + Console.WriteLine("FloatingButton instance doesn't support to set Opacity."); + } + } + + /// + /// Set the floatingbutton position with animation or not. + /// + /// Button position + /// Animat flag + public void SetPosition(FloatingButtonPosition position, bool animated) + { + if (animated) + { + Interop.Eext.eext_floatingbutton_pos_bring_in(Handle, (int)position); + } + else + { + Interop.Eext.eext_floatingbutton_pos_set(Handle, (int)position); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Eext.eext_floatingbutton_add(parent.Handle); + } + } + + /// + /// Enumeration for FloatingButtonMode + /// + public enum FloatingButtonMode + { + /// + /// Allows all positions + /// + All, + + /// + /// Allows LEFT and RIGHT positions only + /// + LeftRightOnly, + } + + /// + /// Enumeration for FloatingButtonPosition + /// + public enum FloatingButtonPosition + { + /// + /// Hides in the left, but small handler will show only + /// + LeftOut, + + /// + /// Shows all of buttons, but lies on the left + /// + Left, + + /// + /// Shows all of buttons, but lies on the center + /// + Center, + + /// + /// Shows all of buttons, but lies on the right + /// + Right, + + /// + /// Hides in the right, but small handler will show only + /// + RightOut, + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenGrid.cs b/src/ElmSharp/ElmSharp/GenGrid.cs new file mode 100644 index 0000000..2b1a6ee --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenGrid.cs @@ -0,0 +1,606 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// It inherits System.EventArgs. + /// It contains Item which is type. + /// All events of GenGrid contain GenGridItemEventArgs as a parameter. + /// + public class GenGridItemEventArgs : EventArgs + { + /// + /// Gets or sets GenGrid item.The return type is . + /// + public GenGridItem Item { get; set; } + + internal static GenGridItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + GenGridItem item = ItemObject.GetItemByHandle(info) as GenGridItem; + return new GenGridItemEventArgs() { Item = item }; + } + } + + /// + /// It inherits . + /// The GenGrid is a widget that aims to position objects in a grid layout while actually creating and rendering only the visible ones. + /// It has two direction in which a given GenGrid widget expands while placing its items, horizontal and vertical. + /// The GenGrid items are represented through definition field details. + /// + public class GenGrid : Layout + { + HashSet _children = new HashSet(); + + SmartEvent _selected; + SmartEvent _unselected; + SmartEvent _activated; + SmartEvent _pressed; + SmartEvent _released; + SmartEvent _doubleClicked; + SmartEvent _realized; + SmartEvent _unrealized; + SmartEvent _longpressed; + SmartEvent _changed; + + /// + /// Creates and initializes a new instance of the GenGrid class. + /// + /// The parent is a given container which will be attached by GenGrid as a child. It's type. + public GenGrid(EvasObject parent) : base(parent) + { + InitializeSmartEvent(); + } + + /// + /// ItemSelected is raised when a new gengrid item is selected. + /// + public event EventHandler ItemSelected; + + /// + /// ItemUnselected is raised when the gengrid item is Unselected. + /// + public event EventHandler ItemUnselected; + + /// + /// ItemPressed is raised when a new gengrid item is pressed. + /// + public event EventHandler ItemPressed; + + /// + /// ItemReleased is raised when a new gengrid item is released. + /// + public event EventHandler ItemReleased; + + /// + /// ItemActivated is raised when a new gengrid item is double clicked or pressed (enter|return|spacebar). + /// + public event EventHandler ItemActivated; + + /// + /// ItemDoubleClicked is raised when a new gengrid item is double clicked. + /// + public event EventHandler ItemDoubleClicked; + + /// + /// ItemRealized is raised when a gengrid item is implementing through . + /// + public event EventHandler ItemRealized; + + /// + /// ItemUnrealized is raised when the gengrid item is deleted. + /// + public event EventHandler ItemUnrealized; + + /// + /// ItemLongPressed is raised when a gengrid item is pressed for a certain amount of time. By default it's 1 second. + /// + public event EventHandler ItemLongPressed; + + /// + /// Changed is raised when an item is added, removed, resized or moved and when the gengrid is resized or gets "horizontal" property changes. + /// + public event EventHandler Changed; + + /// + /// Gets or sets the item's grid alignment along x-axis within a given gengrid widget. + /// Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users. + /// By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the left along x-axis. + /// + public double ItemAlignmentX + { + get + { + double align; + Interop.Elementary.elm_gengrid_align_get(RealHandle, out align, IntPtr.Zero); + return align; + } + set + { + double aligny = ItemAlignmentY; + Interop.Elementary.elm_gengrid_align_set(RealHandle, value, aligny); + } + } + + /// + /// Gets or sets the item's grid alignment on y-axis within a given gengrid widget. + /// Accepted values are in the 0.0 to 1.0 range, with the special value -1.0 used to specify "justify" or "fill" by some users. + /// By default, value is 0.0, meaning that the gengrid has its items grid placed exactly in the top along y-axis. + /// + public double ItemAlignmentY + { + get + { + double align; + Interop.Elementary.elm_gengrid_align_get(RealHandle, IntPtr.Zero, out align); + return align; + } + set + { + double alignx = ItemAlignmentX; + Interop.Elementary.elm_gengrid_align_set(RealHandle, alignx, value); + } + } + + /// + /// Gets or sets the manner in which the items grid is filled within a given gengrid widget. + /// It is filled if true, otherwise false. + /// + public bool FillItems + { + get + { + return Interop.Elementary.elm_gengrid_filled_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_filled_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether multi-selection is enabled or disabled for a given gengrid widget. + /// + /// + /// Multi-selection is the ability to have more than one item selected, on a given gengrid, simultaneously. + /// When it is enabled, a sequence of clicks on different items makes them all selected, progressively. + /// A click on an already selected item unselects it. If interacting via the keyboard, multi-selection is enabled while holding the "Shift" key. + /// By default, multi-selection is disabled. + /// + public bool MultipleSelection + { + get + { + return Interop.Elementary.elm_gengrid_multi_select_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_multi_select_set(RealHandle, value); + } + } + + /// + /// Gets or sets the width for the items of a given gengrid widget. + /// + /// + /// A gengrid, after creation, still has no information on the size to give to each of its cells. + /// The default width and height just have one finger wide. + /// Use this property to force a custom width for your items, making them as big as you wish. + /// + public int ItemWidth + { + get + { + int width; + Interop.Elementary.elm_gengrid_item_size_get(RealHandle, out width, IntPtr.Zero); + return width; + } + set + { + int height = ItemHeight; + Interop.Elementary.elm_gengrid_item_size_set(RealHandle, value, height); + } + } + + /// + /// Gets or sets the height for the items of a given gengrid widget. + /// + /// + /// A gengrid, after creation, still has no information on the size to give to each of its cells. + /// The default width and height just have one finger wide. + /// Use this property to force a custom height for your items, making them as big as you wish. + /// + public int ItemHeight + { + get + { + int height; + Interop.Elementary.elm_gengrid_item_size_get(RealHandle, IntPtr.Zero, out height); + return height; + } + set + { + int width = ItemWidth; + Interop.Elementary.elm_gengrid_item_size_set(RealHandle, width, value); + } + } + + /// + /// Gets or sets the gengrid select mode by . + /// + public GenItemSelectionMode SelectionMode + { + get + { + return (GenItemSelectionMode)Interop.Elementary.elm_gengrid_select_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_select_mode_set(RealHandle, (int)value); + } + } + + /// + /// Gets or sets the direction for which a given gengrid widget expands while placing its items. + /// + /// + /// If true, items are placed in columns from top to bottom and when the space for a column is filled, another one is started on the right, thus expanding the grid horizontally. + /// If false, items are placed in rows from left to right, and when the space for a row is filled, another one is started below, thus expanding the grid vertically. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_gengrid_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_horizontal_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether the gengrid items should be highlighted when an item is selected. + /// + public bool IsHighlight + { + get + { + return Interop.Elementary.elm_gengrid_highlight_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_highlight_mode_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value of HorizontalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Elementary.elm_scroller_policy_get(RealHandle, out policy, IntPtr.Zero); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy; + Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)value, (int)v); + } + } + + /// + /// Sets or gets the value of VerticalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Elementary.elm_scroller_policy_get(RealHandle, IntPtr.Zero, out policy); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy; + Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)h, (int)value); + } + } + + /// + /// Gets the first item in a given gengrid widget. + /// + public GenGridItem FirstItem + { + get + { + IntPtr handle = Interop.Elementary.elm_gengrid_first_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenGridItem; + } + } + + /// + /// Gets the last item in a given gengrid widget. + /// + public GenGridItem LastItem + { + get + { + IntPtr handle = Interop.Elementary.elm_gengrid_last_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenGridItem; + } + } + + /// + /// Gets the items count in a given gengrid widget. + /// + public uint ItemCount + { + get + { + return Interop.Elementary.elm_gengrid_items_count(RealHandle); + } + } + + /// + /// Gets the selected item in a given gengrid widget. + /// + public GenGridItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_gengrid_selected_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenGridItem; + } + } + + /// + /// Gets or sets whether a given gengrid widget is or not able have items reordered. + /// + public bool ReorderMode + { + get + { + return Interop.Elementary.elm_gengrid_reorder_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_gengrid_reorder_mode_set(RealHandle, value); + } + } + + /// + /// Appends a new item to a given gengrid widget. This adds an item to the end of the gengrid. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// Return a gengrid item that contains data and itemClass. + /// + /// + public GenGridItem Append(GenItemClass itemClass, object data) + { + GenGridItem item = new GenGridItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_gengrid_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Prepends a new item to a given gengrid widget. This adds an item to the beginning of the gengrid. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// Return a gengrid item that contains data and itemClass. + /// + /// + public GenGridItem Prepend(GenItemClass itemClass, object data) + { + GenGridItem item = new GenGridItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_gengrid_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Inserts an item before another in a gengrid widget. This inserts an item before another in the gengrid. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item before which to place this new one. + /// Return a gengrid item that contains data and itemClass./> + /// + /// + public GenGridItem InsertBefore(GenItemClass itemClass, object data, GenGridItem before) + { + GenGridItem item = new GenGridItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_gengrid_item_insert_before(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, before, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Inserts an item before another in a gengrid widget. This inserts an item after another in the gengrid. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item after which to place this new one. + /// Return a gengrid item that contains data and itemClass. + /// + /// + public GenGridItem InsertAfter(GenItemClass itemClass, object data, GenGridItem after) + { + GenGridItem item = new GenGridItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_gengrid_item_insert_after(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, after, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Insert an item in a gengrid widget using a user-defined sort function. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// User defined comparison function that defines the sort order based on gengrid item and its data. + /// Return a gengrid item that contains data and itemClass. + public GenGridItem InsertSorted(GenItemClass itemClass, object data, Comparison comparison) + { + GenGridItem item = new GenGridItem(data, itemClass); + + Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) => + { + GenGridItem first = (ItemObject.GetItemByHandle(handle1) as GenGridItem) ?? item; + GenGridItem second = (ItemObject.GetItemByHandle(handle2) as GenGridItem) ?? item; + return comparison(first.Data, second.Data); + }; + + IntPtr handle = Interop.Elementary.elm_gengrid_item_sorted_insert(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, compareCallback, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Shows a given item to the visible area of a gengrid. + /// + /// The gengrid item to display. + /// The position of the item in the viewport. + /// The type of how to show the item. + /// + /// If animated is true, the gengrid shows item by scrolling if it's not fully visible. + /// If animated is false, the gengrid shows item by jumping if it's not fully visible. + /// + /// + public void ScrollTo(GenGridItem item, ScrollToPosition position, bool animated) + { + if (animated) + { + Interop.Elementary.elm_gengrid_item_bring_in(item.Handle, (int)position); + } + else + { + Interop.Elementary.elm_gengrid_item_show(item.Handle, (int)position); + } + } + + /// + /// Updates the contents of all the realized items. + /// This updates all realized items by calling all the again to get the content, text, and states. + /// Use this when the original item data has changed and the changes are desired to reflect. + /// + /// + /// to update just one item. + /// + public void UpdateRealizedItems() + { + Interop.Elementary.elm_gengrid_realized_items_update(RealHandle); + } + + /// + /// Removes all items from a given gengrid widget. + /// This removes(and deletes) all items in obj, making it empty. + /// + /// + /// to delete just one item. + /// + public void Clear() + { + Interop.Elementary.elm_gengrid_clear(RealHandle); + } + + /// + /// Get the item that is at the x, y canvas coords. + /// + /// The input x coordinate + /// The input y coordinate + /// The position relative to the item returned here. + /// -1, 0 or 1, depending if the coordinate is on the left portion of that item(-1), on the middle section(0) or on the right part(1). + /// + /// The position relative to the item returned here + /// -1, 0 or 1, depending if the coordinate is on the upper portion of that item (-1), on the middle section (0) or on the lower part (1). + /// + /// + public GenGridItem GetItemByPosition(int x, int y, out int portionX, out int portionY) + { + IntPtr handle = Interop.Elementary.elm_gengrid_at_xy_item_get(RealHandle, x, y, out portionX, out portionY); + return ItemObject.GetItemByHandle(handle) as GenGridItem; + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_gengrid_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + void InitializeSmartEvent() + { + _selected = new SmartEvent(this, this.RealHandle, "selected", GenGridItemEventArgs.CreateFromSmartEvent); + _unselected = new SmartEvent(this, this.RealHandle, "unselected", GenGridItemEventArgs.CreateFromSmartEvent); + _activated = new SmartEvent(this, this.RealHandle, "activated", GenGridItemEventArgs.CreateFromSmartEvent); + _pressed = new SmartEvent(this, this.RealHandle, "pressed", GenGridItemEventArgs.CreateFromSmartEvent); + _released = new SmartEvent(this, this.RealHandle, "released", GenGridItemEventArgs.CreateFromSmartEvent); + _doubleClicked = new SmartEvent(this, this.RealHandle, "clicked,double", GenGridItemEventArgs.CreateFromSmartEvent); + _realized = new SmartEvent(this, this.RealHandle, "realized", GenGridItemEventArgs.CreateFromSmartEvent); + _unrealized = new SmartEvent(this, this.RealHandle, "unrealized", GenGridItemEventArgs.CreateFromSmartEvent); + _longpressed = new SmartEvent(this, this.RealHandle, "longpressed", GenGridItemEventArgs.CreateFromSmartEvent); + _changed = new SmartEvent(this, this.RealHandle, "changed"); + + _selected.On += (s, e) => { if (e.Item != null) ItemSelected?.Invoke(this, e); }; + _unselected.On += (s, e) => { if (e.Item != null) ItemUnselected?.Invoke(this, e); }; + _activated.On += (s, e) => { if (e.Item != null) ItemActivated?.Invoke(this, e); }; + _pressed.On += (s, e) => { if (e.Item != null) ItemPressed?.Invoke(this, e); }; + _released.On += (s, e) => { if (e.Item != null) ItemReleased?.Invoke(this, e); }; + _doubleClicked.On += (s, e) => { if (e.Item != null) ItemDoubleClicked?.Invoke(this, e); }; + _realized.On += (s, e) => { if (e.Item != null) ItemRealized?.Invoke(this, e); }; + _unrealized.On += (s, e) => { if (e.Item != null) ItemUnrealized?.Invoke(this, e); }; + _longpressed.On += (s, e) => { if (e.Item != null) ItemLongPressed?.Invoke(this, e); }; + _changed.On += (s, e) => { Changed?.Invoke(this, e); }; + } + + void AddInternal(GenGridItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((GenGridItem)sender); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenGridItem.cs b/src/ElmSharp/ElmSharp/GenGridItem.cs new file mode 100644 index 0000000..afdede0 --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenGridItem.cs @@ -0,0 +1,183 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; + +namespace ElmSharp +{ + /// + /// It inherits . + /// A instance to the gengrid item added. + /// It contains Update() method to update a gengrid item which is given. + /// + public class GenGridItem : GenItem + { + internal GenGridItem(object data, GenItemClass itemClass) : base(data, itemClass) + { + } + + /// + /// Gets or sets whether a given gengrid item is selected. + /// If one gengrid item is selected, any other previously selected items get unselected in favor of this new one. + /// + /// + /// If true, it is selected. + /// If false, it is unselected. + /// + public override bool IsSelected + { + get + { + return Interop.Elementary.elm_gengrid_item_selected_get(Handle); + } + set + { + Interop.Elementary.elm_gengrid_item_selected_set(Handle, value); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override string Cursor + { + get + { + return Interop.Elementary.elm_gengrid_item_cursor_get(Handle); + } + set + { + if (!string.IsNullOrEmpty(value)) + { + Interop.Elementary.elm_gengrid_item_cursor_set(Handle, value); + } + else + { + Interop.Elementary.elm_gengrid_item_cursor_unset(Handle); + } + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override string CursorStyle + { + get + { + return Interop.Elementary.elm_gengrid_item_cursor_style_get(Handle); + } + set + { + Interop.Elementary.elm_gengrid_item_cursor_style_set(Handle, value); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsUseEngineCursor + { + get + { + return Interop.Elementary.elm_gengrid_item_cursor_engine_only_get(Handle); + } + set + { + Interop.Elementary.elm_gengrid_item_cursor_engine_only_set(Handle, value); + } + } + + /// + /// Gets or sets the style of given gengrid item's tooltip. + /// + public override string TooltipStyle + { + get + { + return Interop.Elementary.elm_gengrid_item_tooltip_style_get(Handle); + } + set + { + Interop.Elementary.elm_gengrid_item_tooltip_style_set(Handle, value); + } + } + + public override GenItemSelectionMode SelectionMode + { + get + { + return (GenItemSelectionMode)Interop.Elementary.elm_gengrid_item_select_mode_get(Handle); + } + set + { + Interop.Elementary.elm_gengrid_item_select_mode_set(Handle, (Interop.Elementary.Elm_Object_Select_Mode)value); + } + } + + /// + /// Gets or sets gengrid item's row position, relative to the whole gengrid's grid area. + /// + public int Row + { + get + { + int row, column; + Interop.Elementary.elm_gengrid_item_pos_get(Handle, out row, out column); + return row; + } + } + + /// + /// Gets or sets gengrid item's column position, relative to the whole gengrid's grid area. + /// + public int Column + { + get + { + int row, column; + Interop.Elementary.elm_gengrid_item_pos_get(Handle, out row, out column); + return column; + } + } + + public override void SetTooltipText(string tooltip) + { + Interop.Elementary.elm_gengrid_item_tooltip_text_set(Handle, tooltip); + } + + public override void UnsetTooltip() + { + Interop.Elementary.elm_gengrid_item_tooltip_unset(Handle); + } + + /// + /// Updates the content of a given gengrid item. + /// This updates an item by calling all the genitem class functions again to get the content, text, and states. + /// Use this when the original item data has changed and you want the changes to reflect. + /// + /// + /// to update the contents of all the realized items. + /// + public override void Update() + { + Interop.Elementary.elm_gengrid_item_update(Handle); + } + + protected override void UpdateTooltipDelegate() + { + Interop.Elementary.elm_gengrid_item_tooltip_content_cb_set(Handle, + TooltipContentDelegate != null ? _tooltipCb : null, + IntPtr.Zero, + null); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenItem.cs b/src/ElmSharp/ElmSharp/GenItem.cs new file mode 100644 index 0000000..ac609b0 --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenItem.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + public enum GenItemSelectionMode + { + /// + /// Default select mode. + /// + Default, + + /// + /// Always select mode. + /// + Always, + + /// + /// No select mode. + /// + None, + + /// + /// No select mode with no finger size rule. + /// + DisplayOnly + } + + /// + /// It inherits . + /// A base class for and . + /// It contains genitem class and data to display data. + /// + public abstract class GenItem : ItemObject + { + internal Interop.Elementary.Elm_Tooltip_Item_Content_Cb _tooltipCb; + GetTooltipContentDelegate _tooltipContentDelegate = null; + + /// + /// The delegate returning the tooltip contents. + /// + public delegate EvasObject GetTooltipContentDelegate(); + + internal GenItem(object data, GenItemClass itemClass) : base(IntPtr.Zero) + { + Data = data; + ItemClass = itemClass; + _tooltipCb = (d, obj, tooltip, item) => { return TooltipContentDelegate(); }; + } + + /// + /// Gets the item class that defines how to display data. It returns type. + /// + public GenItemClass ItemClass { get; protected set; } + + /// + /// It's a abstract property. It's implemented by and . + /// + public GetTooltipContentDelegate TooltipContentDelegate + { + get + { + return _tooltipContentDelegate; + } + set + { + _tooltipContentDelegate = value; + UpdateTooltipDelegate(); + } + } + + public abstract GenItemSelectionMode SelectionMode { get; set; } + + public abstract string Cursor { get; set; } + public abstract string CursorStyle { get; set; } + + public abstract bool IsUseEngineCursor { get; set; } + + /// + /// Gets item data that is added through calling , or methods. + /// + public object Data { get; protected set; } + + /// + /// It's a abstract property. It's implemented by and . + /// + public abstract bool IsSelected { get; set; } + + /// + /// It's a abstract property. It's implemented by and . + /// + public abstract string TooltipStyle { get; set; } + + public abstract void SetTooltipText(string tooltip); + public abstract void UnsetTooltip(); + + /// + /// It's a abstract method. It's implemented by and . + /// + public abstract void Update(); + + /// + /// The override method for delete item class and item data. It's called when the item is deleting. + /// + protected override void OnInvalidate() + { + ItemClass?.SendItemDeleted(Data); + Data = null; + ItemClass = null; + } + + protected abstract void UpdateTooltipDelegate(); + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenItemClass.cs b/src/ElmSharp/ElmSharp/GenItemClass.cs new file mode 100644 index 0000000..17fe11a --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenItemClass.cs @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// It represents the GenGrid or GenList item class definition field details. + /// It has some display styles, such as "default", "full" and "group_index". + /// + public class GenItemClass : IDisposable + { + static Dictionary s_HandleToEvasObject = new Dictionary(); + + /// + /// The delegate to define . + /// + /// The item data. + /// The part where the data should be shown. + /// Return string that should be shown. + public delegate string GetTextDelegate(object data, string part); + + /// + /// The delegate to define . + /// + /// The item data. + /// The part where the data should be shown. + /// Return content that should be shown. + public delegate EvasObject GetContentDelegate(object data, string part); + + /// + /// The delegate to define . + /// + /// The item data. + public delegate void DeleteDelegate(object data); + + /// + /// The delegate to define . + /// + /// The item data. + /// The part where the data should be shown. + /// The content has been added in gengrid. + /// Return content that should be shown. + public delegate EvasObject GetReusableContentDelegate(object data, string part, EvasObject old); + + ItemClass _itemClass; + IntPtr _unmanagedPtr = IntPtr.Zero; + string _style; + + /// + /// Creates and initializes a new instance of the GenItemClass. + /// + /// The item display style. + public GenItemClass(string style) + { + _style = style; + IntPtr unmanaged = CreateItemClass(); + + _itemClass = Marshal.PtrToStructure(unmanaged); + _itemClass.itemStyle = style; + _itemClass.textCallback = GetTextCallback; + _itemClass.contentCallback = GetContentCallback; + _itemClass.stateCallback = null; + _itemClass.delCallback = DelCallback; + _itemClass.reusableContentCallback = GetReusableContentCallback; + + ReleaseItemClass(unmanaged); + } + + ~GenItemClass() + { + Dispose(false); + } + + /// + /// Gets the item style. + /// + public string ItemStyle { get { return _style; } } + + /// + /// Gets or sets the callback that defines how to display item text. + /// If get, return . + /// + public GetTextDelegate GetTextHandler { get; set; } + + /// + /// Gets or sets the callback that defines how to display item content. + /// If get, return . + /// + public GetContentDelegate GetContentHandler { get; set; } + + /// + /// Gets or sets the callback that defines how to delete item text and content. + /// If get, return . + /// + public DeleteDelegate DeleteHandler { get; set; } + + /// + /// Gets or sets the callback that defines how to reuse item content. + /// If get, return . + /// + public GetReusableContentDelegate ReusableContentHandler { get; set; } + + internal IntPtr UnmanagedPtr + { + get + { + if (_unmanagedPtr == IntPtr.Zero) + { + _unmanagedPtr = Marshal.AllocHGlobal(Marshal.SizeOf(_itemClass)); + Marshal.StructureToPtr(_itemClass, _unmanagedPtr, false); + } + return _unmanagedPtr; + } + } + + protected virtual void Dispose(bool disposing) + { + if (_unmanagedPtr != IntPtr.Zero) + { + Marshal.FreeHGlobal(_unmanagedPtr); + _unmanagedPtr = IntPtr.Zero; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void SendItemDeleted(object data) + { + // data is user inserted value with GenItem + DeleteHandler?.Invoke(data); + } + + protected virtual IntPtr CreateItemClass() + { + return Interop.Elementary.elm_genlist_item_class_new(); + } + + protected virtual void ReleaseItemClass(IntPtr unmanagedPtr) + { + Interop.Elementary.elm_genlist_item_class_free(unmanagedPtr); + } + + string GetTextCallback(IntPtr data, IntPtr obj, IntPtr part) + { + GenItem item = ItemObject.GetItemById((int)data) as GenItem; + return GetTextHandler?.Invoke(item?.Data, Marshal.PtrToStringAnsi(part)); + } + + IntPtr GetContentCallback(IntPtr data, IntPtr obj, IntPtr part) + { + GenItem item = ItemObject.GetItemById((int)data) as GenItem; + EvasObject evasObject = GetContentHandler?.Invoke(item?.Data, Marshal.PtrToStringAnsi(part)); + if (evasObject != null) + { + s_HandleToEvasObject[evasObject.Handle] = evasObject; + evasObject.Deleted += EvasObjectDeleted; + } + return evasObject; + } + + void EvasObjectDeleted(object sender, EventArgs e) + { + IntPtr handle = (sender as EvasObject).Handle; + s_HandleToEvasObject.Remove(handle); + } + + IntPtr GetReusableContentCallback(IntPtr data, IntPtr obj, IntPtr part, IntPtr old) + { + IntPtr reusedHandle = IntPtr.Zero; + GenItem item = ItemObject.GetItemById((int)data) as GenItem; + if (s_HandleToEvasObject.ContainsKey(old)) + { + reusedHandle = ReusableContentHandler?.Invoke(item?.Data, Marshal.PtrToStringAnsi(part), s_HandleToEvasObject[old]); + } + return reusedHandle; + } + + void DelCallback(IntPtr data, IntPtr obj) + { + // We can't use this callback + // because, when item was deleted + // First, ItemObject deleted callback was called + // and We need to clean up ItemObject related objects + // This callback was called after ItemObject deleted callback was completed. + // So, We can't get resource reletated with ItemObject + } + } + + public class GenGridItemClass : GenItemClass + { + public GenGridItemClass(string style) : base(style) + { + } + + protected override IntPtr CreateItemClass() + { + return Interop.Elementary.elm_gengrid_item_class_new(); + } + + protected override void ReleaseItemClass(IntPtr unmanagedPtr) + { + Interop.Elementary.elm_gengrid_item_class_free(unmanagedPtr); + } + } + + [StructLayout(LayoutKind.Sequential)] + internal class ItemClass + { + public delegate string GetTextCallback(IntPtr data, IntPtr obj, IntPtr part); + + public delegate IntPtr GetContentCallback(IntPtr data, IntPtr obj, IntPtr part); + + public delegate int GetStateCallback(IntPtr data, IntPtr obj, IntPtr part); + + public delegate void DelCallback(IntPtr data, IntPtr obj); + + public delegate int FilterCallback(IntPtr data, IntPtr obj, IntPtr key); + + public delegate IntPtr GetReusableContentCallback(IntPtr data, IntPtr obj, IntPtr part, IntPtr old); + + public int version; + public uint refCount; + public int deleteMe; + public string itemStyle; + public readonly string decorateItemStyle; + public readonly string decorateAllItemStyle; + public GetTextCallback textCallback; + public GetContentCallback contentCallback; + public GetStateCallback stateCallback; + public DelCallback delCallback; + public FilterCallback filterCallback; + public GetReusableContentCallback reusableContentCallback; + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenList.cs b/src/ElmSharp/ElmSharp/GenList.cs new file mode 100644 index 0000000..ecb20e4 --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenList.cs @@ -0,0 +1,751 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// Enumeration for setting genlist item type. + /// + public enum GenListItemType + { + /// + /// if Normal is set then this item is normal item. + /// + Normal = 0, + + /// + /// If tree is set then this item is displayed as an item that is able to expand and have child items. + /// + Tree = (1 << 0), + + /// + /// if Group is set then this item is group index item that is displayed at the top until the next group comes. + /// + Group = (1 << 1), + } + + /// + /// Enumeration for setting genlist's resizing behavior, transverse axis scrolling and items cropping. + /// + public enum GenListMode + { + /// + /// The genlist won't set any of its size hints to inform how a possible container should resize it. + /// Then, if it's not created as a "resize object", it might end with zeroed dimensions. + /// The genlist will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction. + /// + Compress = 0, + + /// + /// This is the same as Compress, with the exception that if any of its items won't fit into its transverse axis, one will be able to scroll it in that direction. + /// + Scroll, + + /// + /// Sets a minimum size hint on the genlist object, so that containers may respect it (and resize itself to fit the child properly). + /// More specifically, a minimum size hint will be set for its transverse axis, so that the largest item in that direction fits well. + /// This is naturally bound by the genlist object's maximum size hints, set externally. + /// + Limit, + + /// + /// Besides setting a minimum size on the transverse axis, just like on Limit, the genlist will set a minimum size on th longitudinal axis, trying to reserve space to all its children to be visible at a time. + /// This is naturally bound by the genlist object's maximum size hints, set externally. + /// + Expand + } + + /// + /// It inherits System.EventArgs. + /// It contains Item which is type. + /// All events of GenList contain GenListItemEventArgs as a parameter. + /// + public class GenListItemEventArgs : EventArgs + { + /// + /// Gets or sets GenList item. The return type is . + /// + public GenListItem Item { get; set; } + + internal static GenListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + GenListItem item = ItemObject.GetItemByHandle(info) as GenListItem; + return new GenListItemEventArgs() { Item = item }; + } + } + + /// + /// Enumeration that defines where to position the item in the genlist. + /// + public enum ScrollToPosition + { + /// + /// Scrolls to nowhere. + /// + None = 0, + + /// + /// Scrolls to the nearest viewport. + /// + In = (1 << 0), + + /// + /// Scrolls to the top of the viewport. + /// + Top = (1 << 1), + + /// + /// Scrolls to the middle of the viewport. + /// + Middle = (1 << 2), + + /// + /// Scrolls to the bottom of the viewport. + /// + Bottom = (1 << 3) + } + + /// + /// It inherits . + /// The GenList is a widget that aims to have more expansive list than the simple in ElmSharp that could have more flexible items and allow many more entries while still being fast and low on memory usage. + /// At the same time it was also made to be able to do tree structures. + /// But the price to pay is more complexity when it comes to usage. + /// If all you want is a simple list with icons and a single text, use the widget. + /// + public class GenList : Layout + { + HashSet _children = new HashSet(); + + SmartEvent _selected; + SmartEvent _unselected; + SmartEvent _activated; + SmartEvent _pressed; + SmartEvent _released; + SmartEvent _doubleClicked; + SmartEvent _expanded; + SmartEvent _realized; + SmartEvent _unrealized; + SmartEvent _longpressed; + SmartEvent _moved; + SmartEvent _movedAfter; + SmartEvent _movedBefore; + SmartEvent _scrollAnimationStarted; + SmartEvent _scrollAnimationStopped; + SmartEvent _changed; + + /// + /// Creates and initializes a new instance of the GenList class. + /// + /// The parent is a given container which will be attached by GenList as a child. It's type. + public GenList(EvasObject parent) : base(parent) + { + ListMode = GenListMode.Compress; + InitializeSmartEvent(); + } + + /// + /// Gets or sets whether the homogeneous mode is enabled. + /// + /// + /// If true, the genlist items have same height and width. + /// + public bool Homogeneous + { + get + { + return Interop.Elementary.elm_genlist_homogeneous_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_homogeneous_set(RealHandle, value); + } + } + + /// + /// Gets or sets the horizontal stretching mode. This mode used for sizing items horizontally. + /// The default value is which means that if items are too wide to fit, the scroller scrolls horizontally. + /// If set which means that the item width is fixed (restricted to a minimum of) to the list width when calculating its size in order to allow the height to be calculated based on it. + /// If set which means that items are expanded to the viewport width and limited to that size. + /// if set which means that genlist try to reserve space to all its items to be visible at a time. + /// + /// + /// Compress makes genlist resize slower as it recalculates every item height again whenever the list width changes. + /// The homogeneous mode is so that all items in the genlist are of the same width/height. With Compress, genlist items are initialized fast. + /// However, there are no sub-objects in the genlist which can be on the flying resizable (such as TEXTBLOCK). + /// If so, then some dynamic resizable objects in the genlist would not be diplayed properly. + /// + public GenListMode ListMode + { + get + { + return (GenListMode)Interop.Elementary.elm_genlist_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_mode_set(RealHandle, (int)value); + } + } + + /// + /// Gets the first item in the genlist. + /// + public GenListItem FirstItem + { + get + { + IntPtr handle = Interop.Elementary.elm_genlist_first_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenListItem; + } + } + + /// + /// Gets the last item in the genlist. + /// + public GenListItem LastItem + { + get + { + IntPtr handle = Interop.Elementary.elm_genlist_last_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenListItem; + } + } + + /// + /// Gets or sets the reorder mode. + /// After turning on the reorder mode, longpress on a normal item triggers reordering of the item. + /// You can move the item up and down. However, reordering does not work with group items. + /// + public bool ReorderMode + { + get + { + return Interop.Elementary.elm_genlist_reorder_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_reorder_mode_set(RealHandle, value); + } + } + + /// + /// Gets or set the maximum number of items within an item block. + /// + public int BlockCount + { + get + { + return Interop.Elementary.elm_genlist_block_count_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_block_count_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether the genlist items should be highlighted when an item is selected. + /// + public bool IsHighlight + { + get + { + return Interop.Elementary.elm_genlist_highlight_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_highlight_mode_set(RealHandle, value); + } + } + + /// + /// Gets or sets the timeout in seconds for the longpress event. + /// + public double LongPressTimeout + { + get + { + return Interop.Elementary.elm_genlist_longpress_timeout_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_longpress_timeout_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether enable multi-selection in the genlist. + /// + public bool IsMultiSelection + { + get + { + return Interop.Elementary.elm_genlist_multi_select_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_multi_select_set(RealHandle, value); + } + } + + /// + /// Gets the selected item in a given genlist widget. + /// + public GenListItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_genlist_selected_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as GenListItem; + } + } + + /// + /// Gets or sets the genlist select mode by . + /// + public GenItemSelectionMode SelectionMode + { + get + { + return (GenItemSelectionMode)Interop.Elementary.elm_genlist_select_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_genlist_select_mode_set(RealHandle, (int)value); + } + } + + /// + /// ItemSelected is raised when a new genlist item is selected. + /// + public event EventHandler ItemSelected; + + /// + /// ItemUnselected is raised when the genlist item is Unselected. + /// + public event EventHandler ItemUnselected; + + /// + /// ItemPressed is raised when a new genlist item is pressed. + /// + public event EventHandler ItemPressed; + + /// + /// ItemReleased is raised when a new genlist item is released. + /// + public event EventHandler ItemReleased; + + /// + /// ItemActivated is raised when a new genlist item is double clicked or pressed (enter|return|spacebar). + /// + public event EventHandler ItemActivated; + + /// + /// ItemDoubleClicked is raised when a new genlist item is double clicked. + /// + public event EventHandler ItemDoubleClicked; + + /// + /// ItemExpanded is raised when a new genlist item is indicated to expand. + /// + public event EventHandler ItemExpanded; + + /// + /// ItemRealized is raised when a new genlist item is created as a real object. + /// + public event EventHandler ItemRealized; + + /// + /// ItemUnrealized is raised when a new genlist item is unrealized. + /// After calling unrealize, the item's content objects are deleted and the item object itself is deleted or is put into a floating cache. + /// + public event EventHandler ItemUnrealized; + + /// + /// ItemLongPressed is raised when a genlist item is pressed for a certain amount of time. By default it's 1 second. + /// + public event EventHandler ItemLongPressed; + + /// + /// ItemMoved is raised when a genlist item is moved in the reorder mode. + /// + public event EventHandler ItemMoved; + + /// + /// ItemMovedAfter is raised when a genlist item is moved after another item in the reorder mode. + /// To get the relative previous item, use . + /// + public event EventHandler ItemMovedAfter; + + /// + /// ItemMovedBefore is raised when a genlist item is moved before another item in the reorder mode. + /// To get the relative next item, use . + /// + public event EventHandler ItemMovedBefore; + + /// + /// Changed is raised when genlist is changed. + /// + public event EventHandler Changed + { + add { _changed.On += value; } + remove { _changed.On -= value; } + } + + /// + /// ScrollAnimationStarted is raised when scrolling animation has started. + /// + public event EventHandler ScrollAnimationStarted + { + add { _scrollAnimationStarted.On += value; } + remove { _scrollAnimationStarted.On -= value; } + } + + /// + /// ScrollAnimationStopped is raised when scrolling animation has stopped. + /// + public event EventHandler ScrollAnimationStopped + { + add { _scrollAnimationStopped.On += value; } + remove { _scrollAnimationStopped.On -= value; } + } + + /// + /// Appends a new item to the end of a given genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// Return a new added genlist item that contains data and itemClass. + /// + /// + public GenListItem Append(GenItemClass itemClass, object data) + { + return Append(itemClass, data, GenListItemType.Normal); + } + + /// + /// Appends a new item with to the end of a given genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The genlist item type. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type) + { + return Append(itemClass, data, type, null); + } + + /// + /// Appends a new item with to the end of a given genlist widget or the end of the children list if the parent is given. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem Append(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent) + { + GenListItem item = new GenListItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_genlist_item_append(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Prepends a new item to the beginning of a given genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem Prepend(GenItemClass itemClass, object data) + { + return Prepend(itemClass, data, GenListItemType.Normal); + } + + /// + /// Prepends a new item with to the beginning of a given genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type) + { + return Prepend(itemClass, data, type, null); + } + + /// + /// Prepends a new item with to the beginning of a given genlist widget or the beginning of the children list if the parent is given. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem Prepend(GenItemClass itemClass, object data, GenListItemType type, GenListItem parent) + { + GenListItem item = new GenListItem(data, itemClass); + IntPtr handle = Interop.Elementary.elm_genlist_item_prepend(RealHandle, itemClass.UnmanagedPtr, (IntPtr)item.Id, parent, (int)type, null, (IntPtr)item.Id); + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Inserts an item before another item in a genlist widget. + /// It is the same tree level or group as the item before which it is inserted.???? + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item before which to place this new one. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before) + { + return InsertBefore(itemClass, data, before, GenListItemType.Normal); + } + + /// + /// Inserts an item with before another item in a genlist widget. + /// It is the same tree level or group as the item before which it is inserted.???? + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item before which to place this new one. + /// The genlist item type. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type) + { + return InsertBefore(itemClass, data, before, type, null); + } + + /// + /// Inserts an item with before another item under a parent in a genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item before which to place this new one. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem InsertBefore(GenItemClass itemClass, object data, GenListItem before, GenListItemType type, GenListItem parent) + { + GenListItem item = new GenListItem(data, itemClass); + // insert before the `before` list item + IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before( + RealHandle, // genlist handle + itemClass.UnmanagedPtr, // item class + (IntPtr)item.Id, // data + parent, // parent + before, // before + (int)type, // item type + null, // select callback + (IntPtr)item.Id); // callback data + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Inserts an item with after another item under a parent in a genlist widget. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// The item after which to place this new one. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a new added genlist item that contains data and itemClass. + public GenListItem InsertAfter(GenItemClass itemClass, object data, GenListItem after, GenListItemType type, GenListItem parent) + { + GenListItem item = new GenListItem(data, itemClass); + // insert before the `before` list item + IntPtr handle = Interop.Elementary.elm_genlist_item_insert_before( + RealHandle, // genlist handle + itemClass.UnmanagedPtr, // item class + (IntPtr)item.Id, // data + parent, // parent + after, // after + (int)type, // item type + null, // select callback + (IntPtr)item.Id); // callback data + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Insert an item in a genlist widget using a user-defined sort function. + /// + /// The itemClass defines how to display the data. + /// The item data. + /// User defined comparison function that defines the sort order based on genlist item and its data. + /// The genlist item type. + /// The parent item, otherwise null if there is no parent item. + /// Return a genlist item that contains data and itemClass. + public GenListItem InsertSorted(GenItemClass itemClass, object data, Comparison comparison, GenListItemType type, GenListItem parent) + { + GenListItem item = new GenListItem(data, itemClass); + + Interop.Elementary.Eina_Compare_Cb compareCallback = (handle1, handle2) => + { + GenListItem first = (ItemObject.GetItemByHandle(handle1) as GenListItem) ?? item; + GenListItem second = (ItemObject.GetItemByHandle(handle2) as GenListItem) ?? item; + return comparison(first.Data, second.Data); + }; + + IntPtr handle = Interop.Elementary.elm_genlist_item_sorted_insert( + RealHandle, // genlist handle + itemClass.UnmanagedPtr, // item clas + (IntPtr)item.Id, // data + parent, // parent + (int)type, // item type + compareCallback, // compare callback + null, //select callback + (IntPtr)item.Id); // callback data + item.Handle = handle; + AddInternal(item); + return item; + } + + /// + /// Shows the given item with position type in a genlist. + /// When animated is true, genlist will jump to the given item and display it (by animatedly scrolling), if it is not fully visible. This may use animation and may take some time. + /// When animated is false, genlist will jump to the given item and display it (by jumping to that position), if it is not fully visible. + /// + /// The item to display. + /// The position to show the given item to . + /// The animated indicates how to display the item, by scrolling or by jumping. + public void ScrollTo(GenListItem item, ScrollToPosition position, bool animated) + { + if (animated) + { + Interop.Elementary.elm_genlist_item_bring_in(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position); + } + else + { + Interop.Elementary.elm_genlist_item_show(item.Handle, (Interop.Elementary.Elm_Genlist_Item_Scrollto_Type)position); + } + } + + /// + /// Updates the content of all the realized items. + /// This updates all the realized items by calling all the again to get the content, text and states. + /// Use this when the original item data has changed and the changes are desired to reflect. + /// To update just one item, use . + /// + /// + public void UpdateRealizedItems() + { + Interop.Elementary.elm_genlist_realized_items_update(RealHandle); + } + + /// + /// Removes all items from a given genlist widget. + /// This removes (and deletes) all items in obj, making it empty. + /// To delete just one item, use . + /// + /// + public void Clear() + { + Interop.Elementary.elm_genlist_clear(RealHandle); + } + + /// + /// Get the item that is at the x, y canvas coords. + /// + /// The input x coordinate + /// The input y coordinate + /// The position relative to the item returned here + /// -1, 0, or 1, depending on whether the coordinate is on the upper portion of that item (-1), in the middle section (0), or on the lower part (1). + /// + /// + public GenListItem GetItemByPosition(int x, int y, out int pos) + { + IntPtr handle = Interop.Elementary.elm_genlist_at_xy_item_get(RealHandle, x, y, out pos); + return ItemObject.GetItemByHandle(handle) as GenListItem; + } + + /// + /// Gets the nth item in a given genlist widget, placed at position nth, in its internal items list. + /// + /// The number of the item to grab (0 being the first) + /// + public GenListItem GetItemByIndex(int index) + { + IntPtr handle = Interop.Elementary.elm_genlist_nth_item_get(RealHandle, index); + return ItemObject.GetItemByHandle(handle) as GenListItem; + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_genlist_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + void InitializeSmartEvent() + { + _selected = new SmartEvent(this, this.RealHandle, "selected", GenListItemEventArgs.CreateFromSmartEvent); + _unselected = new SmartEvent(this, this.RealHandle, "unselected", GenListItemEventArgs.CreateFromSmartEvent); + _activated = new SmartEvent(this, this.RealHandle, "activated", GenListItemEventArgs.CreateFromSmartEvent); + _pressed = new SmartEvent(this, this.RealHandle, "pressed", GenListItemEventArgs.CreateFromSmartEvent); + _released = new SmartEvent(this, this.RealHandle, "released", GenListItemEventArgs.CreateFromSmartEvent); + _doubleClicked = new SmartEvent(this, this.RealHandle, "clicked,double", GenListItemEventArgs.CreateFromSmartEvent); + _expanded = new SmartEvent(this, this.RealHandle, "expanded", GenListItemEventArgs.CreateFromSmartEvent); + _realized = new SmartEvent(this, this.RealHandle, "realized", GenListItemEventArgs.CreateFromSmartEvent); + _unrealized = new SmartEvent(this, this.RealHandle, "unrealized", GenListItemEventArgs.CreateFromSmartEvent); + _longpressed = new SmartEvent(this, this.RealHandle, "longpressed", GenListItemEventArgs.CreateFromSmartEvent); + _moved = new SmartEvent(this, this.RealHandle, "moved", GenListItemEventArgs.CreateFromSmartEvent); + _movedAfter = new SmartEvent(this, this.RealHandle, "moved,after", GenListItemEventArgs.CreateFromSmartEvent); + _movedBefore = new SmartEvent(this, this.RealHandle, "moved,before", GenListItemEventArgs.CreateFromSmartEvent); + _scrollAnimationStarted = new SmartEvent(this, this.RealHandle, "scroll,anim,start"); + _scrollAnimationStopped = new SmartEvent(this, this.RealHandle, "scroll,anim,stop"); + _changed = new SmartEvent(this, this.RealHandle, "changed"); + + _selected.On += (s, e) => { if (e.Item != null) ItemSelected?.Invoke(this, e); }; + _unselected.On += (s, e) => { if (e.Item != null) ItemUnselected?.Invoke(this, e); }; + _activated.On += (s, e) => { if (e.Item != null) ItemActivated?.Invoke(this, e); }; + _pressed.On += (s, e) => { if (e.Item != null) ItemPressed?.Invoke(this, e); }; + _released.On += (s, e) => { if (e.Item != null) ItemReleased?.Invoke(this, e); }; + _doubleClicked.On += (s, e) => { if (e.Item != null) ItemDoubleClicked?.Invoke(this, e); }; + _expanded.On += (s, e) => { if (e.Item != null) ItemExpanded?.Invoke(this, e); }; + _realized.On += (s, e) => { if (e.Item != null) ItemRealized?.Invoke(this, e); }; + _unrealized.On += (s, e) => { if (e.Item != null) ItemUnrealized?.Invoke(this, e); }; + _longpressed.On += (s, e) => { if (e.Item != null) ItemLongPressed?.Invoke(this, e); }; + _moved.On += (s, e) => { if (e.Item != null) ItemMoved?.Invoke(this, e); }; + _movedAfter.On += (s, e) => { if (e.Item != null) ItemMovedAfter?.Invoke(this, e); }; + _movedBefore.On += (s, e) => { if (e.Item != null) ItemMovedBefore?.Invoke(this, e); }; + } + + void AddInternal(GenListItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((GenListItem)sender); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/GenListItem.cs b/src/ElmSharp/ElmSharp/GenListItem.cs new file mode 100644 index 0000000..d1f7a85 --- /dev/null +++ b/src/ElmSharp/ElmSharp/GenListItem.cs @@ -0,0 +1,317 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; + +namespace ElmSharp +{ + /// + /// The type of item's part type. + /// + [Flags] + public enum GenListItemFieldType + { + /// + /// All item's parts. + /// + All = 0, + + /// + /// The text part type. + /// + Text = (1 << 0), + + /// + /// The Content part type. + /// + Content = (1 << 1), + + /// + /// The state of part. + /// + State = (1 << 2), + + /// + /// No part type. + /// + None = (1 << 3) + }; + + /// + /// It inherits . + /// A instance to the genlist item added. + /// It contains Update() method to update a genlist item which is given. + /// + public class GenListItem : GenItem + { + internal GenListItem(object data, GenItemClass itemClass) : base(data, itemClass) + { + } + + /// + /// Gets or sets whether a given genlist item is selected. + /// + public override bool IsSelected + { + get + { + return Interop.Elementary.elm_genlist_item_selected_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_selected_set(Handle, value); + } + } + + /// + /// Gets or sets whether a given genlist item is expanded. + /// + public bool IsExpanded + { + get + { + return Interop.Elementary.elm_genlist_item_expanded_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_expanded_set(Handle, value); + } + } + + /// + /// Updates the content of an item. + /// This updates an item by calling all the again to get the content, text, and states. + /// Use this when the original item data has changed and the changes are desired to reflect. + /// To update already realized items, use . + /// + /// + public override void Update() + { + Interop.Elementary.elm_genlist_item_update(Handle); + } + + /// + /// Updates the part of an item. + /// This updates an item's part by calling item's fetching functions again to get the contents, texts and states. + /// Use this when the original item data has changed and the changes are desired to be reflected. + /// To update an item's all property, use . + /// + /// The part could be "elm.text", "elm.swalllow.icon", "elm.swallow.end", "elm.swallow.content" and so on. It is also used for globbing to match '*', '?', and '.'. It can be used at updating multi fields. + /// The type of item's part type. + /// + public void UpdateField(string part, GenListItemFieldType type) + { + Interop.Elementary.elm_genlist_item_fields_update(Handle, part, (uint)type); + } + + /// + /// Demote an item to the end of the list. + /// + /// The genlistitem object + public void DemoteItem() + { + Interop.Elementary.elm_genlist_item_demote(Handle); + } + + /// + /// Gets or sets the genlist item's select mode. + /// + public override GenItemSelectionMode SelectionMode + { + get + { + return (GenItemSelectionMode)Interop.Elementary.elm_genlist_item_select_mode_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_select_mode_set(Handle, (Interop.Elementary.Elm_Object_Select_Mode)value); + } + } + + /// + /// Gets the next item in a genlist widget's internal list of items. + /// + /// + public GenListItem Next + { + get + { + IntPtr next = Interop.Elementary.elm_genlist_item_next_get(Handle); + if (next == IntPtr.Zero) + return null; + else + return GetItemByHandle(next) as GenListItem; + } + } + + /// + /// Get the previous item in a genlist widget's internal list of items. + /// + /// + public GenListItem Previous + { + get + { + IntPtr prev = Interop.Elementary.elm_genlist_item_prev_get(Handle); + if (prev == IntPtr.Zero) + return null; + else + return GetItemByHandle(prev) as GenListItem; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override string Cursor + { + get + { + return Interop.Elementary.elm_genlist_item_cursor_get(Handle); + } + set + { + if (!string.IsNullOrEmpty(value)) + { + Interop.Elementary.elm_genlist_item_cursor_set(Handle, value); + } + else + { + Interop.Elementary.elm_genlist_item_cursor_unset(Handle); + } + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override string CursorStyle + { + get + { + return Interop.Elementary.elm_genlist_item_cursor_style_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_cursor_style_set(Handle, value); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsUseEngineCursor + { + get + { + return Interop.Elementary.elm_genlist_item_cursor_engine_only_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_cursor_engine_only_set(Handle, value); + } + } + + public override void SetTooltipText(string tooltip) + { + Interop.Elementary.elm_genlist_item_tooltip_text_set(Handle, tooltip); + } + + public override void UnsetTooltip() + { + Interop.Elementary.elm_genlist_item_tooltip_unset(Handle); + } + + /// + /// Gets or sets the style of given genlist item's tooltip. + /// + public override string TooltipStyle + { + get + { + return Interop.Elementary.elm_genlist_item_tooltip_style_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_tooltip_style_set(Handle, value); + } + } + + /// + /// Gets or sets whether disable size restrictions on an object's tooltip. + /// + public bool IsTooltipWindowMode + { + get + { + return Interop.Elementary.elm_genlist_item_tooltip_window_mode_get(Handle); + } + set + { + Interop.Elementary.elm_genlist_item_tooltip_window_mode_set(Handle, value); + } + } + + /// + /// Gets the index of the item. It is only valid once displayed. + /// + public int Index + { + get + { + return Interop.Elementary.elm_genlist_item_index_get(Handle); + } + } + + /// + /// Gets the depth of expanded item. + /// + public int ExpandedItemDepth + { + get + { + return Interop.Elementary.elm_genlist_item_expanded_depth_get(Handle); + } + } + + /// + /// Remove all sub-items (children) of the given item. + /// + /// + /// This removes all items that are children (and their descendants) of the given item it. + /// + public void ClearSubitems() + { + Interop.Elementary.elm_genlist_item_subitems_clear(Handle); + } + + /// + /// Update the item class of an item. + /// This sets another class of the item, changing the way that it is displayed. After changing the item class, is called on the item. + /// + /// The item class for the item. + /// The data for the item. + public void UpdateItemClass(GenItemClass itemClass, object data) + { + Data = data; + ItemClass = itemClass; + Interop.Elementary.elm_genlist_item_item_class_update((IntPtr)Handle, itemClass.UnmanagedPtr); + } + + protected override void UpdateTooltipDelegate() + { + Interop.Elementary.elm_genlist_item_tooltip_content_cb_set(Handle, + TooltipContentDelegate != null ? _tooltipCb : null, + IntPtr.Zero, + null); + } + } +} diff --git a/src/ElmSharp/ElmSharp/GestureLayer.cs b/src/ElmSharp/ElmSharp/GestureLayer.cs new file mode 100644 index 0000000..c6bce6c --- /dev/null +++ b/src/ElmSharp/ElmSharp/GestureLayer.cs @@ -0,0 +1,835 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// The GestureLayer is used to detect gestures. + /// Inherits Widget + /// + public class GestureLayer : Widget + { + private readonly Interop.Elementary.GestureEventCallback _gestureCallback; + + // Important: don't remove items from _handlers list + // The list can grow up to (number of GestureType) * (number of GestureState) + // but all gestures share the callback and you don't want to desynchronize mapping + private readonly List _handlers = new List(); + + /// + /// Creates and initializes a new instance of GestureLayer class. + /// + /// The parent is a given container which will be attached by GestureLayer as a child. It's type. + public GestureLayer(EvasObject parent) : base(parent) + { + _gestureCallback = new Interop.Elementary.GestureEventCallback(GestureCallbackHandler); + } + + /// + /// Enumeration for supported gesture types. + /// + public enum GestureType + { + /// + /// N fingers single taps + /// + Tap = 1, + + /// + /// N fingers single long-taps + /// + LongTap, + + /// + /// N fingers double-single taps + /// + DoubleTap, + + /// + /// N fingers triple-single taps + /// + TripleTap, + + /// + /// Reports momentum in the direction of move + /// + Momentum, + + /// + /// N fingers line gesture + /// + Line, + + /// + /// N fingers flick gesture + /// + Flick, + + /// + /// Zoom + /// + Zoom, + + /// + /// Rotate + /// + Rotate, + } + + /// + /// Enumeration for gesture states. + /// + public enum GestureState + { + /// + /// Gesture not started + /// + Undefined = -1, + + /// + /// Gesture started + /// + Start, + + /// + /// Gesture is ongoing + /// + Move, + + /// + /// Gesture completed + /// + End, + + /// + /// Ongoing gesture is aborted + /// + Abort, + } + + #region Properties + + /// + /// Sets or gets the repeat-events setting. + /// + public bool HoldEvents + { + get + { + return Interop.Elementary.elm_gesture_layer_hold_events_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_hold_events_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer continues enable of an object + /// + public bool Continues + { + get + { + return Interop.Elementary.elm_gesture_layer_continues_enable_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_continues_enable_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer finger-size for taps. + /// + public int TapFingerSize + { + get + { + return Interop.Elementary.elm_gesture_layer_tap_finger_size_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_tap_finger_size_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer long tap start timeout of an object + /// + public double LongTapTimeout + { + get + { + return Interop.Elementary.elm_gesture_layer_long_tap_start_timeout_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_long_tap_start_timeout_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer double tap timeout of an object + /// + public double DoubleTapTimeout + { + get + { + return Interop.Elementary.elm_gesture_layer_double_tap_timeout_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_double_tap_timeout_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer flick time limit (in ms) of an object + /// + public int FlickTimeLimit + { + get + { + return (int)Interop.Elementary.elm_gesture_layer_flick_time_limit_ms_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_flick_time_limit_ms_set(Handle, (UInt32)value); + } + } + + /// + /// Sets or gets the gesture layer line min length of an object + /// + public int MinimumLineLength + { + get + { + return Interop.Elementary.elm_gesture_layer_line_min_length_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_line_min_length_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer line angular tolerance of an object + /// + public double LineAngularTolerance + { + get + { + return Interop.Elementary.elm_gesture_layer_line_angular_tolerance_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_line_angular_tolerance_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer line distance tolerance of an object + /// + public int LineDistanceTolerance + { + get + { + return Interop.Elementary.elm_gesture_layer_line_distance_tolerance_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_line_distance_tolerance_set(Handle, value); + } + } + + /// + /// Sets or gets step-value for rotate action. + /// + public double RotateStep + { + get + { + return Interop.Elementary.elm_gesture_layer_rotate_step_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_rotate_step_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer rotate angular tolerance of an object + /// + public double RotateAngularTolerance + { + get + { + return Interop.Elementary.elm_gesture_layer_rotate_angular_tolerance_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_rotate_angular_tolerance_set(Handle, value); + } + } + + /// + /// Sets or gets control step value for zoom action. + /// + public double ZoomStep + { + get + { + return Interop.Elementary.elm_gesture_layer_zoom_step_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_zoom_step_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer zoom distance tolerance of an object + /// + public int ZoomDistanceTolerance + { + get + { + return Interop.Elementary.elm_gesture_layer_zoom_distance_tolerance_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_zoom_distance_tolerance_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer zoom finger factor of an object + /// + public double ZoomFingerFactor + { + get + { + return Interop.Elementary.elm_gesture_layer_zoom_finger_factor_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_zoom_finger_factor_set(Handle, value); + } + } + + /// + /// Sets or gets the gesture layer zoom wheel factor of an object + /// + public double ZoomWheelFactor + { + get + { + return Interop.Elementary.elm_gesture_layer_zoom_wheel_factor_get(Handle); + } + set + { + Interop.Elementary.elm_gesture_layer_zoom_wheel_factor_set(Handle, value); + } + } + + #endregion Properties + + /// + /// Attach a gesture layer widget to an Evas object (setting the widget's target). + /// A gesture layer's target may be any Evas object. This object will be used to listen to mouse and key events. + /// + /// The object to attach. + public void Attach(EvasObject target) + { + Interop.Elementary.elm_gesture_layer_attach(Handle, target.Handle); + } + + /// + /// Set the gesture state change callback. + /// When all callbacks for the gesture are set to null, it means this gesture is disabled. + /// + /// The gesture you want to track state of. + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetGestureCallback(GestureType type, GestureState state, Action action) + { + lock (_handlers) + { + bool found = false; + int i = 0; + // if this (type, state) already exists in _handlers, we will reuse it + foreach (var handler in _handlers) + { + if (handler.Type == type && handler.State == state) + { + found = true; + break; + } + i++; + } + if (found) + { + // if we are changing null -> not-null, or not-null -> null, then inform the EFL + if (_handlers[i].Action == null ^ action == null) + Interop.Elementary.elm_gesture_layer_cb_set(Handle, type, state, action == null ? null : _gestureCallback, new IntPtr(i)); + // overwrite previous action + _handlers[i].Action = action; + } + else + { + if (action == null) + { + // ignore unsetting a handler for event which was not registered yet? + return; + } + // (type, state) was not found, so we are adding a new entry and registering the callback + _handlers.Add(new NativeCallback(type, state, action)); + // callback is always the same, the event is recognised by the index in _handler list (the index is passed as data) + Interop.Elementary.elm_gesture_layer_cb_set(Handle, type, state, _gestureCallback, new IntPtr(i)); + } + } + } + + /// + /// clear the gesture state change callback. + /// + public void ClearCallbacks() + { + lock (_handlers) + { + int i = 0; + foreach (var handler in _handlers) + { + if (handler.Action != null) + { + Interop.Elementary.elm_gesture_layer_cb_set(Handle, handler.Type, handler.State, null, new IntPtr(i)); + handler.Action = null; + } + i++; + } + } + } + + #region Typed callback setting methods + + // Following methods have been added for convenience, so the user will not have to convert Info structures himself + /// + /// Set the tap callback. + /// + /// The gesture you want to track state of. + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetTapCallback(GestureType type, GestureState state, Action action) + { + SetCallback(type, state, action); + } + + /// + /// Set the gesture state change callback with Momentum Gesture Type + /// + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetMomentumCallback(GestureState state, Action action) + { + SetCallback(GestureType.Momentum, state, action); + } + + /// + /// Set the gesture state change callback with Line Gesture Type + /// + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetLineCallback(GestureState state, Action action) + { + SetCallback(GestureType.Line, state, action); + } + + /// + /// Set the gesture state change callback with Flick Gesture Type + /// + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetFlickCallback(GestureState state, Action action) + { + SetCallback(GestureType.Flick, state, action); + } + + /// + /// Set the gesture state change callback with Zoom Gesture Type + /// + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetZoomCallback(GestureState state, Action action) + { + SetCallback(GestureType.Zoom, state, action); + } + + /// + /// Set the gesture state change callback with Rotate Gesture Type + /// + /// The event the callback tracks (START, MOVE, END, ABORT). + /// The callback itself. + public void SetRotateCallback(GestureState state, Action action) + { + SetCallback(GestureType.Rotate, state, action); + } + + #endregion Typed callback setting methods + + /// + /// Call this function to construct a new gesture-layer object. + /// + /// The gesture layer's parent widget. + /// + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_gesture_layer_add(parent); + } + + /// + /// clear the gesture state change callback. + /// + protected override void OnUnrealize() + { + ClearCallbacks(); + base.OnUnrealize(); + } + + private void SetCallback(GestureType type, GestureState state, Action action) + { + if (action == null) + SetGestureCallback(type, state, null); + else + SetGestureCallback(type, state, new Action((info) => action((T)info))); + } + + private void GestureCallbackHandler(IntPtr data, IntPtr event_info) + { + // so EFL called our callback, lets use data to find the right Action to call + var handlerIndex = (int)data; + // thanks to the fact that we never remove item from _handlers, we don't need a lock here + if (handlerIndex < 0 || handlerIndex >= _handlers.Count) + return; + Action action = _handlers[handlerIndex].Action; + if (action == null) + return; + // the interpretation of the event_info struct pointer depends on the GestureType + switch (_handlers[handlerIndex].Type) + { + case GestureType.Tap: + case GestureType.LongTap: + case GestureType.DoubleTap: + case GestureType.TripleTap: + action(Marshal.PtrToStructure(event_info)); + break; + + case GestureType.Momentum: + action(Marshal.PtrToStructure(event_info)); + break; + + case GestureType.Line: + case GestureType.Flick: + action(Marshal.PtrToStructure(event_info)); + break; + + case GestureType.Zoom: + action(Marshal.PtrToStructure(event_info)); + break; + + case GestureType.Rotate: + action(Marshal.PtrToStructure(event_info)); + break; + } + } + + #region Info structures + + /// + /// The struct of TapData + /// + [StructLayout(LayoutKind.Sequential)] + public struct TapData + { + /// + /// The x coordinate of the center point. + /// + public Int32 X; + + /// + /// The y coordinate of the center point. + /// + public Int32 Y; + +#pragma warning disable 3003 + + /// + /// The number of fingers tapped. + /// + public UInt32 FingersCount; + + /// + /// The timestamp. + /// + public UInt32 Timestamp; + +#pragma warning restore 3003 + } + + /// + /// The struct of MomentumData + /// + [StructLayout(LayoutKind.Sequential)] + public struct MomentumData + { + /// + /// Final-swipe direction starting point on X. + /// + public Int32 X1; + + /// + /// Final-swipe direction starting point on Y. + /// + public Int32 Y1; + + /// + /// Final-swipe direction ending point on X. + /// + public Int32 X2; + + /// + /// Final-swipe direction ending point on Y + /// + public Int32 Y2; + +#pragma warning disable 3003 + + /// + /// Timestamp of start of final x-swipe. + /// + public UInt32 HorizontalSwipeTimestamp; + + /// + /// Timestamp of start of final y-swipe. + /// + public UInt32 VerticalSwipeTimestamp; + + /// + /// Momentum on X. + /// + public Int32 HorizontalMomentum; + + /// + /// Momentum on Y. + /// + public Int32 VerticalMomentum; + + /// + /// Number of fingers. + /// + public UInt32 FingersCount; + +#pragma warning restore 3003 + } + + /// + /// The struct of LineData + /// + [StructLayout(LayoutKind.Sequential)] + public struct LineData + { + /// + /// Final-swipe direction starting point on X. + /// + public Int32 X1; + + /// + /// Final-swipe direction starting point on Y. + /// + public Int32 Y1; + + /// + /// Final-swipe direction ending point on X. + /// + public Int32 X2; + + /// + /// Final-swipe direction ending point on Y + /// + public Int32 Y2; + +#pragma warning disable 3003 + + /// + /// Timestamp of start of final x-swipe. + /// + public UInt32 HorizontalSwipeTimestamp; + + /// + /// Timestamp of start of final y-swipe. + /// + public UInt32 VerticalSwipeTimestamp; + + /// + /// Momentum on X. + /// + public Int32 HorizontalMomentum; + + /// + /// Momentum on Y. + /// + public Int32 VerticalMomentum; + + /// + /// Number of fingers. + /// + public UInt32 FingersCount; + +#pragma warning restore 3003 + + /// + /// Angle (direction) of lines. + /// + public double Angle; + } + + /// + /// The struct of ZoomData + /// + [StructLayout(LayoutKind.Sequential)] + public struct ZoomData + { + /// + /// The x coordinate of zoom center point reported to user. + /// + public Int32 X; + + /// + /// The y coordinate of zoom center point reported to user. + /// + public Int32 Y; + + /// + /// The radius (distance) between fingers reported to user. + /// + public Int32 Radius; + + /// + /// The zoom value. 1.0 means no zoom. + /// + public double Zoom; + + /// + /// Zoom momentum: zoom growth per second (NOT YET SUPPORTED). + /// + private double Momentum; + } + + /// + /// The struct of RotateData + /// + [StructLayout(LayoutKind.Sequential)] + public struct RotateData + { + /// + /// The x coordinate of rotation center point reported to user. + /// + public Int32 X; + + /// + /// The y coordinate of rotation center point reported to user. + /// + public Int32 Y; + + /// + /// The radius (distance) between fingers reported to user. + /// + public Int32 Radius; + + /// + /// The start-angle. + /// + public double BaseAngle; + + /// + /// The rotation value. 0.0 means no rotation. + /// + public double Angle; + + /// + /// Rotation momentum: rotation done per second (NOT YET SUPPORTED). + /// + private double Momentum; + } + + #endregion Info structures + + /// + /// Config is a static class, it provides gestureLayer's timeout information. + /// + public static class Config + { + /// + /// Sets or gets the duration for occurring long tap event of gesture layer. + /// + public static double DefaultLongTapTimeout + { + get + { + return Interop.Elementary.elm_config_glayer_long_tap_start_timeout_get(); + } + set + { + Interop.Elementary.elm_config_glayer_long_tap_start_timeout_set(value); + } + } + + /// + /// Sets or gets the duration for occurring double tap event of gesture layer. + /// + public static double DefaultDoubleTapTimeout + { + get + { + return Interop.Elementary.elm_config_glayer_double_tap_timeout_get(); + } + set + { + Interop.Elementary.elm_config_glayer_double_tap_timeout_set(value); + } + } + } + + private class NativeCallback + { + public readonly GestureType Type; + public readonly GestureState State; + public Action Action; + + public NativeCallback(GestureType type, GestureState state, Action action) + { + Type = type; + State = state; + Action = action; + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Hoversel.cs b/src/ElmSharp/ElmSharp/Hoversel.cs new file mode 100644 index 0000000..6adca62 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Hoversel.cs @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The HoverselItemEventArgs is an HoverselItem's EventArgs + /// + public class HoverselItemEventArgs : EventArgs + { + /// + /// Hoversel's Item + /// + public HoverselItem Item { get; set; } + + internal static HoverselItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + HoverselItem item = ItemObject.GetItemByHandle(info) as HoverselItem; + return new HoverselItemEventArgs() { Item = item }; + } + } + + /// + /// The hoversel is a button that pops up a list of items. + /// + public class Hoversel : Layout + { + SmartEvent _clicked; + SmartEvent _expanded; + SmartEvent _dismissed; + SmartEvent _selected; + Interop.Evas.SmartCallback _onItemSelected; + + /// + /// Creates and initializes a new instance of the Hoversel class. + /// + /// The parent is a given container which will be attached by Hoversel as a child. It's type. + public Hoversel(EvasObject parent) : base(parent) + { + _clicked = new SmartEvent(this, "clicked"); + _clicked.On += (sender, e) => + { + Clicked?.Invoke(this, EventArgs.Empty); + }; + _expanded = new SmartEvent(this, "expanded"); + _expanded.On += (sender, e) => + { + Expanded?.Invoke(this, EventArgs.Empty); + }; + _dismissed = new SmartEvent(this, "dismissed"); + _dismissed.On += (sender, e) => + { + Dismissed?.Invoke(this, EventArgs.Empty); + }; + _selected = new SmartEvent(this, RealHandle, "selected", HoverselItemEventArgs.CreateFromSmartEvent); + _selected.On += (s, e) => + { + if (e.Item != null) ItemSelected?.Invoke(this, e); + }; + _onItemSelected = (data, obj, info) => + { + HoverselItem item = ItemObject.GetItemById((int)data) as HoverselItem; + item?.SendItemSelected(); + }; + } + + /// + /// Clicked will be triggered when Hoversel is clicked + /// + public event EventHandler Clicked; + + /// + /// Expanded will be triggered when Hoversel is activated by clicking the hoversel or by a function + /// + public event EventHandler Expanded; + + /// + /// Dismissed will be triggered when Hoversel Dismissed + /// + public event EventHandler Dismissed; + + /// + /// ItemSelected will be triggered when Hoversel's Item Selected + /// + public event EventHandler ItemSelected; + + /// + /// Gets or sets the status to control whether the hoversel should expand horizontally. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_hoversel_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_hoversel_horizontal_set(RealHandle, value); + } + } + + /// + /// Gets or sets the hover parent. + /// + public IntPtr HoverParent + { + get + { + return Interop.Elementary.elm_hoversel_hover_parent_get(RealHandle); + } + set + { + Interop.Elementary.elm_hoversel_hover_parent_set(RealHandle, value); + } + } + + /// + /// Gets the flag of whether the hoversel is expanded. + /// + public bool IsExpanded + { + get + { + return Interop.Elementary.elm_hoversel_expanded_get(RealHandle); + } + } + + /// + /// Gets or sets the status of whether update icon and text of hoversel same to those of selected item automatically. + /// + public bool AutoUpdate + { + get + { + return Interop.Elementary.elm_hoversel_auto_update_get(RealHandle); + } + set + { + Interop.Elementary.elm_hoversel_auto_update_set(RealHandle, value); + } + } + + /// + /// This triggers the hoversel popup from code, the same as if the user had clicked the button. + /// + public void HoverBegin() + { + Interop.Elementary.elm_hoversel_hover_begin(RealHandle); + } + + /// + /// This dismisses the hoversel popup as if the user had clicked outside the hover. + /// + public void HoverEnd() + { + Interop.Elementary.elm_hoversel_hover_end(RealHandle); + } + + /// + /// This will remove all the children items from the hoversel. + /// + public void Clear() + { + Interop.Elementary.elm_hoversel_clear(RealHandle); + } + + /// + /// Add an item to the hoversel button. + /// This adds an item to the hoversel to show when it is clicked. + /// + /// Item's label + /// A handle to the added item. + public HoverselItem AddItem(string label) + { + HoverselItem item = new HoverselItem(); + item.Label = label; + item.Handle = Interop.Elementary.elm_hoversel_item_add(RealHandle, label, null, 0, _onItemSelected, (IntPtr)item.Id); + return item; + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + RealHandle = Interop.Elementary.elm_hoversel_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/HoverselItem.cs b/src/ElmSharp/ElmSharp/HoverselItem.cs new file mode 100755 index 0000000..ebdaece --- /dev/null +++ b/src/ElmSharp/ElmSharp/HoverselItem.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The HoverselItem is the Item of Hoversel + /// + public class HoverselItem : ItemObject + { + internal HoverselItem() : base(IntPtr.Zero) + { + } + + /// + /// HoverselItem's label + /// + public string Label { get; internal set; } + + /// + /// ItemSelected will be triggered when HoverselItem Selected + /// + public event EventHandler ItemSelected; + + internal void SendItemSelected() + { + ItemSelected?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/src/ElmSharp/ElmSharp/IAccessibleObject.cs b/src/ElmSharp/ElmSharp/IAccessibleObject.cs new file mode 100755 index 0000000..f1488ff --- /dev/null +++ b/src/ElmSharp/ElmSharp/IAccessibleObject.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace ElmSharp.Accessible +{ + /// + /// IAccessibleObject is a interface which defines properties and methods of accessible object. + /// + public interface IAccessibleObject + { + ReadingInfoType ReadingInfoType { get; set; } + AccessRole Role { get; set; } + bool CanHighlight { get; set; } + string TranslationDomain { get; set; } + string Name { get; set; } + string Description { get; set; } + AccessibleInfoProvider NameProvider { get; set; } + AccessibleInfoProvider DescriptionProvider { get; set; } + void AppendRelation(IAccessibleRelation relation); + void RemoveRelation(IAccessibleRelation relation); + void Highlight(); + void Unhighlight(); + } +} diff --git a/src/ElmSharp/ElmSharp/Icon.cs b/src/ElmSharp/ElmSharp/Icon.cs new file mode 100755 index 0000000..3ebff8f --- /dev/null +++ b/src/ElmSharp/ElmSharp/Icon.cs @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for the icon lookup order. Should look for icons in the theme, FDO paths, or both. + /// + public enum IconLookupOrder + { + /// + /// Icon look up order: freedesktop, theme + /// + FreeDesktopFirst = 0, + /// + /// Icon look up order: theme, freedesktop + /// + ThemeFirst, + /// + /// Icon look up order: freedesktop + /// + FreeDesktopOnly, + /// + /// Icon look up order: theme + /// + ThemeOnly + } + + /// + /// The Icon is a widget that displays standard icon images ("delete", "edit", "arrows", etc.) + /// or images coming from a custom file (PNG, JPG, EDJE, etc.), on icon context. + /// Inherits Image + /// + public class Icon : Image + { + /// + /// Creates and initializes a new instance of Icon class. + /// + /// The parent is a given container which will be attached by Icon as a child. It's type. + public Icon(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets the standard icon name of a given Icon widget. + /// + public string StandardIconName + { + get + { + return Interop.Elementary.elm_icon_standard_get(RealHandle); + } + set + { + Interop.Elementary.elm_icon_standard_set(RealHandle, value); + } + } + + /// + /// Sets or gets the icon lookup order of a given Icon widget. + /// + public IconLookupOrder IconLookupOrder + { + get + { + return (IconLookupOrder)Interop.Elementary.elm_icon_order_lookup_get(RealHandle); + } + set + { + Interop.Elementary.elm_icon_order_lookup_set(RealHandle, (int)value); + } + } + + /// + /// Sets the file that is used, but uses a generated thumbnail. + /// + /// The path to the file that is used as an icon image + /// The group that the icon belongs to + public void SetThumb(string file, string group) + { + Interop.Elementary.elm_icon_thumb_set(RealHandle, file, group); + } + + /// + /// Adds a new icon object to the parent. + /// + /// EvasObject + /// The new object, otherwise NULL if it cannot be created + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + RealHandle = Interop.Elementary.elm_icon_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Image.cs b/src/ElmSharp/ElmSharp/Image.cs new file mode 100644 index 0000000..743cb42 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Image.cs @@ -0,0 +1,688 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace ElmSharp +{ + /// + /// The Image is a widget that allows one to load and display an image file on it, + /// be it from a disk file or from a memory region. + /// Inherits Widget + /// + public class Image : Widget + { + bool _canScaleUp = true; + bool _canScaleDown = true; + SmartEvent _clicked; + Color _color = Color.Default; + + /// + /// Creates and initializes a new instance of Image class. + /// + /// The parent is a given container which will be attached by Image as a child. It's type. + public Image(EvasObject parent) : base(parent) + { + _clicked = new SmartEvent(this, "clicked"); + _clicked.On += (s, e) => Clicked?.Invoke(this, EventArgs.Empty); + } + + /// + /// Clicked will be triggered when the image is clicked. + /// + public event EventHandler Clicked; + + /// + /// LoadingCompleted will be triggered when the image is loaded completely. + /// + public event EventHandler LoadingCompleted; + + /// + /// Clicked will be triggered when the image is fail to load. + /// + public event EventHandler LoadingFailed; + + /// + /// Gets the file that is used as an image. + /// + public string File + { + get + { + return Interop.Elementary.elm_image_file_get(RealHandle); + } + } + + /// + /// Sets or gets the smooth effect for an image. + /// + public bool IsSmooth + { + get + { + return Interop.Elementary.elm_image_smooth_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_smooth_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether scaling is disabled on the object. + /// + public bool IsScaling + { + get + { + return !Interop.Elementary.elm_image_no_scale_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_no_scale_set(RealHandle, !value); + } + } + + /// + /// Sets or gets whether the object is down resizeable. + /// + public bool CanScaleDown + { + get + { + return _canScaleDown; + } + set + { + _canScaleDown = value; + Interop.Elementary.elm_image_resizable_set(RealHandle, _canScaleUp, _canScaleDown); + } + } + + /// + /// Sets or gets whether the object is up resizeable. + /// + public bool CanScaleUp + { + get + { + return _canScaleUp; + } + set + { + _canScaleUp = value; + Interop.Elementary.elm_image_resizable_set(RealHandle, _canScaleUp, _canScaleDown); + } + } + + /// + /// Sets or gets whether the image fills the entire object area, when keeping the aspect ratio. + /// + public bool CanFillOutside + { + get + { + return Interop.Elementary.elm_image_fill_outside_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_fill_outside_set(RealHandle, value); + } + } + + /// + /// Sets or gets the prescale size for the image. + /// + public int PrescaleSize + { + get + { + return Interop.Elementary.elm_image_prescale_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_prescale_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the original aspect ratio of the image should be kept on resize. + /// + public bool IsFixedAspect + { + get + { + return Interop.Elementary.elm_image_aspect_fixed_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_aspect_fixed_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether an image object (which supports animation) is to animate itself. + /// + public bool IsAnimated + { + get + { + return Interop.Elementary.elm_image_animated_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_animated_set(RealHandle, value); + } + } + + /// + /// Gets whether an image object supports animation. + /// + public bool IsAnimatedAvailable + { + get + { + return Interop.Elementary.elm_image_animated_available_get(RealHandle); + } + } + + /// + /// Sets or gets whether an image object is under animation. + /// + /// + /// An image object, even if it supports animation, will be displayed by default without animation. + /// To actually start playing any image object's animation, should be TRUE before setting this property true. + /// + public bool IsAnimationPlaying + { + get + { + return Interop.Elementary.elm_image_animated_play_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_animated_play_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the image is 'editable'. + /// + public bool IsEditable + { + get + { + return Interop.Elementary.elm_image_editable_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_editable_set(RealHandle, value); + } + } + + /// + /// Gets the current size of the image. + /// + public Size ObjectSize + { + get + { + Interop.Elementary.elm_image_object_size_get(RealHandle, out int w, out int h); + return new Size(w, h); + } + } + + /// + /// Sets or gets whether alpha channel data is being used on the given image object. + /// + public bool IsOpaque + { + get + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + if (evasObj != IntPtr.Zero) + { + return !Interop.Evas.evas_object_image_alpha_get(evasObj); + } + return false; + } + set + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + if (evasObj != IntPtr.Zero) + { + Interop.Evas.evas_object_image_alpha_set(evasObj, !value); + } + } + } + + /// + /// Sets or gets the image orientation. + /// + public ImageOrientation Orientation + { + get + { + return (ImageOrientation)Interop.Elementary.elm_image_orient_get(RealHandle); + } + set + { + Interop.Elementary.elm_image_orient_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets the image color + /// + public override Color Color + { + get + { + return _color; + } + set + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + if (evasObj != IntPtr.Zero) + { + if (value.IsDefault) + { + // Currently, we assume the Image.Color property as a blending color (actually, multiply blending). + // Thus we are using Color.White (255,255,255,255) as a default color to ensure original image color. (255/255 * original = original) + Interop.Evas.evas_object_color_set(evasObj, 255, 255, 255, 255); + } + else + { + Interop.Evas.SetPremultipliedColor(evasObj, value.R, value.G, value.B, value.A); + } + } + _color = value; + } + } + + /// + /// Sets the background color + /// + public override Color BackgroundColor + { + set + { + if (value.IsDefault) + { + SetPartColor("bg", Color.Transparent); + } + else + { + SetPartColor("bg", value); + } + _backgroundColor = value; + } + } + + /// + /// Sets the dimensions for an image object's border, a region which is not scaled together with its center ever. + /// + /// The border's left width + /// The border's right width + /// The border's top width + /// The border's bottom width + public void SetBorder(int left, int right, int top, int bottom) + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + Interop.Evas.evas_object_image_border_set(evasObj, left, right, top, bottom); + } + + /// + /// Sets or gets if the center part of the given image object (not the border) should be drawn. + /// + /// + /// When rendering, the image may be scaled to fit the size of the image object. + /// This function sets if the center part of the scaled image is to be drawn or left completely blank, or forced to be solid. + /// Very useful for frames and decorations. + /// + public ImageBorderFillMode BorderCenterFillMode + { + get + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + return (ImageBorderFillMode)Interop.Evas.evas_object_image_border_center_fill_get(evasObj); + } + set + { + IntPtr evasObj = Interop.Elementary.elm_image_object_get(RealHandle); + Interop.Evas.evas_object_image_border_center_fill_set(evasObj, (int)value); + } + } + + /// + /// Sets the file that is used as the image's source. + /// + /// The path to the file that is used as an image source + /// (true = success, false = error) + public bool Load(string file) + { + if (file == null) + throw new ArgumentNullException("file"); + + Interop.Elementary.elm_image_async_open_set(RealHandle, false); + Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true); + return Interop.Elementary.elm_image_file_set(RealHandle, file, null); + } + + /// + /// Sets the uri that is used as the image's source. + /// + /// The uri to the file that is used as an image source + /// (true = success, false = error) + public bool Load(Uri uri) + { + if (uri == null) + throw new ArgumentNullException("uri"); + + return Load(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri); + } + + /// + /// Sets a location in the memory to be used as an image object's source bitmap. + /// + /// + /// This function is handy when the contents of an image file are mapped into the memory, for example. + /// The format string should be something like "png", "jpg", "tga", "tiff", "bmp" etc, when provided (null, on the contrary). + /// This improves the loader performance as it tries the "correct" loader first, before trying a range of other possible loaders until one succeeds. + /// + /// The binary data that is used as an image source + /// The size of the binary data blob img + /// (true = success, false = error) + [Obsolete("This method will be removed. Use Load(Stream stream) instead.")] + public unsafe bool Load(byte* img, long size) + { + if (img == null) + throw new ArgumentNullException("img"); + + Interop.Elementary.elm_image_async_open_set(RealHandle, false); + Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true); + return Interop.Elementary.elm_image_memfile_set(RealHandle, img, size, IntPtr.Zero, IntPtr.Zero); + } + + /// + /// Sets the stream that is used as the image's source. + /// + /// The stream that is used as an image source + /// (true = success, false = error) + public bool Load(Stream stream) + { + if (stream == null) + throw new ArgumentNullException("stream"); + + Interop.Elementary.elm_image_async_open_set(RealHandle, false); + Interop.Elementary.elm_image_preload_disabled_set(RealHandle, true); + MemoryStream memstream = new MemoryStream(); + stream.CopyTo(memstream); + unsafe + { + byte[] dataArr = memstream.ToArray(); + fixed (byte* data = &dataArr[0]) + { + return Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero); + } + } + } + + /// + /// Sets the file that is used as the image's source with async. + /// + /// The path to the file that is used as an image source + /// cancellation token + /// (true = success, false = error) + public Task LoadAsync(string file, CancellationToken cancellationToken = default(CancellationToken)) + { + if (file == null) + throw new ArgumentNullException("file"); + + Interop.Elementary.elm_image_async_open_set(RealHandle, true); + Interop.Elementary.elm_image_preload_disabled_set(RealHandle, false); + + var tcs = new TaskCompletionSource(); + + cancellationToken.Register(() => + { + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetCanceled(); + } + }); + + SmartEvent loadReady = new SmartEvent(this, RealHandle, "load,ready"); + loadReady.On += (s, e) => + { + loadReady.Dispose(); + LoadingCompleted?.Invoke(this, EventArgs.Empty); + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetResult(true); + } + }; + + SmartEvent loadError = new SmartEvent(this, RealHandle, "load,error"); + loadError.On += (s, e) => + { + loadError.Dispose(); + LoadingFailed?.Invoke(this, EventArgs.Empty); + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetResult(false); + } + }; + + bool ret = Interop.Elementary.elm_image_file_set(RealHandle, file, null); + if (!ret) + { + throw new InvalidOperationException("Failed to set file to Image"); + } + + return tcs.Task; + } + + /// + /// Sets the uri that is used as the image's source with async. + /// + /// The uri to the file that is used as an image source + /// cancellation token + /// (true = success, false = error) + public Task LoadAsync(Uri uri, CancellationToken cancellationToken = default(CancellationToken)) + { + if (uri == null) + throw new ArgumentNullException("uri"); + + return LoadAsync(uri.IsFile ? uri.LocalPath : uri.AbsoluteUri, cancellationToken); + } + + /// + /// Sets the stream that is used as the image's source with async. + /// + /// The stream that is used as an image source + /// cancellation token + /// (true = success, false = error) + public async Task LoadAsync(Stream stream, CancellationToken cancellationToken = default(CancellationToken)) + { + if (stream == null) + throw new ArgumentNullException("stream"); + + Interop.Elementary.elm_image_async_open_set(RealHandle, true); + Interop.Elementary.elm_image_preload_disabled_set(RealHandle, false); + + var tcs = new TaskCompletionSource(); + + cancellationToken.Register(() => + { + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetCanceled(); + } + }); + + SmartEvent loadReady = new SmartEvent(this, RealHandle, "load,ready"); + loadReady.On += (s, e) => + { + loadReady.Dispose(); + LoadingCompleted?.Invoke(this, EventArgs.Empty); + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetResult(true); + } + }; + + SmartEvent loadError = new SmartEvent(this, RealHandle, "load,error"); + loadError.On += (s, e) => + { + loadError.Dispose(); + LoadingFailed?.Invoke(this, EventArgs.Empty); + if (tcs != null && !tcs.Task.IsCompleted) + { + tcs.SetResult(false); + } + }; + + MemoryStream memstream = new MemoryStream(); + await stream.CopyToAsync(memstream); + + unsafe + { + byte[] dataArr = memstream.ToArray(); + fixed (byte* data = &dataArr[0]) + { + bool ret = Interop.Elementary.elm_image_memfile_set(RealHandle, data, dataArr.Length, IntPtr.Zero, IntPtr.Zero); + if (!ret) + { + return false; + } + } + } + + return await tcs.Task; + } + + /// + /// Sets the color of color class for a given widget. + /// + /// The name of color class. + /// The struct of color + public override void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + /// + /// Gets the color of color class for a given widget. + /// + /// The name of color class. + /// color object + public override Color GetPartColor(string part) + { + Interop.Elementary.elm_object_color_class_color_get(Handle, part, out int r, out int g, out int b, out int a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + + /// + /// Sets the content at a part of a given container widget. + /// + /// The parent is a given container which will be attached by Image as a child. It's type. + /// The new object, otherwise null if it cannot be created + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + RealHandle = Interop.Elementary.elm_image_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } + + /// + /// Enumeration for the fill mode of image border + /// + public enum ImageBorderFillMode + { + /// + /// None mode of image border + /// + None, + + /// + /// Default mode of image border + /// + Default, + + /// + /// Solid mode of image border + /// + Solid, + } + + /// + /// Enumeration for the possible orientation options + /// + public enum ImageOrientation : int + { + /// + /// No orientation change + /// + None = 0, + + /// + /// Rotate 90 degrees clockwise + /// + Rotate90, + + /// + /// Rotate 180 degrees clockwise + /// + Rotate180, + + /// + /// Rotate 90 degrees counter-clockwise (i.e. 270 degrees clockwise) + /// + Rotate270, + + /// + /// Flip image horizontally + /// + FlipHorizontal, + + /// + /// Flip image vertically + /// + FlipVertical, + + /// + /// Flip the image along the y = (width - x) line (bottom-left to top-right) + /// + FlipTranspose, + + /// + /// Flip the image along the y = x line (top-left to bottom-right) + /// + FlipTransverse + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Index.cs b/src/ElmSharp/ElmSharp/Index.cs new file mode 100755 index 0000000..f73ec7a --- /dev/null +++ b/src/ElmSharp/ElmSharp/Index.cs @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// An index widget gives you an index for fast access to whichever group of other UI items one might have. + /// Inherits Layout + /// + public class Index : Layout + { + HashSet _children = new HashSet(); + SmartEvent _delayedChanged; + + /// + /// Creates and initializes a new instance of Index class. + /// + /// The parent is a given container which will be attached by Index as a child. It's type. + public Index(EvasObject parent) : base(parent) + { + _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed"); + _delayedChanged.On += _delayedChanged_On; + } + + /// + /// Changed will be triggered when the selected index item is changed. + /// + public event EventHandler Changed; + + /// + /// Sets or gets the auto hiding feature is enabled or not for a given index widget. + /// + public bool AutoHide + { + get + { + return !Interop.Elementary.elm_index_autohide_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_autohide_disabled_set(RealHandle, !value); + } + } + + /// + /// Sets or gets a value whether horizontal mode is enabled or not. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_index_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value of indicator's disabled status. + /// + public bool IndicatorVisible + { + get + { + return !Interop.Elementary.elm_index_indicator_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_indicator_disabled_set(RealHandle, !value); + } + } + + /// + /// Sets or gets the omit feature is enabled or not for a given index widget. + /// + public bool OmitEnabled + { + get + { + return Interop.Elementary.elm_index_omit_enabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_omit_enabled_set(RealHandle, value); + } + } + + /// + /// Set a delay change time for index object. + /// delay time is 0.2 sec by default. + /// + public double Delay + { + get + { + return Interop.Elementary.elm_index_delay_change_time_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_delay_change_time_set(RealHandle, value); + } + } + + /// + /// Gets or sets the items level for a given index widget. + /// + public int Level + { + get + { + return Interop.Elementary.elm_index_item_level_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_item_level_set(RealHandle, value); + } + } + + /// + /// Control standard_priority group of index. + /// Priority group will be shown as many items as it can, and other group will be shown one character only. + /// + public int Priority + { + get + { + return Interop.Elementary.elm_index_standard_priority_get(RealHandle); + } + set + { + Interop.Elementary.elm_index_standard_priority_set(RealHandle, value); + } + } + + /// + /// Gets the last selected item, for a given index widget. + /// + public IndexItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_index_selected_item_get(RealHandle, 0); + return ItemObject.GetItemByHandle(handle) as IndexItem; + } + } + + /// + /// Append a new item on a given index widget. + /// + /// the label which the item should be indexed + /// A object to the IndexItem added or null, on errors + public IndexItem Append(string label) + { + IndexItem item = new IndexItem(label); + item.Handle = Interop.Elementary.elm_index_item_append(RealHandle, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Prepend a new item on a given index widget. + /// + /// the label which the item should be indexed + /// A handle to the item added or NULL, on errors + public IndexItem Prepend(string label) + { + IndexItem item = new IndexItem(label); + item.Handle = Interop.Elementary.elm_index_item_prepend(RealHandle, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Insert a new item into the index object before item before. + /// + /// the label which the item should be indexed + /// The index item to insert after. + /// A object to the IndexItem added or null, on errors + public IndexItem InsertBefore(string label, IndexItem before) + { + IndexItem item = new IndexItem(label); + item.Handle = Interop.Elementary.elm_index_item_insert_before(RealHandle, before, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Insert a new item into the index object after item after. + /// + /// the label which the item should be indexed + /// The index item to insert after. + /// A object to the IndexItem added or null, on errors + public IndexItem InsertAfter(string label, IndexItem after) + { + IndexItem item = new IndexItem(label); + item.Handle = Interop.Elementary.elm_index_item_insert_after(RealHandle, after, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Flush the changes made to the index items so they work correctly. + /// + /// The index level (one of 0 or 1) where changes were made + public void Update(int level) + { + Interop.Elementary.elm_index_level_go(RealHandle, level); + } + + /// + /// Removes all items from a given index widget. + /// + public void Clear() + { + Interop.Elementary.elm_index_item_clear(RealHandle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_index_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + void _delayedChanged_On(object sender, EventArgs e) + { + SelectedItem?.SendSelected(); + Changed?.Invoke(this, e); + } + + void AddInternal(IndexItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((IndexItem)sender); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/IndexItem.cs b/src/ElmSharp/ElmSharp/IndexItem.cs new file mode 100755 index 0000000..67dcfd4 --- /dev/null +++ b/src/ElmSharp/ElmSharp/IndexItem.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace ElmSharp +{ + /// + /// The IndexItem is used to manage index item + /// Inherits ItemObject + /// + public class IndexItem : ItemObject + { + /// + /// Creates and initializes a new instance of IndexItem class. + /// + /// the text is set to the Text. It's 'string' type. + public IndexItem(string text) : base(IntPtr.Zero) + { + Text = text; + } + + /// + /// Selected will be triggered when the index item is selected + /// + public event EventHandler Selected; + + /// + /// Gets the text + /// + public string Text { get; private set; } + + /// + /// Sets the selected state of an item. + /// + /// The selected state + public void Select(bool selected) + { + Interop.Elementary.elm_index_item_selected_set(Handle, selected); + } + internal void SendSelected() + { + Selected?.Invoke(this, EventArgs.Empty); + } + + } +} diff --git a/src/ElmSharp/ElmSharp/ItemObject.cs b/src/ElmSharp/ElmSharp/ItemObject.cs new file mode 100644 index 0000000..f009396 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ItemObject.cs @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// The ItemObject is used to manage item object + /// + public class ItemObject + { + private static Dictionary s_IdToItemTable = new Dictionary(); + private static Dictionary s_HandleToItemTable = new Dictionary(); + private static int s_globalId = 0; + + readonly Dictionary _partContents = new Dictionary(); + Interop.Evas.SmartCallback _deleteCallback; + IntPtr _handle = IntPtr.Zero; + Dictionary _signalDatas = new Dictionary(); + EvasObject _trackObject = null; + + /// + /// Creates and initializes a new instance of ItemObject class. + /// + /// IntPtr + protected ItemObject(IntPtr handle) + { + _deleteCallback = DeleteCallbackHandler; + Id = GetNextId(); + s_IdToItemTable[Id] = this; + Handle = handle; + } + + // C# Finalizer was called on GC thread + // So, We can't access to EFL object + // And When Finalizer was called, Field can be already released. + //~ItemObject() + //{ + // if (Handle != IntPtr.Zero) + // Interop.Elementary.elm_object_item_del(Handle); + //} + + /// + /// Gets the id of item object + /// + public int Id { get; private set; } + + /// + /// Sets or gets whether the item object is enabled + /// + public bool IsEnabled + { + get { return !Interop.Elementary.elm_object_item_disabled_get(Handle); } + set { Interop.Elementary.elm_object_item_disabled_set(Handle, !value); } + } + + /// + /// Gets track object of the item. + /// + public EvasObject TrackObject + { + get + { + if (_trackObject == null) + _trackObject = new ItemEvasObject(Handle); + return _trackObject; + } + } + + internal IntPtr Handle + { + get + { + return _handle; + } + set + { + if (_handle == value) + return; + + if (_handle != IntPtr.Zero) + { + UnsetDeleteCallback(); + } + _handle = value; + SetDeleteCallback(); + s_HandleToItemTable[Handle] = this; + } + } + + /// + /// Deleted will be triggered when the item object is deleted + /// + public event EventHandler Deleted; + + /// + /// Delete the item object + /// + public void Delete() + { + Interop.Elementary.elm_object_item_del(Handle); + _handle = IntPtr.Zero; + } + + /// + /// Set a content of an object item and delete old content + /// + /// The content part name (null for the default content) + /// The content of the object item + public void SetPartContent(string part, EvasObject content) + { + SetPartContent(part, content, false); + } + + /// + /// Set a content of an object item + /// + /// The content part name (null for the default content) + /// The content of the object item + /// judge whether delete old content + public void SetPartContent(string part, EvasObject content, bool preserveOldContent) + { + IntPtr oldContent = Interop.Elementary.elm_object_item_part_content_unset(Handle, part); + if (oldContent != IntPtr.Zero && !preserveOldContent) + { + Interop.Evas.evas_object_del(oldContent); + } + Interop.Elementary.elm_object_item_part_content_set(Handle, part, content); + _partContents[part ?? "__default__"] = content; + } + + /// + /// Set a label of an object item + /// + /// The text part name (null for the default label) + /// Text of the label + public void SetPartText(string part, string text) + { + Interop.Elementary.elm_object_item_part_text_set(Handle, part, text); + } + + /// + /// Gets a label of an object item + /// + /// The text part name (null for the default label) + /// + public string GetPartText(string part) + { + return Interop.Elementary.elm_object_item_part_text_get(Handle, part); + } + + /// + /// Sets color of an object item + /// + /// The text part name (null for the default label) + /// the color + public void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_item_color_class_color_set(Handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + /// + /// Gets color of an object item + /// + /// The text part name (null for the default label) + /// the color of object item + public Color GetPartColor(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_item_color_class_color_get(Handle, part, out r, out g, out b, out a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + + /// + /// Deletes color of an object item + /// + /// The text part name + public void DeletePartColor(string part) + { + Interop.Elementary.elm_object_item_color_class_del(Handle, part); + } + + /// + /// Add a function for a signal emitted by object item edje. + /// + /// The signal's name. + /// The signal's source. + /// The function to be executed when the signal is emitted. + public void AddSignalHandler(string emission, string source, Func func) + { + if (emission != null && source != null && func != null) + { + var signalData = new SignalData(emission, source, func); + if (!_signalDatas.ContainsKey(signalData)) + { + var signalCallback = new Interop.Elementary.Elm_Object_Item_Signal_Cb((d, o, e, s) => + { + return func(e, s); + }); + Interop.Elementary.elm_object_item_signal_callback_add(Handle, emission, source, signalCallback, IntPtr.Zero); + } + } + } + + /// + /// Remove a signal-triggered function from a object item edje object. + /// + /// The signal's name. + /// The signal's source. + /// The function to be executed when the signal is emitted. + public void RemoveSignalHandler(string emission, string source, Func func) + { + if (emission != null && source != null && func != null) + { + var signalData = new SignalData(emission, source, func); + + Interop.Elementary.Elm_Object_Item_Signal_Cb signalCallback = null; + _signalDatas.TryGetValue(signalData, out signalCallback); + + if (signalCallback != null) + { + Interop.Elementary.elm_object_item_signal_callback_del(Handle, emission, source, signalCallback); + _signalDatas.Remove(signalData); + } + } + } + + /// + /// Send a signal to the edje object of the widget item. + /// + /// The signal's name. + /// The signal's source. + public void EmitSignal(string emission, string source) + { + Interop.Elementary.elm_object_item_signal_emit(Handle, emission, source); + } + + /// + /// Gets the handle of object item + /// + /// ItemObject + public static implicit operator IntPtr(ItemObject obj) + { + if (obj == null) + return IntPtr.Zero; + return obj.Handle; + } + + /// + /// OnInvalidate of object item + /// + protected virtual void OnInvalidate() { } + + internal static ItemObject GetItemById(int id) + { + ItemObject value; + s_IdToItemTable.TryGetValue(id, out value); + return value; + } + + internal static ItemObject GetItemByHandle(IntPtr handle) + { + ItemObject value; + s_HandleToItemTable.TryGetValue(handle, out value); + return value; + } + + void DeleteCallbackHandler(IntPtr data, IntPtr obj, IntPtr info) + { + Deleted?.Invoke(this, EventArgs.Empty); + OnInvalidate(); + if (s_IdToItemTable.ContainsKey(Id)) + { + s_IdToItemTable.Remove(Id); + } + if (s_HandleToItemTable.ContainsKey(_handle)) + { + s_HandleToItemTable.Remove(_handle); + } + _partContents.Clear(); + _handle = IntPtr.Zero; + } + + void UnsetDeleteCallback() + { + Interop.Elementary.elm_object_item_del_cb_set(Handle, null); + } + + void SetDeleteCallback() + { + if (Handle != IntPtr.Zero) + Interop.Elementary.elm_object_item_del_cb_set(Handle, _deleteCallback); + } + + static int GetNextId() + { + return s_globalId++; + } + + class SignalData + { + public string Emission { get; set; } + public string Source { get; set; } + public Func Func { get; set; } + + public SignalData(string emission, string source, Func func) + { + Emission = emission; + Source = source; + Func = func; + } + + public override bool Equals(object obj) + { + SignalData s = obj as SignalData; + if (s == null) + { + return false; + } + return (Emission == s.Emission) && (Source == s.Source) && (Func == s.Func); + } + + public override int GetHashCode() + { + int hashCode = Emission.GetHashCode(); + hashCode ^= Source.GetHashCode(); + hashCode ^= Func.GetHashCode(); + return hashCode; + } + } + + class ItemEvasObject : EvasObject + { + IntPtr _parent = IntPtr.Zero; + + public ItemEvasObject(IntPtr parent) : base() + { + _parent = parent; + Realize(null); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_object_item_track(_parent); + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/ItemObjectExtension.cs b/src/ElmSharp/ElmSharp/ItemObjectExtension.cs new file mode 100755 index 0000000..ef8b609 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ItemObjectExtension.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The ItemObjectExtension is used to manage item object extension + /// + public static class ItemObjectExtension + { + /// + /// Grab high light of item object + /// + /// the item object which is grabbed high light + public static void GrabHighlight(this ItemObject obj) + { + Interop.Elementary.elm_atspi_component_highlight_grab(obj.Handle); + } + + /// + /// Clear high light of item object + /// + /// the item object which is cleared high light + public static void ClearHighlight(this ItemObject obj) + { + Interop.Elementary.elm_atspi_component_highlight_clear(obj.Handle); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Label.cs b/src/ElmSharp/ElmSharp/Label.cs new file mode 100755 index 0000000..12aae07 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Label.cs @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace ElmSharp +{ + /// + /// Label is a widget to display text, with simple html-like markup. + /// Inherits Layout + /// + public class Label : Layout + { + SmartEvent _slideCompleted; + + /// + /// Creates and initializes a new instance of Label class. + /// + /// The parent is a given container which will be attached by Label as a child. It's type. + public Label(EvasObject parent) : base(parent) + { + _slideCompleted = new SmartEvent(this, this.RealHandle, "slide,end"); + _slideCompleted.On += (s, e) => + { + SlideCompleted?.Invoke(this, EventArgs.Empty); + }; + } + + /// + /// SlideCompleted will be triggered when the slide is completed. + /// + public event EventHandler SlideCompleted; + + /// + /// Sets or gets wrap width of the label. + /// + public int LineWrapWidth + { + get + { + return Interop.Elementary.elm_label_wrap_width_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_wrap_width_set(RealHandle, value); + } + } + + /// + /// Sets or gets the wrapping behavior of the label. + /// + public WrapType LineWrapType + { + get + { + return (WrapType)Interop.Elementary.elm_label_line_wrap_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_line_wrap_set(RealHandle, (int)value); + if (value != WrapType.None) + { + Interop.Evas.evas_object_size_hint_min_get(RealHandle, IntPtr.Zero, out int h); + Interop.Evas.evas_object_size_hint_min_set(RealHandle, 0, h); + } + } + } + + /// + /// Sets or gets the slide mode of the label widget. + /// + public LabelSlideMode SlideMode + { + get + { + return (LabelSlideMode)Interop.Elementary.elm_label_slide_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_slide_mode_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets the slide duration of the label. + /// + public double SlideDuration + { + get + { + return Interop.Elementary.elm_label_slide_duration_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_slide_duration_set(RealHandle, value); + } + } + + /// + /// Sets or gets the slide Speed of the label. + /// + /// + /// The speed of the slide animation in px per seconds. + /// If you set the duration of the slide using elm_label_slide_duration_set() you cannot get the correct speed using this function until the label is actually rendered and resized. + /// + /// + public double SlideSpeed + { + get + { + return Interop.Elementary.elm_label_slide_speed_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_slide_speed_set(RealHandle, value); + } + } + + /// + /// Sets or gets the ellipsis behavior of the label. + /// + public bool IsEllipsis + { + get + { + return Interop.Elementary.elm_label_ellipsis_get(RealHandle); + } + set + { + Interop.Elementary.elm_label_ellipsis_set(RealHandle, value); + } + } + + /// + /// Sets or gets the style of the label text. + /// + /// + /// APIs, elm_label_text_style_user_peek/pop/push, are internal APIs only in Tizen. Avalilable since Tizen_4.0. + /// + /// + public string TextStyle + { + get + { + return Interop.Elementary.elm_label_text_style_user_peek(RealHandle); + } + set + { + if (string.IsNullOrEmpty(value)) + { + Interop.Elementary.elm_label_text_style_user_pop(RealHandle); + } + else + { + Interop.Elementary.elm_label_text_style_user_push(RealHandle, value); + } + } + } + + /// + /// Start slide effect. + /// + public void PlaySlide() + { + Interop.Elementary.elm_label_slide_go(RealHandle); + } + + /// + /// Sets the content at a part of a given container widget. + /// + /// EvasObject + /// The new object, otherwise null if it cannot be created + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_label_add(parent.Handle); + } + } + + /// + /// Enumeration for slide mode of a label widget + /// + public enum LabelSlideMode + { + /// + /// no slide effect + /// + None = 0, + /// + /// slide only if the label area is bigger than the text width length + /// + Auto, + /// + /// slide always + /// + Always + } +} diff --git a/src/ElmSharp/ElmSharp/Layout.cs b/src/ElmSharp/ElmSharp/Layout.cs new file mode 100644 index 0000000..9a45bbe --- /dev/null +++ b/src/ElmSharp/ElmSharp/Layout.cs @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// This is a container widget that takes a standard Edje design file and wraps it very thinly in a widget. + /// Inherits Widget + /// + public class Layout : Container + { + SmartEvent _languageChanged; + SmartEvent _themeChanged; + + IntPtr _edjeHandle; + + /// + /// Creates and initializes a new instance of Layout class. + /// + /// The parent is a given container which will be attached by Layout as a child. It's type. + public Layout(EvasObject parent) : base(parent) + { + _languageChanged = new SmartEvent(this, this.RealHandle, "language,changed"); + _languageChanged.On += (s, e) => + { + LanguageChanged?.Invoke(this, EventArgs.Empty); + }; + + _themeChanged = new SmartEvent(this, this.RealHandle, "theme,changed"); + _themeChanged.On += (s, e) => + { + ThemeChanged?.Invoke(this, EventArgs.Empty); + }; + } + + /// + /// LanguageChanged will be triggered when the program's language is changed. + /// + public event EventHandler LanguageChanged; + + /// + /// ThemeChanged will be triggered when the theme is changed. + /// + public event EventHandler ThemeChanged; + + /// + /// Gets the edje layout. + /// + public EdjeObject EdjeObject + { + get + { + if (_edjeHandle == IntPtr.Zero) + _edjeHandle = Interop.Elementary.elm_layout_edje_get(RealHandle); + return new EdjeObject(_edjeHandle); + } + } + + /// + /// Gets or sets accessibility state of texblock(text) parts in the layout object. + /// + public bool TextBlockAccessibility + { + get + { + return Interop.Elementary.elm_layout_edje_object_can_access_get(RealHandle); + } + set + { + Interop.Elementary.elm_layout_edje_object_can_access_set(RealHandle, value); + } + } + + /// + /// Freezes the Elementary layout object. + /// This function puts all changes on hold. + /// Successive freezes will nest, requiring an equal number of thaws. + /// + /// The frozen state or 0 if the object is not frozen or on error. + public int Freeze() + { + return Interop.Elementary.elm_layout_freeze(RealHandle); + } + + /// + /// Thaws the Elementary object. + /// If sucessives freezes were done, an equal number of thaws will be required. + /// + /// The frozen state or 0 if the object is not frozen or on error. + public int Thaw() + { + return Interop.Elementary.elm_layout_thaw(RealHandle); + } + + /// + /// Eval sizing. + /// Manually forces a sizing re-evaluation. + /// This is useful when the minimum size required by the edje theme of this layout has changed. + /// The change on the minimum size required by the edje theme is not immediately reported to the elementary layout, so one needs to call this function in order to tell the widget (layout) that it needs to reevaluate its own size. + /// The minimum size of the theme is calculated based on minimum size of parts, the size of elements inside containers like box and table, etc. + /// All of this can change due to state changes, and that's when this function should be called. + /// + public void Resizing() + { + Interop.Elementary.elm_layout_sizing_eval(RealHandle); + } + + /// + /// Request sizing reevaluation, restricted to current width and/or height. + /// Useful mostly when there are TEXTBLOCK parts defining the height of the object and nothing else restricting it to a minimum width.Calling this function will restrict the minimum size in the Edje calculation to whatever size it the layout has at the moment. + /// + /// Restrict minimum size ot the current width. + /// Restrict minimum size ot the current height. + public void Resizing(bool width, bool height) + { + Interop.Elementary.elm_layout_sizing_restricted_eval(RealHandle, width, height); + } + + /// + /// Get the edje data from the given layout. + /// This function fetches data specified inside the edje theme of this layout. + /// This function return NULL if data is not found. + /// + /// The data key + /// The data + public string GetEdjeData(string key) + { + return Interop.Elementary.elm_layout_data_get(RealHandle, key); + } + + /// + /// Gets the text set in the given part. + /// + /// The TEXT part to retrieve the text off. + /// + public override string GetPartText(string part) + { + return Interop.Elementary.elm_layout_text_get(RealHandle, part); + } + + /// + /// Sets the text set in the given part. + /// + /// The TEXT part to retrieve the text off. + /// The text to set. + /// + public override bool SetPartText(string part, string text) + { + return Interop.Elementary.elm_layout_text_set(RealHandle, part, text); + } + + /// + /// Append child to layout box part. + /// Once the object is appended, it will become child of the layout. + /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically. + /// + /// The part + /// The Object to append + /// Sucess is true + public bool BoxAppend(string part, EvasObject child) + { + AddChild(child); + return Interop.Elementary.elm_layout_box_append(RealHandle, part, child.Handle); + } + + /// + /// Prepend child to layout box part. + /// Once the object is prepended, it will become child of the layout. + /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically. + /// + /// The part + /// The Object to prepend + /// Sucess is true + public bool BoxPrepend(string part, EvasObject child) + { + AddChild(child); + return Interop.Elementary.elm_layout_box_prepend(RealHandle, part, child.Handle); + } + + /// + /// Remove a child of the given part box. + /// The object will be removed from the box part and its lifetime will not be handled by the layout anymore. + /// + /// The part + /// The Object to remove + /// Sucess is true + public bool BoxRemove(string part, EvasObject child) + { + RemoveChild(child); + return Interop.Elementary.elm_layout_box_remove(RealHandle, part, child.Handle) != null; + } + + /// + /// Remove all children of the given part box. + /// The objects will be removed from the box part and their lifetime will not be handled by the layout anymore. + /// + /// The part + /// If true, then all objects will be deleted as well, otherwise they will just be removed and will be dangling on the canvas. + /// Sucess is true + public bool BoxRemoveAll(string part, bool clear) + { + ClearChildren(); + return Interop.Elementary.elm_layout_box_remove_all(RealHandle, part, clear); + } + + /// + /// Insert child to layout box part at a given position. + /// Once the object is inserted, it will become child of the layout. + /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically. + /// + /// The part + /// The child object to insert into box. + /// The numeric position >=0 to insert the child. + /// Sucess is true + public bool BoxInsertAt(string part, EvasObject child, uint position) + { + AddChild(child); + return Interop.Elementary.elm_layout_box_insert_at(RealHandle, part, child.Handle, position); + } + + /// + /// Insert child to layout box part before a reference object. + /// Once the object is inserted, it will become child of the layout. + /// Its lifetime will be bound to the layout, whenever the layout dies the child will be deleted automatically. + /// + /// + /// The child object to insert into box. + /// Another reference object to insert before in box. + /// Sucess is true + public bool BoxInsertBefore(string part, EvasObject child, EvasObject reference) + { + AddChild(child); + return Interop.Elementary.elm_layout_box_insert_before(RealHandle, part, child.Handle, reference.Handle); + } + + /// + /// Sets the layout content. + /// + /// The swallow part name in the edje file + /// The child that will be added in this layout object. + /// TRUE on success, FALSE otherwise + public override bool SetPartContent(string part, EvasObject content) + { + return SetPartContent(part, content, false); + } + + /// + /// Sets the layout content. + /// + /// The name of particular part + /// The content + /// true, preserve old content will be unset. false, preserve old content will not be unset. + /// TRUE on success, FALSE otherwise + public override bool SetPartContent(string part, EvasObject content, bool preserveOldContent) + { + if (preserveOldContent) + { + Interop.Elementary.elm_layout_content_unset(RealHandle, part); + } + UpdatePartContents(content, part); + return Interop.Elementary.elm_layout_content_set(RealHandle, part, content); + } + + /// + /// Sets the edje group from the elementary theme that is used as a layout. + /// + /// The class of the group + /// The group + /// The style to use + public void SetTheme(string klass, string group, string style) + { + Interop.Elementary.elm_layout_theme_set(RealHandle, klass, group, style); + } + + /// + /// Sets the file that is used as a layout. + /// + /// The path to the file (edj) that is used as a layout + /// The group that the layout belongs to in the edje file + public void SetFile(string file, string group) + { + Interop.Elementary.elm_layout_file_set(RealHandle, file, group); + } + + /// + /// Sets the back ground color of layout + /// + public override Color BackgroundColor + { + set + { + if (value.IsDefault) + { + string part = ClassName.ToLower().Replace("elm_", "") + "/" + "bg"; + EdjeObject.DeleteColorClass(part); + } + else + { + SetPartColor("bg", value); + } + _backgroundColor = value; + } + } + + /// + /// Sets the vertical text alignment of layout's text part + /// + /// + /// API, elm_layout_text_valign_set, is an internal API only in Tizen. Avalilable since Tizen_4.0. + /// + public virtual void SetVerticalTextAlignment(string part, double valign) + { + Interop.Elementary.elm_layout_text_valign_set(RealHandle, part, valign); + } + + /// + /// Gets the vertical text alignment of layout's text part + /// + /// + /// API, elm_layout_text_valign_get, is internal API only in Tizen. Avalilable since Tizen_4.0. + /// + public virtual double GetVerticalTextAlignment(string part) + { + return Interop.Elementary.elm_layout_text_valign_get(RealHandle, part); + } + + /// + /// Sets the content at a part of a given container widget. + /// + /// The parent is a given container which will be attached by Layout as a child. It's type. + /// The new object, otherwise null if it cannot be created + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_layout_add(parent.Handle); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/List.cs b/src/ElmSharp/ElmSharp/List.cs new file mode 100755 index 0000000..9a14f93 --- /dev/null +++ b/src/ElmSharp/ElmSharp/List.cs @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// Enumeration for setting list's resizing behavior, transverse axis scrolling and items cropping. + /// + public enum ListMode + { + /// + /// The list won't set any of its size hints to inform how a possible container should resize it. + /// Then, if it's not created as a "resize object", it might end with zeroed dimensions. + /// The list will respect the container's geometry and, if any of its items won't fit into its transverse axis, one won't be able to scroll it in that direction. + /// + Compress = 0, + /// + /// This is the same as Compress, with the exception that if any of its items won't fit into its transverse axis, one will be able to scroll it in that direction. + /// + Scroll, + /// + /// Sets a minimum size hint on the genlist object, so that containers may respect it (and resize itself to fit the child properly). + /// More specifically, a minimum size hint will be set for its transverse axis, so that the largest item in that direction fits well. + /// This is naturally bound by the list object's maximum size hints, set externally. + /// + Limit, + /// + /// Besides setting a minimum size on the transverse axis, just like on Limit, the list will set a minimum size on th longitudinal axis, trying to reserve space to all its children to be visible at a time. + /// This is naturally bound by the list object's maximum size hints, set externally. + /// + Expand + } + + /// + /// It inherits System.EventArgs. + /// It contains Item which is type. + /// All events of List contain ListItemEventArgs as a parameter. + /// + public class ListItemEventArgs : EventArgs + { + /// + /// Gets or sets List item. The return type is . + /// + public ListItem Item { get; set; } + + internal static ListItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + ListItem item = ItemObject.GetItemByHandle(info) as ListItem; + return new ListItemEventArgs() { Item = item }; + } + } + + /// + /// It inherits . + /// The List is a widget that aims to display simple list item which has 2 icons and 1 text, and can be selected. + /// For more robust lists, should probably be used. + /// + /// + /// + public class List : Layout + { + HashSet _children = new HashSet(); + SmartEvent _selected; + SmartEvent _unselected; + SmartEvent _doubleClicked; + SmartEvent _longpressed; + SmartEvent _activated; + + /// + /// Creates and initializes a new instance of the List class. + /// + /// The parent is a given container which will be attached by List as a child. It's type. + public List(EvasObject parent) : base(parent) + { + _selected = new SmartEvent(this, this.RealHandle, "selected", ListItemEventArgs.CreateFromSmartEvent); + _unselected = new SmartEvent(this, this.RealHandle, "unselected", ListItemEventArgs.CreateFromSmartEvent); + _doubleClicked = new SmartEvent(this, this.RealHandle, "clicked,double", ListItemEventArgs.CreateFromSmartEvent); + _longpressed = new SmartEvent(this, this.RealHandle, "longpressed", ListItemEventArgs.CreateFromSmartEvent); + _activated = new SmartEvent(this, this.RealHandle, "activated", ListItemEventArgs.CreateFromSmartEvent); + _selected.On += (s, e) => { ItemSelected?.Invoke(this, e); }; + _unselected.On += (s, e) => { ItemUnselected?.Invoke(this, e); }; + _doubleClicked.On += (s, e) => { ItemDoubleClicked?.Invoke(this, e); }; + _longpressed.On += (s, e) => { ItemLongPressed?.Invoke(this, e); }; + _activated.On += (s, e) => { ItemActivated?.Invoke(this, e); }; + } + + /// + /// Gets or sets which mode to use for the list. + /// + public ListMode Mode + { + get + { + return (ListMode)Interop.Elementary.elm_list_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_list_mode_set(RealHandle, (Interop.Elementary.Elm_List_Mode)value); + } + } + + /// + /// Gets the selected item. + /// + public ListItem SelectedItem + { + get + { + IntPtr item = Interop.Elementary.elm_list_selected_item_get(RealHandle); + return ItemObject.GetItemByHandle(item) as ListItem; + } + } + + /// + /// ItemSelected is raised when a new list item is selected. + /// + public event EventHandler ItemSelected; + + /// + /// ItemUnselected is raised when the list item is Unselected. + /// + public event EventHandler ItemUnselected; + + /// + /// ItemDoubleClicked is raised when a new list item is double clicked. + /// + public event EventHandler ItemDoubleClicked; + + /// + /// ItemLongPressed is raised when a list item is pressed for a certain amount of time. By default it's 1 second. + /// + public event EventHandler ItemLongPressed; + + /// + /// ItemActivated is raised when a new list item is double clicked or pressed (enter|return|spacebar). + /// + public event EventHandler ItemActivated; + + /// + /// Starts the list. + /// Call before running on the list object. + /// If not called, it won't display the list properly. + /// + public void Update() + { + Interop.Elementary.elm_list_go(RealHandle); + } + + /// + /// Appends a new item with a text to the end of a given list widget. + /// + /// The text for the item. + /// Return a new added list item that contains a text. + /// + public ListItem Append(string label) + { + return Append(label, null, null); + } + + /// + /// Appends a new item with a text and 2 icons to the end of a given list widget. + /// + /// The text for the item. + /// The left icon for the item. + /// The right icon for the item. + /// Return a new added list item that contains a text and 2 icons. + /// + public ListItem Append(string label, EvasObject leftIcon, EvasObject rightIcon) + { + ListItem item = new ListItem(label, leftIcon, rightIcon); + item.Handle = Interop.Elementary.elm_list_item_append(RealHandle, label, leftIcon, rightIcon, null, (IntPtr)item.Id); + AddInternal(item); + return item; + } + + /// + /// Prepends a new item with a text to the beginning of a given list widget. + /// + /// The text for the item. + /// Return a new added list item that contains a text. + public ListItem Prepend(string label) + { + return Prepend(label, null, null); + } + + /// + /// Prepends a new item with a text and 2 icons to the beginning of a given list widget. + /// + /// The text for the item. + /// The left icon for the item. + /// The right icon for the item. + /// Return a new added list item that contains a text and 2 icons. + public ListItem Prepend(string label, EvasObject leftIcon, EvasObject rigthIcon) + { + ListItem item = new ListItem(label, leftIcon, rigthIcon); + item.Handle = Interop.Elementary.elm_list_item_prepend(RealHandle, label, leftIcon, rigthIcon, null, (IntPtr)item.Id); + AddInternal(item); + return item; + } + + /// + /// Removes all items from a given list widget. + /// To delete just one item, use . + /// + public void Clear() + { + Interop.Elementary.elm_list_clear(RealHandle); + foreach (var item in _children) + { + item.Deleted -= Item_Deleted; + } + _children.Clear(); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_list_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + void AddInternal(ListItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((ListItem)sender); + } + } +} diff --git a/src/ElmSharp/ElmSharp/ListItem.cs b/src/ElmSharp/ElmSharp/ListItem.cs new file mode 100644 index 0000000..09354b1 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ListItem.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits . + /// A instance to the list item added. + /// It contains Text, LeftIcon and RightIcon properties to show a list item which is given. + /// + public class ListItem : ItemObject + { + internal ListItem(string text, EvasObject leftIcon, EvasObject rightIcon) : base(IntPtr.Zero) + { + Text = text; + LeftIcon = leftIcon; + RightIcon = rightIcon; + } + + /// + /// Gets the text for the list item. + /// + public string Text { get; internal set; } + + /// + /// Gets the left icon for the list item. + /// + public EvasObject LeftIcon { get; internal set; } + + /// + /// Gets the right icon for the list item. + /// + public EvasObject RightIcon { get; internal set; } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/MultiButtonEntry.cs b/src/ElmSharp/ElmSharp/MultiButtonEntry.cs new file mode 100755 index 0000000..21d9a54 --- /dev/null +++ b/src/ElmSharp/ElmSharp/MultiButtonEntry.cs @@ -0,0 +1,407 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// It inherits . + /// The MultiButtonEntry is a widget letting an user enter text and each chunk of text managed as a set of buttons. + /// Each text button is inserted by pressing the "return" key. If there is no space in the current row, a new button is added to the next row. + /// When a text button is pressed, it will become focused. Backspace removes the focus. When the multi-button entry loses focus, items longer than one line are shrunk to one line. + /// The typical use case of multi-button entry is composing emails/messages to a group of addresses, each of which is an item that can be clicked for further actions. + /// + public class MultiButtonEntry : Layout + { + HashSet _children = new HashSet(); + List> _filters = new List>(); + Func _formatFunc = null; + Entry _entry = null; + + Interop.Elementary.MultiButtonEntryItemFilterCallback _filterCallback; + Interop.Elementary.MultiButtonEntryFormatCallback _formatCallback; + + SmartEvent _clicked; + SmartEvent _expanded; + SmartEvent _contracted; + SmartEvent _expandedStateChanged; + SmartEvent _itemSelected; + SmartEvent _itemClicked; + SmartEvent _itemLongPressed; + SmartEvent _itemAdded; + + /// + /// Creates and initializes a new instance of the MultiButtonEntry class. + /// + /// The parent is a given container which will be attached by MultiButtonEntry as a child. It's type. + public MultiButtonEntry(EvasObject parent) : base(parent) + { + _clicked = new SmartEvent(this, "clicked"); + _expanded = new SmartEvent(this, "expanded"); + _contracted = new SmartEvent(this, "contracted"); + _expandedStateChanged = new SmartEvent(this, "expand,state,changed"); + + _itemSelected = new SmartEvent(this, "item,selected", MultiButtonEntryItemEventArgs.CreateFromSmartEvent); + _itemClicked = new SmartEvent(this, "item,clicked", MultiButtonEntryItemEventArgs.CreateFromSmartEvent); + _itemLongPressed = new SmartEvent(this, "item,longpressed", MultiButtonEntryItemEventArgs.CreateFromSmartEvent); + _itemAdded = new SmartEvent(this, "item,added", MultiButtonEntryItemEventArgs.CreateAndAddFromSmartEvent); + + _filterCallback = new Interop.Elementary.MultiButtonEntryItemFilterCallback(FilterCallbackHandler); + _formatCallback = new Interop.Elementary.MultiButtonEntryFormatCallback(FormatCallbackHandler); + + _clicked.On += (sender, e) => Clicked?.Invoke(this, EventArgs.Empty); + _expanded.On += (sender, e) => Expanded?.Invoke(this, EventArgs.Empty); + _contracted.On += (sender, e) => Contracted?.Invoke(this, EventArgs.Empty); + _expandedStateChanged.On += (sender, e) => ExpandedStateChanged?.Invoke(this, EventArgs.Empty); + + _itemSelected.On += (sender, e) => { ItemSelected?.Invoke(this, e); }; + _itemClicked.On += (sender, e) => { ItemClicked?.Invoke(this, e); }; + _itemLongPressed.On += (sender, e) => { ItemLongPressed?.Invoke(this, e); }; + _itemAdded.On += OnItemAdded; + } + + /// + /// Clicked is raised when a MultiButtonEntry is clicked. + /// + public event EventHandler Clicked; + + /// + /// Expanded is raised when a MultiButtonEntry is expanded. + /// + public event EventHandler Expanded; + + /// + /// Contracted is raised when a MultiButtonEntry is contracted. + /// + public event EventHandler Contracted; + + /// + /// ExpandedStateChanged is raised when shrink mode state of MultiButtonEntry is changed. + /// + public event EventHandler ExpandedStateChanged; + + /// + /// ItemSelected is raised when an item is selected by api, user interaction, and etc. + /// This is also raised when a user press back space while cursor is on the first field of entry. + /// + public event EventHandler ItemSelected; + + /// + /// ItemClicked is raised when an item is clicked by user interaction. + /// + public event EventHandler ItemClicked; + + /// + /// ItemLongPressed is raised when MultiButtonEntry item is pressed for a long time. + /// + public event EventHandler ItemLongPressed; + + /// + /// ItemAdded is raised when a new MultiButtonEntry item is added. + /// + public event EventHandler ItemAdded; + + /// + /// ItemDeleted is raised when a MultiButtonEntry item is deleted. + /// + public event EventHandler ItemDeleted; + + /// + /// Gets the selected item in the multibuttonentry. + /// + public MultiButtonEntryItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_multibuttonentry_selected_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + } + } + + /// + /// Gets or sets whether the multibuttonentry is editable or not. + /// + public bool IsEditable + { + get + { + return Interop.Elementary.elm_multibuttonentry_editable_get(RealHandle); + } + set + { + Interop.Elementary.elm_multibuttonentry_editable_set(RealHandle, value); + } + } + + /// + /// Gets or sets the multibuttonentry to expanded state. + /// If true, expanded state. + /// If false, single line state. + /// + public bool IsExpanded + { + get + { + return Interop.Elementary.elm_multibuttonentry_expanded_get(RealHandle); + } + set + { + Interop.Elementary.elm_multibuttonentry_expanded_set(RealHandle, value); + } + } + + /// + /// Gets the first item in the multibuttonentry. + /// + public MultiButtonEntryItem FirstItem + { + get + { + IntPtr handle = Interop.Elementary.elm_multibuttonentry_first_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + } + } + + /// + /// Gets the last item in the multibuttonentry. + /// + public MultiButtonEntryItem LastItem + { + get + { + IntPtr handle = Interop.Elementary.elm_multibuttonentry_last_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + } + } + + /// + /// Gets the entry object int the multibuttonentry. + /// + public Entry Entry + { + get + { + if (_entry == null) + { + _entry = new EntryInner(this); + } + + return _entry; + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_multibuttonentry_add(parent.Handle); + } + + /// + /// Append a new item to the multibuttonentry. + /// + /// The label of new item. + /// A MultiButtonEntryItem to the item added. + public MultiButtonEntryItem Append(string label) + { + var handle = Interop.Elementary.elm_multibuttonentry_item_append(RealHandle, label, null, IntPtr.Zero); + MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + return item; + } + + /// + /// Prepend a new item to the multibuttonentry. + /// + /// The label of new item. + /// A MultiButtonEntryItem to the item added. + public MultiButtonEntryItem Prepend(string label) + { + var handle = Interop.Elementary.elm_multibuttonentry_item_prepend(RealHandle, label, null, IntPtr.Zero); + MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + return item; + } + + /// + /// Add a new item to the multibuttonentry before the indicated object reference. + /// + /// The item before which to add it. + /// The label of new item. + /// A MultiButtonEntryItem to the item added. + public MultiButtonEntryItem InsertBefore(MultiButtonEntryItem before, string label) + { + var handle = Interop.Elementary.elm_multibuttonentry_item_insert_before(RealHandle, before.Handle, label, null, IntPtr.Zero); + MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + return item; + } + + /// + /// Add a new item to the multibuttonentry after the indicated object. + /// + /// The item after which to add it. + /// The label of new item. + /// A MultiButtonEntryItem to the item added. + public MultiButtonEntryItem InsertAfter(MultiButtonEntryItem after, string label) + { + var handle = Interop.Elementary.elm_multibuttonentry_item_insert_after(RealHandle, after.Handle, label, null, IntPtr.Zero); + MultiButtonEntryItem item = ItemObject.GetItemByHandle(handle) as MultiButtonEntryItem; + return item; + } + + /// + /// Remove all items in the multibuttonentry. + /// + public void Clear() + { + Interop.Elementary.elm_multibuttonentry_clear(RealHandle); + foreach (var item in _children) + { + item.Deleted -= Item_Deleted; + } + _children.Clear(); + } + + /// + /// Append an item filter function for text inserted in the Multibuttonentry. + /// + /// The function to use as item filter. + public void AppendFilter(Func func) + { + _filters.Add(func); + if (_filters.Count == 1) + { + Interop.Elementary.elm_multibuttonentry_item_filter_append(RealHandle, _filterCallback, IntPtr.Zero); + } + } + + /// + /// Prepend a filter function for text inserted in the Multibuttonentry. + /// + /// The function to use as text filter. + public void PrependFilter(Func func) + { + _filters.Insert(0, func); + if (_filters.Count == 1) + { + Interop.Elementary.elm_multibuttonentry_item_filter_prepend(RealHandle, _filterCallback, IntPtr.Zero); + } + } + + /// + /// Remove a filter from the list. + /// + /// The filter function to remove. + public void RemoveFilter(Func func) + { + _filters.Remove(func); + if (_filters.Count == 0) + { + Interop.Elementary.elm_multibuttonentry_item_filter_remove(RealHandle, _filterCallback, IntPtr.Zero); + } + } + + /// + /// Set a function to format the string that will be used to display the hidden items counter. + /// If func is NULL, the default format will be used, which is "+ 'the hidden items counter'". + /// + /// The function to return string to show + public void SetFormatCallback(Func func) + { + if (func == null) + { + Interop.Elementary.elm_multibuttonentry_format_function_set(RealHandle, null, IntPtr.Zero); + } + else + { + _formatFunc = func; + Interop.Elementary.elm_multibuttonentry_format_function_set(RealHandle, _formatCallback, IntPtr.Zero); + } + } + + string FormatCallbackHandler(int count, IntPtr data) + { + return _formatFunc(count); + } + + void Item_Deleted(object sender, EventArgs e) + { + var removed = sender as MultiButtonEntryItem; + _children.Remove(removed); + + // "item,deleted" event will be called after removing the item from ItemObject has been done. + // ItemObject will no longer have the item instance that is deleted after this. + // So, ItemDelete event with the removed item should be triggered here. + ItemDeleted?.Invoke(this, new MultiButtonEntryItemEventArgs() { Item = removed }); + } + + void OnItemAdded(object sender, MultiButtonEntryItemEventArgs e) + { + _children.Add(e.Item); + e.Item.Deleted += Item_Deleted; + ItemAdded?.Invoke(this, e); + } + + bool FilterCallbackHandler(IntPtr obj, string label, IntPtr itemData, IntPtr data) + { + foreach (var func in _filters) + { + if (!func(label)) + return false; + } + return true; + } + + internal class EntryInner : Entry + { + internal EntryInner(EvasObject parent) : base(parent) + { + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_multibuttonentry_entry_get(parent.Handle); + } + } + } + + /// + /// It inherits System.EventArgs. + /// The MultiButtonEntryItemEventArgs is a argument for all events of MultiButtonEntry. + /// It contains Item which is type. + /// + public class MultiButtonEntryItemEventArgs : EventArgs + { + /// + /// Gets or sets MultiButtonEntryItem item. The return type is . + /// + public MultiButtonEntryItem Item { get; set; } + + internal static MultiButtonEntryItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + MultiButtonEntryItem item = ItemObject.GetItemByHandle(info) as MultiButtonEntryItem; + return new MultiButtonEntryItemEventArgs() { Item = item }; + } + + internal static MultiButtonEntryItemEventArgs CreateAndAddFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + // Item can be added throught calling Append method and user input. + // And since "item.added" event will be called before xx_append() method returns, + // ItemObject does NOT have an item that contains handle matched to "info" at this time. + // So, item should be created and added internally here. + MultiButtonEntryItem item = new MultiButtonEntryItem(info); + return new MultiButtonEntryItemEventArgs() { Item = item }; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs b/src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs new file mode 100755 index 0000000..583e1ee --- /dev/null +++ b/src/ElmSharp/ElmSharp/MultiButtonEntryItem.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// It inherits . + /// MutltiButtonEntryItem is a item which is added to MultiButtonEntry. + /// It contains Next and Prev properties to get next and previous item. + /// + public class MultiButtonEntryItem : ItemObject + { + /// + /// Creates and initializes a new instance of the MultiButtonEntryItem class. + /// + /// The text of MultiButtonEntryItem's Label name. + public MultiButtonEntryItem(string text) : base(IntPtr.Zero) + { + Label = text; + } + + internal MultiButtonEntryItem(IntPtr handle) : base(handle) + { + Label = Interop.Elementary.elm_object_item_part_text_get(handle, null); + } + + /// + /// Gets the label of this item. + /// + public string Label { get; private set; } + + /// + /// Gets or sets the selected state of an item. + /// + public bool IsSelected + { + get + { + return Interop.Elementary.elm_multibuttonentry_item_selected_get(Handle); + } + set + { + Interop.Elementary.elm_multibuttonentry_item_selected_set(Handle, value); + } + } + + /// + /// Get the next item in the multibuttonentry. + /// + public MultiButtonEntryItem Next + { + get + { + var next = Interop.Elementary.elm_multibuttonentry_item_next_get(Handle); + return ItemObject.GetItemByHandle(next) as MultiButtonEntryItem; + } + } + + /// + /// Get the previous item in the multibuttonentry. + /// + public MultiButtonEntryItem Prev + { + get + { + var prev = Interop.Elementary.elm_multibuttonentry_item_prev_get(Handle); + return ItemObject.GetItemByHandle(prev) as MultiButtonEntryItem; + } + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/NaviItem.cs b/src/ElmSharp/ElmSharp/NaviItem.cs new file mode 100755 index 0000000..f7da156 --- /dev/null +++ b/src/ElmSharp/ElmSharp/NaviItem.cs @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The NaviItem is a widget to contain the contents to show in Naviframe. + /// Inherits ItemObject + /// + public class NaviItem : ItemObject + { + EvasObject _content; + bool _isPopped; + Color _barBackgroundColor = Color.Default; + Interop.Elementary.Elm_Naviframe_Item_Pop_Cb _popped; + + NaviItem(IntPtr handle, EvasObject content) : base(handle) + { + _isPopped = false; + _content = content; + _popped = (d, i) => + { + _isPopped = true; + Popped?.Invoke(this, EventArgs.Empty); + return true; + }; + Interop.Elementary.elm_naviframe_item_pop_cb_set(handle, _popped, IntPtr.Zero); + } + + /// + /// Popped will be triggered when NaviItem is removed. + /// + public event EventHandler Popped; + + /// + /// Gets the content object. The name of content part is "elm.swallow.content". + /// + public EvasObject Content + { + get { return _content; } + } + + /// + /// Sets or gets a value whether title area is enabled or not. + /// + public bool TitleBarVisible + { + get + { + return Interop.Elementary.elm_naviframe_item_title_enabled_get(Handle); + } + set + { + Interop.Elementary.elm_naviframe_item_title_enabled_set(Handle, value, false); + } + } + + /// + /// Sets or gets the title bar background color + /// + public Color TitleBarBackgroundColor + { + get + { + return _barBackgroundColor; + } + set + { + if (value.IsDefault) + { + Interop.Elementary.elm_object_item_color_class_del(Handle, "bg_title"); + } + else + { + SetPartColor("bg_title", value); + _barBackgroundColor = value; + } + } + } + + /// + /// Sets or gets an item style. + /// + public string Style + { + get + { + return Interop.Elementary.elm_naviframe_item_style_get(Handle); + } + set + { + Interop.Elementary.elm_naviframe_item_style_set(Handle, value); + } + } + + /// + /// Invalidate the EventArgs if _isPopped is false. + /// The method should be overridden in children class. + /// + protected override void OnInvalidate() + { + if (!_isPopped) + Popped?.Invoke(this, EventArgs.Empty); + } + + internal static NaviItem FromNativeHandle(IntPtr handle, EvasObject content) + { + return new NaviItem(handle, content); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Naviframe.cs b/src/ElmSharp/ElmSharp/Naviframe.cs new file mode 100755 index 0000000..8d31756 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Naviframe.cs @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// The NaviframeEventArgs is a event args class for navi frame. + /// Inherits EventArgs + /// + public class NaviframeEventArgs : EventArgs + { + /// + /// Sets or gets the content object. The name of content part is "elm.swallow.content". + /// + public EvasObject Content { get; set; } + } + /// + /// Naviframe is a widget to stands for navigation frame. It's a views manager for applications. + /// Inherits Widget + /// + public class Naviframe : Widget + { + SmartEvent _transitionFinished; + readonly List _itemStack = new List(); + + /// + /// Creates and initializes a new instance of Naviframe class. + /// + /// The parent is a given container which will be attached by Naviframe as a child. It's type. + public Naviframe(EvasObject parent) : base(parent) + { + _transitionFinished = new SmartEvent(this, this.RealHandle, "transition,finished"); + _transitionFinished.On += (s, e) => AnimationFinished?.Invoke(this, EventArgs.Empty); + } + + /// + /// Popped will be triggered when NaviItem is removed. + /// + /// + /// It is always called when NaviItem was removed. + /// (even if removed by NaviItem.Delete()) + /// This event will be invoked in progress of Pop/Delete operation. + /// After called Popped event, Pop/Delete method will be returned + /// + public event EventHandler Popped; + + /// + /// AnimationFinished will be triggered when animation is finished. + /// + public event EventHandler AnimationFinished; + + /// + /// Gets the list of navi item + /// + public IReadOnlyList NavigationStack + { + get { return _itemStack; } + } + + /// + /// Sets or gets the the preserve content objects when items are popped. + /// + public bool PreserveContentOnPop + { + get + { + return Interop.Elementary.elm_naviframe_content_preserve_on_pop_get(RealHandle); + } + set + { + Interop.Elementary.elm_naviframe_content_preserve_on_pop_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the default back button is enabled + /// + public bool DefaultBackButtonEnabled + { + get + { + return Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_get(RealHandle); + } + set + { + Interop.Elementary.elm_naviframe_prev_btn_auto_pushed_set(RealHandle, value); + } + } + + /// + /// Push a new item to the top of the naviframe stack and show it. + /// The title and style are null. + /// + /// The main content object. The name of content part is "elm.swallow.content". + /// The created item or null upon failure. + public NaviItem Push(EvasObject content) + { + return Push(content, null); + } + + /// + /// Push a new item to the top of the naviframe stack and show it. + /// The style are null. + /// + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// + public NaviItem Push(EvasObject content, string title) + { + return Push(content, title, null); + } + + /// + /// Push a new item to the top of the naviframe stack and show it. + /// + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// The current item style name. null would be default. + /// The created item or null upon failure. + public NaviItem Push(EvasObject content, string title, string style) + { + IntPtr item = Interop.Elementary.elm_naviframe_item_push(RealHandle, title, IntPtr.Zero, IntPtr.Zero, content.Handle, style); + NaviItem naviItem = NaviItem.FromNativeHandle(item, content); + _itemStack.Add(naviItem); + naviItem.Popped += ItemPoppedHandler; + return naviItem; + } + + /// + /// Insert a new item into the naviframe before item. + /// The title is "" and the style is null. + /// + /// The item which the new item is inserted before. + /// The main content object. The name of content part is "elm.swallow.content". + /// The created item or null upon failure. + public NaviItem InsertBefore(NaviItem before, EvasObject content) + { + return InsertBefore(before, content, ""); + } + + /// + /// Insert a new item into the naviframe before item. + /// The style is null. + /// + /// The item which the new item is inserted before. + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// The created item or null upon failure. + public NaviItem InsertBefore(NaviItem before, EvasObject content, string title) + { + return InsertBefore(before, content, title, null); + } + + /// + /// Insert a new item into the naviframe before item. + /// + /// The item which the new item is inserted before. + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// The current item style name. null would be default. + /// The created item or null upon failure. + public NaviItem InsertBefore(NaviItem before, EvasObject content, string title, string style) + { + IntPtr item = Interop.Elementary.elm_naviframe_item_insert_before(RealHandle, before, title, IntPtr.Zero, IntPtr.Zero, content, null); + NaviItem naviItem = NaviItem.FromNativeHandle(item, content); + int idx = _itemStack.IndexOf(before); + _itemStack.Insert(idx, naviItem); + naviItem.Popped += ItemPoppedHandler; + return naviItem; + } + + /// + /// Insert a new item into the naviframe after item. + /// The title is "" and the style is null. + /// + /// The item which the new item is inserted after. + /// The main content object. The name of content part is "elm.swallow.content". + /// The created item or null upon failure. + public NaviItem InsertAfter(NaviItem after, EvasObject content) + { + return InsertAfter(after, content, ""); + } + + /// + /// Insert a new item into the naviframe after item. + /// The style is null. + /// + /// The item which the new item is inserted after. + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// The created item or null upon failure. + public NaviItem InsertAfter(NaviItem after, EvasObject content, string title) + { + return InsertAfter(after, content, title, null); + } + + /// + /// Insert a new item into the naviframe after item. + /// + /// The item which the new item is inserted after. + /// The main content object. The name of content part is "elm.swallow.content". + /// The current item title. null would be default. + /// The current item style name. null would be default. + /// The created item or null upon failure. + public NaviItem InsertAfter(NaviItem after, EvasObject content, string title, string style) + { + IntPtr item = Interop.Elementary.elm_naviframe_item_insert_after(RealHandle, after, title, IntPtr.Zero, IntPtr.Zero, content, null); + NaviItem naviItem = NaviItem.FromNativeHandle(item, content); + int idx = _itemStack.IndexOf(after); + _itemStack.Insert(idx + 1, naviItem); + naviItem.Popped += ItemPoppedHandler; + return naviItem; + } + + /// + /// Pop an item that is on top of the stack. + /// + public void Pop() + { + Interop.Elementary.elm_naviframe_item_pop(RealHandle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_naviframe_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + + void ItemPoppedHandler(object sender, EventArgs e) + { + NaviItem item = sender as NaviItem; + if (item == null) + return; + _itemStack.Remove(item); + Popped?.Invoke(this, new NaviframeEventArgs() { Content = item.Content }); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Panel.cs b/src/ElmSharp/ElmSharp/Panel.cs new file mode 100755 index 0000000..f644d27 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Panel.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for paneldirection type. + /// + public enum PanelDirection + { + /// + /// Top to bottom + /// + Top = 0, + /// + /// Bottom to top + /// + Bottom, + /// + /// Left to right + /// + Left, + /// + /// Right to left + /// + Right, + } + + /// + /// The Panel is a container that can contain subobjects. + /// + public class Panel : Layout + { + SmartEvent _toggled; + + /// + /// Creates and initializes a new instance of Panel class. + /// + /// The EvasObject to which the new Panel will be attached as a child. + public Panel(EvasObject parent) : base(parent) + { + _toggled = new SmartEvent(this, this.RealHandle, "toggled"); + _toggled.On += (s, e) => Toggled?.Invoke(this, EventArgs.Empty); + } + + /// + /// Sets or gets the hidden status of a given Panel widget. + /// + public bool IsOpen + { + get + { + return !Interop.Elementary.elm_panel_hidden_get(RealHandle); + } + set + { + Interop.Elementary.elm_panel_hidden_set(RealHandle, !value); + } + } + + /// + /// Sets or gets the direction of a given Panel widget. + /// + public PanelDirection Direction + { + get + { + return (PanelDirection)Interop.Elementary.elm_panel_orient_get(RealHandle); + } + set + { + Interop.Elementary.elm_panel_orient_set(RealHandle, (int)value); + } + } + + /// + /// Toggled will be triggered when toggles Panel. + /// + public event EventHandler Toggled; + + /// + /// Enable or disable scrolling in the Panel. + /// + /// + /// Bool value can be false or true. + /// + public void SetScrollable(bool enable) + { + Interop.Elementary.elm_panel_scrollable_set(RealHandle, enable); + } + + /// + /// Sets the scroll size of Panel. + /// + /// + /// The size of scroll area. + /// + public void SetScrollableArea(double ratio) + { + Interop.Elementary.elm_panel_scrollable_content_size_set(RealHandle, ratio); + } + + /// + /// Toggles the hidden state of the Panel. + /// + public void Toggle() + { + Interop.Elementary.elm_panel_toggle(RealHandle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_panel_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Panes.cs b/src/ElmSharp/ElmSharp/Panes.cs new file mode 100755 index 0000000..d99b5b6 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Panes.cs @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Panes is a widget that adds a draggable bar between two contents. + /// When dragged this bar resizes contents' size. + /// + public class Panes : Layout + { + SmartEvent _press; + SmartEvent _unpressed; + + /// + /// Creates and initializes a new instance of the Panes class. + /// + /// The EvasObject to which the new Panes will be attached as a child. + public Panes(EvasObject parent) : base(parent) + { + _press = new SmartEvent(this, this.RealHandle, "press"); + _unpressed = new SmartEvent(this, this.RealHandle, "unpress"); + + _press.On += (s, e) => Pressed?.Invoke(this, e); + _unpressed.On += (s, e) => Unpressed?.Invoke(this, e); + } + + /// + /// Pressed will be triggered when panes have been pressed (button isn't released yet). + /// + public event EventHandler Pressed; + + /// + /// Unpressed will be triggered when panes are released after being pressed. + /// + public event EventHandler Unpressed; + + /// + /// Sets or gets resize mode of a given Panes widget. + /// True means the left and right panes resize homogeneously. + /// + public bool IsFixed + { + get + { + return Interop.Elementary.elm_panes_fixed_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_fixed_set(RealHandle, value); + } + } + + /// + /// Sets or Gets the size proportion of the Panes widget's left side. + /// + /// + /// By default it's homogeneous, i.e., both sides have the same size.If something different is required, + /// it can be set with this function. For example, if the left content should be displayed over 75% of the panes size, + /// size should be passed as 0.75. This way, the right content is resized to 25% of the panes size. + /// If displayed vertically, left content is displayed at the top, and right content at the bottom. + /// This proportion changes when the user drags the panes bar. + /// + /// The value is float type and between 0.0 and 1.0 representing the size proportion of the left side. + /// + public double Proportion + { + get + { + return Interop.Elementary.elm_panes_content_left_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_content_left_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the orientation of a given Panes widget. + /// + /// + /// Uses this function to change how your panes are to be disposed: vertically or horizontally. + /// By default it's displayed horizontally. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_panes_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets the absolute minimum size of panes widget's left side. + /// If displayed vertically, left content is displayed at top. + /// value representing minimum size of left side in pixels. + /// + public int LeftMinimumSize + { + get + { + return Interop.Elementary.elm_panes_content_left_min_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_content_left_min_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the relative minimum size of panes widget's left side. + /// proportion of minimum size of left side. + /// If displayed vertically, left content is displayed at top. + /// value between 0.0 and 1.0 representing size proportion of minimum size of left side. + /// + public double LeftMinimumRelativeSize + { + get + { + return Interop.Elementary.elm_panes_content_left_min_relative_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_content_left_min_relative_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the absolute minimum size of panes widget's right side. + /// If displayed vertically, right content is displayed at top. + /// value representing minimum size of right side in pixels. + /// + public int RightMinimumSize + { + get + { + return Interop.Elementary.elm_panes_content_right_min_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_content_right_min_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the relative minimum size of panes widget's right side. + /// proportion of minimum size of right side. + /// If displayed vertically, right content is displayed at top. + /// value between 0.0 and 1.0 representing size proportion of minimum size of right side. + /// + public double RightMinimumRelativeSize + { + get + { + return Interop.Elementary.elm_panes_content_right_min_relative_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_panes_content_right_min_relative_size_set(RealHandle, value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_panes_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Point.cs b/src/ElmSharp/ElmSharp/Point.cs new file mode 100755 index 0000000..3fe04cd --- /dev/null +++ b/src/ElmSharp/ElmSharp/Point.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Point is a struct that defines a 2-D point as a pair of generic type. + /// + public struct Point : IEquatable + { + /// + /// Location along the horizontal axis. + /// + public int X; + + /// + /// Location along the vertical axis. + /// + public int Y; + + public override string ToString() + { + return string.Format("{{X={0} Y={1}}}", X, Y); + } + + public override int GetHashCode() + { + unchecked + { + return X.GetHashCode() ^ (Y.GetHashCode() * 397); + } + } + + public override bool Equals(object obj) + { + if (!(obj is Point)) + return false; + + return Equals((Point)obj); + } + + public bool Equals(Point other) + { + return X.Equals(other.X) && Y.Equals(other.Y); + } + + /// + /// Whether the two s are equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s have equal values. + public static bool operator ==(Point p1, Point p2) + { + return p1.Equals(p2); + } + + /// + /// Whether two s are not equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s do not have equal values. + public static bool operator !=(Point p1, Point p2) + { + return !p1.Equals(p2); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Point3D.cs b/src/ElmSharp/ElmSharp/Point3D.cs new file mode 100755 index 0000000..ebb8afb --- /dev/null +++ b/src/ElmSharp/ElmSharp/Point3D.cs @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Point3D is a Struct that defining a 3-D point. + /// + public struct Point3D : IEquatable + { + /// + /// The X coordinate of a 3D point. + /// + public int X; + + /// + /// The Y coordinate of a 3D point. + /// + public int Y; + + /// + /// The Z coordinate of a 3D point. + /// + public int Z; + + public override string ToString() + { + return string.Format("{{X={0} Y={1} Z={2}}}", X, Y, Z); + } + + public override int GetHashCode() + { + unchecked + { + int hashCode = X.GetHashCode(); + hashCode = (hashCode * 397) ^ Y.GetHashCode(); + hashCode = (hashCode * 397) ^ Z.GetHashCode(); + return hashCode; + } + } + + public override bool Equals(object obj) + { + if (!(obj is Point3D)) + return false; + + return Equals((Point3D)obj); + } + + public bool Equals(Point3D other) + { + return X.Equals(other.X) && Y.Equals(other.Y) && Z.Equals(other.Z); + } + + /// + /// Whether the two s are equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s have equal values. + public static bool operator ==(Point3D p1, Point3D p2) + { + return p1.Equals(p2); + } + + /// + /// Whether two s are not equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s do not have equal values. + public static bool operator !=(Point3D p1, Point3D p2) + { + return !p1.Equals(p2); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Polygon.cs b/src/ElmSharp/ElmSharp/Polygon.cs new file mode 100755 index 0000000..5db398d --- /dev/null +++ b/src/ElmSharp/ElmSharp/Polygon.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Polygon is a widget that used to draw a polygon (filled). + /// + public class Polygon : EvasObject + { + /// + /// Creates and initializes a new instance of the Polygon class. + /// The EvasObject to which the new Polygon will be attached as a child. + /// + public Polygon(EvasObject parent) : base(parent) + { + } + + /// + /// Adds a new vertex to the Polygon. + /// The X coordinate of the new vertex. + /// The Y coordinate of the new vertex. + /// + public void AddPoint(int x, int y) + { + Interop.Evas.evas_object_polygon_point_add(Handle, x, y); + } + + /// + /// Adds a new vertex to the Polygon. + /// The coordinates of the new vertex. + /// + public void AddPoint(Point p) + { + AddPoint(p.X, p.Y); + } + + /// + /// Removes all the vertices of the Polygon, making it empty. + /// + public void ClearPoints() + { + Interop.Evas.evas_object_polygon_points_clear(Handle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr evas = Interop.Evas.evas_object_evas_get(parent.Handle); + return Interop.Evas.evas_object_polygon_add(evas); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Popup.cs b/src/ElmSharp/ElmSharp/Popup.cs new file mode 100755 index 0000000..26f736d --- /dev/null +++ b/src/ElmSharp/ElmSharp/Popup.cs @@ -0,0 +1,291 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// Enumeration for the popup orientation type. + /// + public enum PopupOrientation + { + /// + /// Appears in the top of parent, default. + /// + Top, + /// + /// Appears in the center of parent. + /// + Center, + /// + /// Appears in the bottom of parent. + /// + Bottom, + /// + /// Appears in the left of parent. + /// + Left, + /// + /// Appears in the right of parent. + /// + Right, + /// + /// Appears in the top left of parent. + /// + TopLeft, + /// + /// Appears in the top right of parent. + /// + TopRight, + /// + /// Appears in the bottom left of parent. + /// + BottomLeft, + /// + /// Appears in the bottom right of parent. + /// + BottomRight + } + + /// + /// The Popup is a widget that is an enhancement of Notify. + /// In addition to content area, there are two optional sections, namely title area and action area. + /// + public class Popup : Layout + { + HashSet _children = new HashSet(); + SmartEvent _dismissed; + SmartEvent _blockClicked; + SmartEvent _timeout; + SmartEvent _showFinished; + + /// + /// Creates and initializes a new instance of the Popup class. + /// + /// The EvasObject to which the new Popup will be attached as a child. + public Popup(EvasObject parent) : base(parent) + { + _dismissed = new SmartEvent(this, "dismissed"); + _dismissed.On += (sender, e) => + { + Dismissed?.Invoke(this, EventArgs.Empty); + }; + + _blockClicked = new SmartEvent(this, "block,clicked"); + _blockClicked.On += (sender, e) => + { + OutsideClicked?.Invoke(this, EventArgs.Empty); + }; + + _timeout = new SmartEvent(this, "timeout"); + _timeout.On += (sender, e) => + { + TimedOut?.Invoke(this, EventArgs.Empty); + }; + + _showFinished = new SmartEvent(this, "show,finished"); + _showFinished.On += (sender, e) => + { + ShowAnimationFinished?.Invoke(this, EventArgs.Empty); + }; + } + + /// + /// Dismissed will be triggered when Popup have been dismissed. + /// + public event EventHandler Dismissed; + + /// + /// OutsideClicked will be triggered when users taps on the outside of Popup. + /// + public event EventHandler OutsideClicked; + + /// + /// OutsideClicked will be triggered when Popup is closed as a result of timeout. + /// + public event EventHandler TimedOut; + + /// + /// OutsideClicked will be triggered when the Popup transition is finished in showing. + /// + public event EventHandler ShowAnimationFinished; + + /// + /// Sets or gets the position in which Popup will appear in its parent. + /// + public PopupOrientation Orientation + { + get + { + return (PopupOrientation)Interop.Elementary.elm_popup_orient_get(Handle); + } + set + { + Interop.Elementary.elm_popup_orient_set(Handle, (int)value); + } + } + + /// + /// Sets or gets the wrapping type of content text packed in content area of Popup widget. + /// + public WrapType ContentTextWrapType + { + get + { + return (WrapType)Interop.Elementary.elm_popup_content_text_wrap_type_get(Handle); + } + set + { + Interop.Elementary.elm_popup_content_text_wrap_type_set(Handle, (int)value); + } + } + + /// + /// Sets or gets the timeout value set to the Popup(in seconds). + /// + /// + /// Since calling Show() on a popup restarts the timer controlling when it is hidden, + /// setting this before the popup is shown will in effect mean starting the timer when the popup is shown. + /// TimedOut is called afterwards which can be handled if needed. + /// Set a value <= 0.0 to disable a running timer.If the value > 0.0 and the popup is previously visible, + /// the timer will be started with this value, canceling any running timer. + /// + public double Timeout + { + get + { + return Interop.Elementary.elm_popup_timeout_get(Handle); + } + set + { + Interop.Elementary.elm_popup_timeout_set(Handle, value); + } + } + + /// + /// Sets or gets whether events should be passed to event blocked area by a click outside. + /// + /// + /// The visible region of popup is surrounded by a translucent region called Blocked Event area. + /// + public bool AllowEvents + { + get + { + return Interop.Elementary.elm_popup_allow_events_get(Handle); + } + set + { + Interop.Elementary.elm_popup_allow_events_set(Handle, value); + } + } + + /// + /// Sets or gets the AlignmentX in which the popup will appear in its parent. + /// + public override double AlignmentX + { + get + { + return Interop.Elementary.GetPopupAlignX(Handle); + } + set + { + Interop.Elementary.SetPopupAlignX(Handle, value); + } + } + + /// + /// Sets or gets the AlignmentY in which the popup will appear in its parent. + /// + public override double AlignmentY + { + get + { + return Interop.Elementary.GetPopupAlignY(Handle); + } + set + { + Interop.Elementary.SetPopupAlignY(Handle, value); + } + } + + /// + /// Gets the Opacity value of the Popup. + /// + public override int Opacity + { + get + { + return Color.Default.A; + } + + set + { + Console.WriteLine("Popup instance doesn't support to set Opacity."); + } + } + + /// + /// Adds label to a Popup widget. + /// + /// + /// The new PopupItem which contains label . + public PopupItem Append(string label) + { + return Append(label, null); + } + + /// + /// Adds Label and icon to a Popup widget. + /// + /// The Label which will be added into a new PopupItem. + /// The icon which will be added into a new PopupItem. + /// The new PopupItem which contains label and icon. + public PopupItem Append(string label, EvasObject icon) + { + PopupItem item = new PopupItem(label, icon); + item.Handle = Interop.Elementary.elm_popup_item_append(Handle, label, icon, null, (IntPtr)item.Id); + AddInternal(item); + return item; + } + + /// + /// Uses this function to dismiss the popup in hide effect. + /// when the Popup is dismissed, the "dismissed" signal will be emitted. + /// + public void Dismiss() + { + Interop.Elementary.elm_popup_dismiss(Handle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return Interop.Elementary.elm_popup_add(parent.Handle); + } + void AddInternal(PopupItem item) + { + _children.Add(item); + item.Deleted += Item_Deleted; + } + void Item_Deleted(object sender, EventArgs e) + { + _children.Remove((PopupItem)sender); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/PopupItem.cs b/src/ElmSharp/ElmSharp/PopupItem.cs new file mode 100755 index 0000000..1251c55 --- /dev/null +++ b/src/ElmSharp/ElmSharp/PopupItem.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The PopupItem is a class that including icon and text. + /// + public class PopupItem : ItemObject + { + internal PopupItem(string text, EvasObject icon) : base(IntPtr.Zero) + { + Text = text; + Icon = icon; + } + + /// + /// Gets the text label of popupitem.Return value is string. + /// + public string Text { get; internal set; } + + /// + /// Gets the icon EvasObject of popupitem. + /// + public EvasObject Icon { get; internal set; } + } +} diff --git a/src/ElmSharp/ElmSharp/ProgressBar.cs b/src/ElmSharp/ElmSharp/ProgressBar.cs new file mode 100755 index 0000000..28f6302 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ProgressBar.cs @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The ProgressBar is a widget for visually representing the progress status of a given job/task. + /// + public class ProgressBar : Layout + { + SmartEvent _changed; + + /// + /// Creates and initializes a new instance of the ProgressBar class. + /// + /// The EvasObject to which the new ProgressBar will be attached as a child. + public ProgressBar(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (s, e) => + { + ValueChanged?.Invoke(this, EventArgs.Empty); + }; + } + + /// + /// ValueChanged will be triggered when value of ProgressBar change. + /// + public event EventHandler ValueChanged; + + /// + /// Sets or gets the value wheather a given ProgressBar widget is at the "pulsing mode". + /// + /// + /// By default, progress bars display values from low to high value boundaries. + /// There are, though, contexts in which the progress of a given task is unknown. + /// For such cases, one can set a progress bar widget to a "pulsing state", + /// to give the user an idea that some computation is being held, + /// but without exact progress values. In the default theme, + /// it animates its bar with the contents filling in constantly and back to non-filled, in a loop. + /// + public bool IsPulseMode + { + get + { + return Interop.Elementary.elm_progressbar_pulse_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_pulse_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value of ProgressBar. + /// + /// + /// Use this property to set the progress bar levels. + /// If you pass a value out of the specified range(0.0~1.0), + /// it is interpreted as the closest of the boundary values in the range. + /// + public double Value + { + get + { + return Interop.Elementary.elm_progressbar_value_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_value_set(RealHandle, value); + } + } + + /// + /// Sets or gets the span value of ProgressBar. + /// + public int SpanSize + { + get + { + return Interop.Elementary.elm_progressbar_span_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_span_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value wheather a given ProgressBar widget is horizontal. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_progressbar_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value whether a given progress bar widget's displaying values are inverted. + /// + public bool IsInverted + { + get + { + return Interop.Elementary.elm_progressbar_inverted_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_inverted_set(RealHandle, value); + } + } + + /// + /// Sets or gets format string for a given progress bar widget's units label. + /// + /// + /// If NULL is passed on format, it makes obj units area to be hidden completely. + /// If not, it sets the format string for the units label's text. + /// The units label is provided with a floating point value, so the units text displays at most one floating point value. + /// Note that the units label is optional. Use a format string such as "%1.2f meters" for example. + /// The default format string for a progress bar is an integer percentage, as in "%.0f %%". + /// + public string UnitFormat + { + get + { + return Interop.Elementary.elm_progressbar_unit_format_get(RealHandle); + } + set + { + Interop.Elementary.elm_progressbar_unit_format_set(RealHandle, value); + } + } + + /// + /// Starts a given progress bar "pulsing" animation, if its under that mode. + /// + public void PlayPulse() + { + Interop.Elementary.elm_progressbar_pulse(RealHandle, true); + } + + [Obsolete("use StopPulse instead")] + public void StopPluse() + { + Interop.Elementary.elm_progressbar_pulse(RealHandle, false); + } + + /// + /// Stops a given progress bar "pulsing" animation, if its under that mode. + /// + public void StopPulse() + { + Interop.Elementary.elm_progressbar_pulse(RealHandle, false); + } + + /// + /// Gets the part value of the given part of the Progressbar. + /// + /// Part of the Progressbar. + /// Returns value range is from 0.0 to 1.0. + public double GetPartValue(string part) + { + return Interop.Elementary.elm_progressbar_part_value_get(RealHandle, part); + } + + /// + /// Sets or gets the general or main color of the given Progressbar. + /// + public override Color Color + { + get + { + return GetPartColor("bar"); + } + set + { + SetPartColor("bar", value); + } + } + + /// + /// Sets the part value of the give part of the Progressbar. + /// + /// Part of the Progressbar. + /// Value range is from 0.0 to 1.0. + public void SetPartValue(string part, double value) + { + Interop.Elementary.elm_progressbar_part_value_set(RealHandle, part, value); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_progressbar_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Radio.cs b/src/ElmSharp/ElmSharp/Radio.cs new file mode 100755 index 0000000..9a5f2d5 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Radio.cs @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Radio is a widget that allows for 1 or more options to be displayed and have the user choose only 1 of them. + /// + public class Radio : Layout + { + SmartEvent _changed; + + /// + /// Creates and initializes a new instance of the Radio class. + /// + /// The EvasObject to which the new Radio will be attached as a child. + public Radio(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty); + } + + /// + /// ValueChanged will be triggered when value of Radio change. + /// + public event EventHandler ValueChanged; + + /// + /// Sets or gets a unique value to each Radio button. + /// + public int StateValue + { + get + { + return Interop.Elementary.elm_radio_state_value_get(RealHandle); + } + set + { + Interop.Elementary.elm_radio_state_value_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value of the radio group. + /// + public int GroupValue + { + get + { + return Interop.Elementary.elm_radio_value_get(RealHandle); + } + set + { + Interop.Elementary.elm_radio_value_set(RealHandle, value); + } + } + + /// + /// Adds this radio to a group of other radio objects. + /// + /// Group which add radio in. + public void SetGroup(Radio group) + { + if (group == null) + { + throw new ArgumentNullException("group"); + } + Interop.Elementary.elm_radio_group_add(RealHandle, group.RealHandle); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_radio_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/ReadingInfoType.cs b/src/ElmSharp/ElmSharp/ReadingInfoType.cs new file mode 100755 index 0000000..35df932 --- /dev/null +++ b/src/ElmSharp/ElmSharp/ReadingInfoType.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp.Accessible +{ + /// + /// Enumeration for ReadingInfoType. + /// + [Flags] + public enum ReadingInfoType + { + /// + /// None + /// + None = 0, + /// + /// Name for reading info type + /// + Name = 0x1, + /// + /// Role for reading info type + /// + Role = 0x2, + /// + /// Description for reading info type + /// + Description = 0x4, + /// + /// State for reading info type + /// + State = 0x8 + } +} diff --git a/src/ElmSharp/ElmSharp/Rect.cs b/src/ElmSharp/ElmSharp/Rect.cs new file mode 100644 index 0000000..2f7a544 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Rect.cs @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace ElmSharp +{ + /// + /// The Rect is a struct that represent rectangluar space. + /// + [StructLayout(LayoutKind.Sequential)] + public struct Rect : IEquatable + { + /// + /// Creates and initializes a new instance of the Rect class. + /// + /// X axis value. + /// Y axis value. + /// Width value. + /// Height value. + public Rect(int x, int y, int w, int h) + { + X = x; + Y = y; + Width = w; + Height = h; + } + /// + /// Gets or sets the position of this Rectangle on the X axis. + /// + public int X { get; set; } + + /// + /// Gets or sets the position of this Rectangle on the Y axis. + /// + public int Y { get; set; } + + /// + /// Gets or sets the width of this Rectangle. + /// + public int Width { get; set; } + + /// + /// Gets or sets the height of this Rectangle. + /// + public int Height { get; set; } + + /// + /// Gets the position of this Rectangle on the X axis. + /// + public int Left { get { return X; } } + + /// + /// Gets the extent along the X axis. + /// + public int Right { get { return X + Width; } } + + /// + /// Gets the position of this Rectangle on the Y axis. + /// + public int Top { get { return Y; } } + + /// + /// Gets the extent along the Y axis. + /// + public int Bottom { get { return Y + Height; } } + + /// + /// Gets the Point defined by Rectangle.Left and Rectangle.Top. + /// + public Point Location { get { return new Point { X = X, Y = Y }; } } + + /// + /// Gets the extent of the Rectangle along its X and Y axis. + /// + public Size Size { get { return new Size { Width = Width, Height = Height }; } } + + public override string ToString() + { + return string.Format("{{X={0} Y={1} Width={2} Height={3}}}", X, Y, Width, Height); + } + + public override int GetHashCode() + { + unchecked + { + int hashCode = X.GetHashCode(); + hashCode = (hashCode * 397) ^ Y.GetHashCode(); + hashCode = (hashCode * 397) ^ Width.GetHashCode(); + hashCode = (hashCode * 397) ^ Height.GetHashCode(); + return hashCode; + } + } + + public override bool Equals(object obj) + { + if (!(obj is Rect)) + return false; + + return Equals((Rect)obj); + } + + public bool Equals(Rect other) + { + return X.Equals(other.X) && Y.Equals(other.Y) && Width.Equals(other.Width) && Height.Equals(other.Height); + } + + /// + /// Whether the two s are equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s have equal values. + public static bool operator ==(Rect r1, Rect r2) + { + return r1.Equals(r2); + } + + /// + /// Whether two s are not equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s do not have equal values. + public static bool operator !=(Rect r1, Rect r2) + { + return !r1.Equals(r2); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Rectangle.cs b/src/ElmSharp/ElmSharp/Rectangle.cs new file mode 100755 index 0000000..b0e69f8 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Rectangle.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Rectangle is a class that used to draw a solid colored rectangle. + /// + public class Rectangle : EvasObject + { + /// + /// Creates and initializes a new instance of the Rectangle class. + /// + /// The to which the new Slider will be attached as a child. + public Rectangle(EvasObject parent) : base(parent) + { + Interop.Evas.evas_object_size_hint_weight_set(Handle, 1.0, 1.0); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr evas = Interop.Evas.evas_object_evas_get(parent.Handle); + return Interop.Evas.evas_object_rectangle_add(evas); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Scroller.cs b/src/ElmSharp/ElmSharp/Scroller.cs new file mode 100755 index 0000000..2ceb38c --- /dev/null +++ b/src/ElmSharp/ElmSharp/Scroller.cs @@ -0,0 +1,794 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for visible type of scrollbar. + /// + public enum ScrollBarVisiblePolicy + { + /// + /// Show scrollbars as needed + /// + Auto = 0, + + /// + /// Always show scrollbars + /// + Visible, + + /// + /// Never show scrollbars + /// + Invisible + } + + /// + /// Enumeration for visible type of scrollbar. + /// + public enum ScrollBlock + { + /// + /// Scrolling movement is allowed in both direction.(X axis and Y axis) + /// + None = 1, + + /// + /// Scrolling movement is not allowed in Y axis direction. + /// + Vertical = 2, + + /// + /// Scrolling movement is not allowed in X axis direction. + /// + Horizontal = 4 + } + + /// + /// Type that controls how the content is scrolled. + /// + public enum ScrollSingleDirection + { + /// + /// Scroll every direction. + /// + None, + + /// + /// Scroll single direction if the direction is certain. + /// + Soft, + + /// + /// Scroll only single direction. + /// + Hard, + } + + /// + /// The Scroller is a container that holds and clips a single object and allows you to scroll across it. + /// + public class Scroller : Layout + { + SmartEvent _scroll; + SmartEvent _dragStart; + SmartEvent _dragStop; + SmartEvent _scrollpage; + + /// + /// Creates and initializes a new instance of the Scroller class. + /// + /// The to which the new Scroller will be attached as a child. + public Scroller(EvasObject parent) : base(parent) + { + _scroll = new SmartEvent(this, this.RealHandle, "scroll"); + _dragStart = new SmartEvent(this, this.RealHandle, "scroll,drag,start"); + _dragStop = new SmartEvent(this, this.RealHandle, "scroll,drag,stop"); + _scrollpage = new SmartEvent(this, this.RealHandle, "scroll,page,changed"); + } + + /// + /// Scrolled will be triggered when the content has been scrolled. + /// + public event EventHandler Scrolled + { + add + { + _scroll.On += value; + } + remove + { + _scroll.On -= value; + } + } + + /// + /// DragStart will be triggered when dragging the contents around has started. + /// + public event EventHandler DragStart + { + add + { + _dragStart.On += value; + } + remove + { + _dragStart.On -= value; + } + } + + /// + /// DragStop will be triggered when dragging the contents around has stopped. + /// + public event EventHandler DragStop + { + add + { + _dragStop.On += value; + } + remove + { + _dragStop.On -= value; + } + } + + /// + /// PageScrolled will be triggered when the visible page has changed. + /// + public event EventHandler PageScrolled + { + add + { + _scrollpage.On += value; + } + remove + { + _scrollpage.On -= value; + } + } + + /// + /// Gets the current region in the content object that is visible through the Scroller. + /// + public Rect CurrentRegion + { + get + { + int x, y, w, h; + Interop.Elementary.elm_scroller_region_get(RealHandle, out x, out y, out w, out h); + return new Rect(x, y, w, h); + } + } + + /// + /// Sets or gets the value of HorizontalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the horizontal scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public virtual ScrollBarVisiblePolicy HorizontalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Elementary.elm_scroller_policy_get(RealHandle, out policy, IntPtr.Zero); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy v = VerticalScrollBarVisiblePolicy; + Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)value, (int)v); + } + } + + /// + /// Sets or gets the value of VerticalScrollBarVisiblePolicy + /// + /// + /// ScrollBarVisiblePolicy.Auto means the vertical scrollbar is made visible if it is needed, and otherwise kept hidden. + /// ScrollBarVisiblePolicy.Visible turns it on all the time, and ScrollBarVisiblePolicy.Invisible always keeps it off. + /// + public virtual ScrollBarVisiblePolicy VerticalScrollBarVisiblePolicy + { + get + { + int policy; + Interop.Elementary.elm_scroller_policy_get(RealHandle, IntPtr.Zero, out policy); + return (ScrollBarVisiblePolicy)policy; + } + set + { + ScrollBarVisiblePolicy h = HorizontalScrollBarVisiblePolicy; + Interop.Elementary.elm_scroller_policy_set(RealHandle, (int)h, (int)value); + } + } + + /// + /// Sets or gets the value of ScrollBlock. + /// + /// + /// This function will block scrolling movement in a given direction.One can disable movements in the X axis, the Y axis or both. + /// The default value is ScrollBlock.None, where movements are allowed in both directions. + /// + public ScrollBlock ScrollBlock + { + get + { + return (ScrollBlock)Interop.Elementary.elm_scroller_movement_block_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_movement_block_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets scroll current page number. + /// + /// + /// Current page means the page which meets the top of the viewport. + /// If there are two or more pages in the viewport, it returns the number of the page which meets the top of the viewport. + /// The page number starts from 0. 0 is the first page. + /// + public int VerticalPageIndex + { + get + { + int v, h; + Interop.Elementary.elm_scroller_current_page_get(RealHandle, out h, out v); + return v; + } + } + + /// + /// Sets or gets scroll current page number. + /// + /// + /// Current page means the page which meets the left of the viewport. + /// If there are two or more pages in the viewport, it returns the number of the page which meets the left of the viewport. + /// The page number starts from 0. 0 is the first page. + /// + public int HorizontalPageIndex + { + get + { + int v, h; + Interop.Elementary.elm_scroller_current_page_get(RealHandle, out h, out v); + return h; + } + } + + /// + /// Sets or gets the maximum limit of the movable page at vertical direction. + /// + public int VerticalPageScrollLimit + { + get + { + int v, h; + Interop.Elementary.elm_scroller_page_scroll_limit_get(RealHandle, out h, out v); + return v; + } + set + { + int h = HorizontalPageScrollLimit; + Interop.Elementary.elm_scroller_page_scroll_limit_set(RealHandle, h, value); + } + } + + /// + /// Sets or gets the maximum limit of the movable page at horizontal direction. + /// + public int HorizontalPageScrollLimit + { + get + { + int v, h; + Interop.Elementary.elm_scroller_page_scroll_limit_get(RealHandle, out h, out v); + return h; + } + set + { + int v = VerticalPageScrollLimit; + Interop.Elementary.elm_scroller_page_scroll_limit_set(RealHandle, value, v); + } + } + + /// + /// Sets or gets the vertical bounce behaviour. + /// When scrolling, the scroller may "bounce" when reaching an edge of the content object. + /// This is a visual way to indicate the end has been reached. + /// This is enabled by default for both axis. + /// This API will set if it is enabled for the given axis with the boolean parameters for each axis. + /// + public bool VerticalBounce + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalBounce; + Interop.Elementary.elm_scroller_bounce_set(RealHandle, h, value); + } + } + + /// + /// Sets or gets the horizontal bounce behaviour. + /// When scrolling, the scroller may "bounce" when reaching an edge of the content object. + /// This is a visual way to indicate the end has been reached. + /// This is enabled by default for both axis. + /// This API will set if it is enabled for the given axis with the boolean parameters for each axis. + /// + public bool HorizontalBounce + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_bounce_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalBounce; + Interop.Elementary.elm_scroller_bounce_set(RealHandle, value, v); + } + } + + /// + /// Gets the width of the content object of the scroller. + /// + public int ChildWidth + { + get + { + int w, h; + Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h); + return w; + } + } + + /// + /// Gets the height of the content object of the scroller. + /// + public int ChildHeight + { + get + { + int w, h; + Interop.Elementary.elm_scroller_child_size_get(RealHandle, out w, out h); + return h; + } + } + + /// + /// Set scrolling gravity values for a scroller. + /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase. + /// The scroller will adjust the view to glue itself as follows. + /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content + /// Default values for x and y are 0.0 + /// + public double HorizontalGravity + { + get + { + double v, h; + Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v); + return h; + } + set + { + double v = VerticalGravity; + Interop.Elementary.elm_scroller_gravity_set(RealHandle, value, v); + } + } + + /// + /// Set scrolling gravity values for a scroller. + /// The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase. + /// The scroller will adjust the view to glue itself as follows. + /// x=0.0, for staying where it is relative to the left edge of the content x=1.0, for staying where it is relative to the rigth edge of the content y=0.0, for staying where it is relative to the top edge of the content y=1.0, for staying where it is relative to the bottom edge of the content + /// Default values for x and y are 0.0 + /// + public double VerticalGravity + { + get + { + double v, h; + Interop.Elementary.elm_scroller_gravity_get(RealHandle, out h, out v); + return v; + } + set + { + double h = HorizontalGravity; + Interop.Elementary.elm_scroller_gravity_set(RealHandle, h, value); + } + } + + /// + /// Get scroll last page number. + /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages. + /// + public int LastVerticalPageNumber + { + get + { + int v, h; + Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v); + return v; + } + } + + /// + /// Get scroll last page number. + /// The page number starts from 0. 0 is the first page. This returns the last page number among the pages. + /// + public int LastHorizontalPageNumber + { + get + { + int v, h; + Interop.Elementary.elm_scroller_last_page_get(RealHandle, out h, out v); + return h; + } + } + + /// + /// Set an infinite loop_ for a scroller. + /// This function sets the infinite loop vertically. + /// If the content is set, it will be shown repeatedly. + /// + public bool VerticalLoop + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalLoop; + Interop.Elementary.elm_scroller_loop_set(RealHandle, h, value); + } + } + + /// + /// Set an infinite loop_ for a scroller. + /// This function sets the infinite loop horizontally. + /// If the content is set, it will be shown repeatedly. + /// + public bool HorizontalLoop + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_loop_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalLoop; + Interop.Elementary.elm_scroller_loop_set(RealHandle, value, v); + } + } + + /// + /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size. + /// + public double VerticalRelativePageSize + { + get + { + double v, h; + Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v); + return v; + } + set + { + double h = HorizontalRelativePageSize; + Interop.Elementary.elm_scroller_page_relative_set(RealHandle, h, value); + } + } + + /// + /// Gets or sets a given scroller widget's scrolling page size, relative to its viewport size. + /// + public double HorizontalRelativePageSize + { + get + { + double v, h; + Interop.Elementary.elm_scroller_page_relative_get(RealHandle, out h, out v); + return h; + } + set + { + double v = VerticalRelativePageSize; + Interop.Elementary.elm_scroller_page_relative_set(RealHandle, value, v); + } + } + + /// + /// Gets or Sets the page snapping behavior of a scroller. + /// + /// + /// When scrolling, if a scroller is paged (see VerticalRelativePageSize), + /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further, + /// it will stop at the next page boundaries. This is disabled, by default, for both axis. + /// This function will set if it that is enabled or not, for each axis. + /// + public bool VerticalSnap + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v); + return v; + } + set + { + bool h = HorizontalSnap; + Interop.Elementary.elm_scroller_page_snap_set(RealHandle, h, value); + } + } + + /// + /// Gets or Sets the page snapping behavior of a scroller. + /// + /// + /// When scrolling, if a scroller is paged (see HorizontalRelativePageSize), + /// the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further, + /// it will stop at the next page boundaries. This is disabled, by default, for both axis. + /// This function will set if it that is enabled or not, for each axis. + /// + public bool HorizontalSnap + { + get + { + bool v, h; + Interop.Elementary.elm_scroller_page_snap_get(RealHandle, out h, out v); + return h; + } + set + { + bool v = VerticalSnap; + Interop.Elementary.elm_scroller_page_snap_set(RealHandle, value, v); + } + } + + /// + /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis. + /// + public int PageHeight + { + get + { + int w, h; + Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h); + return h; + } + set + { + int w = PageWidth; + Interop.Elementary.elm_scroller_page_size_set(RealHandle, w, value); + } + } + + /// + /// Gets or sets the page size to an absolute fixed value, with 0 turning it off for that axis. + /// + public int PageWidth + { + get + { + int w, h; + Interop.Elementary.elm_scroller_page_size_get(RealHandle, out w, out h); + return w; + } + set + { + int h = PageHeight; + Interop.Elementary.elm_scroller_page_size_set(RealHandle, value, h); + } + } + + /// + /// Gets or sets the event propagation for a scroller. + /// This enables or disables event propagation from the scroller content to the scroller and its parent. + /// By default event propagation is enabled. + /// + public bool ContentPropagateEvents + { + get + { + return Interop.Elementary.elm_scroller_propagate_events_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_propagate_events_set(RealHandle, value); + } + } + + /// + /// Gets or sets the step size to move scroller by key event. + /// + public int HorizontalStepSize + { + get + { + int h, v; + Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v); + return h; + } + set + { + int v = VerticalStepSize; + Interop.Elementary.elm_scroller_step_size_set(RealHandle, value, v); + } + } + + /// + /// Gets or sets the step size to move scroller by key event. + /// + public int VerticalStepSize + { + get + { + int h, v; + Interop.Elementary.elm_scroller_step_size_get(RealHandle, out h, out v); + return v; + } + set + { + int h = HorizontalStepSize; + Interop.Elementary.elm_scroller_step_size_set(RealHandle, h, value); + } + } + + /// + /// Gets or sets a value whether mouse wheel is enabled or not over the scroller. + /// + public bool WheelDisabled + { + get + { + return Interop.Elementary.elm_scroller_wheel_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_wheel_disabled_set(RealHandle, value); + } + } + + /// + /// Gets or sets the type of single direction scroll. + /// + public ScrollSingleDirection SingleDirection + { + get + { + return (ScrollSingleDirection)Interop.Elementary.elm_scroller_single_direction_get(RealHandle); + } + set + { + Interop.Elementary.elm_scroller_single_direction_set(RealHandle, (int)value); + } + } + + /// + /// Sets the scroller minimum size limited to the minimum size of the content. + /// By default the scroller will be as small as its design allows, irrespective of its content. + /// This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction. + /// + /// Enable limiting minimum size horizontally + /// Enable limiting minimum size vertically + public void MinimumLimit(bool horizontal, bool vertical) + { + Interop.Elementary.elm_scroller_content_min_limit(RealHandle, horizontal, vertical); + } + + /// + /// Sets the page size to an absolute fixed value, with 0 turning it off for that axis. + /// + /// The horizontal page size. + /// The vertical page size. + public void SetPageSize(int width, int height) + { + Interop.Elementary.elm_scroller_page_size_set(RealHandle, width, height); + } + + /// + /// Sets the scroll page size relative to the viewport size. + /// + /// + /// The scroller is capable of limiting scrolling by the user to "pages". + /// That is to jump by and only show a "whole page" at a time as if the continuous area of the scroller + /// content is split into page sized pieces. This sets the size of a page relative to the viewport of the scroller. + /// 1.0 is "1 viewport" which is the size (horizontally or vertically). 0.0 turns it off in that axis. + /// This is mutually exclusive with the page size (see elm_scroller_page_size_set() for more information). + /// Likewise 0.5 is "half a viewport". Usable values are normally between 0.0 and 1.0 including 1.0. + /// If you only want 1 axis to be page "limited", use 0.0 for the other axis. + /// + /// The horizontal page relative size. + /// The vertical page relative size. + public void SetPageSize(double width, double height) + { + Interop.Elementary.elm_scroller_page_relative_set(RealHandle, width, height); + } + + /// + /// Shows a specific virtual region within the scroller content object by the page number. + /// (0, 0) of the indicated page is located at the top-left corner of the viewport. + /// + /// The horizontal page number. + /// The vertical page number. + /// True means slider with animation. + public void ScrollTo(int horizontalPageIndex, int verticalPageIndex, bool animated) + { + if (animated) + { + Interop.Elementary.elm_scroller_page_bring_in(RealHandle, horizontalPageIndex, verticalPageIndex); + } + else + { + Interop.Elementary.elm_scroller_page_show(RealHandle, horizontalPageIndex, verticalPageIndex); + } + } + + /// + /// Shows a specific virtual region within the scroller content object. + /// + /// + /// This ensures that all (or part, if it does not fit) of the designated region in the virtual content object ((0, 0) + /// starting at the top-left of the virtual content object) is shown within the scroller. + /// If set "animated" to true, it will allows the scroller to "smoothly slide" to this location + /// (if configuration in general calls for transitions). + /// It may not jump immediately to the new location and may take a while and show other content along the way. + /// + /// Rect struct of region. + /// True means allows the scroller to "smoothly slide" to this location. + public void ScrollTo(Rect region, bool animated) + { + if (animated) + { + Interop.Elementary.elm_scroller_region_bring_in(RealHandle, region.X, region.Y, region.Width, region.Height); + } + else + { + Interop.Elementary.elm_scroller_region_show(RealHandle, region.X, region.Y, region.Width, region.Height); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_scroller_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Size.cs b/src/ElmSharp/ElmSharp/Size.cs new file mode 100755 index 0000000..c2af5e2 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Size.cs @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Size is a struct that defining height and width as a pair of generic type. + /// + public struct Size : IEquatable + { + /// + /// Magnitude along the horizontal axis, in platform-defined units. + /// + public int Width; + + /// + /// Magnitude along the vertical axis, in platform-specific units. + /// + public int Height; + + /// + /// Initializes a new instance of the Size structure from the specified dimensions. + /// + /// The width to set + /// The height to set + public Size(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// A human-readable representation of the . + /// + /// The string is formatted as "{{Width={0} Height={1}}}". + public override string ToString() + { + return string.Format("{{Width={0} Height={1}}}", Width, Height); + } + + public override int GetHashCode() + { + unchecked + { + return Width.GetHashCode() ^ (Height.GetHashCode() * 397); + } + } + + public override bool Equals(object obj) + { + if (!(obj is Size)) + return false; + + return Equals((Size)obj); + } + + public bool Equals(Size other) + { + return Width.Equals(other.Width) && Height.Equals(other.Height); + } + + /// + /// Whether the two s are equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s have equal values. + public static bool operator ==(Size s1, Size s2) + { + return s1.Equals(s2); + } + + /// + /// Whether two s are not equal. + /// + /// A on the left hand side. + /// A on the right hand side. + /// True if the two s do not have equal values. + public static bool operator !=(Size s1, Size s2) + { + return !s1.Equals(s2); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Slider.cs b/src/ElmSharp/ElmSharp/Slider.cs new file mode 100755 index 0000000..41fb507 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Slider.cs @@ -0,0 +1,328 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for the Slider's indicator visiblity mode. + /// + public enum SliderIndicatorVisibleMode + { + /// + /// Show indicator on mouse down or change in slider value. + /// + Default, + + /// + /// Always show the indicator. + /// + Always, + + /// + /// Show the indicator on focus. + /// + OnFocus, + + /// + /// Never show the indicator. + /// + None, + } + + /// + /// The Slider is a widget that adds a draggable slider widget for selecting the value of something within a range. + /// + public class Slider : Layout + { + double _minimum = 0.0; + double _maximum = 1.0; + + SmartEvent _changed; + SmartEvent _delayedChanged; + SmartEvent _dragStarted; + SmartEvent _dragStopped; + + /// + /// Creates and initializes a new instance of the Slider class. + /// + /// The to which the new Slider will be attached as a child. + public Slider(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty); + + _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed"); + _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty); + + _dragStarted = new SmartEvent(this, this.RealHandle, "slider,drag,start"); + _dragStarted.On += (s, e) => DragStarted?.Invoke(this, EventArgs.Empty); + + _dragStopped = new SmartEvent(this, this.RealHandle, "slider,drag,stop"); + _dragStopped.On += (s, e) => DragStopped?.Invoke(this, EventArgs.Empty); + } + + /// + /// ValueChanged will be triggered when the Slider value is changed by the user. + /// + public event EventHandler ValueChanged; + + /// + /// DelayedValueChanged will be triggered when a short time after the value is changed by the user. + /// This will be called only when the user stops dragging for a very short period or when they release their finger/mouse, + /// so it avoids possibly expensive reactions to the value change. + /// + public event EventHandler DelayedValueChanged; + + /// + /// DragStarted will be triggered when dragging the Slider indicator around has started. + /// + public event EventHandler DragStarted; + + /// + /// DragStopped will be triggered when dragging the Slider indicator around has stopped. + /// + public event EventHandler DragStopped; + + /// + /// Sets or gets the (exact) length of the bar region of a given Slider widget. + /// + /// + /// This sets the minimum width (when in the horizontal mode) or height (when in the vertical mode) + /// of the actual bar area of the slider obj. This in turn affects the object's minimum size. + /// Use this when you're not setting other size hints expanding on the given direction + /// (like weight and alignment hints), and you would like it to have a specific size. + /// + public int SpanSize + { + get + { + return Interop.Elementary.elm_slider_span_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_span_size_set(RealHandle, value); + } + } + + /// + /// Sets or gets the format string for the indicator label. + /// + /// + /// The slider may display its value somewhere other than the unit label, + /// for example, above the slider knob that is dragged around. This function sets the format string + /// used for this.If NULL, the indicator label won't be visible. If not, it sets the format string + /// for the label text. For the label text floating point value is provided, so the label text can + /// display up to 1 floating point value. Note that this is optional.Use a format string + /// such as "%1.2f meters" for example, and it displays values like: "3.14 meters" for a value + /// equal to 3.14159.By default, the indicator label is disabled. + /// + public string IndicatorFormat + { + get + { + return Interop.Elementary.elm_slider_indicator_format_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_indicator_format_set(RealHandle, value); + } + } + + /// + /// Sets or gets the orientation of a given slider widget. + /// + /// + /// The orientation may be vertically or horizontally.By default, it's displayed horizontally. + /// + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_slider_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets the minimum values for the slider. + /// + /// + /// This defines the allowed minimum values to be selected by the user. + /// If the actual value is less than min, it is updated to min. + /// Actual value can be obtained with Value.By default, min is equal to 0.0. + /// + public double Minimum + { + get + { + return _minimum; + } + set + { + _minimum = value; + Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum); + } + } + + /// + /// Sets or gets the maximum values for the slider. + /// + /// + /// This defines the allowed maximum values to be selected by the user. + /// If the actual value is bigger then max, it is updated to max. + /// Actual value can be obtained with Value.By default, min is equal to 0.0, and max is equal to 1.0. + /// Maximum must be greater than minimum, otherwise the behavior is undefined. + /// + public double Maximum + { + get + { + return _maximum; + } + set + { + _maximum = value; + Interop.Elementary.elm_slider_min_max_set(RealHandle, _minimum, _maximum); + } + } + + /// + /// Gets or sets the value displayed by the slider. + /// + /// + /// Value will be presented on the unit label following format specified with UnitFormat and + /// on indicator with IndicatorFormat.The value must to be between Minimum and Maximum values. + /// + public double Value + { + get + { + return Interop.Elementary.elm_slider_value_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_value_set(RealHandle, value); + } + } + + /// + /// Sets or gets the step by which the slider indicator moves. + /// + /// + /// This value is used when the draggable object is moved automatically i.e., + /// in case of a key event when up/down/left/right key is pressed or in case accessibility + /// is set and the flick event is used to inc/dec slider values. + /// By default, the step value is equal to 0.05. + /// + public double Step + { + get + { + return Interop.Elementary.elm_slider_step_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_step_set(RealHandle, value); + } + } + + /// + /// Gets or sets whether a given slider widget's displaying values are inverted. + /// + /// + /// A slider may be inverted, in which case it gets its values inverted, + /// with high values being on the left or top and low values on the right or bottom, + /// as opposed to normally have the low values on the former and high values on the latter, + /// respectively, for the horizontal and vertical modes. + /// + public bool IsInverted + { + get + { + return Interop.Elementary.elm_slider_inverted_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_inverted_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether to enlarge the slider indicator (augmented knob). + /// + /// + /// By default, the indicator is bigger when dragged by the user. + /// It won't display values set with IndicatorFormat if you disable the indicator. + /// + public bool IsIndicatorVisible + { + get + { + return Interop.Elementary.elm_slider_indicator_show_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_indicator_show_set(RealHandle, value); + } + } + + /// + /// Sets or gets the visible mode of slider indicator. + /// + public SliderIndicatorVisibleMode IndicatorVisibleMode + { + get + { + return (SliderIndicatorVisibleMode)Interop.Elementary.elm_slider_indicator_visible_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_indicator_visible_mode_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets whether to Show the indicator of slider on focus. + /// + public bool IsIndicatorFocusable + { + get + { + return Interop.Elementary.elm_slider_indicator_show_on_focus_get(RealHandle); + } + set + { + Interop.Elementary.elm_slider_indicator_show_on_focus_set(RealHandle, value); + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_slider_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/SmartEvent.cs b/src/ElmSharp/ElmSharp/SmartEvent.cs new file mode 100755 index 0000000..6edbb7a --- /dev/null +++ b/src/ElmSharp/ElmSharp/SmartEvent.cs @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; +using System.Collections.Generic; +using System.Linq; + +namespace ElmSharp +{ + /// + /// It inherits . + /// The event with TEventArgs for . + /// EvasObject can elect SmartEvent occurring inside of them to be reported back to their users via delegates. + /// This way, you can extend EvasObject's own . + /// They are defined by an event string, which identifies them uniquely. + /// + /// The parameter for the event. + public class SmartEvent : IInvalidatable where TEventArgs : EventArgs + { + /// + /// The delegate for creating smart event item args. + /// + /// The item data. + /// The sender obj. + /// The item sender obj. + /// Return smart event item args. + public delegate TEventArgs SmartEventInfoParser(IntPtr data, IntPtr obj, IntPtr info); + + private EvasObject _sender; + private readonly string _eventName; + private IntPtr _handle; + private readonly SmartEventInfoParser _parser; + private readonly List _nativeCallbacks = new List(); + + /// + /// Creates and initializes a new instance of the SmartEvent class. + /// + /// The source of the event. + /// The event name. + /// The event parameter. + public SmartEvent(EvasObject sender, string eventName, SmartEventInfoParser parser) : this(sender, sender.Handle, eventName, parser) + { + } + + [EditorBrowsableAttribute(EditorBrowsableState.Never)] + public SmartEvent(EvasObject sender, IntPtr handle, string eventName, SmartEventInfoParser parser) + { + _sender = sender; + _eventName = eventName; + _handle = handle; + _parser = parser; + sender.AddToEventLifeTracker(this); + } + + /// + /// Creates and initializes a new instance of the SmartEvent class. + /// + /// The source of the event. + /// The event name. + public SmartEvent(EvasObject sender, string eventName) : this(sender, eventName, null) + { + } + + ~SmartEvent() + { + Dispose(false); + } + + private struct NativeCallback + { + public Interop.Evas.SmartCallback callback; + public EventHandler eventHandler; + } + + /// + /// Adds or removes delegate for event. + /// + public event EventHandler On + { + add + { + if (_handle == IntPtr.Zero) + { + return; + } + EventHandler handler = value; + var cb = new Interop.Evas.SmartCallback((d, o, e) => + { + TEventArgs ea = _parser == null ? (TEventArgs)EventArgs.Empty : _parser(d, o, e); + handler(_sender, ea); + }); + _nativeCallbacks.Add(new NativeCallback { callback = cb, eventHandler = handler }); + int i = _nativeCallbacks.Count - 1; + Interop.Evas.evas_object_smart_callback_add(_handle, _eventName, _nativeCallbacks[i].callback, IntPtr.Zero); + } + + remove + { + if (_handle == IntPtr.Zero) + { + return; + } + EventHandler handler = value; + var callbacks = _nativeCallbacks.Where(cb => cb.eventHandler == handler); + foreach (var cb in callbacks) + { + Interop.Evas.evas_object_smart_callback_del(_handle, _eventName, cb.callback); + } + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Make current instance invalidate. + /// + public void MakeInvalidate() + { + _sender = null; + _handle = IntPtr.Zero; + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // Place holder to dispose managed state (managed objects). + } + if (_handle != IntPtr.Zero) + { + foreach (var cb in _nativeCallbacks) + { + Interop.Evas.evas_object_smart_callback_del(_handle, _eventName, cb.callback); + } + } + _nativeCallbacks.Clear(); + } + } + + /// + /// It inherits . + /// EvasObject can elect SmartEvent occurring inside of them to be reported back to their users via delegates. + /// This way, you can extend EvasObject's own . + /// They are defined by an event string, which identifies them uniquely. + /// + /// The parameter for the event. + public class SmartEvent : IInvalidatable + { + private SmartEvent _smartEvent; + private event EventHandler _handlers; + + /// + /// Creates and initializes a new instance of the SmartEvent class. + /// + /// The source of the event. + /// The event name. + public SmartEvent(EvasObject sender, string eventName) : this(sender, sender.RealHandle, eventName) + { + } + + [EditorBrowsableAttribute(EditorBrowsableState.Never)] + public SmartEvent(EvasObject sender, IntPtr handle, string eventName) + { + _smartEvent = new SmartEvent(sender, handle, eventName, null); + } + + ~SmartEvent() + { + Dispose(false); + } + + /// + /// Adds or removes delegate for event. + /// + public event EventHandler On + { + add + { + if (_handlers == null) + { + _smartEvent.On += SendEvent; + } + _handlers += value; + } + + remove + { + _handlers -= value; + if (_handlers == null) + { + _smartEvent.On -= SendEvent; + } + } + } + + private void SendEvent(object sender, EventArgs e) + { + _handlers?.Invoke(sender, e); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Make current instance invalidate. + /// + public void MakeInvalidate() + { + _smartEvent.MakeInvalidate(); + } + + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + // Place holder to dispose managed state (managed objects). + _smartEvent.Dispose(); + } + } + } +} diff --git a/src/ElmSharp/ElmSharp/Spinner.cs b/src/ElmSharp/ElmSharp/Spinner.cs new file mode 100755 index 0000000..e6a12e6 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Spinner.cs @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Spinner is a widget that increase or decrease numeric values using arrow buttons, or edit values directly. + /// Inherits . + /// + public class Spinner : Layout + { + double _minimum = 0.0; + double _maximum = 100.0; + + SmartEvent _changed; + SmartEvent _delayedChanged; + + /// + /// Creates and initializes a new instance of the Spinner class. + /// + /// The parent of new Spinner instance + public Spinner(EvasObject parent) : base(parent) + { + _changed = new SmartEvent(this, this.RealHandle, "changed"); + _changed.On += (s, e) => ValueChanged?.Invoke(this, EventArgs.Empty); + + _delayedChanged = new SmartEvent(this, this.RealHandle, "delay,changed"); + _delayedChanged.On += (s, e) => DelayedValueChanged?.Invoke(this, EventArgs.Empty); + } + + /// + /// ValueChanged will be triggered whenever the spinner value is changed. + /// + public event EventHandler ValueChanged; + + /// + /// DelayedValueChanged will be triggered after a short time when the value is changed. + /// + public event EventHandler DelayedValueChanged; + + /// + /// Sets or gets the label format of the spinner. + /// + public string LabelFormat + { + get + { + return Interop.Elementary.elm_spinner_label_format_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_label_format_set(RealHandle, value); + } + } + + /// + /// Sets or gets the minimum value for the spinner. + /// + public double Minimum + { + get + { + return _minimum; + } + set + { + _minimum = value; + Interop.Elementary.elm_spinner_min_max_set(RealHandle, _minimum, _maximum); + } + } + + /// + /// Sets or gets the maximum value for the spinner. + /// + public double Maximum + { + get + { + return _maximum; + } + set + { + _maximum = value; + Interop.Elementary.elm_spinner_min_max_set(RealHandle, _minimum, _maximum); + } + } + + /// + /// Sets or gets the step that used to increment or decrement the spinner value. + /// + public double Step + { + get + { + return Interop.Elementary.elm_spinner_step_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_step_set(RealHandle, value); + } + } + + /// + /// Sets or gets the value displayed by the spinner. + /// + public double Value + { + get + { + return Interop.Elementary.elm_spinner_value_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_value_set(RealHandle, value); + } + } + + /// + /// Sets or gets the interval on time updates for an user mouse button hold on spinner widgets' arrows. + /// + public double Interval + { + get + { + return Interop.Elementary.elm_spinner_interval_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_interval_set(RealHandle, value); + } + } + + /// + /// Sets or gets the base for rounding. + /// + public double RoundBase + { + get + { + return Interop.Elementary.elm_spinner_base_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_base_set(RealHandle, value); + } + } + + /// + /// Sets or gets the round value for rounding. + /// + public int RoundValue + { + get + { + return Interop.Elementary.elm_spinner_round_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_round_set(RealHandle, value); + } + } + + /// + /// Sets or gets the wrap of a given spinner widget. + /// + /// + /// If wrap is disabled, when the user tries to increment the value, but displayed value plus step value is bigger than maximum value, the new value will be the maximum value. + /// If wrap is enabled, when the user tries to increment the value, but displayed value plus step value is bigger than maximum value, the new value will be the minimum value. + /// By default it's disabled. + /// + public bool IsWrapEnabled + { + get + { + return Interop.Elementary.elm_spinner_wrap_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_wrap_set(RealHandle, value); + } + } + + /// + /// Sets or gets whether the spinner can be directly edited by the user or not. + /// + /// By default it is enabled + public bool IsEditable + { + get + { + return Interop.Elementary.elm_spinner_editable_get(RealHandle); + } + set + { + Interop.Elementary.elm_spinner_editable_set(RealHandle, value); + } + } + + /// + /// Set a special string to display in the place of the numerical value. + /// + /// The numerical value to be replaced + /// The label to be used + public void AddSpecialValue(double value, string label) + { + Interop.Elementary.elm_spinner_special_value_add(RealHandle, value, label); + } + + /// + /// Remove a previously added special value, After this, the spinner will display the value itself instead of a label. + /// + /// The replaced numerical value + public void RemoveSpecialValue(double value) + { + Interop.Elementary.elm_spinner_special_value_del(RealHandle, value); + } + + /// + /// Get the special string display in the place of the numerical value. + /// + /// The replaced numerical value. + /// The value of the spinner which replaced numerical value with special string + public string GetSpecialValue(double value) + { + return Interop.Elementary.elm_spinner_special_value_get(RealHandle, value); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_spinner_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Table.cs b/src/ElmSharp/ElmSharp/Table.cs new file mode 100755 index 0000000..707a34b --- /dev/null +++ b/src/ElmSharp/ElmSharp/Table.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The Table is a container widget to arrange other widgets in a table where items can span multiple columns or rows . + /// Inherits . + /// + public class Table : Container + { + int _paddingX = 0; + int _paddingY = 0; + + /// + /// Creates and initializes a new instance of the Table class. + /// + /// + /// A to which the new Table instance will be attached. + /// + public Table(EvasObject parent) : base(parent) + { + } + + /// + /// Sets or gets whether the layout of this table is homogeneous. + /// + /// True for homogeneous, False for no homogeneous + public bool Homogeneous + { + get + { + return Interop.Elementary.elm_table_homogeneous_get(RealHandle); + } + set + { + Interop.Elementary.elm_table_homogeneous_set(RealHandle, value); + } + } + + /// + /// Sets or gets the horizontal padding between the cells. + /// + public int PaddingX + { + get + { + return _paddingX; + } + set + { + _paddingX = value; + Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY); + } + } + + /// + /// Sets or gets the vertical padding between the cells. + /// + public int PaddingY + { + get + { + return _paddingY; + } + set + { + _paddingY = value; + Interop.Elementary.elm_table_padding_set(RealHandle, _paddingX, _paddingY); + } + } + /// + /// Adds a subobject on the table with the coordinates passed. + /// + /// The subobject to be added to the table + /// The column number + /// The row number + /// The column span + /// The row span + public void Pack(EvasObject obj, int col, int row, int colspan, int rowspan) + { + if (obj == null) + throw new ArgumentNullException("obj"); + Interop.Elementary.elm_table_pack(RealHandle, obj, col, row, colspan, rowspan); + AddChild(obj); + } + + /// + /// Removes the child from the table. + /// + /// The subobject + public void Unpack(EvasObject obj) + { + if (obj == null) + throw new ArgumentNullException("obj"); + Interop.Elementary.elm_table_unpack(RealHandle, obj); + RemoveChild(obj); + } + + /// + /// Removes all child objects from a table object. + /// + public void Clear() + { + Interop.Elementary.elm_table_clear(RealHandle, false); + ClearChildren(); + } + + /// + /// Sets the color for particular part of the table. + /// + /// The name of part class + /// The color + public override void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_color_class_color_set(Handle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + /// + /// Gets the color of particular part of the table. + /// + /// The name of part class, it could be 'bg', 'elm.swllow.content' + /// The color of the particular part + public override Color GetPartColor(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "background", "default"); + + RealHandle = Interop.Elementary.elm_table_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} diff --git a/src/ElmSharp/ElmSharp/Toolbar.cs b/src/ElmSharp/ElmSharp/Toolbar.cs new file mode 100644 index 0000000..0370594 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Toolbar.cs @@ -0,0 +1,463 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; + +namespace ElmSharp +{ + /// + /// Enumeration for the selection mode of Toolbar. + /// + public enum ToolbarSelectionMode + { + /// + /// Default select mode. + /// + Default = 0, + + /// + /// Always select mode. + /// + Always, + + /// + /// No select mode. + /// + None, + + /// + /// No select mode with no finger size rule. + /// + DisplayOnly, + } + + /// + /// Enumeration that sets the toolbar items display behavior, it can be scrollable, can show a menu with exceeding items, or simply hide them. + /// + public enum ToolbarShrinkMode + { + /// + /// Sets minimum toolbar size to fit all the items. + /// + None = 0, + + /// + /// Hides exceeding items. + /// + Hide, + + /// + /// Allows accessing exceeding items through a scroller. + /// + Scroll, + + /// + /// Inserts a button to pop up a menu with exceeding items. + /// + Menu, + + /// + /// Expands all items according to the size of the toolbar. + /// + Expand + } + + /// + /// Enumeration for the icon lookup order of Toolbar. + /// + public enum ToolbarIconLookupOrder + { + /// + /// Icon look up order: freedesktop, theme. + /// + FreedesktopTheme, + + /// + /// Icon look up order: theme, freedesktop. + /// + ThemeFreedesktop, + + /// + /// Icon look up order: freedesktop. + /// + Freedesktop, + + /// + /// Icon look up order: theme. + /// + Theme, + } + + /// + /// Event arguments for events of . + /// + /// + /// Inherits EventArgs. + /// + public class ToolbarItemEventArgs : EventArgs + { + /// + /// Gets the ToolbarItem. + /// + public ToolbarItem Item { get; private set; } + + internal static ToolbarItemEventArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + ToolbarItem item = ItemObject.GetItemByHandle(info) as ToolbarItem; + return new ToolbarItemEventArgs() { Item = item }; + } + } + + /// + /// The Toolbar is a widget that displays a list of items inside a box. + /// + public class Toolbar : Widget + { + SmartEvent _clicked; + SmartEvent _selected; + SmartEvent _longpressed; + + /// + /// Creates and initializes a new instance of the Toolbar class. + /// + /// + /// A EvasObject to which the new Table instance will be attached. + /// + public Toolbar(EvasObject parent) : base(parent) + { + _selected = new SmartEvent(this, this.RealHandle, "selected", ToolbarItemEventArgs.CreateFromSmartEvent); + _selected.On += (s, e) => + { + if (e.Item != null) + { + Selected?.Invoke(this, e); + e.Item.SendSelected(); + } + }; + _longpressed = new SmartEvent(this, this.RealHandle, "longpressed", ToolbarItemEventArgs.CreateFromSmartEvent); + _longpressed.On += (s, e) => + { + e.Item?.SendLongPressed(); + }; + _clicked = new SmartEvent(this, this.RealHandle, "clicked", ToolbarItemEventArgs.CreateFromSmartEvent); + _clicked.On += (s, e) => + { + e.Item?.SendClicked(); + }; + } + + /// + /// Selected will be triggered when toolbar have been selected. + /// + public event EventHandler Selected; + + /// + /// Sets or gets whether the layout of this toolbar is homogeneous. + /// + /// True for homogeneous, False for no homogeneous + public bool Homogeneous + { + get + { + return Interop.Elementary.elm_toolbar_homogeneous_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_homogeneous_set(RealHandle, value); + } + } + + /// + /// Sets or gets the slection mode of a given Toolbar widget. + /// + public ToolbarSelectionMode SelectionMode + { + get + { + return (ToolbarSelectionMode)Interop.Elementary.elm_toolbar_select_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_select_mode_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets the shrink mode of a given Toolbar widget. + /// + public ToolbarShrinkMode ShrinkMode + { + get + { + return (ToolbarShrinkMode)Interop.Elementary.elm_toolbar_shrink_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_shrink_mode_set(RealHandle, (int)value); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsHorizontal + { + get + { + return Interop.Elementary.elm_toolbar_horizontal_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_horizontal_set(RealHandle, value); + } + } + + /// + /// Sets or gets the icon lookup order, for toolbar items' icons. + /// The default lookup order is ToolbarIocnLookupOrder.ThemeFreedesktop. + /// Icons added before calling this function will not be affected. + /// + public ToolbarIconLookupOrder IconLookupOrder + { + get + { + return (ToolbarIconLookupOrder)Interop.Elementary.elm_toolbar_icon_order_lookup_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_icon_order_lookup_set(RealHandle, (int)value); + } + } + + /// + /// Sets or gets the icon size of a given toolbar widget. + /// Default value is 32 pixels, to be used by toolbar items. + /// + public int IconSize + { + get + { + return Interop.Elementary.elm_toolbar_icon_size_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_icon_size_set(RealHandle, value); + } + } + + /// + /// Gets the number of items in a toolbar widget. + /// + public int ItemsCount + { + get + { + return Interop.Elementary.elm_toolbar_items_count(RealHandle); + } + } + + /// + /// Sets or gets the alignment of the items. + /// + /// The toolbar items alignment, a float between 0.0 and 1.0 + public double ItemAlignment + { + get + { + return Interop.Elementary.elm_toolbar_align_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_align_set(RealHandle, value); + } + } + + /// + /// Sets or gets the item's transverse expansion of a given toolbar widget. + /// + /// + /// The transverse expansion of the item, true for on and false for off. + /// By default it's false. + /// + public bool TransverseExpansion + { + get + { + return Interop.Elementary.elm_toolbar_transverse_expanded_get(RealHandle); + } + set + { + Interop.Elementary.elm_toolbar_transverse_expanded_set(RealHandle, value); + } + } + + /// + /// Appends ToolbarItem which just contains label to the toolbar. + /// + /// The label of the item + /// The new ToolbarItem which appended to the toolbar + /// + /// + public ToolbarItem Append(string label) + { + return Append(label, null); + } + + /// + /// Appends ToolbarItem which contains label and icon to the toolbar. + /// + /// The label of the item + /// A string with the icon name or the absolute path of an image file + /// The new ToolbarItem which appended to the toolbar + /// + /// + /// + public ToolbarItem Append(string label, string icon) + { + ToolbarItem item = new ToolbarItem(label, icon); + item.Handle = Interop.Elementary.elm_toolbar_item_append(RealHandle, icon, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Prepends ToolbarItem which just contains label to the toolbar. + /// + /// The label of the item + /// The new ToolbarItem which prepended to the toolbar + /// + /// + /// + public ToolbarItem Prepend(string label) + { + return Prepend(label, null); + } + + /// + /// Prepends ToolbarItem which contains label and icon to the toolbar. + /// + /// The label of the item + /// A string with the icon name or the absolute path of an image file + /// The new which prepended to the toolbar + /// + /// + /// + public ToolbarItem Prepend(string label, string icon) + { + ToolbarItem item = new ToolbarItem(label, icon); + item.Handle = Interop.Elementary.elm_toolbar_item_prepend(RealHandle, icon, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Inserts a new item which just contains label into the toolbar object before item . + /// + /// The toolbar item to insert before + /// The label of the item + /// The new which insert into the toolbar + /// + public ToolbarItem InsertBefore(ToolbarItem before, string label) + { + return InsertBefore(before, label, string.Empty); + } + + /// + /// Inserts a new item which contains label and icon into the toolbar object before item . + /// + /// The toolbar item to insert before + /// The label of the item + /// A string with the icon name or the absolute path of an image file + /// The new which insert into the toolbar + /// + public ToolbarItem InsertBefore(ToolbarItem before, string label, string icon) + { + ToolbarItem item = new ToolbarItem(label, icon); + item.Handle = Interop.Elementary.elm_toolbar_item_insert_before(RealHandle, before, icon, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Inserts a new item which contains label and icon into the toolbar object after item . + /// + /// The toolbar item to insert after + /// The label of the item + /// A string with the icon name or the absolute path of an image file + /// The new which insert into the toolbar + /// + public ToolbarItem InsertAfter(ToolbarItem after, string label, string icon) + { + ToolbarItem item = new ToolbarItem(label, icon); + item.Handle = Interop.Elementary.elm_toolbar_item_insert_after(RealHandle, after, icon, label, null, (IntPtr)item.Id); + return item; + } + + /// + /// Find the item with that label in the toolbar. + /// + /// The label of the item + /// The into the toolbar + public ToolbarItem FindItemByLabel(string label) + { + IntPtr handle = Interop.Elementary.elm_toolbar_item_find_by_label(RealHandle, label); + return ItemObject.GetItemByHandle(handle) as ToolbarItem; + } + + /// + /// Gets the selected ToolbarItemItem of the toolbar. + /// + public ToolbarItem SelectedItem + { + get + { + IntPtr handle = Interop.Elementary.elm_toolbar_selected_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as ToolbarItem; + } + } + + /// + /// Gets the first ToolbarItemItem of the toolbar. + /// + public ToolbarItem FirstItem + { + get + { + IntPtr handle = Interop.Elementary.elm_toolbar_first_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as ToolbarItem; + } + } + + /// + /// Gets the last ToolbarItemItem of the toolbar. + /// + public ToolbarItem LastItem + { + get + { + IntPtr handle = Interop.Elementary.elm_toolbar_last_item_get(RealHandle); + return ItemObject.GetItemByHandle(handle) as ToolbarItem; + } + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = Interop.Elementary.elm_layout_add(parent.Handle); + Interop.Elementary.elm_layout_theme_set(handle, "layout", "elm_widget", "default"); + + RealHandle = Interop.Elementary.elm_toolbar_add(handle); + Interop.Elementary.elm_object_part_content_set(handle, "elm.swallow.content", RealHandle); + + return handle; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/ToolbarItem.cs b/src/ElmSharp/ElmSharp/ToolbarItem.cs new file mode 100755 index 0000000..072baab --- /dev/null +++ b/src/ElmSharp/ElmSharp/ToolbarItem.cs @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// The ToolbarItem is a item of Toolbar. + /// + public class ToolbarItem : ItemObject + { + string _icon; + string _text; + internal ToolbarItem(string text, string icon) : base(IntPtr.Zero) + { + _text = text; + _icon = icon; + } + + /// + /// Sets or gets the icon path of the item. + /// + public string Icon + { + get + { + return _icon; + } + set + { + _icon = value; + Interop.Elementary.elm_toolbar_item_icon_set(Handle, value); + } + } + + /// + /// Sets or gets the text string of the item. + /// + public string Text + { + get + { + return _text; + } + set + { + _text = value; + SetPartText(null, value); + } + } + + /// + /// Sets or gets the enable of the item. + /// + [Obsolete("Enabled is obsolete as of version v1.1.0-beta-023. Please use IsEnabled instead.")] + public bool Enabled + { + get + { + return IsEnabled; + } + set + { + IsEnabled = value; + } + } + + /// + /// Sets or gets whether displaying the item as a separator. + /// + /// Items aren't set as a separator by default. If set as a separator it displays a separator theme, so it won't display icons or labels. + public bool IsSeparator + { + get + { + return Interop.Elementary.elm_toolbar_item_separator_get(Handle); + } + set + { + Interop.Elementary.elm_toolbar_item_separator_set(Handle, value); + } + } + + /// + /// Sets or gets whether the item is selected. + /// + public bool IsSelected + { + get + { + return Interop.Elementary.elm_toolbar_item_selected_get(Handle); + } + set + { + Interop.Elementary.elm_toolbar_item_selected_set(Handle, value); + } + } + + /// + /// Selected will be triggered when the item is selected. + /// + public event EventHandler Selected; + + /// + /// LongPressed will be triggered when the item is pressed long time. + /// + public event EventHandler LongPressed; + + /// + /// Clicked will be triggered when the item is clicked. + /// + public event EventHandler Clicked; + + internal void SendSelected() + { + Selected?.Invoke(this, EventArgs.Empty); + } + internal void SendLongPressed() + { + LongPressed?.Invoke(this, EventArgs.Empty); + } + internal void SendClicked() + { + Clicked?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/src/ElmSharp/ElmSharp/Transit.cs b/src/ElmSharp/ElmSharp/Transit.cs new file mode 100755 index 0000000..8ee276a --- /dev/null +++ b/src/ElmSharp/ElmSharp/Transit.cs @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using static Interop.Elementary; + +namespace ElmSharp +{ + /// + /// Transit is designed to apply various animated transition effects, such like translation, rotation, etc. + /// For using these effects, create an Transit and add the desired transition effects. + /// + /// Transit is not reusable. If the effect ends, the transit is destroyed automatically. + public class Transit : IDisposable + { + IntPtr _handle = IntPtr.Zero; + bool _isDisposed = false; + ObservableCollection _objects = new ObservableCollection(); + ObservableCollection _chains = new ObservableCollection(); + HashSet _checker = new HashSet(); + Elm_Transit_Del_Cb DeletedCallback; + Elm_Transit_Effect_End_Cb EffectEndCallback; + Elm_Transit_Effect_Transition_Cb EffectTransitionCallback; + + /// + /// A callback called when the transit is deleted. + /// + public event EventHandler Deleted; + + /// + /// Creates and initializes a new instance of Transit class. + /// + public Transit() + { + _handle = Interop.Elementary.elm_transit_add(); + DeletedCallback = (ptr1, ptr2) => { + Deleted?.Invoke(this, EventArgs.Empty); + Dispose(true); + }; + Interop.Elementary.elm_transit_del_cb_set(_handle, DeletedCallback, IntPtr.Zero); + ((INotifyCollectionChanged)_objects).CollectionChanged += OnObjectCollectionChanged; + ((INotifyCollectionChanged)_chains).CollectionChanged += OnChaninCollectionChanged; + } + + ~Transit() + { + Dispose(false); + } + + /// + /// Gets or sets the transit animation time + /// + public double Duration + { + get + { + return Interop.Elementary.elm_transit_duration_get(_handle); + } + set + { + Interop.Elementary.elm_transit_duration_set(_handle, value); + } + } + + /// + /// Gets or sets a value whether the objects states will be keep or not. + /// If it is not kept, the objects states will be reset when transition ends. + /// + public bool ObjectStateKeep + { + get + { + return Interop.Elementary.elm_transit_objects_final_state_keep_get(_handle); + } + set + { + Interop.Elementary.elm_transit_objects_final_state_keep_set(_handle, value); + } + } + + /// + /// Gets or sets the transit animation acceleration type. + /// + public TweenMode TweenMode + { + get + { + return (TweenMode)Interop.Elementary.elm_transit_tween_mode_get(_handle); + } + set + { + Interop.Elementary.elm_transit_tween_mode_set(_handle, (int)value); + } + } + + /// + /// Gets or sets the transit repeat count. + /// If the repeat is a negative number, it will repeat infinite times. + /// + public int Repeat + { + get + { + return Interop.Elementary.elm_transit_repeat_times_get(_handle); + } + set + { + Interop.Elementary.elm_transit_repeat_times_set(_handle, value); + } + } + + /// + /// Gets or sets if the auto reverse is on. + /// + public bool AutoReverse + { + get + { + return Interop.Elementary.elm_transit_auto_reverse_get(_handle); + } + set + { + Interop.Elementary.elm_transit_auto_reverse_set(_handle, value); + } + } + + /// + /// Gets or sets the event enabled when transit is operating. + /// + public bool EventEnabled + { + get + { + return Interop.Elementary.elm_transit_event_enabled_get(_handle); + } + set + { + Interop.Elementary.elm_transit_event_enabled_set(_handle, value); + } + } + + /// + /// Gets or sets the smooth scaling for transit map rendering + /// This gets smooth scaling for transit map rendering. + /// + public bool Smooth + { + get + { + return Interop.Elementary.elm_transit_smooth_get(_handle); + } + set + { + Interop.Elementary.elm_transit_smooth_set(_handle, value); + } + } + + /// + /// Get the time progression of the animation (a double value between 0.0 and 1.0). + /// The value returned is a fraction(current time / total time). + /// It represents the progression position relative to the total. + /// + public double Progress + { + get + { + return Interop.Elementary.elm_transit_progress_value_get(_handle); + } + } + + /// + /// Gets or sets the transit animation tween mode acceleration factor. + /// + /// A factor value from 0.0 to 1.0. + public double BeginAccelerationFactor + { + get + { + double begin = 1.0, end = 0.0; + Interop.Elementary.elm_transit_tween_mode_factor_get(_handle, out begin, out end); + return begin; + } + set + { + Interop.Elementary.elm_transit_tween_mode_factor_set(_handle, value, EndAccelerationFactor); + } + } + + /// + /// Gets or sets the transit animation tween mode acceleration factor. + /// + /// A factor value from 0.0 to 1.0. + public double EndAccelerationFactor + { + get + { + double begin = 1.0, end = 0.0; + Interop.Elementary.elm_transit_tween_mode_factor_get(_handle, out begin, out end); + return end; + } + set + { + Interop.Elementary.elm_transit_tween_mode_factor_set(_handle, BeginAccelerationFactor, value); + } + } + + /// + /// Starts the transition in given seconds. + /// Once this API is called, the transit begins to measure the time. + /// + /// The interval value in seconds + public void Go(double interval = 0) + { + Interop.Elementary.elm_transit_go_in(_handle, interval); + } + + /// + /// Pause the transition. + /// + public void Pause() + { + if (Interop.Elementary.elm_transit_paused_get(_handle) == false) + Interop.Elementary.elm_transit_paused_set(_handle, true); + } + + /// + /// Resume the transition. + /// + public void Resume() + { + if (Interop.Elementary.elm_transit_paused_get(_handle) == true) + Interop.Elementary.elm_transit_paused_set(_handle, false); + } + + /// + /// Get the current chained transit list. + /// + /// Cannot add the duplicate transit. + public IList Chains + { + get { return _chains; } + } + + /// + /// Get the objects list of the transit. + /// + /// Cannot add the duplicate object. + public IList Objects + { + get { return _objects; } + } + + /// + /// Add the effect. + /// + /// EffectBase object. + public void AddEffect(EffectBase effect) + { + IntPtr _effect = effect.CreateEffect(_handle); + EffectEndCallback = (effectPtr, transitPtr) => { effect.SendEffectEnd(); }; + EffectTransitionCallback = (effectPtr, transitPtr, progress) => { }; + Interop.Elementary.elm_transit_effect_add(_handle, EffectTransitionCallback, _effect, EffectEndCallback); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool isDisposing) + { + if (_isDisposed) + return; + + if (isDisposing) + { + ((INotifyCollectionChanged)_chains).CollectionChanged -= OnChaninCollectionChanged; + _chains.Clear(); + ((INotifyCollectionChanged)_objects).CollectionChanged -= OnObjectCollectionChanged; + _objects.Clear(); + _checker.Clear(); + } + + _isDisposed = true; + } + + void OnObjectCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.Action == NotifyCollectionChangedAction.Add) + { + foreach (EvasObject item in e.NewItems) + AddObject(item); + } + else if (e.Action == NotifyCollectionChangedAction.Remove) + { + foreach (EvasObject item in e.OldItems) + RemoveObject(item); + } + } + + void OnChaninCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.Action == NotifyCollectionChangedAction.Add) + { + foreach (Transit item in e.NewItems) + AddChainedTransit(item); + } + else if (e.Action == NotifyCollectionChangedAction.Remove) + { + foreach (Transit item in e.OldItems) + DeleteChainedTransit(item); + } + } + + /// + /// Add new object to apply the effects. + /// After the first addition of an object to transit, if its object list become empty again, the transit will be killed. + /// If the obj belongs to another transit, the obj will be removed from it and it will only belong to the other transit. + /// + /// It is not allowed to add a new object after transit begins. + /// Object to be animated. + void AddObject(EvasObject obj) + { + if (_checker.Contains(obj)) + throw new Exception("Cannot add the duplicate object."); + + _checker.Add(obj); + Interop.Elementary.elm_transit_object_add(_handle, obj); + } + + /// + /// Removes an added object from the transit. + /// + /// Object to be removed from transit. + void RemoveObject(EvasObject obj) + { + if (_checker.Contains(obj)) + _checker.Remove(obj); + + Interop.Elementary.elm_transit_object_remove(_handle, obj); + } + + /// + /// Makes the chain relationship between two transits. + /// + /// The chain transit object. This transit will be operated after transit is done. + void AddChainedTransit(Transit transit) + { + if (_checker.Contains(transit)) + throw new Exception("Cannot add the duplicate transit."); + + _checker.Add(transit); + Interop.Elementary.elm_transit_chain_transit_add(_handle, transit._handle); + } + + /// + /// Cut off the chain relationship between two transits. + /// + /// The chain transit object. + void DeleteChainedTransit(Transit transit) + { + if (_checker.Contains(transit)) + _checker.Remove(transit); + + Interop.Elementary.elm_transit_chain_transit_del(_handle, transit._handle); + } + } +} diff --git a/src/ElmSharp/ElmSharp/TransitEffect.cs b/src/ElmSharp/ElmSharp/TransitEffect.cs new file mode 100755 index 0000000..fd29499 --- /dev/null +++ b/src/ElmSharp/ElmSharp/TransitEffect.cs @@ -0,0 +1,461 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace ElmSharp +{ + /// + /// The axis along which flip effect should be applied. + /// + public enum FlipAxis + { + /// + /// Flip on X axis + /// + X, + + /// + /// Flip on Y axis + /// + Y, + } + + /// + /// The direction in which the wipe effect should occur. + /// + public enum WipeDirection + { + /// + /// Wipe to the left + /// + Left, + + /// + /// Wipe to the right + /// + Right, + + /// + /// Wipe to the up + /// + Up, + + /// + /// Wipe to the down + /// + Down, + } + + /// + /// Whether the wipe effect should show or hide the object. + /// + public enum WipeType + { + /// + /// Hide the object during the animation + /// + Hide, + + /// + /// Show the object during the animation + /// + Show, + } + + /// + /// The type of acceleration used in the transition. + /// + public enum TweenMode + { + /// + /// Constant speed + /// + Linear, + + /// + /// Starts slow, increase speed over time, then decrease again and stop slowly, v1 being a power factor + /// + Sinusoidal, + + /// + /// Starts fast and decrease speed over time, v1 being a power factor + /// + Decelerate, + + /// + /// Starts slow and increase speed over time, v1 being a power factor + /// + Accelerate, + + /// + /// Start at gradient v1, interpolated via power of v2 curve + /// + DivisorInterpolate, + + /// + /// Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1 + /// + Bounce, + + /// + /// Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble v2 times, with decay factor of v1 + /// + Spring, + + /// + /// Follow the cubic-bezier curve calculated with the control points (x1, y1), (x2, y2) + /// + BezierCurve, + } + + /// + /// Blend effect class. + /// + public class BlendEffect : EffectBase + { + /// + /// Creates and initializes a new instance of BlendEffect class. + /// + public BlendEffect() + { + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_blend_add(transit); + } + } + + /// + /// Color effect class. + /// + public class ColorEffect : EffectBase + { + Color _begin; + Color _end; + + /// + /// Creates and initializes a new instance of ColorEffect class. + /// + /// The begin color of the effect + /// The end color of the effect + public ColorEffect(Color beginColor, Color endColor) + { + _begin = beginColor; + _end = endColor; + } + + /// + /// The begin color of the effect + /// + public Color BeginColor + { + get { return _begin; } + } + + /// + /// The end color of the effect + /// + public Color EndColor + { + get { return _end; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_color_add(transit, _begin.R, _begin.G, _begin.B, _begin.A, _end.R, _end.G, _end.B, _end.A); + } + } + + /// + /// Fade effect class. + /// + public class FadeEffect : EffectBase + { + /// + /// Creates and initializes a new instance of FadeEffect class. + /// + public FadeEffect() + { + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_fade_add(transit); + } + } + + /// + /// Flip effect class. + /// + public class FlipEffect : EffectBase + { + FlipAxis _axis; + bool _clockWise; + bool _resizable; + + /// + /// Creates and initializes a new instance of FlipEffect class. + /// + /// Flipping Axis(X or Y). + /// Flipping Direction. True is clock-wise. + /// Resizable effect with FlipEffect + public FlipEffect(FlipAxis axis, bool clockWise, bool resizable = false) + { + _axis = axis; + _clockWise = clockWise; + _resizable = resizable; + } + + /// + /// Flipping Axis(X or Y). + /// + public FlipAxis Axis + { + get { return _axis; } + } + + /// + /// Flipping Direction. True is clock-wise. + /// + public bool ClockWise + { + get { return _clockWise; } + } + + /// + /// Resizable FlipEffect. + /// + public bool Resizable + { + get { return _resizable; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + if (_resizable) + return Interop.Elementary.elm_transit_effect_resizable_flip_add(transit, (int)_axis, _clockWise); + return Interop.Elementary.elm_transit_effect_flip_add(transit, (int)_axis, _clockWise); + } + } + + /// + /// Resizing effect class. + /// + public class ResizingEffect : EffectBase + { + Size _begin; + Size _end; + + /// + /// Creates and initializes a new instance of FlipEffect class. + /// + /// The begin Size of the effect + /// The end Size of the effect + public ResizingEffect(Size beginSize, Size endSize) + { + _begin = beginSize; + _end = endSize; + } + + /// + /// The begin Size of the effect + /// + public Size BeginSize + { + get { return _begin; } + } + + /// + /// The end Size of the effect + /// + public Size EndSize + { + get { return _end; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_resizing_add(transit, _begin.Width, _begin.Height, _end.Width, _end.Height); + } + } + + /// + /// Rotation effect class. + /// + public class RotationEffect : EffectBase + { + float _begin; + float _end; + + /// + /// Creates and initializes a new instance of RotationEffect class. + /// + /// The begin degree of the effect + /// The end degree of the effect + public RotationEffect(float beginDegree, float endDegree) + { + _begin = beginDegree; + _end = endDegree; + } + + /// + /// The begin degree of the effect + /// + public float BeginDegree + { + get { return _begin; } + } + + /// + /// The end degree of the effect + /// + public float EndDegree + { + get { return _end; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_rotation_add(transit, _begin, _end); + } + } + + /// + /// Translation effect class. + /// + public class TranslationEffect : EffectBase + { + Point _begin; + Point _end; + + /// + /// Creates and initializes a new instance of FlipEffect class. + /// + /// The begin Point of the effect + /// The end Point of the effect + public TranslationEffect(Point beginPoint, Point endPoint) + { + _begin = beginPoint; + _end = endPoint; + } + + /// + /// The begin Point of the effect + /// + public Point BeginPoint + { + get { return _begin; } + } + + /// + /// The end Point of the effect + /// + public Point EndPoint + { + get { return _end; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_translation_add(transit, _begin.X, _begin.Y, _end.X, _end.Y); + } + } + + /// + /// Wipe effect class. + /// + public class WipeEffect : EffectBase + { + WipeType _type; + WipeDirection _direction; + + /// + /// Creates and initializes a new instance of WipeEffect class. + /// + /// Wipe type. Hide or show. + /// Wipe Direction. + public WipeEffect(WipeType type, WipeDirection direction) + { + _type = type; + _direction = direction; + } + + /// + /// Wipe type. Hide or show. + /// + public WipeType Type + { + get { return _type; } + } + + /// + /// Wipe Direction. + /// + public WipeDirection Direction + { + get { return _direction; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_wipe_add(transit, (int)_type, (int)_direction); + } + } + + /// + /// Zoom effect class. + /// + public class ZoomEffect : EffectBase + { + float _begin; + float _end; + + /// + /// Creates and initializes a new instance of ZoomEffect class. + /// + /// The begin rate of the effect + /// The end rate of the effect + public ZoomEffect(float beginRate, float endRate) + { + _begin = beginRate; + _end = endRate; + } + + /// + /// The begin rate of the effect + /// + public float BeginRate + { + get { return _begin; } + } + + /// + /// The end rate of the effect + /// + public float EndRate + { + get { return _end; } + } + + internal override IntPtr CreateEffect(IntPtr transit) + { + return Interop.Elementary.elm_transit_effect_zoom_add(transit, _begin, _end); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Utility.cs b/src/ElmSharp/ElmSharp/Utility.cs new file mode 100644 index 0000000..baff802 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Utility.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace ElmSharp +{ + public static class Utility + { + /// + /// Appends a font path to the list of font paths used by the application. + /// + /// The new font path. + public static void AppendGlobalFontPath(string path) + { + Interop.Evas.evas_font_path_global_append(path); + } + + /// + /// Prepends a font path to the list of font paths used by the application. + /// + /// The new font path. + public static void PrependEvasGlobalFontPath(string path) + { + Interop.Evas.evas_font_path_global_prepend(path); + } + + /// + /// Removes all font paths loaded into memory by evas_font_path_app_* APIs for the application. + /// + public static void ClearEvasGlobalFontPath() + { + Interop.Evas.evas_font_path_global_clear(); + } + + /// + /// Sets Edje color class. + /// + /// Color class + /// Object Red value + /// Object Red value + /// Object Red value + /// Object Red value + /// Outline Red value + /// Outline Green value + /// Outline Blue value + /// Outline Alpha value + /// Shadow Red value + /// Shadow Green value + /// Shadow Bluevalue + /// Shadow Alpha value + /// + public static bool SetEdjeColorClass(string colorClass, int red, int green, int blue, int alpha, int outlineRed, int outlineGreen, int outlineBlue, int outlineAlpha, + int shadowRed, int shadowGreen, int shadowBlue, int shadowAlpha) + { + return Interop.Elementary.edje_color_class_set(colorClass, red, green, blue, alpha, outlineRed, outlineGreen, outlineBlue, outlineAlpha, shadowRed, shadowGreen, shadowBlue, shadowAlpha); + } + + /// + /// Gets Edje color class. + /// + /// Color class + /// Object Red value + /// Object Red value + /// Object Red value + /// Object Red value + /// Outline Red value + /// Outline Green value + /// Outline Blue value + /// Outline Alpha value + /// Shadow Red value + /// Shadow Green value + /// Shadow Bluevalue + /// Shadow Alpha value + /// + public static bool GetEdjeColorClass(string colorClass, out int red, out int green, out int blue, out int alpha, out int outlineRed, out int outlineGreen, out int outlineBlue, + out int outlineAlpha, out int shadowRed, out int shadowGreen, out int shadowBlue, out int shadowAlpha) + { + return Interop.Elementary.edje_color_class_get(colorClass, out red, out green, out blue, out alpha, out outlineRed, out outlineGreen, out outlineBlue, out outlineAlpha, + out shadowRed, out shadowGreen, out shadowBlue, out shadowAlpha); + } + + /// + /// Processes all queued up edje messages. + /// This function triggers the processing of messages addressed to any (alive) edje objects. + /// + public static void ProcessEdjeMessageSignal() + { + Interop.Elementary.edje_message_signal_process(); + } + + /// + /// Sets the Edje text class. + /// + /// The text class name + /// The font name + /// The font size + /// True, on success or false, on error + public static bool SetEdjeTextClass(string textClass, string font, int size) + { + return Interop.Elementary.edje_text_class_set(textClass, font, size); + } + + /// + /// Gets the Edje text class. + /// + /// The text class name + /// The font name + /// The font size + /// True, on success or false, on error + public static bool GetEdjeTextClass(string textClass, out string font, out int size) + { + return Interop.Elementary.edje_text_class_get(textClass, out font, out size); + } + + /// + /// Delete the text class. + /// + /// + public static void DeleteEdjeTextClass(string textClass) + { + Interop.Elementary.edje_text_class_del(textClass); + } + + /// + /// Pre-multiplies a rgb triplet by an alpha factor. + /// + /// The alpha factor + /// The Red component of the color + /// The Green component of the color + /// The Blue component of the color + public static void PremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue) + { + Interop.Evas.evas_color_argb_premul(alpha, ref red, ref green, ref blue); + } + + /// + /// Undoes pre-multiplies a rgb triplet by an alpha factor. + /// + /// The alpha factor + /// The Red component of the color + /// The Green component of the color + /// The Blue component of the color + public static void UnPremulityplyEvasColorByAlpha(int alpha, ref int red, ref int green, ref int blue) + { + Interop.Evas.evas_color_argb_unpremul(alpha, ref red, ref green, ref blue); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Widget.cs b/src/ElmSharp/ElmSharp/Widget.cs new file mode 100755 index 0000000..f1df744 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Widget.cs @@ -0,0 +1,442 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using ElmSharp.Accessible; + +namespace ElmSharp +{ + /// + /// Enumeration for the focus direction. + /// + public enum FocusDirection + { + /// + /// Previous direction + /// + Previous, + + /// + /// Next direction + /// + Next, + + /// + /// Up direction + /// + Up, + + /// + /// Down direction + /// + Down, + + /// + /// Right direction + /// + Right, + + /// + /// Left direction + /// + Left + } + + /// + /// The Widget is abstract class, it is the parent of other widgets. + /// Inherits from . + /// + public abstract class Widget : AccessibleObject + { + Dictionary _partContents = new Dictionary(); + + SmartEvent _focused; + SmartEvent _unfocused; + + internal Color _backgroundColor = Color.Default; + internal int _opacity = Color.Default.A; + + protected Widget() + { + } + + /// + /// Creates and initializes a new instance of the Widget class. + /// + /// The parent of new Widget instance + protected Widget(EvasObject parent) : base(parent) + { + _focused = new SmartEvent(this, "focused"); + _focused.On += (s, e) => Focused?.Invoke(this, EventArgs.Empty); + + _unfocused = new SmartEvent(this, "unfocused"); + _unfocused.On += (s, e) => Unfocused?.Invoke(this, EventArgs.Empty); + } + + /// + /// Update the part contents + /// + /// The content which put to the part + /// The updated part + protected void UpdatePartContents(EvasObject content, string part = "__default__") + { + _partContents[part] = content; + } + + /// + /// Focused will be triggered when the widget is focused. + /// + public event EventHandler Focused; + + /// + /// Unfocused will be triggered when the widget is unfocused. + /// + public event EventHandler Unfocused; + + /// + /// Sets or gets the state of the widget, which might be enabled or disabled. + /// + public bool IsEnabled + { + get + { + return !Interop.Elementary.elm_object_disabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_disabled_set(RealHandle, !value); + } + } + + /// + /// Sets or gets the style of the widget. + /// + public string Style + { + get + { + return Interop.Elementary.elm_object_style_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_style_set(RealHandle, value); + } + } + + /// + /// Gets whether this widget is focused. + /// + public bool IsFocused + { + get + { + return Interop.Elementary.elm_object_focus_get(RealHandle); + } + } + + /// + /// Gets whether a widget is focusable or not. + /// + /// Widgets which are meant to be interacted with by input events are created able to be focused, by default + public bool IsFocusAllowed + { + get + { + return Interop.Elementary.elm_object_focus_allow_get(RealHandle); + } + } + + /// + /// Sets or gets the text of the widget. + /// + /// It could be override by special child class + public virtual string Text + { + get + { + return Interop.Elementary.elm_object_part_text_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_part_text_set(RealHandle, IntPtr.Zero, value); + } + } + + /// + /// Sets or gets the background color of the widget. + /// + /// It could be override by special child class + public virtual Color BackgroundColor + { + get + { + if (!_backgroundColor.IsDefault) + { + _backgroundColor = GetPartColor("bg"); + } + return _backgroundColor; + } + set + { + if (value.IsDefault) + { + Console.WriteLine("Widget instance doesn't support to set BackgroundColor to Color.Default."); + } + else + { + SetPartColor("bg", value); + _backgroundColor = value; + } + } + } + + /// + /// Sets or gets the opacity of the widget. + /// + /// It could be override by special child class + public virtual int Opacity + { + get + { + if (_opacity != Color.Default.A) + { + _opacity = GetPartOpacity("opacity"); + } + return _opacity; + } + set + { + SetPartOpacity("opacity", value); + _opacity = value; + } + } + + /// + /// Sets or gets whether a widget and its children are focusable or not. + /// + public bool AllowTreeFocus + { + get + { + return Interop.Elementary.elm_object_tree_focus_allow_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_tree_focus_allow_set(RealHandle, value); + } + } + + /// + /// Sets or gets the widget's mirrored mode. + /// + public bool IsMirroredMode + { + get + { + return Interop.Elementary.elm_object_mirrored_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_mirrored_set(RealHandle, value); + } + } + + /// + /// Sets or gets the widget's mirrored mode setting. + /// When widget set automatic mode(true), it follows the system mirrored mode. + /// + public bool IsAutoMirroredMode + { + get + { + return Interop.Elementary.elm_object_mirrored_automatic_get(RealHandle); + } + set + { + Interop.Elementary.elm_object_mirrored_automatic_set(RealHandle, value); + } + } + + /// + /// Sets the widget to be focused or not. + /// + /// Weather be focused + public void SetFocus(bool isFocus) + { + Interop.Elementary.elm_object_focus_set(RealHandle, isFocus); + } + + /// + /// Sets the ability for a widget to be focused. + /// + /// True if the object can be focused, false if not(and on errors) + public void AllowFocus(bool isAllowFocus) + { + Interop.Elementary.elm_object_focus_allow_set(RealHandle, isAllowFocus); + } + + /// + /// Gives focus to next widget in widget tree. + /// + /// Direction to move the focus + public void FocusNext(FocusDirection direction) + { + Interop.Elementary.elm_object_focus_next(RealHandle, (int)direction); + } + + /// + /// Set next widget with specific focus direction. + /// + /// Focus next widget + /// Focus direction + public void SetNextFocusObject(EvasObject next, FocusDirection direction) + { + Interop.Elementary.elm_object_focus_next_object_set(RealHandle, next.RealHandle, (int)direction); + } + + /// + /// Sets content to particular part of the widget, and the preserve old content will not be unset. + /// + /// The name of particular part + /// The content + /// + public virtual bool SetPartContent(string part, EvasObject content) + { + return SetPartContent(part, content, false); + } + + /// + /// Sets content to particular part of the widget. + /// + /// The name of particular part + /// The content + /// true, preserve old content will be unset. false, preserve old content will not be unset. + /// + public virtual bool SetPartContent(string part, EvasObject content, bool preserveOldContent) + { + if (preserveOldContent) + { + Interop.Elementary.elm_object_part_content_unset(RealHandle, part); + } + Interop.Elementary.elm_object_part_content_set(RealHandle, part, content); + UpdatePartContents(content, part); + return true; + } + + /// + /// Sets content to the widget, and the preserve old content will not be unset. + /// + /// The content + /// + public void SetContent(EvasObject content) + { + SetContent(content, false); + } + + /// + /// Sets content the widget. + /// + /// The content + /// true, preserve old content will be unset. false, preserve old content will not be unset. + /// + public void SetContent(EvasObject content, bool preserveOldContent) + { + if (preserveOldContent) + { + Interop.Elementary.elm_object_content_unset(RealHandle); + } + + Interop.Elementary.elm_object_content_set(RealHandle, content); + UpdatePartContents(content); + } + + /// + /// Sets text to particular part of the widget. + /// + /// The name of particular part + /// The text + public virtual bool SetPartText(string part, string text) + { + Interop.Elementary.elm_object_part_text_set(RealHandle, part, text); + return true; + } + + /// + /// Gets text of a particular part of the widget. + /// + /// The name of particular part + /// Text of the particular part of the widget + public virtual string GetPartText(string part) + { + return Interop.Elementary.elm_object_part_text_get(RealHandle, part); + } + + /// + /// Sets color of a particular part of the widget. + /// + /// The name of particular part + /// The color be set to widget + /// This method is a virtual method, it could be override by special child class + public virtual void SetPartColor(string part, Color color) + { + Interop.Elementary.elm_object_color_class_color_set(RealHandle, part, color.R * color.A / 255, + color.G * color.A / 255, + color.B * color.A / 255, + color.A); + } + + /// + /// Gets color of the particular part of the widget. + /// + /// The name of particular part + /// The color of the particular part + /// This method is a virtual method, it could be override by special child class + public virtual Color GetPartColor(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_color_class_color_get(RealHandle, part, out r, out g, out b, out a); + return new Color((int)(r / (a / 255.0)), (int)(g / (a / 255.0)), (int)(b / (a / 255.0)), a); + } + + /// + /// Sets opacity of the particular part of the widget. + /// + /// The name of particular part + /// The opacity of the particular part + public void SetPartOpacity(string part, int opacity) + { + Interop.Elementary.elm_object_color_class_color_set(Handle, part, 255, 255, 255, opacity); + } + + /// + /// Gets opacity of the particular part of the widget. + /// + /// The name of particular part + /// Opacity value of the particular part + public int GetPartOpacity(string part) + { + int r, g, b, a; + Interop.Elementary.elm_object_color_class_color_get(Handle, part, out r, out g, out b, out a); + return a; + } + + internal IntPtr GetPartContent(string part) + { + return Interop.Elementary.elm_object_part_content_get(RealHandle, part); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/Window.cs b/src/ElmSharp/ElmSharp/Window.cs new file mode 100644 index 0000000..71d18f5 --- /dev/null +++ b/src/ElmSharp/ElmSharp/Window.cs @@ -0,0 +1,1058 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace ElmSharp +{ + /// + /// Enumeration for the display rotation of window. + /// + [Flags] + public enum DisplayRotation + { + /// + /// Rotation value of window is 0 degree + /// + Degree_0 = 1, + + /// + /// Rotation value of window is 90 degree + /// + Degree_90 = 2, + + /// + /// Rotation value of window is 180 degree + /// + Degree_180 = 4, + + /// + /// Rotation value of window is 270 degree + /// + Degree_270 = 8 + }; + + /// + /// Enumeration for the indicator opacity + /// + public enum StatusBarMode + { + /// + /// Opacifies the status bar + /// + Opaque = 1, + + /// + /// Be translucent the status bar + /// + /// + /// Not supported. + /// + Translucent = 2, + + /// + /// Transparentizes the status bar + /// + Transparent = 3, + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum KeyGrabMode + { + Shared = 256, + Topmost = 512, + Exclusive = 1024, + OverrideExclusive = 2048, + } + + /// + /// Enumeration for the indicator mode. + /// + public enum IndicatorMode + { + /// + /// Unknown indicator state. + /// + Unknown = 0, + + /// + /// Hides the indicator. + /// + Hide, + + /// + /// Shows the indicator. + /// + Show, + }; + + /// + /// Enumeration for the keyboard mode + /// + public enum KeyboardMode + { + /// + /// Unknown keyboard state + /// + Unknown, + + /// + /// Request to deactivate the keyboard + /// + Off, + + /// + /// Enable keyboard with default layout + /// + On, + + /// + /// Alpha (a-z) keyboard layout + /// + Alpha, + + /// + /// Numeric keyboard layout + /// + Numeric, + + /// + /// PIN keyboard layout + /// + Pin, + + /// + /// Phone keyboard layout + /// + PhoneNumber, + + /// + /// Hexadecimal numeric keyboard layout + /// + Hex, + + /// + /// Full (QWERTY) keyboard layout + /// + QWERTY, + + /// + /// Password keyboard layout + /// + Password, + + /// + /// IP keyboard layout + /// + IP, + + /// + /// Host keyboard layout + /// + Host, + + /// + /// File keyboard layout + /// + File, + + /// + /// URL keyboard layout + /// + URL, + + /// + /// Keypad layout + /// + Keypad, + + /// + /// J2ME keyboard layout + /// + J2ME, + }; + + /// + /// Enumeration for the window type + /// + public enum WindowType + { + /// + /// Unknown + /// + Unknown, + + /// + /// A normal window. Indicates a normal, top-level window. Almost every window will be created with this type. + /// + Basic, + + /// + /// Used for simple dialog windows. + /// + Dialog, + + /// + /// For special desktop windows, like a background window holding desktop icons. + /// + Desktop, + + /// + /// The window is used as a dock or panel. Usually would be kept on top of any other window by the Window Manager. + /// + Dock, + + /// + /// The window is used to hold a floating toolbar, or similar. + /// + Toolbar, + + /// + /// Similar to Toolbar. + /// + Menu, + + /// + /// A persistent utility window, like a toolbox or palette. + /// + Utility, + + /// + /// Splash window for a starting up application. + /// + Splash, + + /// + /// The window is a dropdown menu, as when an entry in a menubar is clicked. + /// + DropdownMenu, + + /// + /// Like DropdownMenu, but for the menu triggered by right-clicking an object. + /// + PopupMenu, + + /// + /// The window is a tooltip. A short piece of explanatory text that typically appear after the mouse cursor hovers over an object for a while. + /// + Tooltip, + + /// + /// A notification window, like a warning about battery life or a new E-Mail received. + /// + Notification, + + /// + /// A window holding the contents of a combo box. + /// + Combo, + + /// + /// Used to indicate the window is a representation of an object being dragged across different windows, or even applications. + /// + DragAndDrop, + + /// + /// The window is rendered onto an image buffer. No actual window is created for this type, instead the window and all of its contents will be rendered to an image buffer. + /// This allows to have children window inside a parent one just like any other object would be, and do other things like applying Evas_Map effects to it. + /// + InlinedImage, + + /// + /// The window is rendered onto an image buffer and can be shown other process's plug image object. + /// No actual window is created for this type, instead the window and all of its contents will be rendered to an image buffer and can be shown other process's plug image object. + /// + SocketImage, + + /// + /// This window was created using a pre-existing canvas. The window widget can be deleted, but the canvas must be managed externally. + /// + Fake, + }; + + /// + /// The Window is container that contain the graphical user interface of a program. + /// + public class Window : Widget + { + SmartEvent _deleteRequest; + SmartEvent _rotationChanged; + HashSet _referenceHolder = new HashSet(); + + /// + /// Creates and initializes a new instance of the Window class. + /// + /// Window name. + public Window(string name) : this(null, name) + { + } + + /// + /// Creates and initializes a new instance of the Window class. + /// + /// + /// Parent widget which this widow created on. + /// + /// + /// Window name. + /// + /// + /// Window constructor.show window indicator,set callback + /// When closing the window in any way outside the program control, + /// and set callback when window rotation changed. + /// + public Window(Window parent, string name) : this(parent, name, WindowType.Basic) + { + } + + /// + /// Creates and initializes a new instance of the Window class. + /// + /// + /// Parent widget which this widow created on. + /// + /// + /// Window name. + /// + /// + /// Window type + /// + /// + /// Window constructor.show window indicator,set callback + /// When closing the window in any way outside the program control, + /// and set callback when window rotation changed. + /// + public Window(Window parent, string name, WindowType type) + { + Name = name; + Type = type; + Realize(parent); + IndicatorMode = IndicatorMode.Show; + + _deleteRequest = new SmartEvent(this, "delete,request"); + _rotationChanged = new SmartEvent(this, "wm,rotation,changed"); + _deleteRequest.On += (s, e) => CloseRequested?.Invoke(this, EventArgs.Empty); + _rotationChanged.On += (s, e) => RotationChanged?.Invoke(this, EventArgs.Empty); + } + + protected Window() + { + } + + /// + /// CloseRequested will be triggered when Window close. + /// + public event EventHandler CloseRequested; + + /// + /// RotationChanged will be triggered when Window do rotation. + /// + public event EventHandler RotationChanged; + + /// + /// Sets or gets Window name. + /// + public string Name { get; set; } + + /// + /// Gets the Window type. + /// + public WindowType Type { get; } = WindowType.Basic; + + /// + /// Gets Window size with Size value(w,h) + /// + public Size ScreenSize + { + get + { + int x, y, w, h; + Interop.Elementary.elm_win_screen_size_get(Handle, out x, out y, out w, out h); + return new Size(w, h); + } + } + + /// + /// Gets the screen dpi for the screen that a Window is on. + /// + public Point ScreenDpi + { + get + { + Point point = default(Point); + Interop.Elementary.elm_win_screen_dpi_get(Handle, out point.X, out point.Y); + return point; + } + } + + /// + /// Gets the rotation of the Window.The rotation of the window in degrees (0-360). + /// + public int Rotation + { + get + { + return Interop.Elementary.elm_win_rotation_get(Handle); + } + } + + /// + /// Gets whether window manager supports window rotation or not. + /// + public bool IsRotationSupported + { + get + { + return Interop.Elementary.elm_win_wm_rotation_supported_get(Handle); + } + } + + [Obsolete("Sorry, it's error typo of AvailableRotations, please use AvailableRotations")] + public DisplayRotation AavailableRotations { get; set; } + + /// + /// Sets or gets available rotation degree. + /// + public DisplayRotation AvailableRotations + { + get + { + int[] rotations; + Interop.Elementary.elm_win_wm_rotation_available_rotations_get(Handle, out rotations); + if (rotations == null) + { + return 0; + } + return ConvertToDisplayRotation(rotations); + } + set + { + Interop.Elementary.elm_win_wm_rotation_available_rotations_set(Handle, ConvertDegreeArray(value)); + } + } + + /// + /// Sets or gets whether auto deletion function is enable. + /// + /// + /// If you enable auto deletion, the window is automatically destroyed after the signal is emitted. + /// If auto deletion is disabled, the window is not destroyed and the program has to handle it. + /// + public bool AutoDeletion + { + get + { + return Interop.Elementary.elm_win_autodel_get(Handle); + } + set + { + Interop.Elementary.elm_win_autodel_set(Handle, value); + } + } + + /// + /// Sets or gets the alpha channel state of a window. + /// + /// + /// True if the window alpha channel is enabled, false otherwise. + /// If alpha is true, the alpha channel of the canvas will be enabled possibly making parts of the window completely or partially transparent. + /// + public bool Alpha + { + get + { + return Interop.Elementary.elm_win_alpha_get(Handle); + } + set + { + Interop.Elementary.elm_win_alpha_set(Handle, value); + } + } + + /// + /// Sets or gets the role of the window. + /// + /// + /// The Role will be invalid if a new role is set or if the window is destroyed. + /// + public string Role + { + get + { + return Interop.Elementary.elm_win_role_get(Handle); + } + set + { + Interop.Elementary.elm_win_role_set(Handle, value); + } + } + + /// + /// Sets or gets the mode of status bar. + /// + public StatusBarMode StatusBarMode + { + get + { + return (StatusBarMode)Interop.Elementary.elm_win_indicator_opacity_get(Handle); + } + set + { + Interop.Elementary.elm_win_indicator_opacity_set(Handle, (int)value); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Iconified + { + get + { + return Interop.Elementary.elm_win_iconified_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_iconified_set(RealHandle, value); + } + } + + /// + /// Gets or sets the window's indicator mode. + /// + /// The indicator mode. + public IndicatorMode IndicatorMode + { + get + { + return Interop.Elementary.elm_win_indicator_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_indicator_mode_set(RealHandle, value); + } + } + + /// + /// Gets or sets the aspect ratio of a window. + /// + public double Aspect + { + get + { + return Interop.Elementary.elm_win_aspect_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_aspect_set(RealHandle, value); + } + } + + /// + /// Window's autohide state. + /// + public bool AutoHide + { + get + { + return Interop.Elementary.elm_win_autohide_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_autohide_set(RealHandle, value); + } + } + + /// + /// Get the borderless state of a window. + /// This function requests the Window Manager to not draw any decoration around the window. + /// + public bool Borderless + { + get + { + return Interop.Elementary.elm_win_borderless_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_borderless_set(RealHandle, value); + } + } + + /// + /// Gets or sets the demand attention state of a window. + /// + public bool DemandAttention + { + get + { + return Interop.Elementary.elm_win_demand_attention_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_demand_attention_set(RealHandle, value); + } + } + + /// + /// Gets or sets the floating mode of a window. + /// + public bool FloatingMode + { + get + { + return Interop.Elementary.elm_win_floating_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_floating_mode_set(RealHandle, value); + } + } + + /// + /// Gets or sets the animate status for the focus highlight for this window. + /// This function will enable or disable the animation of focus highlight only for the given window, regardless of the global setting for it. + /// + public bool FocusHighlightAnimation + { + get + { + return Interop.Elementary.elm_win_focus_highlight_animate_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_focus_highlight_animate_set(RealHandle, value); + } + } + + /// + /// Gets or sets the enabled status for the focus highlight in a window. + /// This function will enable or disable the focus highlight only for the given window, regardless of the global setting for it. + /// + public bool FocusHighlightEnabled + { + get + { + return Interop.Elementary.elm_win_focus_highlight_enabled_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_focus_highlight_enabled_set(RealHandle, value); + } + } + + /// + /// Gets or sets the style for the focus highlight on this window. + /// Sets the style to use for theming the highlight of focused objects on the given window.If style is NULL, the default will be used. + /// + public string FocusHighlightStyle + { + get + { + return Interop.Elementary.elm_win_focus_highlight_style_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_focus_highlight_style_set(RealHandle, value); + } + } + + /// + /// Get the keyboard mode of the window. + /// + public KeyboardMode KeyboardMode + { + get + { + return (KeyboardMode)Interop.Elementary.elm_win_keyboard_mode_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_keyboard_mode_set(RealHandle, (int)value); + } + } + + /// + /// Gets or sets the layer of the window. + /// What this means exactly will depend on the underlying engine used. + /// In the case of X11 backed engines, the value in layer has the following meanings + /// less than 3 means that the window will be placed below all others, + /// more than 5 means that the window will be placed above all others, + /// and anything else means that the window will be placed in the default layer. + /// + public override int Layer + { + get + { + return Interop.Elementary.elm_win_layer_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_layer_set(RealHandle, value); + } + } + + /// + /// Gets or sets the maximized state of a window. + /// + public bool Maximized + { + get + { + return Interop.Elementary.elm_win_maximized_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_maximized_set(RealHandle, value); + } + } + + /// + /// Gets or sets the modal state of a window. + /// + public bool Modal + { + get + { + return Interop.Elementary.elm_win_modal_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_modal_set(RealHandle, value); + } + } + + /// + /// Gets or sets the noblank property of a window. + /// This is a way to request the display on which the windowis shown does not blank, screensave or otherwise hide or obscure the window.It is intended for uses such as media playback on a television where a user may not want to be interrupted by an idle screen. + /// The noblank property may have no effect if the window is iconified/minimized or hidden. + /// + public bool NoBlank + { + get + { + return Interop.Elementary.elm_win_noblank_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_noblank_set(RealHandle, value); + } + } + + /// + /// Get the profile of a window. + /// + public string Profile + { + get + { + return Interop.Elementary.elm_win_profile_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_profile_set(RealHandle, value); + } + } + + /// + /// Get the constraints on the maximum width and height of a window relative to the width and height of its screen. + /// When this function returns true, obj will never resize larger than the screen. + /// + public bool ScreenConstrain + { + get + { + return Interop.Elementary.elm_win_screen_constrain_get(RealHandle); + } + set + { + Interop.Elementary.elm_win_screen_constrain_set(RealHandle, value); + } + } + + /// + /// Gets or sets the base size of a window. + /// + public Size BaseSize + { + get + { + int w, h; + Interop.Elementary.elm_win_size_base_get(RealHandle, out w, out h); + return new Size(w, h); + } + set + { + Interop.Elementary.elm_win_size_base_set(RealHandle, value.Width, value.Height); + } + } + + /// + /// Gets or sets the step size of a window. + /// + public Size StepSize + { + get + { + int w, h; + Interop.Elementary.elm_win_size_step_get(RealHandle, out w, out h); + return new Size(w, h); + } + set + { + Interop.Elementary.elm_win_size_step_set(RealHandle, value.Width, value.Height); + } + } + + /// + /// Get the screen position X of a window. + /// + public int ScreenPositionX + { + get + { + int x, y; + Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y); + return x; + } + } + + /// + /// Get the screen position Y of a window. + /// + public int ScreenPositionY + { + get + { + int x, y; + Interop.Elementary.elm_win_screen_position_get(Handle, out x, out y); + return y; + } + } + + /// + /// Gets or sets the title of the window. + /// + public string Title + { + get + { + return Interop.Elementary.elm_win_title_get(Handle); + } + set + { + Interop.Elementary.elm_win_title_set(Handle, value); + } + } + + /// + /// Gets or sets the urgent state of a window. + /// + public bool Urgent + { + get + { + return Interop.Elementary.elm_win_urgent_get(Handle); + } + set + { + Interop.Elementary.elm_win_urgent_set(Handle, value); + } + } + + /// + /// Gets or sets the withdrawn state of a window. + /// + public bool Withdrawn + { + get + { + return Interop.Elementary.elm_win_urgent_get(Handle); + } + set + { + Interop.Elementary.elm_win_urgent_set(Handle, value); + } + } + + /// + /// Create a socket to provide the service for Plug widget. + /// + /// A service name + /// A number (any value, 0 being the common default) to differentiate multiple instances of services with the same name. + /// A boolean that if true, specifies to create a system-wide service all users can connect to, otherwise the service is private to the user id that created the service. + /// + public bool CreateServiceSocket(string name, int number, bool systemWide) + { + return Interop.Elementary.elm_win_socket_listen(RealHandle, name, number, systemWide); + } + + /// + /// Set the rotation of the window. + /// + /// The rotation of the window, in degrees (0-360), counter-clockwise. + /// Resizes the window's contents so that they fit inside the current window geometry. + public void SetRotation(int degree, bool resize) + { + if (resize) + Interop.Elementary.elm_win_rotation_with_resize_set(RealHandle, degree); + else + Interop.Elementary.elm_win_rotation_set(RealHandle, degree); + } + + /// + /// Set the window to be skipped by focus. + /// This sets the window to be skipped by normal input. + /// This means a window manager will be asked to not focus this window as well as omit it from things like the taskbar, pager etc. + /// Call this and enable it on a window BEFORE you show it for the first time, otherwise it may have no effect. + /// Use this for windows that have only output information or might only be interacted with by the mouse or fingers, and never for typing input. + /// Be careful that this may have side-effects like making the window non-accessible in some cases unless the window is specially handled. Use this with care. + /// + public void FocusSkip(bool skip) + { + Interop.Elementary.elm_win_prop_focus_skip_set(Handle, skip); + } + + /// + /// Pull up the window object. + /// Places the window pointed by obj at the top of the stack, so that it's not covered by any other window. + /// + public void PullUp() + { + Interop.Elementary.elm_win_raise(Handle); + } + + /// + /// Bring down the window object. + /// Places the window pointed by obj at the bottom of the stack, so that no other window is covered by it. + /// + public void BringDown() + { + Interop.Elementary.elm_win_lower(Handle); + } + + /// + /// This function sends a request to the Windows Manager to activate the Window. + /// If honored by the WM, the window receives the keyboard focus. + /// + /// + /// This is just a request that a Window Manager may ignore, so calling this function does not ensure + /// in any way that the window is going to be the active one after it. + /// + public void Active() + { + Interop.Elementary.elm_win_activate(Handle); + } + + /// + /// Delete subobj as a resize object of window obj. + /// This function removes the object subobj from the resize objects of the window obj. + /// It will not delete the object itself, which will be left unmanaged and should be deleted by the developer, manually handled or set as child of some other container. + /// + /// Resize object. + public void DeleteResizeObject(EvasObject obj) + { + Interop.Elementary.elm_win_resize_object_del(Handle, obj); + } + + /// + /// Adds obj as a resize object of the Window. + /// + /// + /// Setting an object as a resize object of the window means that the obj child's size and + /// position is controlled by the window directly. That is, the obj is resized to match the window size + /// and should never be moved or resized manually by the developer.In addition, + /// resize objects of the window control the minimum size of it as well as whether it can or cannot be resized by the user. + /// + /// + /// Resize object. + /// + public void AddResizeObject(EvasObject obj) + { + Interop.Elementary.elm_win_resize_object_add(Handle, obj); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void WinKeyGrab(string keyname, KeyGrabMode mode) + { + Interop.Elementary.elm_win_keygrab_set(RealHandle, keyname, 0, 0, 0, mode); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void WinKeyUngrab(string keyname) + { + Interop.Elementary.elm_win_keygrab_unset(RealHandle, keyname, 0, 0); + } + + /// + /// Set the keygrab of the window. + /// + /// keyname string to set keygrab + public void KeyGrabEx(string keyname) + { + Interop.Elementary.eext_win_keygrab_set(RealHandle, keyname); + } + + /// + /// Unset the keygrab of the window. + /// + /// keyname string to unset keygrab + public void KeyUngrabEx(string keyname) + { + Interop.Elementary.eext_win_keygrab_unset(RealHandle, keyname); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + Interop.Elementary.elm_config_accel_preference_set("3d"); + return Interop.Elementary.elm_win_add(parent != null ? parent.Handle : IntPtr.Zero, Name, (int)Type); + } + + internal void AddChild(EvasObject obj) + { + _referenceHolder.Add(obj); + } + + internal void RemoveChild(EvasObject obj) + { + _referenceHolder.Remove(obj); + } + + static int[] ConvertDegreeArray(DisplayRotation value) + { + List rotations = new List(); + if (value.HasFlag(DisplayRotation.Degree_0)) + rotations.Add(0); + if (value.HasFlag(DisplayRotation.Degree_90)) + rotations.Add(90); + if (value.HasFlag(DisplayRotation.Degree_180)) + rotations.Add(180); + if (value.HasFlag(DisplayRotation.Degree_270)) + rotations.Add(270); + return rotations.ToArray(); + } + + static DisplayRotation ConvertToDisplayRotation(int[] values) + { + int orientation = 0; + foreach (int v in values) + { + orientation |= (1 << (v / 90)); + } + return (DisplayRotation)orientation; + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/ElmSharp/WrapType.cs b/src/ElmSharp/ElmSharp/WrapType.cs new file mode 100755 index 0000000..5725790 --- /dev/null +++ b/src/ElmSharp/ElmSharp/WrapType.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace ElmSharp +{ + /// + /// Enumeration for the wrap type. + /// + public enum WrapType + { + /// + /// No wrap. + /// + None = 0, + /// + /// Char wrap - wrap between characters. + /// + Char, + /// + /// Word wrap - wrap within the allowed wrapping points + /// (as defined in the unicode standard). + /// + Word, + /// + /// Mixed wrap - Word wrap, if that fails, char wrap. + /// + Mixed + } +} diff --git a/src/ElmSharp/Interop/Interop.Ecore.cs b/src/ElmSharp/Interop/Interop.Ecore.cs new file mode 100644 index 0000000..99b9ee1 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Ecore.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Ecore + { + internal delegate void EcoreCallback(IntPtr data); + internal delegate bool EcoreTaskCallback(IntPtr data); + internal delegate void EcoreEventCallback(IntPtr data, int type, IntPtr evt); + + [DllImport(Libraries.Ecore)] + internal static extern int ecore_init(); + + [DllImport(Libraries.Ecore)] + internal static extern int ecore_shutdown(); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_main_loop_begin(); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_main_loop_quit(); + + [DllImport(Libraries.Ecore)] + internal static extern bool ecore_main_loop_glib_integrate(); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_idler_add(EcoreTaskCallback callback, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern void ecore_main_loop_thread_safe_call_async(EcoreTaskCallback callback, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_main_loop_thread_safe_call_sync(EcoreTaskCallback callback, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_idler_del(IntPtr idler); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_timer_add(double interval, EcoreTaskCallback callback, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_timer_del(IntPtr timer); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_animator_add(EcoreTaskCallback func, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_animator_del(IntPtr animator); + + [DllImport(Libraries.Ecore)] + internal static extern double ecore_time_get(); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_event_handler_add(int type, EcoreEventCallback func, IntPtr data); + + [DllImport(Libraries.Ecore)] + internal static extern IntPtr ecore_event_handler_del(IntPtr handler); + } +} diff --git a/src/ElmSharp/Interop/Interop.Eext.Event.cs b/src/ElmSharp/Interop/Interop.Eext.Event.cs new file mode 100644 index 0000000..02420dc --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Eext.Event.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + public enum EextCallbackType + { + EEXT_CALLBACK_BACK, // H/W Back Key Event + EEXT_CALLBACK_MORE, // H/W More Key Event + } + internal delegate void EextEventCallback(IntPtr data, IntPtr obj, IntPtr info); + + [DllImport(Libraries.Eext)] + internal static extern void eext_object_event_callback_add(IntPtr obj, EextCallbackType type, EextEventCallback callback, IntPtr data); + + + [DllImport(Libraries.Eext)] + internal static extern void eext_object_event_callback_del(IntPtr obj, EextCallbackType type, EextEventCallback callback); + } +} diff --git a/src/ElmSharp/Interop/Interop.Eext.FloatingButton.cs b/src/ElmSharp/Interop/Interop.Eext.FloatingButton.cs new file mode 100755 index 0000000..7ecef6a --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Eext.FloatingButton.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eext + { + [DllImport(Libraries.Eext)] + internal static extern IntPtr eext_floatingbutton_add(IntPtr parent); + + [DllImport(Libraries.Eext)] + internal static extern int eext_floatingbutton_mode_get(IntPtr floatingButton); + + [DllImport(Libraries.Eext)] + internal static extern void eext_floatingbutton_mode_set(IntPtr floatingButton, int mode); + + [DllImport(Libraries.Eext)] + internal static extern int eext_floatingbutton_pos_get(IntPtr floatingButton); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_floatingbutton_pos_set(IntPtr floatingButton, int position); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_floatingbutton_movement_block_get(IntPtr floatingButton); + + [DllImport(Libraries.Eext)] + internal static extern void eext_floatingbutton_movement_block_set(IntPtr floatingButton, bool block); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_floatingbutton_pos_bring_in(IntPtr floatingButton, int posposition); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Eina.cs b/src/ElmSharp/Interop/Interop.Eina.cs new file mode 100644 index 0000000..1051b52 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Eina.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eina + { + [DllImport(Libraries.Eina)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool eina_main_loop_is(); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Accessibility.cs b/src/ElmSharp/Interop/Interop.Elementary.Accessibility.cs new file mode 100644 index 0000000..fc3bc6b --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Accessibility.cs @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal enum Elm_Atspi_Relation_Type + { + ELM_ATSPI_RELATION_NULL, + ELM_ATSPI_RELATION_LABEL_FOR, + ELM_ATSPI_RELATION_LABELLED_BY, + ELM_ATSPI_RELATION_CONTROLLER_FOR, + ELM_ATSPI_RELATION_CONTROLLED_BY, + ELM_ATSPI_RELATION_MEMBER_OF, + ELM_ATSPI_RELATION_TOOLTIP_FOR, + ELM_ATSPI_RELATION_NODE_CHILD_OF, + ELM_ATSPI_RELATION_NODE_PARENT_OF, + ELM_ATSPI_RELATION_EXTENDED, + ELM_ATSPI_RELATION_FLOWS_TO, + ELM_ATSPI_RELATION_FLOWS_FROM, + ELM_ATSPI_RELATION_SUBWINDOW_OF, + ELM_ATSPI_RELATION_EMBEDS, + ELM_ATSPI_RELATION_EMBEDDED_BY, + ELM_ATSPI_RELATION_POPUP_FOR, + ELM_ATSPI_RELATION_PARENT_WINDOW_OF, + ELM_ATSPI_RELATION_DESCRIPTION_FOR, + ELM_ATSPI_RELATION_DESCRIBED_BY, + ELM_ATSPI_RELATION_LAST_DEFINED, + } + + internal enum Elm_Atspi_Role + { + ELM_ATSPI_ROLE_INVALID, + ELM_ATSPI_ROLE_ACCELERATOR_LABEL, + ELM_ATSPI_ROLE_ALERT, + ELM_ATSPI_ROLE_ANIMATION, + ELM_ATSPI_ROLE_ARROW, + ELM_ATSPI_ROLE_CALENDAR, + ELM_ATSPI_ROLE_CANVAS, + ELM_ATSPI_ROLE_CHECK_BOX, + ELM_ATSPI_ROLE_CHECK_MENU_ITEM, + ELM_ATSPI_ROLE_COLOR_CHOOSER, + ELM_ATSPI_ROLE_COLUMN_HEADER, + ELM_ATSPI_ROLE_COMBO_BOX, + ELM_ATSPI_ROLE_DATE_EDITOR, + ELM_ATSPI_ROLE_DESKTOP_ICON, + ELM_ATSPI_ROLE_DESKTOP_FRAME, + ELM_ATSPI_ROLE_DIAL, + ELM_ATSPI_ROLE_DIALOG, + ELM_ATSPI_ROLE_DIRECTORY_PANE, + ELM_ATSPI_ROLE_DRAWING_AREA, + ELM_ATSPI_ROLE_FILE_CHOOSER, + ELM_ATSPI_ROLE_FILLER, + ELM_ATSPI_ROLE_FOCUS_TRAVERSABLE, + ELM_ATSPI_ROLE_FONT_CHOOSER, + ELM_ATSPI_ROLE_FRAME, + ELM_ATSPI_ROLE_GLASS_PANE, + ELM_ATSPI_ROLE_HTML_CONTAINER, + ELM_ATSPI_ROLE_ICON, + ELM_ATSPI_ROLE_IMAGE, + ELM_ATSPI_ROLE_INTERNAL_FRAME, + ELM_ATSPI_ROLE_LABEL, + ELM_ATSPI_ROLE_LAYERED_PANE, + ELM_ATSPI_ROLE_LIST, + ELM_ATSPI_ROLE_LIST_ITEM, + ELM_ATSPI_ROLE_MENU, + ELM_ATSPI_ROLE_MENU_BAR, + ELM_ATSPI_ROLE_MENU_ITEM, + ELM_ATSPI_ROLE_OPTION_PANE, + ELM_ATSPI_ROLE_PAGE_TAB, + ELM_ATSPI_ROLE_PAGE_TAB_LIST, + ELM_ATSPI_ROLE_PANEL, + ELM_ATSPI_ROLE_PASSWORD_TEXT, + ELM_ATSPI_ROLE_POPUP_MENU, + ELM_ATSPI_ROLE_PROGRESS_BAR, + ELM_ATSPI_ROLE_PUSH_BUTTON, + ELM_ATSPI_ROLE_RADIO_BUTTON, + ELM_ATSPI_ROLE_RADIO_MENU_ITEM, + ELM_ATSPI_ROLE_ROOT_PANE, + ELM_ATSPI_ROLE_ROW_HEADER, + ELM_ATSPI_ROLE_SCROLL_BAR, + ELM_ATSPI_ROLE_SCROLL_PANE, + ELM_ATSPI_ROLE_SEPARATOR, + ELM_ATSPI_ROLE_SLIDER, + ELM_ATSPI_ROLE_SPIN_BUTTON, + ELM_ATSPI_ROLE_SPLIT_PANE, + ELM_ATSPI_ROLE_STATUS_BAR, + ELM_ATSPI_ROLE_TABLE, + ELM_ATSPI_ROLE_TABLE_CELL, + ELM_ATSPI_ROLE_TABLE_COLUMN_HEADER, + ELM_ATSPI_ROLE_TABLE_ROW_HEADER, + ELM_ATSPI_ROLE_TEAROFF_MENU_ITEM, + ELM_ATSPI_ROLE_TERMINAL, + ELM_ATSPI_ROLE_TEXT, + ELM_ATSPI_ROLE_TOGGLE_BUTTON, + ELM_ATSPI_ROLE_TOOL_BAR, + ELM_ATSPI_ROLE_TOOL_TIP, + ELM_ATSPI_ROLE_TREE, + ELM_ATSPI_ROLE_TREE_TABLE, + ELM_ATSPI_ROLE_UNKNOWN, + ELM_ATSPI_ROLE_VIEWPORT, + ELM_ATSPI_ROLE_WINDOW, + ELM_ATSPI_ROLE_EXTENDED, + ELM_ATSPI_ROLE_HEADER, + ELM_ATSPI_ROLE_FOOTER, + ELM_ATSPI_ROLE_PARAGRAPH, + ELM_ATSPI_ROLE_RULER, + ELM_ATSPI_ROLE_APPLICATION, + ELM_ATSPI_ROLE_AUTOCOMPLETE, + ELM_ATSPI_ROLE_EDITBAR, + ELM_ATSPI_ROLE_EMBEDDED, + ELM_ATSPI_ROLE_ENTRY, + ELM_ATSPI_ROLE_CHART, + ELM_ATSPI_ROLE_CAPTION, + ELM_ATSPI_ROLE_DOCUMENT_FRAME, + ELM_ATSPI_ROLE_HEADING, + ELM_ATSPI_ROLE_PAGE, + ELM_ATSPI_ROLE_SECTION, + ELM_ATSPI_ROLE_REDUNDANT_OBJECT, + ELM_ATSPI_ROLE_FORM, + ELM_ATSPI_ROLE_LINK, + ELM_ATSPI_ROLE_INPUT_METHOD_WINDOW, + ELM_ATSPI_ROLE_TABLE_ROW, + ELM_ATSPI_ROLE_TREE_ITEM, + ELM_ATSPI_ROLE_DOCUMENT_SPREADSHEET, + ELM_ATSPI_ROLE_DOCUMENT_PRESENTATION, + ELM_ATSPI_ROLE_DOCUMENT_TEXT, + ELM_ATSPI_ROLE_DOCUMENT_WEB, + ELM_ATSPI_ROLE_DOCUMENT_EMAIL, + ELM_ATSPI_ROLE_COMMENT, + ELM_ATSPI_ROLE_LIST_BOX, + ELM_ATSPI_ROLE_GROUPING, + ELM_ATSPI_ROLE_IMAGE_MAP, + ELM_ATSPI_ROLE_NOTIFICATION, + ELM_ATSPI_ROLE_INFO_BAR + } + + [Flags] + internal enum Elm_Accessible_Reading_Info_Type + { + ELM_ACCESSIBLE_READING_INFO_TYPE_NAME = 0x1, + ELM_ACCESSIBLE_READING_INFO_TYPE_ROLE = 0x2, + ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION = 0x4, + ELM_ACCESSIBLE_READING_INFO_TYPE_STATE = 0x8 + } + + internal delegate void Elm_Atspi_Say_Signal_Cb(IntPtr data, string say_signal); + internal delegate string Elm_Atspi_Reading_Info_Cb(IntPtr data, IntPtr obj); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_atspi_accessible_relationship_append(IntPtr obj, Elm_Atspi_Relation_Type type, IntPtr relationObj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_relationship_remove(IntPtr obj, Elm_Atspi_Relation_Type type, IntPtr relationObj); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_atspi_accessible_relationship_append(IntPtr obj, int type, IntPtr relationObj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_relationship_remove(IntPtr obj, int type, IntPtr relationObj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_atspi_accessible_translation_domain_get")] + internal static extern IntPtr _elm_atspi_accessible_translation_domain_get(IntPtr obj); + + internal static string elm_atspi_accessible_translation_domain_get(IntPtr obj) + { + var str = _elm_atspi_accessible_translation_domain_get(obj); + return Marshal.PtrToStringAnsi(str); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_translation_domain_set(IntPtr obj, string domain); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_name_set(IntPtr obj, string name); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_atspi_accessible_name_get")] + internal static extern IntPtr _elm_atspi_accessible_name_get(IntPtr obj); + + internal static string elm_atspi_accessible_name_get(IntPtr obj) + { + var str = _elm_atspi_accessible_name_get(obj); + return Marshal.PtrToStringAnsi(str); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_name_cb_set(IntPtr obj, Elm_Atspi_Reading_Info_Cb name_cb, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_Atspi_Role elm_atspi_accessible_role_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_role_set(IntPtr obj, Elm_Atspi_Role role); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_description_set(IntPtr obj, string description); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_atspi_accessible_description_get")] + internal static extern IntPtr _elm_atspi_accessible_description_get(IntPtr obj); + internal static string elm_atspi_accessible_description_get(IntPtr obj) + { + var str = _elm_atspi_accessible_description_get(obj); + return Marshal.PtrToStringAnsi(str); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_description_cb_set(IntPtr obj, Elm_Atspi_Reading_Info_Cb description_cb, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_reading_info_type_set(IntPtr obj, Elm_Accessible_Reading_Info_Type reading_info); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_atspi_accessible_reading_info_type_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_accessible_can_highlight_set(IntPtr obj, bool can_highlight); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_atspi_accessible_can_highlight_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_atspi_component_highlight_grab(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_atspi_component_highlight_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_atspi_bridge_utils_say(string text, bool discardable, Elm_Atspi_Say_Signal_Cb func, IntPtr data); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Bg.cs b/src/ElmSharp/Interop/Interop.Elementary.Bg.cs new file mode 100644 index 0000000..2f6f732 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Bg.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + public enum BackgroundOptions + { + Center, Scale, Stretch, Tile + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_bg_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_bg_color_set(IntPtr obj, int r, int g, int b); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_bg_color_get(IntPtr obj, out int r, out int g, out int b); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_bg_file_set(IntPtr obj, string file, IntPtr group); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_bg_file_get(IntPtr obj, out IntPtr file, IntPtr group); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_bg_option_set(IntPtr obj, BackgroundOptions option); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_bg_load_size_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern BackgroundOptions elm_bg_option_get(IntPtr obj); + + internal static string BackgroundFileGet(IntPtr obj) + { + IntPtr file = IntPtr.Zero; + elm_bg_file_get(obj, out file, IntPtr.Zero); + return Marshal.PtrToStringAnsi(file); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Box.cs b/src/ElmSharp/Interop/Interop.Elementary.Box.cs new file mode 100644 index 0000000..cb104a6 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Box.cs @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + public delegate void BoxLayoutCallback(IntPtr obj, IntPtr priv, IntPtr userData); + + public delegate void BoxDataFreeCallback(IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_box_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_box_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_pack_start(IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_pack_end(IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_pack_before(IntPtr obj, IntPtr subobj, IntPtr before); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_pack_after(IntPtr obj, IntPtr subobj, IntPtr after); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_unpack(IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_unpack_all(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_align_set(IntPtr obj, double horizontal, double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_align_get(IntPtr obj, out double horizontal, out double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_align_get(IntPtr obj, IntPtr horizontal, out double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_align_get(IntPtr obj, out double horizontal, IntPtr vertical); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_box_children_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_padding_set(IntPtr obj, int horizontal, int vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_padding_get(IntPtr obj, out int horizontal, out int vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_layout_set(IntPtr obj, BoxLayoutCallback cb, IntPtr data, BoxDataFreeCallback dataFreeCb); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_layout_set(IntPtr obj, BoxLayoutCallback cb, IntPtr data, IntPtr dataFreeCb); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_box_homogeneous_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_homogeneous_set(IntPtr obj, bool ishomogeneous); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_box_recalculate(IntPtr obj); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Button.cs b/src/ElmSharp/Interop/Interop.Elementary.Button.cs new file mode 100644 index 0000000..5d5279f --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Button.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_button_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_button_autorepeat_initial_timeout_set(IntPtr obj, double t); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_button_autorepeat_initial_timeout_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_button_autorepeat_gap_timeout_set(IntPtr obj, double t); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_button_autorepeat_gap_timeout_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_button_autorepeat_set(IntPtr obj, bool on); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_button_autorepeat_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_radio_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_radio_group_add(IntPtr obj, IntPtr group); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_radio_state_value_set(IntPtr obj, int value); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_radio_state_value_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_radio_value_set(IntPtr obj, int value); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_radio_value_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_radio_selected_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_check_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_check_state_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_check_state_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_check_state_pointer_set(IntPtr obj, bool value); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.CalendarView.cs b/src/ElmSharp/Interop/Interop.Elementary.CalendarView.cs new file mode 100644 index 0000000..6885035 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.CalendarView.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal enum Elm_Calendar_Mark_Repeat_Type + { + ELM_CALENDAR_UNIQUE = 0, /* Default value. Marks will be displayed only on event day. */ + ELM_CALENDAR_DAILY, /* Marks will be displayed every day after event day (inclusive). */ + ELM_CALENDAR_WEEKLY, /* Marks will be displayed every week after event day (inclusive) */ + ELM_CALENDAR_MONTHLY, /* Marks will be displayed every month day that coincides to event day. */ + ELM_CALENDAR_ANNUALLY, /* Marks will be displayed every year that coincides to event day (and month). */ + LM_CALENDAR_LAST_DAY_OF_MONTH /* Marks will be displayed every last day of month after event day (inclusive). */ + }; + + internal enum Elm_Calendar_Select_Mode + { + ELM_CALENDAR_SELECT_MODE_DEFAULT = 0, /* Default value. a day is always selected. */ + ELM_CALENDAR_SELECT_MODE_ALWAYS, /* a day is always selected. */ + ELM_CALENDAR_SELECT_MODE_NONE, /* None of the days can be selected. */ + ELM_CALENDAR_SELECT_MODE_ONDEMAND /* User may have selected a day or not. */ + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_calendar_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_calendar_weekdays_names_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_weekdays_names_set(IntPtr obj, string[] weekdays); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_min_max_year_set(IntPtr obj, int min, int max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_min_max_year_get(IntPtr obj, out int min, out int max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_selected_time_set(IntPtr obj, ref Libc.SystemTime selectedtime); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_selected_time_get(IntPtr obj, ref Libc.SystemTime selectedtime); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_first_day_of_week_set(IntPtr obj, int day); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_calendar_first_day_of_week_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_selectable_set(IntPtr obj, int SelectedField); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_calendar_selectable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_calendar_displayed_time_get(IntPtr obj, out Libc.SystemTime displayedtime); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_interval_set(IntPtr obj, double interval); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_calendar_interval_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_select_mode_set(IntPtr obj, Elm_Calendar_Select_Mode mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_calendar_select_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_calendar_mark_add(IntPtr obj, string type, ref Libc.SystemTime date, Elm_Calendar_Mark_Repeat_Type repeatType); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_mark_del(IntPtr markItem); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_marks_draw(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_marks_clear(IntPtr obj); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate string Elm_Calendar_Format_Cb(Libc.SystemTime date); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_calendar_format_function_set(IntPtr obj, Elm_Calendar_Format_Cb format_function); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs b/src/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs new file mode 100755 index 0000000..231fc9d --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.ColorPicker.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + + internal enum Elm_Colorselector_Mode + { + ELM_COLORSELECTOR_PALETTE = 0, /* Only color palette is displayed. */ + ELM_COLORSELECTOR_COMPONENTS, /* Only color selector is displayed. */ + ELM_COLORSELECTOR_BOTH, /* Both Palette and selector is displayed, default.*/ + ELM_COLORSELECTOR_PICKER, /* Only color picker is displayed. */ + ELM_COLORSELECTOR_ALL /* All possible color selector is displayed. */ + }; + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_colorselector_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_color_get(IntPtr obj, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_palette_name_set(IntPtr obj, string name); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_colorselector_palette_name_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_colorselector_palette_name_get(IntPtr obj); + internal static string elm_colorselector_palette_name_get(IntPtr obj) + { + var text = _elm_colorselector_palette_name_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_mode_set(IntPtr obj, Elm_Colorselector_Mode mode); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_Colorselector_Mode elm_colorselector_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_colorselector_palette_color_add(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_palette_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_colorselector_palette_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_palette_item_color_get(IntPtr obj, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_palette_item_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_colorselector_palette_item_selected_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_colorselector_palette_item_selected_set(IntPtr obj, bool selected); + + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.CtxPopup.cs b/src/ElmSharp/Interop/Interop.Elementary.CtxPopup.cs new file mode 100644 index 0000000..e2db4ba --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.CtxPopup.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_ctxpopup_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_ctxpopup_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_ctxpopup_auto_hide_disabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_auto_hide_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_ctxpopup_hover_parent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_hover_parent_set(IntPtr obj, IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_ctxpopup_direction_available_get(IntPtr obj, int direction); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_direction_priority_set(IntPtr obj, int first, int second, int third, int fourth); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_direction_priority_get(IntPtr obj, out int first, out int second, out int third, out int fourth); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_ctxpopup_direction_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_dismiss(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_ctxpopup_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_ctxpopup_item_append(IntPtr obj, string label, IntPtr icon, Evas.SmartCallback func, IntPtr data); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs b/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs new file mode 100644 index 0000000..e65b9ef --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.DateTimePicker.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_datetime_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_set(IntPtr obj, ref Libc.SystemTime newtime); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_get(IntPtr obj, ref Libc.SystemTime currtime); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_format_set(IntPtr obj, string format); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr _elm_datetime_format_get(IntPtr obj); + + internal static string elm_datetime_format_get(IntPtr obj) + { + var format = _elm_datetime_format_get(obj); + return Marshal.PtrToStringAnsi(format); + } + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_max_set(IntPtr obj, ref Libc.SystemTime maxtime); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_max_get(IntPtr obj, ref Libc.SystemTime maxtime); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_min_set(IntPtr obj, ref Libc.SystemTime mintime); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_value_min_get(IntPtr obj, ref Libc.SystemTime mintime); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_datetime_field_limit_set(IntPtr obj, int type, int min, int max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_datetime_field_limit_get(IntPtr obj, int type, out int min, out int max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_datetime_field_visible_set(IntPtr obj, int type, bool visible); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_datetime_field_visible_get(IntPtr obj, int type); + + internal enum DateTimeFieldType + { + Year, + Month, + Date, + Hour, + Minute, + AmPm + } + } +} + diff --git a/src/ElmSharp/Interop/Interop.Elementary.Entry.cs b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs new file mode 100644 index 0000000..b858d5a --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Entry.cs @@ -0,0 +1,401 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + /// + /// Types of "Enter" keys available for different keyboards layout + /// + public enum ReturnKeyType + { + Default, + Done, + Go, + Join, + Login, + Next, + Search, + Send, + Signin + } + + public enum InputPanelLayout + { + Normal, + Number, + Email, + Url, + PhoneNumber, + Ip, + Month, + NumberOnly, + Invalid, + Hex, + Terminal, + Password, + DateTime, + Emoticon + } + + internal enum WrapType + { + None, + Char, + Word, + Mixed, + } + + internal enum AutocapitalType + { + None, + Word, + Sentence, + AllCharacter, + } + + internal enum InputHints + { + None, + AutoComplete, + SensitiveData, + } + + internal enum InputPanelLanguage + { + Automatic, + Alphabet, + } + + internal enum CopyAndPasteMode + { + Markup, + NoImage, + PlainText + } + + internal enum TextFormat + { + PlainUtf8, + MarkupUtf8 + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_entry_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_editable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_editable_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_single_line_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_single_line_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_entry_entry_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_entry_entry_get(IntPtr obj); + + internal static string elm_entry_entry_get(IntPtr obj) + { + var text = _elm_entry_entry_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_entry_set(IntPtr obj, string value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_entry_append(IntPtr obj, string value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_entry_insert(IntPtr obj, string value); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_get(IntPtr obj, out string file, out TextFormat format); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_set(IntPtr obj, string file, TextFormat format); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_file_save(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_password_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_password_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_is_empty(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_next(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_prev(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_up(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_down(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_begin_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_end_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_cursor_content_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_line_begin_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_line_end_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_entry_cursor_pos_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_pos_set(IntPtr obj, int pos); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_geometry_get(IntPtr obj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_is_format_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_cursor_is_visible_format_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_selection_begin(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cursor_selection_end(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_markup_to_utf8(IntPtr text); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_markup_to_utf8(string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_show(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_enabled_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_input_panel_enabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_return_key_type_set(IntPtr obj, ReturnKeyType keyType); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_layout_set(IntPtr obj, InputPanelLayout layout); + + [DllImport(Libraries.Elementary)] + internal static extern InputPanelLayout elm_entry_input_panel_layout_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_select_all(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_select_none(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_text_style_user_pop(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_text_style_user_push(IntPtr obj, string style); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_entry_text_style_user_peek", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_entry_text_style_user_peek(IntPtr obj); + + internal static string elm_entry_text_style_user_peek(IntPtr obj) + { + var text = _elm_entry_text_style_user_peek(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_scrollable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_scrollable_set(IntPtr obj, bool scroll); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_hide(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_imdata_set(IntPtr obj, IntPtr data, int len); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_entry_input_panel_layout_variation_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_layout_variation_set(IntPtr obj, int variation); + + [DllImport(Libraries.Elementary)] + internal static extern WrapType elm_entry_line_wrap_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_line_wrap_set(IntPtr obj, WrapType wrap); + + [DllImport(Libraries.Elementary)] + internal static extern AutocapitalType elm_entry_autocapital_type_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_autocapital_type_set(IntPtr obj, AutocapitalType autoCapitalType); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_autosave_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_autosave_set(IntPtr obj, bool autosave); + + [DllImport(Libraries.Elementary)] + internal static extern CopyAndPasteMode elm_entry_cnp_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_cnp_mode_set(IntPtr obj, CopyAndPasteMode mode); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_calc_force(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_entry_imf_context_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern InputHints elm_entry_input_hint_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_hint_set(IntPtr obj, InputHints hints); + + [DllImport(Libraries.Elementary)] + internal static extern InputPanelLanguage elm_entry_input_panel_language_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_language_set(IntPtr obj, InputPanelLanguage lang); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_input_panel_return_key_disabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_return_key_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_return_key_autoenabled_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_input_panel_show_on_demand_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_input_panel_show_on_demand_set(IntPtr obj, bool onDemand); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_markup_filter_append(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_markup_filter_prepend(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_markup_filter_remove(IntPtr obj, Elm_Entry_Filter_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_entry_prediction_allow_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_prediction_allow_set(IntPtr obj, bool prediction); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_select_allow_set(IntPtr obj, bool allow); + + [DllImport(Libraries.Elementary)] + internal static extern string elm_entry_utf8_to_markup(string str); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Elm_Entry_Filter_Cb(IntPtr data, IntPtr obj, ref IntPtr text); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_entry_anchor_hover_parent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_parent_set(IntPtr obj, IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_end(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_entry_anchor_hover_style_get")] + internal static extern IntPtr _elm_entry_anchor_hover_style_get(IntPtr obj); + + internal static string elm_entry_anchor_hover_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_entry_anchor_hover_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_anchor_hover_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_icon_visible_set(IntPtr obj, bool setting); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate IntPtr Elm_Entry_Item_Provider_Cb(IntPtr data, IntPtr entry, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_append(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_prepend(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_item_provider_remove(IntPtr obj, Elm_Entry_Item_Provider_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_copy(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_cut(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_paste(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_selection_handler_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_entry_selection_get")] + internal static extern IntPtr _elm_entry_selection_get(IntPtr obj); + + internal static string elm_entry_selection_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_entry_selection_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_entry_select_region_set(IntPtr obj, int start, int end); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs b/src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs new file mode 100644 index 0000000..9768571 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.FlipSelector.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_flipselector_first_interval_get(IntPtr flipSelector); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_flipselector_first_interval_set(IntPtr flipSelector, double interval); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_item_append(IntPtr flipSelector, string text, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_item_prepend(IntPtr flipSelector, string text, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_flipselector_flip_next(IntPtr flipSelector); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_flipselector_flip_prev(IntPtr flipSelector); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_selected_item_get(IntPtr flipSelector); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_first_item_get(IntPtr flipSelector); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_flipselector_last_item_get(IntPtr flipSelector); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.GenGridView.cs b/src/ElmSharp/Interop/Interop.Elementary.GenGridView.cs new file mode 100644 index 0000000..b9acd01 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.GenGridView.cs @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_align_set(IntPtr obj, double align_x, double align_y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_align_get(IntPtr obj, out double align_x, out double align_y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_align_get(IntPtr obj, IntPtr align_x, out double align_y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_align_get(IntPtr obj, out double align_x, IntPtr align_y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_multi_select_set(IntPtr obj, bool multi); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_multi_select_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_append(IntPtr obj, IntPtr itc, IntPtr data, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_prepend(IntPtr obj, IntPtr itc, IntPtr data, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_insert_before(IntPtr obj, IntPtr itc, IntPtr data, IntPtr before, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_insert_after(IntPtr obj, IntPtr itc, IntPtr data, IntPtr after, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_class_new(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_size_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_size_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_size_get(IntPtr obj, IntPtr w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_size_get(IntPtr obj, out int w, IntPtr h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_filled_set(IntPtr obj, bool fill); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_filled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gengrid_item_index_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_selected_set(IntPtr obj, bool selected); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_item_selected_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern uint elm_gengrid_items_count(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_highlight_mode_set(IntPtr obj, bool highlight); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_highlight_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_show(IntPtr obj, int type); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_bring_in(IntPtr obj, int type); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_select_mode_set(IntPtr it, Elm_Object_Select_Mode mode); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_Object_Select_Mode elm_gengrid_item_select_mode_get(IntPtr it); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_select_mode_set(IntPtr it, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gengrid_select_mode_get(IntPtr it); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_realized_items_update(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_update(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_at_xy_item_get(IntPtr obj, int x, int y, out int xposret, out int yposret); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_first_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_class_free(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_last_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_gengrid_item_cursor_get")] + internal static extern IntPtr _elm_gengrid_item_cursor_get(IntPtr obj); + + internal static string elm_gengrid_item_cursor_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_gengrid_item_cursor_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_cursor_set(IntPtr obj, string cursor); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_cursor_unset(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_gengrid_item_cursor_style_get")] + internal static extern IntPtr _elm_gengrid_item_cursor_style_get(IntPtr obj); + + internal static string elm_gengrid_item_cursor_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_gengrid_item_cursor_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_cursor_style_set(IntPtr obj, string cursor); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_item_cursor_engine_only_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_cursor_engine_only_set(IntPtr obj, bool engine); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_tooltip_text_set(IntPtr obj, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_tooltip_unset(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_gengrid_item_tooltip_style_get")] + internal static extern IntPtr _elm_gengrid_item_tooltip_style_get(IntPtr obj); + + internal static string elm_gengrid_item_tooltip_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_gengrid_item_tooltip_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_tooltip_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gengrid_reorder_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_reorder_mode_set(IntPtr obj, bool mode); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_pos_get(IntPtr obj, out int row, out int column); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gengrid_item_sorted_insert(IntPtr obj, IntPtr itc, IntPtr data, Eina_Compare_Cb compare, Evas.SmartCallback func, IntPtr funcData); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gengrid_item_tooltip_content_cb_set(IntPtr obj, Elm_Tooltip_Item_Content_Cb func, IntPtr funcData, Evas.SmartCallback deleteFunc); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.GenListView.cs b/src/ElmSharp/Interop/Interop.Elementary.GenListView.cs new file mode 100644 index 0000000..bfb326f --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.GenListView.cs @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal enum Elm_Genlist_Item_Scrollto_Type + { + ELM_GENLIST_ITEM_SCROLLTO_NONE = 0, + + // Scrolls to nowhere + ELM_GENLIST_ITEM_SCROLLTO_IN = (1 << 0), + + // Scrolls to the nearest viewport + ELM_GENLIST_ITEM_SCROLLTO_TOP = (1 << 1), + + // Scrolls to the top of the viewport + ELM_GENLIST_ITEM_SCROLLTO_MIDDLE = (1 << 2), + + // Scrolls to the middle of the viewport + ELM_GENLIST_ITEM_SCROLLTO_BOTTOM = (1 << 3) + + // Scrolls to the bottom of the viewport + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Evas_Smart_Cb(IntPtr data, IntPtr obj, IntPtr eventInfo); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_mode_set(IntPtr obj, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_select_mode_set(IntPtr obj, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_select_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_append(IntPtr obj, IntPtr itc, IntPtr data, IntPtr parent, int type, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_prepend(IntPtr obj, IntPtr itc, IntPtr data, IntPtr parent, int type, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_insert_before(IntPtr obj, IntPtr itc, IntPtr data, IntPtr parent, IntPtr before, int type, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_class_new(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_class_free(IntPtr itemClass); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_block_count_set(IntPtr obj, int count); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_block_count_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_homogeneous_set(IntPtr obj, bool homogeneous); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_homogeneous_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_item_index_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_item_type_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_parent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_realized_items_update(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_update(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_show(IntPtr item, Elm_Genlist_Item_Scrollto_Type type); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_bring_in(IntPtr item, Elm_Genlist_Item_Scrollto_Type type); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_items_count(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_first_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_last_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_next_get(IntPtr item); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_prev_get(IntPtr item); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_item_selected_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_selected_set(IntPtr obj, bool selected); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_select_mode_set(IntPtr obj, Elm_Object_Select_Mode mode); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_Object_Select_Mode elm_genlist_item_select_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_item_class_update(IntPtr obj, IntPtr itc); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_fields_update(IntPtr item, string part, uint type); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_reorder_mode_set(IntPtr obj, bool mode); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_genlist_reorder_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern void elm_genlist_item_expanded_set(IntPtr obj, bool isExpanded); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_genlist_item_expanded_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_highlight_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_highlight_mode_set(IntPtr obj, bool highlight); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_at_xy_item_get(IntPtr obj, int x, int y, out int posret); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_insert_after(IntPtr obj, IntPtr itc, IntPtr data, IntPtr parent, IntPtr after, int type, Evas.SmartCallback func, IntPtr func_data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_item_class_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_genlist_longpress_timeout_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_longpress_timeout_set(IntPtr obj, double timeout); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_multi_select_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_multi_select_set(IntPtr obj, bool multi); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_nth_item_get(IntPtr obj, int nth); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_genlist_item_cursor_get")] + internal static extern IntPtr _elm_genlist_item_cursor_get(IntPtr obj); + + internal static string elm_genlist_item_cursor_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_genlist_item_cursor_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_cursor_set(IntPtr obj, string cursor); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_cursor_unset(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_item_cursor_engine_only_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_cursor_engine_only_set(IntPtr obj, bool engineOnly); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_genlist_item_cursor_style_get")] + internal static extern IntPtr _elm_genlist_item_cursor_style_get(IntPtr obj); + + internal static string elm_genlist_item_cursor_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_genlist_item_cursor_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_cursor_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_demote(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_genlist_item_expanded_depth_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_subitems_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_tooltip_text_set(IntPtr obj, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_tooltip_unset(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_genlist_item_tooltip_style_get")] + internal static extern IntPtr _elm_genlist_item_tooltip_style_get(IntPtr obj); + + internal static string elm_genlist_item_tooltip_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_genlist_item_tooltip_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_tooltip_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_item_tooltip_window_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_genlist_item_tooltip_window_mode_set(IntPtr obj, bool disable); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_genlist_item_sorted_insert(IntPtr obj, IntPtr itc, IntPtr data, IntPtr parent, int type, Eina_Compare_Cb compare, Evas.SmartCallback func, IntPtr funcData); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_genlist_item_tooltip_content_cb_set(IntPtr obj, Elm_Tooltip_Item_Content_Cb func, IntPtr funcData, Evas.SmartCallback deleteFunc); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.GestureLayer.cs b/src/ElmSharp/Interop/Interop.Elementary.GestureLayer.cs new file mode 100644 index 0000000..369eba1 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.GestureLayer.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + public delegate void GestureEventCallback(IntPtr data, IntPtr event_info); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_gesture_layer_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gesture_layer_attach(IntPtr obj, IntPtr target); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_zoom_step_set(IntPtr obj, double step); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_zoom_step_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_tap_finger_size_set(IntPtr obj, int sz); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gesture_layer_tap_finger_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_hold_events_set(IntPtr obj, bool hold_events); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gesture_layer_hold_events_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_rotate_step_set(IntPtr obj, double step); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_rotate_step_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_cb_set(IntPtr obj, ElmSharp.GestureLayer.GestureType idx, ElmSharp.GestureLayer.GestureState cb_type, GestureEventCallback cb, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_line_min_length_set(IntPtr obj, int line_min_length); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gesture_layer_line_min_length_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_zoom_distance_tolerance_set(IntPtr obj, int zoom_distance_tolerance); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gesture_layer_zoom_distance_tolerance_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_line_distance_tolerance_set(IntPtr obj, int line_distance_tolerance); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_gesture_layer_line_distance_tolerance_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_line_angular_tolerance_set(IntPtr obj, double line_angular_tolerance); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_line_angular_tolerance_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_zoom_wheel_factor_set(IntPtr obj, double zoom_wheel_factor); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_zoom_wheel_factor_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_zoom_finger_factor_set (IntPtr obj, double zoom_finger_factor); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_zoom_finger_factor_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_rotate_angular_tolerance_set (IntPtr obj, double rotate_angular_tolerance); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_rotate_angular_tolerance_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_flick_time_limit_ms_set (IntPtr obj, UInt32 flick_time_limit_ms); + + [DllImport(Libraries.Elementary)] + internal static extern UInt32 elm_gesture_layer_flick_time_limit_ms_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_long_tap_start_timeout_set(IntPtr obj, double long_tap_start_timeout); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_long_tap_start_timeout_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_continues_enable_set(IntPtr obj, bool continues_enable); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_gesture_layer_continues_enable_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_gesture_layer_double_tap_timeout_set (IntPtr obj, double double_tap_timeout); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_gesture_layer_double_tap_timeout_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_config_glayer_long_tap_start_timeout_get (); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_glayer_long_tap_start_timeout_set(double long_tap_timeout); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_config_glayer_double_tap_timeout_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_glayer_double_tap_timeout_set(double double_tap_timeout); + } +} + diff --git a/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs b/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs new file mode 100755 index 0000000..ca8cefe --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Hoversel.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_hoversel_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_hoversel_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_hover_parent_set(IntPtr obj, IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_hoversel_hover_parent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_hoversel_expanded_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_auto_update_set(IntPtr obj, bool auto_update); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_hoversel_auto_update_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_hover_begin(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_hover_end(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_hoversel_item_add(IntPtr obj, string label, string icon_file, int icon_type, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_item_icon_set(IntPtr obj, string icon_file, string icon_group, int icon_type); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_hoversel_item_icon_get(IntPtr obj, out string icon_file, out string icon_group, int icon_type); + } +} + diff --git a/src/ElmSharp/Interop/Interop.Elementary.Image.cs b/src/ElmSharp/Interop/Interop.Elementary.Image.cs new file mode 100644 index 0000000..c49ff92 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Image.cs @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_image_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_async_open_set(IntPtr obj, bool async); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_image_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_image_object_size_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_preload_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_file_set(IntPtr obj, string file, string group); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_image_file_get")] + internal static extern void _elm_image_file_get(IntPtr obj, out IntPtr file, out IntPtr group); + internal static string elm_image_file_get(IntPtr obj) + { + IntPtr file; + IntPtr group; + _elm_image_file_get(obj, out file, out group); + return Marshal.PtrToStringAnsi(file); + } + + [DllImport(Libraries.Elementary)] + internal static unsafe extern bool elm_image_memfile_set(IntPtr obj, byte* img, long size, IntPtr format, IntPtr key); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_smooth_set(IntPtr obj, bool smooth); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_smooth_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_resizable_set(IntPtr obj, bool up, bool down); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_resizable_get(IntPtr obj, out bool up, out bool down); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_no_scale_set(IntPtr obj, bool no_scale); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_no_scale_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_aspect_fixed_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_aspect_fixed_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_fill_outside_set(IntPtr obj, bool fill_outside); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_fill_outside_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_animated_available_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_animated_set(IntPtr obj, bool anim); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_animated_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_animated_play_set(IntPtr obj, bool play); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_animated_play_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_prescale_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_image_prescale_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_editable_set(IntPtr obj, bool set); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_image_editable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_image_orient_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_image_orient_set(IntPtr obj, int orient); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_icon_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_icon_standard_set(IntPtr obj, string name); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_icon_standard_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_icon_standard_get(IntPtr obj); + internal static string elm_icon_standard_get(IntPtr obj) + { + var text = _elm_icon_standard_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_icon_thumb_set(IntPtr obj, string file, string group); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_icon_order_lookup_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_icon_order_lookup_set(IntPtr obj, int order); + } +} + diff --git a/src/ElmSharp/Interop/Interop.Elementary.Index.cs b/src/ElmSharp/Interop/Interop.Elementary.Index.cs new file mode 100644 index 0000000..f2ecacd --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Index.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal delegate void EventCallback(IntPtr data, IntPtr obj, IntPtr info); + + internal delegate void SmartCallback(IntPtr data, IntPtr obj, IntPtr info); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_index_autohide_disabled_get(IntPtr index); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_autohide_disabled_set(IntPtr index, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_index_horizontal_get(IntPtr index); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_horizontal_set(IntPtr index, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_append(IntPtr index, string text, EventCallback callback, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_prepend(IntPtr index, string text, EventCallback callback, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_selected_item_get(IntPtr index, int level); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_item_selected_set(IntPtr item, bool selected); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_level_go(IntPtr index, int level); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_index_indicator_disabled_get(IntPtr index); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_indicator_disabled_set(IntPtr index, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_index_omit_enabled_get(IntPtr index); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_omit_enabled_set(IntPtr index, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_insert_before(IntPtr obj, IntPtr before, string letter, EventCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_sorted_insert(IntPtr obj, string letter, Evas_Smart_Cb func, IntPtr data, Eina_Compare_Cb cmpFunc, Eina_Compare_Cb cmpDataFunc); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_delay_change_time_set(IntPtr obj, double time); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_index_delay_change_time_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_item_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_find(IntPtr obj, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_index_item_insert_after(IntPtr obj, IntPtr after, string letter, SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_index_item_level_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_item_level_set(IntPtr obj, int level); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_index_standard_priority_set(IntPtr obj, int priority); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_index_standard_priority_get(IntPtr obj); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Item.cs b/src/ElmSharp/Interop/Interop.Elementary.Item.cs new file mode 100644 index 0000000..0d516ec --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Item.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_part_content_set(IntPtr obj, string part, IntPtr content); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_part_content_unset(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_part_content_set(IntPtr obj, IntPtr part, IntPtr content); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_object_item_part_text_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_object_item_part_text_get(IntPtr obj, string part); + + internal static string elm_object_item_part_text_get(IntPtr obj, string part) + { + var text = _elm_object_item_part_text_get(obj, part); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_color_set(IntPtr it, string part, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_color_get(IntPtr obj, string part, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_color_class_del(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_part_text_set(IntPtr obj, string part, string label); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_part_text_set(IntPtr obj, IntPtr part, string label); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_data_get(IntPtr it); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_data_set(IntPtr it, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_del(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_del_cb_set(IntPtr obj, Interop.Evas.SmartCallback callback); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_disabled_set(IntPtr obj, bool disable); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_item_disabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_part_content_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_access_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_access_unregister(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_track(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_untrack(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_widget_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_signal_emit(IntPtr obj, string emission, string source); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_item_signal_callback_add(IntPtr obj, string emission, string source, Elm_Object_Item_Signal_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_item_signal_callback_del(IntPtr obj, string emission, string source, Elm_Object_Item_Signal_Cb func); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool Elm_Object_Item_Signal_Cb(IntPtr data, IntPtr item, string emission, string source); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate IntPtr Elm_Tooltip_Item_Content_Cb(IntPtr data, IntPtr obj, IntPtr tooltip, IntPtr item); + + internal enum Elm_Object_Select_Mode + { + ELM_OBJECT_SELECT_MODE_DEFAULT, + ELM_OBJECT_SELECT_MODE_ALWAYS, + ELM_OBJECT_SELECT_MODE_NONE, + ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Label.cs b/src/ElmSharp/Interop/Interop.Elementary.Label.cs new file mode 100755 index 0000000..bf5c2d5 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Label.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_label_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_slide_mode_set(IntPtr obj, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_label_slide_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_slide_duration_set(IntPtr obj, double duration); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_label_slide_duration_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_slide_speed_set(IntPtr obj, double speed); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_label_slide_speed_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_slide_go(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_line_wrap_set(IntPtr obj, int wrap); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_label_line_wrap_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_wrap_width_set(IntPtr obj, int w); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_label_wrap_width_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_ellipsis_set(IntPtr obj, bool ellipsis); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_label_ellipsis_get(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_label_text_style_user_peek", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_label_text_style_user_peek(IntPtr obj); + internal static string elm_label_text_style_user_peek(IntPtr obj) + { + var text = _elm_label_text_style_user_peek(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_text_style_user_push(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_label_text_style_user_pop(IntPtr obj); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.List.cs b/src/ElmSharp/Interop/Interop.Elementary.List.cs new file mode 100644 index 0000000..40f4059 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.List.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + public enum Elm_List_Mode + { + ELM_LIST_COMPRESS = 0, + ELM_LIST_SCROLL, + ELM_LIST_LIMIT, + ELM_LIST_EXPAND, + ELM_LIST_LAST + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_list_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_list_item_append(IntPtr obj, string label, IntPtr lefticon, IntPtr righticon, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_list_item_prepend(IntPtr obj, string label, IntPtr icon, IntPtr end, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_list_go(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_list_mode_set(IntPtr obj, Elm_List_Mode listMode); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_List_Mode elm_list_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_list_item_selected_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_list_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_list_clear(IntPtr obj); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.MultiButtonEntry.cs b/src/ElmSharp/Interop/Interop.Elementary.MultiButtonEntry.cs new file mode 100644 index 0000000..0fa7ca5 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.MultiButtonEntry.cs @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + public delegate bool MultiButtonEntryItemFilterCallback(IntPtr obj, string label, IntPtr itemData, IntPtr data); + + public delegate string MultiButtonEntryFormatCallback(int count, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_entry_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_multibuttonentry_expanded_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_expanded_set(IntPtr obj, bool expanded); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_multibuttonentry_editable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_editable_set(IntPtr obj, bool editable); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_prepend(IntPtr obj, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_append(IntPtr obj, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_insert_before(IntPtr obj, IntPtr before, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_insert_after(IntPtr obj, IntPtr after, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_first_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_last_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_item_selected_set(IntPtr obj, bool selected); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_multibuttonentry_item_selected_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_clear(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_prev_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_multibuttonentry_item_next_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_format_function_set(IntPtr obj, MultiButtonEntryFormatCallback callback, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_item_filter_append(IntPtr obj, MultiButtonEntryItemFilterCallback callback, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_item_filter_prepend(IntPtr obj, MultiButtonEntryItemFilterCallback callback, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_multibuttonentry_item_filter_remove(IntPtr obj, MultiButtonEntryItemFilterCallback callback, IntPtr data); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Naviframe.cs b/src/ElmSharp/Interop/Interop.Elementary.Naviframe.cs new file mode 100644 index 0000000..732ecee --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Naviframe.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_item_pop_cb_set(IntPtr it, Elm_Naviframe_Item_Pop_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_event_enabled_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_prev_btn_auto_pushed_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_naviframe_prev_btn_auto_pushed_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_item_title_enabled_set(IntPtr item, bool enable, bool transition); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_naviframe_item_title_enabled_get(IntPtr item); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_item_push(IntPtr obj, string title, IntPtr prev, IntPtr next, IntPtr content, string style); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_item_pop(IntPtr obj); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool Elm_Naviframe_Item_Pop_Cb(IntPtr data, IntPtr item); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_content_preserve_on_pop_set(IntPtr obj, bool preserve); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_naviframe_content_preserve_on_pop_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_item_insert_before(IntPtr naviframe, IntPtr before, string title, IntPtr prev, IntPtr next, IntPtr content, string style); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_item_insert_after(IntPtr naviframe, IntPtr after, string title, IntPtr prev, IntPtr next, IntPtr content, string style); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_top_item_get(IntPtr naviframe); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_naviframe_bottom_item_get(IntPtr naviframe); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_item_pop_to(IntPtr item); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_naviframe_item_style_set(IntPtr item, string style); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_naviframe_item_style_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_naviframe_item_style_get(IntPtr item); + + internal static string elm_naviframe_item_style_get(IntPtr item) + { + var text = _elm_naviframe_item_style_get(item); + return Marshal.PtrToStringAnsi(text); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Panel.cs b/src/ElmSharp/Interop/Interop.Elementary.Panel.cs new file mode 100644 index 0000000..c25f4fd --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Panel.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_panel_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panel_toggle(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panel_hidden_set(IntPtr obj, bool hidden); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_panel_hidden_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panel_scrollable_set(IntPtr obj, bool scrollable); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panel_scrollable_content_size_set(IntPtr obj, double ratio); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panel_orient_set(IntPtr obj, int orient); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_panel_orient_get(IntPtr obj); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Panes.cs b/src/ElmSharp/Interop/Interop.Elementary.Panes.cs new file mode 100644 index 0000000..d3aa6e8 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Panes.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_panes_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_left_size_set(IntPtr obj, double size); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_panes_content_left_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_panes_content_left_min_relative_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_left_min_relative_size_set(IntPtr obj, double size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_panes_content_left_min_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_left_min_size_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_right_size_set(IntPtr obj, double size); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_panes_content_right_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_panes_content_right_min_relative_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_right_min_relative_size_set(IntPtr obj, double size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_panes_content_right_min_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_content_right_min_size_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_panes_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_panes_fixed_set(IntPtr obj, bool fix); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_panes_fixed_get(IntPtr obj); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Popup.cs b/src/ElmSharp/Interop/Interop.Elementary.Popup.cs new file mode 100644 index 0000000..aeae832 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Popup.cs @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_popup_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_popup_timeout_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_timeout_set(IntPtr obj, double timeout); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_popup_timeout_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_popup_orient_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_orient_set(IntPtr obj, int orient); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_popup_orient_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_allow_events_set(IntPtr obj, bool allow); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_popup_allow_events_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_popup_item_append(IntPtr obj, string label, IntPtr icon, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_dismiss(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_align_set(IntPtr obj, double horizontal, double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_align_get(IntPtr obj, out double horizontal, out double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_align_get(IntPtr obj, IntPtr horizontal, out double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_align_get(IntPtr obj, out double horizontal, IntPtr vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_popup_content_text_wrap_type_set(IntPtr obj, int type); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_popup_content_text_wrap_type_get(IntPtr obj); + + internal static double GetPopupAlignX(IntPtr obj) + { + double x; + elm_popup_align_get(obj, out x, IntPtr.Zero); + return x; + } + + internal static double GetPopupAlignY(IntPtr obj) + { + double y; + elm_popup_align_get(obj, IntPtr.Zero, out y); + return y; + } + + internal static void SetPopupAlignX(IntPtr obj, double x) + { + double y = GetPopupAlignY(obj); + elm_popup_align_set(obj, x, y); + } + + internal static void SetPopupAlignY(IntPtr obj, double y) + { + double x = GetPopupAlignX(obj); + elm_popup_align_set(obj, x, y); + } + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs b/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs new file mode 100644 index 0000000..259b53f --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.ProgressBar.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_progressbar_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_progressbar_pulse_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_pulse_set(IntPtr obj, bool pulse); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_progressbar_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_inverted_set(IntPtr obj, bool inverted); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_progressbar_inverted_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_value_set(IntPtr obj, double val); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_progressbar_value_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_span_size_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_progressbar_span_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_pulse(IntPtr obj, bool state); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_part_value_set(IntPtr obj, string part, double val); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_progressbar_part_value_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_progressbar_unit_format_set(IntPtr obj, string format); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr _elm_progressbar_unit_format_get(IntPtr obj); + + internal static string elm_progressbar_unit_format_get(IntPtr obj) + { + var format = _elm_progressbar_unit_format_get(obj); + return Marshal.PtrToStringAnsi(format); + } + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs b/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs new file mode 100644 index 0000000..671aa5c --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.ScrollView.cs @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern void elm_interface_scrollable_content_size_get (out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_interface_scrollable_page_bring_in (int pagenumber_h, int pagenumber_v); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_scroller_add (IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_bounce_get(IntPtr obj, out bool h_bounce, out bool v_bounce); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_bounce_set(IntPtr obj, bool h_bounce, bool v_bounce); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_child_size_get (IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_content_min_limit (IntPtr obj, bool w, bool h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_current_page_get (IntPtr obj, out int h_pagenumber, out int v_pagenumber); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_gravity_get(IntPtr obj, out double x, out double y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_gravity_set (IntPtr obj, double x, double y); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_last_page_get (IntPtr obj, out int h_pagenumber, out int v_pagenumber); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_loop_get(IntPtr obj, out bool loop_h, out bool loop_v); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_loop_set (IntPtr obj, bool loop_h, bool loop_v); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_scroller_movement_block_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_movement_block_set(IntPtr obj, int block); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_bring_in (IntPtr obj, int h_pagenumber, int v_pagenumber); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_relative_get (IntPtr obj, out double h_pagerel, out double v_pagerel); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_relative_set (IntPtr obj, double h_pagerel, double v_pagerel); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_show (IntPtr obj, int h_pagenumber, int v_pagenumber); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_size_get (IntPtr obj, out int h_pagesize, out int v_pagesize); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_size_set (IntPtr obj, int h_pagesize, int v_pagesize); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_snap_get (IntPtr obj, out bool page_h_snap, out bool page_v_snap); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_snap_set (IntPtr obj, bool page_h_snap, bool page_v_snap); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_policy_get(IntPtr obj, out int policy_h, out int policy_v); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_policy_get(IntPtr obj, out int policy_h, IntPtr policy_v); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_policy_get(IntPtr obj, IntPtr policy_h, out int policy_v); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_policy_set(IntPtr obj, int policy_h, int policy_v); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_region_bring_in (IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_region_get (IntPtr obj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_region_show (IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_scroller_single_direction_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_single_direction_set(IntPtr obj, int singleDirection); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_step_size_get (IntPtr obj, out int x, out int y); + + [DllImportAttribute(Libraries.Elementary)] + internal static extern void elm_scroller_step_size_set (IntPtr obj, int x, int y); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_scroller_wheel_disabled_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_wheel_disabled_set (IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_scroller_propagate_events_get (IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_propagate_events_set (IntPtr obj, bool propagation); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_scroll_limit_get (IntPtr obj, out int page_limit_h_, out int page_limit_v_); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_scroller_page_scroll_limit_set (IntPtr obj, int page_limit_h_, int page_limit_v_); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_scroll_lock_y_set(IntPtr obj, bool enable); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Slider.cs b/src/ElmSharp/Interop/Interop.Elementary.Slider.cs new file mode 100755 index 0000000..6f30f31 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Slider.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal enum Elm_Slider_Indicator_Visible_Mode + { + ELM_SLIDER_INDICATOR_VISIBLE_MODE_DEFAULT, /* show indicator on mouse down or change in slider value */ + ELM_SLIDER_INDICATOR_VISIBLE_MODE_ALWAYS, /* Always show the indicator. */ + ELM_SLIDER_INDICATOR_VISIBLE_MODE_ON_FOCUS, /* Show the indicator on focus */ + ELM_SLIDER_INDICATOR_VISIBLE_MODE_NONE /* Never show the indicator */ + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_slider_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_indicator_show_set(IntPtr obj, bool show); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_slider_indicator_show_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_indicator_show_on_focus_set(IntPtr obj, bool focus); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_slider_indicator_show_on_focus_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_indicator_format_set(IntPtr obj, string indicator); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_slider_indicator_format_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_slider_indicator_format_get(IntPtr obj); + + internal static string elm_slider_indicator_format_get(IntPtr obj) + { + var text = _elm_slider_indicator_format_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_unit_format_set(IntPtr obj, string units); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_slider_unit_format_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_slider_unit_format_get(IntPtr obj); + + internal static string elm_slider_unit_format_get(IntPtr obj) + { + var text = _elm_slider_unit_format_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_inverted_set(IntPtr obj, bool inverted); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_slider_inverted_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_horizontal_set(IntPtr obj, bool value); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_slider_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_min_max_get(IntPtr obj, out double min, out double max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_min_max_get(IntPtr obj, out double min, IntPtr max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_min_max_get(IntPtr obj, IntPtr min, out double max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_value_set(IntPtr obj, double val); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_slider_value_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_span_size_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_slider_span_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_step_set(IntPtr obj, double step); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_slider_step_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_slider_indicator_visible_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_slider_indicator_visible_mode_set(IntPtr obj, int mode); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.Spinner.cs b/src/ElmSharp/Interop/Interop.Elementary.Spinner.cs new file mode 100644 index 0000000..338b4cc --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Spinner.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_spinner_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_min_max_set(IntPtr obj, double min, double max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_min_max_get(IntPtr obj, out double min, IntPtr max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_min_max_get(IntPtr obj, IntPtr min, out double max); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_step_set(IntPtr obj, double step); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_spinner_step_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_wrap_set(IntPtr obj, bool wrap); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_spinner_wrap_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_interval_set(IntPtr obj, double interval); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_spinner_interval_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_round_set(IntPtr obj, int rnd); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_spinner_round_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_editable_set(IntPtr obj, bool editable); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_spinner_editable_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_base_set(IntPtr obj, double value); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_spinner_base_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_value_set(IntPtr obj, double val); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_spinner_value_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_label_format_set(IntPtr obj, string fmt); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_spinner_label_format_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_spinner_label_format_get(IntPtr obj); + internal static string elm_spinner_label_format_get(IntPtr obj) + { + var text = _elm_spinner_label_format_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_special_value_add(IntPtr obj, double value, string label); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_spinner_special_value_del(IntPtr obj, double value); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_spinner_special_value_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_spinner_special_value_get(IntPtr obj, double value); + internal static string elm_spinner_special_value_get(IntPtr obj, double value) + { + var text = _elm_spinner_special_value_get(obj, value); + return Marshal.PtrToStringAnsi(text); + } + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Table.cs b/src/ElmSharp/Interop/Interop.Elementary.Table.cs new file mode 100644 index 0000000..d793a75 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Table.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_table_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_homogeneous_set(IntPtr obj, bool homogeneous); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_table_homogeneous_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_padding_set(IntPtr obj, int horizontal, int vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_padding_get(IntPtr obj, out int horizontal, out int vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_clear (IntPtr obj, bool clear); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_unpack (IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_pack(IntPtr obj, IntPtr subobj, int column, int row, int colspan, int rowspan); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_pack_set(IntPtr subobj, int col, int row, int colspan, int rowspan); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_table_pack_get(IntPtr subobj, out int col, out int row, out int colspan, out int rowspan); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Toolbar.cs b/src/ElmSharp/Interop/Interop.Elementary.Toolbar.cs new file mode 100644 index 0000000..d753827 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Toolbar.cs @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_add(IntPtr parent); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_shrink_mode_set(IntPtr obj, int shrink_mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_toolbar_shrink_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_item_append(IntPtr obj, string icon, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_item_prepend(IntPtr obj, string icon, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_item_insert_before(IntPtr obj, IntPtr before, string icon, string label, Evas.SmartCallback func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_transverse_expanded_set(IntPtr obj, bool transverse_expanded); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_toolbar_transverse_expanded_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_select_mode_set(IntPtr obj, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_toolbar_select_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_toolbar_align_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_align_set(IntPtr obj, double align); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_homogeneous_set(IntPtr obj, bool homogeneous); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_toolbar_homogeneous_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_toolbar_horizontal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_horizontal_set(IntPtr obj, bool horizontal); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_toolbar_icon_order_lookup_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_icon_order_lookup_set(IntPtr obj, int order); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_toolbar_icon_size_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_icon_size_set(IntPtr obj, int size); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_item_icon_set(IntPtr obj, string icon); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_toolbar_item_icon_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_toolbar_item_icon_get(IntPtr obj); + internal static string elm_toolbar_item_icon_get(IntPtr obj) + { + var text = _elm_toolbar_item_icon_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_first_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_last_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_item_selected_set(IntPtr obj, bool selected); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_toolbar_item_selected_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_selected_item_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_toolbar_item_separator_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_toolbar_item_separator_set(IntPtr obj, bool separator); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_item_find_by_label(IntPtr obj, string label); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_item_insert_after(IntPtr obj, IntPtr after, string icon, string label, Evas_Smart_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_toolbar_items_count(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_menu_parent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_menu_parent_set(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_toolbar_more_item_get(IntPtr obj); + } +} diff --git a/src/ElmSharp/Interop/Interop.Elementary.Win.cs b/src/ElmSharp/Interop/Interop.Elementary.Win.cs new file mode 100644 index 0000000..f0d2412 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.Win.cs @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_add(IntPtr parent, string name, int type); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_util_standard_add(string name, string title); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_activate(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_title_set(IntPtr obj, string title); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_title_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _elm_win_title_get(IntPtr obj); + + internal static string elm_win_title_get(IntPtr obj) + { + var text = _elm_win_title_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_screen_size_get(IntPtr obj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_resize_object_del(IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_resize_object_add(IntPtr obj, IntPtr subobj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_raise(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_lower(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_alpha_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_alpha_set(IntPtr obj, bool alpha); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_role_get")] + internal static extern IntPtr _elm_win_role_get(IntPtr obj); + + internal static string elm_win_role_get(IntPtr obj) + { + var text = _elm_win_role_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_role_set(IntPtr obj, string role); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_focus_highlight_style_get")] + internal static extern IntPtr _elm_win_focus_highlight_style_get(IntPtr obj); + + internal static string elm_win_focus_highlight_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_win_focus_highlight_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_focus_highlight_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_borderless_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_borderless_set(IntPtr obj, bool borderless); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_focus_highlight_enabled_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_focus_highlight_enabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_autodel_set(IntPtr obj, bool autodel); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_autodel_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_override_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_override_set(IntPtr obj, bool isOverride); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_indicator_opacity_set(IntPtr obj, int opacity); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_indicator_opacity_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_indicator_mode_set(IntPtr obj, IndicatorMode mode); + + [DllImport(Libraries.Elementary)] + internal static extern IndicatorMode elm_win_indicator_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_demand_attention_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_demand_attention_set(IntPtr obj, bool demandAttention); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_conformant_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_conformant_set(IntPtr obj, bool conformant); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_fullscreen_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_fullscreen_set(IntPtr obj, bool fullscreen); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_rotation_set(IntPtr obj, int rotation); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_rotation_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_rotation_with_resize_set(IntPtr obj, int rotation); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_prop_focus_skip_set(IntPtr obj, bool skip); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_wm_rotation_supported_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_focus_get(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_wm_rotation_available_rotations_set")] + internal static extern void _elm_win_wm_rotation_available_rotations_set(IntPtr obj, IntPtr rotations, uint count); + + internal static void elm_win_wm_rotation_available_rotations_set(IntPtr obj, int[] rotations) + { + IntPtr pRotations = Marshal.AllocHGlobal(Marshal.SizeOf() * rotations.Length); + Marshal.Copy(rotations, 0, pRotations, rotations.Length); + _elm_win_wm_rotation_available_rotations_set(obj, pRotations, (uint)rotations.Length); + Marshal.FreeHGlobal(pRotations); + } + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_wm_rotation_available_rotations_get")] + internal static extern bool _elm_win_wm_rotation_available_rotations_get(IntPtr obj, out IntPtr rotations, out int count); + + internal static bool elm_win_wm_rotation_available_rotations_get(IntPtr obj, out int[] rotations) + { + IntPtr rotationArrPtr; + int count; + if (_elm_win_wm_rotation_available_rotations_get(obj, out rotationArrPtr, out count)) + { + rotations = new int[count]; + Marshal.Copy(rotationArrPtr, rotations, 0, count); + Libc.Free(rotationArrPtr); + return true; + } + rotations = null; + return false; + } + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_layer_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_layer_set(IntPtr obj, int layer); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_sticky_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_sticky_set(IntPtr obj, bool sticky); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_screen_dpi_get(IntPtr obj, out int xdpi, out int ydpi); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_iconified_set(IntPtr obj, bool iconified); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_win_iconified_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_floating_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_floating_mode_set(IntPtr obj, bool floating); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_win_keygrab_set(IntPtr obj, string key, ulong modifiers, ulong notModifiers, int proirity, KeyGrabMode grabMode); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_win_keygrab_unset(IntPtr obj, string key, ulong modifiers, ulong notModifiers); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_win_keygrab_set(IntPtr obj, string key); + + [DllImport(Libraries.Eext)] + internal static extern bool eext_win_keygrab_unset(IntPtr obj, string key); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_keyboard_win_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_keyboard_win_set(IntPtr obj, bool isKeyboard); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_keyboard_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_keyboard_mode_set(IntPtr obj, int mode); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_inwin_activate(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_inwin_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_inwin_content_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_inwin_content_set(IntPtr obj, IntPtr content); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_inwin_content_unset(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_win_aspect_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_aspect_set(IntPtr obj, double aspect); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_autohide_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_autohide_set(IntPtr obj, bool autohide); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_center(IntPtr obj, bool h, bool v); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_focus_highlight_animate_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_focus_highlight_animate_set(IntPtr obj, bool animate); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_icon_name_get")] + internal static extern IntPtr _elm_win_icon_name_get(IntPtr obj); + + internal static string elm_win_icon_name_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_win_icon_name_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_icon_name_set(IntPtr obj, string iconName); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_icon_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_icon_object_set(IntPtr obj, IntPtr icon); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_inlined_image_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_maximized_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_maximized_set(IntPtr obj, bool maximized); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_modal_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_modal_set(IntPtr obj, bool modal); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_noblank_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_noblank_set(IntPtr obj, bool noblank); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_norender_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_norender_pop(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_norender_push(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_win_profile_get")] + internal static extern IntPtr _elm_win_profile_get(IntPtr obj); + + internal static string elm_win_profile_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_win_profile_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_profile_set(IntPtr obj, string profile); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_quickpanel_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_quickpanel_priority_major_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_quickpanel_priority_major_set(IntPtr obj, int priority); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_quickpanel_priority_minor_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_quickpanel_priority_minor_set(IntPtr obj, int priority); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_quickpanel_set(IntPtr obj, bool quickpanel); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_quickpanel_zone_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_quickpanel_zone_set(IntPtr obj, int zone); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_render(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_screen_constrain_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_screen_constrain_set(IntPtr obj, bool constrain); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_screen_position_get(IntPtr obj, out int x, out int y); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_shaped_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_shaped_set(IntPtr obj, bool shaped); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_size_base_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_size_base_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_size_step_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_size_step_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_socket_listen(IntPtr obj, string svcname, int svcnum, bool svcsys); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_trap_data_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_trap_set(IntPtr obj, IntPtr trap); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_urgent_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_urgent_set(IntPtr obj, bool urgent); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_util_dialog_add(IntPtr obj, string name, string title); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_withdrawn_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_withdrawn_set(IntPtr obj, bool withdrawn); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_wm_rotation_manual_rotation_done(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_wm_rotation_manual_rotation_done_get(IntPtr obj, bool withdrawn); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_wm_rotation_manual_rotation_done_set(IntPtr obj, bool set); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_win_wm_rotation_preferred_rotation_get(IntPtr obj, bool withdrawn); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_win_available_profiles_get(IntPtr obj, out string[] profiles, out int count); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_available_profiles_set(IntPtr obj, string[] profiles, int count); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_win_fake_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_fake_canvas_set(IntPtr obj, IntPtr oee); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_win_illume_command_send(IntPtr obj, IntPtr param); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Elementary.cs b/src/ElmSharp/Interop/Interop.Elementary.cs new file mode 100644 index 0000000..601f8ee --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Elementary.cs @@ -0,0 +1,795 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + internal enum Edje_Message_Type + { + EDJE_MESSAGE_NONE = 0, + + // A message with a string as value. Use #Edje_Message_String structs as message body, for this type. + EDJE_MESSAGE_STRING = 2, + + // A message with an integer number as value. Use #Edje_Message_Int structs as message body, for this type. + EDJE_MESSAGE_INT = 3, + + // A message with a floating pointer number as value. Use #Edje_Message_Float structs as message body, for this type. + EDJE_MESSAGE_FLOAT = 4, + + // A message with a list of strings as value. Use #Edje_Message_String_Set structs as message body, for this type. + EDJE_MESSAGE_STRING_SET = 5, + + // A message with a list of integer numbers as value. Use #Edje_Message_Int_Set structs as message body, for this type. + EDJE_MESSAGE_INT_SET = 6, + + // A message with a list of floating point numbers as value. Use #Edje_Message_Float_Set structs as message body, for this type. + EDJE_MESSAGE_FLOAT_SET = 7, + + // A message with a struct containing a string and an integer number as value. Use #Edje_Message_String_Int structs as message body, for this type. + EDJE_MESSAGE_STRING_INT = 8, + + // A message with a struct containing a string and a floating point number as value. Use #Edje_Message_String_Float structs as message body, for this type. + EDJE_MESSAGE_STRING_FLOAT = 9, + + // A message with a struct containing a string and list of integer numbers as value. Use #Edje_Message_String_Int_Set structs as message body, for this type. + EDJE_MESSAGE_STRING_INT_SET = 10, + + // A message with a struct containing a string and list of floating point numbers as value. Use #Edje_Message_String_Float_Set structs as message body, for this type. + EDJE_MESSAGE_STRING_FLOAT_SET = 11 + } + internal enum Elm_Focus_Autoscroll_Mode + { + ELM_FOCUS_AUTOSCROLL_MODE_SHOW, + ELM_FOCUS_AUTOSCROLL_MODE_NONE, + ELM_FOCUS_AUTOSCROLL_MODE_BRING_IN + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_scroll_bring_in_scroll_friction_set(double time); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_config_scroll_bring_in_scroll_friction_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_focus_autoscroll_mode_set(Elm_Focus_Autoscroll_Mode mode); + + [DllImport(Libraries.Elementary)] + internal static extern Elm_Focus_Autoscroll_Mode elm_config_focus_autoscroll_mode_get(); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_config_accel_preference_set(string preference); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_scale_set(double scale); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_config_scale_get(); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_config_profile_get")] + internal static extern IntPtr _elm_config_profile_get(); + + internal static string elm_config_profile_get() + { + return Marshal.PtrToStringAnsi(_elm_config_profile_get()); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_preferred_engine_set(string name); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_config_longpress_timeout_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_reload(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_all_flush(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_finger_size_set(int size); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_config_finger_size_get(); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_config_mirrored_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_mirrored_set(bool mirrored); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_mirrored_automatic_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_mirrored_automatic_set(IntPtr obj, bool automatic); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_mirrored_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_mirrored_set(IntPtr obj, bool mirrored); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_grid_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_grid_pack(IntPtr obj, IntPtr subObj, int x, int y, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_grid_pack_get(IntPtr subObj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_grid_pack_set(IntPtr subObj, int x, int y, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_grid_size_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tree_dump(IntPtr top); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_disabled_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_disabled_set(IntPtr obj, bool disabled); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_init(int argc, string[] argv); + + [DllImport(Libraries.Elementary)] + internal static extern bool ecore_main_loop_glib_integrate(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_run(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_exit(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_shutdown(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_app_base_scale_set(double base_scale); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_app_base_scale_get(); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_conformant_add(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_object_part_text_get")] + internal static extern IntPtr _elm_object_part_text_get(IntPtr obj, IntPtr part); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_object_part_text_get")] + internal static extern IntPtr _elm_object_part_text_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_text_set(IntPtr obj, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_unset(IntPtr obj); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_object_tooltip_style_get")] + internal static extern IntPtr _elm_object_tooltip_style_get(IntPtr obj); + + internal static string elm_object_tooltip_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_object_tooltip_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_tooltip_window_mode_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_tooltip_window_mode_set(IntPtr obj, bool disable); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_move_freeze_push(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_move_freeze_pop(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_object_tooltip_move_freeze_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_show(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_hide(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_orient_set(IntPtr obj, int orient); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_object_tooltip_orient_get(IntPtr obj); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate IntPtr Elm_Tooltip_Content_Cb(IntPtr data, IntPtr obj, IntPtr tooltip); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tooltip_content_cb_set(IntPtr obj, Elm_Tooltip_Content_Cb func, IntPtr data, Interop.Evas.SmartCallback del); + + internal static string elm_object_part_text_get(IntPtr obj, string part) + { + return Marshal.PtrToStringAnsi(_elm_object_part_text_get(obj, part)); + } + + internal static string elm_object_part_text_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_object_part_text_get(obj, IntPtr.Zero)); + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_part_content_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_part_content_set(IntPtr obj, string part, IntPtr content); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_part_content_set(IntPtr obj, IntPtr part, IntPtr content); + + internal static void elm_object_content_set(IntPtr obj, IntPtr content) + { + elm_object_part_content_set(obj, IntPtr.Zero, content); + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_part_content_unset(IntPtr obj, string part); + + internal static void elm_object_content_unset(IntPtr obj) + { + elm_object_part_content_unset(obj, null); + } + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_content_get(IntPtr obj, string swallow); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_content_set(IntPtr obj, string swallow, IntPtr content); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_content_unset(IntPtr obj, string swallow); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_text_set(IntPtr obj, string part, string text); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_layout_text_get")] + internal static extern IntPtr _elm_layout_text_get(IntPtr obj, string part); + + internal static string elm_layout_text_get(IntPtr obj, string part) + { + return Marshal.PtrToStringAnsi(_elm_layout_text_get(obj, part)); + } + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_theme_set(IntPtr obj, string klass, string group, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_file_get(IntPtr obj, IntPtr file, IntPtr group); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_file_set(IntPtr obj, string file, string group); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_signal_emit(IntPtr obj, string emission, string source); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_signal_callback_add(IntPtr obj, string emission, string source, Edje_Signal_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_signal_callback_del(IntPtr obj, string emission, string source, Edje_Signal_Cb func); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Edje_Signal_Cb(IntPtr data, IntPtr obj, string emission, string source); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_box_append(IntPtr obj, string part, IntPtr child); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_box_prepend(IntPtr obj, string part, IntPtr child); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_box_remove(IntPtr obj, string part, IntPtr child); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_box_remove_all(IntPtr obj, string part, bool clear); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_layout_data_get")] + internal static extern IntPtr _elm_layout_data_get(IntPtr obj, string key); + + internal static string elm_layout_data_get(IntPtr obj, string key) + { + return Marshal.PtrToStringAnsi(_elm_layout_data_get(obj, key)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_text_valign_set(IntPtr obj, string part, double valign); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_layout_text_valign_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_notify_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_notify_align_set(IntPtr obj, double horizontal, double vertical); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_notify_timeout_set(IntPtr obj, double timeout); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_object_scale_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_scale_set(IntPtr obj, double scale); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_signal_emit(IntPtr obj, string emission, string source); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_signal_callback_del(IntPtr obj, string emission, string source, Edje_Signal_Cb func); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_signal_callback_add(IntPtr obj, string emission, string source, Edje_Signal_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_style_set(IntPtr obj, string style); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_object_style_get")] + internal static extern IntPtr _elm_object_style_get(IntPtr obj); + + internal static string elm_object_style_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_elm_object_style_get(obj)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_color_class_color_get(IntPtr obj, string colorClass, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_color_class_color_set(IntPtr obj, string colorClass, int r, int g, int b, int a); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_part_text_set(IntPtr obj, string part, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_part_text_set(IntPtr obj, IntPtr part, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_focus_highlight_animate_set(bool animate); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_config_focus_highlight_animate_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_config_focus_highlight_enabled_set(bool enable); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_config_focus_highlight_enabled_get(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_tree_focus_allow_set(IntPtr obj, bool focusable); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_tree_focus_allow_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_focus_next_object_get(IntPtr obj, int dir); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_object_focused_object_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_focus_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_set(IntPtr obj, bool focus); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_object_focus_allow_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_allow_set(IntPtr obj, bool enable); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_next(IntPtr obj, int direction); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_next_object_set(IntPtr obj, IntPtr next, int direction); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_next_item_set(IntPtr obj, IntPtr nextItem, int direction); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_extension_add(IntPtr theme, string path); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_overlay_add(IntPtr theme, string path); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_language_set(string lang); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_policy_set(uint policy, int value); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_theme_new(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_free(IntPtr theme); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_ref_set(IntPtr theme, IntPtr themeRef); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_extension_del(IntPtr theme, string item); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_overlay_del(IntPtr theme, string item); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_set(IntPtr obj, string theme); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_flush(IntPtr theme); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_theme_full_flush(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_theme_set(IntPtr obj, IntPtr theme); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_edje_get(IntPtr obj); + + internal static void SetObjectText(IntPtr obj, string text) + { + elm_object_part_text_set(obj, IntPtr.Zero, text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void elm_cache_all_flush(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_domain_translatable_part_text_set(IntPtr obj, string part, string domain, string text); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_color_class_del(IntPtr obj, string colorClass); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_part_exists(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr edje_object_part_object_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_part_geometry_get(IntPtr obj, string part, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_part_text_set(IntPtr obj, string part, string text); + + [DllImport(Libraries.Elementary, EntryPoint = "edje_object_part_text_get", CharSet = CharSet.Ansi)] + internal static extern IntPtr _edje_object_part_text_get(IntPtr obj, string part); + + internal static string edje_object_part_text_get(IntPtr obj, string part) + { + var text = _edje_object_part_text_get(obj, part); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary, EntryPoint = "edje_object_part_text_style_user_peek", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _edje_object_part_text_style_user_peek(IntPtr obj, string part); + + internal static string edje_object_part_text_style_user_peek(IntPtr obj, string part) + { + var text = _edje_object_part_text_style_user_peek(obj, part); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_part_text_style_user_push(IntPtr obj, string part, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_part_text_style_user_pop(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_signal_emit(IntPtr obj, string emission, string source); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_mirrored_set(IntPtr obj, bool rtl); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr edje_object_add(IntPtr evas); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_file_set(IntPtr obj, string file, string group); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_part_box_append(IntPtr obj, string part, IntPtr child); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_part_box_prepend(IntPtr obj, string part, IntPtr child); + + [DllImport(Libraries.Elementary, EntryPoint = "edje_object_part_state_get")] + internal static extern IntPtr _edje_object_part_state_get(IntPtr obj, string part, out double value); + + internal static string edje_object_part_state_get(IntPtr obj, string part, out double value) + { + return Marshal.PtrToStringAnsi(_edje_object_part_state_get(obj, part, out value)); + } + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_signal_callback_add(IntPtr obj, string emission, string source, Edje_Signal_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr edje_object_signal_callback_del(IntPtr obj, string emission, string source, Edje_Signal_Cb func); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_signal_callback_del_full(IntPtr obj, string emission, string source, Edje_Signal_Cb func, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_color_class_set(string colorClass, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_color_class_get(string colorClass, out int r, out int g, out int b, out int a, out int r2, out int g2, out int b2, out int a2, + out int r3, out int g3, out int b3, out int a3); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_color_class_set(IntPtr obj, string colorClass, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_color_class_get(IntPtr obj, string colorClass, out int r, out int g, out int b, out int a, out int r2, out int g2, out int b2, out int a2, + out int r3, out int g3, out int b3, out int a3); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_message_signal_process(); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_message_handler_set(IntPtr obj, Edje_Message_Handler_Cb func, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Edje_Message_Handler_Cb(IntPtr data, IntPtr obj, Edje_Message_Type type, int id, IntPtr msg); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_message_send(IntPtr obj, Edje_Message_Type type, int id, IntPtr msg); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_object_message_signal_process(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_text_class_set(IntPtr obj, string textClass, string font, int size); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_object_text_class_get(IntPtr obj, string textClass, out string font, out int size); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_text_class_set(string textClass, string font, int size); + + [DllImport(Libraries.Elementary)] + internal static extern bool edje_text_class_get(string textClass, out string font, out int size); + + [DllImport(Libraries.Elementary)] + internal static extern void edje_text_class_del(string textClass); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_add(); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_del(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_object_add(IntPtr transit, IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_translation_add(IntPtr transit, int fromDx, int fromDy, int toDx, int toDy); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_objects_final_state_keep_set(IntPtr transit, bool stateKeep); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_tween_mode_set(IntPtr transit, int tweenMode); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_repeat_times_set(IntPtr transit, int repeat); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_duration_set(IntPtr transit, double duration); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_go(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_zoom_add(IntPtr transit, float fromRate, float toRate); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_color_add(IntPtr transit, int fromR, int fromG, int fromB, int fromA, int toR, int toG, int toB, int toA); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_auto_reverse_set(IntPtr transit, bool reverse); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_effect_add(IntPtr transit, Elm_Transit_Effect_Transition_Cb transitionCb, IntPtr effect, Elm_Transit_Effect_End_Cb endCb); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_fade_add(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_resizing_add(IntPtr transit, int fromW, int fromH, int toW, int toH); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_event_enabled_set(IntPtr transit, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_smooth_set(IntPtr transit, bool enabled); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_effect_del(IntPtr transit, Elm_Transit_Effect_Transition_Cb transitionCb, IntPtr effect); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_object_remove(IntPtr transit, IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_transit_objects_final_state_keep_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_transit_event_enabled_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_del_cb_set(IntPtr transit, Elm_Transit_Del_Cb cb, IntPtr data); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_transit_auto_reverse_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_transit_repeat_times_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_transit_tween_mode_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_tween_mode_factor_set(IntPtr transit, double v1, double v2); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_tween_mode_factor_get(IntPtr transit, out double v1, out double v2); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_tween_mode_factor_n_set(IntPtr transit, int vSize, out double v); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_transit_duration_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_go_in(IntPtr transit, double interval); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_paused_set(IntPtr transit, bool paused); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_transit_paused_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern double elm_transit_progress_value_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_chain_transit_add(IntPtr transit, IntPtr chainTransit); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_transit_chain_transit_del(IntPtr transit, IntPtr chainTransit); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_chain_transits_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_transit_smooth_get(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_flip_add(IntPtr transit, int axis, bool cw); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_resizable_flip_add(IntPtr transit, int axis, bool cw); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_wipe_add(IntPtr transit, int type, int dir); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_blend_add(IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_rotation_add(IntPtr transit, float fromDegree, float toDegree); + + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_transit_effect_image_animation_add(IntPtr transit, IntPtr images); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate int Eina_Compare_Cb(IntPtr data1, IntPtr data2); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Elm_Transit_Effect_Transition_Cb(IntPtr effect, IntPtr transit, double progress); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Elm_Transit_Effect_End_Cb(IntPtr effect, IntPtr transit); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Elm_Transit_Del_Cb(IntPtr data, IntPtr transit); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_box_insert_at(IntPtr obj, string part, IntPtr child, uint pos); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_box_insert_before(IntPtr obj, string part, IntPtr child, IntPtr reference); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_edje_object_can_access_get(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_edje_object_can_access_set(IntPtr obj, bool canAccess); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_layout_freeze(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_part_cursor_engine_only_get(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_part_cursor_engine_only_set(IntPtr obj, string part, bool engineOnly); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_layout_part_cursor_get")] + internal static extern IntPtr _elm_layout_part_cursor_get(IntPtr obj, string part); + + internal static string elm_layout_part_cursor_get(IntPtr obj, string part) + { + return Marshal.PtrToStringAnsi(_elm_layout_part_cursor_get(obj, part)); + } + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_part_cursor_set(IntPtr obj, string part, string cursor); + + [DllImport(Libraries.Elementary, EntryPoint = "elm_layout_part_cursor_style_get")] + internal static extern IntPtr _elm_layout_part_cursor_style_get(IntPtr obj, string part); + + internal static string elm_layout_part_cursor_style_get(IntPtr obj, string part) + { + return Marshal.PtrToStringAnsi(_elm_layout_part_cursor_style_get(obj, part)); + } + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_part_cursor_style_set(IntPtr obj, string part, string style); + + [DllImport(Libraries.Elementary)] + internal static extern bool elm_layout_part_cursor_unset(IntPtr obj, string part); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_sizing_eval(IntPtr obj); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_layout_sizing_restricted_eval(IntPtr obj, bool width, bool height); + + [DllImport(Libraries.Elementary)] + internal static extern int elm_layout_thaw(IntPtr obj); + } +} diff --git a/src/ElmSharp/Interop/Interop.Eo.cs b/src/ElmSharp/Interop/Interop.Eo.cs new file mode 100644 index 0000000..9ff0936 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Eo.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Eo + { + [DllImport(Libraries.Eo)] + internal static extern IntPtr eo_class_get(IntPtr obj); + + [DllImport(Libraries.Eo, EntryPoint = "eo_class_name_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _eo_class_name_get(IntPtr klass); + + internal static string eo_class_name_get(IntPtr obj) + { + var name = _eo_class_name_get(obj); + return Marshal.PtrToStringAnsi(name); + } + + } + +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Evas.Image.cs b/src/ElmSharp/Interop/Interop.Evas.Image.cs new file mode 100644 index 0000000..c18cbdd --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Evas.Image.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Evas + { + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_file_set(IntPtr obj, string file, string key); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_border_set(IntPtr obj, int l, int r, int t, int b); + + [DllImport(Libraries.Evas)] + internal static extern int evas_object_image_border_center_fill_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_border_center_fill_set(IntPtr obj, int filled); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_alpha_set(IntPtr obj, bool has_alpha); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_image_alpha_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern LoadError evas_object_image_load_error_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_size_get(IntPtr obj, IntPtr x, out int y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_size_get(IntPtr obj, out int x, IntPtr y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_size_get(IntPtr obj, out int x, out int y); + } +} \ No newline at end of file diff --git a/src/ElmSharp/Interop/Interop.Evas.cs b/src/ElmSharp/Interop/Interop.Evas.cs new file mode 100644 index 0000000..60e3d16 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Evas.cs @@ -0,0 +1,818 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Evas + { + public enum ObjectCallbackType + { + MouseIn, + MouseOut, + MouseDown, + MouseUp, + MouseMove, + MouseWheel, + MultiDown, + MultiUp, + MultiMove, + Free, + KeyDown, + KeyUp, + FocusIn, + FocusOut, + Show, + Hide, + Move, + Resize, + Restack, + Del, + Hold, + ChangedSizeHints, + ImagePreloaded, + CanvasFocusIn, + CanvasFocusOut, + RenderFlushPre, + RenderFlushPost, + CanvasObjectFocusIn, + CanvasObjectFocusOut, + ImageUnloaded, + RenderPre, + RenderPost, + ImageResize, + DeviceChanged, + AxisUpdate, + CanvasViewportResize + } + + public enum LoadError + { + None = 0, /* No error on load */ + Generic = 1, /* A non-specific error occurred */ + DoesNotRxist = 2, /* File (or file path) does not exist */ + PermissionDenied = 3, /* Permission denied to an existing file (or path) */ + ResourceAllocationFailed = 4, /* Allocation of resources failure prevented load */ + CorruptFile = 5, /* File corrupt (but was detected as a known format) */ + UnknownFormat = 6 /* File is not a known format */ + } + + public enum Colorspace + { + Argb8888, /* ARGB 32 bits per pixel, high-byte is Alpha, accessed 1 32bit word at a time */ + Ycbcr422p709pl, /* YCbCr 4:2:2 Planar, ITU.BT-709 specifications. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb, then Cr rows */ + Ergb565a5p, /* 16bit rgb565 + Alpha plane at end - 5 bits of the 8 being used per alpha byte */ + Egry8, /* 8bit grayscale */ + Eycbcr422601pl, /* YCbCr 4:2:2, ITU.BT-601 specifications. The data pointed to is just an array of row pointer, pointing to line of Y,Cb,Y,Cr bytes */ + Eycbcr420nv12601pl, /* YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of row pointer, pointing to the Y rows, then the Cb,Cr rows. */ + Eycbcr420tm12601pl, /* YCbCr 4:2:0, ITU.BT-601 specification. The data pointed to is just an array of tiled row pointer, pointing to the Y rows, then the Cb,Cr rows. */ + Eagry88, /* AY 8bits Alpha and 8bits Grey, accessed 1 16bits at a time */ + Eetc1, /* OpenGL ETC1 encoding of RGB texture (4 bit per pixel) @since 1.10 */ + Ergb8etc2, /* OpenGL GL_COMPRESSED_RGB8_ETC2 texture compression format (4 bit per pixel) @since 1.10 */ + Ergba8etc2eac, /* OpenGL GL_COMPRESSED_RGBA8_ETC2_EAC texture compression format, supports alpha (8 bit per pixel) @since 1.10 */ + Eetc1alpha, /* ETC1 with alpha support using two planes: ETC1 RGB and ETC1 grey for alpha @since 1.11 */ + } + + public enum ImageScaleHint + { + None = 0, /* No scale hint at all */ + Dynamic = 1, /* Image is being re-scaled over time, thus turning scaling cache @b off for its data */ + Static = 2 /* Image is not being re-scaled over time, thus turning scaling cache @b on for its data */ + } + + public enum RenderOp + { + Blend = 0, /* default op: d = d*(1-sa) + s */ + BlendRel = 1, /* d = d*(1 - sa) + s*da */ + Copy = 2, /* d = s */ + CopyRel = 3, /* d = s*da */ + Add = 4, /* d = d + s */ + AddRel = 5, /* d = d + s*da */ + Sub = 6, /* d = d - s */ + SubRel = 7, /* d = d - s*da */ + Tint = 8, /* d = d*s + d*(1 - sa) + s*(1 - da) */ + TintRel = 9, /* d = d*(1 - sa + s) */ + Mask = 10, /* d = d*sa */ + Mul = 11 /* d = d*s */ + } + + public enum ObjectCallbackPriority + { + After = 100, + Before = -100, + Default = 0 + } + + public enum TableHomogeneousMode + { + None = 0, + Table = 1, + Item = 2 + } + + public enum TextStyleType + { + Plain, /* plain, standard text */ + Shadow, /* text with shadow underneath */ + Outline, /* text with an outline */ + SoftOutline, /* text with a soft outline */ + Glow, /* text with a glow effect */ + OutlineShadow, /* text with both outline and shadow effects */ + FarShadow, /* text with (far) shadow underneath */ + OutlineSoftShadow, /* text with outline and soft shadow effects combined */ + SoftShadow, /* text with(soft) shadow underneath */ + FarSoftShadow, /* text with(far soft) shadow underneath */ + ShadowDirectionBottomRight, /* shadow growing to bottom right */ + ShadowDirectionBottom, /* shadow growing to the bottom */ + ShadowDirectionBottomLeft, /* shadow growing to bottom left */ + ShadowDirectionLeft, /* shadow growing to the left */ + ShadowDirectionTopLeft, /* shadow growing to top left */ + ShadowDirectionTop, /* shadow growing to the top */ + ShadowDirectionTopRight, /* shadow growing to top right */ + ShadowDirectionRight, /* shadow growing to the right */ + } + + //public struct TextBlockStyle + //{ + // string StyleText; + // string DefaultTag; + + // List objects; + // bool DeleteMe; + //} + + //public struct StyleTag + //{ + //} + + internal delegate void EventCallback(IntPtr data, IntPtr evas, IntPtr obj, IntPtr info); + + internal delegate void EvasCallback(IntPtr data, IntPtr evas, IntPtr info); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_callback_add(IntPtr obj, ObjectCallbackType type, EvasCallback func, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_callback_del(IntPtr obj, ObjectCallbackType type, EvasCallback func); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_event_callback_add(IntPtr obj, ObjectCallbackType type, EventCallback func, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_event_callback_del(IntPtr obj, ObjectCallbackType type, EventCallback func); + + public delegate void SmartCallback(IntPtr data, IntPtr obj, IntPtr info); + + public static readonly string BackKeyName = "XF86Back"; + public static readonly string MenuKeyName = "XF86Menu"; + + public enum ButtonFlags + { + None, DoubleClick, TripleClick + } + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_key_grab(IntPtr obj, string keyname, ulong modifier, ulong not_modifier, bool exclusive); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_key_ungrab(IntPtr obj, string keyname, ulong modifier, ulong not_modifier); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_data_get(IntPtr obj, string keyname); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_data_set(IntPtr obj, string keyname, IntPtr data); + + [DllImport(Libraries.Evas, EntryPoint = "evas_object_type_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _evas_object_type_get(IntPtr obj); + + internal static string evas_object_type_get(IntPtr obj) + { + var text = _evas_object_type_get(obj); + return Marshal.PtrToStringAnsi(text); + } + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_evas_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_image_add(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_del(IntPtr objectPtr); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_show(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_hide(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_visible_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_callback_add(IntPtr obj, string eventName, SmartCallback seh, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_callback_del(IntPtr obj, string eventName, SmartCallback seh); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_min_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_min_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_min_get(IntPtr obj, IntPtr w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_min_get(IntPtr obj, out int w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_max_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_max_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_max_get(IntPtr obj, IntPtr w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_max_get(IntPtr obj, out int w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_weight_get(IntPtr obj, out double x, out double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_weight_get(IntPtr obj, out double x, IntPtr y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_weight_get(IntPtr obj, IntPtr x, out double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_align_get(IntPtr obj, out double x, out double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_align_get(IntPtr obj, out double x, IntPtr y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_align_get(IntPtr obj, IntPtr x, out double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_weight_set(IntPtr obj, double x, double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_align_set(IntPtr obj, double x, double y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_move(IntPtr obj, int x, int y); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_resize(IntPtr obj, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_set(IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, out int x, IntPtr y, IntPtr w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, IntPtr x, out int y, IntPtr w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, IntPtr x, IntPtr y, out int w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, IntPtr x, IntPtr y, IntPtr w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, IntPtr x, IntPtr y, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_geometry_get(IntPtr obj, out int x, out int y, IntPtr w, IntPtr h); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_smart_members_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_map_new(int count); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_util_points_populate_from_object_full(IntPtr map, IntPtr obj, int z); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_util_points_populate_from_geometry(IntPtr map, int x, int y, int w, int h, int z); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_util_3d_rotate(IntPtr map, double dx, double dy, double dz, int cx, int cy, int cz); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_util_zoom(IntPtr map, double x, double y, int cx, int cy); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_point_coord_set(IntPtr map, int idx, int x, int y, int z); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_point_coord_get(IntPtr map, int idx, out int x, out int y, out int z); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_map_enable_set(IntPtr obj, bool enabled); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_map_enable_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_util_object_move_sync_set(IntPtr map, bool enabled); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_map_util_object_move_sync_get(IntPtr map); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_map_set(IntPtr obj, IntPtr map); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_map_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_map_free(IntPtr map); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_polygon_add(IntPtr evas); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_polygon_point_add(IntPtr evas, int x, int y); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_polygon_points_clear(IntPtr evas); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_rectangle_add(IntPtr evas); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_color_get(IntPtr obj, out int r, out int g, out int b, out int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_color_get(IntPtr obj, IntPtr r, IntPtr g, IntPtr b, out int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_clip_set(IntPtr obj, IntPtr clip); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_clip_unset(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_clip_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_lower(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_feed_mouse_move(IntPtr obj, int x, int y, int timestamp, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_feed_mouse_down(IntPtr obj, int b, ButtonFlags flags, int timestamp, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_feed_mouse_up(IntPtr obj, int b, ButtonFlags flags, int timestamp, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_feed_key_down(IntPtr obj, string keyname, string key, string str, string compose, int timestamp, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_feed_key_up(IntPtr obj, string keyname, string key, string str, string compose, int timestamp, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_ref(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_unref(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern int evas_object_ref_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_repeat_events_set(IntPtr obj, bool repeat); + + [DllImport(Libraries.Evas)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool evas_object_repeat_events_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_propagate_events_set(IntPtr obj, bool propagate); + + [DllImport(Libraries.Evas)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool evas_object_propagate_events_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_pass_events_set(IntPtr obj, bool propagate); + + [DllImport(Libraries.Evas)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool evas_object_pass_events_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_textblock_size_native_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_textblock_size_formatted_get(IntPtr obj, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_changed(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_calculate(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_color_argb_premul(int a, ref int r, ref int g, ref int b); + + [DllImport(Libraries.Evas)] + internal static extern void evas_damage_rectangle_add(IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_data_argb_premul(uint data, uint length); + + [DllImport(Libraries.Evas)] + internal static extern void evas_event_callback_del_full(IntPtr obj, ObjectCallbackType type, EvasCallback func, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_font_path_global_append(string path); + + [DllImport(Libraries.Evas)] + internal static extern void evas_image_cache_flush(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_image_cache_set(IntPtr obj, int size); + + [DllImport(Libraries.Evas, EntryPoint = "evas_load_error_str")] + internal static extern IntPtr _evas_load_error_str(LoadError error); + + internal static string evas_load_error_str(LoadError error) + { + return Marshal.PtrToStringAnsi(_evas_load_error_str(error)); + } + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_data_del(IntPtr obj, string key); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_focus_set(IntPtr obj, bool focus); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_freeze_events_set(IntPtr obj, bool freeze); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_colorspace_set(IntPtr obj, Colorspace colorSpace); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_data_copy_set(IntPtr obj, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_image_data_get(IntPtr obj, bool forWriting); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_data_set(IntPtr obj, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_data_update_add(IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_fill_set(IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_image_filled_add(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_filled_set(IntPtr obj, bool setting); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_memfile_set(IntPtr obj, IntPtr data, int size, string format, string key); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_pixels_dirty_set(IntPtr obj, bool dirty); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_save(IntPtr obj, string file, string key, string flags); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_scale_hint_set(IntPtr obj, ImageScaleHint hint); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_size_set(IntPtr obj, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_smooth_scale_set(IntPtr obj, bool smoothScale); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_source_set(IntPtr obj, IntPtr src); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_image_source_visible_set(IntPtr obj, bool visible); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_layer_set(IntPtr obj, int layer); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_raise(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_render_op_set(IntPtr obj, RenderOp op); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_aspect_set(IntPtr obj, int aspect, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_smart_add(IntPtr obj, IntPtr smart); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_smart_data_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_data_set(IntPtr obj, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_member_add(IntPtr obj, IntPtr smart); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_member_del(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_stack_above(IntPtr obj, IntPtr avobe); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_text_add(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_font_set(IntPtr obj, string font, int size); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_text_set(IntPtr obj, string text); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_textblock_add(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_textblock_style_set(IntPtr obj, IntPtr textBlockStyle); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_textblock_text_markup_set(IntPtr obj, string text); + + [DllImport(Libraries.Evas)] + internal static extern void evas_obscured_clear(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_smart_class_new(IntPtr obj); + + [DllImport(Libraries.Evas, EntryPoint = "evas_device_name_get")] + internal static extern IntPtr _evas_device_name_get(IntPtr obj); + + internal static string evas_device_name_get(IntPtr obj) + { + return Marshal.PtrToStringAnsi(_evas_device_name_get(obj)); + } + + [DllImport(Libraries.Evas)] + internal static extern void evas_font_path_global_clear(); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_above_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_event_callback_priority_add(IntPtr obj, ObjectCallbackType type, ObjectCallbackPriority priority, EventCallback func, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_focus_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_freeze_events_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern int evas_object_layer_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_callback_priority_add(IntPtr obj, string eventName, ObjectCallbackPriority priority, EventCallback func, IntPtr data); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_smart_clipped_smart_set(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_table_homogeneous_set(IntPtr obj, TableHomogeneousMode mode); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_table_pack(IntPtr obj, IntPtr child, uint col, uint row, uint colspan, uint rowspan); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_table_padding_set(IntPtr obj, int horizontal, int vertical); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_filter_program_set(IntPtr obj, string program); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_glow_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_outline_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_shadow_color_set(IntPtr obj, int r, int g, int b, int a); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_text_style_set(IntPtr obj, TextStyleType type); + + [DllImport(Libraries.Evas)] + internal static extern bool evas_object_textblock_line_number_geometry_get(IntPtr obj, int line, out int x, out int y, out int w, out int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_textblock_valign_set(IntPtr obj, double align); + + [DllImport(Libraries.Evas)] + internal static extern int evas_string_char_len_get(string str); + + [DllImport(Libraries.Evas)] + internal static extern int evas_textblock_style_free(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_textblock_style_new(); + + [DllImport(Libraries.Evas)] + internal static extern void evas_textblock_style_set(IntPtr obj, string text); + + [DllImport(Libraries.Evas)] + internal static extern string evas_textblock_text_markup_to_utf8(IntPtr obj, string text); + + [DllImport(Libraries.Evas)] + internal static extern string evas_textblock_text_utf8_to_markup(IntPtr obj, string text); + + [DllImport(Libraries.Evas)] + internal static extern void evas_obscured_rectangle_add(IntPtr obj, int x, int y, int w, int h); + + [DllImport(Libraries.Evas)] + internal static extern void evas_render(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_norender(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern int evas_image_cache_get(IntPtr obj); + + [DllImport(Libraries.Evas)] + internal static extern void evas_font_path_global_prepend(string path); + + [DllImport(Libraries.Evas)] + internal static extern void evas_color_argb_unpremul(int a, ref int r, ref int g, ref int b); + + [DllImport(Libraries.Evas)] + internal static extern void evas_color_hsv_to_rgb(int r, int g, int b, out float h, out float s, out float v); + + [DllImport(Libraries.Evas)] + internal static extern void evas_color_rgb_to_hsv(float h, float s, float v, out int r, out int g, out int b); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_stack_below(IntPtr obj, IntPtr below); + + [DllImport(Libraries.Evas)] + internal static extern void evas_object_size_hint_aspect_get(IntPtr obj, out int aspect, out int w, out int h); + + internal static void SetX(IntPtr obj, int x) + { + int y = GetY(obj); + evas_object_move(obj, x, y); + } + + internal static void SetY(IntPtr obj, int y) + { + int x = GetX(obj); + evas_object_move(obj, x, y); + } + + internal static void SetWidth(IntPtr obj, int w) + { + int h = GetHeight(obj); + evas_object_resize(obj, w, h); + } + + internal static void SetHeight(IntPtr obj, int h) + { + int w = GetWidth(obj); + evas_object_resize(obj, w, h); + } + + internal static int GetX(IntPtr obj) + { + int x; + evas_object_geometry_get(obj, out x, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + return x; + } + + internal static int GetY(IntPtr obj) + { + int y; + evas_object_geometry_get(obj, IntPtr.Zero, out y, IntPtr.Zero, IntPtr.Zero); + return y; + } + + internal static int GetWidth(IntPtr obj) + { + int w; + evas_object_geometry_get(obj, IntPtr.Zero, IntPtr.Zero, out w, IntPtr.Zero); + return w; + } + + internal static int GetHeight(IntPtr obj) + { + int h; + evas_object_geometry_get(obj, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out h); + return h; + } + + internal static double GetAlignX(IntPtr obj) + { + double x; + evas_object_size_hint_align_get(obj, out x, IntPtr.Zero); + return x; + } + + internal static double GetAlignY(IntPtr obj) + { + double y; + evas_object_size_hint_align_get(obj, IntPtr.Zero, out y); + return y; + } + + internal static void SetAlignX(IntPtr obj, double x) + { + double y = GetAlignY(obj); + evas_object_size_hint_align_set(obj, x, y); + } + + internal static void SetAlignY(IntPtr obj, double y) + { + double x = GetAlignX(obj); + evas_object_size_hint_align_set(obj, x, y); + } + + internal static double GetWeightX(IntPtr obj) + { + double x; + evas_object_size_hint_weight_get(obj, out x, IntPtr.Zero); + return x; + } + + internal static double GetWeightY(IntPtr obj) + { + double y; + evas_object_size_hint_weight_get(obj, IntPtr.Zero, out y); + return y; + } + + internal static void SetWeightX(IntPtr obj, double x) + { + double y = GetWeightY(obj); + evas_object_size_hint_weight_set(obj, x, y); + } + + internal static void SetWeightY(IntPtr obj, double y) + { + double x = GetWeightX(obj); + evas_object_size_hint_weight_set(obj, x, y); + } + + internal static int GetAlpha(IntPtr obj) + { + int a; + evas_object_color_get(obj, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, out a); + return a; + } + + internal static void SetAlpha(IntPtr obj, int a) + { + evas_object_color_set(obj, a, a, a, a); + } + + internal static void SetPremultipliedColor(IntPtr obj, int r, int g, int b, int a) + { + evas_object_color_set(obj, r * a / 255, g * a / 255, b * a / 255, a); + } + } +} diff --git a/src/ElmSharp/Interop/Interop.Libc.cs b/src/ElmSharp/Interop/Interop.Libc.cs new file mode 100644 index 0000000..1e29684 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Libc.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + + // Broken-down time is stored in the structure tm which is defined in as follows: + [StructLayout(LayoutKind.Sequential)] + internal struct SystemTime + { + public int tm_sec; + public int tm_min; + public int tm_hour; + public int tm_mday; + public int tm_mon; + public int tm_year; + public int tm_wday; + public int tm_yday; + public int tm_isdst; + + // The glibc version of struct tm has additional fields + public long tm_gmtoff; + public IntPtr tm_zone; + + public static implicit operator SystemTime(DateTime value) + { + SystemTime tm = new SystemTime(); + tm.tm_sec = value.Second; + tm.tm_min = value.Minute; + tm.tm_hour = value.Hour; + tm.tm_mday = value.Day; + tm.tm_mon = value.Month - 1; + tm.tm_year = value.Year - 1900; + tm.tm_wday = (int)value.DayOfWeek; + tm.tm_yday = value.DayOfYear; + tm.tm_isdst = value.IsDaylightSavingTime() ? 1 : 0; + return tm; + } + + public static implicit operator DateTime(SystemTime value) + { + DateTime date = new DateTime(value.tm_year + 1900, value.tm_mon + 1, value.tm_mday, value.tm_hour, value.tm_min, value.tm_sec); + return date; + } + } + } +} diff --git a/src/ElmSharp/Interop/Interop.Libdl.cs b/src/ElmSharp/Interop/Interop.Libdl.cs new file mode 100644 index 0000000..4f233f8 --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Libdl.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libdl + { + private const int RTLD_NOW = 2; + + [DllImport(Libraries.Libdl)] + private static extern IntPtr dlopen(string filename, int flags); + + [DllImport(Libraries.Libdl)] + private static extern int dlclose(IntPtr handle); + + [DllImport(Libraries.Libdl)] + private static extern IntPtr dlsym(IntPtr handle, string symbol); + + [DllImport(Libraries.Libdl)] + private static extern IntPtr dlerror(); + + internal static IntPtr LoadLibrary(string filename) + { + return dlopen(filename, RTLD_NOW); + } + + internal static void FreeLibrary(IntPtr handle) + { + dlclose(handle); + } + + internal static IntPtr GetProcAddress(IntPtr handle, string name) + { + dlerror(); + var res = dlsym(handle, name); + var errPtr = dlerror(); + if (errPtr != IntPtr.Zero) + { + throw new Exception("dlsym : " + Marshal.PtrToStringAnsi(errPtr)); + } + return res; + } + } +} diff --git a/src/ElmSharp/Interop/Interop.Libraries.cs b/src/ElmSharp/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..7f1ca6a --- /dev/null +++ b/src/ElmSharp/Interop/Interop.Libraries.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static class Libraries + { + internal const string Libc = "libc.so.6"; + internal const string Libdl = "libdl.so.2"; + internal const string Evas = "libevas.so.1"; + internal const string Elementary = "libelementary.so.1"; + internal const string Eina = "libeina.so.1"; + internal const string Ecore = "libecore.so.1"; + internal const string EcoreInput = "libecore_input.so.1"; + internal const string Eo = "libeo.so.1"; + internal const string Eext = "libefl-extension.so.0"; + } +} diff --git a/src/Tizen.Account.AccountManager/Interop/Interop.Account.cs b/src/Tizen.Account.AccountManager/Interop/Interop.Account.cs new file mode 100644 index 0000000..9789044 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Interop/Interop.Account.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Account.AccountManager; +/// +/// Interop for Account class APIs +/// +/// 3 +internal static partial class Interop +{ + /// + /// Interop for Account class APIs + /// + /// 3 + internal static partial class Account + { + [DllImport(Libraries.AccountSvc, EntryPoint = "account_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountId(IntPtr data, out int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserName(IntPtr data, out string userName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserName(IntPtr handle, string userName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountDisplayName(IntPtr handle, out string displayName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountDisplayName(IntPtr handle, string displayName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCapability(IntPtr handle, string capabilityType, out int capabilityValue); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_capability", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountCapability(IntPtr handle, string capabilityType, int capabilityValue); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountIconPath(IntPtr handle, string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_domain_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountDomainName(IntPtr handle, out string domainName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_domain_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountDomainName(IntPtr handle, string domainName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_email_address", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountEmail(IntPtr handle, out string email); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_email_address", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountEmail(IntPtr handle, string email); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountPackageName(IntPtr handle, out string name); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountPackageName(IntPtr handle, string name); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_access_token", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountAccessToken(IntPtr handle, out string accessToken); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_access_token", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountAccessToken(IntPtr handle, string accessToken); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_text", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserText(IntPtr handle, int index, out string userText); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_text", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserText(IntPtr handle, int index, string userText); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_user_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountUserInt(IntPtr handle, int index, out int value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_user_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountUserInt(IntPtr handle, int index, int value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_auth_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountAuthType(IntPtr handle, out int authType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_auth_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountAuthType(IntPtr handle, int authType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_secret", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSercet(IntPtr handle, out int secretType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_secret", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSecret(IntPtr handle, int secretType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_sync_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSyncSupport(IntPtr handle, out int syncType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_sync_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSyncSupport(IntPtr handle, int syncType); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_source", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountSource(IntPtr handle, out string source); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_source", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountSource(IntPtr handle, string source); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCustomValue(IntPtr handle, string key, out string value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_set_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SetAccountCustomValue(IntPtr handle, string key, string value); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountSyncStatusById(int accountId, int status); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_capability_all")] + internal static extern int GetAllAccountCapabilities(IntPtr handle, AccountCapabilityCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id")] + internal static extern int QueryAccountCapabilityById(AccountCapabilityCallback callback, int accountId, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_custom_all")] + internal static extern int GetAllAccountCustomValues(IntPtr handle, AccountCustomCallback callback, IntPtr userData); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCapabilityCallback(string capabilityType, int capabilityState, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCustomCallback(string key, string value, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountCallback(IntPtr data, IntPtr userData); + } +} diff --git a/src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs b/src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs new file mode 100644 index 0000000..f201061 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Interop/Interop.AccountProvider.cs @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Account.AccountManager; + +/// +/// Interop for AccountProvider class APIs +/// +/// 3 +internal static partial class Interop +{ + /// + /// Interop for AccountProvider class APIs + /// + /// 3 + internal static partial class AccountProvider + { + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_app_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAppId(IntPtr handle, out string appId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_supported_feature", CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsFeatureSupported(string appId, string capability); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_service_provider_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetServiceProviderId(IntPtr handle, out string providerId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountProviderIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_small_icon_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountProviderSmallIconPath(IntPtr handle, out string iconPath); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_multiple_account_support", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetMultipleAccountSupport(IntPtr handle, out int suppport); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label_by_locale", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetlabelbyLocale(IntPtr handle, string locale, out string label); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_app_id_exist", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAppIdExists(string appId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAllAccountProviders(AccountProviderCallback callback, IntPtr data); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_provider_feature_by_app_id")] + internal static extern int GetAccountProviderFeaturesByAppId(AccountProviderFeatureCallback callback, string appId, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_provider_feature_all")] + internal static extern int GetAccountProviderFeatures(IntPtr handle, AccountProviderFeatureCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_get_label")] + internal static extern int GetAccountProviderLabels(IntPtr handle, LabelCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_label_by_app_id")] + internal static extern int GetLablesByAppId(LabelCallback callback, string appId, IntPtr userData); + + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountProviderFeatureCallback(string appId, string key, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AccountProviderCallback(IntPtr handle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool LabelCallback(string appId, string label, string locale, IntPtr user_data); + + } +} diff --git a/src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs b/src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs new file mode 100644 index 0000000..7bb1275 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Interop/Interop.AccountService.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Interop for Account class APIs +/// +/// 3 +internal static partial class Interop +{ + /// + /// Interop for Account class APIs + /// + /// 3 + internal static partial class AccountService + { + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountToDBById(IntPtr handle, int id); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_to_db_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountToDBByUserName(IntPtr handle, string userName, string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountById(int accountId, out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountByUserName(Interop.Account.AccountCallback callback, string userName, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountByPackageName(Interop.Account.AccountCallback callback, string packageName, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_capability_by_account_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int QueryAccountCapabilityById(Interop.Account.AccountCapabilityCallback callback, int accoutId, IntPtr data); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_update_sync_status_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UpdateAccountSyncStatusById(int accoutId, int status); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_insert_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int AddAccount(IntPtr handle, out int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountById(int accountId); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_user_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountByUser(string userName, string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_delete_from_db_by_package_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeleteAccountByPackage(string packageName); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_get_total_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetAccountCount(out int count); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_foreach_account_from_db")] + internal static extern int AccountForeachAccountFromDb(Interop.Account.AccountCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability")] + internal static extern int GetAccountByCapability(Interop.Account.AccountCallback callback, string capabilityType, int value, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_query_account_by_capability_type")] + internal static extern int GetAccountByCapabilityType(Interop.Account.AccountCallback callback, string capabilityType, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_foreach_account_type_from_db")] + internal static extern int GetAllAccountproviders(Interop.AccountProvider.AccountProviderCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_provider_feature")] + internal static extern int GetAccountProviderByFeature(Interop.AccountProvider.AccountProviderCallback callback, string key, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_type_query_by_app_id")] + internal static extern int GetAccountProviderByAppId(string appId, out IntPtr handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_create")] + internal static extern int CreateAccountSubscriber(out Interop.AccountService.SafeAccountSubscriberHandle handle); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_subscribe_notification")] + internal static extern int RegisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle, Interop.AccountService.SubscribeCallback callback, IntPtr userData); + + [DllImport(Libraries.AccountSvc, EntryPoint = "account_unsubscribe_notification")] + internal static extern int UnregisterSubscriber(Interop.AccountService.SafeAccountSubscriberHandle handle); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SubscribeCallback(string eventType, int accountId, IntPtr userData); + + internal sealed class SafeAccountSubscriberHandle : SafeHandle + { + public SafeAccountSubscriberHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs b/src/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f1530bd --- /dev/null +++ b/src/Tizen.Account.AccountManager/Interop/Interop.Libraries.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// Interop for Library reference +/// +/// 3 +internal static partial class Interop +{ + /// + /// Interop for Library reference + /// + /// 3 + internal static partial class Libraries + { + public const string AccountSvc = "libaccounts-svc.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.sln b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.sln new file mode 100755 index 0000000..4ea5304 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Account.AccountManager", "Tizen.Account.AccountManager.csproj", "{A7594F6F-E28C-475E-B614-9596C140A2E7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{BB293E56-D739-4B0A-B27B-F4FC8AD7832F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{7B75CA54-AA68-425B-86E2-B550D8F9BA4C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A7594F6F-E28C-475E-B614-9596C140A2E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7594F6F-E28C-475E-B614-9596C140A2E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7594F6F-E28C-475E-B614-9596C140A2E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7594F6F-E28C-475E-B614-9596C140A2E7}.Release|Any CPU.Build.0 = Release|Any CPU + {BB293E56-D739-4B0A-B27B-F4FC8AD7832F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB293E56-D739-4B0A-B27B-F4FC8AD7832F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB293E56-D739-4B0A-B27B-F4FC8AD7832F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB293E56-D739-4B0A-B27B-F4FC8AD7832F}.Release|Any CPU.Build.0 = Release|Any CPU + {7B75CA54-AA68-425B-86E2-B550D8F9BA4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B75CA54-AA68-425B-86E2-B550D8F9BA4C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B75CA54-AA68-425B-86E2-B550D8F9BA4C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B75CA54-AA68-425B-86E2-B550D8F9BA4C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs new file mode 100644 index 0000000..df10a15 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/Account.cs @@ -0,0 +1,619 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.AccountManager +{ + /// + /// Represents the Account Information. + /// + /// 3 + public class Account : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + internal Account(IntPtr handle) + { + Handle = handle; + } + + ~Account() + { + Dispose(false); + } + /// + /// Creates a new Account instance. + /// + /// 3 + /// Account Instance. + public static Account CreateAccount() + { + IntPtr handle; + AccountError err = (AccountError)Interop.Account.Create(out handle); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to create new error."); + } + + return new Account(handle); + } + + /// + /// Id of the Account. + /// + /// 3 + /// Account Id shall be created only when account is added to the database. + public int AccountId + { + get + { + int id = 0; + AccountError res = (AccountError)Interop.Account.GetAccountId(_handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get Id for the Account"); + } + + return id; + } + } + + /// + /// UserName of the Account. + /// + /// 3 + /// User Name of the Account. + public string UserName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountUserName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get UserName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountUserName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set UserName for Account"); + } + } + } + + /// + /// Display Name of the Account. + /// + /// 3 + /// DisplayName of the Account. + public string DisplayName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountDisplayName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get DisplayName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountDisplayName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set DisplayName for Account"); + } + } + } + + /// + /// Icon path of the Account. + /// + /// 3 + /// Icon path of the Account. + public string IconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.Account.GetAccountIconPath(_handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get IconPath for the Account"); + } + + return path; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountIconPath(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set IconPath for Account"); + } + } + } + + /// + /// Domain name of the Account. + /// + /// 3 + /// Domain name of the Account. + public string DomainName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountDomainName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get DomainName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountDomainName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set DomainName for Account"); + } + } + } + + /// + /// Email Id of the Account. + /// + /// 3 + /// Email Id of the Account. + public string EmailId + { + get + { + string email = ""; + AccountError res = (AccountError)Interop.Account.GetAccountEmail(_handle, out email); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get email for the Account"); + } + + return email; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountEmail(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set email for Account"); + } + } + } + + /// + /// Package Name of the Account. + /// + /// 3 + /// Package Name. + public string PackageName + { + get + { + string name = ""; + AccountError res = (AccountError)Interop.Account.GetAccountPackageName(_handle, out name); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get PacakageName for the Account"); + } + + return name; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountPackageName(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set PacakageName for Account"); + } + } + } + + /// + /// Access Token of the Account. + /// + /// 3 + /// Access Token. + public string AccessToken + { + get + { + string token = ""; + AccountError res = (AccountError)Interop.Account.GetAccountAccessToken(_handle, out token); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get token for the Account"); + } + + return token; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountAccessToken(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set token for Account"); + } + } + } + + /// + /// Authentication type of the Account. + /// + /// 3 + /// Authentication type. + public AccountAuthType AuthType + { + get + { + int user; + AccountError res = (AccountError)Interop.Account.GetAccountAuthType(_handle, out user); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AuthType for the Account"); + } + + return (AccountAuthType)user; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountAuthType(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set AuthType for Account"); + } + } + } + + /// + /// Secrecy State of the Account. + /// + /// 3 + /// Secrecy State. + public AccountSecrecyState SecrecyState + { + get + { + int state; + AccountError res = (AccountError)Interop.Account.GetAccountSercet(_handle, out state); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get User Secret for the Account"); + } + + return (AccountSecrecyState)state; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSecret(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set User Secret for Account"); + } + } + } + + /// + /// Sync State of the Account. + /// + /// 3 + /// Sync State. + public AccountSyncState SyncState + { + get + { + int supported; + AccountError res = (AccountError)Interop.Account.GetAccountSyncSupport(_handle, out supported); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AuthType for the Account"); + } + + return (AccountSyncState)supported; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSyncSupport(_handle, (int)value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set AuthType for Account"); + } + } + } + + /// + /// Source of the Account . + /// + /// 3 + /// Account Source. + public string Source + { + get + { + string text = ""; + AccountError res = (AccountError)Interop.Account.GetAccountSource(_handle, out text); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get User Secret for the Account"); + } + + return text; + } + + set + { + AccountError res = (AccountError)Interop.Account.SetAccountSource(_handle, value); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to Set User Secret for Account"); + } + } + } + + internal IntPtr Handle + { + get + { + return _handle; + } + + set + { + _handle = value; + } + } + /// + /// Sets the account capability. + /// + /// 3 + /// The Account capability type + /// The Account capability state + /// In case of invalid parameters + public void SetCapability(string capabilityType, CapabilityState state) + { + AccountError ret = (AccountError)Interop.Account.SetAccountCapability(_handle, capabilityType, (int)state); + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "failed to set account capability"); + } + } + /// + /// Gets all the capabilities of an account. + /// + /// 3 + /// The capability type to get the capability value. + /// The capability value (on/off) of the specified CapabilityState . + /// In case of invalid parameters + public CapabilityState GetCapability(string capabilityType) + { + int type; + AccountError res = (AccountError)Interop.Account.GetAccountCapability(_handle, capabilityType, out type); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetCapability for Account"); + } + + return (CapabilityState)type; + } + + /// + /// Gets all the capabilities of an account. + /// + /// 3 + /// List of Cpabailities as Dictionary + public Dictionary GetAllCapabilities() + { + + AccountError res = AccountError.None; + Dictionary list = new Dictionary(); + Interop.Account.AccountCapabilityCallback capabilityCallback = (string type, int state, IntPtr data) => + { + list.Add(type, (CapabilityState)state); + return true; + }; + + res = (AccountError)Interop.Account.GetAllAccountCapabilities(_handle, capabilityCallback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get account capabilities"); + } + + return list; + } + + /// + /// Sets the Custom Value to the Account. + /// + /// 3 + /// key to be added to the Account. + /// value to be updated for respective key for the Account. + /// In case of invalid parameters + public void SetCustomValue(string key, string value) + { + AccountError err = (AccountError)Interop.Account.SetAccountCustomValue(_handle, key, value); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to set the value for : " + key); + } + } + + /// + /// Gets the user specific custom text of an account key. + /// + /// 3 + /// The key to retrieve custom text . + /// The text of the given key + /// In case of invalid parameters + /// If there is no given capability type in the account + public string GetCustomValue(string key) + { + string result = ""; + AccountError err = (AccountError)Interop.Account.GetAccountCustomValue(_handle, key, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + key); + } + + return result; + } + + /// + /// Gets All the custome values. + /// + /// 3 + /// List of custom key, value pairs as Dictionary. + public Dictionary GetAllCustomValues() + { + AccountError res = AccountError.None; + Dictionary list = new Dictionary(); + + Interop.Account.AccountCustomCallback customCallback = (string key, string value, IntPtr data) => + { + list.Add(key, value); + return true; + }; + + res = (AccountError)Interop.Account.GetAllAccountCustomValues(_handle, customCallback, IntPtr.Zero); + + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get account capabilities"); + } + + return list; + } + + /// + /// Sets the user text. + /// + /// 3 + /// The index of the user text (must be in range from 0 to 4) + /// The text string to set as the user text + /// In case of invalid parameters + public void SetUserText(int index, string text) + { + AccountError err = (AccountError)Interop.Account.SetAccountUserText(_handle, index, text); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + } + + /// + /// Gets the user text. + /// + /// 3 + /// The index of the user text (range: 0 ~ 4) + /// The user text of the given key + /// In case of invalid parameters + /// In case of out of memory + public string GetUserText(int index) + { + string result = ""; + AccountError err = (AccountError)Interop.Account.GetAccountUserText(_handle, index, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + + return result; + } + + /// + /// Gets the user int value. + /// + /// 3 + /// The index of the user int (range: 0 ~ 4) + /// The user int of the given key + /// In case of invalid parameters + public int GetUserInt(int index) + { + int result = -1; + AccountError err = (AccountError)Interop.Account.GetAccountUserInt(_handle, index, out result); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + + return result; + } + + /// + /// Sets the user integer value. + /// + /// 3 + /// The index of the user integer (must be in range from 0 to 4) + /// The integer to set as the user integer + /// In case of invalid parameters + public void SetUserInt(int index, int value) + { + AccountError err = (AccountError)Interop.Account.SetAccountUserInt(_handle, index, value); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to get the value for : " + index); + } + } + + /// + /// Overloaded Dispose API for destroying the Account Handle. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (!disposing) + { + if (_handle != IntPtr.Zero) + { + _handle = IntPtr.Zero; + } + } + } + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs new file mode 100644 index 0000000..b55a458 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountEnums.cs @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.AccountManager +{ + /// + /// Enumeration for the state of capability + /// + /// 3 + public enum CapabilityState + { + /// + /// Account capability is invalid + /// + /// 3 + InvalidState, + + /// + /// Account capability is disabled + /// + /// 3 + Disabled, + + /// + /// Account capability is enabled + /// + /// 3 + Enabled + } + + /// + /// Enumeration for the state of account secrecy. + /// + public enum AccountSecrecyState + { + /// + /// Account secrecy is invalid + /// + /// 3 + InvalidState, + + /// + /// Account is not visible + /// + /// 3 + Invisible, + + /// + /// Account is visible + /// + /// 3 + Visible + } + + /// + /// Enumeration for the account sync status. + /// + /// 3 + public enum AccountSyncState + { + /// + /// Account sync is invalid + /// + /// 3 + InvalidState, + + /// + /// Account sync not supported + /// + /// 3 + NotSupported, + + /// + /// Account sync supported but all synchronization functionalities are off + /// + /// 3 + Off, + + /// + /// Account sync support and sync status is idle + /// + /// 3 + Idle, + + /// + /// Account sync support and sync status is running + /// + /// 3 + Running + } + + /// + /// Enumeration for the account auth type. + /// + /// 3 + public enum AccountAuthType + { + /// + /// Auth type is invalid + /// + /// 3 + Invalid, + + /// + /// XAuth type + /// + /// 3 + XAuth, + + /// + /// OAuth type + /// + /// 3 + OAuth, + + /// + /// Client-Login type + /// + /// 3 + ClientLogin + } + + /// + /// Account information change notification type + /// + /// 3 + /// + /// When the account database is changed, You can distinguish one event type from the other which are set for subscribing notification. + /// + public enum AccountNotificationType + { + /// + /// The insert notification type. + /// + /// 3 + Insert, + /// + /// The delete notification type. + /// + /// 3 + Delete, + /// + /// The update notification type. + /// + /// 3 + Update, + /// + /// The sync update notification type. + /// + /// 3 + syncUpdate + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs new file mode 100644 index 0000000..48f9164 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountErrorFactory.cs @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen; + +namespace Tizen.Account.AccountManager +{ + /// + /// Enum to give the type of error occured, if any. + /// + /// 3 + public enum AccountError + { + //TIZEN_ERROR_ACCOUNT = -0x01000000 + /// + /// Successful. + /// + /// 3 + None = Tizen.Internals.Errors.ErrorCode.None, + /// + /// Invalid parameter. + /// + /// 3 + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + /// + /// Out of memory. + /// + /// 3 + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + /// + /// Same user name exists in your application + /// + /// 3 + Duplcated = -0x01000000 | 0x01, + /// + /// Empty Data + /// + /// 3 + NoData = Tizen.Internals.Errors.ErrorCode.NoData, + /// + /// elated record does not exist + /// + /// 3 + RecordNotFound = -0x01000000 | 0x03, + /// + /// Invalid Operation. + /// + /// 3 + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, + /// + /// DB operation failed. + /// + /// 3 + DBFailed = -0x01000000 | 0x04, + /// + /// DB is not connected. + /// + /// 3 + DBNotOpened = -0x01000000 | 0x05, + /// + /// DB query syntax error + /// + /// 3 + QuerySyntaxError = -0x01000000 | 0x06, + /// + /// Iterator has reached the end + /// + /// 3 + IteratorEnd = -0x01000000 | 0x07, + /// + /// Notification failed + /// + /// 3 + NotificationFailed = -0x01000000 | 0x08, + /// + /// Permission denied. + /// + /// 3 + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + /// + /// XML parse failed + /// + /// 3 + XMLParseFailed = -0x01000000 | 0x0a, + /// + /// XML File not found + /// + /// 3 + XMLFileNotFound = -0x01000000 | 0x0b, + /// + /// Subscription failed + /// + /// 3 + EventSubscriptionFailed = -0x01000000 | 0x0c, + /// + /// Account provider is not registered + /// + /// 3 + ProviderNotRegistered = -0x01000000 | 0x0d, + /// + /// Multiple accounts are not supported. + /// + /// 3 + MultipleNotAllowed = -0x01000000 | 0x0e, + /// + /// SQLite busy handler expired + /// + /// 3 + DBBusy = -0x01000000 | 0x10 + }; + + internal class AccountErrorFactory + { + internal const string LogTag = "Tizen.Account.AccountManager"; + + internal static Exception CreateException(AccountError err, string msg) + { + Log.Info(LogTag, "Got Error " + err + " throwing Exception with msg " + msg); + Exception exp; + switch (err) + { + case AccountError.InvalidParameter: + { + exp = new ArgumentException(msg + " Invalid Parameters Provided"); + break; + } + + case AccountError.OutOfMemory: + { + exp = new OutOfMemoryException(msg + " Out Of Memory"); + break; + } + + case AccountError.InvalidOperation: + { + exp = new InvalidOperationException(msg + " Inavlid operation"); + break; + } + + case AccountError.NoData: + { + exp = new InvalidOperationException(msg + " Empty Data"); + break; + } + + case AccountError.PermissionDenied: + { + exp = new UnauthorizedAccessException(msg + " Permission Denied"); + break; + } + + case AccountError.DBFailed: + { + exp = new InvalidOperationException(msg + " DataBase Failed"); + break; + } + + case AccountError.DBBusy: + { + exp = new InvalidOperationException(msg + " DataBase Busy"); + break; + } + + case AccountError.QuerySyntaxError: + { + exp = new InvalidOperationException(msg + " Network Error"); + break; + } + case AccountError.XMLFileNotFound: + { + exp = new System.IO.FileNotFoundException(msg + " XML File not found"); + break; + } + case AccountError.XMLParseFailed: + { + exp = new System.IO.InvalidDataException(msg + " XML parse error"); + break; + } + + default: + { + exp = new InvalidOperationException(err + " " + msg); + break; + } + } + + return exp; + } + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs new file mode 100644 index 0000000..606a286 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountProvider.cs @@ -0,0 +1,366 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Internals.Errors; + +namespace Tizen.Account.AccountManager +{ + /// + /// Account Id. + /// + /// 3 + public class AccountProvider : IDisposable + { + internal IntPtr _handle; + internal AccountProvider(IntPtr handle) + { + Handle = handle; + } + + ~AccountProvider() + { + Dispose(false); + } + + internal IntPtr Handle + { + get + { + return _handle; + } + + set + { + _handle = value; + } + } + /// + /// Account Id. + /// + /// 3 + public string AppId + { + get + { + string id = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAppId(Handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get AppId for the AccountProvider"); + } + + return id; + } + } + + /// + /// Serviceprovider Id of the account provider. + /// + /// 3 + public string ServiceProviderId + { + get + { + string id = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetServiceProviderId(Handle, out id); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get ServiceProviderId for the AccountProvider"); + } + + return id; + } + } + + /// + /// Icon path of an account provider. + /// + /// 3 + public string IconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAccountProviderIconPath(Handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get IconPath for the AccountProvider"); + } + + return path; + } + } + + /// + /// Small icon path of an account provider. + /// + /// 3 + public string SmallIconPath + { + get + { + string path = ""; + AccountError res = (AccountError)Interop.AccountProvider.GetAccountProviderSmallIconPath(Handle, out path); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get SmallIconPath for the AccountProvider"); + } + + return path; + } + } + + /// + /// Flag for account provider If supports multiple accounts. + /// + /// 3 + public bool MultipleAccountSupport + { + get + { + int multiple = 0; + AccountError res = (AccountError)Interop.AccountProvider.GetMultipleAccountSupport(Handle, out multiple); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get SmallIconPath for the AccountProvider"); + } + + return (multiple == 0) ? false : true; + } + } + + /// + /// Retrieves all the capability information of the account provider. + /// + /// 3 + /// http://tizen.org/privilege/account.read + /// + /// list of capability information. + /// + /// In case of any DB error + /// In case of privilege not defined. + public IEnumerable GetAllCapabilities() + { + List capabilities = new List(); + AccountError res; + Interop.AccountProvider.AccountProviderFeatureCallback callback = (string appId, string key, IntPtr data) => + { + capabilities.Add(key); + return true; + }; + + res = (AccountError)Interop.AccountProvider.GetAccountProviderFeatures(Handle, callback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetAllCapabilities for AccountProvider"); + } + + return capabilities; + } + + /// + /// Gets the specific label information detail of an account provider. + /// + /// 3 + /// + /// The locale is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" or "ko-kr" for Korean, "en_US" or "en-us" for American English. + /// + /// The label text given for the locale + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given locale + /// In case of privilege not defined. + public string GetLabel(string locale) + { + string label; + AccountError res = (AccountError)Interop.AccountProvider.GetlabelbyLocale(Handle, locale, out label); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetLabel for AccountProvider"); + } + + return label; + } + + /// + /// Gets the specific label information detail of an account provider. + /// + /// 3 + /// + /// The application ID to search + /// + /// All the labels information for the given application Id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static Dictionary GetLabelsByAppId(string appId) + { + + Dictionary labels = new Dictionary(); + Interop.AccountProvider.LabelCallback callback = (string applicationId, string label, string locale, IntPtr userData) => + { + labels.Add(locale, label); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetLablesByAppId(callback, appId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetLablesByAppId"); + } + + return labels; + } + + /// + /// Gets the label information detail of an account provider. + /// + /// 3 + /// All the labels information for the given account provider. + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public Dictionary GetLabels() + { + + Dictionary labels = new Dictionary(); + Interop.AccountProvider.LabelCallback callback = (string applicationId, string label, string locale, IntPtr userData) => + { + labels.Add(locale, label); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetAccountProviderLabels(Handle, callback, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderLabels"); + } + + return labels; + } + + /// + /// Checks whether the given appId exists in the account provider DB. + /// + /// 3 + /// The application ID to check. + /// returns true If App is supported + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public bool IsAppSupported(string appId) + { + bool isSupported = false; + AccountError res = (AccountError)Interop.AccountProvider.GetAppIdExists(appId); + + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to GetLabel for AccountProvider"); + } + else + { + isSupported = true; + } + + return isSupported; + } + + /// + /// Checks whether the given application ID supports the capability. + /// + /// 3 + /// The application Id + /// The capability information + /// + /// TRUE if the application supports the given capability, + /// otherwise FALSE if the application does not support the given capability + /// + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static bool IsFeatureSupportedByApp(string appId, string capability) + { + bool supported = Interop.AccountProvider.IsFeatureSupported(appId, capability); + if (!supported) + { + //Get last result and validate error code. + AccountError err = (AccountError)ErrorFacts.GetLastResult(); + if ((err != AccountError.None) && (err != AccountError.RecordNotFound)) + { + throw AccountErrorFactory.CreateException(err, "Failed to get IsFeatureSupported"); + } + } + + return supported; + } + + /// + /// Retrieves capability information with application ID. + /// + /// 3 + /// application Id + /// Capability information list for the given appId. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetFeaturesByAppId(string appId) + { + + List features = new List(); + Interop.AccountProvider.AccountProviderFeatureCallback callback = (string applicationId, string key, IntPtr userData) => + { + features.Add(key); + return true; + }; + + AccountError err = (AccountError)Interop.AccountProvider.GetAccountProviderFeaturesByAppId(callback, appId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderFeaturesByAppId"); + } + + return (IEnumerable)features; + } + + /// + /// Overloaded Dispose API for destroying the AccountProvider Handle. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (!disposing) + { + if (_handle != IntPtr.Zero) + { + Interop.AccountProvider.Destroy(_handle); + _handle = IntPtr.Zero; + } + } + } + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs new file mode 100644 index 0000000..fc7cbd4 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountService.cs @@ -0,0 +1,606 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.AccountManager +{ + /// + /// The AccountManager APIs is separated into two major sections: + /// 1. Registering an account provider while an application is installed. This information will be used for the Add account screen. + /// 2. Adding an account information when an application signs in successfully to share the account information to the Tizen system. This information will be shown in the Tizen settings account menu. + /// + /// The APIs of both of the sections consist of the following functionality: + /// + /// Create an account or account provider + /// Update an account or account provider(Only available for the creator) + /// Delete an account or account provider(Only available for the creator) + /// Read an account or account provider with some filter + /// + /// + /// 3 + + public static class AccountService + { + /// + /// This is contact capability string. + /// + /// 3 + public static readonly string ContactCapability = "http://tizen.org/account/capability/contact"; + + /// + /// This is calendar capability string. + /// + /// 3 + public static readonly string CalendarCapability = "http://tizen.org/account/capability/calendar"; + + /// + /// This is email capability string. + /// + /// 3 + public static readonly string EmailCapability = "http://tizen.org/account/capability/email"; + + /// + /// This is photo capability string. + /// + /// 3 + public static readonly string PhotoCapability = "http://tizen.org/account/capability/photo"; + + /// + /// This is video capability string. + /// + /// 3 + public static readonly string VideoCapability = "http://tizen.org/account/capability/video"; + + /// + /// This is music capability string. + /// + /// 3 + public static readonly string MusicCapability = "http://tizen.org/account/capability/music"; + + /// + /// This is document capability string. + /// + /// 3 + public static readonly string DocumentCapability = "http://tizen.org/account/capability/document"; + + /// + /// This is message capability string. + /// + /// 3 + public static readonly string MessageCapability = "http://tizen.org/account/capability/message"; + + /// + /// This is game capability string. + /// + /// 3 + public static readonly string GameCapability = "http://tizen.org/account/capability/game"; + + /// + /// Retrieves all accounts details from the account database. + /// + /// 3 + /// List of Accounts + /// http://tizen.org/privilege/account.read + /// In case of any DB error. + /// In case of privilege not defined. + public static IEnumerable GetAccountsAsync() + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr data, IntPtr userdata) => + { + Account account = new Account(data); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError res = (AccountError)Interop.AccountService.AccountForeachAccountFromDb(accountCallback, IntPtr.Zero); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to AccountForeachAccountFromDb"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieve an account with the account ID. + /// + /// 3 + /// The account Id to be searched. + /// Account instance with reference to the given id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given account id + /// In case of invalid parameter + /// In case of privilege not defined. + public static Account GetAccountById(int accountId) + { + Account account = Account.CreateAccount(); + IntPtr handle = account.Handle; + AccountError res = (AccountError)Interop.AccountService.QueryAccountById(accountId, out handle); + if (res != AccountError.None) + { + throw AccountErrorFactory.CreateException(res, "Failed to get accounts from the database for account id: " + accountId); + } + + account.Handle = handle; + return account; + } + + /// + /// Retrieves all AccountProviders details from the account database. + /// + /// 3 + /// List of AccountProviders + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public static IEnumerable GetAccountProviders() + { + List values = new List(); + List providers = new List(); + Interop.AccountProvider.AccountProviderCallback accountCallback = (IntPtr handle, IntPtr data) => + { + AccountProvider provider = new AccountProvider(handle); + values.Add(provider.AppId); + provider.Dispose(); + return true; + }; + + AccountError res = (AccountError)Interop.AccountService.GetAllAccountproviders(accountCallback, IntPtr.Zero); + if (res != AccountError.None) + { + Log.Warn(AccountErrorFactory.LogTag, "Failed to get account providers from the database"); + throw AccountErrorFactory.CreateException(res, "Failed to get account providers from the database"); + } + + foreach (string val in values) + { + AccountProvider provider = GetAccountProviderByAppId(val); + providers.Add(provider); + } + + return providers; + } + + /// + /// Retrieves the account provider information with application Id. + /// + /// 3 + /// Application Id. + /// The AccountProvider instance associated with the given application Id. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given appid + /// In case of invalid parameter + /// In case of privilege not defined. + public static AccountProvider GetAccountProviderByAppId(string appId) + { + IntPtr handle; + Interop.AccountProvider.Create(out handle); + AccountError err = (AccountError)Interop.AccountService.GetAccountProviderByAppId(appId, out handle); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderByAppId"); + } + + AccountProvider provider = new AccountProvider(handle); + return provider; + } + + /// + /// Retrieves all the account providers information with feature. + /// + /// 3 + /// The capability value to search for account providers. + /// Retrieves AccountProviders information with the capability name. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given feature + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountProvidersByFeature(string feature) + { + List values = new List(); + List providers = new List(); + Interop.AccountProvider.AccountProviderCallback providerCallback = (IntPtr handle, IntPtr data) => + { + AccountProvider provider = new AccountProvider(handle); + values.Add(provider.AppId); + provider.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.GetAccountProviderByFeature(providerCallback, feature, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderByFeature"); + } + + foreach (string val in values) + { + AccountProvider provider = GetAccountProviderByAppId(val); + providers.Add(provider); + } + + return providers; + } + + /// + /// Inserts into the Database with the new account Infomration. + /// + /// 3 + /// New Account instance to be added. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + /// In case of OutOfMemory error. + public static int AddAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to AddAccount"); + } + + int id = -1; + AccountError err = (AccountError)Interop.AccountService.AddAccount(account.Handle, out id); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to AddAccount"); + } + + return id; + } + + /// + /// Updates the account details to the account database. + /// + /// 3 + /// account instance to be updated. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + /// In case of OutOfMemory error. + public static void UpdateAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to UpdateAccount"); + } + + AccountError err = (AccountError)Interop.AccountService.UpdateAccountToDBById(account.Handle, account.AccountId); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to UpdateAccount"); + } + } + + /// + /// Deletes the account information from the Database. + /// + /// 3 + /// Account instance to be deleted from the database. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(Account account) + { + if (account == null) + { + throw AccountErrorFactory.CreateException(AccountError.InvalidParameter, "Failed to DeleteAccount"); + } + + AccountError err = (AccountError)Interop.AccountService.DeleteAccountById(account.AccountId); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by Id: " + account.AccountId); + } + } + + /// + /// Deletes an account from the account database by user name. + /// + /// 3 + /// The user name of the account to delete. + /// The package name of the account to delete. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(string userName, string packageName) + { + AccountError err = (AccountError)Interop.AccountService.DeleteAccountByUser(userName, packageName); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by userName: " + userName); + } + } + + /// + /// Deletes an account from the account database by package name. + /// + /// 3 + /// The package name of the account to delete. + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void DeleteAccount(string packageName) + { + AccountError err = (AccountError)Interop.AccountService.DeleteAccountByPackage(packageName); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to delete the account by package name: " + packageName); + } + + } + + /// + /// Retrieves all accounts with the given user name. + /// + /// 3 + /// The user name to search . + /// Accounts list matched with the user name + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given username + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByUserName(string userName) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountByUserName(accountCallback, userName, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByUserName"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all accounts with the given package name. + /// + /// 3 + /// The package name to Search + /// Accounts list matched with the package name + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given package name + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByPackageName(string packageName) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountByPackageName(accountCallback, packageName, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByPackageName"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all accounts with the given cpability type. + /// + /// 3 + /// Capability type + /// Accounts list matched with the capability type + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given capability type + /// In case of invalid parameter + /// In case of privilege not defined. + public static IEnumerable GetAccountsByCapabilityType(string type) + { + List accounts = new List(); + List values = new List(); + Interop.Account.AccountCallback accountCallback = (IntPtr handle, IntPtr data) => + { + Account account = new Account(handle); + values.Add(account.AccountId); + account.Dispose(); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.GetAccountByCapabilityType(accountCallback, type, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountByCapabilityType"); + } + + foreach (int i in values) + { + Account account = AccountService.GetAccountById(i); + accounts.Add(account); + } + + return accounts; + } + + /// + /// Retrieves all capabilities with the given account + /// + /// 3 + /// account instance + /// Capabilities list as Dictionary of Capability type and State. + /// http://tizen.org/privilege/account.read + /// In case of any DB error or record not found for given account id + /// In case of invalid parameter + /// In case of privilege not defined. + public static Dictionary GetCapabilitiesById(int accountId) + { + Dictionary capabilities = new Dictionary(); + Interop.Account.AccountCapabilityCallback capabilityCallback = (string type, int capabilityState, IntPtr data) => + { + capabilities.Add(type, (CapabilityState)capabilityState); + return true; + }; + + AccountError err = (AccountError)Interop.AccountService.QueryAccountCapabilityById(capabilityCallback, accountId, IntPtr.Zero); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAllCapabilitiesById"); + } + + return capabilities; + } + + /// + /// Gets the count of accounts in the account database. + /// + /// 3 + /// The number of accounts in the database + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of privilege not defined. + public static int GetAccountsCount() + { + int count = 0; + AccountError err = (AccountError)Interop.AccountService.GetAccountCount(out count); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to GetAccountCount"); + } + + return count; + } + + /// + /// Updates the sync status of the given account. + /// + /// 3 + /// Account for which sync status needs to be updated + /// Sync State + /// http://tizen.org/privilege/account.read + /// http://tizen.org/privilege/account.write + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static void UpdateSyncStatusById(Account account, AccountSyncState status) + { + AccountError err = (AccountError)Interop.AccountService.UpdateAccountSyncStatusById(account.AccountId, (int)status); + if (err != AccountError.None) + { + throw AccountErrorFactory.CreateException(err, "Failed to UpdateSyncStatusById"); + } + } + + private static readonly Interop.AccountService.SubscribeCallback s_accountUpdatedCallback = (string eventType, int accountId, IntPtr userData) => + { + AccountSubscriberEventArgs eventArgs = new AccountSubscriberEventArgs(eventType, accountId); + s_accountUpdated?.Invoke(null, eventArgs); + return true; + }; + + private static Interop.AccountService.SafeAccountSubscriberHandle s_subscriberHandle; + + private static event EventHandler s_accountUpdated; + /// + /// ContentUpdated event is triggered when the media item info from DB changes. + /// + /// 3 + /// + /// ContentUpdate event is triggered if the MediaInformaion updated/deleted or new Inforamtion is Inserted. + /// + /// + /// A ContentUpdatedEventArgs object that contains information about the update operation. + /// http://tizen.org/privilege/account.read + /// In case of any DB error + /// In case of invalid parameter + /// In case of privilege not defined. + public static event EventHandler AccountUpdated + { + add + { + if (s_accountUpdated == null) + { + if (s_subscriberHandle == null) + { + Interop.AccountService.CreateAccountSubscriber(out s_subscriberHandle); + } + + AccountError ret = (AccountError)Interop.AccountService.RegisterSubscriber(s_subscriberHandle, s_accountUpdatedCallback, IntPtr.Zero); + + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "Error in callback handling"); + } + } + + s_accountUpdated += value; + } + + remove + { + s_accountUpdated -= value; + if (s_accountUpdated == null) + { + AccountError ret = (AccountError)Interop.AccountService.UnregisterSubscriber(s_subscriberHandle); + if (ret != AccountError.None) + { + throw AccountErrorFactory.CreateException(ret, "Error in callback handling"); + } + s_subscriberHandle = null; + } + } + } + + } +} diff --git a/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs new file mode 100644 index 0000000..153c427 --- /dev/null +++ b/src/Tizen.Account.AccountManager/Tizen.Account.AccountManager/AccountSubscriberEventArgs.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.AccountManager +{ + /// + /// Event arguments passed when Event is triggered to notify that account is updated/removed from the account database. + /// + /// 3 + public class AccountSubscriberEventArgs : EventArgs + { + private const string NotiInsert = "insert"; + private const string NotiDelete = "delete"; + private const string NotiUpdate = "update"; + private const string NotiSyncUpdate = "sync_update"; + internal AccountSubscriberEventArgs(string eventType, int accountId) + { + if (eventType.CompareTo(NotiInsert) == 0) + { + EventType = AccountNotificationType.Insert; + } + else if (eventType.CompareTo(NotiDelete) == 0) + { + EventType = AccountNotificationType.Delete; + } + else if (eventType.CompareTo(NotiUpdate) == 0) + { + EventType = AccountNotificationType.Update; + } + else if (eventType.CompareTo(NotiSyncUpdate) == 0) + { + EventType = AccountNotificationType.syncUpdate; + } + + AccountId = accountId; + } + + /// + /// The account event type + /// + /// 3 + public AccountNotificationType EventType + { + get; + internal set; + } + + /// + /// The account ID to update + /// + /// 3 + public int AccountId + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Account.FidoClient/Interop/Interop.Libc.cs b/src/Tizen.Account.FidoClient/Interop/Interop.Libc.cs new file mode 100755 index 0000000..13c7170 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Account.FidoClient/Interop/Interop.Libraries.cs b/src/Tizen.Account.FidoClient/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..955fffe --- /dev/null +++ b/src/Tizen.Account.FidoClient/Interop/Interop.Libraries.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + /// + /// Wrapper class for maintaining names of dependent native libraries. + /// + internal static partial class Libraries + { + public const string FidoClient = "libfido-client.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Authenticator.cs b/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Authenticator.cs new file mode 100755 index 0000000..7cbd9f9 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Authenticator.cs @@ -0,0 +1,68 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; + +internal static partial class Interop +{ + internal static partial class UafAuthenticator + { + [DllImport(Libraries.FidoClient, EntryPoint = "fido_foreach_authenticator")] + internal static extern int ForeachAuthenticator(FidoAuthenticatorCallback cb, IntPtr /* void */ userData); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_title")] + internal static extern int GetTitle(IntPtr /* fido_authenticator_h */ auth, out IntPtr title); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_aaid")] + internal static extern int GetAaid(IntPtr /* fido_authenticator_h */ auth, out IntPtr aaid); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_description")] + internal static extern int GetDescription(IntPtr /* fido_authenticator_h */ auth, out IntPtr desc); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_assertion_scheme")] + internal static extern int GetAssertionScheme(IntPtr /* fido_authenticator_h */ auth, out IntPtr scheme); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_algorithm")] + internal static extern int GetAlgorithm(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_algo_e */ algo); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_foreach_attestation_type")] + internal static extern int ForeachAttestationType(IntPtr /* fido_authenticator_h */ auth, FidoAttestationTypeCallback cb, IntPtr /* void */ userData); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_verification_method")] + internal static extern int GetVerificationMethod(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_user_verify_type_e */ userVerification); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_key_protection_method")] + internal static extern int GetKeyProtectionMethod(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_key_protection_type_e */ keyProtection); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_matcher_protection_method")] + internal static extern int GetMatcherProtectionMethod(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_matcher_protection_type_e */ matcherProtection); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_attachment_hint")] + internal static extern int GetAttachmentHint(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_attachment_hint_e */ attachmentHint); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_is_second_factor_only")] + internal static extern bool GetIsSecondFactorOnly(IntPtr /* fido_authenticator_h */ auth); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_tc_discplay")] + internal static extern int GetTcDiscplay(IntPtr /* fido_authenticator_h */ auth, out int /* fido_auth_tc_display_type_e */ tcDisplay); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_tc_display_type")] + internal static extern int GetTcDisplayType(IntPtr /* fido_authenticator_h */ auth, out IntPtr tcDisplayContentType); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_authenticator_get_icon")] + internal static extern int GetIcon(IntPtr /* fido_authenticator_h */ auth, out IntPtr icon); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void FidoAuthenticatorCallback(IntPtr /* fido_authenticator_h */ authInfo, IntPtr /* void */ userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void FidoAttestationTypeCallback(int /* fido_auth_attestation_type_e */ attType, IntPtr /* void */ userData); + } +} diff --git a/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Client.cs b/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Client.cs new file mode 100755 index 0000000..2c4072d --- /dev/null +++ b/src/Tizen.Account.FidoClient/Interop/Interop.Uaf.Client.cs @@ -0,0 +1,35 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; + +internal static partial class Interop +{ + internal static partial class UafClient + { + [DllImport(Libraries.FidoClient, EntryPoint = "fido_get_client_vendor")] + internal static extern int FidoGetClientVendor(out string vendorName); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_get_client_version")] + internal static extern int FidoGetClientVersion(out int clientMajorVersion, out int clientMinorVersion); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_uaf_is_supported")] + internal static extern int FidoUafIsSupported(string uafMessageJson, out bool isSupported); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_uaf_get_response_message")] + internal static extern int FidoUafGetResponseMessage(string uafRequestJson, string channelBinding, FidoUafResponseMessageCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.FidoClient, EntryPoint = "fido_uaf_set_server_result")] + internal static extern int FidoUafSetServerResult(int responseCode, string uafResponseJson); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void FidoUafResponseMessageCallback(int /* fido_error_e */ tizenErrorCode, string uafResponseJson, IntPtr /* void */ userData); + } +} diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.csproj b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.sln b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.sln new file mode 100755 index 0000000..a6baae6 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Account.FidoClient", "Tizen.Account.FidoClient.csproj", "{11ED0ABB-177B-434B-909C-14D589455779}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{89AE4C5A-07D4-476A-8E30-6B0502094C1E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B6FD3563-E050-43C1-BB6C-3728CBF5F8EA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {11ED0ABB-177B-434B-909C-14D589455779}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11ED0ABB-177B-434B-909C-14D589455779}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11ED0ABB-177B-434B-909C-14D589455779}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11ED0ABB-177B-434B-909C-14D589455779}.Release|Any CPU.Build.0 = Release|Any CPU + {89AE4C5A-07D4-476A-8E30-6B0502094C1E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89AE4C5A-07D4-476A-8E30-6B0502094C1E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89AE4C5A-07D4-476A-8E30-6B0502094C1E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89AE4C5A-07D4-476A-8E30-6B0502094C1E}.Release|Any CPU.Build.0 = Release|Any CPU + {B6FD3563-E050-43C1-BB6C-3728CBF5F8EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6FD3563-E050-43C1-BB6C-3728CBF5F8EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6FD3563-E050-43C1-BB6C-3728CBF5F8EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6FD3563-E050-43C1-BB6C-3728CBF5F8EA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/AuthenticatorInformation.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/AuthenticatorInformation.cs new file mode 100755 index 0000000..220b131 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/AuthenticatorInformation.cs @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.FidoClient +{ + /// + /// Contains information about the authenticators registered on the device. + /// + /// 3 + /// + /// + /// IEnumerable authInfos = await UafAuthenticatorFinder.DiscoverAuthenticatorsAsync(); + /// foreach (AuthenticatorInformation authInfo in authInfos) + /// { + /// string aaid = authInfo.Aaid; + /// string title = authInfo.Title; + /// } + /// + /// + public class AuthenticatorInformation + { + internal AuthenticatorInformation() + { + } + + /// + /// The authenticator Title + /// + /// 3 + public string Title { get; internal set; } + + /// + /// The Authenticator AAID (Authenticator Attestation ID) + /// + /// 3 + public string Aaid { get; internal set; } + + /// + /// The Authenticator description + /// + /// 3 + public string Description { get; internal set; } + + /// + /// The Authenticator assertion scheme. + /// + /// 3 + public string AssertionScheme { get; internal set; } + + /// + /// The Authenticator algorithm. + /// + /// 3 + public AuthenticationAlgorithm AuthenticationAlgorithm { get; internal set; } + + /// + /// The user verification method of this Authenticator + /// + /// 3 + public UserVerificationMethod UserVerification { get; internal set; } + + /// + /// The key protection method of this Authenticator. + /// + /// 3 + public KeyProtectionType KeyProtection { get; internal set; } + + /// + /// The matcher protection method of this Authenticator. + /// + /// 3 + public MatcherProtectionType MatcherProtection { get; internal set; } + + /// + /// The attachment hint of this Authenticator. + /// + /// 3 + public AuthenticatorAttachmentHint AttachmentHint { get; internal set; } + + /// + /// Denotes the Authenticator is Second factor only which is supported by U2F standards. + /// + /// 3 + public bool IsSecondFactorOnly { get; internal set; } + + /// + /// The available attestation types for this Authenticator. + /// + /// 3 + public IEnumerable AttestationTypes { get; internal set; } + + /// + /// The Transaction Confirmation display type of this Authenticator. + /// + /// 3 + public TransactionConfirmationDisplayType TcDisplayType { get; internal set; } + + /// + /// The Transaction Confirmation display type of this Authenticator. + /// + /// 3 + public string TcDisplayContentType { get; internal set; } + + /// + /// The icon of this Authenticator. + /// + /// 3 + public string Icon { get; internal set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/ErrorFactory.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/ErrorFactory.cs new file mode 100755 index 0000000..ef3191a --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/ErrorFactory.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Account.FidoClient +{ + internal enum FidoErrorCode + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + NoData = ErrorCode.NoData, + NotSupported = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + UserActionInProgress = -0x01030000 | 0x01, + UserCancelled = -0x01030000 | 0x02, + UnsupportedVersion = -0x01030000 | 0x03, + NoSuitableAuthenticator = -0x01030000 | 0x04, + ProtocolError = -0x01030000 | 0x05, + UntrustedFacetId = -0x01030000 | 0x06, + Unknown = ErrorCode.Unknown + } + + internal class ErrorFactory + { + internal static string LogTag = "Tizen.Account.FidoClient"; + + internal static Exception GetException(int error) + { + if ((FidoErrorCode)error == FidoErrorCode.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if ((FidoErrorCode)error == FidoErrorCode.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if ((FidoErrorCode)error == FidoErrorCode.UserActionInProgress) + { + return new InvalidOperationException("User action already in progress"); + } + else if ((FidoErrorCode)error == FidoErrorCode.NotSupported) + { + return new NotSupportedException("FIDO is unsupported."); + } + else if ((FidoErrorCode)error == FidoErrorCode.PermissionDenied) + { + return new UnauthorizedAccessException("Permission denied"); + } + else if ((FidoErrorCode)error == FidoErrorCode.UnsupportedVersion) + { + return new NotSupportedException("UAF message's version is not supported."); + } + else if ((FidoErrorCode)error == FidoErrorCode.NoSuitableAuthenticator) + { + return new Exception("Suitable authenticator can't be found"); + } + else if ((FidoErrorCode)error == FidoErrorCode.ProtocolError) + { + return new ArgumentException("Protocol error, the interaction may have timed out, or the UAF message is malformed."); + } + else if ((FidoErrorCode)error == FidoErrorCode.UserCancelled) + { + return new Exception("User has canceled the operation."); + } + else if ((FidoErrorCode)error == FidoErrorCode.UntrustedFacetId) + { + return new Exception(" The caller's id is not allowed to use this operation."); + } + else + { + return new Exception("Unknown error"); + } + } + } +} diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafAuthenticatorFinder.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafAuthenticatorFinder.cs new file mode 100755 index 0000000..bed73d4 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafAuthenticatorFinder.cs @@ -0,0 +1,211 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace Tizen.Account.FidoClient +{ + /// + /// Class to find available FIDO specific authenticators on the device + /// + /// 3 + public static class UafAuthenticatorFinder + { + /// + /// Retrieves all the available FIDO authenticators supported by this Device. + /// + /// 3 + /// Enumerable list of authenticators + /// http://tizen.org/privilege/fido.client + /// http://tizen.org/feature/fido.uaf + /// Thrown when the application does not have privilege to access this method + /// FIDO is not supported + + /// + /// + /// IEnumerable authInfos = await UafAuthenticatorFinder.DiscoverAuthenticatorsAsync(); + /// foreach (AuthenticatorInformation authInfo in authInfos) + /// { + /// string aaid = authInfo.Aaid; + /// string title = authInfo.Title; + /// } + /// + /// + public static async Task> DiscoverAuthenticatorsAsync() + { + IEnumerable result = null; + await Task.Run(() => result = Discover()); + return result; + } + + private static IEnumerable Discover() + { + IList result = new List(); + + Interop.UafAuthenticator.FidoAuthenticatorCallback cb = (IntPtr authHandle, IntPtr userData) => + { + Log.Info(ErrorFactory.LogTag, "Iterating authenticators"); + result.Add(GetAuthInfo(authHandle)); + }; + + int ret = Interop.UafAuthenticator.ForeachAuthenticator(cb, IntPtr.Zero); + if(ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + return result; + } + + private static AuthenticatorInformation GetAuthInfo(IntPtr authHandle) + { + var authInfo = new AuthenticatorInformation(); + + IntPtr stringPtr; + int ret = Interop.UafAuthenticator.GetTitle(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.Title = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.UafAuthenticator.GetAaid(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.Aaid = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.UafAuthenticator.GetDescription(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.Description = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.UafAuthenticator.GetAssertionScheme(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.AssertionScheme = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + int authAlgo; + ret = Interop.UafAuthenticator.GetAlgorithm(authHandle, out authAlgo); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + int usrVerificationMethod; + ret = Interop.UafAuthenticator.GetVerificationMethod(authHandle, out usrVerificationMethod); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + int keyProtectionType; + ret = Interop.UafAuthenticator.GetKeyProtectionMethod(authHandle, out keyProtectionType); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + int matcherProtection; + ret = Interop.UafAuthenticator.GetMatcherProtectionMethod(authHandle, out matcherProtection); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + int attachmentHint; + ret = Interop.UafAuthenticator.GetAttachmentHint(authHandle, out attachmentHint); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + bool isSecondaryOnly = Interop.UafAuthenticator.GetIsSecondFactorOnly(authHandle); + + int tcDisplayType; + ret = Interop.UafAuthenticator.GetTcDiscplay(authHandle, out tcDisplayType); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.UafAuthenticator.GetTcDisplayType(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.TcDisplayContentType = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.UafAuthenticator.GetIcon(authHandle, out stringPtr); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + authInfo.Icon = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + var attestationTypes = new List (); + Interop.UafAuthenticator.FidoAttestationTypeCallback cb = (int type, IntPtr usrData) => + { + attestationTypes.Add((AuthenticatorAttestationType)type); + }; + + ret = Interop.UafAuthenticator.ForeachAttestationType(authHandle, cb, IntPtr.Zero); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + authInfo.AuthenticationAlgorithm = (AuthenticationAlgorithm)authAlgo; + authInfo.UserVerification = (UserVerificationMethod)usrVerificationMethod; + authInfo.KeyProtection = (KeyProtectionType)keyProtectionType; + authInfo.MatcherProtection = (MatcherProtectionType)matcherProtection; + authInfo.AttachmentHint = (AuthenticatorAttachmentHint)attachmentHint; + authInfo.IsSecondFactorOnly = isSecondaryOnly; + authInfo.TcDisplayType = (TransactionConfirmationDisplayType)tcDisplayType; + authInfo.AttestationTypes = attestationTypes; + + return authInfo; + } + } +} diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafClient.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafClient.cs new file mode 100755 index 0000000..da3f9da --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafClient.cs @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using Tizen.Internals.Errors; + +namespace Tizen.Account.FidoClient +{ + /// + /// The FIDO UAF Client APIs + /// + /// 3 + public static class UafClient + { + private static string _vendorName = null; + private static int _majorVersion; + private static int _minorVersion; + + static UafClient() + { + int ret = Interop.UafClient.FidoGetClientVendor(out _vendorName); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.UafClient.FidoGetClientVersion(out _majorVersion, out _minorVersion); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// The FIDO Client vendor name + /// + /// 3 + public static string VendorName + { + get + { + return _vendorName; + } + } + + /// + /// The FIDO Client Major version + /// + /// 3 + public static int MajorVersion + { + get + { + return _majorVersion; + } + } + + /// + /// The FIDO Client Minor version + /// + /// 3 + public static int MinorVersion + { + get + { + return _minorVersion; + } + } + + /// + /// The FIDO Server response for successfull interaction. + /// + /// 3 + public static int StautsOk + { + get + { + return 1200; + } + } + + /// + /// Checks whether the FIDO message can be processed + /// + /// 3 + /// The FIDO UAF message which is received from the relying party server + /// True if the message can be handled by the device, else false + /// http://tizen.org/privilege/fido.client + /// http://tizen.org/feature/fido.uaf + /// In case of invalid parameter + /// Thrown when the application does not have privilege to access this method + /// FIDO is not supported + /// + /// + /// UafMessage uafRequest = new UafMessage() + /// { + /// Operation = "UafRequestJson" + /// }; + /// bool response = await UafClient.CheckPolicyAsync(uafRequest); + /// + /// + public static async Task CheckPolicyAsync(UafMessage uafMessage) + { + if (uafMessage == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)FidoErrorCode.InvalidParameter); + } + + bool result = false; + await Task.Run(() => result = CheckPolicy(uafMessage.Operation)); + return result; + } + + /// + /// Processes the given FIDO UAF message. + /// + /// 3 + /// The FIDO UAF message which is received from the relying party server + /// The channel binding data in JSON format which is received from the relying party server + /// FIDO response message + /// http://tizen.org/privilege/fido.client + /// http://tizen.org/feature/fido.uaf + /// In case of invalid parameter + /// Thrown when the application does not have privilege to access this method + /// FIDO is not supported + /// + /// + /// UafMessage uafRequest = new UafMessage() + /// { + /// Operation = "UafAuthRequestJson" + /// }; + /// + /// var response = await UafClient.ProcessRequestAsync(uafRequest, null); + /// + /// + public static async Task ProcessRequestAsync(UafMessage uafMessage, string channelBindng) + { + if (uafMessage == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)FidoErrorCode.InvalidParameter); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.UafClient.FidoUafResponseMessageCallback cb = (int errorCode, string uafResponseJson, IntPtr userData) => + { + if (uafMessage == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + tcs.SetException(ErrorFactory.GetException((int)FidoErrorCode.InvalidParameter)); + } + + if (errorCode != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop callback failed with error code: [" + errorCode + "]"); + tcs.SetException(ErrorFactory.GetException(errorCode)); + } + + tcs.SetResult(new UafResponse() { Response = uafResponseJson }); + }; + + int ret = Interop.UafClient.FidoUafGetResponseMessage(uafMessage.Operation, channelBindng, cb, IntPtr.Zero); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + + return await tcs.Task; + } + + /// + /// Notifies the FIDO client about the server result. FIDO Server sends the result of processing a UAF message to FIDO client. + /// + /// 3 + /// The status code received from Server.(StautsOk implies success) + /// The FIDO response message sent to server in JSON format + /// http://tizen.org/privilege/fido.client + /// http://tizen.org/feature/fido.uaf + /// + /// This is especially important for cases when a new registration may be considered by the client to be in a pending state until it is communicated that the server accepted it + /// + /// In case of invalid parameter + /// Thrown when the application does not have privilege to access this method + /// FIDO is not supported + /// + /// + /// UafResponse response = new UafResponse() + /// { + /// Response = "Responsejson" + /// }; + /// + /// await UafClient.NotifyResultAsync(UafClient.StautsOk, response); + /// + /// + public static async Task NotifyResultAsync(int responseCode, UafResponse response) + { + if (response == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid parameter"); + throw ErrorFactory.GetException((int)FidoErrorCode.InvalidParameter); + } + + await Task.Run(() => NotifyResult(responseCode, response.Response)); + } + + private static bool CheckPolicy(string uafOperation) + { + bool isSupported; + int ret = Interop.UafClient.FidoUafIsSupported(uafOperation, out isSupported); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ret + "]"); + throw ErrorFactory.GetException(ret); + } + return isSupported; + } + + private static void NotifyResult(int responseCode, string response) + { + int ret = Interop.UafClient.FidoUafSetServerResult(responseCode, response); + if (ret != (int)FidoErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop API failed with error code: [" + ErrorFacts.GetErrorMessage(ret) + "]"); + throw ErrorFactory.GetException(ret); + } + } + + } +} diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafEnumerations.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafEnumerations.cs new file mode 100755 index 0000000..89367ff --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafEnumerations.cs @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.FidoClient +{ + /// + /// Authenticator's supported algorithm and encoding + /// + /// 3 + public enum AuthenticationAlgorithm + { + /// + /// SECP256R1 ECDSA SHA256 Raw + /// + /// 3 + Secp256r1EcdsaSha256Raw = 0X01, + + /// + /// SECP256R1 ECDSA SHA256 DER + /// + /// 3 + Secp256r1EcdsaSha256Der = 0X02, + + /// + /// RSA PSS SHA256 Raw + /// + /// 3 + RsassaPssSha256Raw = 0X03, + + /// + /// RSA PSS SHA256 DER + /// + /// 3 + RsassaPssSha256Der = 0X04, + + /// + /// SECP256K1 ECDSA SHA256 Raw + /// + /// 3 + Secp256k1EcdsaSha256Raw = 0X05, + + /// + /// SECP256K1 ECDSA SHA256 DER + /// + /// 3 + Secp256k1EcdsaSha256Der = 0X06 + } + + /// + /// Authenticator's supported user verification method type. + /// + /// 3 + public enum UserVerificationMethod + { + /// + /// User presence verification. + /// + /// 3 + Presence = 0X01, + + /// + /// User fingerprint verification. + /// + /// 3 + Fingerprint = 0X02, + + /// + /// User passcode verification. + /// + /// 3 + Passcode = 0X04, + + /// + /// User voiceprint verification. + /// + /// 3 + Voiceprint = 0X08, + + /// + /// User faceprint verification. + /// + /// 3 + Faceprint = 0X10, + /// + /// User location verification. + /// + /// 3 + Location = 0X20, + + /// + /// User eyeprint verification. + /// + /// 3 + Eyeprint = 0X40, + + /// + /// User pattern verification. + /// + /// 3 + Pattern = 0X80, + + /// + /// User handprint verification. + /// + /// 3 + Handprint = 0X100, + + /// + /// Silent verification. + /// + /// 3 + None = 0X200, + + /// + /// If an authenticator sets multiple flags for user verification types, it may also set this flag to indicate that all verification methods will be enforced (e.g. faceprint AND voiceprint). If flags for multiple user verification methods are set and this flag is not set, verification with only one is necessary (e.g. fingerprint OR passcode). + /// + /// 3 + All = 0X400 + } + + /// + /// Authenticator's supported key protection method type. + /// + /// 3 + public enum KeyProtectionType + { + /// + /// Software based key management. + /// + /// 3 + Software = 0X01, + + /// + /// Hardware based key management. + /// + /// 3 + Hardware = 0X02, + + /// + /// Trusted Execution Environment based key management. + /// + /// 3 + Tee = 0X04, + + /// + /// Secure Element based key management. + /// + /// 3 + SecureElement = 0X08, + + /// + /// Authenticator does not store (wrapped) UAuth keys at the client, but relies on a server-provided key handle. + /// + /// 3 + RemoteHandle = 0X10 + } + + /// + /// Authenticator's supported matcher protection type. + /// + /// 3 + public enum MatcherProtectionType + { + /// + /// Authenticator's matcher is running in software. + /// + /// 3 + Software = 0X01, + + /// + /// Authenticator's matcher is running inside the Trusted Execution Environment. + /// + /// 3 + Tee = 0X02, + + /// + /// Aauthenticator's matcher is running on the chip. + /// + /// 3 + OnChip = 0X04 + } + + /// + /// Authenticator's supproted method to communicate to FIDO user device. + /// + /// 3 + public enum AuthenticatorAttachmentHint + { + /// + /// Authenticator is permanently attached to the FIDO User Device. + /// + /// 3 + Internal = 0X01, + + /// + /// Authenticator is removable or remote from the FIDO User Device. + /// + /// 3 + External = 0X02, + + /// + /// The external authenticator currently has an exclusive wired connection. + /// + /// 3 + Wired = 0X04, + + /// + /// The external authenticator communicates with the FIDO User Device through wireless means. + /// + /// 3 + Wireless = 0X08, + + /// + /// Authenticator is able to communicate by NFC to the FIDO User Device. + /// + /// 3 + Nfc = 0X10, + + /// + /// Authenticator is able to communicate by Bluetooth to the FIDO User Device. + /// + /// 3 + Bt = 0X20, + + /// + /// Authenticator is connected to the FIDO User Device ver a non-exclusive network (e.g. over a TCP/IP LAN or WAN, as opposed to a PAN or point-to-point connection). + /// + /// 3 + Nw = 0X40, + + /// + /// The external authenticator is in a "ready" state. + /// + /// 3 + Ready = 0X80, + + /// + /// The external authenticator is able to communicate using WiFi Direct with the FIDO User Device. + /// + /// 3 + WifiDirect = 0X100 + } + + /// + /// Authenticator's supported Attestation type. + /// + /// 3 + public enum AuthenticatorAttestationType + { + /// + /// Full basic attestation. + /// + /// 3 + BasicFull = 0X3e07, + + /// + /// Surrogate basic attestation. + /// + /// 3 + BasicSurrogate = 0X3e08, + } + + /// + /// Transaction confirmation display capability type. + /// + /// 3 + public enum TransactionConfirmationDisplayType + { + /// + /// Some form of transaction confirmation display is available on this authenticator. + /// + /// 3 + Any = 0X01, + + /// + /// Software-based transaction confirmation display operating in a privileged context is available on this authenticator. + /// + /// 3 + PrivilegedSoftware = 0X02, + + /// + /// Transaction confirmation display is in a Trusted Execution Environment. + /// + /// 3 + Tee = 0X04, + + /// + /// Transaction confirmation display based on hardware assisted capabilities is available on this authenticator. + /// + /// 3 + Hw = 0X08, + + /// + /// Transaction confirmation display is provided on a distinct device from the FIDO User Device. + /// + /// 3 + Remote = 0X10 + } +} diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafMessage.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafMessage.cs new file mode 100755 index 0000000..92fe2fe --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafMessage.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.FidoClient +{ + /// + /// The FIDO message received from the relying party server + /// + /// 3 + public class UafMessage + { + /// + /// The constructor + /// + /// 3 + public UafMessage() + { + } + + /// + /// The FIDO message in JSON format which is received from the relying party server + /// + /// 3 + public string Operation { get; set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafResponse.cs b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafResponse.cs new file mode 100755 index 0000000..bc63076 --- /dev/null +++ b/src/Tizen.Account.FidoClient/Tizen.Account.FidoClient/UafResponse.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.FidoClient +{ + /// + /// Represents FIDO response message + /// + /// 3 + public class UafResponse + { + /// + /// The constructor + /// + /// 3 + public UafResponse() + { + } + + /// + /// FIDO response message in JSON format + /// + /// 3 + public string Response { set; get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Common.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Common.cs new file mode 100644 index 0000000..b16906f --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Common.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + /// + /// Safehandle wrapper for OAuth2 native handles. + /// + internal abstract class SafeOauth2Handle : SafeHandle + { + public SafeOauth2Handle() : base(IntPtr.Zero, true) + { + } + + public SafeOauth2Handle(IntPtr handle) : base(handle, true) + { + } + + public override bool IsInvalid + { + get + { + return handle == IntPtr.Zero; + } + } + + public abstract void Destroy(); + + protected override bool ReleaseHandle() + { + Destroy(); + SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Error.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Error.cs new file mode 100644 index 0000000..de77168 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Error.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + /// + /// Wrapper class for OAuth2 native API. + /// + internal static partial class Error + { + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_error_get_code")] + internal static extern int GetCode(IntPtr /* oauth2_error_h */ handle, out int serverErrorCode, out int platformErrorCode); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_error_get_description")] + internal static extern int GetDescription(IntPtr /* oauth2_error_h */ handle, out string description); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_error_get_uri")] + internal static extern int GetUri(IntPtr /* oauth2_error_h */ handle, out string uri); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_error_get_custom_data")] + internal static extern int GetCustomData(IntPtr /* oauth2_error_h */ handle, string customKey, out string customValue); + + + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Libraries.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..b446467 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Libraries.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + /// + /// Wrapper class for maintaining names of dependent native libraries. + /// + internal static partial class Libraries + { + public const string OAuth2 = "liboauth2.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Manager.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Manager.cs new file mode 100755 index 0000000..3970b6b --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Manager.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + /// + /// Wrapper class for OAuth2 native API. + /// + internal static partial class Manager + { + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void Oauth2TokenCallback(IntPtr /* oauth2_response_h */ response, IntPtr /* void */ userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void Oauth2AuthGrantCallback(IntPtr /* oauth2_response_h */ response, IntPtr /* void */ userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void Oauth2AccessTokenCallback(IntPtr /* oauth2_response_h */ response, IntPtr /* void */ userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void Oauth2RefreshTokenCallback(IntPtr /* oauth2_response_h */ response, IntPtr /* void */ userData); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_create")] + internal static extern int Create(out IntPtr /* oauth2_manager_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_destroy")] + internal static extern int Destroy(IntPtr /* oauth2_manager_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_request_token")] + internal static extern int RequestToken(IntPtr /* oauth2_manager_h */ handle, IntPtr /* oauth2_request_h */ request, Oauth2TokenCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_request_authorization_grant")] + internal static extern int RequestAuthorizationGrant(IntPtr /* oauth2_manager_h */ handle, IntPtr /* oauth2_request_h */ request, Oauth2AuthGrantCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_request_access_token")] + internal static extern int RequestAccessToken(IntPtr /* oauth2_manager_h */ handle, IntPtr /* oauth2_request_h */ request, Oauth2AccessTokenCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_refresh_access_token")] + internal static extern int RefreshAccessToken(IntPtr /* oauth2_manager_h */ handle, IntPtr /* oauth2_request_h */ request, Oauth2RefreshTokenCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_is_request_in_progress")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsRequestInProgress(IntPtr /* oauth2_manager_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_clear_cookies")] + internal static extern int ClearCookies(IntPtr /* oauth2_manager_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_manager_clear_cache")] + internal static extern int ClearCache(IntPtr /* oauth2_manager_h */ handle); + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Request.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Request.cs new file mode 100644 index 0000000..c76dba0 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Request.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + /// + /// Wrapper class for OAuth2 native API. + /// + internal static partial class Request + { + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_create")] + internal static extern int Create(out IntPtr /* oauth2_request_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_destroy")] + internal static extern int Destroy(IntPtr /* oauth2_request_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_auth_end_point_url")] + internal static extern int SetAuthEndPointUrl(IntPtr /* oauth2_request_h */ handle, string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_token_end_point_url")] + internal static extern int SetTokenEndPointUrl(IntPtr /* oauth2_request_h */ handle, string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_redirection_url")] + internal static extern int SetRedirectionUrl(IntPtr /* oauth2_request_h */ handle, string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_refresh_token_url")] + internal static extern int SetRefreshTokenUrl(IntPtr /* oauth2_request_h */ handle, string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_refresh_token")] + internal static extern int SetRefreshToken(IntPtr /* oauth2_request_h */ handle, string refreshToken); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_response_type")] + internal static extern int SetResponseType(IntPtr /* oauth2_request_h */ handle, ResponseType /* oauth2_response_type_e */ responseType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_client_id")] + internal static extern int SetClientId(IntPtr /* oauth2_request_h */ handle, string clientId); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_client_secret")] + internal static extern int SetClientSecret(IntPtr /* oauth2_request_h */ handle, string clientSecret); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_client_authentication_type")] + internal static extern int SetClientAuthenticationType(IntPtr /* oauth2_request_h */ handle, int /* oauth2_client_authentication_type_e */ clientAuthType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_scope")] + internal static extern int SetScope(IntPtr /* oauth2_request_h */ handle, string scope); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_state")] + internal static extern int SetState(IntPtr /* oauth2_request_h */ handle, string state); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_grant_type")] + internal static extern int SetGrantType(IntPtr /* oauth2_request_h */ handle, GrantType /* oauth2_grant_type_e */ grantType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_authorization_code")] + internal static extern int SetAuthorizationCode(IntPtr /* oauth2_request_h */ handle, string code); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_user_name")] + internal static extern int SetUserName(IntPtr /* oauth2_request_h */ handle, string userName); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_set_password")] + internal static extern int SetPassword(IntPtr /* oauth2_request_h */ handle, string password); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_add_custom_data")] + internal static extern int AddCustomData(IntPtr /* oauth2_request_h */ handle, string key, string value); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_auth_end_point_url")] + internal static extern int GetAuthEndPointUrl(IntPtr /* oauth2_request_h */ handle, out string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_token_end_point_url")] + internal static extern int GetTokenEndPointUrl(IntPtr /* oauth2_request_h */ handle, out string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_redirection_url")] + internal static extern int GetRedirectionUrl(IntPtr /* oauth2_request_h */ handle, out string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_refresh_token_url")] + internal static extern int GetRefreshTokenUrl(IntPtr /* oauth2_request_h */ handle, out string url); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_refresh_token")] + internal static extern int GetRefreshToken(IntPtr /* oauth2_request_h */ handle, out string refreshToken); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_response_type")] + internal static extern int GetResponseType(IntPtr /* oauth2_request_h */ handle, out ResponseType /* oauth2_response_type_e */ responseType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_client_id")] + internal static extern int GetClientId(IntPtr /* oauth2_request_h */ handle, out string clientId); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_client_secret")] + internal static extern int GetClientSecret(IntPtr /* oauth2_request_h */ handle, out string clientSecret); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_scope")] + internal static extern int GetScope(IntPtr /* oauth2_request_h */ handle, out string scope); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_state")] + internal static extern int GetState(IntPtr /* oauth2_request_h */ handle, out string state); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_grant_type")] + internal static extern int GetGrantType(IntPtr /* oauth2_request_h */ handle, out GrantType /* oauth2_grant_type_e */ grantType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_authorization_code")] + internal static extern int GetAuthorizationCode(IntPtr /* oauth2_request_h */ handle, out string code); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_user_name")] + internal static extern int GetUserName(IntPtr /* oauth2_request_h */ handle, out string userName); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_password")] + internal static extern int GetPassword(IntPtr /* oauth2_request_h */ handle, out string password); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_request_get_custom_data")] + internal static extern int GetCustomData(IntPtr /* oauth2_request_h */ handle, string customKey, out string customValue); + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Response.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Response.cs new file mode 100644 index 0000000..6131414 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Response.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + /// + /// Wrapper class for OAuth2 native API. + /// + internal static partial class Response + { + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_destroy")] + internal static extern int Destroy(IntPtr /* oauth2_response_h */ handle); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_authorization_code")] + internal static extern int GetAuthorizationCode(IntPtr /* oauth2_response_h */ handle, out IntPtr code); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_state")] + internal static extern int GetState(IntPtr /* oauth2_response_h */ handle, out IntPtr state); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_access_token")] + internal static extern int GetAccessToken(IntPtr /* oauth2_response_h */ handle, out IntPtr accessToken); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_token_type")] + internal static extern int GetTokenType(IntPtr /* oauth2_response_h */ handle, out IntPtr tokenType); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_expires_in")] + internal static extern int GetExpiresIn(IntPtr /* oauth2_response_h */ handle, out long expiresIn); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_refresh_token")] + internal static extern int GetRefreshToken(IntPtr /* oauth2_response_h */ handle, out IntPtr refreshToken); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_scope")] + internal static extern int GetScope(IntPtr /* oauth2_response_h */ handle, out IntPtr scope); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_error")] + internal static extern int GetError(IntPtr /* oauth2_response_h */ handle, out IntPtr /* oauth2_error_h */ error); + + [DllImport(Libraries.OAuth2, EntryPoint = "oauth2_response_get_custom_data")] + internal static extern int GetCustomData(IntPtr /* oauth2_response_h */ handle, string customKey, out IntPtr customValue); + + + } +} diff --git a/src/Tizen.Account.OAuth2/Interop/Interop.Types.cs b/src/Tizen.Account.OAuth2/Interop/Interop.Types.cs new file mode 100644 index 0000000..27bf2cb --- /dev/null +++ b/src/Tizen.Account.OAuth2/Interop/Interop.Types.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Contains Interop declarations of OAuth2 classes. +/// +internal static partial class Interop +{ + internal enum GrantType + { + AuthCode, // OAUTH2_GRANT_TYPE_AUTH_CODE + Password, // OAUTH2_GRANT_TYPE_PASSWORD + ClientCredentials, // OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS + Refresh, // OAUTH2_GRANT_TYPE_REFRESH + } + + internal enum ResponseType + { + Code, // OAUTH2_RESPONSE_TYPE_CODE + Token, // OAUTH2_RESPONSE_TYPE_TOKEN + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.csproj b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.sln b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.sln new file mode 100755 index 0000000..f6466f3 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Account.OAuth2", "Tizen.Account.OAuth2.csproj", "{1D4A1B0D-AAF5-44A3-8F51-82AD8FD02E9C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F01EC0FE-2430-4E29-8E32-7F382B203A40}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{CB517D83-FC5A-4797-A36B-AB40B2CA9A13}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1D4A1B0D-AAF5-44A3-8F51-82AD8FD02E9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D4A1B0D-AAF5-44A3-8F51-82AD8FD02E9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D4A1B0D-AAF5-44A3-8F51-82AD8FD02E9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D4A1B0D-AAF5-44A3-8F51-82AD8FD02E9C}.Release|Any CPU.Build.0 = Release|Any CPU + {F01EC0FE-2430-4E29-8E32-7F382B203A40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F01EC0FE-2430-4E29-8E32-7F382B203A40}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F01EC0FE-2430-4E29-8E32-7F382B203A40}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F01EC0FE-2430-4E29-8E32-7F382B203A40}.Release|Any CPU.Build.0 = Release|Any CPU + {CB517D83-FC5A-4797-A36B-AB40B2CA9A13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB517D83-FC5A-4797-A36B-AB40B2CA9A13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB517D83-FC5A-4797-A36B-AB40B2CA9A13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB517D83-FC5A-4797-A36B-AB40B2CA9A13}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AccessToken.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AccessToken.cs new file mode 100755 index 0000000..4d185a0 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AccessToken.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Account.OAuth2 +{ + /// + /// Class containing access token and related information. + /// + /// 3 + public class AccessToken + { + internal AccessToken() + { + } + + /// + /// The lifetime in seconds of the access token. + /// + /// 3 + public long ExpiresIn { get; internal set;} + + /// + /// The access token issued by the authorization server. + /// + /// 3 + public string Token { get; internal set;} + + /// + /// The scope of the access token. + /// + /// 3 + public IEnumerable Scope { get; internal set;} + + /// + /// The type of the access token. + /// + /// 3 + public string TokenType { get; internal set;} + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthenticationScheme.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthenticationScheme.cs new file mode 100755 index 0000000..6f385e7 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthenticationScheme.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// Enumerations for Client authentication scheme, used to sign client id and client secret accordingly. + /// Default is Basic (http://tools.ietf.org/html/rfc2617#section-2) + /// + /// 3 + /// Facebook and Google does not support HTTP Basic Authentication, instead they require client credentials to be sent via request body. + public enum AuthenticationScheme + { + /// + /// HTTP Basic Authentication for client authentication + /// + /// 3 + Basic = 0, + + /// + /// HTTP Basic Authentication for client authentication + /// + /// 3 + Digest, + + /// + /// Client credentials are sent via request body + /// + /// 3 + RequestBody + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationRequest.cs new file mode 100755 index 0000000..e6a4a4d --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationRequest.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The request parameters to be sent to authorization end point. + /// + /// 3 + public abstract class AuthorizationRequest + { + /// + /// The desired response type from the OAuth authorization end point. + /// + /// 3 + public abstract string ResponseType { get; } + + /// + /// Client secret credentials. + /// + /// 3 + public ClientCredentials ClientSecrets { get; set; } + + /// + /// The scope of the access. + /// + /// 3 + public IEnumerable Scopes { get; set; } + + /// + /// The authorization end point URL. + /// + /// 3 + public Uri AuthorizationEndpoint { get; set; } + + /// + /// The redirection endpoint of the auhorization flow. + /// + /// 3 + public Uri RedirectionEndPoint { get; set; } + + /// + /// The access token end point URL. + /// + /// 3 + public Uri TokenEndpoint { get; set; } + + /// + /// The client's state which is maintained between request and response. + /// + /// 3 + public string State { get; set; } + + /// + /// Custom key-value parameters to be sent to the server + /// + /// 3 + public IEnumerable> CustomData { get; set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationResponse.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationResponse.cs new file mode 100755 index 0000000..c12422a --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/AuthorizationResponse.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The response containing authroization code from the authorization server. + /// + /// 3 + public class AuthorizationResponse : IDisposable + { + private bool _disposed = false; + private IntPtr _responseHandle; + + internal AuthorizationResponse(IntPtr handle) + { + _responseHandle = handle; + } + + /// + /// Destructor of the AuthorizationResponse class. + /// + /// 3 + ~AuthorizationResponse() + { + Dispose(false); + } + + /// + /// The authroization code. + /// + /// 3 + public string Code { get; internal set; } + + /// + /// The state parameter present in authorization request. + /// + /// 3 + /// + /// The value can be null depending on the server specifications. + /// + public string State { get; internal set; } + + /// + /// Custom key-value parameter received from service provider + /// + /// 3 + /// + /// The return value can be null depending on the server specifications. + /// + public string GetCustomValue(string key) + { + IntPtr value = IntPtr.Zero; + int ret = Interop.Response.GetCustomData(_responseHandle, key, out value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + return Marshal.PtrToStringAnsi(value); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.Response.Destroy(_responseHandle); + _disposed = true; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/Authorizer.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/Authorizer.cs new file mode 100755 index 0000000..bf0496c --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/Authorizer.cs @@ -0,0 +1,490 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Account.OAuth2 +{ + /// + /// An abstract class to represent various OAuth 2.0 authorization code flows. + /// Refer to http://tools.ietf.org/html/rfc6749 about OAuth 2.0 protocols. + /// Also service provider document needs to be referred for using end points and additional parameters. + /// + /// 3 + public abstract class Authorizer : IDisposable + { + + internal IntPtr _managerHandle; + private bool _disposed = false; + + /// + /// Constructor for Authoirzer instances + /// + /// 3 + public Authorizer() + { + int ret = Interop.Manager.Create(out _managerHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the Authorizer class. + /// + /// 3 + ~Authorizer() + { + Dispose(false); + } + + /// + /// Indicates if the current instance is already handling an authorization request + /// + /// 3 + public bool IsRequestInProgress + { + get + { + return Interop.Manager.IsRequestInProgress(_managerHandle); + } + } + + /// + /// Authorizes the client with access toekn / authorizaion code in Implicit and Authorization Code grant flows respectively. + /// + /// 3 + /// + /// + /// An authorization request + /// The authorization response from server + public virtual Task AuthorizeAsync(AuthorizationRequest request) + { + throw new NotImplementedException(); + } + + /// + /// Gets the access token in OAuth2 supported grant flows except Implicit Grant flow. + /// + /// 3 + /// + /// + /// A token request + /// The response from server + public virtual Task GetAccessTokenAsync(TokenRequest request) + { + throw new NotImplementedException(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Retrieves access token using a refresh token. + /// + /// 3 + /// Request containing refresh token + /// The response containing access token. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public virtual async Task RefreshAccessTokenAsync(RefreshTokenRequest request) + { + IntPtr requestHandle = GetRequestHandle(request); + return await Task.Run(() => GetRefreshToken(requestHandle)); + } + + private TokenResponse GetRefreshToken(IntPtr requestHandle) + { + int ret = (int)OAuth2Error.None; + IntPtr error = IntPtr.Zero; + TokenResponse response = null; + Interop.Manager.Oauth2RefreshTokenCallback accessTokenCb = (IntPtr responseHandle, IntPtr usrData) => + { + Interop.Response.GetError(responseHandle, out error); + if (error != IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Error occured"); + } + else + { + IntPtr accessToken; + ret = Interop.Response.GetAccessToken(responseHandle, out accessToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr tokenType; + ret = Interop.Response.GetTokenType(responseHandle, out tokenType); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get token type"); + } + + long expiresIn; + ret = Interop.Response.GetExpiresIn(responseHandle, out expiresIn); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get expires in"); + } + + IntPtr refreshToken; + ret = Interop.Response.GetRefreshToken(responseHandle, out refreshToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr scope; + ret = Interop.Response.GetScope(responseHandle, out scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get scope"); + } + + IEnumerable scopes = (scope == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(scope)?.Split(' '); + + var token = new AccessToken(); + token.Token = (accessToken == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(accessToken); + token.TokenType = (tokenType == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(tokenType); + token.Scope = scopes; + token.ExpiresIn = expiresIn; + + response = new TokenResponse(responseHandle); + response.AccessToken = token; + response.RefreshToken = (refreshToken == IntPtr.Zero) ? null : new RefreshToken() { Token = Marshal.PtrToStringAnsi(refreshToken) }; + } + }; + + ret = Interop.Manager.RefreshAccessToken(_managerHandle, requestHandle, accessTokenCb, IntPtr.Zero); + Interop.Request.Destroy(requestHandle); + if (ret != (int)OAuth2Error.None || error != IntPtr.Zero) + { + if (error != IntPtr.Zero) + { + throw ErrorFactory.GetException(error); + } + else + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + return response; + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.Manager.Destroy(_managerHandle); + _disposed = true; + } + + // Fill device request handle for refreshing access token + internal IntPtr GetRequestHandle(RefreshTokenRequest request) + { + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetRefreshTokenUrl(requestHandle, request.TokenEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetGrantType(requestHandle, Interop.GrantType.Refresh); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetRefreshToken(requestHandle, request.RefreshToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.ClientSecrets.Id != null) + { + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.ClientSecrets.Secret != null) + { + ret = Interop.Request.SetClientSecret(requestHandle, request.ClientSecrets.Secret); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.Scopes != null) + { + string scope = string.Join(" ", request.Scopes); + ret = Interop.Request.SetScope(requestHandle, scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + ret = Interop.Request.SetClientAuthenticationType(requestHandle, (int)request.AuthenticationScheme); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + return requestHandle; + } + + internal TokenResponse GetAccessToken(IntPtr requestHandle) + { + int ret = (int)OAuth2Error.None; + IntPtr error = IntPtr.Zero; + TokenResponse response = null; + Interop.Manager.Oauth2TokenCallback accessTokenCb = (IntPtr responseHandle, IntPtr usrData) => + { + if (responseHandle == IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Error occured"); + throw (new ArgumentNullException()); + } + + Interop.Response.GetError(responseHandle, out error); + if (error != IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Server Error occured"); + } + else + { + IntPtr accessToken = IntPtr.Zero; + ret = Interop.Response.GetAccessToken(responseHandle, out accessToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get access token"); + throw ErrorFactory.GetException(ret); + } + + IntPtr tokenType; + ret = Interop.Response.GetTokenType(responseHandle, out tokenType); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "TokenType can't be found"); + } + + long expiresIn = -1; + ret = Interop.Response.GetExpiresIn(responseHandle, out expiresIn); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "ExpiresIn can't be found"); + } + + IntPtr refreshToken; + ret = Interop.Response.GetRefreshToken(responseHandle, out refreshToken); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "Refresh Token can't be found"); + } + + IntPtr scope; + ret = Interop.Response.GetScope(responseHandle, out scope); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "Scope can't be found"); + } + + IntPtr state; + ret = Interop.Response.GetState(responseHandle, out state); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "State can't be found"); + } + + IEnumerable scopes = (scope == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(scope)?.Split(' '); + + var token = new AccessToken(); + token.Token = (accessToken == IntPtr.Zero)? null : Marshal.PtrToStringAnsi(accessToken); + token.TokenType = (tokenType == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(tokenType); + token.Scope = scopes; + token.ExpiresIn = expiresIn; + + response = new TokenResponse(responseHandle); + response.AccessToken = token; + response.State = (state == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(state); + response.RefreshToken = (refreshToken == IntPtr.Zero) ? null : new RefreshToken() { Token = Marshal.PtrToStringAnsi(refreshToken) }; + } + }; + + ret = Interop.Manager.RequestToken(_managerHandle, requestHandle, accessTokenCb, IntPtr.Zero); + Interop.Request.Destroy(requestHandle); + if (ret != (int)OAuth2Error.None || error != IntPtr.Zero) + { + if (error != IntPtr.Zero) + { + throw ErrorFactory.GetException(error); + } + else + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + return response; + } + + internal TokenResponse GetAccessTokenByCode(IntPtr requestHandle) + { + int ret = (int)OAuth2Error.None; + IntPtr error = IntPtr.Zero; + TokenResponse response = null; + Interop.Manager.Oauth2AccessTokenCallback accessTokenCb = (IntPtr responseHandle, IntPtr usrData) => + { + if (responseHandle == IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Error occured"); + throw (new ArgumentNullException()); + } + + Interop.Response.GetError(responseHandle, out error); + if (error != IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Server Error occured"); + } + else + { + IntPtr accessToken = IntPtr.Zero; + ret = Interop.Response.GetAccessToken(responseHandle, out accessToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get access token"); + throw ErrorFactory.GetException(ret); + } + + IntPtr tokenType; + ret = Interop.Response.GetTokenType(responseHandle, out tokenType); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "TokenType can't be found"); + } + + long expiresIn = -1; + ret = Interop.Response.GetExpiresIn(responseHandle, out expiresIn); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "ExpiresIn can't be found"); + } + + IntPtr refreshToken; + ret = Interop.Response.GetRefreshToken(responseHandle, out refreshToken); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "Refresh Token can't be found"); + } + + IntPtr scope; + ret = Interop.Response.GetScope(responseHandle, out scope); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "Scope can't be found"); + } + + IntPtr state; + ret = Interop.Response.GetState(responseHandle, out state); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "State can't be found"); + } + + IEnumerable scopes = (scope == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(scope)?.Split(' '); + + var token = new AccessToken(); + token.Token = (accessToken == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(accessToken); + token.TokenType = (tokenType == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(tokenType); + token.Scope = scopes; + token.ExpiresIn = expiresIn; + + response = new TokenResponse(responseHandle); + response.AccessToken = token; + response.State = (state == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(state); + response.RefreshToken = (refreshToken == IntPtr.Zero) ? null : new RefreshToken() { Token = Marshal.PtrToStringAnsi(refreshToken) }; + } + }; + + ret = Interop.Manager.RequestAccessToken(_managerHandle, requestHandle, accessTokenCb, IntPtr.Zero); + Interop.Request.Destroy(requestHandle); + if (ret != (int)OAuth2Error.None || error != IntPtr.Zero) + { + if (error != IntPtr.Zero) + { + throw ErrorFactory.GetException(error); + } + else + { + Log.Error(ErrorFactory.LogTag, "Interop failed : " + ret); + throw ErrorFactory.GetException(ret); + } + } + + return response; + } + } +} + diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentials.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentials.cs new file mode 100755 index 0000000..3b6f58b --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentials.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.OAuth2 +{ + /// + /// Contains client credentials required for authentication in request-body + /// + /// 3 + public class ClientCredentials + { + /// + /// The constructor + /// + /// 3 + public ClientCredentials() + { + + } + + /// + /// The client identifier + /// + /// 3 + public string Id { get; set; } + + /// + /// The client secret + /// + /// 3 + public string Secret { get; set; } + } +} + diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsAuthorizer.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsAuthorizer.cs new file mode 100755 index 0000000..b9d8f1c --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsAuthorizer.cs @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The ClientCredentialsAuthorizer is used to obtain access tokens using Client Credentials Grant flow as described at https://tools.ietf.org/html/rfc6749#section-4.4 + /// + /// 3 + public class ClientCredentialsAuthorizer : Authorizer + { + /// + /// The constructor + /// + /// 3 + public ClientCredentialsAuthorizer() + { + + } + + /// + /// Authorization not supported through this API for this flow. + /// + /// 3 + /// Thrown when the operation is not supported + public override Task AuthorizeAsync(AuthorizationRequest request) + { + Log.Error(ErrorFactory.LogTag, "Authorization is not supported in this flow"); + throw new InvalidOperationException(); + } + + /// + /// Refreshing access token is not supported in this flow. + /// + /// 3 + /// Thrown when the operation is not supported + public override Task RefreshAccessTokenAsync(RefreshTokenRequest request) + { + Log.Error(ErrorFactory.LogTag, "Refreshing access token is not supported in this flow"); + throw new InvalidOperationException(); + } + + /// + /// Retrieves access token using client credentials. + /// The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.4.2 + /// + /// 3 + /// The token request + /// The response containing access token. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public override async Task GetAccessTokenAsync(TokenRequest request) + { + IntPtr requestHandle = GetRequestHandle(request as ClientCredentialsTokenRequest); + return await Task.Run(() => GetAccessToken(requestHandle)); + } + + // Fill device request handle for access token + private IntPtr GetRequestHandle(ClientCredentialsTokenRequest request) + { + if (request == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)OAuth2Error.InvalidParameter); + } + + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetTokenEndPointUrl(requestHandle, request.TokenEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetRedirectionUrl(requestHandle, request.RedirectionEndPoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetGrantType(requestHandle, Interop.GrantType.ClientCredentials); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.ClientSecrets.Id != null) + { + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.ClientSecrets.Secret != null) + { + ret = Interop.Request.SetClientSecret(requestHandle, request.ClientSecrets.Secret); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.Scopes != null) + { + string scope = string.Join(" ", request.Scopes); + ret = Interop.Request.SetScope(requestHandle, scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.CustomData != null) + { + foreach (var item in request.CustomData) + { + ret = Interop.Request.AddCustomData(requestHandle, item.Key, item.Value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + } + + ret = Interop.Request.SetClientAuthenticationType(requestHandle, (int) request.AuthenticationScheme); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + return requestHandle; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsTokenRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsTokenRequest.cs new file mode 100755 index 0000000..a57225f --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ClientCredentialsTokenRequest.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for retreiving access token in Client Credentials Grant flow. + /// + /// 3 + public class ClientCredentialsTokenRequest : TokenRequest + { + /// + /// The constructor + /// + /// 3 + public ClientCredentialsTokenRequest() + { + + } + + /// + /// The grant type. + /// + /// 3 + public override string GrantType { get; } = "client_credentials"; + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizationRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizationRequest.cs new file mode 100755 index 0000000..385a798 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizationRequest.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for retreiving authorization code in Authorization Code Grant flow. + /// Please refer https://tools.ietf.org/html/rfc6749#section-4.1.1 for more details + /// + public class CodeGrantAuthorizationRequest : AuthorizationRequest + { + /// + /// The constructor + /// + /// 3 + public CodeGrantAuthorizationRequest() + { + + } + + /// + /// The response type parameter to authorization server. + /// + /// 3 + public override string ResponseType { get; } = "code"; + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizer.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizer.cs new file mode 100755 index 0000000..bb7f1b5 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantAuthorizer.cs @@ -0,0 +1,343 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The CodeGrantAuthorizer is used to obtain access tokens and refresh tokens using Authorization Code Grant flow as described at https://tools.ietf.org/html/rfc6749#section-4.1 + /// + /// 3 + public class CodeGrantAuthorizer : Authorizer + { + /// + /// The constructor + /// + /// 3 + public CodeGrantAuthorizer() + { + + } + + /// + /// Retrieves authorization code asynchronously. The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.1.1 + /// + /// 3 + /// The authorization request + /// The response containing authorization code. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public override async Task AuthorizeAsync(AuthorizationRequest request) + { + IntPtr requestHandle = GetRequestHandle(request as CodeGrantAuthorizationRequest); + return await Task.Run(() => GetAuthorizationResponse(requestHandle)); + } + + /// + /// Retrieves access token by exchanging authorization code received using . + /// The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.1.3 + /// + /// 3 + /// The token request + /// The response containing access token. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public override async Task GetAccessTokenAsync(TokenRequest request) + { + IntPtr requestHandle = GetRequestHandle(request as CodeGrantTokenRequest); + return await Task.Run(() => GetAccessTokenByCode(requestHandle) ); + } + + /// + /// Clears the cookies + /// + /// 3 + public void ClearCookies() + { + int ret = (int)OAuth2Error.None; + ret = Interop.Manager.ClearCookies(_managerHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Clear the cache + /// + /// 3 + public void ClearCache() + { + int ret = (int)OAuth2Error.None; + ret = Interop.Manager.ClearCache(_managerHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + // Fill device request handle for Authorization code grant + private IntPtr GetRequestHandle(CodeGrantAuthorizationRequest request) + { + if (request == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)OAuth2Error.InvalidParameter); + } + + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetAuthEndPointUrl(requestHandle, request.AuthorizationEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetResponseType(requestHandle, Interop.ResponseType.Code); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.ClientSecrets.Id != null) + { + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.ClientSecrets.Secret != null) + { + ret = Interop.Request.SetClientSecret(requestHandle, request.ClientSecrets.Secret); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.RedirectionEndPoint != null) + { + ret = Interop.Request.SetRedirectionUrl(requestHandle, request.RedirectionEndPoint.OriginalString); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.Scopes != null) + { + string scope = string.Join(" ", request.Scopes); + ret = Interop.Request.SetScope(requestHandle, scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.State != null) + { + ret = Interop.Request.SetState(requestHandle, request.State); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.CustomData != null) + { + foreach( var item in request.CustomData) + { + ret = Interop.Request.AddCustomData(requestHandle, item.Key, item.Value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + } + + return requestHandle; + } + + // Fill device request handle for access token + private IntPtr GetRequestHandle(CodeGrantTokenRequest request) + { + if (request == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)OAuth2Error.InvalidParameter); + } + + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetGrantType(requestHandle, Interop.GrantType.AuthCode); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetAuthorizationCode(requestHandle, request.Code); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetTokenEndPointUrl(requestHandle, request.TokenEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetRedirectionUrl(requestHandle, request.RedirectionEndPoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.ClientSecrets.Secret != null) + { + ret = Interop.Request.SetClientSecret(requestHandle, request.ClientSecrets.Secret); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.CustomData != null) + { + foreach (var item in request.CustomData) + { + ret = Interop.Request.AddCustomData(requestHandle, item.Key, item.Value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + } + + ret = Interop.Request.SetClientAuthenticationType(requestHandle, (int)request.AuthenticationScheme); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + return requestHandle; + } + + private AuthorizationResponse GetAuthorizationResponse(IntPtr requestHandle) + { + AuthorizationResponse response = null; + int ret = (int)OAuth2Error.None; + IntPtr error = IntPtr.Zero; + + Interop.Manager.Oauth2AuthGrantCallback authGrantCb = (IntPtr responseHandle, IntPtr usrData) => + { + if (responseHandle == IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Error occured"); + throw (new ArgumentNullException()); + } + + Interop.Response.GetError(responseHandle, out error); + if (error == IntPtr.Zero) + { + Log.Warn(ErrorFactory.LogTag, "Error occured"); + throw ErrorFactory.GetException(error); + } + else + { + IntPtr authorizationCode; + ret = Interop.Response.GetAuthorizationCode(responseHandle, out authorizationCode); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr state; + ret = Interop.Response.GetState(responseHandle, out state); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + response = new AuthorizationResponse(responseHandle) { Code = Marshal.PtrToStringAnsi(authorizationCode), State = Marshal.PtrToStringAnsi(state) }; + } + }; + + ret = Interop.Manager.RequestAuthorizationGrant(_managerHandle, requestHandle, authGrantCb, IntPtr.Zero); + Interop.Request.Destroy(requestHandle); + if (ret != (int)OAuth2Error.None || error != IntPtr.Zero) + { + if (error != IntPtr.Zero) + { + throw ErrorFactory.GetException(error); + } + else + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + return response; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantTokenRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantTokenRequest.cs new file mode 100755 index 0000000..38d21f9 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/CodeGrantTokenRequest.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for retreiving access token in Authorization Code Grant flow. + /// + /// 3 + public class CodeGrantTokenRequest : TokenRequest + { + /// + /// The constructor + /// + /// 3 + public CodeGrantTokenRequest() + { + + } + + /// + /// The grant type + /// + /// 3 + public override string GrantType { get; } = "authorization_code"; + + /// + /// The authoriztion code received from the authorization server. + /// + /// 3 + public string Code { get; set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizationRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizationRequest.cs new file mode 100755 index 0000000..5b0c50a --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizationRequest.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for retreiving access token in Implicit Grant flow. + /// + public class ImplicitGrantAuthorizationRequest : AuthorizationRequest + { + /// + /// The constructor + /// + /// 3 + public ImplicitGrantAuthorizationRequest() + { + + } + + /// + /// The response type parameter to aturhoization server. + /// + /// 3 + public override string ResponseType { get; } = "token"; + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizer.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizer.cs new file mode 100755 index 0000000..c59dbee --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ImplicitGrantAuthorizer.cs @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The ImplicitGrantAuthorizer is used to obtain access tokens using Implicit Grant flow as described at https://tools.ietf.org/html/rfc6749#section-4.2 + /// + /// 3 + public class ImplicitGrantAuthorizer : Authorizer + { + /// + /// The constructor + /// + /// 3 + public ImplicitGrantAuthorizer() + { + + } + + /// + /// Retrieves access token asynchronously. The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.2.1 + /// + /// 3 + /// The authorization request + /// The response containing access token. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public new virtual async Task AuthorizeAsync(AuthorizationRequest request) + { + IntPtr requestHandle = GetRequestHandle(request as ImplicitGrantAuthorizationRequest); + return await Task.Run(() => GetAuthorizationResponse(requestHandle)); + } + + /// + /// Access token can be retreived implicitly using in this flow. + /// + /// 3 + /// Thrown when the operation is not supported + public override Task GetAccessTokenAsync(TokenRequest request) + { + Log.Error(ErrorFactory.LogTag, "Obtain token directly from authorization grant "); + throw new InvalidOperationException(); + } + + /// + /// Refreshing access token is not supported in this flow. + /// + /// 3 + /// Thrown when the operation is not supported + public override Task RefreshAccessTokenAsync(RefreshTokenRequest request) + { + Log.Error(ErrorFactory.LogTag, "Refesh token is not supported in Implicit Grant flow"); + throw new InvalidOperationException(); + } + + private TokenResponse GetAuthorizationResponse(IntPtr requestHandle) + { + IntPtr error = IntPtr.Zero; + TokenResponse response = null; + int ret = (int)OAuth2Error.None; + Interop.Manager.Oauth2AuthGrantCallback authGrantCb = (IntPtr responseHandle, IntPtr usrData) => + { + if (responseHandle == IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Error occured"); + throw (new ArgumentNullException()); + } + + Interop.Response.GetError(responseHandle, out error); + if (error != IntPtr.Zero) + { + Log.Error(ErrorFactory.LogTag, "Server Error occured"); + } + else + { + IntPtr accessToken; + ret = Interop.Response.GetAccessToken(responseHandle, out accessToken); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr tokenType; + ret = Interop.Response.GetTokenType(responseHandle, out tokenType); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + long expiresIn; + ret = Interop.Response.GetExpiresIn(responseHandle, out expiresIn); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr scope; + ret = Interop.Response.GetScope(responseHandle, out scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IntPtr state; + ret = Interop.Response.GetState(responseHandle, out state); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + IEnumerable scopes = (scope == IntPtr.Zero) ? null : Marshal.PtrToStringAnsi(scope)?.Split(' '); + + var token = new AccessToken() { Token = Marshal.PtrToStringAnsi(accessToken), ExpiresIn = expiresIn, Scope = scopes, TokenType = Marshal.PtrToStringAnsi(tokenType) }; + response = new TokenResponse(responseHandle) { AccessToken = token, State = Marshal.PtrToStringAnsi(state), RefreshToken = null }; + } + }; + + ret = Interop.Manager.RequestAuthorizationGrant(_managerHandle, requestHandle, authGrantCb, IntPtr.Zero); + Interop.Request.Destroy(requestHandle); + if (ret != (int)OAuth2Error.None || error != IntPtr.Zero) + { + if (error != IntPtr.Zero) + { + throw ErrorFactory.GetException(error); + } + else + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + return response; + } + + // Fill device request handle for Authorization code grant + private IntPtr GetRequestHandle(ImplicitGrantAuthorizationRequest request) + { + if (request == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)OAuth2Error.InvalidParameter); + } + + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetAuthEndPointUrl(requestHandle, request.AuthorizationEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetResponseType(requestHandle, Interop.ResponseType.Token); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.RedirectionEndPoint != null) + { + ret = Interop.Request.SetRedirectionUrl(requestHandle, request.RedirectionEndPoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.Scopes != null) + { + string scope = string.Join(" ", request.Scopes); + ret = Interop.Request.SetScope(requestHandle, scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.State != null) + { + ret = Interop.Request.SetState(requestHandle, request.State); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.CustomData != null) + { + foreach (var item in request.CustomData) + { + ret = Interop.Request.AddCustomData(requestHandle, item.Key, item.Value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + } + + return requestHandle; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorFactory.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorFactory.cs new file mode 100755 index 0000000..08569f6 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorFactory.cs @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Account.OAuth2 +{ + internal enum OAuth2Error + { + // Tizen Account Oauth Error + // TIZEN_ERROR_ACCOUNT_OAUTH -0x01010000 + + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + AlreadyInProgress = ErrorCode.AlreadyInProgress, + NotSupported = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + ParseFailed = -0x01010000 | 0X01, + NetworkError = -0x01010000 | 0X02, + Server = -0x01010000 | 0X03, + UserCancelled = -0x01010000 | 0X04, + ValueNotFound = -0x01010000 | 0X05, + Unknown = ErrorCode.Unknown + } + + internal class ErrorFactory + { + internal static string LogTag = "Tizen.Account.OAuth2"; + + internal static Exception GetException(IntPtr error) + { + int serverErrorCode, platformErrorCode; + int ret = Interop.Error.GetCode(error, out serverErrorCode, out platformErrorCode); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "error code can't be found"); + } + + string errorDescription; + ret = Interop.Error.GetDescription(error, out errorDescription); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "error description can't be found"); + } + + string uri; + Interop.Error.GetUri(error, out uri); + if (ret != (int)OAuth2Error.None) + { + Log.Debug(ErrorFactory.LogTag, "error uri can't be found"); + } + + var errorResponse = new OAuth2ErrorResponse() + { + PlatformErrorCode = platformErrorCode, + ServerErrorCode = serverErrorCode, + ErrorUri = uri, + Error = errorDescription + }; + + return new OAuth2Exception() { Error = errorResponse }; + } + + internal static Exception GetException(int error) + { + if ((OAuth2Error)error == OAuth2Error.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if ((OAuth2Error)error == OAuth2Error.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if ((OAuth2Error)error == OAuth2Error.AlreadyInProgress) + { + return new InvalidOperationException("Request already in progress"); + } + else if ((OAuth2Error)error == OAuth2Error.NotSupported) + { + return new NotSupportedException("Not supported"); + } + else if ((OAuth2Error)error == OAuth2Error.PermissionDenied) + { + return new UnauthorizedAccessException("Permission denied"); + } + else if ((OAuth2Error)error == OAuth2Error.ParseFailed) + { + return new FormatException("Parsing failed"); + } + else if ((OAuth2Error)error == OAuth2Error.NetworkError) + { + return new Exception("Networking error occured"); + } + else if ((OAuth2Error)error == OAuth2Error.Server) + { + return new Exception("Server error"); + } + else if ((OAuth2Error)error == OAuth2Error.UserCancelled) + { + return new Exception("User cancelled"); + } + else if ((OAuth2Error)error == OAuth2Error.ValueNotFound) + { + return new ArgumentException("Value not found"); + } + else + { + return new Exception("Unknown error"); + } + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorResponse.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorResponse.cs new file mode 100755 index 0000000..82f1024 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/OAuth2ErrorResponse.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Account.OAuth2 +{ + /// + /// Exception wrapper for OAuth2 related exception + /// + public class OAuth2Exception : Exception + { + internal OAuth2Exception() + { + } + + /// + /// The error response. + /// + /// 3 + public OAuth2ErrorResponse Error { get; internal set; } + } + + /// + /// Wrapper class contaning OAuth2 related error information + /// + /// 3 + public class OAuth2ErrorResponse + { + internal OAuth2ErrorResponse () + { + + } + + /// + /// The server error code + /// + /// 3 + public int ServerErrorCode { get; internal set; } + + /// + /// The platform error cocde + /// + /// 3 + public int PlatformErrorCode { get; internal set; } + + /// + /// Error description + /// + /// 3 + public string Error { get; internal set; } + + /// + /// URI of the error page. + /// + /// 3 + public string ErrorUri { get; internal set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshToken.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshToken.cs new file mode 100755 index 0000000..5050563 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshToken.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// The refresh token which can be used to obtain new access token. + /// + /// 3 + public class RefreshToken + { + internal RefreshToken () + { + + } + + /// + /// The refresh token issued to the client. + /// + /// 3 + public string Token { get; internal set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshTokenRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshTokenRequest.cs new file mode 100755 index 0000000..0928ab6 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/RefreshTokenRequest.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for refreshing an access token. + /// + /// 3 + public class RefreshTokenRequest : TokenRequest + { + /// + /// The constructor + /// + /// 3 + public RefreshTokenRequest() + { + + } + + /// + /// The grant type to be used + /// + /// 3 + public override string GrantType { get; } = "refresh_token"; + + /// + /// The refresh token issued by authorization server. + /// + /// 3 + public string RefreshToken { get; set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsAuthorizer.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsAuthorizer.cs new file mode 100755 index 0000000..27ae244 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsAuthorizer.cs @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The ResourceOwnerPwdCredentialsAuthorizer is used to obtain access tokens using Resource Owner Password Credentials Grant flow as described at https://tools.ietf.org/html/rfc6749#section-4.3 + /// + /// 3 + public class ResourceOwnerPwdCredentialsAuthorizer : Authorizer + { + /// + /// The constructor + /// + /// 3 + public ResourceOwnerPwdCredentialsAuthorizer() + { + + } + + /// + /// Authorization not supported through this API for this flow. + /// + /// 3 + /// Thrown when the operation is not supported + public override Task AuthorizeAsync(AuthorizationRequest request) + { + Log.Error(ErrorFactory.LogTag, "Authorization is not supported in this flow"); + throw new InvalidOperationException(); + } + + /// + /// Retrieves access token by sending resource owner's password credentials. + /// The authroization request parameters should be as defined in https://tools.ietf.org/html/rfc6749#section-4.3.2 + /// + /// 3 + /// The token request + /// The response containing access token. + /// http://tizen.org/privilege/internet + /// Thrown when method failed due to invalid argumets + /// Thrown when method fails due to server error + public override async Task GetAccessTokenAsync(TokenRequest request) + { + IntPtr requestHandle = GetRequestHandle(request as ResourceOwnerPwdCredentialsTokenRequest); + return await Task.Run(() => GetAccessToken(requestHandle)); + } + + // Fill device request handle for access token + private IntPtr GetRequestHandle(ResourceOwnerPwdCredentialsTokenRequest request) + { + if (request == null) + { + Log.Error(ErrorFactory.LogTag, "Invalid request or request is null"); + throw ErrorFactory.GetException((int)OAuth2Error.InvalidParameter); + } + + IntPtr requestHandle; + int ret = Interop.Request.Create(out requestHandle); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetTokenEndPointUrl(requestHandle, request.TokenEndpoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetRedirectionUrl(requestHandle, request.RedirectionEndPoint.ToString()); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetGrantType(requestHandle, Interop.GrantType.Password); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetUserName(requestHandle, request.Username); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Request.SetPassword(requestHandle, request.Password); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + if (request.ClientSecrets.Id != null) + { + ret = Interop.Request.SetClientId(requestHandle, request.ClientSecrets.Id); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.ClientSecrets.Secret != null) + { + ret = Interop.Request.SetClientSecret(requestHandle, request.ClientSecrets.Secret); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.Scopes != null) + { + string scope = string.Join(" ", request.Scopes); + ret = Interop.Request.SetScope(requestHandle, scope); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + if (request.CustomData != null) + { + foreach (var item in request.CustomData) + { + ret = Interop.Request.AddCustomData(requestHandle, item.Key, item.Value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + } + + if (request.State != null) + { + ret = Interop.Request.SetState(requestHandle, request.State); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + } + + ret = Interop.Request.SetClientAuthenticationType(requestHandle, (int)request.AuthenticationScheme); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + + return requestHandle; + } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsTokenRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsTokenRequest.cs new file mode 100755 index 0000000..a0cf7fa --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/ResourceOwnerPwdCredentialsTokenRequest.cs @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Account.OAuth2 +{ + /// + /// The class contains request parameters for retreiving access token in Resource Owner Password Credentials Grant flow. + /// + /// 3 + public class ResourceOwnerPwdCredentialsTokenRequest : TokenRequest + { + /// + /// The constructor + /// + public ResourceOwnerPwdCredentialsTokenRequest() + { + + } + + /// + /// The grant type + /// + /// 3 + public override string GrantType { get; } = "password"; + + /// + /// The resource owner username + /// + /// 3 + public string Username { get; set; } + + /// + /// The resource owner password + /// + /// 3 + public string Password { get; set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenRequest.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenRequest.cs new file mode 100755 index 0000000..1575c22 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenRequest.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Account.OAuth2 +{ + /// + /// Abstract wrapper class containing OAuth 2.0 request parameters for requesting an access token. + /// + /// 3 + public abstract class TokenRequest + { + /// + /// The Grant type + /// + /// 3 + public abstract string GrantType { get; } + + /// + /// The client credentials + /// + /// 3 + public ClientCredentials ClientSecrets { get; set; } + + /// + /// The access token end point URL. + /// + /// 3 + public Uri TokenEndpoint { get; set; } + + /// + /// The redirection endpoint of the auhorization flow. + /// + /// 3 + public Uri RedirectionEndPoint { get; set; } + + /// + /// The scope of the access request as described by https://tools.ietf.org/html/rfc6749#section-3.3 + /// + /// 3 + public IEnumerable Scopes { get; set; } + + /// + /// Custom key-value parameters to be sent to the server + /// + /// 3 + public IEnumerable> CustomData { get; set; } + + /// + /// Client authentication scheme. Default is Basic + /// + /// 3 + public AuthenticationScheme AuthenticationScheme { get; set; } = AuthenticationScheme.Basic; + + /// + /// The client's state which is maintained between request and response. + /// + /// 3 + public string State { get; set; } + } +} diff --git a/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenResponse.cs b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenResponse.cs new file mode 100755 index 0000000..0783268 --- /dev/null +++ b/src/Tizen.Account.OAuth2/Tizen.Account.OAuth2/TokenResponse.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Account.OAuth2 +{ + /// + /// The response from authroization server containing access token and an optional refresh token. + /// + /// 3 + public class TokenResponse + { + private bool _disposed = false; + private IntPtr _responseHandle; + + internal TokenResponse(IntPtr handle) + { + _responseHandle = handle; + } + + /// + /// Destructor of the AuthorizationResponse class. + /// + /// 3 + ~TokenResponse() + { + Dispose(false); + } + + /// + /// The access token + /// + /// 3 + public AccessToken AccessToken { get; internal set; } + + /// + /// The state parameter present in authorization request. + /// + /// 3 + /// + /// The value can be null depending on the server specifications. + /// + public string State { get; internal set; } + + /// + /// The refresh token. The value will be null if authorization server doesn't return a refresh token. + /// + /// 3 + /// + /// Issuing a refresh token is optional at the discretion of the authorization server. + /// + public RefreshToken RefreshToken { get; internal set; } + + /// + /// Gets the value of the key received from service provider + /// + /// 3 + /// The value of respecitve key + /// Thrown when the key does not exist or when there is an invalid parameter. + public string GetCustomValue(string key) + { + IntPtr value; + int ret = Interop.Response.GetCustomData(_responseHandle, key, out value); + if (ret != (int)OAuth2Error.None) + { + Log.Error(ErrorFactory.LogTag, "Interop failed"); + throw ErrorFactory.GetException(ret); + } + return Marshal.PtrToStringAnsi(value); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.Response.Destroy(_responseHandle); + _disposed = true; + } + } +} diff --git a/src/Tizen.Applications.Alarm/Interop/Interop.Alarm.cs b/src/Tizen.Applications.Alarm/Interop/Interop.Alarm.cs new file mode 100755 index 0000000..bb4bbf9 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Interop/Interop.Alarm.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Internals.Errors; +using Tizen.Applications; +using Tizen.Applications.Notifications; + +internal static partial class Interop +{ + internal static partial class Alarm + { + [StructLayout(LayoutKind.Sequential)] + internal struct DateTime + { + internal int sec; + internal int min; + internal int hour; + internal int mday; /* day of the month, range 1 to 31*/ + internal int mon; + internal int year; + internal int wday; /* day of the week, range 0 to 6*/ + internal int yday; /* day in the year, range 0 to 365*/ + internal int isdst; /* daylight saving time*/ + internal long tm_gmtoff; + internal IntPtr tm_zone; + }; + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_after_delay")] + internal static extern int CreateAlarmAfterDelay(SafeAppControlHandle appControl, int delay, int period, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_after_delay")] + internal static extern int CreateAlarmOnceAfterDelay(SafeAppControlHandle appControl, int delay, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_once_at_date")] + internal static extern int CreateAlarmOnceAtDate(SafeAppControlHandle appControl, ref DateTime date, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_with_recurrence_week_flag")] + internal static extern int CreateAlarmRecurWeek(SafeAppControlHandle appControl, ref DateTime date, int week, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_recurrence_week_flag")] + internal static extern int GetAlarmWeekFlag(int alarmId, out int weekFlag); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel")] + internal static extern int CancelAlarm(int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_cancel_all")] + internal static extern int CancelAllAlarms(); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_date")] + internal static extern int GetAlarmScheduledDate(int alarmId, out DateTime date); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_current_time")] + internal static extern int GetCurrentTime(out DateTime date); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_app_control")] + internal static extern int GetAlarmAppControl(int alarmId, out SafeAppControlHandle control); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_scheduled_period")] + internal static extern int GetAlarmScheduledPeriod(int alarmId, out int period); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_set_global")] + internal static extern int SetAlarmGlobalFlag(int alarmId, bool global); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_get_global")] + internal static extern int GetAlarmGlobalFlag(int alarmId, out bool global); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_foreach_registered_alarm")] + internal static extern int GetAllRegisteredAlarms(RegisteredAlarmCallback callback, IntPtr userData); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_once_at_date")] + internal static extern AlarmError CreateAlarmNotiOnceAtDate(NotificationSafeHandle noti, ref DateTime date, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_after_delay")] + internal static extern AlarmError CreateAlarmNotiAfterDelay(NotificationSafeHandle noti, int delay, int period, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_once_after_delay")] + internal static extern AlarmError CreateAlarmNotiOnceAfterDelay(NotificationSafeHandle noti, int delay, out int alarmId); + + [DllImport(Libraries.Alarm, EntryPoint = "alarm_schedule_noti_with_recurrence_week_flag")] + internal static extern AlarmError CreateAlarmNotiRecurWeek(NotificationSafeHandle noti, ref DateTime date, int week, out int alarmId); + + //callback + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool RegisteredAlarmCallback(int alarmId, IntPtr userData); + } +} diff --git a/src/Tizen.Applications.Alarm/Interop/Interop.Libraries.cs b/src/Tizen.Applications.Alarm/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..63f4a29 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Alarm = "libcapi-appfw-alarm.so.0"; + } +} diff --git a/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.csproj b/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.csproj new file mode 100755 index 0000000..42d8c2c --- /dev/null +++ b/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.sln b/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.sln new file mode 100755 index 0000000..9afcde6 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Tizen.Applications.Alarm.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Alarm", "Tizen.Applications.Alarm.csproj", "{8807011E-9AE7-41D2-B568-E9F7B1B8E030}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{ECB33982-A146-4B3E-A8C8-C3496EA897B2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Notification", "..\Tizen.Applications.Notification\Tizen.Applications.Notification.csproj", "{243EE447-5438-495D-AD85-4261EB97EA4F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{9FFD6275-D54A-4F6B-9066-619F82D8B2C6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{6F685D6D-FD89-4F05-AC1B-BBB8473B5F5F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8807011E-9AE7-41D2-B568-E9F7B1B8E030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8807011E-9AE7-41D2-B568-E9F7B1B8E030}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8807011E-9AE7-41D2-B568-E9F7B1B8E030}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8807011E-9AE7-41D2-B568-E9F7B1B8E030}.Release|Any CPU.Build.0 = Release|Any CPU + {ECB33982-A146-4B3E-A8C8-C3496EA897B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECB33982-A146-4B3E-A8C8-C3496EA897B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECB33982-A146-4B3E-A8C8-C3496EA897B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECB33982-A146-4B3E-A8C8-C3496EA897B2}.Release|Any CPU.Build.0 = Release|Any CPU + {243EE447-5438-495D-AD85-4261EB97EA4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {243EE447-5438-495D-AD85-4261EB97EA4F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {243EE447-5438-495D-AD85-4261EB97EA4F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {243EE447-5438-495D-AD85-4261EB97EA4F}.Release|Any CPU.Build.0 = Release|Any CPU + {9FFD6275-D54A-4F6B-9066-619F82D8B2C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FFD6275-D54A-4F6B-9066-619F82D8B2C6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FFD6275-D54A-4F6B-9066-619F82D8B2C6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FFD6275-D54A-4F6B-9066-619F82D8B2C6}.Release|Any CPU.Build.0 = Release|Any CPU + {6F685D6D-FD89-4F05-AC1B-BBB8473B5F5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F685D6D-FD89-4F05-AC1B-BBB8473B5F5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F685D6D-FD89-4F05-AC1B-BBB8473B5F5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F685D6D-FD89-4F05-AC1B-BBB8473B5F5F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Alarm/Tizen.Applications/Alarm.cs b/src/Tizen.Applications.Alarm/Tizen.Applications/Alarm.cs new file mode 100755 index 0000000..af69b75 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Tizen.Applications/Alarm.cs @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The Alarm API allows setting an "alarm clock" for the delivery of a notification at some point in the future. + /// + /// + /// + /// public class AlarmExample + /// { + /// /// ... + /// IEnumerable < Alarm > alarms = AlarmManager.GetAllScheduledAlarms(); + /// alarms[0].Cancel(); + /// } + /// + /// + public class Alarm + { + private const string _logTag = "Tizen.Applications.Alarm"; + + /// + /// Constructor created with new AlarmId. + /// + /// + internal Alarm(int id) + { + AlarmId = id; + } + + /// + /// The alarm ID uniquely identifies an alarm. + /// + public int AlarmId + { + get; private set; + } + + /// + /// Gets the recurrence days of the week. + /// + /// http://tizen.org/privilege/alarm.get + /// + /// week_flag may be a combination of days, like Tuesday | Friday + /// + public AlarmWeekFlag WeekFlag + { + get + { + int week; + AlarmError ret = (AlarmError)Interop.Alarm.GetAlarmWeekFlag(AlarmId, out week); + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + + return (AlarmWeekFlag)week; + } + } + + /// + /// Gets the scheduled time. + /// + /// http://tizen.org/privilege/alarm.get + public DateTime ScheduledDate + { + get + { + Interop.Alarm.DateTime value; + AlarmError ret = (AlarmError)Interop.Alarm.GetAlarmScheduledDate(AlarmId, out value); + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + + DateTime time = AlarmManager.ConvertIntPtrToDateTime(value); + return time; + } + } + + /// + /// Gets the period of time between the recurrent alarms. + /// + /// http://tizen.org/privilege/alarm.get + public int Period + { + get + { + int period; + AlarmError ret = (AlarmError)Interop.Alarm.GetAlarmScheduledPeriod(AlarmId, out period); + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + + return period; + } + } + + /// + /// Gets the AppControl to be invoked when the the alarm is triggered. + /// + /// http://tizen.org/privilege/alarm.get + public AppControl AlarmAppControl + { + get + { + SafeAppControlHandle handle; + AlarmError ret = (AlarmError)Interop.Alarm.GetAlarmAppControl(AlarmId, out handle); + + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + + return new AppControl(handle); + } + } + + /// + /// Gets whether the alarm will launch global application or not. + /// + /// http://tizen.org/privilege/alarm.set + /// http://tizen.org/privilege/alarm.get + public bool Global + { + get + { + bool global; + AlarmError ret = (AlarmError)Interop.Alarm.GetAlarmGlobalFlag(AlarmId, out global); + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + + return global; + } + + set + { + AlarmError ret = (AlarmError)Interop.Alarm.SetAlarmGlobalFlag(AlarmId, value); + if (ret != AlarmError.None) + { + Log.Error(_logTag, "Failed to get WeekFlag"); + } + } + } + + /// + /// Cancels the the specific alarm. + /// + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied due to insufficient previlleges. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public void Cancel() + { + AlarmError ret = (AlarmError)Interop.Alarm.CancelAlarm(AlarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to Cancel alarm"); + } + } + } +} diff --git a/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmErrorFactory.cs b/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmErrorFactory.cs new file mode 100755 index 0000000..4524882 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmErrorFactory.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + internal enum AlarmError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + InvalidTime = -0x01100000 | 0x05, + InvalidDate = -0x01100000 | 0x06, + ConnectionFail = -0x01100000 | 0x07, + NotPermittedApp = -0x01100000 | 0x08, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied + } + internal static class AlarmErrorFactory + { + private const string _logTag = "Tizen.Applications.Alarm"; + + internal static Exception GetException(AlarmError ret, string msg) + { + switch (ret) + { + case AlarmError.InvalidParameter: + //fall through + case AlarmError.InvalidTime: + //fall through + case AlarmError.InvalidDate: + Log.Error(_logTag, msg); + return new ArgumentException(ret + " error occurred."); + case AlarmError.NotPermittedApp: + //fall through + case AlarmError.PermissionDenied: + Log.Error(_logTag, msg); + return new UnauthorizedAccessException(ret + "error occured."); + default: + Log.Error(_logTag, msg); + return new InvalidOperationException(ret + " error occurred."); + } + } + } +} diff --git a/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmManager.cs b/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmManager.cs new file mode 100755 index 0000000..60d2954 --- /dev/null +++ b/src/Tizen.Applications.Alarm/Tizen.Applications/AlarmManager.cs @@ -0,0 +1,412 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + using System; + using System.Collections.Generic; + using System.Runtime.InteropServices; + using Tizen.Applications.Notifications; + + /// + /// Enumeration for Alarm Week Flag, the days of the week. + /// + [Flags] + public enum AlarmWeekFlag + { + /// + /// Identifier for Sunday. + /// + Sunday = 0x01, + + /// + /// Identifier for Monday. + /// + Monday = 0x02, + + /// + /// Identifier for Tuesday. + /// + Tuesday = 0x04, + + /// + /// Identifier for Wednesday. + /// + Wednesday = 0x08, + + /// + /// Identifier for Thursday. + /// + Thursday = 0x10, + + /// + /// Identifier for Friday. + /// + Friday = 0x20, + + /// + /// Identifier for Saturday. + /// + Saturday = 0x40, + + /// + /// All Days of the Week. + /// + AllDays = Sunday |Monday|Tuesday|Wednesday|Thursday|Friday|Saturday, + + /// + /// Only Weekdays + /// + WeekDays = Monday | Tuesday | Wednesday | Thursday | Friday + } + + /// + /// Mobile devices typically give constant access to information from various sources.Some of this information is best delivered through alarms - + /// the most obvious case is a calendar scheduling application which lets you know when a meeting is about to start.Alarms are certainly better than actively waiting in a loop. + /// They are also better than putting an interface to sleep because they do not block your main UI thread. + /// Use of alarms helps build smooth user experiences and implements unattended data synchronization tasks. + /// If an application is installed after setting the alarm, your alarm is cancelled automatically. + /// + /// + /// + /// public class AlarmManagerExample + /// { + /// /// ... + /// Alarm alarm = AlarmManager.CreateAlarm(24000,1000,null); + /// AlarmManager.CancelAll(); + /// } + /// + /// + + public static class AlarmManager + { + private const string LogTag = "Tizen.Applications.Alarm"; + + private static Interop.Alarm.DateTime ConvertDateTimeToStruct(DateTime value) + { + Interop.Alarm.DateTime time = new Interop.Alarm.DateTime(); + time.sec = value.Second; + time.min = value.Minute; + time.hour = value.Hour; + time.mday = value.Day; + time.mon = value.Month - 1; + time.year = value.Year - 1900; + time.wday = (int)value.DayOfWeek; + time.yday = value.DayOfYear; + time.isdst = 0; + return time; + } + + internal static DateTime ConvertIntPtrToDateTime(Interop.Alarm.DateTime time) + { + DateTime value = new DateTime(1900 + time.year, 1 + time.mon, time.mday, time.hour, time.min, time.sec, DateTimeKind.Utc); + return value; + } + + /// + /// Sets an alarm to be triggered after a specific time. + /// The alarm will first go off delay seconds later and then will go off every certain amount of time defined using period seconds. + /// + /// The amount of time before the first execution (in seconds). + /// The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy. + /// The actual interval is calculated by the OS. The minimum value is 600sec + /// The destination AppControl to perform a specific task when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public static Alarm CreateAlarm(int delay, int period, AppControl appControl) + { + Alarm alarm = null; + int alarmId; + SafeAppControlHandle handle = (appControl == null) ? null : appControl.SafeAppControlHandle; + AlarmError ret = (AlarmError)Interop.Alarm.CreateAlarmAfterDelay(handle, delay, period, out alarmId); + alarm = new Alarm(alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + return alarm; + } + + /// + /// Sets an alarm to be triggered after a specific time. + /// The alarm will go off delay seconds later. + /// + /// The amount of time before the execution (in seconds) + /// The destination AppControl to perform a specific task when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public static Alarm CreateAlarm(int delay, AppControl appControl) + { + Alarm alarm = null; + int alarmId; + AlarmError ret = (AlarmError)Interop.Alarm.CreateAlarmOnceAfterDelay(appControl.SafeAppControlHandle, delay, out alarmId); + alarm = new Alarm(alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + return alarm; + } + + /// + /// Sets an alarm to be triggered at a specific time. + /// The date describes the time of the first occurrence. + /// + /// The first active alarm time + /// The destination AppControl to perform specific work when the alarm is triggered + /// Alarm Instance created with the set param values. + /// This operation is permitted wit UI application appcontrol only. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public static Alarm CreateAlarm(DateTime value, AppControl appControl) + { + Alarm alarm = null; + int alarmId; + Interop.Alarm.DateTime time = ConvertDateTimeToStruct(value); + AlarmError ret = (AlarmError)Interop.Alarm.CreateAlarmOnceAtDate(appControl.SafeAppControlHandle, ref time, out alarmId); + alarm = new Alarm(alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + return alarm; + } + + /// + /// Sets an alarm to be triggered periodically, starting at a specific time. + /// The date describes the time of the first occurrence. + /// weekFlag is the repeat value of the days of the week. + /// If weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time. + /// + /// This operation is permitted wit UI application appcontrol only. + /// The first active alarm time + /// The day of the week, AlarmWeekFlag may be a combination of days, like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday + /// The destination AppControl to perform specific work when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public static Alarm CreateAlarm(DateTime value, AlarmWeekFlag weekFlag, AppControl appControl) + { + Alarm alarm = null; + int alarmId; + Interop.Alarm.DateTime time = ConvertDateTimeToStruct(value); + AlarmError ret = (AlarmError)Interop.Alarm.CreateAlarmRecurWeek(appControl.SafeAppControlHandle, ref time, (int)weekFlag, out alarmId); + alarm = new Alarm(alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + return alarm; + } + + /// + /// Sets a notification alarm to be triggered at a specific time. + /// The date describes the time of the first occurrence. + /// + /// The first active alarm time + /// The notification to be posted when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + /// http://tizen.org/privilege/notification + public static Alarm CreateAlarm(DateTime dateTime, Notification notification) + { + Alarm alarm = null; + int alarmId; + NotificationSafeHandle safeHandle = NotificationManager.MakeNotificationSafeHandle(notification); + Interop.Alarm.DateTime time = ConvertDateTimeToStruct(dateTime); + AlarmError ret = Interop.Alarm.CreateAlarmNotiOnceAtDate(safeHandle, ref time, out alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + alarm = new Alarm(alarmId); + + return alarm; + } + + /// + /// Sets a notification alarm to be triggered after a specific time. + /// The alarm will first go off delay seconds later and then will go off every certain amount of time defined using period seconds. + /// + /// The amount of time before the first execution (in seconds). + /// The amount of time between subsequent alarms (in seconds). This value does not guarantee the accuracy. + /// The notification to be posted when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + /// http://tizen.org/privilege/notification + public static Alarm CreateAlarm(int delay, int period, Notification notification) + { + Alarm alarm = null; + int alarmId; + NotificationSafeHandle safeHandle = NotificationManager.MakeNotificationSafeHandle(notification); + AlarmError ret = Interop.Alarm.CreateAlarmNotiAfterDelay(safeHandle, delay, period, out alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + alarm = new Alarm(alarmId); + + return alarm; + } + + /// + /// Sets a notification alarm to be triggered periodically, starting at a specific time. + /// The date describes the time of the first occurrence. + /// weekFlag is the repeat value of the days of the week. + /// If weekFlag is AlarmWeekFlag.Tuesday, the alarm will repeat every Tuesday at a specific time. + /// + /// The first active alarm time + /// The day of the week, AlarmWeekFlag may be a combination of days, + /// like AlarmWeekFlag.Sunday | AlarmWeekFlag.Monday + /// The notification to be posted when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + /// http://tizen.org/privilege/notification + public static Alarm CreateAlarm(DateTime dateTime, AlarmWeekFlag weekFlag, Notification notification) + { + Alarm alarm = null; + int alarmId; + NotificationSafeHandle safeHandle = NotificationManager.MakeNotificationSafeHandle(notification); + Interop.Alarm.DateTime time = ConvertDateTimeToStruct(dateTime); + AlarmError ret = Interop.Alarm.CreateAlarmNotiRecurWeek(safeHandle, ref time, (int)weekFlag, out alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + alarm = new Alarm(alarmId); + + return alarm; + } + + /// + /// Sets a notification alarm to be triggered after a specific time. + /// The alarm will go off delay seconds later. + /// + /// The amount of time before the first execution (in seconds). + /// The notification to be posted when the alarm is triggered + /// Alarm Instance created with the set param values. + /// Thrown in case of Invalid parameter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + /// http://tizen.org/privilege/notification + public static Alarm CreateAlarm(int delay, Notification notification) + { + Alarm alarm = null; + int alarmId; + NotificationSafeHandle safeHandle = NotificationManager.MakeNotificationSafeHandle(notification); + AlarmError ret = Interop.Alarm.CreateAlarmNotiOnceAfterDelay(safeHandle, delay, out alarmId); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to create Alarm"); + } + + alarm = new Alarm(alarmId); + + return alarm; + } + + /// + /// Cancels all scheduled alarms that are registered by the application that calls this API. + /// + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.set + public static void CancelAll() + { + AlarmError ret = (AlarmError)Interop.Alarm.CancelAllAlarms(); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to cancel Alarms"); + } + } + + /// + /// Retrieves all registered alarms. + /// + /// List of all Alarm instances. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/alarm.get + public static IEnumerable GetAllScheduledAlarms() + { + List alarms = new List(); + Interop.Alarm.RegisteredAlarmCallback callback = (int alarmId, IntPtr userData) => + { + alarms.Add(new Alarm(alarmId)); + return true; + }; + + AlarmError ret = (AlarmError)Interop.Alarm.GetAllRegisteredAlarms(callback, IntPtr.Zero); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to get Alarms"); + } + + return alarms; + } + + /// + /// Gets the current system time. + /// + /// The current system time + /// Thrown in case of any internal error. + public static DateTime GetCurrentTime() + { + DateTime time; + Interop.Alarm.DateTime value; + AlarmError ret = (AlarmError)Interop.Alarm.GetCurrentTime(out value); + if (ret != AlarmError.None) + { + throw AlarmErrorFactory.GetException(ret, "Failed to get Currenttime"); + } + else + { + + time = ConvertIntPtrToDateTime(value); + } + + return time; + } + + } +} diff --git a/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs b/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs new file mode 100755 index 0000000..3718191 --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Interop/Interop.AttachPanel.cs @@ -0,0 +1,71 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class AttachPanel + { + internal enum ErrorCode : int + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + AlreadyExists = -0x02850000 | 0x01, + NotInitialized = -0x02850000 | 0x02, + UnsupportedContentCategory = -0x02850000 | 0x03, + AlreadyDestroyed = -0x02850000 | 0x05, + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AttachPanelEventCallback(IntPtr attachPanel, int eventType, IntPtr eventInfo, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AttachPanelResultCallback(IntPtr attachPanel, int category, IntPtr result, int resultCode, IntPtr userData); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_create")] + internal static extern ErrorCode CreateAttachPanel(IntPtr conform, ref IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_destroy")] + internal static extern ErrorCode DestroyAttachPanel(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_add_content_category")] + internal static extern ErrorCode AddCategory(IntPtr attach_panel, int content_category, IntPtr extraData); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_remove_content_category")] + internal static extern ErrorCode RemoveCategory(IntPtr attach_panel, int content_category); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_set_extra_data")] + internal static extern ErrorCode SetExtraData(IntPtr attach_panel, int content_category, IntPtr extraData); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_set_result_cb")] + internal static extern ErrorCode SetResultCb(IntPtr attach_panel, AttachPanelResultCallback callback, IntPtr userData); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_unset_result_cb")] + internal static extern ErrorCode UnsetResultCb(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_set_event_cb")] + internal static extern ErrorCode SetEventCb(IntPtr attach_panel, AttachPanelEventCallback callback, IntPtr userData); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_unset_event_cb")] + internal static extern ErrorCode UnsetEventCb(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_show")] + internal static extern ErrorCode Show(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_show_without_animation")] + internal static extern ErrorCode ShowWithoutAnimation(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_hide")] + internal static extern ErrorCode Hide(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_hide_without_animation")] + internal static extern ErrorCode HideWithoutAnimation(IntPtr attach_panel); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_get_visibility")] + internal static extern ErrorCode GetVisibility(IntPtr attach_panel, out int visible); + + [DllImport(Libraries.AttachPanel, EntryPoint = "attach_panel_get_state")] + internal static extern ErrorCode GetState(IntPtr attach_panel, out int state); + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.AttachPanel/Interop/Interop.Libraries.cs b/src/Tizen.Applications.AttachPanel/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..4b4049b --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Interop/Interop.Libraries.cs @@ -0,0 +1,7 @@ +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AttachPanel = "libattach-panel.so.0.1.0"; + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln new file mode 100755 index 0000000..8eeff18 --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.AttachPanel", "Tizen.Applications.AttachPanel.csproj", "{C8C93D46-CACE-4BF1-8B50-6A6A00967045}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{B01C1F2E-18E2-4DDE-8B7E-6642F0730A7F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C8C93D46-CACE-4BF1-8B50-6A6A00967045}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C8C93D46-CACE-4BF1-8B50-6A6A00967045}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C8C93D46-CACE-4BF1-8B50-6A6A00967045}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C8C93D46-CACE-4BF1-8B50-6A6A00967045}.Release|Any CPU.Build.0 = Release|Any CPU + {D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2B5F854-4FE1-473C-A8E3-53ABB0A966AA}.Release|Any CPU.Build.0 = Release|Any CPU + {B01C1F2E-18E2-4DDE-8B7E-6642F0730A7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B01C1F2E-18E2-4DDE-8B7E-6642F0730A7F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B01C1F2E-18E2-4DDE-8B7E-6642F0730A7F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B01C1F2E-18E2-4DDE-8B7E-6642F0730A7F}.Release|Any CPU.Build.0 = Release|Any CPU + {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AFF3D5BA-42DA-40CE-BC57-0DC1E92673B9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs new file mode 100755 index 0000000..bd403f0 --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanel.cs @@ -0,0 +1,263 @@ +using System; + +namespace Tizen.Applications.AttachPanel +{ + /// + /// Represents immutable class for attach panel. + /// + public partial class AttachPanel + { + /// + /// Represents immutable class for attach panel. + /// + /// 3 + /// The caller's conformant + /// Thrown when an attempt to allocate memory fails. + /// Thrown when the AttachPanel is already exist or the is not a conformant object + public AttachPanel(IntPtr conformant) + { + if (conformant == IntPtr.Zero) + { + throw new ArgumentNullException("Use the value property, not null value"); + } + IntPtr candidateAttachPanel = new IntPtr(); + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel); + checkException(err); + + Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance"); + isCreationSucceed = true; + _attachPanel = candidateAttachPanel; + + if (_eventEventHandler == null) + { + StateEventListenStart(); + } + + if (_resultEventHandler == null) + { + ResultEventListenStart(); + } + } + + ~AttachPanel() + { + if (isCreationSucceed && + _attachPanel != IntPtr.Zero) + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.DestroyAttachPanel(_attachPanel); + checkException(err); + _attachPanel = IntPtr.Zero; + } + } + + /// + /// Gets the state of the AttachPanel. + /// + /// The AttachPanel window state + public int State + { + get + { + int state; + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetState(_attachPanel, out state); + checkException(err); + return state; + } + } + + /// + /// Gets the value that indicates whether the AttachPanel is visible. + /// + /// visible value of AttachPanel state + public int Visible + { + get + { + int visible; + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.GetVisibility(_attachPanel, out visible); + checkException(err); + return visible; + } + } + + /// + /// Add a content category in the AttachPanel. + /// + /// The ContentCategory to be added in the AttachPanel + /// The AttachPanel send some information using Bundle + /// http://tizen.org/privilege/mediastorage + /// http://tizen.org/privilege/camera + /// http://tizen.org/privilege/recorder + /// http://tizen.org/privilege/appmanager.launch + /// http://tizen.org/feature/camera + /// http://tizen.org/feature/microphone + /// + /// The caller app has to check the return value of this function. + /// Content categories will be shown as the sequence of using AddCategory + /// Some contents need time to load it all. + /// So, it is needed to use this before the mainloop of Show + /// Privileges, + /// http://tizen.org/privilege/mediastorage, for using Image or Camera + /// http://tizen.org/privilege/camera, for using Camera or TakePicture + /// http://tizen.org/privilege/recorder, for using Voice + /// http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab + /// http://tizen.org/feature/camera, for using Camera or TakePicture + /// http://tizen.org/feature/microphone, for using Voice + /// Deliver more information to the callee with a bundle if you need. + /// http://tizen.org/appcontrol/data/total_count + /// http://tizen.org/appcontrol/data/total_size + /// + /// Thrown when the is not a valid category + /// Thrown when application does not have privilege to access this method + /// Thrown when the device does not supported the feature + /// Thrown when the AttachPanel is not created yet or already destroyed + public void AddCategory(ContentCategory category, Bundle extraData) + { + IntPtr bundle = IntPtr.Zero; + if (extraData != null) + { + bundle = extraData.SafeBundleHandle.DangerousGetHandle(); + } + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.AddCategory(_attachPanel, (int)category, bundle); + checkException(err); + } + + /// + /// Removes the ContentCategory from the AttachPanel + /// + /// The ContentCategory adding in the AttachPanel + /// Thrown when the is not a valid category + /// Thrown when the AttachPanel is not created yet or already destroyed + public void RemoveCategory(ContentCategory category) + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.RemoveCategory(_attachPanel, (int)category); + checkException(err); + } + + /// + /// Sets extraData to send to the ContentCategory using a Bundle + /// + /// The ContentCategory that some information to be set in the AttachPanel. + /// The AttachPanel send some information using Bundle + /// Thrown when the is not a valid category + /// Thrown when the AttachPanel is destroyed + /// Thrown when an attempt to allocate memory fails. + public void SetExtraData(ContentCategory category, Bundle extraData) + { + if(extraData == null) + { + checkException(Interop.AttachPanel.ErrorCode.InvalidParameter); + } + + IntPtr bundle = IntPtr.Zero; + if (extraData != null) + { + bundle = extraData.SafeBundleHandle.DangerousGetHandle(); + } + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.SetExtraData(_attachPanel, (int)category, bundle); + checkException(err); + } + + /// + /// Shows the attach panel with animations + /// + /// Thrown when the AttachPanel is destroyed + public void Show() + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel); + checkException(err); + } + + /// + /// Shows the attach panel and selects whether or not to animate + /// + /// Thrown when the AttachPanel is destroyed + public void Show(bool animation) + { + if (animation) + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Show(_attachPanel); + checkException(err); + } + else + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.ShowWithoutAnimation(_attachPanel); + checkException(err); + } + } + + /// + /// Hides the attach panel with animations + /// + /// Thrown when the AttachPanel is destroyed + public void Hide() + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel); + checkException(err); + } + + /// + /// Hides the attach panel and selects whether or not to animate + /// + /// Thrown when the AttachPanel is destroyed + public void Hide(bool animation) + { + if (animation) + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.Hide(_attachPanel); + checkException(err); + } + else + { + Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.HideWithoutAnimation(_attachPanel); + checkException(err); + } + } + + /// + /// Occurs when reserved events are published from the panel-side. + /// + public event EventHandler EventChanged + { + add + { + if (_eventEventHandler == null) + { + StateEventListenStart(); + } + _eventEventHandler += value; + } + remove + { + _eventEventHandler -= value; + if (_eventEventHandler == null) + { + StateEventListenStop(); + } + } + } + + /// + /// Occurs when an user selects and confirms something to attach in the AttachPanel + /// + public event EventHandler ResultCallback + { + add + { + if (_resultEventHandler == null) + { + ResultEventListenStart(); + } + _resultEventHandler += value; + } + remove + { + _resultEventHandler -= value; + if (_resultEventHandler == null) + { + ResultEventListenStop(); + } + } + } + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs new file mode 100755 index 0000000..e40af2d --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/AttachPanelInternal.cs @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; + +namespace Tizen.Applications.AttachPanel +{ + public partial class AttachPanel + { + private static IntPtr _attachPanel; + private bool isCreationSucceed; + + private static event EventHandler _eventEventHandler; + private static event EventHandler _resultEventHandler; + + private static Interop.AttachPanel.AttachPanelEventCallback SetEventListener; + private static Interop.AttachPanel.AttachPanelResultCallback SetResultListener; + + private void StateEventListenStart() + { + Interop.AttachPanel.ErrorCode err = 0; + + SetEventListener = (attachPanel, eventType, eventInfo, userData) => + { + _eventEventHandler?.Invoke(null, new StateEventArgs(attachPanel, (EventType)eventType, eventInfo, userData)); + }; + err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero); + checkException(err); + } + private void StateEventListenStop() + { + Interop.AttachPanel.ErrorCode err = 0; + err = Interop.AttachPanel.UnsetEventCb(_attachPanel); + checkException(err); + } + + private void ResultEventListenStart() + { + Interop.AttachPanel.ErrorCode err = 0; + SetResultListener = (attachPanel, category, resulthandler, resultCode, userData) => + { + SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false); + AppControl result = new AppControl(handle); + _resultEventHandler?.Invoke(null, new ResultEventArgs(attachPanel, (ContentCategory)category, result, (AppControlReplyResult)resultCode, userData)); + }; + err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero); + checkException(err); + } + + private void ResultEventListenStop() + { + Interop.AttachPanel.ErrorCode err = 0; + err = Interop.AttachPanel.UnsetResultCb(_attachPanel); + checkException(err); + } + + internal static void checkException(Interop.AttachPanel.ErrorCode err) + { + switch (err) + { + case Interop.AttachPanel.ErrorCode.InvalidParameter: + throw new ArgumentOutOfRangeException("Invalid parameter error at unmanaged code"); + case Interop.AttachPanel.ErrorCode.OutOfMemory: + throw new OutOfMemoryException("Out of Memory"); + case Interop.AttachPanel.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + case Interop.AttachPanel.ErrorCode.AlreadyExists: + throw new InvalidOperationException("Already Exists"); + case Interop.AttachPanel.ErrorCode.NotInitialized: + throw new InvalidOperationException("Not initialized"); + case Interop.AttachPanel.ErrorCode.UnsupportedContentCategory: + throw new NotSupportedException("Unsupported Content Category"); + case Interop.AttachPanel.ErrorCode.AlreadyDestroyed: + throw new InvalidOperationException("Already Destroyed"); + } + } + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs new file mode 100755 index 0000000..e86b9ea --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ContentCategory.cs @@ -0,0 +1,57 @@ +namespace Tizen.Applications.AttachPanel +{ + /// + /// Enumeration for the attach panel content category. + /// + public enum ContentCategory + { + /// + /// Attaching images from the gallery + /// + Image = 1, + /// + /// Taking pictures to attach + /// + Camera, + /// + /// Taking a voice clip to attach + /// + Voice, + /// + /// Attaching video from the gallery + /// + Video, + /// + /// Attaching audio from my files + /// + Audio, + /// + /// Attaching calendar data from the calendar + /// + Calendar, + /// + /// Attaching contact data from the contacts + /// + Contact, + /// + /// Attaching files data from my files + /// + Myfiles, + /// + /// Taking a video clip to attach + /// + VideoRecorder, + /// + /// Attaching files from the document list + /// + Document, + /// + /// Launching apps to take pictures will be attached + /// + TakePicture, + /// + /// Attaching memo data from the memo + /// + Memo, + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs new file mode 100755 index 0000000..dc460a1 --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/EventType.cs @@ -0,0 +1,25 @@ +namespace Tizen.Applications.AttachPanel +{ + /// + /// Enumeration for the attach panel event. + /// + public enum EventType + { + /// + /// Attach panel starts the effect to show + /// + ShowStart = 1, + /// + /// Attach panel finishes the effect to show + /// + ShowFinish, + /// + /// Attach panel starts the effect to hide the panel + /// + HideStart, + /// + /// Attach panel finishes the effect to hide the panel + /// + HideFinish, + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ResultEventArgs.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ResultEventArgs.cs new file mode 100755 index 0000000..6628b9d --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/ResultEventArgs.cs @@ -0,0 +1,51 @@ +using System; + +namespace Tizen.Applications.AttachPanel +{ + /// + /// Class for event arguments of the result event + /// + public class ResultEventArgs : EventArgs + { + private readonly IntPtr _attachPanel; + private readonly ContentCategory _category; + private readonly AppControl _result; + private readonly AppControlReplyResult _resultCode; + private readonly IntPtr _userData; + + internal ResultEventArgs(IntPtr attachPanel, ContentCategory category, AppControl result, AppControlReplyResult resultCode, IntPtr userData) + { + _attachPanel = attachPanel; + _category = category; + _result = result; + _resultCode = resultCode; + _userData = userData; + } + + /// + /// Property for attach panel object. + /// + public IntPtr AttachPanel { get { return _attachPanel; } } + + /// + /// Results are from the content category. + /// + public ContentCategory Category { get { return _category; } } + + /// + /// Property for result + /// The caller app has to use ExtraData property to get received data. + /// + public AppControl Result { get { return _result; } } + + /// + /// Property for result of AppControl + /// + public AppControlReplyResult ResultCode { get { return _resultCode; } } + + /// + /// Property for user data + /// + public IntPtr UserData { get { return _userData; } } + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateEventArgs.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateEventArgs.cs new file mode 100755 index 0000000..5354c5f --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateEventArgs.cs @@ -0,0 +1,44 @@ +using System; + +namespace Tizen.Applications.AttachPanel +{ + /// + /// Class for event arguments of the state event + /// + public class StateEventArgs : EventArgs + { + private readonly IntPtr _attachPanel; + private readonly EventType _eventType; + private readonly IntPtr _eventInfo; + private readonly IntPtr _userData; + + internal StateEventArgs(IntPtr attachPanel, EventType eventType, IntPtr eventInfo, IntPtr userData) + { + _attachPanel = attachPanel; + _eventType = eventType; + _eventInfo = eventInfo; + _userData = userData; + } + + /// + /// Property for attach panel object + /// + public IntPtr AttachPanel { get { return _attachPanel; } } + + /// + /// Property for event type. + /// + public EventType EventType { get { return _eventType; } } + + /// + /// Additional event information. + /// This can be NULL if there are no necessary information. + /// + public IntPtr EventInfo { get { return _eventInfo; } } + + /// + /// Property for user data. + /// + public IntPtr UserData { get { return _userData; } } + } +} diff --git a/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs new file mode 100755 index 0000000..a2474db --- /dev/null +++ b/src/Tizen.Applications.AttachPanel/Tizen.Applications.AttachPanel/StateType.cs @@ -0,0 +1,21 @@ +namespace Tizen.Applications.AttachPanel +{ + /// + /// Enumeration for the attach panel's window state. + /// + public enum StateType + { + /// + /// Attach panel is not visible + /// + Hidden = 0, + /// + /// Attach panel is in partial window mode + /// + Partial, + /// + /// Attach panel is in full screen mode + /// + Full, + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Badge/GlobalSuppressions.cs b/src/Tizen.Applications.Badge/GlobalSuppressions.cs new file mode 100755 index 0000000000000000000000000000000000000000..9d742533852f291d5b872bdf32aedc33e5b3af4d GIT binary patch literal 954 zcmaKr%}&EG5QO*Kr?7IS^cfHm5(gwCdf{l&&<5J1Y7(TrJn+rB?oTREr1)oNXUF69 z&-ct`7Hn=StF2@9&bYRUSy~V5R<>aMW_$kk*0NIk&Kiqg_aG9sCl+kOZcVH|jKN-P zur1$?ypHebFh*NC(*zAt5y|O6)zli82^|<$9#LEj8pXB-mz1Tt!X+K5)Y=EplI&Z{ z{LdHrQ$Obys5PA3NMj8{Q&Lx?`Hbk<9$hs zsmHRm;;PHSsLu+|%-)_W%^C`ObZz5)%`QApQ*Wa + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.Badge/Tizen.Applications.Badge.sln b/src/Tizen.Applications.Badge/Tizen.Applications.Badge.sln new file mode 100755 index 0000000..461be58 --- /dev/null +++ b/src/Tizen.Applications.Badge/Tizen.Applications.Badge.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Badge", "Tizen.Applications.Badge.csproj", "{2BA194AC-736A-4C5F-A41F-1A77B1D5CEA2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{9D519F2A-4853-499F-A479-3440CFAF4701}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{C791221D-31B2-4D62-A149-60BA76E99E11}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2BA194AC-736A-4C5F-A41F-1A77B1D5CEA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BA194AC-736A-4C5F-A41F-1A77B1D5CEA2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BA194AC-736A-4C5F-A41F-1A77B1D5CEA2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BA194AC-736A-4C5F-A41F-1A77B1D5CEA2}.Release|Any CPU.Build.0 = Release|Any CPU + {9D519F2A-4853-499F-A479-3440CFAF4701}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D519F2A-4853-499F-A479-3440CFAF4701}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D519F2A-4853-499F-A479-3440CFAF4701}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D519F2A-4853-499F-A479-3440CFAF4701}.Release|Any CPU.Build.0 = Release|Any CPU + {C791221D-31B2-4D62-A149-60BA76E99E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C791221D-31B2-4D62-A149-60BA76E99E11}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C791221D-31B2-4D62-A149-60BA76E99E11}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C791221D-31B2-4D62-A149-60BA76E99E11}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Badge/Tizen.Applications/Badge.cs b/src/Tizen.Applications.Badge/Tizen.Applications/Badge.cs new file mode 100755 index 0000000..89b317a --- /dev/null +++ b/src/Tizen.Applications.Badge/Tizen.Applications/Badge.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Immutable class for getting information of the badge. + /// + public class Badge + { + private readonly string _appId; + private readonly int _count; + private readonly bool _isDisplay; + + internal Badge(string appid, int count, bool isDisplay) + { + _appId = appid; + _count = count; + _isDisplay = isDisplay; + } + + /// + /// Property for the count value of the badge. + /// + /// 3 + public int Count + { + get + { + return _count; + } + } + + /// + /// Property for the application ID of the badge. + /// + /// 3 + public string AppId + { + get + { + return _appId; + } + } + + /// + /// Property for the flag of 'display'. + /// + /// 3 + public bool IsDisplay + { + get + { + return _isDisplay; + } + } + } +} diff --git a/src/Tizen.Applications.Badge/Tizen.Applications/BadgeControl.cs b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeControl.cs new file mode 100755 index 0000000..85e72a7 --- /dev/null +++ b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeControl.cs @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + using System; + using System.Collections.Generic; + /// + /// The class for badge operation. + /// + public static class BadgeControl + { + private static event EventHandler s_changed; + private static bool s_registered = false; + private static Interop.Badge.ChangedCallback s_callback; + + /// + /// Event handler for receiving badge events. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access. + /// http://tizen.org/privilege/notification + public static event EventHandler Changed + { + add + { + if (s_changed == null && !s_registered) + { + if (s_callback == null) + { + s_callback = new Interop.Badge.ChangedCallback(OnChangedEvent); + } + + BadgeError err = Interop.Badge.SetChangedCallback(s_callback, IntPtr.Zero); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to add event handler"); + } + + s_registered = true; + } + + s_changed += value; + } + remove + { + s_changed -= value; + if (s_changed == null && s_registered) + { + BadgeError err = Interop.Badge.UnsetChangedCallback(s_callback); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to remove event handler"); + } + + s_callback = null; + s_registered = false; + } + } + } + + /// + /// Gets the badge information from the application ID. + /// + /// 3 + /// Application ID. + /// Thrown when failed because of an invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static Badge Find(string appId) + { + uint count; + uint display; + + BadgeError err = Interop.Badge.GetCount(appId, out count); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to find badge count of " + appId); + } + + err = Interop.Badge.GetDisplay(appId, out display); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to find badge display of " + appId); + } + + return new Badge(appId, (int)count, display == 0 ? false : true); + } + + /// + /// Removes the badge information. + /// + /// 3 + /// Application ID. + /// Thrown when failed because of a an invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static void Remove(string appId) + { + BadgeError err = Interop.Badge.Remove(appId); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to Remove badge of " + appId); + } + } + + /// + /// Adds the badge information. + /// + /// 3 + /// Application ID. + /// Count value. + /// True if it should be displayed. + /// Thrown when failed because of an invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static void Add(string appId, int count = 1, bool isDisplay = true) + { + BadgeError err = Interop.Badge.Add(appId); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to add badge of " + appId); + } + + try + { + Update(appId, count, isDisplay); + } + catch (Exception e) + { + Remove(appId); + throw e; + } + } + + /// + /// Updates the badge information. + /// + /// 3 + /// Application ID. + /// Count value. + /// Thrown when failed because of an invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static void Update(string appId, int count) + { + BadgeError err = Interop.Badge.SetCount(appId, (uint)count); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + appId); + } + } + + /// + /// Updates the badge information. + /// + /// 3 + /// Application ID. + /// True if it should be displayed. + /// Thrown when failed because of an invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static void Update(string appId, bool isDisplay) + { + BadgeError err = Interop.Badge.SetDisplay(appId, isDisplay ? 1U : 0U); + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to update badge of " + appId); + } + } + + /// + /// Updates the badge information. + /// + /// 3 + /// Application ID. + /// Count value. + /// True if it should be displayed. + /// Thrown when failed because of invalid argument. + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static void Update(string appId, int count, bool isDisplay) + { + Update(appId, count); + Update(appId, isDisplay); + } + + /// + /// Gets all the badge information. + /// + /// 3 + /// Thrown when an application does not have the privilege to access. + /// Thrown in case of failed conditions. + /// http://tizen.org/privilege/notification + public static IEnumerable GetBadges() + { + IList list = new List(); + + BadgeError err = Interop.Badge.Foreach((appId, count, userData) => + { + uint display = 0; + BadgeError errGetDisplay = Interop.Badge.GetDisplay(appId, out display); + if (errGetDisplay != BadgeError.None) + { + throw BadgeErrorFactory.GetException(errGetDisplay, "Failed to get badges "); + } + + list.Add(new Badge(appId, (int)count, display == 0 ? false : true)); + }, IntPtr.Zero); + + if (err != BadgeError.None) + { + throw BadgeErrorFactory.GetException(err, "Failed to get badges"); + } + + return list; + } + + private static void OnChangedEvent(Interop.Badge.Action action, string appId, uint count, IntPtr userData) + { + uint display = 0; + uint countLocal = 0; + + switch (action) + { + case Interop.Badge.Action.Create: + s_changed?.Invoke(null, new BadgeEventArgs() + { + Reason = BadgeEventArgs.Action.Add, + Badge = new Badge(appId, 0, false) + }); + break; + + case Interop.Badge.Action.Remove: + s_changed?.Invoke(null, new BadgeEventArgs() + { + Reason = BadgeEventArgs.Action.Remove, + Badge = new Badge(appId, 0, false) + }); + break; + + case Interop.Badge.Action.Update: + Interop.Badge.GetDisplay(appId, out display); + s_changed?.Invoke(null, new BadgeEventArgs() + { + Reason = BadgeEventArgs.Action.Update, + Badge = new Badge(appId, (int)count, display == 0 ? false : true) + }); + break; + + case Interop.Badge.Action.ChangedDisplay: + Interop.Badge.GetCount(appId, out countLocal); + s_changed?.Invoke(null, new BadgeEventArgs() + { + Reason = BadgeEventArgs.Action.Update, + Badge = new Badge(appId, (int)countLocal, count == 0 ? false : true) + }); + break; + + case Interop.Badge.Action.ServiceReady: + // Ignore + break; + } + } + } +} diff --git a/src/Tizen.Applications.Badge/Tizen.Applications/BadgeErrorFactory.cs b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeErrorFactory.cs new file mode 100755 index 0000000..ff0d909 --- /dev/null +++ b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeErrorFactory.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + using System; + using System.Runtime.CompilerServices; + + internal enum BadgeError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + DbError = -0x01120000 | 0x01, + AlreadyExists = -0x01120000 | 0x02, + DBusError = -0x01120000 | 0x03, + DoesnotExist = -0x01120000 | 0x04, + ServiceError = -0x01120000 | 0x05, + InvalidPackage = -0x01120000 | 0x06 + } + + /// + /// Immutable class for getting the badge information. + /// + internal static class BadgeErrorFactory + { + private static readonly string LogTag = "Tizen.Applications.Badge"; + + internal static Exception GetException(BadgeError ret, string msg, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) + { + Log.Error(LogTag, memberName + " : " + lineNumber); + + switch (ret) + { + case BadgeError.InvalidParameter: + Log.Error(LogTag, msg); + return new ArgumentException(ret + " error occurred."); + case BadgeError.PermissionDenied: + throw new UnauthorizedAccessException("Permission denied (http://tizen.org/privilege/notification)"); + default: + Log.Error(LogTag, msg); + return new InvalidOperationException(ret + " error occurred."); + } + } + } +} diff --git a/src/Tizen.Applications.Badge/Tizen.Applications/BadgeEventArgs.cs b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeEventArgs.cs new file mode 100755 index 0000000..bfcc85f --- /dev/null +++ b/src/Tizen.Applications.Badge/Tizen.Applications/BadgeEventArgs.cs @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + using System; + + /// + /// The class for event arguments of the badge event. + /// + public class BadgeEventArgs : EventArgs + { + internal BadgeEventArgs() + { + } + + /// + /// Enumeration for the badge action. + /// + /// 3 + public enum Action : int + { + /// + /// The badge was added. + /// + Add = 0, + + /// + /// The badge was removed. + /// + Remove, + + /// + /// The badge was updated. + /// + Update, + } + + /// + /// The property for the badge object. + /// + /// 3 + public Badge Badge { get; internal set; } + + /// + /// The property for the action value. + /// + /// 3 + public Action Reason { get; internal set; } + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.AppCommon.cs b/src/Tizen.Applications.Common/Interop/Interop.AppCommon.cs new file mode 100755 index 0000000..5ad41f5 --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.AppCommon.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Internals.Errors; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class AppCommon + { + internal enum ResourceCategory : int + { + Image = 0, + Layout, + Sound, + Binary + } + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_id")] + internal static extern ErrorCode AppGetId(out string appId); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_name")] + internal static extern ErrorCode AppGetName(out string name); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_resource_path")] + internal static extern string AppGetResourcePath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_data_path")] + internal static extern string AppGetDataPath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_cache_path")] + internal static extern string AppGetCachePath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_data_path")] + internal static extern string AppGetSharedDataPath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_resource_path")] + internal static extern string AppGetSharedResourcePath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_shared_trusted_path")] + internal static extern string AppGetSharedTrustedPath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_tep_resource_path")] + internal static extern string AppGetTepResourcePath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_cache_path")] + internal static extern string AppGetExternalCachePath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_data_path")] + internal static extern string AppGetExternalDataPath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_external_shared_data_path")] + internal static extern string AppGetExternalSharedDataPath(); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_get_version")] + internal static extern ErrorCode AppGetVersion(out string version); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_memory_status")] + internal static extern ErrorCode AppEventGetLowMemoryStatus(IntPtr handle, out LowMemoryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_battery_status")] + internal static extern ErrorCode AppEventGetLowBatteryStatus(IntPtr handle, out LowBatteryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_language")] + internal static extern ErrorCode AppEventGetLanguage(IntPtr handle, out string lang); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_region_format")] + internal static extern ErrorCode AppEventGetRegionFormat(IntPtr handle, out string region); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_resource_manager_get")] + internal static extern ErrorCode AppResourceManagerGet(ResourceCategory category, string id, out string path); + + [DllImport(Libraries.Application, EntryPoint = "app_resource_manager_get")] + internal static extern ErrorCode LegacyAppResourceManagerGet(ResourceCategory category, string id, out string path); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_device_orientation")] + internal static extern ErrorCode AppEventGetDeviceOrientation(IntPtr handle, out DeviceOrientation orientation); + } +} + diff --git a/src/Tizen.Applications.Common/Interop/Interop.AppControl.cs b/src/Tizen.Applications.Common/Interop/Interop.AppControl.cs new file mode 100755 index 0000000..c379698 --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.AppControl.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class AppControl + { + internal const int AppStartedStatus = 1; + + internal delegate bool ExtraDataCallback(IntPtr handle, string key, IntPtr userData); + internal delegate bool AppMatchedCallback(IntPtr handle, string applicationId, IntPtr userData); + internal delegate void ReplyCallback(IntPtr request, IntPtr reply, int result, IntPtr userData); + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + AppNotFound = -0x01100000 | 0x21, + KeyNotFound = Tizen.Internals.Errors.ErrorCode.KeyNotAvailable, + KeyRejected = Tizen.Internals.Errors.ErrorCode.KeyRejected, + InvalidDataType = -0x01100000 | 0x22, + LaunchRejected = -0x01100000 | 0x23, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + LaunchFailed = -0x01100000 | 0x24, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, + } + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_create")] + internal static extern ErrorCode Create(out SafeAppControlHandle handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_clone")] + internal static extern ErrorCode DangerousClone(out SafeAppControlHandle clone, IntPtr handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")] + internal static extern ErrorCode GetAppId(IntPtr app_control, out IntPtr app_id); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_operation")] + internal static extern ErrorCode GetOperation(SafeAppControlHandle handle, out string operation); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_operation")] + internal static extern ErrorCode SetOperation(SafeAppControlHandle handle, string operation); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_uri")] + internal static extern ErrorCode GetUri(SafeAppControlHandle handle, out string uri); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_uri")] + internal static extern ErrorCode SetUri(SafeAppControlHandle handle, string uri); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_mime")] + internal static extern ErrorCode GetMime(SafeAppControlHandle handle, out string mime); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_mime")] + internal static extern ErrorCode SetMime(SafeAppControlHandle handle, string mime); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_category")] + internal static extern ErrorCode GetCategory(SafeAppControlHandle handle, out string category); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_category")] + internal static extern ErrorCode SetCategory(SafeAppControlHandle handle, string category); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")] + internal static extern ErrorCode GetAppId(SafeAppControlHandle handle, out string appId); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_app_id")] + internal static extern ErrorCode SetAppId(SafeAppControlHandle handle, string appId); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_launch_mode")] + internal static extern ErrorCode SetLaunchMode(SafeAppControlHandle handle, int mode); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_launch_mode")] + internal static extern ErrorCode GetLaunchMode(SafeAppControlHandle handle, out int mode); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_caller")] + internal static extern ErrorCode GetCaller(SafeAppControlHandle handle, out string caller); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_reply_requested")] + internal static extern ErrorCode IsReplyRequested(SafeAppControlHandle handle, out bool requested); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data")] + internal static extern ErrorCode AddExtraData(SafeAppControlHandle handle, string key, string value); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_remove_extra_data")] + internal static extern ErrorCode RemoveExtraData(SafeAppControlHandle handle, string key); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data")] + internal static extern ErrorCode GetExtraData(SafeAppControlHandle handle, string key, out string value); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data_array")] + internal static extern ErrorCode AddExtraDataArray(SafeAppControlHandle handle, string key, string[] value, int length); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data_array")] + internal static extern ErrorCode GetExtraDataArray(SafeAppControlHandle handle, string key, out IntPtr value, out int length); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_extra_data_array")] + internal static extern ErrorCode IsExtraDataArray(SafeAppControlHandle handle, string key, out bool array); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_destroy")] + internal static extern ErrorCode DangerousDestroy(IntPtr handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_extra_data")] + internal static extern ErrorCode ForeachExtraData(SafeAppControlHandle handle, ExtraDataCallback callback, IntPtr userData); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_app_matched")] + internal static extern ErrorCode ForeachAppMatched(SafeAppControlHandle handle, AppMatchedCallback callback, IntPtr userData); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_send_launch_request")] + internal static extern ErrorCode SendLaunchRequest(SafeAppControlHandle handle, ReplyCallback callback, IntPtr userData); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_send_terminate_request")] + internal static extern ErrorCode SendTerminateRequest(SafeAppControlHandle handle); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_reply_to_launch_request")] + internal static extern ErrorCode ReplyToLaunchRequest(SafeAppControlHandle reply, SafeAppControlHandle request, int result); + + [DllImport(Libraries.AppControl, EntryPoint = "app_control_enable_app_started_result_event")] + internal static extern ErrorCode EnableAppStartedResultEvent(SafeAppControlHandle handle); + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.ApplicationManager.cs b/src/Tizen.Applications.Common/Interop/Interop.ApplicationManager.cs new file mode 100644 index 0000000..0879a32 --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.ApplicationManager.cs @@ -0,0 +1,356 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ApplicationManager + { + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + NoSuchApp = -0x01110000 | 0x01, + DbFailed = -0x01110000 | 0x03, + InvalidPackage = -0x01110000 | 0x04, + AppNoRunning = -0x01110000 | 0x05, + RequestFailed = -0x01110000 | 0x06, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied + } + + internal enum AppContextEvent + { + Launched = 0, + Terminated = 1 + } + + internal enum AppManagerEventStatusType + { + All = 0x00, + Enable = 0x01, + Disable = 0x02 + } + + internal enum AppManagerEventType + { + Enable = 0, + Disable = 1 + } + + internal enum AppManagerEventState + { + Started = 0, + Completed = 1, + Failed = 2 + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AppManagerEventCallback(string appType, string appId, AppManagerEventType eventType, AppManagerEventState eventState, IntPtr eventHandle, IntPtr userData); + //void(* app_manager_event_cb)(const char *type, const char *app_id, app_manager_event_type_e event_type, app_manager_event_state_e event_state, app_manager_event_h handle, void *user_data) + + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AppManagerAppContextEventCallback(IntPtr handle, AppContextEvent state, IntPtr userData); + //void(* app_manager_app_context_event_cb)(app_context_h app_context, app_context_event_e event, void *user_data) + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AppManagerAppInfoCallback(IntPtr handle, IntPtr userData); + //bool(* app_manager_app_info_cb )(app_info_h app_info, void *user_data) + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AppManagerAppContextCallback(IntPtr handle, IntPtr userData); + //bool(* app_manager_app_context_cb)(app_context_h app_context, void *user_data) + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AppInfoFilterCallback(IntPtr handle, IntPtr userData); + //bool(* app_info_filter_cb )(app_info_h app_info, void *user_data) + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AppInfoMetadataCallback(string key, string value, IntPtr userData); + //bool(* app_info_metadata_cb )(const char *metadata_key, const char *metadata_value, void *user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_set_app_context_event_cb")] + internal static extern ErrorCode AppManagerSetAppContextEvent(AppManagerAppContextEventCallback callback, IntPtr userData); + //int app_manager_set_app_context_event_cb( app_manager_app_context_event_cb callback, void * user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_unset_app_context_event_cb")] + internal static extern void AppManagerUnSetAppContextEvent(); + //void app_manager_unset_app_context_event_cb (void); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_running_app_context")] + internal static extern ErrorCode AppManagerForeachRunningAppContext(AppManagerAppContextCallback callback, IntPtr userData); + //int app_manager_foreach_running_app_context(app_manager_app_context_cb callback, void *user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_context")] + internal static extern ErrorCode AppManagerForeachAppContext(AppManagerAppContextCallback callback, IntPtr userData); + //int app_manager_foreach_app_context(app_manager_app_context_cb callback, void *user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_context")] + internal static extern ErrorCode AppManagerGetAppContext(string applicationId, out IntPtr handle); + //int app_manager_get_app_context(const char* app_id, app_context_h *app_context); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_id")] + internal static extern ErrorCode AppManagerGetAppId(int processId, out string applicationId); + //int app_manager_get_app_id (pid_t pid, char **appid); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_is_running")] + internal static extern ErrorCode AppManagerIsRunning(string applicationId, out bool running); + //int app_manager_is_running (const char *appid, bool *running); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_resume_app")] + internal static extern ErrorCode AppManagerResumeApp(IntPtr handle); + //int app_manager_resume_app (app_context_h handle); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_request_terminate_bg_app")] + internal static extern ErrorCode AppManagerRequestTerminateBgApp(IntPtr handle); + //int app_manager_request_terminate_bg_app (app_context_h handle); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_foreach_app_info")] + internal static extern ErrorCode AppManagerForeachAppInfo(AppManagerAppInfoCallback callback, IntPtr userData); + //int app_manager_foreach_app_info(app_manager_app_info_cb callback, void *user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_info")] + internal static extern ErrorCode AppManagerGetAppInfo(string applicationId, out IntPtr handle); + //int app_manager_get_app_info(const char * app_id, app_info_h * app_info) + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_data_path")] + internal static extern ErrorCode AppManagerGetSharedDataPath(string applicationId, out string path); + //int app_manager_get_shared_data_path (const char *appid, char **path); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_resource_path")] + internal static extern ErrorCode AppManagerGetSharedResourcePath(string applicationId, out string path); + //int app_manager_get_shared_resource_path (const char *appid, char **path); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_shared_trusted_path")] + internal static extern ErrorCode AppManagerGetSharedTrustedPath(string applicationId, out string path); + //int app_manager_get_shared_trusted_path (const char *appid, char **path); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_external_shared_data_path")] + internal static extern ErrorCode AppManagerGetExternalSharedDataPath(string applicationId, out string path); + //int app_manager_get_external_shared_data_path (const char *appid, char **path); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_event_create")] + internal static extern ErrorCode AppManagerEventCreate(out IntPtr handle); + //int app_manager_event_create (app_manager_event_h *handle); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_event_set_status")] + internal static extern ErrorCode AppManagerEventSetStatus(IntPtr handle, AppManagerEventStatusType statusType); + //int app_manager_event_set_status (app_manager_event_h handle, int status_type); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_set_event_cb")] + internal static extern ErrorCode AppManagerSetEventCallback(IntPtr handle, AppManagerEventCallback callback, IntPtr userData); + //int app_manager_set_event_cb (app_manager_event_h handle, app_manager_event_cb callback, void *user_data); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_unset_event_cb")] + internal static extern ErrorCode AppManagerUnSetEventCallback(IntPtr handle); + //int app_manager_unset_event_cb (app_manager_event_h handle); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_event_destroy")] + internal static extern ErrorCode AppManagerEventDestroy(IntPtr handle); + //int app_manager_event_destroy (app_manager_event_h handle); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_terminate_app")] + internal static extern ErrorCode AppManagerTerminateApp(IntPtr handle); + //int app_manager_terminate_app (app_context_h app_context); + + [DllImport(Libraries.AppManager, EntryPoint = "app_manager_get_app_context_by_instance_id")] + internal static extern ErrorCode AppManagerGetAppContextByInstanceId(string applicationId, string instanceId, out IntPtr handle); + //int app_manager_get_app_context_by_instance_id (const char *app_id, const char *instance_id, app_context_h *app_context); + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_destroy")] + internal static extern ErrorCode AppContextDestroy(IntPtr handle); + //int app_context_destroy(app_context_h app_context) + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_app_id")] + internal static extern ErrorCode AppContextGetAppId(IntPtr handle, out string applicationId); + //int app_context_get_app_id(app_context_h app_context, char **app_id) + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_package_id")] + internal static extern ErrorCode AppContextGetPackageId(IntPtr handle, out string packageId); + //int app_context_get_package_id(app_context_h app_context, char **package_id) + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_pid")] + internal static extern ErrorCode AppContextGetPid(IntPtr handle, out int processId); + //int app_context_get_pid (app_context_h app_context, pid_t *pid) + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_get_app_state")] + internal static extern ErrorCode AppContextGetAppState(IntPtr handle, out int state); + //int app_context_get_app_state (app_context_h app_context, app_state_e *state) + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_terminated")] + internal static extern ErrorCode AppContextIsTerminated(IntPtr handle, out bool terminated); + //int app_context_is_terminated (app_context_h app_context, bool *terminated); + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_equal")] + internal static extern ErrorCode AppContextIsEqual(IntPtr first, IntPtr second, out bool equal); + //int app_context_is_equal (app_context_h lhs, app_context_h rhs, bool *equal); + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_is_sub_app")] + internal static extern ErrorCode AppContextIsSubApp(IntPtr handle, out bool is_sub_app); + //int app_context_is_sub_app (app_context_h app_context, bool *is_sub_app); + + [DllImport(Libraries.AppManager, EntryPoint = "app_context_clone")] + internal static extern ErrorCode AppContextClone(out IntPtr destination, IntPtr source); + //int app_context_clone (app_context_h *clone, app_context_h app_context); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_create")] + internal static extern ErrorCode AppInfoCreate(string applicationId, out IntPtr handle); + //int app_info_create (const char *app_id, app_info_h *app_info); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_destroy")] + internal static extern ErrorCode AppInfoDestroy(IntPtr handle); + //int app_info_destroy (app_info_h app_info); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_app_id")] + internal static extern ErrorCode AppInfoGetAppId(IntPtr handle, out string applicationId); + //int app_info_get_app_id (app_info_h app_info, char **app_id); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_exec")] + internal static extern ErrorCode AppInfoGetExec(IntPtr handle, out string exec); + //int app_info_get_exec (app_info_h app_info, char **exec); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_label")] + internal static extern ErrorCode AppInfoGetLabel(IntPtr handle, out string label); + //int app_info_get_label (app_info_h app_info, char **label); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_localed_label")] + internal static extern ErrorCode AppInfoGetLocaledLabel(string applicationId, string locale, out string label); + //int app_info_get_localed_label (const char *app_id, const char *locale, char **label); + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_icon")] + internal static extern ErrorCode AppInfoGetIcon(IntPtr handle, out string path); + //int app_info_get_icon (app_info_h app_info, char **path) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_package")] + internal static extern ErrorCode AppInfoGetPackage(IntPtr handle, out string package); + //int app_info_get_package (app_info_h app_info, char **package) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_get_type")] + internal static extern ErrorCode AppInfoGetType(IntPtr handle, out string type); + //int app_info_get_type (app_info_h app_info, char **type) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_foreach_metadata")] + internal static extern ErrorCode AppInfoForeachMetadata(IntPtr handle, AppInfoMetadataCallback callback, IntPtr userData); + //int app_info_foreach_metadata(app_info_h app_info, app_info_metadata_cb callback, void *user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_nodisplay")] + internal static extern ErrorCode AppInfoIsNodisplay(IntPtr handle, out bool noDisplay); + //int app_info_is_nodisplay (app_info_h app_info, bool *nodisplay) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_equal")] + internal static extern ErrorCode AppInfoIsEqual(IntPtr first, IntPtr second, out bool equal); + //int app_info_is_equal (app_info_h lhs, app_info_h rhs, bool *equal) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_enabled")] + internal static extern ErrorCode AppInfoIsEnabled(IntPtr handle, out bool enabled); + //int app_info_is_enabled (app_info_h app_info, bool *enabled) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_onboot")] + internal static extern ErrorCode AppInfoIsOnBoot(IntPtr handle, out bool onBoot); + //int app_info_is_onboot (app_info_h app_info, bool *onboot) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_is_preload")] + internal static extern ErrorCode AppInfoIsPreLoad(IntPtr handle, out bool preLoaded); + //int app_info_is_preload (app_info_h app_info, bool *preload) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_clone")] + internal static extern ErrorCode AppInfoClone(out IntPtr destination, IntPtr source); + //int app_info_clone(app_info_h * clone, app_info_h app_info) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_create")] + internal static extern ErrorCode AppInfoFilterCreate(out IntPtr handle); + //int app_info_filter_create(app_info_filter_h * handle) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_destroy")] + internal static extern ErrorCode AppInfoFilterDestroy(IntPtr handle); + //int app_info_filter_destroy(app_info_filter_h handle) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_bool")] + internal static extern ErrorCode AppInfoFilterAddBool(IntPtr handle, string property, bool value); + //int app_info_filter_add_bool(app_info_filter_h handle, const char *property, const bool value) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_add_string")] + internal static extern ErrorCode AppInfoFilterAddString(IntPtr handle, string property, string value); + //int app_info_filter_add_string(app_info_filter_h handle, const char *property, const char *value) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_count_appinfo")] + internal static extern ErrorCode AppInfoFilterCountAppinfo(IntPtr handle, out int count); + //int app_info_filter_count_appinfo(app_info_filter_h handle, int *count) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_filter_foreach_appinfo")] + internal static extern ErrorCode AppInfoFilterForeachAppinfo(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData); + //int app_info_filter_foreach_appinfo(app_info_filter_h handle, app_info_filter_cb callback, void * user_data) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_create")] + internal static extern ErrorCode AppInfoMetadataFilterCreate(out IntPtr handle); + //int app_info_metadata_filter_create (app_info_metadata_filter_h *handle) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_destroy")] + internal static extern ErrorCode AppInfoMetadataFilterDestroy(IntPtr handle); + //int app_info_metadata_filter_destroy (app_info_metadata_filter_h handle) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_add")] + internal static extern ErrorCode AppInfoMetadataFilterAdd(IntPtr handle, string key, string value); + //int app_info_metadata_filter_add (app_info_metadata_filter_h handle, const char *key, const char *value) + + [DllImport(Libraries.AppManager, EntryPoint = "app_info_metadata_filter_foreach")] + internal static extern ErrorCode AppInfoMetadataFilterForeach(IntPtr handle, AppInfoFilterCallback callback, IntPtr userData); + //int app_info_metadata_filter_foreach (app_info_metadata_filter_h handle, app_info_filter_cb callback, void *user_data) + + [StructLayout(LayoutKind.Sequential)] + internal struct RuaRec + { + internal int id; + internal IntPtr pkgName; + internal IntPtr appPath; + internal IntPtr arg; + internal IntPtr launchTime; + internal IntPtr instanceId; + internal IntPtr instanceName; + internal IntPtr icon; + internal IntPtr uri; + internal IntPtr image; + }; + + [DllImport(Libraries.Rua, EntryPoint = "rua_history_get_rec")] + internal static extern ErrorCode RuaHistoryGetRecord(out RuaRec record, IntPtr table, int nRows, int nCols, int row); + //int rua_history_get_rec(struct rua_rec *rec, char** table, int nrows, int ncols, int row); + + [DllImport(Libraries.Rua, EntryPoint = "rua_history_load_db")] + internal static extern ErrorCode RuaHistoryLoadDb(out IntPtr table, out int nRows, out int nCols); + //int rua_history_load_db(char*** table, int *nrows, int *ncols); + + [DllImport(Libraries.Rua, EntryPoint = "rua_history_unload_db")] + internal static extern ErrorCode RuaHistoryUnLoadDb(ref IntPtr table); + //int rua_history_unload_db(char*** table); + + [DllImport(Libraries.Rua, EntryPoint = "rua_delete_history_with_pkgname")] + internal static extern ErrorCode RuaDeleteHistoryWithPkgname(string pkgName); + //int rua_delete_history_with_pkgname(char* pkg_name); + + [DllImport(Libraries.Rua, EntryPoint = "rua_delete_history_with_apppath")] + internal static extern ErrorCode RuaDeleteHistoryWithApppath(string appPath); + //int rua_delete_history_with_apppath(char* app_path); + + [DllImport(Libraries.Rua, EntryPoint = "rua_clear_history")] + internal static extern ErrorCode RuaClearHistory(); + //int rua_clear_history(void); + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.Bundle.cs b/src/Tizen.Applications.Common/Interop/Interop.Bundle.cs new file mode 100755 index 0000000..65c314a --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.Bundle.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class Bundle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void Iterator(string key, int type, IntPtr keyval, IntPtr userData); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_create")] + internal static extern SafeBundleHandle Create(); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_free")] + internal static extern int DangerousFree(IntPtr handle); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_del")] + internal static extern int RemoveItem(SafeBundleHandle handle, string key); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_add_str")] + internal static extern int AddString(SafeBundleHandle handle, string key, string value); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_get_type")] + internal static extern int GetType(SafeBundleHandle handle, string key); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_get_str")] + internal static extern int GetString(SafeBundleHandle handle, string key, out IntPtr value); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_add_byte")] + internal static extern unsafe int AddByte(SafeBundleHandle handle, string key, byte* value, int size); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_get_byte")] + internal static extern int GetByte(SafeBundleHandle handle, string key, out IntPtr value, out int size); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_add_str_array")] + internal static extern int AddStringArray(SafeBundleHandle handle, string key, string[] value, int size); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_get_str_array")] + internal static extern IntPtr GetStringArray(SafeBundleHandle handle, string key, out int size); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_foreach")] + internal static extern void Foreach(SafeBundleHandle handle, Iterator iterator, IntPtr userData); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_encode")] + internal static extern void BundleEncode(SafeBundleHandle handle, out string str, out int len); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_decode")] + internal static extern SafeBundleHandle BundleDecode(string bundleRaw, int len); + + [DllImport(Libraries.Bundle, EntryPoint = "bundle_dup")] + internal static extern SafeBundleHandle DangerousClone(IntPtr handle); + + internal static class UnsafeCode + { + internal static unsafe int AddItem(SafeBundleHandle handle, string key, byte[] value, int offset, int count) + { + fixed (byte* pointer = value) + { + return AddByte(handle, key, pointer + offset, count); + } + } + } + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.Glib.cs b/src/Tizen.Applications.Common/Interop/Interop.Glib.cs new file mode 100755 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.Libc.cs b/src/Tizen.Applications.Common/Interop/Interop.Libc.cs new file mode 100755 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Applications.Common/Interop/Interop.Libraries.cs b/src/Tizen.Applications.Common/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..8a417c6 --- /dev/null +++ b/src/Tizen.Applications.Common/Interop/Interop.Libraries.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AppCommon = "libcapi-appfw-app-common.so.0"; + public const string AppControl = "libcapi-appfw-app-control.so.0"; + public const string AppEvent = "libcapi-appfw-event.so.0"; + public const string AppManager = "libcapi-appfw-app-manager.so.0"; + public const string Bundle = "libbundle.so.0"; + public const string Rua = "librua.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + public const string Application = "libcapi-appfw-application.so.0"; + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Common.csproj b/src/Tizen.Applications.Common/Tizen.Applications.Common.csproj new file mode 100755 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications.Common.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.Common/Tizen.Applications.Common.sln b/src/Tizen.Applications.Common/Tizen.Applications.Common.sln new file mode 100755 index 0000000..2be1005 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications.Common.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "Tizen.Applications.Common.csproj", "{C38800D6-AB85-4D6E-9C3F-F79C7C3ED4EB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{2E04FB0F-03F4-40B0-BB25-5ADFB08C8DF3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{8DA5B43B-63E9-460C-B64F-0B691539DC5D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C38800D6-AB85-4D6E-9C3F-F79C7C3ED4EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C38800D6-AB85-4D6E-9C3F-F79C7C3ED4EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C38800D6-AB85-4D6E-9C3F-F79C7C3ED4EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C38800D6-AB85-4D6E-9C3F-F79C7C3ED4EB}.Release|Any CPU.Build.0 = Release|Any CPU + {2E04FB0F-03F4-40B0-BB25-5ADFB08C8DF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E04FB0F-03F4-40B0-BB25-5ADFB08C8DF3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E04FB0F-03F4-40B0-BB25-5ADFB08C8DF3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E04FB0F-03F4-40B0-BB25-5ADFB08C8DF3}.Release|Any CPU.Build.0 = Release|Any CPU + {8DA5B43B-63E9-460C-B64F-0B691539DC5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DA5B43B-63E9-460C-B64F-0B691539DC5D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DA5B43B-63E9-460C-B64F-0B691539DC5D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DA5B43B-63E9-460C-B64F-0B691539DC5D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs new file mode 100755 index 0000000..aabbbeb --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/DefaultCoreBackend.cs @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +using Tizen.Internals.Errors; + +namespace Tizen.Applications.CoreBackend +{ + /// + /// Abstract class to provide default event handlers for apps. + /// + public abstract class DefaultCoreBackend : ICoreBackend + { + /// + /// Low level event types + /// + public enum AppEventType + { + LowMemory = 0, + LowBattery, + LanguageChanged, + DeviceOrientationChanged, + RegionFormatChanged, + SuspendedStateChanged + } + + protected static readonly string LogTag = typeof(DefaultCoreBackend).Namespace; + + protected IDictionary Handlers = new Dictionary(); + + public DefaultCoreBackend() + { + } + + ~DefaultCoreBackend() + { + Dispose(false); + } + + public void AddEventHandler(EventType evType, Action handler) + { + Handlers.Add(evType, handler); + } + + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + Handlers.Add(evType, handler); + } + + public virtual void Run(string[] args) + { + TizenSynchronizationContext.Initialize(); + } + + public abstract void Exit(); + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected abstract void Dispose(bool disposing); + + protected virtual void OnLowMemoryNative(IntPtr infoHandle, IntPtr data) + { + LowMemoryStatus status = LowMemoryStatus.None; + ErrorCode err = Interop.AppCommon.AppEventGetLowMemoryStatus(infoHandle, out status); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get memory status. Err = " + err); + } + if (Handlers.ContainsKey(EventType.LowMemory)) + { + var handler = Handlers[EventType.LowMemory] as Action; + handler?.Invoke(new LowMemoryEventArgs(status)); + } + } + + protected virtual void OnLowBatteryNative(IntPtr infoHandle, IntPtr data) + { + LowBatteryStatus status = LowBatteryStatus.None; + ErrorCode err = Interop.AppCommon.AppEventGetLowBatteryStatus(infoHandle, out status); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get battery status. Err = " + err); + } + if (Handlers.ContainsKey(EventType.LowBattery)) + { + var handler = Handlers[EventType.LowBattery] as Action; + handler?.Invoke(new LowBatteryEventArgs(status)); + } + } + + protected virtual void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data) + { + string lang; + ErrorCode err = Interop.AppCommon.AppEventGetLanguage(infoHandle, out lang); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get changed language. Err = " + err); + } + if (Handlers.ContainsKey(EventType.LocaleChanged)) + { + var handler = Handlers[EventType.LocaleChanged] as Action; + handler?.Invoke(new LocaleChangedEventArgs(lang)); + } + } + + protected virtual void OnRegionChangedNative(IntPtr infoHandle, IntPtr data) + { + string region; + ErrorCode err = Interop.AppCommon.AppEventGetRegionFormat(infoHandle, out region); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get changed region format. Err = " + err); + } + if (Handlers.ContainsKey(EventType.RegionFormatChanged)) + { + var handler = Handlers[EventType.RegionFormatChanged] as Action; + handler?.Invoke(new RegionFormatChangedEventArgs(region)); + } + } + + protected virtual void OnDeviceOrientationChangedNative(IntPtr infoHandle, IntPtr data) + { + DeviceOrientation orientation; + ErrorCode err = Interop.AppCommon.AppEventGetDeviceOrientation(infoHandle, out orientation); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get deivce orientation. Err = " + err); + } + if (Handlers.ContainsKey(EventType.DeviceOrientationChanged)) + { + var handler = Handlers[EventType.DeviceOrientationChanged] as Action; + handler?.Invoke(new DeviceOrientationEventArgs(orientation)); + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/EventType.cs b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/EventType.cs new file mode 100755 index 0000000..e24cddf --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/EventType.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +namespace Tizen.Applications.CoreBackend +{ + /// + /// Class that represents the type of event for backends. This class can be converted from string type. + /// + public class EventType + { + /// + /// Pre-defined event type. "PreCreated" + /// + public static readonly EventType PreCreated = "PreCreated"; + + /// + /// Pre-defined event type. "Created" + /// + public static readonly EventType Created = "Created"; + + /// + /// Pre-defined event type. "Terminated" + /// + public static readonly EventType Terminated = "Terminated"; + + /// + /// Pre-defined event type. "AppControlReceived" + /// + public static readonly EventType AppControlReceived = "AppControlReceived"; + + /// + /// Pre-defined event type. "Resumed" + /// + public static readonly EventType Resumed = "Resumed"; + + /// + /// Pre-defined event type. "Paused" + /// + public static readonly EventType Paused = "Paused"; + + /// + /// Pre-defined event type. "LowMemory" + /// + public static readonly EventType LowMemory = "LowMemory"; + + /// + /// Pre-defined event type. "LowBattery" + /// + public static readonly EventType LowBattery = "LowBattery"; + + /// + /// Pre-defined event type. "LocaleChanged" + /// + public static readonly EventType LocaleChanged = "LocaleChanged"; + + /// + /// Pre-defined event type. "RegionFormatChanged" + /// + public static readonly EventType RegionFormatChanged = "RegionFormatChanged"; + + /// + /// Pre-defined event type. "DeviceOrientationChanged" + /// + public static readonly EventType DeviceOrientationChanged = "DeviceOrientationChanged"; + + private string _typeName; + + /// + /// Initializes the EventType class. + /// + /// The name of event type. + public EventType(string name) + { + _typeName = name; + } + + /// + /// Returns the name of event type. + /// + public override string ToString() + { + return _typeName; + } + + /// + /// Returns the hash code for event type string. + /// + public override int GetHashCode() + { + if (_typeName == null) return 0; + return _typeName.GetHashCode(); + } + + /// + /// Determines whether this instance and a specified object. + /// + public override bool Equals(object obj) + { + EventType other = obj as EventType; + return other != null && other._typeName == this._typeName; + } + + /// + /// Converts a string to EventType instance. + /// + public static implicit operator EventType(string value) + { + return new EventType(value); + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs new file mode 100755 index 0000000..0ba8be5 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications.CoreBackend/ICoreBackend.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications.CoreBackend +{ + /// + /// Interface that represents the backend lifecycles. + /// + public interface ICoreBackend : IDisposable + { + /// + /// Adds an event handler. + /// + /// The type of event. + /// The handler method without arguments. + void AddEventHandler(EventType evType, Action handler); + + /// + /// Adds an event handler. + /// + /// The EventArgs type used in arguments of the handler method. + /// The type of event. + /// The handler method with a TEventArgs type argument. + void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs; + + /// + /// Runs the mainloop of backend. + /// + /// + void Run(string[] args); + + /// + /// Exits the mainloop of backend. + /// + void Exit(); + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs new file mode 100755 index 0000000..1128f02 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControl.cs @@ -0,0 +1,1038 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// Represents the control message to exchange between applications. + /// + /// + /// + /// public class AppControlExample : UIApplication + /// { + /// /// ... + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// AppControl appControl = new AppControl(); + /// appControl.ApplicationId = "org.tizen.calculator"; + /// AppControl.SendLaunchRequest(appControl, (launchRequest, replyRequest, result) => { + /// // ... + /// }); + /// } + /// } + /// + /// + public class AppControl + { + private const string LogTag = "Tizen.Applications"; + + private static Dictionary s_replyNativeCallbackMaps = new Dictionary(); + private static int s_replyNativeCallbackId = 0; + + private readonly SafeAppControlHandle _handle; + + private string _operation = null; + private string _mime = null; + private string _uri = null; + private string _category = null; + private string _applicationId = null; + private ExtraDataCollection _extraData = null; + + /// + /// Initializes the instance of the AppControl class. + /// + /// Thrown when failed to create AppControl handle. + public AppControl() + { + Interop.AppControl.ErrorCode err = Interop.AppControl.Create(out _handle); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to create the appcontrol handle. Err = " + err); + } + } + + /// + /// Initializes the instance of the AppControl class with parameter. + /// + /// The flag value to receive an additional launch result event on launch request. + /// Thrown when failed to create AppControl handle. + public AppControl(bool enableAppStartedResultEvent) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.Create(out _handle); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to create the appcontrol handle. Err = " + err); + } + + if (enableAppStartedResultEvent) + { + err = Interop.AppControl.EnableAppStartedResultEvent(_handle); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to set EnableAppStartedResultEvent"); + } + } + } + + /// + /// Initializes the instance of the AppControl class with the SafeAppControlHandle. + /// + /// + public AppControl(SafeAppControlHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("handle"); + } + + Interop.AppControl.ErrorCode err = Interop.AppControl.DangerousClone(out _handle, handle.DangerousGetHandle()); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to clone the appcontrol handle. Err = " + err); + } + } + + private AppControl(IntPtr handle) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.DangerousClone(out _handle, handle); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to clone the appcontrol handle. Err = " + err); + } + } + + #region Public Properties + + /// + /// Gets the SafeAppControlHandle instance. + /// + public SafeAppControlHandle SafeAppControlHandle + { + get + { + return _handle; + } + } + + /// + /// Gets and sets the operation to be performed. + /// + /// + /// The operation is the mandatory information for the launch request. If the operation is not specified, + /// AppControlOperations.Default is used for the launch request. If the operation is AppControlOperations.Default, + /// the package information is mandatory to explicitly launch the application. + /// (if the operation is null for setter, it clears the previous value.) + /// + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.Operation = AppControlOperations.Default; + /// Log.Debug(LogTag, "Operation: " + appControl.Operation); + /// + /// + public string Operation + { + get + { + if (String.IsNullOrEmpty(_operation)) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.GetOperation(_handle, out _operation); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the operation from the appcontrol. Err = " + err); + } + } + return _operation; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetOperation(_handle, value); + if (err == Interop.AppControl.ErrorCode.None) + { + _operation = value; + } + else + { + Log.Warn(LogTag, "Failed to set the operation to the appcontrol. Err = " + err); + } + } + } + + /// + /// Gets and sets the explicit MIME type of the data. + /// + /// + /// (if the mime is null for setter, it clears the previous value.) + /// + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.Mime = "image/jpg"; + /// Log.Debug(LogTag, "Mime: " + appControl.Mime); + /// + /// + public string Mime + { + get + { + if (String.IsNullOrEmpty(_mime)) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.GetMime(_handle, out _mime); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the mime from the appcontrol. Err = " + err); + } + } + return _mime; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetMime(_handle, value); + if (err == Interop.AppControl.ErrorCode.None) + { + _mime = value; + } + else + { + Log.Warn(LogTag, "Failed to set the mime to the appcontrol. Err = " + err); + } + } + } + + /// + /// Gets and sets the URI of the data. + /// + /// + /// Since Tizen 2.4, if the parameter 'uri' is started with 'file://' and + /// it is a regular file in this application's data path which can be obtained + /// by property DataPath in ApplicationInfo class, + /// it will be shared to the callee application. + /// Framework will grant a temporary permission to the callee application for this file and + /// revoke it when the callee application is terminated. + /// The callee application can just read it. + /// (if the uri is null for setter, it clears the previous value.) + /// + /// + /// + /// public class AppControlExample : UIApplication + /// { + /// ... + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// ... + /// AppControl appControl = new AppControl(); + /// appContrl.Uri = this.ApplicationInfo.DataPath + "image.jpg"; + /// Log.Debug(LogTag, "Set Uri: " + appControl.Uri); + /// } + /// } + /// + /// + public string Uri + { + get + { + if (String.IsNullOrEmpty(_uri)) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.GetUri(_handle, out _uri); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the uri from the appcontrol. Err = " + err); + } + } + return _uri; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetUri(_handle, value); + if (err == Interop.AppControl.ErrorCode.None) + { + _uri = value; + } + else + { + Log.Warn(LogTag, "Failed to set the uri to the appcontrol. Err = " + err); + } + } + } + + /// + /// Gets and sets the explicit category. + /// + /// + /// (if the category is null for setter, it clears the previous value.) + /// + public string Category + { + get + { + if (String.IsNullOrEmpty(_category)) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.GetCategory(_handle, out _category); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the category from the appcontrol. Err = " + err); + } + } + return _category; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetCategory(_handle, value); + if (err == Interop.AppControl.ErrorCode.None) + { + _category = value; + } + else + { + Log.Warn(LogTag, "Failed to set the category to the appcontrol. Err = " + err); + } + } + } + + /// + /// Gets and sets the application id to explicitly launch. + /// + /// + /// (if the application id is null for setter, it clears the previous value.) + /// + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ApplicationId = "org.tizen.calculator"; + /// Log.Debug(LogTag, "ApplicationId: " + appControl.ApplicationId); + /// + /// + public string ApplicationId + { + get + { + if (String.IsNullOrEmpty(_applicationId)) + { + Interop.AppControl.ErrorCode err = Interop.AppControl.GetAppId(_handle, out _applicationId); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the application id from the AppControl. Err = " + err); + } + } + return _applicationId; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetAppId(_handle, value); + if (err == Interop.AppControl.ErrorCode.None) + { + _applicationId = value; + } + else + { + Log.Warn(LogTag, "Failed to set the application id to the AppControl. Err = " + err); + } + } + } + + /// + /// Gets and sets the launch mode of the application. + /// + /// + /// Although LaunchMode were set as AppControlLaunchMode.Group, + /// callee application would be launched as single mode + /// if the manifest file of callee application defined the launch mode as "single". + /// This property can just set the preference of caller application to launch an application. + /// Sub-applications which were launched as group mode always have own process. + /// Since Tizen 3.0, if launch mode not set in the caller app control, + /// this property returns AppControlLaunchMode.Single launch mode. + /// + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.LaunchMode = AppControlLaunchMode.Group; + /// + /// + public AppControlLaunchMode LaunchMode + { + get + { + int value = 0; + Interop.AppControl.ErrorCode err = Interop.AppControl.GetLaunchMode(_handle, out value); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the LaunchMode from the AppControl. Err = " + err); + } + return (AppControlLaunchMode)value; + } + set + { + Interop.AppControl.ErrorCode err = Interop.AppControl.SetLaunchMode(_handle, (int)value); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to set the LaunchMode to the AppControl. Err = " + err); + } + } + } + + /// + /// Gets the collection of the extra data. + /// + /// + /// Extra data for communication between AppControls. + /// + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ExtraData.Add("key", "value"); + /// ... + /// + /// + public ExtraDataCollection ExtraData + { + get + { + if (_extraData == null) + _extraData = new ExtraDataCollection(_handle); + return _extraData; + } + } + + #endregion // Public Properties + + /// + /// Retrieves all applications that can be launched to handle the given app_control request. + /// + /// The AppControl + /// ApplicationIds + /// Thrown when failed because of invalid parameter + /// + /// + /// IEnumerable applicationIds = AppControl.GetMatchedApplicationIds(control); + /// if (applicationIds != null) + /// { + /// foreach (string id in applicationIds) + /// { + /// // ... + /// } + /// } + /// + /// + public static IEnumerable GetMatchedApplicationIds(AppControl control) + { + if (control == null) + { + throw new ArgumentNullException("control"); + } + + List ids = new List(); + Interop.AppControl.AppMatchedCallback callback = (handle, applicationId, userData) => + { + if (applicationId == null) + { + return false; + } + + ids.Add(applicationId); + return true; + }; + + Interop.AppControl.ErrorCode err = Interop.AppControl.ForeachAppMatched(control._handle, callback, IntPtr.Zero); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to get matched application ids. err = " + err); + } + + return ids; + } + + /// + /// Sends the launch request. + /// + /// + /// The operation is mandatory information for the launch request. + /// If the operation is not specified, AppControlOperations.Default is used by default. + /// If the operation is AppControlOperations.Default, the application ID is mandatory to explicitly launch the application. \n + /// Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform. + /// Also, implicit launch requests are NOT delivered to service applications since 2.4. + /// To launch a service application, an explicit launch request with application ID given by property ApplicationId MUST be sent. + /// + /// The AppControl + /// Thrown when failed because of a null arguament + /// Thrown when failed because of invalid operation + /// Thrown when failed because of timeout + /// http://tizen.org/privilege/appmanager.launch + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ApplicationId = "org.tizen.calculator"; + /// AppControl.SendLaunchRequest(appControl); + /// + /// + public static void SendLaunchRequest(AppControl launchRequest) + { + SendLaunchRequest(launchRequest, null); + } + + /// + /// Sends the launch request. + /// + /// + /// The operation is mandatory information for the launch request. + /// If the operation is not specified, AppControlOperations.Default is used by default. + /// If the operation is AppControlOperations.Default, the application ID is mandatory to explicitly launch the application. \n + /// Since Tizen 2.4, the launch request of the service application over out of packages is restricted by the platform. + /// Also, implicit launch requests are NOT delivered to service applications since 2.4. + /// To launch a service application, an explicit launch request with application ID given by property ApplicationId MUST be sent. + /// + /// The AppControl + /// The callback function to be called when the reply is delivered + /// Thrown when failed because of arguament is invalid + /// Thrown when failed because of invalid operation + /// Thrown when failed because of timeout + /// http://tizen.org/privilege/appmanager.launch + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ApplicationId = "org.tizen.calculator"; + /// AppControl.SendLaunchRequest(appControl, (launchRequest, replyRequest, result) => { + /// // ... + /// }); + /// + /// + public static void SendLaunchRequest(AppControl launchRequest, AppControlReplyCallback replyAfterLaunching) + { + if (launchRequest == null) + { + throw new ArgumentNullException("launchRequest"); + } + + Interop.AppControl.ErrorCode err; + + if (replyAfterLaunching != null) + { + int id = 0; + lock (s_replyNativeCallbackMaps) + { + id = s_replyNativeCallbackId++; + s_replyNativeCallbackMaps[id] = (launchRequestHandle, replyRequestHandle, result, userData) => + { + if (replyAfterLaunching != null) + { + Log.Debug(LogTag, "Reply Callback is launched"); + replyAfterLaunching(new AppControl(launchRequestHandle), new AppControl(replyRequestHandle), (AppControlReplyResult)result); + if (result != Interop.AppControl.AppStartedStatus) + { + lock (s_replyNativeCallbackMaps) + { + s_replyNativeCallbackMaps.Remove(id); + } + } + } + }; + } + err = Interop.AppControl.SendLaunchRequest(launchRequest._handle, s_replyNativeCallbackMaps[id], IntPtr.Zero); + } + else + { + err = Interop.AppControl.SendLaunchRequest(launchRequest._handle, null, IntPtr.Zero); + } + + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.AppControl.ErrorCode.TimedOut: + throw new TimeoutException("Timed out"); + default: + throw new InvalidOperationException("Error = " + err); + } + } + } + + /// + /// Sends the terminate request to the application that is launched by AppControl. + /// + /// + /// You are not allowed to terminate other general applications using this API. + /// This API can be used to terminate sub-applications which were launched as group mode by caller application. + /// Once callee application is being terminated by this API, + /// other applications which were launched by callee application as group mode will be terminated as well + /// + /// The AppControl + /// Thrown when failed because of arguament is invalid + /// Thrown when failed because of invalid operation + /// Thrown when failed because of timeout + /// + /// + /// AppControl terminateRequest = new AppControl(); + /// terminateRequest.ApplicationId = "org.tizen.calculator"; + /// AppControl.SendTerminateRequest(terminateRequest); + /// + /// + public static void SendTerminateRequest(AppControl terminateRequest) + { + if (terminateRequest == null) + { + throw new ArgumentNullException("terminateRequest"); + } + Interop.AppControl.ErrorCode err; + + err = Interop.AppControl.SendTerminateRequest(terminateRequest._handle); + + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.AppControl.ErrorCode.TimedOut: + throw new TimeoutException("Timed out"); + default: + throw new InvalidOperationException("Error = " + err); + } + } + } + + /// + /// Class for Extra Data + /// + public class ExtraDataCollection + { + private readonly SafeAppControlHandle _handle; + + internal ExtraDataCollection(SafeAppControlHandle handle) + { + _handle = handle; + } + + /// + /// Adds extra data. + /// + /// + /// The function replaces any existing value for the given key. + /// + /// The name of the extra data + /// The value associated with the given key + /// Thrown when key or value is a zero-length string + /// Thrown when the application tries to use the same key with system-defined key + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ExtraData.Add("myKey", "myValue"); + /// + /// + public void Add(string key, string value) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + if (string.IsNullOrEmpty(value)) + { + throw new ArgumentNullException("value"); + } + Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraData(_handle, key, value); + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter: key or value is a zero-length string"); + case Interop.AppControl.ErrorCode.KeyRejected: + throw new ArgumentException("Key is rejected: the key is system-defined key."); + default: + throw new InvalidOperationException("Error = " + err); + } + } + } + + /// + /// Adds extra data. + /// + /// + /// The function replaces any existing value for the given key. + /// + /// The name of the extra data + /// The value associated with the given key + /// Thrown when key or value is a zero-length string + /// Thrown when the application tries to use the same key with system-defined key + /// + /// + /// AppControl appControl = new AppControl(); + /// string[] myValues = new string[] { "first", "second", "third" }; + /// appControl.ExtraData.Add("myKey", myValues); + /// + /// + public void Add(string key, IEnumerable value) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + if (value == null) + { + throw new ArgumentNullException("value"); + } + string[] valueArray = value.ToArray(); + Interop.AppControl.ErrorCode err = Interop.AppControl.AddExtraDataArray(_handle, key, valueArray, valueArray.Length); + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter: key or value is a zero-length string"); + case Interop.AppControl.ErrorCode.KeyRejected: + throw new ArgumentException("Key is rejected: the key is system-defined key."); + default: + throw new InvalidOperationException("Error = " + err); + } + } + } + + /// + /// Gets the extra data. + /// + /// Only string and IEnumerable<string> + /// The name of extra data + /// The value associated with the given key + /// Thrown when the key is invalid parameter + /// Thrown when the key is not found + /// Thrown when the key is rejected + /// + /// + /// AppControl appControl = new AppControl(); + /// string myValue = appControl.ExtraData.Get("myKey"); + /// + /// + public T Get(string key) + { + object ret = Get(key); + return (T)ret; + } + + /// + /// Gets the extra data. + /// + /// The name of extra data + /// The value associated with the given key + /// Thrown when the key is invalid parameter + /// Thrown when the key is not found + /// Thrown when the key is rejected + /// + /// + /// AppControl appControl = new AppControl(); + /// string myValue = appControl.ExtraData.Get("myKey") as string; + /// if (myValue != null) + /// { + /// // ... + /// } + /// + /// + public object Get(string key) + { + if (IsCollection(key)) + { + return GetDataCollection(key); + } + else + { + return GetData(key); + } + } + + /// + /// Gets all keys in extra data. + /// + /// The keys in the AppControl + /// Thrown when invalid parameter + /// + /// + /// AppControl appControl = new AppControl(); + /// IEnumerable keys = appControl.GetKeys(); + /// if (keys != null) + /// { + /// foreach (string key in keys) + /// { + /// // ... + /// } + /// } + /// + /// + public IEnumerable GetKeys() + { + List keys = new List(); + Interop.AppControl.ExtraDataCallback callback = (handle, key, userData) => + { + if (key == null) + { + return false; + } + + keys.Add(key); + return true; + }; + + Interop.AppControl.ErrorCode err = Interop.AppControl.ForeachExtraData(_handle, callback, IntPtr.Zero); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Failed to get keys. err = " + err); + } + + return keys; + } + + /// + /// Tries getting the extra data. + /// + /// The name of extra data + /// The value associated with the given key + /// The result whether getting the value is done + /// Thrown when the key is invalid parameter + /// Thrown when the key is not found + /// Thrown when the key is rejected + /// + /// + /// AppControl appControl = new AppControl(); + /// string myValue = string.Empty; + /// bool result = appControl.ExtraData.TryGet("myKey", out myValue); + /// if (result != null) + /// { + /// // ... + /// } + /// + /// + public bool TryGet(string key, out string value) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + Interop.AppControl.GetExtraData(_handle, key, out value); + if (value != null) + { + return true; + } + else + { + value = default(string); + return false; + } + } + + /// + /// Tries getting the extra data. + /// + /// The name of extra data + /// The value associated with the given key + /// The result whether getting the value is done + /// Thrown when the key is invalid parameter + /// Thrown when the key is not found + /// Thrown when the key is rejected + /// + /// + /// AppControl appControl = new AppControl(); + /// IEnumerable myValue = null; + /// bool result = appControl.ExtraData.TryGet("myKey", out myValue); + /// if (result) + /// { + /// foreach (string value in myValue) + /// { + /// // ... + /// } + /// } + /// + /// + public bool TryGet(string key, out IEnumerable value) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + IntPtr valuePtr = IntPtr.Zero; + int len = -1; + Interop.AppControl.ErrorCode err = Interop.AppControl.GetExtraDataArray(_handle, key, out valuePtr, out len); + if (err == Interop.AppControl.ErrorCode.None && valuePtr != IntPtr.Zero) + { + List stringList = new List(); + for (int i = 0; i < len; ++i) + { + IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); + stringList.Add(Marshal.PtrToStringAnsi(charArr)); + Interop.Libc.Free(charArr); + } + Interop.Libc.Free(valuePtr); + value = stringList; + return true; + } + else + { + value = default(IEnumerable); + return false; + } + } + + /// + /// Removes the extra data. + /// + /// The name of the extra data + /// Thrown when the key is a zero-length string + /// Thrown when the key is not found + /// Thrown when the key is rejected + /// + /// + /// AppControl appControl = new AppControl(); + /// appControl.ExtraData.Remove("myKey"); + /// + /// + public void Remove(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + Interop.AppControl.ErrorCode err = Interop.AppControl.RemoveExtraData(_handle, key); + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter: key is a zero-length string"); + case Interop.AppControl.ErrorCode.KeyNotFound: + throw new KeyNotFoundException("Key is not found"); ; + case Interop.AppControl.ErrorCode.KeyRejected: + throw new ArgumentException("Key is rejected: the key is system-defined key."); + default: + throw new InvalidOperationException("Error = " + err); + } + } + } + + /// + /// Counts keys in the extra data. + /// + /// The number of counting keys + /// Thrown when invalid parameter + /// + /// + /// AppControl appControl = new AppControl(); + /// int numberOfKeys = appControl.ExtraData.Count(); + /// + /// + public int Count() + { + return GetKeys().Count(); + } + + /// + /// Checks whether the extra data associated with the given key is of collection data type. + /// + /// The name of the extra data + /// If true the extra data is of array data type, otherwise false + /// Thrown when the key is a zero-length string + /// Thrown when failed to check the key + /// + /// + /// AppControl appControl = new AppControl(); + /// bool result = appControl.ExtraData.IsCollection("myKey"); + /// + /// + public bool IsCollection(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + bool isArray = false; + Interop.AppControl.ErrorCode err = Interop.AppControl.IsExtraDataArray(_handle, key, out isArray); + if (err != Interop.AppControl.ErrorCode.None) + { + throw new InvalidOperationException("Error = " + err); + } + return isArray; + } + + private string GetData(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + string value = string.Empty; + Interop.AppControl.ErrorCode err = Interop.AppControl.GetExtraData(_handle, key, out value); + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter: key is a zero-length string"); + case Interop.AppControl.ErrorCode.KeyNotFound: + throw new KeyNotFoundException("Key is not found"); ; + case Interop.AppControl.ErrorCode.InvalidDataType: + throw new ArgumentException("Invalid data type: value is data collection type"); + case Interop.AppControl.ErrorCode.KeyRejected: + throw new ArgumentException("Key is rejected: the key is system-defined key."); + default: + throw new InvalidOperationException("Error = " + err); + } + } + return value; + } + + private IEnumerable GetDataCollection(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw new ArgumentNullException("key"); + } + IntPtr valuePtr = IntPtr.Zero; + int len = -1; + Interop.AppControl.ErrorCode err = Interop.AppControl.GetExtraDataArray(_handle, key, out valuePtr, out len); + if (err != Interop.AppControl.ErrorCode.None) + { + switch (err) + { + case Interop.AppControl.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter: key is a zero-length string"); + case Interop.AppControl.ErrorCode.KeyNotFound: + throw new KeyNotFoundException("Key is not found"); ; + case Interop.AppControl.ErrorCode.InvalidDataType: + throw new ArgumentException("Invalid data type: value is data collection type"); + case Interop.AppControl.ErrorCode.KeyRejected: + throw new ArgumentException("Key is rejected: the key is system-defined key."); + default: + throw new InvalidOperationException("Error = " + err); + } + } + + List valueArray = new List(); + if (valuePtr != IntPtr.Zero) + { + for (int i = 0; i < len; ++i) + { + IntPtr charArr = Marshal.ReadIntPtr(valuePtr, IntPtr.Size * i); + valueArray.Add(Marshal.PtrToStringAnsi(charArr)); + Interop.Libc.Free(charArr); + } + Interop.Libc.Free(valuePtr); + } + return valueArray; + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlData.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlData.cs new file mode 100755 index 0000000..fddfd09 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlData.cs @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Data of the AppControl. + /// + public static class AppControlData + { + /// + /// Subject + /// + public const string Subject = "http://tizen.org/appcontrol/data/subject"; + + /// + /// Recipients + /// + public const string To = "http://tizen.org/appcontrol/data/to"; + + /// + /// E-mail addresses that should be carbon copied + /// + public const string Cc = "http://tizen.org/appcontrol/data/cc"; + + /// + /// E-mail addresses that should be blind carbon copied + /// + public const string Bcc = "http://tizen.org/appcontrol/data/bcc"; + + /// + /// Text + /// + public const string Text = "http://tizen.org/appcontrol/data/text"; + + /// + /// Title + /// + public const string Title = "http://tizen.org/appcontrol/data/title"; + + /// + /// Selected items + /// + public const string Selected = "http://tizen.org/appcontrol/data/selected"; + + /// + /// Paths of items + /// + public const string Path = "http://tizen.org/appcontrol/data/path"; + + /// + /// Selection mode. ("single" or "multiple") + /// + public const string SectionMode = "http://tizen.org/appcontrol/data/selection_mode"; + + /// + /// All-day mode of event ("true" or "false") + /// + public const string AllDay = "http://tizen.org/appcontrol/data/calendar/all_day"; + + /// + /// Start time of event (format: YYYY-MM-DD HH:MM:SS) + /// + public const string StartTime = "http://tizen.org/appcontrol/data/calendar/start_time"; + + /// + /// End time of event (format: YYYY-MM-DD HH:MM:SS) + /// + public const string Endtime = "http://tizen.org/appcontrol/data/calendar/end_time"; + + /// + /// E-mail addressed + /// + public const string Email = "http://tizen.org/appcontrol/data/email"; + + /// + /// Phone numbers + /// + public const string Phone = "http://tizen.org/appcontrol/data/phone"; + + /// + /// URLs + /// + public const string Url = "http://tizen.org/appcontrol/data/url"; + + /// + /// IDs + /// + public const string Ids = "http://tizen.org/appcontrol/data/id"; + + /// + /// Type + /// + public const string Type = "http://tizen.org/appcontrol/data/type"; + + /// + /// Total count + /// + public const string TotalCount = "http://tizen.org/appcontrol/data/total_count"; + + /// + /// Total size (unit : bytes) + /// + public const string TotalSize = "http://tizen.org/appcontrol/data/total_size"; + + /// + /// Name + /// + public const string Name = "http://tizen.org/appcontrol/data/name"; + + /// + /// Location + /// + public const string Location = "http://tizen.org/appcontrol/data/location"; + + /// + /// Select the type of input method + /// + public const string InputType = "http://tizen.org/appcontrol/data/input_type"; + + /// + /// Send the pre inputted text such as "http://" in web + /// + public const string InputDefaultText = "http://tizen.org/appcontrol/data/input_default_text"; + + /// + /// Send guide text to show to user such as "Input user name" + /// + public const string InputGuideText = "http://tizen.org/appcontrol/data/input_guide_text"; + + /// + /// Send text to receive answer result from smart reply + /// + public const string InputPredictionHint = "http://tizen.org/appcontrol/data/input_prediction_hint"; + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs new file mode 100755 index 0000000..728612c --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlLaunchMode.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for App Control Launch Mode. + /// + public enum AppControlLaunchMode + { + /// + /// Prefer to launch an application as single mode + /// + Single = 0, + + /// + /// Prefer to launch an application as group mode + /// + Group, + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlOperations.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlOperations.cs new file mode 100755 index 0000000..c045651 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlOperations.cs @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Operations of the AppControl. + /// + public static class AppControlOperations + { + /// + /// An explicit launch for a homescreen application. + /// + public const string Main = "http://tizen.org/appcontrol/operation/main"; + + /// + /// An explicit launch for an application that excludes a homescreen application. + /// + public const string Default = "http://tizen.org/appcontrol/operation/default"; + + /// + /// Provides an editable access to the given data. + /// + public const string Edit = "http://tizen.org/appcontrol/operation/edit"; + + /// + /// Displays the data. + /// + public const string View = "http://tizen.org/appcontrol/operation/view"; + + /// + /// Picks items. + /// + public const string Pick = "http://tizen.org/appcontrol/operation/pick"; + + /// + /// Creates contents. + /// + public const string CreateContent = "http://tizen.org/appcontrol/operation/create_content"; + + /// + /// Performs a call to someone. + /// + public const string Call = "http://tizen.org/appcontrol/operation/call"; + + /// + /// Delivers some data to someone else. + /// + public const string Send = "http://tizen.org/appcontrol/operation/send"; + + /// + /// Delivers text data to someone else. + /// + public const string SendText = "http://tizen.org/appcontrol/operation/send_text"; + + /// + /// Shares an item with someone else. + /// + public const string Share = "http://tizen.org/appcontrol/operation/share"; + + /// + /// Shares multiple items with someone else. + /// + public const string MultiShare = "http://tizen.org/appcontrol/operation/multi_share"; + + /// + /// Shares text data with someone else. + /// + public const string ShareText = "http://tizen.org/appcontrol/operation/share_text"; + + /// + /// Dials a number. This shows a UI with the number to be dialed, allowing the user to explicitly initiate the call. + /// + public const string Dial = "http://tizen.org/appcontrol/operation/dial"; + + /// + /// Performs a search. + /// + public const string Search = "http://tizen.org/appcontrol/operation/search"; + + /// + /// Downloads items. + /// + public const string Download = "http://tizen.org/appcontrol/operation/download"; + + /// + /// Prints contents. + /// + public const string Print = "http://tizen.org/appcontrol/operation/print"; + + /// + /// Composes a message. + /// + public const string Compose = "http://tizen.org/appcontrol/operation/compose"; + + /// + /// Can be launched by interested System-Event. + /// + public const string LaunchOnEvent = "http://tizen.org/appcontrol/operation/launch_on_event"; + + /// + /// Adds an item. + /// + public const string Add = "http://tizen.org/appcontrol/operation/add"; + + /// + /// Captures images by camera applications. + /// + public const string ImageCapture = "http://tizen.org/appcontrol/operation/image_capture"; + + /// + /// Captures videos by camera applications. + /// + public const string VideoCapture = "http://tizen.org/appcontrol/operation/video_capture"; + + /// + /// Shows system settings. + /// + public const string Setting = "http://tizen.org/appcontrol/operation/setting"; + + /// + /// Shows settings to enable Bluetooth. + /// + public const string SettingBluetoothEnable = "http://tizen.org/appcontrol/operation/setting/bt_enable"; + + /// + /// Shows settings to configure Bluetooth visibility. + /// + public const string SettingBluetoothVisibility = "http://tizen.org/appcontrol/operation/setting/bt_visibility"; + + /// + /// Shows settings to allow configuration of current location sources. + /// + public const string SettingLocation = "http://tizen.org/appcontrol/operation/setting/location"; + + /// + /// Shows NFC settings. + /// + public const string SettingNfc = "http://tizen.org/appcontrol/operation/setting/nfc"; + + /// + /// Shows settings to allow configuration of Wi-Fi. + /// + public const string SettingWifi = "http://tizen.org/appcontrol/operation/setting/wifi"; + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlReceivedEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReceivedEventArgs.cs new file mode 100755 index 0000000..7318466 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReceivedEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that raised when the application receives the AppControl. + /// + public class AppControlReceivedEventArgs : EventArgs + { + /// + /// Initializes AppControlReceivedEventArgs class. + /// + /// + public AppControlReceivedEventArgs(ReceivedAppControl appControl) + { + ReceivedAppControl = appControl; + } + + /// + /// The received AppControl. + /// + public ReceivedAppControl ReceivedAppControl { get; private set; } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyCallback.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyCallback.cs new file mode 100755 index 0000000..1a9c6c9 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyCallback.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Reply callback for the launch request + /// + /// The AppControl of the launch request that has been sent + /// The AppControl in which the results of the callee are contained + /// The result of the launch request + public delegate void AppControlReplyCallback(AppControl launchRequest, AppControl replyRequest, AppControlReplyResult result); +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyResult.cs b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyResult.cs new file mode 100755 index 0000000..7fed628 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/AppControlReplyResult.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for App Control Result. + /// + public enum AppControlReplyResult + { + /// + /// Callee application launched actually + /// + AppStarted = 1, + + /// + /// Operation is succeeded + /// + Succeeded = 0, + + /// + /// Operation is failed by the callee + /// + Failed = -1, + + /// + /// Operation is canceled by the platform + /// + Canceled = -2, + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/Application.cs b/src/Tizen.Applications.Common/Tizen.Applications/Application.cs new file mode 100755 index 0000000..2049f57 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/Application.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Class that represents a Tizen application. + /// + public abstract class Application : IDisposable + { + internal const string LogTag = "Tizen.Applications"; + + private static Application s_CurrentApplication = null; + + private object _lock = new object(); + + private DirectoryInfo _directoryInfo; + private ApplicationInfo _applicationInfo; + + /// + /// Gets the instance of current application. + /// + public static Application Current { get { return s_CurrentApplication; } } + + /// + /// Gets the class representing directory information of current application. + /// + public DirectoryInfo DirectoryInfo + { + get + { + lock (_lock) + { + if (_directoryInfo == null) + { + _directoryInfo = new DirectoryInfo(); + } + } + return _directoryInfo; + } + } + + /// + /// Gets the class representing information of current application. + /// + public ApplicationInfo ApplicationInfo + { + get + { + lock (_lock) + { + if (_applicationInfo == null) + { + string appId = string.Empty; + Interop.AppCommon.AppGetId(out appId); + if (!string.IsNullOrEmpty(appId)) + { + _applicationInfo = new ApplicationInfo(appId); + } + } + } + return _applicationInfo; + } + } + + /// + /// Runs the application's main loop. + /// + /// Arguments from commandline. + public virtual void Run(string[] args) + { + if (args == null) + { + throw new ArgumentNullException("args"); + } + s_CurrentApplication = this; + } + + /// + /// Exits the main loop of application. + /// + public abstract void Exit(); + + #region IDisposable Support + private bool _disposedValue = false; // To detect redundant calls + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + if (_applicationInfo != null) + { + _applicationInfo.Dispose(); + } + } + + _disposedValue = true; + } + } + + /// + /// Finalizer of the Application class. + /// + ~Application() + { + Dispose(false); + } + + /// + /// Releases all resources used by the Application class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationDisabledEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationDisabledEventArgs.cs new file mode 100644 index 0000000..5b185d3 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationDisabledEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that is raised when the application is disabled. + /// + public class ApplicationDisabledEventArgs : EventArgs + { + private readonly ApplicationEventState _eventState; + private readonly string _applicationId; + + internal ApplicationDisabledEventArgs(string appId, ApplicationEventState eventState) + { + _applicationId = appId; + _eventState = eventState; + } + + /// + /// The Id of the application + /// + public string ApplicationId { get { return _applicationId; } } + + /// + /// The Event state of the application + /// + public ApplicationEventState EventState { get { return _eventState; } } + } +} + diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEnabledEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEnabledEventArgs.cs new file mode 100644 index 0000000..fa72e8a --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEnabledEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that is raised when the application is enabled. + /// + public class ApplicationEnabledEventArgs : EventArgs + { + private readonly ApplicationEventState _eventState; + private readonly string _applicationId; + + internal ApplicationEnabledEventArgs(string appId, ApplicationEventState eventState) + { + _applicationId = appId; + _eventState = eventState; + } + + /// + /// The Id of the application + /// + public string ApplicationId { get { return _applicationId; } } + + /// + /// The Event state of the application + /// + public ApplicationEventState EventState { get { return _eventState; } } + } +} + diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEventState.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEventState.cs new file mode 100644 index 0000000..8ef9597 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationEventState.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration of the application event state + /// + public enum ApplicationEventState + { + /// + /// Processing Started. + /// + Started = Interop.ApplicationManager.AppManagerEventState.Started, + /// + /// Processing Completed. + /// + Completed = Interop.ApplicationManager.AppManagerEventState.Completed, + /// + /// Processing Failed. + /// + Failed = Interop.ApplicationManager.AppManagerEventState.Failed + } +} + diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs new file mode 100755 index 0000000..34d7b19 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfo.cs @@ -0,0 +1,406 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Applications +{ + /// + /// This class provides methods and properties to get information of the application. + /// + public class ApplicationInfo : IDisposable + { + private const string LogTag = "Tizen.Applications"; + private bool _disposed = false; + private IntPtr _infoHandle = IntPtr.Zero; + private string _applicationId = string.Empty; + private Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + + internal ApplicationInfo(IntPtr infoHandle) + { + err = Interop.ApplicationManager.AppInfoGetAppId(infoHandle, out _applicationId); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw new ArgumentException("Invalid native handle."); + } + _infoHandle = infoHandle; + } + + /// + /// A constructor of ApplicationInfo that takes the application id. + /// + /// application id. + public ApplicationInfo(string applicationId) + { + _applicationId = applicationId; + } + + /// + /// Destructor of the class + /// + ~ApplicationInfo() + { + Dispose(false); + } + + /// + /// Gets the application id. + /// + public string ApplicationId + { + get + { + if (!string.IsNullOrEmpty(_applicationId)) + return _applicationId; + IntPtr infoHandle = GetInfoHandle(); + string appid = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetAppId(infoHandle, out appid); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the application id. err = " + err); + } + } + return appid; + } + } + + /// + /// Gets the package id of the application. + /// + public string PackageId + { + get + { + IntPtr infoHandle = GetInfoHandle(); + string packageid = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetPackage(infoHandle, out packageid); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the package id of " + _applicationId + ". err = " + err); + } + } + return packageid; + } + } + + /// + /// Gets the label of the application. + /// + public string Label + { + get + { + IntPtr infoHandle = GetInfoHandle(); + string label = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetLabel(infoHandle, out label); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the app label of " + _applicationId + ". err = " + err); + } + } + return label; + } + } + + /// + /// Gets the executable path of the application. + /// + public string ExecutablePath + { + get + { + IntPtr infoHandle = GetInfoHandle(); + string exec = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetExec(infoHandle, out exec); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the executable file path of " + _applicationId + ". err = " + err); + } + } + return exec; + } + } + + /// + /// Gets the absolute path to the icon image. + /// + public string IconPath + { + get + { + IntPtr infoHandle = GetInfoHandle(); + string path = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetIcon(infoHandle, out path); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the app icon path of " + _applicationId + ". err = " + err); + } + } + return path; + } + } + + /// + /// Gets the application type name. + /// + public string ApplicationType + { + get + { + IntPtr infoHandle = GetInfoHandle(); + string type = string.Empty; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoGetType(infoHandle, out type); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the application type of " + _applicationId + ". err = " + err); + } + } + return type; + } + } + + /// + /// Gets the application's metadata. + /// + public IDictionary Metadata + { + get + { + IDictionary metadata = new Dictionary(); + + Interop.ApplicationManager.AppInfoMetadataCallback cb = (string key, string value, IntPtr userData) => + { + if (key.Length != 0) + { + metadata.Add(key, value); + } + return true; + }; + + IntPtr infoHandle = GetInfoHandle(); + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoForeachMetadata(infoHandle, cb, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get application metadata of " + _applicationId + ". err = " + err); + } + } + return metadata; + } + } + + /// + /// Checks whether application information is nodisplay. If the application icon is not displayed on the menu screen, true; otherwise, false. + /// + public bool IsNoDisplay + { + get + { + IntPtr infoHandle = GetInfoHandle(); + bool nodisplay = false; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoIsNodisplay(infoHandle, out nodisplay); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the IsNoDisplay value of " + _applicationId + ". err = " + err); + + } + } + return nodisplay; + } + } + + /// + /// Checks whether application is launched on booting time. If the application will be automatically start on boot, true; otherwise, false. + /// + public bool IsOnBoot + { + get + { + IntPtr infoHandle = GetInfoHandle(); + bool onboot = false; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoIsOnBoot(infoHandle, out onboot); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the IsOnBoot value of " + _applicationId + ". err = " + err); + } + } + return onboot; + } + } + + /// + /// Checks whether application is preloaded. If the application is preloaded, true; otherwise, false. + /// + public bool IsPreload + { + get + { + IntPtr infoHandle = GetInfoHandle(); + bool preloaded = false; + if (infoHandle != IntPtr.Zero) + { + err = Interop.ApplicationManager.AppInfoIsPreLoad(infoHandle, out preloaded); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the IsPreload value of " + _applicationId + ". err = " + err); + } + } + return preloaded; + } + } + + /// + /// Gets the shared data path. + /// + public string SharedDataPath + { + get + { + string path = string.Empty; + err = Interop.ApplicationManager.AppManagerGetSharedDataPath(ApplicationId, out path); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the SharedDataPath of " + _applicationId + ". err = " + err); + } + return path; + } + } + + /// + /// Gets the shared resource path. + /// + public string SharedResourcePath + { + get + { + string path = string.Empty; + err = Interop.ApplicationManager.AppManagerGetSharedResourcePath(ApplicationId, out path); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the SharedResourcePath of " + _applicationId + ". err = " + err); + } + return path; + } + } + + /// + /// Gets the shared trust path. + /// + public string SharedTrustedPath + { + get + { + string path = string.Empty; + err = Interop.ApplicationManager.AppManagerGetSharedTrustedPath(ApplicationId, out path); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the SharedTrustedPath of " + _applicationId + ". err = " + err); + } + return path; + } + } + + /// + /// Gets the external shared data path. + /// + public string ExternalSharedDataPath + { + get + { + string path = string.Empty; + err = Interop.ApplicationManager.AppManagerGetExternalSharedDataPath(ApplicationId, out path); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the ExternalSharedDataPath of " + _applicationId + ". err = " + err); + } + return path; + } + } + + /// + /// Gets the localized label of application for the given locale. + /// + /// locale. + public string GetLocalizedLabel(string locale) + { + string label = string.Empty; + err = Interop.ApplicationManager.AppInfoGetLocaledLabel(ApplicationId, locale, out label); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the GetLocalizedLabel of " + _applicationId + ". err = " + err); + label = Label; + } + return label; + } + + private IntPtr GetInfoHandle() + { + if (_infoHandle == IntPtr.Zero) + { + IntPtr infoHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppManagerGetAppInfo(_applicationId, out infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the handle of the ApplicationInfo. err = " + err); + } + _infoHandle = infoHandle; + } + return _infoHandle; + } + + /// + /// Releases all resources used by the ApplicationInfo class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + if (disposing) + { + } + if (_infoHandle != IntPtr.Zero) + { + Interop.ApplicationManager.AppInfoDestroy(_infoHandle); + _infoHandle = IntPtr.Zero; + } + _disposed = true; + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs new file mode 100755 index 0000000..bba97b3 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoFilter.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Applications +{ + /// + /// This class is a parameter of GetInstalledApplicationsAsync method. + /// + public class ApplicationInfoFilter + { + /// + /// + /// + public ApplicationInfoFilter() + { + Filter = new Dictionary(); + } + + /// + /// This class is a possible key to use in the InstalledApplicationFilter. + /// + public static class Keys + { + /// + /// + /// + public const string Id = "PACKAGE_INFO_PROP_APP_ID"; + /// + /// + /// + public const string Type = "PACKAGE_INFO_PROP_APP_TYPE"; + /// + /// + /// + public const string Category = "PACKAGE_INFO_PROP_APP_CATEGORY"; + /// + /// + /// + public const string NoDisplay = "PACKAGE_INFO_PROP_APP_NODISPLAY"; + /// + /// + /// + public const string TaskManage = "PACKAGE_INFO_PROP_APP_TASKMANAGE"; + } + + /// + /// + /// + public IDictionary Filter + { + get; private set; + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoMetadataFilter.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoMetadataFilter.cs new file mode 100755 index 0000000..b4bc005 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationInfoMetadataFilter.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Applications +{ + /// + /// This class is a parameter of GetInstalledApplicationsAsync method. + /// + public class ApplicationInfoMetadataFilter : ApplicationInfoFilter + { + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationLaunchedEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationLaunchedEventArgs.cs new file mode 100755 index 0000000..7f9c4b7 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationLaunchedEventArgs.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that is raised when the application is launched. + /// + public class ApplicationLaunchedEventArgs : EventArgs + { + /// + /// The information of the application. + /// + public ApplicationRunningContext ApplicationRunningContext { get; internal set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs new file mode 100755 index 0000000..adc70c3 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs @@ -0,0 +1,608 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// This class has the methods and events of the ApplicationManager. + /// + public static class ApplicationManager + { + private const string LogTag = "Tizen.Applications"; + private static EventHandler s_launchedHandler; + private static EventHandler s_terminatedHandler; + private static Interop.ApplicationManager.AppManagerAppContextEventCallback s_applicationChangedEventCallback; + private static EventHandler _enabledHandler; + private static EventHandler _disabledHandler; + private static Interop.ApplicationManager.AppManagerEventCallback _eventCallback; + private static IntPtr _eventHandle = IntPtr.Zero; + + /// + /// Occurs whenever the installed application is enabled. + /// + public static event EventHandler ApplicationEnabled + { + add + { + if (_enabledHandler == null && _disabledHandler == null) + { + RegisterApplicationEvent(); + } + _enabledHandler += value; + } + remove + { + _enabledHandler -= value; + if (_enabledHandler == null && _disabledHandler == null) + { + UnRegisterApplicationEvent(); + } + } + } + + /// + /// Occurs whenever the installed application is disabled. + /// + public static event EventHandler ApplicationDisabled + { + add + { + if (_disabledHandler == null && _enabledHandler == null) + { + RegisterApplicationEvent(); + } + _disabledHandler += value; + } + remove + { + _disabledHandler -= value; + if (_disabledHandler == null && _enabledHandler == null) + { + UnRegisterApplicationEvent(); + } + } + } + + /// + /// Occurs whenever the installed applications get launched. + /// + public static event EventHandler ApplicationLaunched + { + add + { + if (s_launchedHandler == null && s_terminatedHandler == null) + { + RegisterApplicationChangedEvent(); + } + s_launchedHandler += value; + } + remove + { + s_launchedHandler -= value; + if (s_launchedHandler == null && s_terminatedHandler == null) + { + UnRegisterApplicationChangedEvent(); + } + } + } + + /// + /// Occurs whenever the installed applications get terminated. + /// + public static event EventHandler ApplicationTerminated + { + add + { + if (s_launchedHandler == null && s_terminatedHandler == null) + { + RegisterApplicationChangedEvent(); + } + s_terminatedHandler += value; + } + remove + { + s_terminatedHandler -= value; + if (s_launchedHandler == null && s_terminatedHandler == null) + { + UnRegisterApplicationChangedEvent(); + } + } + } + + /// + /// Gets the information of the installed applications asynchronously. + /// + public static async Task> GetInstalledApplicationsAsync() + { + return await Task.Run(() => + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + List result = new List(); + + Interop.ApplicationManager.AppManagerAppInfoCallback cb = (IntPtr infoHandle, IntPtr userData) => + { + if (infoHandle != IntPtr.Zero) + { + IntPtr clonedHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppInfoClone(out clonedHandle, infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to clone the appinfo. err = " + err); + return false; + } + ApplicationInfo app = new ApplicationInfo(clonedHandle); + result.Add(app); + return true; + } + return false; + }; + err = Interop.ApplicationManager.AppManagerForeachAppInfo(cb, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach the appinfo."); + } + return result; + }); + } + + /// + /// Gets the information of the installed applications with the ApplicationInfoFilter asynchronously. + /// + /// Key-value pairs for filtering. + public static async Task> GetInstalledApplicationsAsync(ApplicationInfoFilter filter) + { + return await Task.Run(() => + { + List result = new List(); + + Interop.ApplicationManager.AppInfoFilterCallback cb = (IntPtr infoHandle, IntPtr userData) => + { + if (infoHandle != IntPtr.Zero) + { + IntPtr clonedHandle = IntPtr.Zero; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoClone(out clonedHandle, infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to clone the appinfo. err = " + err); + return false; + } + ApplicationInfo app = new ApplicationInfo(clonedHandle); + result.Add(app); + return true; + } + return false; + }; + filter.Fetch(cb); + return result; + }); + } + + /// + /// Gets the information of the installed applications with the ApplicationInfoMetadataFilter asynchronously. + /// + /// Key-value pairs for filtering. + public static async Task> GetInstalledApplicationsAsync(ApplicationInfoMetadataFilter filter) + { + return await Task.Run(() => + { + List result = new List(); + + Interop.ApplicationManager.AppInfoFilterCallback cb = (IntPtr infoHandle, IntPtr userData) => + { + if (infoHandle != IntPtr.Zero) + { + IntPtr clonedHandle = IntPtr.Zero; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoClone(out clonedHandle, infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to clone the appinfo. err = " + err); + return false; + } + ApplicationInfo app = new ApplicationInfo(clonedHandle); + result.Add(app); + return true; + } + return false; + }; + filter.Fetch(cb); + return result; + }); + } + + /// + /// Gets the information of the running applications asynchronously. + /// + public static async Task> GetRunningApplicationsAsync() + { + return await Task.Run(() => + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + List result = new List(); + + Interop.ApplicationManager.AppManagerAppContextCallback cb = (IntPtr contextHandle, IntPtr userData) => + { + if (contextHandle != IntPtr.Zero) + { + IntPtr clonedHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppContextClone(out clonedHandle, contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to clone the app context. err = " + err); + return false; + } + ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle); + result.Add(context); + return true; + } + return false; + }; + + err = Interop.ApplicationManager.AppManagerForeachAppContext(cb, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach appcontext."); + } + return result; + }); + } + + /// + /// Gets the information of the running applications including subapp asynchronously. + /// + public static async Task> GetAllRunningApplicationsAsync() + { + return await Task.Run(() => + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + List result = new List(); + + Interop.ApplicationManager.AppManagerAppContextCallback cb = (IntPtr contextHandle, IntPtr userData) => + { + if (contextHandle != IntPtr.Zero) + { + IntPtr clonedHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppContextClone(out clonedHandle, contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to clone the app context. err = " + err); + return false; + } + ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle); + result.Add(context); + return true; + } + return false; + }; + + err = Interop.ApplicationManager.AppManagerForeachRunningAppContext(cb, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to foreach appcontext."); + } + return result; + }); + } + + /// + /// Gets the information of the specified application with the application id. + /// + /// Application id. + public static ApplicationInfo GetInstalledApplication(string applicationId) + { + IntPtr infoHandle = IntPtr.Zero; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppManagerGetAppInfo(applicationId, out infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to get the installed application information of " + applicationId + "."); + } + ApplicationInfo app = new ApplicationInfo(infoHandle); + return app; + } + + /// + /// Returns if the specified application is running or not. + /// + /// The application Id. + /// Returns true if the given application is running, otherwise false. + /// Thrown when the given parameter is invalid. + public static bool IsRunning(string applicationId) + { + bool isRunning = false; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppManagerIsRunning(applicationId, out isRunning); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(Interop.ApplicationManager.ErrorCode.InvalidParameter, "Invalid parameter"); + } + return isRunning; + } + + private static void RegisterApplicationChangedEvent() + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + s_applicationChangedEventCallback = (IntPtr contextHandle, Interop.ApplicationManager.AppContextEvent state, IntPtr userData) => + { + if (contextHandle == IntPtr.Zero) return; + + IntPtr clonedHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppContextClone(out clonedHandle, contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to register the application context event."); + } + using (ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle)) + { + if (state == Interop.ApplicationManager.AppContextEvent.Launched) + { + s_launchedHandler?.Invoke(null, new ApplicationLaunchedEventArgs { ApplicationRunningContext = context }); + } + else if (state == Interop.ApplicationManager.AppContextEvent.Terminated) + { + s_terminatedHandler?.Invoke(null, new ApplicationTerminatedEventArgs { ApplicationRunningContext = context }); + } + } + }; + err = Interop.ApplicationManager.AppManagerSetAppContextEvent(s_applicationChangedEventCallback, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to register the application context event."); + } + } + + private static void UnRegisterApplicationChangedEvent() + { + Interop.ApplicationManager.AppManagerUnSetAppContextEvent(); + } + + private static void RegisterApplicationEvent() + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + err = Interop.ApplicationManager.AppManagerEventCreate(out _eventHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to create the application event handle"); + } + + err = Interop.ApplicationManager.AppManagerEventSetStatus(_eventHandle, Interop.ApplicationManager.AppManagerEventStatusType.All); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Interop.ApplicationManager.AppManagerEventDestroy(_eventHandle); + _eventHandle = IntPtr.Zero; + throw ApplicationManagerErrorFactory.GetException(err, "Failed to set the application event"); + } + + _eventCallback = (string appType, string appId, Interop.ApplicationManager.AppManagerEventType eventType, Interop.ApplicationManager.AppManagerEventState eventState, IntPtr eventHandle, IntPtr UserData) => + { + if (eventType == Interop.ApplicationManager.AppManagerEventType.Enable) + { + _enabledHandler?.Invoke(null, new ApplicationEnabledEventArgs(appId, (ApplicationEventState)eventState)); + } + else if (eventType == Interop.ApplicationManager.AppManagerEventType.Disable) + { + _disabledHandler?.Invoke(null, new ApplicationDisabledEventArgs(appId, (ApplicationEventState)eventState)); + } + }; + err = Interop.ApplicationManager.AppManagerSetEventCallback(_eventHandle, _eventCallback, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Interop.ApplicationManager.AppManagerEventDestroy(_eventHandle); + _eventHandle = IntPtr.Zero; + throw ApplicationManagerErrorFactory.GetException(err, "Failed to set the application event callback"); + } + } + + private static void UnRegisterApplicationEvent() + { + if (_eventHandle != IntPtr.Zero) + { + Interop.ApplicationManager.AppManagerUnSetEventCallback(_eventHandle); + Interop.ApplicationManager.AppManagerEventDestroy(_eventHandle); + _eventHandle = IntPtr.Zero; + } + } + + /// + /// Gets the information of the recent applications. + /// + /// Returns a dictionary containing all recent application info. + /// Thrown when failed because of invalid operation + [EditorBrowsable(EditorBrowsableState.Never)] + public static IEnumerable GetRecentApplications() + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + + List result = new List(); + IntPtr table; + int nrows, ncols; + + err = Interop.ApplicationManager.RuaHistoryLoadDb(out table, out nrows, out ncols); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to load a table for the recent application list."); + } + + for (int row = 0; row < nrows; ++row) + { + Interop.ApplicationManager.RuaRec record; + + err = Interop.ApplicationManager.RuaHistoryGetRecord(out record, table, nrows, ncols, row); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to get record."); + } + + RecentApplicationInfo info = new RecentApplicationInfo(record); + result.Add(info); + } + + err = Interop.ApplicationManager.RuaHistoryUnLoadDb(ref table); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to unload a table for the recent application list."); + } + + return result; + } + } + + internal static class FilterExtension + { + private const string LogTag = "Tizen.Applications"; + internal static void Fetch(this ApplicationInfoFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback) + { + if (filter is ApplicationInfoMetadataFilter) + { + ApplicationInfoMetadataFilter metaFilter = (ApplicationInfoMetadataFilter)filter; + metaFilter.Fetch(callback); + return; + } + + IntPtr nativeHandle = MakeNativeAppInfoFilter(filter.Filter); + if (nativeHandle == IntPtr.Zero) + { + throw ApplicationManagerErrorFactory.NativeFilterHandleIsInvalid(); + } + try + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoFilterForeachAppinfo(nativeHandle, callback, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to get application information list with filter."); + } + } + finally + { + Interop.ApplicationManager.AppInfoFilterDestroy(nativeHandle); + } + } + + internal static void Fetch(this ApplicationInfoMetadataFilter filter, Interop.ApplicationManager.AppInfoFilterCallback callback) + { + IntPtr nativeHandle = MakeNativeAppMetadataFilter(filter.Filter); + if (nativeHandle == IntPtr.Zero) + { + throw ApplicationManagerErrorFactory.NativeFilterHandleIsInvalid(); + } + try + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoMetadataFilterForeach(nativeHandle, callback, IntPtr.Zero); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to get metadata list with filter."); + } + } + finally + { + Interop.ApplicationManager.AppInfoMetadataFilterDestroy(nativeHandle); + } + } + + private static IntPtr MakeNativeAppInfoFilter(IDictionary filter) + { + if (filter == null || filter.Count == 0) + { + throw ApplicationManagerErrorFactory.FilterIsInvalid(); + } + + IntPtr infoHandle = IntPtr.Zero; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoFilterCreate(out infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to create the filter handle."); + } + + foreach (var item in filter) + { + if ((item.Key == ApplicationInfoFilter.Keys.Id) || + (item.Key == ApplicationInfoFilter.Keys.Type) || + (item.Key == ApplicationInfoFilter.Keys.Category)) + { + err = Interop.ApplicationManager.AppInfoFilterAddString(infoHandle, item.Key, item.Value); + } + else if ((item.Key == ApplicationInfoFilter.Keys.NoDisplay) || + (item.Key == ApplicationInfoFilter.Keys.TaskManage)) + { + err = Interop.ApplicationManager.AppInfoFilterAddBool(infoHandle, item.Key, Convert.ToBoolean(item.Value)); + } + else + { + Log.Warn(LogTag, string.Format("'{0}' is not supported key for the filter.", item.Key)); + } + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Interop.ApplicationManager.AppInfoFilterDestroy(infoHandle); + throw ApplicationManagerErrorFactory.GetException(err, "Failed to add item to the filter."); + } + } + return infoHandle; + } + + private static IntPtr MakeNativeAppMetadataFilter(IDictionary filter) + { + if (filter == null || filter.Count == 0) + { + throw ApplicationManagerErrorFactory.FilterIsInvalid(); + } + + IntPtr infoHandle = IntPtr.Zero; + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.AppInfoMetadataFilterCreate(out infoHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to create the filter for searching with metadata."); + } + foreach (var item in filter) + { + err = Interop.ApplicationManager.AppInfoMetadataFilterAdd(infoHandle, item.Key, item.Value); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Interop.ApplicationManager.AppInfoMetadataFilterDestroy(infoHandle); + throw ApplicationManagerErrorFactory.GetException(err, "Failed to add the item to the filter."); + } + } + return infoHandle; + } + } + + internal static class ApplicationManagerErrorFactory + { + internal static Exception NativeFilterHandleIsInvalid() + { + return new InvalidOperationException("The native handle for filtering is invalid."); + } + + internal static Exception FilterIsInvalid() + { + return new ArgumentException("The filter is invalid."); + } + + internal static Exception GetException(Interop.ApplicationManager.ErrorCode err, string message) + { + string errMessage = String.Format("{0} err = {1}", message, err); + switch (err) + { + case Interop.ApplicationManager.ErrorCode.InvalidParameter: + return new ArgumentException(errMessage); + default: + return new InvalidOperationException(errMessage); + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs new file mode 100644 index 0000000..0220424 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationRunningContext.cs @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; + +namespace Tizen.Applications +{ + /// + /// This class provides methods and properties to get information of the application. + /// + public class ApplicationRunningContext : IDisposable + { + private const string LogTag = "Tizen.Applications"; + private bool _disposed = false; + private IntPtr _contextHandle = IntPtr.Zero; + private Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + + internal ApplicationRunningContext(IntPtr contextHandle) + { + _contextHandle = contextHandle; + } + + /// + /// A constructor of ApplicationRunningContext that takes the application id. + /// + /// application id. + /// Thrown when failed of invalid argument. + /// Thrown when failed because of application not exist error or system error. + /// Thrown when failed because of out of memory. + public ApplicationRunningContext(string applicationId) + { + IntPtr contextHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppManagerGetAppContext(applicationId, out contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the handle of the ApplicationRunningContext. err = " + err); + switch (err) + { + case Interop.ApplicationManager.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid Parameter."); + case Interop.ApplicationManager.ErrorCode.NoSuchApp: + throw new InvalidOperationException("No such application."); + case Interop.ApplicationManager.ErrorCode.OutOfMemory: + throw new OutOfMemoryException("Out of memory"); + default: + throw new InvalidOperationException("Invalid Operation."); + } + } + _contextHandle = contextHandle; + } + + /// + /// A constructor of ApplicationRunningContext that takes the application id. + /// + /// application id. + /// instance id. + /// Thrown when failed of invalid argument. + /// Thrown when failed because of application not exist error or system error. + /// Thrown when failed because of out of memory. + [EditorBrowsable(EditorBrowsableState.Never)] + public ApplicationRunningContext(string applicationId, string instanceId) + { + IntPtr contextHandle = IntPtr.Zero; + err = Interop.ApplicationManager.AppManagerGetAppContextByInstanceId(applicationId, instanceId, out contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the handle of the ApplicationRunningContext. err = " + err); + switch (err) + { + case Interop.ApplicationManager.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid Parameter."); + case Interop.ApplicationManager.ErrorCode.NoSuchApp: + throw new InvalidOperationException("No such application."); + case Interop.ApplicationManager.ErrorCode.OutOfMemory: + throw new OutOfMemoryException("Out of memory"); + default: + throw new InvalidOperationException("Invalid Operation."); + } + } + _contextHandle = contextHandle; + } + + /// + /// Destructor of the class + /// + ~ApplicationRunningContext() + { + Dispose(false); + } + + /// + /// Enumeration for the Application State. + /// + public enum AppState + { + /// + /// The undefined state + /// + Undefined = 0, + + /// + /// The UI application is running in the foreground. + /// + Foreground, + + /// + /// The UI application is running in the background. + /// + Background, + + /// + /// The Service application is running. + /// + Service, + + /// + /// The application is terminated. + /// + Terminated, + } + + /// + /// Gets the application id. + /// + public string ApplicationId + { + get + { + string appid = string.Empty; + err = Interop.ApplicationManager.AppContextGetAppId(_contextHandle, out appid); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the application id. err = " + err); + } + return appid; + } + } + + /// + /// Gets the package id of the application. + /// + public string PackageId + { + get + { + string packageid = string.Empty; + err = Interop.ApplicationManager.AppContextGetPackageId(_contextHandle, out packageid); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the package id. err = " + err); + } + return packageid; + } + } + + /// + /// Gets the application's process id. + /// + public int ProcessId + { + get + { + int pid = 0; + err = Interop.ApplicationManager.AppContextGetPid(_contextHandle, out pid); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the process id. err = " + err); + } + return pid; + } + } + + /// + /// Gets the state of the application. + /// + public AppState State + { + get + { + int state = 0; + + err = Interop.ApplicationManager.AppContextGetAppState(_contextHandle, out state); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the application state. err = " + err); + } + return (AppState)state; + } + } + + /// + /// Gets whether the application is sub application of the application group. + /// + public bool IsSubApp + { + get + { + bool subapp = false; + err = Interop.ApplicationManager.AppContextIsSubApp(_contextHandle, out subapp); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the IsSubApp value. err = " + err); + } + return subapp; + } + } + + /// + /// Terminates the application. + /// + /// Thrown when failed of invalid argument. + /// Thrown when failed because of permission denied or system error. + /// http://tizen.org/privilege/appmanager.kill + [EditorBrowsable(EditorBrowsableState.Never)] + public void Terminate() + { + err = Interop.ApplicationManager.AppManagerTerminateApp(_contextHandle); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + switch (err) + { + case Interop.ApplicationManager.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid argument."); + case Interop.ApplicationManager.ErrorCode.PermissionDenied: + throw new InvalidOperationException("Permission denied."); + default: + throw new InvalidOperationException("Invalid Operation."); + } + } + } + + /// + /// Releases all resources used by the ApplicationRunningContext class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (_contextHandle != IntPtr.Zero) + { + Interop.ApplicationManager.AppContextDestroy(_contextHandle); + _contextHandle = IntPtr.Zero; + } + _disposed = true; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationTerminatedEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationTerminatedEventArgs.cs new file mode 100755 index 0000000..622dc91 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationTerminatedEventArgs.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that is raised when the application is terminated. + /// + public class ApplicationTerminatedEventArgs : EventArgs + { + /// + /// The information of the application. + /// + public ApplicationRunningContext ApplicationRunningContext { get; internal set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ApplicationType.cs b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationType.cs new file mode 100755 index 0000000..857c3a7 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ApplicationType.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for applications type. + /// + public enum ApplicationType + { + /// + /// All applications. + /// + All = 0, + /// + /// UI applications. + /// + Ui = 1, + /// + /// Service applications. + /// + Service = 2 + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs b/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs new file mode 100755 index 0000000..1b56e8e --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/Bundle.cs @@ -0,0 +1,714 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Reflection; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; + +namespace Tizen.Applications +{ + /// + /// A Bundle object represents a bundle. + /// A bundle holds items (key-value pairs) and can be used with other Tizen APIs. + /// Keys can be used to access values. + /// This class is accessed by using a constructor to create a new instance of this object. + /// A bundle instance is not guaranteed to be thread safe if the instance is modified by multiple threads. + /// + public class Bundle : IDisposable + { + private SafeBundleHandle _handle; + private bool _disposed = false; + private readonly HashSet _keys; + + /// + /// The Bundle constructor. + /// + /// Thrown when out of memory + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// + public Bundle() + { + _handle = Interop.Bundle.Create(); + BundleErrorFactory.CheckAndThrowException(ErrorFacts.GetLastResult(), _handle); + _keys = new HashSet(); + } + + /// + /// The Bundle constructor. + /// + /// The SafeBundleHandle instance. + /// Thrown when the handle is null or invalid. + public Bundle(SafeBundleHandle handle) + { + if (handle == null || handle.IsInvalid) + { + throw new ArgumentNullException("handle"); + } + + _handle = Interop.Bundle.DangerousClone(handle.DangerousGetHandle()); + _keys = new HashSet(); + Interop.Bundle.Iterator iterator = (string key, int type, IntPtr keyval, IntPtr userData) => + { + _keys.Add(key); + }; + + Interop.Bundle.Foreach(_handle, iterator, IntPtr.Zero); + if ((BundleErrorFactory.BundleError)ErrorFacts.GetLastResult() == BundleErrorFactory.BundleError.InvalidParameter) + { + throw new ArgumentException("Invalid parameter - cannot create bundle instance"); + } + } + + private enum BundleTypeProperty + { + Array = 0x0100, + Primitive = 0x0200, + Measurable = 0x0400 + } + + private enum BundleType + { + None = -1, + Any = 0, + String = 1 | BundleTypeProperty.Measurable, + StringArray = String | BundleTypeProperty.Array | BundleTypeProperty.Measurable, + Byte = 2, + ByteArray = Byte | BundleTypeProperty.Array + } + + /// + /// The number of items in a Bundle object. + /// + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// Console.WriteLine("There are {0} items in the bundle", bundle.Count); + /// + public int Count + { + get + { + return _keys.Count; + } + } + + /// + /// The keys in a Bundle object. + /// + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string1", "a_string1"); + /// bundle.AddItem("string2", "a_string2"); + /// bundle.AddItem("string3", "a_string3"); + /// Console.WriteLine("The bundle contains the following keys:"); + /// foreach(string key in bundle.Keys) + /// { + /// Console.WriteLine(key); + /// } + /// + public IEnumerable Keys + { + get + { + return _keys; + } + } + + /// + /// Gets the SafeBundleHandle instance. + /// + public SafeBundleHandle SafeBundleHandle + { + get { return _handle; } + } + + /// + /// Releases any unmanaged resources used by this object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Checks whether the bundle contains an item with a specified key. + /// + /// The key to check for. + /// true if the bundle contains the key. false otherwise. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// if (bundle.Contains("string")) + /// { + /// string aValue = bundle.GetItem("string"); + /// Console.WriteLine(aValue); + /// } + /// + public bool Contains(string key) + { + return _keys.Contains(key); + } + + /// + /// Adds an item into the bundle. + /// + /// The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed. + /// The value of the item. + /// Thrown when the key already exists or when there is an invalid parameter. + /// Thrown when value is null. + /// Thrown when out of memory or when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + /// bundle.AddItem("byte_array", byteArray); + /// + public void AddItem(string key, byte[] value) + { + if (value == null) + { + throw new ArgumentNullException("value"); + } + AddItem(key, value, 0, value.Length); + } + + /// + /// Adds an item into the bundle. + /// + /// The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed. + /// The value of the item. + /// The zero-based byte offset in value from which to add to the bundle. + /// The maximum number of bytes to add to the bundle starting with offset. + /// Thrown when the offset or count is out of range. + /// Thrown when the key already exists or when there is an invalid parameter. + /// Thrown when value is null. + /// Thrown when out of memory or when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + /// bundle.AddItem("byte_array", byteArray, 2, 3); + /// + public void AddItem(string key, byte[] value, int offset, int count) + { + if (!_keys.Contains(key)) + { + if (value == null) + { + throw new ArgumentNullException("value"); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException("offset", offset, "Cannot be less than 0"); + } + if (offset > value.Length - 1) + { + throw new ArgumentOutOfRangeException("offset", offset, "Greater than last index of array"); + } + if (count < 1) + { + throw new ArgumentOutOfRangeException("count", count, "Must be at least 1"); + } + if (offset + count > value.Length) + { + throw new ArgumentException("The count is too large for the specified offset"); + } + // Code is in Interop file because it is unsafe + int ret = Interop.Bundle.UnsafeCode.AddItem(_handle, key, value, offset, count); + BundleErrorFactory.CheckAndThrowException(ret, _handle); + _keys.Add(key); + } + else + { + throw new ArgumentException("Key already exists", "key"); + } + } + + /// + /// Adds an item into the bundle. + /// + /// The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed. + /// The value of the item. + /// Thrown when the key already exists or when there is an invalid parameter. + /// Thrown when out of memory or when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// + public void AddItem(string key, string value) + { + if (!_keys.Contains(key)) + { + int ret = Interop.Bundle.AddString(_handle, key, value); + BundleErrorFactory.CheckAndThrowException(ret, _handle); + _keys.Add(key); + } + else + { + throw new ArgumentException("Key already exists", "key"); + } + } + + /// + /// Adds an item into the bundle. + /// + /// The key to identify the item with. If an item with the key already exists in the Bundle, this method will not succeed. + /// The value of the item. + /// Thrown when the key already exists or when there is an invalid parameter. + /// Thrown when out of memory or when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string[] stringArray = { "a", "b", "c" }; + /// bundle.AddItem("string_array", stringArray); + /// + public void AddItem(string key, IEnumerable value) + { + if (!_keys.Contains(key)) + { + string[] valueArray = value.Select(v => v == null ? string.Empty : v).ToArray(); + int ret = Interop.Bundle.AddStringArray(_handle, key, valueArray, valueArray.Count()); + BundleErrorFactory.CheckAndThrowException(ret, _handle); + _keys.Add(key); + } + else + { + throw new ArgumentException("Key already exists", "key"); + } + } + + /// + /// Gets the value of a bundle item with a specified key. + /// + /// The key of the bundle item whose value is desired. + /// The value of the bundle item. + /// Thrown when the key does not exist or when there is an invalid parameter. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// if (bundle.Contains("string")) + /// { + /// object aValue = bundle.GetItem("string"); + /// if (bundle.Is("string");) + /// { + /// string aString = (string)aValue; + /// Console.WriteLine(aString); + /// } + /// } + /// + public object GetItem(string key) + { + if (_keys.Contains(key)) + { + int type = Interop.Bundle.GetType(_handle, key); + BundleErrorFactory.CheckAndThrowException(ErrorFacts.GetLastResult(), _handle); + switch (type) + { + case (int)BundleType.String: + // get string + IntPtr stringPtr; + int retString = Interop.Bundle.GetString(_handle, key, out stringPtr); + BundleErrorFactory.CheckAndThrowException(retString, _handle); + string stringValue = Marshal.PtrToStringAnsi(stringPtr); + if (stringValue == null) + return string.Empty; + return stringValue; + + case (int)BundleType.StringArray: + // get string array + int stringArraySize; + IntPtr stringArrayPtr = Interop.Bundle.GetStringArray(_handle, key, out stringArraySize); + BundleErrorFactory.CheckAndThrowException(ErrorFacts.GetLastResult(), _handle); + string[] stringArray; + IntPtrToStringArray(stringArrayPtr, stringArraySize, out stringArray); + return stringArray; + + case (int)BundleType.Byte: + // get byte array + IntPtr byteArrayPtr; + int byteArraySize; + int retByte = Interop.Bundle.GetByte(_handle, key, out byteArrayPtr, out byteArraySize); + BundleErrorFactory.CheckAndThrowException(retByte, _handle); + byte[] byteArray = new byte[byteArraySize]; + Marshal.Copy(byteArrayPtr, byteArray, 0, byteArraySize); + return byteArray; + + default: + throw new ArgumentException("Key does not exist in the bundle", "key"); + } + } + else + { + throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key"); + } + } + + /// + /// Gets the value of a bundle item with a specified key. + /// Note that this is a generic method. + /// + /// The generic type to return. + /// The key of the bundle item whose value is desired. + /// The value of the bundle item if it is of the specified generic type. + /// Thrown when the key does not exist or when there is an invalid parameter. + /// Thrown when the value of the bundle item cannot be converted to the specified generic type. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string[] stringArray = { "a", "b", "c" }; + /// bundle.AddItem("string_array", stringArray); + /// if (bundle.Is("string_array")) + /// { + /// Console.WriteLine("It is a string"); + /// Console.WriteLine(bundle.GetItem("string_array")); + /// } + /// else if (bundle.Is("string_array")) + /// { + /// Console.WriteLine("It is a string[]"); + /// string[] anArray = bundle.GetItem("string_array"); + /// foreach (string value in anArray) + /// { + /// Console.WriteLine(value); + /// } + /// } + /// + public T GetItem(string key) + { + return (T)GetItem(key); + } + + /// + /// Gets the value of a bundle item with a specified key. + /// + /// The key of the bundle item whose value is desired. + /// The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type. + /// true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// byte[] byteArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; + /// bundle.AddItem("byte_array", byteArray); + /// byte[] aByteArray; + /// if (bundle.TryGetItem("byte_array", out aByteArray)) + /// { + /// Console.WriteLine("First item in the byte array: {0}", aByteArray[0]); + /// } + /// + public bool TryGetItem(string key, out byte[] value) + { + if (_keys.Contains(key) && Interop.Bundle.GetType(_handle, key) == (int)BundleType.Byte) + { + value = GetItem(key); + return true; + } + else + { + if (_keys.Contains(key) && ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) + { + throw new InvalidOperationException("Invalid bundle instance (object may have been disposed or released)"); + } + value = default(byte[]); + return false; + } + } + + /// + /// Gets the value of a bundle item with a specified key. + /// + /// The key of the bundle item whose value is desired. + /// The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type. + /// true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// string aString; + /// if (bundle.TryGetItem("string", out aString)) + /// { + /// Console.WriteLine(aString); + /// } + /// + public bool TryGetItem(string key, out string value) + { + if (_keys.Contains(key) && Interop.Bundle.GetType(_handle, key) == (int)BundleType.String) + { + value = GetItem(key); + return true; + } + else + { + if (_keys.Contains(key) && ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) + { + throw new InvalidOperationException("Invalid bundle instance (object may have been disposed or released)"); + } + value = default(string); + return false; + } + } + + /// + /// Gets the value of a bundle item with a specified key. + /// + /// The key of the bundle item whose value is desired. + /// The value of the bundle item. If the key does not exist or the type of this parameter is incorrect, it is the default value for the value parameter type. + /// true if an item with the key exists and if the value is the same type as the output value parameter. false otherwise. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string[] stringArray = { "a", "b", "c" }; + /// bundle.AddItem("string_array", stringArray); + /// System.Collections.Generic.IEnumerable aStringEnumerable; + /// if (bundle.TryGetItem("string", out aStringEnumerable)) + /// { + /// foreach (string value in aStringEnumerable) + /// { + /// Console.WriteLine(value); + /// } + /// } + /// + public bool TryGetItem(string key, out IEnumerable value) + { + if (_keys.Contains(key) && Interop.Bundle.GetType(_handle, key) == (int)BundleType.StringArray) + { + value = GetItem>(key); + return true; + } + else + { + if (_keys.Contains(key) && ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) + { + throw new InvalidOperationException("Invalid bundle instance (object may have been disposed or released)"); + } + value = default(IEnumerable); + return false; + } + } + + /// + /// Checks whether an item is of a specific type. + /// + /// The generic type to check for. + /// The key whose type wants to be checked. + /// true if the item is of the specified type. false otherwise. + /// Thrown when the key does not exist or when there is an invalid parameter. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string[] stringArray = { "a", "b", "c" }; + /// bundle.AddItem("string_array", stringArray); + /// if (bundle.Is("string_array")) + /// { + /// Console.WriteLine("It is a string[]"); + /// string[] anArray = bundle.GetItem("string_array"); + /// foreach (string value in anArray) + /// { + /// Console.WriteLine(value); + /// } + /// } + /// + public bool Is(string key) + { + if (_keys.Contains(key)) + { + int type = Interop.Bundle.GetType(_handle, key); + switch (type) + { + case (int)BundleType.String: + return typeof(string) == typeof(T); + + case (int)BundleType.StringArray: + return typeof(T).GetTypeInfo().IsAssignableFrom(typeof(string[]).GetTypeInfo()); + + case (int)BundleType.Byte: + return typeof(byte[]) == typeof(T); + + default: + throw new ArgumentException("Key does not exist in the bundle", "key"); + } + } + else + { + throw new ArgumentException("Key does not exist in the bundle (may be null or empty string)", "key"); + } + } + + /// + /// Removes a a bundle item with a specific key from a Bundle. + /// + /// The key of the item to delete. + /// true if the item is successfully found and removed. false otherwise (even if the item is not found). + /// Thrown when there is an invalid parameter. + /// Thrown when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// bundle.AddItem("string", "a_string"); + /// if (bundle.Contains("string")) + /// { + /// if (bundle.RemoveItem("string")) + /// { + /// Console.WriteLine("Removed"); + /// } + /// } + /// + public bool RemoveItem(string key) + { + if (_keys.Contains(key)) + { + int ret = Interop.Bundle.RemoveItem(_handle, key); + if (ret == (int)BundleErrorFactory.BundleError.KeyNotAvailable) + { + return false; + } + BundleErrorFactory.CheckAndThrowException(ret, _handle); + _keys.Remove(key); + return true; + } + else + { + return false; + } + } + + /// + /// Decodes an encoded bundle data. + /// + /// The encoded bundle data. bundleRaw should be return value of Tizen.Applications.Bundle.Encode, otherwise this method will not succeed + /// Decoded Bundle object. + /// Thrown when there is an invalid parameter. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string bundleRaw = bundle.Encode(); + /// Bundle data = bundle.Decode(bundleRaw); + /// + public static Bundle Decode(string bundleRaw) + { + SafeBundleHandle handle; + + handle = Interop.Bundle.BundleDecode(bundleRaw, bundleRaw.Length); + if (ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) + { + throw new ArgumentException("Invalid bundle raw"); + } + + return new Bundle(handle); + } + + /// + /// Encodes bundle to string. + /// + /// Encoded Bundle data in string. + /// Thrown when out of memory or when the Bundle instance has been disposed. + /// + /// Tizen.Applications.Bundle bundle = new Tizen.Applications.Bundle(); + /// string bundleRaw = bundle.Encode(); + /// + public string Encode() + { + string bundleRaw; + int len; + + Interop.Bundle.BundleEncode(_handle, out bundleRaw, out len); + if (ErrorFacts.GetLastResult() == (int)BundleErrorFactory.BundleError.InvalidParameter) + { + throw new InvalidOperationException("Invalid bundle"); + } + + return bundleRaw; + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + if (_handle != null && !_handle.IsInvalid) + _handle.Dispose(); + } + + _disposed = true; + } + } + + /// + /// Destructor of the Bundle class. + /// + ~Bundle() + { + Dispose(false); + } + + static private void IntPtrToStringArray(IntPtr unmanagedArray, int size, out string[] managedArray) + { + managedArray = new string[size]; + IntPtr[] IntPtrArray = new IntPtr[size]; + + Marshal.Copy(unmanagedArray, IntPtrArray, 0, size); + + for (int iterator = 0; iterator < size; iterator++) + { + managedArray[iterator] = Marshal.PtrToStringAnsi(IntPtrArray[iterator]); + } + } + } + + internal static class BundleErrorFactory + { + internal enum BundleError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + KeyNotAvailable = ErrorCode.KeyNotAvailable, + KeyExists = -0x01180000 | 0x01 + } + + static internal void CheckAndThrowException(int error, SafeBundleHandle handle) + { + if ((BundleError)error == BundleError.None) + { + return; + } + else if ((BundleError)error == BundleError.OutOfMemory) + { + throw new InvalidOperationException("Out of memory"); + } + else if ((BundleError)error == BundleError.InvalidParameter) + { + if (handle.IsInvalid) + { + throw new InvalidOperationException("Invalid bundle instance (object may have been disposed or released)"); + } + throw new ArgumentException("Invalid parameter"); + } + else if ((BundleError)error == BundleError.KeyNotAvailable) + { + throw new ArgumentException("Key does not exist in the bundle"); + } + else if ((BundleError)error == BundleError.KeyExists) + { + throw new ArgumentException("Key already exists"); + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs b/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs new file mode 100755 index 0000000..5bf6e39 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/CoreApplication.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +using Tizen.Applications.CoreBackend; + +namespace Tizen.Applications +{ + /// + /// Class that represents an application controlled lifecycles by the backend system. + /// + public class CoreApplication : Application + { + private readonly ICoreBackend _backend; + private bool _disposedValue = false; + + /// + /// Initializes the CoreApplication class. + /// + /// The backend instance implementing ICoreBacked interface. + public CoreApplication(ICoreBackend backend) + { + _backend = backend; + } + + /// + /// Occurs when the application is launched. + /// + public event EventHandler Created; + + /// + /// Occurs when the application is about to shutdown. + /// + public event EventHandler Terminated; + + /// + /// Occurs whenever the application receives the appcontrol message. + /// + public event EventHandler AppControlReceived; + + /// + /// Occurs when the system memory is low. + /// + public event EventHandler LowMemory; + + /// + /// Occurs when the system battery is low. + /// + public event EventHandler LowBattery; + + /// + /// Occurs when the system language is chagned. + /// + public event EventHandler LocaleChanged; + + /// + /// Occurs when the region format is changed. + /// + public event EventHandler RegionFormatChanged; + + /// + /// Occurs when the device orientation is changed. + /// + public event EventHandler DeviceOrientationChanged; + + /// + /// The backend instance. + /// + protected ICoreBackend Backend { get { return _backend; } } + + /// + /// Runs the application's main loop. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + base.Run(args); + + _backend.AddEventHandler(EventType.Created, OnCreate); + _backend.AddEventHandler(EventType.Terminated, OnTerminate); + _backend.AddEventHandler(EventType.AppControlReceived, OnAppControlReceived); + _backend.AddEventHandler(EventType.LowMemory, OnLowMemory); + _backend.AddEventHandler(EventType.LowBattery, OnLowBattery); + _backend.AddEventHandler(EventType.LocaleChanged, OnLocaleChanged); + _backend.AddEventHandler(EventType.RegionFormatChanged, OnRegionFormatChanged); + _backend.AddEventHandler(EventType.DeviceOrientationChanged, OnDeviceOrientationChanged); + + string[] argsClone = null; + + if (args == null) + { + argsClone = new string[1]; + } + else + { + argsClone = new string[args.Length + 1]; + args.CopyTo(argsClone, 1); + } + argsClone[0] = string.Empty; + _backend.Run(argsClone); + } + + /// + /// Exits the main loop of the application. + /// + public override void Exit() + { + _backend.Exit(); + } + + /// + /// Overrides this method if want to handle behavior when the application is launched. + /// If base.OnCreated() is not called, the event 'Created' will not be emitted. + /// + protected virtual void OnCreate() + { + Created?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior when the application is terminated. + /// If base.OnTerminate() is not called, the event 'Terminated' will not be emitted. + /// + protected virtual void OnTerminate() + { + Terminated?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior when the application receives the appcontrol message. + /// If base.OnAppControlReceived() is not called, the event 'AppControlReceived' will not be emitted. + /// + /// + protected virtual void OnAppControlReceived(AppControlReceivedEventArgs e) + { + AppControlReceived?.Invoke(this, e); + } + + /// + /// Overrides this method if want to handle behavior when the system memory is low. + /// If base.OnLowMemory() is not called, the event 'LowMemory' will not be emitted. + /// + protected virtual void OnLowMemory(LowMemoryEventArgs e) + { + LowMemory?.Invoke(this, e); + System.GC.Collect(); + } + + /// + /// Overrides this method if want to handle behavior when the system battery is low. + /// If base.OnLowBattery() is not called, the event 'LowBattery' will not be emitted. + /// + protected virtual void OnLowBattery(LowBatteryEventArgs e) + { + LowBattery?.Invoke(this, e); + } + + /// + /// Overrides this method if want to handle behavior when the system language is changed. + /// If base.OnLocaleChanged() is not called, the event 'LocaleChanged' will not be emitted. + /// + protected virtual void OnLocaleChanged(LocaleChangedEventArgs e) + { + LocaleChanged?.Invoke(this, e); + } + + /// + /// Overrides this method if want to handle behavior when the region format is changed. + /// If base.OnRegionFormatChanged() is not called, the event 'RegionFormatChanged' will not be emitted. + /// + protected virtual void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + RegionFormatChanged?.Invoke(this, e); + } + + /// + /// Overrides this method if want to handle behavior when the device orientation is changed. + /// If base.OnRegionFormatChanged() is not called, the event 'RegionFormatChanged' will not be emitted. + /// + protected virtual void OnDeviceOrientationChanged(DeviceOrientationEventArgs e) + { + DeviceOrientationChanged?.Invoke(this, e); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected override void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _backend.Dispose(); + } + + _disposedValue = true; + } + base.Dispose(disposing); + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs new file mode 100755 index 0000000..5b41aea --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for device orientation. + /// + public enum DeviceOrientation + { + /// + /// The device orientation is 0 + /// + Orientation_0 = 0, + + /// + /// The device orientation is 90 + /// + Orientation_90 = 90, + + /// + /// The device orientation is 180 + /// + Orientation_180 = 180, + + /// + /// The device orientation is 270 + /// + Orientation_270 = 270, + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientationEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientationEventArgs.cs new file mode 100755 index 0000000..750e316 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/DeviceOrientationEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for the argument of the DeviceOrientationChanged EventHandler + /// + public class DeviceOrientationEventArgs : EventArgs + { + /// + /// Initializes DeviceOrientationEventArgs class + /// + /// The information of the DeviceOrientation + public DeviceOrientationEventArgs(DeviceOrientation orientation) + { + DeviceOrientation = orientation; + } + + /// + /// The property to get the intformation of the DeviceOrientation + /// + public DeviceOrientation DeviceOrientation { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Common/Tizen.Applications/DirectoryInfo.cs b/src/Tizen.Applications.Common/Tizen.Applications/DirectoryInfo.cs new file mode 100755 index 0000000..4b7f06b --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/DirectoryInfo.cs @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Represents directory information of the application. + /// + public class DirectoryInfo + { + private string _dataPath; + private string _cachePath; + private string _resourcePath; + + private string _sharedDataPath; + private string _sharedResourcePath; + private string _sharedTrustedPath; + + private string _externalDataPath; + private string _externalCachePath; + private string _externalSharedDataPath; + + private string _expansionPackageResourcePath; + + internal DirectoryInfo() + { + } + + /// + /// Gets the absolute path to the application's data directory which is used to store private data of the application. + /// + public string Data + { + get + { + if (_dataPath == null) + _dataPath = Interop.AppCommon.AppGetDataPath(); + return _dataPath; + } + } + + /// + /// Gets the absolute path to the application's cache directory which is used to store temporary data of the application. + /// + public string Cache + { + get + { + if (_cachePath == null) + _cachePath = Interop.AppCommon.AppGetCachePath(); + return _cachePath; + } + } + + /// + /// Gets the absolute path to the application resource directory. The resource files are delivered with the application package. + /// + public string Resource + { + get + { + if (_resourcePath == null) + _resourcePath = Interop.AppCommon.AppGetResourcePath(); + return _resourcePath; + } + } + + /// + /// Gets the absolute path to the application's shared data directory which is used to share data with other applications. + /// + public string SharedData + { + get + { + if (_sharedDataPath == null) + _sharedDataPath = Interop.AppCommon.AppGetSharedDataPath(); + return _sharedDataPath; + } + } + + /// + /// Gets the absolute path to the application's shared resource directory which is used to share resources with other applications. + /// + public string SharedResource + { + get + { + if (_sharedResourcePath == null) + _sharedResourcePath = Interop.AppCommon.AppGetSharedResourcePath(); + return _sharedResourcePath; + } + } + + + /// + /// Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications. + /// + public string SharedTrusted + { + get + { + if (_sharedTrustedPath == null) + _sharedTrustedPath = Interop.AppCommon.AppGetSharedTrustedPath(); + return _sharedTrustedPath; + } + } + + /// + /// Gets the absolute path to the application's external data directory which is used to store data of the application. + /// + public string ExternalData + { + get + { + if (_externalDataPath == null) + _externalDataPath = Interop.AppCommon.AppGetExternalDataPath(); + return _externalDataPath; + } + } + + /// + /// Gets the absolute path to the application's external cache directory which is used to store temporary data of the application. + /// + public string ExternalCache + { + get + { + if (_externalCachePath == null) + _externalCachePath = Interop.AppCommon.AppGetExternalCachePath(); + return _externalCachePath; + } + } + + /// + /// Gets the absolute path to the application's external shared data directory which is used to share data with other applications. + /// + public string ExternalSharedData + { + get + { + if (_externalSharedDataPath == null) + _externalSharedDataPath = Interop.AppCommon.AppGetExternalSharedDataPath(); + return _externalSharedDataPath; + } + } + + /// + /// Gets the absolute path to the application's TEP(Tizen Expansion Package) directory. The resource files are delivered with the expansion package. + /// + public string ExpansionPackageResource + { + get + { + if (_expansionPackageResourcePath == null) + _expansionPackageResourcePath = Interop.AppCommon.AppGetTepResourcePath(); + return _expansionPackageResourcePath; + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/LocaleChangedEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/LocaleChangedEventArgs.cs new file mode 100755 index 0000000..a1e99ba --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/LocaleChangedEventArgs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for the argument of the LocaleChanged EventHandler + /// + public class LocaleChangedEventArgs : EventArgs + { + + /// + /// Initializes LocaleChangedEventArgs class + /// + /// The information of the Locale + public LocaleChangedEventArgs(string locale) + { + Locale = locale; + } + + /// + /// The property to get the intformation of the Locale + /// + public string Locale { get; private set; } + + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryEventArgs.cs new file mode 100755 index 0000000..bf0c49a --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for the argument of the LowBattery EventHandler + /// + public class LowBatteryEventArgs : EventArgs + { + /// + /// Initializes LowBatteryEventArgs class + /// + /// The information of the LowBatteryEventArgs + public LowBatteryEventArgs(LowBatteryStatus status) + { + LowBatteryStatus = status; + } + + /// + /// The property to get the intformation of the LowBatteryStatus + /// + public LowBatteryStatus LowBatteryStatus { get; private set; } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryStatus.cs b/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryStatus.cs new file mode 100755 index 0000000..a835521 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/LowBatteryStatus.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for low battery status. + /// + public enum LowBatteryStatus + { + /// + /// + /// + None = 0, + + /// + /// The battery status is under 1% + /// + PowerOff = 1, + + /// + /// The battery status is under 5% + /// + CriticalLow + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryEventArgs.cs new file mode 100755 index 0000000..e42fedc --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for the argument of the LowMemory EventHandler + /// + public class LowMemoryEventArgs : EventArgs + { + /// + /// Initializes LowMemoryEventArgs class + /// + /// The information of the LowMemoryStatus + public LowMemoryEventArgs(LowMemoryStatus status) + { + LowMemoryStatus = status; + } + + /// + /// The property to get the intformation of the LowMemoryStatus + /// + public LowMemoryStatus LowMemoryStatus { get; private set; } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryStatus.cs b/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryStatus.cs new file mode 100755 index 0000000..e704de3 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/LowMemoryStatus.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for low memory status. + /// + public enum LowMemoryStatus + { + /// + /// Not initialized status + /// + None = 0x00, + + /// + /// Normal status + /// + Normal = 0x01, + + /// + /// Soft warning status + /// + SoftWarning = 0x02, + + /// + /// Hard warning status + /// + HardWarning = 0x04, + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs new file mode 100755 index 0000000..638ee7a --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ReceivedAppControl.cs @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Represents the received AppControl. + /// + /// + /// + /// public class ReceivedAppControlExample : UIApplication + /// { + /// // ... + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// ReceivedAppControl control = e.ReceivedAppControl; + /// if (control.Operation == AppControlOperations.Pick) + /// { + /// Log.Debug(LogTag, "Received AppControl is Pick"); + /// } + /// if (control.IsReplyRequest) + /// { + /// AppControl replyRequest = new AppControl(); + /// replyRequest.ExtraData.Add("myKey", "I'm replying"); + /// control.ReplyToLaunchRequest(replyRequest, AppControlReplyResult.Succeeded); + /// } + /// } + /// } + /// + /// + public class ReceivedAppControl : AppControl + { + private const string LogTag = "Tizen.Applications"; + + /// + /// Initializes a ReceivedAppControl class. + /// + public ReceivedAppControl(SafeAppControlHandle handle) : base(handle) + { + } + + /// + /// Gets the application ID of the caller from the launch request. + /// + /// + /// The application ID of the caller + /// + /// + /// + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// ReceivedAppControl control = e.ReceivedAppControl; + /// string caller = control.CallerApplicationId; + /// } + /// + /// + public string CallerApplicationId + { + get + { + string value = String.Empty; + Interop.AppControl.ErrorCode err = Interop.AppControl.GetCaller(SafeAppControlHandle, out value); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get the caller application id from the AppControl. Err = " + err); + } + return value; + } + } + + /// + /// Checks whether the caller is requesting a reply from the launch request. + /// + /// + /// If true this ReceivedAppControl is requested by the caller, otherwise false + /// + /// + /// + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// ReceivedAppControl control = e.ReceivedAppControl; + /// bool isReply = control.IsReplyRequest; + /// } + /// + /// + public bool IsReplyRequest + { + get + { + bool value = false; + Interop.AppControl.ErrorCode err = Interop.AppControl.IsReplyRequested(SafeAppControlHandle, out value); + if (err != Interop.AppControl.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to check the reply of the AppControl is requested. Err = " + err); + } + return value; + } + } + + /// + /// Replies to the launch request sent by the caller. + /// If the caller application sent the launch request to receive the result, the callee application can return the result back to the caller. + /// + /// The AppControl in which the results of the callee are contained + /// The result code of the launch request + /// + /// + /// protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + /// { + /// ReceivedAppControl control = e.ReceivedAppControl; + /// if (control.IsReplyRequest) + /// { + /// AppControl replyRequest = new AppControl(); + /// replyRequest.ExtraData.Add("myKey", "I'm replying"); + /// control.ReplyToLaunchRequest(replyRequest, AppControlReplyResult.Succeeded); + /// } + /// } + /// + /// + public void ReplyToLaunchRequest(AppControl replyRequest, AppControlReplyResult result) + { + if (replyRequest == null) + { + throw new ArgumentNullException("replyRequest"); + } + Interop.AppControl.ErrorCode err = Interop.AppControl.ReplyToLaunchRequest(replyRequest.SafeAppControlHandle, this.SafeAppControlHandle, (int)result); + if (err != Interop.AppControl.ErrorCode.None) + throw new InvalidOperationException("Failed to reply. Err = " + err); + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs new file mode 100755 index 0000000..5bc84fe --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationControl.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// This class provides methods and properties to get information of recent application. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class RecentApplicationControl + { + private const string LogTag = "Tizen.Applications"; + + private readonly string _pkgId; + + internal RecentApplicationControl(String pkgId) + { + _pkgId = pkgId; + } + + /// + /// Deletes the application from recent application list. + /// + /// platform + public void Delete() + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + err = Interop.ApplicationManager.RuaDeleteHistoryWithPkgname(_pkgId); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to delete application from recent application list."); + } + } + + /// + /// Delete all recent applicationsfrom recent application list. + /// + /// platform + public static void DeleteAll() + { + Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None; + err = Interop.ApplicationManager.RuaClearHistory(); + if (err != Interop.ApplicationManager.ErrorCode.None) + { + throw ApplicationManagerErrorFactory.GetException(err, "Failed to clear the recent application list."); + } + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs new file mode 100755 index 0000000..613e7d6 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/RecentApplicationInfo.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// This class provides methods and properties to get information of recent application. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class RecentApplicationInfo : ApplicationInfo + { + private const string LogTag = "Tizen.Applications"; + + /// + /// Gets the instance id. + /// + public string InstanceId { get; private set; } + + /// + /// Gets the instance Name. + /// + public string InstanceName { get; private set; } + + /// + /// Gets the arguements. + /// + public string Arg { get; private set; } + + /// + /// Gets the uri. + /// + public string Uri { get; private set; } + + /// + /// Gets the launchTime. + /// + public DateTime LaunchTime { get; private set; } + + /// + /// Gets the recent application controller. + /// + public RecentApplicationControl Controller { get; private set; } + + internal RecentApplicationInfo(Interop.ApplicationManager.RuaRec record) : base(Marshal.PtrToStringAnsi(record.pkgName)) + { + InstanceId = Marshal.PtrToStringAnsi(record.instanceId); + InstanceName = Marshal.PtrToStringAnsi(record.instanceName); + Arg = Marshal.PtrToStringAnsi(record.arg); + Uri = Marshal.PtrToStringAnsi(record.uri); + long seconds = record.launchTime.ToInt64(); + LaunchTime = new DateTime(1970, 1, 1).AddSeconds(seconds); + Controller = new RecentApplicationControl(Marshal.PtrToStringAnsi(record.pkgName)); + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/RegionFormatChangedEventArgs.cs b/src/Tizen.Applications.Common/Tizen.Applications/RegionFormatChangedEventArgs.cs new file mode 100755 index 0000000..a481093 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/RegionFormatChangedEventArgs.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for the argument of the RegionFormatChanged EventHandler + /// + public class RegionFormatChangedEventArgs : EventArgs + { + + /// + /// Initializes RegionFormatChangedEventArgs class + /// + /// The information of the Region + public RegionFormatChangedEventArgs(string region) + { + Region = region; + } + + /// + /// The property to get the intformation of the Region + /// + public string Region { get; private set; } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/ResourceManager.cs b/src/Tizen.Applications.Common/Tizen.Applications/ResourceManager.cs new file mode 100755 index 0000000..c20840a --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/ResourceManager.cs @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Applications +{ + /// + /// Class for getting resource path. + /// + public static class ResourceManager + { + /// + /// Enumeration for Resource category. + /// + public enum Category : int + { + /// + /// Image format. + /// + Image = 0, + + /// + /// Layout format. + /// + Layout, + + /// + /// Sound format. + /// + Sound, + + /// + /// Binary format. + /// + Binary + } + + private static ErrorCode AppResourceManagerGet(Category category, string id, out string path) + { + ErrorCode err; + + try + { + err = Interop.AppCommon.AppResourceManagerGet( + (Interop.AppCommon.ResourceCategory)category, id, out path); + } + catch (System.TypeLoadException) + { + err = Interop.AppCommon.LegacyAppResourceManagerGet( + (Interop.AppCommon.ResourceCategory)category, id, out path); + } + + return err; + } + + /// + /// Converts resource ID to path name. + /// + /// Category to search + /// ID to search + /// Found resource path + /// Thrown in case of failed conditions + public static string GetPath(Category category, string id) + { + string path; + ErrorCode err = AppResourceManagerGet(category, id, out path); + + switch (err) + { + case ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter"); + + case ErrorCode.OutOfMemory: + throw new InvalidOperationException("Out-of-memory at unmanaged code"); + + case ErrorCode.IoError: + throw new InvalidOperationException("IO error at unmanaged code"); + } + + return path; + } + + /// + /// Converts resource ID to path name. + /// + /// Category to search + /// ID to search + /// Found resource path or null when the resource doesn't exist + /// Thrown in case of failed conditions + public static string TryGetPath(Category category, string id) + { + string path; + ErrorCode err = AppResourceManagerGet(category, id, out path); + + switch (err) + { + case ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter"); + + case ErrorCode.OutOfMemory: + throw new InvalidOperationException("Out-of-memory at unmanaged code"); + + case ErrorCode.IoError: + return null; + } + + return path; + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/SafeAppControlHandle.cs b/src/Tizen.Applications.Common/Tizen.Applications/SafeAppControlHandle.cs new file mode 100755 index 0000000..5bbdf60 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/SafeAppControlHandle.cs @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// Represents a wrapper class for a unmanaged AppControl handle. + /// + public sealed class SafeAppControlHandle : SafeHandle + { + /// + /// Initializes a new instance of the SafeAppControlHandle class. + /// + public SafeAppControlHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Initializes a new instance of the SafeAppControlHandle class. + /// + /// An IntPtr object that represents the pre-existing handle to use. + /// true to reliably release the handle during the finalization phase; false to prevent reliable release. + public SafeAppControlHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + /// + /// When overridden in a derived class, executes the code required to free the handle. + /// + /// true if the handle is released successfully + protected override bool ReleaseHandle() + { + Interop.AppControl.DangerousDestroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs b/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs new file mode 100755 index 0000000..c3bab4b --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/SafeBundleHandle.cs @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// Represents a wrapper class for a unmanaged Bundle handle. + /// + public sealed class SafeBundleHandle : SafeHandle + { + /// + /// Initializes a new instance of the SafeBundleHandle class. + /// + public SafeBundleHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Initializes a new instance of the SafeBundleHandle class. + /// + /// An IntPtr object that represents the pre-existing handle to use. + /// true to reliably release the handle during the finalization phase; false to prevent reliable release. + public SafeBundleHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + /// + /// When overridden in a derived class, executes the code required to free the handle. + /// + /// true if the handle is released successfully + protected override bool ReleaseHandle() + { + Interop.Bundle.DangerousFree(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs b/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs new file mode 100644 index 0000000..dcfb4c8 --- /dev/null +++ b/src/Tizen.Applications.Common/Tizen.Applications/TizenSynchronizationContext.cs @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Concurrent; +using System.Threading; + +namespace Tizen.Applications +{ + + /// + /// Provides a synchronization context for the Tizen application model. + /// + public class TizenSynchronizationContext : SynchronizationContext + { + private readonly Interop.Glib.GSourceFunc _wrapperHandler; + private readonly Object _transactionLock = new Object(); + private readonly ConcurrentDictionary _handlerMap = new ConcurrentDictionary(); + private int _transactionId = 0; + + /// + /// Initializes a new instance of the TizenSynchronizationContext class. + /// + public TizenSynchronizationContext() + { + _wrapperHandler = new Interop.Glib.GSourceFunc(Handler); + } + + /// + /// Initilizes a new TizenSynchronizationContext and install into current thread + /// + /// + /// It is equivalent + /// + /// SetSynchronizationContext(new TizenSynchronizationContext()); + /// + /// + public static void Initialize() + { + SetSynchronizationContext(new TizenSynchronizationContext()); + } + + + /// + /// Dispatches an asynchronous message to a Tizen main loop. + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// + /// The Post method starts an asynchronous request to post a message. + public override void Post(SendOrPostCallback d, object state) + { + Post(() => + { + d(state); + }); + } + + /// + /// Dispatches a synchronous message to a Tizen main loop + /// + /// The SendOrPostCallback delegate to call. + /// The object passed to the delegate. + /// + /// The Send method starts a synchronous request to send a message. + public override void Send(SendOrPostCallback d, object state) + { + var mre = new ManualResetEvent(false); + Exception err = null; + Post(() => + { + try + { + d(state); + } + catch (Exception ex) + { + err = ex; + } + finally + { + mre.Set(); + } + }); + mre.WaitOne(); + if (err != null) + { + throw err; + } + } + + private void Post(Action action) + { + int id = 0; + lock (_transactionLock) + { + id = _transactionId++; + } + _handlerMap.TryAdd(id, action); + Interop.Glib.IdleAdd(_wrapperHandler, (IntPtr)id); + } + + private bool Handler(IntPtr userData) + { + int key = (int)userData; + if (_handlerMap.ContainsKey(key)) + { + Action action; + _handlerMap.TryRemove(key, out action); + action?.Invoke(); + } + return false; + } + } +} diff --git a/src/Tizen.Applications.DataControl/Interop/Interop.DataControl.cs b/src/Tizen.Applications.DataControl/Interop/Interop.DataControl.cs new file mode 100755 index 0000000..b19f6ee --- /dev/null +++ b/src/Tizen.Applications.DataControl/Interop/Interop.DataControl.cs @@ -0,0 +1,466 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Text; +using Tizen.Applications; +using Tizen; +using Tizen.Applications.DataControl; + +internal static partial class Interop +{ + internal static partial class DataControl + { + + internal enum NativeResultType : int + { + Success = Tizen.Internals.Errors.ErrorCode.None, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + MaxExceed = -0x01190000 | 0x01, + } + + internal sealed class SafeBulkDataHandle : SafeHandle + { + internal SafeBulkDataHandle() + : base(IntPtr.Zero, true) + { + } + + internal SafeBulkDataHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + DataControl.BulkFree(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + internal sealed class SafeBulkResultDataHandle : SafeHandle + { + internal SafeBulkResultDataHandle() + : base(IntPtr.Zero, true) + { + } + + internal SafeBulkResultDataHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + DataControl.BulkResultFree(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + internal sealed class SafeCursorHandle : SafeHandle + { + internal SafeCursorHandle() + : base(IntPtr.Zero, true) + { + } + + internal SafeCursorHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } + + internal sealed class SafeDataControlHandle : SafeHandle + { + internal SafeDataControlHandle() + : base(IntPtr.Zero, true) + { + } + + internal SafeDataControlHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + DataControl.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_create")] + internal static extern ResultType DataControlCreate(out SafeDataControlHandle handle); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_destroy")] + internal static extern ResultType Destroy(IntPtr handle); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_provider_id")] + internal static extern ResultType DataControlGetProviderId(SafeDataControlHandle handle, out string providerId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_set_provider_id")] + internal static extern ResultType DataControlSetProviderId(SafeDataControlHandle handle, string providerId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_set_data_id")] + internal static extern ResultType DataControlSetDataId(SafeDataControlHandle handle, string dataId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_data_id")] + internal static extern ResultType DataControlGetDataId(SafeDataControlHandle handle, out string dataId); + + internal delegate void MapGetResponseCallback(int requestID, + IntPtr provider, string[] resultValueList, int resultValueCount, bool providerResult, string error, IntPtr userData); + internal delegate void MapSetResponseCallback(int requestID, + IntPtr provider, bool providerResult, string error, IntPtr userData); + internal delegate void MapAddResponseCallback(int requestID, + IntPtr provider, bool providerResult, string error, IntPtr userData); + internal delegate void MapRemoveResponseCallback(int requestID, + IntPtr provider, bool providerResult, string error, IntPtr userData); + internal delegate void MapBulkAddResponseCallback(int requestID, + IntPtr provider, IntPtr bulkResults, bool providerResult, string error, IntPtr userData); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct MapResponseCallbacks + { + public MapGetResponseCallback Get; + public MapSetResponseCallback Set; + public MapAddResponseCallback Add; + public MapRemoveResponseCallback Remove; + } + + internal delegate void SqlSelectResponseCallback(int requestID, + IntPtr provider, IntPtr cursor, bool providerResult, string error, IntPtr userData); + internal delegate void SqlInsertResponseCallback(int requestID, + IntPtr provider, long inserted_row_id, bool providerResult, string error, IntPtr userData); + internal delegate void SqlUpdateResponseCallback(int requestID, + IntPtr provider, bool providerResult, string error, IntPtr userData); + internal delegate void SqlDeleteResponseCallback(int requestID, + IntPtr provider, bool providerResult, string error, IntPtr userData); + internal delegate void SqlBulkInsertResponseCallback(int requestID, + IntPtr provider, IntPtr bulk_results, bool providerResult, string error, IntPtr userData); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct SqlResponseCallbacks + { + public SqlSelectResponseCallback Select; + public SqlInsertResponseCallback Insert; + public SqlUpdateResponseCallback Update; + public SqlDeleteResponseCallback Delete; + } + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_register_response_cb")] + internal static extern ResultType RegisterMapResponse(SafeDataControlHandle provider, ref MapResponseCallbacks callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_unregister_response_cb")] + internal static extern ResultType UnregisterMapResponse(SafeDataControlHandle provider); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_register_add_bulk_data_response_cb")] + internal static extern ResultType RegisterMapBulkResponseCallback(SafeDataControlHandle provider, MapBulkAddResponseCallback callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_unregister_add_bulk_data_response_cb")] + internal static extern ResultType UnregisterMapBulkResponseCallback(SafeDataControlHandle provider); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_register_response_cb")] + internal static extern ResultType RegisterSqlResponseCallback(SafeDataControlHandle provider, ref SqlResponseCallbacks callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_unregister_response_cb")] + internal static extern ResultType UnregisterSqlResponseCallback(SafeDataControlHandle provider); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_register_insert_bulk_data_response_cb")] + internal static extern ResultType RegisterSqlBulkResponseCallback(SafeDataControlHandle provider, SqlBulkInsertResponseCallback callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_unregister_insert_bulk_data_response_cb")] + internal static extern ResultType UnregisterSqlBulkResponseCallback(SafeDataControlHandle provider); + + internal delegate void MapGetRequestCallback(int requestID, + IntPtr provider, string key, IntPtr userData); + internal delegate void MapSetRequestCallback(int requestID, + IntPtr provider, string key, string oldValue, string newValue, IntPtr userData); + internal delegate void MapAddRequestCallback(int requestID, + IntPtr provider, string key, string value, IntPtr userData); + internal delegate void MapRemoveRequestCallback(int requestID, + IntPtr provider, string key, string value, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MapBulkAddRequestCallback(int requestID, + IntPtr provider, IntPtr bulkData, IntPtr userData); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct MapRequestCallbacks + { + public MapGetRequestCallback Get; + public MapSetRequestCallback Set; + public MapAddRequestCallback Add; + public MapRemoveRequestCallback Remove; + } + + internal delegate void SqlInsertRequestCallback(int requestID, + IntPtr provider, IntPtr insertData, IntPtr userData); + internal delegate void SqlSelectRequestCallback(int requestID, + IntPtr provider, IntPtr columnList, int columnCount, string where, string order, IntPtr userData); + internal delegate void SqlUpdateRequestCallback(int requestID, + IntPtr provider, IntPtr updateData, string where, IntPtr userData); + internal delegate void SqlDeleteRequestCallback(int requestID, + IntPtr provider, string where, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SqlBulkInsertRequestCallback(int requestID, + IntPtr provider, IntPtr bulk_data, IntPtr userData); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct SqlRequestCallbacks + { + public SqlInsertRequestCallback Insert; + public SqlSelectRequestCallback Select; + public SqlUpdateRequestCallback Update; + public SqlDeleteRequestCallback Delete; + } + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_map_register_cb")] + internal static extern ResultType RegisterMapRequest(ref MapRequestCallbacks callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_sql_register_cb")] + internal static extern ResultType RegisterSqlRequest(ref SqlRequestCallbacks callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_sql_register_insert_bulk_data_request_cb")] + internal static extern ResultType RegisterSqlBulkRequest(SqlBulkInsertRequestCallback callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_sql_unregister_insert_bulk_data_request_cb")] + internal static extern ResultType UnregisterSqlBulkRequest(); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_map_register_add_bulk_data_request_cb")] + internal static extern ResultType RegisterMapBulkRequest(MapBulkAddRequestCallback callback, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_map_unregister_add_bulk_data_request_cb")] + internal static extern ResultType UnregisterMapBulkRequest(); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_map_result")] + internal static extern ResultType SendMapResult(int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_map_get_value_result")] + internal static extern ResultType SendMapGetResult(int requestID, string[] valueList, int valueCount); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_insert_result")] + internal static extern ResultType SendInsertResult(int requestID, long rowId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_update_result")] + internal static extern ResultType SendUpdateResult(int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_delete_result")] + internal static extern ResultType SendDeleteResult(int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "datacontrol_provider_send_select_result_without_data")] + internal static extern ResultType SendSelectResult(int requestID, out int fd); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_error")] + internal static extern ResultType SendError(int requestID, string error); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_insert")] + internal static extern ResultType Insert(SafeDataControlHandle provider, SafeBundleHandle insertData, out int requestId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_select_with_page")] + internal static extern ResultType Select(SafeDataControlHandle provider, string[] columnList, int columnCount, string where, string order, int pageNumber, + int countPerPage, out int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_delete")] + internal static extern ResultType Delete(SafeDataControlHandle provider, string where, out int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_update")] + internal static extern ResultType Update(SafeDataControlHandle provider, SafeBundleHandle updatetData, string where, out int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_insert_bulk_data")] + internal static extern ResultType BulkInsert(SafeDataControlHandle provider, SafeBulkDataHandle insertData, out int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_add")] + internal static extern ResultType MapAdd(SafeDataControlHandle provider, string key, string value, out int requestId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_set")] + internal static extern ResultType MapSet(SafeDataControlHandle provider, string key, string oldValue, string newValue, out int requestId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_remove")] + internal static extern ResultType MapRemove(SafeDataControlHandle provider, string key, string value, out int requestId); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_get_with_page")] + internal static extern ResultType MapGet(SafeDataControlHandle provider, string key, out int requestId, int pageNumber, + int countPerPage); + [DllImport(Libraries.DataControl, EntryPoint = "data_control_map_add_bulk_data")] + internal static extern ResultType BulkAdd(SafeDataControlHandle provider, SafeBulkDataHandle insertData, out int requestID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_create_insert_statement")] + internal static extern string CreateInsertStatement(SafeDataControlHandle provider, SafeBundleHandle insertData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_create_delete_statement")] + internal static extern string CreateDeleteStatement(SafeDataControlHandle provider, string where); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_create_update_statement")] + internal static extern string CreateUpdateStatement(SafeDataControlHandle provider, SafeBundleHandle updateData, string where); + + [DllImport(Libraries.DataControl, EntryPoint = "datacontrol_provider_get_select_page_info")] + internal static extern ResultType GetSelectPageInfo(int requestId, out int pageNum, out int countPerPage); + + [DllImport(Libraries.DataControl, EntryPoint = "datacontrol_provider_write_socket")] + internal static extern unsafe ResultType WriteSelectResult(int socketFd, byte* buffer, uint nbytes, out uint bytesWrite); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_data_change_noti")] + internal static extern ResultType SendDataChange(IntPtr handle, ChangeType type, SafeBundleHandle data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_step_next")] + internal static extern ResultType Next(SafeCursorHandle cursor); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_step_last")] + internal static extern ResultType Last(SafeCursorHandle cursor); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_step_first")] + internal static extern ResultType First(SafeCursorHandle cursor); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_step_previous")] + internal static extern ResultType Prev(SafeCursorHandle cursor); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_column_count")] + internal static extern int GetColumnCount(SafeCursorHandle cursor); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_column_name")] + internal static extern ResultType GetColumnName(SafeCursorHandle cursor, int idx, StringBuilder name); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_column_item_size")] + internal static extern int GetItemSize(SafeCursorHandle cursor, int idx); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_column_item_type")] + internal static extern ResultType GetItemType(SafeCursorHandle cursor, int idx, out int type); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_blob_data")] + internal static extern ResultType GetBlob(SafeCursorHandle cursor, int idx, byte[] buffer, int size); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_int_data")] + internal static extern ResultType GetInt(SafeCursorHandle cursor, int idx, out int data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_int64_data")] + internal static extern ResultType GetInt64(SafeCursorHandle cursor, int idx, out long data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_double_data")] + internal static extern ResultType Getdouble(SafeCursorHandle cursor, int idx, out double data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_sql_get_text_data")] + internal static extern unsafe ResultType GetText(SafeCursorHandle cursor, int idx, byte[] data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_data_create")] + internal static extern ResultType BulkCreate(out SafeBulkDataHandle handle); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_data_add")] + internal static extern ResultType BulkAdd(SafeBulkDataHandle handle, SafeBundleHandle data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_data_get_count")] + internal static extern ResultType BulkGetCount(SafeBulkDataHandle handle, out int count); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_data_destroy")] + internal static extern ResultType BulkFree(IntPtr handle); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_data_get_data")] + internal static extern ResultType BulkGetData(SafeBulkDataHandle handle, int idx, out IntPtr data); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_create")] + internal static extern ResultType BulkResultCreate(out SafeBulkResultDataHandle handle); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_add")] + internal static extern ResultType BulkResultAdd(SafeBulkResultDataHandle handle, SafeBundleHandle data, int result); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_get_count")] + internal static extern ResultType BulkResultGetCount(SafeBulkResultDataHandle handle, out int count); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_get_result_data")] + internal static extern ResultType BulkResultGetData(SafeBulkResultDataHandle handle, int idx, out IntPtr data, out int result); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_get_result_data")] + internal static extern ResultType BulkResultGetResult(SafeBulkResultDataHandle handle, int idx, out IntPtr data, out int result); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_bulk_result_data_destroy")] + internal static extern ResultType BulkResultFree(IntPtr handle); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AddCallbackResultCallback(IntPtr handle, ResultType type, int callbackID, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DataChangeCallback(IntPtr handle, ChangeType type, IntPtr data, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_add_data_change_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern ResultType AddDataChangeCallback(SafeDataControlHandle provider, DataChangeCallback callback, + IntPtr userData, AddCallbackResultCallback resultCallback, IntPtr resultCbUserData, out int callbackID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_remove_data_change_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern ResultType RemoveDataChangeCallback(SafeDataControlHandle provider, int callbackID); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool DataChangeConsumerFilterCb(IntPtr handle, string consumerAppid, IntPtr userData); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_add_data_change_consumer_filter_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern ResultType AddDataChangeConsumerFilterCallback(DataChangeConsumerFilterCb callback, + IntPtr userData, + out int callbackID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_remove_data_change_consumer_filter_cb")] + internal static extern int RemoveDataChangeConsumerFilterCallback(int callbackID); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_bulk_insert_result")] + internal static extern ResultType SendBulkInsertResult(int requestId, SafeBulkResultDataHandle result); + + [DllImport(Libraries.DataControl, EntryPoint = "data_control_provider_send_map_bulk_add_result")] + internal static extern ResultType SendMapBulkAddResult(int requestId, SafeBulkResultDataHandle result); + + internal static class UnsafeCode + { + internal static unsafe ResultType WriteResult(int socketFd, byte[] value, int nbytes, out uint bytesWrite) + { + fixed (byte* pointer = value) + { + return WriteSelectResult(socketFd, pointer, (uint)nbytes, out bytesWrite); + } + } + } + + } +} diff --git a/src/Tizen.Applications.DataControl/Interop/Interop.Libraries.cs b/src/Tizen.Applications.DataControl/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..1658ec6 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string DataControl = "libdata-control.so.0"; + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.Core/CloneCursorCore.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.Core/CloneCursorCore.cs new file mode 100755 index 0000000..1e066ee --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.Core/CloneCursorCore.cs @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.Threading; + +namespace Tizen.Applications.DataControl.Core +{ + internal class CloneCursorCore : ICursor + { + internal const int MaxColumnNameSize = 1024; + private const string LogTag = "Tizen.Applications.DataControl"; + private long _rowCount; + private int _columnCount; + private const int ResultNoData = -1; + private Interop.DataControl.SafeCursorHandle _cursor; + internal CloneCursorCore(Interop.DataControl.SafeCursorHandle cursor) + { + _cursor = cursor; + _columnCount = Interop.DataControl.GetColumnCount(cursor); + + if (_columnCount == ResultNoData) + { + _rowCount = 0; + return; + } + + Interop.DataControl.First(cursor); + + do + { + _rowCount++; + } + while (Interop.DataControl.Next(cursor) == (int)ResultType.Success); + Interop.DataControl.First(cursor); + } + + public int GetColumnCount() + { + return Interop.DataControl.GetColumnCount(_cursor); + } + + public ColumnType GetColumnType(int index) + { + int type; + ResultType ret; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + ret = Interop.DataControl.GetItemType(_cursor, index, out type); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Column Index " + index.ToString()); + } + + return (ColumnType)type; + } + + public string GetColumnName(int index) + { + string retStr; + ResultType ret; + StringBuilder columnName = new StringBuilder(); + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + columnName.Length = MaxColumnNameSize; + ret = Interop.DataControl.GetColumnName(_cursor, index, columnName); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Column Index " + index.ToString()); + } + + retStr = columnName.ToString(); + columnName.Clear(); + columnName = null; + + return retStr; + } + + public long GetRowCount() + { + return _rowCount; + } + + public bool Next() + { + ResultType type = Interop.DataControl.Next(_cursor); + + if (type != ResultType.Success) + { + return false; + } + + return true; + } + + public bool Prev() + { + ResultType type = Interop.DataControl.Prev(_cursor); + + if (type != ResultType.Success) + { + return false; + } + + return true; + } + + public bool Reset() + { + ResultType type = Interop.DataControl.First(_cursor); + + if (type != ResultType.Success) + { + return false; + } + + return true; + } + + public int GetIntValue(int index) + { + ResultType ret; + int value; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + ret = Interop.DataControl.GetInt(_cursor, index, out value); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Column Index " + index.ToString()); + } + + return value; + } + + public Int64 GetInt64Value(int index) + { + ResultType ret; + Int64 value; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + ret = Interop.DataControl.GetInt64(_cursor, index, out value); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Column Index " + index.ToString()); + } + + return value; + } + + public double GetDoubleValue(int index) + { + ResultType ret; + double value; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + ret = Interop.DataControl.Getdouble(_cursor, index, out value); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Column Index " + index.ToString()); + } + + return value; + } + + public string GetStringValue(int index) + { + ResultType ret; + int size; + byte[] value; + string text; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + size = Interop.DataControl.GetItemSize(_cursor, index); + if (size < 0) + { + ErrorFactory.ThrowException(ResultType.IoError, false, "Invalid size"); + } + + value = new byte[size + 1]; + ret = Interop.DataControl.GetText(_cursor, index, value); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false); + } + + text = Encoding.UTF8.GetString(value); + + return text; + } + + public byte[] GetBlobValue(int index) + { + ResultType ret; + int size; + byte[] byte_array; + + if (index < 0 || index >= _columnCount) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + size = Interop.DataControl.GetItemSize(_cursor, index); + if (size < 0) + { + ErrorFactory.ThrowException(ResultType.IoError, false, "Invalid size"); + } + + byte_array = new byte[size]; + ret = Interop.DataControl.GetBlob(_cursor, index, byte_array, size); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false); + } + + return byte_array; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.csproj b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.csproj new file mode 100644 index 0000000..0e326ef --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.csproj @@ -0,0 +1,18 @@ + + + + + netstandard1.6 + + + + + + + + + + + + + diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.sln b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.sln new file mode 100755 index 0000000..03947af --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.DataControl", "Tizen.Applications.DataControl.csproj", "{12BD57BA-0C9C-4861-A2CF-F759AFB63C9B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{787BCB6D-5159-4927-B87B-6C4C6CB27BB9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{EDCB4562-3D7A-422A-9D31-2D04F17F9B5C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{40D22D0C-CB4D-4EF7-B1A0-B350BC5A536F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {12BD57BA-0C9C-4861-A2CF-F759AFB63C9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {12BD57BA-0C9C-4861-A2CF-F759AFB63C9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {12BD57BA-0C9C-4861-A2CF-F759AFB63C9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {12BD57BA-0C9C-4861-A2CF-F759AFB63C9B}.Release|Any CPU.Build.0 = Release|Any CPU + {787BCB6D-5159-4927-B87B-6C4C6CB27BB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {787BCB6D-5159-4927-B87B-6C4C6CB27BB9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {787BCB6D-5159-4927-B87B-6C4C6CB27BB9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {787BCB6D-5159-4927-B87B-6C4C6CB27BB9}.Release|Any CPU.Build.0 = Release|Any CPU + {EDCB4562-3D7A-422A-9D31-2D04F17F9B5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EDCB4562-3D7A-422A-9D31-2D04F17F9B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EDCB4562-3D7A-422A-9D31-2D04F17F9B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EDCB4562-3D7A-422A-9D31-2D04F17F9B5C}.Release|Any CPU.Build.0 = Release|Any CPU + {40D22D0C-CB4D-4EF7-B1A0-B350BC5A536F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40D22D0C-CB4D-4EF7-B1A0-B350BC5A536F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40D22D0C-CB4D-4EF7-B1A0-B350BC5A536F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40D22D0C-CB4D-4EF7-B1A0-B350BC5A536F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/BulkData.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/BulkData.cs new file mode 100755 index 0000000..a3aa164 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/BulkData.cs @@ -0,0 +1,361 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; + +namespace Tizen.Applications.DataControl +{ + /// + /// Represents BulkData class for DataControl bulk request. + /// + public class BulkData : IDisposable + { + private bool _disposed = false; + private Interop.DataControl.SafeBulkDataHandle _handle; + + /// + /// Initializes BulkData class. + /// + /// Thrown in case of any internal error. + public BulkData() + { + ResultType ret; + + ret = Interop.DataControl.BulkCreate(out _handle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkCreate"); + } + + } + + internal BulkData(Interop.DataControl.SafeBulkDataHandle handle) + { + ResultType ret; + int count, i; + + ret = Interop.DataControl.BulkCreate(out _handle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkCreate"); + } + + ret = Interop.DataControl.BulkGetCount(handle, out count); + for ( i = 0; i < count; i++) + { + IntPtr bundleHandle; + Bundle bundle; + + ret = Interop.DataControl.BulkGetData(handle, i, out bundleHandle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkGetData"); + } + + bundle = new Bundle(new SafeBundleHandle(bundleHandle, false)); + ret = Interop.DataControl.BulkAdd(_handle, bundle.SafeBundleHandle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkAdd"); + } + } + } + + internal Interop.DataControl.SafeBulkDataHandle SafeBulkDataHandle + { + get { return _handle; } + } + + /// + /// Adds bulk data. + /// + /// Bulk data + /// Thrown in case of Invalid parmaeter. + public void Add(Bundle data) + { + ResultType ret; + + if (data == null || data.SafeBundleHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "data"); + } + + ret = Interop.DataControl.BulkAdd(_handle, data.SafeBundleHandle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkAdd"); + } + } + + /// + /// Gets current data count. + /// + public int GetCount() + { + int count; + ResultType ret; + + ret = Interop.DataControl.BulkGetCount(_handle, out count); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkGetCount"); + } + + return count; + } + + /// + /// Returns the data at the given zero-based data index. + /// + /// Target data index + /// Thrown in case of Invalid parmaeter. + public Bundle GetData(int index) + { + IntPtr bundlePtr; + Bundle bundle; + ResultType ret; + + if (index < 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "index"); + } + + ret = Interop.DataControl.BulkGetData(_handle, index, out bundlePtr); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkGetData"); + } + + bundle = new Bundle(new SafeBundleHandle(bundlePtr, false)); + return bundle; + } + + /// + /// Releases all resources used by the BulkData class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != null && !_handle.IsInvalid) + { + _handle.Dispose(); + } + + _disposed = true; + } + } + + ~BulkData() + { + Dispose(false); + } + } + + /// + /// Represents BulkResultData class for DataControl bulk request. + /// + public class BulkResultData : IDisposable + { + private const string LogTag = "Tizen.Applications.DataControl"; + private bool _disposed = false; + private Interop.DataControl.SafeBulkResultDataHandle _handle; + /// + /// Initializes BulkResultData class. + /// + /// Thrown in case of any internal error. + public BulkResultData() + { + ResultType ret; + + ret = Interop.DataControl.BulkResultCreate(out _handle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true,"BulkResultCreate"); + } + } + + internal BulkResultData(Interop.DataControl.SafeBulkResultDataHandle handle) + { + ResultType ret; + + ret = Interop.DataControl.BulkResultCreate(out _handle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true,"BulkResultCreate"); + } + + int count; + ret = Interop.DataControl.BulkResultGetCount(handle, out count); + for (int i = 0; i < count; i++) + { + IntPtr bundleHandle; + Bundle bundle; + int result; + + ret = Interop.DataControl.BulkResultGetData(handle, i, out bundleHandle, out result); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkResultGetData"); + } + + bundle = new Bundle(new SafeBundleHandle(bundleHandle, false)); + ret = Interop.DataControl.BulkResultAdd(_handle, bundle.SafeBundleHandle, result); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkResultAdd"); + } + } + } + + /// + /// Adds bulk operation result data. + /// + /// Result data + /// Result + /// Thrown in case of Invalid parmaeter. + public void Add(Bundle data, int result) + { + ResultType ret; + + if (data == null || data.SafeBundleHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "data"); + } + + ret = Interop.DataControl.BulkResultAdd(_handle, data.SafeBundleHandle, result); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkResultAdd"); + } + } + + internal Interop.DataControl.SafeBulkResultDataHandle SafeBulkDataHandle + { + get { return _handle; } + } + + /// + /// Gets current result data count. + /// + public int GetCount() + { + int count; + ResultType ret; + + ret = Interop.DataControl.BulkResultGetCount(_handle, out count); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true,"BulkResultGetCount"); + } + + return count; + } + + /// + /// Returns the result data at the given zero-based data index. + /// + /// Target result data index + /// Thrown in case of Invalid parmaeter. + public Bundle GetData(int index) + { + IntPtr bundlePtr; + Bundle bundle; + ResultType ret; + int result; + + if (index < 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "index"); + } + + ret = Interop.DataControl.BulkResultGetData(_handle, index, out bundlePtr, out result); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkResultGetData"); + } + + bundle = new Bundle(new SafeBundleHandle(bundlePtr, false)); + return bundle; + } + + /// + /// Returns the result at the given zero-based data index. + /// + /// Target result index + /// Thrown in case of Invalid parmaeter. + public int GetResult(int index) + { + IntPtr bundlePtr; + ResultType ret; + int result; + + if (index < 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "index"); + } + + ret = Interop.DataControl.BulkResultGetData(_handle, index, out bundlePtr, out result); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, true, "BulkResultGetData"); + } + + return result; + } + + /// + /// Releases all resources used by the BulkResultData class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != null && !_handle.IsInvalid) + { + _handle.Dispose(); + } + + _disposed = true; + } + } + + ~BulkResultData() + { + Dispose(false); + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Consumer.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Consumer.cs new file mode 100755 index 0000000..ddbf6a8 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Consumer.cs @@ -0,0 +1,973 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; +using Tizen.Applications.DataControl.Core; +using System.Threading; + +namespace Tizen.Applications.DataControl +{ + /// + /// Represents Consumer class for DataControl consumer application. + /// + public abstract class Consumer : IDisposable + { + + private Interop.DataControl.SafeDataControlHandle _handle; + private string _dataID, _providerID; + private int _changeCallbackID = 0; + private const string LogTag = "Tizen.Applications.DataControl"; + private bool _disposed = false; + private static Mutex _lock = new Mutex(); + private Interop.DataControl.DataChangeCallback _dataChangeCallback; + private Interop.DataControl.AddCallbackResultCallback _addCallbackResultCallback; + + private static class CallbackManager + { + private static IDictionary _mapResponseCallbacks = new Dictionary(); + private static IDictionary _mapBulkResponseCallback = new Dictionary(); + private static IDictionary _sqlResponseCallbacks = new Dictionary(); + private static IDictionary _sqlBulkResponseCallback = new Dictionary(); + private static IDictionary _reqConsumerDictionary = new Dictionary(); + private static IDictionary _reqProviderList = new Dictionary(); + private static void InsertResponse(int reqId, IntPtr provider, long insertedRowId, bool providerResult, string error, IntPtr userData) + { + Log.Debug(LogTag, $"InsertResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}, rowID : {insertedRowId.ToString()}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnInsertResult(new InsertResult(insertedRowId, providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void BulkInsertResponse(int reqId, IntPtr provider, IntPtr bulkResults, bool providerResult, string error, IntPtr userData) + { + BulkResultData brd; + Log.Debug(LogTag, $"BulkInsertResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + if (bulkResults != IntPtr.Zero) + { + brd = new BulkResultData(new Interop.DataControl.SafeBulkResultDataHandle(bulkResults, false)); + } + else + { + brd = new BulkResultData(); + Log.Error(LogTag, $"reqId {reqId.ToString()}, bulkResults is null"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnBulkInsertResult(new BulkInsertResult(brd, providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void SelectResponse(int reqId, IntPtr provider, IntPtr cursor, bool providerResult, string error, IntPtr userData) + { + MatrixCursor dmc; + Log.Debug(LogTag, $"SelectResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + if (cursor != IntPtr.Zero) + { + try + { + dmc = CloneCursor(new CloneCursorCore(new Interop.DataControl.SafeCursorHandle(cursor, true))); + } + catch (Exception ex) + { + dmc = new MatrixCursor(); + Log.Error(LogTag, $"reqId {reqId.ToString()}, {ex.ToString()}"); + } + } + else + { + dmc = new MatrixCursor(); + Log.Error(LogTag, $"reqId {reqId.ToString()}, cursor is null"); + } + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnSelectResult(new SelectResult(dmc, providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void UpdateResponse(int reqId, IntPtr provider, bool providerResult, string error, IntPtr userData) + { + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnUpdateResult(new UpdateResult(providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void DeleteResponse(int reqId, IntPtr provider, bool providerResult, string error, IntPtr userData) + { + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnDeleteResult(new DeleteResult(providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void MapGetResponse(int reqId, IntPtr provider, string[] valueList, int valueCount, bool providerResult, string error, IntPtr userData) + { + MapGetResult mgr; + Log.Debug(LogTag, $"MapGetResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + if (valueList !=null) + { + mgr = new MapGetResult(valueList, providerResult); + } + else + { + mgr = new MapGetResult(new string[0], providerResult); + Log.Error(LogTag, $"reqId {reqId.ToString()}, valueList is null"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnMapGetResult(mgr); + _reqConsumerDictionary.Remove(reqId); + } + + private static void MapBulkAddResponse(int reqId, IntPtr provider, IntPtr bulkResults, bool providerResult, string error, IntPtr userData) + { + BulkResultData brd; + Log.Debug(LogTag, $"MapBulkAddResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + if (bulkResults != IntPtr.Zero) + { + brd = new BulkResultData(new Interop.DataControl.SafeBulkResultDataHandle(bulkResults, false)); + } + else + { + brd = new BulkResultData(); + Log.Error(LogTag, $"reqId {reqId.ToString()}, bulkResults is null"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnMapBulkAddResult(new MapBulkAddResult(brd, providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void MapAddResponse(int reqId, IntPtr provider, bool providerResult, string error, IntPtr userData) + { + Log.Debug(LogTag, $"MapAddResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnMapAddResult(new MapAddResult(providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void MapSetResponse(int reqId, IntPtr provider, bool providerResult, string error, IntPtr userData) + { + Log.Debug(LogTag, $"MapSetResponse {reqId.ToString()}"); + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnMapSetResult(new MapSetResult(providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static void MapRemoveResponse(int reqId, IntPtr provider, bool providerResult, string error, IntPtr userData) + { + if (!_reqConsumerDictionary.ContainsKey(reqId)) + { + Log.Error(LogTag, $"Invalid reqId {reqId.ToString()}"); + return; + } + + if (!providerResult) + { + Log.Error(LogTag, $"reqId {reqId.ToString()}, error : {error}"); + } + + Consumer consumer = _reqConsumerDictionary[reqId]; + consumer.OnMapRemoveResult(new MapRemoveResult(providerResult)); + _reqConsumerDictionary.Remove(reqId); + } + + private static MatrixCursor CloneCursor(CloneCursorCore coreCursor) + { + int size = coreCursor.GetColumnCount(); + int i; + string[] name = new string[size]; + object[] newRow = new object[size]; + ColumnType[] type = new ColumnType[size]; + + for (i = 0; i < size; i++) + { + name[i] = coreCursor.GetColumnName(i); + type[i] = coreCursor.GetColumnType(i); + } + + MatrixCursor dmc = new MatrixCursor(name, type); + + if (coreCursor.GetRowCount() <= 0) + { + return dmc; + } + + coreCursor.Reset(); + do + { + for (i = 0; i < size; i++) + { + switch (type[i]) + { + case ColumnType.ColumnTypeInt: + newRow[i] = coreCursor.GetInt64Value(i); + break; + case ColumnType.ColumnTypeDouble: + newRow[i] = coreCursor.GetDoubleValue(i); + break; + case ColumnType.ColumnTypeBlob: + newRow[i] = coreCursor.GetBlobValue(i); + break; + case ColumnType.ColumnTypeString: + newRow[i] = coreCursor.GetStringValue(i); + break; + } + } + + dmc.AddRow(newRow); + } + while (coreCursor.Next()); + + return dmc; + } + + internal static void RegisterReqId(int reqId, Consumer consumer) + { + _lock.WaitOne(); + _reqConsumerDictionary.Add(reqId, consumer); + _lock.ReleaseMutex(); + } + + internal static void RegisterCallback(Interop.DataControl.SafeDataControlHandle handle, string providerId) + { + ResultType ret; + Interop.DataControl.SqlResponseCallbacks sqlCallbacks; + Interop.DataControl.SqlBulkInsertResponseCallback sqlBulkCallbacks; + Interop.DataControl.MapResponseCallbacks mapCallbacks; + Interop.DataControl.MapBulkAddResponseCallback mapBulkCallbacks; + bool sqlRegistered = false; + bool mapRegistered = false; + + if (_reqProviderList.ContainsKey(providerId)) + { + _reqProviderList[providerId]++; + Log.Error(LogTag, "The data control is already set"); + return; + } + + sqlCallbacks.Insert = new Interop.DataControl.SqlInsertResponseCallback(InsertResponse); + sqlCallbacks.Select = new Interop.DataControl.SqlSelectResponseCallback(SelectResponse); + sqlCallbacks.Update = new Interop.DataControl.SqlUpdateResponseCallback(UpdateResponse); + sqlCallbacks.Delete = new Interop.DataControl.SqlDeleteResponseCallback(DeleteResponse); + ret = Interop.DataControl.RegisterSqlResponseCallback(handle, ref sqlCallbacks, IntPtr.Zero); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "Registering the sql callback function is failed : " + ret); + } + else + { + _sqlResponseCallbacks.Add(providerId, sqlCallbacks); + sqlRegistered = true; + } + + sqlBulkCallbacks = new Interop.DataControl.SqlBulkInsertResponseCallback(BulkInsertResponse); + ret = Interop.DataControl.RegisterSqlBulkResponseCallback(handle, sqlBulkCallbacks, IntPtr.Zero); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "Registering the sql bulk callback function is failed : " + ret); + } + else + { + _sqlBulkResponseCallback.Add(providerId, sqlBulkCallbacks); + } + + mapCallbacks.Add = new Interop.DataControl.MapAddResponseCallback(MapAddResponse); + mapCallbacks.Set = new Interop.DataControl.MapSetResponseCallback(MapSetResponse); + mapCallbacks.Get = new Interop.DataControl.MapGetResponseCallback(MapGetResponse); + mapCallbacks.Remove = new Interop.DataControl.MapRemoveResponseCallback(MapRemoveResponse); + ret = Interop.DataControl.RegisterMapResponse(handle, ref mapCallbacks, IntPtr.Zero); + + if (ret != ResultType.Success) + { + Log.Error(LogTag, "Registering the map callback function is failed : " + ret); + } + else + { + _mapResponseCallbacks.Add(providerId, mapCallbacks); + mapRegistered = true; + } + + mapBulkCallbacks = new Interop.DataControl.MapBulkAddResponseCallback(MapBulkAddResponse); + ret = Interop.DataControl.RegisterMapBulkResponseCallback(handle, mapBulkCallbacks, IntPtr.Zero); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "Registering the map bulk callback function is failed : " + ret); + } + else + { + _mapBulkResponseCallback.Add(providerId, mapBulkCallbacks); + } + + if (!mapRegistered && !sqlRegistered) + { + ErrorFactory.ThrowException(ret, true, "Registering the response callback function is failed"); + } + + _reqProviderList.Add(providerId, 1); + } + + internal static void UnregisterCallback(Interop.DataControl.SafeDataControlHandle handle, string providerId) + { + int count; + + _reqProviderList[providerId]--; + count = _reqProviderList[providerId]; + if (count <= 0) + { + _reqProviderList.Remove(providerId); + + _mapResponseCallbacks.Remove(providerId); + Interop.DataControl.UnregisterMapResponse(handle); + + _mapBulkResponseCallback.Remove(providerId); + Interop.DataControl.UnregisterMapBulkResponseCallback(handle); + + _sqlResponseCallbacks.Remove(providerId); + Interop.DataControl.UnregisterSqlResponseCallback(handle); + + _sqlBulkResponseCallback.Remove(providerId); + Interop.DataControl.UnregisterSqlBulkResponseCallback(handle); + } + + } + } + + /// + /// Sends insert request to provider application. + /// + /// OnInsertResult will recieve result of this API + /// Insert data + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void Insert(Bundle insertData) + { + int reqId; + ResultType ret; + + if (insertData == null || insertData.SafeBundleHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "insertData"); + } + + _lock.WaitOne(); + ret = Interop.DataControl.Insert(_handle, insertData.SafeBundleHandle, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Insert"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends select request to provider application. + /// + /// OnSelectResult will recieve result of this API + /// Select target column list + /// Where statement for select query + /// Order statement for select query + /// Select target page number + /// Select row count per page + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void Select(string[] columnList, string where, string order, int pageNumber = 1, int countPerPage = 20) + { + int reqId, i; + ResultType ret; + if (columnList == null || columnList.Length == 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column_list"); + } + + for (i = 0; i < columnList.Length; i++) + { + if (string.IsNullOrEmpty(columnList[i])) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column_list index " + i.ToString()); + } + } + + _lock.WaitOne(); + ret = Interop.DataControl.Select(_handle, columnList, columnList.Length, where, order, pageNumber, countPerPage, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Select"); + } + Log.Info(LogTag, "select end. " + reqId.ToString()); + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends delete request to provider application. + /// + /// OnDeleteResult will recieve result of this API + /// Where statement for delete query + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void Delete(string where) + { + int reqId; + ResultType ret; + + _lock.WaitOne(); + ret = Interop.DataControl.Delete(_handle, where, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Delete"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends update request to provider application. + /// + /// OnUpdateResult will recieve result of this API + /// Update data + /// Where statement for query + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void Update(Bundle updateData, string where) + { + int reqId; + ResultType ret; + + if (updateData == null || updateData.SafeBundleHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "insertData"); + } + + if (string.IsNullOrEmpty(where)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "where"); + } + + _lock.WaitOne(); + ret = Interop.DataControl.Update(_handle, updateData.SafeBundleHandle, where, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Update"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends bulk insert request to provider application. + /// + /// OnBulkInsertResult will recieve result of this API + /// Bulk insert data + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void BulkInsert(BulkData insertData) + { + int reqId; + ResultType ret; + + if (insertData == null || insertData.SafeBulkDataHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "insertData"); + } + + _lock.WaitOne(); + ret = Interop.DataControl.BulkInsert(_handle, insertData.SafeBulkDataHandle, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "BulkInsert"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends map add request to provider application. + /// + /// OnMapAddResult will recieve result of this API + /// The key of the value to add + /// The value to add + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void MapAdd(string key, string value) + { + int reqId; + ResultType ret; + + if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + _lock.WaitOne(); + ret = Interop.DataControl.MapAdd(_handle, key, value, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "MapAdd"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends map get request to provider application. + /// + /// OnMapGetResult will recieve result of this API + /// The key of the value list to obtain + /// The page number of the value set + /// The desired maximum count of the data items per page + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void MapGet(string key, int pageNumber = 1, int countPerPage = 20) + { + int reqId; + ResultType ret; + + if (string.IsNullOrEmpty(key) || pageNumber <= 0 || countPerPage <= 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + _lock.WaitOne(); + ret = Interop.DataControl.MapGet(_handle, key, out reqId, pageNumber, countPerPage); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "MapGet"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends map remove request to provider application. + /// + /// OnMapRemoveResult will recieve result of this API + /// The key of the value to remove + /// The value to remove + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void MapRemove(string key, string value) + { + int reqId; + ResultType ret; + + if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(value)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + _lock.WaitOne(); + ret = Interop.DataControl.MapRemove(_handle, key, value, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "MapRemove"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends map set request to provider application. + /// + /// OnMapSetResult will recieve result of this API + /// The key of the value to replace + /// The value to be replaced + /// The new value that replaces the existing value + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void MapSet(string key, string oldValue, string newValue) + { + int reqId; + ResultType ret; + + if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(oldValue) || string.IsNullOrEmpty(newValue)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + _lock.WaitOne(); + ret = Interop.DataControl.MapSet(_handle, key, oldValue, newValue, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "MapSet"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + /// + /// Sends map bulk add request to provider application. + /// + /// OnMapBulkAddResult will recieve result of this API + /// Map bulk add data + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown when message has exceeded the maximum limit(1MB) + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void MapBulkAdd(BulkData addData) + { + int reqId; + ResultType ret; + + if (addData == null || addData.SafeBulkDataHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "addData"); + } + + _lock.WaitOne(); + ret = Interop.DataControl.BulkAdd(_handle, addData.SafeBulkDataHandle, out reqId); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "BulkAdd"); + } + + CallbackManager.RegisterReqId(reqId, this); + } + + private void DataChange(IntPtr handle, ChangeType type, IntPtr data, IntPtr userData) + { + OnDataChange(type, new Bundle(new SafeBundleHandle(data, false))); + } + + private void DataChangeListenResult(IntPtr handle, ResultType type, int callbackId, IntPtr userData) + { + OnDataChangeListenResult(new DataChangeListenResult(type)); + } + + /// + /// Listen DataChange event + /// + /// OnDataChangeListenResult will recieve result of this API + /// If success, OnDataChange will recieve DataChange event + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + /// http://tizen.org/privilege/appmanager.launch + public void DataChangeListen() + { + ResultType ret; + _lock.WaitOne(); + /* Only one callback is allowed for every obejct */ + if (_changeCallbackID > 0) + { + _lock.ReleaseMutex(); + return; + } + _dataChangeCallback = new Interop.DataControl.DataChangeCallback(DataChange); + _addCallbackResultCallback = new Interop.DataControl.AddCallbackResultCallback(DataChangeListenResult); + ret = Interop.DataControl.AddDataChangeCallback(_handle, _dataChangeCallback, IntPtr.Zero, + _addCallbackResultCallback , IntPtr.Zero, out _changeCallbackID); + _lock.ReleaseMutex(); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "DataChangeListen"); + } + } + + /// + /// Initializes Consumer class with providerId and dataId. + /// + /// DataControl Provider ID + /// DataControl Data ID + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of any internal error. + public Consumer(string providerId, string dataId) + { + ResultType ret; + + if (string.IsNullOrEmpty(providerId)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "providerId"); + } + + if (string.IsNullOrEmpty(dataId)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "dataId"); + } + + ret = Interop.DataControl.DataControlCreate(out _handle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false, "Creating data control handle is failed"); + } + + Interop.DataControl.DataControlSetProviderId(_handle, providerId); + Interop.DataControl.DataControlSetDataId(_handle, dataId); + CallbackManager.RegisterCallback(_handle, providerId); + _dataID = dataId; + _providerID = providerId; + } + + ~Consumer() + { + Dispose(false); + } + + /// + /// Overrides this method if want to handle behavior when the DataChangeListen result is received. + /// + protected virtual void OnDataChangeListenResult(DataChangeListenResult result) + { + Log.Info(LogTag, "The OnDataChangeListenResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the data change event is received. + /// + protected virtual void OnDataChange(ChangeType type, Bundle data) + { + Log.Info(LogTag, "The OnDataChange is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the select response is received. + /// + protected abstract void OnSelectResult(SelectResult result); + + /// + /// Overrides this method if want to handle behavior when the insert response is received. + /// + protected abstract void OnInsertResult(InsertResult result); + + /// + /// Overrides this method if want to handle behavior when the update response is received. + /// + protected abstract void OnUpdateResult(UpdateResult result); + + /// + /// Overrides this method if want to handle behavior when the delete response is received. + /// + protected abstract void OnDeleteResult(DeleteResult result); + /// + /// Overrides this method if want to handle behavior when the BulkInsert response is received. + /// + protected virtual void OnBulkInsertResult(BulkInsertResult result) + { + Log.Info(LogTag, "The OnBulkInsertResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the map get response is received. + /// + protected virtual void OnMapGetResult(MapGetResult result) + { + Log.Info(LogTag, "The OnMapGetResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the map add response is received. + /// + protected virtual void OnMapAddResult(MapAddResult result) + { + Log.Info(LogTag, "The OnMapAddResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the map set response is received. + /// + protected virtual void OnMapSetResult(MapSetResult result) + { + Log.Info(LogTag, "The OnMapSetResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the map remove response is received. + /// + protected virtual void OnMapRemoveResult(MapRemoveResult result) + { + Log.Info(LogTag, "The OnMapRemoveResult is not implemented."); + } + + /// + /// Overrides this method if want to handle behavior when the BulkAdd response is received. + /// + protected virtual void OnMapBulkAddResult(MapBulkAddResult result) + { + Log.Info(LogTag, "The OnMapBulkAddResult is not implemented."); + } + + /// + /// Releases the unmanaged resourced used by the Consumer class specifying whether to perform a normal dispose operation. + /// + /// true for a normal dispose operation; false to finalize the handle. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_changeCallbackID > 0) + { + Interop.DataControl.RemoveDataChangeCallback(_handle, _changeCallbackID); + } + + CallbackManager.UnregisterCallback(_handle, _providerID); + _handle.Dispose(); + _disposed = true; + } + + if (disposing) + { + GC.SuppressFinalize(this); + } + } + + /// + /// Releases all resources used by the Consumer class. + /// + public void Dispose() + { + Dispose(true); + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ErrorFactory.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ErrorFactory.cs new file mode 100755 index 0000000..a5712c9 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ErrorFactory.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; + +namespace Tizen.Applications.DataControl +{ + internal static class ErrorFactory + { + private const string LogTag = "Tizen.Applications.DataControl"; + + internal static void ThrowException(ResultType errorCode, bool ignoreType, string errorMessage = null, + [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) + { + Log.Error(LogTag, $"{memberName}({lineNumber.ToString()}) : {filePath}"); + if (ignoreType) + { + throw new InvalidOperationException(string.IsNullOrEmpty(errorMessage) ? "error code : " + errorCode.ToString() : + $"{errorMessage} - {errorCode}"); + } + + switch (errorCode) + { + case ResultType.Success: + return; + case ResultType.OutOfMemory: + case ResultType.IoError: + throw new InvalidOperationException(string.IsNullOrEmpty(errorMessage) ? "error code : " + errorCode.ToString() : + $"{errorMessage} - {errorCode}"); + case ResultType.InvalidParameter: + Log.Error(LogTag, "Invalid parameter : " + errorMessage); + throw new ArgumentException(string.IsNullOrEmpty(errorMessage) ? "Invalid parameter" : "Invalid parameter : " + errorMessage); + case ResultType.PermissionDenied: + Log.Error(LogTag, "Permission denied : " + errorMessage); + throw new UnauthorizedAccessException(string.IsNullOrEmpty(errorMessage) ? "Permission denied" : "Permission denied : " + errorMessage); + case ResultType.MaxExceed: + Log.Error(LogTag, "Too long argument : " + errorMessage); + throw new ArgumentOutOfRangeException(string.IsNullOrEmpty(errorMessage) ? "Too long argument" : "Too long argument : " + errorMessage); + default: + Log.Error(LogTag, $"Unknown error : {errorMessage} - {errorCode}"); + throw new InvalidOperationException(string.IsNullOrEmpty(errorMessage) ? "Unknown error : " + errorCode.ToString() : + $"Unknown error : {errorMessage} - {errorCode}"); + } + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ICursor.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ICursor.cs new file mode 100755 index 0000000..4136358 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/ICursor.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Applications.DataControl +{ + /// + /// This interface is for DataControl cursor. + /// + public interface ICursor + { + /// + /// Gets a column count. + /// + int GetColumnCount(); + /// + /// Gets a column type. + /// + /// The index of column. + ColumnType GetColumnType(int index); + /// + /// Gets a column name. + /// + /// The index of column. + string GetColumnName(int index); + /// + /// Gets the numbers of rows in the cursor. + /// + long GetRowCount(); + /// + /// Gets a next row. + /// + bool Next(); + /// + /// Gets a prev row. + /// + bool Prev(); + /// + /// Gets a first row. + /// + bool Reset(); + /// + /// / Gets an int value. + /// + /// The index of row. + int GetIntValue(int index); + /// + /// / Gets an int64 value. + /// + /// The index of row. + Int64 GetInt64Value(int index); + /// + /// Gets an double value. + /// + /// The index of row. + double GetDoubleValue(int index); + /// + /// Gets an string value. + /// + /// The index of row. + string GetStringValue(int index); + /// + /// Gets a blob value. + /// + /// The index of row. + byte[] GetBlobValue(int index); + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/MatrixCursor.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/MatrixCursor.cs new file mode 100755 index 0000000..426416e --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/MatrixCursor.cs @@ -0,0 +1,629 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.Threading; +using System.Diagnostics; + +namespace Tizen.Applications.DataControl +{ + /// + /// Represents MatrixCursor class for DataControl provider's matrix cursor. + /// + public class MatrixCursor : IDisposable, ICursor + { + private const string LogTag = "Tizen.Applications.DataControl"; + private FileStream _fs; + private bool _disposed = false; + private string _cursorPath; + private long _rowCount = 0; + private long _rowCountPosition = 0; + private int _currentRowIndex = 0; + private IList _rowFieldOffset = new List(); + private string[] _columnNames; + private ColumnType[] _columnTypes; + private const int ColumnTypeNull = 5; + + private byte[] GetValue(int index) + { + byte[] int_tmp = new byte[sizeof(int)]; + byte[] ret_array; + ColumnType type; + int size, read_len; + + MoveToColumn(index); + + read_len = _fs.Read(int_tmp, 0, int_tmp.Length); + if (read_len != int_tmp.Length) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Column Type " + index.ToString()); + } + + type = (ColumnType)BitConverter.ToInt32(int_tmp, 0); + + if (type != _columnTypes[index]) + { + if ((int)type == ColumnTypeNull && + (_columnTypes[index] == ColumnType.ColumnTypeBlob || _columnTypes[index] == ColumnType.ColumnTypeString)) + { + return null; /* null type */ + } + + ErrorFactory.ThrowException(ResultType.IoError, true, "Type mismatch " + index.ToString()); + } + + read_len = _fs.Read(int_tmp, 0, int_tmp.Length); + if (read_len != int_tmp.Length) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Column size " + index.ToString()); + } + + size = BitConverter.ToInt32(int_tmp, 0); + + if (size < 0) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Invalid data size " + index.ToString()); + } + + ret_array = new byte[size]; + read_len = _fs.Read(ret_array, 0, ret_array.Length); + if (read_len != ret_array.Length) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Column value size " + index.ToString()); + return null; + } + + return ret_array; + } + + private void MoveToColumn(int ColumnIndex) + { + int i, tmp_position; + byte[] int_tmp = new byte[sizeof(int)]; + int read_len; + long seek_len; + + seek_len = _fs.Seek(_rowFieldOffset[_currentRowIndex], SeekOrigin.Begin); + if (seek_len != _rowFieldOffset[_currentRowIndex]) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Row index " + _currentRowIndex.ToString()); + } + + for (i = 0; i < ColumnIndex; i++) + { + /* type(int) size(int) value */ + switch (_columnTypes[i]) + { + case ColumnType.ColumnTypeInt: + tmp_position = sizeof(int) * 2 + sizeof(Int64); + _fs.Seek(tmp_position, SeekOrigin.Current); + break; + case ColumnType.ColumnTypeDouble: + tmp_position = sizeof(int) * 2 + sizeof(double); + _fs.Seek(tmp_position, SeekOrigin.Current); + break; + case ColumnType.ColumnTypeString: + tmp_position = sizeof(int); + _fs.Seek(tmp_position, SeekOrigin.Current); + read_len = _fs.Read(int_tmp, 0, int_tmp.Length); + if (read_len != int_tmp.Length) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Column Index " + ColumnIndex.ToString()); + } + + tmp_position = BitConverter.ToInt32(int_tmp, 0); + + if (tmp_position > 0) + { + _fs.Seek(tmp_position, SeekOrigin.Current); + } + + break; + case ColumnType.ColumnTypeBlob: + tmp_position = sizeof(int); + _fs.Seek(tmp_position, SeekOrigin.Current); + + read_len = _fs.Read(int_tmp, 0, int_tmp.Length); + if (read_len != int_tmp.Length) + { + ErrorFactory.ThrowException(ResultType.IoError, true, "Column Index " + ColumnIndex.ToString()); + } + + tmp_position = BitConverter.ToInt32(int_tmp, 0); + + if (tmp_position > 0) + { + _fs.Seek(tmp_position, SeekOrigin.Current); + } + + break; + } + } + + } + + internal FileStream GetFileStream() + { + return _fs; + } + + /// + /// Gets column count of MatrixCursor. + /// + public int GetColumnCount() + { + return _columnTypes.Length; + } + + /// + /// Returns the column type at the given zero-based column index. + /// + /// Target column index + /// Thrown in case of Invalid parmaeter. + public ColumnType GetColumnType(int index) + { + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + return _columnTypes[index]; + } + + /// + /// Returns the column name at the given zero-based column index. + /// + /// Target column index + /// Thrown in case of Invalid parmaeter. + public string GetColumnName(int index) + { + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + return _columnNames[index]; + } + + /// + /// Gets MatrixCursor's row count. + /// + public long GetRowCount() + { + return _rowCount; + } + + /// + /// Move the MatrixCursor to the next row. + /// + public bool Next() + { + if (_currentRowIndex >= _rowCount - 1) + { + return false; + } + + _currentRowIndex++; + return true; + } + + /// + /// Move the MatrixCursor to the previous row. + /// + public bool Prev() + { + if (_currentRowIndex <= 0) + { + return false; + } + + _currentRowIndex--; + return true; + } + + /// + /// Move the MatrixCursor to the first row. + /// + public bool Reset() + { + _currentRowIndex = 0; + return true; + } + + /// + /// Returns the value of the requested column as a int. + /// + /// Thrown in case of Invalid parmaeter. + public int GetIntValue(int index) + { + int ret; + byte[] byte_array; + + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + byte_array = GetValue(index); + if (byte_array == null) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + ret = BitConverter.ToInt32(byte_array, 0); + + return ret; + } + + /// + /// Returns the value of the requested column as a int64. + /// + /// Thrown in case of Invalid parmaeter. + public Int64 GetInt64Value(int index) + { + Int64 ret; + byte[] byte_array; + + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + byte_array = GetValue(index); + if (byte_array == null) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + ret = BitConverter.ToInt64(byte_array, 0); + + return ret; + } + + /// + /// Returns the value of the requested column as a double. + /// + /// Thrown in case of Invalid parmaeter. + public double GetDoubleValue(int index) + { + double ret; + byte[] byte_array; + + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + byte_array = GetValue(index); + if (byte_array == null) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + ret = BitConverter.ToDouble(byte_array, 0); + + return ret; + } + + /// + /// Returns the value of the requested column as a string. + /// + /// Thrown in case of Invalid parmaeter. + public string GetStringValue(int index) + { + string ret; + byte[] byte_array; + + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + byte_array = GetValue(index); + + if (byte_array == null) + { + return null; + } + + ret = Encoding.UTF8.GetString(byte_array).TrimEnd('\0'); + return ret; + + } + + /// + /// Returns the value of the requested column as a blob. + /// + /// Thrown in case of Invalid parmaeter. + public byte[] GetBlobValue(int index) + { + byte[] byte_array; + + if (index < 0 || index >= _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + byte_array = GetValue(index); + return byte_array; + } + + private static class FileManager + { + private static readonly string DATACONTROL_DIRECTORY = "/tmp/"; + private static Dictionary fileTable = new Dictionary(); + public static string OpenFileStream(int threadID) + { + string path; + int index; + + if (threadID < 0) + { + Log.Error(LogTag, "threadID is " + threadID.ToString()); + return null; + } + + if (fileTable.ContainsKey(threadID) == false) + { + fileTable.Add(threadID, 0); + } + + index = fileTable[threadID]; + index++; + fileTable[threadID] = index; + + path = DATACONTROL_DIRECTORY + Application.Current.ApplicationInfo.ApplicationId + "_" + Process.GetCurrentProcess().Id.ToString() + "_" + threadID.ToString() + "_" + index.ToString(); + + return path; + } + } + + /// + /// Initializes MatrixCursor class with columnNames and columnTypes. + /// + /// MatrixCursor's column name list + /// MatrixCursor's column type list + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of any internal error. + public MatrixCursor(string[] columnNames, ColumnType[] columnTypes) + { + byte[] byte_tmp, length_tmp, string_tmp; + int i, total_len_of_column_names = 0; + + if (columnNames == null || columnTypes == null || + (columnNames.Length != columnTypes.Length) || columnNames.Length < 1) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + for (i = 0; i < columnNames.Length; i++) + { + if (string.IsNullOrEmpty(columnNames[i])) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "columnNames index " + i.ToString()); + } + } + + for (i = 0; i < columnTypes.Length; i++) + { + if ( columnTypes[i] < ColumnType.ColumnTypeInt || columnTypes[i] > ColumnType.ColumnTypeBlob) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "columnTypes index" + i.ToString()); + } + } + + _columnNames = columnNames; + _columnTypes = columnTypes; + + _cursorPath = FileManager.OpenFileStream(Thread.CurrentThread.ManagedThreadId); + if (_cursorPath == null) + { + Log.Error(LogTag, "Unable to create a cursor file : " + _cursorPath); + ErrorFactory.ThrowException(ResultType.IoError, true); + } + + _fs = new FileStream(_cursorPath, FileMode.Create); + /* column count */ + byte_tmp = BitConverter.GetBytes(columnNames.Length); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + + /* column type */ + for (i = 0; i < columnTypes.Length; i++) + { + byte_tmp = BitConverter.GetBytes((int)_columnTypes[i]); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + } + + /* column name */ + for (i = 0; i < columnTypes.Length; i++) + { + string_tmp = Encoding.UTF8.GetBytes(columnNames[i]); + byte_tmp = new byte[string_tmp.Length + 1];/*insert null */ + + string_tmp.CopyTo(byte_tmp, 0); + + length_tmp = BitConverter.GetBytes(byte_tmp.Length); + total_len_of_column_names += length_tmp.Length; + + _fs.Write(length_tmp, 0, length_tmp.Length); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + } + + /* total length of column names */ + byte_tmp = BitConverter.GetBytes(total_len_of_column_names); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + + _rowCountPosition = _fs.Position; + /* row count */ + byte_tmp = BitConverter.GetBytes(_rowCount); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + _fs.Flush(); + } + + internal MatrixCursor() + { + _columnNames = new string[0]; + _columnTypes = new ColumnType[0]; + _fs = null; + _cursorPath = null; + } + + /// + /// Adds a new row to the end with the given column values. + /// + /// New column values + /// Thrown in case of Invalid parmaeter. + public void AddRow(object[] columnValues) + { + int i, size = 0; + byte[] type_array, length_array, value_array = null, string_array, byte_tmp; + + if (columnValues == null || columnValues.Length <= 0 || columnValues.Length != _columnTypes.Length) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false); + } + + using (MemoryStream ms = new MemoryStream()) + { + for (i = 0; i < _columnTypes.Length; i++) + { + type_array = BitConverter.GetBytes((int)_columnTypes[i]); + switch (_columnTypes[i]) + { + case ColumnType.ColumnTypeInt: + if (!(columnValues[i] is Int64) && !(columnValues[i] is Int32)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "Type mismatch :Index " + i.ToString()); + } + + value_array = BitConverter.GetBytes(Convert.ToUInt64(columnValues[i])); + size = value_array.Length; + break; + case ColumnType.ColumnTypeDouble: + if (!(columnValues[i] is Double)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "Type mismatch :Index " + i.ToString()); + } + + value_array = BitConverter.GetBytes(Convert.ToDouble(columnValues[i])); + size = value_array.Length; + break; + case ColumnType.ColumnTypeString: + if (columnValues[i] == null) + { + type_array = BitConverter.GetBytes(ColumnTypeNull); + size = 0; + break; + } + + if (!(columnValues[i] is string)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "Type mismatch :Index " + i.ToString()); + } + + string_array = Encoding.UTF8.GetBytes(Convert.ToString(columnValues[i])); + value_array = new byte[string_array.Length + 1];/*insert null */ + string_array.CopyTo(value_array, 0); + size = value_array.Length; + break; + + case ColumnType.ColumnTypeBlob: + if (columnValues[i] == null) + { + type_array = BitConverter.GetBytes(ColumnTypeNull); + size = 0; + break; + } + + if (!(columnValues[i] is byte[])) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "Type mismatch :Index " + i.ToString()); + } + + value_array = (byte[])columnValues[i]; + size = value_array.Length; + break; + } + + ms.Write(type_array, 0, type_array.Length); + + length_array = BitConverter.GetBytes(size); + ms.Write(length_array, 0, length_array.Length); + if (size > 0) + { + ms.Write(value_array, 0, value_array.Length); + } + } + + /* update row count */ + _rowCount++; + byte_tmp = BitConverter.GetBytes(_rowCount); + _fs.Seek(_rowCountPosition, SeekOrigin.Begin); + _fs.Write(byte_tmp, 0, byte_tmp.Length); + + _fs.Seek(0, SeekOrigin.End); + + _rowFieldOffset.Add(_fs.Position); + ms.WriteTo(_fs);/* row data */ + _fs.Flush(); + + Log.Debug(LogTag, "_fs pos = " + _fs.Position.ToString()); + Log.Debug(LogTag, "_fs len = " + _fs.Length.ToString()); + } + } + + /// + /// Releases all resources used by the MatrixCursor class. + /// + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (!string.IsNullOrEmpty(_cursorPath)) + { + FileInfo fi = new FileInfo(_cursorPath); + + if (_fs != null) + { + _fs.Dispose(); + } + + if (fi.Exists) + { + fi.Delete(); + } + } + + _disposed = true; + } + + if (disposing) + { + GC.SuppressFinalize(this); + } + } + + ~MatrixCursor() + { + Dispose(false); + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Provider.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Provider.cs new file mode 100755 index 0000000..72a1142 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Provider.cs @@ -0,0 +1,1091 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using Tizen.Applications.DataControl; +using System.Runtime.InteropServices; +using System.Threading; + +namespace Tizen.Applications.DataControl +{ + /// + /// Represents Provider class for DataControl provider application. + /// + public abstract class Provider : IDisposable + { + private const string LogTag = "Tizen.Applications.DataControl"; + private static IDictionary _providerDict = new Dictionary(); + private static Interop.DataControl.SqlRequestCallbacks _sqlRequestCallbacks; + private static Interop.DataControl.MapRequestCallbacks _mapRequestCallbacks; + private IntPtr _nativeHandle; + private static Interop.DataControl.DataChangeConsumerFilterCb _filterCallback; + private static int _filterCallbackID; + private static bool _filterRegistered; + private static Interop.DataControl.SqlBulkInsertRequestCallback _sqlBulkCallback; + private static Interop.DataControl.MapBulkAddRequestCallback _mapBulkCallback; + private static Mutex _lock = new Mutex(); + private bool _disposed = false; + private bool _isRunning = false; + + /// + /// Gets the data ID + /// + public string DataID + { + get; + private set; + } + + private static bool DataChangeListenFilter(IntPtr handlePtr, string consumerAppid, IntPtr userData) + { + Provider provider; + DataChangeListenResult result; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return false; + } + + result = provider.OnDataChangeListenRequest(consumerAppid); + if (result == null || result.Result != ResultType.Success) + { + return false; + } + else + { + return true; + } + } + + private enum OperationType : short + { + Select, + Update, + Insert, + Delete + } + + private static string CreateSelectQuery(IntPtr handlePtr, string[] columnList, int columnCount, string where, string order, int pageNum, int countPerPage) + { + Interop.DataControl.SafeDataControlHandle handle = new Interop.DataControl.SafeDataControlHandle(handlePtr, false); + string query = "SELECT"; + string dataId; + if (columnList == null) + { + query += " * "; + } + else + { + for (int i = 0; i < columnCount; i++) + { + if (i != 0) + { + query += ","; + } + + query += " " + columnList[i]; + } + } + + Interop.DataControl.DataControlGetDataId(handle, out dataId); + query += " FROM " + dataId; + if (where != null) + { + query += " WHERE " + where; + } + + if (order != null) + { + query += " ORDER BY " + order; + } + + if (pageNum != 0) + { + query += " LIMIT " + countPerPage + " OFFSET " + (countPerPage * (pageNum - 1)); + } + handle.Dispose(); + return query; + } + + private static void InsertRequest(int requestId, IntPtr handlePtr, IntPtr insertData, IntPtr userData) + { + Provider provider; + InsertResult result; + SafeBundleHandle sbh = new SafeBundleHandle(insertData, false); + string query = GetQuery(handlePtr, sbh, null, OperationType.Update); + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return; + } + + result = provider.OnInsert(query, new Bundle(sbh)); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendInsertResult(requestId, result.RowID); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendInsertResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"InsertResult is null : {requestId.ToString()}"); + } + } + + private static void BulkInsertRequest(int requestId, IntPtr handlePtr, IntPtr bulk_data, IntPtr userData) + { + Provider provider; + BulkInsertResult result; + BulkData bulkData = new BulkData(new Interop.DataControl.SafeBulkDataHandle(bulk_data, false)); + Interop.DataControl.SafeBulkDataHandle sbdh = bulkData.SafeBulkDataHandle; + IntPtr bundleHandel; + ResultType ret; + + int count = bulkData.GetCount(); + List queryList = new List(); + + for (int i = 0; i < count; i++) + { + Interop.DataControl.BulkGetData(sbdh, i, out bundleHandel); + queryList.Add(GetQuery(handlePtr, new SafeBundleHandle(bundleHandel, false), null, OperationType.Insert)); + } + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return; + } + + result = provider.OnBulkInsert(queryList, bulkData); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendBulkInsertResult(requestId, result.BulkResultData.SafeBulkDataHandle); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendBulkInsertResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + + if (result.BulkResultData != null) + { + result.BulkResultData.Dispose(); + } + } + else + { + Log.Info(LogTag, $"BulkInsertResult is null : {requestId.ToString()}"); + } + } + + private static void SendNativeProtocol(int socketFd, ICursor cursor, int requestId) + { + uint write_len; + int DATACONTROL_RESULT_NO_DATA = -1; + int COLUMN_TYPE_NULL = 5; + int column_count, i, rowcount, size = 0, total_len_of_column_names = 0; + byte[] type_array, length_array, string_array, int_tmp, value_array = null; + string txt; + ResultType result; + MemoryStream ms; + + if (cursor.Reset() == false) + { + Log.Error(LogTag, "Reset is failed : " + requestId.ToString()); + return; + } + + if (cursor.GetRowCount() <= 0) + { + Log.Error(LogTag, "The DB does not have another row : " + requestId.ToString()); + int_tmp = BitConverter.GetBytes(DATACONTROL_RESULT_NO_DATA); + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, int_tmp, int_tmp.Length, out write_len); + return; + } + + /* 1. column count */ + column_count = cursor.GetColumnCount(); + int_tmp = BitConverter.GetBytes(column_count); + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, int_tmp, int_tmp.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a column_count to a file descriptor is failed."); + return; + } + + Log.Info(LogTag, "Writing a column_count " + column_count.ToString()); + + /* 2.column type x column_count */ + for (i = 0; i < column_count; i++) + { + type_array = BitConverter.GetBytes((int)cursor.GetColumnType(i)); + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, type_array, type_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a type to a file descriptor is failed."); + return; + } + + Log.Info(LogTag, "Writing a column_type " + cursor.GetColumnType(i).ToString()); + } + + /* 3. column name x column_count */ + for (i = 0; i < column_count; i++) + { + Log.Info(LogTag, "Writing a name " + cursor.GetColumnName(i)); + + total_len_of_column_names += cursor.GetColumnName(i).Length; + string_array = Encoding.UTF8.GetBytes(cursor.GetColumnName(i)); + value_array = new byte[string_array.Length + 1];/*insert null */ + string_array.CopyTo(value_array, 0); + length_array = BitConverter.GetBytes(value_array.Length); + + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, length_array, length_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a type to a file descriptor is failed."); + return; + } + + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, value_array, value_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a type to a file descriptor is failed."); + return; + } + + } + + /* 4. total length of column names */ + length_array = BitConverter.GetBytes(total_len_of_column_names); + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, length_array, length_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a total_len_of_column_names to a file descriptor is failed"); + return; + } + + Log.Info(LogTag, "Writing total length of column namese " + total_len_of_column_names.ToString()); + + /* 5. row count */ + length_array = BitConverter.GetBytes(cursor.GetRowCount()); + Log.Error(LogTag, "=========================== select rowcount " + cursor.GetRowCount().ToString()); + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, length_array, length_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a row count to a file descriptor is failed"); + return; + } + + Log.Error(LogTag, "Writing a row count " + cursor.GetRowCount().ToString()); + + rowcount = 0; + do + { + ms = new MemoryStream(); + + for (i = 0; i < column_count; i++) + { + type_array = BitConverter.GetBytes((int)cursor.GetColumnType(i)); + switch (cursor.GetColumnType(i)) + { + case ColumnType.ColumnTypeInt: + value_array = BitConverter.GetBytes(cursor.GetInt64Value(i)); + size = value_array.Length; + break; + + case ColumnType.ColumnTypeDouble: + value_array = BitConverter.GetBytes(cursor.GetDoubleValue(i)); + size = value_array.Length; + break; + + case ColumnType.ColumnTypeString: + txt = cursor.GetStringValue(i); + if (txt == null) + { + type_array = BitConverter.GetBytes(COLUMN_TYPE_NULL); + size = 0; + break; + } + + string_array = Encoding.UTF8.GetBytes(txt); + value_array = new byte[string_array.Length + 1];/*insert null */ + string_array.CopyTo(value_array, 0); + size = value_array.Length; + break; + + case ColumnType.ColumnTypeBlob: + int_tmp = cursor.GetBlobValue(i); + if (int_tmp == null) + { + type_array = BitConverter.GetBytes(COLUMN_TYPE_NULL); + size = 0; + break; + } + + value_array = int_tmp; + size = value_array.Length; + break; + } + + ms.Write(type_array, 0, type_array.Length); + + length_array = BitConverter.GetBytes(size); + ms.Write(length_array, 0, length_array.Length); + if (size > 0) + { + ms.Write(value_array, 0, value_array.Length); + } + } + + value_array = ms.ToArray(); + + result = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, value_array, value_array.Length, out write_len); + if (result != ResultType.Success) + { + Log.Error(LogTag, "Writing a row to a file descriptor is failed"); + ms.Dispose(); + return; + } + + ms.Dispose(); + Log.Info(LogTag, "row_count ~~~~ ", rowcount.ToString()); + + } + while (cursor.Next()); + } + + private static void SelectRequest(int requestId, + IntPtr handlePtr, IntPtr columnList, int columnCount, string where, string order, IntPtr userData) + { + Provider provider; + SelectResult result; + int pageNum = 0; + int countPerPage = 0; + int MAX_WRITE_SIZE = 1024; /* 1kbyte */ + string query = null; + int socketFd, write_size, i; + uint write_len; + ResultType ret; + string[] _columnList = new string[columnCount]; + byte[] buffer; + + unsafe + { + byte** _sbyte_columnList = (byte**)columnList; + + for (i = 0; i < columnCount; i++) + { + _columnList[i] = Marshal.PtrToStringAnsi((IntPtr)_sbyte_columnList[i]); + } + } + + Interop.DataControl.GetSelectPageInfo(requestId, out pageNum, out countPerPage); + query = CreateSelectQuery(handlePtr, _columnList, _columnList.Length, where, order, pageNum, countPerPage); + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return; + } + + result = provider.OnSelect(query, where, _columnList, _columnList.Length, order, pageNum, countPerPage); + if (result != null) + { + if (result.Result) + { + Interop.DataControl.SendSelectResult(requestId, out socketFd); + + MatrixCursor mc = result.ResultCursor as MatrixCursor; + + if (mc == null) + { + SendNativeProtocol(socketFd, result.ResultCursor, requestId); + } + else + { + FileStream fs = mc.GetFileStream(); + fs.Seek(0, SeekOrigin.Begin); + + buffer = new byte[MAX_WRITE_SIZE]; + + do + { + write_size = fs.Read(buffer, 0, MAX_WRITE_SIZE); + + if (write_size > 0) + { + ret = (ResultType)Interop.DataControl.UnsafeCode.WriteResult(socketFd, buffer, write_size, out write_len); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "Writing a row to a file descriptor is failed"); + mc.Dispose(); + return; + } + } + } + while (write_size > 0); + mc.Dispose(); + } + + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"SelectResult is null : {requestId.ToString()}"); + } + } + + private static void UpdateRequest(int requestId, + IntPtr handlePtr, IntPtr updateData, string where, IntPtr userData) + { + Provider provider; + UpdateResult result; + SafeBundleHandle sbh = new SafeBundleHandle(updateData, false); + string query = GetQuery(handlePtr, sbh, where, OperationType.Update); + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return; + } + + result = provider.OnUpdate(query, where, new Bundle(sbh)); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendUpdateResult(requestId); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendUpdateResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"UpdateResult is null : {requestId.ToString()}"); + } + } + + private static void DeleteRequest(int requestId, + IntPtr handlePtr, string where, IntPtr userData) + { + Provider provider; + DeleteResult result; + string query = GetQuery(handlePtr, null, where, OperationType.Delete); + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist "); + return; + } + + result = provider.OnDelete(query, where); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendDeleteResult(requestId); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendDeleteResult fail " + ret.ToString()); + } + + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"DeleteResult is null : {requestId.ToString()}"); + } + } + + private static void MapAddRequest(int requestId, IntPtr handlePtr, string key, string value, IntPtr userData) + { + Provider provider; + MapAddResult result; + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist"); + return; + } + + result = provider.OnMapAdd(key, value); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendMapResult(requestId); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendMapResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"MapAddResult is null : {requestId.ToString()}"); + } + } + + private static void MapSetRequest(int requestId, IntPtr handlePtr, string key, string oldValue, string newValue, IntPtr userData) + { + Provider provider; + MapSetResult result; + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist"); + return; + } + + result = provider.OnMapSet(key, oldValue, newValue); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendMapResult(requestId); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendMapResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"MapSetResult is null : {requestId.ToString()}"); + } + } + + private static void MapRemoveRequest(int requestId, IntPtr handlePtr, string key, string value, IntPtr userData) + { + Provider provider; + MapRemoveResult result; + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist"); + return; + } + + result = provider.OnMapRemove(key, value); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendMapResult(requestId); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendMapResult fail " + ret.ToString()); + } + + } + else + { + ret = Interop.DataControl.SendError(requestId, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"MapRemoveRequest is null : {requestId.ToString()}"); + } + } + + private static void MapGetRequest(int requestID, IntPtr handlePtr, string key, IntPtr userData) + { + Provider provider; + MapGetResult result; + ResultType ret; + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist"); + return; + } + + result = provider.OnMapGet(key); + if (result != null) + { + if (result.Result) + { + int valueCount = 0; + if (result.ValueList != null) + valueCount = result.ValueList.Length; + ret = Interop.DataControl.SendMapGetResult(requestID, result.ValueList, valueCount); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendMapGetResult fail " + ret.ToString()); + } + + } + else + { + ret = Interop.DataControl.SendError(requestID, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + } + else + { + Log.Info(LogTag, $"MapRemoveRequest is null : {requestID.ToString()}"); + } + } + + private static void MapBulkAddRequest(int requestID, IntPtr handlePtr, IntPtr bulkDataPtr, IntPtr userData) + { + Provider provider; + MapBulkAddResult result; + BulkData bulkData = new BulkData(new Interop.DataControl.SafeBulkDataHandle(bulkDataPtr, false)); + Interop.DataControl.SafeBulkDataHandle sbdh = bulkData.SafeBulkDataHandle; + IntPtr bundleHandel; + int count = bulkData.GetCount(); + List queryList = new List(); + ResultType ret; + + for (int i = 0; i < count; i++) + { + Interop.DataControl.BulkGetData(sbdh, i, out bundleHandel); + queryList.Add(GetQuery(handlePtr, new SafeBundleHandle(bundleHandel, false), null, OperationType.Insert)); + } + + provider = GetProvider(handlePtr); + if (provider == null) + { + Log.Error(LogTag, "Provider not exist"); + return; + } + + result = provider.OnMapBulkAdd(bulkData); + if (result != null) + { + if (result.Result) + { + ret = Interop.DataControl.SendMapBulkAddResult(requestID, result.BulkResultData.SafeBulkDataHandle); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendMapBulkAddResult fail " + ret.ToString()); + } + } + else + { + ret = Interop.DataControl.SendError(requestID, result.Result.ToString()); + if (ret != ResultType.Success) + { + Log.Error(LogTag, "SendError fail " + ret.ToString()); + } + } + + if (result.BulkResultData != null) + { + result.BulkResultData.Dispose(); + } + } + else + { + Log.Info(LogTag, $"MapBulkAddRequest is null : {requestID.ToString()}"); + } + } + + private static string GetQuery(IntPtr handlePtr, SafeBundleHandle data, string where, OperationType type) + { + Interop.DataControl.SafeDataControlHandle handle = new Interop.DataControl.SafeDataControlHandle(handlePtr, false); + string query = null; + + switch (type) + { + case OperationType.Select: + break; + case OperationType.Update: + query = Interop.DataControl.CreateUpdateStatement(handle, data, where); + break; + case OperationType.Delete: + query = Interop.DataControl.CreateDeleteStatement(handle, where); + break; + case OperationType.Insert: + query = Interop.DataControl.CreateInsertStatement(handle, data); + break; + default: + break; + } + handle.Dispose(); + + return query; + } + + private static Provider GetProvider(IntPtr handlePtr) + { + Interop.DataControl.SafeDataControlHandle handle = new Interop.DataControl.SafeDataControlHandle(handlePtr, false); + Provider provider = null; + string dataID; + + Interop.DataControl.DataControlGetDataId(handle, out dataID); + if (dataID != null && _providerDict.ContainsKey(dataID)) + { + provider = _providerDict[dataID]; + provider._nativeHandle = handlePtr; + Log.Info(LogTag, "DataID :" + dataID + ", hash code : " + provider.GetHashCode().ToString()); + } + handle.Dispose(); + + return provider; + } + + /// + /// Sends a data change notification to consumer applications which have successfully added a data change listen. + /// + /// Changed data type + /// Customized information about changed data + /// Thrown in case of Invalid parmaeter. + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + public void SendDataChange(ChangeType type, Bundle changedData) + { + ResultType ret; + + if (changedData == null || changedData.SafeBundleHandle.IsInvalid) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "changedData"); + } + + if (this._nativeHandle == IntPtr.Zero) + { + return; + } + + ret = Interop.DataControl.SendDataChange(this._nativeHandle, type, changedData.SafeBundleHandle); + if (ret != ResultType.Success) + { + ErrorFactory.ThrowException(ret, false); + } + } + + /// + /// Initializes Provider class with dataID. + /// + /// DataControl Data ID + /// Thrown in case of Invalid parmaeter. + public Provider(string dataID) + { + if (string.IsNullOrEmpty(dataID)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "dataID"); + } + + DataID = dataID; + } + + /// + /// Starts Provider service. + /// + /// Only one Provider service can be ran for each process + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/datasharing + public void Run() + { + ResultType ret; + _lock.WaitOne(); + if (_providerDict.ContainsKey(DataID)) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException((ResultType)1, true, "The provider is already running"); + return; + } + + if (_providerDict.Count == 0) + { + Log.Debug(LogTag, "Provider create"); + + _sqlRequestCallbacks.Insert = new Interop.DataControl.SqlInsertRequestCallback(InsertRequest); + _sqlRequestCallbacks.Select = new Interop.DataControl.SqlSelectRequestCallback(SelectRequest); + _sqlRequestCallbacks.Update = new Interop.DataControl.SqlUpdateRequestCallback(UpdateRequest); + _sqlRequestCallbacks.Delete = new Interop.DataControl.SqlDeleteRequestCallback(DeleteRequest); + + ret = Interop.DataControl.RegisterSqlRequest(ref _sqlRequestCallbacks, IntPtr.Zero); + if (ret != ResultType.Success) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException(ret, false); + } + + _sqlBulkCallback = new Interop.DataControl.SqlBulkInsertRequestCallback(BulkInsertRequest); + ret = Interop.DataControl.RegisterSqlBulkRequest(_sqlBulkCallback, IntPtr.Zero); + if (ret != ResultType.Success) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException(ret, false); + } + + _mapRequestCallbacks.Add = new Interop.DataControl.MapAddRequestCallback(MapAddRequest); + _mapRequestCallbacks.Remove = new Interop.DataControl.MapRemoveRequestCallback(MapRemoveRequest); + _mapRequestCallbacks.Set = new Interop.DataControl.MapSetRequestCallback(MapSetRequest); + _mapRequestCallbacks.Get = new Interop.DataControl.MapGetRequestCallback(MapGetRequest); + ret = Interop.DataControl.RegisterMapRequest(ref _mapRequestCallbacks, IntPtr.Zero); + if (ret != ResultType.Success) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException(ret, false); + } + + _mapBulkCallback = new Interop.DataControl.MapBulkAddRequestCallback(MapBulkAddRequest); + ret = Interop.DataControl.RegisterMapBulkRequest(_mapBulkCallback, IntPtr.Zero); + if (ret != ResultType.Success) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException(ret, false); + } + + if (_filterRegistered == false) + { + if (_filterCallback == null) + _filterCallback = new Interop.DataControl.DataChangeConsumerFilterCb(DataChangeListenFilter); + + ret = Interop.DataControl.AddDataChangeConsumerFilterCallback( + _filterCallback, + IntPtr.Zero, out _filterCallbackID); + + if (ret != ResultType.Success) + { + _lock.ReleaseMutex(); + ErrorFactory.ThrowException(ret, false); + } + } + + _filterRegistered = true; + } + + _providerDict.Add(DataID, this); + Log.Info(LogTag, "DataID :" + DataID + ", hash code : " + this.GetHashCode().ToString()); + _isRunning = true; + _lock.ReleaseMutex(); + } + + /// + /// Stop Provider service. + /// + public void Stop() + { + if (_isRunning == true) + { + Log.Info(LogTag, "DataID :" + DataID); + _isRunning = false; + _providerDict.Remove(DataID); + } + } + + ~Provider() + { + Dispose(false); + } + + /// + /// Overrides this method if want to handle behavior when the select request is received. + /// + protected abstract SelectResult OnSelect(string query, string where, string[] columList, int columnCount, string order, int pageNum, int countPerPage); + + /// + /// Overrides this method if want to handle behavior when the insert request is received. + /// + protected abstract InsertResult OnInsert(string query, Bundle insertData); + + /// + /// Overrides this method if want to handle behavior when the update request is received. + /// + protected abstract UpdateResult OnUpdate(string query, string where, Bundle updateData); + + /// + /// Overrides this method if want to handle behavior when the delete request is received. + /// + protected abstract DeleteResult OnDelete(string query, string where); + + /// + /// Overrides this method if want to handle behavior when the bulk insert request is received. + /// + protected virtual BulkInsertResult OnBulkInsert(IEnumerable query, BulkData bulkInsertData) + { + Log.Info(LogTag, "The OnBulkInsert is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the map get request is received. + /// + protected virtual MapGetResult OnMapGet(string key) + { + Log.Info(LogTag, "The OnMapGet is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the map add request is received. + /// + protected virtual MapAddResult OnMapAdd(string key, string value) + { + Log.Info(LogTag, "The OnMapAdd is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the update request is received. + /// + protected virtual MapSetResult OnMapSet(string key, string oldValue, string newValue) + { + Log.Info(LogTag, "The OnMapSet is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the delete request is received. + /// + protected virtual MapRemoveResult OnMapRemove(string key, string value) + { + Log.Info(LogTag, "The OnMapRemove is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the bulk add request is received. + /// + protected virtual MapBulkAddResult OnMapBulkAdd(BulkData bulkAddData) + { + Log.Info(LogTag, "The OnMapBulkAdd is not implemented."); + return null; + } + + /// + /// Overrides this method if want to handle behavior when the data change listen request is received. + /// + protected virtual DataChangeListenResult OnDataChangeListenRequest(string requestAppID) + { + Log.Info(LogTag, "The OnDataChangeListenRequest is not implemented."); + return null; + } + + /// + /// Releases the unmanaged resourced used by the Provider class specifying whether to perform a normal dispose operation. + /// + /// true for a normal dispose operation; false to finalize the handle. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + Stop(); + _disposed = true; + } + if (disposing) + { + GC.SuppressFinalize(this); + } + } + + /// + /// Releases all resources used by the Provider class. + /// + public void Dispose() + { + Dispose(true); + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Results.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Results.cs new file mode 100755 index 0000000..81f63a5 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Results.cs @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications.DataControl +{ + /// + /// This class is for containing insert operation result. + /// + public class InsertResult + { + /// + /// Gets the insert data's row id. + /// + public long RowID + { + get; + private set; + } + + /// + /// Gets the insert operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes InsertResult class with columnNames and columnTypes. + /// + /// Inserted row ID + /// Insert request result + public InsertResult(long rowID, bool result) + { + RowID = rowID; + Result = result; + } + } + + /// + /// This class is for containing bulk insert operation result. + /// + public class BulkInsertResult + { + /// + /// Gets the bulk insert operation result data. + /// + public BulkResultData BulkResultData + { + get; + private set; + } + + /// + /// Gets the bulk insert operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes InsertResult class with bulkResultData and result. + /// + /// Bulk insert request result data + /// Bulk insert request result + /// Thrown in case of Invalid parmaeter. + public BulkInsertResult(BulkResultData bulkResultData, bool result) + { + if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "bulkResultData"); + } + + BulkResultData = bulkResultData; + Result = result; + } + } + + /// + /// This class is for containing update operation result. + /// + public class UpdateResult + { + /// + /// Gets the update operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes UpdateResult class with result. + /// + /// Update request result + public UpdateResult(bool result) + { + Result = result; + } + } + + /// + /// This class is for containing delete operation result. + /// + public class DeleteResult + { + /// + /// Gets the delete operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes DeleteResult class with result. + /// + /// Delete request result + public DeleteResult(bool result) + { + Result = result; + } + } + + /// + /// This class is for containing select operation result. + /// + public class SelectResult + { + /// + /// Gets the select operation result cursor. + /// + public ICursor ResultCursor + { + get; + private set; + } + /// + /// Gets the select operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes SelectResult class with cursor and result. + /// + /// Cursor with selected data + /// Select request result + /// Thrown in case of Invalid parmaeter. + public SelectResult(ICursor cursor, bool result) + { + int i; + + if (result == true && cursor == null) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "cursor"); + } + + if (result == true && (cursor is MatrixCursor) == false) + { + if (cursor.GetColumnCount() <= 0) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column count"); + } + + for (i = 0; i < cursor.GetColumnCount(); i++) + { + if (string.IsNullOrEmpty(cursor.GetColumnName(i))) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column name index " + i.ToString()); + } + + if (cursor.GetColumnType(i) < ColumnType.ColumnTypeInt || cursor.GetColumnType(i) > ColumnType.ColumnTypeBlob) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "column type index" + i.ToString()); + } + } + } + + ResultCursor = cursor; + Result = result; + } + } + + /// + /// This class is for containing MapAdd operation result. + /// + public class MapAddResult + { + + /// + /// Gets the MapAdd operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes MapAddResult class with result. + /// + /// MapAdd request result + public MapAddResult(bool result) + { + Result = result; + } + } + + /// + /// This class is for containing MapBulkAdd operation result. + /// + public class MapBulkAddResult + { + /// + /// Gets the MapBulkAdd operation result data. + /// + public BulkResultData BulkResultData + { + get; + private set; + } + + /// + /// Gets the MapBulkAdd operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes MapBulkAddResult class with bulkResultData and result. + /// + /// MapBulkAdd request result data + /// MapBulkAdd request result + /// Thrown in case of Invalid parmaeter. + public MapBulkAddResult(BulkResultData bulkResultData, bool result) + { + if (result == true && (bulkResultData == null || bulkResultData.SafeBulkDataHandle.IsInvalid)) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "bulkResultData"); + } + + BulkResultData = bulkResultData; + Result = result; + } + } + + /// + /// This class is for containing MapSet operation result. + /// + public class MapSetResult + { + /// + /// Gets the MapSet operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes MapSetResult class with result. + /// + /// MapSet request result + public MapSetResult(bool result) + { + Result = result; + } + } + + /// + /// This class is for containing MapRemove operation result. + /// + public class MapRemoveResult + { + /// + /// Gets the MapRemove operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes MapRemoveResult class with result. + /// + /// MapRemove request result + public MapRemoveResult(bool result) + { + Result = result; + } + } + + /// + /// This class is for containing MapGet operation result. + /// + public class MapGetResult + { + /// + /// Gets the result value list of the MapGet operation. + /// + public string[] ValueList + { + get; + private set; + } + /// + /// Gets the MapGet operation result. + /// + public bool Result + { + get; + private set; + } + + /// + /// Initializes MapGetResult class with data and result. + /// + /// MapGet request result data + /// MapGet request result + /// Thrown in case of Invalid parmaeter. + public MapGetResult(string[] valueLIst, bool result) + { + if (result == true && valueLIst == null) + { + ErrorFactory.ThrowException(ResultType.InvalidParameter, false, "valueLIst"); + } + + ValueList = valueLIst; + Result = result; + } + } + + /// + /// This class is for containing DataChangeListen operation result. + /// + public class DataChangeListenResult + { + /// + /// Gets the DataChangeListen operation result. + /// + public ResultType Result + { + get; + private set; + } + + /// + /// Initializes DataChangeListenResult class with result. + /// + /// DataChangeListen request result + public DataChangeListenResult(ResultType result) + { + Result = result; + } + } +} diff --git a/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Types.cs b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Types.cs new file mode 100755 index 0000000..09d25a6 --- /dev/null +++ b/src/Tizen.Applications.DataControl/Tizen.Applications.DataControl/Types.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications.DataControl +{ + + /// + /// Enumeration for DataControl column type + /// + public enum ColumnType : short + { + /// + /// Value representing DataControl operation Success + /// + ColumnTypeInt = 1, + /// + /// Value representing DataControl operation Success + /// + ColumnTypeDouble = 2, + /// + /// Value representing DataControl operation Success + /// + ColumnTypeString = 3, + /// + /// Value representing DataControl operation Success + /// + ColumnTypeBlob = 4 + } + + /// + /// Enumeration for DataControl column type + /// + public enum ChangeType : short + { + /// + /// Value representing DataControl provider data changed by update + /// + Update, + /// + /// Value representing DataControl provider data changed by insert + /// + Insert, + /// + /// Value representing DataControl provider data changed by delete + /// + Delete, + /// + /// Value representing DataControl provider data changed by map add + /// + MapAdd, + /// + /// Value representing DataControl provider data changed by map remove + /// + MapRemove, + /// + /// Value representing DataControl provider data changed by map set + /// + MapSet, + } + + /// + /// Enumeration for DataControl result type + /// + public enum ResultType : int + { + /// + /// Value representing DataControl operation success + /// + Success = Interop.DataControl.NativeResultType.Success, + /// + /// Value representing DataControl operation cause out of memory error + /// + OutOfMemory = Interop.DataControl.NativeResultType.OutOfMemory, + /// + /// Value representing DataControl operation cause IO error + /// + IoError = Interop.DataControl.NativeResultType.IoError, + /// + /// Value representing DataControl operation cause Invalid parameter error + /// + InvalidParameter = Interop.DataControl.NativeResultType.InvalidParameter, + /// + /// Value representing DataControl operation cause permission denied error + /// + PermissionDenied = Interop.DataControl.NativeResultType.PermissionDenied, + /// + /// Value representing DataControl operation cause max exceed error + /// + MaxExceed = Interop.DataControl.NativeResultType.MaxExceed, + } +} diff --git a/src/Tizen.Applications.MessagePort/Interop/Interop.Libraries.cs b/src/Tizen.Applications.MessagePort/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..2b7e4da --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MessagePort = "libmessage-port.so.1"; + } +} diff --git a/src/Tizen.Applications.MessagePort/Interop/Interop.MessagePort.cs b/src/Tizen.Applications.MessagePort/Interop/Interop.MessagePort.cs new file mode 100755 index 0000000..bcbbc63 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Interop/Interop.MessagePort.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class MessagePort + { + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_register_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int RegisterPort(string local_port, message_port_message_cb callback, IntPtr userData); + + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_register_trusted_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int RegisterTrustedPort(string trusted_local_port, message_port_message_cb callback, IntPtr userData); + + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_unregister_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UnregisterPort(int local_port_id); + + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_unregister_trusted_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int UnregisterTrustedPort(int trusted_local_port_id); + + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_send_message_with_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SendMessageWithLocalPort(string remote_app_id, string remote_port, SafeBundleHandle message, int local_port_id); + + [DllImport(Libraries.MessagePort, EntryPoint = "message_port_send_trusted_message_with_local_port", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SendTrustedMessageWithLocalPort(string remote_app_id, string remote_port, SafeBundleHandle message, int local_port_id); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void message_port_message_cb(int local_port_id, string remote_app_id, string remote_port, bool trusted_remote_port, IntPtr message, IntPtr userData); + } +} diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.csproj b/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.sln b/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.sln new file mode 100755 index 0000000..c89ef69 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.MessagePort.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.MessagePort", "Tizen.Applications.MessagePort.csproj", "{D4D1B081-7D62-4FD7-B474-216527AFC076}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{C1AF9022-830D-4FEB-B308-050568624979}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{48373A14-DFEF-49CF-984F-7ED985EBF802}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{3CA3AD79-049D-42EB-B9A7-3C24BB418855}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D4D1B081-7D62-4FD7-B474-216527AFC076}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D4D1B081-7D62-4FD7-B474-216527AFC076}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D4D1B081-7D62-4FD7-B474-216527AFC076}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D4D1B081-7D62-4FD7-B474-216527AFC076}.Release|Any CPU.Build.0 = Release|Any CPU + {C1AF9022-830D-4FEB-B308-050568624979}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C1AF9022-830D-4FEB-B308-050568624979}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C1AF9022-830D-4FEB-B308-050568624979}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C1AF9022-830D-4FEB-B308-050568624979}.Release|Any CPU.Build.0 = Release|Any CPU + {48373A14-DFEF-49CF-984F-7ED985EBF802}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48373A14-DFEF-49CF-984F-7ED985EBF802}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48373A14-DFEF-49CF-984F-7ED985EBF802}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48373A14-DFEF-49CF-984F-7ED985EBF802}.Release|Any CPU.Build.0 = Release|Any CPU + {3CA3AD79-049D-42EB-B9A7-3C24BB418855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3CA3AD79-049D-42EB-B9A7-3C24BB418855}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3CA3AD79-049D-42EB-B9A7-3C24BB418855}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3CA3AD79-049D-42EB-B9A7-3C24BB418855}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePort.cs b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePort.cs new file mode 100755 index 0000000..26632e4 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePort.cs @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Applications; + +namespace Tizen.Applications.Messages +{ + /// + /// The Message Port API provides functions to send and receive messages between applications. + /// + /// + /// The Message Port API provides functions for passing messages between applications. An application should register its own local port to receive messages from remote applications. + /// If a remote application sends a message, the registered callback function of the local port is called. + /// The trusted message-port API allows communications between applications that are signed by the same developer(author) certificate. + /// + public class MessagePort : IDisposable + { + private static readonly object s_lock = new object(); + private static readonly HashSet s_portMap = new HashSet(); + + // The name of the local message port + private readonly string _portName = null; + + // If true the message port is a trusted port, otherwise false it is not + private readonly bool _trusted = false; + + // The local message port ID + private int _portId = 0; + + // If true the message port is listening, otherwise false it is not + private bool _listening = false; + + private Interop.MessagePort.message_port_message_cb _messageCallBack; + + /// + /// Initializes the instance of the MessagePort class. + /// + /// The name of the local message port + /// If true is the trusted message port of application, otherwise false + /// Thrown when portName is null or empty + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// + public MessagePort(string portName, bool trusted) + { + if (String.IsNullOrEmpty(portName)) + { + MessagePortErrorFactory.ThrowException((int)MessagePortError.InvalidParameter, "Invalid PortName", "PortName"); + } + _portName = portName; + _trusted = trusted; + } + + /// + /// Destructor of the MessagePort class. + /// + ~MessagePort() + { + Dispose(false); + } + + /// + /// Called when a message is received. + /// + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// messagePort.MessageReceived += MessageReceivedCallback; + /// static void MessageReceivedCallback(object sender, MessageReceivedEventArgs e) + /// { + /// Console.WriteLine("Message Received "); + /// if (e.Remote.AppId != null) { + /// Console.WriteLine("from :"+e.Remote.AppId); + /// } + /// } + /// + public event EventHandler MessageReceived; + + /// + /// The name of the local message port + /// + public string PortName + { + get + { + return _portName; + } + } + /// + /// If true the message port is a trusted port, otherwise false it is not + /// + public bool Trusted + { + get + { + return _trusted; + } + } + + /// + /// If true the message port is listening, otherwise false it is not + /// + public bool Listening + { + get + { + return _listening; + } + } + + /// + /// Register the local message port. + /// + /// Thrown when portName is already used, when there is an invalid parameter, when out of memory, when there is an I/O error + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// messagePort.MessageReceived += MessageReceivedCallback; + /// messagePort.Listen(); + /// + public void Listen() + { + lock (s_lock) + { + if (s_portMap.Contains(_portName)) + { + throw new InvalidOperationException(_portName + " is already used"); + } + _messageCallBack = (int localPortId, string remoteAppId, string remotePortName, bool trusted, IntPtr message, IntPtr userData) => + { + MessageReceivedEventArgs args = new MessageReceivedEventArgs() + { + Message = new Bundle(new SafeBundleHandle(message, false)) + }; + + if (!String.IsNullOrEmpty(remotePortName) && !String.IsNullOrEmpty(remoteAppId)) + { + args.Remote = new RemoteValues() + { + AppId = remoteAppId, + PortName = remotePortName, + Trusted = trusted + }; + } + MessageReceived?.Invoke(this, args); + }; + + _portId = _trusted ? + Interop.MessagePort.RegisterTrustedPort(_portName, _messageCallBack, IntPtr.Zero) : + Interop.MessagePort.RegisterPort(_portName, _messageCallBack, IntPtr.Zero); + + if (_portId <= 0) + throw new InvalidOperationException("Can't Listening with " + _portName); + + s_portMap.Add(_portName); + _listening = true; + } + } + + /// + /// Unregisters the local message port. + /// + /// Thrown when messageport is already stopped, when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// messagePort.MessageReceived += MessageReceivedCallback; + /// messagePort.Listen(); + /// using (var message = new Tizen.Application.Bundle()) + /// { + /// message.AddItem("message", "a_string"); + /// messagePort.Send(message, "ReceiverAppID", "ReceiverPort"); + /// } + /// messageProt.StopListening(); + /// + public void StopListening() + { + if (!_listening) + { + throw new InvalidOperationException("Already stopped"); + } + + int ret = _trusted ? + Interop.MessagePort.UnregisterTrustedPort(_portId) : + Interop.MessagePort.UnregisterPort(_portId); + + if (ret != (int)MessagePortError.None) + { + MessagePortErrorFactory.ThrowException(ret); + } + + lock (s_lock) + { + s_portMap.Remove(_portName); + } + _portId = 0; + _listening = false; + } + + /// + /// Sends a untrusted message to the message port of a remote application. + /// + /// The message to be passed to the remote application, the recommended message size is under 4KB + /// The ID of the remote application + /// The name of the remote message port + /// Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error + /// Thrown when message has exceeded the maximum limit(4KB) + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// messagePort.MessageReceived += MessageReceivedCallback; + /// messagePort.Listen(); + /// using (var message = new Tizen.Application.Bundle()) + /// { + /// message.AddItem("message", "a_string"); + /// messagePort.Send(message, "ReceiverAppID", "ReceiverPort"); + /// } + /// + public void Send(Bundle message, string remoteAppId, string remotePortName) + { + Send(message, remoteAppId, remotePortName, false); + } + + /// + /// Sends a message to the message port of a remote application. + /// + /// The message to be passed to the remote application, the recommended message size is under 4KB + /// The ID of the remote application + /// The name of the remote message port + /// If true the trusted message port of remote application otherwise false + /// Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error + /// Thrown when message has exceeded the maximum limit(4KB) + /// + /// MessagePort messagePort = new MessagePort("SenderPort", true); + /// messagePort.MessageReceived += MessageReceivedCallback; + /// messagePort.Listen(); + /// using (var message = new Tizen.Application.Bundle()) + /// { + /// message.AddItem("message", "a_string"); + /// messagePort.Send(message, "ReceiverAppID", "ReceiverPort", true); + /// } + /// + public void Send(Bundle message, string remoteAppId, string remotePortName, bool trusted) + { + if (!_listening) + { + throw new InvalidOperationException("Should start listen before send"); + } + if (message == null) + { + throw new ArgumentNullException("message"); + } + int ret = trusted ? + Interop.MessagePort.SendTrustedMessageWithLocalPort(remoteAppId, remotePortName, message.SafeBundleHandle, _portId) : + Interop.MessagePort.SendMessageWithLocalPort(remoteAppId, remotePortName, message.SafeBundleHandle, _portId); + + if (ret != (int)MessagePortError.None) + { + if (ret == (int)MessagePortError.MaxExceeded) + { + MessagePortErrorFactory.ThrowException(ret, "Message has exceeded the maximum limit(4KB)", "Message"); + } + MessagePortErrorFactory.ThrowException(ret, "Can't send message"); + } + } + + /// + /// Releases the unmanaged resourced used by the MessagePort class specifying whether to perform a normal dispose operation. + /// + /// true for a normal dispose operation; false to finalize the handle. + protected virtual void Dispose(bool disposing) + { + if (_listening) + { + try + { + StopListening(); + } + catch (Exception e) + { + Log.Warn(GetType().Namespace, "Exception in Dispose :" + e.Message); + } + } + } + + /// + /// Releases all resources used by the MessagePort class. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + } +} diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePortErrorFactory.cs b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePortErrorFactory.cs new file mode 100755 index 0000000..949d067 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessagePortErrorFactory.cs @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Applications.Messages +{ + internal enum MessagePortError + { + None = ErrorCode.None, + IOError = ErrorCode.IoError, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + PortNotFound = -0x01130000 | 0x01, + CertificateNotMatch = -0x01130000 | 0x02, + MaxExceeded = -0x01130000 | 0x03, + ResourceUnavailable = -0x01130000 | 0x04 + } + + internal static class MessagePortErrorFactory + { + internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null) + { + MessagePortError err = (MessagePortError)errorCode; + if (String.IsNullOrEmpty(errorMessage)) + { + errorMessage = err.ToString(); + } + switch ((MessagePortError)errorCode) + { + case MessagePortError.IOError: + case MessagePortError.OutOfMemory: + case MessagePortError.InvalidOperation: + case MessagePortError.PortNotFound: + case MessagePortError.ResourceUnavailable: throw new InvalidOperationException(errorMessage); + case MessagePortError.InvalidParameter: + case MessagePortError.CertificateNotMatch: throw new ArgumentException(errorMessage, paramName); + case MessagePortError.MaxExceeded: throw new ArgumentOutOfRangeException(paramName, errorMessage); + } + } + } +} diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessageReceivedEventArgs.cs b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessageReceivedEventArgs.cs new file mode 100755 index 0000000..cfe1762 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/MessageReceivedEventArgs.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Applications.Messages +{ + /// + /// An extended EventArgs class which contains remote message port information and message + /// + public class MessageReceivedEventArgs : EventArgs + { + /// + /// Contains AppId, Port Name, Trusted + /// + public RemoteValues Remote { get; internal set; } + + /// + /// The message passed from the remote application + /// + public Bundle Message { get; internal set; } + } +} diff --git a/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/RemoteValues.cs b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/RemoteValues.cs new file mode 100755 index 0000000..db853d3 --- /dev/null +++ b/src/Tizen.Applications.MessagePort/Tizen.Applications.Messages/RemoteValues.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Messages +{ + /// + /// Contains AppId, Port Name, Trusted + /// + public class RemoteValues + { + /// + /// The ID of the remote application that sent this message + /// + public string AppId { get; set; } + + /// + /// The name of the remote message port + /// + public string PortName { get; set; } + + /// + /// If true the remote port is a trusted port, otherwise if false it is not + /// + public bool Trusted { get; set; } + } +} diff --git a/src/Tizen.Applications.Notification/Interop/Interop.Libraries.cs b/src/Tizen.Applications.Notification/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..d5edebd --- /dev/null +++ b/src/Tizen.Applications.Notification/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Notification = "libnotification.so.0"; + } +} diff --git a/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs b/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs new file mode 100755 index 0000000..e865ab1 --- /dev/null +++ b/src/Tizen.Applications.Notification/Interop/Interop.Notification.cs @@ -0,0 +1,311 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; +using Tizen.Applications.Notifications; + +internal static partial class Interop +{ + internal static class Notification + { + [DllImport(Libraries.Notification, EntryPoint = "notification_create")] + internal static extern IntPtr Create(NotificationType type); + + [DllImport(Libraries.Notification, EntryPoint = "notification_free")] + internal static extern NotificationError Destroy(IntPtr handle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_text")] + internal static extern NotificationError GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_text")] + internal static extern NotificationError SetText(NotificationSafeHandle handle, NotificationText type, string text, string key, int args); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_image")] + internal static extern NotificationError GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_image")] + internal static extern NotificationError SetImage(NotificationSafeHandle handle, NotificationImage type, string path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_time")] + internal static extern NotificationError GetTime(NotificationSafeHandle handle, out int time); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_time")] + internal static extern NotificationError SetTime(NotificationSafeHandle handle, int time); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_insert_time")] + internal static extern NotificationError GetInsertTime(NotificationSafeHandle handle, out long time); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_sound")] + internal static extern NotificationError GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_sound")] + internal static extern NotificationError SetSound(NotificationSafeHandle handle, AccessoryOption type, string path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_vibration")] + internal static extern NotificationError GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_vibration")] + internal static extern NotificationError SetVibration(NotificationSafeHandle handle, AccessoryOption type, string path); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_led")] + internal static extern NotificationError GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_led")] + internal static extern NotificationError SetLed(NotificationSafeHandle handle, AccessoryOption type, int color); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_led_time_period")] + internal static extern NotificationError GetLedTimePeriod(NotificationSafeHandle handle, out int onMillisecond, out int offMillisecond); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_led_time_period")] + internal static extern NotificationError SetLedTimePeriod(NotificationSafeHandle handle, int onMillisecond, int offMillisecond); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_launch_option")] + internal static extern NotificationError GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle apphandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_launch_option")] + internal static extern NotificationError SetAppControl(NotificationSafeHandle handle, LaunchOption type, SafeAppControlHandle appHandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_event_handler")] + internal static extern NotificationError GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appHandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")] + internal static extern NotificationError SetEventHandler(NotificationSafeHandle handle, int type, SafeAppControlHandle appHandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_property")] + internal static extern NotificationError GetProperties(NotificationSafeHandle handle, out int flags); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_property")] + internal static extern NotificationError SetProperties(NotificationSafeHandle handle, int flags); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_display_applist")] + internal static extern NotificationError GetApplist(NotificationSafeHandle handle, out int flags); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_display_applist")] + internal static extern NotificationError SetApplist(NotificationSafeHandle handle, int flags); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_size")] + internal static extern NotificationError GetProgressSize(NotificationSafeHandle handle, out double size); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_size")] + internal static extern NotificationError SetProgressSize(NotificationSafeHandle handle, double size); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_progress")] + internal static extern NotificationError GetProgress(NotificationSafeHandle handle, out double progress); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_progress")] + internal static extern NotificationError SetProgress(NotificationSafeHandle handle, double progress); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_layout")] + internal static extern NotificationError GetLayout(NotificationSafeHandle handle, out NotificationLayout layout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_layout")] + internal static extern NotificationError SetLayout(NotificationSafeHandle handle, NotificationLayout layout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_type")] + internal static extern NotificationError GetType(NotificationSafeHandle handle, out NotificationType type); + + [DllImport(Libraries.Notification, EntryPoint = "notification_update")] + internal static extern NotificationError Update(NotificationSafeHandle handle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_delete")] + internal static extern NotificationError Delete(NotificationSafeHandle handle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_delete_all")] + internal static extern NotificationError DeleteAll(int type); + + [DllImport(Libraries.Notification, EntryPoint = "notification_post")] + internal static extern NotificationError Post(NotificationSafeHandle handle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_pkgname")] + internal static extern NotificationError GetPackageName(NotificationSafeHandle handle, out IntPtr name); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_event_handler")] + internal static extern NotificationError AddButtonAction(NotificationSafeHandle handle, ButtonIndex type, SafeAppControlHandle appcontrol); + + [DllImport(Libraries.Notification, EntryPoint = "notification_remove_button")] + internal static extern NotificationError RemoveButton(NotificationSafeHandle handle, ButtonIndex index); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_tag")] + internal static extern NotificationError SetTag(NotificationSafeHandle handle, string tag); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")] + internal static extern NotificationError GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag); + + [DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")] + internal static extern IntPtr Load(string text); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_id")] + internal static extern NotificationError GetID(NotificationSafeHandle handle, out int groupID, out int privID); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_priv_id")] + internal static extern NotificationError SetID(NotificationSafeHandle handle, int privID); + + [DllImport(Libraries.Notification, EntryPoint = "notification_save_as_template")] + internal static extern NotificationError SaveTemplate(NotificationSafeHandle handle, string name); + + [DllImport(Libraries.Notification, EntryPoint = "notification_create_from_template")] + internal static extern IntPtr LoadTemplate(string name); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_noti_block_state")] + internal static extern NotificationError GetBlockState(out NotificationBlockState status); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_auto_remove")] + internal static extern NotificationError SetAutoRemove(NotificationSafeHandle handle, bool autoRemove); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_auto_remove")] + internal static extern NotificationError GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_value_type")] + internal static extern NotificationError SetProgressType(NotificationSafeHandle handle, ProgressCategory category); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_value_type")] + internal static extern NotificationError GetProgressType(NotificationSafeHandle handle, out ProgressCategory category); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_ongoing_flag")] + internal static extern NotificationError SetOngoingFlag(NotificationSafeHandle handle, bool flag); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")] + internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, bool flag); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_ongoing_flag")] + internal static extern NotificationError GetProgressFlag(NotificationSafeHandle handle, out bool flag); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_text_input")] + internal static extern NotificationError SetPlaceHolderLength(NotificationSafeHandle handle, int length); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_text_input_max_length")] + internal static extern NotificationError GetPlaceHolderLength(NotificationSafeHandle handle, out int length); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_hide_timeout")] + internal static extern NotificationError GetHideTime(NotificationSafeHandle handle, out int timeout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_hide_timeout")] + internal static extern NotificationError SetHideTime(NotificationSafeHandle handle, int timeout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_delete_timeout")] + internal static extern NotificationError GetDeleteTime(NotificationSafeHandle handle, out int timeout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_delete_timeout")] + internal static extern NotificationError SetDeleteTime(NotificationSafeHandle handle, int timeout); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_extention_data")] + internal static extern NotificationError SetExtentionData(NotificationSafeHandle handle, string key, SafeBundleHandle bundleHandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_extention_data")] + internal static extern NotificationError GetExtentionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_args")] + internal static extern NotificationError GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr group_args); + + [DllImport(Libraries.Notification, EntryPoint = "notification_get_default_button")] + internal static extern NotificationError GetDefaultButton(NotificationSafeHandle handle, out int index); + + [DllImport(Libraries.Notification, EntryPoint = "notification_set_default_button")] + internal static extern NotificationError SetDefaultButton(NotificationSafeHandle handle, int index); + + internal static NotificationError GetText(NotificationSafeHandle handle, NotificationText type, out string text) + { + NotificationError ret; + IntPtr ptr; + ret = GetTextReferenceType(handle, type, out ptr); + + if (ptr == IntPtr.Zero) + { + text = null; + } + else + { + text = Marshal.PtrToStringAnsi(ptr); + } + + return ret; + } + + internal static NotificationError GetImage(NotificationSafeHandle handle, NotificationImage type, out string path) + { + NotificationError ret; + IntPtr ptr; + ret = GetImageReferenceType(handle, type, out ptr); + + if (ptr == IntPtr.Zero) + { + path = null; + } + else + { + path = Marshal.PtrToStringAnsi(ptr); + } + + return ret; + } + + internal static NotificationError GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path) + { + NotificationError ret; + IntPtr ptr; + ret = GetSoundReferenceType(handle, out type, out ptr); + + if (ptr == IntPtr.Zero) + { + path = null; + } + else + { + path = Marshal.PtrToStringAnsi(ptr); + } + + return ret; + } + + internal static NotificationError GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path) + { + NotificationError ret; + IntPtr ptr; + ret = GetVibrationReferenceType(handle, out type, out ptr); + + if (ptr == IntPtr.Zero) + { + path = null; + } + else + { + path = Marshal.PtrToStringAnsi(ptr); + } + + return ret; + } + + internal static NotificationError GetTag(NotificationSafeHandle handle, out string tag) + { + NotificationError ret; + IntPtr ptr; + ret = GetTagReferenceType(handle, out ptr); + + if (ptr == IntPtr.Zero) + { + tag = null; + } + else + { + tag = Marshal.PtrToStringAnsi(ptr); + } + + return ret; + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notification.csproj b/src/Tizen.Applications.Notification/Tizen.Applications.Notification.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notification.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notification.sln b/src/Tizen.Applications.Notification/Tizen.Applications.Notification.sln new file mode 100755 index 0000000..0331680 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notification.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Notification", "Tizen.Applications.Notification.csproj", "{DB7A1051-D52D-4A42-8817-7A61E35E2FE6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{5C021594-8AFF-4E71-B5F7-D3E565825BEF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{593C96BE-8C68-490F-982E-952617901774}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{78C34A63-D5BE-48E8-BBB5-76FCBEE65AD1}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DB7A1051-D52D-4A42-8817-7A61E35E2FE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB7A1051-D52D-4A42-8817-7A61E35E2FE6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB7A1051-D52D-4A42-8817-7A61E35E2FE6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB7A1051-D52D-4A42-8817-7A61E35E2FE6}.Release|Any CPU.Build.0 = Release|Any CPU + {5C021594-8AFF-4E71-B5F7-D3E565825BEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C021594-8AFF-4E71-B5F7-D3E565825BEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C021594-8AFF-4E71-B5F7-D3E565825BEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C021594-8AFF-4E71-B5F7-D3E565825BEF}.Release|Any CPU.Build.0 = Release|Any CPU + {593C96BE-8C68-490F-982E-952617901774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {593C96BE-8C68-490F-982E-952617901774}.Debug|Any CPU.Build.0 = Debug|Any CPU + {593C96BE-8C68-490F-982E-952617901774}.Release|Any CPU.ActiveCfg = Release|Any CPU + {593C96BE-8C68-490F-982E-952617901774}.Release|Any CPU.Build.0 = Release|Any CPU + {78C34A63-D5BE-48E8-BBB5-76FCBEE65AD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78C34A63-D5BE-48E8-BBB5-76FCBEE65AD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78C34A63-D5BE-48E8-BBB5-76FCBEE65AD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78C34A63-D5BE-48E8-BBB5-76FCBEE65AD1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs new file mode 100755 index 0000000..ec7202a --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs @@ -0,0 +1,505 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification : IDisposable + { + internal static readonly string LogTag = "Tizen.Applications.Notification"; + + private NotificationSafeHandle safeHandle; + private bool disposed = false; + + private IDictionary styleDictionary; + private IDictionary extenderDictionary; + private int count = 0; + + /// + /// Initializes a new instance of the class. + /// + public Notification() + { + styleDictionary = new Dictionary(); + extenderDictionary = new Dictionary(); + } + + /// + /// Gets or sets Tag of Notification. + /// + public string Tag { get; set; } = string.Empty; + + /// + /// Gets or sets Title of Notification. + /// + public string Title { get; set; } = string.Empty; + + /// + /// Gets or sets icon of Notification. + /// + public string Icon { get; set; } = string.Empty; + + /// + /// Gets or sets sub icon of Notification. + /// This SubIcon is displayed in Icon you set. + /// + public string SubIcon { get; set; } = string.Empty; + + /// + /// Gets or sets content of Notification. + /// + public string Content { get; set; } = string.Empty; + + /// + /// Gets or sets a value indicating whether TimeStamp of Notification is Visible or not. + /// Default to true. + /// + public bool IsTimeStampVisible { get; set; } = true; + + /// + /// Gets or sets TimeStamp of Notification. + /// + /// + /// If you don't set TimeStamp, It will be set value that time when the notification is posted. + /// TimeStamp requires NotificationManager.Post() to be called. + /// If you set IsVisibleTimeStamp property is false, TimeStamp is not Visible in Notification. + /// + public DateTime TimeStamp { get; set; } + + /// + /// Gets or sets Action which is invoked when notification is clicked + /// + /// + /// If you set it to null, the already set AppControl will be removed and nothing will happen when you click on notification. + /// + /// + public AppControl Action { get; set; } + + /// + /// Gets or sets Count which is displayed at the right side of notification. + /// + /// + /// You must set only positive number. + /// If you set count to negative number, This property throw exception. + /// + /// Thrown when argument is invalid + public int Count + { + get + { + return count; + } + + set + { + if (value < 0) + { + Log.Error(LogTag, "Count value is negative"); + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The Count must be a positive integer."); + } + + count = value; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsOngoing { get; set; } = false; + + /// + /// Gets or sets property + /// + /// + public NotificationProperty Property { get; set; } = NotificationProperty.None; + + /// + /// Gets or sets object for display at notification + /// + /// + public ProgressType Progress { get; set; } + + /// + /// Gets or sets which is included vibration, led and sound option to be applied at Notification. + /// + /// + /// If you set it to null, the already set AccessorySet will be initialized. + /// + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "Notification", + /// Content = "Hello Tizen", + /// Icon = "Icon path", + /// Count = 3 + /// }; + /// + /// Notification.AccessorySet accessory = new Notification.AccessorySet + /// { + /// SoundOption = AccessoryOption.Custom, + /// SoundPath = "Sound File Path", + /// IsVibration = true, + /// LedOption = AccessoryOption.Custom, + /// LedOnMs = 100; + /// LedOffMs = 50; + /// LedColor = Color.Lime + /// }; + /// + /// notification.Accessory = accessory; + /// + /// NotificationManager.Post(notification); + /// + /// + public AccessorySet Accessory { get; set; } + + /// + /// Gets or sets a value indicating whether notification is displayed on default viewer. + /// If you set false and add style, you can see only style notification. + /// + public bool IsDisplay { get; set; } = true; + + /// + /// Gets or sets NotificationSafeHandle + /// + internal NotificationSafeHandle Handle + { + get + { + return safeHandle; + } + + set + { + if (value == null) + { + Log.Error(LogTag, "Invalid argument NotificationSafeHandle"); + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to set NotificationSafeHandle"); + } + + safeHandle = value; + } + } + + /// + /// Gets or sets Private ID + /// + internal int PrivID { get; set; } = -1; + + /// + /// Method to add various style to be applied to notification. + /// + /// + /// The user always see about valid notification style. If you add style which is not supported in platform, + /// this method has no effect. + /// + /// The style to be applied to notification + /// Thrown when argument is invalid + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "Notification", + /// Content = "Hello Tizen", + /// Icon = "Icon path", + /// Count = 3 + /// }; + /// + /// Notification.LockStyle lockStyle = new Notification.LockStyle + /// { + /// IconPath = "Icon path", + /// ThumbnailPath = "Thumbnail Path" + /// }; + /// + /// notification.AddStyle(lockStyle); + /// + /// NotificationManager.Post(notification); + /// + /// + public void AddStyle(StyleBase style) + { + if (style == null) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + + if (styleDictionary.ContainsKey(style.Key) == true) + { + Log.Info(LogTag, "The Style is existed, so extender data is replaced"); + styleDictionary.Remove(style.Key); + styleDictionary.Add(style.Key, style); + } + else + { + styleDictionary.Add(style.Key, style); + } + } + + /// + /// Method to remove style you already added. + /// + /// Type of notification style to be queried + /// Thrown when argument is invalid + public void RemoveStyle() where T : Notification.StyleBase, new() + { + T type = new T(); + + if (styleDictionary.ContainsKey(type.Key)) + { + styleDictionary.Remove(type.Key); + } + else + { + Log.Error(LogTag, "Sytle Can't be removed, there is no style matched input key"); + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + } + + /// + /// Method to get style you already added. + /// + /// Type of notification style to be queried + /// + /// The Notification.Style object associated with the given style + /// + /// Thrown when argument is invalid + public T GetStyle() where T : Notification.StyleBase, new() + { + T type = new T(); + StyleBase style = null; + + styleDictionary.TryGetValue(type.Key, out style); + + if (style == null) + { + Log.Error(LogTag, "Invalid Style"); + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + else + { + return style as T; + } + } + + /// + /// Method to set extender data to add extra data + /// + /// + /// The type of extra data is Bundle. + /// + /// The key of the extra data you want to add. + /// The value you want to add. + /// Thrown when argument is invalid + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "Notification", + /// Content = "Hello Tizen", + /// Icon = "Icon path", + /// }; + /// + /// Bundle bundle = new Bundle(); + /// bundle.AddItem("key", "value"); + /// + /// notification.SetExtender("firstKey", bundle); + /// + /// + public void SetExtender(string key, Bundle value) + { + if (value == null || value.SafeBundleHandle.IsInvalid || string.IsNullOrEmpty(key)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + + if (extenderDictionary.ContainsKey(key) == true) + { + Log.Info(LogTag, "The key is existed, so extender data is replaced"); + extenderDictionary.Remove(key); + extenderDictionary.Add(key, value); + } + else + { + extenderDictionary.Add(key, value); + } + } + + /// + /// Method to remove extender you already added. + /// + /// + /// The type of extra data is Bundle. + /// + /// The key of the extra data to add. + /// Thrown when argument is invalid + public void RemoveExtender(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + + if (extenderDictionary.ContainsKey(key)) + { + extenderDictionary.Remove(key); + } + else + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + } + + /// + /// Method to get extender data you already set + /// + /// The key of the extra data to get. + /// Bundle Object that include extender data + /// Thrown when argument is invalid + public Bundle GetExtender(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + + Bundle bundle; + if (extenderDictionary.TryGetValue(key, out bundle) == false) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered : " + key); + } + + return bundle; + } + + /// + /// Releases any unmanaged resources used by this object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void Dispose(bool disposing) + { + if (disposed) + { + return; + } + + if (disposing) + { + Handle.Dispose(); + } + + disposed = true; + } + + internal IDictionary GetStyleDictionary() + { + return styleDictionary; + } + + internal IDictionary GetExtenderDictionary() + { + return extenderDictionary; + } + + internal StyleBase GetStyle(string key) + { + if (string.IsNullOrEmpty(key)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "Key is null or empty"); + } + + StyleBase style = null; + bool ret = styleDictionary.TryGetValue(key, out style); + if (ret == false) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The Style object matched input key is not existed"); + } + + return style; + } + + internal void Make() + { + NotificationBinder.BindObject(this); + + foreach (string key in GetExtenderDictionary().Keys) + { + Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle"); + Interop.Notification.SetExtentionData(Handle, key, extenderDictionary[key].SafeBundleHandle); + } + + foreach (Notification.StyleBase style in styleDictionary.Values) + { + Log.Info(LogTag, "Start to bind Notification.Style to SafeHandle [" + style.Key + "]"); + style.Make(this); + } + + if (Accessory != null) + { + Log.Info(LogTag, "Start to bind Notification.AccessetSet to SafeHandle"); + Accessory.Make(this); + } + + if (Progress != null) + { + Log.Info(LogTag, "Start to bind Notification.Progress to SafeHandle"); + Progress.Make(this); + } + } + + internal Notification Build() + { + IntPtr extention = IntPtr.Zero; + IntPtr extentionBundlePtr = IntPtr.Zero; + + NotificationBinder.BindSafeHandle(this); + + Interop.Notification.GetExtentionBundle(Handle, out extention, out extentionBundlePtr); + + if (extention != IntPtr.Zero) + { + Bundle bundle = new Bundle(new SafeBundleHandle(extention, false)); + foreach (string key in bundle.Keys) + { + SafeBundleHandle sbh; + Interop.Notification.GetExtentionData(Handle, key, out sbh); + extenderDictionary.Add(key, new Bundle(sbh)); + } + } + + ProgressBinder.BindSafeHandle(this); + AccessorySetBinder.BindSafeHandle(this); + IndicatorBinder.BindSafeHandle(this); + ActiveBinder.BindSafeHandle(this); + LockBinder.BindSafehandle(this); + + return this; + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs new file mode 100755 index 0000000..ec7958d --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using Tizen.Common; + + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for Notification AccessorySet which is included vibration, led, sound option + /// + public sealed class AccessorySet : MakerBase + { + /// + /// Gets or sets the sound option. Default to AccessoryOption.Off. + /// + /// + /// If you set AccessoryOption.Custom and not set SoundPath, then turn on the default sound. + /// + public AccessoryOption SoundOption { get; set; } = AccessoryOption.Off; + + /// + /// Gets or sets the sound path, It will play on the sound file you set. + /// + public string SoundPath { get; set; } + + /// + /// Gets or sets a value indicating whether vibration is operated. Default to false. + /// + public bool CanVibrate { get; set; } = false; + + /// + /// Gets or sets the led option. Default to AccessoryOption.Off. + /// + /// + /// If you set AccessoryOption.Custom and not set LedColor, then turn on the LED with default color. + /// + public AccessoryOption LedOption { get; set; } = AccessoryOption.Off; + + /// + /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate + /// + /// + /// Default value of LedOnMillisecond is 0. + /// The rate is specified in terms of the number of Milliseconds to be on. + /// You should always set LedOnMillisecond with LedOffMillisecond. Otherwise, it may not operate normally. + /// + public int LedOnMillisecond { get; set; } + + /// + /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate. + /// + /// + /// The rate is specified in terms of the number of Milliseconds to be off. + /// You should always set LedOffMillisecond with LedOnMillisecond. Otherwise, it may not operate normally. + /// + public int LedOffMillisecond { get; set; } + + /// + /// Gets or sets the led color that you would like the LED on the device to blink. + /// + /// + /// If you want to set LedColor, you should always set LedOption is AccessoryOption.Custom. Otherwise, it may operate default led color. + /// + public Color LedColor { get; set; } + + internal override void Make(Notification notification) + { + AccessorySetBinder.BindObject(notification); + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySetBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySetBinder.cs new file mode 100755 index 0000000..91e2282 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySetBinder.cs @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using Tizen.Common; + + internal static class AccessorySetBinder + { + internal static void BindObject(Notification notification) + { + BindLedToHandle(notification); + BindSoundToHandle(notification); + BindVibrationToHandle(notification); + } + + internal static void BindSafeHandle(Notification notification) + { + Notification.AccessorySet accessory = new Notification.AccessorySet(); + BindHandleToLed(notification, accessory); + BindHandleToSound(notification, accessory); + BindHandleToVibration(notification, accessory); + notification.Accessory = accessory; + } + + private static void BindLedToHandle(Notification notification) + { + NotificationError ret = NotificationError.None; + Notification.AccessorySet accessory = notification.Accessory; + + ret = Interop.Notification.SetLed(notification.Handle, accessory.LedOption, 0); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set led"); + } + + ret = Interop.Notification.SetLedTimePeriod(notification.Handle, accessory.LedOnMillisecond, accessory.LedOffMillisecond); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set led period"); + } + + if (notification.Accessory.LedOption == AccessoryOption.Custom) + { + Color color = accessory.LedColor; + ret = Interop.Notification.SetLed(notification.Handle, AccessoryOption.Custom, color.GetArgb()); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set led color"); + } + } + } + + private static void BindVibrationToHandle(Notification notification) + { + Notification.AccessorySet accessory = notification.Accessory; + if (accessory.CanVibrate == false) + { + Interop.Notification.SetVibration(notification.Handle, AccessoryOption.Off, null); + } + else + { + Interop.Notification.SetVibration(notification.Handle, AccessoryOption.On, null); + } + } + + private static void BindSoundToHandle(Notification notification) + { + Notification.AccessorySet accessory = notification.Accessory; + + if (accessory.SoundOption == AccessoryOption.Custom && string.IsNullOrEmpty(accessory.SoundPath)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "If the option is set to Custom, the path must also be set."); + } + + NotificationError ret = Interop.Notification.SetSound(notification.Handle, accessory.SoundOption, accessory.SoundPath); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set sound"); + } + } + + private static void BindHandleToLed(Notification notification, Notification.AccessorySet accessory) + { + AccessoryOption type; + int argb; + Interop.Notification.GetLed(notification.Handle, out type, out argb); + + accessory.LedOption = type; + if (type == AccessoryOption.Custom) + { + accessory.LedColor = new Color(argb >> 16 & 255, argb >> 8 & 255, argb >> 0 & 255, argb >> 24 & 255); + } + + int onMillisecond, offMillisecond; + Interop.Notification.GetLedTimePeriod(notification.Handle, out onMillisecond, out offMillisecond); + accessory.LedOnMillisecond = onMillisecond; + accessory.LedOffMillisecond = offMillisecond; + } + + private static void BindHandleToSound(Notification notification, Notification.AccessorySet accessory) + { + AccessoryOption type; + string path; + + Interop.Notification.GetSound(notification.Handle, out type, out path); + + accessory.SoundOption = type; + if (type == AccessoryOption.Custom) + { + accessory.SoundPath = path; + } + } + + private static void BindHandleToVibration(Notification notification, Notification.AccessorySet accessory) + { + AccessoryOption type; + string path; + + Interop.Notification.GetVibration(notification.Handle, out type, out path); + if (type == AccessoryOption.Off) + { + accessory.CanVibrate = false; + } + else + { + accessory.CanVibrate = true; + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs new file mode 100755 index 0000000..d7b9d7f --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System.Collections.Generic; + + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for generating Active style notification + /// + public sealed class ActiveStyle : StyleBase + { + private IDictionary buttonDictionary; + private int hideTimeout = 0; + private int deleteTimeout = 0; + + /// + /// Initializes a new instance of the class. + /// + public ActiveStyle() + { + buttonDictionary = new Dictionary(); + } + + /// + /// Gets or sets an absolute path for an image file to display on the background of active notification + /// + public string BackgroundImage { get; set; } + + /// + /// Gets or sets a value indicating whether the active notification is removed automatically. Default value is true. + /// + /// + /// IsAutoRemove option lets the active notification be removed several seconds after it shows. + /// When 'IsAutoRemove' is set as false, the active notification will not be removed as long as the user removes + /// the active notification or the app which posted the active notification removes the active notification. + /// > + public bool IsAutoRemove { get; set; } = true; + + /// + /// Gets or sets the default button to display highlight on the active notification + /// + /// + /// The default button for display highlight is only reflected on Tizen TV. + /// If you use this Property on other profile, this value have no effect + /// + public ButtonIndex DefaultButton { get; set; } = ButtonIndex.None; + + /// + /// Gets or sets a ReplyAction to this active notification style. + /// + /// + /// When you add a ReplyAction to the ActiveStyle, the notification UI will show a ReplyAction with button. + /// If you set null parameter, ReplyAction is disappeared. + /// + /// + /// + /// + /// ButtonAction button = new ButtonAction + /// { + /// Index = ButtonIndex.First, + /// Text = "Yes" + /// Action = new AppControl{ ApplicationId = "org.tizen.app" }; + /// }; + /// + /// ReplyAction reply = new ReplyAction + /// { + /// ParentIndex = ButtonIndex.First; + /// PlaceHolderText = "Please write your reply." + /// ReplyMax = 160, + /// Button = new ButtonAction + /// { + /// Text = "Yes", + /// ImagePath = "image path" + /// Action = new AppControl{ ApplicationId = "org.tizen.app" }; + /// }; + /// }; + /// + /// ActiveStyle active = new ActiveStyle + /// { + /// AutoRemove = true, + /// BackgroundImage = "image path", + /// ReplyAction = reply + /// }; + /// + /// active.AddButtonAction(button); + /// + /// + public ReplyAction ReplyAction { get; set; } + + /// + /// Gets the key of ActiveStyle + /// + internal override string Key + { + get + { + return "Active"; + } + } + + /// + /// Method to set times to hide or delete notification. + /// + /// + /// The time settings for hiding and deleting are only reflected on Tizen TV. + /// If you use this API on other profile, this time settings have no effect + /// + /// The value in second when the notification can be hidden from the notification viewer after notification is posted + /// The value in second when the notification can be deleted from the notification list in setting application after notification is posted + /// Thrown when argument is invalid + public void SetRemoveTime(int hideTime, int deleteTime) + { + if (hideTime < 0 || deleteTime < 0) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument"); + } + + hideTimeout = hideTime; + deleteTimeout = deleteTime; + } + + /// + /// Method to get times to hide or delete notification. + /// + /// The value in second when the notification can be hidden from the notification viewer after notification is posted + /// The value in second when the notification can be deleted from the notification list in setting application after notification is posted + public void GetRemoveTime(out int hideTime, out int deleteTime) + { + hideTime = hideTimeout; + deleteTime = deleteTimeout; + } + + /// + /// Method to add a button to the active notification style. + /// Buttons are displayed on the notification. + /// + /// + /// If you add button that has same index, the button is replaced to latest adding button. + /// If you don't set an index on ButtonAction, the index is set sequentially from zero. + /// + /// An ButtonAction for appear to the notification + /// Thrown when argument is invalid + /// + /// + /// + /// ButtonAction button = new ButtonAction + /// { + /// Index = 0, + /// Text = "Yes" + /// Action = new AppControl{ ApplicationId = "org.tizen.app" }; + /// }; + /// + /// ActiveStyle active = new ActiveStyle + /// { + /// IsAutoRemove = true, + /// BackgroundImage = "image path", + /// }; + /// + /// active.AddButtonAction(button); + /// + /// + /// + public void AddButtonAction(ButtonAction button) + { + if (button == null) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid ButtonAction object"); + } + + if (button.Index == ButtonIndex.None) + { + button.Index = (ButtonIndex)buttonDictionary.Count; + buttonDictionary.Add(button.Index, button); + } + else if (button.Index >= ButtonIndex.First) + { + if (buttonDictionary.ContainsKey(button.Index)) + { + buttonDictionary.Remove(button.Index); + } + + buttonDictionary.Add(button.Index, button); + } + } + + /// + /// Remove the ButtonAction you already add. + /// + /// The index to remove a button + /// true if the element is successfully found and removed; otherwise, false + public bool RemoveButtonAction(ButtonIndex index) + { + bool ret = buttonDictionary.Remove(index); + + if (ret == false) + { + Log.Debug(Notification.LogTag, "Invalid key, there is no button matched input index"); + } + else + { + Log.Debug(Notification.LogTag, "The button was removed."); + } + + return ret; + } + + /// + /// Gets the ButtonAction of the active notification. + /// + /// The index to get a button you already add + /// The ButtonAction object which is you already add + /// Thrown when argument is invalid + public ButtonAction GetButtonAction(ButtonIndex index) + { + ButtonAction button = null; + + if (buttonDictionary.ContainsKey(index) == true) + { + buttonDictionary.TryGetValue(index, out button); + } + else + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value is not existed."); + } + + return button; + } + + internal ICollection GetButtonAction() + { + return buttonDictionary.Values; + } + + internal override void Make(Notification notification) + { + ActiveBinder.BindObject(notification); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs new file mode 100755 index 0000000..2d7eb4b --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + + internal static class NotificationBinder + { + private static readonly int DoNotShowTimeStamp = -1; + + internal static void BindObject(Notification notification) + { + BindNotificationSafeHandle(notification); + BindNotificationText(notification); + BindNotificationTime(notification); + + Interop.Notification.SetID(notification.Handle, notification.PrivID); + + if (notification.IsDisplay) + { + Interop.Notification.SetApplist(notification.Handle, (int)NotificationDisplayApplist.Tray); + } + else + { + Interop.Notification.SetApplist(notification.Handle, 0); + } + + if (notification.IsOngoing == true) + { + Log.Info(Notification.LogTag, "Start to set IsOngoing to SafeHandle"); + Interop.Notification.SetLayout(notification.Handle, NotificationLayout.Ongoing); + Interop.Notification.SetOngoingFlag(notification.Handle, true); + } + + if (string.IsNullOrEmpty(notification.Tag) != true) + { + Interop.Notification.SetTag(notification.Handle, notification.Tag); + } + + if (notification.Action != null && notification.Action.SafeAppControlHandle.IsInvalid == false) + { + Interop.Notification.SetAppControl(notification.Handle, LaunchOption.AppControl, notification.Action.SafeAppControlHandle); + } + + Interop.Notification.SetProperties(notification.Handle, (int)notification.Property); + } + + internal static void BindSafeHandle(Notification notification) + { + int privID, groupID; + Interop.Notification.GetID(notification.Handle, out groupID, out privID); + notification.PrivID = privID; + + NotificationLayout layout; + Interop.Notification.GetLayout(notification.Handle, out layout); + NotificationType type; + Interop.Notification.GetType(notification.Handle, out type); + if (layout == NotificationLayout.Ongoing && type == NotificationType.Ongoing) + { + notification.IsOngoing = true; + } + + int appList; + Interop.Notification.GetApplist(notification.Handle, out appList); + if ((appList & (int)NotificationDisplayApplist.Tray) == 0) + { + notification.IsDisplay = false; + } + + BindSafeHandleText(notification); + BindSafeHandleTime(notification); + BindSafeHandleTag(notification); + BindSafeHandleAction(notification); + } + + private static void BindNotificationSafeHandle(Notification notification) + { + IntPtr ptr; + NotificationError ret; + + if (notification.Handle != null && notification.Handle.IsInvalid == false) + { + notification.Handle.Dispose(); + } + + if (notification.IsOngoing == true || notification.Progress != null) + { + ptr = Interop.Notification.Create(NotificationType.Ongoing); + } + else + { + ptr = Interop.Notification.Create(NotificationType.Basic); + } + + if (ptr == IntPtr.Zero) + { + ret = (NotificationError)Tizen.Internals.Errors.ErrorFacts.GetLastResult(); + throw NotificationErrorFactory.GetException(ret, "Unable to create IntPtr Notification"); + } + + notification.Handle = new NotificationSafeHandle(ptr, true); + } + + private static void BindNotificationText(Notification notification) + { + Interop.Notification.SetText(notification.Handle, NotificationText.Title, notification.Title, null, -1); + Interop.Notification.SetText(notification.Handle, NotificationText.Content, notification.Content, null, -1); + Interop.Notification.SetImage(notification.Handle, NotificationImage.Icon, notification.Icon); + Interop.Notification.SetImage(notification.Handle, NotificationImage.SubIcon, notification.SubIcon); + Interop.Notification.SetText(notification.Handle, NotificationText.EventCount, notification.Count.ToString(), null, -1); + } + + private static void BindNotificationTime(Notification notification) + { + if (notification.IsTimeStampVisible == true) + { + if (notification.TimeStamp != DateTime.MinValue) + { + TimeSpan datatime = notification.TimeStamp.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + Interop.Notification.SetTime(notification.Handle, (int)datatime.TotalSeconds); + } + } + else + { + Interop.Notification.SetTime(notification.Handle, DoNotShowTimeStamp); + } + } + + private static void BindSafeHandleText(Notification notification) + { + string text; + Interop.Notification.GetText(notification.Handle, NotificationText.Title, out text); + if (string.IsNullOrEmpty(text) == false) + { + notification.Title = text; + } + + Interop.Notification.GetText(notification.Handle, NotificationText.Content, out text); + if (string.IsNullOrEmpty(text) == false) + { + notification.Content = text; + } + + string path; + Interop.Notification.GetImage(notification.Handle, NotificationImage.Icon, out path); + if (string.IsNullOrEmpty(path) == false) + { + notification.Icon = path; + } + + Interop.Notification.GetImage(notification.Handle, NotificationImage.SubIcon, out path); + if (string.IsNullOrEmpty(path) == false) + { + notification.SubIcon = path; + } + + Interop.Notification.GetText(notification.Handle, NotificationText.EventCount, out text); + if (string.IsNullOrEmpty(text) == false) + { + try + { + notification.Count = int.Parse(text); + } + catch (Exception ex) + { + Log.Error(Notification.LogTag, ex.ToString()); + } + } + } + + private static void BindSafeHandleTime(Notification notification) + { + int time; + + Interop.Notification.GetTime(notification.Handle, out time); + + if (time == DoNotShowTimeStamp) + { + notification.IsTimeStampVisible = false; + } + else + { + notification.IsTimeStampVisible = true; + + if (time != 0) + { + notification.TimeStamp = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Local)).AddSeconds(time).ToLocalTime(); + } + } + } + + private static void BindSafeHandleTag(Notification notification) + { + string text; + Interop.Notification.GetTag(notification.Handle, out text); + if (string.IsNullOrEmpty(text) != true) + { + notification.Tag = text; + } + } + + private static void BindSafeHandleProperty(Notification notification) + { + int property; + Interop.Notification.GetProperties(notification.Handle, out property); + notification.Property = (NotificationProperty)property; + } + + private static void BindSafeHandleAction(Notification notification) + { + SafeAppControlHandle appcontrol = null; + Interop.Notification.GetAppControl(notification.Handle, LaunchOption.AppControl, out appcontrol); + if (appcontrol != null && appcontrol.IsInvalid == false) + { + notification.Action = new AppControl(appcontrol); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs new file mode 100755 index 0000000..c4c2ed5 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class to help you set button on Active style of Notification + /// + /// + /// It must include a Text, an Index, an ImagePath, and an Action to be invoked when user select the button. + /// > + public sealed class ButtonAction : MakerBase + { + /// + /// Gets or sets the index of Button which is appeared at Notification. + /// + public ButtonIndex Index { get; set; } = ButtonIndex.None; + + /// + /// Gets or sets the text describing the button + /// + public string Text { get; set; } + + /// + /// Gets or sets the image path that represent the button + /// + public string ImagePath { get; set; } + + /// + /// Gets or sets the action which is invoked when button is clicked + /// + /// + /// If you don't set Action, nothing happens when button is clicked. + /// + /// + /// + /// ButtonAction button = new ButtonAction + /// { + /// Index = ButtonIndex.First, + /// text = "Yes", + /// ImagePath = "image path", + /// Action = new AppControl{ ApplicationId = "org.tizen.app" }; + /// }; + /// + /// + /// + public AppControl Action { get; set; } + + internal override void Make(Notification notification) + { + int enumIndex = (int)NotificationText.FirstButton + (int)Index; + + Interop.Notification.SetText(notification.Handle, (NotificationText)enumIndex, Text, null, -1); + enumIndex = (int)NotificationImage.FirstButton + (int)Index; + Interop.Notification.SetImage(notification.Handle, (NotificationImage)enumIndex, ImagePath); + if (Action != null && Action.SafeAppControlHandle.IsInvalid == false) + { + Interop.Notification.SetEventHandler(notification.Handle, (int)Index, Action.SafeAppControlHandle); + } + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs new file mode 100755 index 0000000..7cb41d9 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs @@ -0,0 +1,215 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + + /// + /// Enumeration for Progress category + /// + public enum ProgressCategory + { + /// + /// Value for percent type + /// + Percent, + + /// + /// Value for time type + /// + Time, + + /// + /// Value for pending type which is not updated progress current value + /// + PendingBar + } + + /// + /// Enumeration for Accessory option + /// + public enum AccessoryOption + { + /// + /// Value for off accessory option + /// + Off = -1, + + /// + /// Value for on accessory option + /// + On, + + /// + /// Value for custom accessory option + /// + Custom + } + + /// + /// Enumeration for Button Index + /// + public enum ButtonIndex + { + /// + /// Value for default button index + /// + None = -1, + + /// + /// Value for first button index + /// + First, + + /// + /// Value for second button index + /// + Second, + + /// + /// Value for third button index + /// + Third + } + + /// + /// Enumeration for notification particular property + /// + [Flags] + public enum NotificationProperty + { + /// + /// Value for adjust nothing + /// + None = 0x00, + + /// + /// Value for display only SIM card inserted + /// + DisplayOnlySimmode = 0x01, + + /// + /// Value for disable application launch when it selected + /// + DisableAppLaunch = 0x02, + + /// + /// Value for disable auto delete when it selected + /// + DisableAutoDelete = 0x04, + + /// + /// Value for deleted when device is rebooted even though notification is not set Ongoing + /// + VolatileDisplay = 0x100 + } + + /// + /// Enumeration for block state + /// + public enum NotificationBlockState + { + /// + /// Value to check the app is allowed to post notification + /// + Allowed = 0, + + /// + /// Value to check the app is not allowed to post any notification + /// + Blocked, + + /// + /// Value to check do not disturb mode which is user set + /// + DoNotDisturb + } + + internal enum NotificationType + { + None = -1, + Basic = 0, + Ongoing, + } + + internal enum NotificationEventType + { + FirstButton = 0, + SecondButton, + ThirdButton, + ClickOnIcon = 6, + ClockOnThumbnail = 7, + ClickOnTextInputButton = 8 + } + + internal enum NotificationLayout + { + None = 0, + SingleEvent = 1, + Thumbnail = 3, + Ongoing = 4, + Progress = 5, + Extension = 6 + } + + internal enum NotificationText + { + Title = 0, + Content, + EventCount = 3, + FirstMainText, + FirstSubText, + SecondMainText, + SecondSubText, + FirstButton = 13, + SeceondButton = 14, + ThirdButton = 15, + PlaceHolder = 19, + InputButton = 20, + } + + internal enum NotificationImage + { + Icon = 0, + IconForIndicator, + IconForLock, + Thumbnail, + ThumbnailForLock, + SubIcon, + Background, + FirstButton = 12, + SecondButton, + ThirdButton, + TextInputButton = 18, + } + + internal enum LaunchOption + { + AppControl = 1 + } + + [Flags] + internal enum NotificationDisplayApplist + { + Tray = 0x00000001, + Ticker = 0x00000002, + Lock = 0x00000004, + Indicator = 0x00000008, + Active = 0x00000010, + All = 0x0000000f, + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationErrorFactory.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationErrorFactory.cs new file mode 100755 index 0000000..12f92f3 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationErrorFactory.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + using System.Runtime.CompilerServices; + + internal enum NotificationError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + DbError = -0x01140000 | 0x01, + AlreadyExists = -0x01140000 | 0x02, + DBusError = -0x01140000 | 0x03, + DoesnotExist = -0x01140000 | 0x04, + ServiceError = -0x01140000 | 0x05, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation + } + + internal static class NotificationErrorFactory + { + internal static Exception GetException(NotificationError ret, string msg, [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0) + { + Log.Error(Notification.LogTag, memberName + " : " + lineNumber); + + switch (ret) + { + case NotificationError.InvalidParameter: + Log.Error(Notification.LogTag, msg); + return new ArgumentException(ret + " error occurred."); + case NotificationError.PermissionDenied: + throw new UnauthorizedAccessException("Permission denied (http://tizen.org/privilege/notification)"); + default: + Log.Error(Notification.LogTag, msg); + return new InvalidOperationException(ret + " error occurred."); + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationIndicatorStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationIndicatorStyle.cs new file mode 100755 index 0000000..7e87c84 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationIndicatorStyle.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for generating Indicator style notification + /// + public sealed class IndicatorStyle : StyleBase + { + /// + /// Gets or sets an absolute path for an image file. + /// If you set IconPath, you can see the icon on the right side of indicator. + /// + public string IconPath { get; set; } + + /// + /// Gets or sets a sub text for displaying Indicator style + /// + public string SubText { get; set; } + + /// + /// Gets the key of IndicatorStyle + /// + internal override string Key + { + get + { + return "Indicator"; + } + } + + internal override void Make(Notification notification) + { + IndicatorBinder.BindObject(notification); + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationLockStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationLockStyle.cs new file mode 100755 index 0000000..78029a7 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationLockStyle.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for generating Lock style notification + /// + public sealed class LockStyle : StyleBase + { + /// + /// Gets or sets an absolute path for an image file to display on the icon of Lock style + /// + public string IconPath { get; set; } + + /// + /// Gets or sets an absolute path for a thumbnail image file to display on Lock style + /// + public string ThumbnailPath { get; set; } + + /// + /// Gets the key of LockStyle + /// + internal override string Key + { + get + { + return "Lock"; + } + } + + internal override void Make(Notification notification) + { + LockBinder.BindObject(notification); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationMakerBase.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationMakerBase.cs new file mode 100755 index 0000000..859a81f --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationMakerBase.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System.ComponentModel; + + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// An object that help notification make to SafeHandle. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public abstract class MakerBase + { + internal abstract void Make(Notification notification); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs new file mode 100755 index 0000000..1a890f3 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + using System.ComponentModel; + + /// + /// NotificationManager class to post, update, delete and get Notification. + /// + public static class NotificationManager + { + /// + /// Posts a new Notification. + /// + /// Notification to post + /// Thrown when argument is invalid + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// + /// Notification.AccessorySet accessory = new Notification.AccessorySet + /// { + /// SoundOption = AccessoryOption.On, + /// CanVibrate = true + /// }; + /// notification.Accessory = accessory; + /// + /// // do something + /// + /// NotificationManager.Post(notification); + /// + /// + /// http://tizen.org/privilege/notification + public static void Post(Notification notification) + { + if (notification == null) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to post method"); + } + + notification.Make(); + + NotificationError ret = Interop.Notification.Post(notification.Handle); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "post notification failed"); + } + + int priv_id, group_id; + Interop.Notification.GetID(notification.Handle, out group_id, out priv_id); + notification.PrivID = priv_id; + } + + /// + /// Updates a posted Notification. + /// + /// Notification to update + /// Thrown when argument is invalid + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// string tag = "first tag"; + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = tag + /// }; + /// + /// Notification.AccessorySet accessory = new Notification.AccessorySet + /// { + /// LedOption = AccessoryOption.On, + /// VibrationOption = AccessoryOption.Custom, + /// VibrationPath = "vibration absolute path" + /// } + /// notification.Accessory = accessory; + /// + /// NotificationManager.Post(notification); + /// + /// // do something + /// + /// Notification loadNotification = NotificationManager.Load(tag); + /// + /// loadNotification.Progress = new ProgressType(ProgressCategory.Percent, 0.0. 100.0); + /// + /// Thread thread = new Thread(new ParameterizedThreadStart(UpdateProgress)); + /// thread.IsBackground = true; + /// thread.Start(notification); + /// + /// ... + /// + /// static void UpdateProgress(Object obj) + /// { + /// Notification notification = (Notification)obj; + /// + /// for (double current = 1.0; current <= 100.0; current = current + 1.0) + /// { + /// notification.Progress.ProgressCurrent = current; + /// NotificationManager.Update(notification); + /// Thread.Sleep(300); + /// } + /// } + /// + /// + /// http://tizen.org/privilege/notification + ///
+        /// Post method should be called on the Notification object.
+        /// 
+ public static void Update(Notification notification) + { + if (notification == null || notification.Handle == null || notification.Handle.IsInvalid) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to post method"); + } + + notification.Make(); + NotificationError ret = Interop.Notification.Update(notification.Handle); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "update notification failed"); + } + } + + /// + /// Deletes a posted Notification. + /// + /// Notification to remove + /// Thrown when argument is invalid + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// NotificationManager.Post(notification); + /// + /// // do something + /// + /// NotificationManager.Delete(notification); + /// + /// + /// http://tizen.org/privilege/notification + ///
+        /// Post method should be called on the Notification object.
+        /// 
+ public static void Delete(Notification notification) + { + if (notification == null || notification.Handle == null || notification.Handle.IsInvalid) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to post method"); + } + + NotificationError ret = Interop.Notification.Delete(notification.Handle); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "delete notification failed"); + } + } + + /// + /// Removes all posted Notification of calling application. + /// + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// Notification firstNotification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// NotificationManager.Post(firstNotification); + /// + /// Notification secondNotification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "second notification" + /// }; + /// NotificationManager.Post(secondNotification); + /// NotificationManager.DeleteAll(); + /// + /// + /// http://tizen.org/privilege/notification + public static void DeleteAll() + { + NotificationError ret; + + ret = Interop.Notification.DeleteAll((int)NotificationType.Basic); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "delete all notifications failed of Noti type"); + } + + ret = Interop.Notification.DeleteAll((int)NotificationType.Ongoing); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "delete all notifications failed of Ongoing type"); + } + } + + /// + /// Searches for a posted notification which has the inputted tag and isn't deleted not yet. + /// + /// + /// Load method should be called only for notifications which have been posted using NotificationManager.Post method. + /// If two or more notifications share the same tag, the notification posted most recently is returned. + /// + /// Tag used to query + /// Notification Object with inputted tag + /// Thrown when argument is invalid or when the tag does not exist + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// NotificationManager.Post(notification); + /// + /// // do someting + /// + /// Notification loadNotification = NotificationManager.Load("first notification"); + /// + /// + /// http://tizen.org/privilege/notification + public static Notification Load(string tag) + { + IntPtr ptr = IntPtr.Zero; + + if (string.IsNullOrEmpty(tag)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered"); + } + + ptr = Interop.Notification.Load(tag); + + if (ptr == IntPtr.Zero) + { + NotificationError ret = (NotificationError)Tizen.Internals.Errors.ErrorFacts.GetLastResult(); + Log.Error(Notification.LogTag, "unable to load Notification : " + ret.ToString()); + if (ret == NotificationError.DbError) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "the tag does not exist"); + } + else + { + throw NotificationErrorFactory.GetException(ret, "unable to load Notification"); + } + } + + Notification notification = new Notification + { + Handle = new NotificationSafeHandle(ptr, true) + }.Build(); + + return notification; + } + + /// + /// Saves a notification template to the notification database + /// + /// Notification to save as template + /// Template name + /// Thrown when argument is invalid + /// Thrown in case of permission denied. + /// Thrown when can't save as template + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// + /// Notification.Accessory accessory = new Notification.Accessory + /// { + /// LedOption = AccessoryOption.On, + /// VibrationOption = AccessoryOption.Custom, + /// VibrationPath = "vibration absolute path" + /// } + /// notification.setAccessory(accessory); + /// + /// // do something + /// + /// NotificationManager.Post(notification); + /// + /// Notification.LockStyle style = new Notification.LockStyle + /// { + /// IconPath = "icon path", + /// ThumbnailPath = "Thumbnail path" + /// } + /// notification.AddStyle(style); + /// NotificationManager.SaveTemplate(notification, "firstTemplate"); + /// + /// + /// http://tizen.org/privilege/notification + public static void SaveTemplate(Notification notification, string name) + { + if (notification == null || string.IsNullOrEmpty(name)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to save template"); + } + + notification.Make(); + + NotificationError ret = Interop.Notification.SaveTemplate(notification.Handle, name); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "save as template failed"); + } + } + + /// + /// Loads a notification template from the notification database + /// + /// Template name + /// Notification Object with inputted template name + /// Thrown when argument is invalid or when no template with input name exists + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// + /// + /// Notification notification = new Notification + /// { + /// Title = "title", + /// Content = "content", + /// Icon = "absolute icon path", + /// Tag = "first notification" + /// }; + /// + /// Notification.Accessory accessory = new Notification.Accessory + /// { + /// LedOption = AccessoryOption.On, + /// VibrationOption = AccessoryOption.Custom, + /// VibrationPath = "vibration absolute path" + /// } + /// notification.setAccessory(accessory); + /// + /// // do something + /// + /// NotificationManager.Post(notification); + /// + /// Notification.LockStyle style = new Notification.LockStyle + /// { + /// IconPath = "icon path", + /// ThumbnailPath = "Thumbnail path" + /// } + /// notification.AddStyle(style); + /// NotificationManager.SaveTemplate(notification, "firstTemplate"); + /// Notification notificationTemplate = NotificationManager.LoadTemplate("firstTemplate"); + /// + /// + /// http://tizen.org/privilege/notification + public static Notification LoadTemplate(string name) + { + IntPtr handle = IntPtr.Zero; + + if (string.IsNullOrEmpty(name)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid argument to load template"); + } + + handle = Interop.Notification.LoadTemplate(name); + if (handle == IntPtr.Zero) + { + NotificationError ret = (NotificationError)Tizen.Internals.Errors.ErrorFacts.GetLastResult(); + if (ret == NotificationError.DbError) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "the name does not exist"); + } + else + { + throw NotificationErrorFactory.GetException(ret, "unable to create Notification from template"); + } + } + + Notification notification = new Notification + { + Handle = new NotificationSafeHandle(handle, true) + }.Build(); + + return notification; + } + + /// + /// Gets notification block state. + /// + /// + /// The user can set the notification block state in settings. + /// The block state indicates whether or not notifications can be posted. + /// Additionally only notifications to the notification panel are allowed in "Do not disturb mode". + /// Sound, Vibrate and Active notifications are blocked. + /// + /// NotificationBlockState is state if notification is posted + /// Thrown in case of permission denied. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static NotificationBlockState GetBlockState() + { + NotificationBlockState state; + NotificationError ret; + + ret = Interop.Notification.GetBlockState(out state); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "GetBlockState failed"); + } + + Log.Info(Notification.LogTag, "Current block state is " + state.ToString()); + return state; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static NotificationSafeHandle MakeNotificationSafeHandle(Notification notification) + { + if (notification == null) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid notification object"); + } + + notification.Make(); + + return notification.Handle; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static Notification MakeNotification(NotificationSafeHandle handle) + { + if (handle == null || handle.IsInvalid == true) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "handle is invalid or null"); + } + + Notification notification = new Notification { Handle = handle }.Build(); + + return notification; + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgress.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgress.cs new file mode 100755 index 0000000..3630755 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgress.cs @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for displaying progress notification + /// You must initialize progress category, current, max value when you create object. + /// + public sealed class ProgressType : MakerBase + { + private double progressCurrent; + private double progressMax; + + /// + /// Initializes a new instance of the class. + /// You must initialize category, current, max value of progress. + /// + /// The category of progress that appeared on Notification + /// The current value of the progress + /// The max value of the progress + /// Thrown when argument is invalid + public ProgressType(ProgressCategory category, double current, double max) + { + if (IsNegativeNumber(current)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The current must be a positive integer."); + } + + if (IsNegativeNumber(max)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The max must be a positive integer."); + } + + Category = category; + ProgressCurrent = current; + ProgressMax = max; + } + + /// + /// Gets or sets category of ProgressType. + /// + /// + public ProgressCategory Category { get; set; } + + /// + /// Gets or sets current value of ProgressType + /// + /// Thrown when argument is invalid + public double ProgressCurrent + { + get + { + return progressCurrent; + } + + set + { + if (IsNegativeNumber(value)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer."); + } + + progressCurrent = value; + } + } + + /// + /// Gets or sets max value of ProgressType + /// + /// Thrown when argument is invalid + public double ProgressMax + { + get + { + return progressMax; + } + + set + { + if (IsNegativeNumber(value)) + { + throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "The value must be a positive integer."); + } + + progressMax = value; + } + } + + internal override void Make(Notification notification) + { + ProgressBinder.BindObject(notification); + } + + private bool IsNegativeNumber(double number) + { + return number < 0; + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgressBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgressBinder.cs new file mode 100755 index 0000000..6afd5c5 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationProgressBinder.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + internal static class ProgressBinder + { + internal static void BindObject(Notification notification) + { + double current, max; + + Notification.ProgressType progress = notification.Progress; + + if (progress.Category == ProgressCategory.PendingBar) + { + Interop.Notification.SetProgressType(notification.Handle, ProgressCategory.Percent); + current = 0; + max = 0; + } + else if (progress.Category == ProgressCategory.Percent) + { + Interop.Notification.SetProgressType(notification.Handle, progress.Category); + current = progress.ProgressCurrent / 100; + max = progress.ProgressMax; + } + else + { + Interop.Notification.SetProgressType(notification.Handle, progress.Category); + current = progress.ProgressCurrent; + max = progress.ProgressMax; + } + + Interop.Notification.SetProgress(notification.Handle, current); + Interop.Notification.SetProgressSize(notification.Handle, max); + Interop.Notification.SetLayout(notification.Handle, NotificationLayout.Progress); + Interop.Notification.SetOngoingFlag(notification.Handle, true); + } + + internal static void BindSafeHandle(Notification notification) + { + NotificationLayout layout; + Interop.Notification.GetLayout(notification.Handle, out layout); + + if (layout == NotificationLayout.Progress) + { + ProgressCategory category; + double current, max; + + Interop.Notification.GetProgressType(notification.Handle, out category); + Interop.Notification.GetProgress(notification.Handle, out current); + Interop.Notification.GetProgressSize(notification.Handle, out max); + + if (category == ProgressCategory.Percent) + { + current *= 100; + } + + notification.Progress = new Notification.ProgressType(category, current, max); + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs new file mode 100755 index 0000000..f3bc10a --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// Class for displaying direct-reply at notification. + /// You must set a ReplyMax and Button. Otherwise user can't send written text to application which is set by AppControl. + /// + public sealed class ReplyAction : MakerBase + { + /// + /// Gets or sets the Index of Button which is appeared at Notification. + /// If you set ParentIndex, ReplyAction is displayed when button matched with ParentIndex click by the user. + /// If you don't set ParentIndex, appeared to notification directly. + /// + public ButtonIndex ParentIndex { get; set; } = ButtonIndex.None; + + /// + /// Gets or sets the PlaceHolderText of ReplyAction which is appeared at Notification. + /// If you set PlaceHolderText, it is displayed to placeholder in notification. + /// + public string PlaceHolderText { get; set; } + + /// + /// Gets or sets the ReplyMax of ReplyAction which is appeared at Notification. + /// You must set a ReplyMax. Otherwise user don't write text to placeholder in notification. + /// + /// + /// Default value is 160. + /// + public int ReplyMax { get; set; } = 160; + + /// + /// Gets or sets the Button which is appeared to ReplyAction in Notification. + /// You must set a Button. Otherwise user can't send written text to application which is set by AppControl. + /// + /// + /// If you set it to null, the already set ButtonAction will be removed. + /// + /// + /// + /// ReplyAction button = new ReplyAction + /// { + /// ParentIndex = ButtonIndex.Second; + /// PlaceHolderText = "Please write your reply." + /// ReplyMax = 160, + /// Button = new ButtonAction + /// { + /// text = "Yes", + /// ImagePath = "image path", + /// Action = new AppControl{ ApplicationId = "org.tizen.app" }; + /// }; + /// }; + /// + /// + public ButtonAction Button { get; set; } + + internal override void Make(Notification notification) + { + string replyKey = "__PARENT_INDEX__"; + + if (Button != null) + { + Interop.Notification.SetText(notification.Handle, NotificationText.InputButton, Button.Text, null, -1); + Interop.Notification.SetImage(notification.Handle, NotificationImage.TextInputButton, Button.ImagePath); + + if (this.Button.Action != null && this.Button.Action.SafeAppControlHandle.IsInvalid == false) + { + Interop.Notification.SetEventHandler(notification.Handle, (int)NotificationEventType.ClickOnTextInputButton, this.Button.Action.SafeAppControlHandle); + + if (this.ParentIndex != ButtonIndex.None) + { + Interop.Notification.SetEventHandler(notification.Handle, (int)this.ParentIndex, this.Button.Action.SafeAppControlHandle); + } + } + } + + Bundle bundle = new Bundle(); + bundle.AddItem(replyKey, ((int)this.ParentIndex).ToString()); + Interop.Notification.SetExtentionData(notification.Handle, replyKey, bundle.SafeBundleHandle); + + Interop.Notification.SetPlaceHolderLength(notification.Handle, this.ReplyMax); + Interop.Notification.SetText(notification.Handle, NotificationText.PlaceHolder, PlaceHolderText, null, -1); + } + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationSafeHandle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationSafeHandle.cs new file mode 100755 index 0000000..28ce60a --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationSafeHandle.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + using System.ComponentModel; + using System.Runtime.InteropServices; + + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class NotificationSafeHandle : SafeHandle + { + [EditorBrowsable(EditorBrowsableState.Never)] + public NotificationSafeHandle() + : base(IntPtr.Zero, true) + { + } + + internal NotificationSafeHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsInvalid + { + get { return this.DangerousGetHandle() == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + Interop.Notification.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyle.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyle.cs new file mode 100755 index 0000000..84ec3a7 --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyle.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + /// + /// Class containing common properties and methods of Notifications + /// + /// + /// A notification is a message that is displayed on the notification area. + /// It is created to notify information to the user through the application. + /// This class helps you to provide method and property for creating notification object. + /// + public sealed partial class Notification + { + /// + /// An object that can apply a rich notification style to a Notification object. + /// If the platform does not provide rich notification styles in this class have no effect. + /// + public abstract class StyleBase : MakerBase + { + internal abstract string Key { get; } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs new file mode 100755 index 0000000..587c6ef --- /dev/null +++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs @@ -0,0 +1,286 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.Notifications +{ + using System; + + internal static class IndicatorBinder + { + internal static void BindObject(Notification notification) + { + int flag; + NotificationError ret = NotificationError.None; + Notification.IndicatorStyle style = (Notification.IndicatorStyle)notification.GetStyle("Indicator"); + Interop.Notification.GetApplist(notification.Handle, out flag); + + if (string.IsNullOrEmpty(style.SubText) == false) + { + ret = Interop.Notification.SetText(notification.Handle, NotificationText.FirstMainText, style.SubText, null, -1); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set indicator text"); + } + flag |= (int)NotificationDisplayApplist.Ticker; + } + + if (string.IsNullOrEmpty(style.IconPath) == false) + { + ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.IconForIndicator, style.IconPath); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set indicator image"); + } + flag |= (int)NotificationDisplayApplist.Indicator; + } + Interop.Notification.SetApplist(notification.Handle, flag); + } + + internal static void BindSafeHandle(Notification notification) + { + int appList; + Interop.Notification.GetApplist(notification.Handle, out appList); + if ((appList & (int)NotificationDisplayApplist.Ticker) != 0 || (appList & (int)NotificationDisplayApplist.Indicator) != 0) + { + string path, text; + Notification.IndicatorStyle indicator = new Notification.IndicatorStyle(); + Interop.Notification.GetImage(notification.Handle, NotificationImage.IconForIndicator, out path); + indicator.IconPath = path; + Interop.Notification.GetText(notification.Handle, NotificationText.FirstMainText, out text); + indicator.SubText = text; + + notification.AddStyle(indicator); + } + } + } + + internal static class ActiveBinder + { + internal static void BindObject(Notification notification) + { + int flag; + NotificationError ret = NotificationError.None; + Notification.ActiveStyle style = (Notification.ActiveStyle)notification.GetStyle("Active"); + + Interop.Notification.SetAutoRemove(notification.Handle, style.IsAutoRemove); + if (style.IsAutoRemove == true) + { + int hidetime; + int deletetime; + style.GetRemoveTime(out hidetime, out deletetime); + + Interop.Notification.SetHideTime(notification.Handle, hidetime); + try + { + Interop.Notification.SetDeleteTime(notification.Handle, deletetime); + } + catch (TypeLoadException) + { + // To support in API version 3.0 + style.SetRemoveTime(hidetime, 60); + } + } + + ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.Background, style?.BackgroundImage); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set background Image"); + } + + if (style.DefaultButton != ButtonIndex.None) + { + Interop.Notification.SetDefaultButton(notification.Handle, (int)style.DefaultButton + 1); + } + + Interop.Notification.GetApplist(notification.Handle, out flag); + Interop.Notification.SetApplist(notification.Handle, flag | (int)NotificationDisplayApplist.Active); + + foreach (Notification.ButtonAction button in style.GetButtonAction()) + { + button.Make(notification); + } + + if (style.ReplyAction != null) + { + style.ReplyAction.Make(notification); + } + } + + internal static void BindSafeHandle(Notification notification) + { + int appList; + Interop.Notification.GetApplist(notification.Handle, out appList); + + if ((appList & (int)NotificationDisplayApplist.Active) != 0) + { + Notification.ActiveStyle active = new Notification.ActiveStyle(); + bool isExisted = false; + bool autoRemove; + string path, text; + SafeAppControlHandle appcontrol = null; + string replyKey = "__PARENT_INDEX__"; + + for (int i = (int)ButtonIndex.First; i <= (int)ButtonIndex.Third; i++) + { + appcontrol = null; + + Interop.Notification.GetImage(notification.Handle, NotificationImage.FirstButton + i, out path); + Interop.Notification.GetText(notification.Handle, NotificationText.FirstButton + i, out text); + Interop.Notification.GetEventHandler(notification.Handle, i, out appcontrol); + + if (string.IsNullOrEmpty(path) == false || string.IsNullOrEmpty(text) == false + || (appcontrol != null && appcontrol.IsInvalid == false)) + { + Notification.ButtonAction button = new Notification.ButtonAction(); + if (appcontrol != null && appcontrol.IsInvalid == false) + { + button.Action = new AppControl(appcontrol); + } + + button.ImagePath = path; + button.Text = text; + button.Index = (ButtonIndex)i; + active.AddButtonAction(button); + isExisted = true; + } + } + + Interop.Notification.GetAutoRemove(notification.Handle, out autoRemove); + active.IsAutoRemove = autoRemove; + if (autoRemove) + { + int hidetime, deletetime; + Interop.Notification.GetHideTime(notification.Handle, out hidetime); + try + { + Interop.Notification.GetDeleteTime(notification.Handle, out deletetime); + } + catch (TypeLoadException) + { + // To support in API version 3.0 + deletetime = 60; + } + + active.SetRemoveTime(hidetime, deletetime); + } + + Interop.Notification.GetImage(notification.Handle, NotificationImage.Background, out path); + if (string.IsNullOrEmpty(path) == false) + { + isExisted = true; + active.BackgroundImage = path; + } + + int defaultIndex; + Interop.Notification.GetDefaultButton(notification.Handle, out defaultIndex); + active.DefaultButton = (ButtonIndex)(defaultIndex - 1); + + appcontrol = null; + Interop.Notification.GetImage(notification.Handle, NotificationImage.TextInputButton, out path); + Interop.Notification.GetText(notification.Handle, NotificationText.InputButton, out text); + Interop.Notification.GetEventHandler(notification.Handle, (int)NotificationEventType.ClickOnTextInputButton, out appcontrol); + + if (string.IsNullOrEmpty(path) == false || string.IsNullOrEmpty(text) == false + || (appcontrol != null && appcontrol.IsInvalid == false)) + { + Notification.ReplyAction reply = new Notification.ReplyAction(); + Notification.ButtonAction button = new Notification.ButtonAction(); + if (appcontrol != null && appcontrol.IsInvalid == false) + { + button.Action = new AppControl(appcontrol); + } + + button.ImagePath = path; + button.Text = text; + reply.Button = button; + + Interop.Notification.GetText(notification.Handle, NotificationText.PlaceHolder, out text); + reply.PlaceHolderText = text; + + int holderLength; + Interop.Notification.GetPlaceHolderLength(notification.Handle, out holderLength); + reply.ReplyMax = holderLength; + + isExisted = true; + + try + { + SafeBundleHandle bundleHandle; + Interop.Notification.GetExtentionData(notification.Handle, replyKey, out bundleHandle); + Bundle bundle = new Bundle(bundleHandle); + reply.ParentIndex = (ButtonIndex)int.Parse(bundle.GetItem(replyKey).ToString()); + } + catch (Exception ex) + { + Log.Error(Notification.LogTag, ex.ToString()); + } + + active.ReplyAction = reply; + } + + if (isExisted) + { + notification.AddStyle(active); + } + } + } + } + + internal static class LockBinder + { + internal static void BindObject(Notification notification) + { + int flag; + NotificationError ret = NotificationError.None; + Notification.LockStyle style = (Notification.LockStyle)notification.GetStyle("Lock"); + + ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.IconForLock, style.IconPath); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set lock icon"); + } + + ret = Interop.Notification.SetImage(notification.Handle, NotificationImage.ThumbnailForLock, style.ThumbnailPath); + if (ret != NotificationError.None) + { + throw NotificationErrorFactory.GetException(ret, "unable to set lock thumbnail"); + } + + Interop.Notification.GetApplist(notification.Handle, out flag); + Interop.Notification.SetApplist(notification.Handle, flag | (int)NotificationDisplayApplist.Lock); + } + + internal static void BindSafehandle(Notification notification) + { + int applist; + Interop.Notification.GetApplist(notification.Handle, out applist); + + if ((applist & (int)NotificationDisplayApplist.Lock) != 0) + { + string path; + Notification.LockStyle lockStyle = new Notification.LockStyle(); + + Interop.Notification.GetImage(notification.Handle, NotificationImage.IconForLock, out path); + lockStyle.IconPath = path; + + Interop.Notification.GetImage(notification.Handle, NotificationImage.ThumbnailForLock, out path); + lockStyle.ThumbnailPath = path; + + notification.AddStyle(lockStyle); + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.Libraries.cs b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..75347d4 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string NotificationEventListener = "libnotification.so.0"; + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs new file mode 100755 index 0000000..1e8b413 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Interop/Interop.NotificationEventListener.cs @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +using Tizen.Applications; +using Tizen.Applications.NotificationEventListener; + +internal static partial class Interop +{ + internal static class NotificationEventListener + { + internal delegate void ChangedCallback(IntPtr userData, NotificationType type, IntPtr operationList, int num); + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + DbError = -0x01140000 | 0x01, + AlreadyExists = -0x01140000 | 0x02, + DBusError = -0x01140000 | 0x03, + DoesnotExist = -0x01140000 | 0x04, + ServiceError = -0x01140000 | 0x05, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation + } + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_free")] + internal static extern ErrorCode Destroy(IntPtr handle); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_id")] + internal static extern ErrorCode GetID(NotificationSafeHandle handle, out int groupId, out int privateId); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_pkgname")] + internal static extern ErrorCode GetAppIdReferenceType(NotificationSafeHandle handle, out IntPtr appid); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_text")] + internal static extern ErrorCode GetTextReferenceType(NotificationSafeHandle handle, NotificationText type, out IntPtr text); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_image")] + internal static extern ErrorCode GetImageReferenceType(NotificationSafeHandle handle, NotificationImage type, out IntPtr text); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_insert_time")] + internal static extern ErrorCode GetInsertTime(NotificationSafeHandle handle, out int time); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_time")] + internal static extern ErrorCode GetTime(NotificationSafeHandle handle, out int time); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_sound")] + internal static extern ErrorCode GetSoundReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_vibration")] + internal static extern ErrorCode GetVibrationReferenceType(NotificationSafeHandle handle, out AccessoryOption type, out IntPtr path); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_led")] + internal static extern ErrorCode GetLed(NotificationSafeHandle handle, out AccessoryOption type, out int color); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_led_time_period")] + internal static extern ErrorCode GetLedTime(NotificationSafeHandle handle, out int onMilliSeconds, out int offMilliSeconds); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_tag")] + internal static extern ErrorCode GetTagReferenceType(NotificationSafeHandle handle, out IntPtr tag); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_display_applist")] + internal static extern ErrorCode GetStyleList(NotificationSafeHandle handle, out int styleList); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_auto_remove")] + internal static extern ErrorCode GetAutoRemove(NotificationSafeHandle handle, out bool autoRemove); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_text_input_max_length")] + internal static extern ErrorCode GetPlaceHolderLength(NotificationSafeHandle handle, out int max); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_launch_option")] + internal static extern ErrorCode GetAppControl(NotificationSafeHandle handle, LaunchOption type, out SafeAppControlHandle appControlHandle); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_event_handler")] + internal static extern ErrorCode GetEventHandler(NotificationSafeHandle handle, int type, out SafeAppControlHandle appControlHandle); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_register_detailed_changed_cb")] + internal static extern ErrorCode SetChangedCallback(ChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_unregister_detailed_changed_cb")] + internal static extern ErrorCode UnsetChangedCallback(ChangedCallback callback); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_op_get_data")] + internal static extern ErrorCode GetOperationData(IntPtr operationList, NotificationOperationDataType type, out IntPtr userData); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_list_get_data")] + internal static extern IntPtr GetData(IntPtr notificationList); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_list_get_next")] + internal static extern IntPtr GetNext(IntPtr notificationList); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_delete_by_priv_id")] + internal static extern ErrorCode Delete(string appId, NotificationType type, int uniqueNumber); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_clear")] + internal static extern ErrorCode DeleteAll(int type); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_list")] + internal static extern ErrorCode GetList(NotificationType type, int count, out IntPtr notification); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_send_event_by_priv_id")] + internal static extern ErrorCode SendEvent(int uniqueNumber, int evnetType); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_layout")] + internal static extern ErrorCode GetLayout(NotificationSafeHandle handle, out NotificationLayout type); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_type")] + internal static extern ErrorCode GetType(NotificationSafeHandle handle, out NotificationType type); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_ongoing_value_type")] + internal static extern ErrorCode GetOngoingType(NotificationSafeHandle handle, out ProgressCategory category); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_size")] + internal static extern ErrorCode GetProgressSize(NotificationSafeHandle handle, out double value); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_progress")] + internal static extern ErrorCode GetProgress(NotificationSafeHandle handle, out double value); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_property")] + internal static extern ErrorCode GetProperties(NotificationSafeHandle handle, out int flags); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_extention_data")] + internal static extern ErrorCode GetExtender(NotificationSafeHandle handle, string key, out SafeBundleHandle value); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_clone")] + internal static extern ErrorCode GetClone(IntPtr handle, out IntPtr value); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_free_list")] + internal static extern ErrorCode NotificationListFree(IntPtr list); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_args")] + internal static extern ErrorCode GetExtentionBundle(NotificationSafeHandle handle, out IntPtr args, out IntPtr groupArgs); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_hide_timeout")] + internal static extern ErrorCode GetHideTimeout(NotificationSafeHandle handle, out int timeout); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_delete_timeout")] + internal static extern ErrorCode GetDeleteTimeout(NotificationSafeHandle handle, out int timeout); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_event_flag")] + internal static extern ErrorCode GetEventFlag(NotificationSafeHandle handle, out bool eventFlag); + + [DllImport(Libraries.NotificationEventListener, EntryPoint = "notification_get_default_button")] + internal static extern ErrorCode GetDefaultButton(NotificationSafeHandle handle, out int index); + + internal static ErrorCode GetAppId(NotificationSafeHandle handle, out string appid) + { + ErrorCode err; + IntPtr ptr; + err = GetAppIdReferenceType(handle, out ptr); + + if (ptr == IntPtr.Zero) + { + appid = null; + } + else + { + appid = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal static ErrorCode GetText(NotificationSafeHandle handle, NotificationText type, out string text) + { + ErrorCode err; + IntPtr ptr; + err = GetTextReferenceType(handle, type, out ptr); + + if (ptr == IntPtr.Zero) + { + text = null; + } + else + { + text = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal static ErrorCode GetImage(NotificationSafeHandle handle, NotificationImage type, out string text) + { + ErrorCode err; + IntPtr ptr; + err = GetImageReferenceType(handle, type, out ptr); + + if (ptr == IntPtr.Zero) + { + text = null; + } + else + { + text = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal static ErrorCode GetSound(NotificationSafeHandle handle, out AccessoryOption type, out string path) + { + ErrorCode err; + IntPtr ptr; + err = GetSoundReferenceType(handle, out type, out ptr); + + if (ptr == IntPtr.Zero) + { + path = null; + } + else + { + path = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal static ErrorCode GetVibration(NotificationSafeHandle handle, out AccessoryOption type, out string path) + { + ErrorCode err; + IntPtr ptr; + err = GetVibrationReferenceType(handle, out type, out ptr); + + if (ptr == IntPtr.Zero) + { + path = null; + } + else + { + path = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal static ErrorCode GetTag(NotificationSafeHandle handle, out string tag) + { + ErrorCode err; + IntPtr ptr; + err = GetTagReferenceType(handle, out ptr); + + if (ptr == IntPtr.Zero) + { + tag = null; + } + else + { + tag = Marshal.PtrToStringAnsi(ptr); + } + + return err; + } + + internal sealed class NotificationSafeHandle : SafeHandle + { + public NotificationSafeHandle() + : base(IntPtr.Zero, true) + { + } + + internal NotificationSafeHandle(IntPtr existingHandle, bool ownsHandle) : base(IntPtr.Zero, ownsHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + NotificationEventListener.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.csproj b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.sln b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.sln new file mode 100755 index 0000000..5d8b12b --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.NotificationEventListener", "Tizen.Applications.NotificationEventListener.csproj", "{E3032B94-F177-43F9-9C3F-BA90717C26BF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{7F09F72D-15F1-4980-87D5-8387213CB4A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{1232A53F-6B57-469F-A2E1-54AA49FA63B1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{2C3BE4AB-1DB5-44D9-85C0-AAD4477D23F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E3032B94-F177-43F9-9C3F-BA90717C26BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E3032B94-F177-43F9-9C3F-BA90717C26BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E3032B94-F177-43F9-9C3F-BA90717C26BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E3032B94-F177-43F9-9C3F-BA90717C26BF}.Release|Any CPU.Build.0 = Release|Any CPU + {7F09F72D-15F1-4980-87D5-8387213CB4A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F09F72D-15F1-4980-87D5-8387213CB4A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F09F72D-15F1-4980-87D5-8387213CB4A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F09F72D-15F1-4980-87D5-8387213CB4A8}.Release|Any CPU.Build.0 = Release|Any CPU + {1232A53F-6B57-469F-A2E1-54AA49FA63B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1232A53F-6B57-469F-A2E1-54AA49FA63B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1232A53F-6B57-469F-A2E1-54AA49FA63B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1232A53F-6B57-469F-A2E1-54AA49FA63B1}.Release|Any CPU.Build.0 = Release|Any CPU + {2C3BE4AB-1DB5-44D9-85C0-AAD4477D23F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2C3BE4AB-1DB5-44D9-85C0-AAD4477D23F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2C3BE4AB-1DB5-44D9-85C0-AAD4477D23F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2C3BE4AB-1DB5-44D9-85C0-AAD4477D23F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationAccessoryArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationAccessoryArgsBinder.cs new file mode 100755 index 0000000..30dd573 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationAccessoryArgsBinder.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + internal static class NotificationAccessoryAgsBinder + { + internal static void BindObject(NotificationEventArgs eventargs) + { + AccessoryOption type; + int color; + string path; + + NotificationEventArgs.AccessoryArgs accessory = new NotificationEventArgs.AccessoryArgs(); + + Interop.NotificationEventListener.GetLed(eventargs.Handle, out type, out color); + accessory.LedOption = type; + if (type != AccessoryOption.Off) + { + int on, off; + + Interop.NotificationEventListener.GetLedTime(eventargs.Handle, out on, out off); + accessory.LedOnMillisecond = on; + accessory.LedOffMillisecond = off; + + if (type == AccessoryOption.Custom) + { + accessory.LedColor = new Common.Color(color >> 16 & 255, color >> 8 & 255, color >> 0 & 255, color >> 24 & 255); + } + } + + Interop.NotificationEventListener.GetSound(eventargs.Handle, out type, out path); + accessory.SoundOption = type; + if (type == AccessoryOption.Custom) + { + accessory.SoundPath = path; + } + + Interop.NotificationEventListener.GetVibration(eventargs.Handle, out type, out path); + if (type == AccessoryOption.Off) + { + accessory.CanVibrate = false; + } + else + { + accessory.CanVibrate = true; + } + + eventargs.Accessory = accessory; + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationButtonActionArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationButtonActionArgsBinder.cs new file mode 100755 index 0000000..e252015 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationButtonActionArgsBinder.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + internal static class NotificationButtonActionArgBinder + { + internal static void BindObject(NotificationEventArgs eventargs, int index) + { + string text; + bool isExisted = false; + SafeAppControlHandle appcontrol = null; + NotificationEventArgs.ButtonActionArgs button = new NotificationEventArgs.ButtonActionArgs(); + + button.Index = (ButtonIndex)index; + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Button_1 + index, out text); + if (string.IsNullOrEmpty(text) == false) + { + isExisted = true; + button.ImagePath = text; + } + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.FirstButton + index, out text); + if (string.IsNullOrEmpty(text) == false) + { + isExisted = true; + button.Text = text; + } + + Interop.NotificationEventListener.GetEventHandler(eventargs.Handle, index, out appcontrol); + + if (appcontrol != null && appcontrol.IsInvalid == false) + { + button.Action = new AppControl(appcontrol); + isExisted = true; + } + + if (isExisted) + { + (eventargs.Style["Active"] as NotificationEventArgs.ActiveStyleArgs).Button.Add(button); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgs.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgs.cs new file mode 100755 index 0000000..5d05883 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgs.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + /// + /// This class provides the property to get information about the deleted notification. + /// + public class NotificationDeleteEventArgs : EventArgs + { + /// + /// Gets the unique number of the Notification. + /// + public int UniqueNumber { get; internal set; } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgsBinder.cs new file mode 100755 index 0000000..35108cd --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationDeleteEventArgsBinder.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + internal static class NotificationDeleteEventArgsBinder + { + internal static NotificationDeleteEventArgs BindObject(int uniqueNumber) + { + NotificationDeleteEventArgs deleteargs = new NotificationDeleteEventArgs(); + + deleteargs.UniqueNumber = uniqueNumber; + + return deleteargs; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs new file mode 100755 index 0000000..9f348f6 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgs.cs @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs : EventArgs + { + private const string LogTag = "Tizen.Applications.NotificationEventListener"; + + internal IDictionary Style; + internal IDictionary Extender; + internal Interop.NotificationEventListener.NotificationSafeHandle Handle; + + /// + /// Initializes a new instance of the class. + /// + public NotificationEventArgs() + { + Style = new Dictionary(); + Extender = new Dictionary(); + } + + /// + /// Gets the unique id of Notification. + /// + public int UniqueNumber { get; internal set; } + + /// + /// Gets the appId of Notification. + /// + public string AppID { get; internal set; } + + /// + /// Gets the title of Notification. + /// + public string Title { get; internal set; } + + /// + /// Gets the content text of Notification. + /// + public string Content { get; internal set; } + + /// + /// Gets the icon's path of Notification. + /// + public string Icon { get; internal set; } + + /// + /// Gets the sub icon path of Notification. + /// + public string SubIcon { get; internal set; } + + /// + /// Gets the Timestamp of notification is visible or not. + /// + public bool IsTimeStampVisible { get; internal set; } + + /// + /// Gets TimeStamp of Notification. + /// + /// + /// If IsTimeStampVisible property is set false, this TimeStamp property is meanless. + /// + public DateTime TimeStamp { get; internal set; } + + /// + /// Gets the count which is displayed at the right side of notification. + /// + public int Count { get; internal set; } + + /// + /// Gets the Tag of notification. + /// + public string Tag { get; internal set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool IsOngoing { get; internal set; } = false; + + /// + /// Gets a value that determines whether notification is displayed on the default viewer. + /// If IsDisplay property set false and add style, you can see only style notification. + /// + public bool IsDisplay { get; internal set; } = true; + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool HasEventFlag { get; internal set; } = false; + + /// + /// Gets the AppControl which is invoked when notification is clicked. + /// + public AppControl Action { get; internal set; } + + /// + /// Gets the object of the progress notification. + /// + public ProgressArgs Progress { get; internal set; } + + /// + /// Gets the AccessoryArgs which has option of Sound, Vibration, LED. + /// + public AccessoryArgs Accessory { get; internal set; } + + /// + /// Gets the key for extender. + /// + public ICollection ExtenderKey + { + get + { + return Extender.Keys; + } + } + + /// + /// Gets the property. + /// + public NotificationProperty Property { get; internal set; } + + /// + /// Gets the styleArgs of active, lock, indicator, bigpicture. + /// + /// Type of notification style to be queried + /// The NotificationEventListener.StyleArgs object associated with the given style + /// Thrown when argument is invalid + public T GetStyle() where T : StyleArgs, new() + { + T type = new T(); + StyleArgs style = null; + + Style.TryGetValue(type.Key, out style); + + if (style == null) + { + Log.Error(LogTag, "Invalid Style"); + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered"); + } + else + { + return style as T; + } + } + + /// + /// Gets the ExtenderArgs. + /// + /// The key that specifies which extender + /// Returns the bundle for key + public Bundle GetExtender(string key) + { + Bundle bundle; + + if (string.IsNullOrEmpty(key)) + { + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered"); + } + + if (Extender.TryGetValue(key, out bundle) == false) + { + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter entered : " + key); + } + + return bundle; + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsAccessory.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsAccessory.cs new file mode 100755 index 0000000..b09398c --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsAccessory.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using Tizen.Common; + + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Notification accessory. + /// + public class AccessoryArgs + { + /// + /// Gets the sound option. + /// + public AccessoryOption SoundOption { get; internal set; } + + /// + /// Gets the sound path. + /// + public string SoundPath { get; internal set; } + + /// + /// Gets the vibration option. + /// + public bool CanVibrate { get; internal set; } + + /// + /// Gets the led option. + /// + public AccessoryOption LedOption { get; internal set; } + + /// + /// Gets led on time period that you would like the LED on the device to blink. as well as the rate. + /// + /// + /// Default value of LedOnMilliseconds is 0. + /// The rate is specified in terms of the number of milliseconds to be on. + /// + public int LedOnMillisecond { get; internal set; } + + /// + /// Gets led on time period that you would like the LED on the device to blink. as well as the rate. + /// + /// + /// Default value of LedOffMillisecond is 0. + /// The rate is specified in terms of the number of millisecond to be off. + /// + public int LedOffMillisecond { get; internal set; } + + /// + /// Gets led color that you would like the LED on the device to blink. + /// + public Color LedColor { get; internal set; } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs new file mode 100755 index 0000000..7495ffc --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsActiveStyle.cs @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System.Collections.Generic; + + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Notification Active style. + /// + public class ActiveStyleArgs : StyleArgs + { + /// + /// Initializes a new instance of the class. + /// + public ActiveStyleArgs() + { + Button = new List(); + } + + /// + /// Gets the IsAutoRemove option of the active notification. + /// IsAutoRemove option lets the active notification be removed several seconds after it shows. + /// + /// + /// When 'IsAutoRemove' is set as false, the active notification will not be removed as long as the user removes + /// the active notification or the app which posted the active notification removes the active notification. + /// + public bool IsAutoRemove { get; internal set; } + + /// + /// Gets an absolute path for an image file to display on the background of active notification. + /// + public string BackgroundImage { get; internal set; } + + /// + /// Gets the default button to display highlight on the active notification + /// + public ButtonIndex DefaultButton { get; internal set; } + + /// + /// Gets timeout value in second when the notification can be hidden from the viewer. + /// + public int HideTimeout { get; internal set; } + + /// + /// Gets timeout value in second when the notification can be deleted from the viewer. + /// + public int DeleteTimeout { get; internal set; } + + /// + /// Gets a button to this active notification style. + /// Buttons are displayed in the notification content. + /// + public IList Button { get; internal set; } + + /// + /// Gets a ReplyAction to this active notification style. + /// + public ReplyActionArgs Reply { get; internal set; } + + internal override string Key + { + get + { + return "Active"; + } + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs new file mode 100755 index 0000000..e38f331 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsBinder.cs @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + + internal static class NotificationEventArgsBinder + { + private const string LogTag = "Tizen.Applications.NotificationEventListener"; + + internal static NotificationEventArgs BindObject(IntPtr notification, bool data) + { + Interop.NotificationEventListener.ErrorCode err; + int time; + int uniqueNumber = -1; + int groupNumber = -1; + int property; + int doNotShowTimeStamp = -1; + int displayList; + bool eventFlag = false; + NotificationLayout layout; + NotificationType type; + string text; + IntPtr extention = IntPtr.Zero; + IntPtr dummy = IntPtr.Zero; + SafeAppControlHandle appcontrol = null; + + NotificationEventArgs eventargs = new NotificationEventArgs(); + + eventargs.Handle = new Interop.NotificationEventListener.NotificationSafeHandle(notification, data); + + err = Interop.NotificationEventListener.GetID(eventargs.Handle, out groupNumber, out uniqueNumber); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Error(LogTag, "unable to get UniqueNumber"); + } + + eventargs.UniqueNumber = uniqueNumber; + + Interop.NotificationEventListener.GetAppId(eventargs.Handle, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.AppID = text; + } + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.Title, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.Title = text; + } + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.Content, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.Content = text; + } + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Icon, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.Icon = text; + } + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.SubIcon, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.SubIcon = text; + } + + err = Interop.NotificationEventListener.GetTime(eventargs.Handle, out time); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get TimeStamp"); + } + + if (time == doNotShowTimeStamp) + { + eventargs.IsTimeStampVisible = false; + } + else + { + eventargs.IsTimeStampVisible = true; + + if (time == 0) + { + err = Interop.NotificationEventListener.GetInsertTime(eventargs.Handle, out time); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get InsertTime"); + } + } + + eventargs.TimeStamp = (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddSeconds(time).ToLocalTime(); + } + + err = Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.EventCount, out text); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get Event Count"); + } + + if (string.IsNullOrEmpty(text) == false) + { + try + { + eventargs.Count = int.Parse(text); + } + catch (Exception ex) + { + Log.Error(LogTag, ex.ToString()); + } + } + + err = Interop.NotificationEventListener.GetAppControl(eventargs.Handle, LaunchOption.AppControl, out appcontrol); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get Action"); + } + + if (appcontrol != null && appcontrol.IsInvalid == false) + { + eventargs.Action = new AppControl(appcontrol); + } + + Interop.NotificationEventListener.GetTag(eventargs.Handle, out text); + if (string.IsNullOrEmpty(text) == false) + { + eventargs.Tag = text; + } + + err = Interop.NotificationEventListener.GetProperties(eventargs.Handle, out property); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get Property"); + } + else + { + eventargs.Property = (NotificationProperty)property; + } + + Interop.NotificationEventListener.GetStyleList(eventargs.Handle, out displayList); + if ((displayList & (int)NotificationDisplayApplist.Tray) == 0) + { + eventargs.IsDisplay = false; + } + + err = Interop.NotificationEventListener.GetExtentionBundle(eventargs.Handle, out extention, out dummy); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get Extender"); + } + + if (extention != IntPtr.Zero) + { + Bundle bundle = new Bundle(new SafeBundleHandle(extention, false)); + foreach (string key in bundle.Keys) + { + SafeBundleHandle sbh; + Interop.NotificationEventListener.GetExtender(eventargs.Handle, key, out sbh); + eventargs.Extender.Add(key, new Bundle(sbh)); + } + } + + err = Interop.NotificationEventListener.GetLayout(eventargs.Handle, out layout); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get layout"); + } + + err = Interop.NotificationEventListener.GetType(eventargs.Handle, out type); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get type"); + } + + if (layout == NotificationLayout.OngoingEvent && type == NotificationType.Ongoing) + { + eventargs.IsOngoing = true; + } + + err = Interop.NotificationEventListener.GetEventFlag(eventargs.Handle, out eventFlag); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + Log.Info(LogTag, "unable to get event flag"); + } + + eventargs.HasEventFlag = eventFlag; + + NotificationAccessoryAgsBinder.BindObject(eventargs); + NotificationStyleArgBinder.BindObject(eventargs); + NotificationProgressArgBinder.BindObject(eventargs); + + return eventargs; + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsButtonAction.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsButtonAction.cs new file mode 100755 index 0000000..2e39158 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsButtonAction.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Notification ButtonAction. + /// + public class ButtonActionArgs + { + /// + /// Gets the Index of the Button which is appeared at Notification. + /// + public ButtonIndex Index { get; internal set; } + + /// + /// Gets the text that describes the button. + /// + public string Text { get; internal set; } + + /// + /// Gets the image's path that represent the button. + /// + public string ImagePath { get; internal set; } + + /// + /// Gets the AppControl that is invoked when the button is clicked. + /// + public AppControl Action { get; internal set; } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs new file mode 100755 index 0000000..348a016 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsEnumerations.cs @@ -0,0 +1,488 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + using System.ComponentModel; + + /// + /// Enumeration for Progress category + /// + public enum ProgressCategory + { + /// + /// Value for percent type + /// + Percent, + + /// + /// Value for time type + /// + Time, + + /// + /// Value for pending type which is not updated progress current value + /// + PendingBar + } + + /// + /// Enumeration for Accessory option + /// + public enum AccessoryOption + { + /// + /// Value for off accessory option + /// + Off = -1, + + /// + /// Value for on accessory option + /// + On, + + /// + /// Value for custom accessory option + /// + Custom + } + + /// + /// Enumeration for Button Index + /// + public enum ButtonIndex + { + /// + /// Value for default button index + /// + None = -1, + + /// + /// Value for first button index + /// + First, + + /// + /// Value for second button index + /// + Second, + + /// + /// Value for third button index + /// + Third + } + + /// + /// Enumeration for notification particular property + /// + [Flags] + public enum NotificationProperty + { + /// + /// Value for adjust nothing + /// + None = 0x00, + + /// + /// Value for display only SIM card inserted + /// + DisplayOnlySimMode = 0x01, + + /// + /// Value for disable application launch when it selected + /// + DisableAppLaunch = 0x02, + + /// + /// Value for disable auto delete when it selected + /// + DisableAutoDelete = 0x04, + + /// + /// Value for deleted when device is rebooted even though notification is not set OngoingType + /// + VolatileDisplay = 0x100, + } + + /// + /// Enumeration for event type on notification. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum UserEventType + { + /// + /// Event type : Click on button 1 + /// + ClickOnButton1 = 0, + + /// + /// Event type : Click on button 2 + /// + ClickOnButton2, + + /// + /// Event type : Click on button 3 + /// + ClickOnButton3, + + /// + /// Event type : Click on text_input button + /// + ClickOnReplyButton = 8, + + /// + /// Event type : Hidden by user + /// + HiddenByUser = 100, + + /// + /// Event type : Deleted by timer + /// + HiddenByTimeout = 101, + + /// + /// Event type : Clicked by user + /// + ClickOnNotification = 200, + + /// + /// Event type : Deleted by user + /// + DeleteNotification = 201, + } + + /// + /// Enumeration for notification type. + /// + internal enum NotificationType + { + /// + /// Notification type + /// + Notification = 0, + + /// + /// Ongoing type + /// + Ongoing, + } + + /// + /// Enumeration for notification text type. + /// + internal enum NotificationText + { + /// + /// Title + /// + Title = 0, + + /// + /// Content + /// + Content, + + /// + /// Text to display event count + /// + EventCount = 3, + + /// + /// Box contents 1 + /// + FirstMainText, + + /// + /// Box contents 1-1 + /// + FirstSubText, + + /// + /// Box contents 2 + /// + SecondMainText, + + /// + /// Box contents 2-1 + /// + SecondSubText, + + /// + /// Text on button 1 + /// + FirstButton = 13, + + /// + /// Text on button 2 + /// + SecondButton, + + /// + /// Text on button 3 + /// + ThirdButton, + + /// + /// Guide text on the message reply box + /// + PlaceHolder = 19, + + /// + /// Text on button the on message reply box + /// + InputButton = 20, + } + + /// + /// Enumeration for image type. + /// + internal enum NotificationImage + { + /// + /// Icon + /// + Icon = 0, + + /// + /// Indicator icon + /// + Indicator, + + /// + /// Lock screen icon + /// + Lockscreen, + + /// + /// Thumbnail + /// + Thumbnail, + + /// + /// Lock screen thumbnail + /// + ThumbnailLockscreen, + + /// + /// Icon + /// + SubIcon, + + /// + /// image displayed on background + /// + Background, + + /// + /// Image for button 1 + /// + Button_1 = 12, + + /// + /// Image for button 2 + /// + Button_2, + + /// + /// Image for button 3 + /// + Button_3, + + /// + /// Image for message reply + /// + TextInputButton = 18, + } + + /// + /// Enumeration for notification layout type. + /// + internal enum NotificationLayout + { + /// + /// Default + /// + None = 0, + + /// + /// Layout for notification. Used to inform single event + /// + SingleEvent = 1, + + /// + /// Layout for notification. Used to display images + /// + Thumbnail = 3, + + /// + /// Layout for ongoing notification. Used to display text message + /// + OngoingEvent = 4, + + /// + /// Layout for ongoing notification. Used to display progress + /// + OngoingProgress = 5, + } + + /// + /// Enumeration for notification launch option type. + /// + internal enum LaunchOption + { + /// + /// Launching with app control + /// + AppControl = 1 + } + + /// + /// Enumeration for notification operation data code. + /// + internal enum NotificationOperationDataType + { + /// + /// Default + /// + Min = 0, + + /// + /// Operation type + /// + Type, + + /// + /// Private ID + /// + UniqueNumber, + + /// + /// Notification handler + /// + Notification, + + /// + /// Reserved + /// + ExtraInformation1, + + /// + /// Reserved + /// + ExtraInformation2, + } + + /// + /// Enumeration for notification operation code. + /// + internal enum NotificationOperationType + { + /// + /// Default + /// + None = 0, + + /// + /// Notification inserted + /// + Insert, + + /// + /// Notification updated + /// + Update, + + /// + /// Notification deleted + /// + Delete, + } + + /// + /// Enumeration for event type on notification. + /// + internal enum ClickEventType + { + /// + /// Event type : Click on button 1 + /// + FirstButton = 0, + + /// + /// Event type : Click on button 2 + /// + SecondButton = 1, + + /// + /// Event type : Click on button 3 + /// + ThirdButton = 2, + + /// + /// Event type : Click on icon + /// + Icon = 6, + + /// + /// Event type : Click on thumbnail + /// + Thumbnail = 7, + + /// + /// Event type : Click on text_input button + /// + InputButton = 8, + } + + /// + /// Enumeration for display application list. + /// + [Flags] + internal enum NotificationDisplayApplist + { + /// + /// Notification Tray(Quickpanel) + /// + Tray = 0x00000001, + + /// + /// Ticker notification + /// + Ticker = 0x00000002, + + /// + /// Lock screen + /// + Lock = 0x00000004, + + /// + /// Indicator + /// + Indicator = 0x00000008, + + /// + /// Active notification + /// + Active = 0x00000010, + + /// + /// All display application except active notification + /// + All = 0x0000000f, + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsIndicatorStyle.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsIndicatorStyle.cs new file mode 100755 index 0000000..bc04cf1 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsIndicatorStyle.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to generate the Indicator style notification. + /// + public class IndicatorStyleArgs : StyleArgs + { + /// + /// Gets the path of the image file to display on the icon of Indicator style. + /// + public string IconPath { get; internal set; } + + /// + /// Gets the sub text to display Indicator style. + /// + public string SubText { get; internal set; } + + internal override string Key + { + get + { + return "Indicator"; + } + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsLockStyle.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsLockStyle.cs new file mode 100755 index 0000000..62ca496 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsLockStyle.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Notification Lock style. + /// + public class LockStyleArgs : StyleArgs + { + /// + /// Gets the path of the image file to display on the icon of Lock style. + /// + public string IconPath { get; internal set; } + + /// + /// Gets the path of the thumbnail image file to display on the icon of Lock style. + /// + public string Thumbnail { get; internal set; } + + internal override string Key + { + get + { + return "Lock"; + } + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsProgress.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsProgress.cs new file mode 100755 index 0000000..ed01380 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsProgress.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Progress Notification. + /// + public class ProgressArgs + { + /// + /// Gets category of ProgressType. + /// + public ProgressCategory Category { get; internal set; } + + /// + /// Gets current value of ProgressType. + /// + public double Current { get; internal set; } + + /// + /// Gets max value of ProgressType. + /// + public double Max { get; internal set; } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsReplyAction.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsReplyAction.cs new file mode 100755 index 0000000..d96ebf0 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsReplyAction.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + /// + /// Class to get infomation about Notification ReplyAction. + /// + public class ReplyActionArgs + { + /// + /// Gets Index of Button which is appeared at Notification. + /// If there is no ParentIndex, the ReplyAction should be displayed directly on the active notification. + /// + public ButtonIndex ParentIndex { get; internal set; } = ButtonIndex.None; + + /// + /// Gets the PlaceHolderText of ReplyAction which is appeared at Notification. + /// It will be displayed to the text input box on the active notification. + /// + public string PlaceHolderText { get; internal set; } + + /// + /// Gets a max length of text input. + /// + public int ReplyMax { get; internal set; } + + /// + /// Gets the button displayed in the replyaction. + /// + public ButtonActionArgs Button { get; internal set; } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsStyle.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsStyle.cs new file mode 100755 index 0000000..5ba07c7 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventArgsStyle.cs @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + /// + /// This class provides the methods and properties to get information about the posted or updated notification. + /// + public partial class NotificationEventArgs + { + public abstract class StyleArgs + { + internal abstract string Key { get; } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventListenerErrorFactory.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventListenerErrorFactory.cs new file mode 100755 index 0000000..8a6bbcb --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationEventListenerErrorFactory.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + using System.Runtime.CompilerServices; + + internal static class NotificationEventListenerErrorFactory + { + private const string LogTag = "Tizen.Applications.NotificationEventListener"; + + internal static Exception GetException( + Interop.NotificationEventListener.ErrorCode err, + string msg, + [CallerMemberName] string memberName = "", + [CallerFilePath] string filePath = "", + [CallerLineNumber] int lineNumber = 0) + { + Log.Error(LogTag, memberName + " : " + lineNumber); + switch (err) + { + case Interop.NotificationEventListener.ErrorCode.InvalidParameter: + Log.Error(LogTag, msg); + return new ArgumentException(err + " error occurred."); + case Interop.NotificationEventListener.ErrorCode.PermissionDenied: + Log.Error(LogTag, msg); + return new UnauthorizedAccessException(err + "Permission denied."); + default: + Log.Error(LogTag, msg); + return new InvalidOperationException(err + " error occurred."); + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs new file mode 100755 index 0000000..5f02395 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationListenerManager.cs @@ -0,0 +1,417 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + using System.Collections.Generic; + using System.ComponentModel; + using System.Runtime.InteropServices; + + /// + /// This class provides a way to register callback function for some notification events. + /// + /// + /// The event listener can use this class to get a list of notification or to clear notifications. + /// + public partial class NotificationListenerManager + { + private const string LogTag = "Tizen.Applications.NotificationEventListener"; + + private static event EventHandler AddEventHandler; + + private static event EventHandler UpdateEventHandler; + + private static event EventHandler DeleteEventHandler; + + private static Interop.NotificationEventListener.ChangedCallback callback; + + [StructLayout(LayoutKind.Sequential)] + private struct NotificationOperation + { + NotificationOperationType type; + int uniqueNumber; + int extraInformation1; + int extraInformation2; + IntPtr notification; + } + + private static int GetEventHandleLength() + { + int length = 0; + + length += (DeleteEventHandler == null) ? 0 : DeleteEventHandler.GetInvocationList().Length; + length += (UpdateEventHandler == null) ? 0 : UpdateEventHandler.GetInvocationList().Length; + length += (AddEventHandler == null) ? 0 : AddEventHandler.GetInvocationList().Length; + + return length; + } + + /// + /// Registers a callback for notification insert event. + /// + /// Thrown in case of Invalid parameter. + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static event EventHandler NotificationAddEventHandler + { + add + { + if (callback == null) + { + callback = new Interop.NotificationEventListener.ChangedCallback(ChangedEvent); + } + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.SetChangedCallback(callback, IntPtr.Zero); + if (err != (int)Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to set changed callback"); + } + } + + AddEventHandler += value; + } + + remove + { + if (AddEventHandler != null && AddEventHandler.GetInvocationList().Length > 0) + { + AddEventHandler -= value; + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.UnsetChangedCallback(callback); + if (err != (int)Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to unset changed callback"); + } + } + } + } + } + + /// + /// Registers a callback for notification update event. + /// + /// Thrown in case of Invalid parameter. + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static event EventHandler NotificationUpdateEventHandler + { + add + { + if (callback == null) + { + callback = new Interop.NotificationEventListener.ChangedCallback(ChangedEvent); + } + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.SetChangedCallback(callback, IntPtr.Zero); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to set changed callback"); + } + } + + UpdateEventHandler += value; + } + + remove + { + if (UpdateEventHandler != null && UpdateEventHandler.GetInvocationList().Length > 0) + { + UpdateEventHandler -= value; + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.UnsetChangedCallback(callback); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to unset changed callback"); + } + } + } + } + } + + /// + /// Registers a callback for notification delete event. + /// + /// Thrown in case of Invalid parameter. + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static event EventHandler NotificationDeleteEventHandler + { + add + { + if (callback == null) + { + callback = new Interop.NotificationEventListener.ChangedCallback(ChangedEvent); + } + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.SetChangedCallback(callback, IntPtr.Zero); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to set changed callback"); + } + } + + DeleteEventHandler += value; + } + + remove + { + if (DeleteEventHandler != null && DeleteEventHandler.GetInvocationList().Length > 0) + { + DeleteEventHandler -= value; + + if (GetEventHandleLength() == 0) + { + Interop.NotificationEventListener.ErrorCode err = Interop.NotificationEventListener.UnsetChangedCallback(callback); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to unset changed callback"); + } + } + } + } + } + + private static void ChangedEvent(IntPtr userData, NotificationType type, IntPtr operationList, int num) + { + IntPtr operationType; + IntPtr uniqueNumber; + IntPtr notification; + + NotificationEventArgs eventargs; + NotificationDeleteEventArgs deleteargs; + + for (int i = 0; i < num; i++) + { + uniqueNumber = IntPtr.Zero; + operationType = IntPtr.Zero; + notification = IntPtr.Zero; + + Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf()), NotificationOperationDataType.Type, out operationType); + Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf()), NotificationOperationDataType.UniqueNumber, out uniqueNumber); + Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf()), NotificationOperationDataType.Notification, out notification); + + if (operationType == IntPtr.Zero) + { + Log.Error(LogTag, "unable to get operationType"); + continue; + } + + Log.Info(LogTag, "type : " + ((int)operationType).ToString()); + Log.Info(LogTag, "Add : " + (AddEventHandler == null ? "0" : AddEventHandler.GetInvocationList().Length.ToString())); + Log.Info(LogTag, "update: " + (UpdateEventHandler == null ? "0" : UpdateEventHandler.GetInvocationList().Length.ToString())); + Log.Info(LogTag, "delete : " + (DeleteEventHandler == null ? "0" : DeleteEventHandler.GetInvocationList().Length.ToString())); + + switch ((int)operationType) + { + case (int)NotificationOperationType.Insert: + if (notification != IntPtr.Zero) + { + try + { + eventargs = NotificationEventArgsBinder.BindObject(notification, false); + AddEventHandler?.Invoke(null, eventargs); + } + catch (Exception e) + { + Log.Error(LogTag, e.Message); + } + } + + break; + + case (int)NotificationOperationType.Update: + if (notification != IntPtr.Zero) + { + try + { + eventargs = NotificationEventArgsBinder.BindObject(notification, false); + UpdateEventHandler?.Invoke(null, eventargs); + } + catch (Exception e) + { + Log.Error(LogTag, e.Message); + } + } + + break; + + case (int)NotificationOperationType.Delete: + if (uniqueNumber != IntPtr.Zero) + { + try + { + deleteargs = NotificationDeleteEventArgsBinder.BindObject((int)uniqueNumber); + DeleteEventHandler?.Invoke(null, deleteargs); + } + catch (Exception e) + { + Log.Error(LogTag, e.Message); + } + } + + break; + + default: + Log.Info(LogTag, "Event : " + (int)operationType); + break; + } + } + } + + /// + /// Deletes a Notification with appId and uniqueNumber. + /// + /// The name of the application you want to delete. + /// The unique number of the notification. + /// Thrown in case of Invalid parameter. + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static void Delete(string appId, int uniqueNumber) + { + Interop.NotificationEventListener.ErrorCode err; + + if (string.IsNullOrEmpty(appId) || uniqueNumber < 0) + { + throw NotificationEventListenerErrorFactory.GetException(Interop.NotificationEventListener.ErrorCode.InvalidParameter, "invalid parameter"); + } + + err = Interop.NotificationEventListener.Delete(appId, 0, uniqueNumber); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to delete"); + } + } + + /// + /// Deletes all Notification. + /// + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static void DeleteAll() + { + Interop.NotificationEventListener.ErrorCode err; + + err = Interop.NotificationEventListener.DeleteAll((int)NotificationType.Notification); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "delete all notifications failed of Noti type"); + } + + err = Interop.NotificationEventListener.DeleteAll((int)NotificationType.Ongoing); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "delete all notifications failed of Ongoing type"); + } + } + + /// + /// Returns the notification list handle. + /// + /// Thrown in case of Permission deny. + /// Thrown in case of any internal error. + /// http://tizen.org/privilege/notification + public static IList GetList() + { + Interop.NotificationEventListener.ErrorCode err; + IntPtr notificationList = IntPtr.Zero; + IntPtr currentList = IntPtr.Zero; + IList list = new List(); + + err = Interop.NotificationEventListener.GetList(NotificationType.Notification, -1, out notificationList); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to get notification list"); + } + + if (notificationList != IntPtr.Zero) + { + currentList = notificationList; + while (currentList != IntPtr.Zero) + { + IntPtr notification; + NotificationEventArgs eventargs = new NotificationEventArgs(); + + notification = Interop.NotificationEventListener.GetData(currentList); + + eventargs = NotificationEventArgsBinder.BindObject(notification, false); + + list.Add(eventargs); + + currentList = Interop.NotificationEventListener.GetNext(currentList); + } + + Interop.NotificationEventListener.NotificationListFree(notificationList); + notificationList = IntPtr.Zero; + } + + err = Interop.NotificationEventListener.GetList(NotificationType.Ongoing, -1, out notificationList); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "unable to get notification list"); + } + + if (notificationList != IntPtr.Zero) + { + currentList = notificationList; + while (currentList != IntPtr.Zero) + { + IntPtr notification; + NotificationEventArgs eventargs = new NotificationEventArgs(); + + notification = Interop.NotificationEventListener.GetData(currentList); + + eventargs = NotificationEventArgsBinder.BindObject(notification, false); + + list.Add(eventargs); + + currentList = Interop.NotificationEventListener.GetNext(currentList); + } + + Interop.NotificationEventListener.NotificationListFree(notificationList); + } + + return list; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public static void SendEvent(int uniqueNumber, UserEventType type) + { + Interop.NotificationEventListener.ErrorCode err; + + err = Interop.NotificationEventListener.SendEvent(uniqueNumber, (int)type); + if (err != Interop.NotificationEventListener.ErrorCode.None) + { + throw NotificationEventListenerErrorFactory.GetException(err, "failed to send event"); + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationProgressArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationProgressArgsBinder.cs new file mode 100755 index 0000000..8611503 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationProgressArgsBinder.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + internal static class NotificationProgressArgBinder + { + internal static void BindObject(NotificationEventArgs eventargs) + { + NotificationLayout layout; + Interop.NotificationEventListener.GetLayout(eventargs.Handle, out layout); + + if (layout == NotificationLayout.OngoingProgress) + { + ProgressCategory category; + double current, max; + + Interop.NotificationEventListener.GetOngoingType(eventargs.Handle, out category); + Interop.NotificationEventListener.GetProgress(eventargs.Handle, out current); + Interop.NotificationEventListener.GetProgressSize(eventargs.Handle, out max); + + if (category == ProgressCategory.Percent) + { + current *= 100; + + if (current == 0 && max == 0) + category = ProgressCategory.PendingBar; + } + + eventargs.Progress = new NotificationEventArgs.ProgressArgs(); + eventargs.Progress.Current = current; + eventargs.Progress.Max = max; + eventargs.Progress.Category = category; + } + } + } +} diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationReplyActionArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationReplyActionArgsBinder.cs new file mode 100755 index 0000000..a851009 --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationReplyActionArgsBinder.cs @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + + internal static class NotificationReplyActionArgBinder + { + private const string LogTag = "Tizen.Applications.NotificationEventListener"; + + internal static void BindObject(NotificationEventArgs eventargs) + { + string text; + int max; + bool isExisted = false; + SafeAppControlHandle appcontrol = null; + Bundle bundle; + NotificationEventArgs.ReplyActionArgs reply = new NotificationEventArgs.ReplyActionArgs(); + NotificationEventArgs.ButtonActionArgs button = new NotificationEventArgs.ButtonActionArgs(); + string replyKey = "__PARENT_INDEX__"; + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.TextInputButton, out text); + if (string.IsNullOrEmpty(text) == false) + { + isExisted = true; + button.ImagePath = text; + } + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.InputButton, out text); + if (string.IsNullOrEmpty(text) == false) + { + isExisted = true; + button.Text = text; + } + + Interop.NotificationEventListener.GetEventHandler(eventargs.Handle, (int)ClickEventType.InputButton, out appcontrol); + + if (appcontrol != null && appcontrol.IsInvalid == false) + { + button.Action = new AppControl(appcontrol); + isExisted = true; + } + + reply.Button = button; + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.PlaceHolder, out text); + + if (string.IsNullOrEmpty(text) == false) + { + isExisted = true; + reply.PlaceHolderText = text; + } + + Interop.NotificationEventListener.GetPlaceHolderLength(eventargs.Handle, out max); + reply.ReplyMax = max; + if (max > 0) + { + isExisted = true; + } + + if (eventargs.Extender.TryGetValue(replyKey, out bundle)) + { + if (bundle.Contains(replyKey)) + { + string parentIndex; + if (bundle.TryGetItem(replyKey, out parentIndex)) + { + try + { + reply.ParentIndex = (ButtonIndex)int.Parse(parentIndex); + isExisted = true; + } + catch (Exception ex) + { + Log.Error(LogTag, "unable to get ParentIndex " + ex.Message); + } + } + } + } + + if (isExisted) + { + (eventargs.Style["Active"] as NotificationEventArgs.ActiveStyleArgs).Reply = reply; + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs new file mode 100755 index 0000000..f45e4aa --- /dev/null +++ b/src/Tizen.Applications.NotificationEventListener/Tizen.Applications.NotificationEventListener/NotificationStyleArgsBinder.cs @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications.NotificationEventListener +{ + using System; + + internal static class NotificationStyleArgBinder + { + internal static void BindObject(NotificationEventArgs eventargs) + { + bool autoRemove; + string path; + int styleList; + int timeout; + + Interop.NotificationEventListener.GetStyleList(eventargs.Handle, out styleList); + + if ((styleList & (int)NotificationDisplayApplist.Active) != 0) + { + NotificationEventArgs.ActiveStyleArgs activeStyle = new NotificationEventArgs.ActiveStyleArgs(); + eventargs.Style.Add(activeStyle.Key, activeStyle); + + for (int i = (int)ClickEventType.FirstButton; i <= (int)ClickEventType.ThirdButton; i++) + { + NotificationButtonActionArgBinder.BindObject(eventargs, i); + } + + Interop.NotificationEventListener.GetAutoRemove(eventargs.Handle, out autoRemove); + activeStyle.IsAutoRemove = autoRemove; + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Background, out path); + activeStyle.BackgroundImage = path; + + int index; + Interop.NotificationEventListener.GetDefaultButton(eventargs.Handle, out index); + activeStyle.DefaultButton = (ButtonIndex)(index - 1); + + Interop.NotificationEventListener.GetHideTimeout(eventargs.Handle, out timeout); + activeStyle.HideTimeout = timeout; + + try + { + Interop.NotificationEventListener.GetDeleteTimeout(eventargs.Handle, out timeout); + } + catch (TypeLoadException) + { + //To support in API version 3.0 + timeout = 60; + } + activeStyle.DeleteTimeout = timeout; + + NotificationReplyActionArgBinder.BindObject(eventargs); + } + + if ((styleList & (int)NotificationDisplayApplist.Lock) != 0) + { + NotificationEventArgs.LockStyleArgs lockStyle = new NotificationEventArgs.LockStyleArgs(); + eventargs.Style.Add(lockStyle.Key, lockStyle); + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Lockscreen, out path); + lockStyle.IconPath = path; + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.ThumbnailLockscreen, out path); + lockStyle.Thumbnail = path; + } + + if ((styleList & (int)NotificationDisplayApplist.Ticker) != 0 || (styleList & (int)NotificationDisplayApplist.Indicator) != 0) + { + NotificationEventArgs.IndicatorStyleArgs indicatorStyle = new NotificationEventArgs.IndicatorStyleArgs(); + eventargs.Style.Add(indicatorStyle.Key, indicatorStyle); + + Interop.NotificationEventListener.GetImage(eventargs.Handle, NotificationImage.Indicator, out path); + indicatorStyle.IconPath = path; + + Interop.NotificationEventListener.GetText(eventargs.Handle, NotificationText.FirstMainText, out path); + indicatorStyle.SubText = path; + } + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Interop/Interop.Libraries.cs b/src/Tizen.Applications.PackageManager/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..83cbc6e --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string PackageManager = "libcapi-appfw-package-manager.so.0"; + } +} diff --git a/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs b/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs new file mode 100644 index 0000000..67de930 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Interop/Interop.Package.cs @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using ErrorCode = Interop.PackageManager.ErrorCode; +using StorageType = Interop.PackageManager.StorageType; +using CertCompareResultType = Interop.PackageManager.CertCompareResultType; + +internal static partial class Interop +{ + internal static partial class Package + { + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool PackageInfoAppInfoCallback(AppType appType, string appId, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool PackageInfoCertificateInfoCallback(IntPtr handle, CertificateType certType, string certValue, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool PackageInfoPrivilegeInfoCallback(string privilege, IntPtr userData); + + // Any change here might require changes in Tizen.Applications.AppType enum + internal enum AppType + { + All = 0, + Ui = 1, + Service = 2 + } + + internal enum CertificateType + { + AuthorRootCertificate = 0, + AuthorIntermediateCertificate = 1, + AuthorSignerCertificate = 2, + DistributorRootCertificate = 3, + DistributorIntermediateCertificate = 4, + DistributorSignerCertificate = 5, + Distributor2RootCertificate = 6, + Distributor2IntermediateCertificate = 7, + Distributor2SignerCertificate = 8 + } + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_foreach_app_from_package")] + internal static extern ErrorCode PackageInfoForeachAppInfo(IntPtr handle, AppType appType, PackageInfoAppInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_foreach_cert_info")] + internal static extern ErrorCode PackageInfoForeachCertificateInfo(IntPtr handle, PackageInfoCertificateInfoCallback callback, IntPtr user_data); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_foreach_privilege_info")] + internal static extern ErrorCode PackageInfoForeachPrivilegeInfo(IntPtr handle, PackageInfoPrivilegeInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_create")] + internal static extern ErrorCode PackageInfoCreate(string packageId, out IntPtr handle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_destroy")] + internal static extern ErrorCode PackageInfoDestroy(IntPtr handle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_package")] + internal static extern ErrorCode PackageInfoGetPackage(IntPtr handle, out string packageId); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_label")] + internal static extern ErrorCode PackageInfoGetLabel(IntPtr handle, out string label); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_icon")] + internal static extern ErrorCode PackageInfoGetIconPath(IntPtr handle, out string path); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_version")] + internal static extern ErrorCode PackageInfoGetVersion(IntPtr handle, out string version); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_type")] + internal static extern ErrorCode PackageInfoGetType(IntPtr handle, out string type); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_installed_storage")] + internal static extern ErrorCode PackageInfoGetInstalledStorage(IntPtr handle, out StorageType storage); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_root_path")] + internal static extern ErrorCode PackageInfoGetRootPath(IntPtr handle, out string path); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_tep_name")] + internal static extern ErrorCode PackageInfoGetTepName(IntPtr handle, out string name); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_system_package")] + internal static extern ErrorCode PackageInfoIsSystemPackage(IntPtr handle, out bool system); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_removable_package")] + internal static extern ErrorCode PackageInfoIsRemovablePackage(IntPtr handle, out bool removable); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_preload_package")] + internal static extern ErrorCode PackageInfoIsPreloadPackage(IntPtr handle, out bool preload); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_is_accessible")] + internal static extern ErrorCode PackageInfoIsAccessible(IntPtr handle, out bool accessible); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_info_get_installed_time")] + internal static extern ErrorCode PackageInfoGetInstalledTime(IntPtr handle, out int installedTime); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_compare_package_cert_info")] + internal static extern ErrorCode PackageCompareCertInfo(string lhsPackageId, string rhsPackageId, out CertCompareResultType result); + } +} diff --git a/src/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs b/src/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs new file mode 100755 index 0000000..92ad54e --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class PackageManager + { + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void PackageManagerEventCallback(string type, string packageId, EventType eventType, PackageEventState eventState, int progress, ErrorCode error, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool PackageManagerPackageInfoCallback(IntPtr handle, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void PackageManagerSizeInfoCallback(string packageId, IntPtr sizeInfoHandle, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void PackageManagerTotalSizeInfoCallback(IntPtr sizeInfoHandle, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void PackageManagerRequestEventCallback(int requestId, string type, string packageId, EventType eventType, PackageEventState eventState, int progress, ErrorCode error, IntPtr userData); + + // Any change here might require changes in Tizen.Applications.PackageManagerEventError enum + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + NoSuchPackage = -0x01150000 | 0x71, + SystemError = -0x01150000 | 0x72, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied + } + + // Any change here might require changes in Tizen.Applications.PackageEventState enum + internal enum PackageEventState + { + Started = 0, + Processing = 1, + Completed = 2, + Failed = 3 + } + + [Flags] + internal enum EventStatus + { + All = 0x00, + Install = 0x01, + Uninstall = 0x02, + Upgrade = 0x04, + Move = 0x08, + ClearData = 0x10, + Progress = 0x20, + } + + internal enum EventType + { + Install = 0, + Uninstall = 1, + Update = 2, + Move = 3, + ClearData = 4 + } + + internal enum CertCompareResultType + { + Match = 0, + Mismatch, + LhsNoCert, + RhsNoCert, + BothNoCert + } + + internal enum PackageManagerPermissionType + { + Normal = 0, + Signature, + Privilege + } + + // Any change here might require changes in Tizen.Applications.StorageType enum + internal enum StorageType + { + Internal = 0, + External = 1 + } + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_create")] + internal static extern ErrorCode PackageManagerCreate(out SafePackageManagerHandle managerHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_destroy")] + internal static extern ErrorCode PackageManagerDestroy(IntPtr managerHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_set_event_status")] + internal static extern ErrorCode PackageManagerSetEvenStatus(SafePackageManagerHandle managerHandle, EventStatus eventStatus); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_set_event_cb")] + internal static extern ErrorCode PackageManagerSetEvent(SafePackageManagerHandle managerHandle, PackageManagerEventCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_unset_event_cb")] + internal static extern ErrorCode PackageManagerUnsetEvent(SafePackageManagerHandle managerHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_foreach_package_info")] + internal static extern ErrorCode PackageManagerForeachPackageInfo(PackageManagerPackageInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_get_package_size_info")] + internal static extern ErrorCode PackageManagerGetSizeInfo(string packageId, PackageManagerSizeInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_get_total_package_size_info")] + internal static extern ErrorCode PackageManagerGetTotalSizeInfo(PackageManagerTotalSizeInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_get_package_id_by_app_id")] + internal static extern ErrorCode PackageManageGetPackageIdByAppId(string app_id, out string package_id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_get_package_info")] + internal static extern ErrorCode PackageManagerGetPackageInfo(string packageId, out IntPtr packageInfoHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_clear_cache_dir")] + internal static extern ErrorCode PackageManagerClearCacheDir(string packageId); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_clear_all_cache_dir")] + internal static extern ErrorCode PackageManagerClearAllCacheDir(); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_clear_data_dir")] + internal static extern ErrorCode PackageManagerClearDataDir(string packageId); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_filter_create")] + internal static extern ErrorCode PackageManagerFilterCreate(out IntPtr handle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_filter_destroy")] + internal static extern ErrorCode PackageManagerFilterDestroy(IntPtr handle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_filter_add_bool")] + internal static extern ErrorCode PackageManagerFilterAdd(IntPtr handle, string property, bool value); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_filter_foreach_package_info")] + internal static extern ErrorCode PackageManagerFilterForeachPackageInfo(IntPtr handle, PackageManagerPackageInfoCallback callback, IntPtr userData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_data_size")] + internal static extern ErrorCode PackageSizeInfoGetDataSize(IntPtr handle, out long dataSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_cache_size")] + internal static extern ErrorCode PackageSizeInfoGetCacheSize(IntPtr handle, out long cacheSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_app_size")] + internal static extern ErrorCode PackageSizeInfoGetAppSize(IntPtr handle, out long appSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_external_data_size")] + internal static extern ErrorCode PackageSizeInfoGetExtDataSize(IntPtr handle, out long extDataSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_external_cache_size")] + internal static extern ErrorCode PackageSizeInfoGetExtCacheSize(IntPtr handle, out long extCacheSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_size_info_get_external_app_size")] + internal static extern ErrorCode PackageSizeInfoGetExtAppSize(IntPtr handle, out long extAppSize); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_create")] + internal static extern ErrorCode PackageManagerRequestCreate(out SafePackageManagerRequestHandle requestHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_destroy")] + internal static extern ErrorCode PackageManagerRequestDestroy(IntPtr requestHandle); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_set_type")] + internal static extern ErrorCode PackageManagerRequestSetType(SafePackageManagerRequestHandle requestHandle, string type); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_set_tep")] + internal static extern ErrorCode PackageManagerRequestSetTepPath(SafePackageManagerRequestHandle requestHandle, string tepPath); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_install")] + internal static extern ErrorCode PackageManagerRequestInstall(SafePackageManagerRequestHandle requestHandle, string path, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_mount_install")] + internal static extern ErrorCode PackageManagerRequestMountInstall(SafePackageManagerRequestHandle requestHandle, string path, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_uninstall")] + internal static extern ErrorCode PackageManagerRequestUninstall(SafePackageManagerRequestHandle requestHandle, string name, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_move")] + internal static extern ErrorCode PackageManagerRequestMove(SafePackageManagerRequestHandle requestHandle, string name, StorageType moveToStorageType); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_compare_package_cert_info")] + internal static extern ErrorCode PackageManagerCompareCertInfo(string lhsPackageId, string rhsPackageId, out CertCompareResultType CompareResult); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_compare_app_cert_info")] + internal static extern ErrorCode PackageManagerCompareCertInfoByApplicationId(string lhsPackageId, string rhsPackageId, out CertCompareResultType CompareResult); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_is_preload_package_by_app_id")] + internal static extern ErrorCode PackageManagerIsPreloadPackageByApplicationId(string ApplicationId, out bool IsPreload); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_get_permission_type")] + internal static extern ErrorCode PackageManagerGetPermissionType(string ApplicationId, out PackageManagerPermissionType PermissionType); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_drm_generate_license_request")] + internal static extern ErrorCode PackageManagerDrmGenerateLicenseRequest(string responseData, out string requestData, out string licenseUrl); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_drm_register_license")] + internal static extern ErrorCode PackageManagerDrmRegisterLicense(string responseData); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_drm_decrypt_package")] + internal static extern ErrorCode PackageManagerDrmDecryptPackage(string drmFilePath, string decryptedFilePath); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_install_with_cb")] + internal static extern ErrorCode PackageManagerRequestInstallWithCB(SafePackageManagerRequestHandle requestHandle, string path, PackageManagerRequestEventCallback callback, IntPtr userData, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_mount_install_with_cb")] + internal static extern ErrorCode PackageManagerRequestMountInstallWithCB(SafePackageManagerRequestHandle requestHandle, string path, PackageManagerRequestEventCallback callback, IntPtr userData, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_uninstall_with_cb")] + internal static extern ErrorCode PackageManagerRequestUninstallWithCB(SafePackageManagerRequestHandle requestHandle, string name, PackageManagerRequestEventCallback callback, IntPtr userData, out int id); + + [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_request_move_with_cb")] + internal static extern ErrorCode PackageManagerRequestMoveWithCB(SafePackageManagerRequestHandle requestHandle, string name, StorageType moveToStorageType, PackageManagerRequestEventCallback callback, IntPtr userData, out int id); + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.csproj b/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.sln b/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.sln new file mode 100755 index 0000000..cf2eb9a --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications.PackageManager.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.PackageManager", "Tizen.Applications.PackageManager.csproj", "{A24D1896-459A-4501-AC43-D574873076E2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{826EC12D-620E-44BE-870D-43BFD31683B4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{979167CF-651A-4423-BEB8-7D9F7770498C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{BB8D64C7-89A1-4297-B537-A37F499D469B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A24D1896-459A-4501-AC43-D574873076E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A24D1896-459A-4501-AC43-D574873076E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A24D1896-459A-4501-AC43-D574873076E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A24D1896-459A-4501-AC43-D574873076E2}.Release|Any CPU.Build.0 = Release|Any CPU + {826EC12D-620E-44BE-870D-43BFD31683B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {826EC12D-620E-44BE-870D-43BFD31683B4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {826EC12D-620E-44BE-870D-43BFD31683B4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {826EC12D-620E-44BE-870D-43BFD31683B4}.Release|Any CPU.Build.0 = Release|Any CPU + {979167CF-651A-4423-BEB8-7D9F7770498C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {979167CF-651A-4423-BEB8-7D9F7770498C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {979167CF-651A-4423-BEB8-7D9F7770498C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {979167CF-651A-4423-BEB8-7D9F7770498C}.Release|Any CPU.Build.0 = Release|Any CPU + {BB8D64C7-89A1-4297-B537-A37F499D469B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB8D64C7-89A1-4297-B537-A37F499D469B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB8D64C7-89A1-4297-B537-A37F499D469B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB8D64C7-89A1-4297-B537-A37F499D469B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/CertCompareResultType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/CertCompareResultType.cs new file mode 100644 index 0000000..cd1512b --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/CertCompareResultType.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration for certificate compare result type. + /// + public enum CertCompareResultType + { + /// + /// Certificates are matched. + /// + Match = Interop.PackageManager.CertCompareResultType.Match, + /// + /// Certificates are not matched. + /// + Mismatch = Interop.PackageManager.CertCompareResultType.Mismatch, + /// + /// First package doesn't have certificate. + /// + LhsNoCert = Interop.PackageManager.CertCompareResultType.LhsNoCert, + /// + /// Second package doesn't have certificate. + /// + RhsNoCert = Interop.PackageManager.CertCompareResultType.RhsNoCert, + /// + /// Certificates of both packages are not exist. + /// + BothNoCert = Interop.PackageManager.CertCompareResultType.BothNoCert + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/CertificateType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/CertificateType.cs new file mode 100755 index 0000000..b9d5858 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/CertificateType.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for certification type. + /// + public enum CertificateType + { + /// + /// Author Certificate. + /// + Author, + /// + /// Distributor Certificate. + /// + Distributor, + /// + /// Distributor2 Certificate. + /// + Distributor2, + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs new file mode 100755 index 0000000..da643db --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/InstallationMode.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for installation mode. + /// + public enum InstallationMode + { + /// + /// Normal Mode. + /// + Normal, + /// + /// Mount Mode. + /// + Mount + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs new file mode 100755 index 0000000..3dcd619 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs @@ -0,0 +1,348 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// This class provide methods and properties to get information about packages. + /// + public class Package + { + private const string LogTag = "Tizen.Applications"; + + private string _id = string.Empty; + private string _label = string.Empty; + private string _iconPath = string.Empty; + private string _version = string.Empty; + private PackageType _type; + private Interop.PackageManager.StorageType _installedStorageType; + private string _rootPath = string.Empty; + private string _expansionPackageName = string.Empty; + private bool _isSystemPackage; + private bool _isRemovable; + private bool _isPreloaded; + private bool _isAccessible; + private IReadOnlyDictionary _certificates; + private List _privileges; + private int _installedTime; + + private Package(string pkgId) + { + _id = pkgId; + } + + /// + /// Package ID. + /// + public string Id { get { return _id; } } + + /// + /// Label of the package. + /// + public string Label { get { return _label; } } + + /// + /// Absolute path to the icon image. + /// + public string IconPath { get { return _iconPath; } } + + /// + /// Version of the package. + /// + public string Version { get { return _version; } } + + /// + /// Type of the package. + /// + public PackageType PackageType { get { return _type; } } + + /// + /// Installed storage type for the package. + /// + public StorageType InstalledStorageType { get { return (StorageType)_installedStorageType; } } + + /// + /// Root path for the package. + /// + public string RootPath { get { return _rootPath; } } + + /// + /// Expansion package name for the package. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public string TizenExpansionPackageName { get { return _expansionPackageName; } } + + /// + /// Checks whether the package is system package. + /// + public bool IsSystemPackage { get { return _isSystemPackage; } } + + /// + /// Checks whether the package is removable. + /// + public bool IsRemovable { get { return _isRemovable; } } + + /// + /// Checks whether the package is preloaded. + /// + public bool IsPreloaded { get { return _isPreloaded; } } + + /// + /// Checks whether the current package is accessible. + /// + public bool IsAccessible { get { return _isAccessible; } } + + /// + /// Certificate information for the package + /// + public IReadOnlyDictionary Certificates { get { return _certificates; } } + + /// + /// Requested privilege for the package + /// + public IEnumerable Privileges { get { return _privileges; } } + + /// + /// Installed time of the package. + /// + public int InstalledTime { get { return _installedTime; } } + + /// + /// Retrieves all application IDs of this package. + /// + /// Returns a dictionary containing all application info for given application type. + public IEnumerable GetApplications() + { + return GetApplications(ApplicationType.All); + } + + /// + /// Retrieves all application IDs of this package. + /// + /// Optional: AppType enum value + /// Returns a dictionary containing all application info for given application type. + public IEnumerable GetApplications(ApplicationType type) + { + List appInfoList = new List(); + Interop.Package.PackageInfoAppInfoCallback cb = (Interop.Package.AppType appType, string appId, IntPtr userData) => + { + appInfoList.Add(new ApplicationInfo(appId)); + return true; + }; + + IntPtr packageInfoHandle; + Interop.PackageManager.ErrorCode err = Interop.Package.PackageInfoCreate(Id, out packageInfoHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to create native handle for package info of {0}. err = {1}", Id, err)); + } + + err = Interop.Package.PackageInfoForeachAppInfo(packageInfoHandle, (Interop.Package.AppType)type, cb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to application info of {0}. err = {1}", Id, err)); + } + + err = Interop.Package.PackageInfoDestroy(packageInfoHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to destroy native handle for package info of {0}. err = {1}", Id, err)); + } + return appInfoList; + } + + /// + /// Gets size information for this package. + /// + /// package size information + /// http://tizen.org/privilege/packagemanager.info + public async Task GetSizeInformationAsync() + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.PackageManager.PackageManagerSizeInfoCallback sizeInfoCb = (pkgId, sizeInfoHandle, userData) => + { + if (sizeInfoHandle != IntPtr.Zero && Id == pkgId) + { + var pkgSizeInfo = PackageSizeInformation.GetPackageSizeInformation(sizeInfoHandle); + tcs.TrySetResult(pkgSizeInfo); + } + }; + + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerGetSizeInfo(Id, sizeInfoCb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + tcs.TrySetException(PackageManagerErrorFactory.GetException(err, "Failed to get total package size info of " + Id)); + } + return await tcs.Task.ConfigureAwait(false); + } + + /// + /// Compare certificate information with given package id. + /// + /// Id of the package + /// Certificate comparison result + /// Thrown when failed when input package ID is invalid + /// Thrown when method failed due to internal IO error + public CertCompareResultType CompareCertInfo(string packageId) + { + Interop.PackageManager.CertCompareResultType compareResult; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerCompareCertInfo(Id, packageId, out compareResult); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to compare package cert info"); + } + + return (CertCompareResultType)compareResult; + } + + // This method assumes that given arguments are already validated and have valid values. + internal static Package CreatePackage(IntPtr handle, string pkgId) + { + Package package = new Package(pkgId); + + var err = Interop.PackageManager.ErrorCode.None; + err = Interop.Package.PackageInfoGetLabel(handle, out package._label); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get package label of " + pkgId); + } + err = Interop.Package.PackageInfoGetIconPath(handle, out package._iconPath); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get package icon path of " + pkgId); + } + err = Interop.Package.PackageInfoGetVersion(handle, out package._version); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get package version of " + pkgId); + } + + string type; + Interop.Package.PackageInfoGetType(handle, out type); + if (Enum.TryParse(type, true, out package._type) == false) + { + Log.Warn(LogTag, "Failed to get package type of " + pkgId); + } + err = Interop.Package.PackageInfoGetRootPath(handle, out package._rootPath); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get package root directory of " + pkgId); + } + err = Interop.Package.PackageInfoGetTepName(handle, out package._expansionPackageName); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get expansion package name of " + pkgId); + package._expansionPackageName = string.Empty; + } + + err = Interop.Package.PackageInfoGetInstalledStorage(handle, out package._installedStorageType); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get installed storage type of " + pkgId); + } + Interop.Package.PackageInfoIsSystemPackage(handle, out package._isSystemPackage); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is system package or not"); + } + Interop.Package.PackageInfoIsRemovablePackage(handle, out package._isRemovable); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is removable or not"); + } + Interop.Package.PackageInfoIsPreloadPackage(handle, out package._isPreloaded); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is preloaded or not"); + } + Interop.Package.PackageInfoIsAccessible(handle, out package._isAccessible); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is accessible or not"); + } + try + { + Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, "Failed to get installed time of " + pkgId); + } + } + catch (TypeLoadException) + { + // To support in API vesion 3.0 + package._installedTime = 0; + } + + package._certificates = PackageCertificate.GetPackageCertificates(handle); + package._privileges = GetPackagePrivilegeInformation(handle); + return package; + } + + internal static Package GetPackage(string packageId) + { + IntPtr packageInfoHandle; + Interop.PackageManager.ErrorCode err = Interop.Package.PackageInfoCreate(packageId, out packageInfoHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, string.Format("Failed to create native handle for package info of {0}", packageId)); + } + + Package package = CreatePackage(packageInfoHandle, packageId); + + err = Interop.Package.PackageInfoDestroy(packageInfoHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to destroy native handle for package info of {0}. err = {1}", packageId, err)); + } + return package; + } + + internal static Package GetPackage(IntPtr packageInfoHandle) + { + String packageId; + Interop.PackageManager.ErrorCode err = Interop.Package.PackageInfoGetPackage(packageInfoHandle, out packageId); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to get package id for given package handle."); + } + return CreatePackage(packageInfoHandle, packageId); + } + + private static List GetPackagePrivilegeInformation(IntPtr packageInfoHandle) + { + List privileges = new List(); + Interop.Package.PackageInfoPrivilegeInfoCallback privilegeInfoCb = (privilege, userData) => + { + privileges.Add(privilege); + return true; + }; + + Interop.PackageManager.ErrorCode err = Interop.Package.PackageInfoForeachPrivilegeInfo(packageInfoHandle, privilegeInfoCb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get privilage info. err = {0}", err)); + } + return privileges; + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs new file mode 100755 index 0000000..914d21a --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageCertificate.cs @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// This class provides information about package certification. + /// + public class PackageCertificate + { + private const string LogTag = "Tizen.Applications"; + + private readonly string _root; + private readonly string _intermediate; + private readonly string _signer; + + internal PackageCertificate(string root, string intermediate, string signer) + { + _root = root; + _intermediate = intermediate; + _signer = signer; + } + + /// + /// Root certificate + /// + public string Root { get { return _root; } } + + /// + /// Intermediate certificate + /// + public string Intermediate { get { return _intermediate; } } + + /// + /// Signer certificate + /// + public string Signer { get { return _signer; } } + + internal static IReadOnlyDictionary GetPackageCertificates(IntPtr packageInfoHandle) + { + Dictionary nativeCertificates = new Dictionary(); + Interop.Package.PackageInfoCertificateInfoCallback certificateInfoCb = (handle, certType, certValue, userData) => + { + if (certValue == null) certValue = string.Empty; + nativeCertificates.Add(certType, certValue); + return true; + }; + + Interop.PackageManager.ErrorCode err = Interop.Package.PackageInfoForeachCertificateInfo(packageInfoHandle, certificateInfoCb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get certificate info. err = {0}", err)); + } + + Dictionary certificates = new Dictionary(); + string authorRootCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.AuthorRootCertificate); + string authorIntermediateCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.AuthorIntermediateCertificate); + string aurthorSignerCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.AuthorSignerCertificate); + certificates.Add(CertificateType.Author, new PackageCertificate(authorRootCertificate, authorIntermediateCertificate, aurthorSignerCertificate)); + + string distRootCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.DistributorRootCertificate); + string distIntermediateCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.DistributorIntermediateCertificate); + string distSignerCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.DistributorSignerCertificate); + certificates.Add(CertificateType.Distributor, new PackageCertificate(distRootCertificate, distIntermediateCertificate, distSignerCertificate)); + + string dist2RootCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); + string dist2IntermediateCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); + string dist2SignerCertificate = GetValue(nativeCertificates, Interop.Package.CertificateType.Distributor2RootCertificate); + certificates.Add(CertificateType.Distributor2, new PackageCertificate(dist2RootCertificate, dist2IntermediateCertificate, dist2SignerCertificate)); + + return certificates; + } + + private static string GetValue(IDictionary dict, Interop.Package.CertificateType key) + { + string value; + dict.TryGetValue(key, out value); + return value; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageDrm.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageDrm.cs new file mode 100644 index 0000000..cb45bbb --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageDrm.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// This class provide methods and properties for DRM operation + /// + public class PackageDrm + { + private string _responseData; + private string _requestData; + private string _licenseUrl; + private PackageDrm(string responseData, string requestData, string licenseUrl) + { + _responseData = responseData; + _requestData = requestData; + _licenseUrl = licenseUrl; + } + + /// + /// Returns response data + /// + /// Returns response data which is given when GenerateLicenseRequest has invoked + public string ResponseData { get { return _responseData; } } + + /// + /// Returns request data + /// + /// Returns request data which is generated when GenerateLicenseRequest has invoked + public string RequestData { get { return _requestData; } } + + /// + /// Returns license URL + /// + /// Returns license URL which is generated when GenerateLicenseRequest has invoked + public string LicenseUrl { get { return _licenseUrl; } } + + internal static PackageDrm CreateDrmRequest(string responseData, string requestData, string licenseUrl) + { + PackageDrm packageDrm = new PackageDrm(responseData, requestData, licenseUrl); + return packageDrm; + } + + internal static PackageDrm GenerateLicenseRequest(string responseData) + { + string requestData; + string licenseUrl; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmGenerateLicenseRequest(responseData, out requestData, out licenseUrl); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to generate license request"); + } + + PackageDrm packageDrm = CreateDrmRequest(responseData, requestData, licenseUrl); + return packageDrm; + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventState.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventState.cs new file mode 100755 index 0000000..827a87f --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventState.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for package manager event state. + /// + public enum PackageEventState + { + /// + /// Processing started + /// + Started = Interop.PackageManager.PackageEventState.Started, + /// + /// Processing state. + /// + Processing = Interop.PackageManager.PackageEventState.Processing, + /// + /// Processing Completed. + /// + Completed = Interop.PackageManager.PackageEventState.Completed, + /// + /// Processing Failed. + /// + Failed = Interop.PackageManager.PackageEventState.Failed + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventType.cs new file mode 100755 index 0000000..15d1f1b --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageEventType.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for package manager event type. + /// + public enum PackageEventType + { + /// + /// Install event. + /// + Install = Interop.PackageManager.EventType.Install, + /// + /// Uninstall event. + /// + Uninstall = Interop.PackageManager.EventType.Uninstall, + /// + /// Update event. + /// + Update = Interop.PackageManager.EventType.Update, + /// + /// Move event. + /// + Move = Interop.PackageManager.EventType.Move, + /// + /// ClearData event. + /// + ClearData = Interop.PackageManager.EventType.ClearData + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageFilter.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageFilter.cs new file mode 100755 index 0000000..8ebff43 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageFilter.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Applications +{ + /// + /// This class is a parameter of PackageManager::GetPackages method. + /// + public class PackageFilter + { + private IDictionary _filter; + + /// + /// Default constructor with empty filter list. All installed applications will satisfy this filter unless updated with more specific filters. + /// + public PackageFilter() + { + _filter = new Dictionary(); + } + + /// + /// Constructor with specific filters. Using this will filter out installed packages which do not meet the criteria of the filters. + /// + public PackageFilter(IDictionary filter) + { + _filter = filter; + } + + /// + /// Filters to be used in the GetPackages method. + /// + public IDictionary Filters + { + get + { + return _filter; + } + } + + /// + /// This class contains possible keys for filter to be used in the GetPackages method. + /// + public static class Keys + { + /// + /// Key of the boolean property for filtering whether the package is removable + /// + public const string Removable = "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"; + /// + /// Key of the boolean property for filtering whether the package is readonly. + /// + public const string ReadOnly = "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"; + /// + /// Key of the boolean property for filtering whether the package supports disabling. + /// + public const string SupportsDisable = "PMINFO_PKGINFO_PROP_PACKAGE_SUPPORT_DISABLE"; + /// + /// Key of the boolean property for filtering whether the package is disabled. + /// + public const string Disable = "PMINFO_PKGINFO_PROP_PACKAGE_DISABLE"; + /// + /// Key of the boolean property for filtering whether the package is preloaded. + /// + public const string Preload = "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"; + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs new file mode 100755 index 0000000..b7f37ef --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManager.cs @@ -0,0 +1,1152 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.IO; + +namespace Tizen.Applications +{ + /// + /// PackageManager class. This class has the methods and events of the PackageManager. + /// + /// + /// The package manager is one of the core modules of Tizen application framework, and responsible for getting their information. + /// You can also retrieve information related to the packages that are installed on the device. + /// + public static class PackageManager + { + private const string LogTag = "Tizen.Applications.PackageManager"; + + private static SafePackageManagerHandle s_handle = new SafePackageManagerHandle(); + private static Interop.PackageManager.EventStatus s_eventStatus = Interop.PackageManager.EventStatus.All; + private static event EventHandler s_installEventHandler; + private static event EventHandler s_uninstallEventHandler; + private static event EventHandler s_updateEventHandler; + private static event EventHandler s_moveEventHandler; + private static event EventHandler s_clearDataEventHandler; + + private static Interop.PackageManager.PackageManagerEventCallback s_packageManagerEventCallback; + + /// + /// Event Callback Method for the request. + /// + /// Type of the package which was requested + /// ID of the package which was requested + /// Event type of the request + /// Current event state of the request + /// Progress for the request being processed by the package manager (in percent) + public delegate void RequestEventCallback(string type, string packageId, PackageEventType eventType, PackageEventState eventState, int progress); + + private static Dictionary RequestCallbacks = new Dictionary(); + private static Dictionary RequestHandles = new Dictionary(); + + private delegate Interop.PackageManager.ErrorCode InstallMethodWithCallback(SafePackageManagerRequestHandle requestHandle, string pkgPath, Interop.PackageManager.PackageManagerRequestEventCallback requestCallback, IntPtr userData, out int requestID); + private delegate Interop.PackageManager.ErrorCode InstallMethod(SafePackageManagerRequestHandle requestHandle, string pkgPath, out int requestID); + + /// + /// InstallProgressChanged event. This event is occurred when a package is getting installed and the progress of the request to the package manager changes. + /// + public static event EventHandler InstallProgressChanged + { + add + { + SetPackageManagerEventStatus(Interop.PackageManager.EventStatus.Install); + RegisterPackageManagerEventIfNeeded(); + s_installEventHandler += value; + } + remove + { + s_installEventHandler -= value; + UnregisterPackageManagerEventIfNeeded(); + UnsetPackageManagerEventStatus(); + } + } + + /// + /// UninstallProgressChanged event. This event is occurred when a package is getting uninstalled and the progress of the request to the package manager changes. + /// + public static event EventHandler UninstallProgressChanged + { + add + { + SetPackageManagerEventStatus(Interop.PackageManager.EventStatus.Uninstall); + RegisterPackageManagerEventIfNeeded(); + s_uninstallEventHandler += value; + } + remove + { + s_uninstallEventHandler -= value; + UnregisterPackageManagerEventIfNeeded(); + UnsetPackageManagerEventStatus(); + } + } + + /// + /// UpdateProgressChanged event. This event is occurred when a package is getting updated and the progress of the request to the package manager changes. + /// + public static event EventHandler UpdateProgressChanged + { + add + { + SetPackageManagerEventStatus(Interop.PackageManager.EventStatus.Upgrade); + RegisterPackageManagerEventIfNeeded(); + s_updateEventHandler += value; + } + remove + { + s_updateEventHandler -= value; + UnregisterPackageManagerEventIfNeeded(); + UnsetPackageManagerEventStatus(); + } + } + + /// + /// MoveProgressChanged event. This event is occurred when a package is getting moved and the progress of the request to the package manager changes. + /// + public static event EventHandler MoveProgressChanged + { + add + { + SetPackageManagerEventStatus(Interop.PackageManager.EventStatus.Move); + RegisterPackageManagerEventIfNeeded(); + s_moveEventHandler += value; + } + remove + { + s_moveEventHandler -= value; + UnregisterPackageManagerEventIfNeeded(); + UnsetPackageManagerEventStatus(); + } + } + + /// + /// ClearDataProgressChanged event. This event is occurred when data directories are cleared in the given package. + /// + public static event EventHandler ClearDataProgressChanged + { + add + { + SetPackageManagerEventStatus(Interop.PackageManager.EventStatus.ClearData); + RegisterPackageManagerEventIfNeeded(); + s_clearDataEventHandler += value; + } + remove + { + s_clearDataEventHandler -= value; + UnregisterPackageManagerEventIfNeeded(); + UnsetPackageManagerEventStatus(); + } + } + + private static SafePackageManagerHandle Handle + { + get + { + if (s_handle.IsInvalid) + { + var err = Interop.PackageManager.PackageManagerCreate(out s_handle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to create package manager handle. err = {0}", err)); + } + } + return s_handle; + } + } + + private static Interop.PackageManager.PackageManagerRequestEventCallback internalRequestEventCallback = (id, packageType, packageId, eventType, eventState, progress, error, userData) => + { + if (RequestCallbacks.ContainsKey(id)) + { + try + { + RequestCallbacks[id](packageType, packageId, (PackageEventType)eventType, (PackageEventState)eventState, progress); + if (eventState == Interop.PackageManager.PackageEventState.Completed || eventState == Interop.PackageManager.PackageEventState.Failed) + { + Log.Debug(LogTag, string.Format("release request handle for id : {0}", id)); + RequestHandles[id].Dispose(); + RequestHandles.Remove(id); + RequestCallbacks.Remove(id); + } + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + RequestHandles[id].Dispose(); + RequestHandles.Remove(id); + RequestCallbacks.Remove(id); + } + } + }; + + /// + /// Gets the package ID for the given app ID. + /// + /// The ID of the application + /// Returns the ID of the package. Empty string if App ID does not exist + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when app does not have privilege to access this method + /// http://tizen.org/privilege/packagemanager.info + public static string GetPackageIdByApplicationId(string applicationId) + { + string packageId; + var err = Interop.PackageManager.PackageManageGetPackageIdByAppId(applicationId, out packageId); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get package Id of {0}. err = {1}", applicationId, err)); + if (err != Interop.PackageManager.ErrorCode.InvalidParameter) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to get package Id"); + } + } + return packageId; + } + + /// + /// Gets the package information for the given package. + /// + /// The ID of the package + /// Returns the package information for the given package ID. + /// Thrown when failed when input package ID is invalid + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when method failed due to internal IO error + /// Thrown when app does not have privilege to access this method + /// http://tizen.org/privilege/packagemanager.info + public static Package GetPackage(string packageId) + { + return Package.GetPackage(packageId); + } + + /// + /// Clears the application's internal and external cache directory. + /// + /// Id of the package + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when method failed due to internal IO error + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + /// http://tizen.org/privilege/packagemanager.clearcache + public static void ClearCacheDirectory(string packageId) + { + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerClearCacheDir(packageId); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to clear cache directory for {0}. err = {1}", packageId, err)); + throw PackageManagerErrorFactory.GetException(err, "Failed to clear cache directory"); + } + } + + /// + /// Clears all application's internal and external cache directory. + /// + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when method failed due to internal IO error + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static void ClearAllCacheDirectory() + { + var err = Interop.PackageManager.PackageManagerClearAllCacheDir(); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to clear all cache directories. err = {0}", err)); + throw PackageManagerErrorFactory.GetException(err, "Failed to clear all cache directories"); + } + } + + /// + /// Clears the application's internal and external data directories + /// + /// + /// All files under data, shared/data and shared/trusted in the internal storage are removed. + /// And, If external storeage exists, then all files under data and shared/trusted in the external storage are removed. + /// + /// Id of the package + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when method failed due to internal IO error + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static void ClearDataDirectory(string packageId) + { + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerClearDataDir(packageId); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to clear data directory for {0}. err = {1}", packageId, err)); + throw PackageManagerErrorFactory.GetException(err, "Failed to clear data directory"); + } + } + + /// + /// Retrieves package information of all installed packages. + /// + /// Returns the list of packages. + /// http://tizen.org/privilege/packagemanager.info + public static IEnumerable GetPackages() + { + return GetPackages(null); + } + + /// + /// Retrieves package information of all installed packages satisfying filter conditions. + /// + /// Optional - package filters + /// Returns the list of packages. + /// http://tizen.org/privilege/packagemanager.info + public static IEnumerable GetPackages(PackageFilter filter) + { + List packageList = new List(); + + IntPtr filterHandle; + var err = Interop.PackageManager.PackageManagerFilterCreate(out filterHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to create package filter handle. err = {0}", err)); + return packageList; + } + + if (filter != null && filter.Filters != null) + { + foreach (KeyValuePair entry in filter?.Filters) + { + err = Interop.PackageManager.PackageManagerFilterAdd(filterHandle, entry.Key, entry.Value); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to configure package filter. err = {0}", err)); + break; + } + } + } + + if (err == Interop.PackageManager.ErrorCode.None) + { + Interop.PackageManager.PackageManagerPackageInfoCallback cb = (handle, userData) => + { + packageList.Add(Package.GetPackage(handle)); + return true; + }; + + err = Interop.PackageManager.PackageManagerFilterForeachPackageInfo(filterHandle, cb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get package Informations. err = {0}", err)); + } + } + + err = Interop.PackageManager.PackageManagerFilterDestroy(filterHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to destroy package filter handle. err = {0}", err)); + } + return packageList; + } + + /// + /// Gets the total package size information. + /// + /// Returns the total package size information asynchronously. + /// http://tizen.org/privilege/packagemanager.info + public static async Task GetTotalSizeInformationAsync() + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.PackageManager.PackageManagerTotalSizeInfoCallback cb = (handle, userData) => + { + if (handle != IntPtr.Zero) + { + tcs.TrySetResult(PackageSizeInformation.GetPackageSizeInformation(handle)); + } + }; + + var err = Interop.PackageManager.PackageManagerGetTotalSizeInfo(cb, IntPtr.Zero); + if (err != Interop.PackageManager.ErrorCode.None) + { + tcs.TrySetException(PackageManagerErrorFactory.GetException(err, "Failed to get total package size info")); + } + return await tcs.Task.ConfigureAwait(false); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, null, PackageType.UNKNOWN, null, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// The event callback will be invoked only for the current request + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, null, PackageType.UNKNOWN, eventCallback, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Package type for the package to be installed + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, PackageType type, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, null, type, null, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Absolute path for the expansion package to be installed + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, string expansionPackagePath, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, null, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Package type for the package to be installed + /// The event callback will be invoked only for the current request + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, PackageType type, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, null, type, eventCallback, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Absolute path for the expansion package to be installed + /// The event callback will be invoked only for the current request + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, string expansionPackagePath, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, expansionPackagePath, PackageType.UNKNOWN, eventCallback, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Absolute path for the expansion package to be installed + /// Package type for the package to be installed + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, string expansionPackagePath, PackageType type, InstallationMode installMode = InstallationMode.Normal) + { + return Install(packagePath, expansionPackagePath, type, null, installMode); + } + + /// + /// Installs package located at the given path + /// + /// Absolute path for the package to be installed + /// Absolute path for the expansion package to be installed + /// Package type for the package to be installed + /// The event callback will be invoked only for the current request + /// Optional parameter to indicate special installation mode + /// Returns true if installtion request is successful, false otherwise. + /// + /// The 'true' means that just the request of installation is seccessful. + /// To check the result of installation, the caller should check the progress using InstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Install(string packagePath, string expansionPackagePath, PackageType type, RequestEventCallback eventCallback, InstallationMode installMode = InstallationMode.Normal) + { + SafePackageManagerRequestHandle RequestHandle; + var err = Interop.PackageManager.PackageManagerRequestCreate(out RequestHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to install package {0}. Error in creating package manager request handle. err = {1}", packagePath, err)); + return false; + } + + try + { + if (type != PackageType.UNKNOWN) + { + err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower()); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to install package {0}. Error in setting request package type. err = {1}", packagePath, err)); + RequestHandle.Dispose(); + return false; + } + } + + if (!string.IsNullOrEmpty(expansionPackagePath)) + { + err = Interop.PackageManager.PackageManagerRequestSetTepPath(RequestHandle, expansionPackagePath); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to install package {0}. Error in setting request package mode. err = {1}", packagePath, err)); + RequestHandle.Dispose(); + return false; + } + } + + int requestId; + if (eventCallback != null) + { + InstallMethodWithCallback install; + if (installMode == InstallationMode.Mount) + { + install = Interop.PackageManager.PackageManagerRequestMountInstallWithCB; + } + else + { + install = Interop.PackageManager.PackageManagerRequestInstallWithCB; + } + err = install(RequestHandle, packagePath, internalRequestEventCallback, IntPtr.Zero, out requestId); + if (err == Interop.PackageManager.ErrorCode.None) + { + RequestCallbacks.Add(requestId, eventCallback); + RequestHandles.Add(requestId, RequestHandle); + } + else + { + Log.Warn(LogTag, string.Format("Failed to install package {0}. err = {1}", packagePath, err)); + RequestHandle.Dispose(); + return false; + } + } + else + { + InstallMethod install; + if (installMode == InstallationMode.Mount) + { + install = Interop.PackageManager.PackageManagerRequestMountInstall; + } + else + { + install = Interop.PackageManager.PackageManagerRequestInstall; + } + err = install(RequestHandle, packagePath, out requestId); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to install package {0}. err = {1}", packagePath, err)); + RequestHandle.Dispose(); + return false; + } + // RequestHandle isn't necessary when this method is called without 'eventCallback' parameter. + RequestHandle.Dispose(); + } + return true; + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + RequestHandle.Dispose(); + return false; + } + } + + /// + /// Uninstalls package with the given name. + /// + /// Id of the package to be uninstalled + /// Returns true if uninstallation request is successful, false otherwise. + /// + /// The 'true' means that just the request of uninstallation is seccessful. + /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Uninstall(string packageId) + { + return Uninstall(packageId, PackageType.UNKNOWN, null); + } + + /// + /// Uninstalls package with the given name. + /// + /// Id of the package to be uninstalled + /// Optional - Package type for the package to be uninstalled + /// Returns true if uninstalltion request is successful, false otherwise. + /// + /// The 'true' means that just the request of uninstallation is seccessful. + /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Uninstall(string packageId, PackageType type) + { + return Uninstall(packageId, type, null); + } + + /// + /// Uninstalls package with the given name. + /// + /// Id of the package to be uninstalled + /// Optional - The event callback will be invoked only for the current request + /// Returns true if uninstalltion request is successful, false otherwise. + /// + /// The 'true' means that just the request of uninstallation is seccessful. + /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Uninstall(string packageId, RequestEventCallback eventCallback) + { + return Uninstall(packageId, PackageType.UNKNOWN, eventCallback); + } + + /// + /// Uninstalls package with the given name. + /// + /// Id of the package to be uninstalled + /// Optional - Package type for the package to be uninstalled + /// Optional - The event callback will be invoked only for the current request + /// Returns true if uninstalltion request is successful, false otherwise. + /// + /// The 'true' means that just the request of uninstallation is seccessful. + /// To check the result of uninstallation, the caller should check the progress using UninstallProgressChanged event OR eventCallback. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Uninstall(string packageId, PackageType type, RequestEventCallback eventCallback) + { + SafePackageManagerRequestHandle RequestHandle; + var err = Interop.PackageManager.PackageManagerRequestCreate(out RequestHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to uninstall package {0}. Error in creating package manager request handle. err = {1}", packageId, err)); + return false; + } + + try + { + err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower()); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to uninstall package {0}. Error in setting request package type. err = {1}", packageId, err)); + RequestHandle.Dispose(); + return false; + } + + int requestId; + if (eventCallback != null) + { + err = Interop.PackageManager.PackageManagerRequestUninstallWithCB(RequestHandle, packageId, internalRequestEventCallback, IntPtr.Zero, out requestId); + if (err == Interop.PackageManager.ErrorCode.None) + { + RequestCallbacks.Add(requestId, eventCallback); + RequestHandles.Add(requestId, RequestHandle); + } + else + { + Log.Warn(LogTag, string.Format("Failed to uninstall package {0}. err = {1}", packageId, err)); + RequestHandle.Dispose(); + return false; + } + } + else + { + err = Interop.PackageManager.PackageManagerRequestUninstall(RequestHandle, packageId, out requestId); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to uninstall package. err = {0}", err)); + RequestHandle.Dispose(); + return false; + } + // RequestHandle isn't necessary when this method is called without 'eventCallback' parameter. + RequestHandle.Dispose(); + } + return true; + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + RequestHandle.Dispose(); + return false; + } + } + + /// + /// Move package to given storage. + /// + /// Id of the package to be moved + /// Storage, package should be moved to + /// Returns true if move request is successful, false otherwise. + /// + /// The 'true' means that just the request of move is seccessful. + /// To check the result of move, the caller should check the progress using MoveProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Move(string packageId, StorageType newStorage) + { + return Move(packageId, PackageType.UNKNOWN, newStorage, null); + } + + /// + /// Move package to given storage. + /// + /// Id of the package to be moved + /// Optional - Package type for the package to be moved + /// Storage, package should be moved to + /// Returns true if move request is successful, false otherwise. + /// + /// The 'true' means that just the request of move is seccessful. + /// To check the result of move, the caller should check the progress using MoveProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Move(string packageId, PackageType type, StorageType newStorage) + { + return Move(packageId, type, newStorage, null); + } + + /// + /// Move package to given storage. + /// + /// Id of the package to be moved + /// Storage, package should be moved to + /// Optional - The event callback will be invoked only for the current request + /// Returns true if move request is successful, false otherwise. + /// + /// The 'true' means that just the request of move is seccessful. + /// To check the result of move, the caller should check the progress using MoveProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Move(string packageId, StorageType newStorage, RequestEventCallback eventCallback) + { + return Move(packageId, PackageType.UNKNOWN, newStorage, eventCallback); + } + + /// + /// Move package to given storage. + /// + /// Id of the package to be moved + /// Optional - Package type for the package to be moved + /// Storage, package should be moved to + /// Optional - The event callback will be invoked only for the current request + /// Returns true if move request is successful, false otherwise. + /// + /// The 'true' means that just the request of move is seccessful. + /// To check the result of move, the caller should check the progress using MoveProgressChanged event. + /// + /// http://tizen.org/privilege/packagemanager.admin + /// platform + public static bool Move(string packageId, PackageType type, StorageType newStorage, RequestEventCallback eventCallback) + { + SafePackageManagerRequestHandle RequestHandle; + var err = Interop.PackageManager.PackageManagerRequestCreate(out RequestHandle); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to create package manager request handle. err = {0}", err)); + return false; + } + + try + { + bool result = true; + err = Interop.PackageManager.PackageManagerRequestSetType(RequestHandle, type.ToString().ToLower()); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to move package. Error in setting request package type. err = {0}", err)); + RequestHandle.Dispose(); + return false; + } + + if (eventCallback != null) + { + int requestId; + err = Interop.PackageManager.PackageManagerRequestMoveWithCB(RequestHandle, packageId, (Interop.PackageManager.StorageType)newStorage, internalRequestEventCallback, IntPtr.Zero, out requestId); + if (err == Interop.PackageManager.ErrorCode.None) + { + RequestCallbacks.Add(requestId, eventCallback); + RequestHandles.Add(requestId, RequestHandle); + } + else + { + Log.Warn(LogTag, string.Format("Failed to move package to requested location. err = {0}", err)); + RequestHandle.Dispose(); + result = false; + } + } + else + { + err = Interop.PackageManager.PackageManagerRequestMove(RequestHandle, packageId, (Interop.PackageManager.StorageType)newStorage); + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to move package to requested location. err = {0}", err)); + RequestHandle.Dispose(); + result = false; + } + // RequestHandle isn't necessary when this method is called without 'eventCallback' parameter. + RequestHandle.Dispose(); + } + return result; + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + RequestHandle.Dispose(); + return false; + } + } + + /// + /// Gets permission type of package which has given application id + /// + /// Id of the application + /// Returns permission type. + /// http://tizen.org/privilege/packagemanager.info + /// Thrown when failed when input package ID is invalid + /// Thrown when app does not have privilege to access this method + public static PermissionType GetPermissionTypeByApplicationId(string applicationId) + { + Interop.PackageManager.PackageManagerPermissionType permissionType; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerGetPermissionType(applicationId, out permissionType); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to get permission type."); + } + + return (PermissionType)permissionType; + } + + /// + /// Gets package's preload attribute which contain given applicion id + /// + /// Id of the application + /// Returns true if package is preloaded. Otherwise return false. + /// http://tizen.org/privilege/packagemanager.info + /// Thrown when failed when input package ID is invalid + /// Thrown when app does not have privilege to access this method + public static bool IsPreloadPackageByApplicationId(string applicationId) + { + bool isPreloadPackage; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerIsPreloadPackageByApplicationId(applicationId, out isPreloadPackage); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to get preload info"); + } + + return isPreloadPackage; + } + + /// + /// Compare certificate of two packages + /// + /// package id to compare + /// package id to be compared + /// Returns certificate comparison result. + /// Thrown when failed when input package ID is invalid + /// Thrown when method failed due to internal IO error + public static CertCompareResultType CompareCertInfo(string lhsPackageId, string rhsPackageId) + { + Interop.PackageManager.CertCompareResultType compareResult; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerCompareCertInfo(lhsPackageId, rhsPackageId, out compareResult); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to compare cert info"); + } + + return (CertCompareResultType)compareResult; + } + + /// + /// Compare certificate of two packages which contain each given application id + /// + /// application id to compare + /// application id to be compared + /// Returns certificate comparison result. + /// Thrown when failed when input package ID is invalid + /// Thrown when method failed due to internal IO error + public static CertCompareResultType CompareCertInfoByApplicationId(string lhsApplicationId, string rhsApplicationId) + { + Interop.PackageManager.CertCompareResultType compareResult; + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerCompareCertInfoByApplicationId(lhsApplicationId, rhsApplicationId, out compareResult); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to compare cert info by application id"); + } + + return (CertCompareResultType)compareResult; + } + + /// + /// Drm nested class. This class has the PackageManager's drm related methods. + /// + public static class Drm + { + /// + /// Generates request for getting license + /// + /// Response data string of the purchase request + /// Returns package drm information of given response data which contains require data and license url + /// http://tizen.org/privilege/packagemanager.admin + /// platform + /// Thrown when failed when input package ID is invalid + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + public static PackageDrm GenerateLicenseRequest(string responseData) + { + return PackageDrm.GenerateLicenseRequest(responseData); + + } + + /// + /// Registers encrypted license + /// + /// The response data string of the rights request + /// Returns true if succeed. Otherwise return false + /// http://tizen.org/privilege/packagemanager.admin + /// platform + /// Thrown when failed when input package ID is invalid + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + public static bool RegisterLicense(string responseData) + { + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmRegisterLicense(responseData); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to register drm license"); + } + + return true; + } + + /// + /// Decrypts contents which is encrypted + /// + /// Drm file path + /// Decrypted file path + /// Returns true if succeed. Otherwise return false + /// http://tizen.org/privilege/packagemanager.admin + /// platform + /// Thrown when failed when input package ID is invalid + /// Thrown when there is not enough memory to continue the execution of the method + /// Thrown when app does not have privilege to access this method + /// Thrown when method failed due to internal system error + public static bool DecryptPackage(string drmFilePath, string decryptedFilePath) + { + Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerDrmDecryptPackage(drmFilePath, decryptedFilePath); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to decrypt drm package"); + } + + return true; + } + } + + private static void SetPackageManagerEventStatus(Interop.PackageManager.EventStatus status) + { + if (Handle.IsInvalid) return; + + Interop.PackageManager.EventStatus eventStatus = s_eventStatus; + eventStatus |= status; + if (eventStatus != Interop.PackageManager.EventStatus.All) + eventStatus |= Interop.PackageManager.EventStatus.Progress; + + var err = Interop.PackageManager.ErrorCode.None; + if (s_eventStatus != eventStatus) + { + err = Interop.PackageManager.PackageManagerSetEvenStatus(Handle, eventStatus); + if (err == Interop.PackageManager.ErrorCode.None) + { + s_eventStatus = eventStatus; + Log.Debug(LogTag, string.Format("New Event Status flag: {0}", s_eventStatus)); + return; + } + Log.Debug(LogTag, string.Format("Failed to set flag for {0} event. err = {1}", eventStatus, err)); + } + } + + private static void UnsetPackageManagerEventStatus() + { + if (Handle.IsInvalid) return; + + Interop.PackageManager.EventStatus eventStatus = Interop.PackageManager.EventStatus.All; + if (s_installEventHandler != null) eventStatus |= Interop.PackageManager.EventStatus.Install; + if (s_uninstallEventHandler != null) eventStatus |= Interop.PackageManager.EventStatus.Uninstall; + if (s_updateEventHandler != null) eventStatus |= Interop.PackageManager.EventStatus.Upgrade; + if (s_moveEventHandler != null) eventStatus |= Interop.PackageManager.EventStatus.Move; + if (s_clearDataEventHandler != null) eventStatus |= Interop.PackageManager.EventStatus.ClearData; + if (eventStatus != Interop.PackageManager.EventStatus.All) + eventStatus |= Interop.PackageManager.EventStatus.Progress; + + var err = Interop.PackageManager.ErrorCode.None; + if (s_eventStatus != eventStatus) + { + err = Interop.PackageManager.PackageManagerSetEvenStatus(Handle, eventStatus); + if (err == Interop.PackageManager.ErrorCode.None) + { + s_eventStatus = eventStatus; + Log.Debug(LogTag, string.Format("New Event Status flag: {0}", s_eventStatus)); + return; + } + Log.Debug(LogTag, string.Format("Failed to set flag for {0} event. err = {1}", eventStatus, err)); + } + } + + private static void RegisterPackageManagerEventIfNeeded() + { + if (s_installEventHandler != null && s_uninstallEventHandler != null && s_updateEventHandler != null && s_moveEventHandler != null && s_clearDataEventHandler != null) + { + return; + } + + var err = Interop.PackageManager.ErrorCode.None; + s_packageManagerEventCallback = (packageType, packageId, eventType, eventState, progress, error, user_data) => + { + try + { + if (eventType == Interop.PackageManager.EventType.Install) + { + s_installEventHandler?.Invoke(null, new PackageManagerEventArgs(packageType, packageId, (PackageEventState)eventState, progress)); + } + else if (eventType == Interop.PackageManager.EventType.Uninstall) + { + s_uninstallEventHandler?.Invoke(null, new PackageManagerEventArgs(packageType, packageId, (PackageEventState)eventState, progress)); + } + else if (eventType == Interop.PackageManager.EventType.Update) + { + s_updateEventHandler?.Invoke(null, new PackageManagerEventArgs(packageType, packageId, (PackageEventState)eventState, progress)); + } + else if (eventType == Interop.PackageManager.EventType.Move) + { + s_moveEventHandler?.Invoke(null, new PackageManagerEventArgs(packageType, packageId, (PackageEventState)eventState, progress)); + } + else if (eventType == Interop.PackageManager.EventType.ClearData) + { + s_clearDataEventHandler?.Invoke(null, new PackageManagerEventArgs(packageType, packageId, (PackageEventState)eventState, progress)); + } + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + } + }; + + if (!Handle.IsInvalid) + { + Log.Debug(LogTag, "Reset Package Event"); + err = Interop.PackageManager.PackageManagerUnsetEvent(Handle); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to unregister package manager event event."); + } + + err = Interop.PackageManager.PackageManagerSetEvent(Handle, s_packageManagerEventCallback, IntPtr.Zero); + } + if (err != Interop.PackageManager.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to register callback for package manager event. err = {0}", err)); + } + } + + private static void UnregisterPackageManagerEventIfNeeded() + { + if (Handle.IsInvalid || s_installEventHandler != null || s_uninstallEventHandler != null || s_updateEventHandler != null || s_moveEventHandler != null || s_clearDataEventHandler != null) + { + return; + } + + var err = Interop.PackageManager.PackageManagerUnsetEvent(Handle); + if (err != Interop.PackageManager.ErrorCode.None) + { + throw PackageManagerErrorFactory.GetException(err, "Failed to unregister package manager event event."); + } + } + } + + internal static class PackageManagerErrorFactory + { + internal static Exception GetException(Interop.PackageManager.ErrorCode err, string message) + { + string errMessage = string.Format("{0} err = {1}", message, err); + switch (err) + { + case Interop.PackageManager.ErrorCode.InvalidParameter: + case Interop.PackageManager.ErrorCode.NoSuchPackage: + return new ArgumentException(errMessage); + case Interop.PackageManager.ErrorCode.PermissionDenied: + return new UnauthorizedAccessException(errMessage); + case Interop.PackageManager.ErrorCode.IoError: + return new global::System.IO.IOException(errMessage); + default: + return new InvalidOperationException(errMessage); + } + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManagerEventArgs.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManagerEventArgs.cs new file mode 100755 index 0000000..ba0466f --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageManagerEventArgs.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// PackageManagerEventArgs class. This class is an event arguments of the InstallProgressChanged, UninstallProgressChanged and UpdateProgressChanged events. + /// + public class PackageManagerEventArgs : EventArgs + { + private readonly PackageType _packageType; + private readonly string _packageId; + private readonly PackageEventState _state; + private readonly int _progress; + + internal PackageManagerEventArgs(string packageType, string packageId, PackageEventState state, int progress) + { + _packageType = PackageTypeMethods.ToPackageType(packageType); + _packageId = packageId; + _state = state; + _progress = progress; + } + + /// + /// Type of the package to be installed, uninstalled or updated + /// + public PackageType PackageType { get { return _packageType; } } + + /// + /// package ID to be installed, uninstalled or updated + /// + public string PackageId { get { return _packageId; } } + + /// + /// Current state of the request to the package manager + /// + public PackageEventState State { get { return _state; } } + + /// + /// Progress for the request being processed by the package manager (in percent). + /// + public int Progress { get { return _progress; } } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageSizeInformation.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageSizeInformation.cs new file mode 100755 index 0000000..7269f74 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageSizeInformation.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// This class has the read only properties to get package size information. + /// + public class PackageSizeInformation + { + private long _dataSize; + private long _cacheSize; + private long _appSize; + private long _externalDataSize; + private long _externalCacheSize; + private long _externalAppSize; + + private PackageSizeInformation() { } + + /// + /// Data size for package. + /// + public long DataSize { get { return _dataSize; } } + + /// + /// Cache size for package. + /// + public long CacheSize { get { return _cacheSize; } } + + /// + /// Application size for package. + /// + public long AppSize { get { return _appSize; } } + + /// + /// External data size for package. + /// + public long ExternalDataSize { get { return _externalDataSize; } } + + /// + /// External cache size for package. + /// + public long ExternalCacheSize { get { return _externalCacheSize; } } + + /// + /// External application size for package. + /// + public long ExternalAppSize { get { return _externalAppSize; } } + + // This method assumes that pass handle is already validated + internal static PackageSizeInformation GetPackageSizeInformation(IntPtr handle) + { + var pkgSizeInfo = new PackageSizeInformation(); + Interop.PackageManager.PackageSizeInfoGetDataSize(handle, out pkgSizeInfo._dataSize); + Interop.PackageManager.PackageSizeInfoGetCacheSize(handle, out pkgSizeInfo._cacheSize); + Interop.PackageManager.PackageSizeInfoGetAppSize(handle, out pkgSizeInfo._appSize); + Interop.PackageManager.PackageSizeInfoGetExtDataSize(handle, out pkgSizeInfo._externalDataSize); + Interop.PackageManager.PackageSizeInfoGetExtCacheSize(handle, out pkgSizeInfo._externalCacheSize); + Interop.PackageManager.PackageSizeInfoGetExtAppSize(handle, out pkgSizeInfo._externalAppSize); + return pkgSizeInfo; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageType.cs new file mode 100755 index 0000000..e8a0042 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PackageType.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration for package type. + /// + public enum PackageType + { + UNKNOWN, + /// + /// Tizen native application package + /// + TPK, + /// + /// Tizen web/ hybrid application Package + /// + WGT, + /// + /// It's a special meaning type to represent the tizen application package which is installed using rpm spec. + /// Only some preloaded packages can have this type. + /// + RPM + } + + internal static class PackageTypeMethods + { + internal static PackageType ToPackageType(string type) + { + if (string.IsNullOrEmpty(type)) + { + throw PackageManagerErrorFactory.GetException(Interop.PackageManager.ErrorCode.InvalidParameter, "type can't be null or empty"); + } + + string lowerType = type.ToLower(); + if (lowerType == "tpk") + { + return PackageType.TPK; + } + else if (lowerType == "wgt") + { + return PackageType.WGT; + } + else if (lowerType == "rpm") + { + return PackageType.RPM; + } + else + { + throw PackageManagerErrorFactory.GetException(Interop.PackageManager.ErrorCode.InvalidParameter, "type should be tpk or wgt"); + } + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/PermissionType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/PermissionType.cs new file mode 100644 index 0000000..c4a4e2f --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/PermissionType.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration for permission type. + /// + public enum PermissionType + { + /// + /// Permission is normal + /// + Normal, + /// + /// Permission is signature + /// + Signature, + /// + /// Permission is privilege + /// + Privilege + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerHandle.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerHandle.cs new file mode 100755 index 0000000..15e0c82 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerHandle.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + internal class SafePackageManagerHandle : SafeHandle + { + /// + /// Initializes a new instance of the SafePackageManagerHandle class. + /// + public SafePackageManagerHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + public override bool IsInvalid + { + get { return handle == IntPtr.Zero; } + } + + /// + /// Executes the code required to free the SafePackageManagerHandle. + /// + /// true if the handle is released successfully + protected override bool ReleaseHandle() + { + Interop.PackageManager.PackageManagerDestroy(handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerRequestHandle.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerRequestHandle.cs new file mode 100755 index 0000000..add74f5 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/SafePackageManagerRequestHandle.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + internal class SafePackageManagerRequestHandle : SafeHandle + { + /// + /// Initializes a new instance of the SafePackageManagerRequestHandle class. + /// + public SafePackageManagerRequestHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Gets a value that indicates whether the handle is invalid. + /// + public override bool IsInvalid + { + get { return handle == IntPtr.Zero; } + } + + /// + /// Executes the code required to free the SafePackageManagerRequestHandle. + /// + /// true if the handle is released successfully + protected override bool ReleaseHandle() + { + Interop.PackageManager.PackageManagerRequestDestroy(handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.PackageManager/Tizen.Applications/StorageType.cs b/src/Tizen.Applications.PackageManager/Tizen.Applications/StorageType.cs new file mode 100755 index 0000000..8246188 --- /dev/null +++ b/src/Tizen.Applications.PackageManager/Tizen.Applications/StorageType.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Applications +{ + /// + /// Enumeration for storage type. + /// + public enum StorageType + { + /// + /// Internal storage. + /// + Internal = Interop.PackageManager.StorageType.Internal, + /// + /// External storage. + /// + External = Interop.PackageManager.StorageType.External + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.Preference/Interop/Interop.Libraries.cs b/src/Tizen.Applications.Preference/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..d65c7425 --- /dev/null +++ b/src/Tizen.Applications.Preference/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Preference = "libcapi-appfw-preference.so.0"; + } +} diff --git a/src/Tizen.Applications.Preference/Interop/Interop.Preference.cs b/src/Tizen.Applications.Preference/Interop/Interop.Preference.cs new file mode 100755 index 0000000..dd98962 --- /dev/null +++ b/src/Tizen.Applications.Preference/Interop/Interop.Preference.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +/// +/// Contains Interop declarations of Preference classes. +/// +internal static partial class Interop +{ + /// + /// Contains Interop declarations of Preference device API. + /// + internal static partial class Preference + { + internal delegate void ChangedCallback(string key, IntPtr userData); + + internal delegate bool ItemCallback(string key, IntPtr userData); + + [DllImport(Libraries.Preference, EntryPoint = "preference_set_int")] + internal static extern int SetInt(string key, int value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_get_int")] + internal static extern int GetInt(string key, out int value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_set_double")] + internal static extern int SetDouble(string key, double value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_get_double")] + internal static extern int GetDouble(string key, out double value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_set_string")] + internal static extern int SetString(string key, string value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_get_string")] + internal static extern int GetString(string key, out string value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_set_boolean")] + internal static extern int SetBoolean(string key, bool value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_get_boolean")] + internal static extern int GetBoolean(string key, out bool value); + + [DllImport(Libraries.Preference, EntryPoint = "preference_remove")] + internal static extern int Remove(string key); + + [DllImport(Libraries.Preference, EntryPoint = "preference_is_existing")] + internal static extern int IsExisting(string key, out bool existing); + + [DllImport(Libraries.Preference, EntryPoint = "preference_remove_all")] + internal static extern int RemoveAll(); + + [DllImport(Libraries.Preference, EntryPoint = "preference_set_changed_cb")] + internal static extern int SetChangedCb(string key, ChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Preference, EntryPoint = "preference_unset_changed_cb")] + internal static extern int UnsetChangedCb(string key); + + [DllImport(Libraries.Preference, EntryPoint = "preference_foreach_item")] + internal static extern int ForeachItem(ItemCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Applications.Preference/Tizen.Applications.Preference.csproj b/src/Tizen.Applications.Preference/Tizen.Applications.Preference.csproj new file mode 100755 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Applications.Preference/Tizen.Applications.Preference.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.Preference/Tizen.Applications.Preference.sln b/src/Tizen.Applications.Preference/Tizen.Applications.Preference.sln new file mode 100755 index 0000000..2eff8e7 --- /dev/null +++ b/src/Tizen.Applications.Preference/Tizen.Applications.Preference.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Preference", "Tizen.Applications.Preference.csproj", "{552DE9C5-1CE3-4C9F-AE29-13D8A8455E94}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{7E1029E6-9699-49EF-A3CE-ABD198FB138B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{9533C92C-0AA3-4798-AB7D-31FD9D9BEE9C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {552DE9C5-1CE3-4C9F-AE29-13D8A8455E94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {552DE9C5-1CE3-4C9F-AE29-13D8A8455E94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {552DE9C5-1CE3-4C9F-AE29-13D8A8455E94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {552DE9C5-1CE3-4C9F-AE29-13D8A8455E94}.Release|Any CPU.Build.0 = Release|Any CPU + {7E1029E6-9699-49EF-A3CE-ABD198FB138B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E1029E6-9699-49EF-A3CE-ABD198FB138B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E1029E6-9699-49EF-A3CE-ABD198FB138B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E1029E6-9699-49EF-A3CE-ABD198FB138B}.Release|Any CPU.Build.0 = Release|Any CPU + {9533C92C-0AA3-4798-AB7D-31FD9D9BEE9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9533C92C-0AA3-4798-AB7D-31FD9D9BEE9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9533C92C-0AA3-4798-AB7D-31FD9D9BEE9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9533C92C-0AA3-4798-AB7D-31FD9D9BEE9C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Preference/Tizen.Applications/Preference.cs b/src/Tizen.Applications.Preference/Tizen.Applications/Preference.cs new file mode 100755 index 0000000..4fd6e79 --- /dev/null +++ b/src/Tizen.Applications.Preference/Tizen.Applications/Preference.cs @@ -0,0 +1,463 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Internals.Errors; + +namespace Tizen.Applications +{ + /// + /// The Preference class provides APIs to store and retrieve application specific data/preference. A preference is saved in the form of a key-value pair. + /// Keys are always text strings and value can be any one of four types: integer, double, string and boolean. + /// + public static class Preference + { + private const string LogTag = "Tizen.Applications"; + private static Interop.Preference.ChangedCallback s_preferenceChangedCallback; + private static IDictionary s_eventMap = new Dictionary(); + + static Preference() + { + s_preferenceChangedCallback = (string key, IntPtr userData) => + { + try + { + s_eventMap[key]?.FireEvent(); + } + catch (Exception e) + { + Log.Warn(LogTag, e.Message); + } + }; + } + + /// + /// Retrieves all keys of the application preferences + /// + /// + /// The list of keys + /// + /// + /// + /// Preference.Set("Option_enabled", true); + /// Preference.Set("active_user", "Joe"); + /// Preference.Set("default_volume", 10); + /// Preference.Set("brightness", "0.6"); + /// foreach(string key in Preference.Keys) + /// { + /// Console.WriteLine("key {0}", key); + /// } + /// + /// + public static IEnumerable Keys + { + get + { + var collection = new List(); + Interop.Preference.ItemCallback itemsCallback = (string key, IntPtr userData) => + { + collection.Add(key); + return true; + }; + Interop.Preference.ForeachItem(itemsCallback, IntPtr.Zero); + return collection; + } + } + + /// + /// Gets the event context for the given key. + /// + /// + /// The preference key + /// The event context of respective key + /// Thrown if the key is not found + /// Thrown if the key is an invalid parameter. + /// + /// + /// private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e) + /// { + /// Console.WriteLine("key {0}", e.Key); + /// } + /// + /// Preference.EventContext context = null; + /// Preference.GetEventContext("active_user").TryGetTarget(out context); + /// if(context != null) + /// { + /// context.Changed += Preference_PreferenceChanged; + /// } + /// + /// Preference.Set("active_user", "Poe"); + /// + /// Preference.GetEventContext("active_user").TryGetTarget(out context); + /// if (context != null) + /// { + /// context.Changed -= Preference_PreferenceChanged; + /// } + /// + /// + public static WeakReference GetEventContext(string key) + { + if (!s_eventMap.ContainsKey(key)) + { + if (Contains(key)) + { + s_eventMap[key] = new EventContext(key); + } + else + { + throw PreferenceErrorFactory.GetException((int)PreferenceErrorFactory.PreferenceError.KeyNotAvailable); + } + } + + return new WeakReference(s_eventMap[key]); + } + + /// + /// Checks whether the given key exists in the preference. + /// + /// The name of the key to check + /// true if the key exists in the preference, otherwise false + /// Thrown if the key is an invalid parameter. + /// Thrown when method failed due to internal IO error. + /// + /// + /// Preference.Set("active_user", "Joe"); + /// bool exists = Preference.Contains("active_user"); + /// if (exists) + /// { + /// string value = Preference.Get("active_user"); + /// Console.WriteLine("user {0}", value); + /// } + /// + /// + public static bool Contains(string key) + { + bool contains; + int ret = Interop.Preference.IsExisting(key, out contains); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to find key"); + throw PreferenceErrorFactory.GetException(ret); + } + + return contains; + } + + /// + /// Sets a key-value pair representing the preference. + /// + /// + /// If the key already exists in the Preference, old value will be overwritten with new value. + /// Data types supported for value are: integer, double, string and bool. + /// + /// The name of the key to create/modigy + /// The value corresponding to the key. + /// Thrown if the key is an invalid parameter. + /// Thrown when method failed due to internal IO error. + /// + /// + /// Preference.Set("Option_enabled", true); + /// Preference.Set("active_user", "Joe"); + /// Preference.Set("default_volume", 10); + /// Preference.Set("brightness", "0.6"); + /// + /// + public static void Set(string key, object value) + { + int ret = 0; + if (value is int) + { + ret = Interop.Preference.SetInt(key, (int)value); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to find key"); + throw PreferenceErrorFactory.GetException(ret); + } + } + else if (value is double) + { + ret = Interop.Preference.SetDouble(key, (double)value); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to find key"); + throw PreferenceErrorFactory.GetException(ret); + } + } + else if (value is string) + { + ret = Interop.Preference.SetString(key, (string)value); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to find key"); + throw PreferenceErrorFactory.GetException(ret); + } + } + else if (value is bool) + { + ret = Interop.Preference.SetBoolean(key, (bool)value); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to find key"); + throw PreferenceErrorFactory.GetException(ret); + } + } + else + { + Log.Error(LogTag, "Failed to Set"); + throw new ArgumentException("Invalid parameter"); + } + } + + /// + /// Gets the value of a preference item with the specified key. + /// Note that this is a generic method. + /// + /// The generic type to return. + /// The key of the preference + /// The value of the preference item if it is of the specified generic type. + /// Thrown if the key is not found + /// Thrown if the key is an invalid parameter. + /// Thrown when method failed due to internal IO error. + /// + /// + /// bool exists = Preference.Contains("active_user"); + /// if (exists) + /// { + /// string value = Preference.Get("active_user"); + /// Console.WriteLine("user {0}", value); + /// } + /// + /// + public static T Get(string key) + { + object result = null; + int ret = (int)PreferenceErrorFactory.PreferenceError.None; + if (typeof(T) == typeof(bool)) + { + bool val; + ret = Interop.Preference.GetBoolean(key, out val); + result = val; + } + else if (typeof(T) == typeof(int)) + { + int val; + ret = Interop.Preference.GetInt(key, out val); + result = val; + } + else if (typeof(T) == typeof(string)) + { + string val; + ret = Interop.Preference.GetString(key, out val); + result = val; + } + else if (typeof(T) == typeof(double)) + { + double val; + ret = Interop.Preference.GetDouble(key, out val); + result = val; + } + else + { + Log.Error(LogTag, "Failed to remove key"); + throw new ArgumentException("Invalid parameter"); + } + + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to remove key"); + throw PreferenceErrorFactory.GetException(ret); + } + + return (result != null) ? (T)result : default(T); + } + + /// + /// Removes any preference value with the given key. + /// + /// The key to remove + /// Thrown if the key is not found + /// Thrown when method failed due to internal IO error. + /// + /// + /// bool exists = Preference.Contains("active_user"); + /// if (exists) + /// { + /// string value = Preference.Remove("active_user"); + /// } + /// + /// + public static void Remove(string key) + { + int ret = Interop.Preference.Remove(key); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to remove key"); + throw PreferenceErrorFactory.GetException(ret); + } + } + + /// + /// Removes all key-value pairs from the preference. + /// + /// Thrown when method failed due to internal IO error. + /// + /// + /// Preference.Set("Option_enabled", true); + /// Preference.Set("active_user", "Joe"); + /// Preference.Set("default_volume", 10); + /// Preference.Set("brightness", "0.6"); + /// Preference.RemoveAll(); + /// + /// + public static void RemoveAll() + { + int ret = Interop.Preference.RemoveAll(); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to remove all keys"); + throw PreferenceErrorFactory.GetException(ret); + } + } + + private static void AllowChangeNotifications(string key) + { + int ret = Interop.Preference.SetChangedCb(key, s_preferenceChangedCallback, IntPtr.Zero); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to set key notification"); + throw PreferenceErrorFactory.GetException(ret); + } + } + + private static void DisallowChangeNotifications(string key) + { + int ret = Interop.Preference.UnsetChangedCb(key); + if (ret != (int)PreferenceErrorFactory.PreferenceError.None) + { + Log.Error(LogTag, "Failed to remove key notification"); + throw PreferenceErrorFactory.GetException(ret); + } + } + + /// + /// The class manages event handlers of preference keys. The class enables having event handlers for individual preference keys. + /// + public class EventContext + { + private string _key; + + internal EventContext(string key) + { + _key = key; + } + + /// + /// Occurs whenever there is change in the value of preference key. + /// + /// Thrown when the key does not exist or when there is an invalid parameter. + /// Thrown when the Bundle instance has been disposed. + /// + /// + /// private static void Preference_PreferenceChanged(object sender, PreferenceChangedEventArgs e) + /// { + /// Console.WriteLine("key {0}", e.Key); + /// } + /// Preference.EventContext context = null; + /// Preference.GetEventContext("active_user").TryGetTarget(out context); + /// if(context != null) + /// { + /// context.Changed += Preference_PreferenceChanged; + /// } + /// + /// Preference.Set("active_user", "Poe"); + /// + /// Preference.GetEventContext("active_user").TryGetTarget(out context); + /// if (context != null) + /// { + /// context.Changed -= Preference_PreferenceChanged; + /// } + /// + /// + public event EventHandler Changed + { + add + { + if (_changed == null) + { + AllowChangeNotifications(_key); + } + + _changed += value; + } + + remove + { + _changed -= value; + if (_changed == null) + { + DisallowChangeNotifications(_key); + s_eventMap.Remove(_key); + } + } + } + + private event EventHandler _changed; + + internal void FireEvent() + { + _changed?.Invoke(null, new PreferenceChangedEventArgs() { Key = _key }); + } + } + + } + + internal static class PreferenceErrorFactory + { + internal enum PreferenceError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + KeyNotAvailable = -0x01100000 | 0x30, + IoError = ErrorCode.IoError + } + + static internal Exception GetException(int error) + { + if ((PreferenceError)error == PreferenceError.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if ((PreferenceError)error == PreferenceError.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if ((PreferenceError)error == PreferenceError.KeyNotAvailable) + { + return new KeyNotFoundException("Key does not exist in the bundle"); + } + else if ((PreferenceError)error == PreferenceError.IoError) + { + return new System.IO.IOException("I/O Error"); + } + else + { + return new ArgumentException("Unknown error"); + } + } + } +} diff --git a/src/Tizen.Applications.Preference/Tizen.Applications/PreferenceChangedEventArgs.cs b/src/Tizen.Applications.Preference/Tizen.Applications/PreferenceChangedEventArgs.cs new file mode 100755 index 0000000..5386c77 --- /dev/null +++ b/src/Tizen.Applications.Preference/Tizen.Applications/PreferenceChangedEventArgs.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// This class is an event arguments of the PreferenceChanged events. + /// + public class PreferenceChangedEventArgs : EventArgs + { + /// + /// The key of the preference whose value is changed. + /// + public string Key { get; internal set; } + } +} diff --git a/src/Tizen.Applications.RemoteView/Interop/Interop.Libraries.cs b/src/Tizen.Applications.RemoteView/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..309f4e4 --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string WidgetViewerEvas = "libwidget_viewer_evas.so.1"; + } +} diff --git a/src/Tizen.Applications.RemoteView/Interop/Interop.WidgetViewerEvas.cs b/src/Tizen.Applications.RemoteView/Interop/Interop.WidgetViewerEvas.cs new file mode 100755 index 0000000..30ca171 --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Interop/Interop.WidgetViewerEvas.cs @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class WidgetViewerEvas + { + internal enum ErrorCode : int + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + Canceled = Tizen.Internals.Errors.ErrorCode.Canceled, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + FileNoSpaceOnDevice = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, + Fault = -0x02F40000 | 0x0001, + AlreadyExist = -0x02F40000 | 0x0002, + AlreadyStarted = -0x02F40000 | 0x0004, + NotExist = -0x02F40000 | 0x0008, + Disabled = -0x02F40000 | 0x0010, + MaxExceeded = -0x02F40000 | 0x0011, + } + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_init")] + internal static extern ErrorCode Init(IntPtr win); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_fini")] + internal static extern ErrorCode Fini(); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_add_widget")] + internal static extern IntPtr AddWidget(IntPtr parent, string widgetId, string content, double period); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_notify_resumed_status_of_viewer")] + internal static extern ErrorCode NotifyResumedStatusOfViewer(); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_notify_paused_status_of_viewer")] + internal static extern ErrorCode NotifyPausedStatusOfViewer(); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_pause_widget")] + internal static extern ErrorCode PauseWidget(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_resume_widget")] + internal static extern ErrorCode ResumeWidget(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_get_content_info")] + internal static extern IntPtr GetContentInfo(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_get_title_string")] + internal static extern IntPtr GetTitleString(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_get_widget_id")] + internal static extern IntPtr GetWidgetId(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_get_period")] + internal static extern double GetPeriod(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_cancel_click_event")] + internal static extern void CancelClickEvent(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_disable_loading")] + internal static extern void DisableLoading(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_feed_mouse_up_event")] + internal static extern ErrorCode FeedMouseUpEvent(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_disable_preview")] + internal static extern void DisablePreview(IntPtr widget); + + [DllImport(Libraries.WidgetViewerEvas, EntryPoint = "widget_viewer_evas_disable_overlay_text")] + internal static extern void DisableOverlayText(IntPtr widget); + + } +} diff --git a/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.csproj b/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.csproj new file mode 100644 index 0000000..ea9943a --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.csproj @@ -0,0 +1,15 @@ + + + + + netstandard1.6 + + + + + + + + + + diff --git a/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.sln b/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.sln new file mode 100755 index 0000000..3672ee7 --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Tizen.Applications.RemoteView.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.RemoteView", "Tizen.Applications.RemoteView.csproj", "{9570A755-64BB-438F-9159-A23EBF578DC3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{F5CBED3B-5663-457F-90FF-54FB36DD2F94}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{A3374C5B-ECF6-4124-9A96-C93F2C315046}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{EBF82A76-BC04-4404-AD72-C4E1E7BB48BE}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9570A755-64BB-438F-9159-A23EBF578DC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9570A755-64BB-438F-9159-A23EBF578DC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9570A755-64BB-438F-9159-A23EBF578DC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9570A755-64BB-438F-9159-A23EBF578DC3}.Release|Any CPU.Build.0 = Release|Any CPU + {F5CBED3B-5663-457F-90FF-54FB36DD2F94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5CBED3B-5663-457F-90FF-54FB36DD2F94}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5CBED3B-5663-457F-90FF-54FB36DD2F94}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5CBED3B-5663-457F-90FF-54FB36DD2F94}.Release|Any CPU.Build.0 = Release|Any CPU + {A3374C5B-ECF6-4124-9A96-C93F2C315046}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A3374C5B-ECF6-4124-9A96-C93F2C315046}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A3374C5B-ECF6-4124-9A96-C93F2C315046}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A3374C5B-ECF6-4124-9A96-C93F2C315046}.Release|Any CPU.Build.0 = Release|Any CPU + {EBF82A76-BC04-4404-AD72-C4E1E7BB48BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBF82A76-BC04-4404-AD72-C4E1E7BB48BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBF82A76-BC04-4404-AD72-C4E1E7BB48BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBF82A76-BC04-4404-AD72-C4E1E7BB48BE}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteView.cs b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteView.cs new file mode 100755 index 0000000..f20e8bb --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteView.cs @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + /// + /// Represents the proxy class for the widget application. + /// + public class RemoteView + { + /// + /// The event types to send. + /// + public enum Event + { + /// + /// Type for feeding the mouse-up event to the widget application. + /// + FeedMouseUp, + + /// + /// Type for canceling the click event procedure. + /// + CancelClick + } + + /// + /// Layout object including preview image, overlay text, loading text, and remote screen image. + /// + /// http://tizen.org/privilege/widget.viewer + public Layout Layout { get; internal set; } + + /// + /// The widget ID. + /// + /// http://tizen.org/privilege/widget.viewer + public string Id + { + get + { + IntPtr ptr = Interop.WidgetViewerEvas.GetWidgetId(Layout); + + return Marshal.PtrToStringAnsi(ptr); + } + } + + /// + /// The update period. + /// + /// http://tizen.org/privilege/widget.viewer + public double Period + { + get + { + return Interop.WidgetViewerEvas.GetPeriod(Layout); + } + } + + /// + /// Contents of the widget. + /// + /// + /// This string can be used for creating contents of the widget again after rebooting a device or it can be recovered from a crash (abnormal status). + /// + /// http://tizen.org/privilege/widget.viewer + public string Content + { + get + { + IntPtr ptr = Interop.WidgetViewerEvas.GetContentInfo(Layout); + + return Marshal.PtrToStringAnsi(ptr); + } + } + + /// + /// Summarized string of the widget content for accessibility. + /// + /// http://tizen.org/privilege/widget.viewer + public string Title + { + get + { + IntPtr ptr = Interop.WidgetViewerEvas.GetTitleString(Layout); + + return Marshal.PtrToStringAnsi(ptr); + } + } + + internal RemoteView() + { + } + + internal static void CheckException(Interop.WidgetViewerEvas.ErrorCode err) + { + switch (err) + { + case Interop.WidgetViewerEvas.ErrorCode.Fault: + throw new InvalidOperationException("Fault at unmanaged code"); + + case Interop.WidgetViewerEvas.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + + case Interop.WidgetViewerEvas.ErrorCode.NotSupported: + throw new NotSupportedException(); + + case Interop.WidgetViewerEvas.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter error at unmanaged code"); + + case Interop.WidgetViewerEvas.ErrorCode.AlreadyExist: + throw new InvalidOperationException("Already exist"); + + case Interop.WidgetViewerEvas.ErrorCode.MaxExceeded: + throw new InvalidOperationException("Max exceeded"); + } + } + + /// + /// Pauses all the connected widget applications. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public static void PauseAll() + { + CheckException(Interop.WidgetViewerEvas.NotifyPausedStatusOfViewer()); + } + + /// + /// Resumes all the connected widget applications. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device<./exception> + public static void ResumeAll() + { + CheckException(Interop.WidgetViewerEvas.NotifyResumedStatusOfViewer()); + } + + /// + /// Pauses the widget application which is connected on this proxy. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public void Pause() + { + CheckException(Interop.WidgetViewerEvas.PauseWidget(Layout)); + } + + /// + /// Resumes the widget application which is connected on this proxy. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public void Resume() + { + CheckException(Interop.WidgetViewerEvas.ResumeWidget(Layout)); + } + + /// + /// Sends the event to the widget application which is connected on this proxy. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public void SendEvent(Event ev) + { + switch (ev) + { + case Event.FeedMouseUp: + Interop.WidgetViewerEvas.FeedMouseUpEvent(Layout); + break; + + case Event.CancelClick: + Interop.WidgetViewerEvas.CancelClickEvent(Layout); + break; + + default: + throw new NotSupportedException("Not supported event type"); + } + + int err = Internals.Errors.ErrorFacts.GetLastResult(); + CheckException((Interop.WidgetViewerEvas.ErrorCode)err); + } + + internal void HideLoadingMessage() + { + Interop.WidgetViewerEvas.DisableLoading(Layout); + int err = Internals.Errors.ErrorFacts.GetLastResult(); + CheckException((Interop.WidgetViewerEvas.ErrorCode)err); + } + + internal void HidePreviewImage() + { + Interop.WidgetViewerEvas.DisablePreview(Layout); + int err = Internals.Errors.ErrorFacts.GetLastResult(); + CheckException((Interop.WidgetViewerEvas.ErrorCode)err); + } + + internal void HideOverlayText() + { + Interop.WidgetViewerEvas.DisableOverlayText(Layout); + int err = Internals.Errors.ErrorFacts.GetLastResult(); + CheckException((Interop.WidgetViewerEvas.ErrorCode)err); + } + + } +} diff --git a/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteViewFactory.cs b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteViewFactory.cs new file mode 100755 index 0000000..0820a5e --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteViewFactory.cs @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; + +namespace Tizen.Applications +{ + /// + /// Represents a factory class for making the RemoteView objects. + /// + public static class RemoteViewFactory + { + private static bool _ready; + + /// + /// Initializes RemoteViewFactory. + /// + /// Window object that will contain RemoteViews that are generated by RemoteViewFactory. + /// All the remote views will be located in the specified window object. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public static void Init(EvasObject win) + { + if (_ready) + throw new InvalidOperationException("Already initialized"); + RemoteView.CheckException(Interop.WidgetViewerEvas.Init(win)); + _ready = true; + } + + /// + /// Creates a RemoteView object. + /// + /// Parent object. + /// Widget ID. + /// Contents that will be given to the widget instance. + /// Update period. + /// True if you want to show the preview image. + /// True if you want to show the overlay text. + /// True if you want to show the loading message. + /// RemoteView object. + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public static RemoteView Create(EvasObject parent, string widgetId, string content, double period, + bool previewImage = true, bool overlayText = true, bool loadingMessage = true) + { + if (!_ready) + throw new InvalidOperationException("Not initialized"); + + var obj = new RemoteView() + { + Layout = new RemoteWindow(parent, widgetId, content, period) + }; + + if (!previewImage) + obj.HidePreviewImage(); + + if (!overlayText) + obj.HideOverlayText(); + + if (!loadingMessage) + obj.HideLoadingMessage(); + + return obj; + } + + /// + /// Finalizes the RemoteViewFactory. + /// + /// http://tizen.org/privilege/widget.viewer + /// Thrown when this operation failed. + /// Thrown when this operation is denied. + /// Thrown when this operation is not supported for this device. + public static void Shutdown() + { + if (!_ready) + throw new InvalidOperationException("Not initialized"); + RemoteView.CheckException(Interop.WidgetViewerEvas.Fini()); + _ready = false; + } + + } +} diff --git a/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteWindow.cs b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteWindow.cs new file mode 100755 index 0000000..c3874fb --- /dev/null +++ b/src/Tizen.Applications.RemoteView/Tizen.Applications/RemoteWindow.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; + +namespace Tizen.Applications +{ + internal class RemoteWindow : Layout + { + private static IntPtr _handle; + + private static EvasObject PrepareHandle(EvasObject parent, string widgetId, string content, double period) + { + _handle = Interop.WidgetViewerEvas.AddWidget(parent, widgetId, content, period); + + int err = Internals.Errors.ErrorFacts.GetLastResult(); + RemoteView.CheckException((Interop.WidgetViewerEvas.ErrorCode)err); + + if (_handle == IntPtr.Zero) + throw new InvalidOperationException("Return null pointer"); + + return parent; + } + + internal RemoteWindow(EvasObject parent, string widgetId, string content, double period) + : base(PrepareHandle(parent, widgetId, content, period)) + { + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr handle = _handle; + + _handle = IntPtr.Zero; + return handle; + } + } +} + diff --git a/src/Tizen.Applications.Service/Interop/Interop.Libraries.cs b/src/Tizen.Applications.Service/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..145ff34 --- /dev/null +++ b/src/Tizen.Applications.Service/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AppcoreAgent = "libappcore-agent.so.1"; + } +} diff --git a/src/Tizen.Applications.Service/Interop/Interop.Service.cs b/src/Tizen.Applications.Service/Interop/Interop.Service.cs new file mode 100755 index 0000000..d4cd60d --- /dev/null +++ b/src/Tizen.Applications.Service/Interop/Interop.Service.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications.CoreBackend; +using Tizen.Internals.Errors; + +internal static partial class Interop +{ + internal static partial class Service + { + internal delegate void AppEventCallback(IntPtr handle, IntPtr data); + + internal delegate bool ServiceAppCreateCallback(IntPtr userData); + + internal delegate void ServiceAppTerminateCallback(IntPtr userData); + + internal delegate void ServiceAppControlCallback(IntPtr appControl, IntPtr userData); + + [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_main")] + internal static extern ErrorCode Main(int argc, string[] argv, ref ServiceAppLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_exit")] + internal static extern void Exit(); + + [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_add_event_handler")] + internal static extern ErrorCode AddEventHandler(out IntPtr handle, DefaultCoreBackend.AppEventType eventType, AppEventCallback callback, IntPtr data); + + [DllImport(Libraries.AppcoreAgent, EntryPoint = "service_app_remove_event_handler")] + internal static extern ErrorCode RemoveEventHandler(IntPtr handle); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct ServiceAppLifecycleCallbacks + { + public ServiceAppCreateCallback OnCreate; + public ServiceAppTerminateCallback OnTerminate; + public ServiceAppControlCallback OnAppControl; + } + } +} diff --git a/src/Tizen.Applications.Service/Tizen.Applications.CoreBackend/ServiceCoreBackend.cs b/src/Tizen.Applications.Service/Tizen.Applications.CoreBackend/ServiceCoreBackend.cs new file mode 100755 index 0000000..bc1a096 --- /dev/null +++ b/src/Tizen.Applications.Service/Tizen.Applications.CoreBackend/ServiceCoreBackend.cs @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +using Tizen.Internals.Errors; + +namespace Tizen.Applications.CoreBackend +{ + internal class ServiceCoreBackend : DefaultCoreBackend + { + private Interop.Service.ServiceAppLifecycleCallbacks _callbacks; + private IntPtr _lowMemoryEventHandle = IntPtr.Zero; + private IntPtr _lowBatteryEventHandle = IntPtr.Zero; + private IntPtr _localeChangedEventHandle = IntPtr.Zero; + private IntPtr _regionChangedEventHandle = IntPtr.Zero; + private IntPtr _deviceOrientationChangedEventHandle = IntPtr.Zero; + private bool _disposedValue = false; + private Interop.Service.AppEventCallback _onLowMemoryNative; + private Interop.Service.AppEventCallback _onLowBatteryNative; + private Interop.Service.AppEventCallback _onLocaleChangedNative; + private Interop.Service.AppEventCallback _onRegionChangedNative; + private Interop.Service.AppEventCallback _onDeviceOrientationChangedNative; + + public ServiceCoreBackend() + { + _callbacks.OnCreate = new Interop.Service.ServiceAppCreateCallback(OnCreateNative); + _callbacks.OnTerminate = new Interop.Service.ServiceAppTerminateCallback(OnTerminateNative); + _callbacks.OnAppControl = new Interop.Service.ServiceAppControlCallback(OnAppControlNative); + + _onLowMemoryNative = new Interop.Service.AppEventCallback(OnLowMemoryNative); + _onLowBatteryNative = new Interop.Service.AppEventCallback(OnLowBatteryNative); + _onLocaleChangedNative = new Interop.Service.AppEventCallback(OnLocaleChangedNative); + _onRegionChangedNative = new Interop.Service.AppEventCallback(OnRegionChangedNative); + _onDeviceOrientationChangedNative = new Interop.Service.AppEventCallback(OnDeviceOrientationChangedNative); + } + + public override void Exit() + { + Interop.Service.Exit(); + } + + public override void Run(string[] args) + { + base.Run(args); + + ErrorCode err = ErrorCode.None; + err = Interop.Service.AddEventHandler(out _lowMemoryEventHandle, AppEventType.LowMemory, _onLowMemoryNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowMemory event. Err = " + err); + } + err = Interop.Service.AddEventHandler(out _lowBatteryEventHandle, AppEventType.LowBattery, _onLowBatteryNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowBattery event. Err = " + err); + } + + err = Interop.Service.AddEventHandler(out _localeChangedEventHandle, AppEventType.LanguageChanged, _onLocaleChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LocaleChanged event. Err = " + err); + } + + err = Interop.Service.AddEventHandler(out _regionChangedEventHandle, AppEventType.RegionFormatChanged, _onRegionChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for RegionFormatChanged event. Err = " + err); + } + + err = Interop.Service.AddEventHandler(out _deviceOrientationChangedEventHandle, AppEventType.DeviceOrientationChanged, _onDeviceOrientationChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for DeviceOrientationChanged event. Err = " + err); + } + + err = Interop.Service.Main(args.Length, args, ref _callbacks, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to run the application. Err = " + err); + } + } + + protected override void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + // Release disposable objects + } + + if (_lowMemoryEventHandle != IntPtr.Zero) + { + Interop.Service.RemoveEventHandler(_lowMemoryEventHandle); + } + if (_lowBatteryEventHandle != IntPtr.Zero) + { + Interop.Service.RemoveEventHandler(_lowBatteryEventHandle); + } + if (_localeChangedEventHandle != IntPtr.Zero) + { + Interop.Service.RemoveEventHandler(_localeChangedEventHandle); + } + if (_regionChangedEventHandle != IntPtr.Zero) + { + Interop.Service.RemoveEventHandler(_regionChangedEventHandle); + } + + if (_deviceOrientationChangedEventHandle != IntPtr.Zero) + { + Interop.Service.RemoveEventHandler(_deviceOrientationChangedEventHandle); + } + + _disposedValue = true; + } + } + + private bool OnCreateNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.Created)) + { + var handler = Handlers[EventType.Created] as Action; + handler?.Invoke(); + } + return true; + } + + private void OnTerminateNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.Terminated)) + { + var handler = Handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + } + + private void OnAppControlNative(IntPtr appControlHandle, IntPtr data) + { + if (Handlers.ContainsKey(EventType.AppControlReceived)) + { + // Create a SafeAppControlHandle but the ownsHandle is false, + // because the appControlHandle will be closed by native appfw after this method automatically. + SafeAppControlHandle safeHandle = new SafeAppControlHandle(appControlHandle, false); + + var handler = Handlers[EventType.AppControlReceived] as Action; + handler?.Invoke(new AppControlReceivedEventArgs(new ReceivedAppControl(safeHandle))); + } + } + + protected override void OnLowMemoryNative(IntPtr infoHandle, IntPtr data) + { + base.OnLowMemoryNative(infoHandle, data); + } + + protected override void OnLowBatteryNative(IntPtr infoHandle, IntPtr data) + { + base.OnLowBatteryNative(infoHandle, data); + } + + protected override void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnLocaleChangedNative(infoHandle, data); + } + + protected override void OnRegionChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnRegionChangedNative(infoHandle, data); + } + + protected override void OnDeviceOrientationChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnDeviceOrientationChangedNative(infoHandle, data); + } + + } +} diff --git a/src/Tizen.Applications.Service/Tizen.Applications.Service.csproj b/src/Tizen.Applications.Service/Tizen.Applications.Service.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.Service/Tizen.Applications.Service.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.Service/Tizen.Applications.Service.sln b/src/Tizen.Applications.Service/Tizen.Applications.Service.sln new file mode 100755 index 0000000..7e6b89f --- /dev/null +++ b/src/Tizen.Applications.Service/Tizen.Applications.Service.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Service", "Tizen.Applications.Service.csproj", "{BDA074BC-34BC-4CE4-B81B-4E06B29CA1FE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{4201665E-B641-4BDD-B5D1-5354AEDBE902}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E0E7023E-23E0-4B1B-A9D4-92A551771C55}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{C4B7B05A-8B70-40C9-B19C-CF11131520D6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BDA074BC-34BC-4CE4-B81B-4E06B29CA1FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BDA074BC-34BC-4CE4-B81B-4E06B29CA1FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BDA074BC-34BC-4CE4-B81B-4E06B29CA1FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BDA074BC-34BC-4CE4-B81B-4E06B29CA1FE}.Release|Any CPU.Build.0 = Release|Any CPU + {4201665E-B641-4BDD-B5D1-5354AEDBE902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4201665E-B641-4BDD-B5D1-5354AEDBE902}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4201665E-B641-4BDD-B5D1-5354AEDBE902}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4201665E-B641-4BDD-B5D1-5354AEDBE902}.Release|Any CPU.Build.0 = Release|Any CPU + {E0E7023E-23E0-4B1B-A9D4-92A551771C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0E7023E-23E0-4B1B-A9D4-92A551771C55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0E7023E-23E0-4B1B-A9D4-92A551771C55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0E7023E-23E0-4B1B-A9D4-92A551771C55}.Release|Any CPU.Build.0 = Release|Any CPU + {C4B7B05A-8B70-40C9-B19C-CF11131520D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C4B7B05A-8B70-40C9-B19C-CF11131520D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C4B7B05A-8B70-40C9-B19C-CF11131520D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C4B7B05A-8B70-40C9-B19C-CF11131520D6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.Service/Tizen.Applications/ServiceApplication.cs b/src/Tizen.Applications.Service/Tizen.Applications/ServiceApplication.cs new file mode 100755 index 0000000..d8742c1 --- /dev/null +++ b/src/Tizen.Applications.Service/Tizen.Applications/ServiceApplication.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Tizen.Applications.CoreBackend; + +namespace Tizen.Applications +{ + /// + /// Represents a service application. + /// + public class ServiceApplication : CoreApplication + { + /// + /// Initializes ServiceApplication class. + /// + public ServiceApplication() : base(new ServiceCoreBackend()) + { + } + + /// + /// Runs the service application's main loop. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + base.Run(args); + } + } +} diff --git a/src/Tizen.Applications.ToastMessage/Interop/Interop.Libraries.cs b/src/Tizen.Applications.ToastMessage/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..c284ac5 --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ToastMessage = "libnotification.so.0"; + } +} diff --git a/src/Tizen.Applications.ToastMessage/Interop/Interop.ToastMessage.cs b/src/Tizen.Applications.ToastMessage/Interop/Interop.ToastMessage.cs new file mode 100755 index 0000000..69e49db --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Interop/Interop.ToastMessage.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static class ToastMessage + { + [DllImport(Libraries.ToastMessage, EntryPoint = "notification_status_message_post")] + internal static extern int ToastMessagePost(string message); + } +} diff --git a/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.csproj b/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.sln b/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.sln new file mode 100755 index 0000000..f52e1fe --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Tizen.Applications.ToastMessage.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.ToastMessage", "Tizen.Applications.ToastMessage.csproj", "{E0083399-45B6-4045-90CC-ED72F1EC2472}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{A4E9A04D-78B1-4733-8E0E-9FB3F8D07560}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{3EEF8883-6470-4972-A3A2-27156897EB8F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{54C52299-BDF4-4934-889E-2D6B2340DBAD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E0083399-45B6-4045-90CC-ED72F1EC2472}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0083399-45B6-4045-90CC-ED72F1EC2472}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0083399-45B6-4045-90CC-ED72F1EC2472}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0083399-45B6-4045-90CC-ED72F1EC2472}.Release|Any CPU.Build.0 = Release|Any CPU + {A4E9A04D-78B1-4733-8E0E-9FB3F8D07560}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4E9A04D-78B1-4733-8E0E-9FB3F8D07560}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4E9A04D-78B1-4733-8E0E-9FB3F8D07560}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4E9A04D-78B1-4733-8E0E-9FB3F8D07560}.Release|Any CPU.Build.0 = Release|Any CPU + {3EEF8883-6470-4972-A3A2-27156897EB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EEF8883-6470-4972-A3A2-27156897EB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EEF8883-6470-4972-A3A2-27156897EB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EEF8883-6470-4972-A3A2-27156897EB8F}.Release|Any CPU.Build.0 = Release|Any CPU + {54C52299-BDF4-4934-889E-2D6B2340DBAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {54C52299-BDF4-4934-889E-2D6B2340DBAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {54C52299-BDF4-4934-889E-2D6B2340DBAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {54C52299-BDF4-4934-889E-2D6B2340DBAD}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessage.cs b/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessage.cs new file mode 100755 index 0000000..fd136b1 --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessage.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Applications +{ + /// + /// The class helps you create and show ToastMessage which is a view quick message for the user + /// + public sealed class ToastMessage + { + + /// + /// Gets and sets message to post ToastMessage + /// + public string Message { get; set; } + + /// + /// Posts a message on a toast popup + /// + /// Thrown when Message is null + /// + /// + /// ToastMessage toast = new ToastMessage + /// { + /// Message = "Hello TIzen" + /// }; + /// toast.Post(); + /// + /// + public void Post() + { + int ret = Interop.ToastMessage.ToastMessagePost(Message); + if (ret != (int)ToastMessageError.None) + { + throw ToastMessageErrorFactory.GetException((ToastMessageError)ret, "post toast message failed"); + } + } + } + +} diff --git a/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessageErrorFactory.cs b/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessageErrorFactory.cs new file mode 100755 index 0000000..cd2eebc --- /dev/null +++ b/src/Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessageErrorFactory.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + internal enum ToastMessageError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + DBusError = -0x01140000 | 0x03, + } + + internal class ToastMessageErrorFactory + { + private const string _logTag = "Tizen.Applications.ToastMessage"; + + internal static Exception GetException(ToastMessageError ret, string msg) + { + switch (ret) + { + case ToastMessageError.InvalidParameter: + Log.Error(_logTag, msg); + return new ArgumentException(ret + " error occurred."); + default: + Log.Error(_logTag, msg); + return new InvalidOperationException(ret + " error occurred."); + } + } + } +} diff --git a/src/Tizen.Applications.UI/Interop/Interop.Application.cs b/src/Tizen.Applications.UI/Interop/Interop.Application.cs new file mode 100755 index 0000000..177bfea --- /dev/null +++ b/src/Tizen.Applications.UI/Interop/Interop.Application.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications.CoreBackend; +using Tizen.Internals.Errors; + +internal static partial class Interop +{ + internal static partial class Application + { + internal delegate void AppEventCallback(IntPtr handle, IntPtr data); + + internal delegate bool AppCreateCallback(IntPtr userData); + + internal delegate void AppPauseCallback(IntPtr userData); + + internal delegate void AppResumeCallback(IntPtr userData); + + internal delegate void AppTerminateCallback(IntPtr userData); + + internal delegate void AppControlCallback(IntPtr appControl, IntPtr userData); + + [DllImport(Libraries.Application, EntryPoint = "ui_app_main")] + internal static extern ErrorCode Main(int argc, string[] argv, ref UIAppLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.Application, EntryPoint = "ui_app_exit")] + internal static extern void Exit(); + + [DllImport(Libraries.Application, EntryPoint = "ui_app_add_event_handler")] + internal static extern ErrorCode AddEventHandler(out IntPtr handle, DefaultCoreBackend.AppEventType eventType, AppEventCallback callback, IntPtr data); + + [DllImport(Libraries.Application, EntryPoint = "ui_app_remove_event_handler")] + internal static extern ErrorCode RemoveEventHandler(IntPtr handle); + + [StructLayout(LayoutKind.Sequential)] + internal struct UIAppLifecycleCallbacks + { + public AppCreateCallback OnCreate; + public AppTerminateCallback OnTerminate; + public AppPauseCallback OnPause; + public AppResumeCallback OnResume; + public AppControlCallback OnAppControl; + } + } +} + diff --git a/src/Tizen.Applications.UI/Interop/Interop.Libraries.cs b/src/Tizen.Applications.UI/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..03047b1 --- /dev/null +++ b/src/Tizen.Applications.UI/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Application = "libcapi-appfw-application.so.0"; + } +} diff --git a/src/Tizen.Applications.UI/Tizen.Applications.CoreBackend/UICoreBackend.cs b/src/Tizen.Applications.UI/Tizen.Applications.CoreBackend/UICoreBackend.cs new file mode 100755 index 0000000..933a4e0 --- /dev/null +++ b/src/Tizen.Applications.UI/Tizen.Applications.CoreBackend/UICoreBackend.cs @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +using Tizen.Internals.Errors; + +namespace Tizen.Applications.CoreBackend +{ + internal class UICoreBackend : DefaultCoreBackend + { + private Interop.Application.UIAppLifecycleCallbacks _callbacks; + private IntPtr _lowMemoryEventHandle = IntPtr.Zero; + private IntPtr _lowBatteryEventHandle = IntPtr.Zero; + private IntPtr _localeChangedEventHandle = IntPtr.Zero; + private IntPtr _regionChangedEventHandle = IntPtr.Zero; + private IntPtr _deviceOrientationChangedEventHandle = IntPtr.Zero; + private bool _disposedValue = false; + private Interop.Application.AppEventCallback _onLowMemoryNative; + private Interop.Application.AppEventCallback _onLowBatteryNative; + private Interop.Application.AppEventCallback _onLocaleChangedNative; + private Interop.Application.AppEventCallback _onRegionChangedNative; + private Interop.Application.AppEventCallback _onDeviceOrientationChangedNative; + + public UICoreBackend() + { + _callbacks.OnCreate = new Interop.Application.AppCreateCallback(OnCreateNative); + _callbacks.OnTerminate = new Interop.Application.AppTerminateCallback(OnTerminateNative); + _callbacks.OnAppControl = new Interop.Application.AppControlCallback(OnAppControlNative); + _callbacks.OnResume = new Interop.Application.AppResumeCallback(OnResumeNative); + _callbacks.OnPause = new Interop.Application.AppPauseCallback(OnPauseNative); + + _onLowMemoryNative = new Interop.Application.AppEventCallback(OnLowMemoryNative); + _onLowBatteryNative = new Interop.Application.AppEventCallback(OnLowBatteryNative); + _onLocaleChangedNative = new Interop.Application.AppEventCallback(OnLocaleChangedNative); + _onRegionChangedNative = new Interop.Application.AppEventCallback(OnRegionChangedNative); + _onDeviceOrientationChangedNative = new Interop.Application.AppEventCallback(OnDeviceOrientationChangedNative); + } + + public override void Exit() + { + Interop.Application.Exit(); + } + + public override void Run(string[] args) + { + base.Run(args); + + ErrorCode err = ErrorCode.None; + err = Interop.Application.AddEventHandler(out _lowMemoryEventHandle, AppEventType.LowMemory, _onLowMemoryNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowMemory event. Err = " + err); + } + err = Interop.Application.AddEventHandler(out _lowBatteryEventHandle, AppEventType.LowBattery, _onLowBatteryNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowBattery event. Err = " + err); + } + + err = Interop.Application.AddEventHandler(out _localeChangedEventHandle, AppEventType.LanguageChanged, _onLocaleChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LocaleChanged event. Err = " + err); + } + + err = Interop.Application.AddEventHandler(out _regionChangedEventHandle, AppEventType.RegionFormatChanged, _onRegionChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for RegionFormatChanged event. Err = " + err); + } + + err = Interop.Application.AddEventHandler(out _deviceOrientationChangedEventHandle, AppEventType.DeviceOrientationChanged, _onDeviceOrientationChangedNative, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for DeviceOrientationChanged event. Err = " + err); + } + + err = Interop.Application.Main(args.Length, args, ref _callbacks, IntPtr.Zero); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to run the application. Err = " + err); + } + } + + protected override void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + // Release disposable objects + } + + if (_lowMemoryEventHandle != IntPtr.Zero) + { + Interop.Application.RemoveEventHandler(_lowMemoryEventHandle); + } + if (_lowBatteryEventHandle != IntPtr.Zero) + { + Interop.Application.RemoveEventHandler(_lowBatteryEventHandle); + } + if (_localeChangedEventHandle != IntPtr.Zero) + { + Interop.Application.RemoveEventHandler(_localeChangedEventHandle); + } + if (_regionChangedEventHandle != IntPtr.Zero) + { + Interop.Application.RemoveEventHandler(_regionChangedEventHandle); + } + if (_deviceOrientationChangedEventHandle != IntPtr.Zero) + { + Interop.Application.RemoveEventHandler(_deviceOrientationChangedEventHandle); + } + + _disposedValue = true; + } + } + + private bool OnCreateNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.PreCreated)) + { + var handler = Handlers[EventType.PreCreated] as Action; + handler?.Invoke(); + } + + if (Handlers.ContainsKey(EventType.Created)) + { + var handler = Handlers[EventType.Created] as Action; + handler?.Invoke(); + } + return true; + } + + private void OnTerminateNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.Terminated)) + { + var handler = Handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + } + + private void OnAppControlNative(IntPtr appControlHandle, IntPtr data) + { + if (Handlers.ContainsKey(EventType.AppControlReceived)) + { + // Create a SafeAppControlHandle but the ownsHandle is false, + // because the appControlHandle will be closed by native appfw after this method automatically. + SafeAppControlHandle safeHandle = new SafeAppControlHandle(appControlHandle, false); + + var handler = Handlers[EventType.AppControlReceived] as Action; + handler?.Invoke(new AppControlReceivedEventArgs(new ReceivedAppControl(safeHandle))); + } + } + + private void OnResumeNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.Resumed)) + { + var handler = Handlers[EventType.Resumed] as Action; + handler?.Invoke(); + } + } + + private void OnPauseNative(IntPtr data) + { + if (Handlers.ContainsKey(EventType.Paused)) + { + var handler = Handlers[EventType.Paused] as Action; + handler?.Invoke(); + } + } + + protected override void OnLowMemoryNative(IntPtr infoHandle, IntPtr data) + { + base.OnLowMemoryNative(infoHandle, data); + } + + protected override void OnLowBatteryNative(IntPtr infoHandle, IntPtr data) + { + base.OnLowBatteryNative(infoHandle, data); + } + + protected override void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnLocaleChangedNative(infoHandle, data); + } + + protected override void OnRegionChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnRegionChangedNative(infoHandle, data); + } + + protected override void OnDeviceOrientationChangedNative(IntPtr infoHandle, IntPtr data) + { + base.OnDeviceOrientationChangedNative(infoHandle, data); + } + } +} diff --git a/src/Tizen.Applications.UI/Tizen.Applications.UI.csproj b/src/Tizen.Applications.UI/Tizen.Applications.UI.csproj new file mode 100755 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.UI/Tizen.Applications.UI.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.UI/Tizen.Applications.UI.sln b/src/Tizen.Applications.UI/Tizen.Applications.UI.sln new file mode 100755 index 0000000..43d25c7 --- /dev/null +++ b/src/Tizen.Applications.UI/Tizen.Applications.UI.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.UI", "Tizen.Applications.UI.csproj", "{560A2284-1C3F-4799-8DE5-9A568F44195F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{8A262C69-7E99-4605-83E2-A7F875B17EFB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{C7D0B251-3102-4A26-BC2E-0220C2DB45DB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{3B366840-7B06-4774-A7A0-E77E92F83BB4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {560A2284-1C3F-4799-8DE5-9A568F44195F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {560A2284-1C3F-4799-8DE5-9A568F44195F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {560A2284-1C3F-4799-8DE5-9A568F44195F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {560A2284-1C3F-4799-8DE5-9A568F44195F}.Release|Any CPU.Build.0 = Release|Any CPU + {8A262C69-7E99-4605-83E2-A7F875B17EFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A262C69-7E99-4605-83E2-A7F875B17EFB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A262C69-7E99-4605-83E2-A7F875B17EFB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A262C69-7E99-4605-83E2-A7F875B17EFB}.Release|Any CPU.Build.0 = Release|Any CPU + {C7D0B251-3102-4A26-BC2E-0220C2DB45DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7D0B251-3102-4A26-BC2E-0220C2DB45DB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7D0B251-3102-4A26-BC2E-0220C2DB45DB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7D0B251-3102-4A26-BC2E-0220C2DB45DB}.Release|Any CPU.Build.0 = Release|Any CPU + {3B366840-7B06-4774-A7A0-E77E92F83BB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B366840-7B06-4774-A7A0-E77E92F83BB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B366840-7B06-4774-A7A0-E77E92F83BB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B366840-7B06-4774-A7A0-E77E92F83BB4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.UI/Tizen.Applications/CoreUIApplication.cs b/src/Tizen.Applications.UI/Tizen.Applications/CoreUIApplication.cs new file mode 100755 index 0000000..03256e7 --- /dev/null +++ b/src/Tizen.Applications.UI/Tizen.Applications/CoreUIApplication.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +using Tizen.Applications.CoreBackend; + +namespace Tizen.Applications +{ + /// + /// Represents an application that have UI screen. The events for resuming and pausing are provided. + /// + public class CoreUIApplication : CoreApplication + { + /// + /// Initializes the CoreUIApplication class. + /// + /// + /// Default backend for UI application will be used. + /// + public CoreUIApplication() : base(new UICoreBackend()) + { + } + + /// + /// Initializes the CoreUIApplication class. + /// + /// + /// If want to change the backend, use this constructor. + /// + /// The backend instance implementing ICoreBacked interface. + public CoreUIApplication(ICoreBackend backend) : base(backend) + { + } + + /// + /// Occurs whenever the application is resumed. + /// + public event EventHandler Resumed; + + /// + /// Occurs whenever the application is paused. + /// + public event EventHandler Paused; + + /// + /// Runs the UI application's main loop. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + Backend.AddEventHandler(EventType.PreCreated, OnPreCreate); + Backend.AddEventHandler(EventType.Resumed, OnResume); + Backend.AddEventHandler(EventType.Paused, OnPause); + base.Run(args); + } + + /// + /// Overrides this method if want to handle behavior before calling OnCreate(). + /// + protected virtual void OnPreCreate() + { + } + + /// + /// Overrides this method if want to handle behavior when the application is resumed. + /// If base.OnResume() is not called, the event 'Resumed' will not be emitted. + /// + protected virtual void OnResume() + { + Resumed?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior when the application is paused. + /// If base.OnPause() is not called, the event 'Paused' will not be emitted. + /// + protected virtual void OnPause() + { + Paused?.Invoke(this, EventArgs.Empty); + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Interop/Interop.Libraries.cs b/src/Tizen.Applications.WatchApplication/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..77c0b48 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AppCommon = "libcapi-appfw-app-common.so.0"; + public const string AppCoreWatch = "libappcore-watch.so.1"; + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.WatchApplication/Interop/Interop.Watch.cs b/src/Tizen.Applications.WatchApplication/Interop/Interop.Watch.cs new file mode 100755 index 0000000..b4ffa33 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Interop/Interop.Watch.cs @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class Watch + { + internal enum AppEventType + { + LowMemory = 0, + LowBattery, + LanguageChanged, + DeviceOrientationChanged, + RegionFormatChanged, + SuspendedStateChanged + } + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + InvalidContext = -0x01100000 | 0x01, + NoSuchFile = Tizen.Internals.Errors.ErrorCode.NoSuchFile, + AlreadyRunning = Tizen.Internals.Errors.ErrorCode.AlreadyInProgress + } + + internal delegate void AppEventCallback(IntPtr handle, IntPtr data); + + internal delegate bool WatchAppCreateCallback(int width, int height, IntPtr userData); + + internal delegate void WatchAppPauseCallback(IntPtr userData); + + internal delegate void WatchAppResumeCallback(IntPtr userData); + + internal delegate void WatchAppTerminateCallback(IntPtr userData); + + internal delegate void WatchAppControlCallback(IntPtr appControl, IntPtr userData); + + internal delegate void WatchAppTimeTickCallback(IntPtr watchTime, IntPtr userData); + + internal delegate void WatchAppAmbientTickCallback(IntPtr watchTime, IntPtr userData); + + internal delegate void WatchAppAmbientChangedCallback(bool ambientMode, IntPtr userData); + + [StructLayout(LayoutKind.Sequential)] + internal struct WatchAppLifecycleCallbacks + { + public WatchAppCreateCallback OnCreate; + public WatchAppControlCallback OnAppControl; + public WatchAppPauseCallback OnPause; + public WatchAppResumeCallback OnResume; + public WatchAppTerminateCallback OnTerminate; + public WatchAppTimeTickCallback OnTick; + public WatchAppAmbientTickCallback OnAmbientTick; + public WatchAppAmbientChangedCallback OnAmbientChanged; + } + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_main")] + internal static extern ErrorCode Main(int argc, string[] argv, ref WatchAppLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_exit")] + internal static extern void Exit(); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_add_event_handler")] + internal static extern ErrorCode AddEventHandler(out IntPtr handle, AppEventType eventType, AppEventCallback callback, IntPtr userData); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_remove_event_handler")] + internal static extern ErrorCode RemoveEventHandler(IntPtr handle); + + // tizen 3.0 + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_set_time_tick_frequency")] + internal static extern ErrorCode SetTimeTickFrequency(int ticks, TimeTickResolution type); + + // tizen 3.0 + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_get_time_tick_frequency")] + internal static extern ErrorCode GetTimeTickFrequency(out int ticks, out TimeTickResolution type); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_set_ambient_tick_type")] + internal static extern ErrorCode SetAmbientTickType(AmbientTickType type); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_get_ambient_tick_type")] + internal static extern ErrorCode GetAmbientTickType(out AmbientTickType type); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_delete")] + internal static extern ErrorCode WatchTimeDelete(IntPtr watchTime); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_year")] + internal static extern ErrorCode WatchTimeGetYear(SafeWatchTimeHandle handle, out int year); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_month")] + internal static extern ErrorCode WatchTimeGetMonth(SafeWatchTimeHandle handle, out int month); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_day")] + internal static extern ErrorCode WatchTimeGetDay(SafeWatchTimeHandle handle, out int day); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_day_of_week")] + internal static extern ErrorCode WatchTimeGetDayOfWeek(SafeWatchTimeHandle handle, out int day_of_week); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_hour")] + internal static extern ErrorCode WatchTimeGetHour(SafeWatchTimeHandle handle, out int hour); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_hour24")] + internal static extern ErrorCode WatchTimeGetHour24(SafeWatchTimeHandle handle, out int hour24); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_minute")] + internal static extern ErrorCode WatchTimeGetMinute(SafeWatchTimeHandle handle, out int minute); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_second")] + internal static extern ErrorCode WatchTimeGetSecond(SafeWatchTimeHandle handle, out int second); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_millisecond")] + internal static extern ErrorCode WatchTimeGetMillisecond(SafeWatchTimeHandle handle, out int millisecond); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_app_get_elm_win")] + internal static extern ErrorCode GetWin(out IntPtr win); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_utc_timestamp")] + internal static extern ErrorCode WatchTimeGetUtcTimestamp(SafeWatchTimeHandle handle, out long utc_timestamp); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_time_zone")] + internal static extern ErrorCode WatchTimeGetTimeZone(SafeWatchTimeHandle handle, out string time_zone_id); + + [DllImport(Libraries.AppCoreWatch, EntryPoint = "watch_time_get_current_time")] + internal static extern ErrorCode WatchTimeGetCurrentTime(out SafeWatchTimeHandle handle); + + // app common + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_memory_status")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLowMemoryStatus(IntPtr handle, out LowMemoryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_battery_status")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLowBatteryStatus(IntPtr handle, out LowBatteryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_language")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLanguage(IntPtr handle, out string lang); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_region_format")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetRegionFormat(IntPtr handle, out string region); + + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchCoreBackend.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchCoreBackend.cs new file mode 100755 index 0000000..01f0bc1 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchCoreBackend.cs @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Internals.Errors; + +namespace Tizen.Applications.CoreBackend +{ + internal class WatchCoreBackend : ICoreBackend + { + private const string LOGTAG = "Tizen.Applications.WatchApplication"; + + private Dictionary _handlers = new Dictionary(); + + private bool _disposedValue = false; + + private Interop.Watch.AppEventCallback _lowMemoryCallback; + private Interop.Watch.AppEventCallback _lowBatteryCallback; + private Interop.Watch.AppEventCallback _localeChangedCallback; + private Interop.Watch.AppEventCallback _regionChnagedCallback; + + private IntPtr _lowMemoryEventHandle = IntPtr.Zero; + private IntPtr _lowBatteryEventHandle = IntPtr.Zero; + private IntPtr _localeChangedEventHandle = IntPtr.Zero; + private IntPtr _regionChnagedEventHandle = IntPtr.Zero; + + private Interop.Watch.WatchAppLifecycleCallbacks _callbacks; + + public WatchCoreBackend() + { + _lowMemoryCallback = new Interop.Watch.AppEventCallback(OnLowMemoryNative); + _lowBatteryCallback = new Interop.Watch.AppEventCallback(OnLowBatteryNative); + _localeChangedCallback = new Interop.Watch.AppEventCallback(OnLocaleChangedNative); + _regionChnagedCallback = new Interop.Watch.AppEventCallback(OnRegionChangedNative); + + _callbacks.OnCreate = new Interop.Watch.WatchAppCreateCallback(OnCreateNative); + _callbacks.OnTerminate = new Interop.Watch.WatchAppTerminateCallback(OnTerminateNative); + _callbacks.OnResume = new Interop.Watch.WatchAppResumeCallback(OnResumeNative); + _callbacks.OnPause = new Interop.Watch.WatchAppPauseCallback(OnPauseNative); + _callbacks.OnAppControl = new Interop.Watch.WatchAppControlCallback(OnAppControlNative); + + _callbacks.OnTick = new Interop.Watch.WatchAppTimeTickCallback(OnTimeTickNative); + _callbacks.OnAmbientTick = new Interop.Watch.WatchAppAmbientTickCallback(OnAmbientTickNative); + _callbacks.OnAmbientChanged = new Interop.Watch.WatchAppAmbientChangedCallback(OnAmbientChangedNative); + } + + ~WatchCoreBackend() + { + Dispose(false); + } + + public void AddEventHandler(EventType evType, Action handler) + { + _handlers.Add(evType, handler); + } + + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + _handlers.Add(evType, handler); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + // Release disposable objects + } + + if (_lowMemoryEventHandle != IntPtr.Zero) + { + Interop.Watch.RemoveEventHandler(_lowMemoryEventHandle); + } + if (_lowBatteryEventHandle != IntPtr.Zero) + { + Interop.Watch.RemoveEventHandler(_lowBatteryEventHandle); + } + if (_localeChangedEventHandle != IntPtr.Zero) + { + Interop.Watch.RemoveEventHandler(_localeChangedEventHandle); + } + if (_regionChnagedEventHandle != IntPtr.Zero) + { + Interop.Watch.RemoveEventHandler(_regionChnagedEventHandle); + } + + _disposedValue = true; + } + } + + public void Exit() + { + Interop.Watch.Exit(); + } + + public void Run(string[] args) + { + Interop.Watch.ErrorCode err = Interop.Watch.ErrorCode.None; + + err = Interop.Watch.AddEventHandler(out _lowMemoryEventHandle, Interop.Watch.AppEventType.LowMemory, _lowMemoryCallback, IntPtr.Zero); + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to add event handler for LowMemory event, Err = " + err); + } + + err = Interop.Watch.AddEventHandler(out _lowBatteryEventHandle, Interop.Watch.AppEventType.LowBattery, _lowBatteryCallback, IntPtr.Zero); + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to add event handler for LowBattery event, Err = " + err); + } + + err = Interop.Watch.AddEventHandler(out _localeChangedEventHandle, Interop.Watch.AppEventType.LanguageChanged, _localeChangedCallback, IntPtr.Zero); + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to add event handler for LocaleChanged event, Err = " + err); + } + + err = Interop.Watch.AddEventHandler(out _regionChnagedEventHandle, Interop.Watch.AppEventType.RegionFormatChanged, _regionChnagedCallback, IntPtr.Zero); + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to add event handler for RegionFormatChanged event, Err = " + err); + } + + err = Interop.Watch.Main(args.Length, args, ref _callbacks, IntPtr.Zero); + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to run the Watch application, Err = " + err); + } + } + + private void OnLowMemoryNative(IntPtr infoHandle, IntPtr data) + { + LowMemoryStatus status = LowMemoryStatus.None; + ErrorCode err = Interop.Watch.AppEventGetLowMemoryStatus(infoHandle, out status); + if (err != ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get memory status, Err = " + err); + } + if (_handlers.ContainsKey(WatchEventType.LowMemory)) + { + var handler = _handlers[WatchEventType.LowMemory] as Action; + handler?.Invoke(new LowMemoryEventArgs(status)); + } + } + + private void OnLowBatteryNative(IntPtr infoHandle, IntPtr data) + { + LowBatteryStatus status = LowBatteryStatus.None; + ErrorCode err = Interop.Watch.AppEventGetLowBatteryStatus(infoHandle, out status); + if (err != Tizen.Internals.Errors.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get battery status, Err = " + err); + } + if (_handlers.ContainsKey(WatchEventType.LowBattery)) + { + var handler = _handlers[WatchEventType.LowBattery] as Action; + handler?.Invoke(new LowBatteryEventArgs(status)); + } + } + private void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data) + { + string lang; + ErrorCode err = Interop.Watch.AppEventGetLanguage(infoHandle, out lang); + if (err != ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get changed language. Err = " + err); + } + if (_handlers.ContainsKey(WatchEventType.LocaleChanged)) + { + var handler = _handlers[WatchEventType.LocaleChanged] as Action; + handler?.Invoke(new LocaleChangedEventArgs(lang)); + } + } + private void OnRegionChangedNative(IntPtr infoHandle, IntPtr data) + { + string region; + ErrorCode err = Interop.Watch.AppEventGetRegionFormat(infoHandle, out region); + if (err != ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get changed region format. Err = " + err); + } + if (_handlers.ContainsKey(WatchEventType.RegionFormatChanged)) + { + var handler = _handlers[WatchEventType.RegionFormatChanged] as Action; + handler?.Invoke(new RegionFormatChangedEventArgs(region)); + } + } + private bool OnCreateNative(int width, int height, IntPtr data) + { + if (_handlers.ContainsKey(WatchEventType.PreCreated)) + { + var handler = _handlers[WatchEventType.PreCreated] as Action; + handler?.Invoke(); + } + + if (_handlers.ContainsKey(WatchEventType.Created)) + { + var handler = _handlers[WatchEventType.Created] as Action; + handler?.Invoke(); + } + return true; + } + + private void OnTerminateNative(IntPtr data) + { + if (_handlers.ContainsKey(WatchEventType.Terminated)) + { + var handler = _handlers[WatchEventType.Terminated] as Action; + handler?.Invoke(); + } + } + + private void OnAppControlNative(IntPtr appControlHandle, IntPtr data) + { + if (_handlers.ContainsKey(WatchEventType.AppControlReceived)) + { + SafeAppControlHandle safeHandle = new SafeAppControlHandle(appControlHandle, false); + + var handler = _handlers[WatchEventType.AppControlReceived] as Action; + + handler?.Invoke(new AppControlReceivedEventArgs(new ReceivedAppControl(safeHandle))); + } + } + + private void OnResumeNative(IntPtr data) + { + if (_handlers.ContainsKey(WatchEventType.Resumed)) + { + var handler = _handlers[WatchEventType.Resumed] as Action; + handler?.Invoke(); + } + } + + private void OnPauseNative(IntPtr data) + { + if (_handlers.ContainsKey(WatchEventType.Paused)) + { + var handler = _handlers[WatchEventType.Paused] as Action; + handler?.Invoke(); + } + } + + private void OnTimeTickNative(IntPtr watchTime, IntPtr userData) + { + if (_handlers.ContainsKey(WatchEventType.TimeTick)) + { + var handler = _handlers[WatchEventType.TimeTick] as Action; + handler?.Invoke(new TimeEventArgs() + { + Time = new WatchTime(new SafeWatchTimeHandle(watchTime, false)) + }); + } + } + + private void OnAmbientTickNative(IntPtr watchTime, IntPtr userData) + { + if (_handlers.ContainsKey(WatchEventType.AmbientTick)) + { + var handler = _handlers[WatchEventType.AmbientTick] as Action; + handler?.Invoke(new TimeEventArgs() + { + Time = new WatchTime(new SafeWatchTimeHandle(watchTime, false)) + }); + } + } + + private void OnAmbientChangedNative(bool ambientMode, IntPtr userData) + { + if (_handlers.ContainsKey(WatchEventType.AmbientChanged)) + { + var handler = _handlers[WatchEventType.AmbientChanged] as Action; + handler?.Invoke(new AmbientEventArgs() + { + Enabled = ambientMode + }); + } + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchEventType.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchEventType.cs new file mode 100755 index 0000000..c996029 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications.CoreBackend/WatchEventType.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Applications.CoreBackend; + +namespace Tizen.Applications.CoreBackend +{ + /// + /// Class that represents the type of event for backends. This class can be converted from string type. + /// + public class WatchEventType : EventType + { + /// + /// Pre-defined event type. "Created" + /// + public static readonly WatchEventType TimeTick = "TimeTick"; + + /// + /// Pre-defined event type. "AmbientTick" + /// + public static readonly WatchEventType AmbientTick = "AmbientTick"; + + /// + /// Pre-defined event type. "AmbientChanged" + /// + public static readonly WatchEventType AmbientChanged = "AmbientChanged"; + + /// + /// Initializes the WatchEventType class. + /// + /// The name of watch event type. + public WatchEventType(string name) : base(name) + { + } + + /// + /// Converts a string to WatchEventType instance. + /// + public static implicit operator WatchEventType(string value) + { + return new WatchEventType(value); + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.csproj b/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.csproj new file mode 100644 index 0000000..be4b321 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.sln b/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.sln new file mode 100755 index 0000000..63347eb --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications.WatchApplication.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.WatchApplication", "Tizen.Applications.WatchApplication.csproj", "{8BF860DC-DCBC-4889-938F-7515C5282D95}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{34997257-2357-4915-BE87-462750971990}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B659B1EF-6967-4FB9-B398-30D964410272}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{F993FF87-2DC9-4282-B88A-E99C8CECB320}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{66EC3D92-AD41-4906-A1A9-3C414B2107F5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BF860DC-DCBC-4889-938F-7515C5282D95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BF860DC-DCBC-4889-938F-7515C5282D95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BF860DC-DCBC-4889-938F-7515C5282D95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BF860DC-DCBC-4889-938F-7515C5282D95}.Release|Any CPU.Build.0 = Release|Any CPU + {34997257-2357-4915-BE87-462750971990}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34997257-2357-4915-BE87-462750971990}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34997257-2357-4915-BE87-462750971990}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34997257-2357-4915-BE87-462750971990}.Release|Any CPU.Build.0 = Release|Any CPU + {B659B1EF-6967-4FB9-B398-30D964410272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B659B1EF-6967-4FB9-B398-30D964410272}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B659B1EF-6967-4FB9-B398-30D964410272}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B659B1EF-6967-4FB9-B398-30D964410272}.Release|Any CPU.Build.0 = Release|Any CPU + {F993FF87-2DC9-4282-B88A-E99C8CECB320}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F993FF87-2DC9-4282-B88A-E99C8CECB320}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F993FF87-2DC9-4282-B88A-E99C8CECB320}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F993FF87-2DC9-4282-B88A-E99C8CECB320}.Release|Any CPU.Build.0 = Release|Any CPU + {66EC3D92-AD41-4906-A1A9-3C414B2107F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66EC3D92-AD41-4906-A1A9-3C414B2107F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66EC3D92-AD41-4906-A1A9-3C414B2107F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66EC3D92-AD41-4906-A1A9-3C414B2107F5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientEventArgs.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientEventArgs.cs new file mode 100755 index 0000000..aa9e7b5 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientEventArgs.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that reaised when the device enters or exits the ambient mode. + /// + public class AmbientEventArgs : EventArgs + { + /// + /// The received Ambient mode + /// + public bool Enabled { get; internal set; } + + internal AmbientEventArgs() + { + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientTickType.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientTickType.cs new file mode 100755 index 0000000..c82656e --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/AmbientTickType.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration for Ambient tick type. + /// + public enum AmbientTickType + { + /// + /// No peridoic ambient tick. + /// + NoTick, + /// + /// Every minute. + /// + EveryMinute, + /// + /// Every 5 minutes. + /// + EveryFiveMinutes, + /// + /// Every 15 minutes. + /// + EveryFiftenMinutes, + /// + /// Every 30 minutes. + /// + EveryThirtyMinutes, + /// + /// Every hour. + /// + EveryHour, + /// + /// Every 3 hours. + /// + EveryThreeHours, + /// + /// Every 6 hours. + /// + EverySixHours, + /// + /// Every 12 hours. + /// + EveryTwelveHours, + /// + /// Every day. + /// + EveryDay + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/SafeWatchTimeHandle.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/SafeWatchTimeHandle.cs new file mode 100755 index 0000000..f87501c --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/SafeWatchTimeHandle.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Applications +{ + internal sealed class SafeWatchTimeHandle : SafeHandle + { + internal SafeWatchTimeHandle() : base(IntPtr.Zero, true) + { + } + + internal SafeWatchTimeHandle(IntPtr existingHandle, bool ownHandle) : base(IntPtr.Zero, ownHandle) + { + SetHandle(existingHandle); + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + Interop.Watch.WatchTimeDelete(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeEventArgs.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeEventArgs.cs new file mode 100755 index 0000000..1d100fe --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeEventArgs.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Arguments for the event that reaised when the time tick comes. + /// + public class TimeEventArgs : EventArgs + { + /// + /// The received WatchTime. + /// + public WatchTime Time { get; internal set; } + + internal TimeEventArgs() + { + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeTickResolution.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeTickResolution.cs new file mode 100755 index 0000000..79c1b29 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/TimeTickResolution.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// Enumeration for Time tick resolution. + /// + public enum TimeTickResolution + { + /// + /// 1 ~ 60 ticks per second. + /// + TimeTicksPerSecond, + /// + /// 1 ~ 60 ticks per minute. + /// + TimeTicksPerMinute, + /// + /// 1 ~ 60 ticks per hour. + /// + TimeTicksPerHour + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchApplication.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchApplication.cs new file mode 100755 index 0000000..f739b47 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchApplication.cs @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Applications.CoreBackend; +using ElmSharp; + +namespace Tizen.Applications +{ + /// + /// The class that represents a Tizen watch application. + /// + public class WatchApplication : CoreApplication + { + /// + /// Initialize the WatchApplication class + /// + /// + /// Default backend for Watch application will be used. + /// + public WatchApplication() : base(new WatchCoreBackend()) + { + } + + /// + /// Initialize the WatchApplication class + /// + /// + /// If want to change the backend , use this constructor + /// + /// The backend instance implementing ICoreBackend interface. + public WatchApplication(ICoreBackend backend) : base(backend) + { + } + + /// + /// Instance for the window + /// + protected Widget Window; + + /// + /// Occurs whenever the application is resumed. + /// + public event EventHandler Resumed; + + /// + /// Occurs whenever the application is paused. + /// + public event EventHandler Paused; + + /// + /// Occurs whenever the time tick comes. + /// + public event EventHandler TimeTick; + + /// + /// Occurs whenever the time tick comes in ambient mode. + /// + public event EventHandler AmbientTick; + + /// + /// Occurs when the ambient mode is changed. + /// + public event EventHandler AmbientChanged; + + /// + /// Runs the UI applications' main loop. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + Backend.AddEventHandler(EventType.Resumed, OnResume); + Backend.AddEventHandler(EventType.Paused, OnPause); + + Backend.AddEventHandler(WatchEventType.TimeTick, OnTick); + Backend.AddEventHandler(WatchEventType.AmbientTick, OnAmbientTick); + Backend.AddEventHandler(WatchEventType.AmbientChanged, OnAmbientChanged); + + base.Run(args); + } + + /// + /// Overrides this method if want to handle behavior when the application is launched. + /// If base.OnCreate() is not called, the event 'Created' will not be emitted. + /// + protected override void OnCreate() + { + base.OnCreate(); + IntPtr win; + + Interop.Watch.GetWin(out win); + Window = new WatchWindow(win); + } + + /// + /// Overrides this method if want to handle behavior when the application is resumed. + /// If base.OnResume() is not called, the event 'Resumed' will not be emitted. + /// + protected virtual void OnResume() + { + Resumed?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior when the application is paused. + /// If base.OnPause() is not called, the event 'Paused' will not be emitted. + /// + protected virtual void OnPause() + { + Paused?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior when the time tick event comes. + /// If base.OnTick() is not called, the event 'TimeTick' will not be emitted. + /// + /// The received TimeEventArgs to get time information. + protected virtual void OnTick(TimeEventArgs time) + { + TimeTick?.Invoke(this, time); + } + + /// + /// Overrides this method if want to handle behavior when the time tick event comes in ambient mode. + /// If base.OnAmbientTick() is not called, the event 'AmbientTick' will not be emitted. + /// + /// The received TimeEventArgs to get time information. + /// http://tizen.org/privilege/alarm.set + protected virtual void OnAmbientTick(TimeEventArgs time) + { + AmbientTick?.Invoke(this, time); + } + + /// + /// Overrides this method if want to handle behavior when the ambient mode is changed. + /// If base.OnAmbientChanged() is not called, the event 'AmbientChanged' will not be emitted. + /// + /// The received AmbientEventArgs + protected virtual void OnAmbientChanged(AmbientEventArgs mode) + { + AmbientChanged?.Invoke(this, mode); + } + + /// + /// Gets the current time + /// + /// WatchTime + /// Thrown when failed to get current time because of invalid parameter. + /// Thrown when failed to get current time because memory is not enough. + /// + /// + /// class MyApp : WatchApplication + /// { + /// ... + /// public void TestMethod() + /// { + /// WatchTime wt; + /// try + /// { + /// wt = GetCurrentTime(); + /// } + /// catch + /// { + /// } + /// } + /// } + /// + /// + protected WatchTime GetCurrentTime() + { + SafeWatchTimeHandle handle; + + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetCurrentTime(out handle); + if (err != Interop.Watch.ErrorCode.None) + { + if (err == Interop.Watch.ErrorCode.InvalidParameter) + throw new InvalidOperationException("Failed to get current time. err : " + err); + else if (err == Interop.Watch.ErrorCode.OutOfMemory) + throw new OutOfMemoryException("Failed to get current time. err : " + err); + } + return new WatchTime(handle); + } + + /// + /// Gets the type of periodic ambient tick. + /// + /// AmbientTickType + /// Thrown when failed to get ambient tick type. + /// + /// + /// class MyApp : WatchApplication + /// { + /// ... + /// public void TestMethod() + /// { + /// AmbientTickType atType; + /// try + /// { + /// atType = GetAmbientTickType(); + /// } + /// catch + /// { + /// } + /// } + /// } + /// + /// + protected AmbientTickType GetAmbientTickType() + { + AmbientTickType ambientTickType; + + Interop.Watch.ErrorCode err = Interop.Watch.GetAmbientTickType(out ambientTickType); + + if(err != Interop.Watch.ErrorCode.None) + { + throw new InvalidOperationException("Failed to get ambient tick type. err : " + err); + } + + return ambientTickType; + } + + /// + /// Sets the type of periodic ambient tick. + /// OnAmbientTick will be called following settings. + /// If SetAmbientTickType is not called, OnAmbientTick will be called every minute. + /// + /// the type of ambient tick + /// Thrown when failed to set ambient tick type. + /// + /// + /// class MyApp : WatchApplication + /// { + /// ... + /// public void TestMethod() + /// { + /// try + /// { + /// SetAmbientTickType(AmbientTickType.EveryMinute); + /// } + /// catch + /// { + /// } + /// } + /// } + /// + /// + protected void SetAmbientTickType(AmbientTickType ambientTickType) + { + Interop.Watch.ErrorCode err = Interop.Watch.SetAmbientTickType(ambientTickType); + + if(err != Interop.Watch.ErrorCode.None) + { + throw new InvalidOperationException("Failed to set ambient tick type. err : " + err); + } + } + + /// + /// Sets the frequency of time tick. + /// OnTick will be called following settings. + /// If SetTimeTickFrequency is not called, OnTick will be called every second. + /// + /// Ticks the number of ticks per given resolution type + /// Type of the resolution type + /// Thrown when failed to set time tick frequency. + /// + /// + /// class MyApp : WatchApplication + /// { + /// ... + /// public void TestMethod() + /// { + /// try + /// { + /// SetTimeTickFrequency(1, TimeTickResolution.TimeTicksPerMinute); + /// } + /// catch + /// { + /// } + /// } + /// } + /// + /// + protected void SetTimeTickFrequency(int ticks, TimeTickResolution type) + { + Interop.Watch.ErrorCode err = Interop.Watch.SetTimeTickFrequency(ticks, type); + + if (err != Interop.Watch.ErrorCode.None) + { + throw new InvalidOperationException("Failed to set time tick frequency. err : " + err); + } + } + + /// + /// Gets the frequency fo time tick. + /// + /// Ticks the number of ticks per given resolution type + /// Type of the resolution type + /// Thrown when failed to get time tick frequency. + /// + /// + /// class MyApp : WatchApplication + /// { + /// ... + /// public void TestMethod() + /// { + /// int tick; + /// TimeTickResolution tType; + /// try + /// { + /// GetTimeTickFrequency(out tick, out tType); + /// } + /// catch + /// { + /// } + /// } + /// } + /// + /// + protected void GetTimeTickFrequency(out int ticks, out TimeTickResolution type) + { + Interop.Watch.ErrorCode err = Interop.Watch.GetTimeTickFrequency(out ticks, out type); + + if (err != Interop.Watch.ErrorCode.None) + { + throw new InvalidOperationException("Failed to get time tick frequency. err : " + err); + } + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchTime.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchTime.cs new file mode 100755 index 0000000..94ce435 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchTime.cs @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The information of Watch Time + /// + public class WatchTime + { + private readonly SafeWatchTimeHandle _handle; + private static readonly string LOGTAG = "Tizen.Applications.WatchApplication"; + + internal WatchTime(SafeWatchTimeHandle handle) + { + _handle = handle; + } + + /// + /// The information of year + /// + public int Year + { + get + { + int year; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetYear(_handle, out year); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Year err : " + err); + } + return year; + } + } + + /// + /// The information fo month + /// + public int Month + { + get + { + int month; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetMonth(_handle, out month); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Month err : " + err); + } + return month; + } + } + + /// + /// The information of day + /// + public int Day + { + get + { + int day; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetDay(_handle, out day); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Day err : " + err); + } + return day; + } + } + + /// + /// The information of day of week + /// + public int DayOfWeek + { + get + { + int dayOfWeek; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetDayOfWeek(_handle, out dayOfWeek); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Second err : " + err); + } + return dayOfWeek; + } + } + + /// + /// The information of hour + /// + public int Hour + { + get + { + int hour; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetHour(_handle, out hour); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Hour err : " + err); + } + return hour; + } + } + + /// + /// The information of hour for 24 hour form + /// + public int Hour24 + { + get + { + int hour24; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetHour24(_handle, out hour24); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Hour24 err : " + err); + } + return hour24; + } + } + + /// + /// The information of Minute + /// + public int Minute + { + get + { + int minute; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetMinute(_handle, out minute); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Minute err : " + err); + } + return minute; + } + } + + /// + /// The information of second + /// + public int Second + { + get + { + int second; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetSecond(_handle, out second); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Second err : " + err); + } + return second; + } + } + + /// + /// The information of millisecond + /// + public int Millisecond + { + get + { + int ms; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetMillisecond(_handle, out ms); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Second err : " + err); + } + return ms; + } + } + + /// + /// The information of timezone + /// + public string TimeZone + { + get + { + string zone; + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetTimeZone(_handle, out zone); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get Second err : " + err); + } + return zone; + } + } + + /// + /// The information of UTC time stamp + /// + public DateTime UtcTimestamp + { + get + { + long ts = 0; + + Interop.Watch.ErrorCode err = Interop.Watch.WatchTimeGetUtcTimestamp(_handle, out ts); + + if (err != Interop.Watch.ErrorCode.None) + { + Log.Error(LOGTAG, "Failed to get UtcTimestamp err : " + err); + } + + return (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddSeconds(ts).ToLocalTime(); + } + } + } +} diff --git a/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchWindow.cs b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchWindow.cs new file mode 100755 index 0000000..2d751d5 --- /dev/null +++ b/src/Tizen.Applications.WatchApplication/Tizen.Applications/WatchWindow.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; + +namespace Tizen.Applications +{ + internal class WatchWindow : Widget + { + private IntPtr _handle; + + internal WatchWindow(IntPtr handle) : base() + { + _handle = handle; + Realize(null); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return _handle; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Applications.WidgetApplication/Interop/Interop.Libraries.cs b/src/Tizen.Applications.WidgetApplication/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..7b43b38 --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AppCommon = "libcapi-appfw-app-common.so.0"; + public const string AppcoreWidget = "libcapi-appfw-widget-application.so.1"; + public const string WidgetService = "libwidget_service.so.1"; + } +} diff --git a/src/Tizen.Applications.WidgetApplication/Interop/Interop.Widget.cs b/src/Tizen.Applications.WidgetApplication/Interop/Interop.Widget.cs new file mode 100755 index 0000000..390227d --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Interop/Interop.Widget.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class Widget + { + internal enum WidgetAppDestroyType + { + Permanent = 0, + Temporary + } + + internal enum AppEventType + { + LowMemory = 0, + LowBattery, + LanguageChanged, + DeviceOrientationChanged, + RegionFormatChanged, + SuspendedStateChanged + } + + internal enum ErrorCode : int + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + Canceled = Tizen.Internals.Errors.ErrorCode.Canceled, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + FileNoSpaceOnDevice = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, + Fault = -0x02F40000 | 0x0001, + AlreadyExist = -0x02F40000 | 0x0002, + AlreadyStarted = -0x02F40000 | 0x0004, + NotExist = -0x02F40000 | 0x0008, + Disabled = -0x02F40000 | 0x0010, + MaxExceeded = -0x02F40000 | 0x0011, + } + + internal delegate void AppEventCallback(IntPtr handle, IntPtr data); + + internal delegate IntPtr WidgetAppCreateCallback(IntPtr userData); + + internal delegate void WidgetAppTerminateCallback(IntPtr userData); + + internal delegate int WidgetInstanceCreateCallback(IntPtr context, IntPtr content, int w, int h, IntPtr userData); + + internal delegate int WidgetInstanceDestroyCallback(IntPtr context, WidgetAppDestroyType reason, IntPtr content, IntPtr userData); + + internal delegate int WidgetInstancePauseCallback(IntPtr context, IntPtr userData); + + internal delegate int WidgetInstanceResumeCallback(IntPtr context, IntPtr userData); + + internal delegate int WidgetInstanceResizeCallback(IntPtr context, int w, int h, IntPtr userData); + + internal delegate int WidgetInstanceUpdateCallback(IntPtr context, IntPtr content, int force, IntPtr userData); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_main")] + internal static extern ErrorCode Main(int argc, string[] argv, ref WidgetAppLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_exit")] + internal static extern void Exit(); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_add_event_handler")] + internal static extern ErrorCode AddEventHandler(out IntPtr handle, AppEventType eventType, AppEventCallback callback, IntPtr data); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_remove_event_handler")] + internal static extern ErrorCode RemoveEventHandler(IntPtr handle); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_class_create")] + internal static extern IntPtr CreateClass(WidgetiInstanceLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_class_add")] + internal static extern IntPtr AddClass(IntPtr handle, string classId, WidgetiInstanceLifecycleCallbacks callback, IntPtr userData); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_terminate_context")] + internal static extern ErrorCode TerminateContext(IntPtr handle); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_context_set_content_info")] + internal static extern ErrorCode SetContent(IntPtr handle, SafeBundleHandle content); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_context_set_title")] + internal static extern ErrorCode SetTitle(IntPtr handle, string title); + + [DllImport(Libraries.AppcoreWidget, EntryPoint = "widget_app_get_elm_win")] + internal static extern ErrorCode GetWin(IntPtr handle, out IntPtr win); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_memory_status")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLowMemoryStatus(IntPtr handle, out LowMemoryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_low_battery_status")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLowBatteryStatus(IntPtr handle, out LowBatteryStatus status); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_language")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetLanguage(IntPtr handle, out string lang); + + [DllImport(Libraries.AppCommon, EntryPoint = "app_event_get_region_format")] + internal static extern Tizen.Internals.Errors.ErrorCode AppEventGetRegionFormat(IntPtr handle, out string region); + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct WidgetAppLifecycleCallbacks + { + public WidgetAppCreateCallback OnCreate; + public WidgetAppTerminateCallback OnTerminate; + } + + [StructLayoutAttribute(LayoutKind.Sequential)] + internal struct WidgetiInstanceLifecycleCallbacks + { + public WidgetInstanceCreateCallback OnCreate; + public WidgetInstanceDestroyCallback OnDestroy; + public WidgetInstancePauseCallback OnPause; + public WidgetInstanceResumeCallback OnResume; + public WidgetInstanceResizeCallback OnResize; + public WidgetInstanceUpdateCallback OnUpdate; + } + } +} diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications.CoreBackend/WidgetCoreBackend.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.CoreBackend/WidgetCoreBackend.cs new file mode 100755 index 0000000..eee864b --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.CoreBackend/WidgetCoreBackend.cs @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Internals.Errors; + +namespace Tizen.Applications.CoreBackend +{ + internal class WidgetCoreBackend : ICoreBackend + { + protected static readonly string LogTag = typeof(WidgetCoreBackend).Namespace; + + private Dictionary _handlers = new Dictionary(); + + private bool _disposedValue = false; + + private Interop.Widget.AppEventCallback _lowMemoryCallback; + private Interop.Widget.AppEventCallback _lowBatteryCallback; + private Interop.Widget.AppEventCallback _localeChangedCallback; + private Interop.Widget.AppEventCallback _regionChangedCallback; + + private IntPtr _lowMemoryEventHandle = IntPtr.Zero; + private IntPtr _lowBatteryEventHandle = IntPtr.Zero; + private IntPtr _localeChangedEventHandle = IntPtr.Zero; + private IntPtr _regionChangedEventHandle = IntPtr.Zero; + + private Interop.Widget.WidgetAppLifecycleCallbacks _callbacks; + + internal IList WidgetTypes = new List(); + + public WidgetCoreBackend() + { + _lowMemoryCallback = new Interop.Widget.AppEventCallback(OnLowMemoryNative); + _lowBatteryCallback = new Interop.Widget.AppEventCallback(OnLowBatteryNative); + _localeChangedCallback = new Interop.Widget.AppEventCallback(OnLocaleChangedNative); + _regionChangedCallback = new Interop.Widget.AppEventCallback(OnRegionChangedNative); + + _callbacks.OnCreate = new Interop.Widget.WidgetAppCreateCallback(OnCreateNative); + _callbacks.OnTerminate = new Interop.Widget.WidgetAppTerminateCallback(OnTerminateNative); + } + + ~WidgetCoreBackend() + { + Dispose(false); + } + + internal void CreateWidgetTypes(IDictionary typeInfo) + { + foreach (Type w in typeInfo.Keys) + { + WidgetTypes.Add(new WidgetType(w, typeInfo[w])); + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + // Release disposable objects + } + + if (_lowMemoryEventHandle != IntPtr.Zero) + { + Interop.Widget.RemoveEventHandler(_lowMemoryEventHandle); + } + if (_lowBatteryEventHandle != IntPtr.Zero) + { + Interop.Widget.RemoveEventHandler(_lowBatteryEventHandle); + } + if (_localeChangedEventHandle != IntPtr.Zero) + { + Interop.Widget.RemoveEventHandler(_localeChangedEventHandle); + } + if (_regionChangedEventHandle != IntPtr.Zero) + { + Interop.Widget.RemoveEventHandler(_regionChangedEventHandle); + } + + _disposedValue = true; + } + } + + public void Exit() + { + Interop.Widget.Exit(); + } + + public void Run(string[] args) + { + Interop.Widget.ErrorCode err = Interop.Widget.ErrorCode.None; + err = Interop.Widget.AddEventHandler(out _lowMemoryEventHandle, Interop.Widget.AppEventType.LowMemory, _lowMemoryCallback, IntPtr.Zero); + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowMemory event. Err = " + err); + } + err = Interop.Widget.AddEventHandler(out _lowBatteryEventHandle, Interop.Widget.AppEventType.LowBattery, _lowBatteryCallback, IntPtr.Zero); + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LowBattery event. Err = " + err); + } + + err = Interop.Widget.AddEventHandler(out _localeChangedEventHandle, Interop.Widget.AppEventType.LanguageChanged, _localeChangedCallback, IntPtr.Zero); + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for LocaleChanged event. Err = " + err); + } + + err = Interop.Widget.AddEventHandler(out _regionChangedEventHandle, Interop.Widget.AppEventType.RegionFormatChanged, _regionChangedCallback, IntPtr.Zero); + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to add event handler for RegionFormatChanged event. Err = " + err); + } + + err = Interop.Widget.Main(args.Length, args, ref _callbacks, IntPtr.Zero); + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to run the application. Err = " + err); + } + } + + private IntPtr OnCreateNative(IntPtr data) + { + if (_handlers.ContainsKey(EventType.Created)) + { + var handler = _handlers[EventType.Created] as Action; + handler?.Invoke(); + } + + IntPtr h = IntPtr.Zero; + foreach (WidgetType type in WidgetTypes) + h = type.Bind(h); + + return h; + } + + private void OnTerminateNative(IntPtr data) + { + if (_handlers.ContainsKey(EventType.Terminated)) + { + var handler = _handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + } + + public void AddEventHandler(EventType evType, Action handler) + { + _handlers.Add(evType, handler); + } + + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + _handlers.Add(evType, handler); + } + + private void OnLowMemoryNative(IntPtr infoHandle, IntPtr data) + { + LowMemoryStatus status = LowMemoryStatus.None; + ErrorCode err = Interop.Widget.AppEventGetLowMemoryStatus(infoHandle, out status); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get memory status. Err = " + err); + } + if (_handlers.ContainsKey(EventType.LowMemory)) + { + var handler = _handlers[EventType.LowMemory] as Action; + handler?.Invoke(new LowMemoryEventArgs(status)); + } + } + + private void OnLowBatteryNative(IntPtr infoHandle, IntPtr data) + { + LowBatteryStatus status = LowBatteryStatus.None; + ErrorCode err = Interop.Widget.AppEventGetLowBatteryStatus(infoHandle, out status); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get battery status. Err = " + err); + } + if (_handlers.ContainsKey(EventType.LowBattery)) + { + var handler = _handlers[EventType.LowBattery] as Action; + handler?.Invoke(new LowBatteryEventArgs(status)); + } + } + + private void OnLocaleChangedNative(IntPtr infoHandle, IntPtr data) + { + string lang; + ErrorCode err = Interop.Widget.AppEventGetLanguage(infoHandle, out lang); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get changed language. Err = " + err); + } + if (_handlers.ContainsKey(EventType.LocaleChanged)) + { + var handler = _handlers[EventType.LocaleChanged] as Action; + handler?.Invoke(new LocaleChangedEventArgs(lang)); + } + } + + private void OnRegionChangedNative(IntPtr infoHandle, IntPtr data) + { + string region; + ErrorCode err = Interop.Widget.AppEventGetRegionFormat(infoHandle, out region); + if (err != ErrorCode.None) + { + Log.Error(LogTag, "Failed to get changed region format. Err = " + err); + } + if (_handlers.ContainsKey(EventType.RegionFormatChanged)) + { + var handler = _handlers[EventType.RegionFormatChanged] as Action; + handler?.Invoke(new RegionFormatChangedEventArgs(region)); + } + } + + } +} diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.csproj b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.csproj new file mode 100644 index 0000000..be4b321 --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.sln b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.sln new file mode 100755 index 0000000..0fb9d73 --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications.WidgetApplication.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.WidgetApplication", "Tizen.Applications.WidgetApplication.csproj", "{9E43466E-58AB-416C-98DB-9B576706223F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{B4B467DD-7FE6-433F-B759-01AA60A9F4DD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{747177C6-A318-4C78-9248-841178EDB499}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{63FAA012-D280-4BD3-9069-0FA056F688D7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{248EA228-52A0-4A65-B236-2311C8895DEB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9E43466E-58AB-416C-98DB-9B576706223F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E43466E-58AB-416C-98DB-9B576706223F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E43466E-58AB-416C-98DB-9B576706223F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E43466E-58AB-416C-98DB-9B576706223F}.Release|Any CPU.Build.0 = Release|Any CPU + {B4B467DD-7FE6-433F-B759-01AA60A9F4DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4B467DD-7FE6-433F-B759-01AA60A9F4DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4B467DD-7FE6-433F-B759-01AA60A9F4DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4B467DD-7FE6-433F-B759-01AA60A9F4DD}.Release|Any CPU.Build.0 = Release|Any CPU + {747177C6-A318-4C78-9248-841178EDB499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {747177C6-A318-4C78-9248-841178EDB499}.Debug|Any CPU.Build.0 = Debug|Any CPU + {747177C6-A318-4C78-9248-841178EDB499}.Release|Any CPU.ActiveCfg = Release|Any CPU + {747177C6-A318-4C78-9248-841178EDB499}.Release|Any CPU.Build.0 = Release|Any CPU + {63FAA012-D280-4BD3-9069-0FA056F688D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {63FAA012-D280-4BD3-9069-0FA056F688D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {63FAA012-D280-4BD3-9069-0FA056F688D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {63FAA012-D280-4BD3-9069-0FA056F688D7}.Release|Any CPU.Build.0 = Release|Any CPU + {248EA228-52A0-4A65-B236-2311C8895DEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {248EA228-52A0-4A65-B236-2311C8895DEB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {248EA228-52A0-4A65-B236-2311C8895DEB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {248EA228-52A0-4A65-B236-2311C8895DEB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetApplication.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetApplication.cs new file mode 100755 index 0000000..ba8edc1 --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetApplication.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Applications.CoreBackend; + +namespace Tizen.Applications +{ + /// + /// Represents a widget application. + /// + public class WidgetApplication : CoreApplication + { + /// + /// Initializes the WidgetApplication class with the type and application ID. + /// + /// Map structure for the derived class type and widget ID. + public WidgetApplication(IDictionary typeInfo) : base(new WidgetCoreBackend()) + { + WidgetCoreBackend core = Backend as WidgetCoreBackend; + + core?.CreateWidgetTypes(typeInfo); + } + + /// + /// Initializes the WidgetApplication class with the type. + /// + /// Widget ID will be replaced as the application ID. + /// Derived class type. + public WidgetApplication(Type type) : base(new WidgetCoreBackend()) + { + WidgetCoreBackend core = Backend as WidgetCoreBackend; + + core?.CreateWidgetTypes(new Dictionary() { {type, ApplicationInfo.ApplicationId } }); + } + + /// + /// Gets all instances of the widget associated with the type. + /// + /// Class type for the widget. + public IEnumerable GetInstances(Type type) + { + WidgetCoreBackend core = Backend as WidgetCoreBackend; + + if (core == null) + return null; + + foreach (WidgetType w in core.WidgetTypes) + { + if (w.ClassType == type) + { + return w.WidgetInstances; + } + } + + return null; + } + + /// + /// Runs the widget application's main loop. + /// + /// Arguments from the commandline. + public override void Run(string[] args) + { + base.Run(args); + } + } +} diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetBase.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetBase.cs new file mode 100755 index 0000000..3573556 --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetBase.cs @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; + +namespace Tizen.Applications +{ + /// + /// The abstract class for widget instances. + /// + public abstract class WidgetBase + { + internal IntPtr Handle; + internal string Id; + protected static readonly string LogTag = typeof(WidgetBase).Namespace; + + /// + /// Window object for this widget instance. + /// It will be created after OnCreate method is invoked. + /// + protected Window Window; + + /// + /// Delete type. + /// + public enum WidgetDestroyType + { + /// + /// User deleted this widget from the viewer. + /// + Permanent = 0, + + /// + /// Widget is deleted because of other reasons. (For e.g., widget process is terminated temporarily by the system) + /// + Temporary + } + + /// + /// Constructor. + /// + public WidgetBase() + { + } + + /// + /// Sets the content information to the widget. + /// + /// The data set to save. + /// Thrown when failed because of an invalid argument. + /// Thrown when the API is not supported in this device. + /// Thrown in case of an unrecoverable error. + public void SetContent(Bundle info) + { + Interop.Widget.ErrorCode err = Interop.Widget.SetContent(Handle, info.SafeBundleHandle); + + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to set content. Err = " + err); + + switch(err) + { + case Interop.Widget.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter of SetContent()"); + + case Interop.Widget.ErrorCode.NotSupported: + throw new NotSupportedException(); + + case Interop.Widget.ErrorCode.OutOfMemory: + case Interop.Widget.ErrorCode.Fault: + throw new InvalidOperationException(); + } + + } + } + + /// + /// Sends the title to the widget. + /// + /// When an accessibility mode is turned on, this string will be read. + /// Thrown when failed because of an invalid argument. + /// Thrown when the API is not supported in this device. + /// Thrown in case of an unrecoverable error. + public void SetTitle(string title) + { + Interop.Widget.ErrorCode err = Interop.Widget.SetTitle(Handle, title); + + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to set title. Err = " + err); + + switch (err) + { + case Interop.Widget.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter of SetContent()"); + + case Interop.Widget.ErrorCode.NotSupported: + throw new NotSupportedException(); + + case Interop.Widget.ErrorCode.OutOfMemory: + case Interop.Widget.ErrorCode.Fault: + throw new InvalidOperationException(); + } + } + } + + /// + /// Finishes the context for the widget instance. + /// + /// Thrown when the API is not supported in this device. + /// Thrown in case of an unrecoverable error. + public void Exit() + { + Interop.Widget.ErrorCode err = Interop.Widget.TerminateContext(Handle); + + if (err != Interop.Widget.ErrorCode.None) + { + Log.Error(LogTag, "Failed to terminate context. Err = " + err); + + switch (err) + { + case Interop.Widget.ErrorCode.NotSupported: + throw new NotSupportedException(); + + case Interop.Widget.ErrorCode.InvalidParameter: + case Interop.Widget.ErrorCode.Fault: + throw new InvalidOperationException(); + } + } + } + + internal void Bind(IntPtr handle, string id) + { + Handle = handle; + Id = id; + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is started. + /// + /// The data set for the previous status. + /// The pixel value for the widget width. + /// The pixel value for the widget height. + public virtual void OnCreate(Bundle content, int w, int h) + { + IntPtr win; + + Interop.Widget.GetWin(Handle, out win); + Window = new WidgetWindow(win); + Window.Resize(w, h); + Window.Show(); + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is destroyed. + /// + /// The reason for destruction. + /// The data set to save. + public virtual void OnDestroy(WidgetDestroyType reason, Bundle content) + { + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is paused. + /// + public virtual void OnPause() + { + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is resumed. + /// + public virtual void OnResume() + { + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is resized. + /// + /// Widget width. + /// Widget height. + public virtual void OnResize(int w, int h) + { + } + + /// + /// Overrides this method if want to handle the behavior when the widget instance is updated. + /// + /// The data set for updating this widget will be provided by the requester. + /// Although the widget is paused, if it is true, the widget can be updated. + public virtual void OnUpdate(Bundle content, bool isForce) + { + } + + } +} diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetType.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetType.cs new file mode 100755 index 0000000..c19e81e --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetType.cs @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Applications +{ + internal class WidgetType + { + internal readonly Type ClassType; + internal readonly string Id; + internal IList WidgetInstances = new List(); + + private Interop.Widget.WidgetiInstanceLifecycleCallbacks _callbacks; + + internal WidgetType(Type ctype, string id) + { + ClassType = ctype; + Id = id; + _callbacks.OnCreate = new Interop.Widget.WidgetInstanceCreateCallback(OnCreate); + _callbacks.OnDestroy = new Interop.Widget.WidgetInstanceDestroyCallback(OnDestroy); + _callbacks.OnPause = new Interop.Widget.WidgetInstancePauseCallback(OnPause); + _callbacks.OnResume = new Interop.Widget.WidgetInstanceResumeCallback(OnResume); + _callbacks.OnResize = new Interop.Widget.WidgetInstanceResizeCallback(OnResize); + _callbacks.OnUpdate = new Interop.Widget.WidgetInstanceUpdateCallback(OnUpdate); + } + + internal IntPtr Bind(IntPtr h) + { + return Interop.Widget.AddClass(h, Id, _callbacks, IntPtr.Zero); + } + + private int OnCreate(IntPtr context, IntPtr content, int w, int h, IntPtr userData) + { + WidgetBase b = Activator.CreateInstance(ClassType) as WidgetBase; + Bundle bundle = null; + + if (b == null) + return 0; + + b.Bind(context, Id); + WidgetInstances.Add(b); + if (content != IntPtr.Zero) + bundle = new Bundle(new SafeBundleHandle(content, false)); + b.OnCreate(bundle, w, h); + + return 0; + } + + private int OnDestroy(IntPtr context, Interop.Widget.WidgetAppDestroyType reason, IntPtr content, IntPtr userData) + { + foreach (WidgetBase w in WidgetInstances) + { + if(w.Handle == context) + { + Bundle bundle = null; + + if (content != IntPtr.Zero) + bundle = new Bundle(new SafeBundleHandle(content, false)); + + w.OnDestroy(reason == Interop.Widget.WidgetAppDestroyType.Permanent ? + WidgetBase.WidgetDestroyType.Permanent : + WidgetBase.WidgetDestroyType.Temporary, bundle); + WidgetInstances.Remove(w); + break; + } + } + + return 0; + } + + private int OnPause(IntPtr context, IntPtr userData) + { + foreach (WidgetBase w in WidgetInstances) + { + if (w.Handle == context) + { + w.OnPause(); + break; + } + } + return 0; + } + + private int OnResume(IntPtr context, IntPtr userData) + { + foreach (WidgetBase w in WidgetInstances) + { + if (w.Handle == context) + { + w.OnResume(); + break; + } + } + return 0; + } + + private int OnResize(IntPtr context, int w, int h, IntPtr userData) + { + foreach (WidgetBase o in WidgetInstances) + { + if (o.Handle == context) + { + o.OnResize(w, h); + break; + } + } + return 0; + } + + private int OnUpdate(IntPtr context, IntPtr content, int force, IntPtr userData) + { + foreach (WidgetBase o in WidgetInstances) + { + if (o.Handle == context) + { + Bundle bundle = null; + + if (content != IntPtr.Zero) + bundle = new Bundle(new SafeBundleHandle(content, false)); + o.OnUpdate(bundle, force != 0 ? true : false); + break; + } + } + return 0; + } + } +} + diff --git a/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs new file mode 100755 index 0000000..870e11d --- /dev/null +++ b/src/Tizen.Applications.WidgetApplication/Tizen.Applications/WidgetWindow.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; +using System.Collections.Generic; + +namespace Tizen.Applications +{ + internal class WidgetWindow : Window + { + private IntPtr _handle; + + internal WidgetWindow(IntPtr handle) : base() + { + _handle = handle; + Realize(null); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return _handle; + } + } +} + diff --git a/src/Tizen.Applications.WidgetControl/Interop/Interop.Libraries.cs b/src/Tizen.Applications.WidgetControl/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..e447fa6 --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string WidgetService = "libwidget_service.so.1"; + } +} diff --git a/src/Tizen.Applications.WidgetControl/Interop/Interop.WidgetService.cs b/src/Tizen.Applications.WidgetControl/Interop/Interop.WidgetService.cs new file mode 100755 index 0000000..b49e859 --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Interop/Interop.WidgetService.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class WidgetService + { + internal enum ErrorCode : int + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + Canceled = Tizen.Internals.Errors.ErrorCode.Canceled, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + FileNoSpaceOnDevice = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, + Fault = -0x02F40000 | 0x0001, + AlreadyExist = -0x02F40000 | 0x0002, + AlreadyStarted = -0x02F40000 | 0x0004, + NotExist = -0x02F40000 | 0x0008, + Disabled = -0x02F40000 | 0x0010, + MaxExceeded = -0x02F40000 | 0x0011, + } + + internal enum LifecycleEvent : int + { + AppDead = 0, + Created = 1, + Destroyed = 2, + Paused = 3, + Resumed = 4, + Max = 5 + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InstanceCallback(string widgetId, string instanceId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void LifecycleCallback(string widgetId, LifecycleEvent e, string instanceId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void WidgetListCallback(string widgetId, int isPrime, IntPtr userData); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_icon")] + internal static extern string GetIcon(string pkgId, string lang); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_name")] + internal static extern string GetName(string widgetId, string lang); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_nodisplay")] + internal static extern int GetNoDisplay(string widgetId); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_widget_instance_list")] + internal static extern ErrorCode GetInstances(string widgetId, InstanceCallback callback, IntPtr userData); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_set_lifecycle_event_cb")] + internal static extern ErrorCode SetLifecycleEvent(string widgetId, LifecycleCallback callback, IntPtr userData); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_unset_lifecycle_event_cb")] + internal static extern ErrorCode UnsetLifecycleEvent(string widgetId, IntPtr userData); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_trigger_update")] + internal static extern ErrorCode UpdateContent(string widgetId, string instanceId, SafeBundleHandle bundle, int force); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_change_period")] + internal static extern ErrorCode ChangePeriod(string widgetId, string instanceId, double period); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_content_of_widget_instance")] + internal static extern ErrorCode GetContent(string widgetId, string instanceId, out IntPtr bundle); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_package_id")] + internal static extern string GetPkgId(string widgetId); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_supported_sizes")] + internal static extern ErrorCode GetSupportedSizes(string widgetId, ref int cnt, out int[] w, out int[] h); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_supported_size_types")] + internal static extern ErrorCode GetSupportedSizeTypes(string widgetId, ref int cnt, out int[] types); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_preview_image_path")] + internal static extern string GetPreviewImagePath(string widgetId, int sizeType); + + [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_widget_list_by_pkgid")] + internal static extern ErrorCode GetWidgetListByPkgId(string pkgId, WidgetListCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.csproj b/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.csproj new file mode 100644 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.sln b/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.sln new file mode 100755 index 0000000..66d5bd7 --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Tizen.Applications.WidgetControl.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.WidgetControl", "Tizen.Applications.WidgetControl.csproj", "{E26FA846-98DF-4FDC-94B2-6857CC5DA810}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F0E88DE4-4979-410B-A3C3-163F17927C4A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{1476ED0F-D5B1-447E-84C6-1955D2715755}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{38DF06B7-F031-434F-A415-F1240671F81D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E26FA846-98DF-4FDC-94B2-6857CC5DA810}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E26FA846-98DF-4FDC-94B2-6857CC5DA810}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E26FA846-98DF-4FDC-94B2-6857CC5DA810}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E26FA846-98DF-4FDC-94B2-6857CC5DA810}.Release|Any CPU.Build.0 = Release|Any CPU + {F0E88DE4-4979-410B-A3C3-163F17927C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0E88DE4-4979-410B-A3C3-163F17927C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0E88DE4-4979-410B-A3C3-163F17927C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0E88DE4-4979-410B-A3C3-163F17927C4A}.Release|Any CPU.Build.0 = Release|Any CPU + {1476ED0F-D5B1-447E-84C6-1955D2715755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1476ED0F-D5B1-447E-84C6-1955D2715755}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1476ED0F-D5B1-447E-84C6-1955D2715755}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1476ED0F-D5B1-447E-84C6-1955D2715755}.Release|Any CPU.Build.0 = Release|Any CPU + {38DF06B7-F031-434F-A415-F1240671F81D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38DF06B7-F031-434F-A415-F1240671F81D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38DF06B7-F031-434F-A415-F1240671F81D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38DF06B7-F031-434F-A415-F1240671F81D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetControl.cs b/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetControl.cs new file mode 100755 index 0000000..9407e0d --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetControl.cs @@ -0,0 +1,708 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Applications; + +namespace Tizen.Applications +{ + /// + /// The class for receiving widget events and sending data to the widget. + /// + public class WidgetControl : IDisposable + { + /// + /// Class for the widget instance. + /// + public class Instance + { + private string _widgetId; + + internal Instance(string widgetId) + { + _widgetId = widgetId; + } + + /// + /// The widget ID. + /// + /// 3 + public string Id { get; internal set; } + + /// + /// Gets the widget content. + /// + /// 3 + /// Thrown in case of failed conditions. + public Bundle GetContent() + { + IntPtr h; + + Interop.WidgetService.ErrorCode err = Interop.WidgetService.GetContent(_widgetId, Id, out h); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.IoError: + throw new InvalidOperationException("Failed to access DB"); + } + + return new Bundle(new SafeBundleHandle(h, true)); + } + + /// + /// Changes the content for the widget instance. + /// + /// 3 + /// Content to be changed. + /// True if you want to update your widget even if the provider is paused, otherwise false. + /// Thrown when failed because of an invalid argument. + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public void ChangeContent(Bundle content, bool force) + { + Interop.WidgetService.ErrorCode err = Interop.WidgetService.UpdateContent(_widgetId, Id, content.SafeBundleHandle, force ? 1 : 0); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + + case Interop.WidgetService.ErrorCode.Canceled: + throw new InvalidOperationException("Provider is paused, so this update request is canceld"); + + case Interop.WidgetService.ErrorCode.OutOfMemory: + throw new InvalidOperationException("Out-of-memory at unmanaged code"); + + case Interop.WidgetService.ErrorCode.Fault: + throw new InvalidOperationException("Failed to create a request packet"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + } + + /// + /// Changes the update period for the widget instance. + /// + /// 3 + /// Thrown when failed because of an invalid argument. + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public void ChangePeriod(double period) + { + Interop.WidgetService.ErrorCode err = Interop.WidgetService.ChangePeriod(_widgetId, Id, period); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + + case Interop.WidgetService.ErrorCode.OutOfMemory: + throw new InvalidOperationException("Out-of-memory at unmanaged code"); + + case Interop.WidgetService.ErrorCode.Fault: + throw new InvalidOperationException("Failed to create a request packet"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + } + } + + /// + /// The class for the widget size information. + /// + public class Scale + { + + internal Scale() + { + } + + /// + /// Enumeration for the types of widget size. + /// + /// 3 + public enum SizeType : int + { + /// + /// 175x175 based on 720x1280 resolution. + /// + Basic1x1 = 0x0001, + + /// + /// 354x175 based on 720x1280 resolution. + /// + Basic2x1 = 0x0002, + + /// + /// 354x354 based on 720x1280 resolution. + /// + Basic2x2 = 0x0004, + + /// + /// 712x175 based on 720x1280 resolution. + /// + Basic4x1 = 0x0008, + + /// + /// 712x354 based on 720x1280 resolution. + /// + Basic4x2 = 0x0010, + + /// + /// 712x533 based on 720x1280 resolution. + /// + Basic4x3 = 0x0020, + + /// + /// 712x712 based on 720x1280 resolution. + /// + Basic4x4 = 0x0040, + + /// + /// 712x891 based on 720x1280 resolution. + /// + Basic4x5 = 0x0080, + + /// + /// 712x1070 based on 720x1280 resolution. + /// + Basic4x6 = 0x0100, + + + /// + /// 224x215 based on 720x1280 resolution. + /// + Easy1x1 = 0x1000, + + /// + /// 680x215 based on 720x1280 resolution. + /// + Easy1x2 = 0x2000, + + /// + /// 680x653 based on 720x1280 resolution. + /// + Easy1x3 = 0x4000, + + /// + /// 720x1280 based on 720x1280 resolution. + /// + Full = 0x0800, + } + + /// + /// Widget width. + /// + /// 3 + public int Width { get; internal set; } + + /// + ///Widget height. + /// + /// 3 + public int Height { get; internal set; } + + /// + /// The path for the widget preview image file. + /// + /// 3 + public string PreviewImagePath { get; internal set; } + + /// + /// The size type of the widget. + /// + /// 3 + public SizeType Type { get; internal set; } + } + + private event EventHandler _created; + private event EventHandler _resumed; + private event EventHandler _paused; + private event EventHandler _destroyed; + private bool _disposedValue = false; + private static IDictionary s_lifecycleEventRefCnt = new Dictionary(); + private static IList s_eventObjects = new List(); + + /// + /// Factory method for the WidgetControl. + /// It will create all the objects of WidgetControl based on the package ID. + /// + /// 3 + /// Package ID. + /// http://tizen.org/privilege/widget.viewer + /// Thrown when failed because of an invalid argument. + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public static WidgetControl[] CreateAll(string pkgId) + { + List list = new List(); + + Interop.WidgetService.ErrorCode err = Interop.WidgetService.GetWidgetListByPkgId(pkgId, (widgetId, isPrime, userData) => + { + list.Add(new WidgetControl(widgetId)); + }, IntPtr.Zero); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + + case Interop.WidgetService.ErrorCode.IoError: + throw new InvalidOperationException("Failed to access DB"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + + return list.ToArray(); + } + + /// + /// Gets all the widget IDs by the package ID. + /// + /// 3 + /// http://tizen.org/privilege/widget.viewer + /// Thrown when failed because of an invalid argument. + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public static string[] GetWidgetIds(string pkgId) + { + List list = new List(); + + Interop.WidgetService.ErrorCode err = Interop.WidgetService.GetWidgetListByPkgId(pkgId, (widgetId, isPrime, userData) => + { + list.Add(widgetId); + }, IntPtr.Zero); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + + case Interop.WidgetService.ErrorCode.IoError: + throw new InvalidOperationException("Failed to access DB"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + + return list.ToArray(); + } + + /// + /// The widget ID. + /// + /// 3 + public string Id { get; internal set; } + + /// + /// The flag value for "nodisplay". + /// + /// 3 + /// http://tizen.org/privilege/widget.viewer + public bool IsNoDisplay + { + get + { + if (Interop.WidgetService.GetNoDisplay(Id) != 0) + return true; + + return false; + } + } + + /// + /// The event handler for a created widget instance. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public event EventHandler Created + { + add + { + RegisterLifecycleEvent(); + _created += value; + } + remove + { + _created -= value; + UnregisterLifecycleEvent(); + } + } + + /// + /// The event handler for a resumed widget instance. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public event EventHandler Resumed + { + add + { + RegisterLifecycleEvent(); + _resumed += value; + } + remove + { + _resumed -= value; + UnregisterLifecycleEvent(); + } + } + + /// + /// The event handler for a paused widget instance. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public event EventHandler Paused + { + add + { + RegisterLifecycleEvent(); + _paused += value; + } + remove + { + _paused -= value; + UnregisterLifecycleEvent(); + } + } + + /// + /// The event handler for a destroyed widget instance. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public event EventHandler Destroyed + { + add + { + RegisterLifecycleEvent(); + _destroyed += value; + } + remove + { + _destroyed -= value; + UnregisterLifecycleEvent(); + } + } + + /// + /// The constructor of the WidgetControl object. + /// + /// 3 + /// Widget ID. + public WidgetControl(string widgetId) + { + Id = widgetId; + } + + /// + /// Finalizer of the WidgetControl class. + /// + ~WidgetControl() + { + Dispose(false); + } + + /// + /// Gets the objects for widget instance information. + /// + /// 3 + /// Thrown in case of failed conditions. + /// Thrown when the API is not supported in this device. + /// Thrown when an application does not have the privilege to access this method. + public IEnumerable GetInstances() + { + IList instances = new List(); + Interop.WidgetService.ErrorCode err = Interop.WidgetService.GetInstances(Id, (widgetId, instanceId, userData) => + { + instances.Add(new Instance(widgetId) { Id = instanceId }); + }, IntPtr.Zero); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.NotSupported: + throw new NotSupportedException(); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + + return instances; + } + + /// + /// Gets the objects for widget scale information. + /// + /// 3 + /// http://tizen.org/privilege/widget.viewer + /// Thrown in case of failed conditions. + /// Thrown when an application does not have the privilege to access this method. + public IEnumerable GetScales() + { + int[] w = new int[100]; + int[] h = new int[100]; + int[] types = new int[100]; + int cnt1 = 100; + int cnt2 = 100; + IList scales = new List(); + + Interop.WidgetService.ErrorCode err = Interop.WidgetService.GetSupportedSizes(Id, ref cnt1, out w, out h); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.IoError: + throw new InvalidOperationException("Failed to access DB"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + + err = Interop.WidgetService.GetSupportedSizeTypes(Id, ref cnt2, out types); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.IoError: + throw new InvalidOperationException("Failed to access DB"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + + if (cnt1 != cnt2) + return null; + + for (int i = 0; i < cnt1; i++) + { + string prev = Interop.WidgetService.GetPreviewImagePath(Id, types[i]); + + scales.Add(new Scale() + { + Width = w[i], + Height = h[i], + PreviewImagePath = prev, + Type = (Scale.SizeType)types[i] + }); + } + return scales; + } + + /// + /// Gets the widget name. + /// + /// 3 + /// Language. + /// http://tizen.org/privilege/widget.viewer + /// Thrown when the argument is null. + public string GetName(string lang) + { + if (lang == null) + throw new ArgumentNullException(); + + return Interop.WidgetService.GetName(Id, lang); + } + + /// + /// Gets the widget icon path. + /// + /// 3 + /// Language. + /// http://tizen.org/privilege/widget.viewer + /// Thrown when the argument is null. + public string GetIconPath(string lang) + { + if (lang == null) + throw new ArgumentNullException(); + + string pkgId = Interop.WidgetService.GetPkgId(Id); + + return Interop.WidgetService.GetIcon(pkgId, lang); + } + + /// + /// Releases all the resources used by the WidgetControl class. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + } + + _created = null; + _resumed = null; + _paused = null; + _destroyed = null; + UnregisterLifecycleEvent(); + + _disposedValue = true; + } + } + + private void RegisterLifecycleEvent() + { + if (!s_lifecycleEventRefCnt.ContainsKey(Id)) + s_lifecycleEventRefCnt[Id] = 0; + + if (_created != null || _paused != null || _resumed != null || _destroyed != null) + return; + + if (s_lifecycleEventRefCnt[Id] == 0) + { + Interop.WidgetService.ErrorCode err = Interop.WidgetService.SetLifecycleEvent(Id, OnLifecycleEvent, IntPtr.Zero); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + } + } + + s_lifecycleEventRefCnt[Id]++; + s_eventObjects.Add(this); + } + + private void UnregisterLifecycleEvent() + { + if (!s_lifecycleEventRefCnt.ContainsKey(Id)) + return; + + if (s_lifecycleEventRefCnt[Id] <= 0) + return; + + if (_created != null || _paused != null || _resumed != null || _destroyed != null) + return; + + if (s_lifecycleEventRefCnt[Id] == 1) + { + Interop.WidgetService.ErrorCode err = Interop.WidgetService.UnsetLifecycleEvent(Id, IntPtr.Zero); + + switch (err) + { + case Interop.WidgetService.ErrorCode.InvalidParameter: + throw new InvalidOperationException("Invalid parameter at unmanaged code"); + + case Interop.WidgetService.ErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(); + + case Interop.WidgetService.ErrorCode.NotExist: + throw new InvalidOperationException("Event handler is not exist"); + } + } + + s_eventObjects.Remove(this); + s_lifecycleEventRefCnt[Id]--; + } + + private static void OnLifecycleEvent(string widgetId, Interop.WidgetService.LifecycleEvent e, string instanceId, IntPtr userData) + { + switch (e) + { + case Interop.WidgetService.LifecycleEvent.Created: + foreach (WidgetControl c in s_eventObjects) + { + if (c.Id.CompareTo(widgetId) == 0) + { + c._created?.Invoke(null, new WidgetLifecycleEventArgs() + { + WidgetId = widgetId, + InstanceId = instanceId, + Type = WidgetLifecycleEventArgs.EventType.Created + }); + } + } + break; + + case Interop.WidgetService.LifecycleEvent.Resumed: + foreach (WidgetControl c in s_eventObjects) + { + if (c.Id.CompareTo(widgetId) == 0) + { + c._resumed?.Invoke(null, new WidgetLifecycleEventArgs() + { + WidgetId = widgetId, + InstanceId = instanceId, + Type = WidgetLifecycleEventArgs.EventType.Resumed + }); + } + } + break; + + case Interop.WidgetService.LifecycleEvent.Paused: + foreach (WidgetControl c in s_eventObjects) + { + if (c.Id.CompareTo(widgetId) == 0) + { + c._paused?.Invoke(null, new WidgetLifecycleEventArgs() + { + WidgetId = widgetId, + InstanceId = instanceId, + Type = WidgetLifecycleEventArgs.EventType.Paused + }); + } + } + break; + + case Interop.WidgetService.LifecycleEvent.Destroyed: + foreach (WidgetControl c in s_eventObjects) + { + if (c.Id.CompareTo(widgetId) == 0) + { + c._destroyed?.Invoke(null, new WidgetLifecycleEventArgs() + { + WidgetId = widgetId, + InstanceId = instanceId, + Type = WidgetLifecycleEventArgs.EventType.Destroyed + }); + } + } + break; + } + + } + } +} diff --git a/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetLifecycleEventArgs.cs b/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetLifecycleEventArgs.cs new file mode 100755 index 0000000..87ffc59 --- /dev/null +++ b/src/Tizen.Applications.WidgetControl/Tizen.Applications/WidgetLifecycleEventArgs.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Applications +{ + /// + /// The class for event arguments of the widget lifecycle. + /// + public class WidgetLifecycleEventArgs : EventArgs + { + internal WidgetLifecycleEventArgs() + { + } + + /// + /// Enumeration for the event type. + /// + public enum EventType + { + /// + /// The widget is created. + /// + Created, + + /// + /// The widget is destroyed. + /// + Destroyed, + + /// + /// The widget is paused. + /// + Paused, + + /// + /// The widget is resumed. + /// + Resumed + } + + /// + /// The widget ID. + /// + public string WidgetId { get; internal set; } + + /// + /// The widget instance ID. + /// + public string InstanceId { get; internal set; } + + /// + /// The event type. + /// + public EventType Type { get; internal set; } + } +} diff --git a/src/Tizen.Content.Download/Interop/Interop.Download.cs b/src/Tizen.Content.Download/Interop/Interop.Download.cs new file mode 100755 index 0000000..839ee63 --- /dev/null +++ b/src/Tizen.Content.Download/Interop/Interop.Download.cs @@ -0,0 +1,110 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; + +internal static partial class Interop +{ + internal static partial class Download + { + // Request class + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(int requestId, int state, IntPtr userData); + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ProgressChangedCallback(int requestId, ulong receivedSize, IntPtr userData); + + [DllImport(Libraries.Download, EntryPoint = "download_create")] + internal static extern int CreateRequest(out int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_destroy")] + internal static extern int DestroyRequest(int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_set_url")] + internal static extern int SetUrl(int requestId, string url); + [DllImport(Libraries.Download, EntryPoint = "download_get_url")] + internal static extern int GetUrl(int requestId, out string url); + [DllImport(Libraries.Download, EntryPoint = "download_set_network_type")] + internal static extern int SetNetworkType(int requestId, int networkType); + [DllImport(Libraries.Download, EntryPoint = "download_get_network_type")] + internal static extern int GetNetworkType(int requestId, out int networkType); + [DllImport(Libraries.Download, EntryPoint = "download_set_destination")] + internal static extern int SetDestination(int requestId, string path); + [DllImport(Libraries.Download, EntryPoint = "download_get_destination")] + internal static extern int GetDestination(int requestId, out string path); + [DllImport(Libraries.Download, EntryPoint = "download_set_file_name")] + internal static extern int SetFileName(int requestId, string fileName); + [DllImport(Libraries.Download, EntryPoint = "download_get_file_name")] + internal static extern int GetFileName(int requestId, out string path); + [DllImport(Libraries.Download, EntryPoint = "download_set_auto_download")] + internal static extern int SetAutoDownload(int requestId, bool value); + [DllImport(Libraries.Download, EntryPoint = "download_get_auto_download")] + internal static extern int GetAutoDownload(int requestId, out bool value); + [DllImport(Libraries.Download, EntryPoint = "download_set_temp_file_path")] + internal static extern int SetTempFilePath(int requestId, string tempPath); + [DllImport(Libraries.Download, EntryPoint = "download_get_temp_path")] + internal static extern int GetTempFilePath(int requestId, out string tempPath); + [DllImport(Libraries.Download, EntryPoint = "download_add_http_header_field")] + internal static extern int AddHttpHeaderField(int requestId, string field, string value); + [DllImport(Libraries.Download, EntryPoint = "download_get_downloaded_file_path")] + internal static extern int GetDownloadedPath(int requestId, out string downloadedPath); + [DllImport(Libraries.Download, EntryPoint = "download_get_mime_type")] + internal static extern int GetMimeType(int requestId, out string mimeType); + [DllImport(Libraries.Download, EntryPoint = "download_get_state")] + internal static extern int GetState(int requestId, out int downloadState); + [DllImport(Libraries.Download, EntryPoint = "download_get_content_name")] + internal static extern int GetContentName(int requestId, out string contentName); + [DllImport(Libraries.Download, EntryPoint = "download_get_content_size")] + internal static extern int GetContentSize(int requestId, out ulong size); + [DllImport(Libraries.Download, EntryPoint = "download_get_http_status")] + internal static extern int GetHttpStatus(int requestId, out int httpStatus); + [DllImport(Libraries.Download, EntryPoint = "download_get_etag")] + internal static extern int GetETag(int requestId, out string etag); + [DllImport(Libraries.Download, EntryPoint = "download_start")] + internal static extern int StartDownload(int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_pause")] + internal static extern int PauseDownload(int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_cancel")] + internal static extern int CancelDownload(int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(int requestId, StateChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Download, EntryPoint = "download_unset_state_changed_cb")] + internal static extern int UnsetStateChangedCallback(int requestId); + [DllImport(Libraries.Download, EntryPoint = "download_set_progress_cb")] + internal static extern int SetProgressCallback(int requestId, ProgressChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Download, EntryPoint = "download_unset_progress_cb")] + internal static extern int UnsetProgressCallback(int requestId); + + // Notification class + + [DllImport(Libraries.Download, EntryPoint = "download_set_notification_title")] + internal static extern int SetNotificationTitle(int requestId, string title); + [DllImport(Libraries.Download, EntryPoint = "download_get_notification_title")] + internal static extern int GetNotificationTitle(int requestId, out string title); + [DllImport(Libraries.Download, EntryPoint = "download_set_notification_description")] + internal static extern int SetNotificationDescription(int requestId, string description); + [DllImport(Libraries.Download, EntryPoint = "download_get_notification_description")] + internal static extern int GetNotificationDescription(int requestId, out string description); + [DllImport(Libraries.Download, EntryPoint = "download_set_notification_type")] + internal static extern int SetNotificationType(int requestId, int type); + [DllImport(Libraries.Download, EntryPoint = "download_get_notification_type")] + internal static extern int GetNotificationType(int requestId, out int type); + [DllImport(Libraries.Download, EntryPoint = "download_set_notification_app_control")] + internal static extern int SetNotificationAppControl(int requestId, int appControlType, SafeAppControlHandle handle); + [DllImport(Libraries.Download, EntryPoint = "download_get_notification_app_control")] + internal static extern int GetNotificationAppControl(int requestId, int appControlType, out SafeAppControlHandle handle); + } +} diff --git a/src/Tizen.Content.Download/Interop/Interop.Libraries.cs b/src/Tizen.Content.Download/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..c634bfd --- /dev/null +++ b/src/Tizen.Content.Download/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Download = "libcapi-web-url-download.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Content.Download/Tizen.Content.Download.csproj b/src/Tizen.Content.Download/Tizen.Content.Download.csproj new file mode 100644 index 0000000..99f4360 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Content.Download/Tizen.Content.Download.sln b/src/Tizen.Content.Download/Tizen.Content.Download.sln new file mode 100755 index 0000000..c935436 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Content.Download", "Tizen.Content.Download.csproj", "{8AE83F8F-ECA3-4BB6-BFB7-449F35B3CA77}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F3849F99-B4B6-4C3C-B1C9-A32BDF5C2F2B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AAEF5DAB-DA71-4E28-A20F-71B8F4E5CAB1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{7B3ABA8E-30F6-4F4D-8DA9-5109DCC54B77}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8AE83F8F-ECA3-4BB6-BFB7-449F35B3CA77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8AE83F8F-ECA3-4BB6-BFB7-449F35B3CA77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8AE83F8F-ECA3-4BB6-BFB7-449F35B3CA77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8AE83F8F-ECA3-4BB6-BFB7-449F35B3CA77}.Release|Any CPU.Build.0 = Release|Any CPU + {F3849F99-B4B6-4C3C-B1C9-A32BDF5C2F2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3849F99-B4B6-4C3C-B1C9-A32BDF5C2F2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3849F99-B4B6-4C3C-B1C9-A32BDF5C2F2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3849F99-B4B6-4C3C-B1C9-A32BDF5C2F2B}.Release|Any CPU.Build.0 = Release|Any CPU + {AAEF5DAB-DA71-4E28-A20F-71B8F4E5CAB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AAEF5DAB-DA71-4E28-A20F-71B8F4E5CAB1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AAEF5DAB-DA71-4E28-A20F-71B8F4E5CAB1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AAEF5DAB-DA71-4E28-A20F-71B8F4E5CAB1}.Release|Any CPU.Build.0 = Release|Any CPU + {7B3ABA8E-30F6-4F4D-8DA9-5109DCC54B77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B3ABA8E-30F6-4F4D-8DA9-5109DCC54B77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B3ABA8E-30F6-4F4D-8DA9-5109DCC54B77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B3ABA8E-30F6-4F4D-8DA9-5109DCC54B77}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/DownloadEnumerator.cs b/src/Tizen.Content.Download/Tizen.Content.Download/DownloadEnumerator.cs new file mode 100755 index 0000000..facfde5 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/DownloadEnumerator.cs @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Content.Download +{ + /// + /// Enumeration for download state. + /// + /// 3 + public enum DownloadState + { + /// + /// Unhandled exception + /// + /// 3 + None = 0, + /// + /// Ready to download + /// + /// 3 + Ready, + /// + /// Queued to start downloading + /// + /// 3 + Queued, + /// + /// Currently downloading + /// + /// 3 + Downloading, + /// + /// Download is paused and can be resumed + /// + /// 3 + Paused, + /// + /// The download is completed + /// + /// 3 + Completed, + /// + /// The download failed + /// + /// 3 + Failed, + /// + /// User canceled the download request + /// + /// 3 + Canceled + } + + /// + /// Enumeration for network type. + /// + /// 3 + public enum NetworkType + { + /// + /// Download is available through data network + /// + /// 3 + DataNetwork = 0, + /// + /// Download is available through WiFi + /// + /// 3 + Wifi, + /// + /// Download is available through WiFi-Direct + /// + /// 3 + WifiDirect, + /// + /// Download is available through either data network or WiFi + /// + /// 3 + All + } + + /// + /// Enumeration for notification type. + /// + /// 3 + public enum NotificationType + { + /// + /// Do not register notification + /// + /// 3 + None = 0, + /// + /// Completion notification for success state and failed state + /// + /// 3 + CompleteOnly, + /// + /// All download notifications for ongoing state, success state and failed state + /// + /// 3 + All + } + + internal enum NotificationAppControlType + { + Downloading = 0, + Completed, + Failed + } + + internal static class Globals + { + internal const string LogTag = "Tizen.Content.Download"; + } +} diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs b/src/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs new file mode 100755 index 0000000..b6fd77f --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/DownloadErrorFactory.cs @@ -0,0 +1,94 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Content.Download +{ + internal enum DownloadError + { + DownloadErrorCommonCode = -0x02A00000, + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + NetworkUnreachable = ErrorCode.NetworkUnreachable, + ConnectionTimedOut = ErrorCode.ConnectionTimeout, + NoSpace = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + InvalidState = DownloadErrorCommonCode | 0x21, + ConnectionFailed = DownloadErrorCommonCode | 0x22, + InvalidUrl = DownloadErrorCommonCode | 0x24, + InvalidDestination = DownloadErrorCommonCode | 0x25, + TooManyDownloads = DownloadErrorCommonCode | 0x26, + QueueFull = DownloadErrorCommonCode | 0x27, + AlreadyCompleted = DownloadErrorCommonCode | 0x28, + FileAlreadyExists = DownloadErrorCommonCode | 0x29, + CannotResume = DownloadErrorCommonCode | 0x2a, + FieldNotFound = DownloadErrorCommonCode | 0x2b, + TooManyRedirects = DownloadErrorCommonCode | 0x30, + UnhandledHttpCode = DownloadErrorCommonCode | 0x31, + RequestTimeout = DownloadErrorCommonCode | 0x32, + ResponseTimeout = DownloadErrorCommonCode | 0x33, + SystemDown = DownloadErrorCommonCode | 0x34, + IdNotFound = DownloadErrorCommonCode | 0x35, + InvalidNetworkType = DownloadErrorCommonCode | 0x36, + NoData = ErrorCode.NoData, + IoError = ErrorCode.IoError + } + + internal static class DownloadErrorFactory + { + internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null) + { + DownloadError err = (DownloadError)errorCode; + if (String.IsNullOrEmpty(errorMessage)) + { + errorMessage = err.ToString(); + } + switch ((DownloadError)errorCode) + { + case DownloadError.InvalidParameter: + case DownloadError.InvalidUrl: + case DownloadError.InvalidDestination: + case DownloadError.InvalidNetworkType: throw new ArgumentException(errorMessage, paramName); + case DownloadError.OutOfMemory: + case DownloadError.NetworkUnreachable: + case DownloadError.ConnectionTimedOut: + case DownloadError.NoSpace: + case DownloadError.InvalidState: + case DownloadError.ConnectionFailed: + case DownloadError.TooManyDownloads: + case DownloadError.QueueFull: + case DownloadError.AlreadyCompleted: + case DownloadError.FileAlreadyExists: + case DownloadError.CannotResume: + case DownloadError.FieldNotFound: + case DownloadError.TooManyRedirects: + case DownloadError.UnhandledHttpCode: + case DownloadError.RequestTimeout: + case DownloadError.ResponseTimeout: + case DownloadError.SystemDown: + case DownloadError.IdNotFound: + case DownloadError.NoData: + case DownloadError.IoError: throw new InvalidOperationException(errorMessage); + case DownloadError.NotSupported: throw new NotSupportedException(errorMessage); + case DownloadError.PermissionDenied: throw new UnauthorizedAccessException(errorMessage); + } + } + } +} diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/Notification.cs b/src/Tizen.Content.Download/Tizen.Content.Download/Notification.cs new file mode 100755 index 0000000..de162a6 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/Notification.cs @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Tizen.Applications; + +namespace Tizen.Content.Download +{ + /// + /// The Notification class consists of all the properties required to set notifications for download operation. + /// + /// 3 + public class Notification + { + private int _downloadId; + + internal Notification(int requestId) + { + _downloadId = requestId; + } + + /// + /// Title of the notification. + /// If user tries to get before setting, empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string Title + { + get + { + string title; + int ret = Interop.Download.GetNotificationTitle(_downloadId, out title); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Notification Title, " + (DownloadError)ret); + return String.Empty; + } + return title; + } + set + { + int ret = Interop.Download.SetNotificationTitle(_downloadId, value.ToString()); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Notification Title"); + } + } + } + + /// + /// Description of the notification. + /// If user tries to get before setting, empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string Description + { + get + { + string description; + int ret = Interop.Download.GetNotificationDescription(_downloadId, out description); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Notification Description, " + (DownloadError)ret); + return String.Empty; + } + return description; + } + set + { + int ret = Interop.Download.SetNotificationDescription(_downloadId, value.ToString()); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Notification Description"); + } + } + } + + /// + /// Type of Notification. + /// If user tries to get before setting, default NotificationType None is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public NotificationType Type + { + get + { + int type; + int ret = Interop.Download.GetNotificationType(_downloadId, out type); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get NotificationType, " + (DownloadError)ret); + return 0; + } + return (NotificationType)type; + } + set + { + int ret = Interop.Download.SetNotificationType(_downloadId, (int)value); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set NotificationType"); + } + } + } + + /// + /// AppControl for an ongoing download notification. + /// If user tries to get before setting, null is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// When the notification message is clicked, the action is decided by the app control. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public AppControl AppControlOngoing + { + get + { + SafeAppControlHandle handle; + int ret = Interop.Download.GetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Downloading, out handle); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Ongoing type NotificationAppControl, " + (DownloadError)ret); + return null; + } + return new AppControl(handle); + } + set + { + int ret = Interop.Download.SetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Downloading, value.SafeAppControlHandle); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Ongoing type NotificationAppControl"); + } + } + } + + /// + /// AppControl for a completed download notification. + /// If user tries to get before setting, null is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// When the notification message is clicked, the action is decided by the app control + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public AppControl AppControlCompleted + { + get + { + SafeAppControlHandle handle; + int ret = Interop.Download.GetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Completed, out handle); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Complete type NotificationAppControl, " + (DownloadError)ret); + return null; + } + return new AppControl(handle); + } + set + { + int ret = Interop.Download.SetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Completed, value.SafeAppControlHandle); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Complete type NotificationAppControl"); + } + } + } + + /// + /// AppControl for a failed download notification. + /// If user tries to get before setting, null is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// When the notification message is clicked, the action is decided by the app control + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public AppControl AppControlFailed + { + get + { + SafeAppControlHandle handle; + int ret = Interop.Download.GetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Failed, out handle); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Fail type NotificationAppControl, " + (DownloadError)ret); + return null; + } + return new AppControl(handle); + } + set + { + int ret = Interop.Download.SetNotificationAppControl(_downloadId, (int)NotificationAppControlType.Failed, value.SafeAppControlHandle); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Fail type NotificationAppControl"); + } + } + } + } +} + diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/ProgressChangedEventArgs.cs b/src/Tizen.Content.Download/Tizen.Content.Download/ProgressChangedEventArgs.cs new file mode 100755 index 0000000..3e5d169 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/ProgressChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Content.Download +{ + /// + /// An extended EventArgs class which contains the size of received data in bytes. + /// + /// 3 + public class ProgressChangedEventArgs : EventArgs + { + private ulong _size = 0; + + internal ProgressChangedEventArgs(ulong size) + { + _size = size; + } + + /// + /// Received data size in bytes. + /// + /// 3 + public ulong ReceivedDataSize + { + get + { + return _size; + } + } + } +} diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/Request.cs b/src/Tizen.Content.Download/Tizen.Content.Download/Request.cs new file mode 100755 index 0000000..20e2048 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/Request.cs @@ -0,0 +1,858 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Content.Download +{ + /// + /// The Request class provides functions to create and manage a single download request. + /// + /// 3 + public class Request : IDisposable + { + private int _downloadId; + private Notification _notificationProperties; + private IDictionary _httpHeaders; + private EventHandler _downloadStateChanged; + private Interop.Download.StateChangedCallback _downloadStateChangedCallback; + private EventHandler _downloadProgressChanged; + private Interop.Download.ProgressChangedCallback _downloadProgressChangedCallback; + private bool _disposed = false; + + /// + /// Creates a Request object. + /// + /// 3 + /// URL to download + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public Request(string url) + { + if (String.IsNullOrEmpty(url)) + { + DownloadErrorFactory.ThrowException((int)DownloadError.InvalidParameter, "url cannot be null or empty"); + } + int ret = Interop.Download.CreateRequest(out _downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Request creation failed"); + } + ret = Interop.Download.SetUrl(_downloadId, url); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting Url failed"); + } + _notificationProperties = new Notification(_downloadId); + _httpHeaders = new Dictionary(); + } + + /// + /// Creates a Request object. + /// + /// 3 + /// URL to download + /// Directory path where downloaded file is stored + /// Name of the downloaded file + /// Network type which the download request must adhere to + /// http://tizen.org/privilege/download + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.wifi.direct + /// http://tizen.org/feature/network.telephony + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when feature is not supported. + public Request(string url, string destinationPath, string fileName, NetworkType type) + { + if (String.IsNullOrEmpty(url)) + { + DownloadErrorFactory.ThrowException((int)DownloadError.InvalidParameter, "url cannot be null or empty"); + } + int ret = Interop.Download.CreateRequest(out _downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Request creation failed"); + } + + ret = Interop.Download.SetUrl(_downloadId, url); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting Url failed"); + } + + ret = Interop.Download.SetDestination(_downloadId, destinationPath); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting DestinationPath failed"); + } + + ret = Interop.Download.SetFileName(_downloadId, fileName); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting FileName failed"); + } + + ret = Interop.Download.SetNetworkType(_downloadId, (int)type); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting NetworkType failed"); + } + + _notificationProperties = new Notification(_downloadId); + _httpHeaders = new Dictionary(); + } + + /// + /// Creates a Request object. + /// + /// 3 + /// URL to download + /// Directory path where downloaded file is stored + /// Name of the downloaded file + /// Network type which the download request must adhere to + /// HTTP header fields for download request + /// http://tizen.org/privilege/download + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.wifi.direct + /// http://tizen.org/feature/network.telephony + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when features is not supported. + public Request(string url, string destinationPath, string fileName, NetworkType type, IDictionary httpHeaders) + { + if (String.IsNullOrEmpty(url)) + { + DownloadErrorFactory.ThrowException((int)DownloadError.InvalidParameter, "url cannot be null or empty"); + } + int ret = Interop.Download.CreateRequest(out _downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Request creation failed"); + } + + ret = Interop.Download.SetUrl(_downloadId, url); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting Url failed"); + } + + ret = Interop.Download.SetDestination(_downloadId, destinationPath); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting DestinationPath failed"); + } + + ret = Interop.Download.SetFileName(_downloadId, fileName); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting FileName failed"); + } + + ret = Interop.Download.SetNetworkType(_downloadId, (int)type); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting NetworkType failed"); + } + + _notificationProperties = new Notification(_downloadId); + _httpHeaders = httpHeaders; + } + + ~Request() + { + Dispose(false); + } + + /// + /// Event that occurs when the download state changes. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public event EventHandler StateChanged + { + add + { + if (_downloadStateChanged == null) + { + RegisterStateChangedEvent(); + } + _downloadStateChanged += value; + } + remove + { + _downloadStateChanged -= value; + if (_downloadStateChanged == null) + { + UnregisterStateChangedEvent(); + } + } + } + + /// + /// Event that occurs when the download progress changes. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public event EventHandler ProgressChanged + { + add + { + if (_downloadProgressChanged == null) + { + RegisterProgressChangedEvent(); + } + _downloadProgressChanged += value; + } + remove + { + _downloadProgressChanged -= value; + if (_downloadProgressChanged == null) + { + UnregisterProgressChangedEvent(); + } + } + } + + /// + /// Absolute path where the file will be downloaded. + /// If you try to get this property value before calling Start(), an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// Returns empty string if download is not completed or if state has not yet changed to Completed or if any other error occurs. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string DownloadedPath + { + get + { + string path; + int ret = Interop.Download.GetDownloadedPath(_downloadId, out path); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get DownloadedPath, " + (DownloadError)ret); + return String.Empty; + } + return path; + } + } + + /// + /// MIME type of the downloaded content. + /// If you try to get this property value before calling Start(), an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string MimeType + { + get + { + string mime; + int ret = Interop.Download.GetMimeType(_downloadId, out mime); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get MimeType, " + (DownloadError)ret); + return String.Empty; + } + return mime; + } + } + + /// + /// Current state of the download. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public DownloadState State + { + get + { + int state; + int ret = Interop.Download.GetState(_downloadId, out state); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get DownloadState, " + (DownloadError)ret); + return DownloadState.None; + } + return (DownloadState)state; + } + } + + /// + /// The content name of the downloaded file. + /// This can be defined with reference of HTTP response header data. The content name can be received when HTTP response header is received. + /// If you try to get this property value before calling Start(), an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string ContentName + { + get + { + string name; + int ret = Interop.Download.GetContentName(_downloadId, out name); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get ContentName, " + (DownloadError)ret); + return String.Empty; + } + return name; + } + } + + /// + /// Total size of downloaded content. + /// This information is received from the server. If the server does not send the total size of the content, the content size is set to zero. + /// If you try to get this property value before calling Start(), 0 is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public ulong ContentSize + { + get + { + ulong size; + int ret = Interop.Download.GetContentSize(_downloadId, out size); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get ContentSize, " + (DownloadError)ret); + return 0; + } + return size; + } + } + + /// + /// HTTP status code when a download exception occurs. + /// If you try to get this property value before calling Start(), 0 is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// State of download request must be DownlodState.Failed. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public int HttpStatus + { + get + { + int status; + int ret = Interop.Download.GetHttpStatus(_downloadId, out status); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get HttpStatus, " + (DownloadError)ret); + return 0; + } + return status; + } + } + + /// + /// ETag value from the HTTP response header when making a HTTP request for resume. + /// If you try to get this property value before calling Start() or if any other error occurs, an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The etag value is available or not depending on the web server. If not available, then on get of the property null is returned. + /// After download is started, it can get the etag value. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string ETagValue + { + get + { + string etag; + int ret = Interop.Download.GetETag(_downloadId, out etag); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get ETagValue, " + (DownloadError)ret); + return String.Empty; + } + return etag; + } + } + + /// + /// Contains properties required for creating download notifications. + /// + /// 3 + /// + /// When the notification message is clicked, the action taken by the system is decided by the app control properties of the NotificationProperties instance. + /// If the app control is not set, the following default operation is executed when the notification message is clicked: + /// 1) download completed state - the viewer application is executed according to extension name of downloaded content, + /// 2) download failed state and ongoing state - the client application is executed. + /// This property should be set before calling Start(). + /// + public Notification NotificationProperties + { + get + { + return _notificationProperties; + } + } + + /// + /// Full path of the temporary file which stores downloaded content. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The download state must be one of the states after Downloading. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string TemporaryPath + { + get + { + string path; + int ret = Interop.Download.GetTempFilePath(_downloadId, out path); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get TemporaryPath, " + (DownloadError)ret); + return String.Empty; + } + return path; + } + } + + /// + /// URL to download. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// Should be set before calling Start(). + /// If you try to get this property value before setting or if any other error occurs, an empty string is returned. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string Url + { + get + { + string url; + int ret = Interop.Download.GetUrl(_downloadId, out url); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get Url, " + (DownloadError)ret); + return String.Empty; + } + return url; + } + set + { + int ret = Interop.Download.SetUrl(_downloadId, value); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set Url"); + } + } + } + + /// + /// Allowed network type for downloading the file. + /// The file will be downloaded only under the allowed network. + /// If you try to get this property value before setting or if any other error occurs, default value NetworkType All is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.wifi.direct + /// http://tizen.org/feature/network.telephony + /// + /// Should be set before calling Start(). + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + /// Thrown when feature is not supported. + public NetworkType AllowedNetworkType + { + get + { + int type; + int ret = Interop.Download.GetNetworkType(_downloadId, out type); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get AllowedNetworkType, " + (DownloadError)ret); + return NetworkType.All; + } + return (NetworkType)type; + } + set + { + int ret = Interop.Download.SetNetworkType(_downloadId, (int)value); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set AllowedNetworkType"); + } + } + } + + /// + /// The file will be downloaded to the set destination file path. The downloaded file is saved to an auto-generated file name in the destination. If the destination is not specified, the file will be downloaded to default storage. + /// If you try to get this property value before setting or if any other error occurs, an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// Should be set before calling Start(). + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string DestinationPath + { + get + { + string path; + int ret = Interop.Download.GetDestination(_downloadId, out path); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get DestinationPath, " + (DownloadError)ret); + return String.Empty; + } + return path; + } + set + { + int ret = Interop.Download.SetDestination(_downloadId, value.ToString()); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set DestinationPath"); + } + } + } + + /// + /// The file will be saved in the specified destination or default storage with the set file name. If the file name is not specified, the downloaded file will be saved with an auto-generated file name in the destination. + /// If you try to get this property value before setting or if any other error occurs, an empty string is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// Should be set before calling Start(). + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public string FileName + { + get + { + string name; + int ret = Interop.Download.GetFileName(_downloadId, out name); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get FileName, " + (DownloadError)ret); + return String.Empty; + } + return name; + } + set + { + int ret = Interop.Download.SetFileName(_downloadId, value.ToString()); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set FileName"); + } + } + } + + /// + /// Enables or disables auto download. + /// If this option is enabled, the previous downloading item is restarted automatically as soon as the download daemon is restarted. The download progress continues after the client process is terminated. + /// If you try to get this property value before setting, default value false is returned. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The default value is false. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public bool AutoDownload + { + get + { + bool value; + int ret = Interop.Download.GetAutoDownload(_downloadId, out value); + if (ret != (int)DownloadError.None) + { + Log.Error(Globals.LogTag, "Failed to get AutoDownload, " + (DownloadError)ret); + return false; + } + return value; + } + set + { + int ret = Interop.Download.SetAutoDownload(_downloadId, value); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set AutoDownload"); + } + } + } + + /// + /// HTTP header field and value pairs to the download request. + /// HTTP header <field,value> pair is the <key,value> pair in the Dictionary HttpHeaders + /// The given HTTP header field will be included with the HTTP request of the download request. + /// If you try to get this property value before setting, an empty dictionary is returned. + /// + /// 3 + /// + /// HTTP header fields should be set before calling Start(). + /// HTTP header fields can be removed before calling Start(). + /// + public IDictionary HttpHeaders + { + get + { + return _httpHeaders; + } + } + + /// + /// Sets the directory path of a temporary file used in a previous download request. + /// This is only useful when resuming download to make HTTP request header at the client side. Otherwise, the path is ignored. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// If the etag value is not present in the download database, it is not useful to set the temporary file path. + /// When resuming the download request, the data is attached at the end of this temporary file. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public void SetTemporaryFilePath(string path) + { + int ret = Interop.Download.SetTempFilePath(_downloadId, path); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set TemporaryFilePath"); + } + } + + /// + /// Starts or resumes download. + /// Starts to download the current URL, or resumes the download if paused. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The URL is the mandatory information to start the download. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public void Start() + { + int ret = (int)DownloadError.None; + foreach (KeyValuePair entry in _httpHeaders) + { + ret = Interop.Download.AddHttpHeaderField(_downloadId, entry.Key, entry.Value); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to set HttpHeaders"); + } + } + + ret = Interop.Download.StartDownload(_downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to start download request"); + } + } + + /// + /// Pauses download request. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The paused download request can be restarted with Start() or canceled with Cancel(). + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public void Pause() + { + int ret = Interop.Download.PauseDownload(_downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to pause download request"); + } + } + + /// + /// Cancels download request. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// The canceled download can be restarted with Start(). + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public void Cancel() + { + int ret = Interop.Download.CancelDownload(_downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Failed to cancel download request"); + } + } + + /// + /// Releases all resources used by the Request class. + /// + /// 3 + /// http://tizen.org/privilege/download + /// + /// After calling this method, download request related data exists in the download database for a certain period of time. Within that time, it is possible to use other APIs with this data. + /// + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Deletes the corresponding download request. + /// + /// 3 + /// http://tizen.org/privilege/download + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation + /// Thrown when permission is denied. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects. + } + Interop.Download.DestroyRequest(_downloadId); + _disposed = true; + } + + static private void IntPtrToStringArray(IntPtr unmanagedArray, int size, out string[] managedArray) + { + managedArray = new string[size]; + IntPtr[] IntPtrArray = new IntPtr[size]; + + Marshal.Copy(unmanagedArray, IntPtrArray, 0, size); + + for (int iterator = 0; iterator < size; iterator++) + { + managedArray[iterator] = Marshal.PtrToStringAnsi(IntPtrArray[iterator]); + } + } + + private void RegisterStateChangedEvent() + { + _downloadStateChangedCallback = (int downloadId, int downloadState, IntPtr userData) => + { + StateChangedEventArgs eventArgs = new StateChangedEventArgs((DownloadState)downloadState); + _downloadStateChanged?.Invoke(this, eventArgs); + }; + + int ret = Interop.Download.SetStateChangedCallback(_downloadId, _downloadStateChangedCallback, IntPtr.Zero); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting StateChanged callback failed"); + } + } + + private void UnregisterStateChangedEvent() + { + int ret = Interop.Download.UnsetStateChangedCallback(_downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Unsetting StateChanged callback failed"); + } + } + + private void RegisterProgressChangedEvent() + { + _downloadProgressChangedCallback = (int downloadId, ulong size, IntPtr userData) => + { + ProgressChangedEventArgs eventArgs = new ProgressChangedEventArgs(size); + _downloadProgressChanged?.Invoke(this, eventArgs); + }; + + int ret = Interop.Download.SetProgressCallback(_downloadId, _downloadProgressChangedCallback, IntPtr.Zero); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Setting ProgressChanged callback failed"); + } + } + + private void UnregisterProgressChangedEvent() + { + int ret = Interop.Download.UnsetProgressCallback(_downloadId); + if (ret != (int)DownloadError.None) + { + DownloadErrorFactory.ThrowException(ret, "Unsetting ProgressChanged callback failed"); + } + } + } +} + diff --git a/src/Tizen.Content.Download/Tizen.Content.Download/StateChangedEventArgs.cs b/src/Tizen.Content.Download/Tizen.Content.Download/StateChangedEventArgs.cs new file mode 100755 index 0000000..e4c56e8 --- /dev/null +++ b/src/Tizen.Content.Download/Tizen.Content.Download/StateChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Content.Download +{ + /// + /// An extended EventArgs class which contains the changed download state. + /// + /// 3 + public class StateChangedEventArgs : EventArgs + { + private DownloadState _state; + + internal StateChangedEventArgs(DownloadState downloadState) + { + _state = downloadState; + } + + /// + /// Present download state. + /// + /// 3 + public DownloadState State + { + get + { + return _state; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.AudioInformation.cs b/src/Tizen.Content.MediaContent/Interop/Interop.AudioInformation.cs new file mode 100755 index 0000000..ccdf20c --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.AudioInformation.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class AudioInformation + { + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Destroy(IntPtr media); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_clone", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Clone(out SafeAudioInformationHandle dst, SafeAudioInformationHandle src); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaId(SafeAudioInformationHandle audioInformationHandle, out IntPtr mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAlbum(SafeAudioInformationHandle audioInformationHandle, out IntPtr albumName); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_artist", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetArtist(SafeAudioInformationHandle audioInformationHandle, out IntPtr artistName); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAlbumArtist(SafeAudioInformationHandle audioInformationHandle, out IntPtr albumArtistName); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_genre", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetGenre(SafeAudioInformationHandle audioInformationHandle, out IntPtr genreName); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_composer", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetComposer(SafeAudioInformationHandle audioInformationHandle, out IntPtr composerName); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_year", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetYear(SafeAudioInformationHandle audioInformationHandle, out IntPtr year); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetRecordedDate(SafeAudioInformationHandle audioInformationHandle, out IntPtr recordedDate); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetCopyright(SafeAudioInformationHandle audioInformationHandle, out IntPtr copyright); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetTrackNum(SafeAudioInformationHandle audioInformationHandle, out IntPtr trackNum); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetBitRate(SafeAudioInformationHandle audioInformationHandle, out int bitRate); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_bitpersample", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetBitPerSample(SafeAudioInformationHandle audioInformationHandle, out int bitPerSample); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_sample_rate", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetSampleRate(SafeAudioInformationHandle audioInformationHandle, out int sampleRate); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_channel", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetChannel(SafeAudioInformationHandle audioInformationHandle, out int channel); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_duration", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetDuration(SafeAudioInformationHandle audioInformationHandle, out int duration); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedCount(SafeAudioInformationHandle audioInformationHandle, out int playedCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedTime(SafeAudioInformationHandle audioInformationHandle, out int playedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_get_played_position", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedPosition(SafeAudioInformationHandle audioInformationHandle, out int playedPosition); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedCount(SafeAudioInformationHandle audioInformationHandle, int playedCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedTime(SafeAudioInformationHandle audioInformationHandle, int playedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_set_played_position", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedPosition(SafeAudioInformationHandle audioInformationHandle, int playedPosition); + + [DllImport(Libraries.MediaContent, EntryPoint = "audio_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError UpdateToDB(IntPtr audioInformationHandle); + + internal sealed class SafeAudioInformationHandle : SafeHandle + { + public SafeAudioInformationHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + AudioInformation.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.Glib.cs b/src/Tizen.Content.MediaContent/Interop/Interop.Glib.cs new file mode 100755 index 0000000..81afefd --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.Glib.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.ImageInformation.cs b/src/Tizen.Content.MediaContent/Interop/Interop.ImageInformation.cs new file mode 100755 index 0000000..cbcfffb --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.ImageInformation.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class ImageInformation + { + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Destroy(IntPtr media); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_clone", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Clone(out SafeImageInformationHandle dst, SafeImageInformationHandle src); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_orientation", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetOrientation(SafeImageInformationHandle imageInformationHandle, out MediaContentOrientation orientation); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_date_taken", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetDateTaken(SafeImageInformationHandle imageInformationHandle, out IntPtr dateTaken); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_burst_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetBurstId(SafeImageInformationHandle imageInformationHandle, out IntPtr burstId); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_exposure_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetExposureTime(SafeImageInformationHandle imageInformationHandle, out IntPtr exposureTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_fnumber", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetFNumber(SafeImageInformationHandle imageInformationHandle, out double fNumber); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_iso", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetISO(SafeImageInformationHandle imageInformationHandle, out int iso); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetModel(SafeImageInformationHandle imageInformationHandle, out IntPtr model); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_is_burst_shot", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError IsBurstShot(SafeImageInformationHandle imageInformationHandle, out bool isBurstShot); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_set_orientation", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetOrientation(SafeImageInformationHandle imageInformationHandle, MediaContentOrientation orientation); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaId(SafeImageInformationHandle imageInformationHandle, out IntPtr mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetWidth(SafeImageInformationHandle imageInformationHandle, out int width); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_height", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetHeight(SafeImageInformationHandle imageInformationHandle, out int width); + + [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError UpdateToDB(IntPtr imageInformationHandle); + + internal sealed class SafeImageInformationHandle : SafeHandle + { + public SafeImageInformationHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + ImageInformation.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.Libc.cs b/src/Tizen.Content.MediaContent/Interop/Interop.Libc.cs new file mode 100755 index 0000000..c9e7ff8 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.Libc.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs b/src/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..a2d161e --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.Libraries.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MediaContent = "libcapi-content-media-content.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs new file mode 100755 index 0000000..6639fbb --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaBookmark.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal partial class Interop +{ + internal static partial class MediaBookmark + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_insert_to_db")] + internal static extern MediaContentError InsertToDb(string media_id, uint time, string thumbnail_path); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_delete_from_db")] + internal static extern MediaContentError DeleteFromDb(int bookmark_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_bookmark_count_from_db")] + internal static extern MediaContentError GetBookmarkCountFromDb(IntPtr filter, out int bookmark_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_destroy")] + internal static extern MediaContentError Destroy(IntPtr bookmark); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_bookmark_id")] + internal static extern MediaContentError GetBookmarkId(IntPtr bookmark, out int bookmark_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_marked_time")] + internal static extern MediaContentError GetMarkedTime(IntPtr bookmark, out uint marked_time); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_bookmark_get_thumbnail_path")] + internal static extern MediaContentError GetThumbnailPath(IntPtr bookmark, out IntPtr filePath); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaContent.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaContent.cs new file mode 100755 index 0000000..02205f1 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaContent.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + + +internal static partial class Interop +{ + internal static partial class Content + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_connect")] + internal static extern MediaContentError Connect(); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_disconnect")] + internal static extern MediaContentError Disconnect(); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_scan_file")] + internal static extern MediaContentError ScanFile(string filePath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_cancel_scan_folder")] + internal static extern MediaContentError CancelScanFolder(string folderPath); + + // Callback + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaScanCompletedCallback(MediaContentError error, IntPtr data); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaContentDBUpdatedCallback(MediaContentError error, int pid, MediaContentUpdateItemType updateItem, MediaContentDBUpdateType updateType, MediaContentType mediaType, string uuid, string filePath, string mimeType, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_scan_folder")] + internal static extern MediaContentError ScanFolder(string folderPath, bool is_recursive, MediaScanCompletedCallback scanCompletedCallback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_add_db_updated_cb")] + internal static extern MediaContentError AddDbUpdatedCb(MediaContentDBUpdatedCallback mediaContentDBUpdatedCallback, IntPtr userData, out IntPtr noti_handle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_content_remove_db_updated_cb")] + internal static extern MediaContentError RemoveDbUpdatedCb(IntPtr noti_handle); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs new file mode 100755 index 0000000..ce88a2c --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFace.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Face + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_destroy")] + internal static extern MediaContentError Destroy(IntPtr face); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_face_id")] + internal static extern MediaContentError GetFaceId(IntPtr face, out IntPtr face_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_media_id")] + internal static extern MediaContentError GetMediaId(IntPtr face, out IntPtr media_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_face_rect")] + internal static extern MediaContentError GetFaceRect(IntPtr face, out int rect_x, out int rect_y, out int rect_w, out int IntPtr); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_orientation")] + internal static extern MediaContentError GetOrientation(IntPtr face, out int orientation); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_get_tag")] + internal static extern MediaContentError GetTag(IntPtr face, out IntPtr tag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_create")] + internal static extern MediaContentError Create(string media_id, out IntPtr face); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_face_rect")] + internal static extern MediaContentError SetFaceRect(IntPtr face, int rect_x, int rect_y, int rect_w, int IntPtr); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_orientation")] + internal static extern MediaContentError SetOrientation(IntPtr face, int orientation); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_set_tag")] + internal static extern MediaContentError SetTag(IntPtr face, string tag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_insert_to_db")] + internal static extern MediaContentError InsertToDb(IntPtr face); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_update_to_db")] + internal static extern MediaContentError UpdateToDb(IntPtr face); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_face_delete_from_db")] + internal static extern MediaContentError DeleteFromDb(string face_id); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs new file mode 100755 index 0000000..f66986b --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFilter.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Filter + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_create")] + internal static extern MediaContentError Create(out IntPtr filter); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_destroy")] + internal static extern MediaContentError Destroy(IntPtr filter); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_offset")] + internal static extern MediaContentError SetOffset(IntPtr filter, int offset, int count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_condition")] + internal static extern MediaContentError SetCondition(IntPtr filter, string condition, ContentCollation type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_order")] + internal static extern MediaContentError SetOrder(IntPtr filter, ContentOrder order, string keyword, ContentCollation type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_set_storage")] + internal static extern MediaContentError SetStorage(IntPtr filter, string storageId); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_offset")] + internal static extern MediaContentError GetOffset(IntPtr filter, out int offset, out int count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_condition")] + internal static extern MediaContentError GetCondition(IntPtr filter, out IntPtr condition, out ContentCollation type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_order")] + internal static extern MediaContentError GetOrder(IntPtr filter, out ContentOrder order, out IntPtr keyword, out ContentCollation type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_filter_get_storage")] + internal static extern MediaContentError GetStorage(IntPtr filter, out IntPtr storageId); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaFolder.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFolder.cs new file mode 100755 index 0000000..8ba231d --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaFolder.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Folder + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_count_from_db")] + internal static extern MediaContentError GetFolderCountFromDb(IntPtr filter, out int folder_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_media_count_from_db")] + internal static extern MediaContentError GetMediaCountFromDb(string folder_id, IntPtr filter, out int media_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_destroy")] + internal static extern MediaContentError Destroy(IntPtr folder); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_id")] + internal static extern MediaContentError GetFolderId(IntPtr folder, out IntPtr folder_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_parent_folder_id")] + internal static extern MediaContentError GetParentFolderId(IntPtr folder, out IntPtr parent_folder_id); + + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_path")] + internal static extern MediaContentError GetPath(IntPtr folder, out IntPtr folderPath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_name")] + internal static extern MediaContentError GetName(IntPtr folder, out IntPtr folder_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_modified_time")] + internal static extern MediaContentError GetModifiedTime(IntPtr folder, out DateTime date); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_type")] + internal static extern MediaContentError GetStorageType(IntPtr folder, out ContentStorageType storage_type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_id")] + internal static extern MediaContentError GetStorageId(IntPtr folder, out IntPtr storage_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_order")] + internal static extern MediaContentError GetOrder(IntPtr folder, out int order); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_from_db")] + internal static extern MediaContentError GetFolderFromDb(string folder_id, out IntPtr folder); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_set_name")] + internal static extern MediaContentError SetName(IntPtr folder, string name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_set_order")] + internal static extern MediaContentError SetOrder(IntPtr folder, int order); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_update_to_db")] + internal static extern MediaContentError UpdateToDb(IntPtr folder); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaFolderCallback(IntPtr folderHandle, IntPtr data); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaInfoCallback(IntPtr handle, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_foreach_folder_from_db")] + internal static extern MediaContentError ForeachFolderFromDb(IntPtr filter, MediaFolderCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_foreach_media_from_db")] + internal static extern MediaContentError ForeachMediaFromDb(string folder_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaGroup.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaGroup.cs new file mode 100755 index 0000000..c879bcc --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaGroup.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Group + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_count_from_db")] + internal static extern MediaContentError MediaAlbumGetAlbumCountFromDb(IntPtr filter, out int album_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_media_count_from_db")] + internal static extern MediaContentError MediaAlbumGetMediaCountFromDb(int album_id, IntPtr filter, out int media_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_destroy")] + internal static extern MediaContentError MediaAlbumDestroy(IntPtr album); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_clone")] + internal static extern MediaContentError MediaAlbumClone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_id")] + internal static extern MediaContentError MediaAlbumGetAlbumId(IntPtr album, out int album_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_name")] + internal static extern MediaContentError MediaAlbumGetName(IntPtr album, out IntPtr album_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_artist")] + internal static extern MediaContentError MediaAlbumGetArtist(IntPtr album, out IntPtr artist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_art")] + internal static extern MediaContentError MediaAlbumGetAlbumArt(IntPtr album, out IntPtr album_art); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_from_db")] + internal static extern MediaContentError MediaAlbumGetAlbumFromDb(int album_id, out IntPtr album); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_group_count_from_db")] + internal static extern MediaContentError GetGroupCountFromDb(IntPtr filter, MediaGroupType group, out int group_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_group_get_media_count_from_db")] + internal static extern MediaContentError GetMediaCountFromDb(string group_name, MediaGroupType group, IntPtr filter, out int media_count); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaGroupCallback(string groupName, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaAlbumCallback(IntPtr albumHandle, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_album_from_db")] + internal static extern MediaContentError MediaAlbumForeachAlbumFromDb(IntPtr filter, MediaAlbumCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_album_foreach_media_from_db")] + internal static extern MediaContentError MediaAlbumForeachMediaFromDb(int albumId, IntPtr filter, MediaInfoCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_group_from_db")] + internal static extern MediaContentError ForeachGroupFromDb(IntPtr filter, MediaGroupType group, MediaGroupCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_group_foreach_media_from_db")] + internal static extern MediaContentError ForeachMediaFromDb(string groupName, MediaGroupType group, IntPtr filter, MediaInfoCallback callback, IntPtr user_data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs new file mode 100755 index 0000000..5d994fc --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaInformation.cs @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class MediaInformation + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaThumbnailCompletedCallback(MediaContentError error, string filePath, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaTagCallback(IntPtr tagHandle, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaBookmarkCallback(IntPtr bookmarkHandle, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaFaceCallback(IntPtr bookmarkHandle, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaInsertCompletedCallback(MediaContentError error, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaInsertBurstShotCompletedCallback(MediaContentError error, IntPtr UserData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaInformationCallback(IntPtr mediaInformationHandle, IntPtr UserData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Insert(string filePath, out SafeMediaInformationHandle info); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_batch_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError BatchInsert(string[] filePathArray, int arrayLength, MediaInsertCompletedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_insert_burst_shot_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError BurstShotInsert(string[] filePathArray, int arrayLength, MediaInsertBurstShotCompletedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Delete(string mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_delete_batch_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError BatchDelete(IntPtr filter); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Destroy(IntPtr mediaInformationHandle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_clone", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Clone(out SafeMediaInformationHandle dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaCount(IntPtr filter, out int mediaCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_media_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAllMedia(IntPtr filter, MediaInformationCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_tag_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetTagCount(string mediaId, IntPtr filter, out int tagCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_tag_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAllTags(string mediaId, IntPtr filter, MediaTagCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_bookmark_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetBookmarkCount(string mediaId, IntPtr filter, out int bookmarkCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_bookmark_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAllBookmarks(string mediaId, IntPtr filter, MediaBookmarkCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_face_count_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetFaceCount(string mediaId, IntPtr filter, out int bookmarkCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_foreach_face_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAllFaces(string mediaId, IntPtr filter, MediaFaceCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_image", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetImage(IntPtr mediaInformationHandle, out Interop.ImageInformation.SafeImageInformationHandle image); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_video", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetVideo(IntPtr mediaInformationHandle, out Interop.VideoInformation.SafeVideoInformationHandle video); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_audio", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAudio(IntPtr mediaInformationHandle, out Interop.AudioInformation.SafeAudioInformationHandle audio); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaId(SafeMediaInformationHandle mediaInformationHandle, out IntPtr mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_file_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetFilePath(SafeMediaInformationHandle mediaInformationHandle, out IntPtr filePath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetDisplayName(SafeMediaInformationHandle mediaInformationHandle, out IntPtr name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaType(SafeMediaInformationHandle mediaInformationHandle, out MediaContentType type); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_mime_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMimeType(SafeMediaInformationHandle mediaInformationHandle, out IntPtr mimeType); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_size", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetSize(SafeMediaInformationHandle mediaInformationHandle, out long size); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_added_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAddedTime(SafeMediaInformationHandle mediaInformationHandle, out int addedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_modified_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetModifiedTime(SafeMediaInformationHandle mediaInformationHandle, out int time); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_timeline", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetTimeline(SafeMediaInformationHandle mediaInformationHandle, out int time); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_thumbnail_path", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetThumbnailPath(SafeMediaInformationHandle mediaInformationHandle, out IntPtr filePath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_description", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetDescription(SafeMediaInformationHandle mediaInformationHandle, out IntPtr description); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_longitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetLongitude(SafeMediaInformationHandle mediaInformationHandle, out double longitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_latitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetLatitude(SafeMediaInformationHandle mediaInformationHandle, out double latitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_altitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAltitude(SafeMediaInformationHandle mediaInformationHandle, out double altitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_weather", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetWeather(SafeMediaInformationHandle mediaInformationHandle, out IntPtr weather); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_rating", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetRating(SafeMediaInformationHandle mediaInformationHandle, out int rating); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_favorite", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetFavorite(SafeMediaInformationHandle mediaInformationHandle, out bool favorite); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_author", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAuthor(SafeMediaInformationHandle mediaInformationHandle, out IntPtr author); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_provider", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetProvider(SafeMediaInformationHandle mediaInformationHandle, out IntPtr provider); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_content_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetContentName(SafeMediaInformationHandle mediaInformationHandle, out IntPtr contentName); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_title", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetTitle(SafeMediaInformationHandle mediaInformationHandle, out IntPtr title); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_category", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetCategory(SafeMediaInformationHandle mediaInformationHandle, out IntPtr category); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_location_tag", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetLocationTag(SafeMediaInformationHandle mediaInformationHandle, out IntPtr locationTag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_age_rating", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAgeRating(SafeMediaInformationHandle mediaInformationHandle, out IntPtr ageRating); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_keyword", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetKeyword(SafeMediaInformationHandle mediaInformationHandle, out IntPtr keyword); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetStorageId(SafeMediaInformationHandle mediaInformationHandle, out IntPtr storageId); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_is_drm", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError IsDrm(SafeMediaInformationHandle mediaInformationHandle, out bool isDrm); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetStorageType(SafeMediaInformationHandle mediaInformationHandle, out ContentStorageType storageType); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedCount(SafeMediaInformationHandle mediaInformationHandle, out int playedCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedAt(SafeMediaInformationHandle mediaInformationHandle, out int playedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaFromDB(string mediaId, out SafeMediaInformationHandle mediaInformationHandle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_increase_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError IncreasePlayedCount(SafeMediaInformationHandle mediaInformationHandle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedAt(SafeMediaInformationHandle mediaInformationHandle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_display_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetDisplayName(SafeMediaInformationHandle mediaInformationHandle, string displayName); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_description", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetDescription(SafeMediaInformationHandle mediaInformationHandle, string description); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_longitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetLongitude(SafeMediaInformationHandle mediaInformationHandle, double longitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_latitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetLatitude(SafeMediaInformationHandle mediaInformationHandle, double latitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_altitude", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetAltitude(SafeMediaInformationHandle mediaInformationHandle, double altitude); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_weather", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetWeather(SafeMediaInformationHandle mediaInformationHandle, string weather); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_rating", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetRating(SafeMediaInformationHandle mediaInformationHandle, int rating); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_favorite", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetFavorite(SafeMediaInformationHandle mediaInformationHandle, bool favorite); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_author", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetAuthor(SafeMediaInformationHandle mediaInformationHandle, string author); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_provider", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetProvider(SafeMediaInformationHandle mediaInformationHandle, string provider); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_content_name", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetContentName(SafeMediaInformationHandle mediaInformationHandle, string contentName); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_category", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetCategory(SafeMediaInformationHandle mediaInformationHandle, string category); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_location_tag", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetLocationTag(SafeMediaInformationHandle mediaInformationHandle, string locationTag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_age_rating", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetAgeRating(SafeMediaInformationHandle mediaInformationHandle, string ageRating); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_keyword", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetKeyword(SafeMediaInformationHandle mediaInformationHandle, string keyword); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_update_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError UpdateToDB(IntPtr mediaInformationHandle); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_refresh_metadata_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError RefreshMetadataToDB(string mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_added_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetAddedTime(SafeMediaInformationHandle mediaInformationHandle, int addedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_move_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError MoveToDB(SafeMediaInformationHandle mediaInformationHandle, string dstPath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_create_thumbnail", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError CreateThumbnail(SafeMediaInformationHandle mediaInformationHandle, MediaThumbnailCompletedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_info_cancel_thumbnail", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError CancelThumbnail(SafeMediaInformationHandle mediaInformationHandle); + + internal sealed class SafeMediaInformationHandle : SafeHandle + { + public SafeMediaInformationHandle(IntPtr handle) + : base(handle, true) + { + } + public SafeMediaInformationHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + MediaInformation.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaPlaylist.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaPlaylist.cs new file mode 100755 index 0000000..25a9ccf --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaPlaylist.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Playlist + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_count_from_db")] + internal static extern MediaContentError GetPlaylistCountFromDb(IntPtr filter, out int playlist_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_media_count_from_db")] + internal static extern MediaContentError GetMediaCountFromDb(int playlist_id, IntPtr filter, out int media_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_insert_to_db")] + internal static extern MediaContentError InsertToDb(string name, out IntPtr playlist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_delete_from_db")] + internal static extern MediaContentError DeleteFromDb(int playlist_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_from_db")] + internal static extern MediaContentError GetPlaylistFromDb(int playlist_id, out IntPtr playlist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_destroy")] + internal static extern MediaContentError Destroy(IntPtr playlist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_id")] + internal static extern MediaContentError GetPlaylistId(IntPtr playlist, out int playlist_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_name")] + internal static extern MediaContentError GetName(IntPtr playlist, out IntPtr playlist_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_set_name")] + internal static extern MediaContentError SetName(IntPtr playlist, string playlist_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_thumbnail_path")] + internal static extern MediaContentError GetThumbnailPath(IntPtr playlist, out IntPtr filePath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_set_thumbnail_path")] + internal static extern MediaContentError SetThumbnailPath(IntPtr playlist, string filePath); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_set_play_order")] + internal static extern MediaContentError SetPlayOrder(IntPtr playlist, int playlist_member_id, int play_order); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_add_media")] + internal static extern MediaContentError AddMedia(IntPtr playlist, string media_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_remove_media")] + internal static extern MediaContentError RemoveMedia(IntPtr playlist, int playlist_member_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_play_order")] + internal static extern MediaContentError GetPlayOrder(IntPtr playlist, int playlist_member_id, out int play_order); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_update_to_db")] + internal static extern MediaContentError UpdateToDb(IntPtr playlist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_import_from_file")] + internal static extern MediaContentError ImportFromFile(string playlist_name, string filePath, out IntPtr playlist); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_export_to_file")] + internal static extern MediaContentError ExportToFile(IntPtr playlist, string filePath); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaPlaylistCallback(IntPtr playListHandle, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PlaylistMemberCallback(int playListMemberId, IntPtr mediaInformation, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_foreach_playlist_from_db")] + internal static extern MediaContentError ForeachPlaylistFromDb(IntPtr filter, MediaPlaylistCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_foreach_media_from_db")] + internal static extern MediaContentError ForeachMediaFromDb(int playlist_id, IntPtr filter, PlaylistMemberCallback callback, IntPtr user_data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs new file mode 100755 index 0000000..b17768e --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaStorage.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Storage + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_info_from_db")] + internal static extern MediaContentError GetStorageInfoFromDb(string storage_id, out IntPtr storage); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_storage_count_from_db")] + internal static extern MediaContentError GetStorageCountFromDb(IntPtr filter, out int storage_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_media_count_from_db")] + internal static extern MediaContentError GetMediaCountFromDb(string storage_id, IntPtr filter, out int media_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_destroy")] + internal static extern MediaContentError Destroy(IntPtr storage); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_id")] + internal static extern MediaContentError GetId(IntPtr storage, out IntPtr storage_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_name")] + internal static extern MediaContentError GetName(IntPtr storage, out IntPtr storage_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_path")] + internal static extern MediaContentError GetPath(IntPtr storage, out IntPtr storage_path); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_get_type")] + internal static extern MediaContentError GetType(IntPtr storage, out ContentStorageType storage_type); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaStorageCallback(IntPtr mediaStorageHandle, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_storage_from_db")] + internal static extern MediaContentError ForeachStorageFromDb(IntPtr filter, MediaStorageCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_storage_foreach_media_from_db")] + internal static extern MediaContentError ForeachMediaFromDb(string storage_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.MediaTag.cs b/src/Tizen.Content.MediaContent/Interop/Interop.MediaTag.cs new file mode 100755 index 0000000..9895b62 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.MediaTag.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class Tag + { + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_insert_to_db")] + internal static extern MediaContentError InsertToDb(string tag_name, out IntPtr tag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_delete_from_db")] + internal static extern MediaContentError DeleteFromDb(int tag_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_count_from_db")] + internal static extern MediaContentError GetTagCountFromDb(IntPtr filter, out int tag_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_media_count_from_db")] + internal static extern MediaContentError GetMediaCountFromDb(int tag_id, IntPtr filter, out int media_count); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_clone")] + internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_destroy")] + internal static extern MediaContentError Destroy(IntPtr tag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_id")] + internal static extern MediaContentError GetTagId(IntPtr tag, out int tag_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_name")] + internal static extern MediaContentError GetName(IntPtr tag, out IntPtr tag_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_get_tag_from_db")] + internal static extern MediaContentError GetTagFromDb(int tag_id, out IntPtr tag); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_add_media")] + internal static extern MediaContentError AddMedia(IntPtr tag, string media_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_remove_media")] + internal static extern MediaContentError RemoveMedia(IntPtr tag, string media_id); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_set_name")] + internal static extern MediaContentError SetName(IntPtr tag, string tag_name); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_update_to_db")] + internal static extern MediaContentError UpdateToDb(IntPtr tag); + + //Callbacks + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaInfoCallback(IntPtr mediaInformation, IntPtr data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MediaTagCallback(IntPtr tag, IntPtr data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_foreach_tag_from_db")] + internal static extern MediaContentError ForeachTagFromDb(IntPtr filter, MediaTagCallback callback, IntPtr user_data); + + [DllImport(Libraries.MediaContent, EntryPoint = "media_tag_foreach_media_from_db")] + internal static extern MediaContentError ForeachMediaFromDb(int tag_id, IntPtr filter, MediaInfoCallback callback, IntPtr user_data); + } +} diff --git a/src/Tizen.Content.MediaContent/Interop/Interop.VideoInformation.cs b/src/Tizen.Content.MediaContent/Interop/Interop.VideoInformation.cs new file mode 100755 index 0000000..8138990 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Interop/Interop.VideoInformation.cs @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Content.MediaContent; + +internal static partial class Interop +{ + internal static partial class VideoInformation + { + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Destroy(IntPtr media); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_clone", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError Clone(out SafeVideoInformationHandle dst, SafeVideoInformationHandle src); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetMediaId(SafeVideoInformationHandle videoInformationHandle, out IntPtr mediaId); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAlbum(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumName); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_artist", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr artistName); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_album_artist", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetAlbumArtist(SafeVideoInformationHandle videoInformationHandle, out IntPtr albumArtistName); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_genre", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetGenre(SafeVideoInformationHandle videoInformationHandle, out IntPtr genreName); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_composer", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetComposer(SafeVideoInformationHandle videoInformationHandle, out IntPtr composerName); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_year", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetYear(SafeVideoInformationHandle videoInformationHandle, out IntPtr year); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_recorded_date", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetRecordedDate(SafeVideoInformationHandle videoInformationHandle, out IntPtr recordedDate); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_copyright", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetCopyright(SafeVideoInformationHandle videoInformationHandle, out IntPtr copyright); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_track_num", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetTrackNum(SafeVideoInformationHandle videoInformationHandle, out IntPtr trackNum); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_bit_rate", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetBitRate(SafeVideoInformationHandle videoInformationHandle, out int bitRate); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_duration", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetDuration(SafeVideoInformationHandle videoInformationHandle, out int duration); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_width", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetWidth(SafeVideoInformationHandle videoInformationHandle, out int width); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_height", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetHeight(SafeVideoInformationHandle videoInformationHandle, out int width); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedCount(SafeVideoInformationHandle videoInformationHandle, out int playedCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedTime(SafeVideoInformationHandle videoInformationHandle, out int playedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_get_played_position", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError GetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, out int playedPosition); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedCount(SafeVideoInformationHandle videoInformationHandle, int playedCount); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_time", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedTime(SafeVideoInformationHandle videoInformationHandle, int playedTime); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_set_played_position", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError SetPlayedPosition(SafeVideoInformationHandle videoInformationHandle, int playedPosition); + + [DllImport(Libraries.MediaContent, EntryPoint = "video_meta_update_to_db", CallingConvention = CallingConvention.Cdecl)] + internal static extern MediaContentError UpdateToDB(IntPtr videoInformationHandle); + + internal sealed class SafeVideoInformationHandle : SafeHandle + { + public SafeVideoInformationHandle() + : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + VideoInformation.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.sln b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.sln new file mode 100755 index 0000000..5a6ff40 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Content.MediaContent", "Tizen.Content.MediaContent.csproj", "{45518596-2EC9-4624-9AE9-D9A0E6708B8C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{7F2897B0-FECF-493B-B988-590ADB8B5AC8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{4FCA7B32-660F-46BF-820F-EBA7C039733F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {45518596-2EC9-4624-9AE9-D9A0E6708B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {45518596-2EC9-4624-9AE9-D9A0E6708B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {45518596-2EC9-4624-9AE9-D9A0E6708B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {45518596-2EC9-4624-9AE9-D9A0E6708B8C}.Release|Any CPU.Build.0 = Release|Any CPU + {7F2897B0-FECF-493B-B988-590ADB8B5AC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F2897B0-FECF-493B-B988-590ADB8B5AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F2897B0-FECF-493B-B988-590ADB8B5AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F2897B0-FECF-493B-B988-590ADB8B5AC8}.Release|Any CPU.Build.0 = Release|Any CPU + {4FCA7B32-660F-46BF-820F-EBA7C039733F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FCA7B32-660F-46BF-820F-EBA7C039733F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FCA7B32-660F-46BF-820F-EBA7C039733F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FCA7B32-660F-46BF-820F-EBA7C039733F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs new file mode 100755 index 0000000..3763483 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Album.cs @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// An album is a logical collection or grouping of related audio files. It is also used for filtering media items. + /// The Media Album API allows to manage media albums which contains all video and audio items from the same album. + /// + public class Album : ContentCollection + { + private IntPtr _albumHandle = IntPtr.Zero; + + private IntPtr Handle + { + get + { + if (_albumHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(Album)); + } + + return _albumHandle; + } + } + + /// + /// The media album ID + /// + /// 3 + public int Id + { + get + { + int id = 0; + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetAlbumId(Handle, out id), "Failed to get value"); + + return id; + } + } + + /// + /// The name of the media artist + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Artist + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetArtist(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The path of the media album art + /// + /// 3 + public string Art + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetAlbumArt(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The name of the media album + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Name + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetName(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + internal Album(IntPtr handle) + { + _albumHandle = handle; + } + + /// + /// Gets the number of MediaInformation Items for the given album present in the media database. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count"); + + return mediaCount; + } + + public override void Dispose() + { + if (_albumHandle != IntPtr.Zero) + { + Interop.Group.MediaAlbumDestroy(_albumHandle); + _albumHandle = IntPtr.Zero; + } + } + + /// + /// Iterates through the media files with a filter in the given media album from the media database. + /// This function gets all media files associated with the given media album and meeting desired filter option. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.Group.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs new file mode 100755 index 0000000..e5fc8d8 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/AudioInformation.cs @@ -0,0 +1,455 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.Collections.ObjectModel; + +namespace Tizen.Content.MediaContent +{ + /// + /// AudioContent class API gives the information related to the audio media stored in the device + /// Its purpose is threefold: + /// - to provide information about audio content + /// - to organize audio content logically(grouping) + /// + public class AudioInformation : MediaInformation + { + private readonly Interop.AudioInformation.SafeAudioInformationHandle _handle; + + /// + /// Gets the ID of the media. + /// + /// 3 + public string MediaId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetMediaId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the album name. + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Album + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetAlbum(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the artist name. + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Artist + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetArtist(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the album artist name. + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string AlbumArtist + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetAlbumArtist(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the genre. + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Genre + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetGenre(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the composer name. + /// If the value is an empty string, the property returns "Unknown". + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Composer + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetComposer(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the year. + /// If the media content has no album info, the property returns empty string. + /// + /// 3 + public string Year + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetYear(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the recorded date. + /// + /// 3 + public string RecordedDate + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetRecordedDate(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the copyright. + /// If the media content has no copyright information, the property returns empty string. + /// + /// 3 + public string Copyright + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetCopyright(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the track number. + /// If the media content has no track information, the property returns empty string. + /// + /// 3 + public string TrackNumber + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetTrackNum(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the bitrate in bit per second [bps]. + /// + /// 3 + public int BitRate + { + get + { + int bitrate = 0; + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetBitRate(_handle, out bitrate), "Failed to get value"); + + return bitrate; + } + } + + /// + /// Gets bit per sample. + /// + /// 3 + public int BitPerSample + { + get + { + int bitPerSample = 0; + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetBitPerSample(_handle, out bitPerSample), "Failed to get value"); + + return bitPerSample; + } + } + + /// + /// Gets the sample rate in hz. + /// + /// 3 + public int SampleRate + { + get + { + int sampleRate = 0; + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetSampleRate(_handle, out sampleRate), "Failed to get value"); + + return sampleRate; + } + } + + /// + /// Gets the channel. + /// + /// 3 + public int Channel + { + get + { + int channel = 0; + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetChannel(_handle, out channel), "Failed to get value"); + + return channel; + } + } + + /// + /// Gets the track duration in Milliseconds. + /// + /// 3 + public int Duration + { + get + { + int duration = 0; + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.GetDuration(_handle, out duration), "Failed to get value"); + + return duration; + } + } + + /// + /// Gets the number of MediaBookmark for the passed filter in the given media ID from the media database. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// + /// int count + /// The Filter for matching Bookmarks + public int GetMediaBookmarkCount(ContentFilter filter) + { + int count = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetBookmarkCount(MediaId, handle, out count), "Failed to get count"); + + return count; + } + + /// + /// Returns the MediaBookmarks for the given media info from the media database. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// + /// Task to get all the Bookmarks + /// + /// filter for the Tags + public IEnumerable GetMediaBookmarks(ContentFilter filter) + { + Collection coll = new Collection(); + IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.MediaInformation.MediaBookmarkCallback callback = (IntPtr handle, IntPtr userData) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.Clone(out newHandle, handle), "Failed to clone"); + + coll.Add(new MediaBookmark(newHandle)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAllBookmarks(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value"); + + return coll; + } + + /// + /// Adds a MediaBookmark to the audio + /// + /// 3 + /// Offset of the audio in seconds + /// + /// Task with newly added MediaBookmark instance. + /// + public MediaBookmark AddBookmark(uint offset) + { + MediaBookmark result = null; + ContentManager.Database.Insert(MediaId, offset, null); + ContentFilter bookmarkfilter = new ContentFilter(); + bookmarkfilter.Condition = ContentColumns.Bookmark.Offset + " = " + offset; + IEnumerable bookmarksList = null; + bookmarksList = GetMediaBookmarks(bookmarkfilter); + foreach (MediaBookmark bookmark in bookmarksList) + { + if (bookmark.Offset == offset) + { + result = bookmark; + break; + } + } + + bookmarkfilter.Dispose(); + return result; + } + + /// + /// Deletes a MediaBookmark item from the media database. + /// + /// 3 + /// The MediaBookmark instance to be deleted + public void DeleteBookmark(MediaBookmark bookmark) + { + ContentManager.Database.Delete(bookmark); + } + + internal IntPtr AudioHandle + { + get + { + return _handle.DangerousGetHandle(); + } + } + + internal AudioInformation(Interop.AudioInformation.SafeAudioInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle) + : base(mediaInformationHandle) + { + _handle = handle; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentCollection.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentCollection.cs new file mode 100755 index 0000000..2e4ae7e --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentCollection.cs @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + public abstract class ContentCollection : IDisposable + { + /// + /// Gets the media count for this content store matching the passed filter + /// + /// 3 + /// the media filter + /// Media count + public abstract int GetMediaInformationCount(ContentFilter filter); + + /// + /// Destroys the unmanaged handles. + /// Call Dispose API once Contentcollection operations are completed. + /// + /// 3 + public abstract void Dispose(); + + /// + /// Gets the media matching the passed filter for this content store, asynchronously + /// + /// 3 + /// The media filter + /// Task with Media Information list + public abstract IEnumerable GetMediaInformations(ContentFilter filter); + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentColumns.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentColumns.cs new file mode 100755 index 0000000..6c10037 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentColumns.cs @@ -0,0 +1,1130 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +namespace Tizen.Content.MediaContent +{ + /// + /// A ContentColumns class defines the keyword used for filter condition or sorting. + /// + public static class ContentColumns + { + /// + /// Media column set. \n + /// You can use this define to set the condition of media filter and order keyword. + /// + public class Media + { + /// + /// Media UUID + /// + /// 4 + public static string Id + { + get + { + return "MEDIA_ID"; + } + } + + /// + /// Media path + /// + /// 4 + public static string Path + { + get + { + return "MEDIA_PATH"; + } + } + + /// + /// Display name + /// + /// 4 + public static string DisplayName + { + get + { + return "MEDIA_DISPLAY_NAME"; + } + } + + /// + /// The type of media (0-image, 1-video, 2-sound, 3-music, 4-other) + /// + /// 4 + public static string MediaType + { + get + { + return "MEDIA_TYPE"; + } + } + + /// + /// Mime type + /// + /// 4 + public static string MimeType + { + get + { + return "MEDIA_MIME_TYPE"; + } + } + + + /// + /// File size + /// + /// 4 + public static string Size + { + get + { + return "MEDIA_SIZE"; + } + } + + /// + /// Added time + /// + /// 4 + public static string AddedTime + { + get + { + return "MEDIA_ADDED_TIME"; + } + } + + /// + /// Modified time + /// + /// 4 + public static string ModifiedTime + { + get + { + return "MEDIA_MODIFIED_TIME"; + } + } + + /// + /// Timeline. Normally, creation date of media + /// + /// 4 + public static string Timeline + { + get + { + return "MEDIA_TIMELINE"; + } + } + + /// + /// The path of thumbnail + /// + /// 4 + public static string ThumbnailPath + { + get + { + return "MEDIA_THUMBNAIL_PATH"; + } + } + + /// + /// Title + /// + /// 4 + public static string Title + { + get + { + return "MEDIA_TITLE"; + } + } + + /// + /// Album name + /// + /// 4 + public static string Album + { + get + { + return "MEDIA_ALBUM"; + } + } + + /// + /// Artist + /// + /// 4 + public static string Artist + { + get + { + return "MEDIA_ARTIST"; + } + } + + /// + /// Album artist + /// + /// 4 + public static string AlbumArtist + { + get + { + return "MEDIA_ALBUM_ARTIST"; + } + } + + /// + /// Genre + /// + /// 4 + public static string Genre + { + get + { + return "MEDIA_GENRE"; + } + } + + /// + /// Composer + /// + /// 4 + public static string Composer + { + get + { + return "MEDIA_COMPOSER"; + } + } + + /// + /// Release year + /// + /// 4 + public static string Year + { + get + { + return "MEDIA_YEAR"; + } + } + + /// + /// Recorded date + /// + /// 4 + public static string RecordedDate + { + get + { + return "MEDIA_RECORDED_DATE"; + } + } + + /// + /// Copyright + /// + /// 4 + public static string Copyright + { + get + { + return "MEDIA_COPYRIGHT"; + } + } + + /// + /// Track Number + /// + /// 4 + public static string TrackNumber + { + get + { + return "MEDIA_TRACK_NUM"; + } + } + + /// + /// Description + /// + /// 4 + public static string Description + { + get + { + return "MEDIA_DESCRIPTION"; + } + } + + /// + /// Bitrate + /// + /// 4 + public static string Bitrate + { + get + { + return "MEDIA_BITRATE"; + } + } + + /// + /// Bit per sample + /// + /// 4 + public static string BitPerSample + { + get + { + return "MEDIA_BITPERSAMPLE"; + } + } + + /// + /// Samplerate + /// + /// 4 + public static string Samplerate + { + get + { + return "MEDIA_SAMPLERATE"; + } + } + + /// + /// Channel + /// + /// 4 + public static string Channel + { + get + { + return "MEDIA_CHANNEL"; + } + } + + /// + /// Duration + /// + /// 4 + public static string Duration + { + get + { + return "MEDIA_DURATION"; + } + } + + /// + /// Longitude + /// + /// 4 + public static string Longitude + { + get + { + return "MEDIA_LONGITUDE"; + } + } + + /// + /// Latitude + /// + /// 4 + public static string Latitude + { + get + { + return "MEDIA_LATITUDE"; + } + } + + /// + /// Altitude + /// + /// 4 + public static string Altitude + { + get + { + return "MEDIA_ALTITUDE"; + } + } + /// + /// Width + /// + /// 4 + public static string Width + { + get + { + return "MEDIA_WIDTH"; + } + } + + /// + /// Height + /// + /// 4 + public static string Height + { + get + { + return "MEDIA_HEIGHT"; + } + } + + /// + /// Datetaken + /// + /// 4 + public static string Datetaken + { + get + { + return "MEDIA_DATETAKEN"; + } + } + + /// + /// Orientation + /// + /// 4 + public static string Orientation + { + get + { + return "MEDIA_ORIENTATION"; + } + } + + /// + /// Burst shot ID + /// + /// 4 + public static string BurstId + { + get + { + return "BURST_ID"; + } + } + + /// + /// Played count + /// + /// 4 + public static string PlayedCount + { + get + { + return "MEDIA_PLAYED_COUNT"; + } + } + + /// + /// Last played time + /// + /// 4 + public static string PlayedTime + { + get + { + return "MEDIA_LAST_PLAYED_TIME"; + } + } + + /// + /// Last played position + /// + /// 4 + public static string PlayedPosition + { + get + { + return "MEDIA_LAST_PLAYED_POSITION"; + } + } + + /// + /// Rating + /// + /// 4 + public static string Rating + { + get + { + return "MEDIA_RATING"; + } + } + + /// + /// Favourite + /// + /// 4 + public static string Favourite + { + get + { + return "MEDIA_FAVOURITE"; + } + } + + /// + /// Author + /// + /// 4 + public static string Author + { + get + { + return "MEDIA_AUTHOR"; + } + } + + /// + /// Provider + /// + /// 4 + public static string Provider + { + get + { + return "MEDIA_PROVIDER"; + } + } + /// + /// Content name + /// + /// 4 + public static string ContentName + { + get + { + return "MEDIA_CONTENT_NAME"; + } + } + + /// + /// Category + /// + /// 4 + public static string Category + { + get + { + return "MEDIA_CATEGORY"; + } + } + /// + /// Location tag + /// + /// 4 + public static string LocationTag + { + get + { + return "MEDIA_LOCATION_TAG"; + } + } + + /// + /// Age rating + /// + /// 4 + public static string AgeRating + { + get + { + return "MEDIA_AGE_RATING"; + } + } + + /// + /// Keyword + /// + /// 4 + public static string Keyword + { + get + { + return "MEDIA_KEYWORD"; + } + } + + /// + /// Weather + /// + /// 4 + public static string Weather + { + get + { + return "MEDIA_WEATHER"; + } + } + + /// + /// Whether DRM(1) or not(0) + /// + /// 4 + public static string IsDRM + { + get + { + return "MEDIA_IS_DRM"; + } + } + + /// + /// Storage type + /// + /// 4 + public static string StorageType + { + get + { + return "MEDIA_STORAGE_TYPE"; + } + } + + /// + /// Exposure time + /// + /// 4 + public static string ExposureTime + { + get + { + return "MEDIA_EXPOSURE_TIME"; + } + } + + /// + /// f-number + /// + /// 4 + public static string FNumber + { + get + { + return "MEDIA_FNUMBER"; + } + } + + /// + /// ISO + /// + /// 4 + public static string Iso + { + get + { + return "MEDIA_ISO"; + } + } + + /// + /// Model + /// + /// 4 + public static string Model + { + get + { + return "MEDIA_MODEL"; + } + } + + /// + /// 360 content + /// + /// 4 + public static string Media360 + { + get + { + return "MEDIA_360"; + } + } + + /// + /// Keyword for pinyin + /// + public class Pinyin + { + /// + /// File name (pinyin) + /// + /// 4 + public static string FileName + { + get + { + return "MEDIA_FILE_NAME_PINYIN"; + } + } + + /// + /// Title (pinyin) + /// + /// 4 + public static string Title + { + get + { + return "MEDIA_TITLE_PINYIN"; + } + } + + /// + /// Album (pinyin) + /// + /// 4 + public static string Album + { + get + { + return "MEDIA_ALBUM_PINYIN"; + } + } + + /// + /// Artist (pinyin) + /// + /// 4 + public static string Artist + { + get + { + return "MEDIA_ARTIST_PINYIN"; + } + } + + /// + /// Album artist (pinyin) + /// + /// 4 + public static string AlbumArtist + { + get + { + return "MEDIA_ALBUM_ARTIST_PINYIN"; + } + } + + /// + /// Genre (pinyin) + /// + /// 4 + public static string Genre + { + get + { + return "MEDIA_GENRE_PINYIN"; + } + } + + /// + /// Composer (pinyin) + /// + /// 4 + public static string Composer + { + get + { + return "MEDIA_COMPOSER_PINYIN"; + } + } + + /// + /// Copyright (pinyin) + /// + /// 4 + public static string Copyright + { + get + { + return "MEDIA_COPYRIGHT_PINYIN"; + } + } + + /// + /// Description (pinyin) + /// + /// 4 + public static string Description + { + get + { + return "MEDIA_DESCRIPTION_PINYIN"; + } + } + + /// + /// Author (pinyin) + /// + /// 4 + public static string Author + { + get + { + return "MEDIA_AUTHOR_PINYIN"; + } + } + + /// + /// Provider (pinyin) + /// + /// 4 + public static string Provider + { + get + { + return "MEDIA_PROVIDER_PINYIN"; + } + } + + /// + /// Content name (pinyin) + /// + /// 4 + public static string ContentName + { + get + { + return "MEDIA_CONTENT_NAME_PINYIN"; + } + } + + /// + /// Category (pinyin) + /// + /// 4 + public static string Category + { + get + { + return "MEDIA_CATEGORY_PINYIN"; + } + } + + /// + /// Location tag (pinyin) + /// + /// 4 + public static string LocationTag + { + get + { + return "MEDIA_LOCATION_TAG_PINYIN"; + } + } + + /// + /// Age rating (pinyin) + /// + /// 4 + public static string AgeRating + { + get + { + return "MEDIA_AGE_RATING_PINYIN"; + } + } + + /// + /// Keyword (pinyin) + /// + /// 4 + public static string Keyword + { + get + { + return "MEDIA_KEYWORD_PINYIN"; + } + } + } + } + + /// + /// Folder column set. \n + /// You can use this define to set the condition of folder filter and order keyword. + /// + public class Folder + { + + /// + ///Folder UUID + /// + /// 4 + public static string Id + { + get + { + return "FOLDER_ID"; + } + } + + /// + /// Folder path + /// + /// 4 + public static string Path + { + get + { + return "FOLDER_PATH"; + } + } + + /// + /// Folder name + /// + /// 4 + public static string Name + { + get + { + return "FOLDER_NAME"; + } + } + + /// + /// Folder modified time + /// + /// 4 + public static string ModifiedTime + { + get + { + return "FOLDER_MODIFIED_TIME"; + } + } + + /// + /// Folder storage type + /// + /// 4 + public static string StorageType + { + get + { + return "FOLDER_STORAGE_TYPE"; + } + } + + /// + /// Keyword for pinyin + /// + public class Pinyin + { + /// + /// Folder name (pinyin) + /// + /// 4 + public static string Name + { + get + { + return "FOLDER_NAME_PINYIN"; + } + } + + } + + /// + /// Folder order. Default is 0 + /// + /// 4 + public static string Order + { + get + { + return "FOLDER_ORDER"; + } + } + + /// + /// Parent folder UUID + /// + /// 4 + public static string ParentId + { + get + { + return "FOLDER_PARENT_FOLDER_ID"; + } + } + } + + /// + /// Playlist column set. \n + /// You can use this define to set the condition of playlist filter and order keyword. + /// + public class Playlist + { + /// + /// Playlist name + /// + /// 4 + public static string Name + { + get + { + return "PLAYLIST_NAME"; + } + } + /// + /// Playlist member's play order + /// + /// 4 + public static string Order + { + get + { + return "PLAYLIST_MEMBER_ORDER"; + } + } + + /// + /// Count of media in the playlist + /// + /// 4 + public static string Count + { + get + { + return "PLAYLIST_MEDIA_COUNT"; + } + } + } + + /// + /// Tag column set. \n + /// You can use this define to set the condition of tag filter and order keyword. + /// + public class Tag + { + /// + /// Tag name + /// + /// 4 + public static string Name + { + get + { + return "TAG_NAME"; + } + } + + /// + /// Count of media in the tag + /// + /// 4 + public static string Count + { + get + { + return "TAG_MEDIA_COUNT"; + } + } + } + + /// + /// Bookmark column set. \n + /// You can use this define to set the condition of bookmark filter and order keyword. + /// + public class Bookmark + { + /// + /// Bookmarked offset + /// + /// 4 + public static string Offset + { + get + { + return "BOOKMARK_MARKED_TIME"; + } + } + } + + /// + /// Storage column set. \n + /// You can use this define to set the condition of storage filter and order keyword. + /// + public class Storage + { + /// + /// Storage UUID + /// + /// 4 + public static string Id + { + get + { + return "STORAGE_ID"; + } + } + + /// + /// Storage path + /// + /// 4 + public static string Path + { + get + { + return "STORAGE_PATH"; + } + } + } + + /// + /// Face column set. \n + /// You can use this define to set the condition of face filter and order keyword. + /// + public class Face + { + /// + /// face tag + /// + /// 4 + public static string Tag + { + get + { + return "MEDIA_FACE_TAG"; + } + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs new file mode 100755 index 0000000..e2389a3 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentDatabase.cs @@ -0,0 +1,714 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +/// +/// The Media Content API provides functions, enumerations used in the entire Content Service. +/// +/// +/// The Media Content API provides functions and enumerations used in the entire Content Service. +/// The information about media items i.e.image, audio and video, are managed in the content database +/// and operations that involve database requires an active connection with the media content service. +/// During media scanning, Media Service extract media information automatically. media information +/// include basic file info like path, size, modified time etc and some metadata like ID3tag, EXIF, +/// thumbnail, etc. (thumbnail extracted only in Internal and SD card storage. +/// Media content services do not manage hidden files. +/// The API provides functions for connecting (media_content_connect()) and disconnecting(media_content_disconnect()) +/// from the media content service. +/// + + +namespace Tizen.Content.MediaContent +{ + /// + /// ContentDatabase class is the interface class for managing the ContentCollection and MediaInformation from/to the database. + /// This class allows usre to access/create/update db operations for media content. + /// + public class ContentDatabase + { + private static IntPtr _updateHandle = IntPtr.Zero; + + /// + /// Connect to the media database to search, insert, remove or modify media information. + /// + /// 4 + /// + /// For information security, disconnect() after use media database. + /// + public static void Connect() + { + MediaContentValidator.ThrowIfError(Interop.Content.Connect(), "Connect failed"); + } + + /// + /// Disconnect from the media database. + /// + /// 4 + public static void Disconnect() + { + MediaContentValidator.ThrowIfError(Interop.Content.Disconnect(), "Disconnect failed"); + } + + private static readonly Interop.Content.MediaContentDBUpdatedCallback s_contentUpdatedCallback = ( + MediaContentError error, + int pid, + MediaContentUpdateItemType updateItem, + MediaContentDBUpdateType updateType, + MediaContentType mediaType, + string uuid, + string filePath, + string mimeType, + IntPtr userData) => + { + _contentUpdated?.Invoke( + null, new ContentUpdatedEventArgs(error, pid, updateItem, updateType, mediaType, uuid, filePath, mimeType)); + }; + + private static event EventHandler _contentUpdated; + /// + /// ContentUpdated event is triggered when the media DB changes. + /// + /// 3 + /// + /// A ContentUpdatedEventArgs object that contains information about the update operation. + public static event EventHandler ContentUpdated + { + add + { + if (_contentUpdated == null) + { + MediaContentValidator.ThrowIfError( + Interop.Content.AddDbUpdatedCb(s_contentUpdatedCallback, IntPtr.Zero, out _updateHandle), "Failed to set callback"); + } + + _contentUpdated += value; + } + + remove + { + _contentUpdated -= value; + if (_contentUpdated == null) + { + MediaContentValidator.ThrowIfError( + Interop.Content.RemoveDbUpdatedCb(_updateHandle), "Failed to unset callback"); + } + } + } + + /// + /// Gets the count of ContentCollections for the ContentCollectionType and passed filter from the media database. + /// + /// 3 + /// The media filter + /// The count of contents present in the media database for a ContentSourceType + public int GetCount(ContentFilter filter) where T : class + { + int count = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaGroupType groupType = MediaGroupType.DisplayName; + if (handle != IntPtr.Zero) + { + groupType = filter.GroupType; + } + + if (typeof(T) == typeof(MediaInformation)) + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetMediaCount(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(MediaBookmark)) + { + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.GetBookmarkCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(Album)) + { + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetAlbumCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(MediaFolder)) + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetFolderCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(Storage)) + { + MediaContentValidator.ThrowIfError( + Interop.Storage.GetStorageCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(Tag)) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.GetTagCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(PlayList)) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetPlaylistCountFromDb(handle, out count), "Failed to get count"); + } + else if (typeof(T) == typeof(Group)) + { + MediaContentValidator.ThrowIfError( + Interop.Group.GetGroupCountFromDb(handle, groupType, out count), "Failed to get count"); + } + else + { + throw new ArgumentException("Wrong type"); + } + + return count; + } + + /// + /// Gets the MediaInformation object for the passed media Id. + /// + /// 3 + /// The media id to fetch the respective MediaInformation instance + /// MediaInformation instance for the associated id.It throws Exception for invalid Id. + public MediaInformation Select(string id) + { + Interop.MediaInformation.SafeMediaInformationHandle mediaHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetMediaFromDB(id, out mediaHandle), "Failed to get information"); + + MediaContentType type; + MediaInformation res; + Interop.MediaInformation.GetMediaType(mediaHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information"); + + res = new ImageInformation(imageInfo, mediaHandle); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information"); + + res = new AudioInformation(audioInfo, mediaHandle); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information"); + + res = new VideoInformation(videoInfo, mediaHandle); + } + else + { + res = new MediaInformation(mediaHandle); + } + + return res; + } + + /// + /// Gets the ContentCollection object for the passed media Id. + /// Applicable for MediaFolder and Storage types. + /// + /// 3 + /// The ContentCollection id to fetch the respective MediaInformation instance + /// ContentCollection instance for the associated id.It throws Exception for invalid Id. + public T Select(string id) where T : ContentCollection + { + ContentCollection result = null; + IntPtr handle = IntPtr.Zero; + + if (typeof(T) == typeof(MediaFolder)) + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetFolderFromDb(id, out handle), "Failed to get information"); + + if (handle != IntPtr.Zero) + { + result = new MediaFolder(handle); + return (T)result; + } + + } + else if (typeof(T) == typeof(Storage)) + { + MediaContentValidator.ThrowIfError( + Interop.Storage.GetStorageInfoFromDb(id, out handle), "Failed to get information"); + + if (handle != IntPtr.Zero) + { + result = new Storage(handle); + return (T)result; + } + } + + return null; + } + + + /// + /// Gets the ContentCollection object for the passed media Id. + /// Applicable for PlayList, Album and Tag types. + /// + /// 3 + /// The ContentCollection id to fetch the respective MediaInformation instance + /// ContentCollection instance for the associated id.It throws Exception for invalid Id. + public T Select(int id) where T : ContentCollection + { + ContentCollection result = null; + IntPtr handle = IntPtr.Zero; + + if (typeof(T) == typeof(PlayList)) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetPlaylistFromDb(id, out handle), "Failed to get information"); + + if (handle != IntPtr.Zero) + { + result = new PlayList(handle); + return (T)result; + } + } + else if (typeof(T) == typeof(Album)) + { + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumGetAlbumFromDb(id, out handle), "Failed to get information"); + + if (handle != IntPtr.Zero) + { + result = new Album(handle); + return (T)result; + } + } + else if (typeof(T) == typeof(Tag)) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.GetTagFromDb(id, out handle), "Failed to get information"); + + if (handle != IntPtr.Zero) + { + result = new Tag(handle); + return (T)result; + } + } + + return null; + } + + private static IEnumerable ForEachFolder(ContentFilter filter) + { + List result = new List(); + Interop.Folder.MediaFolderCallback callback = (IntPtr handle, IntPtr data) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Folder.Clone(out newHandle, handle), "Failed to clone"); + + result.Add(new MediaFolder(newHandle)); + return true; + }; + IntPtr filterHandle = filter != null ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Folder.ForeachFolderFromDb(filterHandle, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + private static IEnumerable ForEachAlbum(ContentFilter filter) + { + List result = new List(); + Interop.Group.MediaAlbumCallback callback = (IntPtr handle, IntPtr data) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumClone(out newHandle, handle), "Failed to clone"); + + result.Add(new Album(newHandle)); + return true; + }; + IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Group.MediaAlbumForeachAlbumFromDb(filterHandle, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + private static IEnumerable ForEachGroup(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaGroupType groupType; + if (filter == null) + { + groupType = MediaGroupType.DisplayName; + } + else + { + groupType = filter.GroupType; + } + + List result = new List(); + Interop.Group.MediaGroupCallback callback = (string groupName, IntPtr data) => + { + result.Add(new Group(groupName, groupType)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Group.ForeachGroupFromDb(handle, groupType, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + private static IEnumerable ForEachStorage(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + List result = new List(); + Interop.Storage.MediaStorageCallback callback = (IntPtr storageHandle, IntPtr data) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Storage.Clone(out newHandle, storageHandle), "Failed to clone"); + + result.Add(new Storage(newHandle)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Storage.ForeachStorageFromDb(handle, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + private static IEnumerable ForEachTag(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + + List result = new List(); + Interop.Tag.MediaTagCallback callback = (IntPtr tagHandle, IntPtr data) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Tag.Clone(out newHandle, tagHandle), "Failed to clone"); + + result.Add(new Tag(newHandle)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Tag.ForeachTagFromDb(handle, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + private static IEnumerable ForEachPlayList(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + + List result = new List(); + Interop.Playlist.MediaPlaylistCallback callback = (IntPtr playListHandle, IntPtr data) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Playlist.Clone(out newHandle, playListHandle), "Failed to clone"); + + result.Add(new PlayList(newHandle)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Playlist.ForeachPlaylistFromDb(handle, callback, IntPtr.Zero), "Failed to get information"); + + return result; + } + + /// + /// Returns the ContentCollections with optional filter from the media database. + /// + /// 3 + /// + /// This function gets all ContentCollections matching the given filter. If NULL is passed to the filter, no filtering is applied. + /// + /// Filter for content items + /// + /// Task with the list of the ContentCollection + /// + public IEnumerable SelectAll(ContentFilter filter) + { + if (typeof(T) == typeof(MediaInformation)) + { + IEnumerable mediaList = GetMediaInformations(filter); + return (IEnumerable)mediaList; + } + else if (typeof(T) == typeof(Album)) + { + IEnumerable collectionList = ForEachAlbum(filter); + return (IEnumerable)collectionList; + } + else if (typeof(T) == typeof(MediaFolder)) + { + IEnumerable collectionList = ForEachFolder(filter); + return (IEnumerable)collectionList; + } + else if (typeof(T) == typeof(Group)) + { + IEnumerable collectionList = ForEachGroup(filter); + return (IEnumerable)collectionList; + } + else if (typeof(T) == typeof(Storage)) + { + IEnumerable collectionList = ForEachStorage(filter); + return (IEnumerable)collectionList; + } + else if (typeof(T) == typeof(Tag)) + { + IEnumerable collectionList = ForEachTag(filter); + return (IEnumerable)collectionList; + } + else if (typeof(T) == typeof(PlayList)) + { + IEnumerable collectionList = ForEachPlayList(filter); + return (IEnumerable)collectionList; + } + + return null; + } + + /// + /// Returns media from the media database. + /// This function gets all media meeting the given filter + /// + /// 3 + /// The media filter + /// List of media + private IEnumerable GetMediaInformations(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + List mediaInformationList = new List(); + Interop.MediaInformation.MediaInformationCallback callback = (IntPtr mediaHandle, IntPtr userData) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaInformationList.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaInformationList.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaInformationList.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaInformationList.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAllMedia(handle, callback, IntPtr.Zero), "Failed to get media information"); + + return mediaInformationList; + } + + /// + /// Deletes a MediaInformation from the media database. + /// + /// 3 + /// The MediaInformation to be deleted + public void Delete(MediaInformation mediaInfo) + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Delete(mediaInfo.MediaId), "Failed to remove information"); + } + + + /// + /// Deletes a content collection from the media database. + /// Applicable for Tag and PlayList only. + /// For other types ArgumentException is thrown. + /// + /// 3 + /// The ContentCollection instance to be deleted + public void Delete(ContentCollection contentcollection) + { + Type type = contentcollection.GetType(); + + if (type == typeof(Tag)) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.DeleteFromDb(((Tag)contentcollection).Id), "Failed to remove information"); + } + else if (type == typeof(PlayList)) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.DeleteFromDb(((PlayList)contentcollection).Id), "Failed to remove information"); + } + else + { + throw new ArgumentException("The type of content collection is wrong"); + } + } + + internal void Delete(MediaBookmark bookmark) + { + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.DeleteFromDb(bookmark.Id), "Failed to remove information"); + } + + internal void Delete(MediaFace face) + { + MediaContentValidator.ThrowIfError( + Interop.Face.DeleteFromDb(face.Id), "Failed to remove face information"); + } + + /// + /// Updates a content collection in the media database + /// Applicable for Tag, PlayList and MediagFolder types only. + /// + /// 3 + /// The content collection to be updated + public void Update(ContentCollection contentCollection) + { + Type type = contentCollection.GetType(); + if (type == typeof(Tag)) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.UpdateToDb(((Tag)contentCollection).Handle), "Failed to update DB"); + } + else if (type == typeof(PlayList)) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.UpdateToDb(((PlayList)contentCollection).Handle), "Failed to update DB"); + } + else if (type == typeof(MediaFolder)) + { + MediaContentValidator.ThrowIfError( + Interop.Folder.UpdateToDb(((MediaFolder)contentCollection).Handle), "Failed to update DB"); + } + else + { + throw new ArgumentException("The type of content collection is wrong"); + } + } + + /// + /// Updates a media information instance in the media database + /// + /// 3 + /// The MediaInformation object to be updated + public void Update(MediaInformation mediaInfo) + { + Type type = mediaInfo.GetType(); + if (type == typeof(ImageInformation)) + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.UpdateToDB(((ImageInformation)mediaInfo).ImageHandle), "Failed to update DB"); + + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB"); + } + else if (type == typeof(AudioInformation)) + { + MediaContentValidator.ThrowIfError( + Interop.AudioInformation.UpdateToDB(((AudioInformation)mediaInfo).AudioHandle), "Failed to update DB"); + + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB"); + } + else if (type == typeof(VideoInformation)) + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.UpdateToDB(((VideoInformation)mediaInfo).VideoHandle), "Failed to update DB"); + + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB"); + } + else if (type == typeof(MediaInformation)) + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.UpdateToDB(mediaInfo.MediaHandle), "Failed to update DB"); + } + else + { + throw new ArgumentException("Invalid information type"); + } + } + + internal void Update(MediaFace face) + { + MediaContentValidator.ThrowIfError(Interop.Face.UpdateToDb(face.Handle), "Failed to update DB"); + } + + /// + /// Inserts a content collection to the media database. + /// Applicable for Tag and PlayList types only. + /// + /// 3 + /// The content collection to be inserted + public void Insert(ContentCollection contentCollection) + { + Type type = contentCollection.GetType(); + IntPtr handle = IntPtr.Zero; + if (type == typeof(Tag)) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.InsertToDb(((Tag)contentCollection).Name, out handle), "Failed to insert collection"); + ((Tag)contentCollection).Handle = handle; + } + else if (type == typeof(PlayList)) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.InsertToDb(((PlayList)contentCollection).Name, out handle), "Failed to insert collection"); + ((PlayList)contentCollection).Handle = handle; + } + else + { + throw new ArgumentException("collection type is wrong"); + } + } + + internal void Insert(string mediaId, uint offset, string thumbnailPath) + { + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.InsertToDb(mediaId, offset, thumbnailPath), "Failed to insert information"); + } + + internal void Insert(MediaFace face) + { + MediaContentValidator.ThrowIfError( + Interop.Face.InsertToDb(((MediaFace)face).Handle), "Failed to insert information"); + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentEventArgs.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentEventArgs.cs new file mode 100755 index 0000000..283fc87 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentEventArgs.cs @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; + +namespace Tizen.Content.MediaContent +{ + /// + /// Event arguments passed when content is updated in the media database + /// + public class ContentUpdatedEventArgs : EventArgs + { + internal ContentUpdatedEventArgs(MediaContentError error, int pid, MediaContentUpdateItemType updateItem, + MediaContentDBUpdateType updateType, MediaContentType mediaType, string uuid, string filePath, string mimeType) + { + Error = error; + Pid = pid; + UpdateItem = updateItem; + UpdateType = updateType; + MediaType = mediaType; + Uuid = uuid; + FilePath = filePath; + MimeType = mimeType; + } + /// + /// The error code + /// + /// 3 + public MediaContentError Error + { + get; + internal set; + } + + /// + /// The PID which publishes notification + /// + /// 3 + public int Pid + { + get; set; + } + + /// + /// The update item of notification + /// + /// 3 + public MediaContentUpdateItemType UpdateItem + { + get; set; + } + + /// + /// The update type of notification + /// + /// 3 + public MediaContentDBUpdateType UpdateType + { + get; set; + } + + /// + /// The type of the media content + /// + /// 3 + public MediaContentType MediaType + { + get; set; + } + + /// + /// The UUID of media or directory, which is updated + /// + /// 3 + public string Uuid + { + get; set; + } + + /// + /// The path of the media or directory + /// + /// 3 + public string FilePath + { + get; set; + } + + /// + /// The mime type of the media info + /// + /// 3 + public string MimeType + { + get; set; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs new file mode 100755 index 0000000..97d4998 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentFilter.cs @@ -0,0 +1,365 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MediaContent +{ + /// + /// The Content Filter API provides functions to manage media filters. + /// + /// + /// A Content filter is required for filtering information associated with Media Folder, Tag, Audio, MediaBookmark and Media Information on basis of details like offset, count, order and condition for searching. + /// It provide functionality to set properties associated with a given content filter. + /// Setting content filter properties helps to limit the number of filtered items as following: + /// + /// + /// Offset - Used to set starting position of the filter's search + /// + /// + /// Count - Used to set number of items to be searched from offset + /// + /// + /// Condition - Used to set keyword which user want to search + /// + /// + /// Order - Used to set type of media to be ordered by the filter + /// + /// + /// Searchable expression can use one of the following forms: + /// + /// + /// column = value + /// + /// + /// column > value + /// + /// + /// column >= value + /// + /// + /// column < value + /// + /// + /// column <= value + /// + /// + /// value = column + /// + /// + /// value >= column + /// + /// + /// value < column + /// + /// + /// value <= column + /// + /// + /// column IN (value) + /// + /// + /// column IN(value-list) + /// + /// + /// column NOT IN(value) + /// + /// + /// column NOT IN(value-list) + /// + /// + /// column LIKE value + /// + /// + /// expression1 AND expression2 OR expression3 + /// + /// + /// Note that if you want to set qoutation(" ' " or " " ") as value of LIKE operator, you should use two times.(" '' " or " "" ") \n And the optional ESCAPE clause is supported. Both percent symbol("%") and underscore symbol("_") are used in the LIKE pattern. + /// If these characters are used as value of LIKE operation, then the expression following the ESCAPE caluse of sqlite. + /// + public class ContentFilter : IDisposable + { + private IntPtr _filterHandle = IntPtr.Zero; + private bool _disposedValue = false; + private ContentCollation _conditionCollate = ContentCollation.Default; + private ContentCollation _orderCollate = ContentCollation.Default; + private ContentOrder _orderType = ContentOrder.Asc; + private string _orderKeyword = null; + private string _conditionMsg = null; + + internal IntPtr Handle + { + get + { + if (_filterHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(ContentFilter)); + } + + return _filterHandle; + } + } + /// + /// The start position of the given filter Starting from zero. + /// Please note that count value has to be set properly for correct result. + /// + /// 3 + public int Offset + { + get + { + int offset; + int count; + MediaContentValidator.ThrowIfError( + Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get offset"); + + return offset; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetOffset(Handle, value, this.Count), "Failed to set offset"); + } + } + + public ContentFilter() + { + MediaContentValidator.ThrowIfError( + Interop.Filter.Create(out _filterHandle), "Failed to Create Filter handle."); + } + + /// + /// The number of items to be searched with respect to the offset + /// + /// 3 + public int Count + { + get + { + int offset; + int count; + MediaContentValidator.ThrowIfError( + Interop.Filter.GetOffset(Handle, out offset, out count), "Failed to get count"); + + return count; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetOffset(Handle, this.Offset, value), "Failed to set count"); + } + } + + /// + /// Gets the media filter content order and order keyword. + /// + /// 3 + public ContentOrder Order + { + get + { + return _orderType; + } + + set + { + if (_orderKeyword != null) + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetOrder(Handle, value, _orderKeyword, _orderCollate), "Failed to set order"); + } + + _orderType = value; + } + } + + /// + /// The search order keyword + /// + /// 3 + public string OrderKey + { + get + { + ContentOrder order; + IntPtr val = IntPtr.Zero; + ContentCollation type; + try + { + MediaContentValidator.ThrowIfError( + Interop.Filter.GetOrder(Handle, out order, out val, out type), "Failed to GetOrder for OrderKey"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetOrder(Handle, _orderType, value, _orderCollate), "Failed to set OrderKey"); + + _orderKeyword = value; + } + } + + /// + /// The collate type for comparing two strings + /// + /// 3 + public ContentCollation OrderCollationType + { + get + { + return _orderCollate; + } + + set + { + if (_orderKeyword != null) + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetOrder(Handle, _orderType, _orderKeyword, value), "Failed to set collation"); + } + + _orderCollate = value; + } + } + + /// + /// Gets/Sets the condition for the given filter. + /// + /// 3 + public string Condition + { + get + { + IntPtr val = IntPtr.Zero; + ContentCollation type; + try + { + MediaContentValidator.ThrowIfError( + Interop.Filter.GetCondition(Handle, out val, out type), "Failed to get condition"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetCondition(Handle, value, _conditionCollate), "Failed to set condition"); + + _conditionMsg = value; + } + } + + /// + /// The collate type for comparing two strings + /// + /// 3 + public ContentCollation ConditionCollationType + { + get + { + return _conditionCollate; + } + + set + { + if (_conditionMsg != null) + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetCondition(Handle, _conditionMsg, value), "Failed to set collation"); + } + + _conditionCollate = value; + } + } + + /// + /// Sets the storage id for the given filter. + /// You can use this property when you want to search items only in the specific storage + /// + /// 3 + public string StorageId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Filter.GetStorage(Handle, out val), "Failed to get condition"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Filter.SetStorage(Handle, value), "Failed to set condition"); + } + } + + /// + /// The type of the media group + /// + /// 3 + public MediaGroupType GroupType { get; set; } + + /// + /// Dispose API for closing the internal resources. + /// This function can be used to stop all effects started by Vibrate(). + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (_filterHandle != IntPtr.Zero) + { + Interop.Filter.Destroy(_filterHandle); + _filterHandle = IntPtr.Zero; + } + + _disposedValue = true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs new file mode 100755 index 0000000..6044b87 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ContentManager.cs @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Threading; + +/// +/// The Media Content API provides functions, enumerations used in the entire Content Service. +/// +/// +/// The Media Content API provides functions and enumerations used in the entire Content Service. +/// The information about media items i.e.image, audio and video, are managed in the content database +/// and operations that involve database requires an active connection with the media content service. +/// During media scanning, Media Service extract media information automatically. media information +/// include basic file info like path, size, modified time etc and some metadata like ID3tag, EXIF, +/// thumbnail, etc. (thumbnail extracted only in Internal and SD card storage. +/// Media content services do not manage hidden files. +/// The API provides functions for connecting (media_content_connect()) and disconnecting(media_content_disconnect()) +/// from the media content service. +/// + + +namespace Tizen.Content.MediaContent +{ + /// + /// ContentManager class is the interface class for accessing the ContentCollection and MediaInformation. + /// This class allows usre to create/update db operations for media content. + /// + public static class ContentManager + { + private static readonly ContentDatabase s_contentDB = new ContentDatabase(); + + /// + /// Database instance to do all the Database oprtions for media content management. + /// + /// 3 + public static ContentDatabase Database + { + get + { + return s_contentDB; + } + } + + /// + /// Requests to scan a media file. + /// + /// 3 + /// File path of the media to be scanned + /// A reference to the MediaInformation object scanned + /// + /// This function requests to scan a media file to the media server. If media file is not registered to DB yet, + /// that media file information will be added to the media DB. If it is already registered to the DB, + /// then this tries to refresh information. If requested file does not exist on file system, + /// information of the media file will be removed from the media DB. + /// + public static void Scan(string filePath) + { + MediaContentValidator.ThrowIfError(Interop.Content.ScanFile(filePath), "Failed scan"); + } + + /// + /// Inserts a media to the media database + /// + /// 3 + /// File path of the media to be inserted + /// the MediaInformation instance about added media path + public static MediaInformation AddMediaInformation(string filePath) + { + Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Insert(filePath, out mediaInformationHandle), "Failed to Insert MediaInformation to DB"); + + MediaContentType type; + MediaInformation res; + Interop.MediaInformation.GetMediaType(mediaInformationHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaInformationHandle.DangerousGetHandle(), out imageInfo), "Failed to get image information"); + + res = new ImageInformation(imageInfo, mediaInformationHandle); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaInformationHandle.DangerousGetHandle(), out audioInfo), "Failed to get audio information"); + + res = new AudioInformation(audioInfo, mediaInformationHandle); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaInformationHandle.DangerousGetHandle(), out videoInfo), "Failed to get video information"); + + res = new VideoInformation(videoInfo, mediaInformationHandle); + } + else + { + res = new MediaInformation(mediaInformationHandle); + } + + return res; + } + + /// + /// Requests to scan a media folder, asynchronously. + /// + /// 3 + /// The folder path + /// Indicate sif the folder is to recursively scanned. Default value: true + /// + /// This function requests to scan a media folder to the media server with given completed callback function. + /// The sub folders are also scanned,if there are sub folders in that folder. + /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder. + /// + /// Task with scanning result + public static Task ScanFolderAsync(string folderPath, bool recursive = true) + { + var task = new TaskCompletionSource(); + + Interop.Content.MediaScanCompletedCallback scanCompleted = (MediaContentError scanResult, IntPtr data) => + { + MediaContentValidator.ThrowIfError(scanResult, "Failed to scan"); + task.SetResult(scanResult); + }; + + MediaContentValidator.ThrowIfError( + Interop.Content.ScanFolder(folderPath, recursive, scanCompleted, IntPtr.Zero), "Failed to scan"); + + return task.Task; + } + + internal static Interop.Content.MediaScanCompletedCallback scanCompletedWithToken = null; + internal static Object l = new Object(); + /// + /// Requests to scan a media folder, asynchronously. + /// + /// 3 + /// The folder path + /// Cancellation token required to cancel the current scan + /// Indicate sif the folder is to recursively scanned. Default value: true + /// + /// This function requests to scan a media folder to the media server with given completed callback function. + /// The sub folders are also scanned,if there are sub folders in that folder. + /// If any folder must not be scanned, a blank file ".scan_ignore" has to be created in that folder. + /// + /// Task with scanning result + public static Task ScanFolderAsync(string folderPath, CancellationToken cancellationToken, bool recursive = true) + { + var task = new TaskCompletionSource(); + bool taskCompleted = false; + + cancellationToken.Register(() => + { + lock (l) + { + if (!taskCompleted) + { + taskCompleted = true; + MediaContentValidator.ThrowIfError( + Interop.Content.CancelScanFolder(folderPath), "Failed CancelScanFolder"); + + task.SetCanceled(); + } + } + }); + scanCompletedWithToken = (MediaContentError scanResult, IntPtr data) => + { + lock (l) + { + if (!taskCompleted) + { + taskCompleted = true; + MediaContentValidator.ThrowIfError(scanResult, "Failed scan"); + task.SetResult((int)scanResult); + } + } + }; + + MediaContentValidator.ThrowIfError( + Interop.Content.ScanFolder(folderPath, recursive, scanCompletedWithToken, IntPtr.Zero), "Failed to scan"); + + return task.Task; + + } + + /// + /// Inserts media files into the media database, asynchronously. + /// + /// 3 + /// The path array to the media files + /// + /// Task with the result of batch insertion + /// + public static Task AddMediaInformationBatchAsync(IEnumerable filePaths) + { + var task = new TaskCompletionSource(); + string[] paths = ((List)filePaths).ToArray(); + Interop.MediaInformation.MediaInsertCompletedCallback callback = (MediaContentError error, IntPtr userData) => + { + MediaContentValidator.ThrowIfError(error, "Failed to batch insert"); + task.SetResult((int)error); + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.BatchInsert(paths, paths.Length, callback, IntPtr.Zero), "Failed to add batch media"); + + return task.Task; + } + + /// + /// Inserts the burst shot images into the media database, asynchronously. + /// + /// 3 + /// The path array to the burst shot images + /// + /// Task with the result of the burstshot insertion + /// + public static Task AddBurstShotImagesAsync(IEnumerable filePaths) + { + var task = new TaskCompletionSource(); + string[] paths = ((List)filePaths).ToArray(); + Interop.MediaInformation.MediaInsertBurstShotCompletedCallback callback = (MediaContentError error, IntPtr userData) => + { + MediaContentValidator.ThrowIfError(error, "Failed to add burstshot"); + task.SetResult((int)error); + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.BurstShotInsert(paths, paths.Length, callback, IntPtr.Zero), "Failed to add burst shots to db"); + + return task.Task; + } + + /// + /// Deletes media files from the media database. The media files for deletion can be specified as a condition in a filter. + /// This function deletes the media items from the content storage.Normally, deleting media files in the database are done automatically by the media server, + /// without calling this function.This function is only called when the media server is busy and user needs to get quick result of deleting. + /// + /// 3 + /// The content filter to which media will be matched + public static void RemoveMediaInformationBatch(ContentFilter filter) + { + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.BatchDelete(handle), "Failed to remove items"); + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceRect.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceRect.cs new file mode 100755 index 0000000..93298a9 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/FaceRect.cs @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +namespace Tizen.Content.MediaContent +{ + /// + /// FaceRect represents a rectangle dimension to create a Face in an image. + /// It is used to create or tag a MediaFace in an image file. + /// + public class FaceRect + { + public FaceRect(int x, int y, int width, int height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + /// + /// X coordinate of the FaceRect + /// + /// 3 + public readonly int X; + + /// + /// Y coordinate of the FaceRect + /// + /// 3 + public readonly int Y; + + /// + /// Width of the FaceRect + /// + /// 3 + public readonly int Width; + + /// + /// Height of the FaceRect + /// + /// 3 + public readonly int Height; + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Group.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Group.cs new file mode 100755 index 0000000..d037f3b --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Group.cs @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// A Media Group represents logical grouping of media files with respect to their group name. + /// It is also used for filtering media items. + /// + public class Group : ContentCollection + { + private readonly string _groupName; + private readonly MediaGroupType _groupType; + private bool _disposedValue = false; + + /// + /// The name of the media group + /// + /// 3 + public string Name + { + get { return _groupName; } + } + + internal Group(string name, MediaGroupType groupType) + { + _groupName = name; + _groupType = groupType; + } + + public override void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + _disposedValue = true; + } + } + + /// + /// Gets the count of the media info for the given media group present in the media database. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Group.GetMediaCountFromDb(Name, _groupType, handle, out mediaCount), "Failed to GetMediaCountFromDb"); + + return mediaCount; + } + + + /// + /// Iterates through the media files with an optional filter in the given group from the media database. + /// This function gets all media files associated with the given group and meeting desired filter option. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.Group.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone MediaInformation instance"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Group.ForeachMediaFromDb(Name, _groupType, handle, callback, IntPtr.Zero), "Failed to get media information for the group"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs new file mode 100755 index 0000000..e6922d3 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/ImageInformation.cs @@ -0,0 +1,347 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MediaContent +{ + /// + /// ImageContent class API gives the information related to the image media stored in the device + public class ImageInformation : MediaInformation + { + private readonly Interop.ImageInformation.SafeImageInformationHandle _handle; + + /// + /// Gets the id of the media. + /// + /// 3 + public string MediaId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetMediaId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the image width in pixels. + /// + /// 3 + public int Width + { + get + { + int width = 0; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetWidth(_handle, out width), "Failed to get value"); + + return width; + } + } + + /// + /// Gets the image height in pixels. + /// + /// 3 + public int Height + { + get + { + int height = 0; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetHeight(_handle, out height), "Failed to get value"); + + return height; + } + } + + /// + /// Image orientation. + /// + /// 3 + public MediaContentOrientation Orientation + { + get + { + MediaContentOrientation orientation = MediaContentOrientation.NotAvailable; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetOrientation(_handle, out orientation), "Failed to get value"); + + return orientation; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.SetOrientation(_handle, value), "Failed to set value"); + } + } + + /// + /// Gets the image creation time in seconds, since the Epoch. + /// + /// 3 + public string TakenDate + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetDateTaken(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the burst shot ID. + /// If BurstId is null, this is not a burst shot + /// + /// 3 + public string BurstId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetBurstId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the exposure time from exif. + /// + /// 3 + public string ExposureTime + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetExposureTime(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the fnumber from exif. + /// + /// 3 + public double FNumber + { + get + { + double fNumber = 0.0; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetFNumber(_handle, out fNumber), "Failed to get value"); + + return fNumber; + } + } + + /// + /// Gets the iso from exif. + /// + /// 3 + public int Iso + { + get + { + int iso = 0; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetISO(_handle, out iso), "Failed to get value"); + + return iso; + } + } + + /// + /// Gets the model from exif. + /// + /// 3 + public string Model + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.GetModel(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Checks whether the media is a burst shot image. + /// The value is true if the media is a burst shot image, + /// otherwise false if the media is not a burst shot image. + /// + /// 3 + public bool IsBurstShot + { + get + { + bool isBurst = false; + MediaContentValidator.ThrowIfError( + Interop.ImageInformation.IsBurstShot(_handle, out isBurst), "Failed to get value"); + + return isBurst; + } + } + + /// + /// Iterates through the media faces with filter in the given media file from the media database. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// + /// Task to get all the MediaFaces + /// filter for the Tags + public IEnumerable GetMediaFaces(ContentFilter filter) + { + Collection coll = new Collection(); + + Interop.MediaInformation.MediaFaceCallback callback = (IntPtr faceHandle, IntPtr userData) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Face.Clone(out newHandle, faceHandle), "Failed to clone Tag"); + + coll.Add(new MediaFace(newHandle)); + return true; + }; + IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAllFaces(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value"); + + return coll; + } + + /// + /// Gets the number of faces for the passed filter in the given media ID from the media database. + /// + /// 3 + /// + /// int count + /// The Filter for matching Face + public int GetMediaFaceCount(ContentFilter filter) + { + int count = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetFaceCount(MediaId, handle, out count), "Failed to get value"); + + return count; + } + + + /// + /// Inserts a MediaFace item to the media database + /// + /// 3 + /// The image on which face is to be added + /// The dimensions of the face + /// The MediaFace instance + public MediaFace AddFace(ImageInformation image, FaceRect rect) + { + MediaFace face = new MediaFace(image, rect); + ContentManager.Database.Insert(face); + return face; + } + + /// + /// Deletes the MediaFace from the media database. + /// + /// 3 + /// The face instance to be deleted + public void DeleteFace(MediaFace face) + { + ContentManager.Database.Delete(face); + } + + /// + /// Updates the MediaFace in the media database + /// + /// 3 + /// The MediaFace object to be updated + public void UpdateFace(MediaFace face) + { + ContentManager.Database.Update(face); + } + + internal IntPtr ImageHandle + { + get + { + return _handle.DangerousGetHandle(); + } + } + + internal ImageInformation(Interop.ImageInformation.SafeImageInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle) + : base(mediaInformationHandle) + { + _handle = handle; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs new file mode 100755 index 0000000..07e14bb --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaBookmark.cs @@ -0,0 +1,129 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MediaContent +{ + /// + /// A MediaBookmark allows you to mark interesting moment in a media(video and audio) to enable fast searching. + /// The MediaBookmark Information API provides functions to get information about bookmarks associated with video and audio items. + /// + public class MediaBookmark : IDisposable + { + private IntPtr _bookmarkHandle = IntPtr.Zero; + private bool _disposedValue = false; + + private IntPtr Handle + { + get + { + if (_bookmarkHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(MediaBookmark)); + } + + return _bookmarkHandle; + } + } + internal MediaBookmark(IntPtr handle) + { + _bookmarkHandle = handle; + } + + ~MediaBookmark() + { + Dispose(false); + } + /// + /// The media bookmark ID + /// + /// 3 + public int Id + { + get + { + int id; + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.GetBookmarkId(Handle, out id), "Failed to get bookmark id"); + + return id; + } + } + + /// + /// The thumbnail path of media bookmark + /// + /// 3 + public string ThumbnailPath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.GetThumbnailPath(Handle, out val), "Failed to get bookmark thumbnail"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The bookmark time offset (in milliseconds) + /// + /// 3 + public uint Offset + { + get + { + uint offset; + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.GetMarkedTime(Handle, out offset), "Failed to get bookmarked time"); + + return offset; + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (_bookmarkHandle != IntPtr.Zero) + { + Interop.MediaBookmark.Destroy(_bookmarkHandle); + _bookmarkHandle = IntPtr.Zero; + } + + _disposedValue = true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentEnums.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentEnums.cs new file mode 100755 index 0000000..2c59329 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentEnums.cs @@ -0,0 +1,411 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +namespace Tizen.Content.MediaContent +{ + /// + /// Enumeration for ordering + /// + /// 3 + public enum ContentOrder + { + /// + /// Ascending order + /// + /// 3 + Asc, + /// + /// Descending order + /// + /// 3 + Desc + } + + /// + /// Enumeration for collations. + /// + /// 3 + public enum ContentCollation + { + /// + /// Default collation BINARY + /// + /// 3 + Default, + /// + /// Collation NOCASE, not case sensitive + /// + /// 3 + Nocase, + /// + /// Collation RTRIM, trailing space characters are ignored + /// + /// 3 + Rtim, + /// + /// Collation LOCALIZATION, NOCASE also applied + /// + /// 3 + Localized + } + + /// + /// Enumeration for a media group. + /// + /// 3 + public enum MediaGroupType + { + /// + /// Media group ID for display name + /// + /// 3 + DisplayName, + /// + /// Media group ID for a media type + /// + /// 3 + Type, + /// + /// Media group ID for a mime type + /// + /// 3 + MimeType, + /// + /// Media group ID for content size + /// + /// 3 + Size, + /// + /// Media group ID for the added time + /// + /// 3 + AddedTime, + /// + /// Media group ID for the modified time + /// + /// 3 + ModifiedTime, + /// + /// Media group ID for a content title + /// + /// 3 + Title, + /// + /// Media group ID for an artist + /// + /// 3 + Artist, + /// + /// Media group ID for an album artist + /// + /// 3 + AlbumArtist, + /// + /// Media group ID for a genre + /// + /// 3 + Genre, + /// + /// Media group ID for a composer + /// + /// 3 + Composer, + /// + /// Media group ID for a year + /// + /// 3 + Year, + /// + /// Media group ID for the recorded date + /// + /// 3 + RecordedDate, + /// + /// Media group ID for the copyright + /// + /// 3 + Copyright, + /// + /// Media group ID for a track number + /// + /// 3 + Tracknum, + /// + /// Media group ID for a description + /// + /// 3 + Description, + /// + /// Media group ID for the longitude + /// + /// 3 + Longitude, + /// + /// Media group ID for the latitude + /// + /// 3 + Latitude, + /// + /// Media group ID for the altitude + /// + /// 3 + Altitude, + /// + /// Media group ID for the burst shot + /// + /// 3 + BurstImage, + /// + /// Media group ID for a rating + /// + /// 3 + Rating, + /// + /// Media group ID for an author + /// + /// 3 + Author, + /// + /// Media group ID for a provide + /// + /// 3 + Provider, + /// + /// Media group ID for the content name + /// + /// 3 + ContentName, + /// + /// Media group ID for a category + /// + /// 3 + Category, + /// + /// Media group ID for a location tag + /// + /// 3 + LocationTag, + /// + /// Media group ID for an age rating + /// + /// 3 + AgeRating, + /// + /// Media group ID for a keyword + /// + /// 3 + Keyword, + /// + /// Media group ID for the weather + /// + /// 3 + Weather, + /// + /// Invalid media group ID + /// + /// 3 + Max + } + + /// + /// Enum to give the type of storage. + /// + /// 3 + public enum ContentStorageType : int + { + /// + /// The device's internal storage + /// + /// 3 + Internal = 0, + /// + /// The device's external storage like sd card + /// + /// 3 + External = 1, + /// + /// The external USB storage + /// + /// 3 + ExternalUSB = 2 + }; + + /// + /// Enums for media database update type + /// + /// 3 + public enum MediaContentDBUpdateType + { + /// + /// Updating the database with inserts. + /// + /// 3 + Insert, + /// + /// Updating the database with removes. + /// + /// 3 + Delete, + /// + /// Updating the database with updates. + /// + /// 3 + Update + } + + /// + /// Enums for the type of item updated in media database + /// + /// 3 + public enum MediaContentUpdateItemType + { + /// + /// The file information is updated. + /// + /// 3 + File, + /// + /// The folder information and the file information included in the folder are updated. + /// + /// 3 + Directory + } + + /// + /// Enums for content collection types + /// + /// 3 + public enum ContentCollectionType + { + /// + ///Content Collection type folder + /// + /// 3 + Folder, + /// + ///Content Collection type storage + /// + /// 3 + Storage, + /// + /// Content Collection type album + /// + /// 3 + Album, + /// + ///Content Collection type playlist + /// + /// 3 + PlayList, + /// + ///Content Collection type tag + /// + /// 3 + Tag, + /// + ///Content Collection type group + /// + /// 3 + Group + } + /// + /// Enum to give the type of media information. + /// + /// 3 + public enum MediaContentType : int + { + /// + /// The type of an image. + /// + /// 3 + Image = 0, + /// + /// The type of a video. + /// + /// 3 + Video = 1, + /// + /// The type of sound. + /// + /// 3 + Sound = 2, + /// + /// The type of music. + /// + /// 3 + Music = 3, + /// + /// The type of other. + /// + /// 3 + Others = 4 + }; + + /// + /// Enum to give the orientation type of the media. + /// + /// 3 + public enum MediaContentOrientation : int + { + /// + /// Not available. + /// + /// 3 + NotAvailable = 0, + /// + /// Normal. + /// + /// 3 + Normal = 1, + /// + /// Flip horizontal. + /// + /// 3 + HFlip = 2, + /// + /// Rotate 180 degrees. + /// + /// 3 + Rot180 = 3, + /// + /// Flip vertical. + /// + /// 3 + VFlip = 4, + /// + /// Transpose. + /// + /// 3 + Transpose = 5, + /// + /// Rotate 90 degrees. + /// + /// 3 + Rot90 = 6, + /// + /// Transverse. + /// + /// 3 + Transverse = 7, + /// + /// Rotate 270 degrees. + /// + /// 3 + Rot270 = 8 + }; +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs new file mode 100755 index 0000000..421c370 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaContentError.cs @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Content.MediaContent +{ + /// + /// Enumeration for media content's error code + /// + /// 3 + /// error occurs when the device does not support the function. + public enum MediaContentError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidOperation = ErrorCode.InvalidOperation, + FileNoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + TizenMediaContentError = -0x01610000, + DatabaseFailed = TizenMediaContentError | 0x01, + DatabaseBusy = TizenMediaContentError | 0x02, + NetworkFailed = TizenMediaContentError | 0x03, + UnsupportedContent = TizenMediaContentError | 0x04, + NotSupported = ErrorCode.NotSupported, + } + + internal class MediaContentValidator + { + internal const string LogTag = "Tizen.Content.MediaContent"; + + internal static void ThrowIfError(MediaContentError err, string msg) + { + switch (err) + { + case MediaContentError.InvalidParameter: + throw new ArgumentException(msg); + case MediaContentError.OutOfMemory: + throw new OutOfMemoryException(msg); + case MediaContentError.InvalidOperation: + throw new InvalidOperationException(msg); + case MediaContentError.FileNoSpaceOnDevice: + throw new IOException(msg); + case MediaContentError.PermissionDenied: + throw new UnauthorizedAccessException(msg); + case MediaContentError.DatabaseFailed: + throw new InvalidOperationException("[DB Failed]" + msg); + case MediaContentError.DatabaseBusy: + throw new InvalidOperationException("[DB Busy]" + msg); + case MediaContentError.NetworkFailed: + throw new InvalidOperationException("[Network Error]" + msg); + case MediaContentError.UnsupportedContent: + throw new PlatformNotSupportedException(msg); + } + } + + internal static string CheckString(string value) + { + return (value != null) ? value : ""; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs new file mode 100755 index 0000000..134ab1f --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFace.cs @@ -0,0 +1,226 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MediaContent +{ + /// + /// The Media Face Information API provides functions to manage the face information in the image files. + /// + public class MediaFace : IDisposable + { + private IntPtr _faceHandle = IntPtr.Zero; + private bool _disposedValue = false; + internal IntPtr Handle + { + get + { + if (_faceHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(MediaFace)); + } + + return _faceHandle; + } + } + + + internal MediaFace(IntPtr handle) + { + _faceHandle = handle; + } + + /// + /// Create Face for Given Image + /// + /// 3 + /// + ///image item through which FaceRect has to be tagged. + /// + ///Position about the detacted face in the media + internal MediaFace(MediaInformation image, FaceRect rect) + { + MediaContentValidator.ThrowIfError( + Interop.Face.Create(image.MediaId, out _faceHandle), "Failed to create MediaFace"); + + try + { + MediaContentValidator.ThrowIfError( + Interop.Face.SetFaceRect(Handle, rect.X, rect.Y, rect.Width, rect.Height), "Failed to set Rect to MediaFace"); + } + catch (Exception) + { + Interop.Face.Destroy(_faceHandle); + throw; + } + } + + ~MediaFace() + { + Dispose(false); + } + + /// + /// The Media Face Information API provides functions to manage the face information in the image files. + /// + /// 3 + public FaceRect Rect + { + get + { + int x; + int y; + int width; + int height; + MediaContentValidator.ThrowIfError( + Interop.Face.GetFaceRect(Handle, out x, out y, out width, out height), "Failed to get Rect for the Face"); + + return new FaceRect(x, y, width, height); + } + + set + { + FaceRect rect = (FaceRect)value; + MediaContentValidator.ThrowIfError( + Interop.Face.SetFaceRect(Handle, rect.X, rect.Y, rect.Width, rect.Height), "Failed to set Rect for the Face"); + } + } + + /// + /// Face id. + /// + /// 3 + public string Id + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Face.GetFaceId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Media uuid from the face + /// + /// 3 + public string MediaInformationId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Face.GetMediaId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + /// + /// Tag name for the MediaFace. + /// + /// 3 + public string Tag + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Face.GetTag(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Face.SetTag(Handle, value), "Failed to set value"); + } + } + + /// + /// Orientation Value for the face + /// + /// 3 + public MediaContentOrientation Orientation + { + get + { + int orientation; + MediaContentValidator.ThrowIfError( + Interop.Face.GetOrientation(Handle, out orientation), "Failed to value"); + + return (MediaContentOrientation)orientation; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Face.SetOrientation(Handle, (int)value), "Failed to set value"); + } + } + + /// + /// Dispose API for closing the internal resources. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (_faceHandle != IntPtr.Zero) + { + Interop.Face.Destroy(_faceHandle); + _faceHandle = IntPtr.Zero; + } + + _disposedValue = true; + } + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs new file mode 100755 index 0000000..af120ca --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaFolder.cs @@ -0,0 +1,330 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// A Folder is used to organize media content files i.e. image, audio, video files, in the physical storage of the device. + /// The Media Folder API provides functions to get basic information about existing folders e.g. folder name, path and storage type. + /// It also provides functions to get information related to media items present in the folder. + /// + public class MediaFolder : ContentCollection + { + private IntPtr _folderHandle = IntPtr.Zero; + private bool _disposedValue = false; + internal IntPtr Handle + { + get + { + if (_folderHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(MediaFolder)); + } + + return _folderHandle; + } + } + /// + /// The ID of the media folder. For each MediaFolder this id is unique. + /// + /// 3 + public string Id + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetFolderId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// ParentId of the MediaFolder that is the ID of the upper media folder (parent folder). + /// + /// 3 + public string ParentId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetParentFolderId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The path of the media folder + /// + /// 3 + public string FolderPath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetPath(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The name of the media folder + /// + /// 3 + public string Name + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetName(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Folder.SetName(Handle, value), "Failed to set value"); + } + } + + /// + /// The storage type of the media folder. + /// Storage types give information about the location of storage like Internal memory, USB or External Storage etc... + /// + /// 3 + public ContentStorageType StorageType + { + get + { + ContentStorageType type; + MediaContentValidator.ThrowIfError( + Interop.Folder.GetStorageType(Handle, out type), "Failed to get value"); + + return type; + } + } + + /// + /// The storage id of the media folder + /// + /// 3 + public string StorageId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Folder.GetStorageId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The modified date of the media folder + /// + /// 3 + public DateTime ModifiedTime + { + get + { + DateTime date; + MediaContentValidator.ThrowIfError( + Interop.Folder.GetModifiedTime(Handle, out date), "Failed to get value"); + + return date; + } + } + + /// + /// The folder order value. Get/Set the folder viewing order. + /// Default Order value is zero. + /// If you set the order value for each folder, you can sort in ascending or descending order as the set order values using the filter. + /// + /// 3 + public int Order + { + get + { + int order; + MediaContentValidator.ThrowIfError( + Interop.Folder.GetOrder(Handle, out order), "Failed to get value"); + + return order; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Folder.SetOrder(Handle, value), "Failed to set value"); + } + } + + internal MediaFolder(IntPtr handle) + { + _folderHandle = handle; + } + + /// + /// Gets the count of media files for the passed filter in the given folder from the media database. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from teh media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Folder.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count"); + + return mediaCount; + } + + ~MediaFolder() + { + Dispose(false); + } + + public override void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (_folderHandle != IntPtr.Zero) + { + Interop.Folder.Destroy(_folderHandle); + _folderHandle = IntPtr.Zero; + } + + _disposedValue = true; + } + } + + /// + /// Iterates through the media files with an filter in the given folder from the media database. + /// This function gets all media files associated with the given folder and meeting desired filter option. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + + Interop.Folder.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Folder.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs new file mode 100755 index 0000000..49b1788 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/MediaInformation.cs @@ -0,0 +1,897 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// MediaContent class API gives the information related to the media stored in the device + /// + /// The API's provide the functionlity to insert, clone, delete, get the number and content of files from DB. + /// You can get and set properties and parameters such as storage type, provider, and category of media info, + /// handling with thumbnail and updating media info to DB. + public class MediaInformation + { + private readonly Interop.MediaInformation.SafeMediaInformationHandle _handle; + + /// + /// Gets the count of media tags for the passed filter in the given mediaId from the media database. + /// + /// 3 + /// + /// int count + /// The Filter for matching Tags + public int GetTagCount(ContentFilter filter) + { + int count = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetTagCount(MediaId, handle, out count), "Failed to get count"); + + return count; + } + + /// + /// Moves the media info to the given destination path in the media database. + /// + /// 3 + /// + /// void + /// The Destination path + public void Move(string destination) + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.MoveToDB(_handle, destination), "Failed to move"); + } + + /// + /// Refreshes the media metadata to the media database. + /// + /// 3 + /// + /// void + public void Refresh() + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.RefreshMetadataToDB(MediaId), "Failed to refresh"); + } + + /// + /// Creates a thumbnail image for the given media, asynchronously + /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned. + /// + /// 3 + /// + /// Task for creation of Thumbnail + public Task CreateThumbnailAsync() + { + var task = new TaskCompletionSource(); + Interop.MediaInformation.MediaThumbnailCompletedCallback thumbnailResult = (MediaContentError createResult, string path, IntPtr userData) => + { + if (createResult != MediaContentError.None) + { + task.SetException(new InvalidOperationException("Failed to create thumbnail:" + createResult)); + } + + task.SetResult(path); + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.CreateThumbnail(_handle, thumbnailResult, IntPtr.Zero), "Failed to create thumbnail"); + + return task.Task; + } + + /// + /// Creates a thumbnail image for the given media, asynchronously + /// which can be cancelled + /// If a thumbnail already exists for the given media, then the path of thumbnail will be returned. + /// + /// 3 + /// Token to cancel the requested operation + /// + /// Task for creation of Thumbnail + /// + public Task CreateThumbnailAsync(CancellationToken cancellationToken) + { + var task = new TaskCompletionSource(); + cancellationToken.Register(() => + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.CancelThumbnail(_handle), "Failed to cancel"); + + task.SetCanceled(); + }); + + Interop.MediaInformation.MediaThumbnailCompletedCallback thumbnailResult = (MediaContentError createResult, string path, IntPtr userData) => + { + if (createResult != MediaContentError.None) + { + task.SetException(new InvalidOperationException("Failed to create thumbnail:" + createResult)); + } + + task.SetResult(path); + }; + + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.CreateThumbnail(_handle, thumbnailResult, IntPtr.Zero), "Failed to create thumbnail"); + + return task.Task; + } + + /// + /// Iterates through the media tag in the given media info from the media database. + /// + /// 3 + /// + /// Task to get all the Tags + /// The filter for the Tags + public IEnumerable GetTags(ContentFilter filter) + { + Collection coll = new Collection(); + + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.MediaInformation.MediaTagCallback tagsCallback = (IntPtr tagHandle, IntPtr userData) => + { + IntPtr newHandle; + MediaContentValidator.ThrowIfError( + Interop.Tag.Clone(out newHandle, tagHandle), "Failed to clone"); + coll.Add(new Tag(newHandle)); + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAllTags(MediaId, handle, tagsCallback, IntPtr.Zero), "Failed to get information"); + + return coll; + } + + /// + /// Gets the ID of the media. + /// + /// 3 + public virtual string MediaId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetMediaId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the path to the media. + /// + /// 3 + public string FilePath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetFilePath(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Name of the media. + /// + /// 3 + public string DisplayName + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetDisplayName(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetDisplayName(_handle, value), "failed to set value"); + } + } + + /// + /// Gets the content type of the media. + /// + /// 3 + public MediaContentType MediaType + { + get + { + MediaContentType contentType = MediaContentType.Others; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetMediaType(_handle, out contentType), "Failed to get value"); + + return contentType; + } + } + + /// + /// Gets the MIME type from the media. + /// + /// 3 + public string MimeType + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetMimeType(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the media file size in bytes. + /// + /// 3 + public long Size + { + get + { + long size; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetSize(_handle, out size), "Failed to get value"); + + return size; + } + } + + /// + /// Addition time of the media. + /// + /// 3 + public DateTime AddedAt + { + get + { + int time; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAddedTime(_handle, out time), "Failed to get value"); + + DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc); + + return utc.ToLocalTime(); + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetAddedTime(_handle, (int)value.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds), "failed to set time"); + } + } + + /// + /// Gets the date of modification of media. + /// + /// 3 + public DateTime ModifiedAt + { + get + { + int time; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetModifiedTime(_handle, out time), "Failed to get value"); + + DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc); + + return utc.ToLocalTime(); + } + } + + /// + /// Gets the timeline of media. + /// + /// 3 + public DateTime TimeLine + { + get + { + int time; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetTimeline(_handle, out time), "Failed to get value"); + + DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc); + + return utc.ToLocalTime(); + } + } + + /// + /// Gets the thumbnail of media. + /// + /// 3 + public string ThumbnailPath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetThumbnailPath(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Description of media. + /// If the media info has no description, the property returns empty string. + /// + /// 3 + public string Description + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetDescription(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetDescription(_handle, value), "failed to set value"); + } + } + + /// + /// Longitude of media. + /// Default Value is 0.0. + /// + /// 3 + public double Longitude + { + get + { + double longitude = 0.0; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetLongitude(_handle, out longitude), "Failed to get value"); + + return longitude; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetLongitude(_handle, value), "failed to set value"); + } + } + + /// + /// Latitude of media. + /// Default Value is 0.0. + /// + /// 3 + public double Latitude + { + get + { + double latitude = 0.0; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetLatitude(_handle, out latitude), "Failed to get value"); + + return latitude; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetLatitude(_handle, value), "failed to set value"); + } + } + + /// + /// Altitude of media. + /// Default Value is 0.0. + /// + /// 3 + public double Altitude + { + get + { + double altitude = 0.0; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAltitude(_handle, out altitude), "Failed to get value"); + + return altitude; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetAltitude(_handle, value), "failed to set value"); + } + } + + /// + /// Weather information of media. + /// + /// 3 + public string Weather + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetWeather(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetWeather(_handle, value), "failed to set value"); + } + } + + /// + /// Rating of media. + /// + /// 3 + public int Rating + { + get + { + int rating = 0; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetRating(_handle, out rating), "Failed to get value"); + return rating; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetRating(_handle, value), "failed to set value"); + } + } + + /// + /// Favorite status of media. + /// true if media info is set as favorite, otherwise false if media info is not set as favorite. + /// + /// 3 + public bool IsFavourite + { + get + { + bool isFavourtite = false; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetFavorite(_handle, out isFavourtite), "Failed to get value"); + + return isFavourtite; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetFavorite(_handle, value), "failed to set value"); + } + } + + /// + /// Author of media. + /// + /// 3 + public string Author + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAuthor(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetAuthor(_handle, value), "failed to set value"); + } + } + + /// + /// Provider of media. + /// + /// 3 + public string Provider + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetProvider(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetProvider(_handle, value), "failed to set value"); + } + } + + /// + /// Content name of media. + /// + /// 3 + public string ContentName + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetContentName(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetContentName(_handle, value), "failed to set value"); + } + } + + /// + /// Gets the title of media. + /// If the media content has no title, the property returns empty string. + /// + /// 3 + public string Title + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetTitle(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Category of media. + /// + /// 3 + public string Category + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetCategory(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetCategory(_handle, value), "failed to set value"); + } + } + + /// + /// location tag of media. + /// + /// 3 + public string LocationTag + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetLocationTag(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetLocationTag(_handle, value), "failed to set value"); + } + } + + /// + /// Age Rating of media. + /// + /// 3 + public string AgeRating + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAgeRating(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetAgeRating(_handle, value), "Failed to set value"); + } + } + + /// + /// Keyword of media. + /// + /// 3 + public string Keyword + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetKeyword(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetKeyword(_handle, value), "failed to set value"); + } + } + + /// + /// Gets the storage id of media. + /// + /// 3 + public string StorageId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetStorageId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Checks whether the media is protected via DRM. + /// + /// 3 + public bool IsDrm + { + get + { + bool isDRM = false; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.IsDrm(_handle, out isDRM), "Failed to get value"); + + return isDRM; + } + } + + /// + /// Gets the storage type of media. + /// + /// 3 + public ContentStorageType StorageType + { + get + { + ContentStorageType storageType = ContentStorageType.Internal; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetStorageType(_handle, out storageType), "Failed to get value"); + + return storageType; + } + } + + /// + /// Number which represents how many times given content has been played. + /// While Setting the played count, it will only be incremented by 1, the value provided will be ignored. + /// + /// 3 + public int PlayedCount + { + get + { + int playedCount = 0; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetPlayedCount(_handle, out playedCount), "Failed to get value"); + + return playedCount; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.IncreasePlayedCount(_handle), "failed to set value"); + } + } + + /// + /// Content's latest played(opened) time of the media file. + /// for set the current time is automatically taken from the system, the value provided will be ignored. + /// + /// 3 + public DateTime PlayedAt + { + get + { + int time; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetPlayedAt(_handle, out time), "Failed to get value"); + + DateTime utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc); + + return utc.ToLocalTime(); + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.SetPlayedAt(_handle), "failed to set value"); + } + } + + internal IntPtr MediaHandle + { + get + { + return _handle.DangerousGetHandle(); + } + } + + internal MediaInformation(Interop.MediaInformation.SafeMediaInformationHandle handle) + { + _handle = handle; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs new file mode 100755 index 0000000..e440707 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/PlayList.cs @@ -0,0 +1,341 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// The PlayList API provides functions to manage media playlists. + /// + /// + /// A PlayList is a list of songs which can be played in some sequence i.e. sequential or shuffled order. + /// The Media PlayList API provides functions to insert, delete or updates a media playlist in the database. + /// + public class PlayList : ContentCollection + { + private readonly IDictionary _dictionary = new Dictionary(); + private IntPtr _playlistHandle = IntPtr.Zero; + internal IntPtr Handle + { + get + { + if (_playlistHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(PlayList)); + } + + return _playlistHandle; + } + + set + { + _playlistHandle = value; + } + } + + private void RefreshPlaylistDictionary() + { + _dictionary.Clear(); + Interop.Playlist.PlaylistMemberCallback callback = (int memberId, IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media"); + + Interop.MediaInformation.GetMediaId(newHandle, out val); + _dictionary.Add(Marshal.PtrToStringAnsi(val), memberId); + return true; + } + finally + { + Interop.Libc.Free(val); + } + }; + MediaContentValidator.ThrowIfError( + Interop.Playlist.ForeachMediaFromDb(Id, IntPtr.Zero, callback, IntPtr.Zero), "Failed to get playlist items"); + } + + /// + /// The ID of the media playlist + /// + /// 3 + public int Id + { + get + { + int id; + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetPlaylistId(Handle, out id), "Failed to get value"); + + return id; + } + } + + internal string _playListName; + /// + /// The playlist name + /// + /// 3 + public string Name + { + get + { + return _playListName; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.SetName(Handle, value), "Failed to set value"); + _playListName = value; + } + } + /// + /// The path of the thumbnail + /// + /// 3 + public string ThumbnailPath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetThumbnailPath(Handle, out val), "Failed to get value"); + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.SetThumbnailPath(Handle, value), "Failed to set value"); + } + } + + /// + /// The constructor to create a new playlist with the given name in the media database. + /// + /// 3 + /// The name of the inserted playlist + public PlayList(string name) + { + _playListName = name; + } + + internal PlayList(IntPtr handle) + { + _playlistHandle = handle; + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetName(handle, out val), "Failed to get value"); + _playListName = Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + /// + /// Adds a new media info to the playlist. + /// + /// 3 + /// The AudioContent obect to be added + public void AddItem(MediaInformation mediaContent) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.AddMedia(Handle, mediaContent.MediaId), "Failed to add item"); + } + + /// + /// Removes the playlist members related with the media from the given playlist. + /// + /// 3 + /// The AudioContent object to be removed + public void RemoveItem(MediaInformation media) + { + int memberId = 0; + RefreshPlaylistDictionary(); + _dictionary.TryGetValue(media.MediaId, out memberId); + MediaContentValidator.ThrowIfError( + Interop.Playlist.RemoveMedia(Handle, memberId), "Failed to remove item"); + } + + /// + /// Sets the playing order in the playlist. + /// + /// 3 + /// The playlist reference + /// The playing order + public void SetPlayOrder(MediaInformation media, int playOrder) + { + int memberId; + RefreshPlaylistDictionary(); + _dictionary.TryGetValue(media.MediaId, out memberId); + MediaContentValidator.ThrowIfError( + Interop.Playlist.SetPlayOrder(Handle, memberId, playOrder), "Failed to set play order"); + } + + /// + /// Gets the playing order in the playlist for the passed member id. + /// + /// 3 + /// The MediaInformation instance + /// The number of play order + public int GetPlayOrder(MediaInformation media) + { + int playOrder; + int memberId; + RefreshPlaylistDictionary(); + _dictionary.TryGetValue(media.MediaId, out memberId); + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetPlayOrder(Handle, memberId, out playOrder), "Failed to get play order"); + + return playOrder; + } + + /// + /// Imports the playlist from m3u playlist file. + /// + /// 3 + /// The name of the playlist to save + /// The path to import the playlist file + /// The imported PlayList object + public static PlayList Import(string name, string filePath) + { + PlayList playList = null; + IntPtr playlistHandle; + + MediaContentValidator.ThrowIfError( + Interop.Playlist.ImportFromFile(name, filePath, out playlistHandle), "Failed to import"); + + playList = new PlayList(name); + playList.Handle = playlistHandle; + return playList; + } + + /// + /// Exports the playlist to m3u playlist file. + /// + /// 3 + /// The playlist instance to export + /// The path to save exported playlist + /// path The path to export the playlist + public static void Export(PlayList list, string filePath) + { + MediaContentValidator.ThrowIfError( + Interop.Playlist.ExportToFile(list.Handle, filePath), "Failed to export playlist:" + filePath); + } + + /// + /// Gets the number of the media info for the given playlist present in the media database. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Playlist.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get media count"); + + return mediaCount; + } + + public override void Dispose() + { + if (_playlistHandle != IntPtr.Zero) + { + Interop.Playlist.Destroy(_playlistHandle); + _playlistHandle = IntPtr.Zero; + } + } + + /// + /// Iterates through the media files with an optional filter in the given audio playlist from the media database. + /// This function gets all media files associated with the given media playlist and meeting desired filter option. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.Playlist.PlaylistMemberCallback callback = (int memberId, IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Playlist.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get media information"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs new file mode 100755 index 0000000..b6935ef --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Storage.cs @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// A Storage allows you to manage external storage. + /// The system generates the storage id when the external storage is added.And the system manages the media information in each of the storage by using storage id. + /// So you can get the information from the storage that you want to view. + /// + public class Storage : ContentCollection + { + private IntPtr _storageHandle = IntPtr.Zero; + private IntPtr Handle + { + get + { + if (_storageHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(Storage)); + } + + return _storageHandle; + } + } + /// + /// The storage id of the media storage + /// + /// 3 + public string Id + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Storage.GetId(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The storage path of the media storage + /// + /// 3 + public string StoragePath + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Storage.GetPath(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The storage name of the media storage + /// + /// 3 + public string Name + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Storage.GetName(Handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// The storage type of the media storage + /// + /// 3 + public ContentStorageType StorageType + { + get + { + ContentStorageType storageType; + MediaContentValidator.ThrowIfError( + Interop.Storage.GetType(Handle, out storageType), "Failed to get value"); + + return storageType; + } + } + + internal Storage(IntPtr handle) + { + _storageHandle = handle; + } + + /// + /// Gets the count of media files for the passed filter in the given storage from the media database. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Storage.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count"); + + return mediaCount; + } + + public override void Dispose() + { + if (_storageHandle != IntPtr.Zero) + { + Interop.Storage.Destroy(_storageHandle); + _storageHandle = IntPtr.Zero; + } + } + + /// + /// Iterates through the media files with an optional filter in the given storage from the media database. + /// This function gets all media files associated with the given storage and meeting desired filter option. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.Storage.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.Storage.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs new file mode 100755 index 0000000..181b763 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/Tag.cs @@ -0,0 +1,217 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Content.MediaContent +{ + /// + /// A Tag is a special piece of information that may be associated with media content items. + /// Tagging allows a user to organize large number of items into logical groups providing a simplified and faster way of accessing media content items. + /// + public class Tag : ContentCollection + { + private IntPtr _tagHandle = IntPtr.Zero; + private string _tagName = ""; + + internal IntPtr Handle + { + get + { + if (_tagHandle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(Tag)); + } + + return _tagHandle; + } + + set + { + _tagHandle = value; + } + } + /// + /// The ID of the media tag + /// + /// 3 + public int Id + { + get + { + int id; + MediaContentValidator.ThrowIfError( + Interop.Tag.GetTagId(Handle, out id), "Failed to get value"); + return id; + } + } + + /// + /// The name of the tag + /// + /// 3 + public string Name + { + get + { + return _tagName; + } + + set + { + MediaContentValidator.ThrowIfError( + Interop.Tag.SetName(Handle, value), "Failed to set value"); + _tagName = value; + } + } + + internal Tag(IntPtr tagHandle) + { + _tagHandle = tagHandle; + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.Tag.GetName(Handle, out val), "Failed to get value"); + _tagName = Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + /// + /// Creates a Tag object which can be inserted to the media database using ContentManager:InsertToDatabaseAsync(ContentCollection) + /// + /// 3 + /// The name of the media tag + public Tag(string tagName) + { + _tagName = tagName; + } + + /// + /// Adds a new media info to the tag. + /// + /// 3 + /// The media info which is added + public void AddItem(MediaInformation mediaContent) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.AddMedia(Handle, mediaContent.MediaId), "Failed to add item"); + } + + /// + /// Removes the media info from the given tag. + /// + /// 3 + /// The media info which is removed + public void RemoveItem(MediaInformation mediaContent) + { + MediaContentValidator.ThrowIfError( + Interop.Tag.RemoveMedia(Handle, mediaContent.MediaId), "Failed to remove item"); + } + + /// + /// Gets the number of media files for the passed filter in the given tag from the media database. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// The number of media contents matching the filter passed + public override int GetMediaInformationCount(ContentFilter filter) + { + int mediaCount; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.Tag.GetMediaCountFromDb(Id, handle, out mediaCount), "Failed to get count"); + + return mediaCount; + } + + public override void Dispose() + { + if (_tagHandle != IntPtr.Zero) + { + Interop.Tag.Destroy(_tagHandle); + _tagHandle = IntPtr.Zero; + } + } + + /// + /// Iterates through media items for a given tag from the media database. + /// This function gets all media items associated with a given tag and meeting a desired filter. + /// If NULL is passed to the filter, no filtering is applied. + /// + /// 3 + /// ContentFilter used to match media content from the media database. + /// List of content media items matching the passed filter + public override IEnumerable GetMediaInformations(ContentFilter filter) + { + List mediaContents = new List(); + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + + Interop.Tag.MediaInfoCallback callback = (IntPtr mediaHandle, IntPtr data) => + { + Interop.MediaInformation.SafeMediaInformationHandle newHandle; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.Clone(out newHandle, mediaHandle), "Failed to clone media"); + + MediaContentType type; + Interop.MediaInformation.GetMediaType(newHandle, out type); + if (type == MediaContentType.Image) + { + Interop.ImageInformation.SafeImageInformationHandle imageInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetImage(mediaHandle, out imageInfo), "Failed to get image information"); + + mediaContents.Add(new ImageInformation(imageInfo, newHandle)); + } + else if ((type == MediaContentType.Music) || (type == MediaContentType.Sound)) + { + Interop.AudioInformation.SafeAudioInformationHandle audioInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAudio(mediaHandle, out audioInfo), "Failed to get audio information"); + + mediaContents.Add(new AudioInformation(audioInfo, newHandle)); + } + else if (type == MediaContentType.Video) + { + Interop.VideoInformation.SafeVideoInformationHandle videoInfo; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetVideo(mediaHandle, out videoInfo), "Failed to get video information"); + + mediaContents.Add(new VideoInformation(videoInfo, newHandle)); + } + else if (type == MediaContentType.Others) + { + mediaContents.Add(new MediaInformation(newHandle)); + } + + return true; + }; + + MediaContentValidator.ThrowIfError( + Interop.Tag.ForeachMediaFromDb(Id, handle, callback, IntPtr.Zero), "Failed to get information"); + + return mediaContents; + } + } +} diff --git a/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs new file mode 100755 index 0000000..da48d28 --- /dev/null +++ b/src/Tizen.Content.MediaContent/Tizen.Content.MediaContent/VideoInformation.cs @@ -0,0 +1,431 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.Collections.ObjectModel; + +namespace Tizen.Content.MediaContent +{ + /// + /// VideoContent class API gives the information related to the image media stored in the device + /// + public class VideoInformation : MediaInformation + { + /// + /// Gets the ID of the media. + /// + /// 3 + public string MediaId + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetMediaId(_handle, out val), "Failed to get value"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the album name. + /// If the media content has no album information, the property returns empty string. + /// + /// 3 + public string Album + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetAlbum(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the artist name. + /// If the media content has no artist information, the property returns empty string. + /// + /// 3 + public string Artist + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetArtist(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the album artist name. + /// If the media content has no album artist information, the property returns empty string. + /// + /// 3 + public string AlbumArtist + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetAlbumArtist(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the genre name. + /// If the media content has no genre information, the property returns empty string. + /// + /// 3 + public string Genre + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetGenre(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the composer name. + /// If the media content has no composer information, the property returns empty string. + /// + /// 3 + public string Composer + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetComposer(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the year. + /// If the media content has no year information, the property returns empty string. + /// + /// 3 + public string Year + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetYear(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the recorded date. + /// + /// 3 + public string RecordedDate + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetRecordedDate(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the copyright notice. + /// If the media content has no copyright information, the property returns empty string. + /// + /// 3 + public string Copyright + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetCopyright(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the track number. + /// If the media content has no track information, the property returns empty string. + /// + /// 3 + public string TrackNumber + { + get + { + IntPtr val = IntPtr.Zero; + try + { + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetTrackNum(_handle, out val), "Failed to get value"); + + return MediaContentValidator.CheckString(Marshal.PtrToStringAnsi(val)); + } + finally + { + Interop.Libc.Free(val); + } + } + } + + /// + /// Gets the bitrate in bit per second [bps]. + /// + /// 3 + public int BitRate + { + get + { + int bitrate = 0; + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetBitRate(_handle, out bitrate), "Failed to get value"); + + return bitrate; + } + } + + /// + /// Gets the track duration in Milliseconds. + /// + /// 3 + public int Duration + { + get + { + int duration = 0; + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetDuration(_handle, out duration), "Failed to get value"); + + return duration; + } + } + + /// + /// Gets the video width in pixels. + /// + /// 3 + public int Width + { + get + { + int width = 0; + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetWidth(_handle, out width), "Failed to get value"); + + return width; + } + } + + /// + /// Gets the video height in pixels. + /// + /// 3 + public int Height + { + get + { + int height = 0; + MediaContentValidator.ThrowIfError( + Interop.VideoInformation.GetHeight(_handle, out height), "Failed to get value"); + + return height; + } + } + + /// + /// Gets the number of bookmarks for the passed filter in the given media ID from the media database. + /// + /// 3 + /// + /// int count + /// The Filter for matching Bookmarks + public int GetMediaBookmarkCount(ContentFilter filter) + { + int count = 0; + IntPtr handle = (filter != null) ? filter.Handle : IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetBookmarkCount(MediaId, handle, out count), "Failed to get count"); + + return count; + } + + /// + /// Iterates through the media bookmark in the given media info from the media database. + /// + /// 3 + /// + /// Task to get all the Bookmarks + /// filter for the Tags + public IEnumerable GetMediaBookmarks(ContentFilter filter) + { + Collection result = new Collection(); + IntPtr filterHandle = (filter != null) ? filter.Handle : IntPtr.Zero; + Interop.MediaInformation.MediaBookmarkCallback callback = (IntPtr handle, IntPtr userData) => + { + IntPtr newHandle = IntPtr.Zero; + MediaContentValidator.ThrowIfError( + Interop.MediaBookmark.Clone(out newHandle, handle), "Failed to clone Tag"); + result.Add(new MediaBookmark(newHandle)); + return true; + }; + MediaContentValidator.ThrowIfError( + Interop.MediaInformation.GetAllBookmarks(MediaId, filterHandle, callback, IntPtr.Zero), "Failed to get value"); + + return result; + } + + /// + /// Adds a bookmark to the video + /// + /// 3 + /// Offset of the video in seconds + /// Thumbnail path for the bookmark + /// Task with added MediaBookmark instance + public MediaBookmark AddBookmark(uint offset, string thumbnailPath) + { + MediaBookmark result = null; + ContentManager.Database.Insert(MediaId, offset, thumbnailPath); + ContentFilter bookmarkfilter = new ContentFilter(); + bookmarkfilter.Condition = ContentColumns.Bookmark.Offset + " = " + offset; + IEnumerable bookmarksList = null; + bookmarksList = GetMediaBookmarks(bookmarkfilter); + foreach (MediaBookmark bookmark in bookmarksList) + { + if (bookmark.Offset == offset) + { + result = bookmark; + break; + } + } + + bookmarkfilter.Dispose(); + return result; + } + + /// + /// Deletes a bookmark from the media database. + /// For other types Unsupported exception is thrown. + /// + /// 3 + /// The bookmark to be deleted + public void DeleteBookmark(MediaBookmark bookmark) + { + ContentManager.Database.Delete(bookmark); + } + + internal IntPtr VideoHandle + { + get + { + return _handle.DangerousGetHandle(); + } + } + + private readonly Interop.VideoInformation.SafeVideoInformationHandle _handle; + + internal VideoInformation(Interop.VideoInformation.SafeVideoInformationHandle handle, Interop.MediaInformation.SafeMediaInformationHandle mediaInformationHandle) + : base(mediaInformationHandle) + { + _handle = handle; + } + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs b/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs new file mode 100755 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs new file mode 100755 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..365b82e --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Mime = "libcapi-content-mime-type.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs b/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs new file mode 100755 index 0000000..048c773 --- /dev/null +++ b/src/Tizen.Content.MimeType/Interop/Interop.Mime.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Mime + { + [DllImport(Libraries.Mime, EntryPoint = "mime_type_get_mime_type", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetMime( + [System.Runtime.InteropServices.InAttribute()] + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string file_extension + , out string mime_type); + + [DllImport(Libraries.Mime, EntryPoint = "mime_type_get_file_extension", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetFile( + [System.Runtime.InteropServices.InAttribute()] + [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPStr)] string mime_type + , out System.IntPtr file_extension, out int length); + } +} diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType.sln b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.sln new file mode 100755 index 0000000..e42091e --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Content.MimeType", "Tizen.Content.MimeType.csproj", "{8CC8944C-8D75-49ED-9763-536302043697}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{B57AB483-78A7-43BC-840F-CAD0836B6018}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{40771996-CF47-4336-A8F1-484F3CA6D996}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8CC8944C-8D75-49ED-9763-536302043697}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8CC8944C-8D75-49ED-9763-536302043697}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8CC8944C-8D75-49ED-9763-536302043697}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8CC8944C-8D75-49ED-9763-536302043697}.Release|Any CPU.Build.0 = Release|Any CPU + {B57AB483-78A7-43BC-840F-CAD0836B6018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B57AB483-78A7-43BC-840F-CAD0836B6018}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B57AB483-78A7-43BC-840F-CAD0836B6018}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B57AB483-78A7-43BC-840F-CAD0836B6018}.Release|Any CPU.Build.0 = Release|Any CPU + {40771996-CF47-4336-A8F1-484F3CA6D996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {40771996-CF47-4336-A8F1-484F3CA6D996}.Debug|Any CPU.Build.0 = Debug|Any CPU + {40771996-CF47-4336-A8F1-484F3CA6D996}.Release|Any CPU.ActiveCfg = Release|Any CPU + {40771996-CF47-4336-A8F1-484F3CA6D996}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs new file mode 100755 index 0000000..d316198 --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeExceptionFactory.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Tizen.Content.MimeType +{ + internal class MimeExceptionFactory + { + internal static Exception CreateException(MimeUtil.MimeError err) + { + Exception exp; + switch (err) + { + case MimeUtil.MimeError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + case MimeUtil.MimeError.IoError: + { + exp = new InvalidOperationException("I/O Error Occured"); + break; + } + case MimeUtil.MimeError.OutOfMemory: + { + exp = new InvalidOperationException("Out Of Memory"); + break; + } + default: + { + exp = new InvalidOperationException(""); + break; + } + } + return exp; + } + } +} diff --git a/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs new file mode 100755 index 0000000..d9be14a --- /dev/null +++ b/src/Tizen.Content.MimeType/Tizen.Content.MimeType/MimeUtil.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Runtime.InteropServices; + +namespace Tizen.Content.MimeType +{ + /// + /// The MimeUtil API provides functions to map MIME types to file extensions and vice versa. + /// + /// Conversions are provided from file extensions to MIME types and from MIME types to file extensions. + public static class MimeUtil + { + /// + /// Gets the MIME type for the given file extension. + /// The MIME type is 'application/octet-stream' if the given file extension is not associated with specific file formats + /// + /// The file Extension + /// + /// + /// string mimeType = MimeUtil.GetMimeType("png"); + /// + /// + public static string GetMimeType(string fileExtension) + { + string mime; + int res = Interop.Mime.GetMime(fileExtension, out mime); + if (res != (int)MimeError.None) + { + throw MimeExceptionFactory.CreateException((MimeError)res); + } + return mime; + } + + /// + /// Gets file extensions for the given MIME type. + /// + /// If Successfull, return's the list of file extension strings for the given MIME type. + /// The array of file extension are without the leading dot ('.') + /// The mime type + /// + /// + /// IEnumerable extColl = MimeUtil.GetFileExtension("video/mpeg"); + /// foreach ( string obj in extColl ) + /// { + /// Console.WriteLine(obj); + /// } + /// + /// + public static IEnumerable GetFileExtension(string mime) + { + IntPtr extensionArray = IntPtr.Zero; + int length = -1; + int res = Interop.Mime.GetFile(mime, out extensionArray, out length); + if (res != (int)MimeError.None) + { + throw MimeExceptionFactory.CreateException((MimeError)res); + } + IntPtr[] extensionList = new IntPtr[length]; + Marshal.Copy(extensionArray, extensionList, 0, length); + Collection coll = new Collection(); + foreach (IntPtr extension in extensionList) + { + coll.Add(Marshal.PtrToStringAnsi(extension)); + Interop.Libc.Free(extension); + } + Interop.Libc.Free(extensionArray); + return coll; + } + + internal enum MimeError : int + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< Internal I/O error */ + } + } +} diff --git a/src/Tizen.Context/Interop/Interop.AppHistory.cs b/src/Tizen.Context/Interop/Interop.AppHistory.cs new file mode 100644 index 0000000..b6cdec2 --- /dev/null +++ b/src/Tizen.Context/Interop/Interop.AppHistory.cs @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class CtxHistory + { + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_query")] + internal static extern int Query(string uri, Int64 startTime, Int64 endTime, uint resultSize, out IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_is_supported")] + internal static extern int IsSupported(string subject, out bool supported); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_get_last_fully_charged_time")] + internal static extern int GetLastFullyChargedTime(out Int64 timestamp); + + } + internal static partial class CtxHistoryCursor + { + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_destroy")] + internal static extern void Destroy(IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_get_count")] + internal static extern int GetCount(IntPtr cursor, out int count); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_get_position")] + internal static extern int GetPosition(IntPtr cursor, out int position); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_set_position")] + internal static extern int SetPosition(IntPtr cursor, int position); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_first")] + internal static extern int First(IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_last")] + internal static extern int Last(IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_next")] + internal static extern int Next(IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_prev")] + internal static extern int Prev(IntPtr cursor); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_get_int64")] + internal static extern int GetInt64(IntPtr cursor, string key, out Int64 value); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_get_double")] + internal static extern int GetDouble(IntPtr cursor, string key, out double value); + + [DllImport(Library.AppHistory, EntryPoint = "ctx_history_cursor_get_string")] + internal static extern int GetString(IntPtr cursor, string key, out string value); + } +} diff --git a/src/Tizen.Context/Interop/Interop.Libraries.cs b/src/Tizen.Context/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..8970f55 --- /dev/null +++ b/src/Tizen.Context/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Library + { + public const string AppHistory = "libcontext-app-history-client.so.4"; + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/AppHistoryErrorFactory.cs b/src/Tizen.Context/Tizen.Context.AppHistory/AppHistoryErrorFactory.cs new file mode 100644 index 0000000..d990828 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/AppHistoryErrorFactory.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Context.AppHistory +{ + internal enum AppHistoryError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoData = ErrorCode.NoData, + OperationFailed = -0x02480000 | 0x04, + } + + internal static class AppHistoryErrorFactory + { + internal const string LogTag = "Tizen.Context.AppHistory"; + + internal static Exception CheckAndThrowException(AppHistoryError error, string msg) + { + switch (error) + { + case AppHistoryError.None: + return null; + case AppHistoryError.InvalidParameter: + return new ArgumentException("Invalid Parameter: " + msg); + case AppHistoryError.OutOfMemory: + return new OutOfMemoryException("Out of Memory: " + msg); + case AppHistoryError.PermissionDenied: + return new UnauthorizedAccessException("Permission Denied: " + msg); + case AppHistoryError.NotSupported: + return new NotSupportedException("Not Supported: " + msg); + case AppHistoryError.OperationFailed: + return new InvalidOperationException("Operation Failed: " + msg); + default: + return new InvalidOperationException("Unknown Error Code: " + msg); + } + } + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/AppStatistics.cs b/src/Tizen.Context/Tizen.Context.AppHistory/AppStatistics.cs new file mode 100644 index 0000000..c25b493 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/AppStatistics.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Context.AppHistory +{ + /// + /// Base class for application statistics. + /// + public abstract class AppStatistics + { + internal const string AppStatsQueryResult = "QueryResult"; + internal const string AppStatsStartTime = "StartTime"; + internal const string AppStatsEndTime = "EndTime"; + internal const string AppStatsResultSize = "ResultSize"; + internal const string AppStatsAppId = "AppId"; + internal const int DefaultResultSize = 5; + + internal string Uri; + + internal AppStatistics() + { + } + + internal static long ConvertDateTimeToUnixTimestamp(DateTime dateTime) + { + DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); + long unixTimestampInTicks = (dateTime.ToUniversalTime() - unixStart).Ticks; + return unixTimestampInTicks / TimeSpan.TicksPerSecond; + } + + internal static DateTime ConvertUnixTimestampToDateTime(long unixTime) + { + DateTime unixStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc); + long unixTimeStampInTicks = unixTime * TimeSpan.TicksPerSecond; + return new DateTime(unixStart.Ticks + unixTimeStampInTicks, System.DateTimeKind.Utc).ToLocalTime(); + } + + internal static void CheckTimeSpan(DateTime startTime, DateTime endTime) + { + if (startTime > endTime) + { + Log.Error(AppHistoryErrorFactory.LogTag, "endTime should be greater than startTime"); + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.InvalidParameter, "endTime should be greater than startTime"); + } + } + + internal static void CheckResultSize(uint resultSize) + { + if (resultSize <= 0) + { + Log.Error(AppHistoryErrorFactory.LogTag, "resultSize should be greater than 0"); + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.InvalidParameter, "resultSize should be greater than 0"); + } + } + + internal abstract string ConvertSortOrderToString(int order); + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/AppStatisticsData.cs b/src/Tizen.Context/Tizen.Context.AppHistory/AppStatisticsData.cs new file mode 100644 index 0000000..ed46f8c --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/AppStatisticsData.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Context.AppHistory +{ + /// + /// Base class which contains application statistics query result. + /// + public abstract class AppStatisticsData + { + internal AppStatisticsData() + { + } + + /// + /// Gets the application id. + /// + /// The application id. + public string AppId { get; protected set; } + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatistics.cs b/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatistics.cs new file mode 100644 index 0000000..f820525 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatistics.cs @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Context.AppHistory +{ + /// + /// This class provides APIs to query battery consumption per application. + /// + public class BatteryStatistics : AppStatistics + { + private const string AppStatsConsumption = "TotalAmount"; + + /// + /// The default constructor of BatteryStatistics class. + /// + /// http://tizen.org/feature/battery + /// Thrown when method fail due to internal error. + /// Thrown when the statistics is not supported. + public BatteryStatistics() + { + SortOrder = SortOrderType.ConsumptionMost; + Uri = ConvertSortOrderToString((int)SortOrder); + + bool isSupported = false; + int error = Interop.CtxHistory.IsSupported(Uri, out isSupported); + if ((AppHistoryError)error != AppHistoryError.None) + { + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, Uri); + } + + if (!isSupported) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.NotSupported, Uri); + } + } + + /// + /// The constructor of BatteryStatistics class. + /// + /// The criteria of the battery statistics sorted by. + /// http://tizen.org/feature/battery + /// Thrown when an invalid argument is used. + /// Thrown when method fail due to internal error. + /// Thrown when the statistics is not supported. + public BatteryStatistics(SortOrderType order) + { + SortOrder = order; + Uri = ConvertSortOrderToString((int)SortOrder); + + if (Uri == null) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.InvalidParameter, "Invalid SortOrderType"); + } + + bool isSupported = false; + int error = Interop.CtxHistory.IsSupported(Uri, out isSupported); + if ((AppHistoryError)error != AppHistoryError.None) + { + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, Uri); + } + + if (!isSupported) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.NotSupported, Uri); + } + } + + /// + /// Retrieves a given type of battery statistics. + /// + /// The start time of the data to be aggregated. + /// The end time of the data to be aggregated. + /// Battery statistics data retrieved. + /// http://tizen.org/privilege/apphistory.read + /// Thrown when an invalid argument is used. + /// Thrown when invalid operation occurs. + /// Thrown when the app has no privilege to retrieve app history. + public IReadOnlyList Query(DateTime startTime, DateTime endTime) + { + CheckTimeSpan(startTime, endTime); + + return Query(startTime, endTime, DefaultResultSize); + } + + /// + /// Retrieves a given type of battery statistics. + /// + /// The start time of the data to be aggregated. + /// The end time of the data to be aggregated. + /// The number of data records to be retrieved. + /// Battery statistics data retrieved. + /// http://tizen.org/privilege/apphistory.read + /// Thrown when an invalid argument is used. + /// Thrown when invalid operation occurs. + /// Thrown when the app has no privilege to retrieve app history. + public IReadOnlyList Query(DateTime startTime, DateTime endTime, uint resultSize) + { + CheckTimeSpan(startTime, endTime); + CheckResultSize(resultSize); + + List result = new List(); + + IntPtr cursor = IntPtr.Zero; + int error = Interop.CtxHistory.Query(Uri, (int)ConvertDateTimeToUnixTimestamp(startTime), (int)ConvertDateTimeToUnixTimestamp(endTime), resultSize, out cursor); + if ((AppHistoryError)error == AppHistoryError.NoData) + { + return result.AsReadOnly(); + } + else if ((AppHistoryError)error != AppHistoryError.None) + { + Log.Error(AppHistoryErrorFactory.LogTag, "Failed to request query battery statistics"); + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, "Failed to request query battery statistics"); + } + + int size; + error = Interop.CtxHistoryCursor.GetCount(cursor, out size); + Interop.CtxHistoryCursor.First(cursor); + + for (int i = 0; i < size; i++) + { + result.Add(ConvertOutputToStatsData(cursor)); + Interop.CtxHistoryCursor.Next(cursor); + } + Interop.CtxHistoryCursor.Destroy(cursor); + + return result.AsReadOnly(); + } + + /// + /// Gets the last time when the device was fully charged. + /// + /// The last time when the device was fully charged. + /// http://tizen.org/feature/battery + /// Thrown when the statistics is not supported. + public static DateTime GetLastFullyChargedTime() + { + Int64 timestamp; + int error = Interop.CtxHistory.GetLastFullyChargedTime(out timestamp); + if ((AppHistoryError)error != AppHistoryError.None) + { + Log.Error(AppHistoryErrorFactory.LogTag, "Failed to request get last fully charged time"); + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, "Failed to request get last fully charged time"); + } + + return ConvertUnixTimestampToDateTime(timestamp); + } + + internal override string ConvertSortOrderToString(int order) + { + switch ((SortOrderType)order) + { + case SortOrderType.ConsumptionMost: + return "stats/battery/history"; + default: + return null; + } + } + + private static BatteryStatisticsData ConvertOutputToStatsData(IntPtr cursor) + { + string appId; + double consumption; + + Interop.CtxHistoryCursor.GetString(cursor, AppStatsAppId, out appId); + Interop.CtxHistoryCursor.GetDouble(cursor, AppStatsConsumption, out consumption); + + return new BatteryStatisticsData(appId, consumption); + } + + /// + /// Gets the criteria of battery statistics sorted by. + /// + /// The criteria of battery statistics sorted by. + public SortOrderType SortOrder { get; private set; } + + /// + /// Sort order type of battery statistics. + /// + public enum SortOrderType + { + /// + /// Sorts apps by consumption, the most battery consuming apps appear first. (Default) + /// + ConsumptionMost = 0 + } + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatisticsData.cs b/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatisticsData.cs new file mode 100644 index 0000000..9dd6e4c --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/BatteryStatisticsData.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Context.AppHistory +{ + /// + /// The class contains battery statistics information retrieved by BatteryStatistics. + /// + public class BatteryStatisticsData : AppStatisticsData + { + internal BatteryStatisticsData(string appId, double consumption) + { + AppId = appId; + Consumption = consumption; + } + + /// + /// Gets how many percentage of battery capacity was used by the application. + /// + /// Battery consumption used by the application. + public double Consumption { get; private set; } + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatistics.cs b/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatistics.cs new file mode 100644 index 0000000..a23d820 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatistics.cs @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Context.AppHistory +{ + /// + /// This class provides APIs to query application launch history. + /// + public class UsageStatistics : AppStatistics + { + private const string AppStatsDuration = "TotalDuration"; + private const string AppStatsLaunchCount = "TotalCount"; + private const string AppStatsLastLaunchTime = "LastTime"; + + /// + /// The default constructor of UsageStatistics class. + /// + /// Thrown when method fail due to internal error. + public UsageStatistics() + { + SortOrder = SortOrderType.LastLaunchTimeNewest; + Uri = ConvertSortOrderToString((int)SortOrder); + + bool isSupported = false; + int error = Interop.CtxHistory.IsSupported(Uri, out isSupported); + if ((AppHistoryError)error != AppHistoryError.None) + { + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, Uri); + } + + if (!isSupported) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.OperationFailed, Uri); + } + } + + /// + /// The constructor of UsageStatistics class. + /// + /// The criteria of the usage statistics sorted by. + /// Thrown when an invalid argument is used. + /// Thrown when method fail due to internal error. + public UsageStatistics(SortOrderType order) + { + SortOrder = order; + Uri = ConvertSortOrderToString((int)SortOrder); + + if (Uri== null) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.InvalidParameter, "Invalid SortOrderType"); + } + + bool isSupported = false; + int error = Interop.CtxHistory.IsSupported(Uri, out isSupported); + if ((AppHistoryError)error != AppHistoryError.None) + { + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, Uri); + } + + if (!isSupported) + { + throw AppHistoryErrorFactory.CheckAndThrowException(AppHistoryError.OperationFailed, Uri); + } + } + + /// + /// Retrieves a given type of usage statistics. + /// + /// The start time of the data to be aggregated. + /// The end time of the data to be aggregated. + /// Usage statistics data retrieved. + /// http://tizen.org/privilege/apphistory.read + /// Thrown when an invalid argument is used. + /// Thrown when invalid operation occurs. + /// Thrown when the app has no privilege to retrieve app history. + public IReadOnlyList Query(DateTime startTime, DateTime endTime) + { + CheckTimeSpan(startTime, endTime); + + return Query(startTime, endTime, DefaultResultSize); + } + + /// + /// Retrieves a given type of usage statistics. + /// + /// The start time of the data to be aggregated. + /// The end time of the data to be aggregated. + /// The number of data records to be retrieved. + /// Usage statistics data retrieved. + /// http://tizen.org/privilege/apphistory.read + /// Thrown when an invalid argument is used. + /// Thrown when invalid operation occurs. + /// Thrown when the app has no privilege to retrieve app history. + public IReadOnlyList Query(DateTime startTime, DateTime endTime, uint resultSize) + { + CheckTimeSpan(startTime, endTime); + CheckResultSize(resultSize); + + List result = new List(); + + IntPtr cursor = IntPtr.Zero; + int error = Interop.CtxHistory.Query(Uri, ConvertDateTimeToUnixTimestamp(startTime), ConvertDateTimeToUnixTimestamp(endTime), resultSize, out cursor); + if ((AppHistoryError)error == AppHistoryError.NoData) + { + return result.AsReadOnly(); + } else if ((AppHistoryError)error != AppHistoryError.None) + { + Log.Error(AppHistoryErrorFactory.LogTag, "Failed to request query usage statistics"); + throw AppHistoryErrorFactory.CheckAndThrowException((AppHistoryError)error, "Failed to request query usage statistics"); + } + + int size; + error = Interop.CtxHistoryCursor.GetCount(cursor, out size); + Interop.CtxHistoryCursor.First(cursor); + + for (int i = 0; i < size; i++) + { + result.Add(ConvertOutputToStatsData(cursor)); + Interop.CtxHistoryCursor.Next(cursor); + } + Interop.CtxHistoryCursor.Destroy(cursor); + + return result.AsReadOnly(); + } + + internal override string ConvertSortOrderToString(int order) + { + switch ((SortOrderType)order) + { + case SortOrderType.LastLaunchTimeNewest: + return "stats/app/recently"; + case SortOrderType.LaunchCountMost: + return "stats/app/often"; + default: + return null; + } + } + + private static UsageStatisticsData ConvertOutputToStatsData(IntPtr cursor) + { + string appId; + Int64 duration = 1; + Int64 launchCount = 1; + Int64 lastLaunchTime; + + Interop.CtxHistoryCursor.GetString(cursor, AppStatsAppId, out appId); + Interop.CtxHistoryCursor.GetInt64(cursor, AppStatsDuration, out duration); + Interop.CtxHistoryCursor.GetInt64(cursor, AppStatsLaunchCount, out launchCount); + Interop.CtxHistoryCursor.GetInt64(cursor, AppStatsLastLaunchTime, out lastLaunchTime); + + return new UsageStatisticsData(appId, (int)duration, (int)launchCount, ConvertUnixTimestampToDateTime(lastLaunchTime)); + } + + /// + /// Gets the criteria of usage statistics sorted by. + /// + /// The criteria of usage statistics sorted by. + public SortOrderType SortOrder { get; private set; } + + /// + /// Sort order type of usage statistics + /// + public enum SortOrderType + { + /// + /// Sorts apps by the last launch time, the most recently launched apps appear first. (Default) + /// + LastLaunchTimeNewest = 0, + /// + /// Sorts apps by the launch count of being launched, the most frequently launched apps appear first. + /// + LaunchCountMost + } + } +} diff --git a/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatisticsData.cs b/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatisticsData.cs new file mode 100644 index 0000000..c090e90 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.AppHistory/UsageStatisticsData.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Context.AppHistory +{ + /// + /// The class contains application usage statistics information retrieved by UsageStatistics. + /// + public class UsageStatisticsData : AppStatisticsData + { + internal UsageStatisticsData(string appId, int duration, int launchCount, DateTime lastLaunchTime) + { + AppId = appId; + Duration = duration; + LaunchCount = launchCount; + LastLaunchTime = lastLaunchTime; + } + + /// + /// Gets the time which the application is being displayed in the foreground in seconds. + /// + /// Duration which the application is used in the foreground in seconds. + public int Duration { get; private set; } + + /// + /// Gets how many times the application is used in the foreground. + /// + /// How many times the application is used in the foreground. + public int LaunchCount { get; private set; } + + /// + /// Gets the last time when the application has been used. + /// + /// The last time when the application has been used. + public DateTime LastLaunchTime { get; private set; } + } +} diff --git a/src/Tizen.Context/Tizen.Context.csproj b/src/Tizen.Context/Tizen.Context.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Context/Tizen.Context.sln b/src/Tizen.Context/Tizen.Context.sln new file mode 100755 index 0000000..d898ec9 --- /dev/null +++ b/src/Tizen.Context/Tizen.Context.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Context", "Tizen.Context.csproj", "{889CEA8B-5F27-4744-81E1-93AEB9A9D99A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{97D7D638-8AF5-4D07-83DC-A613285D77B2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{CEC858B1-A52B-479A-8BF4-2691CCB64719}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {889CEA8B-5F27-4744-81E1-93AEB9A9D99A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {889CEA8B-5F27-4744-81E1-93AEB9A9D99A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {889CEA8B-5F27-4744-81E1-93AEB9A9D99A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {889CEA8B-5F27-4744-81E1-93AEB9A9D99A}.Release|Any CPU.Build.0 = Release|Any CPU + {97D7D638-8AF5-4D07-83DC-A613285D77B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97D7D638-8AF5-4D07-83DC-A613285D77B2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97D7D638-8AF5-4D07-83DC-A613285D77B2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97D7D638-8AF5-4D07-83DC-A613285D77B2}.Release|Any CPU.Build.0 = Release|Any CPU + {CEC858B1-A52B-479A-8BF4-2691CCB64719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CEC858B1-A52B-479A-8BF4-2691CCB64719}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CEC858B1-A52B-479A-8BF4-2691CCB64719}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CEC858B1-A52B-479A-8BF4-2691CCB64719}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Convergence/Interop/Interop.Common.cs b/src/Tizen.Convergence/Interop/Interop.Common.cs new file mode 100755 index 0000000..bad120b --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Common.cs @@ -0,0 +1,41 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal abstract class TizenSafeHandle : SafeHandle + { + public abstract void Destroy(); + + public TizenSafeHandle() : base(IntPtr.Zero, true) + { + } + + public TizenSafeHandle(IntPtr handle) : base(handle, true) + { + } + + public override bool IsInvalid + { + get + { + return handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + Destroy(); + SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Channel.cs b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Channel.cs new file mode 100755 index 0000000..4a8a282 --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Channel.cs @@ -0,0 +1,67 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Convergence; + +internal static partial class Interop +{ + internal static partial class Internal + { + internal static partial class ConvChannel + { + [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_create")] + internal static extern int Create(out ConvChannelHandle /* conv_channel_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_destroy")] + internal static extern int Destroy(IntPtr /* conv_channel_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_get_string")] + internal static extern int GetString(ConvChannelHandle /* conv_channel_h */ handle, string key, out IntPtr value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_channel_set_string")] + internal static extern int SetString(ConvChannelHandle /* conv_channel_h */ handle, string key, string value); + } + + internal class ConvChannelHandle : TizenSafeHandle + { + private bool _ownsHandle = true; + + public ConvChannelHandle(): base() + { + + } + + public ConvChannelHandle(IntPtr handle) + : base(handle) + { + } + + public ConvChannelHandle(IntPtr handle, bool ownsHandle) + : base(handle) + { + _ownsHandle = ownsHandle; + } + + public override void Destroy() + { + if (_ownsHandle && handle != IntPtr.Zero) + { + var err = ConvChannel.Destroy(this.handle); + if (err != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to destroy conv channel handle"); + throw ErrorFactory.GetException(err); + } + } + } + } + } +} diff --git a/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Device.cs b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Device.cs new file mode 100755 index 0000000..cbee849 --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Device.cs @@ -0,0 +1,62 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Convergence; + +internal static partial class Interop +{ + internal static partial class Internal + { + internal static partial class ConvDevice + { + [DllImport(Libraries.Convergence, EntryPoint = "conv_device_clone")] + internal static extern int Clone(IntPtr /* conv_device_h */ originalHandle, out ConvDeviceHandle /* conv_device_h */ targetHandle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_device_destroy")] + internal static extern int Destroy(IntPtr /* conv_device_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_device_get_property_string")] + internal static extern int GetPropertyString(ConvDeviceHandle /* conv_device_h */ handle, string key, out IntPtr value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_device_foreach_service")] + internal static extern int ForeachService(ConvDeviceHandle /* conv_device_h */ handle, ConvServiceForeachCallback cb, IntPtr /* void */ userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ConvServiceForeachCallback(IntPtr serviceHandle, IntPtr /* void */ userData); + } + + internal class ConvDeviceHandle : TizenSafeHandle + { + public ConvDeviceHandle() : base() + { + + } + + public ConvDeviceHandle(IntPtr handle) + : base(handle) + { + } + + public override void Destroy() + { + if (handle != IntPtr.Zero) + { + var err = ConvDevice.Destroy(this.handle); + if (err != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to destroy conv device handle"); + throw ErrorFactory.GetException(err); + } + } + } + } + } +} diff --git a/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Manager.cs b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Manager.cs new file mode 100755 index 0000000..cfdc9e5 --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Manager.cs @@ -0,0 +1,79 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Convergence; + +internal static partial class Interop +{ + internal static partial class Internal + { + public enum ConvDiscoveryResult + { + /// + /// Discovery Error + /// + Error = -1, + /// + /// Discovery Success + /// + Success = 0, + /// + /// Discovery finished + /// + Finished, + /// + /// Discovery lost + /// + Lost, + } + + internal static partial class ConvManager + { + [DllImport(Libraries.Convergence, EntryPoint = "conv_create")] + internal static extern int ConvCreate(out ConvManagerHandle /* conv_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_destroy")] + internal static extern int ConvDestroy(IntPtr /* conv_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_discovery_start")] + internal static extern int ConvDiscoveryStart(ConvManagerHandle /* conv_h */ handle, int timeoutSeconds, ConvDiscoveryCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_discovery_stop")] + internal static extern int ConvDiscoveryStop(ConvManagerHandle /* conv_h */ handle); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ConvDiscoveryCallback(IntPtr /* conv_device_h */ deviceHandle, ConvDiscoveryResult /* conv_discovery_result_e */ result, IntPtr /* void */ userData); + } + + internal class ConvManagerHandle : TizenSafeHandle + { + public ConvManagerHandle() : base() + { + + } + + public ConvManagerHandle(IntPtr handle) + : base(handle) + { + } + + public override void Destroy() + { + var err = ConvManager.ConvDestroy(this.handle); + if (err != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to destroy conv manager handle"); + throw ErrorFactory.GetException(err); + } + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Payload.cs b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Payload.cs new file mode 100755 index 0000000..902e5e0 --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Payload.cs @@ -0,0 +1,79 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Convergence; + +internal static partial class Interop +{ + internal static partial class Internal + { + internal static partial class ConvPayload + { + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_create")] + internal static extern int Create(out ConvPayloadHandle /* conv_payload_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_destroy")] + internal static extern int Destroy(IntPtr /* conv_payload_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_set_string")] + internal static extern int SetString(ConvPayloadHandle /* conv_payload_h */ handle, string key, string value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_get_string")] + internal static extern int GetString(ConvPayloadHandle /* conv_payload_h */ handle, string key, out IntPtr value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_set_byte")] + internal static extern int SetByte(ConvPayloadHandle /* conv_payload_h */ handle, string key, int length, byte[] value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_get_byte")] + internal static extern int GetByte(ConvPayloadHandle /* conv_payload_h */ handle, string key, out int length, out IntPtr value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_set_binary")] + internal static extern int SetBinary(ConvPayloadHandle /* conv_payload_h */ handle, int length, byte[] value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_payload_get_binary")] + internal static extern int GetBinary(ConvPayloadHandle /* conv_payload_h */ handle, out int length, out IntPtr value); + } + + internal class ConvPayloadHandle : TizenSafeHandle + { + private bool _ownsHandle = true; + + public ConvPayloadHandle(): base() + { + + } + + public ConvPayloadHandle(IntPtr handle) + : base(handle) + { + } + + public ConvPayloadHandle(IntPtr handle, bool ownsHandle) + : base(handle) + { + _ownsHandle = ownsHandle; + } + + public override void Destroy() + { + if (_ownsHandle && handle != IntPtr.Zero) + { + var err = ConvPayload.Destroy(this.handle); + if (err != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to destroy conv payload handle"); + throw ErrorFactory.GetException(err); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Service.cs b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Service.cs new file mode 100755 index 0000000..e99233a --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Internal.Conv.Service.cs @@ -0,0 +1,107 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Convergence; + +internal static partial class Interop +{ + internal static partial class Internal + { + internal enum ServiceType + { + /// + /// Undefined service + /// + None = -1, + + /// + /// App-to-app communication service + /// + AppCommunication = 0, + + /// + /// Remote app-control service + /// + RemoteAppControl, + } + + internal static partial class ConvService + { + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_create")] + internal static extern int Create(out ConvServiceHandle /* conv_service_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_clone")] + internal static extern int Clone(IntPtr /* conv_service_h */ originalHandle, out ConvServiceHandle /* conv_service_h */ targetHandle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_destroy")] + internal static extern int Destroy(IntPtr /* conv_service_h */ handle); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_get_property_string")] + internal static extern int GetPropertyString(ConvServiceHandle /* conv_service_h */ handle, string key, out IntPtr value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_set_property_string")] + internal static extern int SetPropertyString(ConvServiceHandle /* conv_service_h */ handle, string key, string value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_get_type")] + internal static extern int GetType(IntPtr /* conv_service_h */ handle, out int /* conv_service_e */ value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_set_type")] + internal static extern int SetType(ConvServiceHandle /* conv_service_h */ handle, int /* conv_service_e */ value); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_start")] + internal static extern int Start(ConvServiceHandle /* conv_service_h */ handle, ConvChannelHandle channel, ConvPayloadHandle payload); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_read")] + internal static extern int Read(ConvServiceHandle /* conv_service_h */ handle, ConvChannelHandle channel, ConvPayloadHandle payload); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_publish")] + internal static extern int Publish(ConvServiceHandle /* conv_service_h */ handle, ConvChannelHandle channel, ConvPayloadHandle payload); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_stop")] + internal static extern int Stop(ConvServiceHandle /* conv_service_h */ handle, ConvChannelHandle channel, ConvPayloadHandle payload); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_set_listener_cb")] + internal static extern int SetListenerCb(ConvServiceHandle /* conv_service_h */ handle, ConvServiceListenerCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.Convergence, EntryPoint = "conv_service_unset_listener_cb")] + internal static extern int UnsetListenerCb(ConvServiceHandle /* conv_service_h */ handle); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ConvServiceListenerCallback(IntPtr /* conv_service_h */ serviceHandle, IntPtr channelHandle, int error, IntPtr result, IntPtr /* void */ userData); + } + + internal class ConvServiceHandle : TizenSafeHandle + { + public ConvServiceHandle(): base() + { + + } + + public ConvServiceHandle(IntPtr handle) + : base(handle) + { + } + + public override void Destroy() + { + if (handle != IntPtr.Zero) + { + var err = ConvService.Destroy(this.handle); + if (err != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to destroy conv service handle"); + throw ErrorFactory.GetException(err); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Convergence/Interop/Interop.Libc.cs b/src/Tizen.Convergence/Interop/Interop.Libc.cs new file mode 100755 index 0000000..13c7170 --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Convergence/Interop/Interop.Libraries.cs b/src/Tizen.Convergence/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..072ed2f --- /dev/null +++ b/src/Tizen.Convergence/Interop/Interop.Libraries.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + /// + /// Wrapper class for maintaining names of dependent native libraries. + /// + internal static partial class Libraries + { + public const string Convergence = "libd2d-conv-manager.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence.csproj b/src/Tizen.Convergence/Tizen.Convergence.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Convergence/Tizen.Convergence.sln b/src/Tizen.Convergence/Tizen.Convergence.sln new file mode 100755 index 0000000..6468f53 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Convergence", "Tizen.Convergence.csproj", "{2678DBBD-A00B-45EC-970B-10177D421F37}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{7E7B653C-4119-43C6-A753-7FF659836862}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{0860A84B-7FAD-434F-9EEB-D59D0FEC145E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2678DBBD-A00B-45EC-970B-10177D421F37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2678DBBD-A00B-45EC-970B-10177D421F37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2678DBBD-A00B-45EC-970B-10177D421F37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2678DBBD-A00B-45EC-970B-10177D421F37}.Release|Any CPU.Build.0 = Release|Any CPU + {7E7B653C-4119-43C6-A753-7FF659836862}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E7B653C-4119-43C6-A753-7FF659836862}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E7B653C-4119-43C6-A753-7FF659836862}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E7B653C-4119-43C6-A753-7FF659836862}.Release|Any CPU.Build.0 = Release|Any CPU + {0860A84B-7FAD-434F-9EEB-D59D0FEC145E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0860A84B-7FAD-434F-9EEB-D59D0FEC145E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0860A84B-7FAD-434F-9EEB-D59D0FEC145E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0860A84B-7FAD-434F-9EEB-D59D0FEC145E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalAppCommunicationService.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalAppCommunicationService.cs new file mode 100755 index 0000000..64b5658 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalAppCommunicationService.cs @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.ComponentModel; +using Tizen.Internals.Errors; + +namespace Tizen.Convergence +{ + /// + /// The class provides APIs to support App to App communication service which relies on a remote server. + /// The initialization and execution of a server app (the app on the side with the Remote Server, e.g. TV) and a client app (e.g. the app on the mobile or wearable device) are slightly different. + /// On the server side an instance of the App Communication Service should be created and started by the app. Note, on the client side the service handle shouldn’t be created, but obtained during discovery. + /// For more information, refer Tizen D2D convergence specification + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalAppCommunicationService : InternalService + { + /// + /// The constructor + /// + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + public InternalAppCommunicationService() : + base(Interop.Internal.ServiceType.AppCommunication) + { + + } + + internal InternalAppCommunicationService(IntPtr serviceHandle) : + base(serviceHandle) + { + + } + + /// + /// Starts and initiates the service + /// + /// Channel to specify a logical session for the service + /// Contains additional data for start request. Refer D2D Convergence specification for more information + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/bluetooth + /// http://tizen.org/privilege/d2d.datasharing + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown when the request is not supported as per Tizen D2D convergence specification + /// Thrown when any of the arugments are null + /// The result of the request is delivered through this event + public void Start(InternalChannel channel, InternalPayload payload) + { + if (channel == null) + { + throw new ArgumentNullException(); + } + + Interop.Internal.ConvPayloadHandle handle = (payload == null) ? new Interop.Internal.ConvPayloadHandle() : payload._payloadHandle; + int ret = Interop.Internal.ConvService.Start(_serviceHandle, channel._channelHandle, handle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop: Failed to start app communication service:" + ErrorFacts.GetErrorMessage(ret)); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Reads data from the channel opened on the service + /// + /// Channel representing a logical session on the service + /// Contains additional data for start request. Refer D2D Convergence specification for more information + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/bluetooth + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown when the request is not supported as per Tizen D2D convergence specification + /// Thrown when any of the arugments are null + /// The result of the request is delivered through this event + public void Read(InternalChannel channel, InternalPayload payload) + { + if (channel == null) + { + throw new ArgumentNullException(); + } + + Interop.Internal.ConvPayloadHandle handle = (payload == null) ? new Interop.Internal.ConvPayloadHandle() : payload._payloadHandle; + int ret = Interop.Internal.ConvService.Read(_serviceHandle, channel._channelHandle, handle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop: Failed to read app communication service:" + ErrorFacts.GetErrorMessage(ret)); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Publishes a message to the remote server application + /// + /// Channel representing a logical session on the service + /// Contains additional data for start request. Refer D2D Convergence specification for more information + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/bluetooth + /// http://tizen.org/privilege/d2d.datasharing + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown when the request is not supported as per Tizen D2D convergence specification + /// Thrown when any of the arugments are null + /// The result of the request is delivered through this event + public void Publish(InternalChannel channel, InternalPayload payload) + { + if (channel == null) + { + throw new ArgumentNullException(); + } + + Interop.Internal.ConvPayloadHandle handle = (payload == null) ? new Interop.Internal.ConvPayloadHandle() : payload._payloadHandle; + int ret = Interop.Internal.ConvService.Publish(_serviceHandle, channel._channelHandle, handle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop: Failed to publish app communication service:" + ErrorFacts.GetErrorMessage(ret)); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Stops the channel opened on the remote server application + /// + /// Channel representing a logical session on the service + /// Contains additional data for start request. Refer D2D Convergence specification for more information + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/bluetooth + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown when the request is not supported as per Tizen D2D convergence specification + /// Thrown when any of the arugments are null + /// The result of the request is delivered through this event + public void Stop(InternalChannel channel, InternalPayload payload) + { + if (channel == null) + { + throw new ArgumentNullException(); + } + + Interop.Internal.ConvPayloadHandle handle = (payload == null) ? new Interop.Internal.ConvPayloadHandle() : payload._payloadHandle; + int ret = Interop.Internal.ConvService.Stop(_serviceHandle, channel._channelHandle, handle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Interop: Failed to start stop communication service:" + ErrorFacts.GetErrorMessage(ret)); + throw ErrorFactory.GetException(ret); + } + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalChannel.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalChannel.cs new file mode 100755 index 0000000..72b00ec --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalChannel.cs @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// The Channel class provies a logical session for communicating with AppCommunicationService. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalChannel : IDisposable + { + internal Interop.Internal.ConvChannelHandle _channelHandle; + internal const string ChannelUriKey = "uri"; + internal const string ChannelIdKey = "channel_id"; + + /// + /// The constructor + /// + /// Uri of the server side app + /// Unique identifier + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Throws when the arguments passed are null + public InternalChannel(string uri, string id) + { + if (uri == null || id == null) + { + throw new ArgumentNullException(); + } + + int ret = Interop.Internal.ConvChannel.Create(out _channelHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create channel"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Internal.ConvChannel.SetString(_channelHandle, ChannelUriKey, uri); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create channel"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Internal.ConvChannel.SetString(_channelHandle, ChannelIdKey, id); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create channel"); + throw ErrorFactory.GetException(ret); + } + + Uri = uri; + Id = id; + } + + internal InternalChannel(IntPtr channelHandle) + { + _channelHandle = new Interop.Internal.ConvChannelHandle(channelHandle, false); + + IntPtr stringPtr = IntPtr.Zero; + int ret = Interop.Internal.ConvChannel.GetString(_channelHandle, ChannelUriKey, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create channel"); + throw ErrorFactory.GetException(ret); + } + Uri = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.Internal.ConvChannel.GetString(_channelHandle, ChannelIdKey, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create channel"); + throw ErrorFactory.GetException(ret); + } + + Id = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + /// + /// Uri of the server side app + /// + public string Uri { get; } + + /// + /// Unique identifier + /// + public string Id { get; } + + /// + /// The dispose method + /// + public void Dispose() + { + _channelHandle.Dispose(); + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalDevice.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalDevice.cs new file mode 100755 index 0000000..0676fca --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalDevice.cs @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// The class encapsulates a D2D convergence compliant device information + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalDevice : IDisposable + { + internal const string DeviceIdKey = "device_id"; + internal const string DeviceNameKey = "device_name"; + internal const string DeviceTypeKey = "device_type"; + internal Interop.Internal.ConvDeviceHandle _deviceHandle; + internal List _services = new List(); + + /// + /// The Unique ID of the device + /// + public string Id { get;} + + /// + /// Name of the device + /// + public string Name { get;} + + /// + /// The profile of the device + /// + public string Type { get; } + + /// + /// List of services supported by the device + /// + public IEnumerable Services + { + get + { + return _services; + } + } + + internal InternalDevice(IntPtr deviceHandle) + { + int ret = Interop.Internal.ConvDevice.Clone(deviceHandle, out _deviceHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to clone device"); + throw ErrorFactory.GetException(ret); + } + + IntPtr stringPtr = IntPtr.Zero; + ret = Interop.Internal.ConvDevice.GetPropertyString(_deviceHandle, DeviceIdKey, out stringPtr); + if (ret == (int)ConvErrorCode.None) + { + Id = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + ret = Interop.Internal.ConvDevice.GetPropertyString(_deviceHandle, DeviceNameKey, out stringPtr); + if (ret == (int)ConvErrorCode.None) + { + Name = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + ret = Interop.Internal.ConvDevice.GetPropertyString(_deviceHandle, DeviceTypeKey, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Type = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + Log.Debug(ErrorFactory.LogTag, "Device ID ,Name, and Type:[" + Id +"," + Name +"," + Type +"]"); + + Interop.Internal.ConvDevice.ConvServiceForeachCallback cb = (IntPtr serviceHandle, IntPtr userData) => + { + _services.Add(InternalService.GetService(serviceHandle)); + }; + + ret = Interop.Internal.ConvDevice.ForeachService(_deviceHandle, cb, IntPtr.Zero); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get device services"); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// The dispose method + /// + public void Dispose() + { + _deviceHandle.Dispose(); + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFinder.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFinder.cs new file mode 100755 index 0000000..aea5f89 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFinder.cs @@ -0,0 +1,133 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Tizen; +using System.Threading; +using System.Threading.Tasks; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// DeviceFinder provides API to find all nearby Tizen D2D convergence compliant devices + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalDeviceFinder : IDisposable + { + internal Interop.Internal.ConvManagerHandle _convManagerHandle; + + /// + /// The constructor + /// + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + public InternalDeviceFinder() + { + int ret = Interop.Internal.ConvManager.ConvCreate(out _convManagerHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create conv manager handle"); + throw ErrorFactory.GetException(ret); + } + + } + + /// + /// DeviceFound event is triggered when a device is found during discovery procedure + /// + public event EventHandler DeviceFound; + + /// + /// Starts the discovery of nearby devices + /// + /// Seconds for discovery timeout. 0 will use default timeout value + /// Cancellation token required to cancel the current discovery + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/bluetooth + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown when the request is not supported as per Tizen D2D convergence specification + /// Devices found are delivered through this event + /// Task with discovery result + public async Task StartFindingAsync(int timeOut, CancellationToken cancellationToken = default(CancellationToken)) + { + var task = new TaskCompletionSource(); + Interop.Internal.ConvManager.ConvDiscoveryCallback discoveredCb = (IntPtr deviceHandle, Interop.Internal.ConvDiscoveryResult result, IntPtr userData) => + { + Log.Debug(ErrorFactory.LogTag, "discovery callback called with result:[" + result + "]"); + switch (result) + { + case Interop.Internal.ConvDiscoveryResult.Success: + { + InternalDevice device = new InternalDevice(deviceHandle); + InternalDeviceFoundEventArgs deviceFoundEventArgs = new InternalDeviceFoundEventArgs() + { + Device = device + }; + DeviceFound?.Invoke(this, deviceFoundEventArgs); + break; + } + case Interop.Internal.ConvDiscoveryResult.Error: + { + task.TrySetException(new InvalidOperationException("Discovery error occured")); + break; + } + case Interop.Internal.ConvDiscoveryResult.Lost: + { + task.TrySetException(new InvalidOperationException("Discovery Lost")); + break; + } + case Interop.Internal.ConvDiscoveryResult.Finished: + { + Log.Debug(ErrorFactory.LogTag, "discovery process finished"); + task.TrySetResult(true); + break; + } + } + }; + int ret = Interop.Internal.ConvManager.ConvDiscoveryStart(_convManagerHandle, timeOut, discoveredCb, IntPtr.Zero); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to start finding devices"); + throw ErrorFactory.GetException(ret); + } + + if (cancellationToken != CancellationToken.None) + { + cancellationToken.Register(() => + { + int error = Interop.Internal.ConvManager.ConvDiscoveryStop(_convManagerHandle); + if (error != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to stop finding devices" + Internals.Errors.ErrorFacts.GetErrorMessage(error)); + throw ErrorFactory.GetException(error); + } + task.TrySetCanceled(); + }); + } + await task.Task; + } + + /// + /// The dispose method + /// + public void Dispose() + { + _convManagerHandle.Dispose(); + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFoundEventArgs.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFoundEventArgs.cs new file mode 100755 index 0000000..60c3df0 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalDeviceFoundEventArgs.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// Contains arguments for the event DeviceFound. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalDeviceFoundEventArgs : EventArgs + { + internal InternalDeviceFoundEventArgs() { } + + /// + /// The device found + /// + public InternalDevice Device { get; internal set; } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalErrorFactory.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalErrorFactory.cs new file mode 100755 index 0000000..8954997 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalErrorFactory.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; +using System.Threading.Tasks; +using System.Threading; + +namespace Tizen.Convergence +{ + internal enum ConvErrorCode + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + NoData = ErrorCode.NoData, + NotSupported = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + } + + internal class ErrorFactory + { + internal static string LogTag = "Tizen.Convergence"; + + internal static Exception GetException(int error) + { + if ((ConvErrorCode)error == ConvErrorCode.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if ((ConvErrorCode)error == ConvErrorCode.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if ((ConvErrorCode)error == ConvErrorCode.InvalidOperation) + { + return new InvalidOperationException("Invalid operation"); + } + else if ((ConvErrorCode)error == ConvErrorCode.NotSupported) + { + return new NotSupportedException("Unsupported feature http://tizen.org/feature/convergence.d2d"); + } + else if ((ConvErrorCode)error == ConvErrorCode.PermissionDenied) + { + return new UnauthorizedAccessException("Permission denied. (http://tizen.org/privilege/internet, http://tizen.org/privilege/bluetooth, http://tizen.org/privilege/d2d.datasharing)"); + } + else if ((ConvErrorCode)error == ConvErrorCode.NoData) + { + return new InvalidOperationException("The payload is empty"); + } + else + { + return new Exception("Unknown error"); + } + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalPayload.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalPayload.cs new file mode 100755 index 0000000..d5df0a8 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalPayload.cs @@ -0,0 +1,219 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// Represents a payload used in Tizen D2D convergence + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalPayload : IDisposable + { + internal Interop.Internal.ConvPayloadHandle _payloadHandle; + + /// + /// The constructor + /// + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + public InternalPayload() + { + int ret = Interop.Internal.ConvPayload.Create(out _payloadHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create payload"); + throw ErrorFactory.GetException(ret); + } + } + + internal InternalPayload(IntPtr payloadHandle) + { + _payloadHandle = new Interop.Internal.ConvPayloadHandle(payloadHandle, false); + } + + /// + /// Adds a key-value pair to payload + /// + /// The key of the attribute + /// The value of the attribute + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown if the arguments passed are null + public void Set(string key, string value) + { + if(key == null || value == null) + { + throw new ArgumentNullException(); + } + + int ret = 0; + if (value is string) + { + ret = Interop.Internal.ConvPayload.SetString(_payloadHandle, key, value); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to add string to payload"); + throw ErrorFactory.GetException(ret); + } + } + } + + /// + /// Adds a key-value pair to payload + /// + /// The key of the attribute + /// The value of the attribute + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown if the arguments passed are null + public void Set(string key, byte[] value) + { + if (key == null || value == null) + { + throw new ArgumentNullException(); + } + + int ret = 0; + ret = Interop.Internal.ConvPayload.SetByte(_payloadHandle, key, value.Length, value); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to add string to payload"); + throw ErrorFactory.GetException(ret); + } + } + + + /// + /// Sets binary to payload. + /// + /// The binary to set + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown if the arguments passed are null + public void Set(byte[] value) + { + if (value == null) + { + throw new ArgumentNullException(); + } + + int ret = 0; + ret = Interop.Internal.ConvPayload.SetBinary(_payloadHandle, value.Length, value); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to add binary to payload"); + throw ErrorFactory.GetException(ret); + } + } + + /// + /// Gets the value of the key from payload + /// + /// The key of the attribute + /// The value of the attribute + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown if the arguments passed are null + /// Thrown if the key is not found + public void Get(string key, out string value) + { + if (key == null) + { + throw new ArgumentNullException(); + } + + IntPtr stringPtr = IntPtr.Zero; + int ret = 0; + ret = Interop.Internal.ConvPayload.GetString(_payloadHandle, key, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to add string to payload"); + throw ErrorFactory.GetException(ret); + } + + value = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + /// + /// Gets the value of the key from payload + /// + /// The key of the attribute + /// The value of the attribute + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + /// Thrown if the arguments passed are null + /// Thrown if the key is not found + public void Get(string key, out byte[] value) + { + if (key == null) + { + throw new ArgumentNullException(); + } + + int ret = 0; + IntPtr byteArrayPtr; + int byteArraySize; + ret = Interop.Internal.ConvPayload.GetByte(_payloadHandle, key, out byteArraySize, out byteArrayPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to add string to payload"); + throw ErrorFactory.GetException(ret); + } + + byte[] byteArray = new byte[byteArraySize]; + Marshal.Copy(byteArrayPtr, byteArray, 0, byteArraySize); + value = byteArray; + Interop.Libc.Free(byteArrayPtr); + } + + /// + /// Gets binary from payload + /// + /// The result value + /// http://tizen.org/feature/convergence.d2d + /// Thrown if the required feature is not supported. + public void Get(out byte[] value) + { + int ret = 0; + IntPtr byteArrayPtr; + int byteArraySize; + ret = Interop.Internal.ConvPayload.GetBinary(_payloadHandle, out byteArraySize, out byteArrayPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get binary from payload"); + throw ErrorFactory.GetException(ret); + } + + byte[] byteArray = new byte[byteArraySize]; + Marshal.Copy(byteArrayPtr, byteArray, 0, byteArraySize); + value = byteArray; + Interop.Libc.Free(byteArrayPtr); + } + + /// + /// The dispose method + /// + public void Dispose() + { + _payloadHandle.Dispose(); + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalService.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalService.cs new file mode 100755 index 0000000..6740231 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalService.cs @@ -0,0 +1,192 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// The class abstracts the features provided by Tizen D2D Convergence. + /// + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public abstract class InternalService : IDisposable + { + internal Interop.Internal.ConvServiceHandle _serviceHandle; + internal const string ServiceIdKey = "service_id"; + internal const string ServiceVersionKey = "service_version"; + + private event EventHandler _serviceEventOccured; + + internal InternalService(Interop.Internal.ServiceType type) + { + int ret = Interop.Internal.ConvService.Create(out _serviceHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create service handle"); + throw ErrorFactory.GetException(ret); + } + + ret = Interop.Internal.ConvService.SetType(_serviceHandle, (int)type); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to create service handle"); + throw ErrorFactory.GetException(ret); + } + } + + internal InternalService(IntPtr existingServiceHandle) + { + int ret = Interop.Internal.ConvService.Clone(existingServiceHandle, out _serviceHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to clone device"); + throw ErrorFactory.GetException(ret); + } + + IntPtr stringPtr = IntPtr.Zero; + ret = Interop.Internal.ConvService.GetPropertyString(_serviceHandle, ServiceIdKey, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get service Id"); + throw ErrorFactory.GetException(ret); + } + + Id = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + + ret = Interop.Internal.ConvService.GetPropertyString(_serviceHandle, ServiceVersionKey, out stringPtr); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get service version"); + throw ErrorFactory.GetException(ret); + } + + Version = Marshal.PtrToStringAnsi(stringPtr); + Interop.Libc.Free(stringPtr); + } + + /// + /// The ID of the service + /// + public string Id { get; } + + /// + /// The Version of the service + /// + public string Version { get; } + + /// + /// The event handler for Service Events(Start/Publish/Read/Stop) + /// + public event EventHandler ServiceEventOccurred + { + add + { + if (_serviceEventOccured == null) + { + RegisterServiceEventListener(); + } + _serviceEventOccured += value; + } + remove + { + _serviceEventOccured -= value; + if (_serviceEventOccured == null) + { + UnregisterServiceEventListener(); + } + } + } + + /// + /// The event handler for service error events + /// + public event EventHandler ServiceErrorOccured; + + /// + /// The dispose method + /// + public void Dispose() + { + _serviceHandle.Dispose(); + } + + internal static InternalService GetService(IntPtr serviceHandle) + { + InternalService service = null; + int serviceType; + int ret = Interop.Internal.ConvService.GetType(serviceHandle, out serviceType); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to get service version"); + throw ErrorFactory.GetException(ret); + } + if (serviceType == (int)Interop.Internal.ServiceType.AppCommunication) + { + service = new InternalAppCommunicationService(serviceHandle); + } + + return service; + } + + private void RegisterServiceEventListener() + { + int ret = Interop.Internal.ConvService.SetListenerCb(_serviceHandle, serviceEventsCb, IntPtr.Zero); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to set listener for service events"); + throw ErrorFactory.GetException(ret); + } + } + + private void UnregisterServiceEventListener() + { + int ret = Interop.Internal.ConvService.UnsetListenerCb(_serviceHandle); + if (ret != (int)ConvErrorCode.None) + { + Log.Error(ErrorFactory.LogTag, "Failed to unset listener for service events"); + throw ErrorFactory.GetException(ret); + } + } + + private void serviceEventsCb(IntPtr serviceHandle, IntPtr channelHandle, int error, IntPtr resultPayloadHandle, IntPtr userData) + { + Log.Debug(ErrorFactory.LogTag, "service event occured. error code :[" + error + "]"); + + if (error == (int)ConvErrorCode.None) + { + var channel = (channelHandle == IntPtr.Zero) ? null : new InternalChannel(channelHandle); + var payload = (resultPayloadHandle == IntPtr.Zero) ? null : new InternalPayload(resultPayloadHandle); + _serviceEventOccured?.Invoke(this, new InternalServiceEventOccuredEventArgs() + { + Payload = payload, + Channel = channel + }); + } + else + { + var eventArgs = new InternalServiceErrorOccuredEventArgs() + { + Exception = ErrorFactory.GetException(error) + }; + ServiceErrorOccured?.Invoke(this, eventArgs); + } + } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalServiceErrorOccuredEventArgs.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalServiceErrorOccuredEventArgs.cs new file mode 100755 index 0000000..104a05b --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalServiceErrorOccuredEventArgs.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// Contains arguments for the event ServiceErrorOccured. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalServiceErrorOccuredEventArgs : EventArgs + { + internal InternalServiceErrorOccuredEventArgs() { } + + /// + /// The exception + /// + public Exception Exception { get; internal set; } + } +} diff --git a/src/Tizen.Convergence/Tizen.Convergence/InternalServiceEventOccuredEventArgs.cs b/src/Tizen.Convergence/Tizen.Convergence/InternalServiceEventOccuredEventArgs.cs new file mode 100755 index 0000000..e07c9e3 --- /dev/null +++ b/src/Tizen.Convergence/Tizen.Convergence/InternalServiceEventOccuredEventArgs.cs @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.ComponentModel; + +namespace Tizen.Convergence +{ + /// + /// Contains arguments for ServiceEventOccured + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalServiceEventOccuredEventArgs : EventArgs + { + internal InternalServiceEventOccuredEventArgs() { } + + /// + /// The channel on which the event occured + /// + public InternalChannel Channel { get; internal set; } + + /// + /// The payload containing the result + /// + public InternalPayload Payload { get; internal set; } + } +} diff --git a/src/Tizen.Location.Geofence/Interop/Interop.Libraries.cs b/src/Tizen.Location.Geofence/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..40b8453 --- /dev/null +++ b/src/Tizen.Location.Geofence/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + internal const string Geofence = "libcapi-geofence-manager.so.0"; + internal const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Location.Geofence/Interop/Interop.Location.cs b/src/Tizen.Location.Geofence/Interop/Interop.Location.cs new file mode 100755 index 0000000..89eed6a --- /dev/null +++ b/src/Tizen.Location.Geofence/Interop/Interop.Location.cs @@ -0,0 +1,157 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Location.Geofence; + +internal static partial class Interop +{ + internal static partial class Geofence + { + [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_geopoint")] + internal static extern int CreateGPSFence(int placeId, double latitude, double longitude, int radius, string address, out IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_bluetooth")] + internal static extern int CreateBTFence(int placeId, string bssid, string ssid, out IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_create_wifi")] + internal static extern int CreateWiFiFence(int placeId, string bssid, string ssid, out IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_type")] + internal static extern int FenceType(IntPtr handle, out FenceType type); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_place_id")] + internal static extern int FencePlaceID(IntPtr handle, out int placeId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_latitude")] + internal static extern int FenceLatitude(IntPtr handle, out double latitude); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_longitude")] + internal static extern int FenceLongitude(IntPtr handle, out double longitude); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_radius")] + internal static extern int FenceRadius(IntPtr handle, out int radius); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_address")] + internal static extern int FenceAddress(IntPtr handle, out string address); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_bssid")] + internal static extern int FenceBSSID(IntPtr handle, out string bssid); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_get_ssid")] + internal static extern int FenceSSID(IntPtr handle, out string ssid); + } + + internal static partial class GeofenceStatus + { + [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_create")] + internal static extern int Create(int fenceId, out IntPtr statusHandle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_destroy")] + internal static extern int Destroy(IntPtr statusHandle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_get_state")] + internal static extern int State(IntPtr statusHandle, out GeofenceState state); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_status_get_duration")] + internal static extern int Duration(IntPtr statusHandle, out int seconds); + } + + internal static partial class GeofenceManager + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool StateChangedCallback(int fenceId, GeofenceState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ProximityStateChangedCallback(int fenceId, ProximityState state, ProximityProvider provider, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GeofenceEventCallback(int placeId, int fenceId, GeofenceError error, GeofenceEventType eventType, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_is_supported")] + internal static extern int IsSupported(out bool supported); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_create")] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_start")] + internal static extern int Start(IntPtr handle, int fenceId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_stop")] + internal static extern int Stop(IntPtr handle, int fenceId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_state_changed_cb")] + internal static extern int SetStateChangedCB(IntPtr handle, StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_state_changed_cb")] + internal static extern int UnsetStateChangedCB(IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_proximity_state_changed_cb")] + internal static extern int SetProximityStateCB(IntPtr handle, ProximityStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_proximity_state_changed_cb")] + internal static extern int UnsetProximityStateCB(IntPtr handle); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_set_geofence_event_cb")] + internal static extern int SetGeofenceEventCB(IntPtr handle, GeofenceEventCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_unset_geofence_event_cb")] + internal static extern int UnsetGeofenceEventCB(IntPtr handle); + } + + internal static partial class VirtualPerimeter + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ForEachPlaceListCallback(int placeId, string placeName, int placeIndex, int placeCount, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ForEachFenceListCallback(int fenceId, IntPtr fenceHandle, int placeIndex, int placeCount, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_add_place")] + internal static extern int AddPlace(IntPtr handle, string placeName, out int placeId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_update_place")] + internal static extern int UpdatePlace(IntPtr handle, int placeId, string placeName); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_remove_place")] + internal static extern int RemovePlace(IntPtr handle, int placeId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_add_fence")] + internal static extern int AddFence(IntPtr handle, IntPtr fenceHandle, out int fenceId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_remove_fence")] + internal static extern int RemoveFence(IntPtr handle, int fenceId); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_geofence_list")] + internal static extern int GetForEachFenceList(IntPtr handle, ForEachFenceListCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_place_geofence_list")] + internal static extern int GetForEachPlaceFenceList(IntPtr handle, int placeId, ForEachFenceListCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_foreach_place_list")] + internal static extern int GetForEachPlaceList(IntPtr handle, ForEachPlaceListCallback callback, IntPtr userData); + + [DllImport(Libraries.Geofence, EntryPoint = "geofence_manager_get_place_name")] + internal static extern int GetPlaceName(IntPtr handle, int placeId, out string placeName); + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence.csproj b/src/Tizen.Location.Geofence/Tizen.Location.Geofence.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence.sln b/src/Tizen.Location.Geofence/Tizen.Location.Geofence.sln new file mode 100755 index 0000000..6d1373d --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Location.Geofence", "Tizen.Location.Geofence.csproj", "{006D46B2-2A19-450F-92FC-872553636B97}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{29BF6014-4845-4260-B24A-8CD532CF0FCC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{D706B5E3-88AE-4231-A81D-0BCA59C45FE7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {006D46B2-2A19-450F-92FC-872553636B97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {006D46B2-2A19-450F-92FC-872553636B97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {006D46B2-2A19-450F-92FC-872553636B97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {006D46B2-2A19-450F-92FC-872553636B97}.Release|Any CPU.Build.0 = Release|Any CPU + {29BF6014-4845-4260-B24A-8CD532CF0FCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29BF6014-4845-4260-B24A-8CD532CF0FCC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29BF6014-4845-4260-B24A-8CD532CF0FCC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29BF6014-4845-4260-B24A-8CD532CF0FCC}.Release|Any CPU.Build.0 = Release|Any CPU + {D706B5E3-88AE-4231-A81D-0BCA59C45FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D706B5E3-88AE-4231-A81D-0BCA59C45FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D706B5E3-88AE-4231-A81D-0BCA59C45FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D706B5E3-88AE-4231-A81D-0BCA59C45FE7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/Fence.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/Fence.cs new file mode 100755 index 0000000..d22b94a --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/Fence.cs @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location.Geofence +{ + /// + /// Geo-fence defines a virtual perimeter for a real-world geographic area. + /// If you create a geofence, you can trigger some activities when a device enters(or exits) the geofences defined by you. + /// You can create a geofence with the information of Geopoint, Wi-Fi, or BT. + /// + /// Geopoint: Geofence is specified by coordinates (Latitude and Longitude) and Radius + /// WIFI: Geofence is specified by BSSID of Wi-Fi access point + /// BT: Geofence is specified by Bluetooth address + /// + /// Basic service set identification(BSSID) The BSSID is the MAC address of the wireless access point(WAP) generated by combining the 24 bit Organization Unique Identifier(the manufacturer's identity) + /// and the manufacturer's assigned 24-bit identifier for the radio chipset in the WAP. + /// + /// 3 + public class Fence : IDisposable + { + private bool _disposed = false; + + internal IntPtr Handle + { + get; + set; + } + + internal Fence(IntPtr handle) + { + Handle = handle; + } + + ~Fence() + { + Dispose(false); + } + + /// + /// Gets the type of geofence. + /// + /// 3 + public FenceType Type + { + get + { + FenceType val; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceType(Handle, out val); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get GeofenceType"); + } + + return val; + } + } + + /// + /// Gets the id of place. + /// + /// 3 + public int PlaceId + { + get + { + int result = -1; + GeofenceError ret = (GeofenceError)Interop.Geofence.FencePlaceID(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get PlaceId"); + } + + return result; + } + } + + /// + /// Gets the longitude of geofence. + /// + /// 3 + public double Longitude + { + get + { + double result = -1; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceLongitude(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Longitude"); + } + + return result; + + } + } + + /// + /// Gets the latitude of geofence. + /// + /// 3 + public double Latitude + { + get + { + double result = -1; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceLatitude(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Latitude"); + } + + return result; + } + } + + /// + /// Gets the radius of geofence. + /// + /// 3 + public int Radius + { + get + { + int result = -1; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceRadius(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Radius"); + } + + return result; + } + } + + /// + /// Gets the address of geofence. + /// + /// 3 + public string Address + { + get + { + string result = ""; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceAddress(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Adress"); + } + + return result; + } + } + + /// + /// Gets the bssid of geofence. + /// + /// 3 + public string Bssid + { + get + { + string result = ""; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceBSSID(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Bssid"); + } + + return result; + } + } + + /// + /// Gets the ssid of geofence. + /// + /// 3 + public string Ssid + { + get + { + string result = ""; + GeofenceError ret = (GeofenceError)Interop.Geofence.FenceSSID(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get Ssid"); + } + + return result; + } + } + + /// + /// Creates a geopoint type of new geofence. + /// + /// 3 + /// The current place id. + /// Specifies the value of latitude of geofence [-90.0 ~ 90.0] (degrees). + /// Specifies the value of longitude of geofence [-180.0 ~ 180.0] (degrees). + /// Specifies the value of radius of geofence [100 ~ 500](meter). + /// Specifies the value of address. + /// Newly created geofence instance. + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Geofence is not supported. + public static Fence CreateGPSFence(int placeId, int latitude, int longitude, int radius, string address) + { + IntPtr handle = IntPtr.Zero; + GeofenceError ret = (GeofenceError)Interop.Geofence.CreateGPSFence(placeId, latitude, longitude, radius,address, out handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to create Geofence from GPS Data for " + placeId); + } + + return new Fence(handle); + } + + /// + /// Creates a Wi-Fi type of new geofence. + /// + /// 3 + /// The current place id. + /// Specifies the value of BSSID of Wi-Fi MAC address. + /// Specifies the value of SSID of Wi-Fi Device. + /// Newly created geofence instance. + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Geofence is not supported. + public static Fence CreateWifiFence(int placeId, string bssid, string ssid) + { + IntPtr handle = IntPtr.Zero; + GeofenceError ret = (GeofenceError)Interop.Geofence.CreateWiFiFence(placeId, bssid, ssid, out handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to create Geofence from Wifi Data for " + placeId); + } + + return new Fence(handle); + } + + /// + /// Creates a bluetooth type of new geofence. + /// + /// 3 + /// The current place id. + /// Specifies the value of BSSID of BT MAC address. + /// Specifies the value of SSID of BT Device. + /// Newly created geofence instance. + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Geofence is not supported. + public static Fence CreateBTFence(int placeId, string bssid, string ssid) + { + IntPtr handle = IntPtr.Zero; + GeofenceError ret = (GeofenceError)Interop.Geofence.CreateBTFence(placeId, bssid, ssid, out handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to create Geofence from Bluetooth Data for " + placeId); + } + + return new Fence(handle); + } + + /// + /// Overloaded Dispose API for destroying the fence Handle. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (Handle != IntPtr.Zero) + { + Interop.Geofence.Destroy(Handle); + Handle = IntPtr.Zero; + } + + _disposed = true; + } + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceData.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceData.cs new file mode 100755 index 0000000..cfda8cf --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceData.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace Tizen.Location.Geofence +{ + /// + /// Represents the Geofence list Item data. + /// + /// 3 + public class FenceData + { + internal FenceData(int fenceId, IntPtr handle, int index, int count) + { + GeofenceId = fenceId; + Fence = new Fence(handle); + Index = index; + Count = count; + } + /// + /// Geofence instance. + /// + /// 3 + public Fence Fence + { + get; + internal set; + } + + /// + /// The geofence id. + /// + /// 3 + public int GeofenceId + { + get; + internal set; + } + + /// + /// The index number of the fences in the list. + /// + /// 3 + /// Index value starts from 1. + public int Index + { + get; + internal set; + } + + /// + /// The total number of fences that exists for the requester. + /// + /// 3 + public int Count + { + get; + internal set; + } + }; + + /// + /// Represents the Place list Item data. + /// + /// 3 + public class PlaceData + { + internal PlaceData(int id, string name, int index, int count) + { + PlaceId = id; + Name = name; + Index = index; + Count = count; + } + /// + /// The current place id. + /// + /// 3 + public int PlaceId + { + get; + internal set; + } + + /// + /// The current place name. + /// + /// 3 + public string Name + { + get; + internal set; + } + + /// + /// The index number of the places in the list. + /// + /// 3 + /// Index value starts from 1. + public int Index + { + get; + internal set; + } + + /// + /// The total number of places that exists for the requester. + /// + /// 3 + public int Count + { + get; + internal set; + } + }; +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceStatus.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceStatus.cs new file mode 100644 index 0000000..46e5e66 --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/FenceStatus.cs @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location.Geofence +{ + /// + /// The geofence status describes the current state and duration of a geofence. + /// + /// State: State is specified by current state of fence + /// Duration: Geofence is specified by duration of current state + /// + /// + /// 3 + public class FenceStatus : IDisposable + { + private bool _disposed = false; + + internal IntPtr Handle + { + get; + set; + } + + /// + /// Creates a new geofence status. + /// + /// 3 + /// Incase of Invalid parameter. + /// Incase of Geofence is not supported. + public FenceStatus(int fenceId) + { + IntPtr handle; + GeofenceError ret = (GeofenceError)Interop.GeofenceStatus.Create(fenceId, out handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to create Geofence Status instance"); + } + + Handle = handle; + } + + ~FenceStatus() + { + Dispose(false); + } + + /// + /// Gets the state of geofence. + /// + /// 3 + /// Incase of Geofence is not supported. + public GeofenceState State + { + get + { + GeofenceState state; + GeofenceError ret = (GeofenceError)Interop.GeofenceStatus.State(Handle, out state); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get FenceState"); + } + + return state; + } + } + + /// + /// Gets the amount of seconds geofence is in the current state. + /// + /// 3 + /// Incase of Geofence is not supported. + public int Duration + { + get + { + int result = -1; + GeofenceError ret = (GeofenceError)Interop.GeofenceStatus.Duration(Handle, out result); + if (ret != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get FenceDuration"); + } + + return result; + } + } + + /// + /// Overloaded Dispose API for destroying the fence Handle. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (Handle != IntPtr.Zero) + { + Interop.GeofenceStatus.Destroy(Handle); + Handle = IntPtr.Zero; + } + + _disposed = true; + } + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEnum.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEnum.cs new file mode 100755 index 0000000..b5be383 --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEnum.cs @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Location.Geofence +{ + /// + /// Enumeration for geofence type. + /// + /// 3 + public enum FenceType + { + /// + /// Geofence is specified by geospatial coordinate. + /// + /// 3 + GeoPoint = 1, + + /// + /// Geofence is specified by Wi-Fi access point. + /// + /// 3 + Wifi, + + /// + /// Geofence is specified by Bluetooth device. + /// + /// 3 + Bluetooth + }; + + /// + /// Enumerations for the state of geofence. + /// + /// 3 + public enum GeofenceState + { + /// + /// Uncertain state of geofence. + /// + /// 3 + Uncertain = 0, + + /// + /// Geofence In state. + /// + /// 3 + In, + + /// + /// Geofence Out state. + /// + /// 3 + Out + }; + + /// + /// Enumerations for geofence management events. + /// + /// 3 + public enum GeofenceEventType + { + /// + /// Geofence is added. + /// + /// 3 + FenceAdded = 0, + + /// + /// Geofence is removed. + /// + /// 3 + FenceRemoved, + + /// + /// Geofencing is started. + /// + /// 3 + FenceStarted, + + /// + /// Geofencing is stopped. + /// + /// 3 + FenceStopped, + + /// + /// Place is added. + /// + /// 3 + PlaceAdded = 0x10, + + /// + /// Place is removed. + /// + /// 3 + PlaceRemoved, + + /// + /// Place is updated. + /// + /// 3 + PlaceUpdated, + + /// + /// Setting for geofencing is enabled. + /// + /// 3 + SettingEnabled = 0x20, + + /// + /// Setting for geofencing is disabled. + /// + /// 3 + SettingDisabled + }; + + /// + /// Enumeration for the provider of proximity. + /// + /// 3 + public enum ProximityProvider + { + /// + /// Proximity is specified by geospatial coordinate. + /// + /// 3 + Location = 0, + + /// + /// Proximity is specified by Wi-Fi access point. + /// + /// 3 + Wifi, + + /// + /// Proximity is specified by Bluetooth device. + /// + /// 3 + Bluetooth, + + /// + /// Proximity is specified by Bluetooth low energy device. + /// + /// 3 + BLE, + + /// + /// Proximity is specified by Sensor. + /// + /// 3 + Sensor + } + + /// + /// Enumeration for the state of proximity. + /// + /// 3 + public enum ProximityState + { + /// + /// Uncertain state of proximity. + /// + /// 3 + Uncertain = 0, + + /// + /// Far state of proximity. + /// + /// 3 + Far, + + /// + /// Far state of proximity. + /// + /// 3 + Near, + + /// + /// Immediate state of proximity. + /// + /// 3 + Immediate + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceErrorFactory.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceErrorFactory.cs new file mode 100755 index 0000000..e9fc3ad --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceErrorFactory.cs @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen; + + +namespace Tizen.Location.Geofence +{ + /// + /// Enum to give the type of error occured, if any. + /// + /// 3 + public enum GeofenceError + { + /// + /// Successful. + /// + /// 3 + None = Tizen.Internals.Errors.ErrorCode.None, + + /// + /// Out of memory. + /// + /// 3 + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + + /// + /// Invalid parameter. + /// + /// 3 + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + + /// + /// Permission denied. + /// + /// 3 + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + + /// + /// Not Supported. + /// + /// 3 + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + + /// + /// Geofence Manager is not initialized. + /// + /// 3 + NotInitialized = -0x02C00000 | 0x100 | 0x01, + + /// + /// Invalid geofence ID. + /// + /// 3 + InvalidID = -0x02C00000 | 0x100 | 0x02, + + /// + /// Exception occurs. + /// + /// 3 + Exception = -0x02C00000 | 0x100 | 0x03, + + /// + /// Geofencing is already started. + /// + /// 3 + AlreadyStarted = -0x02C00000 | 0x100 | 0x04, + + /// + /// Too many geofence. + /// + /// 3 + TooManyGeofence = -0x02C00000 | 0x100 | 0x05, + + /// + /// Error in GPS, Wi-Fi, or BT. + /// + /// 3 + IPC = -0x02C00000 | 0x100 | 0x06, + + /// + /// DB error in the server side. + /// + /// 3 + DBFailed = -0x02C00000 | 0x100 | 0x07, + + /// + /// Access to specified place is denied. + /// + /// 3 + PlaceAccessDenied = -0x02C00000 | 0x100 | 0x08, + + /// + /// Access to specified geofence is denied. + /// + /// 3 + GeofenceAccessDenied = -0x02C00000 | 0x100 | 0x09 + }; + + internal class GeofenceErrorFactory + { + internal const string LogTag = "Tizen.Location.Geofence"; + + internal static Exception CreateException(GeofenceError err, string msg) + { + Log.Info(LogTag, "Got Error " + err + " throwing Exception with msg " + msg); + Exception exp; + switch (err) + { + case GeofenceError.InvalidParameter: + { + exp = new ArgumentException(msg + " Invalid Parameters Provided"); + break; + } + + case GeofenceError.OutOfMemory: + { + exp = new OutOfMemoryException(msg + " Out Of Memory"); + break; + } + + case GeofenceError.NotInitialized: + { + exp = new InvalidOperationException(msg + " Not initializded"); + break; + } + + case GeofenceError.NotSupported: + { + exp = new NotSupportedException(msg + " Not supported"); + break; + } + + case GeofenceError.PermissionDenied: + // fall through + case GeofenceError.GeofenceAccessDenied: + //fall through + case GeofenceError.PlaceAccessDenied: + { + exp = new UnauthorizedAccessException(msg + " Permission Denied"); + break; + } + + case GeofenceError.DBFailed: + { + exp = new InvalidOperationException(msg + " DataBase Failed"); + break; + } + + default: + { + exp = new InvalidOperationException(msg); + break; + } + } + + return exp; + } + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEventArgs.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEventArgs.cs new file mode 100755 index 0000000..f5ef780 --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceEventArgs.cs @@ -0,0 +1,164 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location.Geofence +{ + /// + /// Event arguments passed when Event is triggered to notify proximity state change. + /// + /// 3 + public class ProximityStateEventArgs : EventArgs + { + /// + /// Internal constructor. + /// + /// 3 + /// The geofence id. + /// The proximity state. + /// The proximity provider. + internal ProximityStateEventArgs(int id, ProximityState state, ProximityProvider provider) + { + GeofenceId = id; + State = state; + Provider = provider; + } + + /// + /// The geofence id. + /// + /// 3 + public int GeofenceId + { + get; + } + + /// + /// The proximity state. + /// + /// 3 + public ProximityState State + { + get; + } + + /// + /// The proximity provider. + /// + /// 3 + public ProximityProvider Provider + { + get; + } + }; + + /// + /// Event arguments passed when Event is triggered to notify Geofence state change. + /// + /// 3 + public class GeofenceStateEventArgs : EventArgs + { + /// + /// Internal constructor. + /// + /// 3 + /// The specified geofence id. + /// The geofence state. + internal GeofenceStateEventArgs(int fenceId, GeofenceState state) + { + GeofenceId = fenceId; + State = state; + } + + /// + /// The specified geofence id. + /// + /// 3 + public int GeofenceId + { + get; + } + + /// + /// The geofence state. + /// + /// 3 + public GeofenceState State + { + get; + } + } + + /// + /// Event arguments passed when Event occurs in geofence and place such as add, update, etc.. + /// + /// 3 + public class GeofenceResponseEventArgs : EventArgs + { + /// + /// Internal constructor. + /// + /// 3 + /// The place id. + /// The specified geofence id. + /// The error code for the particular action. + /// The result code for the particular place and geofence management. + internal GeofenceResponseEventArgs(int placeId, int fenceId, GeofenceError error, GeofenceEventType eventType) + { + PlaceId = placeId; + FenceId = fenceId; + ErrorCode = error; + EventType = eventType; + } + + /// + /// The place id. + /// + /// 3 + public int PlaceId + { + get; + } + + /// + /// The specified geofence id. + /// + /// 3 + public int FenceId + { + get; + } + + /// + /// The error code for the particular action. + /// + /// 3 + public GeofenceError ErrorCode + { + get; + } + + /// + /// The result code for the particular place and geofence management. + /// + /// 3 + public GeofenceEventType EventType + { + get; + } + }; +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceManager.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceManager.cs new file mode 100755 index 0000000..ad69b02 --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/GeofenceManager.cs @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location.Geofence +{ + /// + /// This Geofence Manager API provides service related to geofence(geo-fence). + /// A geofence is a virtual perimeter for a real-world geographic area. + /// This API provides functions to set geofence with geopoint, MAC address of Wi-Fi and Bluetooth address. + /// And, notifications on events like changing in service status are provided. + /// There are two kinds of places and fences: + /// + /// Public places and fences that are created by MyPlace app can be used by all apps. + /// Private places and fences that are created by specified app can be used by the same app. + /// + /// Notifications can be received about the following events: + /// + /// Zone in when a device enters a specific area + /// Zone out when a device exits a specific area + /// Results and errors for each event requested to geofence module + /// + /// + /// 3 + public class GeofenceManager : IDisposable + { + private bool _disposed = false; + + internal IntPtr Handle + { + get; + set; + } + + /// + /// Creates a new geofence manager. + /// + /// 3 + /// Incase of OutOfMemory condition. + /// Incase of any System error. + /// Incase of Geofence is not supported. + public GeofenceManager() + { + IntPtr handle; + GeofenceError ret = (GeofenceError) Interop.GeofenceManager.Create(out handle); + if(ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to create Geofence Manager instance"); + } + + Handle = handle; + } + + ~GeofenceManager() + { + Dispose(false); + } + + /// + /// Checks whether the geofence manager is available or not. + /// + /// 3 + public static bool IsSupported + { + get + { + bool ret = false; + GeofenceError res= (GeofenceError)Interop.GeofenceManager.IsSupported(out ret); + if(res != GeofenceError.None) + { + Tizen.Log.Error(GeofenceErrorFactory.LogTag, "Failed to get IsSupported feature for Geofence manager"); + } + + return ret; + } + } + + /// + /// Starts the geofencing service. + /// + /// 3 + /// The specified geofence id. + /// http://tizen.org/privilege/location + /// + /// When the location service is enabled, the StateChanged event is invoked and the service starts. + /// + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public void Start(int geofenceId) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.Start(Handle, geofenceId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to start service for " + geofenceId); + } + } + + /// + /// Stops the geofenceing service. + /// + /// 3 + /// The specified geofence id. + /// http://tizen.org/privilege/location + /// + /// This function initiates the process of stopping the service. + /// You can stop and start the geofence manager as needed. + /// + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public void Stop(int geofenceId) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.Stop(Handle, geofenceId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to stop service for " + geofenceId); + } + } + + private static readonly Interop.GeofenceManager.StateChangedCallback s_stateChangedCallback = (int fenceId, GeofenceState state, IntPtr data) => + { + GeofenceStateEventArgs evenArgs = new GeofenceStateEventArgs(fenceId, state); + s_stateChanged?.Invoke(null, evenArgs); + return true; + }; + + private static event EventHandler s_stateChanged = null; + + /// + /// Invokes when a device enters or exits the given geofence, If this event is registered. + /// + /// 3 + /// + /// Call to Start() will invoke this event. + /// + /// Incase of feature Not supported. + public event EventHandler StateChanged + { + add + { + if(s_stateChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.SetStateChangedCB(Handle, s_stateChangedCallback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to register state change callback"); + } + } + s_stateChanged += value; + } + remove + { + s_stateChanged -= value; + if (s_stateChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.UnsetStateChangedCB(Handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to unregister state change callback"); + } + } + } + } + + private static readonly Interop.GeofenceManager.ProximityStateChangedCallback s_proximityChangedCallback = (int fenceId, ProximityState state, ProximityProvider provider, IntPtr data) => + { + ProximityStateEventArgs evenArgs = new ProximityStateEventArgs(fenceId, state, provider); + s_proximityChanged?.Invoke(null, evenArgs); + return true; + }; + + private static event EventHandler s_proximityChanged; + + /// + /// Called when a proximity state of device is changed. + /// + /// 3 + /// + /// Call to Start() will invoke this event. + /// + /// Incase of feature Not supported. + public event EventHandler ProximityChanged + { + add + { + if (s_proximityChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.SetProximityStateCB(Handle, s_proximityChangedCallback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to register proximity change callback"); + } + s_proximityChanged += value; + } + } + remove + { + s_proximityChanged -= value; + if (s_proximityChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.UnsetProximityStateCB(Handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to un register proximity change callback"); + } + } + } + } + + private static readonly Interop.GeofenceManager.GeofenceEventCallback s_geofenceEventCallback = (int placeId, int fenceId, GeofenceError error, GeofenceEventType eventType, IntPtr data) => + { + GeofenceResponseEventArgs evenArgs = new GeofenceResponseEventArgs(placeId, fenceId, error, eventType); + s_geofenceEventChanged?.Invoke(null, evenArgs); + return true; + }; + + private static event EventHandler s_geofenceEventChanged; + + /// + /// Called when the some event occurs in geofence and place such as add, update, etc.. + /// The events of public geofence is also received if there are public geofences. + /// + /// 3 + /// + /// Call to Start() will invoke this event. + /// The value of place_id or geofence_id is -1 when the place id or geofence id is not assigned. + /// + /// Incase of feature Not supported. + public event EventHandler GeofenceEventChanged + { + add + { + if (s_geofenceEventChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.SetGeofenceEventCB(Handle, s_geofenceEventCallback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to register geofence event change callback"); + } + s_geofenceEventChanged += value; + } + } + remove + { + s_geofenceEventChanged -= value; + if (s_geofenceEventChanged == null) + { + GeofenceError ret = (GeofenceError)Interop.GeofenceManager.UnsetGeofenceEventCB(Handle); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to unregister geofence event change callback"); + } + } + } + } + + /// + /// Overloaded Dispose API for destroying the GeofenceManager Handle. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (Handle != IntPtr.Zero) + { + Interop.GeofenceManager.Destroy(Handle); + Handle = IntPtr.Zero; + } + + _disposed = true; + } + } +} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/NamespaceDoc.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/NamespaceDoc.cs new file mode 100755 index 0000000..440da97 --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/NamespaceDoc.cs @@ -0,0 +1,33 @@ +/** + +The Tizen.Location.Geofence namespace provides classes for virtual perimeter. + + + +

Overview

+ +This API provides functions to set geofence with geopoint, MAC address of Wi-Fi, and Bluetooth address. +And notifications on events like changing in service status are provided.

+There are two kinds of places and fences:
+- Public places and fences that are created by MyPlace app can be used by all apps.
+- Private places and fences that are created by specified app can be used by the same app.

+Notifications can be received about the following events:
+- Zone in when a device enters a specific area
+- Zone out when a device exits a specific area
+- Results and errors for each event requested to geofence module

+The Geofence manager has the following properties:
+- geofence type
+- status
+- 'Service state change' callback + + +

Related Features

+To guarantee that the Geofence application runs on a device with Geofence profile feature, +declare the following feature requirements in the config file:
+http://tizen.org/feature/location
+http://tizen.org/feature/location.geofence
+http://tizen.org/feature/location.wps +
+
+*/ +namespace Tizen.Location.Geofence {} diff --git a/src/Tizen.Location.Geofence/Tizen.Location.Geofence/VirtualPerimeter.cs b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/VirtualPerimeter.cs new file mode 100755 index 0000000..0d5cffe --- /dev/null +++ b/src/Tizen.Location.Geofence/Tizen.Location.Geofence/VirtualPerimeter.cs @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Location.Geofence +{ + /// + /// Allows to create a virtual fence as Geofence using GeofenceManager instance. + /// User can manage all the geofence/place related data and events. + /// + /// 3 + public class VirtualPerimeter + { + private IntPtr Handle; + + /// + /// Creates a VirtualPerimeter which can be used to create virtual fence. + /// + /// 3 + /// GeofenceManager instance. + /// Incase of invlid parameter. + public VirtualPerimeter(GeofenceManager manager) + { + if (manager == null) + { + throw GeofenceErrorFactory.CreateException(GeofenceError.InvalidParameter, "Invalid GeofenceManager instance"); + } + else + { + Handle = manager.Handle; + } + } + + /// + /// Creates a new place for geofencing service. + /// + /// 3 + /// A place name to be created. + /// The place id to be newly created on success. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public int AddPlaceName(string name) + { + int placeId = 0; + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.AddPlace(Handle, name, out placeId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to add place to Geofence Manager for " + name); + } + + return placeId; + } + + /// + /// Updates the place name of a given place id. + /// + /// 3 + /// The specified place id. + /// A new place name of the place id. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public void UpdatePlace(int placeId, string name) + { + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.UpdatePlace(Handle, placeId, name); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to update place to Geofence Manager for " + placeId); + } + } + + /// + /// Removes the specific place for geofencing service. + /// + /// 3 + /// The specified place id. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public void RemovePlace(int placeId) + { + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.RemovePlace(Handle, placeId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to remove place from Geofence Manager for " + placeId); + } + } + + /// + /// Adds a geofence for a given geofence manager. + /// + /// 3 + /// The Geofence instance to be added. + /// The geofence id to be newly created on success. + /// The retun value will always be a number greater than zero. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public int AddGeofence(Fence fence) + { + int fenceId = 0; + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.AddFence(Handle, fence.Handle, out fenceId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to add fence to Geofence Manager "); + } + + return fenceId; + } + + /// + /// Removes a geofence with a given geofence id. + /// + /// 3 + /// The specified geofence id. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public void RemoveGeofence(int fenceId) + { + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.RemoveFence(Handle, fenceId); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to remove geofence from Geofence Manager for " + fenceId); + } + } + + /// + /// Gets the name of place. + /// + /// 3 + /// The place id. + /// The name of the place. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public string GetPlaceName(int placeId) + { + string name = ""; + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.GetPlaceName(Handle, placeId, out name); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to get placenamefrom Geofence Manager for " + placeId); + } + + return name; + } + + /// + /// Retrieves a list of places registered in the specified geofence manager. + /// + /// 3 + /// list of places registered as PlaceData instance list. + /// http://tizen.org/privilege/location + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public IEnumerable GetPlaceDataList() + { + List places = new List(); + Interop.VirtualPerimeter.ForEachPlaceListCallback placeCallback = (int placeId, string name, int index, int count, IntPtr data) => + { + if (count != 0) + { + PlaceData place = new PlaceData(placeId, name, index, count); + places.Add(place); + } + return true; + }; + + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.GetForEachPlaceList(Handle, placeCallback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to get Places list from Geofence Manager "); + } + + return places; + } + + /// + /// Retrieves a list of fences registered in the specified geofence manager. + /// + /// 3 + /// list of FenceData instances registred for each Geofence. + /// http://tizen.org/privilege/location + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public IEnumerable GetFenceDataList() + { + List fences = new List(); + Interop.VirtualPerimeter.ForEachFenceListCallback callback = (int fenceId, IntPtr handle, int index, int count, IntPtr data) => + { + if (count != 0) + { + FenceData fence = new FenceData(fenceId, handle, index, count); + fences.Add(fence); + } + return true; + }; + + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.GetForEachFenceList(Handle, callback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to get Geofence list from Geofence Manager "); + } + + return fences; + } + + /// + /// Retrieves a list of fences registered in the specified place. + /// + /// 3 + /// The place id. + /// list of FenceData instances registred for each Geofence for specified place. + /// http://tizen.org/privilege/location + /// Incase of Invalid parameter. + /// Incase of any System error. + /// Incase of Privileges are not defined. + /// Incase of Geofence is not supported. + public IEnumerable GetGeofenceDataListByPlaceId(int placeId) + { + List fences = new List(); + Interop.VirtualPerimeter.ForEachFenceListCallback callback = (int fenceId, IntPtr handle, int index, int count, IntPtr data) => + { + FenceData fence = new FenceData(fenceId, handle, index, count); + fences.Add(fence); + return true; + }; + + GeofenceError ret = (GeofenceError)Interop.VirtualPerimeter.GetForEachPlaceFenceList(Handle, placeId, callback, IntPtr.Zero); + if (ret != GeofenceError.None) + { + throw GeofenceErrorFactory.CreateException(ret, "Failed to get Geofence list from Geofence Manager for " + placeId); + } + + return fences; + } + } +} diff --git a/src/Tizen.Location/Interop/Interop.Libraries.cs b/src/Tizen.Location/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..7fd22e0 --- /dev/null +++ b/src/Tizen.Location/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + internal const string Location = "libcapi-location-manager.so.0"; + internal const string Libc = "libc.so.6"; + } +} \ No newline at end of file diff --git a/src/Tizen.Location/Interop/Interop.Location.cs b/src/Tizen.Location/Interop/Interop.Location.cs new file mode 100755 index 0000000..ad4466c --- /dev/null +++ b/src/Tizen.Location/Interop/Interop.Location.cs @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Location; + +internal static partial class Interop +{ + internal static partial class Locator + { + [DllImport(Libraries.Location, EntryPoint = "location_manager_create")] + internal static extern int Create(int locationMethod, out IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_start")] + internal static extern int Start(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_stop")] + internal static extern int Stop(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_start_batch")] + internal static extern int StartBatch(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_stop_batch")] + internal static extern int StopBatch(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_is_enabled_mock_location")] + internal static extern int IsEnabledMock(out bool status); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_enable_mock_location")] + internal static extern int EnableMock(bool enable); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_mock_location")] + internal static extern int SetMockLocation(IntPtr handle, double latitude, double longitude, double altitude, double speed, double direction, double accuracy); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_clear_mock_location")] + internal static extern int ClearMock(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_get_location")] + internal static extern int GetLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out int level, out double horizontal, out double vertical, out int timestamp); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_get_last_location")] + internal static extern int GetLastLocation(IntPtr handle, out double altitude, out double latitude, out double longitude, out double climb, out double direction, out double speed, out int level, out double horizontal, out double vertical, out int timestamp); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_add_boundary")] + internal static extern int AddBoundary(IntPtr managerHandle, IntPtr boundsHandle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_remove_boundary")] + internal static extern int RemoveBoundary(IntPtr managerHandle, IntPtr boundsHandle); + } + + internal static partial class LocatorHelper + { + [DllImport(Libraries.Location, EntryPoint = "location_manager_is_enabled_method")] + internal static extern int IsEnabled(int locationMethod, out bool status); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_is_supported_method")] + internal static extern bool IsSupported(int locationMethod); + } + + internal static partial class Location + { + [DllImport(Libraries.Location, EntryPoint = "location_manager_get_distance")] + internal static extern int GetDistanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, out double distance); + } + + internal static partial class LocatorEvent + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceStatechangedCallback(ServiceState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ZonechangedCallback(BoundaryState state, double latitude, double longitude, double altitude, int timesatmp, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SettingchangedCallback(LocationType method, bool enable, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void LocationchangedCallback(double latitude, double longitude, double altitude, double speed, double direction, double accuracy, int timeStamp, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void LocationUpdatedCallback(LocationError error, double latitude, double longitude, double altitude, int timestamp, double speed, double direction, double climb, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void LocationBatchCallback(int batch_size, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void LocationBatchGetCallback(double latitude, double longitude, double altitude, double speed, double direction, double horizontal, double vertical, int timeStamp, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_service_state_changed_cb")] + internal static extern int SetServiceStateChangedCallback(IntPtr handle, ServiceStatechangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_service_state_changed_cb")] + internal static extern int UnSetServiceStateChangedCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_zone_changed_cb")] + internal static extern int SetZoneChangedCallback(IntPtr handle, ZonechangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_zone_changed_cb")] + internal static extern int UnSetZoneChangedCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_setting_changed_cb")] + internal static extern int SetSettingChangedCallback(int method, SettingchangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_setting_changed_cb")] + internal static extern int UnSetSettingChangedCallback(int method); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_distance_based_location_changed_cb")] + internal static extern int SetDistanceBasedLocationChangedCallback(IntPtr handle, LocationchangedCallback callback, int interval, double distance, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_distance_based_location_changed_cb")] + internal static extern int UnSetDistanceBasedLocationChangedCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_location_changed_cb")] + internal static extern int SetLocationChangedCallback(IntPtr handle, LocationchangedCallback callback, int interval, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_location_changed_cb")] + internal static extern int UnSetLocationChangedCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_set_location_batch_cb")] + internal static extern int SetLocationBatchCallback(IntPtr handle, LocationBatchCallback callback, int batchInterval, int batchPeriod, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_unset_location_batch_cb")] + internal static extern int UnSetLocationBatchCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_foreach_location_batch")] + internal static extern int GetLocationBatch(IntPtr handle, LocationBatchGetCallback callback, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_manager_request_single_location")] + internal static extern int GetSingleLocation(IntPtr handle, int timeout, LocationUpdatedCallback callback, IntPtr userData); + } + + internal static partial class LocationBoundary + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PolygonCoordinatesCallback(Coordinate coordinates, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_rect")] + internal static extern int CreateRectangularBoundary(Coordinate topLeft, Coordinate bottomLeft, out IntPtr boundsHandle); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_circle")] + internal static extern int CreateCircleBoundary(Coordinate center, double radius, out IntPtr boundsHandle); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_create_polygon")] + internal static extern int CreatePolygonBoundary(IntPtr list, int listLength, out IntPtr boundsHandle); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_get_rect_coords")] + internal static extern int GetRectangleCoordinates(IntPtr handle, out Coordinate topLeft, out Coordinate bottomRight); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_get_circle_coords")] + internal static extern int GetCircleCoordinates(IntPtr handle, out Coordinate center, out double radius); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_foreach_polygon_coords")] + internal static extern int GetForEachPolygonCoordinates(IntPtr handle, PolygonCoordinatesCallback callback, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_contains_coordinates")] + internal static extern bool IsValidCoordinates(IntPtr handle, Coordinate coordinate); + + [DllImport(Libraries.Location, EntryPoint = "location_bounds_destroy")] + internal static extern int DestroyBoundary(IntPtr handle); + } + + internal static partial class GpsSatellite + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SatelliteStatuschangedCallback(uint numActive, uint numInView, int timeStamp, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SatelliteStatusinfomationCallback(uint azimuth, uint elevation, uint prn, uint snr, bool active, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "gps_status_get_nmea")] + internal static extern int GetNMEAData(IntPtr handle, out string nmea); + + [DllImport(Libraries.Location, EntryPoint = "gps_status_get_satellite")] + internal static extern int GetSatelliteStatus(IntPtr handle, out uint numberOfActive, out uint numberInView, out int timestamp); + + [DllImport(Libraries.Location, EntryPoint = "gps_status_set_satellite_updated_cb")] + internal static extern int SetSatelliteStatusChangedCallback(IntPtr handle, SatelliteStatuschangedCallback callback, int interval, IntPtr userData); + + [DllImport(Libraries.Location, EntryPoint = "gps_status_unset_satellite_updated_cb")] + internal static extern int UnSetSatelliteStatusChangedCallback(IntPtr handle); + + [DllImport(Libraries.Location, EntryPoint = "gps_status_foreach_satellites_in_view")] + internal static extern int GetForEachSatelliteInView(IntPtr handle, SatelliteStatusinfomationCallback callback, IntPtr userData); + } + + internal static DateTime ConvertDateTime(int timestamp) + { + DateTime dateTime = DateTime.Now; + + DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc); + dateTime = start.ToLocalTime(); + + return dateTime; + } +} diff --git a/src/Tizen.Location/Tizen.Location.csproj b/src/Tizen.Location/Tizen.Location.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Location/Tizen.Location.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Location/Tizen.Location.sln b/src/Tizen.Location/Tizen.Location.sln new file mode 100755 index 0000000..98a5ac6 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Location", "Tizen.Location.csproj", "{930A56B0-AE35-470A-8A56-6F762B4964AC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{53D6289A-C30A-4D18-A49F-BB3C3ECC15A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B75B5672-8C3C-433E-9A5D-20A7CC70E4F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {930A56B0-AE35-470A-8A56-6F762B4964AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {930A56B0-AE35-470A-8A56-6F762B4964AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {930A56B0-AE35-470A-8A56-6F762B4964AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {930A56B0-AE35-470A-8A56-6F762B4964AC}.Release|Any CPU.Build.0 = Release|Any CPU + {53D6289A-C30A-4D18-A49F-BB3C3ECC15A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53D6289A-C30A-4D18-A49F-BB3C3ECC15A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53D6289A-C30A-4D18-A49F-BB3C3ECC15A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53D6289A-C30A-4D18-A49F-BB3C3ECC15A8}.Release|Any CPU.Build.0 = Release|Any CPU + {B75B5672-8C3C-433E-9A5D-20A7CC70E4F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B75B5672-8C3C-433E-9A5D-20A7CC70E4F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B75B5672-8C3C-433E-9A5D-20A7CC70E4F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B75B5672-8C3C-433E-9A5D-20A7CC70E4F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Location/Tizen.Location/GpsSatellite.cs b/src/Tizen.Location/Tizen.Location/GpsSatellite.cs new file mode 100755 index 0000000..b9bf58d --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/GpsSatellite.cs @@ -0,0 +1,359 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Location +{ + /// + /// A class which contains the functionality for obtaining information about Gps satellites in range and in use. + /// + /// 3 + public class GpsSatellite + { + private int _interval = 1; + private Locator _locator; + private EventHandler _satelliteStatusChanged; + private IntPtr _handle = IntPtr.Zero; + + private Interop.GpsSatellite.SatelliteStatuschangedCallback _satelliteStatuschangedCallback; + private Interop.GpsSatellite.SatelliteStatusinfomationCallback _satelliteStatusinfomationCallback; + + /// + /// The time interval between callback updates. + /// Should be in the range [1~120] seconds. + /// + /// 3 + /// Thrown when an invalid argument is used. + public int Interval + { + get + { + Log.Info(Globals.LogTag, "Getting the Callback Interval"); + return _interval; + } + set + { + Log.Info(Globals.LogTag, "Setting the Callback Interval"); + if (value > 0 && value <= 120) + { + _interval = value; + } + else + { + Log.Error(Globals.LogTag, "Error Setting the Callback Interval"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The NMEAData from the Satellite. + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public string Nmea + { + get + { + Log.Info(Globals.LogTag, "Getting NMEAData"); + return GetNmea(); + } + } + + private string GetNmea() + { + string value = null; + int ret = Interop.GpsSatellite.GetNMEAData(_handle, out value); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting the NMEAData," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + + return value; + } + + + /// + /// The Count of Active satellites. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public int ActiveCount + { + get + { + return (int)GetActiveCount(); + } + } + + private uint GetActiveCount() + { + Log.Info(Globals.LogTag, "Getting the ActiveCount of satellites"); + uint numActive = 0; + uint numInView; + int timestamp; + int ret = Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting the satellite" + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return numActive; + } + + /// + /// The Count of satellites in view. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public int InViewCount + { + get + { + return (int)GetInViewCount(); + } + } + + private uint GetInViewCount() + { + Log.Info(Globals.LogTag, "Getting the In view count of satellites"); + uint numActive; + uint numInView = 0; + int timestamp; + int ret = Interop.GpsSatellite.GetSatelliteStatus(_handle, out numActive, out numInView, out timestamp); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting the satellite" + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return numInView; + } + + /// + /// The list of satellites/last recorded satellites in view. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public IList Satellites + { + get + { + return GetSatellites(); + } + } + + private IList GetSatellites() + { + List satelliteList = new List(); + Log.Info(Globals.LogTag, "Getting the list of satellites"); + + if (_satelliteStatusinfomationCallback == null) + { + _satelliteStatusinfomationCallback = (azimuth, elevation, prn, snr, active, userData) => + { + SatelliteInformation satellite = new SatelliteInformation(azimuth, elevation, prn, snr, active); + satelliteList.Add(satellite); + return true; + }; + } + + int ret = Interop.GpsSatellite.GetForEachSatelliteInView(_handle, _satelliteStatusinfomationCallback, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting the satellite" + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return satelliteList; + } + + /// + /// The constructor of GpsSatellite class. + /// + /// 3 + /// Locator object initilized using Gps. + /// Thrown when an invalid argument is used. + public GpsSatellite(Locator locator) + { + Log.Info(Globals.LogTag, "Calling GpsSatellite constructor"); + if (locator == null) + { + Log.Error(Globals.LogTag, "locator is null"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + + LocationType method = locator.LocationType; + if (method.Equals(LocationType.Gps) || method.Equals(LocationType.Hybrid)) + { + _locator = locator; + _handle = _locator.GetHandle(); + } + else + { + Log.Error(Globals.LogTag, "Error constructing GpsSatellite class"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + + /// + /// (event) SatelliteStatusUpdated is raised whenever satellite information is updated. + /// The callback will be invoked periodically (every Interval seconds). + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public event EventHandler SatelliteStatusUpdated + { + add + { + Log.Info(Globals.LogTag, "SatelliteStatusUpdated Add called"); + if (_satelliteStatusChanged == null) + { + Log.Info(Globals.LogTag, "SetSatelliteStatusChangeCallback called"); + SetSatelliteStatusChangeCallback(); + } + _satelliteStatusChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "SatelliteStatusUpdated Remove called"); + _satelliteStatusChanged -= value; + if (_satelliteStatusChanged == null) + { + Log.Info(Globals.LogTag, "UnSetSatelliteStatusChangeCallback called"); + UnSetSatelliteStatusChangeCallback(); + } + } + } + + private void SetSatelliteStatusChangeCallback() + { + Log.Info(Globals.LogTag, "SetSatelliteStatusChangeCallback"); + if (_satelliteStatuschangedCallback == null) + { + _satelliteStatuschangedCallback = (numActive, numInView, timestamp, userData) => + { + Log.Info(Globals.LogTag, "Inside SatelliteStatusChangedCallback"); + DateTime timeStamp = DateTime.Now; + + if (timestamp != 0) + { + DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc); + timeStamp = start.ToLocalTime(); + } + _satelliteStatusChanged?.Invoke(_handle, new SatelliteStatusChangedEventArgs(numActive, numInView, timeStamp)); + }; + } + + GCHandle handle = GCHandle.Alloc(this); + int ret = Interop.GpsSatellite.SetSatelliteStatusChangedCallback(_handle, _satelliteStatuschangedCallback, _interval, GCHandle.ToIntPtr(handle)); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in setting satellite status changed callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetSatelliteStatusChangeCallback() + { + Log.Info(Globals.LogTag, "UnSetSatelliteStatusChangeCallback"); + int ret = Interop.GpsSatellite.UnSetSatelliteStatusChangedCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Getting Unsetting satellite status changed callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + } + + /// + /// A class which contains the information of the Satellite under consideration. + /// + /// 3 + public class SatelliteInformation + { + /// + /// Class Constructor for SatelliteInformation class. + /// + /// 3 + /// The azimuth value of the satellite in degrees. + /// The elevation of the satellite in meters. + /// The Prn value of the satellite. + /// The SNR value of the satellite in dB. + /// The flag signaling if satellite is in use. + public SatelliteInformation(uint azimuth, uint elevation, uint prn, uint snr, bool active) + { + Azimuth = azimuth; + Elevation = elevation; + Prn = prn; + Snr = snr; + Active = active; + } + + /// + /// The Azimuth information of the Satellite. + /// + /// 3 + /// The azimuth value of the satellite in degrees. + public uint Azimuth { get; private set; } + + /// + /// The Elevation information of the Satellite. + /// + /// 3 + /// The azimuth value of the satellite in degrees. + public uint Elevation { get; private set; } + + /// + /// The PRN of the Satellite. + /// + /// 3 + /// The azimuth value of the satellite in degrees. + public uint Prn { get; private set; } + + /// + /// The SNR of the Satellite. + /// + /// 3 + public uint Snr { get; private set; } + + /// + /// The operational status of the Satellite. + /// + /// 3 + public bool Active { get; private set; } + } +} diff --git a/src/Tizen.Location/Tizen.Location/Location.cs b/src/Tizen.Location/Tizen.Location/Location.cs new file mode 100755 index 0000000..7127800 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/Location.cs @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Location +{ + /// + /// A class which contains the details of the location rrequested. + /// Includes the functionality to get the distance between locations. + /// + /// 3 + public class Location + { + private double _latitude; + private double _longitude; + private double _altitude; + private double _speed; + private double _direction; + private double _accuracy; + internal int _timestamp; + + /// + /// The default constructor of Location Class. + /// + /// 3 + public Location() + { + } + + /// + /// The parameterized constructor of Location Class. + /// + /// 3 + /// Latitude component of the device co-ordinate [-90.0 ~ 90.0] (degrees). + /// Longitude component of the device co-ordinate[-180.0 ~ 180.0] (degrees). + /// Altitude value. + /// Accuracy in meters. + /// Devie Speed. + /// Device direction with respect to north. + /// Time when the measurement took place. + /// Thrown when an invalid argument is used. + public Location(double latitude, double longitude, double altitude, double speed, double direction, double accuracy, int timestamp) + { + _latitude = latitude; + _longitude = longitude; + _altitude = altitude; + _speed = speed; + _direction = direction; + _accuracy = accuracy; + _timestamp = timestamp; + } + + /// + /// The current latitude [-90.0 ~ 90.0] (degrees). + /// + /// 3 + public double Latitude + { + get + { + Log.Info(Globals.LogTag, "Getting the latitude"); + return _latitude; + } + set + { + Log.Info(Globals.LogTag, "Setting the latitude"); + if (value >= -90.0 && value <= 90.0) + { + _latitude = value; + } + else + { + Log.Error(Globals.LogTag, "Error setting latitude"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The current longitude [-180.0 ~ 180.0] (degrees). + /// + /// 3 + public double Longitude + { + get + { + Log.Info(Globals.LogTag, "Getting the longitude"); + return _longitude; + } + set + { + Log.Info(Globals.LogTag, "Setting the longitude"); + if (value >= -180.0 && value <= 180.0) + { + _longitude = value; + } + else + { + Log.Error(Globals.LogTag, "Error setting longitude"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The current altitude (meters). + /// + /// 3 + public double Altitude + { + get + { + return _altitude; + } + set + { + _altitude = value; + } + } + + /// + /// The Device Speed (km/h). + /// + /// 3 + public double Speed + { + get + { + return _speed; + } + set + { + _speed = value; + } + } + + /// + /// The direction, degrees from the north. + /// + /// 3 + public double Direction + { + get + { + return _direction; + } + set + { + _direction = value; + } + } + + /// + /// The accuracy. + /// + /// 3 + public double Accuracy + { + get + { + return _accuracy; + } + set + { + _accuracy = value; + } + } + + /// + /// The time value when the measurement was done. + /// + /// 3 + public DateTime Timestamp + { + get + { + return Interop.ConvertDateTime(_timestamp); + } + internal set + { + Timestamp = value; + } + + } + + /// + /// Gets the distance between the two given coordinates. + /// + /// 3 + /// The latitude of the source location [-90.0 ~ 90.0] (degrees). + /// The Longitude of the source location[-180.0 ~ 180.0] (degrees). + /// The latitude of the source location [-90.0 ~ 90.0] (degrees). + /// The longitude of the source location[-180.0 ~ 180.0] (degrees). + /// Returns the distance between source and destination. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public static double GetDistanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude) + { + double result; + Log.Info(Globals.LogTag, "Calling GetDistanceBetween"); + int ret = Interop.Location.GetDistanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, out result); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting single distance information ," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return result; + } + + /// + /// Gets the distance between the current and specified location. + /// + /// 3 + /// The location object to which distance is to be calculated. + /// Returns the distance to the specified location. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public double GetDistanceTo(Location location) + { + double result; + Log.Info(Globals.LogTag, "Calling GetDistanceTo"); + int ret = Interop.Location.GetDistanceBetween(this.Latitude, this.Longitude, location.Latitude, location.Longitude, out result); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error getting distance information to the specifed location," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return result; + } + } +} diff --git a/src/Tizen.Location/Tizen.Location/LocationBoundary.cs b/src/Tizen.Location/Tizen.Location/LocationBoundary.cs new file mode 100755 index 0000000..f66f609 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/LocationBoundary.cs @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Location +{ + /// + /// Abstract class which provides functions related to geographic bounds information. + /// + /// 3 + public abstract class LocationBoundary : IDisposable + { + internal IntPtr handle; + private bool _disposed = false; + + /// + /// Gets the location boundary type. + /// + /// 3 + public BoundaryType BoundaryType{ get; internal set; } + + internal LocationBoundary() { } + /// + /// The destructor of LocationBoundary class. + /// + /// 3 + ~LocationBoundary() + { + Log.Info(Globals.LogTag, "The destructor of LocationBoundary class"); + Dispose(false); + } + + internal IntPtr GetHandle() + { + return handle; + } + + /// + /// Checks if the boundary contains the specified geographical coordinates. + /// + /// 3 + /// The coordinate which needs to be checked. + /// Returns a boolean value indicating whether or not the specified coordinate lies in the geographical area. + public bool BoundaryContainsCoordinates(Coordinate coordinate) + { + Log.Info(Globals.LogTag, "Checking if coordinates are contained within boundary"); + return Interop.LocationBoundary.IsValidCoordinates(handle, coordinate); + } + + /// + /// The overidden Dispose method of the IDisposable class. + /// + /// 3 + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public void Dispose() + { + Log.Info(Globals.LogTag, "Dispose"); + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + Log.Info(Globals.LogTag, "Dispose"); + if (_disposed) + return; + + if (disposing) + DestroyHandle(); + + _disposed = true; + } + + private void DestroyHandle() + { + Log.Info(Globals.LogTag, "DestroyBoundaryHandle"); + int ret = Interop.LocationBoundary.DestroyBoundary(handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in DestroyBoundary handle" + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + } + + /// + /// Class representing a rectangular location boundary. + /// Inherits the Abstract LocationBoundary class. + /// + /// 3 + public class RectangleBoundary : LocationBoundary + { + /// + /// Constructor of the Rectangle boundary class. + /// + /// 3 + /// The coordinate which constitute the top left handside of the rectangular boundary. + /// The coordinate which constitute the bottom right handside of the rectangular boundary. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public RectangleBoundary(Coordinate topLeft, Coordinate bottomRight) + { + Log.Info(Globals.LogTag, "Calling RectangleBoundary constructor"); + BoundaryType = BoundaryType.Rectangle; + IntPtr boundsHandle; + int ret = Interop.LocationBoundary.CreateRectangularBoundary(topLeft, bottomRight, out boundsHandle); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Creating Rectangular Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + handle = boundsHandle; + } + + /// + /// Gets the Top Left handside coordinate of a rectangular boundary. + /// + /// 3 + public Coordinate TopLeft + { + get + { + Log.Info(Globals.LogTag, "Calling to get CoordinateItem TopLeft"); + return GetRectangleCoordinate("TopLeft"); + } + } + + /// + /// Gets the Bottom Right handside coordinate of a rectangular boundary. + /// + /// 3 + public Coordinate BottomRight + { + get + { + Log.Info(Globals.LogTag, "Calling to get CoordinateItem BottomRight"); + return GetRectangleCoordinate("BottomRight"); + } + } + + private Coordinate GetRectangleCoordinate(string tag) + { + Coordinate topLeft; + Coordinate bottomRight; + + Interop.LocationBoundary.GetRectangleCoordinates(handle, out topLeft, out bottomRight); + + if (tag.Equals("TopLeft")) + { + return topLeft; + } + else + { + return bottomRight; + } + } + } + + /// + /// Class representing a circular location boundary. + /// Inherits the Abstract LocationBoundary class. + /// + /// 3 + public class CircleBoundary : LocationBoundary + { + /// + /// Constructor of the Circular boundary class. + /// + /// 3 + /// The coordinates which constitute the center of the circular boundary. + /// The radius value of the circular boundary. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public CircleBoundary(Coordinate coordinate, double radius) + { + Log.Info(Globals.LogTag, "Calling CircleBoundary constructor"); + BoundaryType = BoundaryType.Circle; + IntPtr boundsHandle; + int ret = Interop.LocationBoundary.CreateCircleBoundary(coordinate, radius, out boundsHandle); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Creating Circular Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + handle = boundsHandle; + } + + /// + /// Gets the coordinate of the center of a circular boundary. + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public Coordinate Center + { + get + { + return GetCircleCenter(); + } + } + + /// + /// Gets the radius of a circular boundary. + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public double Radius + { + get + { + return GetRadius(); + } + } + + private Coordinate GetCircleCenter() + { + Log.Info(Globals.LogTag, "Calling to get CoordinateItem Center"); + Coordinate center; + double radius; + int ret = Interop.LocationBoundary.GetCircleCoordinates(handle, out center, out radius); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Get Circle Center," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + return center; + } + + private double GetRadius() + { + Coordinate center; + double radius = 0; + int ret = Interop.LocationBoundary.GetCircleCoordinates(handle, out center, out radius); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Get Radius," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + return radius; + } + } + + /// + /// Class representing a polygonal location boundary. + /// Inherits the Abstract LocationBoundary class. + /// + /// 3 + public class PolygonBoundary : LocationBoundary + { + /// + /// Constructor of the polygon boundary class. + /// + /// 3 + /// The coordinates which constitute the polgonal boundary. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public PolygonBoundary(IList coordinates) + { + Log.Info(Globals.LogTag, "Calling PolygonBoundary Constructor"); + if (coordinates == null) + { + Log.Error(Globals.LogTag, "coordingtes list is null"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + + BoundaryType = BoundaryType.Polygon; + IntPtr listPointer = Marshal.AllocHGlobal(Marshal.SizeOf(coordinates[0]) * coordinates.Count); + IntPtr boundsHandle; + for (int i = 0; i < coordinates.Count; i++) + { + Marshal.StructureToPtr(coordinates[i], listPointer + i * Marshal.SizeOf(coordinates[0]), false); + } + int ret = Interop.LocationBoundary.CreatePolygonBoundary(listPointer, coordinates.Count, out boundsHandle); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Creating Polygon Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + handle = boundsHandle; + } + + /// + /// Gets the list of coordinates which constitute a polygonal boundary + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public IList Coordinates + { + get + { + return GetCoordinates(); + } + } + + private IList GetCoordinates() + { + Log.Info(Globals.LogTag, "Calling to get Polygon coordinates"); + List coordinateList = new List(); + Interop.LocationBoundary.PolygonCoordinatesCallback callback = (Coordinate coordinate, IntPtr userData) => + { + Coordinate item; + item.Latitude = coordinate.Latitude; + item.Longitude = coordinate.Longitude; + coordinateList.Add(item); + return true; + }; + + int ret = Interop.LocationBoundary.GetForEachPolygonCoordinates(handle, callback, IntPtr.Zero); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Get foreach Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + return coordinateList; + } + } + + /// + /// The structure which represents the co-ordinates of a geographical location. + /// + /// 3 + [StructLayout(LayoutKind.Sequential)] + public struct Coordinate + { + /// + /// Latitude component of the co-ordinate. + /// Should have a value between [-90.0 ~ 90.0] (degrees). + /// + /// 3 + public double Latitude; + + /// + /// Longitude component of the co-ordinate. + /// Should have a value between [-180.0 ~ 180.0] (degrees). + /// + /// 3 + public double Longitude; + } +} diff --git a/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs new file mode 100755 index 0000000..6bfe66d --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/LocationChangedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + /// + /// An extended EventArgs class which contains the changed location information. + /// + /// 3 + public class LocationChangedEventArgs : EventArgs + { + + /// + /// Class Constructor for LocationUpdatedEventArgs class. + /// + /// 3 + /// Object of Location class. + public LocationChangedEventArgs(Location location) + { + Location = location; + } + + /// + /// Get the Location Update information. + /// + /// 3 + public Location Location { get; private set; } + } +} diff --git a/src/Tizen.Location/Tizen.Location/LocationError.cs b/src/Tizen.Location/Tizen.Location/LocationError.cs new file mode 100755 index 0000000..3254d8e --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/LocationError.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Location +{ + internal static class LocationManagerError + { + public const int Base = -0x02C00000; + public const int BoundsBase = -0x02C00000 | 0x20; + } + + /// + /// Location Manager error codes. + /// + /// 3 + public enum LocationError + { + None = ErrorCode.None,/**< Successful */ + OutOfMemory = ErrorCode.OutOfMemory,/**< Out of memory error */ + InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */ + AcessibilityNotallowed = ErrorCode.PermissionDenied,/**< Permission denied */ + NotSupported = ErrorCode.NotSupported,/**< Address family not supported */ + IncorrectMethod = LocationManagerError.Base | 0x01,/**< Location manager contains incorrect method for a given call */ + NetworkFailed = LocationManagerError.Base | 0x02,/**< Network unavailable */ + ServiceNotAvailable = LocationManagerError.Base | 0x03,/**< Location service is not available */ + SettingOff = LocationManagerError.Base | 0x04,/**< GPS/WPS, or MOCK setting is not enabled */ + SecuirtyRestricted = LocationManagerError.Base | 0x05,/**< Restricted by security system policy */ + } + + /// + /// Location Boundary error codes. + /// + /// 3 + public enum LocationBoundError + { + None = ErrorCode.None,/**< Successful */ + OutOfMemory = ErrorCode.OutOfMemory,/**< Out of memory error */ + InvalidParameter = ErrorCode.InvalidParameter,/**< Invalid parameter */ + NotSupported = ErrorCode.NotSupported,/**< Not supported */ + IncorrectType = LocationManagerError.BoundsBase | 0x01,/**< Incorrect bounds type for a given call */ + IsAdded = LocationManagerError.BoundsBase | 0x02/**< Cannot remove bounds handle from location manager */ + } + + internal static class LocationErrorFactory + { + internal static Exception ThrowLocationException(int errCode) + { + Log.Error(Globals.LogTag, "Throw Location Exception : " + errCode); + LocationError error = (LocationError)errCode; + switch (error) + { + case LocationError.OutOfMemory: + return new InvalidOperationException("Out of memory"); + case LocationError.InvalidParameter: + return new ArgumentException("Invalid Parameter passed"); + case LocationError.AcessibilityNotallowed: + return new UnauthorizedAccessException("Accesibility not allowed"); + case LocationError.NotSupported: + return new NotSupportedException("Not supported"); + case LocationError.IncorrectMethod: + return new InvalidOperationException("Incorrect method used"); + case LocationError.NetworkFailed: + return new InvalidOperationException("Network failed"); + case LocationError.ServiceNotAvailable: + return new InvalidOperationException("Service not available"); + case LocationError.SettingOff: + return new InvalidOperationException("Current locationtype setting is off"); + case LocationError.SecuirtyRestricted: + return new InvalidOperationException("Security Restricted"); + default: + return new InvalidOperationException("Unknown Error"); + } + } + + internal static Exception ThrowLocationBoundaryException(int errCode) + { + LocationBoundError error = (LocationBoundError)errCode; + switch (error) + { + case LocationBoundError.OutOfMemory: + return new InvalidOperationException("Out of memory exception"); + case LocationBoundError.InvalidParameter: + return new ArgumentException("Invalid parameter passed"); + case LocationBoundError.NotSupported: + return new NotSupportedException("Not supported"); + case LocationBoundError.IncorrectType: + return new InvalidOperationException("Incorrect type passed"); + case LocationBoundError.IsAdded: + return new InvalidOperationException("Boundary is not addded"); + default: + return new InvalidOperationException("Unknown Error"); + } + } + } +} diff --git a/src/Tizen.Location/Tizen.Location/Locator.cs b/src/Tizen.Location/Tizen.Location/Locator.cs new file mode 100755 index 0000000..3c2d320 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/Locator.cs @@ -0,0 +1,965 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Tizen.Internals.Errors; +using System.Runtime.InteropServices; + +namespace Tizen.Location +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Location"; + } + + /// + /// A class which contains the functionality for obtaining geographical infomation and setting boundary condition. + /// Notifications on events like service becoming enabled or disabled, new position data being available + /// and others can also be acquired. + /// + /// 3 + public class Locator : IDisposable + { + private int _interval = 1; + private int _stayInterval = 120; + private int _batchInterval = 0; + private int _batchPeriod = 0; + private int _requestId = 0; + private double _distance = 120.0; + private bool _isEnableMock = false; + private bool _disposed = false; + private bool _isStarted = false; + private IntPtr _handle; + private LocationType _locationType; + private Location _location = null; + private Dictionary _callback_map = new Dictionary(); + + private Interop.LocatorEvent.ServiceStatechangedCallback _serviceStateChangedCallback; + private Interop.LocatorEvent.ZonechangedCallback _zoneChangedCallback; + private Interop.LocatorEvent.SettingchangedCallback _settingChangedCallback; + private Interop.LocatorEvent.LocationchangedCallback _distanceBasedLocationChangedCallback; + private Interop.LocatorEvent.LocationchangedCallback _locationChangedCallback; + private Interop.LocatorEvent.LocationBatchCallback _locationBatchCallback; + private Interop.LocatorEvent.LocationBatchGetCallback _locationBatchGetCallback; + + private EventHandler _zoneChanged; + private EventHandler _serviceStateChanged; + private EventHandler _settingChanged; + private EventHandler _distanceBasedLocationChanged; + private EventHandler _locationChanged; + + /// + /// The constructor of Locator class. + /// + /// 3 + /// The back-end positioning method to be used for LBS. + /// http://tizen.org/feature/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public Locator(LocationType locationType) + { + Log.Info(Globals.LogTag, "Locator Constructor"); + int ret = Interop.Locator.Create((int)locationType, out _handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error creating Location Manager," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + _location = new Location(); + _locationType = locationType; + } + + /// + /// The destructor of Locator class. + /// + /// 3 + ~Locator() + { + Dispose(false); + } + + /// + /// The time interval between callback updates. + /// Should be in the range [1~120] seconds. + /// + /// 3 + /// Thrown when an invalid argument is used. + public int Interval + { + get + { + Log.Info(Globals.LogTag, "Getting the Callback Interval"); + return _interval; + } + set + { + Log.Info(Globals.LogTag, "Setting the Callback Interval"); + if (value > 0 && value <= 120) + { + _interval = value; + } + else + { + Log.Error(Globals.LogTag, "Error setting Callback Interval"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The time interval between Distance based location callback updates. + /// Should be in the range [1~120] seconds. + /// + /// 3 + /// Thrown when an invalid argument is used. + public int StayInterval + { + get + { + Log.Info(Globals.LogTag, "Getting the StayInterval"); + return _stayInterval; + } + set + { + Log.Info(Globals.LogTag, "Setting the StayInterval"); + if (value > 0 && value <= 120) + { + _stayInterval = value; + } + else + { + Log.Error(Globals.LogTag, "Error Setting the StayInterval"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The time interval between position collection in batch mode. + /// Should be in the range [1~255] seconds. + /// + /// 3 + /// Thrown when an invalid argument is used. + public int BatchInterval + { + get + { + Log.Info(Globals.LogTag, "Getting the Batch Interval"); + return _batchInterval; + } + set + { + Log.Info(Globals.LogTag, "Setting the Batch Interval"); + if (value > 0 && value <= 255) + { + _batchInterval = value; + } + else + { + Log.Error(Globals.LogTag, "Error setting Callback Interval"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The time interval between batch callback updates. The BatchPeriod should be greater than or equal to the BatchInterval. If BatchPeriod is zero or smaller than BatchInterval, then batch mode will not working. In addition, sometimes the period may not work as you intended, the maximum permissible value for batch_period is device specific. + /// Should be in the range [0~60000] seconds. + /// + /// 3 + /// Thrown when an invalid argument is used. + public int BatchPeriod + { + get + { + Log.Info(Globals.LogTag, "Getting the Batch Period"); + return _batchPeriod; + } + set + { + Log.Info(Globals.LogTag, "Setting the Batch Period"); + if (value >= 0 && value <= 60000) + { + _batchPeriod = value; + } + else + { + Log.Error(Globals.LogTag, "Error setting Batch Period"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// The distance between callback updates. + /// Should be in the range [1-120] meters. + /// + /// 3 + /// Thrown when an invalid argument is used. + public double Distance + { + get + { + Log.Info(Globals.LogTag, "Getting the Distance Interval"); + return _distance; + } + set + { + Log.Info(Globals.LogTag, "Setting the Distance Interval"); + if (value > 0 && value <= 120) + { + _distance = value; + } + else + { + Log.Error(Globals.LogTag, "Error Setting the Distance"); + throw LocationErrorFactory.ThrowLocationException((int)LocationError.InvalidParameter); + } + } + } + + /// + /// Gets the Location object. + /// + /// 3 + public Location Location + { + get + { + Log.Info(Globals.LogTag, "Getting location details"); + return _location; + } + } + + /// + /// Gets the type used to obtain Location data. + /// + /// 3 + public LocationType LocationType + { + get + { + Log.Info(Globals.LogTag, "Getting LocationType"); + return _locationType; + } + } + + /// + /// Gets the status whether mock location is enabled or not. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public bool EnableMock + { + get + { + Log.Info(Globals.LogTag, "Getting getting Mock"); + _isEnableMock = GetEnableMock(); + return _isEnableMock; + } + set + { + _isEnableMock = value; + SetEnableMock(); + } + } + + internal IntPtr GetHandle() + { + return _handle; + } + + private bool GetEnableMock() + { + bool status = false; + int ret = Interop.Locator.IsEnabledMock(out status); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error Get Enable Mock Status," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return status; + } + + private void SetEnableMock() + { + int ret = Interop.Locator.EnableMock(_isEnableMock); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error Set Enable Mock Status," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// Starts the Location Manager which has been created using the specified method. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public void Start() + { + Log.Info(Globals.LogTag, "Starting Location Manager"); + if (_batchPeriod > 0 && _batchPeriod > _batchInterval) + { + int ret = Interop.Locator.StartBatch(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error Starting Location Batch mode," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + else + { + int ret = Interop.Locator.Start(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error Starting Location Manager," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + _isStarted = true; + } + + /// + /// Stops the Location Manager which has been activated using the specified method. + /// Does not destroy the manager. + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public void Stop() + { + Log.Info(Globals.LogTag, "Stopping Location Manager"); + int ret = Interop.Locator.Stop(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error stopping Location Manager," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + _isStarted = false; + } + + /// + /// Sets a mock location for the given location method. + /// + /// 3 + /// The location object containing the mock location details. + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public void SetMockLocation(Location location) + { + Log.Info(Globals.LogTag, "Setting mock location"); + int ret = Interop.Locator.SetMockLocation(_handle, location.Latitude, location.Longitude, location.Altitude, location.Speed, location.Direction, location.Accuracy); + if (((LocationError)ret == LocationError.None)) + { + _location.Latitude = location.Latitude; + _location.Longitude = location.Longitude; + _location.Altitude = location.Altitude; + _location.Speed = location.Speed; + _location.Direction = location.Direction; + _location.Accuracy = location.Accuracy; + } + else + { + Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// Clears a mock location for the given location method. + /// + /// 3 + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public void ClearMock() + { + Log.Info(Globals.LogTag, "Clear mock location"); + int ret = Interop.Locator.ClearMock(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in clear up location mocking," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// Gets the details of the location asynchronously. + /// + /// 3 + /// Timeout to stop requesting single location after(seconds). + /// A task which contains the current location details + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public Task GetLocationAsync(int timeout) + { + var task = new TaskCompletionSource(); + IntPtr id = IntPtr.Zero; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (LocationError error, double latitude, double longitude, double altitude, int timestamp, double speed, double direction, double climb, IntPtr userData) => + { + if (error != LocationError.None) + { + Log.Error(Globals.LogTag, "Error in getting up location information," + (LocationError)error); + } + else + { + Log.Info(Globals.LogTag, "Creating a current location object"); + _location = new Location(latitude, longitude, altitude, speed, direction, 0.0, timestamp); + task.SetResult(_location); + } + lock (_callback_map) + { + _callback_map.Remove(userData); + } + }; + } + + int ret = Interop.LocatorEvent.GetSingleLocation(_handle, timeout, _callback_map[id], id); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in setting up location mocking," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return task.Task; + } + + + /// + /// Gets the details of the location. + /// + /// 3 + /// which contains the current location details. + /// http://tizen.org/privilege/location + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the app has no privilege to use the location. + /// Thrown when the location is not supported. + public Location GetLocation() + { + double latitude = 0; + double longitude = 0; + double altitude = 0; + double climb = 0; + double speed = 0; + double direction = 0; + int level = 0; + double accuracy = 0; + double vertical = 0; + int timestamp = 0; + + if (_isStarted) + { + Log.Info(Globals.LogTag, "Get current location information"); + int ret = Interop.Locator.GetLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out accuracy, out vertical, out timestamp); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in get current location infomation," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + else + { + Log.Info(Globals.LogTag, "Get last location information"); + int ret = Interop.Locator.GetLastLocation(_handle, out altitude, out latitude, out longitude, out climb, out direction, out speed, out level, out accuracy, out vertical, out timestamp); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in get last location information," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp); + _location = location; + + return location; + } + + + /// + /// Adds a bounds for a given locator. + /// + /// 3 + /// The boundary object to be added to the locator. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public void AddBoundary(LocationBoundary locationBoundary) + { + Log.Info(Globals.LogTag, "AddBoundary called"); + + int ret = Interop.Locator.AddBoundary(_handle, locationBoundary.GetHandle()); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Adding Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + } + + /// + /// Deletes a bounds for a given locator. + /// + /// 3 + /// The boundary object to be removed from the locator. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public void RemoveBoundary(LocationBoundary locationBoundary) + { + Log.Info(Globals.LogTag, "RemoveBoundary called"); + int ret = Interop.Locator.RemoveBoundary(_handle, locationBoundary.GetHandle()); + if ((LocationBoundError)ret != LocationBoundError.None) + { + Log.Error(Globals.LogTag, "Error Removing Boundary," + (LocationBoundError)ret); + throw LocationErrorFactory.ThrowLocationBoundaryException(ret); + } + } + + /// + /// The overidden Dispose method of the IDisposable class. + /// + /// 3 + /// Thrown when an invalid argument is used. + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + DestroyHandle(); + + _disposed = true; + } + + private void DestroyHandle() + { + int ret = Interop.Locator.Destroy(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Destroy handle, " + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// (event) ServiceStateChanged Event is invoked when the location service state is changed. + /// + /// 3 + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public event EventHandler ServiceStateChanged + { + add + { + Log.Info(Globals.LogTag, "ServiceStateChanged called"); + if (_serviceStateChanged == null) + { + Log.Info(Globals.LogTag, "Calling function SetServiceStateChangedCallback"); + SetServiceStateChangedCallback(); + } + _serviceStateChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "Callback removed"); + _serviceStateChanged -= value; + + if (_serviceStateChanged == null) + { + Log.Info(Globals.LogTag, "Calling function UnSetServiceStateChangedCallback"); + UnSetServiceStateChangedCallback(); + } + } + } + + private void SetServiceStateChangedCallback() + { + Log.Info(Globals.LogTag, "Calling Interop.LocatorEvent.SetServiceStateChangedCallback"); + if (_serviceStateChangedCallback == null) + { + _serviceStateChangedCallback = (state, userData) => + { + Log.Info(Globals.LogTag, "Inside ServiceStateChangedCallback"); + _serviceStateChanged?.Invoke(this, new ServiceStateChangedEventArgs(state)); + }; + } + + int ret = Interop.LocatorEvent.SetServiceStateChangedCallback(_handle, _serviceStateChangedCallback, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting Service State Changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetServiceStateChangedCallback() + { + Log.Info(Globals.LogTag, "Calling Interop.LocatorEvent.UnSetServiceStateChangedCallback"); + int ret = Interop.LocatorEvent.UnSetServiceStateChangedCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in UnSetting Service State Changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// (event) ZoneChanged is invoked when the previously set boundary area is entered or left. + /// + /// 3 + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public event EventHandler ZoneChanged + { + add + { + Log.Info(Globals.LogTag, "ZoneChanged called"); + if (_zoneChanged == null) + { + Log.Info(Globals.LogTag, "Calling function SetZoneChangedCallback"); + SetZoneChangedCallback(); + } + _zoneChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "Callback removed"); + _zoneChanged -= value; + + if (_zoneChanged == null) + { + Log.Info(Globals.LogTag, "Calling function UnSetZoneChangedCallback"); + UnSetZoneChangedCallback(); + } + } + } + + private void SetZoneChangedCallback() + { + Log.Info(Globals.LogTag, "Inside SetZoneChangedCallback"); + if (_zoneChangedCallback == null) + { + _zoneChangedCallback = (state, latitude, longitude, altitude, timestamp, userData) => + { + Log.Info(Globals.LogTag, "Inside ZoneChangedCallback"); + DateTime timeStamp = DateTime.Now; + if (timestamp != 0) + { + DateTime start = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(timestamp), DateTimeKind.Utc); + timeStamp = start.ToLocalTime(); + } + _zoneChanged?.Invoke(this, new ZoneChangedEventArgs(state, latitude, longitude, altitude, timeStamp)); + }; + } + + int ret = Interop.LocatorEvent.SetZoneChangedCallback(_handle, _zoneChangedCallback, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting Zone Changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetZoneChangedCallback() + { + Log.Info(Globals.LogTag, "Inside UnSetZoneChangedCallback"); + int ret = Interop.LocatorEvent.UnSetZoneChangedCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in UnSetting Zone Changed Callback," + (LocationError)ret); + } + } + + /// + /// (event) SetttingChanged is raised when the location setting is changed. + /// + /// 3 + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public event EventHandler SettingChanged + { + add + { + Log.Info(Globals.LogTag, "Adding SettingChanged EventHandler"); + if (_settingChanged == null) + { + Log.Info(Globals.LogTag, "Calling function SetSettingChangedCallback"); + SetSettingChangedCallback(); + } + _settingChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "Removing SettingChanged EventHandler"); + _settingChanged -= value; + + if (_settingChanged == null) + { + Log.Info(Globals.LogTag, "Calling function UnSetSettingChangedCallback"); + UnSetSettingChangedCallback(); + } + } + } + + private void SetSettingChangedCallback() + { + Log.Info(Globals.LogTag, "Calling SetSettingChangedCallback"); + if (_settingChangedCallback == null) + { + _settingChangedCallback = (method, enable, userData) => + { + Log.Info(Globals.LogTag, "Calling SettingChangedCallback"); + _settingChanged?.Invoke(this, new SettingChangedEventArgs(method, enable)); + }; + } + + int ret = Interop.LocatorEvent.SetSettingChangedCallback((int)_locationType, _settingChangedCallback, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting Changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetSettingChangedCallback() + { + Log.Info(Globals.LogTag, "Calling UnSetSettingChangedCallback"); + int ret = Interop.LocatorEvent.UnSetSettingChangedCallback((int)_locationType); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Unsetting Setting's Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + /// + /// (event) DistanceBasedLocationChanged is raised with updated location information. + /// The callback will be invoked at minimum interval or minimum distance with updated position information. + /// + /// 3 + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public event EventHandler DistanceBasedLocationChanged + { + add + { + Log.Info(Globals.LogTag, "Adding DistanceBasedLocationChanged EventHandler"); + //if (_distanceBasedLocationChanged == null) + { + Log.Info(Globals.LogTag, "Calling function SetDistanceBasedLocationChangedCallback"); + SetDistanceBasedLocationChangedCallback(); + } + _distanceBasedLocationChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "Removing DistanceBasedLocationChanged EventHandler"); + _distanceBasedLocationChanged -= value; + + if (_distanceBasedLocationChanged == null) + { + Log.Info(Globals.LogTag, "Calling function UnSetDistanceBasedLocationChangedCallback"); + UnSetDistanceBasedLocationChangedCallback(); + } + } + } + + private void SetDistanceBasedLocationChangedCallback() + { + Log.Info(Globals.LogTag, "SetDistanceBasedLocationChangedCallback"); + if (_distanceBasedLocationChangedCallback == null) { + _distanceBasedLocationChangedCallback = (latitude, longitude, altitude, speed, direction, accuracy, timestamp, userData) => + { + Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #1"); + Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp); + Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #2"); + _distanceBasedLocationChanged?.Invoke(this, new LocationChangedEventArgs(location)); + Log.Info(Globals.LogTag, "DistanceBasedLocationChangedCallback #3"); + }; + } + + int ret = Interop.LocatorEvent.SetDistanceBasedLocationChangedCallback(_handle, _distanceBasedLocationChangedCallback, _stayInterval, _distance, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting Distance based location changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetDistanceBasedLocationChangedCallback() + { + Log.Info(Globals.LogTag, "UnSetDistanceBasedLocationChangedCallback"); + int ret = Interop.LocatorEvent.UnSetDistanceBasedLocationChangedCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in UnSetting Distance based location changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + _distanceBasedLocationChanged = null; + } + + /// + /// (event)LocationUpdated is raised at defined intervals of time with updated location information. + /// The callback will be invoked periodically. + /// + /// 3 + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public event EventHandler LocationChanged + { + add + { + Log.Info(Globals.LogTag, "Adding LocationChanged EventHandler"); + if (_batchPeriod > 0 && _batchPeriod > _batchInterval) + { + Log.Info(Globals.LogTag, "Calling function SetLocationBatchCallback"); + SetLocationBatchCallback(); + } + else + { + Log.Info(Globals.LogTag, "Calling function SetLocationChangedCallback"); + SetLocationChangedCallback(); + } + _locationChanged += value; + } + remove + { + Log.Info(Globals.LogTag, "Removing LocationChanged EventHandler"); + _locationChanged -= value; + + if (_locationChanged == null) + { + if (_batchPeriod > 0 && _batchPeriod > _batchInterval) + { + Log.Info(Globals.LogTag, "Calling function UnSetLocationBatchCallback"); + UnSetLocationBatchCallback(); + } + else + { + Log.Info(Globals.LogTag, "Calling function UnSetLocationChangedCallback"); + UnSetLocationChangedCallback(); + } + } + } + } + + private void SetLocationChangedCallback() + { + Log.Info(Globals.LogTag, "Calling SetLocationChangedCallback"); + + if (_locationChangedCallback == null) { + _locationChangedCallback = (latitude, longitude, altitude, speed, direction, accuracy, timestamp, userData) => + { + Log.Info(Globals.LogTag, "LocationChangedCallback has been called"); + Location location = new Location(latitude, longitude, altitude, speed, direction, accuracy, timestamp); + _location = location; + _locationChanged?.Invoke(this, new LocationChangedEventArgs(location)); + }; + } + + int ret = Interop.LocatorEvent.SetLocationChangedCallback(_handle, _locationChangedCallback, _interval, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting location changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetLocationChangedCallback() + { + Log.Info(Globals.LogTag, "Calling UnSetLocationChangedCallback"); + int ret = Interop.LocatorEvent.UnSetLocationChangedCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in UnSetting location changed Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void SetLocationBatchCallback() + { + Log.Info(Globals.LogTag, "Calling SetLocationBatchCallback"); + int ret; + if (_locationBatchCallback == null) { + _locationBatchCallback = (batch_size, userData) => + { + Log.Info(Globals.LogTag, "LocationBatchCallback has been called, size : " + batch_size); + + _locationBatchGetCallback = (latitude, longitude, altitude, speed, direction, horizontal, vertical, timestamp, batchUserData) => + { + Log.Info(Globals.LogTag, "GetLocationBatch has been called"); + Location location = new Location(latitude, longitude, altitude, speed, direction, horizontal, timestamp); + _location = location; + _locationChanged?.Invoke(this, new LocationChangedEventArgs(location)); + }; + + ret = Interop.LocatorEvent.GetLocationBatch(_handle, _locationBatchGetCallback, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting location batch Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + }; + } + + ret = Interop.LocatorEvent.SetLocationBatchCallback(_handle, _locationBatchCallback, _batchInterval, _batchPeriod, IntPtr.Zero); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in Setting location batch Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + + private void UnSetLocationBatchCallback() + { + Log.Info(Globals.LogTag, "Calling UnSetLocationBatchCallback"); + int ret = Interop.LocatorEvent.UnSetLocationBatchCallback(_handle); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error in UnSetting location batch Callback," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + } + } +} diff --git a/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs b/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs new file mode 100755 index 0000000..8f04a80 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/LocatorEnumerations.cs @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Location +{ + /// + /// Enumeration for the state of the location service. + /// + /// 3 + public enum ServiceState + { + Disabled = 0, /** + /// Enumeration for the type of connection used in acquiring Location data. + /// + /// 3 + public enum LocationType + { + Hybrid = 0, /** + /// Enumeration for the created boundary type. + /// + /// 3 + public enum BoundaryType + { + Rectangle = 0, /** + /// Enumeration for error code for Location manager. + /// + /// 3 + public enum BoundaryState + { + In = 0, /**< Boundary In (Zone In) */ + Out /**< Boundary Out (Zone Out) */ + } +} diff --git a/src/Tizen.Location/Tizen.Location/LocatorHelper.cs b/src/Tizen.Location/Tizen.Location/LocatorHelper.cs new file mode 100755 index 0000000..5ad09ee --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/LocatorHelper.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + public static class LocatorHelper + { + /// + /// Checks if the specified geographical positioning type is supported or not. + /// + /// 3 + /// The back-end positioning method to be used for LBS. + /// Returns a boolean value indicating whether or not the specified method is supported. + public static bool IsSupportedType(LocationType locationType) + { + bool status = Interop.LocatorHelper.IsSupported((int)locationType); + Log.Info(Globals.LogTag, "Checking if the Location Manager type is supported ," + status); + return status; + } + + /// + /// Checks if the specified geographical positioning type is enabled or not. + /// + /// 3 + /// The back-end positioning method to be used for LBS. + /// Returns a boolean value indicating whether or not the specified method is supported. + /// Thrown when the operation is invalid for the current state. + /// Thrown when an invalid argument is used. + /// Thrown when the location is not supported. + public static bool IsEnabledType(LocationType locationType) + { + Log.Info(Globals.LogTag, "Checking if the Location Manager type is Enabled"); + bool status; + int ret = Interop.LocatorHelper.IsEnabled((int)locationType, out status); + if (((LocationError)ret != LocationError.None)) + { + Log.Error(Globals.LogTag, "Error Checking the Location Manager type is Enabled," + (LocationError)ret); + throw LocationErrorFactory.ThrowLocationException(ret); + } + return status; + } + } +} diff --git a/src/Tizen.Location/Tizen.Location/NamespaceDoc.cs b/src/Tizen.Location/Tizen.Location/NamespaceDoc.cs new file mode 100755 index 0000000..e8ba5d4 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/NamespaceDoc.cs @@ -0,0 +1,21 @@ +/** + +The Tizen.Location namespace provides classes for obtaining information related to geographical location. +Notifications on events like service becoming enabled or disabled, +new position data being available and others can also be acquired. + + +

Overview

+The Tizen.Location namespace provides classes for obtaining information related to geographical location. +Notifications on events like service becoming enabled or disabled, +new position data being available and others can also be acquired. +

Related Features

+To guarantee that the Location application runs on a device with location profile feature, +declare the following feature requirements in the config file:
+http://tizen.org/feature/location
+http://tizen.org/feature/location.gps
+http://tizen.org/feature/location.wps +
+
+*/ +namespace Tizen.Location {} diff --git a/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs new file mode 100755 index 0000000..c6f4ba4 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/SatelliteStatusChangedEventArgs.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + public class SatelliteStatusChangedEventArgs : EventArgs + { + /// + /// Class Constructor for SatelliteStatusChangedEventArgs class. + /// + /// 3 + /// The number of active satellites. + /// The number of satellites in view. + /// The time at which the data has been extracted. + public SatelliteStatusChangedEventArgs(uint activeCount, uint inviewCount, DateTime timestamp) + { + ActiveCount = activeCount; + InViewCount = inviewCount; + Timestamp = timestamp; + } + + /// + /// Gets the number of active satellites. + /// + /// 3 + public uint ActiveCount { get; private set; } + + /// + /// Gets the number of satellites in view. + /// + /// 3 + public uint InViewCount { get; private set; } + + /// + /// Get the timestamp. + /// + /// 3 + public DateTime Timestamp { get; private set; } + } +} diff --git a/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs new file mode 100755 index 0000000..35ff1a7 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/ServiceStateChangedEventArgs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + /// + /// An extended EventArgs class which contains the changed location service state. + /// + public class ServiceStateChangedEventArgs : EventArgs + { + /// + /// Class Constructor for ServiceStateChangedEventArgs class. + /// + /// 3 + /// An enumeration of type LocationServiceState. + public ServiceStateChangedEventArgs(ServiceState state) + { + ServiceState = state; + } + + /// + /// Get the Service state. + /// + /// 3 + public ServiceState ServiceState { get; private set; } + } +} diff --git a/src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs new file mode 100755 index 0000000..2869b69 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/SettingChangedEventArgs.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + public class SettingChangedEventArgs : EventArgs + { + /// + /// Class Constructor for SettingChangedEventArgs class. + /// + /// 3 + /// The positioing method used for Location information. + /// Status of the method. + public SettingChangedEventArgs(LocationType type, bool enable) + { + LocationType = type; + IsEnabled = enable; + } + + /// + /// Gets the currently used location method. + /// + /// 3 + public LocationType LocationType { get; private set; } + + /// + /// Method to get the setting value changed. + /// + /// 3 + public bool IsEnabled { get; private set; } + } +} diff --git a/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs b/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs new file mode 100755 index 0000000..9bc05e4 --- /dev/null +++ b/src/Tizen.Location/Tizen.Location/ZoneChangedEventArgs.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Location +{ + public class ZoneChangedEventArgs : EventArgs + { + /// + /// Class Constructor for ZoneChangedEventArgs class. + /// + /// 3 + /// An enumeration of type BoundaryState. + /// The latitude value[-90.0 ~ 90.0] (degrees). + /// The longitude value[-180.0 ~ 180.0] (degrees). + /// The altitude value. + /// The timestamp value. + public ZoneChangedEventArgs(BoundaryState state, double latitude, double longitude, double altitude, DateTime timestamp) + { + BoundState = state; + Latitude = latitude; + Longitude = longitude; + Altitude = altitude; + Timestamp = timestamp; + } + + /// + /// Get the Boundary State. + /// + /// 3 + public BoundaryState BoundState { get; private set; } + + /// + /// Get the latitude. + /// + /// 3 + public double Latitude { get; private set; } + + /// + /// Get the longitude. + /// + /// 3 + public double Longitude { get; private set; } + + /// + /// Get the altitude. + /// + /// 3 + public double Altitude { get; private set; } + + /// + /// Method to get the timestamp. + /// + /// 3 + public DateTime Timestamp { get; private set; } + } +} diff --git a/src/Tizen.Log/Interop/Interop.Dlog.cs b/src/Tizen.Log/Interop/Interop.Dlog.cs new file mode 100644 index 0000000..db12535 --- /dev/null +++ b/src/Tizen.Log/Interop/Interop.Dlog.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Dlog = "libdlog.so.0"; + } + + internal static partial class Dlog + { + internal enum LogID : int + { + LOG_ID_INVALID = -1, + LOG_ID_MAIN, + LOG_ID_RADIO, + LOG_ID_SYSTEM, + LOG_ID_APPS, + LOG_ID_KMSG, + LOG_ID_MAX + } + + internal enum LogPriority : int + { + DLOG_UNKNOWN = 0, + DLOG_DEFAULT, + DLOG_VERBOSE, + DLOG_DEBUG, + DLOG_INFO, + DLOG_WARN, + DLOG_ERROR, + DLOG_FATAL, + DLOG_SILENT, + DLOG_PRIO_MAX, + } + + [DllImport(Libraries.Dlog, EntryPoint = "dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Print(LogPriority prio, string tag, string fmt, string msg); + + [DllImport(Libraries.Dlog, EntryPoint = "dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Print(LogPriority prio, string tag, string fmt, string file, string func, int line, string msg); + + [DllImport(Libraries.Dlog, EntryPoint = "__dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int InternalPrint(LogID log_id, LogPriority prio, string tag, string fmt, string msg); + + [DllImport(Libraries.Dlog, EntryPoint = "__dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int InternalPrint(LogID log_id, LogPriority prio, string tag, string fmt, string file, string func, int line, string msg); + + } +} + diff --git a/src/Tizen.Log/Tizen.Log.csproj b/src/Tizen.Log/Tizen.Log.csproj new file mode 100644 index 0000000..88c3f81 --- /dev/null +++ b/src/Tizen.Log/Tizen.Log.csproj @@ -0,0 +1,9 @@ + + + + + netstandard1.6 + + + + diff --git a/src/Tizen.Log/Tizen.Log.sln b/src/Tizen.Log/Tizen.Log.sln new file mode 100755 index 0000000..6e96ada --- /dev/null +++ b/src/Tizen.Log/Tizen.Log.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "Tizen.Log.csproj", "{D177F87F-B680-46DE-8EEB-2386BF76D2FA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D177F87F-B680-46DE-8EEB-2386BF76D2FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D177F87F-B680-46DE-8EEB-2386BF76D2FA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D177F87F-B680-46DE-8EEB-2386BF76D2FA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D177F87F-B680-46DE-8EEB-2386BF76D2FA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Log/Tizen/Log.cs b/src/Tizen.Log/Tizen/Log.cs new file mode 100644 index 0000000..da673e7 --- /dev/null +++ b/src/Tizen.Log/Tizen/Log.cs @@ -0,0 +1,224 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Runtime.CompilerServices; +using System.ComponentModel; + +namespace Tizen +{ + /// + /// Provides methods to print log messages to the Tizen logging system. + /// + public class Log + { + /// + /// Prints a log message with the VERBOSE priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Verbose(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, message, file, func, line); + } + + /// + /// Prints a log message with the DEBUG priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Debug(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_DEBUG, tag, message, file, func, line); + } + + /// + /// Prints a log message with the INFO priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Info(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_INFO, tag, message, file, func, line); + } + + /// + /// Prints a log message with the WARNING priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Warn(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_WARN, tag, message, file, func, line); + } + + /// + /// Prints a log message with the ERROR priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Error(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_ERROR, tag, message, file, func, line); + } + + /// + /// Prints a log message with the FATAL priority. + /// + /// 3 + /// The tag name of the log message. + /// The log message to print. + /// The source file path of the caller function. This argument will be set automatically by the compiler. + /// The function name of the caller function. This argument will be set automatically by the compiler. + /// The line number of the calling position. This argument will be set automatically by the compiler. + public static void Fatal(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogPriority.DLOG_FATAL, tag, message, file, func, line); + } + + static void Print(Interop.Dlog.LogPriority priority, string tag, string message, string file, string func, int line) + { + if (String.IsNullOrEmpty(file)) + { + Interop.Dlog.Print(priority, tag, "%s", message); + } + else + { + Uri f = new Uri("file://" + file); + Interop.Dlog.Print(priority, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); + } + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public class InternalLog + { + public static void Verbose(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + // For internal dlog APIs, Verbose level log is disabled + // Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, message, file, func, line); + } + + public static void Debug(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_DEBUG, tag, message, file, func, line); + } + + public static void Info(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_INFO, tag, message, file, func, line); + } + + public static void Warn(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_WARN, tag, message, file, func, line); + } + + public static void Error(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_ERROR, tag, message, file, func, line); + } + + public static void Fatal(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_FATAL, tag, message, file, func, line); + } + + static void Print(Interop.Dlog.LogID log_id, Interop.Dlog.LogPriority priority, string tag, string message, string file, string func, int line) + { + if (String.IsNullOrEmpty(file)) + { + Interop.Dlog.InternalPrint(log_id, priority, tag, "%s", message); + } + else + { + Uri f = new Uri("file://" + file); + Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > %s", Path.GetFileName(f.AbsolutePath), func, line, message); + } + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public class SecureLog + { + public static void Verbose(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + // For internal dlog APIs, Verbose level log is disabled + // Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_VERBOSE, tag, message, file, func, line); + } + + public static void Debug(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_DEBUG, tag, message, file, func, line); + } + + public static void Info(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_INFO, tag, message, file, func, line); + } + + public static void Warn(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_WARN, tag, message, file, func, line); + } + + public static void Error(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_ERROR, tag, message, file, func, line); + } + + public static void Fatal(string tag, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Print(Interop.Dlog.LogID.LOG_ID_MAIN, Interop.Dlog.LogPriority.DLOG_FATAL, tag, message, file, func, line); + } + + static void Print(Interop.Dlog.LogID log_id, Interop.Dlog.LogPriority priority, string tag, string message, string file, string func, int line) + { +#if !DISABLE_SECURELOG + if (String.IsNullOrEmpty(file)) + { + Interop.Dlog.InternalPrint(log_id, priority, tag, "[SECURE_LOG] %s", message); + } + else + { + Uri f = new Uri("file://" + file); + Interop.Dlog.InternalPrint(log_id, priority, tag, "%s: %s(%d) > [SECURE_LOG] %s", Path.GetFileName(f.AbsolutePath), func, line, message); + } +#endif + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Address.cs b/src/Tizen.Maps/Interop/Interop.Address.cs new file mode 100755 index 0000000..90840c0 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Address.cs @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_building_number")] + internal static extern ErrorCode GetBuildingNumber(this AddressHandle /* maps_address_h */ address, out string buildingNumber); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_building_number")] + internal static extern ErrorCode SetBuildingNumber(this AddressHandle /* maps_address_h */ address, string buildingNumber); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_street")] + internal static extern ErrorCode GetStreet(this AddressHandle /* maps_address_h */ address, out string street); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_street")] + internal static extern ErrorCode SetStreet(this AddressHandle /* maps_address_h */ address, string street); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_district")] + internal static extern ErrorCode GetDistrict(this AddressHandle /* maps_address_h */ address, out string district); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_district")] + internal static extern ErrorCode SetDistrict(this AddressHandle /* maps_address_h */ address, string district); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_city")] + internal static extern ErrorCode GetCity(this AddressHandle /* maps_address_h */ address, out string city); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_city")] + internal static extern ErrorCode SetCity(this AddressHandle /* maps_address_h */ address, string city); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_state")] + internal static extern ErrorCode GetState(this AddressHandle /* maps_address_h */ address, out string state); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_state")] + internal static extern ErrorCode SetState(this AddressHandle /* maps_address_h */ address, string state); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country")] + internal static extern ErrorCode GetCountry(this AddressHandle /* maps_address_h */ address, out string country); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country")] + internal static extern ErrorCode SetCountry(this AddressHandle /* maps_address_h */ address, string country); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_country_code")] + internal static extern ErrorCode GetCountryCode(this AddressHandle /* maps_address_h */ address, out string countryCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_country_code")] + internal static extern ErrorCode SetCountryCode(this AddressHandle /* maps_address_h */ address, string countryCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_county")] + internal static extern ErrorCode GetCounty(this AddressHandle /* maps_address_h */ address, out string county); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_county")] + internal static extern ErrorCode SetCounty(this AddressHandle /* maps_address_h */ address, string county); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_postal_code")] + internal static extern ErrorCode GetPostalCode(this AddressHandle /* maps_address_h */ address, out string postalCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_postal_code")] + internal static extern ErrorCode SetPostalCode(this AddressHandle /* maps_address_h */ address, string postalCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_get_freetext")] + internal static extern ErrorCode GetFreeText(this AddressHandle /* maps_address_h */ address, out string freetext); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_set_freetext")] + internal static extern ErrorCode SetFreeText(this AddressHandle /* maps_address_h */ address, string freetext); + + internal class AddressHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_address_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_address_h */ address); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_address_h */ address); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_address_h */ origin, out IntPtr /* maps_address_h */ cloned); + + internal string Building + { + get { return NativeGet(this.GetBuildingNumber); } + set { NativeSet(this.SetBuildingNumber, value); } + } + + internal string Street + { + get { return NativeGet(this.GetStreet); } + set { NativeSet(this.SetStreet, value); } + } + + internal string City + { + get { return NativeGet(this.GetCity); } + set { NativeSet(this.SetCity, value); } + } + + internal string District + { + get { return NativeGet(this.GetDistrict); } + set { NativeSet(this.SetDistrict, value); } + } + + internal string State + { + get { return NativeGet(this.GetState); } + set { NativeSet(this.SetState, value); } + } + + internal string Country + { + get { return NativeGet(this.GetCountry); } + set { NativeSet(this.SetCountry, value); } + } + + internal string CountryCode + { + get { return NativeGet(this.GetCountryCode); } + set { NativeSet(this.SetCountryCode, value); } + } + + internal string County + { + get { return NativeGet(this.GetCounty); } + set { NativeSet(this.SetCounty, value); } + } + + internal string PostalCode + { + get { return NativeGet(this.GetPostalCode); } + set { NativeSet(this.SetPostalCode, value); } + } + + internal string FreeText + { + get { return NativeGet(this.GetFreeText); } + set { NativeSet(this.SetFreeText, value); } + } + + internal AddressHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal AddressHandle() : this(IntPtr.Zero, true) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal static AddressHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new AddressHandle(handle, true); + } + + internal static AddressHandle Create(IntPtr nativeHandle) + { + return new AddressHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.AddressList.cs b/src/Tizen.Maps/Interop/Interop.AddressList.cs new file mode 100755 index 0000000..ebbc6d3 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.AddressList.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_append")] + internal static extern ErrorCode ListAppend(this AddressListHandle /* maps_address_list_h */ addressList, AddressHandle /* maps_address_h */ address); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_remove")] + internal static extern ErrorCode ListRemove(this AddressListHandle /* maps_address_list_h */ addressList, AddressHandle /* maps_address_h */ address); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_get_length")] + internal static extern ErrorCode ListGetLength(this AddressListHandle /* maps_address_list_h */ addressList, out int length); + + + internal class AddressListHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AddressCallback(int index, IntPtr /* maps_address_h */ addressHandle, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_address_list_h */ addressList); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_address_list_h */ addressList); + + [DllImport(Libraries.MapService, EntryPoint = "maps_address_list_foreach")] + internal static extern ErrorCode Foreach(IntPtr /* maps_address_list_h */ addressList, AddressCallback callback, IntPtr /* void */ userData); + + internal AddressListHandle() : base(IntPtr.Zero, true, Destroy) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal AddressListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal void Foreach(Action action) + { + AddressCallback callback = (index, handle, userData) => + { + action(AddressHandle.CloneFrom(handle)); + return true; + }; + + Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get address list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Area.cs b/src/Tizen.Maps/Interop/Interop.Area.cs new file mode 100755 index 0000000..cf56832 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Area.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal class AreaHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_area_create_rectangle")] + internal static extern ErrorCode CreateRectangle(IntPtr /* maps_coordinates_h */ topLeft, IntPtr /* maps_coordinates_h */ bottomRight, out IntPtr /* maps_area_h */ area); + + [DllImport(Libraries.MapService, EntryPoint = "maps_area_create_circle")] + internal static extern ErrorCode CreateCircle(IntPtr /* maps_coordinates_h */ center, double radius, out IntPtr /* maps_area_h */ area); + + [DllImport(Libraries.MapService, EntryPoint = "maps_area_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_area_h */ area); + + [DllImport(Libraries.MapService, EntryPoint = "maps_area_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_area_h */ origin, out IntPtr /* maps_area_h */ cloned); + + internal AreaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal AreaHandle(CoordinatesHandle topLeft, CoordinatesHandle bottomRight) : this(IntPtr.Zero, true) + { + IntPtr _topLeft = (topLeft != null ? topLeft : IntPtr.Zero); + IntPtr _bottomRight = (bottomRight != null ? bottomRight : IntPtr.Zero); + CreateRectangle(_topLeft, _bottomRight, out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal AreaHandle(CoordinatesHandle center, double radius) : this(IntPtr.Zero, true) + { + IntPtr _center = (center != null ? center : IntPtr.Zero); + CreateCircle(_center, radius, out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal static AreaHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new AreaHandle(handle, true); + } + + internal static AreaHandle Create(IntPtr nativeHandle) + { + return new AreaHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Coordinates.cs b/src/Tizen.Maps/Interop/Interop.Coordinates.cs new file mode 100755 index 0000000..6a06431 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Coordinates.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_latitude")] + internal static extern ErrorCode GetLatitude(this CoordinatesHandle /* maps_coordinates_h */ coordinates, out double latitude); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_get_longitude")] + internal static extern ErrorCode GetLongitude(this CoordinatesHandle /* maps_coordinates_h */ coordinates, out double longitude); + + internal class CoordinatesHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_create")] + internal static extern ErrorCode Create(double latitude, double longitude, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_coordinates_h */ origin, out IntPtr /* maps_coordinates_h */ cloned); + + internal double Latitude + { + get { return NativeGet(this.GetLatitude); } + } + + internal double Longitude + { + get { return NativeGet(this.GetLongitude); } + } + + internal CoordinatesHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal CoordinatesHandle(double latitude, double longitude) : this(IntPtr.Zero, true) + { + Create(latitude, longitude, out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal static CoordinatesHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new CoordinatesHandle(handle, true); + } + + internal static CoordinatesHandle Create(IntPtr nativeHandle) + { + return new CoordinatesHandle(nativeHandle, true); + } + + public override string ToString() + { + return $"[{Latitude}, {Longitude}]"; + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.CoordinatesList.cs b/src/Tizen.Maps/Interop/Interop.CoordinatesList.cs new file mode 100755 index 0000000..5c31cf9 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.CoordinatesList.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_append")] + internal static extern ErrorCode Append(this CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_remove")] + internal static extern ErrorCode Remove(this CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, CoordinatesHandle /* maps_coordinates_h */ coordinates); + + + internal class CoordinatesListHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_coordinates_list_h */ coordinatesList); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_coordinates_list_h */ coordinatesList); + + [DllImport(Libraries.MapService, EntryPoint = "maps_coordinates_list_foreach")] + internal static extern ErrorCode Foreach(IntPtr /* maps_coordinates_list_h */ coordinatesList, CoordinatesCallback callback, IntPtr /* void */ userData); + + internal CoordinatesListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) { } + + internal CoordinatesListHandle(bool needToRelease = true) : this(IntPtr.Zero, needToRelease) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal void Add(CoordinatesHandle handleToAdd) + { + using (var clonedHandle = CoordinatesHandle.CloneFrom(handleToAdd)) + { + if (this.Append(clonedHandle).WarnIfFailed("Failed to add coordinates to the list")) + { + clonedHandle.HasOwnership = false; + } + } + } + + internal void ForEach(Action action) + { + CoordinatesCallback callback = (index, handle, userData) => + { + action(CoordinatesHandle.CloneFrom(handle)); + return true; + }; + + Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.ErrorCode.cs b/src/Tizen.Maps/Interop/Interop.ErrorCode.cs new file mode 100755 index 0000000..89d4916 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.ErrorCode.cs @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; +using Tizen; + +internal static partial class Interop +{ + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + ConnectionTimeOut = Tizen.Internals.Errors.ErrorCode.ConnectionTimeout, + NetworkUnreachable = Tizen.Internals.Errors.ErrorCode.NetworkUnreachable, + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, + KeyNotAvailable = Tizen.Internals.Errors.ErrorCode.KeyNotAvailable, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + Canceled = Tizen.Internals.Errors.ErrorCode.Canceled, + Unknown = Tizen.Internals.Errors.ErrorCode.Unknown, + UserNotConsented = Tizen.Internals.Errors.ErrorCode.UserNotConsented, + ServiceNotAvailable = -0x02C20000 | 0x01, // MAPS_ERROR_SERVICE_NOT_AVAILABLE + NotFound = -0x02C20000 | 0x02, // MAPS_ERROR_NOT_FOUND + } +} + +internal static class ErrorCodeExtensions +{ + private const string LogTag = "Tizen.Maps"; + + internal static bool IsSuccess(this Interop.ErrorCode err) + { + return err == Interop.ErrorCode.None; + } + + internal static bool IsFailed(this Interop.ErrorCode err) + { + return !err.IsSuccess(); + } + + /// + /// The utility method to check for an error. Returns false on failure and prints warning messages. + /// + /// Returns true in case of no error, otherwise false. + internal static bool WarnIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Debug(LogTag, $"{msg}, err: {err.ToString()}", file, func, line); + return false; + } + return true; + } + + /// + /// The utility method to check for an error. Returns false on failure and throws an exception. + /// + /// Returns true in case of no error, otherwise false. + internal static bool ThrowIfFailed(this Interop.ErrorCode err, string msg, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Error(LogTag, $"{msg}, err: {err.ToString()}", file, func, line); + throw err.GetException(msg); + } + return true; + } + + internal static Exception GetException(this Interop.ErrorCode err, string message) + { + string errMessage = $"{message}, err: {err.ToString()}"; + switch (err) + { + //case ErrorCode.None: + case Interop.ErrorCode.PermissionDenied: return new System.UnauthorizedAccessException(errMessage); + case Interop.ErrorCode.InvalidParameter: return new System.ArgumentException(errMessage); + case Interop.ErrorCode.OutOfMemory: + case Interop.ErrorCode.NotSupported: + case Interop.ErrorCode.ConnectionTimeOut: + case Interop.ErrorCode.NetworkUnreachable: + case Interop.ErrorCode.InvalidOperation: + case Interop.ErrorCode.KeyNotAvailable: + case Interop.ErrorCode.ResourceBusy: + case Interop.ErrorCode.Canceled: + case Interop.ErrorCode.Unknown: + case Interop.ErrorCode.ServiceNotAvailable: + case Interop.ErrorCode.NotFound: + default: return new System.InvalidOperationException(errMessage); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Libraries.cs b/src/Tizen.Maps/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..03be6b6 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static class Libraries + { + internal const string MapService = "capi-maps-service.so.0"; + } +} \ No newline at end of file diff --git a/src/Tizen.Maps/Interop/Interop.Place.Attribute.cs b/src/Tizen.Maps/Interop/Interop.Place.Attribute.cs new file mode 100755 index 0000000..f7e7c78 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Attribute.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_id")] + internal static extern ErrorCode GetId(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_label")] + internal static extern ErrorCode GetLabel(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string label); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_get_text")] + internal static extern ErrorCode GetText(this PlaceAttributeHandle /* maps_place_attribute_h */ attribute, out string text); + + internal class PlaceAttributeHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_attribute_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_attribute_h */ attribute); + + internal string Id + { + get { return NativeGet(this.GetId); } + } + + internal string Label + { + get { return NativeGet(this.GetLabel); } + } + + internal string Text + { + get { return NativeGet(this.GetText); } + } + + public PlaceAttributeHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Category.cs b/src/Tizen.Maps/Interop/Interop.Place.Category.cs new file mode 100755 index 0000000..7265409 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Category.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_id")] + internal static extern ErrorCode GetId(this PlaceCategoryHandle /* maps_place_category_h */ category, out string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_id")] + internal static extern ErrorCode SetId(this PlaceCategoryHandle /* maps_place_category_h */ category, string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_name")] + internal static extern ErrorCode GetName(this PlaceCategoryHandle /* maps_place_category_h */ category, out string name); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_name")] + internal static extern ErrorCode SetName(this PlaceCategoryHandle /* maps_place_category_h */ category, string name); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_get_url")] + internal static extern ErrorCode GetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, out string url); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_set_url")] + internal static extern ErrorCode SetUrl(this PlaceCategoryHandle /* maps_place_category_h */ category, string url); + + internal class PlaceCategoryHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_place_category_h */ category); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_category_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_category_h */ category); + + internal string Id + { + get { return NativeGet(this.GetId); } + set { NativeSet(this.SetId, value); } + } + + internal string Name + { + get { return NativeGet(this.GetName); } + set { NativeSet(this.SetName, value); } + } + + internal string Url + { + get { return NativeGet(this.GetUrl); } + set { NativeSet(this.SetUrl, value); } + } + + public PlaceCategoryHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal PlaceCategoryHandle() : this(IntPtr.Zero, true) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal static PlaceCategoryHandle Create(IntPtr nativeHandle) + { + return new PlaceCategoryHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Contact.cs b/src/Tizen.Maps/Interop/Interop.Place.Contact.cs new file mode 100755 index 0000000..bd6b61f --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Contact.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_label")] + internal static extern ErrorCode GetLabel(this PlaceContactHandle /* maps_place_contact_h */ contact, out string label); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_type")] + internal static extern ErrorCode GetType(this PlaceContactHandle /* maps_place_contact_h */ contact, out string type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_get_value")] + internal static extern ErrorCode GetValue(this PlaceContactHandle /* maps_place_contact_h */ contact, out string value); + + internal class PlaceContactHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_contact_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_contact_h */ contact); + + internal string Label + { + get { return NativeGet(this.GetLabel); } + } + + internal string Type + { + get { return NativeGet(this.GetType); } + } + + internal string Value + { + get { return NativeGet(this.GetValue); } + } + + public PlaceContactHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Editorial.cs b/src/Tizen.Maps/Interop/Interop.Place.Editorial.cs new file mode 100755 index 0000000..6af3dba --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Editorial.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_description")] + internal static extern ErrorCode GetDescription(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string description); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_language")] + internal static extern ErrorCode GetLanguage(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_get_media")] + internal static extern ErrorCode GetMedia(this PlaceEditorialHandle /* maps_place_editorial_h */ editorial, out IntPtr /* maps_place_media_h */ media); + + internal class PlaceEditorialHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_editorial_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_editorial_h */ editorial); + + internal string Description + { + get { return NativeGet(this.GetDescription); } + } + + internal string Language + { + get { return NativeGet(this.GetLanguage); } + } + + internal PlaceMediaHandle Media + { + get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); } + } + + public PlaceEditorialHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Filter.cs b/src/Tizen.Maps/Interop/Interop.Place.Filter.cs new file mode 100755 index 0000000..20dc6a9 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Filter.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get")] + internal static extern ErrorCode Get(this PlaceFilterHandle /* maps_place_filter_h */ filter, string key, out string value); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set")] + internal static extern ErrorCode Set(this PlaceFilterHandle /* maps_place_filter_h */ filter, string key, string value); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_keyword")] + internal static extern ErrorCode GetKeyword(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string keyword); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_keyword")] + internal static extern ErrorCode SetKeyword(this PlaceFilterHandle /* maps_place_filter_h */ filter, string keyword); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_place_name")] + internal static extern ErrorCode GetPlaceName(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string placeName); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_place_name")] + internal static extern ErrorCode SetPlaceName(this PlaceFilterHandle /* maps_place_filter_h */ filter, string placeName); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_category")] + internal static extern ErrorCode GetCategory(this PlaceFilterHandle /* maps_place_filter_h */ filter, out IntPtr /* maps_place_category_h */ category); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_category")] + internal static extern ErrorCode SetCategory(this PlaceFilterHandle /* maps_place_filter_h */ filter, PlaceCategoryHandle /* maps_place_category_h */ category); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_get_place_address")] + internal static extern ErrorCode GetPlaceAddress(this PlaceFilterHandle /* maps_place_filter_h */ filter, out string placeAddress); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_set_place_address")] + internal static extern ErrorCode SetPlaceAddress(this PlaceFilterHandle /* maps_place_filter_h */ filter, string placeAddress); + + internal class PlaceFilterHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PlaceFilterPropertiesCallback(int index, int total, string key, IntPtr /* void */ value, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_foreach_property")] + internal static extern ErrorCode ForeachProperty(IntPtr /* maps_place_filter_h */ filter, PlaceFilterPropertiesCallback callback, IntPtr /* void */ userData); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_place_filter_h */ filter); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_filter_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_filter_h */ filter); + + internal string Keyword + { + get { return NativeGet(this.GetKeyword); } + set { NativeSet(this.SetKeyword, value); } + } + + internal string PlaceName + { + get { return NativeGet(this.GetPlaceName); } + set { NativeSet(this.SetPlaceName, value); } + } + + internal string PlaceAddress + { + get { return NativeGet(this.GetPlaceAddress); } + set { NativeSet(this.SetPlaceAddress, value); } + } + + internal PlaceCategoryHandle Category + { + get { return NativeGet(this.GetCategory, PlaceCategoryHandle.Create); } + set { NativeSet(this.SetCategory, value); } + } + + public PlaceFilterHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + public PlaceFilterHandle() : this(IntPtr.Zero, true) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal void ForeachProperty(Action action) + { + PlaceFilterPropertiesCallback callback = (index, total, key, value, userData) => + { + action(key, Marshal.PtrToStringUni(value)); + return true; + }; + + ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get address list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Image.cs b/src/Tizen.Maps/Interop/Interop.Place.Image.cs new file mode 100755 index 0000000..ff96f6b --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Image.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_id")] + internal static extern ErrorCode GetId(this PlaceImageHandle /* maps_place_image_h */ image, out string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_url")] + internal static extern ErrorCode GetUrl(this PlaceImageHandle /* maps_place_image_h */ image, out string url); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_width")] + internal static extern ErrorCode GetWidth(this PlaceImageHandle /* maps_place_image_h */ image, out int width); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_height")] + internal static extern ErrorCode GetHeight(this PlaceImageHandle /* maps_place_image_h */ image, out int height); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_user_link")] + internal static extern ErrorCode GetUserLink(this PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_link_object_h */ user); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_get_media")] + internal static extern ErrorCode GetMedia(this PlaceImageHandle /* maps_place_image_h */ image, out IntPtr /* maps_place_media_h */ media); + + internal class PlaceImageHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_image_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_image_h */ image); + + internal string Id + { + get { return NativeGet(this.GetId); } + } + + internal string Url + { + get { return NativeGet(this.GetUrl); } + } + + internal int Width + { + get { return NativeGet(this.GetWidth); } + } + + internal int Height + { + get { return NativeGet(this.GetHeight); } + } + + internal PlaceLinkObjectHandle User + { + get { return NativeGet(this.GetUserLink, PlaceLinkObjectHandle.Create); } + } + + internal PlaceMediaHandle Media + { + get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); } + } + + public PlaceImageHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Link.Object.cs b/src/Tizen.Maps/Interop/Interop.Place.Link.Object.cs new file mode 100755 index 0000000..ac170b1 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Link.Object.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_id")] + internal static extern ErrorCode GetId(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_name")] + internal static extern ErrorCode GetName(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string name); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_string")] + internal static extern ErrorCode GetLink(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string linkString); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_get_type")] + internal static extern ErrorCode GetType(this PlaceLinkObjectHandle /* maps_place_link_object_h */ link, out string type); + + internal class PlaceLinkObjectHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_link_object_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_link_object_h */ link); + + internal string Id + { + get { return NativeGet(this.GetId); } + } + + internal string Name + { + get { return NativeGet(this.GetName); } + } + + internal string Link + { + get { return NativeGet(this.GetLink); } + } + + internal string Type + { + get { return NativeGet(this.GetType); } + } + + public PlaceLinkObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static PlaceLinkObjectHandle Create(IntPtr nativeHandle) + { + return new PlaceLinkObjectHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Media.cs b/src/Tizen.Maps/Interop/Interop.Place.Media.cs new file mode 100755 index 0000000..14145b8 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Media.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_attribution")] + internal static extern ErrorCode GetAttribution(this PlaceMediaHandle /* maps_place_media_h */ media, out string attribution); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_supplier")] + internal static extern ErrorCode GetSupplier(this PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ supplier); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_get_via")] + internal static extern ErrorCode GetVia(this PlaceMediaHandle /* maps_place_media_h */ media, out IntPtr /* maps_place_link_object_h */ via); + + internal class PlaceMediaHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_media_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_media_h */ media); + + internal string Attribution + { + get { return NativeGet(this.GetAttribution); } + } + + internal PlaceLinkObjectHandle Supplier + { + get { return NativeGet(this.GetSupplier, PlaceLinkObjectHandle.Create); } + } + + internal PlaceLinkObjectHandle Via + { + get { return NativeGet(this.GetVia, PlaceLinkObjectHandle.Create); } + } + + public PlaceMediaHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static PlaceMediaHandle Create(IntPtr nativeHandle) + { + return new PlaceMediaHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Rating.cs b/src/Tizen.Maps/Interop/Interop.Place.Rating.cs new file mode 100755 index 0000000..acefe9e --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Rating.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_count")] + internal static extern ErrorCode GetCount(this PlaceRatingHandle /* maps_place_rating_h */ rating, out int count); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_get_average")] + internal static extern ErrorCode GetAverage(this PlaceRatingHandle /* maps_place_rating_h */ rating, out double average); + + internal class PlaceRatingHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_rating_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_rating_h */ rating); + + internal int Count + { + get { return NativeGet(this.GetCount); } + } + + internal double Average + { + get { return NativeGet(this.GetAverage); } + } + + + public PlaceRatingHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static PlaceRatingHandle Create(IntPtr nativeHandle) + { + return new PlaceRatingHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.Review.cs b/src/Tizen.Maps/Interop/Interop.Place.Review.cs new file mode 100755 index 0000000..7cb1111 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.Review.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_date")] + internal static extern ErrorCode GetDate(this PlaceReviewHandle /* maps_place_review_h */ review, out string date); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_title")] + internal static extern ErrorCode GetTitle(this PlaceReviewHandle /* maps_place_review_h */ review, out string title); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_rating")] + internal static extern ErrorCode GetRating(this PlaceReviewHandle /* maps_place_review_h */ review, out double rating); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_description")] + internal static extern ErrorCode GetDescription(this PlaceReviewHandle /* maps_place_review_h */ review, out string description); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_language")] + internal static extern ErrorCode GetLanguage(this PlaceReviewHandle /* maps_place_review_h */ review, out string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_media")] + internal static extern ErrorCode GetMedia(this PlaceReviewHandle /* maps_place_review_h */ review, out IntPtr /* maps_place_media_h */ media); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_get_user_link")] + internal static extern ErrorCode GetUserLink(this PlaceReviewHandle /* maps_place_review_h */ review, out IntPtr /* maps_place_link_object_h */ user); + + internal class PlaceReviewHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_place_review_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_review_h */ review); + + internal string Date + { + get { return NativeGet(this.GetDate); } + } + + internal string Title + { + get { return NativeGet(this.GetTitle); } + } + internal string Language + { + get { return NativeGet(this.GetLanguage); } + } + internal string Description + { + get { return NativeGet(this.GetDescription); } + } + internal double Rating + { + get { return NativeGet(this.GetRating); } + } + + internal PlaceLinkObjectHandle User + { + get { return NativeGet(this.GetUserLink, PlaceLinkObjectHandle.Create); } + } + + internal PlaceMediaHandle Media + { + get { return NativeGet(this.GetMedia, PlaceMediaHandle.Create); } + } + + public PlaceReviewHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Place.cs b/src/Tizen.Maps/Interop/Interop.Place.cs new file mode 100755 index 0000000..9d8a898 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Place.cs @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_id")] + internal static extern ErrorCode GetId(this PlaceHandle /* maps_place_h */ place, out string id); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_name")] + internal static extern ErrorCode GetName(this PlaceHandle /* maps_place_h */ place, out string name); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_uri")] + internal static extern ErrorCode GetUri(this PlaceHandle /* maps_place_h */ place, out string uri); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_distance")] + internal static extern ErrorCode GetDistance(this PlaceHandle /* maps_place_h */ place, out int distance); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_location")] + internal static extern ErrorCode GetLocation(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_coordinates_h */ location); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_address")] + internal static extern ErrorCode GetAddress(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_address_h */ address); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_rating")] + internal static extern ErrorCode GetRating(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_rating_h */ rating); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_supplier_link")] + internal static extern ErrorCode GetSupplierLink(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ supplier); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_get_related_link")] + internal static extern ErrorCode GetRelatedLink(this PlaceHandle /* maps_place_h */ place, out IntPtr /* maps_place_link_object_h */ related); + + internal class PlaceHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CategoriesCallback(int index, int total, IntPtr /* maps_place_category_h */ category, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AttributesCallback(int index, int total, IntPtr /* maps_place_attribute_h */ attribute, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ContactsCallback(int index, int total, IntPtr /* maps_place_contact_h */ contact, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EditorialsCallback(int index, int total, IntPtr /* maps_place_editorial_h */ editorial, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ImagesCallback(int index, int total, IntPtr /* maps_place_image_h */ image, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ReviewsCallback(int index, int total, IntPtr /* maps_place_review_h */ review, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_property")] + internal static extern ErrorCode ForeachProperty(IntPtr /* maps_place_h */ place, PropertiesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_category")] + internal static extern ErrorCode ForeachCategory(IntPtr /* maps_place_h */ place, CategoriesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_attribute")] + internal static extern ErrorCode ForeachAttribute(IntPtr /* maps_place_h */ place, AttributesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_contact")] + internal static extern ErrorCode ForeachContact(IntPtr /* maps_place_h */ place, ContactsCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_editorial")] + internal static extern ErrorCode ForeachEditorial(IntPtr /* maps_place_h */ place, EditorialsCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_image")] + internal static extern ErrorCode ForeachImage(IntPtr /* maps_place_h */ place, ImagesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_foreach_review")] + internal static extern ErrorCode ForeachReview(IntPtr /* maps_place_h */ place, ReviewsCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_h */ place); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_place_h */ origin, out IntPtr /* maps_place_h */ cloned); + + internal string Id + { + get { return NativeGet(this.GetId); } + } + + internal string Name + { + get { return NativeGet(this.GetName); } + } + + internal string Uri + { + get { return NativeGet(this.GetUri); } + } + + internal int Distance + { + get { return NativeGet(this.GetDistance); } + } + + internal CoordinatesHandle Coordinates + { + get { return NativeGet(this.GetLocation, CoordinatesHandle.Create); } + } + + internal AddressHandle Address + { + get { return NativeGet(this.GetAddress, AddressHandle.Create); } + } + + internal PlaceRatingHandle Rating + { + get { return NativeGet(this.GetRating, PlaceRatingHandle.Create); } + } + + internal PlaceLinkObjectHandle Supplier + { + get { return NativeGet(this.GetSupplierLink, PlaceLinkObjectHandle.Create); } + } + + internal PlaceLinkObjectHandle Related + { + get { return NativeGet(this.GetRelatedLink, PlaceLinkObjectHandle.Create); } + } + + public PlaceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static PlaceHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new PlaceHandle(handle, true); + } + + + internal void ForeachProperty(Action action) + { + PropertiesCallback callback = (index, total, key, value, userData) => + { + action(key, value); + return true; + }; + + ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle"); + } + + internal void ForeachCategory(Action action) + { + // PlaceCategoryHandle is valid only in this callback and users should not keep its reference + CategoriesCallback callback = (index, total, handle, userData) => + { + action(new PlaceCategoryHandle(handle, true)); + return true; + }; + + ForeachCategory(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get category list from native handle"); + } + + internal void ForeachAttribute(Action action) + { + // PlaceAttributeHandle is valid only in this callback and users should not keep its reference + AttributesCallback callback = (index, total, handle, userData) => + { + action(new PlaceAttributeHandle(handle, true)); + return true; + }; + + ForeachAttribute(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get attributes list from native handle"); + } + + internal void ForeachContact(Action action) + { + // PlaceContactHandle is valid only in this callback and users should not keep its reference + ContactsCallback callback = (index, total, handle, userData) => + { + action(new PlaceContactHandle(handle, true)); + return true; + }; + + ForeachContact(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get contacts list from native handle"); + } + + internal void ForeachEditorial(Action action) + { + // PlaceEditorialHandle is valid only in this callback and users should not keep its reference + EditorialsCallback callback = (index, total, handle, userData) => + { + action(new PlaceEditorialHandle(handle, true)); + return true; + }; + + ForeachEditorial(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get editorial list from native handle"); + } + + internal void ForeachImage(Action action) + { + // PlaceImageHandle is valid only in this callback and users should not keep its reference + ImagesCallback callback = (index, total, handle, userData) => + { + action(new PlaceImageHandle(handle, true)); + return true; + }; + + ForeachImage(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get image list from native handle"); + } + + internal void ForeachReview(Action action) + { + // PlaceReviewHandle is valid only in this callback and users should not keep its reference + ReviewsCallback callback = (index, total, handle, userData) => + { + action(new PlaceReviewHandle(handle, true)); + return true; + }; + + ForeachReview(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get review list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.PlaceList.cs b/src/Tizen.Maps/Interop/Interop.PlaceList.cs new file mode 100755 index 0000000..8edf5b8 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.PlaceList.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal class PlaceListHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PlaceCallback(int index, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_place_list_h */ placeList); + + [DllImport(Libraries.MapService, EntryPoint = "maps_place_list_foreach")] + internal static extern ErrorCode Foreach(IntPtr /* maps_place_list_h */ placeList, PlaceCallback callback, IntPtr /* void */ userData); + + public PlaceListHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) { } + + internal void Foreach(Action action) + { + PlaceCallback callback = (index, handle, userData) => + { + action(PlaceHandle.CloneFrom(handle)); + return true; + }; + + Foreach(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get place list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Preference.cs b/src/Tizen.Maps/Interop/Interop.Preference.cs new file mode 100755 index 0000000..f309cad --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Preference.cs @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum DistanceUnit + { + Meter, // MAPS_DISTANCE_UNIT_M + Kilometer, // MAPS_DISTANCE_UNIT_KM + Foot, // MAPS_DISTANCE_UNIT_FT + Yard, // MAPS_DISTANCE_UNIT_YD + } + + internal enum RouteOptimization + { + Fastest, // MAPS_ROUTE_TYPE_FASTEST + Shortest, // MAPS_ROUTE_TYPE_SHORTEST + Economic, // MAPS_ROUTE_TYPE_ECONOMIC + Scenic, // MAPS_ROUTE_TYPE_SCENIC + FastestNow, // MAPS_ROUTE_TYPE_FASTESTNOW + DirectDrive, // MAPS_ROUTE_TYPE_DIRECTDRIVE + } + + internal enum RouteTransportMode + { + Car, // MAPS_ROUTE_TRANSPORT_MODE_CAR + Pedestrian, // MAPS_ROUTE_TRANSPORT_MODE_PEDESTRIAN + Bicycle, // MAPS_ROUTE_TRANSPORT_MODE_BICYCLE + PublicTransit, // MAPS_ROUTE_TRANSPORT_MODE_PUBLICTRANSIT + Truck, // MAPS_ROUTE_TRANSPORT_MODE_TRUCK + } + + internal enum RouteFeatureWeight + { + Normal, // MAPS_ROUTE_FEATURE_WEIGHT_NORMAL + Prefer, // MAPS_ROUTE_FEATURE_WEIGHT_PREFER + Avoid, // MAPS_ROUTE_FEATURE_WEIGHT_AVOID + SoftExclude, // MAPS_ROUTE_FEATURE_WEIGHT_SOFTEXCLUDE + StrictExclude, // MAPS_ROUTE_FEATURE_WEIGHT_STRICTEXCLUDE + } + + internal enum RouteRequestFeature + { + None, // MAPS_ROUTE_FEATURE_NO + Toll, // MAPS_ROUTE_FEATURE_TOLL + MotorWay, // MAPS_ROUTE_FEATURE_MOTORWAY + BoatFerry, // MAPS_ROUTE_FEATURE_BOATFERRY + RailFerry, // MAPS_ROUTE_FEATURE_RAILFERRY + PublicTransit, // MAPS_ROUTE_FEATURE_PUBLICTTRANSIT + Tunnel, // MAPS_ROUTE_FEATURE_TUNNEL + DirtRoad, // MAPS_ROUTE_FEATURE_DIRTROAD + Parks, // MAPS_ROUTE_FEATURE_PARKS + Hovlane, // MAPS_ROUTE_FEATURE_HOVLANE + Stairs, // MAPS_ROUTE_FEATURE_STAIRS + } + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_distance_unit")] + internal static extern ErrorCode GetDistanceUnit(this PreferenceHandle /* maps_preference_h */ preference, out DistanceUnit /* maps_distance_unit_e */ unit); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_distance_unit")] + internal static extern ErrorCode SetDistanceUnit(this PreferenceHandle /* maps_preference_h */ preference, DistanceUnit /* maps_distance_unit_e */ unit); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_language")] + internal static extern ErrorCode GetLanguage(this PreferenceHandle /* maps_preference_h */ preference, out string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_language")] + internal static extern ErrorCode SetLanguage(this PreferenceHandle /* maps_preference_h */ preference, string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_max_results")] + internal static extern ErrorCode GetMaxResults(this PreferenceHandle /* maps_preference_h */ preference, out int maxResults); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_max_results")] + internal static extern ErrorCode SetMaxResults(this PreferenceHandle /* maps_preference_h */ preference, int maxResults); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_country_code")] + internal static extern ErrorCode GetCountryCode(this PreferenceHandle /* maps_preference_h */ preference, out string countryCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_country_code")] + internal static extern ErrorCode SetCountryCode(this PreferenceHandle /* maps_preference_h */ preference, string countryCode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_optimization")] + internal static extern ErrorCode GetRouteOptimization(this PreferenceHandle /* maps_preference_h */ preference, out RouteOptimization /* maps_route_optimization_e */ optimization); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_optimization")] + internal static extern ErrorCode SetRouteOptimization(this PreferenceHandle /* maps_preference_h */ preference, RouteOptimization /* maps_route_optimization_e */ optimization); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_transport_mode")] + internal static extern ErrorCode GetRouteTransportMode(this PreferenceHandle /* maps_preference_h */ preference, out RouteTransportMode /* maps_route_transport_mode_e */ transportMode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_transport_mode")] + internal static extern ErrorCode SetRouteTransportMode(this PreferenceHandle /* maps_preference_h */ preference, RouteTransportMode /* maps_route_transport_mode_e */ transportMode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_feature_weight")] + internal static extern ErrorCode GetRouteFeatureWeight(this PreferenceHandle /* maps_preference_h */ preference, out RouteFeatureWeight /* maps_route_feature_weight_e */ featureWeight); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_feature_weight")] + internal static extern ErrorCode SetRouteFeatureWeight(this PreferenceHandle /* maps_preference_h */ preference, RouteFeatureWeight /* maps_route_feature_weight_e */ featureWeight); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_feature")] + internal static extern ErrorCode GetRouteFeature(this PreferenceHandle /* maps_preference_h */ preference, out RouteRequestFeature /* maps_route_feature_e */ feature); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_feature")] + internal static extern ErrorCode SetRouteFeature(this PreferenceHandle /* maps_preference_h */ preference, RouteRequestFeature /* maps_route_feature_e */ feature); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get_route_alternatives_enabled")] + internal static extern ErrorCode GetRouteAlternativesEnabled(this PreferenceHandle /* maps_preference_h */ preference, out bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_route_alternatives_enabled")] + internal static extern ErrorCode SetRouteAlternativesEnabled(this PreferenceHandle /* maps_preference_h */ preference, bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_get")] + internal static extern ErrorCode GetProperty(this PreferenceHandle /* maps_preference_h */ preference, string key, out string value); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_set_property")] + internal static extern ErrorCode SetProperty(this PreferenceHandle /* maps_preference_h */ preference, string key, string value); + + internal class PreferenceHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PropertiesCallback(int index, int total, string key, string value, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_foreach_property")] + internal static extern ErrorCode ForeachProperty(IntPtr /* maps_preference_h */ preference, PropertiesCallback callback, IntPtr /* void */ userData); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_create")] + internal static extern ErrorCode Create(out IntPtr /* maps_preference_h */ preference); + + [DllImport(Libraries.MapService, EntryPoint = "maps_preference_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_preference_h */ preference); + + internal DistanceUnit Unit + { + get { return NativeGet(this.GetDistanceUnit); } + set { NativeSet(this.SetDistanceUnit, value); } + } + + internal string Language + { + get { return NativeGet(this.GetLanguage); } + set { NativeSet(this.SetLanguage, value); } + } + + internal int MaxResult + { + get { return NativeGet(this.GetMaxResults); } + set { NativeSet(this.SetMaxResults, value); } + } + + internal string CountryCode + { + get { return NativeGet(this.GetCountryCode); } + set { NativeSet(this.SetCountryCode, value); } + } + + internal RouteOptimization Optimization + { + get { return NativeGet(this.GetRouteOptimization); } + set { NativeSet(this.SetRouteOptimization, value); } + } + + internal RouteTransportMode TransportMode + { + get { return NativeGet(this.GetRouteTransportMode); } + set { NativeSet(this.SetRouteTransportMode, value); } + } + + internal RouteRequestFeature Feature + { + get { return NativeGet(this.GetRouteFeature); } + set { NativeSet(this.SetRouteFeature, value); } + } + + internal RouteFeatureWeight FeatureWeight + { + get { return NativeGet(this.GetRouteFeatureWeight); } + set { NativeSet(this.SetRouteFeatureWeight, value); } + } + + internal bool AlternativesEnabled + { + get { return NativeGet(this.GetRouteAlternativesEnabled); } + set { NativeSet(this.SetRouteAlternativesEnabled, value); } + } + + internal PreferenceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal PreferenceHandle() : this(IntPtr.Zero, true) + { + Create(out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal void ForeachProperty(Action action) + { + PropertiesCallback callback = (index, total, key, value, userData) => + { + action(key, value); + return true; + }; + + ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle"); + } + + internal static PreferenceHandle Create(IntPtr nativeHandle) + { + return new PreferenceHandle(nativeHandle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Route.Maneuver.cs b/src/Tizen.Maps/Interop/Interop.Route.Maneuver.cs new file mode 100755 index 0000000..a2c6216 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Route.Maneuver.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum RouteDirection + { + None, // MAPS_ROUTE_DIRECTION_NONE + North, // MAPS_ROUTE_DIRECTION_NORTH + NorthWest, // MAPS_ROUTE_DIRECTION_NORTHWEST + NorthEast, // MAPS_ROUTE_DIRECTION_NORTHEAST + South, // MAPS_ROUTE_DIRECTION_SOUTH + SouthEast, // MAPS_ROUTE_DIRECTION_SOUTHEAST + SouthWest, // MAPS_ROUTE_DIRECTION_SOUTHWEST + West, // MAPS_ROUTE_DIRECTION_WEST + East, // MAPS_ROUTE_DIRECTION_EAST + } + + internal enum RouteTurnType + { + None, // MAPS_ROUTE_TURN_TYPE_NONE + Straight, // MAPS_ROUTE_TURN_TYPE_STRAIGHT + BearRight, // MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT + LightRight, // MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT + Right, // MAPS_ROUTE_TURN_TYPE_RIGHT + HardRight, // MAPS_ROUTE_TURN_TYPE_HARD_RIGHT + UturnRight, // MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT + UturnLeft, // MAPS_ROUTE_TURN_TYPE_UTURN_LEFT + HardLeft, // MAPS_ROUTE_TURN_TYPE_HARD_LEFT + Left, // MAPS_ROUTE_TURN_TYPE_LEFT + LightLeft, // MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT + BearLeft, // MAPS_ROUTE_TURN_TYPE_BEAR_LEFT + RightFork, // MAPS_ROUTE_TURN_TYPE_RIGHT_FORK + LeftFork, // MAPS_ROUTE_TURN_TYPE_LEFT_FORK + StraightFork, // MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK + } + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_direction_id")] + internal static extern ErrorCode GetDirectionId(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteDirection /* maps_route_direction_e */ directionId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_turn_type")] + internal static extern ErrorCode GetTurnType(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out RouteTurnType /* maps_route_turn_type_e */ turnType); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_position")] + internal static extern ErrorCode GetPosition(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out IntPtr /* maps_coordinates_h */ position); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_road_name")] + internal static extern ErrorCode GetRoadName(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string roadName); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_instruction_text")] + internal static extern ErrorCode GetInstructionText(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string instructionText); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_locale")] + internal static extern ErrorCode GetLocale(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out string locale); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_time_to_next_instruction")] + internal static extern ErrorCode GetTimeToNextInstruction(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out int timeToNextInstruction); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_get_distance_to_next_instruction")] + internal static extern ErrorCode GetDistanceToNextInstruction(this RouteManeuverHandle /* maps_route_maneuver_h */ maneuver, out double distanceToNextInstruction); + + internal class RouteManeuverHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_route_maneuver_h */ maneuver); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_maneuver_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_route_maneuver_h */ origin, out IntPtr /* maps_route_maneuver_h */ cloned); + + internal string RoadName + { + get { return NativeGet(this.GetRoadName); } + } + + internal string Instruction + { + get { return NativeGet(this.GetInstructionText); } + } + + internal string Locale + { + get { return NativeGet(this.GetLocale); } + } + + internal int TimeToNextInstruction + { + get { return NativeGet(this.GetTimeToNextInstruction); } + } + + internal double DistanceToNextInstruction + { + get { return NativeGet(this.GetDistanceToNextInstruction); } + } + + internal RouteDirection Direction + { + get { return NativeGet(this.GetDirectionId); } + } + + internal RouteTurnType TurnType + { + get { return NativeGet(this.GetTurnType); } + } + + internal CoordinatesHandle Coordinates + { + get { return NativeGet(this.GetPosition, CoordinatesHandle.Create); } + } + + public RouteManeuverHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static RouteManeuverHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new RouteManeuverHandle(handle, true); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Route.Segment.cs b/src/Tizen.Maps/Interop/Interop.Route.Segment.cs new file mode 100755 index 0000000..7aa6493 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Route.Segment.cs @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_origin")] + internal static extern ErrorCode GetOrigin(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ origin); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_destination")] + internal static extern ErrorCode GetDestination(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_coordinates_h */ destination); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_bounding_box")] + internal static extern ErrorCode GetBoundingBox(this RouteSegmentHandle /* maps_route_segment_h */ segment, out IntPtr /* maps_area_h */ boundingBox); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_distance")] + internal static extern ErrorCode GetDistance(this RouteSegmentHandle /* maps_route_segment_h */ segment, out double distance); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_get_duration")] + internal static extern ErrorCode GetDuration(this RouteSegmentHandle /* maps_route_segment_h */ segment, out long duration); + + internal class RouteSegmentHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ManeuverCallback(int index, int total, IntPtr /* maps_route_maneuver_h */ maneuver, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_path")] + internal static extern ErrorCode ForeachPath(IntPtr /* maps_route_segment_h */ segment, PathCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_foreach_maneuver")] + internal static extern ErrorCode ForeachManeuver(IntPtr /* maps_route_segment_h */ segment, ManeuverCallback callback, IntPtr /* void */ userData); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_route_segment_h */ segment); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_segment_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_route_segment_h */ origin, out IntPtr /* maps_route_segment_h */ cloned); + + internal double Distance + { + get { return NativeGet(this.GetDistance); } + } + + internal long Duration + { + get { return NativeGet(this.GetDuration); } + } + + internal CoordinatesHandle Origin + { + get { return NativeGet(this.GetOrigin, CoordinatesHandle.Create); } + } + + internal CoordinatesHandle Destination + { + get { return NativeGet(this.GetDestination, CoordinatesHandle.Create); } + } + + internal AreaHandle BoundingBox + { + get { return NativeGet(this.GetBoundingBox, AreaHandle.Create); } + } + + public RouteSegmentHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static RouteSegmentHandle CloneFrom(IntPtr nativeHandle) + { + IntPtr handle; + Clone(nativeHandle, out handle).ThrowIfFailed("Failed to clone native handle"); + return new RouteSegmentHandle(handle, true); + } + + internal void ForeachPath(Action action) + { + PathCallback callback = (index, total, nativeHandle, userData) => + { + if (handle != IntPtr.Zero) + { + action(CoordinatesHandle.CloneFrom(nativeHandle)); + //Destroy(nativeHandle); + } + return true; + }; + + ForeachPath(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get path coordinates list from native handle"); + } + + internal void ForeachManeuver(Action action) + { + ManeuverCallback callback = (index, total, nativeHandle, userData) => + { + if (handle != IntPtr.Zero) + { + action(RouteManeuverHandle.CloneFrom(nativeHandle)); + //Destroy(nativeHandle); + } + return true; + }; + + ForeachManeuver(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get segment list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Route.cs b/src/Tizen.Maps/Interop/Interop.Route.cs new file mode 100755 index 0000000..52eac7d --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Route.cs @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_route_id")] + internal static extern ErrorCode GetRouteId(this RouteHandle /* maps_route_h */ route, out string routeId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_origin")] + internal static extern ErrorCode GetOrigin(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ origin); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_destination")] + internal static extern ErrorCode GetDestination(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_coordinates_h */ destination); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_bounding_box")] + internal static extern ErrorCode GetBoundingBox(this RouteHandle /* maps_route_h */ route, out IntPtr /* maps_area_h */ boundingBox); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_transport_mode")] + internal static extern ErrorCode GetTransportMode(this RouteHandle /* maps_route_h */ route, out RouteTransportMode /* maps_route_transport_mode_e */ transportMode); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_distance")] + internal static extern ErrorCode GetTotalDistance(this RouteHandle /* maps_route_h */ route, out double totalDistance); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_total_duration")] + internal static extern ErrorCode GetTotalDuration(this RouteHandle /* maps_route_h */ route, out long totalDuration); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_get_distance_unit")] + internal static extern ErrorCode GetDistanceUnit(this RouteHandle /* maps_route_h */ route, out DistanceUnit /* maps_distance_unit_e */ distanceUnit); + + internal class RouteHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PropertiesCallback(int index, int total, string key, string /* void */ value, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PathCallback(int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SegmentCallback(int index, int total, IntPtr /* maps_route_segment_h */ segment, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_property")] + internal static extern ErrorCode ForeachProperty(IntPtr /* maps_route_h */ route, PropertiesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_path")] + internal static extern ErrorCode ForeachPath(IntPtr /* maps_route_h */ route, PathCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_foreach_segment")] + internal static extern ErrorCode ForeachSegment(IntPtr /* maps_route_h */ route, SegmentCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_route_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_route_h */ route); + + internal string Id + { + get { return NativeGet(this.GetRouteId); } + } + + internal double Distance + { + get { return NativeGet(this.GetTotalDistance); } + } + + internal long Duration + { + get { return NativeGet(this.GetTotalDuration); } + } + + internal DistanceUnit Unit + { + get { return NativeGet(this.GetDistanceUnit); } + } + + internal RouteTransportMode TransportMode + { + get { return NativeGet(this.GetTransportMode); } + } + + internal CoordinatesHandle Origin + { + get { return NativeGet(this.GetOrigin, CoordinatesHandle.Create); } + } + + internal CoordinatesHandle Destination + { + get { return NativeGet(this.GetDestination, CoordinatesHandle.Create); } + } + + internal AreaHandle BoundingBox + { + get { return NativeGet(this.GetBoundingBox, AreaHandle.Create); } + } + + public RouteHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal void ForeachProperty(Action action) + { + PropertiesCallback callback = (index, total, key, value, userData) => + { + action(key, value); + return true; + }; + + ForeachProperty(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get property list from native handle"); + } + + internal void ForeachPath(Action action) + { + PathCallback callback = (index, total, nativeHandle, userData) => + { + if (handle != IntPtr.Zero) + { + action(CoordinatesHandle.CloneFrom(nativeHandle)); + //Destroy(nativeHandle); + } + return true; + }; + + ForeachPath(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get path coordinates list from native handle"); + } + + internal void ForeachSegment(Action action) + { + SegmentCallback callback = (index, total, nativeHandle, userData) => + { + if (handle != IntPtr.Zero) + { + action(RouteSegmentHandle.CloneFrom(nativeHandle)); + //Destroy(nativeHandle); + } + return true; + }; + + ForeachSegment(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get segment list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs b/src/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs new file mode 100755 index 0000000..6f915cc --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.SafeMapsHandle.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + + +internal static partial class Interop +{ + private const string LogTag = "Tizen.Maps"; + + public delegate ErrorCode GetterMethod(out T value); + public delegate ErrorCode GetterPtrMethod(out IntPtr value); + public delegate ErrorCode SetterMethod(T value); + + internal static T NativeGet(GetterMethod getter, [CallerMemberName] string propertyName = "") + { + T value; + var err = getter(out value); + if (err.IsSuccess()) + { + return value; + } + + //err.WarnIfFailed($"Native getter for {propertyName} failed"); + return default(T); + } + + internal static T NativeGet(GetterMethod getter, Func ctor, [CallerMemberName] string propertyName = "") where T : SafeMapsHandle + { + return ctor(NativeGet(getter, propertyName)); + } + + internal static T NativeGet(GetterMethod getter, Func ctor, bool hasOwnership, [CallerMemberName] string propertyName = "") where T : SafeMapsHandle + { + return ctor(NativeGet(getter, propertyName), hasOwnership); + } + + internal static string NativeGet(GetterMethod getter, [CallerMemberName] string propertyName = "") + { + string value; + var err = getter(out value); + if (err.IsSuccess()) + { + return value; + } + + //err.WarnIfFailed($"Native getter for {propertyName} failed"); + return string.Empty; + } + + internal static void NativeSet(SetterMethod setter, T value, [CallerMemberName] string propertyName = "") + { + setter(value).WarnIfFailed($"Native setter for {propertyName} failed"); + } + + internal abstract class SafeMapsHandle : SafeHandle + { + protected delegate ErrorCode DestroyNativeHandleMethod(IntPtr handle); + protected DestroyNativeHandleMethod DestroyHandle; + + protected SafeMapsHandle(IntPtr handle, bool needToRelease, DestroyNativeHandleMethod destroy) : base(handle, true) + { + HasOwnership = needToRelease; + DestroyHandle = destroy; + } + + internal bool HasOwnership { get; set; } + + public override bool IsInvalid { get { return handle == IntPtr.Zero; } } + + protected override bool ReleaseHandle() + { + if (HasOwnership) + { + var err = DestroyHandle(handle); + err.WarnIfFailed($"Failed to delete native {GetType()} handle"); + } + + SetHandle(IntPtr.Zero); + return true; + } + + public static implicit operator IntPtr(SafeMapsHandle otherHandle) + { + return otherHandle.handle; + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.Service.cs b/src/Tizen.Maps/Interop/Interop.Service.cs new file mode 100755 index 0000000..021b4b4 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.Service.cs @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum ServiceType + { + Geocode, // MAPS_SERVICE_GEOCODE + GeocodeInsideArea, // MAPS_SERVICE_GEOCODE_INSIDE_AREA + GeocodeByStructuredAddress, // MAPS_SERVICE_GEOCODE_BY_STRUCTURED_ADDRESS + ReverseGeocode, // MAPS_SERVICE_REVERSE_GEOCODE + SearchPlace, // MAPS_SERVICE_SEARCH_PLACE + SearchPlaceByArea, // MAPS_SERVICE_SEARCH_PLACE_BY_AREA + SearchPlaceByAddress, // MAPS_SERVICE_SEARCH_PLACE_BY_ADDRESS + SearchRoute, // MAPS_SERVICE_SEARCH_ROUTE + SearchRouteWaypoints, // MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS + CancelRequest, // MAPS_SERVICE_CANCEL_REQUEST + MultiReverseGeocode, // MAPS_SERVICE_MULTI_REVERSE_GEOCODE + SearchPlaceList, // MAPS_SERVICE_SEARCH_PLACE_LIST + SearchGetPlaceDetails, // MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS + View = 0x100, // MAPS_SERVICE_VIEW + ViewSnapshot, // MAPS_SERVICE_VIEW_SNAPSHOT + } + + internal enum ServiceData + { + PlaceAddress, // MAPS_PLACE_ADDRESS + PlaceRating, // MAPS_PLACE_RATING + PlaceCategories, // MAPS_PLACE_CATEGORIES + PlaceAttributes, // MAPS_PLACE_ATTRIBUTES + PlaceContacts, // MAPS_PLACE_CONTACTS + PlaceEditorials, // MAPS_PLACE_EDITORIALS + PlaceReviews, // MAPS_PLACE_REVIEWS + PlaceImage, // MAPS_PLACE_IMAGE + PlaceSupplier, // MAPS_PLACE_SUPPLIER + PlaceRelated, // MAPS_PLACE_RELATED + RoutePath, // MAPS_ROUTE_PATH + RouteSegmentsPath, // MAPS_ROUTE_SEGMENTS_PATH + RouteSegmentsManeuvers, // MAPS_ROUTE_SEGMENTS_MANEUVERS + ViewTraffic = 0x100, // MAPS_VIEW_TRAFFIC + ViewPublicTransit, // MAPS_VIEW_PUBLIC_TRANSIT + ViewBuilding, // MAPS_VIEW_BUILDING + ViewScaleBar, // MAPS_VIEW_SCALEBAR + } + + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int index, int total, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ReverseGeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int index, int total, IntPtr /* maps_address_h */ address, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MultiReverseGeocodeCallback(ErrorCode /* maps_error_e */ result, int requestId, int total, IntPtr /* maps_address_list_h */ addressList, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SearchPlaceCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SearchPlaceListCallback(ErrorCode /* maps_error_e */ error, int requestId, int total, IntPtr /* maps_place_list_h */ placeList, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void GetPlaceDetailsCallback(ErrorCode /* maps_error_e */ error, int requestId, IntPtr /* maps_place_h */ place, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SearchRouteCallback(ErrorCode /* maps_error_e */ error, int requestId, int index, int total, IntPtr /* maps_route_h */ route, IntPtr /* void */ userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RequestUserConsentwithHandleCallback(bool consented, IntPtr /* void */ userData); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_cancel_request")] + internal static extern ErrorCode CancelRequest(this ServiceHandle /* maps_service_h */ maps, int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode")] + internal static extern ErrorCode Geocode(this ServiceHandle /* maps_service_h */ maps, string address, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode_inside_area")] + internal static extern ErrorCode GeocodeInsideArea(this ServiceHandle /* maps_service_h */ maps, string address, AreaHandle /* maps_area_h */ bounds, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_geocode_by_structured_address")] + internal static extern ErrorCode GeocodeByStructuredAddress(this ServiceHandle /* maps_service_h */ maps, AddressHandle /* maps_address_h */ address, PreferenceHandle /* maps_preference_h */ preference, GeocodeCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_reverse_geocode")] + internal static extern ErrorCode ReverseGeocode(this ServiceHandle /* maps_service_h */ maps, double latitude, double longitude, PreferenceHandle /* maps_preference_h */ preference, ReverseGeocodeCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_multi_reverse_geocode")] + internal static extern ErrorCode MultiReverseGeocode(this ServiceHandle /* maps_service_h */ maps, CoordinatesListHandle /* maps_coordinates_list_h */ coordinatesList, PreferenceHandle /* maps_preference_h */ preference, MultiReverseGeocodeCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place")] + internal static extern ErrorCode SearchPlace(this ServiceHandle /* maps_service_h */ maps, CoordinatesHandle /* maps_coordinates_h */ position, int distance, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_by_area")] + internal static extern ErrorCode SearchPlaceByArea(this ServiceHandle /* maps_service_h */ maps, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_by_address")] + internal static extern ErrorCode SearchPlaceByAddress(this ServiceHandle /* maps_service_h */ maps, string address, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_place_list")] + internal static extern ErrorCode SearchPlaceList(this ServiceHandle /* maps_service_h */ maps, AreaHandle /* maps_area_h */ boundary, PlaceFilterHandle /* maps_place_filter_h */ filter, PreferenceHandle /* maps_preference_h */ preference, SearchPlaceListCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_place_details")] + internal static extern ErrorCode GetPlaceDetails(this ServiceHandle /* maps_service_h */ maps, string uri, GetPlaceDetailsCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route")] + internal static extern ErrorCode SearchRoute(this ServiceHandle /* maps_service_h */ maps, CoordinatesHandle /* maps_coordinates_h */ origin, CoordinatesHandle /* maps_coordinates_h */ destination, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_search_route_waypoints")] + internal static extern ErrorCode SearchRouteWaypoints(this ServiceHandle /* maps_service_h */ maps, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] [In] IntPtr[] /* maps_coordinates_h */ waypointList, int waypointNum, PreferenceHandle /* maps_preference_h */ preference, SearchRouteCallback callback, IntPtr /* void */ userData, out int requestId); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_user_consent")] + internal static extern ErrorCode GetUserConsent(this ServiceHandle /* maps_service_h */ maps, out bool consent); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_set_provider_key")] + internal static extern ErrorCode SetProviderKey(this ServiceHandle /* maps_service_h */ maps, string providerKey); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_provider_key")] + internal static extern ErrorCode GetProviderKey(this ServiceHandle /* maps_service_h */ maps, out string providerKey); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_set_preference")] + internal static extern ErrorCode SetPreference(this ServiceHandle /* maps_service_h */ maps, PreferenceHandle /* maps_preference_h */ preference); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_get_preference")] + internal static extern ErrorCode GetPreference(this ServiceHandle /* maps_service_h */ maps, out IntPtr /* maps_preference_h */ preference); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_service_supported")] + internal static extern ErrorCode IsServiceSupported(this ServiceHandle /* maps_service_h */ maps, ServiceType /* maps_service_e */ service, out bool supported); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_provider_is_data_supported")] + internal static extern ErrorCode IsDataSupported(this ServiceHandle /* maps_service_h */ maps, ServiceData /* maps_service_data_e */ data, out bool supported); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_request_user_consent_with_handle")] + internal static extern ErrorCode RequestUserConsent(this ServiceHandle /* maps_service_h */ maps, RequestUserConsentwithHandleCallback callback, IntPtr /* void */ userData); + + internal class ServiceHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ProviderInfoCallback(string mapsProvider, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_foreach_provider")] + internal static extern ErrorCode ForeachProvider(ProviderInfoCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_create_without_user_consent")] + internal static extern ErrorCode Create(string provider, out IntPtr /* maps_service_h */ maps); + + [DllImport(Libraries.MapService, EntryPoint = "maps_service_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_service_h */ maps); + + internal bool UserConsented + { + get { return NativeGet(this.GetUserConsent); } + } + + internal string ProviderKey + { + get { return NativeGet(this.GetProviderKey); } + set { NativeSet(this.SetProviderKey, value); } + } + + internal PreferenceHandle Preferences + { + get { return NativeGet(this.GetPreference, PreferenceHandle.Create); } + set { NativeSet(this.SetPreference, value); } + } + + public ServiceHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + public ServiceHandle(string serviceProvider) : this(IntPtr.Zero, true) + { + Create(serviceProvider, out handle).ThrowIfFailed($"Failed to create native handle for {serviceProvider}"); + } + + internal static void ForeachProvider(Action action) + { + ProviderInfoCallback callback = (provider, userData) => + { + action(provider); + return true; + }; + + ForeachProvider(callback, IntPtr.Zero).WarnIfFailed("Failed to get provider list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Event.Data.cs b/src/Tizen.Maps/Interop/Interop.View.Event.Data.cs new file mode 100755 index 0000000..dd5fd6a --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Event.Data.cs @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + internal enum ViewAction + { + None, // MAPS_VIEW_ACTION_NONE + Scroll, // MAPS_VIEW_ACTION_SCROLL + Zoom, // MAPS_VIEW_ACTION_ZOOM + ZoomIn, // MAPS_VIEW_ACTION_ZOOM_IN + ZoomOut, // MAPS_VIEW_ACTION_ZOOM_OUT + ZoomAndScroll, // MAPS_VIEW_ACTION_ZOOM_AND_SCROLL + Rotate, // MAPS_VIEW_ACTION_ROTATE + } + + internal enum ViewGesture + { + None, // MAPS_VIEW_GESTURE_NONE + Scroll, // MAPS_VIEW_GESTURE_SCROLL + Zoom, // MAPS_VIEW_GESTURE_ZOOM + Click, // MAPS_VIEW_GESTURE_TAP + DoubleClick, // MAPS_VIEW_GESTURE_DOUBLE_TAP + TwoFingerClick, // MAPS_VIEW_GESTURE_2_FINGER_TAP + Rotation, // MAPS_VIEW_GESTURE_ROTATE + LongPress, // MAPS_VIEW_GESTURE_LONG_PRESS + } + + internal enum ViewEventType + { + Gesture, // MAPS_VIEW_EVENT_GESTURE + Action, // MAPS_VIEW_EVENT_ACTION + Object, // MAPS_VIEW_EVENT_OBJECT + Ready, // MAPS_VIEW_EVENT_READY + } + + internal static partial class ViewEventData + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_clone")] + internal static extern ErrorCode Clone(IntPtr /* maps_view_event_data_h */ origin, out IntPtr /* maps_view_event_data_h */ cloned); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_center")] + internal static extern ErrorCode GetCenter(IntPtr /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_coordinates_h */ center); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_delta")] + internal static extern ErrorCode GetDelta(IntPtr /* maps_view_event_data_h */ viewEvent, out int deltaX, out int deltaY); + } + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_type")] + internal static extern ErrorCode GetType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewEventType /* maps_view_event_type_e */ eventType); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_gesture_type")] + internal static extern ErrorCode GetGestureType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewGesture /* maps_view_gesture_e */ gestureType); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_action_type")] + internal static extern ErrorCode GetActionType(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out ViewAction /* maps_view_action_e */ actionType); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_position")] + internal static extern ErrorCode GetPosition(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out int x, out int y); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_fingers")] + internal static extern ErrorCode GetFingers(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out int fingers); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_object")] + internal static extern ErrorCode GetObject(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_view_object_h */ viewEventDataObject); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_coordinates")] + internal static extern ErrorCode GetCoordinates(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_zoom_factor")] + internal static extern ErrorCode GetZoomFactor(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out double zoomFactor); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_get_rotation_angle")] + internal static extern ErrorCode GetRotationAngle(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out double rotationAngle); + + internal static ErrorCode GetPosition(this EventDataHandle /* maps_view_event_data_h */ viewEvent, out Point position) + { + position = new Point(); + return GetPosition(viewEvent, out position.X, out position.Y); + } + + internal class EventDataHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_event_data_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_view_event_data_h */ viewEvent); + + internal ViewEventType Type + { + get { return NativeGet(this.GetType); } + } + + // event_data will be released automatically after this callback is terminated. + internal EventDataHandle(IntPtr handle) : base(handle, false, Destroy) + { + } + } + + internal class ObjectEventDataHandle : EventDataHandle + { + internal ViewGesture GestureType + { + get { return NativeGet(this.GetGestureType); } + } + + internal Point Position + { + get { return NativeGet(this.GetPosition); } + } + + internal int FingerCount + { + get { return NativeGet(this.GetFingers); } + } + + internal ViewObjectHandle ViewObject + { + get { return NativeGet(this.GetObject, ViewObjectHandle.Create, false ); } + } + + // event_data will be released automatically after this callback is terminated. + internal ObjectEventDataHandle(IntPtr handle) : base(handle) + { + } + } + + internal class GestureEventDataHandle : EventDataHandle + { + internal ViewGesture GestureType + { + get { return NativeGet(this.GetGestureType); } + } + + internal Point Position + { + get { return NativeGet(this.GetPosition); } + } + + internal int FingerCount + { + get { return NativeGet(this.GetFingers); } + } + + internal double ZoomFactor + { + get { return NativeGet(this.GetZoomFactor); } + } + + internal double RotationAngle + { + get { return NativeGet(this.GetRotationAngle); } + } + + internal CoordinatesHandle Coordinates + { + get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); } + } + + internal GestureEventDataHandle(IntPtr handle) : base(handle) + { + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Marker.cs b/src/Tizen.Maps/Interop/Interop.View.Marker.cs new file mode 100755 index 0000000..f92ef87 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Marker.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_type")] + internal static extern ErrorCode GetType(this MarkerHandle /* maps_view_object_h */ marker, out ViewMarkerType /* maps_view_marker_type_e */ type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_coordinates")] + internal static extern ErrorCode GetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_coordinates")] + internal static extern ErrorCode SetCoordinates(this MarkerHandle /* maps_view_object_h */ marker, CoordinatesHandle /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_image_file")] + internal static extern ErrorCode GetImageFile(this MarkerHandle /* maps_view_object_h */ marker, out string filePath); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_image_file")] + internal static extern ErrorCode SetImageFile(this MarkerHandle /* maps_view_object_h */ marker, string filePath); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_z_order")] + internal static extern ErrorCode GetZOrder(this MarkerHandle /* maps_view_object_h */ marker, out int zOrder); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_set_z_order")] + internal static extern ErrorCode SetZOrder(this MarkerHandle /* maps_view_object_h */ marker, int zOrder); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_get_size")] + internal static extern ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out int width, out int height); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_marker_resize")] + internal static extern ErrorCode Resize(this MarkerHandle /* maps_view_object_h */ marker, int width, int height); + + internal static ErrorCode GetSize(this MarkerHandle /* maps_view_object_h */ marker, out Size size) + { + size = new Size(0, 0); + return GetSize(marker, out size.Width, out size.Height); + } + + internal static ErrorCode SetSize(this MarkerHandle /* maps_view_object_h */ marker, Size size) + { + return Resize(marker, size.Width, size.Height); + } + + internal class MarkerHandle : ViewObjectHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_marker")] + internal static extern ErrorCode CreateMarker(CoordinatesHandle /* maps_coordinates_h */ coordinates, string imageFilePath, ViewMarkerType /* maps_view_marker_type_e */ type, out IntPtr /* maps_view_object_h */ marker); + + internal ViewMarkerType Type + { + get { return NativeGet(this.GetType); } + } + + internal string ImageFile + { + get { return NativeGet(this.GetImageFile); } + set { NativeSet(this.SetImageFile, value); } + } + + internal int ZOrder + { + get { return NativeGet(this.GetZOrder); } + set { NativeSet(this.SetZOrder, value); } + } + + internal Size MarkerSize + { + get { return NativeGet(this.GetSize); } + set { NativeSet(this.SetSize, value); } + } + + internal CoordinatesHandle Coordinates + { + get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); } + set { NativeSet(this.SetCoordinates, value); } + } + + internal MarkerHandle(CoordinatesHandle coordinates, string imagePath, ViewMarkerType type) : base(IntPtr.Zero, true) + { + var clonedCoordinatesHandle = CoordinatesHandle.CloneFrom(coordinates); + CreateMarker(clonedCoordinatesHandle, imagePath, type, out handle).ThrowIfFailed("Failed to create native handle for marker"); + clonedCoordinatesHandle.HasOwnership = false; + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Object.cs b/src/Tizen.Maps/Interop/Interop.View.Object.cs new file mode 100755 index 0000000..af2834f --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Object.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + internal enum ViewObjectType + { + Polyline, // MAPS_VIEW_OBJECT_POLYLINE + Polygon, // MAPS_VIEW_OBJECT_POLYGON + Marker, // MAPS_VIEW_OBJECT_MARKER + Overlay, // MAPS_VIEW_OBJECT_OVERLAY + } + + internal enum ViewMarkerType + { + Pin, // MAPS_VIEW_MARKER_PIN + Sticker, // MAPS_VIEW_MARKER_STICKER + } + + internal enum ViewOverlayType + { + Normal, // MAPS_VIEW_OVERLAY_NORMAL + Bubble, // MAPS_VIEW_OVERLAY_BUBBLE + Box, // MAPS_VIEW_OVERLAY_BOX + } + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_type")] + internal static extern ErrorCode GetType(this ViewObjectHandle /* maps_view_object_h */ viewObject, out ViewObjectType /* maps_view_object_type_e */ type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_set_visible")] + internal static extern ErrorCode SetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, bool visible); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_get_visible")] + internal static extern ErrorCode GetVisible(this ViewObjectHandle /* maps_view_object_h */ viewObject, out bool visible); + + internal class ViewObjectHandle : SafeMapsHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_view_object_h */ viewObject); + + internal bool IsVisible + { + get { return NativeGet(this.GetVisible); } + set { NativeSet(this.SetVisible, value); } + } + + public ViewObjectHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + internal static ViewObjectHandle Create(IntPtr nativeHandle, bool needToRelease) + { + return new ViewObjectHandle(nativeHandle, needToRelease); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Overlay.cs b/src/Tizen.Maps/Interop/Interop.View.Overlay.cs new file mode 100755 index 0000000..27ed8b7 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Overlay.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_coordinates")] + internal static extern ErrorCode SetCoordinates(this OverlayHandle /* maps_view_object_h */ overlay, CoordinatesHandle /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_coordinates")] + internal static extern ErrorCode GetCoordinates(this OverlayHandle /* maps_view_object_h */ overlay, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_min_zoom_level")] + internal static extern ErrorCode SetMinZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, int zoom); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_min_zoom_level")] + internal static extern ErrorCode GetMinZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, out int zoom); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_set_max_zoom_level")] + internal static extern ErrorCode SetMaxZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, int zoom); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_overlay_get_max_zoom_level")] + internal static extern ErrorCode GetMaxZoomLevel(this OverlayHandle /* maps_view_object_h */ overlay, out int zoom); + + internal class OverlayHandle : ViewObjectHandle + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_overlay")] + internal static extern ErrorCode CreateOverlay(CoordinatesHandle /* maps_coordinates_h */ coordinates, IntPtr viewObject, ViewOverlayType /* maps_view_overlay_type_e */ type, out IntPtr /* maps_view_object_h */ overlay); + + internal int MinZoomLevel + { + get { return NativeGet(this.GetMinZoomLevel); } + set { NativeSet(this.SetMinZoomLevel, value); } + } + + internal int MaxZoomLevel + { + get { return NativeGet(this.GetMaxZoomLevel); } + set { NativeSet(this.SetMaxZoomLevel, value); } + } + + + internal CoordinatesHandle Coordinates + { + get { return NativeGet(this.GetCoordinates, CoordinatesHandle.Create); } + set { NativeSet(this.SetCoordinates, value); } + } + + internal OverlayHandle(CoordinatesHandle coordinates, EvasObject viewObject, ViewOverlayType type) : base(IntPtr.Zero, true) + { + var clonedCoordinatesHandle = CoordinatesHandle.CloneFrom(coordinates); + CreateOverlay(clonedCoordinatesHandle, viewObject, type, out handle).ThrowIfFailed("Failed to create native overlay handle"); + clonedCoordinatesHandle.HasOwnership = false; + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Polygon.cs b/src/Tizen.Maps/Interop/Interop.View.Polygon.cs new file mode 100755 index 0000000..5699b0e --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Polygon.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_polygon")] + internal static extern ErrorCode SetPolygon(this PolygonHandle /* maps_view_object_h */ polygon, CoordinatesListHandle /* maps_coordinates_list_h */ points); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_get_fill_color")] + internal static extern ErrorCode GetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, out byte r, out byte g, out byte b, out byte a); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_set_fill_color")] + internal static extern ErrorCode SetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, byte r, byte g, byte b, byte a); + + internal static ErrorCode GetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, out Color color) + { + byte r, g, b, a; + var err = polygon.GetFillColor(out r, out g, out b, out a); + color = new Color(r, g, b, a); + return err; + } + + internal static ErrorCode SetFillColor(this PolygonHandle /* maps_view_object_h */ polygon, Color color) + { + return polygon.SetFillColor((byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A); + } + + internal class PolygonHandle : ViewObjectHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polygon_foreach_point")] + internal static extern ErrorCode ForeachPoint(IntPtr /* maps_view_object_h */ polygon, CoordinatesCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_polygon")] + internal static extern ErrorCode CreatePolygon(CoordinatesListHandle /* maps_coordinates_list_h */ coordinates, byte r, byte g, byte b, byte a, out IntPtr /* maps_view_object_h */ polygon); + + internal Color FillColor + { + get { return NativeGet(this.GetFillColor); } + set { NativeSet(this.SetFillColor, value); } + } + + internal PolygonHandle(CoordinatesListHandle coordinates, Color color) : base(IntPtr.Zero, true) + { + CreatePolygon(coordinates, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, out handle).ThrowIfFailed("Failed to create native polygon handle"); + coordinates.HasOwnership = false; + } + + internal void ForeachPoint(Action action) + { + CoordinatesCallback callback = (index, handle, userData) => + { + action(CoordinatesHandle.CloneFrom(handle)); + return true; + }; + + ForeachPoint(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Polyline.cs b/src/Tizen.Maps/Interop/Interop.View.Polyline.cs new file mode 100755 index 0000000..0ceae65 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Polyline.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_polyline")] + internal static extern ErrorCode SetPolyline(this PolylineHandle /* maps_view_object_h */ polyline, CoordinatesListHandle /* maps_coordinates_list_h */ points); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_color")] + internal static extern ErrorCode SetColor(this PolylineHandle /* maps_view_object_h */ polyline, byte r, byte g, byte b, byte a); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_get_color")] + internal static extern ErrorCode GetColor(this PolylineHandle /* maps_view_object_h */ polyline, out byte r, out byte g, out byte b, out byte a); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_set_width")] + internal static extern ErrorCode SetWidth(this PolylineHandle /* maps_view_object_h */ polyline, int width); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_get_width")] + internal static extern ErrorCode GetWidth(this PolylineHandle /* maps_view_object_h */ polyline, out int width); + + internal static ErrorCode GetColor(this PolylineHandle /* maps_view_object_h */ polyline, out Color color) + { + byte r, g, b, a; + var err = polyline.GetColor(out r, out g, out b, out a); + color = new Color(r, g, b, a); + return err; + } + + internal static ErrorCode SetColor(this PolylineHandle /* maps_view_object_h */ polyline, Color color) + { + return polyline.SetColor((byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A); + } + + internal class PolylineHandle : ViewObjectHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CoordinatesCallback(int index, IntPtr /* maps_coordinates_h */ coordinates, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_create_polyline")] + internal static extern ErrorCode CreatePolyline(CoordinatesListHandle /* maps_coordinates_list_h */ coordinates, byte r, byte g, byte b, byte a, int width, out IntPtr /* maps_view_object_h */ polyline); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_object_polyline_foreach_point")] + internal static extern ErrorCode ForeachPoint(IntPtr /* maps_view_object_h */ polyline, CoordinatesCallback callback, IntPtr /* void */ userData); + + internal Color LineColor + { + get { return NativeGet(this.GetColor); } + set { NativeSet(this.SetColor, value); } + } + + internal int LineWidth + { + get { return NativeGet(this.GetWidth); } + set { NativeSet(this.SetWidth, value); } + } + + internal PolylineHandle(CoordinatesListHandle coordinates, Color color, int width) : base(IntPtr.Zero, true) + { + CreatePolyline(coordinates, (byte)color.R, (byte)color.G, (byte)color.B, (byte)color.A, width, out handle).ThrowIfFailed("Failed to create native polyline handle"); + coordinates.HasOwnership = false; + } + + internal void ForeachPoint(Action action) + { + CoordinatesCallback callback = (index, handle, userData) => + { + action(CoordinatesHandle.CloneFrom(handle)); + return true; + }; + + ForeachPoint(handle, callback, IntPtr.Zero).WarnIfFailed("Failed to get coordinates list from native handle"); + } + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.Snapshot.cs b/src/Tizen.Maps/Interop/Interop.View.Snapshot.cs new file mode 100755 index 0000000..d6403c6 --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.Snapshot.cs @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum ViewSnapshotFormatType + { + ViewSnapshotBmp, // MAPS_VIEW_SNAPSHOT_BMP + ViewSnapshotJpeg, // MAPS_VIEW_SNAPSHOT_JPEG + } + + internal static partial class ViewSnapshot + { + [DllImport(Libraries.MapService, EntryPoint = "maps_view_capture_snapshot")] + internal static extern ErrorCode ViewCaptureSnapshot(ViewHandle /* maps_view_h */ view, ViewSnapshotFormatType /* maps_view_snapshot_format_type_e */ type, int quality, string path); + } +} diff --git a/src/Tizen.Maps/Interop/Interop.View.cs b/src/Tizen.Maps/Interop/Interop.View.cs new file mode 100755 index 0000000..c48224a --- /dev/null +++ b/src/Tizen.Maps/Interop/Interop.View.cs @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using ElmSharp; + +internal static partial class Interop +{ + internal enum ViewType + { + Normal, // MAPS_VIEW_TYPE_NORMAL + Satellite, // MAPS_VIEW_TYPE_SATELLITE + Terrain, // MAPS_VIEW_TYPE_TERRAIN + Hybrid, // MAPS_VIEW_TYPE_HYBRID + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ViewOnEventCallback(ViewEventType /* maps_view_event_type_e */ type, IntPtr /* maps_view_event_data_h */ eventData, IntPtr /* void */ userData); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_zoom_level")] + internal static extern ErrorCode GetZoomLevel(this ViewHandle /* maps_view_h */ view, out int level); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_zoom_level")] + internal static extern ErrorCode SetZoomLevel(this ViewHandle /* maps_view_h */ view, int level); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_min_zoom_level")] + internal static extern ErrorCode GetMinZoomLevel(this ViewHandle /* maps_view_h */ view, out int minZoomLevel); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_min_zoom_level")] + internal static extern ErrorCode SetMinZoomLevel(this ViewHandle /* maps_view_h */ view, int minZoomLevel); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_max_zoom_level")] + internal static extern ErrorCode GetMaxZoomLevel(this ViewHandle /* maps_view_h */ view, out int maxZoomLevel); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_max_zoom_level")] + internal static extern ErrorCode SetMaxZoomLevel(this ViewHandle /* maps_view_h */ view, int maxZoomLevel); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_orientation")] + internal static extern ErrorCode GetOrientation(this ViewHandle /* maps_view_h */ view, out double rotationAngle); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_orientation")] + internal static extern ErrorCode SetOrientation(this ViewHandle /* maps_view_h */ view, double rotationAngle); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_language")] + internal static extern ErrorCode GetLanguage(this ViewHandle /* maps_view_h */ view, out string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_language")] + internal static extern ErrorCode SetLanguage(this ViewHandle /* maps_view_h */ view, string language); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_type")] + internal static extern ErrorCode SetMapType(this ViewHandle /* maps_view_h */ view, ViewType /* maps_view_type_e */ type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_type")] + internal static extern ErrorCode GetMapType(this ViewHandle /* maps_view_h */ view, out ViewType /* maps_view_type_e */ type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_buildings_enabled")] + internal static extern ErrorCode GetBuildingsEnabled(this ViewHandle /* maps_view_h */ view, out bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_buildings_enabled")] + internal static extern ErrorCode SetBuildingsEnabled(this ViewHandle /* maps_view_h */ view, bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_traffic_enabled")] + internal static extern ErrorCode GetTrafficEnabled(this ViewHandle /* maps_view_h */ view, out bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_traffic_enabled")] + internal static extern ErrorCode SetTrafficEnabled(this ViewHandle /* maps_view_h */ view, bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_public_transit_enabled")] + internal static extern ErrorCode GetPublicTransitEnabled(this ViewHandle /* maps_view_h */ view, out bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_public_transit_enabled")] + internal static extern ErrorCode SetPublicTransitEnabled(this ViewHandle /* maps_view_h */ view, bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_scalebar_enabled")] + internal static extern ErrorCode GetScaleBarEnabled(this ViewHandle /* maps_view_h */ view, out bool enabled); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_scalebar_enabled")] + internal static extern ErrorCode SetScaleBarEnabled(this ViewHandle /* maps_view_h */ view, bool enable); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_screen_location")] + internal static extern ErrorCode GetScreenLocation(this ViewHandle /* maps_view_h */ view, out int x, out int y, out int width, out int height); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_screen_location")] + internal static extern ErrorCode SetScreenLocation(this ViewHandle /* maps_view_h */ view, int x, int y, int width, int height); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_visibility")] + internal static extern ErrorCode GetVisibility(this ViewHandle /* maps_view_h */ view, out bool visible); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_visibility")] + internal static extern ErrorCode SetVisibility(this ViewHandle /* maps_view_h */ view, bool visible); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_viewport")] + internal static extern ErrorCode GetViewport(this ViewHandle /* maps_view_h */ view, out IntPtr viewport); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_center")] + internal static extern ErrorCode GetCenter(this ViewHandle /* maps_view_h */ view, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_center")] + internal static extern ErrorCode SetCenter(this ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates); + + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_get_gesture_enabled")] + internal static extern ErrorCode GetGestureEnabled(this ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, out bool enabled); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_gesture_enabled")] + internal static extern ErrorCode SetGestureEnabled(this ViewHandle /* maps_view_h */ view, ViewGesture /* maps_view_gesture_e */ gesture, bool enabled); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_set_event_cb")] + internal static extern ErrorCode SetEventCb(this ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type, ViewOnEventCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_unset_event_cb")] + internal static extern ErrorCode UnsetEventCb(this ViewHandle /* maps_view_h */ view, ViewEventType /* maps_view_event_type_e */ type); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_screen_to_geolocation")] + internal static extern ErrorCode ScreenToGeolocation(this ViewHandle /* maps_view_h */ view, int x, int y, out IntPtr /* maps_coordinates_h */ coordinates); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_geolocation_to_screen")] + internal static extern ErrorCode GeolocationToScreen(this ViewHandle /* maps_view_h */ view, CoordinatesHandle /* maps_coordinates_h */ coordinates, out int x, out int y); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_move")] + internal static extern ErrorCode Move(this ViewHandle /* maps_view_h */ view, int x, int y); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_resize")] + internal static extern ErrorCode Resize(this ViewHandle /* maps_view_h */ view, int width, int height); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_add_object")] + internal static extern ErrorCode AddObject(this ViewHandle /* maps_view_h */ view, ViewObjectHandle /* maps_view_object_h */ viewObject); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_remove_object")] + internal static extern ErrorCode RemoveObject(this ViewHandle /* maps_view_h */ view, ViewObjectHandle /* maps_view_object_h */ viewObject); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_remove_all_objects")] + internal static extern ErrorCode RemoveAllObjects(this ViewHandle /* maps_view_h */ view); + + internal class ViewHandle : SafeMapsHandle + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ViewObjectCallback(int index, int total, IntPtr /* maps_view_object_h */ viewObject, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_foreach_object")] + internal static extern ErrorCode ForeachObject(ViewHandle /* maps_view_h */ view, ViewObjectCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_create")] + internal static extern ErrorCode Create(ServiceHandle /* maps_service_h */ maps, IntPtr obj, out IntPtr /* maps_view_h */ view); + + [DllImport(Libraries.MapService, EntryPoint = "maps_view_destroy")] + internal static extern ErrorCode Destroy(IntPtr /* maps_view_h */ view); + + internal int ZoomLevel + { + get { return NativeGet(this.GetZoomLevel); } + set { NativeSet(this.SetZoomLevel, value); } + } + + internal int MinimumZoomLevel + { + get { return NativeGet(this.GetMinZoomLevel); } + set { NativeSet(this.SetMinZoomLevel, value); } + } + + internal int MaximumZoomLevel + { + get { return NativeGet(this.GetMaxZoomLevel); } + set { NativeSet(this.SetMaxZoomLevel, value); } + } + + internal double Orientation + { + get { return NativeGet(this.GetOrientation); } + set { NativeSet(this.SetOrientation, value); } + } + + internal ViewType MapType + { + get { return NativeGet(this.GetMapType); } + set { NativeSet(this.SetMapType, value); } + } + + internal bool BuildingsEnabled + { + get { return NativeGet(this.GetBuildingsEnabled); } + set { NativeSet(this.SetBuildingsEnabled, value); } + } + + internal bool TrafficEnabled + { + get { return NativeGet(this.GetTrafficEnabled); } + set { NativeSet(this.SetTrafficEnabled, value); } + } + + internal bool PublicTransitEnabled + { + get { return NativeGet(this.GetPublicTransitEnabled); } + set { NativeSet(this.SetPublicTransitEnabled, value); } + } + internal bool ScaleBarEnabled + { + get { return NativeGet(this.GetScaleBarEnabled); } + set { NativeSet(this.SetScaleBarEnabled, value); } + } + + internal string Language + { + get { return NativeGet(this.GetLanguage); } + set { NativeSet(this.SetLanguage, value); } + } + + internal bool IsVisible + { + get { return NativeGet(this.GetVisibility); } + set { NativeSet(this.SetVisibility, value); } + } + + internal CoordinatesHandle Center + { + get { return NativeGet(this.GetCenter, CoordinatesHandle.Create); } + set { NativeSet(this.SetCenter, value); } + } + + public ViewHandle(IntPtr handle, bool needToRelease) : base(handle, needToRelease, Destroy) + { + } + + public ViewHandle(ServiceHandle maps, IntPtr evasObject) : this(IntPtr.Zero, true) + { + Create(maps, evasObject, out handle).ThrowIfFailed("Failed to create native handle"); + } + + internal CoordinatesHandle ScreenToGeolocation(Point position) + { + IntPtr coordinates; + this.ScreenToGeolocation(position.X, position.Y, out coordinates).WarnIfFailed("Failed to convert screen position to geocoordinates"); + return CoordinatesHandle.Create(coordinates); + } + + internal Point GeolocationToScreen(CoordinatesHandle coordinates) + { + int x, y; + this.GeolocationToScreen(coordinates, out x, out y).WarnIfFailed("Failed to convert geocoordinates to screen position"); + return new Point() { X = x, Y = y }; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps.csproj b/src/Tizen.Maps/Tizen.Maps.csproj new file mode 100644 index 0000000..a9b894d --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps.csproj @@ -0,0 +1,34 @@ + + + + + netstandard1.6 + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + + + diff --git a/src/Tizen.Maps/Tizen.Maps.sln b/src/Tizen.Maps/Tizen.Maps.sln new file mode 100755 index 0000000..a65ea71 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Maps", "Tizen.Maps.csproj", "{52206925-326A-4D67-8010-8C9CB5CDAB0F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{ED77D1C5-2ABB-4FBE-A042-DFBACB334A9C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{18913535-3C08-4EB5-AC27-25D2EDFC2A1A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{2A8BBBC1-AEDF-4099-A60E-D9E6C644F4A9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52206925-326A-4D67-8010-8C9CB5CDAB0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52206925-326A-4D67-8010-8C9CB5CDAB0F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52206925-326A-4D67-8010-8C9CB5CDAB0F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52206925-326A-4D67-8010-8C9CB5CDAB0F}.Release|Any CPU.Build.0 = Release|Any CPU + {ED77D1C5-2ABB-4FBE-A042-DFBACB334A9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED77D1C5-2ABB-4FBE-A042-DFBACB334A9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED77D1C5-2ABB-4FBE-A042-DFBACB334A9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED77D1C5-2ABB-4FBE-A042-DFBACB334A9C}.Release|Any CPU.Build.0 = Release|Any CPU + {18913535-3C08-4EB5-AC27-25D2EDFC2A1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {18913535-3C08-4EB5-AC27-25D2EDFC2A1A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {18913535-3C08-4EB5-AC27-25D2EDFC2A1A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {18913535-3C08-4EB5-AC27-25D2EDFC2A1A}.Release|Any CPU.Build.0 = Release|Any CPU + {2A8BBBC1-AEDF-4099-A60E-D9E6C644F4A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A8BBBC1-AEDF-4099-A60E-D9E6C644F4A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A8BBBC1-AEDF-4099-A60E-D9E6C644F4A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A8BBBC1-AEDF-4099-A60E-D9E6C644F4A9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Maps/Tizen.Maps/Area.cs b/src/Tizen.Maps/Tizen.Maps/Area.cs new file mode 100755 index 0000000..9e19368 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Area.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Class representing geographical area + /// + /// 3 + public class Area : IDisposable + { + internal Interop.AreaHandle handle; + + /// + /// Constructs rectangular area. + /// + /// 3 + /// Top-left coordinates of the area + /// Bottom-left coordinate of the area + /// Thrown when the required feature is not supported. + /// Thrown when input coordinates are invalid + /// Thrown when native operation failed to allocate memory. + public Area(Geocoordinates topLeft, Geocoordinates bottomRight) + { + handle = new Interop.AreaHandle(topLeft?.handle, bottomRight?.handle); + } + + /// + /// Constructs circular area. + /// + /// 3 + /// Coordinates for center of the area + /// Radius of the area + /// Thrown when the required feature is not supported. + /// Thrown when input coordinates are invalid + /// Thrown when native operation failed to allocate memory. + public Area(Geocoordinates center, double radius) + { + handle = new Interop.AreaHandle(center?.handle, radius); + } + + internal Area(Interop.AreaHandle nativeHandle) + { + handle = nativeHandle; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Direction.cs b/src/Tizen.Maps/Tizen.Maps/Direction.cs new file mode 100755 index 0000000..61c924f --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Direction.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Direction types for route maneuver + /// + /// 3 + public enum DirectionType + { + /// + /// Indicates unknown direction. + /// + None = Interop.RouteDirection.None, + /// + /// Indicates north direction. + /// + North = Interop.RouteDirection.North, + /// + /// Indicates north-west direction. + /// + NorthWest = Interop.RouteDirection.NorthWest, + /// + /// Indicates north-east direction. + /// + NorthEast = Interop.RouteDirection.NorthEast, + /// + /// Indicates south direction. + /// + South = Interop.RouteDirection.South, + /// + /// Indicates south-East direction. + /// + SouthEast = Interop.RouteDirection.SouthEast, + /// + /// Indicates south-West direction. + /// + SouthWest = Interop.RouteDirection.SouthWest, + /// + /// Indicates west direction. + /// + West = Interop.RouteDirection.West, + /// + /// Indicates east direction. + /// + East = Interop.RouteDirection.East, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/DistanceUnit.cs b/src/Tizen.Maps/Tizen.Maps/DistanceUnit.cs new file mode 100755 index 0000000..addc926 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/DistanceUnit.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Allowed distance units + /// + /// 3 + public enum DistanceUnit + { + /// + /// Indicates meter unit. + /// + Meter = Interop.DistanceUnit.Meter, + /// + /// Indicates kilometer unit. + /// + Kilometer = Interop.DistanceUnit.Kilometer, + /// + /// Indicates foot unit. + /// + Foot = Interop.DistanceUnit.Foot, + /// + /// Indicates yard unit. + /// + Yard = Interop.DistanceUnit.Yard, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs b/src/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs new file mode 100755 index 0000000..f39452c --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/GeocodeRequest.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Geocode request for map service + /// + /// 3 + public class GeocodeRequest : MapServiceRequest + { + private Interop.GeocodeCallback _geocodeCallback; + private List _coordinateList = new List(); + + internal GeocodeRequest(MapService service, string address) : this(service, ServiceRequestType.Geocode) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get coordinates for given address {address}"; + errorCode = _service.handle.Geocode(address, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + internal GeocodeRequest(MapService service, string address, Area boundry) : this(service, ServiceRequestType.GeocodeInsideArea) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get coordinates for given address {address}"; + errorCode = _service.handle.GeocodeInsideArea(address, boundry.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + internal GeocodeRequest(MapService service, PlaceAddress address) : this(service, ServiceRequestType.GeocodeByStructuredAddress) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get coordinates for given address {address}"; + errorCode = _service.handle.GeocodeByStructuredAddress(address.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + private GeocodeRequest(MapService service, ServiceRequestType type) : base(service, type) + { + // The Maps Service invokes this callback while iterating through the list of obtained coordinates of the specified place. + _geocodeCallback = (result, id, index, total, coordinates, userData) => + { + errorCode = result; + if (result.IsSuccess()) + { + // The parameter coordinates must be released using maps_coordinates_destroy() + var coordinatesHandle = new Interop.CoordinatesHandle(coordinates, needToRelease: true); + _coordinateList.Add(new Geocoordinates(coordinatesHandle)); + if (_coordinateList.Count == total) + { + _requestTask?.TrySetResult(_coordinateList); + } + return true; + } + else + { + // If search is failed, the value of total is 0 and coordinates is NULL + _requestTask?.TrySetException(result.GetException(errMessage)); + return false; + } + }; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Geocoordinates.cs b/src/Tizen.Maps/Tizen.Maps/Geocoordinates.cs new file mode 100755 index 0000000..fb891ac --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Geocoordinates.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Class representing geographical coordinates. + /// + /// 3 + public class Geocoordinates : IDisposable + { + internal Interop.CoordinatesHandle handle; + + /// + /// Constructs map coordinates object. + /// + /// 3 + /// Latitude value, must be between (-90.0 ~ 90.0) degrees + /// Longitude value, must be between (-180.0 ~ 180.0) degrees + /// Thrown when values for latitude and longitude are not valid. + /// Thrown when native operation failed to allocate memory. + public Geocoordinates(double latitude, double longitude) + { + handle = new Interop.CoordinatesHandle(latitude, longitude); + } + + internal Geocoordinates(Interop.CoordinatesHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets latitude of the coordinates. + /// + /// 3 + public double Latitude + { + get + { + return handle.Latitude; + } + } + + /// + /// Gets longitude of the coordinates. + /// + /// 3 + public double Longitude + { + get + { + return handle.Longitude; + } + } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"[{Latitude}, {Longitude}]"; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs b/src/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs new file mode 100755 index 0000000..50ae012 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/GeocoordinatesList.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// List of objects to be used in APIs + /// + internal class GeocoordinatesList : IDisposable + { + internal Interop.CoordinatesListHandle handle; + + internal GeocoordinatesList(IEnumerable coordinateList, bool ownerShip = false) + { + handle = new Interop.CoordinatesListHandle(ownerShip); + foreach (var coordinates in coordinateList) + { + handle.Add(coordinates.handle); + } + } + + /// + /// Iterator for coordinates in this list + /// + internal IEnumerable Coordinates + { + get + { + List list = new List(); + handle.ForEach(coordinateHandle => list.Add(new Geocoordinates(coordinateHandle))); + return list; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/GestureType.cs b/src/Tizen.Maps/Tizen.Maps/GestureType.cs new file mode 100755 index 0000000..f5ab43d --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/GestureType.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Enumeration of user gestures over map view + /// + /// 3 + public enum GestureType + { + /// + /// Indicates empty gesture. + /// + None = Interop.ViewGesture.None, + /// + /// Indicates the move map user gesture. + /// + Scroll = Interop.ViewGesture.Scroll, + /// + /// Indicates the zoom user gesture. + /// + Zoom = Interop.ViewGesture.Zoom, + /// + /// Indicates the click user gesture + /// + Click = Interop.ViewGesture.Click, + /// + /// Indicates the double click user gesture + /// + DoubleClick = Interop.ViewGesture.DoubleClick, + /// + /// Indicates the two-finger click user gesture + /// + TwoFingerClick = Interop.ViewGesture.TwoFingerClick, + /// + /// Indicates the rotation user gesture. + /// + Rotation = Interop.ViewGesture.Rotation, + /// + /// Indicates the long press user gesture. + /// + LongPress = Interop.ViewGesture.LongPress, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs b/src/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs new file mode 100755 index 0000000..fb0d8a5 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/IGeocodePreference.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Maps +{ + /// + /// Preferences for geocode searches + /// + /// 3 + public interface IGeocodePreference + { + /// + /// Gets or sets a string that presents preferred language. + /// + /// 3 + /// Language should be specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code.
e.g. "ko-KR", "en-US".
+ string Language { get; set; } + + /// + /// Gets or sets the maximum number of results. + /// + /// 3 + /// Setting negative value will not have any effect on MaxResults value. + int MaxResults { get; set; } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs b/src/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs new file mode 100755 index 0000000..e32b44d --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/IPlaceSearchPreference.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Preferences for place searches + /// + /// 3 + public interface IPlaceSearchPreference + { + /// + /// Gets or sets distance unit. + /// + /// 3 + DistanceUnit Unit { get; set; } + + /// + /// Gets or sets preferred language. + /// + /// 3 + /// Language should be specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code.
e.g. "ko-KR", "en-US".
+ string Language { get; set; } + + /// + /// Gets or sets the maximum number of results. + /// + /// 3 + int MaxResults { get; set; } + + /// + /// Gets or sets a string that represents code of preferred country. + /// + /// 3 + string CountryCode { get; set; } + + /// + /// Gets or sets search properties as key value pair. + /// + /// 3 + IReadOnlyDictionary Properties { get; set; } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs b/src/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs new file mode 100755 index 0000000..e7eedbc --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/IRouteSearchPreference.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Maps +{ + /// + /// Preferences for route searches + /// + /// 3 + public interface IRouteSearchPreference + { + /// + /// Gets or sets distance unit. + /// + /// 3 + DistanceUnit Unit { get; set; } + + /// + /// Gets or sets route optimization. + /// + /// 3 + RouteOptimization Optimization { get; set; } + + /// + /// Gets or sets route transport mode. + /// + /// 3 + TransportMode Mode { get; set; } + + /// + /// Gets or sets route feature weight. + /// + /// 3 + RouteFeatureWeight RouteFeatureWeight { get; set; } + + /// + /// Gets or sets route feature. + /// + /// 3 + RouteFeature RouteFeature { get; set; } + + /// + /// Gets or sets if searching for alternative routes is enabled. + /// + /// 3 + bool SearchAlternativeRoutes { get; set; } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Log.cs b/src/Tizen.Maps/Tizen.Maps/Log.cs new file mode 100755 index 0000000..8340d2e --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Log.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; + +namespace Tizen.Maps +{ + internal static class Log + { + private static String tag = "Tizen.Maps"; + + public static void Debug(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Debug(tag, message, file, func, line); + } + + public static void Error(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Error(tag, message, file, func, line); + } + + public static void Fatal(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Fatal(tag, message, file, func, line); + } + + public static void Info(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Info(tag, message, file, func, line); + } + + public static void Verbose(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Verbose(tag, message, file, func, line); + } + + public static void Warn(string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Tizen.Log.Warn(tag, message, file, func, line); + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs b/src/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs new file mode 100755 index 0000000..111ce73 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapGestureEventArgs.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp; + +namespace Tizen.Maps +{ + /// + /// Event arguments for gesture type map events + /// + /// 3 + public class MapGestureEventArgs : EventArgs + { + internal MapGestureEventArgs(IntPtr nativeHandle) + { + using (var handle = new Interop.GestureEventDataHandle(nativeHandle)) + { + GestureType = (GestureType)handle.GestureType; + Position = handle.Position; + TouchCount = handle.FingerCount; + ZoomFactor = handle.ZoomFactor; + RotationAngle = handle.RotationAngle; + Geocoordinates = new Geocoordinates(handle.Coordinates); + } + } + + /// + /// Gets type of gesture event. + /// + /// 3 + public GestureType GestureType { get; } + + /// + /// Gets screen coordinates in the event. + /// + /// 3 + public Point Position { get; } + + /// + /// Gets the number of fingers detected in the event. + /// + /// 3 + public int TouchCount { get; } + + /// + /// Gets zoom factor for zoom gesture event. + /// + /// 3 + public double ZoomFactor { get; } + + /// + /// Gets angle of rotation for rotate gesture event. + /// + /// 3 + public double RotationAngle { get; } + + /// + /// Gets geographical coordinates for the event. + /// + /// 3 + public Geocoordinates Geocoordinates { get; } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapObject.cs b/src/Tizen.Maps/Tizen.Maps/MapObject.cs new file mode 100755 index 0000000..936552a --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapObject.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Maps +{ + /// + /// Map object + /// + /// 3 + public abstract class MapObject + { + internal MapObject() { } + + /// + /// Gets or sets visibility of the map object. + /// + /// 3 + public abstract bool IsVisible { get; set; } + + internal abstract void HandleClickedEvent(); + + internal abstract void InvalidateMapObject(); + + internal abstract Interop.ViewObjectHandle GetHandle(); + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapService.cs b/src/Tizen.Maps/Tizen.Maps/MapService.cs new file mode 100755 index 0000000..4002c3b --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapService.cs @@ -0,0 +1,385 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Maps +{ + /// + /// Map service class for service request + /// + /// 3 + public partial class MapService : IDisposable + { + internal Interop.ServiceHandle handle; + + private PlaceFilter _filter; + private SearchPreference _searchPreference; + + private static List s_providers; + private string _serviceProvider; + + + /// + /// Creates a new Maps Service object for given service provider. + /// + /// 3 + /// A string which representing name of map service provider + /// A string which representing certificate key to use the map service provider + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when parameters are invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + /// Thrown when application does not have some privilege to access this method. + public MapService(string serviceProvider, string serviceProviderKey) + { + _serviceProvider = serviceProvider; + handle = new Interop.ServiceHandle(serviceProvider); + ProviderKey = serviceProviderKey; + PlaceSearchFilter = new PlaceFilter(); + Preferences = new SearchPreference(); + } + + /// + /// Gets list of available map service providers. + /// + /// 3 + /// The list of map service providers. + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have privileges to access this property. + public static IEnumerable Providers + { + get + { + if (s_providers != null) return s_providers; + + s_providers = new List(); + Interop.ServiceHandle.ForeachProvider(provider => s_providers.Add(provider)); + return s_providers; + } + } + + /// + /// Gets name of map service provider. + /// + /// 3 + public string Provider { get { return _serviceProvider; } } + + /// + /// Gets a user consent for map service provider + /// + /// 3 + /// http://tizen.org/privilege/mapservice + public bool UserConsented + { + get + { + return handle.UserConsented; + } + } + + /// + /// Gets and sets a string representing keys for map service provider + /// + /// 3 + /// Typically, the provider key is issued by each maps provider, after signing up for a plan in the web site. + /// Depending on the plan and its provider which you have signed, you might pay for the network traffic. + public string ProviderKey + { + get + { + return handle.ProviderKey; + } + set + { + handle.ProviderKey = value; + } + } + + /// + /// Gets and sets a filter used for place search result. + /// + /// 3 + public PlaceFilter PlaceSearchFilter + { + get + { + return _filter; + } + set + { + if (value != null) + { + _filter = value; + } + } + } + + /// + /// Gets search preferences used for or . + /// + /// 3 + public IGeocodePreference GeocodePreferences + { + get + { + return Preferences as IGeocodePreference; + } + } + + /// + /// Gets search preferences used for . + /// + /// 3 + public IPlaceSearchPreference PlaceSearchPreferences + { + get + { + return Preferences as IPlaceSearchPreference; + } + } + + /// + /// Gets search preferences used for . + /// + /// 3 + public IRouteSearchPreference RouteSearchPreferences + { + get + { + return Preferences as IRouteSearchPreference; + } + } + + /// + /// Gets and sets search preferences. + /// + /// 3 + public SearchPreference Preferences + { + get + { + if (_searchPreference == null) + { + _searchPreference = new SearchPreference(handle.Preferences); + } + return _searchPreference; + } + set + { + if (value != null) + { + handle.Preferences = value.handle; + _searchPreference = value; + } + } + } + + /// + /// Gets the user's consent to use maps data. + /// + /// 3 + /// Returns true if user agreed that the application can use maps data, otherwise false. + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public async Task RequestUserConsent() + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.RequestUserConsentwithHandleCallback cb = (consented, userData) => + { + tcs.TrySetResult(consented); + }; + + var err = handle.RequestUserConsent(cb, IntPtr.Zero); + if (err.IsFailed()) + { + tcs.TrySetException(err.GetException("Failed to get user consent")); + } + return await tcs.Task.ConfigureAwait(false); + } + + /// + /// Checks if the Maps Service supports given request. + /// + /// 3 + /// Request type to check + /// Returns true if the Maps Service supports a request, otherwise false. + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool IsSupported(ServiceRequestType type) + { + bool result; + var err = handle.IsServiceSupported((Interop.ServiceType)type, out result); + err.WarnIfFailed($"Failed to get if {type} is supported"); + return (err.IsSuccess()) ? result : false; + } + + /// + /// Checks if the Maps Service supports given data feature. + /// + /// 3 + /// Data feature to check + /// Returns true if the Maps Service supports a data feature, otherwise false. + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool IsSupported(ServiceData data) + { + bool result; + var err = handle.IsDataSupported((Interop.ServiceData)data, out result); + err.WarnIfFailed($"Failed to get if {data} data is supported"); + return (err.IsSuccess()) ? result : false; + } + + /// + /// Creates geocode search request for given free-formed address string. + /// + /// 3 + /// A string which representing free-formed address + /// GeocodeRequest object created with address string + public GeocodeRequest CreateGeocodeRequest(string address) + { + return new GeocodeRequest(this, address); + } + + /// + /// Creates geocode search request for given free-formed address string, within the specified boundary. + /// + /// 3 + /// A string which representing free-formed address + /// An instance of Area object which representing interested area + /// + /// GeocodeRequest object created with address string and specified boundary + public GeocodeRequest CreateGeocodeRequest(string address, Area boundary) + { + return new GeocodeRequest(this, address, boundary); + } + + /// + /// Creates geocode search request for given structured address. + /// + /// 3 + /// A string which representing address of interest + /// Returns GeocodeRequest object created with structured address + public GeocodeRequest CreateGeocodeRequest(PlaceAddress address) + { + return new GeocodeRequest(this, address); + } + + /// + /// Creates a reverse geocode search request for given latitude and longitude. + /// + /// 3 + /// Latitude of interested place + /// Longitude of interested place + /// Returns ReverseGeocodeRequest object created with location coordinates + public ReverseGeocodeRequest CreateReverseGeocodeRequest(double latitude, double longitude) + { + return new ReverseGeocodeRequest(this, latitude, longitude); + } + + /// + /// Creates a reverse geocode search request for given position coordinates list. + /// + /// 3 + /// Coordinates list with [2 ~ 100] coordinates + /// Returns MultiReverseGeocodeRequest object created with list of location coordinates + public MultiReverseGeocodeRequest CreateMultiReverseGeocodeRequest(IEnumerable coordinates) + { + return new MultiReverseGeocodeRequest(this, coordinates); + } + + /// + /// Creates a route search request for origin and destination points. + /// + /// 3 + /// Starting point + /// Destination + /// Returns RouteSearchRequest object created with origin and destination coordinates + public RouteSearchRequest CreateRouteSearchRequest(Geocoordinates from, Geocoordinates to) + { + return new RouteSearchRequest(this, from, to); + } + + /// + /// Creates a place search request for specified search radius around a given coordinates position. + /// + /// 3 + /// A geographical coordinates of center + /// A double value which representing radius of area to search places + /// Returns PlaceSearchRequest object created with location coordinates and search radius + public PlaceSearchRequest CreatePlaceSearchRequest(Geocoordinates coordinates, int distance) + { + return new PlaceSearchRequest(this, coordinates, distance); + } + + /// + /// Creates a place search request for places within specified boundary. + /// + /// 3 + /// An instance of Area object which representing area to search interested places + /// Returns PlaceSearchRequest object created with specified boundary + public PlaceSearchRequest CreatePlaceSearchRequest(Area boundary) + { + return new PlaceSearchRequest(this, boundary); + } + + /// + /// Creates a place search request for free-formed address within boundary. + /// + /// 3 + /// A string which representing free-formed address + /// An instance of Area object which representing area to search interested places + /// Returns PlaceSearchRequest object created with address string and specified boundary + public PlaceSearchRequest CreatePlaceSearchRequest(string address, Area boundary) + { + return new PlaceSearchRequest(this, address, boundary); + } + + #region IDisposable Support + private bool _disposedValue = false; + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _filter.Dispose(); + _searchPreference.Dispose(); + } + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs b/src/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs new file mode 100755 index 0000000..bc9e555 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapServiceRequest.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Maps +{ + /// + /// Base class for map service request + /// + /// 3 + /// + public abstract class MapServiceRequest : IDisposable + { + protected TaskCompletionSource> _requestTask; + protected string errMessage; + protected int? _requestID; + protected ServiceRequestType _type; + + internal Action startExecutionAction; + internal Interop.ErrorCode errorCode; + + internal MapService _service; + + /// + /// Creates a map service request. + /// + /// map service object + /// Request type + internal MapServiceRequest(MapService service, ServiceRequestType type) + { + _service = service; + _type = type; + } + + /// + /// Sends a request to map service provider. + /// + /// 3 + /// Response from map service provider + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the result is invalid. + /// Thrown when arguments are invalid + public async Task> GetResponseAsync() + { + IEnumerable task = null; + if (_requestTask == null || _requestTask.Task.IsCanceled) + { + _requestTask = new TaskCompletionSource>(); + startExecutionAction(); + task = await _requestTask.Task.ConfigureAwait(false); + } + errorCode.WarnIfFailed(errMessage); + return task; + } + + internal void Cancel() + { + if (_requestTask?.Task.IsCompleted == false) + { + _requestTask?.SetCanceled(); + if (_requestID != null) + { + var err = Interop.CancelRequest(_service.handle, (int)_requestID); + err.ThrowIfFailed($"Unable to cancel service request, Type: {_type}, ID: {_requestID}"); + } + + errorCode = Interop.ErrorCode.Canceled; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + Cancel(); + _service.Dispose(); + } + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapTypes.cs b/src/Tizen.Maps/Tizen.Maps/MapTypes.cs new file mode 100755 index 0000000..e10448f --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapTypes.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Map View Type (theme) + /// + /// 3 + public enum MapTypes + { + /// + /// Indicates normal street theme. + /// + Normal = Interop.ViewType.Normal, + /// + /// Indicates satellite theme. + /// + Satellite = Interop.ViewType.Satellite, + /// + /// Indicates terrain theme. + /// + Terrain = Interop.ViewType.Terrain, + /// + /// Indicates hybrid theme, has both satellite and normal theme. + /// + Hybrid = Interop.ViewType.Hybrid, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MapView.cs b/src/Tizen.Maps/Tizen.Maps/MapView.cs new file mode 100755 index 0000000..318874d --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MapView.cs @@ -0,0 +1,780 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp; +using Layout = ElmSharp.Layout; +using EvasObject = ElmSharp.EvasObject; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Map View class to show a map on the screen. + /// + /// 3 + public class MapView : Layout, IDisposable + { + internal Interop.ViewHandle handle; + private MapService _service; + + private Dictionary _handleToObjectTable = new Dictionary(); + + private Interop.ViewOnEventCallback _gestureEventCallback; + private Interop.ViewOnEventCallback _objectEventCallback; + private Interop.ViewOnEventCallback _viewReadyEventCallback; + + private event EventHandler _scrolledEventHandler; + private event EventHandler _twoFingerZoomedEventHandler; + private event EventHandler _clickedEventHandler; + private event EventHandler _doubleClickedEventHandler; + private event EventHandler _twoFingerClickedEventHandler; + private event EventHandler _twoFingerRotatedEventHandler; + private event EventHandler _longPressedEventHandler; + private event EventHandler _viewReadyEventHandler; + + /// + /// Creates the view and link it to the instance of map service. + /// + /// 3 + /// An instance of object which map view will be drawn + /// An instance of object + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when parameters are invalid + /// Thrown when native operation failed to allocate memory, connect to service + public MapView(EvasObject parent, MapService service) : base(parent) + { + handle = new Interop.ViewHandle(service.handle, this); + Log.Info(string.Format("MapView is created")); + + _service = service; + this.Resize(1, 1); + + // We need to keep Gesture Tap event enabled for object event to work + handle.SetGestureEnabled(Interop.ViewGesture.Click, true); + SetObjectEventCallback(); + } + + /// + /// Adds or removes event handlers to deliver scrolled gesture event. + /// + /// Event handlers to get scrolled gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler Scrolled + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.Scroll, true); + _scrolledEventHandler += value; + Log.Info(string.Format("Scrolled event handler is added")); + } + remove + { + _scrolledEventHandler -= value; + Log.Info(string.Format("Scrolled event handler is removed")); + if (_scrolledEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.Scroll, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver zoomed gesture event. + /// + /// Event handlers to get zoomed gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler TwoFingerZoomed + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.Zoom, true); + _twoFingerZoomedEventHandler += value; + Log.Info(string.Format("TwoFingerZoomed event handler is added")); + } + remove + { + _twoFingerZoomedEventHandler -= value; + Log.Info(string.Format("TwoFingerZoomed event handler is removed")); + if (_twoFingerZoomedEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.Zoom, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver clicked gesture event. + /// + /// Event handlers to get clicked gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler Clicked + { + add + { + SetGestureEventCallback(); + //handle.SetGestureEnabled(Interop.ViewGesture.Click, true); + _clickedEventHandler += value; + Log.Info(string.Format("Clicked event handler is added")); + } + remove + { + _clickedEventHandler -= value; + Log.Info(string.Format("Clicked event handler is removed")); + if (_clickedEventHandler == null) + { + //handle.SetGestureEnabled(Interop.ViewGesture.Click, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver double-clicked gesture event. + /// + /// Event handlers to get double-clicked gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler DoubleClicked + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.DoubleClick, true); + _doubleClickedEventHandler += value; + Log.Info(string.Format("DoubleClicked event handler is removed")); + } + remove + { + _doubleClickedEventHandler -= value; + Log.Info(string.Format("DoubleClicked event handler is removed")); + if (_doubleClickedEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.DoubleClick, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver clicked gesture event with two-fingers. + /// + /// Event handlers to get clicked gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler TwoFingerClicked + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerClick, true); + _twoFingerClickedEventHandler += value; + Log.Info(string.Format("TwoFingerClicked event handler is added")); + } + remove + { + _twoFingerClickedEventHandler -= value; + Log.Info(string.Format("TwoFingerClicked event handler is removed")); + if (_twoFingerClickedEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerClick, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver rotated gesture event. + /// + /// Event handlers to get rotated gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler TwoFingerRotated + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.Rotation, true); + _twoFingerRotatedEventHandler += value; + Log.Info(string.Format("Rotated event handler is added")); + } + remove + { + _twoFingerRotatedEventHandler -= value; + Log.Info(string.Format("Rotated event handler is removed")); + if (_twoFingerRotatedEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.Rotation, false); + UnsetGestureEventCallback(); + } + } + } + + + /// + /// Adds or removes event handlers to deliver long-pressed gesture event. + /// + /// Event handlers to get long-pressed gesture event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler LongPressed + { + add + { + SetGestureEventCallback(); + handle.SetGestureEnabled(Interop.ViewGesture.LongPress, true); + _longPressedEventHandler += value; + Log.Info(string.Format("LongPressed event handler is added")); + } + remove + { + _longPressedEventHandler -= value; + Log.Info(string.Format("LongPressed event handler is removed")); + if (_longPressedEventHandler == null) + { + handle.SetGestureEnabled(Interop.ViewGesture.LongPress, false); + UnsetGestureEventCallback(); + } + } + } + + /// + /// Adds or removes event handlers to deliver a event representing the view is ready to be used. + /// + /// Event handlers to get view ready event + /// 3 + /// Thrown when the required feature is not supported. + public event EventHandler ViewReady + { + add + { + SetViewReadyEventCallback(); + _viewReadyEventHandler += value; + Log.Info(string.Format("ViewReady event handler is added")); + } + remove + { + _viewReadyEventHandler -= value; + Log.Info(string.Format("ViewReady event handler is removed")); + UnsetGestureEventCallback(); + } + } + + /// + /// Gets or sets current zoom level. + /// + /// It is an integer value that representing current zoom level. + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public int ZoomLevel + { + get + { + return handle.ZoomLevel; + } + set + { + Log.Info(string.Format("ZoomLevel is changed from {0} to {1}", handle.ZoomLevel, value)); + handle.ZoomLevel = value; + } + } + + /// + /// Gets or sets minimum zoom level. + /// + /// It is an integer value that limits minimal zoom level within range of current map plug-in supported. + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public int MinimumZoomLevel + { + get + { + return handle.MinimumZoomLevel; + } + set + { + Log.Info(string.Format("MinimumZoomLevel is changed from {0} to {1}", handle.MinimumZoomLevel, value)); + handle.MinimumZoomLevel = value; + } + } + + /// + /// Gets or sets maximum zoom level. + /// + /// It is an integer value that limits maximum zoom level within range of current map plug-in supported. + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public int MaximumZoomLevel + { + get + { + return handle.MaximumZoomLevel; + } + set + { + Log.Info(string.Format("MaximumZoomLevel is changed from {0} to {1}", handle.MaximumZoomLevel, value)); + handle.MaximumZoomLevel = value; + } + } + + /// + /// Gets or sets orientation on the map view. + /// + /// It is an integer value from 0 to 360 that indicates orientation of the map view + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public double Orientation + { + get + { + return handle.Orientation; + } + set + { + Log.Info(string.Format("Orientation is changed from {0} to {1}", handle.Orientation, value)); + handle.Orientation = value; + } + } + + /// + /// Gets or sets theme type of the map view. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public MapTypes MapType + { + get + { + return (MapTypes)handle.MapType; + } + set + { + Log.Info(string.Format("MapType is changed from {0} to {1}", handle.MapType, value)); + handle.MapType = (Interop.ViewType)value; + } + } + + /// + /// Indicates whether the map should show the 3D buildings layer. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool BuildingsEnabled + { + get + { + return handle.BuildingsEnabled; + } + set + { + Log.Info(string.Format("Showing the 3D buildings is {0}", (value ? "enabled" : "disabled"))); + handle.BuildingsEnabled = value; + } + } + + /// + /// Indicates whether the map should show the traffic layer. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool TrafficEnabled + { + get + { + return handle.TrafficEnabled; + } + set + { + Log.Info(string.Format("Showing the traffic is {0}", (value ? "enabled" : "disabled"))); + handle.TrafficEnabled = value; + } + } + + /// + /// Indicates whether the map should show the public transit layer. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool PublicTransitEnabled + { + get + { + return handle.PublicTransitEnabled; + } + set + { + Log.Info(string.Format("Showing the public transit is {0}", (value ? "enabled" : "disabled"))); + handle.PublicTransitEnabled = value; + } + } + + /// + /// Indicates whether the scale-bar is enabled or not. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + public bool ScaleBarEnabled + { + get + { + return handle.ScaleBarEnabled; + } + set + { + Log.Info(string.Format("Showing the scale-bar is {0}", (value ? "enabled" : "disabled"))); + handle.ScaleBarEnabled = value; + } + } + + /// + /// Sets language of map view. + /// + /// The display language in the map. + /// A language is specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code. + /// Each language tag is composed of one or more "subtags" separated by hyphens (-). + /// Each subtag is composed of basic Latin letters or digits only. + /// For example, "ko-KR" for Korean, "en-US" for American English. + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + public string Language + { + get + { + return handle.Language; + } + set + { + Log.Info(string.Format("Language is changed from {0} to {1}", handle.Language, value)); + handle.Language = value; + } + } + + /// + /// Gets or sets geographical coordinates for map view's center. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// http://tizen.org/privilege/internet + /// http://tizen.org/privilege/network.get + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + public Geocoordinates Center + { + get + { + return new Geocoordinates(handle.Center); + } + set + { + Log.Info(string.Format("Center is changed from {0} to {1}", handle.Center.ToString(), value.ToString())); + handle.Center = value.handle; + } + } + + /// + /// Gets a list of map object added to map view. + /// + /// 3 + public IEnumerable Children + { + get + { + return _handleToObjectTable.Values; + } + } + + /// + /// Changes geographical coordinates to screen coordinates. + /// + /// 3 + /// Geographical coordinates + /// Returns an instance of screen coordinates on the current screen + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + public Point GeolocationToScreen(Geocoordinates coordinates) + { + return handle.GeolocationToScreen(coordinates.handle); + } + + /// + /// Changes screen coordinates to geographical coordinates. + /// + /// 3 + /// Screen coordinates + /// Returns an instance of geographical coordinates object. + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + public Geocoordinates ScreenToGeolocation(Point screenCoordinates) + { + return new Geocoordinates(handle.ScreenToGeolocation(screenCoordinates)); + } + + /// + /// Adds a map object to map view. + /// + /// 3 + /// An instance of map object to be added + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + public void Add(MapObject child) + { + Log.Info(string.Format("Add a object")); + var objectHandle = child.GetHandle(); + if (!_handleToObjectTable.ContainsKey(objectHandle)) + { + _handleToObjectTable[objectHandle] = child; + handle.AddObject(objectHandle); + + // MapView take ownership of added map objects + objectHandle.HasOwnership = false; + } + } + + /// + /// Removes a map object from map view. + /// + /// 3 + /// An instance of map object to be removed + /// Once removed, the child object will be become invalid + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + public void Remove(MapObject child) + { + Log.Info(string.Format("Remove a object")); + var objectHandle = child.GetHandle(); + if (_handleToObjectTable.Remove(objectHandle)) + { + handle.RemoveObject(child.GetHandle()); + + // The object handle will be released automatically by the View, once RemoveObject call is successful + child.InvalidateMapObject(); + } + } + + /// + /// Removes all map objects from map view. + /// + /// 3 + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when native operation failed to allocate memory, connect to service. + public void RemoveAll() + { + Log.Info(string.Format("Remove all of objects")); + foreach (var child in _handleToObjectTable.Values) + { + child.InvalidateMapObject(); + } + _handleToObjectTable.Clear(); + handle.RemoveAllObjects(); + } + + /// + /// Captures a snapshot of map view + /// + /// 3 + /// Type of file format + /// A integer value which representing quality for encoding, from 1 to 100 + /// A string which representing The file path for snapshot + /// http://tizen.org/privilege/mapservice + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when the value is invalid. + /// Thrown when native operation failed to allocate memory, connect to service. + public void CaptureSnapshot(SnapshotType type, int quality, string path) + { + var err = Interop.ViewSnapshot.ViewCaptureSnapshot(handle, (Interop.ViewSnapshotFormatType)type, quality, path); + err.ThrowIfFailed("Failed to create snapshot for the view"); + } + + private void SetGestureEventCallback() + { + if (_gestureEventCallback == null) + { + _gestureEventCallback = (type, eventData, userData) => + { + if (type != Interop.ViewEventType.Gesture) return; + var eventArg = new MapGestureEventArgs(eventData); + switch (eventArg.GestureType) + { + case GestureType.Scroll: _scrolledEventHandler?.Invoke(this, eventArg); break; + case GestureType.Zoom: _twoFingerZoomedEventHandler?.Invoke(this, eventArg); break; + case GestureType.Click: _clickedEventHandler?.Invoke(this, eventArg); break; + case GestureType.DoubleClick: _doubleClickedEventHandler?.Invoke(this, eventArg); break; + case GestureType.TwoFingerClick: _twoFingerClickedEventHandler?.Invoke(this, eventArg); break; + case GestureType.Rotation: _twoFingerRotatedEventHandler?.Invoke(this, eventArg); break; + case GestureType.LongPress: _longPressedEventHandler?.Invoke(this, eventArg); break; + } + }; + handle.SetEventCb(Interop.ViewEventType.Gesture, _gestureEventCallback, IntPtr.Zero); + Log.Info(string.Format("Gesture event callback is set")); + } + } + + private void UnsetGestureEventCallback() + { + if (_scrolledEventHandler != null || _twoFingerZoomedEventHandler != null + || _clickedEventHandler != null || _doubleClickedEventHandler != null + || _twoFingerClickedEventHandler != null || _twoFingerRotatedEventHandler != null + || _longPressedEventHandler != null) + { + return; + } + + handle.UnsetEventCb(Interop.ViewEventType.Gesture); + _gestureEventCallback = null; + Log.Info(string.Format("Gesture event callback is unset")); + } + + private void SetObjectEventCallback() + { + if (_objectEventCallback == null) + { + _objectEventCallback = (type, eventData, userData) => + { + if (type != Interop.ViewEventType.Object) return; + var eventArg = new Interop.ObjectEventDataHandle(eventData); + switch (eventArg.GestureType) + { + case Interop.ViewGesture.Click: + { + var mapObject = _handleToObjectTable[eventArg.ViewObject]; + mapObject?.HandleClickedEvent(); + break; + } + } + }; + handle.SetEventCb(Interop.ViewEventType.Object, _objectEventCallback, IntPtr.Zero); + Log.Info(string.Format("Object event callback is set")); + } + } + + private void SetViewReadyEventCallback() + { + if (_viewReadyEventCallback == null) + { + _viewReadyEventCallback = (type, eventData, userData) => + { + _viewReadyEventHandler?.Invoke(this, EventArgs.Empty); + }; + handle.SetEventCb(Interop.ViewEventType.Ready, _viewReadyEventCallback, IntPtr.Zero); + Log.Info(string.Format("ViewReady event callback is set")); + } + } + + private void UnsetViewReadyEventCallback() + { + if (_viewReadyEventHandler == null) + { + handle.UnsetEventCb(Interop.ViewEventType.Ready); + _viewReadyEventCallback = null; + Log.Info(string.Format("ViewReady event callback is unset")); + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _service.Dispose(); + } + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Marker.cs b/src/Tizen.Maps/Tizen.Maps/Marker.cs new file mode 100755 index 0000000..1655e65 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Marker.cs @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using ElmSharp; + +namespace Tizen.Maps +{ + /// + /// Marker map object + /// + /// 3 + public class Marker : MapObject, IDisposable + { + internal Interop.MarkerHandle handle; + + internal Marker(Geocoordinates coordinates, string imagePath, Interop.ViewMarkerType type) + { + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || imagePath == null) + { + err.ThrowIfFailed("given coordinates or imagePath is null"); + } + handle = new Interop.MarkerHandle(coordinates.handle, imagePath, type); + } + + /// + /// Gets or sets clicked event handlers. + /// + /// 3 + public event EventHandler Clicked; + + /// + /// Gets or sets marker's visibility. + /// + /// 3 + public override bool IsVisible + { + get + { + return handle.IsVisible; + } + set + { + handle.IsVisible = value; + } + } + + /// + /// Gets or sets geographical coordinates for this marker. + /// + /// 3 + public Geocoordinates Coordinates + { + get + { + return new Geocoordinates(handle.Coordinates); + } + set + { + handle.Coordinates = value.handle; + + // Marker takes ownership of the native handle. + value.handle.HasOwnership = false; + } + } + + /// + /// Gets or sets a string representing image file path for this marker. + /// + /// 3 + public string ImagePath + { + get + { + return handle.ImageFile; + } + set + { + handle.ImageFile = value; + } + } + + /// + /// Gets or sets screen size for this marker. + /// + /// 3 + public Size MarkerSize + { + get + { + return handle.MarkerSize; + } + set + { + handle.MarkerSize = value; + } + } + + /// + /// Gets or sets z-order for this marker. + /// + /// 3 + /// The integer value is 0 in default, and must be in range of from -100 to 100. + public int ZOrder + { + get + { + return handle.ZOrder; + } + set + { + handle.ZOrder = value; + } + } + + /// + /// Changes marker size. + /// + /// 3 + /// New size + public void Resize(Size newSize) + { + MarkerSize = newSize; + } + + /// + /// Changes marker coordinates. + /// + /// 3 + /// New position for marker + public void Move(Geocoordinates newPosition) + { + Coordinates = newPosition; + } + + internal override void HandleClickedEvent() + { + Clicked?.Invoke(this, EventArgs.Empty); + } + + internal override void InvalidateMapObject() + { + handle = null; + } + + internal override Interop.ViewObjectHandle GetHandle() + { + return handle; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + + #endregion + } + + /// + /// Pin type marker map object + /// + /// 3 + public class Pin : Marker + { + private const string defaultImagePath = "/usr/share/dotnet.tizen/framework/res/maps_marker_pin_48.png"; + + /// + /// Creates a Pin type marker. + /// + /// 3 + /// Marker coordinates + /// Thrown when input coordinates are invalid. + public Pin(Geocoordinates coordinates) + : base(coordinates, defaultImagePath, Interop.ViewMarkerType.Pin) + { + } + + /// + /// Creates a Pin type marker. + /// + /// 3 + /// Marker coordinates + /// Image file path for Marker + /// + /// http://tizen.org/privilege/mediastorage is needed if the file path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if the file path are relevant to external storage. + /// + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when input coordinates or imagePath are invalid. + public Pin(Geocoordinates coordinates, string imagePath) + : base(coordinates, imagePath, Interop.ViewMarkerType.Pin) + { + } + } + + /// + /// Sticker type marker map object + /// + /// 3 + public class Sticker : Marker + { + private const string defaultImagePath = "/usr/share/dotnet.tizen/framework/res/maps_marker_sticker_48.png"; + + /// + /// Creates a Sticker type marker. + /// + /// 3 + /// Marker coordinates + /// Thrown when input coordinates are invalid. + public Sticker(Geocoordinates coordinates) + : base(coordinates, defaultImagePath, Interop.ViewMarkerType.Sticker) + { + } + + /// + /// Creates a Sticker type marker. + /// + /// 3 + /// Marker coordinates + /// Image file path for Marker + /// + /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// + /// Thrown when the required feature is not supported. + /// Thrown when application does not have some privilege to access this method. + /// Thrown when input coordinates or imagePath are invalid. + public Sticker(Geocoordinates coordinates, string imagePath) + : base(coordinates, imagePath, Interop.ViewMarkerType.Sticker) + { + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs b/src/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs new file mode 100755 index 0000000..2794961 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/MultiReverseGeocodeRequest.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Multiple Reverse geocode Request for Tizen map service + /// + /// 3 + public class MultiReverseGeocodeRequest : MapServiceRequest + { + private Interop.MultiReverseGeocodeCallback _geocodeCallback; + private List _addressesList = new List(); + + internal MultiReverseGeocodeRequest(MapService service, IEnumerable coordinates) : base(service, ServiceRequestType.ReverseGeocode) + { + // The Maps Service invokes this callback once when gets the response from map service provider + // The value of total is same with requested coordinates list size. Even though one of address is not provided valid address handle is retrieved. + _geocodeCallback = (result, id, total, handle, userData) => + { + errorCode = result; + if (result.IsSuccess()) + { + var addressListHandle = new Interop.AddressListHandle(handle, needToRelease: true); + var addressList = new PlaceAddressList(addressListHandle); + _addressesList = addressList.Addresses as List; + _requestTask?.TrySetResult(_addressesList); + return true; + } + else + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + return false; + } + }; + + var coordinateList = new GeocoordinatesList(coordinates); + startExecutionAction = new Action(() => + { + int requestID; + errMessage = "Failed to get address list for given co-ordinate list"; + errorCode = _service.handle.MultiReverseGeocode(coordinateList.handle, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/NamespaceDoc.cs b/src/Tizen.Maps/Tizen.Maps/NamespaceDoc.cs new file mode 100755 index 0000000..2c9fe11 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/NamespaceDoc.cs @@ -0,0 +1,132 @@ +/** + +The Tizen.Maps namespace provides classes to get the information of Place, Geocoding, Route by querying, +or to show them on the map view with interactive gestural interface. + + + + + + +

Overview

+ +Maps API provides a developer with a set of functions, helping to create Maps aware applications.

+ +Maps API comprises of following features:
+- Geocoding and reverse Geocoding
+- Discoverying Place information
+- Calculating Route
+- View + + + + +Maps API allows a Developer to choose one of Map Providers which are being included as plugins.

+ + +

Geocoding

+The Maps Geocoding API allows translating an address to its geographical +location defined in terms of latitude and longitude; the input can be a +qualified and structured address or a free-formed search text with full or +partial address information.

+ +The example below shows a structured address:
+ - housenumber=117,
+ - street=Invaliden street
+ - city=Berlin,
+ - postalcode=10115,
+ - country=Germany,
+ - state=Berlin + + + + +

Reverse Geocoding

+The Maps Reverse Geocoding API allows to inverse translating a geographical +location (longitude, latitude) to an address; it can be used to answer the +question "Where am I?". +
+ + + +

Route

+The Maps Route API provides ways to calculate a route that defines a path +between a start and a destination and may, optionally, pass through specific +intermediate locations.

+ +Route Preferences:
+ - Travel Mode (car, pedestrian, public transit, truck),
+ - Optimization (fastest, shortest),
+ - Avoid/Prefer Preferences (toll road, motorway, ferry, public transit, + tunnel, dirt road, parks, car-pool lane).
+ - Route Calculations
+ - Way points and preferences as input values,
+ - Route geometry and maneuver (instructions for guidance) as result values: + Geometry consists of points that visually represent the determined route, + Maneuver contains turn-by-turn instruction and position. + + + + +

Places

+The Maps Place API allows you to find place information.

+ +Place search
+ - Depending on the location context, the number of relevant places might + be large. Therefore this query may not only return places, but also + suggestions for additional filter criteria that allow users to interactively + refine the classes of places they are interested in.
+ - Nearby Search: search for places within a specified area. + You can refine your search request by supplying keywords, Name of Points + of Interests, or Proximity.
+ - Category Search: search for popular places for the given location context and matching the category filter criteria. + You can refine your search request by specifying the categories of place you are searching for.
+Result item type of searching
+ - ID, name, location, distance, URI, rating, category.
+Place information allows to fetch details about a place. The following place content is supported:
+ - Base Attribute includes name, location, categories, contacts, ID, ratings, icon path, + image content, review content, and editorial content.
+ - Extended Attribute refers to opening hours, payment methods, annual closings, disabled access. + + + + +

View

+The Maps View API provides a developer with a set of functions, bringing +basic interactive visual user interface in maps applications.

+ +View widget: Drawing a map image on the map port, the specified rectangular +area of the maps application GUI.

+ +Zoom and rotation: Changing zoom and orientation of the view in response +to user gestures, such as scrolling, tapping, zooming, rotating, etc.

+ +Conversion of screen coordinates to geographical and vise versa.

+ +User's gesture support:
+ - Receive the event of the user gesture.
+ - Enable or disable the specified gesture.
+ - Re-assign the action, which should be taken in response to the user's gesture.

+ +Various Properties:
+ - Visibility and size on the screen.
+ - Theme: Day, satellite, or terrain.
+ - Language: English, Russian, Chinese, Italian, German, Spanish, etc. + + + + + +

Related Features

+ +To guarantee that the Maps application runs on a device with Maps profile feature, +declare the following feature requirements in the config file:
+http://tizen.org/feature/maps
+http://tizen.org/feature/internet +
+ +
+*/ + +namespace Tizen.Maps {} + diff --git a/src/Tizen.Maps/Tizen.Maps/Overlay.cs b/src/Tizen.Maps/Tizen.Maps/Overlay.cs new file mode 100755 index 0000000..9a9e7f0 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Overlay.cs @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using EvasObject = ElmSharp.EvasObject; + +namespace Tizen.Maps +{ + /// + /// Overlay map object + /// + /// 3 + public class Overlay : MapObject, IDisposable + { + internal Interop.OverlayHandle handle; + + /// + /// Creates a normal overlay map object. + /// + /// 3 + /// + /// + /// Thrown when input coordinates or objectToContain are invalid + public Overlay(Geocoordinates coordinates, EvasObject objectToContain) + : this(coordinates, objectToContain, Interop.ViewOverlayType.Normal) + { + } + + internal Overlay(Geocoordinates coordinates, EvasObject objectToContain, Interop.ViewOverlayType type) + { + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || objectToContain == null) + { + err.ThrowIfFailed("given coordinates or parent evas object is null"); + } + handle = new Interop.OverlayHandle(coordinates.handle, objectToContain, type); + } + + /// + /// Gets or sets visibility of overlay map object. + /// + /// 3 + public override bool IsVisible + { + get { return handle.IsVisible; } + set { handle.IsVisible = value; } + } + + /// + /// Gets or sets geographical coordinates for overlay map object. + /// + /// 3 + public Geocoordinates Coordinates + { + get + { + return new Geocoordinates(handle.Coordinates); + } + set + { + // Overlay takes ownership of the native handle. + handle.Coordinates = value.handle; + value.handle.HasOwnership = false; + } + } + + /// + /// Gets or sets minimum zoom level for overlay map object. + /// + /// 3 + public int MinimumZoomLevel + { + get + { + return handle.MinZoomLevel; + } + set + { + handle.MinZoomLevel = value; + } + } + + /// + /// Gets or sets maximum zoom lever for overlay map object. + /// + /// 3 + public int MaximumZoomLevel + { + get + { + return handle.MaxZoomLevel; + } + set + { + handle.MaxZoomLevel = value; + } + } + + // Overlay object does not support click events + internal override void HandleClickedEvent() + { + throw new NotSupportedException("Overlay object does not support click events"); + } + + internal override void InvalidateMapObject() + { + handle = null; + } + + internal override Interop.ViewObjectHandle GetHandle() + { + return handle; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } + + /// + /// Bubble overlay map object + /// + /// 3 + public class BubbleOverlay : Overlay + { + /// + /// Creates a Bubble overlay. + /// + /// 3 + /// The geographical coordinates to be pointed + /// The EvasObject to be shown + /// Thrown when the required feature is not supported. + /// Thrown when input coordinates or objectToContain are invalid + public BubbleOverlay(Geocoordinates coordinates, EvasObject objectToContain) + : base(coordinates, objectToContain, Interop.ViewOverlayType.Bubble) + { + } + } + + /// + /// Box Overlay map object + /// + /// 3 + public class BoxOverlay : Overlay + { + /// + /// Creates a Box overlay. + /// + /// 3 + /// The geographical coordinates to be pointed + /// The EvasObject to be shown + /// Thrown when the required feature is not supported. + /// Thrown when input coordinates or objectToContain are invalid + public BoxOverlay(Geocoordinates coordinates, EvasObject objectToContain) + : base(coordinates, objectToContain, Interop.ViewOverlayType.Box) + { + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Place.cs b/src/Tizen.Maps/Tizen.Maps/Place.cs new file mode 100755 index 0000000..70f6bf6 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Place.cs @@ -0,0 +1,264 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Place information, used in Place Discovery and Search + /// + /// 3 + public class Place : IDisposable + { + internal Interop.PlaceHandle handle; + + internal Place(Interop.PlaceHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets ID string for the place. + /// + /// 3 + public string Id + { + get + { + return handle.Id; + } + } + + /// + /// Gets name string for the place. + /// + /// 3 + public string Name + { + get + { + return handle.Name; + } + } + + /// + /// Gets view URI for the place. + /// + /// 3 + public string Uri + { + get + { + return handle.Uri; + } + } + + /// + /// Gets distance for the place from the center. + /// + /// 3 + public int Distance + { + get + { + return handle.Distance; + } + } + + /// + /// Gets geographical location for the place. + /// + /// 3 + public Geocoordinates Coordinates + { + get + { + return new Geocoordinates(handle.Coordinates); + } + } + + /// + /// Gets address for the place. + /// + /// 3 + public PlaceAddress Address + { + get + { + return new PlaceAddress(handle.Address); + } + } + + /// + /// Gets rating for the place. + /// + /// 3 + public PlaceRating Rating + { + get + { + return new PlaceRating(handle.Rating); + } + } + + /// + /// Gets supplier link for the place. + /// + /// 3 + public PlaceLink Supplier + { + get + { + return new PlaceLink(handle.Supplier); + } + } + + /// + /// Gets related link for the place. + /// + /// 3 + public PlaceLink Related + { + get + { + return new PlaceLink(handle.Related); + } + } + + /// + /// Gets all properties attached to this place. + /// + /// 3 + public IDictionary Properties + { + get + { + var properties = new Dictionary(); + handle.ForeachProperty((key, value) => properties[key] = value); + return properties; + } + } + + /// + /// Gets all categories attached to this place. + /// + /// 3 + public IEnumerable Categories + { + get + { + var categories = new List(); + handle.ForeachCategory((categoryHandle) => categories.Add(new PlaceCategory(categoryHandle))); + return categories; + } + } + + /// + /// Gets all attributes attached to this place. + /// + /// 3 + public IEnumerable Attributes + { + get + { + var attributes = new List(); + handle.ForeachAttribute((attributeHandle) => attributes.Add(new PlaceAttribute(attributeHandle))); + return attributes; + } + } + + /// + /// Gets all contacts attached to this place. + /// + /// 3 + public IEnumerable Contacts + { + get + { + var contacts = new List(); + handle.ForeachContact((contactHandle) => contacts.Add(new PlaceContact(contactHandle))); + return contacts; + } + } + + /// + /// Gets all editorials attached to this place. + /// + /// 3 + public IEnumerable Editorials + { + get + { + var editorials = new List(); + handle.ForeachEditorial((editorialHandle) => editorials.Add(new PlaceEditorial(editorialHandle))); + return editorials; + } + } + + /// + /// Gets all images attached to this place. + /// + /// 3 + public IEnumerable Images + { + get + { + var images = new List(); + handle.ForeachImage((imageHandle) => images.Add(new PlaceImage(imageHandle))); + return images; + } + } + + /// + /// Gets all reviews attached to this place. + /// + /// 3 + public IEnumerable Reviews + { + get + { + var reviews = new List(); + handle.ForeachReview((reviewHandle) => reviews.Add(new PlaceReview(reviewHandle))); + return reviews; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceAddress.cs b/src/Tizen.Maps/Tizen.Maps/PlaceAddress.cs new file mode 100755 index 0000000..0a119ed --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceAddress.cs @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; + +namespace Tizen.Maps +{ + /// + /// Address information for the map point used in Geocode and Reverse Geocode requests. + /// + /// 3 + public class PlaceAddress : IDisposable + { + internal Interop.AddressHandle handle; + + /// + /// Constructs map address object. + /// + /// 3 + /// Thrown when native operation failed to allocate memory. + public PlaceAddress() + { + handle = new Interop.AddressHandle(); + } + + internal PlaceAddress(Interop.AddressHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets a building number for this address. + /// + /// 3 + public string Building + { + get + { + return handle.Building; + } + set + { + handle.Building = value; + } + } + + /// + /// Gets a city name for this address. + /// + /// 3 + public string City + { + get + { + return handle.City; + } + set + { + handle.City = value; + } + } + + /// + /// Gets a country name for this address. + /// + /// 3 + public string Country + { + get + { + return handle.Country; + } + set + { + handle.Country = value; + } + } + + /// + /// Gets a country code for this address. + /// + /// 3 + public string CountryCode + { + get + { + return handle.CountryCode; + } + set + { + handle.CountryCode = value; + } + } + + /// + /// Gets a county for this address. + /// + /// 3 + public string County + { + get + { + return handle.County; + } + set + { + handle.County = value; + } + } + + /// + /// Gets a district name for this address. + /// + /// 3 + public string District + { + get + { + return handle.District; + } + set + { + handle.District = value; + } + } + + /// + /// Gets a free text associated with this address. + /// + /// 3 + public string FreeText + { + get + { + return handle.FreeText; + } + set + { + handle.FreeText = value; + } + } + + [EditorBrowsableAttribute(EditorBrowsableState.Never)] + [Obsolete("Freetext is deprecated. Please use FreeText instead.")] + public string Freetext + { + get + { + return FreeText; + } + set + { + FreeText = value; + } + } + + /// + /// Gets a postal code for this address. + /// + /// 3 + public string PostalCode + { + get + { + return handle.PostalCode; + } + set + { + handle.PostalCode = value; + } + } + + /// + /// Gets a state name for this address. + /// + /// 3 + public string State + { + get + { + return handle.State; + } + set + { + handle.State = value; + } + } + + /// + /// Gets a street name for this address. + /// + /// 3 + public string Street + { + get + { + return handle.Street; + } + set + { + handle.Street = value; + } + } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{FreeText}"; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs b/src/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs new file mode 100755 index 0000000..86ba5f3 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceAddressList.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// List of objects to be used in APIs + /// + internal class PlaceAddressList : IDisposable + { + internal Interop.AddressListHandle handle; + private List _list; + + /// + /// Constructs a map address list object. + /// + /// Thrown when the required feature is not supported. + /// Thrown when native operation failed to allocate memory. + public PlaceAddressList() + { + handle = new Interop.AddressListHandle(); + } + + internal PlaceAddressList(Interop.AddressListHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets an iterator for addresses in this list. + /// + public IEnumerable Addresses + { + get + { + if (_list == null) + { + _list = new List(); + handle.Foreach(addressHandle => _list.Add(new PlaceAddress(addressHandle))); + } + return _list; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs b/src/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs new file mode 100755 index 0000000..a6307fa --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceAttribute.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Attributes information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceAttribute + { + private string _id; + private string _label; + private string _text; + + internal PlaceAttribute(Interop.PlaceAttributeHandle nativeHandle) + { + _id = nativeHandle.Id; + _label = nativeHandle.Label; + _text = nativeHandle.Text; + } + + internal PlaceAttribute(IntPtr nativeHandle, bool needToRelease) + : this(new Interop.PlaceAttributeHandle(nativeHandle, needToRelease)) + { + } + + /// + /// Gets an ID for the place attribute. + /// + /// 3 + public string Id { get { return _id; } } + + /// + /// Gets a label for the place attribute. + /// + /// 3 + public string Label { get { return _label; } } + + /// + /// Gets a text for the place attribute. + /// + /// 3 + public string Text { get { return _text; } } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{Label}: {Text}"; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceCategory.cs b/src/Tizen.Maps/Tizen.Maps/PlaceCategory.cs new file mode 100755 index 0000000..16ce43c --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceCategory.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Category information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceCategory : IDisposable + { + internal Interop.PlaceCategoryHandle handle; + + /// + /// Constructs search category object. + /// + /// 3 + /// Thrown when native operation failed to allocate memory. + public PlaceCategory() + { + handle = new Interop.PlaceCategoryHandle(); + } + + internal PlaceCategory(Interop.PlaceCategoryHandle nativeHandle) + { + handle = nativeHandle; + } + + + /// + /// Gets or sets an ID for this category. + /// + /// 3 + public string Id + { + get { return handle.Id; } + set { handle.Id = value; } + } + + /// + /// Gets or sets a name for this category. + /// + /// 3 + public string Name + { + get { return handle.Name; } + set { handle.Name = value; } + } + + /// + /// Gets or sets an URL for this category. + /// + /// 3 + public string Url + { + get { return handle.Url; } + set { handle.Url = value; } + } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{Name}"; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceContact.cs b/src/Tizen.Maps/Tizen.Maps/PlaceContact.cs new file mode 100755 index 0000000..8d6c467 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceContact.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Contact information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceContact + { + private string _label; + private string _type; + private string _value; + + internal PlaceContact(Interop.PlaceContactHandle handle) + { + _label = handle.Label; + _type = handle.Type; + _value = handle.Value; + } + + internal PlaceContact(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceContactHandle(nativeHandle, needToRelease)) + { + } + + /// + /// Gets an ID for this place contact. + /// + /// 3 + public string Id { get { return _type; } } + + /// + /// Gets a label for this place contact. + /// + /// 3 + public string Label { get { return _label; } } + + /// + /// Gets a value for this place contact. + /// + /// 3 + public string Value { get { return _value; } } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{Label}: {Value}"; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs b/src/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs new file mode 100755 index 0000000..ba4ff6a --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceEditorial.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Editorial information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceEditorial + { + private string _description; + private string _language; + private PlaceMedia _media; + + internal PlaceEditorial(Interop.PlaceEditorialHandle handle) + { + _description = handle.Description; + _language = handle.Language; + _media = new PlaceMedia(handle.Media); + } + + internal PlaceEditorial(IntPtr nativeHandle, bool needToRelease) : this(new Interop.PlaceEditorialHandle(nativeHandle, needToRelease)) + { + } + + /// + /// Gets a description for this place editorial. + /// + /// 3 + public string Description { get { return _description; } } + + /// + /// Gets a language for this place editorial. + /// + /// 3 + public string Language { get { return _language; } } + + /// + /// Gets an instance of object which representing media for this place editorial. + /// + /// 3 + public PlaceMedia Media { get { return _media; } } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{Description}"; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceFilter.cs b/src/Tizen.Maps/Tizen.Maps/PlaceFilter.cs new file mode 100755 index 0000000..747c0d7 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceFilter.cs @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Filter information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceFilter : IDisposable + { + internal Interop.PlaceFilterHandle handle; + + /// + /// Constructs new place filter. + /// + /// 3 + /// Thrown when native operation failed to allocate memory. + public PlaceFilter() + { + handle = new Interop.PlaceFilterHandle(); + } + + /// + /// Gets or sets an free-formed address string for this place filter. + /// + /// 3 + /// Depending on maps provider which the application has selected, + /// it may treat , and + /// as same kind of strings to search places. + public string Address + { + get + { + return handle.PlaceAddress; + } + set + { + handle.PlaceAddress = value; + } + } + + /// + /// Gets or sets an instance of object for this place filter. + /// + /// 3 + public PlaceCategory Category + { + get + { + return new PlaceCategory(handle.Category); + } + set + { + handle.Category = value.handle; + } + } + + /// + /// Gets or sets a keyword for this place filter. + /// + /// 3 + /// Depending on maps provider which the application has selected, + /// it may treat , and + /// as same kind of strings to search places. + public string Keyword + { + get + { + return handle.Keyword; + } + set + { + handle.Keyword = value; + } + } + + /// + /// Gets or sets a name for this place filter. + /// + /// 3 + /// Depending on maps provider which the application has selected, + /// it may treat , and + /// as same kind of strings to search places. + public string Name + { + get + { + return handle.PlaceName; + } + set + { + handle.PlaceName = value; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceImage.cs b/src/Tizen.Maps/Tizen.Maps/PlaceImage.cs new file mode 100755 index 0000000..220a199 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceImage.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Image information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceImage + { + private string _id; + private string _url; + private int _width; + private int _height; + private PlaceLink _userLink; + private PlaceMedia _media; + + internal PlaceImage(Interop.PlaceImageHandle handle) + { + _id = handle.Id; + _url = handle.Url; + _width = handle.Width; + _height = handle.Height; + _userLink = new PlaceLink(handle.User); + _media = new PlaceMedia(handle.Media); + } + + /// + /// Gets an ID for this place image. + /// + /// 3 + public string Id { get { return _id; } } + + /// + /// Gets an URL for this place image. + /// + /// 3 + public string Url { get { return _url; } } + + /// + /// Gets width for this place image. + /// + /// 3 + public int Width { get { return _width; } } + + /// + /// Gets height for this place image. + /// + /// 3 + public int Height { get { return _height; } } + + /// + /// Gets an object which representing user link for this place image. + /// + /// 3 + public PlaceLink UserLink { get { return _userLink; } } + + /// + /// Gets an object which representing image media for this place image. + /// + /// 3 + public PlaceMedia ImageMedia { get { return _media; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceLink.cs b/src/Tizen.Maps/Tizen.Maps/PlaceLink.cs new file mode 100755 index 0000000..bdc6a06 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceLink.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Link Object information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceLink + { + private string _id; + private string _name; + private string _link; + private string _type; + + internal PlaceLink(Interop.PlaceLinkObjectHandle handle) + { + _id = handle.Id; + _name = handle.Name; + _link = handle.Link; + _type = handle.Type; + } + + /// + /// Gets a string which representing ID for this place link. + /// + /// 3 + public string Id { get { return _id; } } + + /// + /// Gets a string which representing name for this place link. + /// + /// 3 + public string Name { get { return _name; } } + + /// + /// Gets a string which representing link for this place link. + /// + /// 3 + public string Link { get { return _link; } } + + /// + /// Gets a string which representing type for this place link. + /// + /// 3 + public string Type { get { return _type; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceList.cs b/src/Tizen.Maps/Tizen.Maps/PlaceList.cs new file mode 100755 index 0000000..c46bbdb --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceList.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// List of objects to be used in APIs + /// + internal class PlaceList : IDisposable + { + internal Interop.PlaceListHandle handle; + private List _list; + + internal PlaceList(Interop.PlaceListHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets an iterator for addresses in this list. + /// + public IEnumerable Places + { + get + { + if (_list == null) + { + _list = new List(); + handle.Foreach(placeHandle => _list.Add(new Place(placeHandle))); + } + return _list; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceMedia.cs b/src/Tizen.Maps/Tizen.Maps/PlaceMedia.cs new file mode 100755 index 0000000..370de73 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceMedia.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Media information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceMedia + { + private string _attribution; + private PlaceLink _supplier; + private PlaceLink _via; + + internal PlaceMedia(Interop.PlaceMediaHandle handle) + { + _attribution = handle.Attribution; + _supplier = new PlaceLink(handle.Supplier); + _via = new PlaceLink(handle.Via); + } + + /// + /// Gets a string which representing attribution for this place media. + /// + /// 3 + public string Attribution { get { return _attribution; } } + + /// + /// Gets an instance of object which representing supplier for this place media. + /// + /// 3 + public PlaceLink Supplier { get { return _supplier; } } + + /// + /// Gets an instance of object which representing via data for this place media. + /// + /// 3 + public PlaceLink Via { get { return _via; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceRating.cs b/src/Tizen.Maps/Tizen.Maps/PlaceRating.cs new file mode 100755 index 0000000..a829fc4 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceRating.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Rating information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceRating + { + private int _count; + private double _average; + + internal PlaceRating(Interop.PlaceRatingHandle handle) + { + _count = handle.Count; + _average = handle.Average; + } + + /// + /// Gets the number of users rated for this place rating. + /// + /// 3 + public int UserCount { get { return _count; } } + + /// + /// Gets average value of this place rating. + /// + /// 3 + public double Average { get { return _average; } } + + /// + /// Returns a string that represents this object. + /// + /// 3 + /// Returns a string which presents this object. + public override string ToString() + { + return $"{Average}({UserCount} reviews)"; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceReview.cs b/src/Tizen.Maps/Tizen.Maps/PlaceReview.cs new file mode 100755 index 0000000..210b307 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceReview.cs @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Place Review information, used in Place Discovery and Search requests + /// + /// 3 + public class PlaceReview + { + private DateTime _date; + private string _title; + private double _rating; + private string _description; + private string _language; + private PlaceMedia _media; + private PlaceLink _userLink; + + internal PlaceReview(Interop.PlaceReviewHandle handle) + { + string date = handle.Date; + if (DateTime.TryParse(date, out _date) == false) + { + Interop.ErrorCode.InvalidParameter.WarnIfFailed($"Wrong date format: {date}"); + } + + _title = handle.Title; + _rating = handle.Rating; + _description = handle.Description; + _language = handle.Language; + _media = new PlaceMedia(handle.Media); + _userLink = new PlaceLink(handle.User); + } + + /// + /// Gets an instance of object which representing time of this review. + /// + /// 3 + public DateTime Date { get { return _date; } } + + /// + /// Gets a string which representing title of this review. + /// + /// 3 + public string Title { get { return _title; } } + + /// + /// Gets a value which representing rating of this review. + /// + /// 3 + public double Rating { get { return _rating; } } + + /// + /// Gets a string which representing description of this review. + /// + /// 3 + public string Description { get { return _description; } } + + /// + /// Gets a string which representing language of this review. + /// + /// 3 + public string Language { get { return _language; } } + + /// + /// Gets an instance of object which representing review media of this review. + /// + /// 3 + public PlaceMedia ReviewMedia { get { return _media; } } + + /// + /// Gets an instance of object which representing user link of this review. + /// + /// 3 + public PlaceLink UserLink { get { return _userLink; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs b/src/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs new file mode 100755 index 0000000..92bd555 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/PlaceSearchRequest.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Place search request for Tizen map service + /// + /// 3 + public class PlaceSearchRequest : MapServiceRequest + { + private Interop.SearchPlaceCallback _placeCallback; + private List _placeList = new List(); + + internal PlaceSearchRequest(MapService service, Geocoordinates position, int distance) : this(service, ServiceRequestType.SearchPlace) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get place list for given co-ordinate {position} and distance {distance}"; + errorCode = _service.handle.SearchPlace(position.handle, distance, _service.PlaceSearchFilter.handle, _service.Preferences.handle, _placeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + internal PlaceSearchRequest(MapService service, Area boundary) : this(service, ServiceRequestType.SearchPlaceByArea) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get place list for given boundary"; + errorCode = _service.handle.SearchPlaceByArea(boundary.handle, _service.PlaceSearchFilter.handle, _service.Preferences.handle, _placeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + internal PlaceSearchRequest(MapService service, string address, Area boundary) : this(service, ServiceRequestType.SearchPlaceByAddress) + { + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get coordinates for address {address} in given boundary"; + errorCode = _service.handle.SearchPlaceByAddress(address, boundary.handle, _service.PlaceSearchFilter.handle, _service.Preferences.handle, _placeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + + private PlaceSearchRequest(MapService service, ServiceRequestType type) : base(service, type) + { + // The Maps Service invokes this callback while iterating through the set of obtained Place data. + _placeCallback = (result, id, index, total, place, userData) => + { + errorCode = result; + if (result.IsSuccess()) + { + // The parameter place must be released using maps_place_destroy(). + var placeHandle = new Interop.PlaceHandle(place, needToRelease: true); + _placeList.Add(new Place(placeHandle)); + if (_placeList.Count == total) + { + _requestTask?.TrySetResult(_placeList); + } + return true; + } + else + { + // If search is failed, the value of total is 0 and place is NULL + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + return false; + } + }; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Polygon.cs b/src/Tizen.Maps/Tizen.Maps/Polygon.cs new file mode 100755 index 0000000..1503b63 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Polygon.cs @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; + +using Color = ElmSharp.Color; + +namespace Tizen.Maps +{ + /// + /// Polygon map object + /// + /// 3 + public class Polygon : MapObject, IDisposable + { + internal Interop.PolygonHandle handle; + private List _coordinateList; + + /// + /// Creates a polygon visual object. + /// + /// 3 + /// List of geographical coordinates + /// Background color + /// Thrown when input values are invalid. + public Polygon(IEnumerable coordinates, Color color) : base() + { + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || coordinates.Count() < 3) + { + err.ThrowIfFailed("given coordinates list should contain at least 3 coordinates"); + } + _coordinateList = coordinates.ToList(); + var geocoordinateList = new GeocoordinatesList(_coordinateList, false); + handle = new Interop.PolygonHandle(geocoordinateList.handle, color); + } + + /// + /// Adds or removes clicked event handlers. + /// + /// 3 + public event EventHandler Clicked; + + /// + /// Gets or sets visibility for the polygon. + /// + /// 3 + public override bool IsVisible + { + get { return handle.IsVisible; } + set { handle.IsVisible = value; } + } + + /// + /// Gets or sets a list of geographical coordinates of polygon vertices. + /// + /// 3 + public IEnumerable Coordinates + { + get + { + return _coordinateList; + } + set + { + var coordinates = value.ToList(); + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || coordinates.Count() < 3) + { + err.ThrowIfFailed("given coordinates list should contain at least 3 coordinates"); + } + + var geocoordinateList = new GeocoordinatesList(coordinates, false); + if (handle.SetPolygon(geocoordinateList.handle).IsSuccess()) + { + _coordinateList = coordinates; + } + } + } + + /// + /// Gets or sets background color to fill the polygon. + /// + /// 3 + public Color FillColor + { + get + { + return handle.FillColor; + } + set + { + handle.FillColor = value; + } + } + + internal override void HandleClickedEvent() + { + Clicked?.Invoke(this, EventArgs.Empty); + } + + internal override void InvalidateMapObject() + { + handle = null; + } + + internal override Interop.ViewObjectHandle GetHandle() + { + return handle; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _coordinateList.Clear(); + } + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Polyline.cs b/src/Tizen.Maps/Tizen.Maps/Polyline.cs new file mode 100755 index 0000000..9c743c2 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Polyline.cs @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; + +using Color = ElmSharp.Color; + +namespace Tizen.Maps +{ + /// + /// Polyline map object + /// + /// 3 + public class Polyline : MapObject, IDisposable + { + internal Interop.PolylineHandle handle; + private List _coordinateList; + + /// + /// Creates polyline visual object. + /// + /// 3 + /// List of geographical coordinates + /// Line color + /// The width of line [1 ~ 100] (pixels) + /// Thrown when input values are invalid + public Polyline(List coordinates, Color color, int width) : base() + { + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || coordinates.Count() < 2) + { + err.ThrowIfFailed("given coordinates list should contain at least 2 coordinates"); + } + _coordinateList = coordinates.ToList(); + var geocoordinateList = new GeocoordinatesList(_coordinateList); + handle = new Interop.PolylineHandle(geocoordinateList.handle, color, width); + } + + /// + /// Adds or removes clicked event handlers. + /// + /// 3 + public event EventHandler Clicked; + + /// + /// Gets or sets visibility for the polyline. + /// + /// 3 + public override bool IsVisible + { + get { return handle.IsVisible; } + set { handle.IsVisible = value; } + } + + /// + /// Gets or sets a list of geographical coordinates for polyline vertices. + /// + /// 3 + public IEnumerable Coordinates + { + get + { + return _coordinateList; + } + set + { + var coordinates = value.ToList(); + var err = Interop.ErrorCode.InvalidParameter; + if (coordinates == null || coordinates.Count() < 2) + { + err.ThrowIfFailed("given coordinates list should contain at least 2 coordinates"); + } + + var geocoordinateList = new GeocoordinatesList(coordinates, false); + if (handle.SetPolyline(geocoordinateList.handle).IsSuccess()) + { + _coordinateList = coordinates; + } + } + } + + /// + /// Gets or sets line color. + /// + /// 3 + public Color LineColor + { + get + { + return handle.LineColor; + } + set + { + handle.LineColor = value; + } + } + + /// + /// Gets or sets line width from 1 to 100 pixels. + /// + /// 3 + public int Width + { + get + { + return handle.LineWidth; + } + set + { + handle.LineWidth = value; + } + } + + internal override void HandleClickedEvent() + { + Clicked?.Invoke(this, EventArgs.Empty); + } + + internal override void InvalidateMapObject() + { + handle = null; + } + + internal override Interop.ViewObjectHandle GetHandle() + { + return handle; + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + _coordinateList.Clear(); + } + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs b/src/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs new file mode 100755 index 0000000..af2533d --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/ReverseGeocodeRequest.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Reverse geocode request for map service. + /// + /// 3 + public class ReverseGeocodeRequest : MapServiceRequest + { + private Interop.ReverseGeocodeCallback _geocodeCallback; + private List _addressList = new List(); + + internal ReverseGeocodeRequest(MapService service, double latitude, double longitute) : base(service, ServiceRequestType.ReverseGeocode) + { + // The Maps Service invokes this callback when the address is obtained from the specified coordinates. + _geocodeCallback = (result, id, index, total, address, userData) => + { + errorCode = result; + if (result.IsSuccess()) + { + // The parameter address must be released using maps_address_destroy(). + var addressHandle = new Interop.AddressHandle(address, needToRelease: true); + _addressList.Add(new PlaceAddress(addressHandle)); + if (_addressList.Count == total) + { + _requestTask?.TrySetResult(_addressList); + } + } + else + { + // If search is failed, the value of total is 0 and address is NULL + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + }; + + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get coordinates for given coordinates: {latitude}:{longitute}"; + errorCode = _service.handle.ReverseGeocode(latitude, longitute, _service.Preferences.handle, _geocodeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + _requestID = requestID; + }); + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/Route.cs b/src/Tizen.Maps/Tizen.Maps/Route.cs new file mode 100755 index 0000000..bc5aa4c --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/Route.cs @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Route information, used in Route Search requests. + /// + /// 3 + public class Route : IDisposable + { + internal Interop.RouteHandle handle; + + internal Route(Interop.RouteHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets an instance of object which representing destination coordinates for this route. + /// + /// 3 + public Geocoordinates Destination + { + get + { + return new Geocoordinates(handle.Destination); + } + } + + /// + /// Gets total distance for this route. + /// + /// 3 + public double Distance + { + get + { + return handle.Distance; + } + } + + /// + /// Get total duration to cover this route. + /// + /// 3 + public double Duration + { + get + { + return handle.Duration; + } + } + + /// + /// Gets an ID for this route. + /// + /// 3 + public string Id + { + get + { + return handle.Id; + } + } + + /// + /// Gets transport mode for this route. + /// + /// 3 + public TransportMode Mode + { + get + { + return (TransportMode)handle.TransportMode; + } + } + + /// + /// Gets origin coordinates for this route. + /// + /// 3 + public Geocoordinates Origin + { + get + { + return new Geocoordinates(handle.Origin); + } + } + + /// + /// Gets a coordinates list for this route. + /// + /// 3 + public IEnumerable Path + { + get + { + var path = new List(); + handle.ForeachPath(coordinateHandle => path.Add(new Geocoordinates(coordinateHandle))); + return path; + } + } + + /// + /// Gets a segment list for this route. + /// + /// 3 + public IEnumerable Segments + { + get + { + var segments = new List(); + handle.ForeachSegment(segmentHandle => segments.Add(new RouteSegment(segmentHandle))); + return segments; + } + } + + /// + /// Gets distance unit for this route. + /// + /// 3 + public DistanceUnit Unit + { + get + { + return (DistanceUnit)handle.Unit; + } + } + + /// + /// Gets an instance of object which representing bounding area for this route. + /// + private Area BoundingBox + { + get + { + return new Area(handle.BoundingBox); + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteFeature.cs b/src/Tizen.Maps/Tizen.Maps/RouteFeature.cs new file mode 100755 index 0000000..4f44d36 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteFeature.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Route features, used for route search requests + /// + /// 3 + public enum RouteFeature + { + /// + /// Indicates no route features (are selected). + /// + None = Interop.RouteRequestFeature.None, + /// + /// Indicates toll roads (toll gates/booths). + /// + Toll = Interop.RouteRequestFeature.Toll, + /// + /// Indicates motorway. + /// + Motorway = Interop.RouteRequestFeature.MotorWay, + /// + /// Indicates a boat ferry. + /// + BoatFerry = Interop.RouteRequestFeature.BoatFerry, + /// + /// Indicates rail (train) ferry. + /// + RailFerry = Interop.RouteRequestFeature.RailFerry, + /// + /// Indicates public transport. + /// + PublicTransit = Interop.RouteRequestFeature.PublicTransit, + /// + /// Indicates tunnel. + /// + Tunnel = Interop.RouteRequestFeature.Tunnel, + /// + /// Indicates dirt road. + /// + DirtRoad = Interop.RouteRequestFeature.DirtRoad, + /// + /// Indicates park. + /// + Parks = Interop.RouteRequestFeature.Parks, + /// + /// Indicates a high-occupancy vehicle lane. + /// + Hovlane = Interop.RouteRequestFeature.Hovlane, + /// + /// Indicates stairs. + /// + Stairs = Interop.RouteRequestFeature.Stairs, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteFeatureWeight.cs b/src/Tizen.Maps/Tizen.Maps/RouteFeatureWeight.cs new file mode 100755 index 0000000..03a557e --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteFeatureWeight.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Route feature weights used in route search requests + /// + /// 3 + public enum RouteFeatureWeight + { + /// + /// Indicates normal weighting. + /// + Normal = Interop.RouteFeatureWeight.Normal, + /// + /// Indicates that a feature is preferred. + /// + Prefer = Interop.RouteFeatureWeight.Prefer, + /// + /// Indicates that a feature is to be avoided. + /// + Avoid = Interop.RouteFeatureWeight.Avoid, + /// + /// Indicates that soft-exclude applies to the feature. + /// + SoftExclude = Interop.RouteFeatureWeight.SoftExclude, + /// + /// Indicates that the feature is to be strictly excluded. + /// + StrictExclude = Interop.RouteFeatureWeight.StrictExclude, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteManeuver.cs b/src/Tizen.Maps/Tizen.Maps/RouteManeuver.cs new file mode 100755 index 0000000..ea1ceeb --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteManeuver.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Maps +{ + /// + /// Route Maneuver information, used in Route Search requests + /// + /// 3 + public class RouteManeuver + { + private Interop.RouteDirection _direction; + private Interop.RouteTurnType _turntype; + private Geocoordinates _coordinates; + private string _road; + private string _instruction; + private string _locale; + private int _timeToNextInstruction; + private double _distanceToNextInstruction; + + internal RouteManeuver(Interop.RouteManeuverHandle handle) + { + _direction = handle.Direction; + _turntype = handle.TurnType; + _coordinates = new Geocoordinates(handle.Coordinates); + _road = handle.RoadName; + _instruction = handle.Instruction; + _locale = handle.Locale; + _timeToNextInstruction = handle.TimeToNextInstruction; + _distanceToNextInstruction = handle.DistanceToNextInstruction; + } + + /// + /// Gets direction type for this maneuver. + /// + /// 3 + public DirectionType Direction { get { return (DirectionType)_direction; } } + + /// + /// Gets turn type for this maneuver. + /// + /// 3 + public TurnInstruction Turn { get { return (TurnInstruction)_turntype; } } + + /// + /// Gets a geographical coordinates position for this maneuver. + /// + /// 3 + public Geocoordinates Position { get { return _coordinates; } } + + /// + /// Gets a name of the road for this maneuver. + /// + /// 3 + public string Road { get { return _road; } } + + /// + /// Gets an instruction text for this maneuver. + /// + /// 3 + public string Instruction { get { return _instruction; } } + + /// + /// Gets a locale for this maneuver. + /// + /// 3 + public string Locale { get { return _locale; } } + + /// + /// Gets time to next instruction for this maneuver. + /// + /// 3 + public int TimeToNextInstruction { get { return _timeToNextInstruction; } } + + /// + /// Gets distance to next instruction for this maneuver. + /// + /// 3 + public double DistanceToNextInstruction { get { return _distanceToNextInstruction; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteOptimization.cs b/src/Tizen.Maps/Tizen.Maps/RouteOptimization.cs new file mode 100755 index 0000000..e7932a0 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteOptimization.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Allowed route optimization option used in route search requests + /// + /// 3 + /// + /// Depending on loaded maps plug-in using , some features may have no effect or differences with descriptions. + /// + public enum RouteOptimization + { + /// + /// Indicates that searching for fastest routes. + /// + Fastest = Interop.RouteOptimization.Fastest, + /// + /// Indicates that searching for shortest routes (car mode only). + /// + Shortest = Interop.RouteOptimization.Shortest, + /// + /// Indicates that searching for most economic routes (car mode only). + /// + Economic = Interop.RouteOptimization.Economic, + /// + /// Indicates that searching for most scenic routes. + /// + Scenic = Interop.RouteOptimization.Scenic, + /// + /// Indicates that searching for most fastest routes now, based on current traffic condition. + /// + FastestNow = Interop.RouteOptimization.FastestNow, + /// + /// Indicates that searching for direct drive routes. + /// + DirectDrive = Interop.RouteOptimization.DirectDrive, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs b/src/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs new file mode 100755 index 0000000..95d48cf --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteSearchRequest.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Tizen.Maps +{ + /// + /// Route search request for Tizen map service requests + /// + /// 3 + public class RouteSearchRequest : MapServiceRequest + { + private Interop.SearchRouteCallback _routeCallback; + private List _routeList = new List(); + + private Geocoordinates _to; + private Geocoordinates _from; + private List _waypoints = new List(); + + internal RouteSearchRequest(MapService service, Geocoordinates from, Geocoordinates to) : this(service, ServiceRequestType.SearchRoute) + { + _to = to; + _from = from; + startExecutionAction = new Action(() => + { + int requestID; + errMessage = $"Failed to get route list for given origin {_from} and destination {_to}"; + if (_waypoints?.Count == 0) + { + _type = ServiceRequestType.SearchRoute; + errorCode = _service.handle.SearchRoute(_from.handle, _to.handle, _service.Preferences.handle, _routeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + } + else + { + _type = ServiceRequestType.SearchRouteWithWaypoints; + + var waypoints = GetCoordinateListForWaypoints(); + errorCode = _service.handle.SearchRouteWaypoints(waypoints, waypoints.Length, _service.Preferences.handle, _routeCallback, IntPtr.Zero, out requestID); + if (errorCode.IsFailed() && errorCode != Interop.ErrorCode.Canceled) + { + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + } + } + _requestID = requestID; + }); + } + + + private RouteSearchRequest(MapService service, ServiceRequestType type) : base(service, type) + { + // The Maps Service invokes this callback while iterating through the set of obtained Routes. + _routeCallback = (result, id, index, total, route, userData) => + { + errorCode = result; + if (result.IsSuccess()) + { + // The parameter route must be released using maps_route_destroy(). + var routeHandle = new Interop.RouteHandle(route, needToRelease: true); + _routeList.Add(new Route(routeHandle)); + if (_routeList.Count == total) + { + _requestTask?.TrySetResult(_routeList); + } + return true; + } + else + { + // If search is failed, the value of total is 0 and route is NULL. + _requestTask?.TrySetException(errorCode.GetException(errMessage)); + return false; + } + }; + } + + /// + /// Gets or sets a list of way-points to cover between origin and destination. + /// + /// 3 + public IEnumerable Waypoints + { + get + { + return _waypoints; + } + set + { + _waypoints = value.ToList(); + } + } + + private IntPtr[] GetCoordinateListForWaypoints() + { + var waypoints = new IntPtr[_waypoints.Count + 2]; + waypoints[0] = _from.handle; + for (int i = 0; i < _waypoints.Count; ++i) + { + waypoints[i + 1] = _waypoints[i].handle; + } + waypoints[waypoints.Length - 1] = _to.handle; + return waypoints; + } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/RouteSegment.cs b/src/Tizen.Maps/Tizen.Maps/RouteSegment.cs new file mode 100755 index 0000000..347466f --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/RouteSegment.cs @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Place Segment information, used in Route Search requests + /// + /// 3 + public class RouteSegment + { + private Geocoordinates _origin; + private Geocoordinates _destination; + private double _distance; + private double _duration; + private Area _boundingBox; + + private List _maneuvers = new List(); + private List _path = new List(); + + internal RouteSegment(Interop.RouteSegmentHandle handle) + { + _origin = new Geocoordinates(handle.Origin); + _destination = new Geocoordinates(handle.Destination); + _distance = handle.Distance; + _duration = handle.Duration; + _boundingBox = new Area(handle.BoundingBox); + + handle.ForeachManeuver(maneuverHandle => _maneuvers.Add(new RouteManeuver(maneuverHandle))); + handle.ForeachPath(pathHandle => _path.Add(new Geocoordinates(pathHandle))); + } + + /// + /// Gets an origin coordinates for this segment. + /// + /// 3 + public Geocoordinates Origin { get { return _origin; } } + + /// + /// Gets a destination coordinates for this segment. + /// + /// 3 + public Geocoordinates Destination { get { return _destination; } } + + /// + /// Gets total distance for this segment. + /// + /// 3 + public double Distance { get { return _distance; } } + + /// + /// Gets total duration to cover this segment. + /// + /// 3 + public double Duration { get { return _duration; } } + + /// + /// Gets a maneuver list for this segment. + /// + /// 3 + public IEnumerable Maneuvers { get { return _maneuvers; } } + + /// + /// Gets a coordinates list for this segment. + /// + /// 3 + public IEnumerable Path { get { return _path; } } + + private Area BoundingBox { get { return _boundingBox; } } + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/SearchPreference.cs b/src/Tizen.Maps/Tizen.Maps/SearchPreference.cs new file mode 100755 index 0000000..fc7da53 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/SearchPreference.cs @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Maps +{ + /// + /// Preferences for route search requests + /// + /// 3 + public class SearchPreference : IGeocodePreference, IPlaceSearchPreference, IRouteSearchPreference, IDisposable + { + internal Interop.PreferenceHandle handle; + private IDictionary _properties = new Dictionary(); + + /// + /// Constructors a new search preference. + /// + /// 3 + public SearchPreference() + { + handle = new Interop.PreferenceHandle(); + } + + /// + /// Constructors a new search preference. + /// + internal SearchPreference(Interop.PreferenceHandle nativeHandle) + { + handle = nativeHandle; + } + + /// + /// Gets or sets preferred language. + /// + /// 3 + /// Language should be specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code.
e.g. "ko-KR", "en-US".
+ public string Language + { + get + { + return handle.Language; + } + set + { + Log.Info(string.Format("Language is changed from {0} to {1}", handle.Language, value)); + handle.Language = value; + } + } + + /// + /// Gets or sets the maximum result count for each service request. + /// + /// 3 + /// Setting negative value will not have any effect on MaxResults value + public int MaxResults + { + get + { + return handle.MaxResult; + } + set + { + Log.Info(string.Format("MaxResult is changed from {0} to {1}", handle.MaxResult, value)); + handle.MaxResult = value; + } + } + + /// + /// Gets or sets distance unit. + /// + /// 3 + public DistanceUnit Unit + { + get + { + return (DistanceUnit)handle.Unit; + } + set + { + Log.Info(string.Format("Unit is changed from {0} to {1}", handle.Unit, value)); + handle.Unit = (Interop.DistanceUnit)value; + } + } + + /// + /// Gets or sets preferred country. + /// + /// 3 + public string CountryCode + { + get + { + return handle.CountryCode; + } + set + { + Log.Info(string.Format("CountryCode is changed from {0} to {1}", handle.CountryCode, value)); + handle.CountryCode = value; + } + } + + /// + /// Gets or sets search properties as key value pair. + /// + /// 3 + public IReadOnlyDictionary Properties + { + get + { + Action action = (key, value) => + { + _properties[key] = value; + }; + + handle.ForeachProperty(action); + return (IReadOnlyDictionary)_properties; + } + set + { + foreach (var prop in value) + { + _properties[prop.Key] = prop.Value; + handle.SetProperty(prop.Key, prop.Value); + Log.Info(string.Format("Properties is changed to [{0}, {1}]", prop.Key, prop.Value)); + } + } + } + + /// + /// Gets or sets route optimization. + /// + /// 3 + public RouteOptimization Optimization + { + get + { + return (RouteOptimization)handle.Optimization; + } + set + { + Log.Info(string.Format("Optimization is changed from {0} to {1}", handle.Optimization, value)); + handle.Optimization = (Interop.RouteOptimization)value; + } + } + + /// + /// Gets or sets route transport mode. + /// + /// 3 + public TransportMode Mode + { + get + { + return (TransportMode)handle.TransportMode; + } + set + { + Log.Info(string.Format("TransportMode is changed from {0} to {1}", handle.TransportMode, value)); + handle.TransportMode = (Interop.RouteTransportMode)value; + } + } + + /// + /// Gets or sets route feature weight. + /// + /// 3 + public RouteFeatureWeight RouteFeatureWeight + { + get + { + return (RouteFeatureWeight)handle.FeatureWeight; + } + set + { + Log.Info(string.Format("RouteFeatureWeight is changed from {0} to {1}", handle.FeatureWeight, value)); + handle.FeatureWeight = (Interop.RouteFeatureWeight)value; + } + } + + /// + /// Gets or sets route feature. + /// + /// 3 + public RouteFeature RouteFeature + { + get + { + return (RouteFeature)handle.Feature; + } + set + { + Log.Info(string.Format("RouteFeature is changed from {0} to {1}", handle.Feature, value)); + handle.Feature = (Interop.RouteRequestFeature)value; + } + } + + /// + /// Gets or sets if searching for alternative routes is enabled. + /// + /// 3 + public bool SearchAlternativeRoutes + { + get + { + return handle.AlternativesEnabled; + } + set + { + Log.Info(string.Format("SearchAlternativeRoutes is {0}", (value ? "enabled" : "disabled"))); + handle.AlternativesEnabled = value; + } + } + + #region IDisposable Support + private bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + handle.Dispose(); + _disposedValue = true; + } + } + + /// + /// Releases all resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/ServiceData.cs b/src/Tizen.Maps/Tizen.Maps/ServiceData.cs new file mode 100755 index 0000000..511a562 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/ServiceData.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Features available in the Map Service + /// + /// 3 + public enum ServiceData + { + /// + /// Indicates availability of address value in the Place data. + /// + PlaceAddress = Interop.ServiceData.PlaceAddress, + /// + /// Indicates availability of rating value in the Place data. + /// + PlaceRating = Interop.ServiceData.PlaceRating, + /// + /// Indicates availability of place category list in the Place data. + /// + PlaceCategories = Interop.ServiceData.PlaceCategories, + /// + /// Indicates availability of place attribute list in the Place data. + /// + PlaceAttributes = Interop.ServiceData.PlaceAttributes, + /// + /// Indicates availability of place contact list in the Place data. + /// + PlaceContacts = Interop.ServiceData.PlaceContacts, + /// + /// Indicates availability of place editorial list in the Place data. + /// + PlaceEditorials = Interop.ServiceData.PlaceEditorials, + /// + /// Indicates availability of place review list in the Place data. + /// + PlaceReviews = Interop.ServiceData.PlaceReviews, + /// + /// Indicates availability of place image in Place the data. + /// + PlaceImage = Interop.ServiceData.PlaceImage, + /// + /// Indicates availability of place supplier link value in the Place data. + /// + PlaceSupplier = Interop.ServiceData.PlaceSupplier, + /// + /// Indicates availability of related place link in the Place data. + /// + PlaceRelated = Interop.ServiceData.PlaceRelated, + + /// + /// Indicates that the Route Data Structure is defined as a Path (a list of geographical coordinates). + /// + RoutePath = Interop.ServiceData.RoutePath, + /// + /// Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a Path. + /// + RouteSegmentsPath = Interop.ServiceData.RouteSegmentsPath, + /// + /// Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a list of Maneuvers. + /// + RouteSegmentsManeuvers = Interop.ServiceData.RouteSegmentsManeuvers, + + /// + /// Indicates availability of traffic information on the Map. + /// + ViewTraffic = Interop.ServiceData.ViewTraffic, + /// + /// Indicates availability of public transit information on the Map. + /// + ViewPublicTransit = Interop.ServiceData.ViewPublicTransit, + /// + /// Indicates availability of 3D building drawable on the Map. + /// + ViewBuilding = Interop.ServiceData.ViewBuilding, + /// + /// Indicates availability of scale bar on the Map. + /// + ViewScaleBar = Interop.ServiceData.ViewScaleBar, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/ServiceRequestType.cs b/src/Tizen.Maps/Tizen.Maps/ServiceRequestType.cs new file mode 100755 index 0000000..5855b52 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/ServiceRequestType.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Service Requests available in the Maps Service + /// + /// 3 + public enum ServiceRequestType + { + /// + /// Indicates that service request to get position for a given free-formed address string is allowed. + /// + Geocode = Interop.ServiceType.Geocode, + /// + /// Indicates that service request to get position for a given address, within the specified bounding , is allowed. + /// + GeocodeInsideArea = Interop.ServiceType.GeocodeInsideArea, + /// + /// Indicates that service request to get position for a given is allowed. + /// + GeocodeByStructuredAddress = Interop.ServiceType.GeocodeByStructuredAddress, + /// + /// Indicates that service request to get for a given is allowed. + /// + ReverseGeocode = Interop.ServiceType.ReverseGeocode, + /// + /// Indicates that service request to get for a given is allowed. + /// + MultiReverseGeocode = Interop.ServiceType.MultiReverseGeocode, + + /// + /// Indicates that service request to query information for a given is allowed. + /// + SearchPlace = Interop.ServiceType.SearchPlace, + /// + /// Indicates that service request to query information for a given is allowed. + /// + SearchPlaceByArea = Interop.ServiceType.SearchPlaceByArea, + /// + /// Indicates that service request to query information for a given free-formed address string is allowed. + /// + SearchPlaceByAddress = Interop.ServiceType.SearchPlaceByAddress, + /// + /// Indicates that service request to query information list for all places in a given is allowed. + /// + SearchPlaceList = Interop.ServiceType.SearchPlaceList, + /// + /// Indicates that service request to get detailed information for a given is allowed. + /// + SearchGetPlaceDetails = Interop.ServiceType.SearchGetPlaceDetails, + + /// + /// Indicates that service request to query information from a given origin and destination is allowed. + /// + SearchRoute = Interop.ServiceType.SearchRoute, + /// + /// Indicates that service request to query information passing through specified way-points is allowed. + /// + SearchRouteWithWaypoints = Interop.ServiceType.SearchRouteWaypoints, + + /// + /// Indicates that map view service is allowed. + /// + View = Interop.ServiceType.View, + /// + /// Indicates that map view snapshot service is allowed. + /// + ViewSnapshot = Interop.ServiceType.ViewSnapshot, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/SnapshotType.cs b/src/Tizen.Maps/Tizen.Maps/SnapshotType.cs new file mode 100755 index 0000000..03c7952 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/SnapshotType.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Enumeration for snapshot file formats + /// + /// 3 + public enum SnapshotType + { + /// + /// Indicates BMP file format. + /// + BMP = Interop.ViewSnapshotFormatType.ViewSnapshotBmp, + /// + /// Indicates JPEG file format. + /// + JPEG = Interop.ViewSnapshotFormatType.ViewSnapshotJpeg, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/TransportMode.cs b/src/Tizen.Maps/Tizen.Maps/TransportMode.cs new file mode 100755 index 0000000..762e31e --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/TransportMode.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Route types + /// + /// 3 + public enum TransportMode + { + /// + /// Indicates that route is to be traveled by car. + /// + Car = Interop.RouteTransportMode.Car, + /// + /// Indicates that route is for a pedestrian. + /// + Pedestrian = Interop.RouteTransportMode.Pedestrian, + /// + /// Indicates that route is for a cyclist. + /// + Bicycle = Interop.RouteTransportMode.Bicycle, + /// + /// Indicates that route is to be traveled using public transport. + /// + PublicTransit = Interop.RouteTransportMode.PublicTransit, + /// + /// Indicates that route is for a truck. + /// + Truck = Interop.RouteTransportMode.Truck, + } +} diff --git a/src/Tizen.Maps/Tizen.Maps/TurnInstruction.cs b/src/Tizen.Maps/Tizen.Maps/TurnInstruction.cs new file mode 100755 index 0000000..d01de95 --- /dev/null +++ b/src/Tizen.Maps/Tizen.Maps/TurnInstruction.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Maps +{ + /// + /// Turn Instruction type for route maneuver + /// + /// 3 + public enum TurnInstruction + { + /// + /// Indicates unknown instruction. + /// + None = Interop.RouteTurnType.None, + /// + /// Indicates instruction to move straight. + /// + Straight = Interop.RouteTurnType.Straight, + /// + /// Indicates instruction to bear right. + /// + BearRight = Interop.RouteTurnType.BearRight, + /// + /// Indicates instruction to turn slightly to the right. + /// + LightRight = Interop.RouteTurnType.LightRight, + /// + /// Indicates instruction to turn right. + /// + Right = Interop.RouteTurnType.Right, + /// + /// Indicates instruction to turn hard to the right. + /// + HardRight = Interop.RouteTurnType.HardRight, + /// + /// Indicates instruction to u-turn to the right. + /// + UturnRight = Interop.RouteTurnType.UturnRight, + /// + /// Indicates instruction to u-turn to the left. + /// + UturnLeft = Interop.RouteTurnType.UturnLeft, + /// + /// Indicates instruction to turn hard to the left. + /// + HardLeft = Interop.RouteTurnType.HardLeft, + /// + /// Indicates instruction to turn left. + /// + Left = Interop.RouteTurnType.Left, + /// + /// Indicates instruction to turn slightly to the left. + /// + LightLeft = Interop.RouteTurnType.LightLeft, + /// + /// Indicates instruction to bear left. + /// + BearLeft = Interop.RouteTurnType.BearLeft, + /// + /// Indicates instruction to take right fork. + /// + RightFork = Interop.RouteTurnType.RightFork, + /// + /// Indicates instruction to take left fork. + /// + LeftFork = Interop.RouteTurnType.LeftFork, + /// + /// Indicates instruction to take straight fork. + /// + StraightFork = Interop.RouteTurnType.StraightFork, + } +} diff --git a/src/Tizen.Maps/res/maps_marker_pin_48.png b/src/Tizen.Maps/res/maps_marker_pin_48.png new file mode 100755 index 0000000000000000000000000000000000000000..a07d693cf779352a13de5703a12a6f5f69ce74be GIT binary patch literal 1185 zcmV;S1YY}zP)7N;nuv8anc`&B5Y39(N~RFs%eq+I)kMX#9C<`ejMl{gUiB%2$r%EEw#g6?kIO*d z#mcTO)^;^JyawFvhUNkMECEh*HyffYVg`~wKP#G8DCuwr`H^(vgyt4J#d)IVxc60; z?Z*7Jj{I=tg!VUp_v3`Fs2jt#+AX_ z&SH*CU=y~1!A}yWPetY6_3MK|PYt?GSj@p(nXv7&CkH5ezyz_F%mGT)=-4qQ$7=6)v~j3Ms#AUmAG z{H%UJI&{B>M59IOK>1&Hz)4KS(jZJ7G6xDc4P}DTz^^#zU4p_(chQtZu-HdX9 zcBs%?OGgdaW7~Zx!L@jySk|Nf%Ht0`+mlbQcy4bj#vwDa9H6SngFzT=MJ+GUBFe0n^k@Ok66BSSx&?}(W33)C0X zqa$0SK7c}ZnLhS9^~I`9JxbasIM5N$Rf>#x7ORcSfXelw(m}?Ga@f{Vi1_W$fi2a$ zQ#U7Z78g%gok|E!Kqu?Qp_L8mW)5X-p4z=wk7_#Scn&G-2^ z0N@uEt^{)!e9r5;0oO@fBeAEb@lGSDoqFiK;ODE1Gfm(J8rIOTWI%mOB~6K5D;C#l zHeF_X_tZhK2$vg6v;(n=EpmGOvSo!F7^ln6yRjg5!0sKA04AeX{KnvuL4Xg;fj#t^ z0keGD{ZlQzW5&vOq07)6*i$oQR(7;~^oq~;j=@g{X)~1fEtC^4>2b@>2gE(oWhQ7_ zp}jD&>6MwsH(l0}FfZRguW|dcIFkQVehV-F<+udC?2zfdL?o4+aXHB(m#!;`c*O{N;O5pcW-i_1ps_!GReqhfWuOj19HKkmZ>g z66dW(K>-#zb$KmFkXCaGkOT*;c?a(S$bX`#X;Cw?NTe0S`fk0#-JI(*tM1pi+Dk(?>3wnJC zaKM&lPiF@X1am_NVs43a6PW=d*#omGL!oCLYIP0SX$W+HE(B7UbWGpGo`A4XaC z43g|AQ`8dA5BrG{z{2E{zV-AKcp#{%0SH)>k)-=KJNKog-BwKvT{D z3fY4QasIT=PXr%+R1AJ}{TN%~3Rrdc-Wx*v{Rcadyt7{n7rHDKaedIGaDBxE$CGAs z>WlALx(XAot~yC%NJdtyusE`O~UWJM%{4i{b(!Ealv#qAG! z#qh^7aWiZVgJ!}+jO&;Ou3WbV4wr`${90FBCg3|Y>sHU zUvL3XStS&l@`ZfT#n<0*mglIk8O$8%FsNh|Ao4$>p^3#F{FQ0DrgfhOpyr4RQ0L)} z(>+;ZP$@D&yeB+8=R8~H&Y|5y$tFPKreWE&B$#8|IzW#Uc}_Gf;moDogH?d|O1tzu zDb7_8edz;~20%4cI`HEUj8a8f!kJ6EhnjVOn#}bQ$`r0e&B0jRH-#I3R7XW*yEjI8 z;W)C$u)Hxj>+&pLnFItm8 zY(LSub;BAs7>irL*K}TSnJ6xW&aT1SNNs+2QSD45cFK~C7>gUZGzY!p3?SN>R8K(L z){TF25}@YWvqt$5zJu?YM8<86J>1<@lYKF)f;aIVO#-G3QfhB(dai4^0+Gr$Fe#lq zKmF5wm=n$cB9K%k8LEqDH%TO@3O-IR7R_L znrK1U_kpMOzw;(AEdmE(+>V#%&Lor2!8J3ay3733dJ?+^18Gus_uHn0?)=%T>Oo*p z4T@|u@>5#c=ybi-LZ+LFjV4a)4xr;>6kTTMHp^0we(W^cerGD_*^b1IofJ^f0g7?6 zY@33)cRK5>MH>fStlf=d5*o;_s$?UBp2bK{BEY$3V_e&v_GojPPrK_CQ54A__5UDS zUa&Q`i?bRkvK1+^4LP>B21P92Ld0_7gHDKSRVe&(=czgi=h__Aq!B9>21PS%E6b4+ z1kIV0q#9?+SuiNfw9zbC#|>;c$dNFn2F{cVaGWtnV-h;K)OiV;Yc_3-1(~&dMl3ae z2&8#o@yLR$BL=wvNDu#b4}WAD{v%D{R>OIw07b*UNsbiBb*zW;RGoCU@W0vcSm8hN z9Vg*Da|UVQAE$)IIpJRm=UAOjx{6p?GbjxIvz+iB3FotEf|ELfG$xg)L?Rw^C?*ol z*(Y^+jzJoeDxn{Vlqimb^GM0Gl7+6B7D@GU_WBl5WUI#NIryFe=zb*<-V~= zM*(c|M){4B2oG`X{HV$IvKQ`wdx=n$&mnHu&A@Vk>A{7OA50#fpLqid*x;+tc=DuL z-2Z4hghZ-5%tkX@E3gnl<8cVEbY-#@D|0~Cg9h5t)QtOb` z!982Y}yv619yC z2pbjh=8%&L=yHe&PUJVxttus_Ey92jHdf&z3#C2|F(m<%0}I*4DJW|QE=mF})$;@2 zz`XN(Pg%o?i-%1P=EhP$fSv$O#!|rVrnC7&1&DUf5-1Oxg0hAcmtg`*eGT|fptf-e z${K=8Nl8GjOR{`=yf8y;V;7h!EAIL@&;^LXsRZ{x25Mnu2IgR{w4m#9DA_6I3aADt zL>|9Z6QMFka46V02ezY%lG`4UFuJ6c zBh?q$A$wMhY z1`-5;TYD(#VwZv_v}>2_Vuvo-rCVaRF4?7nU9wBJKuH3-xR-(s)(Sx(K?R`&6$|#~ z*6udXFjM2EIWyloyQ|Iv!&k!2%=>)L`_9Ze@5fj`KtMo1KtRCeL{yDI(*vVD{DIcZ zTPtrV`P7l)Ei0e1yk%x?ozHAYf;b^CzK^$F`HX{c-X`$mgyq&XL7bRQ{uq*^{831v zzL_Ok+F7!(jU~5kV^Kqk_?wPm{tGKDEwaM*&#dt66Duq(h`*I73}g*+qTZ}4f}~$+ zEj(kt_)}99NE)k2f~0D0s~7|K*|PH>IWa2{_2brMag>BxaWjWPc;A)eVcp0N`<^~xubDOim1o|DIf zWPM|e!6$Q2|Ho=^{K!d@rl4tYllW5@R-*b&}qSKG?dc=f5o9`R%7)LfCh zUyQ%w{>p>4#BS3Au8o3*)Y&QyIn6v|T{xWJ^5YoqR2M(#8D62=<2bAAjt(F=gPyPv-@c(GLA*2tC+~=s637fpqT3?-N{kv zLmwvUTTMkW)uIx3WXn782n^S2MO)ZHG(=moYS3Qe+CU4bZO3 zFvU5}Bv4Z-Xj3B)6bSN9kT}qlUG=UB%6ty>Seh*)hgESKfIu6`uFbJ7{~UjgrD8Q( zGO-C#Wp4;HvQNuTL5kCGB`GvHzf(xlY5bl;75&4zKxeGqB_ zMP--kGJGvVM-uvST_H6aCMXF4+c`+nB^If8acMH1yWzJ3_lnMOO{;Uvkt#@L|3!zm zrHr$oJ9D?-WFUTn-^STnX>&KOkhQrN8|JMa_eyvZuD2Ud0bJzHOyw^QwR*;3Ob%(TEfR;hdtd^oEnP>Up$ z%`M9;N?x3UbXmX-MV#xAq?#!MUWufQSV*3XJE?`4$@d-UQ&aq(hxp8P{QUTm(;kUp zrAh)z`S;h;kdTTwr)%O<1WifdV-`cA!sk$iY6>6J84%UU!Y7%=iV7d~S`gO5*2!n# l0RaI40RaI4n-#wW7yz>a$w_}n%WMDu002ovPDHLkV1oS`kfZ + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push.sln b/src/Tizen.Messaging.Push/Tizen.Messaging.Push.sln new file mode 100755 index 0000000..6a2d5e4 --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Messaging.Push", "Tizen.Messaging.Push.csproj", "{B31AE42B-4C42-468E-8C1A-AAB11564EDD8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{0C7D8B15-AE88-4AA4-9692-CD49CE9FEFED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{6A5AD3AA-AFF5-472F-BE3F-8D82A2BB51D7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B31AE42B-4C42-468E-8C1A-AAB11564EDD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B31AE42B-4C42-468E-8C1A-AAB11564EDD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B31AE42B-4C42-468E-8C1A-AAB11564EDD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B31AE42B-4C42-468E-8C1A-AAB11564EDD8}.Release|Any CPU.Build.0 = Release|Any CPU + {0C7D8B15-AE88-4AA4-9692-CD49CE9FEFED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C7D8B15-AE88-4AA4-9692-CD49CE9FEFED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C7D8B15-AE88-4AA4-9692-CD49CE9FEFED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C7D8B15-AE88-4AA4-9692-CD49CE9FEFED}.Release|Any CPU.Build.0 = Release|Any CPU + {6A5AD3AA-AFF5-472F-BE3F-8D82A2BB51D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A5AD3AA-AFF5-472F-BE3F-8D82A2BB51D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A5AD3AA-AFF5-472F-BE3F-8D82A2BB51D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A5AD3AA-AFF5-472F-BE3F-8D82A2BB51D7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushClient.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushClient.cs new file mode 100644 index 0000000..3e9dd90 --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushClient.cs @@ -0,0 +1,191 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Messaging.Push +{ + /// + /// The PushClient API provides functions to connect to push service for receiving push messages. + /// + /// 3 + /// + /// The PushClient API provides the way to connect with the push service. + /// It provides APIs to connect/disconnect from the push service. + /// APIs are provided so that an application can register itself + /// with the push server along with APIs to request push message. + /// + /// + /// + /// public class Program + /// { + /// static void Main(string[] args) + /// { + /// PushClient.PushServiceConnect("xxxxx"); + /// Task tr = PushClient.PushServerRegister(); + /// tr.GetAwaiter().OnCompleted(() => { + /// ServerResponse res = tr.Result; + /// PushClient.GetUnreadNotifications(); + /// Task tu = PushClient.PushServerUnregister(); + /// tu.GetAwaiter().OnCompleted(() => { + /// PushClient.PushServiceDisconnect(); + /// }); + /// }); + /// PushClient.NotificationReceived += EventHandlerNotificationReceived; + /// PushClient.StateChanged += EventHandlerStateChanged; + /// } + /// } + /// static void EventHandlerNotificationReceived(object sender, PushMessageEventArgs e) + /// { + /// // any user code + /// } + /// static void EventHandlerStateChanged(object sender, PushConnectionStateEventArgs e) + /// { + /// // any user code + /// } + /// + /// + public static class PushClient + { + /// + /// Event Handler for receiving the notifications. + /// + /// 3 + public static event EventHandler NotificationReceived + { + add + { + lock (_lock) + { + _notificationReceived += value; + } + } + remove + { + lock (_lock) + { + _notificationReceived -= value; + } + } + } + + /// + /// Event Handler for receiving changes in States of the connection. + /// + /// 3 + public static event EventHandler StateChanged + { + add + { + lock (_lock) + { + _stateChanged += value; + } + } + remove + { + lock (_lock) + { + _stateChanged -= value; + } + } + } + + /// + /// API to connect with the push service. + /// + /// 3 + /// http://tizen.org/privilege/push + /// In case of privilege not defined. + /// The Push Application ID Registered with the server. + public static void PushServiceConnect(string pushAppId) + { + PushImpl.Instance.PushServiceConnect(pushAppId); + } + + /// + /// API to disconnect from the push service. + /// + /// 3 + public static void PushServiceDisconnect() + { + PushImpl.Instance.PushServiceDisconnect(); + //PushImpl.Reset(); + } + + + /// + /// API to Register the application with the push server. + /// + /// 3 + /// + /// The method returns a task, which on completion will give a ServerResponse Object. + /// + public static Task PushServerRegister() + { + return PushImpl.Instance.PushServerRegister(); + } + + /// + /// API to Deregister the application from the push server. + /// + /// 3 + /// + /// The method returns a task, which on completion will give a ServerResponse Object. + /// + public static Task PushServerUnregister() + { + return PushImpl.Instance.PushServerUnregister(); + } + + /// + /// Gets the unread notifications for the application. + /// + /// 3 + public static void GetUnreadNotifications() + { + PushImpl.Instance.GetUnreadNotifications(); + } + + /// + /// registration ID received from server. + /// 3 + /// + /// It is the string, which is the ID received from the server. + /// + public static string GetRegistrationId() + { + return PushImpl.Instance.GetRegistrationId(); + } + + internal static void StateChange(PushConnectionStateEventArgs args) + { + if (_stateChanged != null) + _stateChanged(null, args); + } + + internal static void Notify(PushMessageEventArgs args) + { + if (_notificationReceived != null) + _notificationReceived(null, args); + } + + private static object _lock = new object(); + private static event EventHandler _notificationReceived; + private static event EventHandler _stateChanged; + } +} diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushConnectionStateEventArgs.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushConnectionStateEventArgs.cs new file mode 100644 index 0000000..d0983f5 --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushConnectionStateEventArgs.cs @@ -0,0 +1,85 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Push +{ + /// + /// An extended EventArgs class, which contains the State Information. + /// + /// 3 + public class PushConnectionStateEventArgs : EventArgs + { + /// + /// Enumeration for the different states. + /// + /// 3 + public enum PushState + { + /// + /// Registered with the Server. + /// + Registered = 0, + /// + /// Unregistered. + /// + Unregistered = 1, + /// + /// To change the provisioning server IP. + /// + ProvisioningIPChanged = 2, + /// + /// Ping interval is changing. + /// + PingChanged = 3, + /// + /// Error Occured in Changing State. + /// + StateError = 4 + } + + /// + /// Gives the current state. + /// + /// 3 + /// + /// It is the current state. + public PushState State + { + get; + internal set; + } + + /// + /// Gives information about the error if set. + /// + /// 3 + /// + /// It is the string, which contains the error string if set. + public string Error + { + get; + internal set; + } + + internal PushConnectionStateEventArgs(PushState state, string error) + { + State = state; + Error = error; + } + } +} diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs new file mode 100644 index 0000000..465e661 --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushExceptionFactory.cs @@ -0,0 +1,83 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Tizen.Messaging.Push +{ + class PushExceptionFactory + { + internal static Exception CreateResponseException(Interop.PushClient.ServiceError result) + { + Exception exp; + switch (result) + { + case Interop.PushClient.ServiceError.OutOfMemory: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.OutOfMemory"); + exp = new InvalidOperationException("Memory Not Sufficient for the current operation"); + break; + } + case Interop.PushClient.ServiceError.InvalidParameter: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.InvalidParameter"); + exp = new InvalidOperationException("The Parameter Passed was Invalid or Invalid Operation Intented"); + break; + } + case Interop.PushClient.ServiceError.NotConnected: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.NotConnected"); + exp = new InvalidOperationException("Not Connected to Server"); + break; + } + case Interop.PushClient.ServiceError.NoData: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.NoData"); + exp = new InvalidOperationException("No Data"); + break; + } + case Interop.PushClient.ServiceError.OpearationFailed: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.OpearationFailed"); + exp = new InvalidOperationException("Operation Failed"); + break; + } + case Interop.PushClient.ServiceError.PermissionDenied: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.PermissionDenied"); + exp = new InvalidOperationException("Permission Denied"); + break; + } + case Interop.PushClient.ServiceError.NotSupported: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Interop.PushClient.ServiceError.NotSupported"); + exp = new InvalidOperationException("Not Supported"); + break; + } + default: + { + Tizen.Log.Error(Interop.PushClient.LogTag, "Creating Exception for Default case for error code " + result); + exp = new Exception(); + break; + } + } + return exp; + } + } +} diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs new file mode 100644 index 0000000..2c49734 --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushImpl.cs @@ -0,0 +1,243 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using Tizen; + +namespace Tizen.Messaging.Push +{ + internal class PushImpl + { + private static readonly object _lock = new object(); + private static PushImpl _instance; + + internal static PushImpl Instance + { + get + { + lock (_lock) + { + if (_instance == null) + { + Log.Info(Interop.PushClient.LogTag, "Creating New Instance"); + _instance = new PushImpl(); + } + } + return _instance; + } + } + + internal PushImpl() + { + //Empty + } + + private IntPtr _connection; + + internal void PushServiceConnect(string pushAppId) + { + Interop.PushClient.VoidStateChangedCallback stateDelegate = (int state, string err, IntPtr userData) => + { + if (err == null) + { + err = ""; + } + PushConnectionStateEventArgs args = new PushConnectionStateEventArgs((PushConnectionStateEventArgs.PushState)state, err); + PushClient.StateChange(args); + }; + Interop.PushClient.VoidNotifyCallback notifyDelegate = (IntPtr notification, IntPtr userData) => + { + Interop.PushClient.ServiceError result; + PushMessageEventArgs ob = new PushMessageEventArgs(); + string data; + result = Interop.PushClient.GetNotificationData(notification, out data); + if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(data))) + { + ob.AppData = data; + } + else + { + ob.AppData = ""; + } + string message; + result = Interop.PushClient.GetNotificationMessage(notification, out message); + if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(message))) + { + ob.Message = message; + } + else + { + ob.Message = ""; + } + string sender; + result = Interop.PushClient.GetNotificationSender(notification, out sender); + if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(sender))) + { + ob.Sender = sender; + } + else + { + ob.Sender = ""; + } + string sessioninfo; + result = Interop.PushClient.GetNotificationSessionInfo(notification, out sessioninfo); + if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(sessioninfo))) + { + ob.SessionInfo = sessioninfo; + } + else + { + ob.SessionInfo = ""; + } + string requestid; + result = Interop.PushClient.GetNotificationRequestId(notification, out requestid); + if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(requestid))) + { + ob.RequestId = requestid; + } + else + { + ob.RequestId = ""; + } + int time; + result = Interop.PushClient.GetNotificationTime(notification, out time); + DateTime utc; + if ((result == Interop.PushClient.ServiceError.None) && (time != 0)) + { + Log.Info(Interop.PushClient.LogTag, "Ticks received: " + time); + utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc); + ob.ReceivedAt = utc.ToLocalTime(); + } + else + { + Log.Info(Interop.PushClient.LogTag, "No Date received"); + ob.ReceivedAt = DateTime.Now; + } + int type = -1; + result = Interop.PushClient.GetNotificationType(notification, out type); + if (result == Interop.PushClient.ServiceError.None) + { + ob.Type = type; + } + PushClient.Notify(ob); + //Interop.PushClient.FreeNotification(notification); + Log.Info(Interop.PushClient.LogTag, "Free Notification Done"); + }; + Interop.PushClient.ServiceError connectResult = Interop.PushClient.ServiceConnect(pushAppId, stateDelegate, notifyDelegate, IntPtr.Zero, out _connection); + if (connectResult != Interop.PushClient.ServiceError.None) + { + Log.Error(Interop.PushClient.LogTag, "Connect failed with " + connectResult); + throw PushExceptionFactory.CreateResponseException(connectResult); + } + } + + internal void PushServiceDisconnect() + { + Interop.PushClient.ServiceDisconnect(_connection); + Log.Info(Interop.PushClient.LogTag, "PushServiceDisconnect Completed"); + } + + internal async Task PushServerRegister() + { + Log.Info(Interop.PushClient.LogTag, "Register Called"); + var task = new TaskCompletionSource(); + Interop.PushClient.VoidResultCallback registerResult = (Interop.PushClient.Result regResult, IntPtr msgPtr, IntPtr userData) => + { + Log.Info(Interop.PushClient.LogTag, "Register Callback Called"); + string msg = ""; + if (msgPtr != IntPtr.Zero) + { + msg = Marshal.PtrToStringAnsi(msgPtr); + } + ServerResponse response = new ServerResponse(); + response.ServerResult = (ServerResponse.Result)regResult; + response.ServerMessage = msg; + if (task.TrySetResult(response) == false) + { + Log.Error(Interop.PushClient.LogTag, "Unable to set the Result for register"); + } + }; + Interop.PushClient.ServiceError result = Interop.PushClient.ServiceRegister(_connection, registerResult, IntPtr.Zero); + Log.Info(Interop.PushClient.LogTag, "Interop.PushClient.ServiceRegister Completed"); + if (result != Interop.PushClient.ServiceError.None) + { + Log.Error(Interop.PushClient.LogTag, "Register failed with " + result); + task.SetException(PushExceptionFactory.CreateResponseException(result)); + } + return await task.Task; + } + + internal async Task PushServerUnregister() + { + var task = new TaskCompletionSource(); + Interop.PushClient.VoidResultCallback registerResult = (Interop.PushClient.Result regResult, IntPtr msgPtr, IntPtr userData) => + { + Log.Info(Interop.PushClient.LogTag, "Unregister Callback Called"); + string msg = ""; + if (msgPtr != IntPtr.Zero) + { + msg = Marshal.PtrToStringAnsi(msgPtr); + } + ServerResponse response = new ServerResponse(); + response.ServerResult = (ServerResponse.Result)regResult; + response.ServerMessage = msg; + if (task.TrySetResult(response) == false) + { + Log.Error(Interop.PushClient.LogTag, "Unable to set the Result for Unregister"); + } + }; + Interop.PushClient.ServiceError result = Interop.PushClient.ServiceDeregister(_connection, registerResult, IntPtr.Zero); + if (result != Interop.PushClient.ServiceError.None) + { + task.SetException(PushExceptionFactory.CreateResponseException(result)); + } + return await task.Task; + } + + internal string GetRegistrationId() + { + string regID = ""; + Interop.PushClient.ServiceError result = Interop.PushClient.GetRegistrationId(_connection, out regID); + if (result != Interop.PushClient.ServiceError.None) + { + throw PushExceptionFactory.CreateResponseException(result); + } + Log.Info(Interop.PushClient.LogTag, "Returning Reg Id: " + regID); + return regID; + } + + internal void GetUnreadNotifications() + { + Interop.PushClient.ServiceError result = Interop.PushClient.RequestUnreadNotification(_connection); + if (result != Interop.PushClient.ServiceError.None) + { + throw PushExceptionFactory.CreateResponseException(result); + } + } + + internal static void Reset() + { + lock (_lock) + { + Log.Info(Interop.PushClient.LogTag, "Making _instance as null"); + _instance = null; + } + } + } +} diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushMessageEventArgs.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushMessageEventArgs.cs new file mode 100644 index 0000000..eba6c0e --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/PushMessageEventArgs.cs @@ -0,0 +1,121 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Push +{ + /// + /// An extended EventArgs class, which contains the message received. + /// + /// 3 + public class PushMessageEventArgs : EventArgs + { + /// + /// Gives the Application Data recieved. + /// 3 + /// + /// It is the string, which stores the application data. + public string AppData + { + get; + internal set; + } + + /// + /// Gives the Message Received Field. + /// + /// 3 + /// + /// It is the string, which stores the message field. + public string Message + { + get; + internal set; + } + + /// + /// Gives the time at which the Notification was received. + /// + /// 3 + /// + /// It is the DateTime field representing the time at which the Notification was received. + public DateTime ReceivedAt + { + get; + internal set; + } + + /// + /// Gives the Sender of the notification. + /// + /// 3 + /// + /// It is a string value representing the Sender of the Notification. + public string Sender + { + get; + internal set; + } + + /// + /// Gives the session ID of the notification. + /// + /// 3 + /// + /// It is a string value representing the session ID of the Notification. + public string SessionInfo + { + get; + internal set; + } + + /// + /// Gives the request ID of the notification. + /// + /// 3 + /// + /// It is a string value representing the request ID of the Notification. + public string RequestId + { + get; + internal set; + } + + /// + /// Gives the value in the type field of the notification. + /// + /// 3 + /// + /// It is an integer value representing the type field of the notification. + public int Type + { + get; + internal set; + } + + internal PushMessageEventArgs() + { + // Giving Default Values + AppData = ""; + Message = ""; + ReceivedAt = new DateTime(); + Sender = ""; + SessionInfo= ""; + RequestId = ""; + } + } +} diff --git a/src/Tizen.Messaging.Push/Tizen.Messaging.Push/ServerResponse.cs b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/ServerResponse.cs new file mode 100644 index 0000000..e0d895b --- /dev/null +++ b/src/Tizen.Messaging.Push/Tizen.Messaging.Push/ServerResponse.cs @@ -0,0 +1,73 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Push +{ + /// + /// The ServerResponse structure provides the result and the server response if any. + /// + /// 3 + public struct ServerResponse + { + /// + /// Enumeration for the Result from the server. + /// + /// 3 + public enum Result + { + /// + /// Successful. + /// + Success = 0, + /// + /// Time Out Occured. + /// + Timeout = 1, + /// + /// Server Error Occured. + /// + ServerError = 2, + /// + /// System Error Occured. + /// + SystemError = 3 + } + + /// + /// Gives the Result of the opeartion. + /// + /// 3 + /// + /// It is the Result state of the operation performed. + public Result ServerResult + { + get; + internal set; + } + + /// + /// Gives the Message from the server. + /// + /// 3 + /// + /// It is the Message sent by the server. + public string ServerMessage + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Messaging/Interop/Interop.Email.cs b/src/Tizen.Messaging/Interop/Interop.Email.cs new file mode 100755 index 0000000..28601a9 --- /dev/null +++ b/src/Tizen.Messaging/Interop/Interop.Email.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum EmailRecipientType + { + To = 1, + Cc = 2, + Bcc = 3 + } + + internal static partial class Email + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EmailSentCallback(IntPtr handle, int result, IntPtr userData); + + [DllImport(Libraries.Email, EntryPoint = "email_create_message")] + internal static extern int CreateEmail(out IntPtr EmailHandle); + + [DllImport(Libraries.Email, EntryPoint = "email_destroy_message")] + internal static extern int DestroyEmail(IntPtr EmailHandle); + + [DllImport(Libraries.Email, EntryPoint = "email_set_subject")] + internal static extern int SetSubject(IntPtr EmailHandle, string text); + + [DllImport(Libraries.Email, EntryPoint = "email_set_body")] + internal static extern int SetBody(IntPtr EmailHandle, string text); + + [DllImport(Libraries.Email, EntryPoint = "email_add_recipient")] + internal static extern int AddRecipient(IntPtr EmailHandle, int type, string text); + + [DllImport(Libraries.Email, EntryPoint = "email_remove_all_recipients")] + internal static extern int RemoveRecipient(IntPtr EmailHandle); + + [DllImport(Libraries.Email, EntryPoint = "email_add_attach")] + internal static extern int AddAttachment(IntPtr EmailHandle, string text); + + [DllImport(Libraries.Email, EntryPoint = "email_remove_all_attachments")] + internal static extern int RemoveAttachments(IntPtr EmailHandle); + + [DllImport(Libraries.Email, EntryPoint = "email_save_message")] + internal static extern int SaveEmail(IntPtr EmailHandle); + + [DllImport(Libraries.Email, EntryPoint = "email_send_message")] + internal static extern int SendEmail(IntPtr EmailHandle, bool SaveToSentBox); + + [DllImport(Libraries.Email, EntryPoint = "email_set_message_sent_cb")] + internal static extern int SetCb(IntPtr EmailHandle, EmailSentCallback Cb, IntPtr UserData); + + [DllImport(Libraries.Email, EntryPoint = "email_unset_message_sent_cb")] + internal static extern int UnsetCb(IntPtr EmailHandle); + } +} diff --git a/src/Tizen.Messaging/Interop/Interop.Libraries.cs b/src/Tizen.Messaging/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..64170be --- /dev/null +++ b/src/Tizen.Messaging/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Messages = "libcapi-messaging-messages.so.0"; + public const string Email = "libcapi-messaging-email.so.0"; + } +} diff --git a/src/Tizen.Messaging/Interop/Interop.Messages.cs b/src/Tizen.Messaging/Interop/Interop.Messages.cs new file mode 100755 index 0000000..7697262 --- /dev/null +++ b/src/Tizen.Messaging/Interop/Interop.Messages.cs @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Messages + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MessageIncomingCallback(IntPtr messageHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MessageSentCallback(int result, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool MessageSearchCallback(IntPtr messageHandle, int index, int resultCount, int totalCount, IntPtr userData); + + [DllImport(Libraries.Messages, EntryPoint = "messages_open_service")] + internal static extern int OpenService(out IntPtr serviceHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_close_service")] + internal static extern int CloseService(IntPtr serviceHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_create_message")] + internal static extern int CreateMessage(int type, out IntPtr messageHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_destroy_message")] + internal static extern int DestroyMessage(IntPtr messageHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_message_id")] + internal static extern int GetMessageId(IntPtr messageHandle, out int messageId); + + [DllImport(Libraries.Messages, EntryPoint = "messages_set_sim_id")] + internal static extern int SetSimId(IntPtr messageHandle, int simId); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_sim_id")] + internal static extern int GetSimId(IntPtr messageHandle, out int simId); + + [DllImport(Libraries.Messages, EntryPoint = "messages_set_mbox_type")] + internal static extern int SetMboxType(IntPtr messageHandle, int mboxType); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_mbox_type")] + internal static extern int GetMboxType(IntPtr messageHandle, out int mboxType); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_message_port")] + internal static extern int GetMessagePort(IntPtr messageHandle, out int messagePort); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_message_type")] + internal static extern int GetMessageType(IntPtr messageHandle, out int messageType); + + [DllImport(Libraries.Messages, EntryPoint = "messages_set_text")] + internal static extern int SetText(IntPtr messageHandle, string text); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_text")] + internal static extern int GetText(IntPtr messageHandle, out string text); + + [DllImport(Libraries.Messages, EntryPoint = "messages_set_time")] + internal static extern int SetTime(IntPtr messageHandle, int time); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_time")] + internal static extern int GetTime(IntPtr messageHandle, out int time); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_set_subject")] + internal static extern int SetSubject(IntPtr messageHandle, string subject); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_get_subject")] + internal static extern int GetSubject(IntPtr messageHandle, out string subject); + + [DllImport(Libraries.Messages, EntryPoint = "messages_add_address")] + internal static extern int AddAddress(IntPtr messageHandle, string address, int type); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_address_count")] + internal static extern int GetAddressCount(IntPtr messageHandle, out int count); + + [DllImport(Libraries.Messages, EntryPoint = "messages_get_address")] + internal static extern int GetAddress(IntPtr messageHandle, int index, out string address, out int type); + + [DllImport(Libraries.Messages, EntryPoint = "messages_remove_all_addresses")] + internal static extern int RemoveAllAddress(IntPtr messageHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_add_attachment")] + internal static extern int AddAttachment(IntPtr messageHandle, int type, string path); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_get_attachment_count")] + internal static extern int GetAttachmentCount(IntPtr messageHandle, out int count); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_get_attachment")] + internal static extern int GetAttachment(IntPtr messageHandle, int index, out int type, out string path); + + [DllImport(Libraries.Messages, EntryPoint = "messages_mms_remove_all_attachments")] + internal static extern int RemoveAllAttachment(IntPtr messageHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_set_message_incoming_cb")] + internal static extern int SetMessageIncomingCb(IntPtr serviceHandle, MessageIncomingCallback cb, IntPtr userData); + + [DllImport(Libraries.Messages, EntryPoint = "messages_unset_message_incoming_cb")] + internal static extern int UnsetMessageIncomingCb(IntPtr serviceHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_send_message")] + internal static extern int SendMessage(IntPtr serviceHandle, IntPtr messageHandle, bool saveToSentbox, MessageSentCallback cb, IntPtr userData); + + [DllImport(Libraries.Messages, EntryPoint = "messages_search_message_by_id")] + internal static extern int GetMessageById(IntPtr serviceHandle, int msgId, out IntPtr messageHandle); + + [DllImport(Libraries.Messages, EntryPoint = "messages_foreach_message")] + internal static extern int SearchMessage(IntPtr serviceHandle, int mbox, int messageType, string textKeyword, string addressKeyword, int offset, int limit, MessageSearchCallback cb, IntPtr userData); + + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailAttachment.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailAttachment.cs new file mode 100644 index 0000000..5f8028a --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailAttachment.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Email +{ + /// + /// Represents an email attachment + /// + public class EmailAttachment + { + /// + /// The absolute full path of the file to be attached + /// + public string FilePath { get; set; } + /// + /// The constructor + /// + public EmailAttachment() + { + + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailEnumerations.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailEnumerations.cs new file mode 100755 index 0000000..fdeaa37 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailEnumerations.cs @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Messaging.Email +{ + /// + /// Result of sending the email + /// + public enum EmailSendResult + { + /// + /// Failed to send the message + /// + Failure = -1, + + /// + /// email sent successfully + /// + Success = 0 + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailErrorFactory.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailErrorFactory.cs new file mode 100755 index 0000000..90dbe54 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailErrorFactory.cs @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Messaging.Email +{ + internal enum EmailError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + ServerNotReady = -0x01710000 | 0x501, + CommunicationWithServerFailed = -0x01710000 | 0x502, + OutOfRange = -0x01710000 | 0x503, + SendingFailed = -0x01710000 | 0x504, + OperationFailed = -0x01710000 | 0x505, + NoSimCard = -0x01710000 | 0x506, + NoData = -0x01710000 | 0x507, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported + } + + internal static class EmailErrorFactory + { + internal const string LogTag = "Tizen.Messaging.Email"; + + internal static Exception GetException(int err) + { + EmailError error = (EmailError)err; + if (error == EmailError.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if (error == EmailError.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if (error == EmailError.ServerNotReady) + { + return new IOException("Server not ready yet"); ; + } + else if (error == EmailError.NoData) + { + return new InvalidDataException("No data found"); + } + else if (error == EmailError.CommunicationWithServerFailed) + { + return new TimeoutException("timed out"); + } + else if (error == EmailError.PermissionDenied) + { + return new UnauthorizedAccessException("Permission denied"); + } + else if (error == EmailError.NotSupported) + { + return new NotSupportedException("Not supported"); + } + else if (error == EmailError.OutOfRange) + { + return new IndexOutOfRangeException("Out of range"); + } + else if (error == EmailError.SendingFailed) + { + return new Exception("Sending failed"); + } + else if (error == EmailError.OperationFailed) + { + return new InvalidOperationException("operation failed"); + } + else if (error == EmailError.NoSimCard) + { + return new Exception("No sim card found"); + } + else + { + return new Exception("System operation"); + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailMessage.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailMessage.cs new file mode 100644 index 0000000..f7756c9 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailMessage.cs @@ -0,0 +1,229 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Tizen.Messaging.Email +{ + /// + /// The class contains Messaging API to support sending email messages. + /// + public class EmailMessage : IDisposable + { + internal IntPtr _emailHandle = IntPtr.Zero; + private bool _disposed = false; + private String _subject; + private String _body; + private IList _attachments = new List(); + private ICollection _to = new Collection(); + private ICollection _cc = new Collection(); + private ICollection _bcc = new Collection(); + + /// + /// The constructor + /// + public EmailMessage() + { + int ret = Interop.Email.CreateEmail(out _emailHandle); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to create message handle, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + + /// + /// Subject of the email message + /// + public string Subject + { + set + { + _subject = value; + int ret = Interop.Email.SetSubject(_emailHandle, _subject); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to set subject, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + get + { + return _subject; + } + + } + + /// + /// Body of the email message + /// + public string Body + { + set + { + _body = value; + int ret = Interop.Email.SetBody(_emailHandle, _body); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to set body, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + get + { + return _body; + } + } + + /// + /// List of file attachments + /// + public IList Attachments + { + get + { + return _attachments; + } + } + + /// + /// Collection of normal email recipients + /// + /// + /// Email address should be in standard format (as described in Internet standards RFC 5321 and RFC 5322). + /// + public ICollection To + { + get + { + return _to; + } + } + + /// + /// Collection of CC(carbon copy) email recipients + /// + /// + /// Email address should be in standard format (as described in Internet standards RFC 5321 and RFC 5322). + /// + public ICollection Cc + { + get + { + return _cc; + } + } + + /// + /// Collection of BCC(blind carbon copy) email recipients + /// + /// + /// Email address should be in standard format (as described in Internet standards RFC 5321 and RFC 5322). + /// + public ICollection Bcc + { + get + { + return _bcc; + } + } + + + internal void Save() + { + int ret; + FillHandle(); + + ret = Interop.Email.SaveEmail(_emailHandle); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to save email, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + + } + + if (_emailHandle != IntPtr.Zero) + { + Interop.Email.DestroyEmail(_emailHandle); + _emailHandle = IntPtr.Zero; + } + _disposed = true; + } + + internal void FillHandle() + { + int ret = (int)EmailError.None; + foreach (EmailAttachment it in Attachments) + { + Console.WriteLine(it.FilePath); + ret = Interop.Email.AddAttachment(_emailHandle, it.FilePath); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to add attachment, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + + foreach (EmailRecipient it in To) + { + ret = Interop.Email.AddRecipient(_emailHandle, (int)Interop.EmailRecipientType.To, it.Address); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to add recipients, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + + foreach (EmailRecipient it in Cc) + { + ret = Interop.Email.AddRecipient(_emailHandle, (int)Interop.EmailRecipientType.Cc, it.Address); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to add recipients, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + + foreach (EmailRecipient it in Bcc) + { + ret = Interop.Email.AddRecipient(_emailHandle, (int)Interop.EmailRecipientType.Bcc, it.Address); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to add recipients, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailRecipient.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailRecipient.cs new file mode 100644 index 0000000..3c1fc24 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailRecipient.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Email +{ + /// + /// The class represents recipients of an email + /// + public class EmailRecipient + { + /// + /// The email address of the recipient + /// + public string Address { get; set; } + /// + /// The constructor + /// + public EmailRecipient() + { + + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/EmailSender.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailSender.cs new file mode 100644 index 0000000..57220ed --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/EmailSender.cs @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Messaging.Email +{ + /// + /// The class to send email messages. + /// + public static class EmailSender + { + /// + /// Sends the email message. + /// + /// The email message + /// Failure if email sending failed otherwise Success + public static async Task SendAsync(EmailMessage email) + { + var task = new TaskCompletionSource(); + int ret = (int)EmailError.None; + bool saveToSentBox = false; + + email.FillHandle(); + email.Save(); + + Interop.Email.EmailSentCallback _emailSendingCallback = (IntPtr handle, int result, IntPtr userData) => + { + task.SetResult((EmailSendResult)result); + }; + + ret = Interop.Email.SetCb(email._emailHandle, _emailSendingCallback, IntPtr.Zero); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to set email incoming callback, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + + ret = Interop.Email.SendEmail(email._emailHandle, saveToSentBox); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to send email, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + + var sendResult = await task.Task; + + ret = Interop.Email.UnsetCb(email._emailHandle); + if (ret != (int)EmailError.None) + { + Log.Error(EmailErrorFactory.LogTag, "Failed to set email incoming callback, Error code: " + (EmailError)ret); + throw EmailErrorFactory.GetException(ret); + } + + return sendResult; + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Email/NamespaceDoc.cs b/src/Tizen.Messaging/Tizen.Messaging.Email/NamespaceDoc.cs new file mode 100755 index 0000000..1c51cb5 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Email/NamespaceDoc.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/// +/// The Tizen.Messaging.Email namespace contains classes providing functionality to send emails. +/// +/// +/// The Tizen.Messaging.Email namespace contains classes providing functionality to send emails. +/// +namespace Tizen.Messaging.Email +{ +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/CBMessage.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/CBMessage.cs new file mode 100755 index 0000000..949a1c8 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/CBMessage.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent cell broadcast messages. + /// + public class CBMessage : Message + { + internal CBMessage(IntPtr messageHandle) : base(messageHandle) + { + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs new file mode 100755 index 0000000..e0e27f2 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/Message.cs @@ -0,0 +1,335 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent all messages. + /// + public abstract class Message : IDisposable + { + internal IntPtr _messageHandle = IntPtr.Zero; + private bool disposed = false; + private int _memoryPressureSize = IntPtr.Size * 11 + sizeof(int) * 5 + sizeof(bool) * 5 + sizeof(short) * 2 + sizeof(byte) * 1176; + + private ICollection _from = new Collection(); + internal ICollection _to = new Collection(); + internal ICollection _cc = new Collection(); + internal ICollection _bcc = new Collection(); + + internal Message(MessageType type) + { + int ret = Interop.Messages.CreateMessage((int)type, out _messageHandle); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to create message handle, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret); + } + + GC.AddMemoryPressure(_memoryPressureSize); + } + + internal Message(IntPtr messageHandle) + { + _messageHandle = messageHandle; + GetAllAddresses(); + GC.AddMemoryPressure(_memoryPressureSize); + } + + internal void FillHandle() + { + SetAddresses(); + (this as MmsMessage)?.SetAttachments(); + } + + ~Message() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + GC.RemoveMemoryPressure(_memoryPressureSize); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects + } + + // Free unmanaged objects + if (_messageHandle != IntPtr.Zero) + { + Interop.Messages.DestroyMessage(_messageHandle); + _messageHandle = IntPtr.Zero; + } + disposed = true; + } + + internal IntPtr GetHandle() + { + return _messageHandle; + } + + private void SetAddresses() + { + foreach (var it in _to) + { + AddAddress(it); + } + + foreach (var it in _cc) + { + AddAddress(it); + } + + foreach (var it in _bcc) + { + AddAddress(it); + } + } + + private void AddAddress(MessagesAddress address) + { + int ret = Interop.Messages.AddAddress(_messageHandle, address.Number, (int)address.Type); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to add address, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + + private void GetAllAddresses() + { + int count; + + int ret = Interop.Messages.GetAddressCount(_messageHandle, out count); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get address count, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + + string number; + int type; + var To = new Collection(); + var Cc = new Collection(); + var Bcc = new Collection(); + var From = new Collection(); + + for (int i = 0; i < count; i++) + { + ret = Interop.Messages.GetAddress(_messageHandle, i, out number, out type); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get address, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + + var addressItem = new MessagesAddress((RecipientType)type, number); + switch ((RecipientType)type) + { + case RecipientType.To: + To.Add(addressItem); + break; + case RecipientType.Cc: + Cc.Add(addressItem); + break; + case RecipientType.Bcc: + Bcc.Add(addressItem); + break; + default: + From.Add(addressItem); + break; + } + } + + _to = To; + _cc = Cc; + _bcc = Bcc; + _from = From; + } + + /// + /// The message ID + /// + /// + /// After creating Message object, default value of this property is 0. After sending, this value is changed. + /// + public int Id + { + get + { + int id = 0; + int ret = Interop.Messages.GetMessageId(_messageHandle, out id); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message id, Error - " + (MessagesError)ret); + } + + return id; + } + } + + /// + /// The destination port of the message + /// + public int Port + { + get + { + int port = 0; + int ret = Interop.Messages.GetMessagePort(_messageHandle, out port); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message port, Error - " + (MessagesError)ret); + } + + return port; + } + } + + /// + /// The message box type + /// + public MessageBoxType BoxType + { + get + { + int boxType = (int)MessageBoxType.All; + int ret = Interop.Messages.GetMboxType(_messageHandle, out boxType); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message box type, Error - " + (MessagesError)ret); + } + + return (MessageBoxType)boxType; + } + set + { + int ret = Interop.Messages.SetMboxType(_messageHandle, (int)value); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set message box type, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + } + + /// + /// The text of the message + /// + public string Text + { + get + { + string text = null; + int ret = Interop.Messages.GetText(_messageHandle, out text); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get text, Error - " + (MessagesError)ret); + } + + return text; + } + set + { + int ret = Interop.Messages.SetText(_messageHandle, value); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set text, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + } + + /// + /// The time of the message + /// + public DateTime Time + { + get + { + int time = 0; + int ret = Interop.Messages.GetTime(_messageHandle, out time); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get time, Error - " + (MessagesError)ret); + } + + return (new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).AddSeconds(time).ToLocalTime(); + } + set + { + int ret = Interop.Messages.SetTime(_messageHandle, (int)(value.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds)); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set time, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + } + + /// + /// The SIM slot index of the message + /// + public SimSlotId SimId + { + get + { + int simId = (int)SimSlotId.Unknown; + int ret = Interop.Messages.GetSimId(_messageHandle, out simId); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get simId, Error - " + (MessagesError)ret); + } + + return (SimSlotId)simId; + } + set + { + int ret = Interop.Messages.SetSimId(_messageHandle, (int)value); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set simId, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + } + + /// + /// Indicates sender of the message + /// + public IReadOnlyCollection From + { + get + { + return _from as IReadOnlyCollection; + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessageReceivedEventArgs.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessageReceivedEventArgs.cs new file mode 100755 index 0000000..cd9f7ee --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessageReceivedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Messages +{ + /// + /// An extended EventArgs class which contains a received message. + /// + public class MessageReceivedEventArgs : EventArgs + { + private Message _message; + + internal MessageReceivedEventArgs(Message message) + { + _message = message; + } + + /// + /// The received message + /// + public Message ReceivedMessage + { + get + { + return _message; + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAddress.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAddress.cs new file mode 100755 index 0000000..19143fb --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAddress.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to manage informations of message address. + /// + public class MessagesAddress + { + internal RecipientType Type; + /// + /// The address of the sender/recipient + /// + public string Number { get; } + + /// + /// Creates a message address. + /// + /// The recipient's address to receive a message + public MessagesAddress(string number) + { + Number = number; + } + + internal MessagesAddress(RecipientType type, string number) + { + Type = type; + Number = number; + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAttachment.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAttachment.cs new file mode 100755 index 0000000..6096278 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesAttachment.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to manage informations of message attachment. + /// + public class MessagesAttachment + { + /// + /// The media type of attachment + /// + public MediaType Type { get; } + + /// + /// The file path of attachment + /// + public string FilePath { get; } + + /// + /// Creates an attachment. + /// + /// The attachment's type + /// The file path to attach + public MessagesAttachment(MediaType type, string filePath) + { + Type = type; + FilePath = filePath; + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEnumerations.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEnumerations.cs new file mode 100755 index 0000000..dd43eb0 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEnumerations.cs @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Messaging.Messages +{ + /// + /// Enumeration for the result of sending a message. + /// + public enum SentResult + { + /// + /// Message sending failed + /// + Failed = -1, + /// + /// Message sending succeeded + /// + Success = 0 + } + + /// + /// Enumeration for the message type. + /// + public enum MessageType + { + /// + /// Unknown type + /// + Unknown = 0, + /// + /// SMS type + /// + Sms = 1, + /// + /// MMS type + /// + Mms = 2, + /// + /// CB(Cell Broadcast) type + /// + CellBroadcast = Sms | 1 << 4, + /// + /// WAP Push type + /// + Push = Sms | 10 << 4 + } + + /// + /// Enumeration for the message box type. + /// + public enum MessageBoxType + { + /// + /// All message box type + /// + All = 0, + /// + /// Inbox type + /// + Inbox = 1, + /// + /// Outbox type + /// + Outbox = 2, + /// + /// Sentbox type + /// + Sentbox = 3, + /// + /// Draft type + /// + Draft = 4 + } + + /// + /// Enumeration for the SIM slot index of a message + /// + public enum SimSlotId + { + /// + /// Unknown SIM Slot + /// + Unknown = 0, + /// + /// SIM Slot 1 + /// + Sim1 = 1, + /// + /// SIM Slot 2 + /// + Sim2 = 2 + } + + /// + /// Enumeration for the recipient type of a message + /// + internal enum RecipientType + { + /// + /// Unknown + /// + Unknown = 0, + /// + /// 'To' recipient + /// + To = 1, + /// + /// 'Cc' (carbon copy) recipient + /// + Cc = 2, + /// + /// 'Bcc' (blind carbon copy) recipient + /// + Bcc = 3 + } + + /// + /// Enumeration for the attachment tyoe for MMS messaging. + /// + public enum MediaType + { + /// + /// Unknown + /// + Unknown = 0, + /// + /// The image + /// + Image = 1, + /// + /// The audio + /// + Audio = 2, + /// + /// The video + /// + Video = 3 + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesErrorFactory.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesErrorFactory.cs new file mode 100755 index 0000000..c331aab --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesErrorFactory.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Messaging.Messages +{ + internal enum MessagesError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + ServerNotReady = -0x01710000 | 0x501, + CommunicationWithServerFailed = -0x01710000 | 0x502, + OutOfRange = -0x01710000 | 0x503, + SendingFailed = -0x01710000 | 0x504, + OperationFailed = -0x01710000 | 0x505, + NoSimCard = -0x01710000 | 0x506, + NoData = -0x01710000 | 0x507, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported + } + + internal static class MessagesErrorFactory + { + static internal void ThrowMessagesException(int e) + { + ThrowException(e, false); + } + + static internal void ThrowMessagesException(int e, IntPtr handle) + { + ThrowException(e, (handle == IntPtr.Zero)); + } + + static private void ThrowException(int e, bool isHandleNull) + { + MessagesError err = (MessagesError)e; + + if (isHandleNull) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or release)"); + } + + switch (err) + { + case MessagesError.OutOfMemory: + throw new OutOfMemoryException(err.ToString()); + case MessagesError.InvalidParameter: + throw new ArgumentException(err.ToString()); + case MessagesError.PermissionDenied: + throw new UnauthorizedAccessException(err.ToString()); + case MessagesError.NotSupported: + throw new NotSupportedException(err.ToString()); + default: + throw new InvalidOperationException(err.ToString()); + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEvent.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEvent.cs new file mode 100755 index 0000000..dd0d616 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesEvent.cs @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Messages +{ + internal partial class MessagesManagerImpl + { + private event EventHandler _messageReceived; + + private Interop.Messages.MessageIncomingCallback _messageReceivedCallback; + + internal event EventHandler _MessageReceived + { + add + { + if (_messageReceived == null) + { + RegisterMessageReceivedEvent(); + } + _messageReceived += value; + } + remove + { + _messageReceived -= value; + if (_messageReceived == null) + { + UnregisterMessageReceivedEvent(); + } + } + } + + private void RegisterMessageReceivedEvent() + { + _messageReceivedCallback = (IntPtr messageHandle, IntPtr userData) => + { + try + { + IntPtr duplicatedMessageHandle = IntPtr.Zero; + + DuplicateMessageHandle(messageHandle, out duplicatedMessageHandle); + if (duplicatedMessageHandle != IntPtr.Zero) + { + int type = (int)MessageType.Unknown; + int result = Interop.Messages.GetMessageType(duplicatedMessageHandle, out type); + if (result != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message type, Error - " + (MessagesError)result); + } + + switch ((MessageType)type) + { + case MessageType.Sms: + { + var receivedMessage = new SmsMessage(duplicatedMessageHandle); + MessageReceivedEventArgs args = new MessageReceivedEventArgs(receivedMessage); + _messageReceived?.Invoke(null, args); + break; + } + case MessageType.Mms: + { + var receivedMessage = new MmsMessage(duplicatedMessageHandle); + MessageReceivedEventArgs args = new MessageReceivedEventArgs(receivedMessage); + _messageReceived?.Invoke(null, args); + break; + } + case MessageType.CellBroadcast: + { + var receivedMessage = new CBMessage(duplicatedMessageHandle); + MessageReceivedEventArgs args = new MessageReceivedEventArgs(receivedMessage); + _messageReceived?.Invoke(null, args); + break; + } + case MessageType.Push: + { + var receivedMessage = new PushMessage(duplicatedMessageHandle); + MessageReceivedEventArgs args = new MessageReceivedEventArgs(receivedMessage); + _messageReceived?.Invoke(null, args); + break; + } + default: + { + Log.Error(Globals.LogTag, "Invaild message type - " + type); + break; + } + } + } + } + catch + { + Log.Error(Globals.LogTag, "Exception in Callback"); + } + }; + + int ret = Interop.Messages.SetMessageIncomingCb(_MessageServiceHandle, _messageReceivedCallback, IntPtr.Zero); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set message incoming callback, Error - " + (MessagesError)ret); + } + } + + private void UnregisterMessageReceivedEvent() + { + int ret = Interop.Messages.UnsetMessageIncomingCb(_MessageServiceHandle); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to unset message incoming callback, Error - " + (MessagesError)ret); + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManager.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManager.cs new file mode 100755 index 0000000..6b23ffa --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManager.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class for message management. It allows applications to use message service. + /// + /// http://tizen.org/privilege/message.read + public static class MessagesManager + { + /// + /// Sends a message. + /// + /// http://tizen.org/privilege/message.write + /// The message to be sent + /// The boolean variable to indicate sent message should be saved in sentbox or not + /// A task contains the result of message sending + /// Thrown when method failed due to invalid operation + /// Thrown when message service is not supported + /// Thrown when input coordinates are invalid + /// Thrown when application does not have proper privileges + public static Task SendMessageAsync(Message message, bool saveToSentbox) + { + return MessagesManagerImpl.Instance.SendMessageAsync(message, saveToSentbox); + } + + /// + /// Searches for messages. + /// + /// http://tizen.org/privilege/message.read + /// The search filter for searching messages + /// A task contains the messages which fit with search filter + /// Thrown when method failed due to invalid operation + /// Thrown when message service is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public static Task> SearchMessageAsync(MessagesSearchFilter filter) + { + return MessagesManagerImpl.Instance.SearchMessageAsync(filter); + } + + /// + /// (event) MessageReceived is raised when receiving a message. + /// + /// http://tizen.org/privilege/message.read + static public event EventHandler MessageReceived + { + add + { + MessagesManagerImpl.Instance._MessageReceived += value; + } + remove + { + MessagesManagerImpl.Instance._MessageReceived -= value; + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManagerImpl.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManagerImpl.cs new file mode 100755 index 0000000..63cd9fc --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesManagerImpl.cs @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Messaging.Messages +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Messaging.Messages"; + } + + internal partial class MessagesManagerImpl : IDisposable + { + private static readonly MessagesManagerImpl _instance = new MessagesManagerImpl(); + private bool disposed = false; + + private static IntPtr _MessageServiceHandle; + + private Interop.Messages.MessageSentCallback _messageSentCallback; + + internal static MessagesManagerImpl Instance + { + get + { + return _instance; + } + } + + private MessagesManagerImpl() + { + initialize(); + } + + ~MessagesManagerImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects + } + + // Free unmanaged objects + deinitialize(); + disposed = true; + } + + private void initialize() + { + int ret; + + ret = Interop.Messages.OpenService(out _MessageServiceHandle); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to open service, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret); + } + } + + private void deinitialize() + { + if (_MessageServiceHandle != IntPtr.Zero) + { + int ret; + + ret = Interop.Messages.CloseService(_MessageServiceHandle); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to close service, Error - " + (MessagesError)ret); + } + + _MessageServiceHandle = IntPtr.Zero; + } + } + + internal Task SendMessageAsync(Message message, bool saveToSentbox) + { + var task = new TaskCompletionSource(); + + _messageSentCallback = (int result, IntPtr data) => + { + task.SetResult((SentResult)result); + }; + + message.FillHandle(); + + int ret; + IntPtr messageHandle = message.GetHandle(); + + ret = Interop.Messages.SendMessage(_MessageServiceHandle, messageHandle, saveToSentbox, _messageSentCallback, IntPtr.Zero); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to send message, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _MessageServiceHandle); + } + + return task.Task; + } + + internal Task> SearchMessageAsync(MessagesSearchFilter filter) + { + return Task.Run>(() => + { + List messageList = new List(); + int ret; + + Interop.Messages.MessageSearchCallback callback = (IntPtr messageHandle, int index, int resultCount, int totalCount, IntPtr userData) => + { + try + { + if (messageHandle != IntPtr.Zero) + { + IntPtr duplicatedMessageHandle = IntPtr.Zero; + + DuplicateMessageHandle(messageHandle, out duplicatedMessageHandle); + if (duplicatedMessageHandle != IntPtr.Zero) + { + int type = (int)MessageType.Unknown; + int result = Interop.Messages.GetMessageType(duplicatedMessageHandle, out type); + if (result != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message type, Error - " + (MessagesError)result); + } + + switch ((MessageType)type) + { + case MessageType.Sms: + { + var messageItem = new SmsMessage(duplicatedMessageHandle); + messageList.Add(messageItem); + break; + } + case MessageType.Mms: + { + var messageItem = new MmsMessage(duplicatedMessageHandle); + messageList.Add(messageItem); + break; + } + case MessageType.CellBroadcast: + { + var messageItem = new CBMessage(duplicatedMessageHandle); + messageList.Add(messageItem); + break; + } + case MessageType.Push: + { + var messageItem = new PushMessage(duplicatedMessageHandle); + messageList.Add(messageItem); + break; + } + default: + { + Log.Error(Globals.LogTag, "Invaild message type - " + type); + break; + } + } + + return true; + } + } + } + catch + { + Log.Error(Globals.LogTag, "Exception in Callback"); + } + + return false; + }; + + ret = Interop.Messages.SearchMessage(_MessageServiceHandle, (int)filter.MessageBoxType, (int)filter.MessageType, filter.TextKeyword, filter.AddressKeyword, 0, 0, callback, IntPtr.Zero); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to search message, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _MessageServiceHandle); + } + + return messageList; + }); + } + + private void DuplicateMessageHandle(IntPtr sourceHandle, out IntPtr clonedHandle) + { + int msgId; + IntPtr returnedHandle = IntPtr.Zero; + + int ret = Interop.Messages.GetMessageId(sourceHandle, out msgId); + if (ret == (int)MessagesError.None) + { + ret = Interop.Messages.GetMessageById(_MessageServiceHandle, msgId, out returnedHandle); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get message by id, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _MessageServiceHandle); + } + } + else + { + Log.Error(Globals.LogTag, "Failed to get message id, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _MessageServiceHandle); + } + + clonedHandle = returnedHandle; + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesSearchFilter.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesSearchFilter.cs new file mode 100755 index 0000000..6561463 --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MessagesSearchFilter.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent message search filters. + /// + public class MessagesSearchFilter + { + /// + /// Create a search filter for searching messages. + /// + public MessagesSearchFilter() + { + } + + /// + /// The message box type + /// + public MessageBoxType MessageBoxType { get; set; } + /// + /// The message type + /// + public MessageType MessageType { get; set; } + /// + /// The keyword to search in the text and subject + /// + public string TextKeyword { get; set; } + /// + /// The recipient address + /// + public string AddressKeyword { get; set; } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/MmsMessage.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/MmsMessage.cs new file mode 100755 index 0000000..f73310a --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/MmsMessage.cs @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent multimedia messages. + /// + public class MmsMessage : Message + { + private IList _attachment = new List(); + + /// + /// Creates a multimedia message. + /// + public MmsMessage() : base(MessageType.Mms) + { + } + + internal MmsMessage(IntPtr messageHandle) : base(messageHandle) + { + GetAllAttachments(); + } + + /// + /// The subject of the multimedia message + /// + public string Subject + { + get + { + string subject = null; + int ret = Interop.Messages.GetSubject(_messageHandle, out subject); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get subject, Error - " + (MessagesError)ret); + } + + return subject; + } + set + { + int ret = Interop.Messages.SetSubject(_messageHandle, value); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to set subject, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + } + + /// + /// Collection of normal message recipients + /// + public ICollection To + { + get + { + return _to; + } + } + + /// + /// Collection of CC(carbon copy) message recipients + /// + public ICollection Cc + { + get + { + return _cc; + } + } + + /// + /// Collection of BCC(blind carbon copy) message recipients + /// + public ICollection Bcc + { + get + { + return _bcc; + } + } + + /// + /// The list of attachment files + /// + public IList Attachments + { + get + { + return _attachment; + } + } + + internal void SetAttachments() + { + foreach (var it in _attachment) + { + AddAttachment(it); + } + } + + private void AddAttachment(MessagesAttachment attach) + { + int ret = Interop.Messages.AddAttachment(_messageHandle, (int)attach.Type, attach.FilePath); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to add attachment, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + } + + private void GetAllAttachments() + { + int count; + + int ret = Interop.Messages.GetAttachmentCount(_messageHandle, out count); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get attachment count, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + + string path; + int type; + var attachmentList = new List(); + + for (int i = 0; i < count; i++) + { + ret = Interop.Messages.GetAttachment(_messageHandle, i, out type, out path); + if (ret != (int)MessagesError.None) + { + Log.Error(Globals.LogTag, "Failed to get attachment, Error - " + (MessagesError)ret); + MessagesErrorFactory.ThrowMessagesException(ret, _messageHandle); + } + + var attachmentItem = new MessagesAttachment((MediaType)type, path); + attachmentList.Add(attachmentItem); + } + + _attachment = attachmentList; + } + + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/NamespaceDoc.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/NamespaceDoc.cs new file mode 100755 index 0000000..45d5a8e --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/NamespaceDoc.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// The Tizen.Messaging.Messages namespace contains classes providing functionality to send, receive and search for messages. +/// +/// +/// The Tizen.Messaging.Messages namespace contains classes providing functionality to send, receive and search for messages. +/// +namespace Tizen.Messaging.Messages +{ +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/PushMessage.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/PushMessage.cs new file mode 100755 index 0000000..667e7ff --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/PushMessage.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent WAP push messages. + /// + public class PushMessage : Message + { + internal PushMessage(IntPtr messageHandle) : base(messageHandle) + { + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.Messages/SmsMessage.cs b/src/Tizen.Messaging/Tizen.Messaging.Messages/SmsMessage.cs new file mode 100755 index 0000000..62ffd1e --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.Messages/SmsMessage.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Messaging.Messages +{ + /// + /// A class to represent short text messages. + /// + public class SmsMessage : Message + { + /// + /// Creates a short text message. + /// + public SmsMessage() : base(MessageType.Sms) + { + } + + internal SmsMessage(IntPtr messageHandle) : base(messageHandle) + { + } + + /// + /// Collection of normal message recipients + /// + public ICollection To + { + get + { + return _to; + } + } + } +} diff --git a/src/Tizen.Messaging/Tizen.Messaging.csproj b/src/Tizen.Messaging/Tizen.Messaging.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Messaging/Tizen.Messaging.sln b/src/Tizen.Messaging/Tizen.Messaging.sln new file mode 100755 index 0000000..2c1202c --- /dev/null +++ b/src/Tizen.Messaging/Tizen.Messaging.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Messaging", "Tizen.Messaging.csproj", "{B7415EEB-5E65-49FB-9DBB-3A014B25AA67}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{199F2770-77CB-4F49-AA99-EF30513C48CB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{544A7066-3180-4A93-A14D-4E33A79CB6B8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B7415EEB-5E65-49FB-9DBB-3A014B25AA67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B7415EEB-5E65-49FB-9DBB-3A014B25AA67}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B7415EEB-5E65-49FB-9DBB-3A014B25AA67}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B7415EEB-5E65-49FB-9DBB-3A014B25AA67}.Release|Any CPU.Build.0 = Release|Any CPU + {199F2770-77CB-4F49-AA99-EF30513C48CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {199F2770-77CB-4F49-AA99-EF30513C48CB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {199F2770-77CB-4F49-AA99-EF30513C48CB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {199F2770-77CB-4F49-AA99-EF30513C48CB}.Release|Any CPU.Build.0 = Release|Any CPU + {544A7066-3180-4A93-A14D-4E33A79CB6B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {544A7066-3180-4A93-A14D-4E33A79CB6B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {544A7066-3180-4A93-A14D-4E33A79CB6B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {544A7066-3180-4A93-A14D-4E33A79CB6B8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs new file mode 100644 index 0000000..1284919 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioCapture.cs @@ -0,0 +1,397 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to directly manage the system audio input devices. + /// + /// The recorder privilege(http://tizen.org/privilege/recorder) is required. + public abstract class AudioCaptureBase : IDisposable + { + /// + /// Specifies the minimum value allowed for the audio capture. + /// + public static readonly int MinSampleRate = 8000; + + /// + /// Specifies the maximum value allowed for the audio capture. + /// + public static readonly int MaxSampleRate = 48000; + + internal IntPtr _handle = IntPtr.Zero; + + private AudioIOState _state = AudioIOState.Idle; + + internal AudioCaptureBase(int sampleRate, AudioChannel channel, AudioSampleType sampleType) + { + if (sampleRate < MinSampleRate || MaxSampleRate < sampleRate) + { + throw new ArgumentOutOfRangeException(nameof(sampleRate), sampleRate, + $"Valid sampleRate range is { MinSampleRate } <= x <= { MaxSampleRate }."); + } + + ValidationUtil.ValidateEnum(typeof(AudioChannel), channel, nameof(channel)); + ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType, nameof(sampleType)); + + SampleRate = sampleRate; + Channel = channel; + SampleType = sampleType; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioInput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle)); + + RegisterStateChangedCallback(); + } + + ~AudioCaptureBase() + { + Dispose(false); + } + + /// + /// Occurs when the state of the AudioCapture is changed. + /// + public event EventHandler StateChanged; + + private Interop.AudioIO.AudioStateChangedCallback _stateChangedCallback; + + private void RegisterStateChangedCallback() + { + _stateChangedCallback = (IntPtr handle, int previous, int current, bool byPolicy, IntPtr _) => + { + _state = (AudioIOState)current; + + StateChanged?.Invoke(this, + new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy)); + }; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioInput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero)); + } + + #region Dispose support + private bool _isDisposed = false; + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_isDisposed) + { + return; + } + + if (_handle != IntPtr.Zero) + { + if (_state != AudioIOState.Idle) + { + try + { + Unprepare(); + } + catch (Exception) + { + } + } + + Interop.AudioIO.AudioInput.Destroy(_handle); + _handle = IntPtr.Zero; + _isDisposed = true; + } + } + + internal void ValidateNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException(GetType().Name); + } + } + #endregion + + internal void ValidateState(params AudioIOState[] desiredStates) + { + ValidateNotDisposed(); + + AudioIOUtil.ValidateState(_state, desiredStates); + } + + /// + /// Gets the sample rate of the audio input data stream. + /// + public int SampleRate { get; } + + /// + /// Gets the channel type of the audio input data stream. + /// + public AudioChannel Channel { get; } + + /// + /// Gets the sample type of the audio input data stream. + /// + public AudioSampleType SampleType { get; } + + /// + /// Gets the size allocated for the audio input buffer. + /// + /// The AudioPlayback has already been disposed. + public int GetBufferSize() + { + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.GetBufferSize(_handle, out var size)); + return size; + } + + /// + /// Prepares the AudioCapture for reading audio data by starting buffering of audio data from the device. + /// + /// + /// Operation failed due to internal error.\n + /// -or-\n + /// The current state is not . + /// + /// + public void Prepare() + { + ValidateState(AudioIOState.Idle); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Prepare(_handle), + "Failed to prepare the AudioCapture"); + } + + /// + /// Unprepares the AudioCapture. + /// + /// + /// Operation failed due to internal error.\n + /// \n + /// The current state is . + /// + /// + public void Unprepare() + { + ValidateState(AudioIOState.Running, AudioIOState.Paused); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Unprepare(_handle), + "Failed to unprepare the AudioCapture"); + } + + /// + /// Pauses buffering of audio data from the device. + /// + /// + /// The current state is .\n + /// -or-\n + /// The method is called in the event handler. + /// + /// + public void Pause() + { + if (_state == AudioIOState.Paused) + { + return; + } + ValidateState(AudioIOState.Running); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Pause(_handle)); + } + /// + /// Resumes buffering audio data from the device. + /// + /// + /// The current state is .\n + /// -or-\n + /// The method is called in the event handler. + /// + /// + public void Resume() + { + if (_state == AudioIOState.Running) + { + return; + } + ValidateState(AudioIOState.Paused); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Resume(_handle)); + } + /// + /// Flushes and discards buffered audio data from the input stream. + /// + /// The current state is . + public void Flush() + { + ValidateState(AudioIOState.Running, AudioIOState.Paused); + + int ret = Interop.AudioIO.AudioInput.Flush(_handle); + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Sets the sound stream information to the audio input. + /// + /// The to apply for the AudioCapture. + /// is null. + /// has already been disposed. + /// is not supported. + /// Not able to retrieve information from . + public void ApplyStreamPolicy(AudioStreamPolicy streamPolicy) + { + if (streamPolicy == null) + { + throw new ArgumentNullException(nameof(streamPolicy)); + } + + if (streamPolicy.Handle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(streamPolicy)); + } + + ValidateNotDisposed(); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.SetStreamInfo(_handle, streamPolicy.Handle)); + } + } + + /// + /// Provides the ability to record audio from system audio input devices in synchronous way. + /// + /// http://tizen.org/privilege/recorder + public class AudioCapture : AudioCaptureBase + { + /// + /// Initializes a new instance of the AudioCapture class with the specified sample rate, channel and sampleType. + /// + /// The audio sample rate.(8000 ~ 48000Hz) + /// The audio channel type. + /// The audio sample type. + /// + /// is less than .\n + /// -or-\n + /// is greater than . + /// + /// + /// is invalid.\n + /// -or-\n + /// is invalid. + /// + /// The required privilege is not specified. + /// The system does not support microphone. + public AudioCapture(int sampleRate, AudioChannel channel, AudioSampleType sampleType) + : base(sampleRate, channel, sampleType) + { + } + + /// + /// Reads audio data from the audio input buffer. + /// + /// The number of bytes to be read. + /// The buffer of audio data captured. + /// The current state is not . + /// is equal to or less than zero. + public byte[] Read(int count) + { + if (count <= 0) + { + throw new ArgumentOutOfRangeException(nameof(count), count, + $"{ nameof(count) } can't be equal to or less than zero."); + } + ValidateState(AudioIOState.Running); + + byte[] buffer = new byte[count]; + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Read(_handle, buffer, count), + "Failed to read"); + + return buffer; + } + } + + /// + /// Provides the ability to record audio from system audio input devices in asynchronous way. + /// + /// http://tizen.org/privilege/recorder + public class AsyncAudioCapture : AudioCaptureBase + { + + /// + /// Occurs when audio data is available. + /// + public event EventHandler DataAvailable; + + /// + /// Initializes a new instance of the AsyncAudioCapture class with the specified sample rate, channel and sampleType. + /// + /// The audio sample rate.(8000 ~ 48000Hz) + /// The audio channel type. + /// The audio sample type. + /// + /// is less than .\n + /// -or-\n + /// is greater than . + /// + /// + /// is invalid.\n + /// -or-\n + /// is invalid. + /// + /// The required privilege is not specified. + /// The system does not support microphone. + public AsyncAudioCapture(int sampleRate, AudioChannel channel, AudioSampleType sampleType) + : base(sampleRate, channel, sampleType) + { + _streamCallback = (IntPtr handle, uint length, IntPtr _) => { OnInputDataAvailable(handle, length); }; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioInput.SetStreamCallback(_handle, _streamCallback, IntPtr.Zero), + $"Failed to initialize a { nameof(AsyncAudioCapture) }"); + } + + private Interop.AudioIO.AudioStreamCallback _streamCallback; + + private void OnInputDataAvailable(IntPtr handle, uint length) + { + if (length == 0U) + { + return; + } + + IntPtr ptr = IntPtr.Zero; + try + { + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioInput.Peek(_handle, out ptr, ref length)); + + byte[] buffer = new byte[length]; + Marshal.Copy(ptr, buffer, 0, (int)length); + + Interop.AudioIO.AudioInput.Drop(_handle); + + DataAvailable?.Invoke(this, new AudioDataAvailableEventArgs(buffer)); + } + catch (Exception e) + { + Log.Error(nameof(AsyncAudioCapture), e.Message); + } + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs new file mode 100644 index 0000000..8fc7940 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioDataAvailableEventArgs.cs @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class AudioDataAvailableEventArgs : EventArgs + { + internal AudioDataAvailableEventArgs(byte[] data) + { + Data = data; + } + + /// + /// Gets the audio data captured. + /// + public byte[] Data { get; } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs new file mode 100644 index 0000000..bec87b0 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOEnums.cs @@ -0,0 +1,80 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + public enum AudioChannel + { + Mono = 0x80, + Stereo + }; + + internal enum AudioIOError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + PermissionDenied = ErrorCode.PermissionDenied, //Device open error by security + NotSupported = ErrorCode.NotSupported, //Not supported + DevicePolicyRestriction = (-2147483648 / 2) + 4, + DeviceNotOpened = -0x01900000 | 0x01, + DeviceNotClosed = -0x01900000 | 0x02, + InvalidBuffer = -0x01900000 | 0x03, + SoundPolicy = -0x01900000 | 0x04, + InvalidState = -0x01900000 | 0x05, + NotSupportedType = -0x01900000 | 0x06, + } + + /// + /// Specifies the states for the , and . + /// + public enum AudioIOState + { + /// + /// Not prepared. + /// + Idle = 0, + + /// + /// The stream is running. + /// + Running = 1, + + /// + /// The stream is paused. + /// + Paused = 2 + } + + /// + /// Enumeration for audio sample type. + /// + public enum AudioSampleType + { + /// + /// Unsigned 8-bit audio samples. + /// + U8 = 0x70, + /// + /// Signed 16-bit audio samples. + /// + S16Le + } + +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs new file mode 100644 index 0000000..5d1677d --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOStateChangedEventArgs.cs @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event and . + /// + public class AudioIOStateChangedEventArgs : EventArgs + { + internal AudioIOStateChangedEventArgs(AudioIOState previous, AudioIOState current, bool byPolicy) + { + Previous = previous; + Current = current; + ByPolicy = byPolicy; + } + + /// + /// Gets the previous state. + /// + public AudioIOState Previous { get; } + + /// + /// Gets the current state. + /// + public AudioIOState Current { get; } + + /// + /// Gets the value indicating whether the state is changed by policy or not. + /// + public bool ByPolicy { get; } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs new file mode 100644 index 0000000..d6a0c76 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioIOUtil.cs @@ -0,0 +1,95 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Diagnostics; +using System.Linq; + +namespace Tizen.Multimedia +{ + internal static class AudioIOUtil + { + internal static void ThrowIfError(int errorCode, string msg = null) + { + AudioIOError code = (AudioIOError)errorCode; + // 현재는 에러코드 최상위 exception으로 전달, 추후 상황에 맞게 케이스 처리해야 함. + + msg = (msg == null ? "" : msg + " ") + $": { code }"; + + if (code > 0) + { + Log.Info("Audio", "Code > 0, no error!!!!"); + return; + } + + switch (code) + { + case AudioIOError.None: + break; + case AudioIOError.OutOfMemory: + Log.Info("Audio", "OutOfMemoryException"); + throw new OutOfMemoryException(); + case AudioIOError.InvalidParameter: + Log.Info("Audio", "ArgumentException"); + throw new ArgumentException(msg); + case AudioIOError.InvalidOperation: + throw new InvalidOperationException(msg); + case AudioIOError.PermissionDenied: + Log.Info("Audio", "Permission Denied Error"); + throw new InvalidOperationException(msg); + case AudioIOError.NotSupported: + throw new NotSupportedException(msg); + case AudioIOError.DevicePolicyRestriction: + Log.Info("Audio", "Device_policy_restriction"); + throw new Exception("Device_policy_restriction"); + case AudioIOError.DeviceNotOpened: + Log.Info("Audio", "Device Not Opened Error"); + throw new Exception("Device Not Opened Error"); + case AudioIOError.DeviceNotClosed: + Log.Info("Audio", "Device Not Closed Error"); + throw new Exception("Device Not Closed Error"); + case AudioIOError.InvalidBuffer: + Log.Info("Audio", "Invalid Buffer Error"); + throw new InvalidOperationException(msg); + case AudioIOError.SoundPolicy: + Log.Info("Audio", "Sound Policy Error"); + throw new Exception(msg); + case AudioIOError.InvalidState: + Log.Info("Audio", "Invalid State Error"); + throw new InvalidOperationException(msg); + case AudioIOError.NotSupportedType: + Log.Info("Audio", "Not supported stream type Error"); + throw new NotSupportedException(msg); + default: + Log.Info("Audio", "Unknown Exception" + code); + throw new Exception(msg); + } + } + + internal static void ValidateState(AudioIOState curState, params AudioIOState[] desiredStates) + { + Debug.Assert(desiredStates.Length > 0); + + if (desiredStates.Contains(curState)) + { + return; + } + + throw new InvalidOperationException($"The audio is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", desiredStates) }."); + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs new file mode 100644 index 0000000..1a6b8a9 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlayback.cs @@ -0,0 +1,386 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to directly manage the system audio output devices and play PCM (pulse-code modulation) data. + /// + public class AudioPlayback : IDisposable + { + public static readonly int MinSampleRate = 8000; + public static readonly int MaxSampleRate = 48000; + + private IntPtr _handle = IntPtr.Zero; + + private AudioIOState _state = AudioIOState.Idle; + + #region Event + /// + /// Occurs when audio playback data can be written. + /// + /// + public event EventHandler BufferAvailable; + + private Interop.AudioIO.AudioStreamCallback _streamCallback; + + private void RegisterStreamCallback() + { + _streamCallback = (IntPtr handle, uint bytes, IntPtr _) => + { + BufferAvailable?.Invoke(this, new AudioPlaybackBufferAvailableEventArgs((int)bytes)); + }; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioOutput.SetStreamChangedCallback(_handle, _streamCallback, IntPtr.Zero), + $"Failed to create {nameof(AudioPlayback)}"); + } + + /// + /// Occurs when the state of the AudioPlayback is changed. + /// + public event EventHandler StateChanged; + + private Interop.AudioIO.AudioStateChangedCallback _stateChangedCallback; + + private void RegisterStateChangedCallback() + { + _stateChangedCallback = (IntPtr handle, int previous, int current, bool byPolicy, IntPtr _) => + { + _state = (AudioIOState)current; + + StateChanged?.Invoke(this, + new AudioIOStateChangedEventArgs((AudioIOState)previous, _state, byPolicy)); + }; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioOutput.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), + $"Failed to create {nameof(AudioPlayback)}"); + } + #endregion + + /// + /// Initializes a new instance of the AudioPlayback class with the specified sample rate, channel and sample type. + /// + /// The audio sample rate.(8000 ~ 48000Hz) + /// The audio channel type. + /// The audio sample type. + /// + /// is less than .\n + /// -or-\n + /// is greater than . + /// + /// + /// is invalid.\n + /// -or-\n + /// is invalid. + /// + public AudioPlayback(int sampleRate, AudioChannel channel, AudioSampleType sampleType) + { + if (sampleRate < MinSampleRate || MaxSampleRate < sampleRate) + { + throw new ArgumentOutOfRangeException(nameof(sampleRate), sampleRate, + $"Valid sampleRate range is { MinSampleRate } <= x <= { MaxSampleRate }."); + } + + ValidationUtil.ValidateEnum(typeof(AudioChannel), channel, nameof(channel)); + ValidationUtil.ValidateEnum(typeof(AudioSampleType), sampleType, nameof(sampleType)); + + SampleRate = sampleRate; + Channel = channel; + SampleType = sampleType; + + AudioIOUtil.ThrowIfError( + Interop.AudioIO.AudioOutput.Create(SampleRate, (int)Channel, (int)SampleType, out _handle), + $"Failed to create {nameof(AudioPlayback)}"); + + RegisterStreamCallback(); + RegisterStateChangedCallback(); + } + + ~AudioPlayback() + { + Dispose(false); + } + + #region Dispose support + private bool _isDisposed = false; + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_isDisposed) + { + return; + } + + if (_handle != IntPtr.Zero) + { + if (_state != AudioIOState.Idle) + { + try + { + Unprepare(); + } + catch (Exception) + { + } + } + + Interop.AudioIO.AudioOutput.Destroy(_handle); + _handle = IntPtr.Zero; + _isDisposed = true; + } + } + + private void ValidateNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException(GetType().Name); + } + } + #endregion + + private void ValidateState(params AudioIOState[] desiredStates) + { + ValidateNotDisposed(); + + AudioIOUtil.ValidateState(_state, desiredStates); + } + + /// + /// Gets the sample rate of the audio output data stream. + /// + public int SampleRate { get; } + + /// + /// Gets the channel type of the audio output data stream. + /// + public AudioChannel Channel { get; } + + /// + /// Gets the sample type of the audio output data stream. + /// + public AudioSampleType SampleType { get; } + + /// + /// Gets the sound type supported by the audio output device. + /// + /// The AudioPlayback has already been disposed. + public AudioStreamType StreamType + { + get + { + ValidateNotDisposed(); + + int audioType = 0; + int ret = Interop.AudioIO.AudioOutput.GetSoundType(_handle, out audioType); + MultimediaDebug.AssertNoError(ret); + + return (AudioStreamType)audioType; + } + } + + /// + /// Gets the size allocated for the audio output buffer. + /// + /// The AudioPlayback has already been disposed. + public int GetBufferSize() + { + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.GetBufferSize(_handle, out var size)); + return size; + } + + /// + /// Drains buffered audio data from the output stream. + /// It blocks the calling thread until draining the stream buffer completely. (e.g end of playback) + /// + /// The AudioPlayback has already been disposed. + /// The current state is . + public void Drain() + { + ValidateState(AudioIOState.Running, AudioIOState.Paused); + + int ret = Interop.AudioIO.AudioOutput.Drain(_handle); + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Starts writing the audio data to the device. + /// + /// The buffer to write. + /// The written size. + /// is null. + /// The length of is zero. + /// The current state is not . + /// The AudioPlayback has already been disposed. + public int Write(byte[] buffer) + { + ValidateState(AudioIOState.Running); + + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (buffer.Length == 0) + { + throw new ArgumentException("buffer has no data.(the Length is zero.)", nameof(buffer)); + } + + int ret = Interop.AudioIO.AudioOutput.Write(_handle, buffer, (uint)buffer.Length); + + AudioIOUtil.ThrowIfError(ret, "Failed to write buffer"); + + return ret; + } + + /// + /// Prepares the AudioPlayback. + /// + /// + /// This must be called before . + /// + /// + /// Operation failed due to internal error.\n + /// -or-\n + /// The current state is not . + /// + /// The AudioPlayback has already been disposed. + /// + public void Prepare() + { + ValidateState(AudioIOState.Idle); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Prepare(_handle), + $"Failed to prepare the {nameof(AudioPlayback)}"); + } + + /// + /// Unprepares the AudioPlayback. + /// + /// + /// Operation failed due to internal error.\n + /// -or-\n + /// The current state is . + /// + /// The AudioPlayback has already been disposed. + /// + public void Unprepare() + { + ValidateState(AudioIOState.Running, AudioIOState.Paused); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Unprepare(_handle), + $"Failed to unprepare the {nameof(AudioPlayback)}"); + } + + /// + /// Pauses feeding of audio data to the device. + /// + /// It has no effect if the current is the . + /// + /// The current state is .\n + /// -or-\n + /// The method is called in the event handler. + /// + /// The AudioPlayback has already been disposed. + /// + public void Pause() + { + if (_state == AudioIOState.Paused) + { + return; + } + ValidateState(AudioIOState.Running); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Pause(_handle)); + } + + /// + /// Resumes feeding of audio data to the device. + /// + /// It has no effect if the current is the . + /// + /// The current state is .\n + /// -or-\n + /// The method is called in an event handler. + /// + /// The AudioPlayback has already been disposed. + /// + public void Resume() + { + if (_state == AudioIOState.Running) + { + return; + } + ValidateState(AudioIOState.Paused); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.Resume(_handle)); + } + + /// + /// Flushes and discards buffered audio data from the output stream. + /// + /// The current state is . + /// The AudioPlayback has already been disposed. + public void Flush() + { + ValidateState(AudioIOState.Running, AudioIOState.Paused); + + int ret = Interop.AudioIO.AudioOutput.Flush(_handle); + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Applies the sound stream information to the AudioPlayback. + /// + /// The to apply for the AudioPlayback. + /// is null. + /// + /// has already been disposed.\n + /// -or-\n + /// The AudioPlayback has already been disposed. + /// + /// is not supported. + /// Not able to retrieve information from . + public void ApplyStreamPolicy(AudioStreamPolicy streamPolicy) + { + if (streamPolicy == null) + { + throw new ArgumentNullException(nameof(streamPolicy)); + } + + if (streamPolicy.Handle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(streamPolicy)); + } + + ValidateNotDisposed(); + + AudioIOUtil.ThrowIfError(Interop.AudioIO.AudioOutput.SetStreamInfo(_handle, streamPolicy.Handle)); + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs new file mode 100644 index 0000000..ac9a495 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/AudioIO/AudioPlaybackBufferAvailableEventArgs.cs @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia +{ + public class AudioPlaybackBufferAvailableEventArgs : EventArgs + { + internal AudioPlaybackBufferAvailableEventArgs(int length) + { + Length = length; + } + + public int Length { get; } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs new file mode 100644 index 0000000..1685489 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.AudioIO.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class AudioIO + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void AudioStreamCallback(IntPtr handle, uint nbytes, IntPtr userdata); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void AudioStateChangedCallback(IntPtr handle, int previous, int current, bool byPolicy, IntPtr userData); + + internal static partial class AudioInput + { + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_stream_cb")] + internal static extern int SetStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_create")] + internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_set_sound_stream_info")] + internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_resume")] + internal static extern int Resume(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_flush")] + internal static extern int Flush(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_read")] + internal static extern int Read(IntPtr handle, byte[] buffer, int length); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_buffer_size")] + internal static extern int GetBufferSize(IntPtr handle, out int size); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_rate")] + internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_channel")] + internal static extern int GetChannel(IntPtr handle, out int channel); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_get_sample_type")] + internal static extern int GetSampleType(IntPtr handle, out int sampleType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_peek")] + internal static extern int Peek(IntPtr handle, out IntPtr buffer, ref uint length); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_in_drop")] + internal static extern int Drop(IntPtr handle); + } + internal static partial class AudioOutput + { + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(IntPtr handle, AudioStateChangedCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_stream_cb")] + internal static extern int SetStreamChangedCallback(IntPtr handle, AudioStreamCallback callback, IntPtr user_data); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_create_new")] + internal static extern int Create(int sampleRate, int channel, int type, out IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_drain")] + internal static extern int Drain(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_flush")] + internal static extern int Flush(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_buffer_size")] + internal static extern int GetBufferSize(IntPtr handle, out int size); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_channel")] + internal static extern int GetChannel(IntPtr handle, out int channel); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_rate")] + internal static extern int GetSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sample_type")] + internal static extern int GetSampleType(IntPtr handle, out int sampleType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_get_sound_type")] + internal static extern int GetSoundType(IntPtr handle, out int soundType); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_resume")] + internal static extern int Resume(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_set_sound_stream_info")] + internal static extern int SetStreamInfo(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.AudioIO, EntryPoint = "audio_out_write")] + internal static extern int Write(IntPtr handle, byte[] buffer, uint length); + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..3469f9f --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string AudioIO = "libcapi-media-audio-io.so.0"; + public const string WavPlayer = "libcapi-media-wav-player.so.0"; + public const string TonePlayer = "libcapi-media-tone-player.so.0"; + } +} diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs new file mode 100644 index 0000000..076a703 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.TonePlayer.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class TonePlayer + { + [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_start_new")] + internal static extern TonePlayerError Start(ToneType tone, IntPtr streamInfoHandle, + int durationMs, out int id); + + [DllImport(Libraries.TonePlayer, EntryPoint = "tone_player_stop")] + internal static extern TonePlayerError Stop(int id); + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs b/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs new file mode 100644 index 0000000..a7f7a6e --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Interop/Interop.WavPlayer.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class WavPlayer + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void WavPlayerCompletedCallback(int playerId, IntPtr userData); + + [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_start_new")] + internal static extern WavPlayerError Start(string filePath, IntPtr streamInfoHandle, + WavPlayerCompletedCallback completedCallback, IntPtr userData, out int id); + + [DllImport(Libraries.WavPlayer, EntryPoint = "wav_player_stop")] + internal static extern WavPlayerError Stop(int id); + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs b/src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs new file mode 100644 index 0000000..3e00569 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/MultimediaDebug.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Diagnostics; + +namespace Tizen.Multimedia +{ + internal class MultimediaDebug + { + [Conditional("DEBUG")] + internal static void AssertNoError(int errorCode) + { + Debug.Assert(errorCode == (int)Internals.Errors.ErrorCode.None, + $"The API is supposed not to return an error! But it returns error({ errorCode }).", + "Implementation of core may have been changed, modify the call to throw if the return code is not ok."); + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.sln b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.sln new file mode 100755 index 0000000..2f6f81e --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/Tizen.Multimedia.AudioIO.sln @@ -0,0 +1,58 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.AudioIO", "Tizen.Multimedia.AudioIO.csproj", "{6C20E06D-1039-4B5B-B983-A17224B858F5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{4DE90BF8-94FD-45B5-88E9-B22D627145D2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{219E90A8-248F-473E-884D-BC2E49E02CD1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{9A6470A1-2201-463F-95C4-704924AB8EA6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{7FEE2C02-DF87-4E31-BF46-984ACE1BBD33}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{539E7A26-C450-464C-A878-D82525218BB3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{70D00AC7-C4EB-4067-89DA-2D186AE8223D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C20E06D-1039-4B5B-B983-A17224B858F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C20E06D-1039-4B5B-B983-A17224B858F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C20E06D-1039-4B5B-B983-A17224B858F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C20E06D-1039-4B5B-B983-A17224B858F5}.Release|Any CPU.Build.0 = Release|Any CPU + {4DE90BF8-94FD-45B5-88E9-B22D627145D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4DE90BF8-94FD-45B5-88E9-B22D627145D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4DE90BF8-94FD-45B5-88E9-B22D627145D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4DE90BF8-94FD-45B5-88E9-B22D627145D2}.Release|Any CPU.Build.0 = Release|Any CPU + {219E90A8-248F-473E-884D-BC2E49E02CD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {219E90A8-248F-473E-884D-BC2E49E02CD1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {219E90A8-248F-473E-884D-BC2E49E02CD1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {219E90A8-248F-473E-884D-BC2E49E02CD1}.Release|Any CPU.Build.0 = Release|Any CPU + {9A6470A1-2201-463F-95C4-704924AB8EA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A6470A1-2201-463F-95C4-704924AB8EA6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A6470A1-2201-463F-95C4-704924AB8EA6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A6470A1-2201-463F-95C4-704924AB8EA6}.Release|Any CPU.Build.0 = Release|Any CPU + {7FEE2C02-DF87-4E31-BF46-984ACE1BBD33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FEE2C02-DF87-4E31-BF46-984ACE1BBD33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FEE2C02-DF87-4E31-BF46-984ACE1BBD33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FEE2C02-DF87-4E31-BF46-984ACE1BBD33}.Release|Any CPU.Build.0 = Release|Any CPU + {539E7A26-C450-464C-A878-D82525218BB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {539E7A26-C450-464C-A878-D82525218BB3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {539E7A26-C450-464C-A878-D82525218BB3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {539E7A26-C450-464C-A878-D82525218BB3}.Release|Any CPU.Build.0 = Release|Any CPU + {70D00AC7-C4EB-4067-89DA-2D186AE8223D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70D00AC7-C4EB-4067-89DA-2D186AE8223D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70D00AC7-C4EB-4067-89DA-2D186AE8223D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70D00AC7-C4EB-4067-89DA-2D186AE8223D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs new file mode 100644 index 0000000..51c92b4 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayer.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to play a tone. + /// + public static class TonePlayer + { + /// + /// Plays a tone, asynchronously. + /// + /// A to play. + /// A . + /// The tone duration in milliseconds. -1 indicates an infinite duration. + /// A task that represents the asynchronous operation. + /// is invalid. + /// is null. + /// is less than -1. + /// Any invalid operations occurred. + /// is not a supported type. + /// has already been disposed. + public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy, + int durationMilliseconds) + { + return StartAsync(tone, streamPolicy, durationMilliseconds, CancellationToken.None); + } + + /// + /// Plays a tone, asynchronously. + /// + /// A to play. + /// A . + /// The tone duration in milliseconds. -1 indicates an infinite duration. + /// The cancellation token which can be used to stop playing the tone. + /// A task that represents the asynchronous operation. + /// is invalid. + /// is null. + /// is less than -1. + /// Any invalid operations occurred. + /// is not a supported type. + /// has already been disposed. + public static Task StartAsync(ToneType tone, AudioStreamPolicy streamPolicy, + int durationMilliseconds, CancellationToken cancellationToken) + { + if (durationMilliseconds < -1) + { + throw new ArgumentOutOfRangeException(nameof(durationMilliseconds), durationMilliseconds, + $"{nameof(durationMilliseconds)} can't be less than -1."); + } + + if (streamPolicy == null) + { + throw new ArgumentNullException(nameof(streamPolicy)); + } + + ValidationUtil.ValidateEnum(typeof(ToneType), tone, nameof(tone)); + + if (cancellationToken.IsCancellationRequested) + { + return Task.FromCanceled(cancellationToken); + } + + return StartAsyncCore(tone, streamPolicy, durationMilliseconds, cancellationToken); + } + + private static async Task StartAsyncCore(ToneType tone, AudioStreamPolicy streamPolicy, + int durationMilliseconds, CancellationToken cancellationToken) + { + + var tcs = new TaskCompletionSource(); + + Interop.TonePlayer.Start(tone, streamPolicy.Handle, durationMilliseconds, out var id). + Validate("Failed to play tone."); + + using (RegisterCancellationAction(tcs, cancellationToken, id)) + { + await WaitForDuration(tcs, cancellationToken, durationMilliseconds); + + await tcs.Task; + } + } + + private static async Task WaitForDuration(TaskCompletionSource tcs, + CancellationToken cancellationToken, int durationMilliseconds) + { + if (durationMilliseconds == -1) + { + return; + } + + try + { + await Task.Delay(durationMilliseconds, cancellationToken); + tcs.TrySetResult(true); + } + catch (TaskCanceledException) + { + } + } + + private static IDisposable RegisterCancellationAction(TaskCompletionSource tcs, + CancellationToken cancellationToken, int id) + { + if (cancellationToken.CanBeCanceled == false) + { + return null; + } + + return cancellationToken.Register(() => + { + Interop.TonePlayer.Stop(id).Validate("Failed to cancel"); + tcs.TrySetCanceled(); + }); + } + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerError.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerError.cs new file mode 100644 index 0000000..e4fd0fa --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/TonePlayer/TonePlayerError.cs @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum TonePlayerError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + TizenErrorTonePlayer = -0x01970000, + TypeNotSupported = TizenErrorTonePlayer | 0x01 + } + + internal static class TonePlayerErrorExtensions + { + internal static void Validate(this TonePlayerError error, string message) + { + if (error == TonePlayerError.None) + { + return; + } + + switch (error) + { + case TonePlayerError.InvalidParameter: + throw new ArgumentException(message); + + case TonePlayerError.TypeNotSupported: + throw new NotSupportedException(message); + + case TonePlayerError.InvalidOperation: + throw new InvalidOperationException(message); + + default: + throw new InvalidOperationException(message); + + } + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/TonePlayer/ToneType.cs b/src/Tizen.Multimedia.AudioIO/TonePlayer/ToneType.cs new file mode 100644 index 0000000..85e2aab --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/TonePlayer/ToneType.cs @@ -0,0 +1,470 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for Audio Codec. + /// + public enum ToneType + { + /// + /// The default tone. + /// + Default = 0, + /// + /// Predefined DTMF 0. + /// + Dtmf0 = 0, + /// + /// Predefined DTMF 1. + /// + Dtmf1, + /// + /// Predefined DTMF 2. + /// + Dtmf2, + /// + /// redefined DTMF 3. + /// + Dtmf3, + /// + /// Predefined DTMF 4. + /// + Dtmf4, + /// + /// Predefined DTMF 5. + /// + Dtmf5, + /// + /// Predefined DTMF 6. + /// + Dtmf6, + /// + /// Predefined DTMF 7. + /// + Dtmf7, + /// + /// Predefined DTMF 8. + /// + Dtmf8, + /// + /// Predefined DTMF 9. + /// + Dtmf9, + /// + /// Predefined DTMF Star - Asterisk. + /// + DtmfS, + /// + /// Predefined DTMF sharp (#). + /// + DtmfP, + /// + /// Predefined DTMF A (A). + /// + DtmfA, + /// + /// Predefined DTMF B (B). + /// + DtmfB, + /// + /// Predefined DTMF C (C). + /// + DtmfC, + /// + /// Predefined DTMF D (D). + /// + DtmfD, + /// + /// Call supervisory tone, Dial tone: CEPT: 425Hz, continuous. + /// + SupDial, + /// + /// Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous. + /// + AnsiDial, + /// + /// Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous. + /// + JapanDial, + /// + /// Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF. + /// + SupBusy, + /// + /// Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF. + /// + AnsiBusy, + /// + /// Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF. + /// + JapanBusy, + /// + /// Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF. + /// + SupCongestion, + /// + /// Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF. + /// + AnsiCongestion, + /// + /// Call supervisory tone, Radio path acknowledgment : CEPT, ANSI: 425Hz, 200ms ON. + /// + SupRadioAck, + /// + /// Call supervisory tone, Radio path acknowledgment : JAPAN: 400Hz, 1s ON, 2s OFF. + /// + JapanRadioAck, + /// + /// Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts. + /// + SupRadioNotAvailable, + /// + /// Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF. + /// + SupError, + /// + /// Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF. + /// + SupCallWaiting, + /// + /// Call supervisory tone, Call Waiting: ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF. + /// + AnsiCallWaiting, + /// + /// Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF. + /// + SupRingtone, + /// + /// Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF. + /// + AnsiRingtone, + /// + /// General beep: 400Hz+1200Hz, 35ms ON. + /// + PropBeep, + /// + /// Proprietary tone, positive acknowledgment: 1200Hz, 100ms ON, 100ms OFF 2 bursts. + /// + PropAck, + /// + /// Proprietary tone, negative acknowledgment: 300Hz+400Hz+500Hz, 400ms ON. + /// + PropNack, + /// + /// Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON. + /// + PropPrompt, + /// + /// Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON. + /// + PropBeep2, + /// + /// Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms. + /// + SupIntercept, + /// + /// Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds. + /// + SupInterceptAbbrev, + /// + /// Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds. + /// + SupCongestionAbbrev, + /// + /// Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle. + /// + SupConfirm, + /// + /// Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). + /// + SupPip, + /// + /// 425Hz continuous. + /// + CdmaDialToneLite, + /// + /// CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF. + /// + CdmaNetworkUsaRingback, + /// + /// CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON. + /// + CdmaIntercept, + /// + /// CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON. + /// + CdmaAbbrIntercept, + /// + /// CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF. + /// + CdmaReorder, + /// + /// CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times. + /// + CdmaAbbrReorder, + /// + /// CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous. + /// + CdmaNetworkBusy, + /// + /// CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times. + /// + CdmaConfirm, + /// + /// CDMA answer tone: silent tone - definition Frequency 0, 0ms ON, 0ms OFF. + /// + CdmaAnswer, + /// + /// CDMA Network Callwaiting tone: 440Hz 300ms ON. + /// + CdmaNetworkCallWaiting, + /// + /// CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times. + /// + CdmaPip, + /// + /// ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF. + /// + CdmaCallSignalIsdnNormal, + /// + /// ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF. + /// + CdmaCallSignalIsdnIntergroup, + /// + /// ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF. + /// + CdmaCallSignalIsdnSpPri, + /// + /// ISDN Call sign PAT3 tone: silent tone. + /// + CdmaCallSignalIsdnPat3, + /// + /// ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON. + /// + CdmaCallSignalIsdnPingRing, + /// + /// ISDN Pat5 tone: silent tone. + /// + CdmaCallSignalIsdnPat5, + /// + /// ISDN Pat6 tone: silent tone. + /// + CdmaCallSignalIsdnPat6, + /// + /// ISDN Pat7 tone: silent tone. + /// + CdmaCallSignalIsdnPat7, + /// + /// TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat. + /// + CdmaHighL, + /// + /// TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat. + /// + CdmaMedL, + /// + /// TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat. + /// + CdmaLowL, + /// + /// CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat. + /// + CdmaHighSs, + /// + /// CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat. + /// + CdmaMedSs, + /// + /// CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat. + /// + CdmaLowSs, + /// + /// CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat. + /// + CdmaHighSsl, + /// + /// CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat. + /// + CdmaMedSsl, + /// + /// CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat. + /// + CdmaLowSsl, + /// + /// CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat. + /// + CdmaHighSs2, + /// + /// CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat. + /// + CdmaMedSs2, + /// + /// CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat. + /// + CdmaLowSs2, + /// + /// CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT. + /// + CdmaHighSls, + /// + /// CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT. + /// + CdmaMedSls, + /// + /// CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT. + /// + CdmaLowSls, + /// + /// CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT. + /// + CdmaHighSx4, + /// + /// CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT. + /// + CdmaMedSX4, + /// + /// CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT. + /// + CdmaLowSX4, + /// + /// CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT. + /// + CdmaHighPbxL, + /// + /// CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT. + /// + CdmaMedPbxL, + /// + /// CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT. + /// + CdmaLowPbxL, + /// + /// CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT. + /// + CdmaHighPbxSs, + /// + /// CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT. + /// + CdmaMedPbxSs, + /// + /// CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT. + /// + CdmaLowPbxSs, + /// + /// CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT. + /// + CdmaHighPbxSsl, + /// + /// CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT. + /// + CdmaMedPbxSsl, + /// + /// CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT. + /// + CdmaLowPbxSsl, + /// + /// CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT. + /// + CdmaHighPbxSls, + /// + /// CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT. + /// + CdmaMedPbxSls, + /// + /// CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT. + /// + CdmaLowPbxSls, + /// + /// CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT. + /// + CdmaHighPbxSX4, + /// + /// CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT. + /// + CdmaMedPbxSX4, + /// + /// CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT. + /// + CdmaLowPbxSX4, + /// + /// CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON. + /// + CdmaAlertNetworkLite, + /// + ///CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON. + /// + CdmaAlertAutoRedialLite, + /// + /// CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON. + /// + CdmaOneMinBeep, + /// + /// CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON. + /// + CdmaKeypadVolumeKeyLite, + /// + /// CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON. + /// + CdmaPressHoldKeyLite, + /// + /// CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms. + /// + CdmaAlertIncallLite, + /// + /// CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT. + /// + CdmaEmergencyRingback, + /// + /// CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times. + /// + CdmaAlertCallGuard, + /// + /// CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms. + /// + CdmaSoftErrorLite, + /// + /// CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms. + /// + CdmaCallDropLite, + /// + /// CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. + /// + CdmaNetworkBusyOneShot, + /// + /// CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON. + /// + CdmaAbbrAlert, + /// + /// CDMA_SIGNAL_OFF - silent tone. + /// + CdmaSignalOff, + /// + /// User Defined Tone: 100Hz continuous. + /// + UserDefinedLowFre, + /// + /// User Defined Tone: 200Hz continuous. + /// + UserDefinedMedFre, + /// + /// User Defined Tone: 300Hz continuous. + /// + UserDefinedHighFre + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs b/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs new file mode 100644 index 0000000..d896ced --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/ValdiationUtil.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class ValidationUtil + { + internal static void ValidateEnum(Type enumType, object value, string paramName) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Invalid { enumType.Name } value : { value }", paramName); + } + } + } +} diff --git a/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs new file mode 100644 index 0000000..954d6f3 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayer.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to play a wav file. + /// + public static class WavPlayer + { + /// + /// Plays a wav file based on the specified . + /// + /// A task that represents the asynchronous operation. + /// A file path to play. + /// A . + /// + /// is null. + /// -or- + /// is null. + /// + /// An internal error occurs. + /// does not exists. + /// The format of is not supported. + /// has already been disposed of. + public static Task StartAsync(string path, AudioStreamPolicy streamPolicy) + { + return StartAsync(path, streamPolicy, CancellationToken.None); + } + + /// + /// Plays a wav file based on the specified . + /// + /// A task that represents the asynchronous operation. + /// A file path to play. + /// A . + /// A cancellation token which can be used to stop. + /// + /// is null. + /// -or- + /// is null. + /// + /// An internal error occurs. + /// does not exists. + /// The format of is not supported. + /// has already been disposed. + public static Task StartAsync(string path, AudioStreamPolicy streamPolicy, + CancellationToken cancellationToken) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + if (streamPolicy == null) + { + throw new ArgumentNullException(nameof(streamPolicy)); + } + + if (File.Exists(path) == false) + { + throw new FileNotFoundException("File does not exists.", path); + } + + return cancellationToken.IsCancellationRequested ? Task.FromCanceled(cancellationToken) : + StartAsyncCore(path, streamPolicy, cancellationToken); + } + + private static async Task StartAsyncCore(string path, AudioStreamPolicy streamPolicy, + CancellationToken cancellationToken) + { + var tcs = new TaskCompletionSource(); + + Interop.WavPlayer.WavPlayerCompletedCallback cb = (id_, _) => tcs.TrySetResult(true); + + Interop.WavPlayer.Start(path, streamPolicy.Handle, cb, IntPtr.Zero, out var id). + Validate("Failed to play."); + + using (RegisterCancellationAction(tcs, cancellationToken, id)) + { + await tcs.Task; + } + } + + private static IDisposable RegisterCancellationAction(TaskCompletionSource tcs, + CancellationToken cancellationToken, int id) + { + if (cancellationToken.CanBeCanceled == false) + { + return null; + } + + return cancellationToken.Register(() => + { + Interop.WavPlayer.Stop(id).Validate("Failed to cancel"); + tcs.TrySetCanceled(); + }); + } + } +} + diff --git a/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs new file mode 100644 index 0000000..4570b22 --- /dev/null +++ b/src/Tizen.Multimedia.AudioIO/WavPlayer/WavPlayerError.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum WavPlayerError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + TizenErrorWavPlayer = -0x01990000, + FormatNotSupported = TizenErrorWavPlayer | 0x01, + NotSupportedType = TizenErrorWavPlayer | 0x02 + } + + internal static class WavPlayerErrorExtensions + { + internal static void Validate(this WavPlayerError error, string message) + { + if (error == WavPlayerError.None) + { + return; + } + + switch (error) + { + case WavPlayerError.InvalidParameter: + throw new ArgumentException(message); + + case WavPlayerError.FormatNotSupported: + throw new FileFormatException(message); + + case WavPlayerError.NotSupportedType: + throw new NotSupportedException(message); + + case WavPlayerError.InvalidOperation: + throw new InvalidOperationException(message); + } + } + } + +} diff --git a/src/Tizen.Multimedia.Camera/Camera/Camera.cs b/src/Tizen.Multimedia.Camera/Camera/Camera.cs new file mode 100755 index 0000000..55ded68 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/Camera.cs @@ -0,0 +1,1004 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading; +using static Interop; +using Native = Interop.Camera; + +namespace Tizen.Multimedia +{ + static internal class CameraLog + { + internal const string Tag = "Tizen.Multimedia.Camera"; + internal const string Enter = "[Enter]"; + internal const string Leave = "[Leave]"; + } + + /// + /// The camera class provides methods to capture photos and support setting up notifications + /// for state changes of capturing, previewing, focusing, information about resolution and binary format + /// and functions for picture manipulations like sepia negative and many more. + /// It also notifies you when a significant picture parameter changes e.g. focus. + /// + public class Camera : IDisposable, IDisplayable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + private CameraState _state = CameraState.None; + + /// + /// Initializes a new instance of the Class. + /// + /// 3 + /// The camera device to access + public Camera(CameraDevice device) + { + CameraErrorFactory.ThrowIfError(Native.Create(device, out _handle), + "Failed to create camera instance"); + + Capabilities = new CameraCapabilities(this); + Settings = new CameraSettings(this); + DisplaySettings = new CameraDisplaySettings(this); + + RegisterCallbacks(); + + SetState(CameraState.Created); + } + + /// + /// Destructor of the camera class. + /// + ~Camera() + { + Dispose(false); + } + + public IntPtr Handle => GetHandle(); + + internal IntPtr GetHandle() + { + ValidateNotDisposed(); + return _handle; + } + + #region Dispose support + /// + /// Releases the unmanaged resources used by the Camera. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + + if (_handle != IntPtr.Zero) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the Camera. + /// + /// 3 + public void Dispose() + { + ReplaceDisplay(null); + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Error(CameraLog.Tag, "Camera handle is disposed."); + throw new ObjectDisposedException(nameof(Camera)); + } + } + #endregion Dispose support + + #region Check camera state + internal void ValidateState(params CameraState[] required) + { + ValidateNotDisposed(); + + Debug.Assert(required.Length > 0); + + var curState = _state; + if (!required.Contains(curState)) + { + throw new InvalidOperationException($"The camera is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", required) }."); + } + } + + internal void SetState(CameraState state) + { + _state = state; + } + #endregion Check camera state + + #region EventHandlers + /// + /// Event that occurs when the camera interrupt is started by policy. + /// + public event EventHandler InterruptStarted; + private Native.InterruptStartedCallback _interruptStartedCallback; + + /// + /// Event that occurs when an camera is interrupted by policy. + /// + /// 3 + public event EventHandler Interrupted; + private Native.InterruptedCallback _interruptedCallback; + + /// + /// Event that occurs when there is an asynchronous error. + /// + /// 3 + public event EventHandler ErrorOccurred; + private Native.ErrorCallback _errorCallback; + + /// + /// Event that occurs when the auto focus state is changed. + /// + /// 3 + public event EventHandler FocusStateChanged; + private Native.FocusStateChangedCallback _focusStateChangedCallback; + + /// + /// Event that occurs when a face is detected in preview frame. + /// + /// 3 + public event EventHandler FaceDetected; + private Native.FaceDetectedCallback _faceDetectedCallback; + + /// + /// Event that occurs during capture of image. + /// + /// 3 + public event EventHandler Capturing; + private Native.CapturingCallback _capturingCallback; + + /// + /// Event that occurs after the capture of the image. + /// + /// 3 + public event EventHandler CaptureCompleted; + private Native.CaptureCompletedCallback _captureCompletedCallback; + + private Native.HdrCaptureProgressCallback _hdrCaptureProgressCallback; + private event EventHandler _hdrCaptureProgress; + private object _hdrCaptureProgressEventLock = new object(); + + /// + /// Event that occurs when there is change in HDR capture progress. + /// Check whether is supported or not before add this EventHandler. + /// + /// 3 + /// In case of HDR feature is not supported. + public event EventHandler HdrCaptureProgress + { + add + { + lock (_hdrCaptureProgressEventLock) + { + if (_hdrCaptureProgress == null) + { + RegisterHdrCaptureProgress(); + } + + _hdrCaptureProgress += value; + } + } + + remove + { + lock (_hdrCaptureProgressEventLock) + { + _hdrCaptureProgress -= value; + + if (_hdrCaptureProgress == null) + { + UnregisterHdrCaptureProgress(); + } + } + } + } + + /// + /// Event that occurs when camera state is changed. + /// + /// 3 + public event EventHandler StateChanged; + private Native.StateChangedCallback _stateChangedCallback; + + private static Native.DeviceStateChangedCallback _deviceStateChangedCallback; + private static event EventHandler _deviceStateChanged; + private static object _deviceStateChangedEventLock = new object(); + private static int _deviceStateCallbackId; + + /// + /// Event that occurs after the is changed. + /// + /// 3 + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// In case of invalid parameters. + public static event EventHandler DeviceStateChanged + { + add + { + lock (_deviceStateChangedEventLock) + { + if (_deviceStateChanged == null) + { + RegisterDeviceStateChangedCallback(); + } + + _deviceStateChanged += value; + } + } + + remove + { + lock (_deviceStateChangedEventLock) + { + _deviceStateChanged -= value; + + if (_deviceStateChanged == null) + { + UnregisterDeviceStateChangedCallback(); + } + } + } + } + + private Native.PreviewCallback _previewCallback; + private event EventHandler _preview; + private object _previewEventLock = new object(); + /// + /// Event that occurs once per frame when previewing. + /// Preview callback is registered when user add callback explicitly to avoid useless P/Invoke. + /// + /// 3 + public event EventHandler Preview + { + add + { + lock (_previewEventLock) + { + if (_preview == null) + { + RegisterPreviewCallback(); + } + + _preview += value; + } + } + + remove + { + lock (_previewEventLock) + { + _preview -= value; + + if (_preview == null) + { + UnregisterPreviewCallback(); + } + } + } + } + + private Native.MediaPacketPreviewCallback _mediaPacketPreviewCallback; + private EventHandler _mediaPacketPreview; + private object _mediaPacketPreviewEventLock = new object(); + + /// + /// Event that occurs once per frame when previewing. + /// Preview callback is registered when user add callback explicitly to avoid useless P/Invoke. + /// + /// 3 + public event EventHandler MediaPacketPreview + { + add + { + lock (_mediaPacketPreviewEventLock) + { + if (_mediaPacketPreview == null) + { + RegisterMediaPacketPreviewCallback(); + } + + _mediaPacketPreview += value; + } + } + + remove + { + lock (_mediaPacketPreviewEventLock) + { + _mediaPacketPreview -= value; + + if (_mediaPacketPreview == null) + { + UnregisterMediaPacketPreviewCallback(); + } + } + } + } + #endregion EventHandlers + + #region Properties + /// + /// Get/Set the various camera settings. + /// + /// 3 + public CameraSettings Settings { get; } + + /// + /// Gets the various camera capabilities. + /// + /// 3 + public CameraCapabilities Capabilities { get; } + + /// + /// Get/set various camera display properties. + /// + /// 3 + public CameraDisplaySettings DisplaySettings{ get; } + + private Display _display; + + private CameraError SetDisplay(Display display) + { + if (display == null) + { + return CameraDisplay.SetTarget(GetHandle(), DisplayType.None, IntPtr.Zero); + } + + return display.ApplyTo(this); + } + + private void ReplaceDisplay(Display newDisplay) + { + _display?.SetOwner(null); + _display = newDisplay; + _display?.SetOwner(this); + } + + /// + /// Sets or gets the display type and handle to show preview images. + /// The camera must be in the state. + /// + /// 3 + /// + /// This must be set before StartPreview() method. + /// In Custom ROI display mode, DisplayRoiArea property must be set before calling this method. + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public Display Display + { + get + { + return _display; + } + + set + { + ValidateState(CameraState.Created); + + if (value?.Owner != null) + { + if (ReferenceEquals(this, value.Owner)) + { + return; + } + + throw new ArgumentException("The display has already been assigned to another."); + } + + CameraErrorFactory.ThrowIfError(SetDisplay(value), "Failed to set the camera display"); + + ReplaceDisplay(value); + } + } + + CameraError IDisplayable.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject) + { + Debug.Assert(_disposed == false); + ValidationUtil.ValidateEnum(typeof(DisplayType), type, nameof(type)); + + return CameraDisplay.SetTarget(GetHandle(), type, evasObject); + } + + /// + /// Gets the state of the camera. + /// + /// 3 + /// None, Created, Preview, Capturing, Captured + /// The camera already has been disposed. + public CameraState State + { + get + { + ValidateNotDisposed(); + + CameraState val = CameraState.None; + CameraErrorFactory.ThrowIfError(Native.GetState(_handle, out val), + "Failed to get camera state"); + + return val; + } + } + + /// + /// The hint for display reuse. + /// If the hint is set to true, the display will be reused when the camera device is changed with + /// ChangeDevice method. + /// + /// 3 + /// In case of invalid parameters. + /// Invalid state. + /// The camera already has been disposed. + public bool DisplayReuseHint + { + get + { + ValidateNotDisposed(); + + CameraErrorFactory.ThrowIfError(Native.GetDisplayReuseHint(_handle, out bool val), + "Failed to get camera display reuse hint"); + + return val; + } + + set + { + ValidateState(CameraState.Preview); + + CameraErrorFactory.ThrowIfError(Native.SetDisplayReuseHint(_handle, value), + "Failed to set display reuse hint."); + } + } + + /// + /// Gets the facing direction of camera module. + /// + /// 3 + /// A that specifies the facing direction of camera device. + /// The camera already has been disposed. + public CameraFacingDirection Direction + { + get + { + ValidateNotDisposed(); + + CameraErrorFactory.ThrowIfError(Native.GetFacingDirection(_handle, out var val), + "Failed to get camera direction"); + + return val; + } + } + + /// + /// Gets the camera device count. + /// + /// 3 + /// This returns 2, if the device supports primary and secondary cameras. + /// Otherwise 1, if the device only supports primary camera. + /// The camera already has been disposed. + public int CameraCount + { + get + { + ValidateNotDisposed(); + + CameraErrorFactory.ThrowIfError(Native.GetDeviceCount(_handle, out int val), + "Failed to get camera device count"); + + return val; + } + } + #endregion Properties + + #region Methods + /// + /// Changes the camera device. + /// + /// 3 + /// The hardware camera to access. + /// + /// If display reuse is set using + /// before stopping the preview, the display will be reused and last frame on the display + /// can be kept even though camera device is changed. + /// The camera must be in the . + /// + /// In case of invalid parameters. + /// In case of any invalid operations. + /// In case of ChangeDevice feature is not supported. + /// The camera already has been disposed. + public void ChangeDevice(CameraDevice device) + { + ValidateState(CameraState.Created); + ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device)); + + CameraErrorFactory.ThrowIfError(Native.ChangeDevice(_handle, device), + "Failed to change the camera device"); + } + + /// + /// Gets the device state. + /// + /// 3 + /// The device to get state. + /// Returns the state of camera device + /// In case of invalid parameters. + /// In case of any invalid operations. + /// In case of this feature is not supported. + public static CameraDeviceState GetDeviceState(CameraDevice device) + { + ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device)); + + CameraErrorFactory.ThrowIfError(Native.GetDeviceState(device, out var val), + "Failed to get the camera device state."); + + return val; + } + + /// + /// Gets the flash state. + /// + /// 3 + /// The device to get state. + /// Returns the flash state of camera device + /// In case of invalid parameters. + /// In case of any invalid operations. + /// In case of this feature is not supported. + public static CameraFlashState GetFlashState(CameraDevice device) + { + ValidationUtil.ValidateEnum(typeof(CameraDevice), device, nameof(device)); + + CameraErrorFactory.ThrowIfError(Native.GetFlashState(device, out var val), + "Failed to get camera flash state"); + + return val; + } + + /// + /// Starts capturing and drawing preview frames on the screen. + /// The display handle must be set using + /// before using this method. + /// If needed set fps , preview resolution + /// , or preview format + /// before using this method. + /// The camera must be in the or state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StartPreview() + { + ValidateState(CameraState.Created, CameraState.Captured); + + CameraErrorFactory.ThrowIfError(Native.StartPreview(_handle), + "Failed to start the camera preview."); + + // Update by StateChangedCallback can be delayed for dozens of milliseconds. + SetState(CameraState.Preview); + } + + /// + /// Stops capturing and drawing preview frames on the screen. + /// The camera must be in the state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StopPreview() + { + ValidateState(CameraState.Preview); + + CameraErrorFactory.ThrowIfError(Native.StopPreview(_handle), + "Failed to stop the camera preview."); + + SetState(CameraState.Created); + } + + /// + /// Starts capturing of still images. + /// EventHandler must be set for capturing using + /// and for completed using before calling this method. + /// The camera must be in the state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// + /// This function causes the transition of the camera state from Capturing to Captured + /// automatically and the corresponding EventHandlers will be invoked. + /// The preview should be restarted by calling method after capture is completed. + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StartCapture() + { + ValidateState(CameraState.Preview); + + CameraErrorFactory.ThrowIfError(Native.StartCapture(_handle, _capturingCallback, _captureCompletedCallback, IntPtr.Zero), + "Failed to start the camera capture."); + + SetState(CameraState.Capturing); + } + + /// + /// Starts continuously capturing still images. + /// EventHandler must be set for capturing using + /// and for completed using before calling this method. + /// The camera must be in the state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// The number of still images. + /// The interval of the capture(milliseconds). + /// The cancellation token to cancel capturing. + /// + /// + /// If this is not supported zero shutter lag occurs. The capture resolution could be + /// changed to the preview resolution. This function causes the transition of the camera state + /// from Capturing to Captured automatically and the corresponding Eventhandlers will be invoked. + /// Each captured image will be delivered through Eventhandler set using event. + /// The preview should be restarted by calling method after capture is completed. + /// + /// In case of invalid parameters. + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StartCapture(int count, int interval, CancellationToken cancellationToken) + { + ValidateState(CameraState.Preview); + + if (count < 2) + { + throw new ArgumentOutOfRangeException(nameof(count), count, $"{nameof(count)} should be greater than one."); + } + + if (interval < 0) + { + throw new ArgumentOutOfRangeException(nameof(interval), interval, $"{nameof(interval)} should be greater than or equal to zero."); + } + + //Handle CancellationToken + if (cancellationToken != CancellationToken.None) + { + cancellationToken.Register(() => + { + CameraErrorFactory.ThrowIfError(Native.StopContinuousCapture(_handle), + "Failed to cancel the continuous capture"); + SetState(CameraState.Captured); + }); + } + + CameraErrorFactory.ThrowIfError(Native.StartContinuousCapture(_handle, count, interval, + _capturingCallback, _captureCompletedCallback, IntPtr.Zero), "Failed to start the continuous capture."); + + SetState(CameraState.Capturing); + } + + /// + /// Starts camera auto-focusing, asynchronously. + /// The camera must be in the or state. + /// + /// 3 + /// Continuous auto focus + /// + /// http://tizen.org/privilege/camera + /// + /// + /// If continuous status is true, the camera continuously tries to focus. + /// + /// In case of invalid parameters. + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StartFocusing(bool continuous) + { + ValidateState(CameraState.Preview, CameraState.Captured); + + CameraErrorFactory.ThrowIfError(Native.StartFocusing(_handle, continuous), + "Failed to cancel the camera focus."); + } + + /// + /// Stops camera auto focusing. + /// The camera must be in the or state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StopFocusing() + { + ValidateState(CameraState.Preview, CameraState.Captured); + + CameraErrorFactory.ThrowIfError(Native.CancelFocusing(_handle), + "Failed to cancel the camera focus."); + } + + /// + /// Starts face detection. + /// The camera must be in the state. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// + /// This should be called after is started. + /// The Eventhandler set using invoked when the face is detected in preview frame. + /// Internally it starts continuous focus and focusing on the detected face. + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StartFaceDetection() + { + ValidateState(CameraState.Preview); + + _faceDetectedCallback = (IntPtr faces, int count, IntPtr userData) => + { + var result = new List(); + IntPtr current = faces; + + for (int i = 0; i < count; i++) + { + result.Add(new FaceDetectionData(current)); + current = IntPtr.Add(current, Marshal.SizeOf()); + } + + FaceDetected?.Invoke(this, new FaceDetectedEventArgs(result)); + }; + CameraErrorFactory.ThrowIfError(Native.StartFaceDetection(_handle, _faceDetectedCallback, IntPtr.Zero), + "Failed to start face detection"); + } + + /// + /// Stops face detection. + /// + /// 3 + /// + /// http://tizen.org/privilege/camera + /// + /// In case of any invalid operations. + /// In case of this feature is not supported. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void StopFaceDetection() + { + if (_faceDetectedCallback == null) + { + throw new InvalidOperationException("The face detection is not started."); + } + + CameraErrorFactory.ThrowIfError(Native.StopFaceDetection(_handle), + "Failed to stop the face detection."); + + _faceDetectedCallback = null; + } + #endregion Methods + + #region Callback registrations + private void RegisterCallbacks() + { + RegisterErrorCallback(); + RegisterFocusStateChanged(); + RegisterInterruptStartedCallback(); + RegisterInterruptedCallback(); + RegisterStateChangedCallback(); + + //Define capturing callback + _capturingCallback = (IntPtr main, IntPtr postview, IntPtr thumbnail, IntPtr userData) => + { + Capturing?.Invoke(this, new CameraCapturingEventArgs(new StillImage(main), + postview == IntPtr.Zero ? null : new StillImage(postview), + thumbnail == IntPtr.Zero ? null : new StillImage(thumbnail))); + }; + + //Define captureCompleted callback + _captureCompletedCallback = _ => + { + SetState(CameraState.Captured); + CaptureCompleted?.Invoke(this, EventArgs.Empty); + }; + } + + private void RegisterInterruptStartedCallback() + { + _interruptStartedCallback = (CameraPolicy policy, CameraState state, IntPtr userData) => + { + InterruptStarted?.Invoke(this, new CameraInterruptStartedEventArgs(policy, state)); + }; + CameraErrorFactory.ThrowIfError(Native.SetInterruptStartedCallback(_handle, _interruptStartedCallback, IntPtr.Zero), + "Failed to set interrupt callback"); + } + + private void RegisterInterruptedCallback() + { + _interruptedCallback = (CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData) => + { + Interrupted?.Invoke(this, new CameraInterruptedEventArgs(policy, previous, current)); + }; + CameraErrorFactory.ThrowIfError(Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), + "Failed to set interrupt callback"); + } + + private void RegisterErrorCallback() + { + _errorCallback = (CameraErrorCode error, CameraState current, IntPtr userData) => + { + ErrorOccurred?.Invoke(this, new CameraErrorOccurredEventArgs(error, current)); + }; + CameraErrorFactory.ThrowIfError(Native.SetErrorCallback(_handle, _errorCallback, IntPtr.Zero), + "Setting error callback failed"); + } + + private void RegisterStateChangedCallback() + { + _stateChangedCallback = (CameraState previous, CameraState current, bool byPolicy, IntPtr _) => + { + SetState(current); + Log.Info(CameraLog.Tag, "Camera state changed " + previous.ToString() + " -> " + current.ToString()); + StateChanged?.Invoke(this, new CameraStateChangedEventArgs(previous, current, byPolicy)); + }; + CameraErrorFactory.ThrowIfError(Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), + "Setting state changed callback failed"); + } + + private static void RegisterDeviceStateChangedCallback() + { + _deviceStateChangedCallback = (CameraDevice device, CameraDeviceState state, IntPtr userData) => + { + _deviceStateChanged?.Invoke(null, new CameraDeviceStateChangedEventArgs(device, state)); + }; + + CameraErrorFactory.ThrowIfError(Native.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero, out _deviceStateCallbackId), + "Failed to set device state changed callback"); + + Log.Info(CameraLog.Tag, "add callbackId " + _deviceStateCallbackId.ToString()); + } + + private static void UnregisterDeviceStateChangedCallback() + { + CameraErrorFactory.ThrowIfError(Native.UnsetDeviceStateChangedCallback(_deviceStateCallbackId), + "Unsetting device state changed callback failed"); + _deviceStateChangedCallback = null; + _deviceStateCallbackId = 0; + } + + private void RegisterFocusStateChanged() + { + _focusStateChangedCallback = (CameraFocusState state, IntPtr userData) => + { + FocusStateChanged?.Invoke(this, new CameraFocusStateChangedEventArgs(state)); + }; + CameraErrorFactory.ThrowIfError(Native.SetFocusStateChangedCallback(_handle, _focusStateChangedCallback, IntPtr.Zero), + "Setting focus changed callback failed"); + } + + private void RegisterHdrCaptureProgress() + { + _hdrCaptureProgressCallback = (int percent, IntPtr userData) => + { + _hdrCaptureProgress?.Invoke(this, new HdrCaptureProgressEventArgs(percent)); + }; + CameraErrorFactory.ThrowIfError(Native.SetHdrCaptureProgressCallback(_handle, _hdrCaptureProgressCallback, IntPtr.Zero), + "Setting Hdr capture progress callback failed"); + } + + private void UnregisterHdrCaptureProgress() + { + CameraErrorFactory.ThrowIfError(Native.UnsetHdrCaptureProgressCallback(_handle), + "Unsetting hdr capture progress is failed"); + _hdrCaptureProgressCallback = null; + } + + private void RegisterPreviewCallback() + { + _previewCallback = (IntPtr frame, IntPtr userData) => + { + _preview?.Invoke(this, new PreviewEventArgs(new PreviewFrame(frame))); + }; + CameraErrorFactory.ThrowIfError(Native.SetPreviewCallback(_handle, _previewCallback, IntPtr.Zero), + "Setting preview callback failed"); + } + + private void UnregisterPreviewCallback() + { + CameraErrorFactory.ThrowIfError(Native.UnsetPreviewCallback(_handle), + "Unsetting preview callback failed"); + _previewCallback = null; + } + + private void RegisterMediaPacketPreviewCallback() + { + _mediaPacketPreviewCallback = (IntPtr mediaPacket, IntPtr userData) => + { + MediaPacket packet = MediaPacket.From(mediaPacket); + var eventHandler = _mediaPacketPreview; + + if (eventHandler != null) + { + eventHandler.Invoke(this, new MediaPacketPreviewEventArgs(packet)); + } + else + { + packet.Dispose(); + } + }; + CameraErrorFactory.ThrowIfError(Native.SetMediaPacketPreviewCallback(_handle, _mediaPacketPreviewCallback, IntPtr.Zero), + "Setting media packet preview callback failed"); + } + + private void UnregisterMediaPacketPreviewCallback() + { + CameraErrorFactory.ThrowIfError(Native.UnsetMediaPacketPreviewCallback(_handle), + "Unsetting media packet preview callback failed"); + _mediaPacketPreviewCallback = null; + } + #endregion Callback registrations + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraCapabilities.cs b/src/Tizen.Multimedia.Camera/Camera/CameraCapabilities.cs new file mode 100755 index 0000000..ddfe4c7 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraCapabilities.cs @@ -0,0 +1,794 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using NativeCapabilities = Interop.CameraCapabilities; +using NativeSettings = Interop.CameraSettings; + +namespace Tizen.Multimedia +{ + /// + /// The CameraCapabilities class provides properties + /// to get various capability information of the camera device. + /// + public class CameraCapabilities + { + internal readonly Camera _camera; + + private IList _previewResolutions; + private IList _cameraResolutions; + private IList _captureFormats; + private IList _previewFormats; + private IList _fps; + private IList _autoFocusModes; + private IList _exposureModes; + private IList _isoLevels; + private IList _theaterModes; + private IList _whitebalances; + private IList _flashModes; + private IList _sceneModes; + private IList _effectModes; + private IList _streamRotations; + private IList _streamFlips; + private IList _ptzTypes; + private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max); + private delegate bool IsSupportedDelegate(IntPtr handle); + + internal CameraCapabilities(Camera camera) + { + _camera = camera; + + IsFaceDetectionSupported = IsFeatureSupported(NativeCapabilities.IsFaceDetectionSupported); + IsMediaPacketPreviewCallbackSupported = IsFeatureSupported(NativeCapabilities.IsMediaPacketPreviewCallbackSupported); + IsZeroShutterLagSupported = IsFeatureSupported(NativeCapabilities.IsZeroShutterLagSupported); + IsContinuousCaptureSupported = IsFeatureSupported(NativeCapabilities.IsContinuousCaptureSupported); + IsHdrCaptureSupported = IsFeatureSupported(NativeCapabilities.IsHdrCaptureSupported); + IsAntiShakeSupported = IsFeatureSupported(NativeCapabilities.IsAntiShakeSupported); + IsVideoStabilizationSupported = IsFeatureSupported(NativeCapabilities.IsVideoStabilizationSupported); + IsAutoContrastSupported = IsFeatureSupported(NativeCapabilities.IsAutoContrastSupported); + IsBrigtnessSupported = CheckRangeValid(NativeSettings.GetBrightnessRange); + IsExposureSupported = CheckRangeValid(NativeSettings.GetExposureRange); + IsZoomSupported = CheckRangeValid(NativeSettings.GetZoomRange); + IsPanSupported = CheckRangeValid(NativeSettings.GetPanRange); + IsTiltSupported = CheckRangeValid(NativeSettings.GetTiltRange); + } + + private bool IsFeatureSupported(IsSupportedDelegate func) + { + return func(_camera.GetHandle()); + } + + private bool CheckRangeValid(GetRangeDelegate func) + { + CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max), + "Failed to check feature is suported or not."); + + return min < max; + } + + /// + /// Gets the face detection feature's supported state. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsFaceDetectionSupported { get; } + + /// + /// Gets the media packet preview callback feature's supported state. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsMediaPacketPreviewCallbackSupported { get; } + + /// + /// Gets the zero shutter lag feature's supported state. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsZeroShutterLagSupported { get; } + + /// + /// Gets continuous capture feature's supported state. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsContinuousCaptureSupported { get; } + + /// + /// Gets the support state of HDR capture. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsHdrCaptureSupported { get; } + + /// + /// Gets the support state of the anti-shake feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsAntiShakeSupported { get; } + + /// + /// Gets the support state of the video stabilization feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsVideoStabilizationSupported { get; } + + /// + /// Gets the support state of auto contrast feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsAutoContrastSupported { get; } + + /// + /// Gets the support state of brightness feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsBrigtnessSupported { get; } + + /// + /// Gets the support state of exposure feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsExposureSupported { get; } + + /// + /// Gets the support state of zoom feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsZoomSupported { get; } + + /// + /// Gets the support state of pan feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsPanSupported { get; } + + /// + /// Gets the support state of tilt feature. + /// true if supported, otherwise false. + /// + /// 3 + public bool IsTiltSupported { get; } + + /// + /// Retrieves all the preview resolutions supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported preview resolutions. + /// by recorder. + /// + /// The camera already has been disposed. + public IEnumerable SupportedPreviewResolutions + { + get + { + if (_previewResolutions == null) + { + _previewResolutions = GetSupportedPreviewResolutions(); + } + + return _previewResolutions; + } + } + + /// + /// Retrieves all the capture resolutions supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported capture resolutions. + /// + /// The camera already has been disposed. + public IEnumerable SupportedCaptureResolutions + { + get + { + if (_cameraResolutions == null) + { + _cameraResolutions = GetSupportedCaptureResolutions(); + } + + return _cameraResolutions; + } + } + + /// + /// Retrieves all the capture formats supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedCapturePixelFormats + { + get + { + if (_captureFormats == null) + { + _captureFormats = GetSupportedCapturePixelFormats(); + } + + return _captureFormats; + } + } + + /// + /// Retrieves all the preview formats supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedPreviewPixelFormats + { + get + { + if (_previewFormats == null) + { + _previewFormats = GetSupportedPreviewPixelFormats(); + } + + return _previewFormats; + } + } + + /// + /// Retrieves all the fps supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedPreviewFps + { + get + { + if (_fps == null) + { + _fps = GetSupportedPreviewFps(); + } + + return _fps; + } + } + + /// + /// Retrieves all the fps by resolution supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported by resolution. + /// + /// The camera already has been disposed. + public IEnumerable GetSupportedPreviewFpsByResolution(int width, int height) + { + return GetSupportedPreviewFpsByResolutions(width, height); + } + + /// + /// Retrieves all the fps by resolution supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported by resolution. + /// + /// The camera already has been disposed. + public IEnumerable GetSupportedPreviewFpsByResolution(Size size) + { + return GetSupportedPreviewFpsByResolutions(size.Width, size.Height); + } + + /// + /// Retrieves all the auto focus modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedAutoFocusModes + { + get + { + if (_autoFocusModes == null) + { + _autoFocusModes = GetSupportedAutoFocusModes(); + } + + return _autoFocusModes; + } + } + + /// + /// Retrieves all the exposure modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedExposureModes + { + get + { + if (_exposureModes == null) + { + _exposureModes = GetSupportedExposureModes(); + } + + return _exposureModes; + } + } + + /// + /// Retrieves all the Iso level supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedIsoLevels + { + get + { + if (_isoLevels == null) + { + _isoLevels = GetSupportedIsoLevels(); + } + + return _isoLevels; + } + } + + /// + /// Retrieves all the theater modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedTheaterModes + { + get + { + if (_theaterModes == null) + { + _theaterModes = GetSupportedTheaterModes(); + } + + return _theaterModes; + } + } + + /// + /// Retrieves all the whitebalance modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedWhiteBalances + { + get + { + if (_whitebalances == null) + { + _whitebalances = GetSupportedWhitebalances(); + } + + return _whitebalances; + } + } + + /// + /// Retrieves all the flash modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedFlashModes + { + get + { + if (_flashModes == null) + { + _flashModes = GetSupportedFlashModes(); + } + + return _flashModes; + } + } + + /// + /// Retrieves all the scene modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedSceneModes + { + get + { + if (_sceneModes == null) + { + _sceneModes = GetSupportedSceneModes(); + } + + return _sceneModes; + } + } + + /// + /// Retrieves all the effect modes supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedEffects + { + get + { + if (_effectModes == null) + { + _effectModes = GetSupportedEffects(); + } + + return _effectModes; + } + } + + /// + /// Retrieves all the stream rotation supported by the camera. + /// + /// 3 + /// + /// An IEnumerable containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedStreamRotations + { + get + { + if (_streamRotations == null) + { + _streamRotations = GetSupportedStreamRotations(); + } + + return _streamRotations; + } + } + + /// + /// Retrieves all the flips supported by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedStreamFlips + { + get + { + if (_streamFlips == null) + { + _streamFlips = GetSupportedStreamFlips(); + } + + return _streamFlips; + } + } + + /// + /// Retrieves all the ptz types by the camera. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedPtzTypes + { + get + { + if (_ptzTypes.Count == 0) + { + _ptzTypes = GetSupportedPtzTypes(); + } + + return _ptzTypes; + } + } + + #region Methods for getting supported values + private IList GetSupportedPreviewResolutions() + { + List previewResolutions = new List(); + + NativeCapabilities.PreviewResolutionCallback callback = (int width, int height, IntPtr userData) => + { + previewResolutions.Add(new Size(width, height)); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewResolutions(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported preview resolutions"); + + return previewResolutions.AsReadOnly(); + } + + private IList GetSupportedCaptureResolutions() + { + List cameraResolutions = new List(); + + NativeCapabilities.CaptureResolutionCallback callback = (int width, int height, IntPtr userData) => + { + cameraResolutions.Add(new Size(width, height)); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCaptureResolutions(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported capture resolutions"); + + return cameraResolutions.AsReadOnly(); + } + + private IList GetSupportedCapturePixelFormats() + { + List captureFormats = new List(); + + NativeCapabilities.CaptureFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => + { + captureFormats.Add(format); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedCapturePixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported capture formats."); + + return captureFormats.AsReadOnly(); + } + + private IList GetSupportedPreviewPixelFormats() + { + List previewFormats = new List(); + + NativeCapabilities.PreviewFormatCallback callback = (CameraPixelFormat format, IntPtr userData) => + { + previewFormats.Add(format); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewPixelFormats(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported preview formats."); + + return previewFormats.AsReadOnly(); + } + + private IList GetSupportedPreviewFps() + { + List previewFps = new List(); + + NativeCapabilities.FpsCallback callback = (CameraFps fps, IntPtr userData) => + { + previewFps.Add(fps); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFps(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported camera fps"); + + return previewFps.AsReadOnly(); + } + + private IList GetSupportedPreviewFpsByResolutions(int width, int height) + { + List fpsByResolution = new List(); + + NativeCapabilities.FpsByResolutionCallback callback = (CameraFps fps, IntPtr userData) => + { + fpsByResolution.Add(fps); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPreviewFpsByResolution(_camera.GetHandle(), + width, height, callback, IntPtr.Zero), "Failed to get the supported fps by resolutions."); + + return fpsByResolution.AsReadOnly(); + } + + private IList GetSupportedAutoFocusModes() + { + List autoFocusModes = new List(); + + NativeCapabilities.AfModeCallback callback = (CameraAutoFocusMode mode, IntPtr userData) => + { + autoFocusModes.Add(mode); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedAutoFocusModes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported Auto focus modes."); + + return autoFocusModes.AsReadOnly(); + } + + private IList GetSupportedExposureModes() + { + List exposureModes = new List(); + + NativeCapabilities.ExposureModeCallback callback = (CameraExposureMode mode, IntPtr userData) => + { + exposureModes.Add(mode); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedExposureModes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported Exposure modes."); + + return exposureModes.AsReadOnly(); + } + + private IList GetSupportedIsoLevels() + { + List isoLevels = new List(); + + NativeCapabilities.IsoCallback callback = (CameraIsoLevel iso, IntPtr userData) => + { + isoLevels.Add(iso); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedIso(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported Iso levels."); + + return isoLevels.AsReadOnly(); + } + + private IList GetSupportedTheaterModes() + { + List theaterModes = new List(); + + NativeCapabilities.TheaterModeCallback callback = (CameraTheaterMode theaterMode, IntPtr userData) => + { + theaterModes.Add(theaterMode); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedTheaterModes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported theater modes."); + + return theaterModes.AsReadOnly(); + } + + private IList GetSupportedWhitebalances() + { + List whitebalances = new List(); + + NativeCapabilities.WhitebalanceCallback callback = (CameraWhiteBalance whiteBalance, IntPtr userData) => + { + whitebalances.Add(whiteBalance); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedWhitebalance(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported white balance."); + + return whitebalances.AsReadOnly(); + } + + private IList GetSupportedFlashModes() + { + List flashModes = new List(); + + NativeCapabilities.FlashModeCallback callback = (CameraFlashMode flashMode, IntPtr userData) => + { + flashModes.Add(flashMode); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedFlashModes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported flash modes."); + + return flashModes.AsReadOnly(); + } + + private IList GetSupportedSceneModes() + { + List sceneModes = new List(); + + NativeCapabilities.SceneModeCallback callback = (CameraSceneMode sceneMode, IntPtr userData) => + { + sceneModes.Add(sceneMode); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedSceneModes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported scene modes."); + + return sceneModes.AsReadOnly(); + } + + private IList GetSupportedEffects() + { + List effectModes = new List(); + + NativeCapabilities.EffectCallback callback = (CameraEffectMode effect, IntPtr userData) => + { + effectModes.Add(effect); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedEffects(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported camera effects."); + + return effectModes.AsReadOnly(); + } + + private IList GetSupportedStreamRotations() + { + List streamRotations = new List(); + + NativeCapabilities.StreamRotationCallback callback = (Rotation streamRotation, IntPtr userData) => + { + streamRotations.Add(streamRotation); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamRotations(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported camera rotations."); + + return streamRotations.AsReadOnly(); + } + + private IList GetSupportedStreamFlips() + { + List streamFlips = new List(); + + NativeCapabilities.StreamFlipCallback callback = (Flips streamFlip, IntPtr userData) => + { + streamFlips.Add(streamFlip); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedStreamFlips(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported camera flips."); + + return streamFlips.AsReadOnly(); + } + + private IList GetSupportedPtzTypes() + { + List ptzTypes = new List(); + + NativeCapabilities.PtzTypeCallback callback = (CameraPtzType ptzType, IntPtr userData) => + { + ptzTypes.Add(ptzType); + return true; + }; + CameraErrorFactory.ThrowIfError(NativeCapabilities.SupportedPtzTypes(_camera.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported Ptz types."); + + return ptzTypes.AsReadOnly(); + } + #endregion Methods for getting supported values + } +} diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs new file mode 100755 index 0000000..584b529 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraCapturingEventArgs.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about the captured still image. + /// + public class CameraCapturingEventArgs : EventArgs + { + internal CameraCapturingEventArgs(StillImage main, StillImage post, StillImage thumbnail) + { + MainImage = main; + PostView = post; + Thumbnail = thumbnail; + } + + /// + /// The main image data of the captured still image. + /// + /// 3 + public StillImage MainImage { get; } + + /// + /// The image data of the postview. + /// + /// 3 + public StillImage PostView { get; } + + /// + /// The image data of the thumbnail. + /// + /// 3 + public StillImage Thumbnail { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs new file mode 100755 index 0000000..32353f1 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraDeviceStateChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about previous and current state + /// of the camera when its state is changed. + /// + public class CameraDeviceStateChangedEventArgs : EventArgs + { + internal CameraDeviceStateChangedEventArgs(CameraDevice device, CameraDeviceState state) + { + Device = device; + State = state; + } + + /// + /// Camera device type. + /// + /// 3 + public CameraDevice Device { get; } + + /// + /// Current state of the camera device. + /// + /// 3 + public CameraDeviceState State { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs b/src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs new file mode 100755 index 0000000..0ac4f50 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraDisplaySettings.cs @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Native = Interop.CameraDisplay; + +namespace Tizen.Multimedia +{ + /// + /// The CameraDisplay class allows you to manage display for the camera. + /// It allows to set and get various display properties such as + /// rotation, display visibility and display mode. + /// + public class CameraDisplaySettings + { + internal readonly Camera _camera; + + internal CameraDisplaySettings(Camera camera) + { + _camera = camera; + } + + /// + /// The display mode. + /// + /// 3 + /// + /// This property is meaningful only in overlay or EVAS surface display type. + /// + /// A that specifies the display mode. + /// Display type is incorrect. + /// The camera already has been disposed. + public CameraDisplayMode Mode + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetMode(_camera.GetHandle(), out var val), + "Failed to get camera display mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraDisplayMode), value); + CameraErrorFactory.ThrowIfError(Native.SetMode(_camera.GetHandle(), value), + "Failed to set camera display mode."); + } + } + + /// + /// The display visibility. + /// True if camera display visible, otherwise false. + /// + /// 3 + /// + /// This property is meaningful only in overlay or EVAS surface display type. + /// + /// Display type is incorrect. + /// The camera already has been disposed. + public bool Visible + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetVisible(_camera.GetHandle(), out bool val), + "Failed to get visible value"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetVisible(_camera.GetHandle(), value), + "Failed to set display visible."); + } + } + + /// + /// The display rotation. + /// + /// 3 + /// + /// This property is meaningful only in overlay or EVAS surface display type. + /// + /// A that specifies the rotation of camera device. + /// Display type is incorrect. + /// The camera already has been disposed. + public Rotation Rotation + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetRotation(_camera.GetHandle(), out var val), + "Failed to get display rotation"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(Rotation), value); + + CameraErrorFactory.ThrowIfError(Native.SetRotation(_camera.GetHandle(), value), + "Failed to set display rotation."); + } + } + + /// + /// The display flip. + /// + /// 3 + /// + /// This property is meaningful only in overlay or EVAS surface display type. + /// + /// A that specifies camera flip type. + /// Display type is incorrect. + /// The camera already has been disposed. + public Flips Flip + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val), + "Failed to get display flip"); + + return val; + } + + set + { + ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips)); + + CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value), + "Failed to set display flip."); + } + } + + /// + /// the ROI(Region Of Interest) area of display. + /// + /// 3 + /// + /// This property is meaningful only in overlay or EVAS surface display type. + /// + /// Display type is incorrect. + /// The camera already has been disposed. + public Rectangle RoiArea + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetRoiArea(_camera.GetHandle(), + out int x, out int y, out int width, out int height), "Failed to get display roi area"); + + return new Rectangle(x, y, width, height); + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetRoiArea(_camera.GetHandle(), + value.X, value.Y, value.Width, value.Height), "Failed to set display roi area."); + } + } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs b/src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs new file mode 100644 index 0000000..65dce11 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraEnums.cs @@ -0,0 +1,860 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for Camera device. + /// + /// 3 + public enum CameraDevice + { + /// + /// Rear Camera device. + /// + Rear, + /// + /// Front Camera device. + /// + Front + } + + /// + /// Enumeration for Camera device state. + /// + /// 3 + public enum CameraDeviceState + { + /// + /// Not opened. + /// + NotOpened, + /// + /// Opened. + /// + Opened, + /// + /// Now previewing or capturing or is being used for video recording. + /// + Working + } + + /// + /// Enumeration for the facing direction of camera module . + /// + /// 3 + public enum CameraFacingDirection + { + /// + /// Rear direction. + /// + Rear, + /// + /// Front direction + /// + Front + } + + /// + /// Enumeration for the current flash state. + /// + /// 3 + public enum CameraFlashState + { + /// + /// Flash is not used now through camera API. + /// + NotUsed, + /// + /// Flash is used now through camera API. + /// + Used + } + + /// + /// Enumeration for the camera focus state. + /// + /// 3 + public enum CameraFocusState + { + /// + /// Focus released. + /// + Released, + /// + /// Focus in progress + /// + Ongoing, + /// + /// Focus succeeded + /// + Focused, + /// + /// Focus failed. + /// + Failed + } + + /// + /// Enumeration for the camera pixel format. + /// + /// 3 + public enum CameraPixelFormat + { + /// + /// Invalid pixel format. + /// + Invalid = -1, + /// + /// NV12 pixel format. + /// + Nv12, + /// + /// NV12 Tiled pixel format. + /// + Nv12t, + /// + /// NV16 pixel format. + /// + Nv16, + /// + /// NV21 pixel format. + /// + Nv21, + /// + /// YUYV(YUY2) pixel format. + /// + Yuyv, + /// + /// UYVY pixel format. + /// + Uyvy, + /// + /// YUV422(Y:U:V) planar pixel format. + /// + Yuv422Planar, + /// + /// I420 pixel format. + /// + I420, + /// + /// YV12 pixel format. + /// + Yv12, + /// + /// RGB565 pixel format. + /// + Rgb565, + /// + /// RGB565 pixel format. + /// + Rgb888, + /// + /// RGBA pixel format. + /// + Rgba, + /// + /// ARGB pixel format. + /// + Argb, + /// + /// Encoded pixel format. + /// + Jpeg, + /// + /// Encoded pixel format : H264. + /// + H264 = 15 + } + + /// + /// Enumeration for the camera policy. + /// + /// 3 + public enum CameraPolicy + { + /// + /// None. + /// + None, + /// + /// Security policy + /// + Security = 4, + /// + /// Resource conflict + /// + ResourceConflict + } + + /// + /// Enumeration for the camera state. + /// + /// 3 + public enum CameraState + { + /// + /// Before creating. + /// + None, + /// + /// Created, but not initialized yet. + /// + Created, + /// + /// Preview. + /// + Preview, + /// + /// While capturing. + /// + Capturing, + /// + /// After capturing. + /// + Captured + } + + /// + /// Enumeration for the auto focus mode. + /// + /// 3 + public enum CameraAutoFocusMode + { + /// + /// auto-focus is not set. + /// + None, + /// + /// auto-focus in the normal mode. + /// + Normal, + /// + /// auto-focus in the macro mode(close distance). + /// + Macro, + /// + /// auto-focus in the full mode(all range scan, limited by device spec). + /// + Full + } + + /// + /// Enumeration for the color tone, which provides the impression of looking through a tinted glass. + /// + /// 3 + public enum CameraEffectMode + { + /// + /// None. + /// + None, + /// + /// Mono. + /// + Mono, + /// + /// Sepia. + /// + Sepia, + /// + /// Negative. + /// + Negative, + /// + /// Blue. + /// + Blue, + /// + /// Green. + /// + Green, + /// + /// Aqua. + /// + Aqua, + /// + /// Violet. + /// + Violet, + /// + /// Orange. + /// + Orange, + /// + /// Gray. + /// + Gray, + /// + /// Red. + /// + Red, + /// + /// Antique. + /// + Antique, + /// + /// Warm. + /// + Warm, + /// + /// Pink. + /// + Pink, + /// + /// Yellow. + /// + Yellow, + /// + /// Purple. + /// + Purple, + /// + /// Emboss. + /// + Emboss, + /// + /// Outline. + /// + Outline, + /// + /// Solarization. + /// + Solarization, + /// + /// Sketch. + /// + Sketch, + /// + /// Washed. + /// + Washed, + /// + /// Vintage warm. + /// + VintageWarm, + /// + /// Vintage cold . + /// + VintageCold, + /// + /// Posterization. + /// + Posterization, + /// + /// Cartoon. + /// + Cartoon, + /// + /// Selective color - Red. + /// + SelectiveRed, + /// + /// Selective color - Green. + /// + SelectiveGreen, + /// + /// Selective color - Blue. + /// + SelectiveBlue, + /// + /// Selective color - Yellow. + /// + SelectiveYellow, + /// + /// Selective color - Red and Yellow. + /// + SelectiveRedYellow, + /// + /// Other Graphic effects. + /// + OtherGraphics + } + + /// + /// Enumeration for the camera exposure modes. + /// + /// 3 + public enum CameraExposureMode + { + /// + /// Off. + /// + Off, + /// + /// All mode. + /// + All, + /// + /// Center mode. + /// + Center, + /// + /// Spot mode. + /// + Spot, + /// + /// Custom mode. + /// + Custom + } + + /// + /// Enumeration for the flash mode. + /// + /// 3 + public enum CameraFlashMode + { + /// + /// Always off. + /// + Off, + /// + /// Always splashes. + /// + On, + /// + /// Depending on intensity of light, strobe starts to flash. + /// + Auto, + /// + /// Red eye reduction. Multiple flash before capturing. + /// + RedEyeReduction, + /// + /// Slow sync curtain synchronization. + /// + SlowSync, + /// + /// Front curtain synchronization. + /// + FrontCurtain, + /// + /// Rear curtain synchronization. + /// + RearCurtain, + /// + /// Keep turned on until turning off. + /// + Permanent + } + + /// + /// Enumeration for preview FPS. + /// + /// 3 + public enum CameraFps + { + /// + /// Auto FPS. + /// + Auto = 0, + /// + /// 7 FPS. + /// + Fps7 = 7, + /// + /// 8 FPS. + /// + Fps8 = 8, + /// + /// 15 FPS. + /// + Fps15 = 15, + /// + /// 20 FPS. + /// + Fps20 = 20, + /// + /// 24 FPS. + /// + Fps24 = 24, + /// + /// 25 FPS. + /// + Fps25 = 25, + /// + /// 30 FPS. + /// + Fps30 = 30, + /// + /// 60 FPS. + /// + Fps60 = 60, + /// + /// 90 FPS. + /// + Fps90 = 90, + /// + /// 120 FPS. + /// + Fps120 = 120 + } + + /// + /// Enumeration for HDR capture mode. + /// + /// 3 + public enum CameraHdrMode + { + /// + /// Disable HDR capture. + /// + Disable, + /// + /// Enable HDR capture. + /// + Enable, + /// + /// Enable HDR capture and keep original image data. + /// + KeepOriginal + } + + /// + /// Enumeration for the ISO levels of the camera. + /// + /// 3 + public enum CameraIsoLevel + { + /// + /// ISO auto mode. + /// + Auto, + /// + /// ISO 50. + /// + Iso50, + /// + /// ISO 100. + /// + Iso100, + /// + /// ISO 200. + /// + Iso200, + /// + /// ISO 400. + /// + Iso400, + /// + /// ISO 800. + /// + Iso800, + /// + /// ISO 1600. + /// + Iso1600, + /// + /// ISO 3200. + /// + Iso3200 + } + + /// + /// Enumeration for PTZ(Pan Tilt Zoom) movement type. + /// + /// 3 + public enum CameraPtzMoveType + { + /// + /// Move to a specific coordinate position. + /// + Absoulute, + /// + /// Move a specific distance from the current position. + /// + Relative + } + + /// + /// Enumeration for PTZ(Pan Tilt Zoom) type. + /// + /// 3 + public enum CameraPtzType + { + /// + /// Move the camera device physically. + /// + Mechanical, + /// + /// Zoom digitally and move into portion of the image. + /// + Electronic + } + + /// + /// Enumeration for the camera scene mode. + /// + /// 3 + public enum CameraSceneMode + { + /// + /// Normal. + /// + Normal, + /// + /// Portrait. + /// + Portrait, + /// + /// Landscape. + /// + Landscape, + /// + /// Sports. + /// + Sports, + /// + /// Party & Indoor. + /// + PartyAndIndoor, + /// + /// Beach & Indoor. + /// + BeachAndIndoor, + /// + /// Sunset. + /// + Sunset, + /// + /// Dusk & Dawn. + /// + DuskAndDawn, + /// + /// Fall. + /// + FallColor, + /// + /// Night scene. + /// + NightScene, + /// + /// Firework. + /// + FireWork, + /// + /// Text. + /// + Text, + /// + /// Show window. + /// + ShowWindow, + /// + /// Candle light. + /// + CandleLight, + /// + /// Backlight. + /// + BackLight, + /// + /// Aqua. + /// + Aqua + } + + /// + /// Enumeration for the orientation values of tag. + /// + /// 3 + public enum CameraTagOrientation + { + /// + /// Row #0 is at the top, Column #0 is to the left. + /// + TopLeft = 1, + /// + /// Row #0 is at the top, Column #0 is to the right. + /// + TopRight = 2, + /// + /// Row #0 is at the bottom, Column #0 is to the right. + /// + BottomRight = 3, + /// + /// Row #0 is at the bottom, Column #0 is to the left. + /// + BottomLeft = 4, + /// + /// Row #0 is at the left, Column #0 is to the top. + /// + LeftTop = 5, + /// + /// Row #0 is at the right, Column #0 is to the top. + /// + RightTop = 6, + /// + /// Row #0 is at the right, Column #0 is to the bottom. + /// + RightBottom = 7, + /// + /// Row #0 is at the left, Column #0 is to the bottom. + /// + LeftBottom = 8 + } + + /// + /// Enumeration for the theater mode. + /// + /// 3 + public enum CameraTheaterMode + { + /// + /// Disable theater mode - External display shows same image as device display. + /// + Disable, + /// + /// Clone mode - Preview image is displayed on external display with full screen mode. Also preview image is shown by the UI on device display. + /// + Clone, + /// + /// Enable theater mode - Preview image is displayed on external display with full screen mode, but preview image is not shown on device display. + /// + Enable + } + + /// + ///Enumeration for the white balance levels of the camera. + /// + /// 3 + public enum CameraWhiteBalance + { + /// + /// None. + /// + None, + /// + /// Automatic. + /// + Automatic, + /// + /// Daylight. + /// + Daylight, + /// + /// Cloudy. + /// + Cloudy, + /// + /// Fluorescent. + /// + Fluorescent, + /// + /// Incandescent. + /// + Incandescent, + /// + /// Shade. + /// + Shade, + /// + /// Horizon. + /// + Horizon, + /// + /// Flash. + /// + Flash, + /// + /// Custom. + /// + Custom + } + + /// + /// Enumeration for the camera display mode. + /// + /// 3 + public enum CameraDisplayMode + { + /// + /// Letter box. + /// + LetterBox, + /// + /// Origin size. + /// + OriginSize, + /// + /// Full screen. + /// + Full, + /// + /// Cropped full screen. + /// + CroppedFull, + /// + /// Original size or letter box. + /// + OriginOrLetterBox, + /// + /// Custom ROI. + /// + CustomROI + } + + /// + /// Enumeration for camera failure error. + /// + /// 3 + public enum CameraErrorCode + { + /// + /// Device Error. + /// + DeviceError = CameraError.DeviceError, + /// + /// Internal error. + /// + InvalidOperation = CameraError.InvalidOperation, + /// + /// Out of memory. + /// + OutOfMemory = CameraError.OutOfMemory, + /// + /// Service is disconnected. + /// + ServiceDisconnected = CameraError.ServiceDisconnected + } + + /// + /// Enumeration for Image datatype. + /// + /// 3 + public enum PlaneType + { + /// + /// Single plane data. + /// + SinglePlane, + /// + /// Double plane data. + /// + DoublePlane, + /// + /// Triple plane data. + /// + TriplePlane, + /// + /// Encoded plane data. + /// + EncodedPlane + } +} diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs b/src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs new file mode 100644 index 0000000..15862f3 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraErrorFactory.cs @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum CameraError + { + TizenErrorCamera = -0x01910000, + CameraErrorClass = TizenErrorCamera, + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidState = CameraErrorClass | 0x02, + OutOfMemory = ErrorCode.OutOfMemory, + DeviceError = CameraErrorClass | 0x04, + InvalidOperation = ErrorCode.InvalidOperation, + SecurityRestricted = CameraErrorClass | 0x07, + DeviceBusy = CameraErrorClass | 0x08, + DeviceNotFound = CameraErrorClass | 0x09, + Esd = CameraErrorClass | 0x0c, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + ResourceConflict = CameraErrorClass | 0x0d, + ServiceDisconnected = CameraErrorClass | 0x0e + } + + internal static class CameraErrorFactory + { + internal static void ThrowIfError(CameraError errorCode, string errorMessage = null, + [CallerMemberName] string caller = null, [CallerLineNumber] int line = 0) + { + if (errorCode == CameraError.None) + { + return; + } + + Log.Info(CameraLog.Tag, "errorCode : " + errorCode.ToString() + ", Caller : " + caller + ", line " + line.ToString()); + + switch (errorCode) + { + case CameraError.InvalidParameter: + throw new ArgumentException(errorMessage); + + case CameraError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + + case CameraError.DeviceError: + case CameraError.DeviceBusy: + case CameraError.Esd: + throw new CameraDeviceException(errorMessage); + + case CameraError.DeviceNotFound: + throw new CameraDeviceNotFoundException(errorMessage); + + case CameraError.SecurityRestricted: + case CameraError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + + case CameraError.NotSupported: + throw new NotSupportedException(errorMessage); + + case CameraError.InvalidState: + case CameraError.InvalidOperation: + case CameraError.ResourceConflict: + case CameraError.ServiceDisconnected: + throw new InvalidOperationException(errorMessage); + + default: + throw new Exception("Unknown error : " + errorCode); + } + } + } +} diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs new file mode 100755 index 0000000..883596b --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraErrorOccurredEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about error status and + /// state of the camera when it failed. + /// + public class CameraErrorOccurredEventArgs : EventArgs + { + internal CameraErrorOccurredEventArgs(CameraErrorCode error, CameraState state) + { + Error = error; + State = state; + } + + /// + /// The camera error code. + /// + /// 3 + public CameraErrorCode Error { get; } + + /// + /// The state of the camera. + /// + /// 3 + public CameraState State { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraException.cs b/src/Tizen.Multimedia.Camera/Camera/CameraException.cs new file mode 100644 index 0000000..36f46d7 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraException.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + public class CameraException : Exception + { + public CameraException() : base() + { + } + + public CameraException(string message) : base(message) + { + } + } + + public class CameraDeviceException : CameraException + { + public CameraDeviceException() : base() + { + } + + public CameraDeviceException(string message) : base(message) + { + } + } + + public class CameraDeviceNotFoundException : CameraException + { + public CameraDeviceNotFoundException() : base() + { + } + + public CameraDeviceNotFoundException(string message) : base(message) + { + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs new file mode 100755 index 0000000..c288d73 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraFocusStateChangedEventArgs.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about focus state of the + /// camera. + /// + public class CameraFocusStateChangedEventArgs : EventArgs + { + internal CameraFocusStateChangedEventArgs(CameraFocusState state) + { + State = state; + } + + /// + /// Focus state of the camera. + /// + /// 3 + public CameraFocusState State { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraInterruptStartedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraInterruptStartedEventArgs.cs new file mode 100755 index 0000000..626e465 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraInterruptStartedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about current state + /// of the camera when interrupt is invoked internally in Native FW. + /// + public class CameraInterruptStartedEventArgs : EventArgs + { + internal CameraInterruptStartedEventArgs(CameraPolicy policy, CameraState state) + { + Policy = policy; + State = state; + } + + /// + /// Current state of the camera. + /// + public CameraState State { get; } + + /// + /// The policy that interrupted the camera. + /// + public CameraPolicy Policy { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs new file mode 100755 index 0000000..4ce158a --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraInterruptedEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about previous and current state + /// of the camera when its interrupted. + /// + public class CameraInterruptedEventArgs : EventArgs + { + internal CameraInterruptedEventArgs(CameraPolicy policy, CameraState previous, CameraState current) + { + Policy = policy; + Current = current; + Previous = previous; + } + + /// + /// Previous state of the camera. + /// + /// 3 + public CameraState Previous { get; } + + /// + /// Current state of the camera. + /// + /// 3 + public CameraState Current { get; } + + /// + /// The policy that interrupted the camera. + /// + /// 3 + public CameraPolicy Policy { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs b/src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs new file mode 100755 index 0000000..318c73f --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraSettings.cs @@ -0,0 +1,1160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Native = Interop.CameraSettings; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The camera setting class provides methods/properties to get and + /// set basic camera attributes. + /// + public class CameraSettings + { + internal readonly Camera _camera; + + private readonly Range? _brightnessRange; + private readonly Range? _contrastRange; + private readonly Range? _panRange; + private readonly Range? _tiltRange; + private readonly Range? _exposureRange; + private readonly Range? _zoomRange; + + internal CameraSettings(Camera camera) + { + _camera = camera; + + _contrastRange = GetRange(Native.GetContrastRange); + _brightnessRange = GetRange(Native.GetBrightnessRange); + _exposureRange = GetRange(Native.GetExposureRange); + _zoomRange = GetRange(Native.GetZoomRange); + _panRange = GetRange(Native.GetPanRange); + _tiltRange = GetRange(Native.GetTiltRange); + } + + private delegate CameraError GetRangeDelegate(IntPtr handle, out int min, out int max); + private Range? GetRange(GetRangeDelegate func) + { + CameraErrorFactory.ThrowIfError(func(_camera.GetHandle(), out int min, out int max), + "Failed to initialize the camera settings"); + + if (min > max) + { + return null; + } + + return new Range(min, max); + } + + #region Auto Focus + /// + /// Sets auto focus area. + /// + /// 3 + /// + /// should not be the . + /// + /// X position + /// Y position + /// In case of invalid parameters. + /// In case of any invalid operations. + /// The camera already has been disposed. + public void SetAutoFocusArea(int x, int y) + { + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), x, y), + "Failed to set the autofocus area."); + } + + /// + /// Sets auto focus area. + /// + /// 3 + /// + /// should not be the . + /// + /// structure including X, Y position + /// In case of invalid parameters. + /// In case of any invalid operations. + /// The camera already has been disposed. + public void SetAutoFocusArea(Point pos) + { + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusArea(_camera.GetHandle(), pos.X, pos.Y), + "Failed to set the autofocus area."); + } + + /// + /// Clears the auto focus area. + /// + /// 3 + /// The camera already has been disposed. + public void ClearFocusArea() + { + CameraErrorFactory.ThrowIfError(Native.ClearAutoFocusArea(_camera.GetHandle()), + "Failed to clear the autofocus area."); + } + + /// + /// The auto focus mode. + /// + /// 3 + /// A that specifies the auto focus mode. + /// The camera already has been disposed. + public CameraAutoFocusMode AutoFocusMode + { + get + { + CameraAutoFocusMode val = CameraAutoFocusMode.None; + + CameraErrorFactory.ThrowIfError(Native.GetAutoFocusMode(_camera.GetHandle(), out val), + "Failed to get camera autofocus mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraAutoFocusMode), value); + CameraErrorFactory.ThrowIfError(Native.SetAutoFocusMode(_camera.GetHandle(), value), + "Failed to set camera autofocus mode."); + } + } + #endregion Auto Focus + + #region Contrast + /// + /// The contrast level of the camera. + /// + /// 3 + /// The camera already has been disposed. + public int Contrast + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetContrast(_camera.GetHandle(), out int val), + "Failed to get camera contrast value"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetContrast(_camera.GetHandle(), value), + "Failed to set camera contrast value."); + } + } + + /// + /// The auto contrast. + /// If true auto contrast is enabled, otherwise false. + /// + /// 3 + /// The camera already has been disposed. + public bool AutoContrast + { + get + { + CameraErrorFactory.ThrowIfError(Native.IsEnabledAutoContrast(_camera.GetHandle(), out bool val), + "Failed to get camera auto contrast"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.EnableAutoContrast(_camera.GetHandle(), value), + "Failed to set camera enable auto contrast."); + } + } + /// + /// Gets the available contrast level. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range ContrastRange + { + get + { + if (!_contrastRange.HasValue) + { + throw new NotSupportedException("Contrast is not supported."); + } + + return _contrastRange.Value; + } + } + #endregion Contrast + + #region Brightness + /// + /// The brightness level of the camera. + /// + /// 3 + /// The camera already has been disposed. + public int Brightness + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetBrightness(_camera.GetHandle(), out int val), + "Failed to get camera brightness value"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetBrightness(_camera.GetHandle(), value), + "Failed to set camera brightness value."); + } + } + + /// + /// Gets the available brightness level. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range BrightnessRange + { + get + { + if (!_brightnessRange.HasValue) + { + throw new NotSupportedException("Brightness is not supported."); + } + + return _brightnessRange.Value; + } + } + #endregion Brightness + + #region Exposure + /// + /// The exposure value. + /// + /// 3 + /// The camera already has been disposed. + public int Exposure + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetExposure(_camera.GetHandle(), out int val), + "Failed to get camera exposure value"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetExposure(_camera.GetHandle(), value), + "Failed to set camera exposure value."); + } + } + + /// + /// The exposure mode. + /// + /// 3 + /// A that specifies the exposure mode. + /// The camera already has been disposed. + public CameraExposureMode ExposureMode + { + get + { + CameraExposureMode val = CameraExposureMode.Off; + + CameraErrorFactory.ThrowIfError(Native.GetExposureMode(_camera.GetHandle(), out val), + "Failed to get camera exposure mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraExposureMode), value); + CameraErrorFactory.ThrowIfError(Native.SetExposureMode(_camera.GetHandle(), value), + "Failed to set camera exposure mode."); + } + } + + /// + /// Gets the available exposure value. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range ExposureRange + { + get + { + if (!_exposureRange.HasValue) + { + throw new NotSupportedException("Exposure is not supported."); + } + + return _exposureRange.Value; + } + } + #endregion Exposure + + #region Zoom + /// + /// The zoom level. + /// The range for zoom level is received from ZoomRange property. + /// + /// 3 + /// The camera already has been disposed. + public int ZoomLevel + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetZoom(_camera.GetHandle(), out int val), + "Failed to get zoom level"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetZoom(_camera.GetHandle(), value), + "Failed to set zoom level."); + } + } + + /// + /// Gets the available zoom level. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range ZoomRange + { + get + { + if (!_zoomRange.HasValue) + { + throw new NotSupportedException("Zoom is not supported."); + } + + return _zoomRange.Value; + } + } + #endregion Zoom + + /// + /// The whitebalance mode. + /// + /// 3 + /// A that specifies the white balance mode. + /// The camera already has been disposed. + public CameraWhiteBalance WhiteBalance + { + get + { + CameraWhiteBalance val = CameraWhiteBalance.None; + + CameraErrorFactory.ThrowIfError(Native.GetWhiteBalance(_camera.GetHandle(), out val), + "Failed to get camera whitebalance"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraWhiteBalance), value); + CameraErrorFactory.ThrowIfError(Native.SetWhitebalance(_camera.GetHandle(), value), + "Failed to set camera whitebalance."); + } + } + + /// + /// The ISO level. + /// + /// 3 + /// A that specifies ISO level. + /// The camera already has been disposed. + public CameraIsoLevel IsoLevel + { + get + { + CameraIsoLevel val = CameraIsoLevel.Auto; + + CameraErrorFactory.ThrowIfError(Native.GetIso(_camera.GetHandle(), out val), + "Failed to get camera Iso level"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraIsoLevel), value); + CameraErrorFactory.ThrowIfError(Native.SetIso(_camera.GetHandle(), value), + "Failed to set camera Iso level."); + } + } + + /// + /// The quality of the image. + /// The range for image quality is 1 to 100. + /// + /// 3 + /// The camera already has been disposed. + public int ImageQuality + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetImageQuality(_camera.GetHandle(), out int val), + "Failed to get image quality"); + + return val; + } + + set + { + if (value < 1 || value > 100) + { + throw new ArgumentException("Valid value is from 1(lowest quality) to 100(highest quality)"); + } + + CameraErrorFactory.ThrowIfError(Native.SetImageQuality(_camera.GetHandle(), value), + "Failed to set image quality."); + } + } + + #region Resolution, Format, Fps of preview, capture + /// + /// The preview frame rate. + /// + /// 3 + /// A that specifies preview frame rate. + /// The camera already has been disposed. + public CameraFps PreviewFps + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetPreviewFps(_camera.GetHandle(), out var val), + "Failed to get camera preview fps"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraFps), value); + CameraErrorFactory.ThrowIfError(Native.SetPreviewFps(_camera.GetHandle(), value), + "Failed to set preview fps."); + } + } + + /// + /// Gets or sets the resolution of preview + /// + /// 3 + /// In case of invalid parameters. + /// The camera already has been disposed. + public Size PreviewResolution + { + get + { + CameraErrorFactory.ThrowIfError(GetPreviewResolution(_camera.GetHandle(), out int width, out int height), + "Failed to get camera preview resolution"); + + return new Size(width, height); + } + + set + { + CameraErrorFactory.ThrowIfError(SetPreviewResolution(_camera.GetHandle(), value.Width, value.Height), + "Failed to set preview resolution."); + } + } + + /// + /// Gets the recommended preview resolution. + /// + /// 3 + /// + /// Depending on the capture resolution aspect ratio and display resolution, + /// the recommended preview resolution is determined. + /// + /// The camera already has been disposed. + public Size RecommendedPreviewResolution + { + get + { + CameraErrorFactory.ThrowIfError(GetRecommendedPreviewResolution(_camera.GetHandle(), out int width, out int height), + "Failed to get recommended preview resolution"); + + return new Size(width, height); + } + } + + /// + /// The preview data format. + /// + /// 3 + /// A that specifies the pixel format of preview data. + /// In case of invalid parameters. + /// The camera already has been disposed. + public CameraPixelFormat PreviewPixelFormat + { + get + { + CameraErrorFactory.ThrowIfError(GetPreviewPixelFormat(_camera.GetHandle(), out var val), + "Failed to get preview format"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value); + CameraErrorFactory.ThrowIfError(SetPreviewPixelFormat(_camera.GetHandle(), value), + "Failed to set preview format."); + } + } + + /// + /// Resolution of the captured image. + /// + /// 3 + /// In case of invalid parameters + /// The camera already has been disposed. + public Size CaptureResolution + { + get + { + CameraErrorFactory.ThrowIfError(GetCaptureResolution(_camera.GetHandle(), out int width, out int height), + "Failed to get camera capture resolution"); + + return new Size(width, height); + } + + set + { + Size res = value; + + CameraErrorFactory.ThrowIfError(SetCaptureResolution(_camera.GetHandle(), res.Width, res.Height), + "Failed to set capture resolution."); + } + } + + /// + /// Format of an image to be captured. + /// + /// 3 + /// A that specifies the pixel format of captured image. + /// In case of invalid parameters. + /// The camera already has been disposed. + public CameraPixelFormat CapturePixelFormat + { + get + { + CameraErrorFactory.ThrowIfError(GetCaptureFormat(_camera.GetHandle(), out var val), + "Failed to get camera capture formats"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraPixelFormat), value); + CameraErrorFactory.ThrowIfError(SetCaptureFormat(_camera.GetHandle(), value), + "Failed to set capture format."); + } + } + #endregion Resolution, Format, Fps of preview, capture + + #region Encoded preview + /// + /// The bit rate of encoded preview. + /// + /// 3 + /// The camera already has been disposed. + public int EncodedPreviewBitrate + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetBitrate(_camera.GetHandle(), out int val), + "Failed to get preview bitrate"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetBitrate(_camera.GetHandle(), value), + "Failed to set encoded preview bitrate."); + } + } + + /// + /// GOP(Group Of Pictures) interval of encoded preview. + /// + /// 3 + /// The camera already has been disposed. + public int EncodedPreviewGopInterval + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetGopInterval(_camera.GetHandle(), out int val), + "Failed to get preview gop interval"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetGopInterval(_camera.GetHandle(), value), + "Failed to set encoded preview gop intervals."); + } + } + #endregion Encoded preview + + /// + /// The theater mode. + /// + /// 3 + /// A that specifies theater mode. + /// + /// If you want to display the preview image on the external display with the full screen mode, + /// use this property. + /// + /// The camera already has been disposed. + public CameraTheaterMode TheaterMode + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetTheaterMode(_camera.GetHandle(), out var val), + "Failed to get camera theater mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraTheaterMode), value); + CameraErrorFactory.ThrowIfError(Native.SetTheaterMode(_camera.GetHandle(), value), + "Failed to set camera theater mode."); + } + } + + /// + /// The camera effect mode. + /// + /// 3 + /// A that specifies effect mode. + /// The camera already has been disposed. + public CameraEffectMode Effect + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetEffect(_camera.GetHandle(), out var val), + "Failed to get camera effect"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraEffectMode), value); + CameraErrorFactory.ThrowIfError(Native.SetEffect(_camera.GetHandle(), value), + "Failed to set camera effect."); + } + } + + /// + /// The scene mode. + /// + /// 3 + /// A that specifies scene mode. + /// The camera already has been disposed. + public CameraSceneMode SceneMode + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetSceneMode(_camera.GetHandle(), out var val), + "Failed to get camera scene mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraSceneMode), value); + CameraErrorFactory.ThrowIfError(Native.SetSceneMode(_camera.GetHandle(), value), + "Failed to set camera scene mode."); + } + } + + /// + /// The camera's flash mode. + /// + /// 3 + /// A that specifies flash mode. + /// The camera already has been disposed. + public CameraFlashMode FlashMode + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetFlashMode(_camera.GetHandle(), out var val), + "Failed to get camera flash mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraFlashMode), value); + CameraErrorFactory.ThrowIfError(Native.SetFlashMode(_camera.GetHandle(), value), + "Failed to set camera flash mode."); + } + } + + /// + /// Gets the camera lens orientation angle. + /// + /// 3 + /// The camera already has been disposed. + public int LensOrientation + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetLensOrientation(_camera.GetHandle(), out var val), + "Failed to get camera lens orientation"); + + return val; + } + } + + /// + /// The stream rotation. + /// + /// 3 + /// A that specifies the rotation of camera device. + /// The camera already has been disposed. + public Rotation StreamRotation + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetStreamRotation(_camera.GetHandle(), out var val), + "Failed to get camera stream rotation"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(Rotation), value); + + CameraErrorFactory.ThrowIfError(Native.SetStreamRotation(_camera.GetHandle(), value), + "Failed to set camera stream rotation."); + } + } + + /// + /// The stream flip. + /// + /// 3 + /// A that specifies camera flip type. + /// The camera already has been disposed. + public Flips StreamFlip + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetFlip(_camera.GetHandle(), out var val), + "Failed to get camera stream flip"); + + return val; + } + + set + { + ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips)); + + CameraErrorFactory.ThrowIfError(Native.SetFlip(_camera.GetHandle(), value), + "Failed to set camera flip."); + } + } + + /// + /// The mode of HDR(High dynamic range) capture. + /// + /// 3 + /// A that specifies the HDR mode. + /// + /// Taking multiple pictures at different exposure levels and intelligently stitching them together + /// so that we eventually arrive at a picture that is representative in both dark and bright areas. + /// If this attribute is set, then eventhandler set for HdrCaptureProgress event is invoked. + /// + /// The camera already has been disposed. + public CameraHdrMode HdrMode + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetHdrMode(_camera.GetHandle(), out var val), + "Failed to get camera hdr mode"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraHdrMode), value); + CameraErrorFactory.ThrowIfError(Native.SetHdrMode(_camera.GetHandle(), value), + "Failed to set camera hdr mode."); + } + } + + /// + /// The anti shake feature. + /// If true the antishake feature is enabled, otherwise false. + /// + /// 3 + /// The camera already has been disposed. + public bool AntiShake + { + get + { + CameraErrorFactory.ThrowIfError(Native.IsEnabledAntiShake(_camera.GetHandle(), out bool val), + "Failed to get camera anti shake value"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.EnableAntiShake(_camera.GetHandle(), value), + "Failed to set camera anti shake value."); + } + } + + /// + /// Enables/Disables the video stabilization feature. + /// If true video stabilization is enabled, otherwise false. + /// + /// 3 + /// + /// If video stabilization is enabled, zero shutter lag is disabled. + /// This feature is used to record a video. + /// + /// The camera already has been disposed. + public bool VideoStabilization + { + get + { + CameraErrorFactory.ThrowIfError(Native.IsEnabledVideoStabilization(_camera.GetHandle(), out bool val), + "Failed to get camera video stabilization"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.EnableVideoStabilization(_camera.GetHandle(), value), + "Failed to set camera video stabilization."); + } + } + + /// + /// Turn the shutter sound on or off, if it is permitted by policy. + /// + /// 3 + /// Shutter sound On/Off flag + /// + /// If this value is true, shutter sound will be disabled, otherwise enabled. + /// In some countries, this operation is not permitted. + /// + /// Disabling shutter sound is not permitted. + /// The camera already has been disposed. + public void DisableShutterSound(bool shutterSound) + { + CameraErrorFactory.ThrowIfError(Native.DisableShutterSound(_camera.GetHandle(), shutterSound), + "Failed to set disable shutter sound."); + } + + #region PTZ(Pan Tilt Zoom), Pan, Tilt + /// + /// Sets the type of PTZ(Pan Tilt Zoom). Mechanical or Electronic. + /// + /// 3 + /// A that specifies the type of PTZ. + /// The camera already has been disposed. + public CameraPtzType PtzType + { + set + { + ValidationUtil.ValidateEnum(typeof(CameraPtzType), value); + + CameraErrorFactory.ThrowIfError(Native.SetPtzType(_camera.GetHandle(), value), + "Failed to set camera ptz type."); + } + } + + /// + /// Sets the position to move horizontally. + /// + /// 3 + /// ptz move type. + /// pan step + /// In case of invalid parameters. + /// The camera already has been disposed. + public void SetPan(CameraPtzMoveType type, int panStep) + { + ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type)); + CameraErrorFactory.ThrowIfError(Native.SetPan(_camera.GetHandle(), type, panStep), + "Failed to set the camera pan type."); + } + + /// + /// Gets the current position of the camera. + /// + /// 3 + /// Returns the camera's horizontal position + /// The camera already has been disposed. + public int GetPan() + { + CameraErrorFactory.ThrowIfError(Native.GetPan(_camera.GetHandle(), out int val), + "Failed to get the camera pan step."); + + return val; + } + + /// + /// Sets the position to move vertically. + /// + /// 3 + /// ptz move type + /// tilt step + /// In case of invalid parameters. + /// The camera already has been disposed. + public void SetTilt(CameraPtzMoveType type, int tiltStep) + { + ValidationUtil.ValidateEnum(typeof(CameraPtzMoveType), type, nameof(type)); + CameraErrorFactory.ThrowIfError(Native.SetTilt(_camera.GetHandle(), type, tiltStep), + "Failed to set the camera tilt type\t."); + } + + /// + /// Gets the current position of the camera. + /// + /// 3 + /// Returns the current vertical position + /// The camera already has been disposed. + public int GetTilt() + { + CameraErrorFactory.ThrowIfError(Native.GetTilt(_camera.GetHandle(), out int val), + "Failed to set the camera current position."); + + return val; + } + + /// + /// Gets lower limit and upper limit for pan position. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range PanRange + { + get + { + if (!_panRange.HasValue) + { + throw new NotSupportedException("Pan is not supported."); + } + return _panRange.Value; + } + } + + /// + /// Gets lower limit and upper limit for tilt position. + /// + /// 3 + /// + /// If min value is greater than the max value, it means this feature is not supported. + /// + /// In case of this feature is not supported. + public Range TiltRange + { + get + { + if (!_tiltRange.HasValue) + { + throw new NotSupportedException("Tilt is not supported."); + } + return _tiltRange.Value; + } + } + #endregion PTZ(Pan Tilt Zoom), Pan, Tilt + + #region EXIF tag + /// + /// The scene mode. + /// true if EXIF tags are enabled in JPEG file, otherwise false. + /// + /// 3 + /// The camera already has been disposed. + public bool EnableTag + { + get + { + CameraErrorFactory.ThrowIfError(Native.IsEnabledTag(_camera.GetHandle(), out bool val), + "Failed to get camera enable tag"); + + return val; + } + + set + { + CameraErrorFactory.ThrowIfError(Native.EnableTag(_camera.GetHandle(), value), + "Failed to set camera enable tag."); + } + } + + /// + /// The camera image description in the EXIF tag. + /// + /// 3 + /// The camera already has been disposed. + public string ImageDescriptionTag + { + get + { + IntPtr val = IntPtr.Zero; + try + { + CameraErrorFactory.ThrowIfError(Native.GetImageDescription(_camera.GetHandle(), out val), + "Failed to get image description"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + LibcSupport.Free(val); + } + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetImageDescription(_camera.GetHandle(), value), + "Failed to set image description."); + } + } + + /// + /// The software information in the EXIF tag. + /// + /// 3 + /// The camera already has been disposed. + public string SoftwareTag + { + get + { + IntPtr val = IntPtr.Zero; + + try + { + CameraErrorFactory.ThrowIfError(Native.GetTagSoftware(_camera.GetHandle(), out val), + "Failed to get tag software"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + LibcSupport.Free(val); + } + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetTagSoftware(_camera.GetHandle(), value), + "Failed to set tag software."); + } + } + + /// + /// The geotag(GPS data) in the EXIF tag. + /// + /// 3 + /// The camera already has been disposed. + public Location GeoTag + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetGeotag(_camera.GetHandle(), + out double latitude, out double longitude, out double altitude), "Failed to get tag"); + + return new Location(latitude, longitude, altitude); + } + + set + { + CameraErrorFactory.ThrowIfError(Native.SetGeotag(_camera.GetHandle(), + value.Latitude, value.Longitude, value.Altitude), "Failed to set geo tag."); + } + } + + /// + /// Removes the geotag(GPS data) in the EXIF(Exchangeable image file format) tag. + /// + /// 3 + /// The camera already has been disposed. + public void RemoveGeoTag() + { + CameraErrorFactory.ThrowIfError(Native.RemoveGeotag(_camera.GetHandle()), + "Failed to remove the geotag\t."); + } + + /// + /// The camera orientation in the tag. + /// + /// 3 + /// The camera already has been disposed. + public CameraTagOrientation OrientationTag + { + get + { + CameraErrorFactory.ThrowIfError(Native.GetTagOrientation(_camera.GetHandle(), out var val), + "Failed to get camera tag orientation"); + + return val; + } + + set + { + ValidationUtil.ValidateEnum(typeof(CameraTagOrientation), value); + CameraErrorFactory.ThrowIfError(Native.SetTagOrientation(_camera.GetHandle(), value), + "Failed to set camera tag orientation."); + } + } + #endregion EXIF tag + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs new file mode 100755 index 0000000..96e2e0c --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/CameraStateChangedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about previous and current state + /// of the camera when its state is changed. + /// + public class CameraStateChangedEventArgs : EventArgs + { + internal CameraStateChangedEventArgs(CameraState previous, CameraState current, bool policy) + { + Previous = previous; + Current = current; + ByPolicy = policy; + } + + /// + /// Previous state of the camera. + /// + /// 3 + public CameraState Previous { get; } + + /// + /// Current state of the camera. + /// + /// 3 + public CameraState Current { get; } + + /// + /// true if the state changed by policy such as Resource Conflict or Security, otherwise false + /// in normal state change. + /// + /// 3 + public bool ByPolicy { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs b/src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs new file mode 100755 index 0000000..e6960f1 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/DoublePlane.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing image data which has two planes. + /// + public class DoublePlane : IPreviewPlane + { + internal DoublePlane(DoublePlaneStruct unmanaged) + { + Y = new byte[unmanaged.YLength]; + UV = new byte[unmanaged.UVLength]; + Marshal.Copy(unmanaged.Y, Y, 0, (int)unmanaged.YLength); + Marshal.Copy(unmanaged.UV, UV, 0, (int)unmanaged.UVLength); + } + + /// + /// The Y plane data. + /// + /// 3 + public byte[] Y { get; } + + /// + /// The UV plane data. + /// + /// 3 + public byte[] UV { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs b/src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs new file mode 100755 index 0000000..d88e596 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/EncodedPlane.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing Encoded image data. + /// + public class EncodedPlane : IPreviewPlane + { + internal EncodedPlane(EncodedPlaneStruct unmanagedData) + { + Data = new byte[unmanagedData.DataLength]; + Marshal.Copy(unmanagedData.Data, Data, 0, (int)unmanagedData.DataLength); + } + + /// + /// The buffer containing encoded image data. + /// + /// 3 + public byte[] Data { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs new file mode 100755 index 0000000..6c5feaa --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/FaceDetectedEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about all the faces detected. + /// If user need to remain faces data, user have to copy the data. + /// + public class FaceDetectedEventArgs : EventArgs + { + internal FaceDetectedEventArgs(List faces) + { + Faces = faces; + } + + /// + /// List containing faces of type . + /// + /// 3 + public IEnumerable Faces { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs b/src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs new file mode 100755 index 0000000..53905c7 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/FaceDetectionData.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class contains the details of the detected face. + /// + public class FaceDetectionData + { + internal FaceDetectionData(IntPtr ptr) + { + var unmanagedStruct = Marshal.PtrToStructure(ptr); + + Id = unmanagedStruct.Id; + Score = unmanagedStruct.Score; + X = unmanagedStruct.X; + Y = unmanagedStruct.Y; + Width = unmanagedStruct.Width; + Height = unmanagedStruct.Height; + } + + /// + /// The Id of each face. + /// + /// 3 + public int Id { get; } + + /// + /// The confidence level for the detection of the face. + /// + /// 3 + public int Score { get; } + + /// + /// The X co-ordinate of the face. + /// + /// 3 + public int X { get; } + + /// + /// The Y co-ordinate of the face. + /// + /// 3 + public int Y { get; } + + /// + /// The width of the face. + /// + /// 3 + public int Width { get; } + + /// + /// The height of the face. + /// + /// 3 + public int Height { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs new file mode 100755 index 0000000..ce5db62 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/HdrCaptureProgressEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about the hdr capture progress. + /// + public class HdrCaptureProgressEventArgs : EventArgs + { + internal HdrCaptureProgressEventArgs(int percent) + { + Percent = percent; + } + + /// + /// Hdr Capture progress in percent. + /// + /// 3 + public int Percent { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs b/src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs new file mode 100755 index 0000000..e3b506b --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/IPreviewPlane.cs @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + public interface IPreviewPlane + { + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/Location.cs b/src/Tizen.Multimedia.Camera/Camera/Location.cs new file mode 100644 index 0000000..1733352 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/Location.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Location class containing GPS data details. + /// + public class Location + { + /// + /// Public constructor. + /// + /// Latitude data + /// Longitude data + /// Altitude data + public Location(double latitude, double longitude, double altitude) + { + Latitude = latitude; + Longitude = longitude; + Altitude = altitude; + } + + /// + /// The Latitude data. + /// + /// 3 + public double Latitude { get; } + + /// + /// The Longitude data. + /// + /// 3 + public double Longitude { get; } + + /// + /// The Altitude data. + /// + /// 3 + public double Altitude { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs new file mode 100755 index 0000000..40736c1 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/MediaPacketPreviewEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about the Media packet preview frame. + /// + public class MediaPacketPreviewEventArgs : EventArgs + { + internal MediaPacketPreviewEventArgs(MediaPacket packet) + { + Packet = packet; + } + + /// + /// Media Packet data. + /// + /// 3 + public MediaPacket Packet { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs b/src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs new file mode 100755 index 0000000..fe5d623 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/PreviewEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about the preview frame. + /// + public class PreviewEventArgs : EventArgs + { + internal PreviewEventArgs(PreviewFrame preview) + { + Preview = preview; + } + + /// + /// PreviewData frame. + /// + /// 3 + public PreviewFrame Preview { get; } + } +} + diff --git a/src/Tizen.Multimedia.Camera/Camera/PreviewFrame.cs b/src/Tizen.Multimedia.Camera/Camera/PreviewFrame.cs new file mode 100755 index 0000000..e21542d --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/PreviewFrame.cs @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing preview image data. + /// + public class PreviewFrame + { + internal PreviewFrame(IntPtr ptr) + { + var unmanagedStruct = Marshal.PtrToStructure(ptr); + + Format = unmanagedStruct.Format; + Resolution = new Size(unmanagedStruct.Width, unmanagedStruct.Height); + TimeStamp = unmanagedStruct.TimeStamp; + PlaneType = GetPlaneType(unmanagedStruct); + Plane = ConvertPlane(unmanagedStruct); + } + + private static IPreviewPlane ConvertPlane(CameraPreviewDataStruct unmanagedStruct) + { + if (unmanagedStruct.NumOfPlanes == 1) + { + if (unmanagedStruct.Format == CameraPixelFormat.H264 || unmanagedStruct.Format == CameraPixelFormat.Jpeg) + { + return new EncodedPlane(unmanagedStruct.Plane.EncodedPlane); + } + else + { + return new SinglePlane(unmanagedStruct.Plane.SinglePlane); + } + } + else if (unmanagedStruct.NumOfPlanes == 2) + { + return new DoublePlane(unmanagedStruct.Plane.DoublePlane); + } + else if (unmanagedStruct.NumOfPlanes == 3) + { + return new TriplePlane(unmanagedStruct.Plane.TriplePlane); + } + + Debug.Fail("Unknown preview data!"); + return null; + } + + private static PlaneType GetPlaneType(CameraPreviewDataStruct unmanagedStruct) + { + if (unmanagedStruct.NumOfPlanes == 1) + { + if (unmanagedStruct.Format == CameraPixelFormat.H264 || unmanagedStruct.Format == CameraPixelFormat.Jpeg) + { + return PlaneType.EncodedPlane; + } + else + { + return PlaneType.SinglePlane; + } + } + else if (unmanagedStruct.NumOfPlanes == 2) + { + return PlaneType.DoublePlane; + } + + return PlaneType.TriplePlane; + } + + /// + /// The pixel format of the image. + /// + /// 3 + public CameraPixelFormat Format { get; } + + /// + /// The resolution of the preview image. + /// + /// 3 + public Size Resolution { get; } + + /// + /// The timestamp of preview frame. + /// + /// 3 + public uint TimeStamp { get; } + + /// + /// The type of preview plane. + /// + /// 3 + public PlaneType PlaneType { get; } + + /// + /// The buffer including preview frame. + /// + /// 3 + public IPreviewPlane Plane { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs b/src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs new file mode 100755 index 0000000..33e64f2 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/SinglePlane.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing image data which has single plane. + /// + public class SinglePlane : IPreviewPlane + { + internal SinglePlane(SinglePlaneStruct unmanaged) + { + Data = new byte[unmanaged.DataLength]; + Marshal.Copy(unmanaged.Data, Data, 0, (int)unmanaged.DataLength); + } + + /// + /// The YUV plane data. + /// + /// 3 + public byte[] Data { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Camera/StillImage.cs b/src/Tizen.Multimedia.Camera/Camera/StillImage.cs new file mode 100755 index 0000000..7fb3b69 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/StillImage.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing the captured still image. + /// + public class StillImage + { + internal StillImage(IntPtr ptr) + { + var unmanagedStruct = Marshal.PtrToStructure(ptr); + + Format = unmanagedStruct.Format; + Resolution = new Size(unmanagedStruct.Width, unmanagedStruct.Height); + + if (unmanagedStruct.Data != IntPtr.Zero && unmanagedStruct.DataLength > 0) + { + Data = new byte[unmanagedStruct.DataLength]; + Marshal.Copy(unmanagedStruct.Data, Data, 0, (int)unmanagedStruct.DataLength); + } + else + { + Debug.Fail("CameraStillImage Data is null!"); + } + + //Exif can be null + if (unmanagedStruct.ExifLength > 0) + { + Exif = new byte[unmanagedStruct.ExifLength]; + Marshal.Copy(unmanagedStruct.Exif, Exif, 0, (int)unmanagedStruct.ExifLength); + } + } + + /// + /// The pixel format of the still image. + /// + /// 3 + public CameraPixelFormat Format { get; } + + /// + /// The resolution of the still image. + /// + /// 3 + public Size Resolution { get; } + + /// + /// The buffer containing still image. + /// + /// 3 + public byte[] Data { get; } + + /// + /// The Exif data describing additional metadata of still image. + /// Please refer Exif specification for more details. + /// + /// 3 + public byte[] Exif { get; } + } +} diff --git a/src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs b/src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs new file mode 100755 index 0000000..132911b --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Camera/TriplePlane.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using static Interop.Camera; + +namespace Tizen.Multimedia +{ + /// + /// The class containing image data which has three planes. + /// + public class TriplePlane : IPreviewPlane + { + internal TriplePlane(TriplePlaneStruct unmanaged) + { + Y = new byte[unmanaged.YLength]; + U = new byte[unmanaged.ULength]; + V = new byte[unmanaged.VLength]; + Marshal.Copy(unmanaged.Y, Y, 0, (int)unmanaged.YLength); + Marshal.Copy(unmanaged.U, U, 0, (int)unmanaged.ULength); + Marshal.Copy(unmanaged.V, V, 0, (int)unmanaged.VLength); + } + + /// + /// The Y plane data. + /// + /// 3 + public byte[] Y { get; } + + /// + /// The U plane data. + /// + /// 3 + public byte[] U { get; } + + /// + /// The V plane data. + /// + /// 3 + public byte[] V { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs new file mode 100755 index 0000000..affcce6 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.Camera.cs @@ -0,0 +1,282 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class Camera + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void FaceDetectedCallback(IntPtr faces, int count, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(CameraState previous, CameraState current, bool byPolicy, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptedCallback(CameraPolicy policy, CameraState previous, CameraState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptStartedCallback(CameraPolicy policy, CameraState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void FocusStateChangedCallback(CameraFocusState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ErrorCallback(CameraErrorCode error, CameraState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CapturingCallback(IntPtr image, IntPtr postview, IntPtr thumbnail, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CaptureCompletedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PreviewCallback(IntPtr frame, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaPacketPreviewCallback(IntPtr mediaPacketHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void HdrCaptureProgressCallback(int percent, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DeviceStateChangedCallback(CameraDevice device, CameraDeviceState state, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_create")] + internal static extern CameraError Create(CameraDevice device, out IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_change_device")] + internal static extern CameraError ChangeDevice(IntPtr handle, CameraDevice device); + + [DllImport(Libraries.Camera, EntryPoint = "camera_destroy")] + internal static extern CameraError Destroy(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_count")] + internal static extern CameraError GetDeviceCount(IntPtr handle, out int count); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_preview")] + internal static extern CameraError StartPreview(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_preview")] + internal static extern CameraError StopPreview(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_device_state")] + internal static extern CameraError GetDeviceState(CameraDevice device, out CameraDeviceState state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_capture")] + internal static extern CameraError StartCapture(IntPtr handle, CapturingCallback captureCallback, + CaptureCompletedCallback completedCallback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_continuous_capture")] + internal static extern CameraError StartContinuousCapture(IntPtr handle, int count, int interval, + CapturingCallback captureCallback, CaptureCompletedCallback completedCallback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_continuous_capture")] + internal static extern CameraError StopContinuousCapture(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_state")] + internal static extern CameraError GetState(IntPtr handle, out CameraState state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_focusing")] + internal static extern CameraError StartFocusing(IntPtr handle, bool continuous); + + [DllImport(Libraries.Camera, EntryPoint = "camera_cancel_focusing")] + internal static extern CameraError CancelFocusing(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_resolution")] + internal static extern CameraError SetPreviewResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_resolution")] + internal static extern CameraError GetPreviewResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_recommended_preview_resolution")] + internal static extern CameraError GetRecommendedPreviewResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_start_face_detection")] + internal static extern CameraError StartFaceDetection(IntPtr handle, FaceDetectedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_stop_face_detection")] + internal static extern CameraError StopFaceDetection(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_reuse_hint")] + internal static extern CameraError SetDisplayReuseHint(IntPtr handle, bool hint); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_reuse_hint")] + internal static extern CameraError GetDisplayReuseHint(IntPtr handle, out bool hint); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_resolution")] + internal static extern CameraError SetCaptureResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_resolution")] + internal static extern CameraError GetCaptureResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_capture_format")] + internal static extern CameraError SetCaptureFormat(IntPtr handle, CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_capture_format")] + internal static extern CameraError GetCaptureFormat(IntPtr handle, out CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_format")] + internal static extern CameraError SetPreviewPixelFormat(IntPtr handle, CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_preview_format")] + internal static extern CameraError GetPreviewPixelFormat(IntPtr handle, out CameraPixelFormat format); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_facing_direction")] + internal static extern CameraError GetFacingDirection(IntPtr handle, out CameraFacingDirection direction); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_flash_state")] + internal static extern CameraError GetFlashState(CameraDevice device, out CameraFlashState state); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_preview_cb")] + internal static extern CameraError SetPreviewCallback(IntPtr handle, PreviewCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_preview_cb")] + internal static extern CameraError UnsetPreviewCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_media_packet_preview_cb")] + internal static extern CameraError SetMediaPacketPreviewCallback(IntPtr handle, MediaPacketPreviewCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_media_packet_preview_cb")] + internal static extern CameraError UnsetMediaPacketPreviewCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_state_changed_cb")] + internal static extern CameraError SetStateChangedCallback(IntPtr handle, StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_add_device_state_changed_cb")] + internal static extern CameraError SetDeviceStateChangedCallback(DeviceStateChangedCallback callback, IntPtr userData, out int callbackId); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_state_changed_cb")] + internal static extern CameraError UnsetStateChangedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_remove_device_state_changed_cb")] + internal static extern CameraError UnsetDeviceStateChangedCallback(int cbId); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupt_started_cb")] + internal static extern CameraError SetInterruptStartedCallback(IntPtr handle, InterruptStartedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupt_started_cb")] + internal static extern CameraError UnsetInterruptStartedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_interrupted_cb")] + internal static extern CameraError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_interrupted_cb")] + internal static extern CameraError UnsetInterruptedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_focus_changed_cb")] + internal static extern CameraError SetFocusStateChangedCallback(IntPtr handle, FocusStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_focus_changed_cb")] + internal static extern CameraError UnsetFocusChangedCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_error_cb")] + internal static extern CameraError SetErrorCallback(IntPtr handle, ErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_unset_error_cb")] + internal static extern CameraError UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_capture_progress_cb")] + internal static extern CameraError SetHdrCaptureProgressCallback(IntPtr handle, HdrCaptureProgressCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_unset_hdr_capture_progress_cb")] + internal static extern CameraError UnsetHdrCaptureProgressCallback(IntPtr handle); + + [StructLayout(LayoutKind.Sequential)] + internal struct StillImageDataStruct + { + internal IntPtr Data; + internal uint DataLength; + internal int Width; + internal int Height; + internal CameraPixelFormat Format; + internal IntPtr Exif; + internal uint ExifLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct DetectedFaceStruct + { + internal int Id; + internal int Score; + internal int X; + internal int Y; + internal int Width; + internal int Height; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SinglePlaneStruct + { + internal IntPtr Data; + internal uint DataLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct DoublePlaneStruct + { + internal IntPtr Y; + internal IntPtr UV; + internal uint YLength; + internal uint UVLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TriplePlaneStruct + { + internal IntPtr Y; + internal IntPtr U; + internal IntPtr V; + internal uint YLength; + internal uint ULength; + internal uint VLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct EncodedPlaneStruct + { + internal IntPtr Data; + internal uint DataLength; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct PreviewPlaneStruct + { + [FieldOffsetAttribute(0)] + internal SinglePlaneStruct SinglePlane; + [FieldOffsetAttribute(0)] + internal DoublePlaneStruct DoublePlane; + [FieldOffsetAttribute(0)] + internal TriplePlaneStruct TriplePlane; + [FieldOffsetAttribute(0)] + internal EncodedPlaneStruct EncodedPlane; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CameraPreviewDataStruct + { + internal CameraPixelFormat Format; + internal int Width; + internal int Height; + internal int NumOfPlanes; + internal uint TimeStamp; + internal PreviewPlaneStruct Plane; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraCapabilities.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraCapabilities.cs new file mode 100755 index 0000000..f4306e1 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraCapabilities.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraCapabilities + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PreviewResolutionCallback(int Width, int Height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CaptureResolutionCallback(int Width, int Height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool CaptureFormatCallback(CameraPixelFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PreviewFormatCallback(CameraPixelFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FpsCallback(CameraFps fps, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FpsByResolutionCallback(CameraFps fps, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AfModeCallback(CameraAutoFocusMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ExposureModeCallback(CameraExposureMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool IsoCallback(CameraIsoLevel iso, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool TheaterModeCallback(CameraTheaterMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool WhitebalanceCallback(CameraWhiteBalance whitebalance, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EffectCallback(CameraEffectMode effect, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SceneModeCallback(CameraSceneMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FlashModeCallback(CameraFlashMode mode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool StreamRotationCallback(Rotation rotation, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool StreamFlipCallback(Flips flip, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PtzTypeCallback(CameraPtzType type, IntPtr userData); + + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_continuous_capture")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsContinuousCaptureSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_face_detection")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsFaceDetectionSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_zero_shutter_lag")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsZeroShutterLagSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_supported_media_packet_preview_cb")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsMediaPacketPreviewCallbackSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_hdr_capture")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsHdrCaptureSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_anti_shake")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsAntiShakeSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_video_stabilization")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsVideoStabilizationSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_supported_auto_contrast")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool IsAutoContrastSupported(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_resolution")] + internal static extern CameraError SupportedPreviewResolutions(IntPtr handle, PreviewResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_resolution")] + internal static extern CameraError SupportedCaptureResolutions(IntPtr handle, CaptureResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_capture_format")] + internal static extern CameraError SupportedCapturePixelFormats(IntPtr handle, CaptureFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_foreach_supported_preview_format")] + internal static extern CameraError SupportedPreviewPixelFormats(IntPtr handle, PreviewFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps")] + internal static extern CameraError SupportedPreviewFps(IntPtr handle, FpsCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_fps_by_resolution")] + internal static extern CameraError SupportedPreviewFpsByResolution(IntPtr handle, int width, int height, FpsByResolutionCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_af_mode")] + internal static extern CameraError SupportedAutoFocusModes(IntPtr handle, AfModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_exposure_mode")] + internal static extern CameraError SupportedExposureModes(IntPtr handle, ExposureModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_iso")] + internal static extern CameraError SupportedIso(IntPtr handle, IsoCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_theater_mode")] + internal static extern CameraError SupportedTheaterModes(IntPtr handle, TheaterModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_whitebalance")] + internal static extern CameraError SupportedWhitebalance(IntPtr handle, WhitebalanceCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_effect")] + internal static extern CameraError SupportedEffects(IntPtr handle, EffectCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_scene_mode")] + internal static extern CameraError SupportedSceneModes(IntPtr handle, SceneModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_flash_mode")] + internal static extern CameraError SupportedFlashModes(IntPtr handle, FlashModeCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_rotation")] + internal static extern CameraError SupportedStreamRotations(IntPtr handle, StreamRotationCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_stream_flip")] + internal static extern CameraError SupportedStreamFlips(IntPtr handle, StreamFlipCallback callback, IntPtr userData); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_foreach_supported_ptz_type")] + internal static extern CameraError SupportedPtzTypes(IntPtr handle, PtzTypeCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs new file mode 100644 index 0000000..001aa42 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraDisplay.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraDisplay + { + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_mode")] + internal static extern CameraError GetMode(IntPtr handle, out CameraDisplayMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_mode")] + internal static extern CameraError SetMode(IntPtr handle, CameraDisplayMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_is_display_visible")] + internal static extern CameraError GetVisible(IntPtr handle, out bool visible); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_visible")] + internal static extern CameraError SetVisible(IntPtr handle, bool visible); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_rotation")] + internal static extern CameraError GetRotation(IntPtr handle, out Rotation rotation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_rotation")] + internal static extern CameraError SetRotation(IntPtr handle, Rotation rotation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_get_display_flip")] + internal static extern CameraError GetFlip(IntPtr handle, out Flips flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display_flip")] + internal static extern CameraError SetFlip(IntPtr handle, Flips flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_display_roi_area")] + internal static extern CameraError GetRoiArea(IntPtr handle, out int x, out int y, out int width, out int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_display_roi_area")] + internal static extern CameraError SetRoiArea(IntPtr handle, int x, int y, int width, int height); + + [DllImport(Libraries.Camera, EntryPoint = "camera_set_display")] + internal static extern CameraError SetTarget(IntPtr handle, DisplayType displayType, IntPtr displayHandle); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs new file mode 100755 index 0000000..bec8a0a --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.CameraSettings.cs @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class CameraSettings + { + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_preview_fps")] + internal static extern CameraError SetPreviewFps(IntPtr handle, CameraFps fps); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_preview_fps")] + internal static extern CameraError GetPreviewFps(IntPtr handle, out CameraFps fps); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_image_quality")] + internal static extern CameraError SetImageQuality(IntPtr handle, int quality); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_image_quality")] + internal static extern CameraError GetImageQuality(IntPtr handle, out int quality); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_bitrate")] + internal static extern CameraError SetBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_bitrate")] + internal static extern CameraError GetBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_encoded_preview_gop_interval")] + internal static extern CameraError SetGopInterval(IntPtr handle, int interval); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_encoded_preview_gop_interval")] + internal static extern CameraError GetGopInterval(IntPtr handle, out int interval); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_zoom")] + internal static extern CameraError SetZoom(IntPtr handle, int zoom); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom")] + internal static extern CameraError GetZoom(IntPtr handle, out int zoom); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_zoom_range")] + internal static extern CameraError GetZoomRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_mode")] + internal static extern CameraError SetAutoFocusMode(IntPtr handle, CameraAutoFocusMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_af_mode")] + internal static extern CameraError GetAutoFocusMode(IntPtr handle, out CameraAutoFocusMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_af_area")] + internal static extern CameraError SetAutoFocusArea(IntPtr handle, int x, int y); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_clear_af_area")] + internal static extern CameraError ClearAutoFocusArea(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure_mode")] + internal static extern CameraError SetExposureMode(IntPtr handle, CameraExposureMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_mode")] + internal static extern CameraError GetExposureMode(IntPtr handle, out CameraExposureMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_exposure")] + internal static extern CameraError SetExposure(IntPtr handle, int value); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure")] + internal static extern CameraError GetExposure(IntPtr handle, out int value); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_exposure_range")] + internal static extern CameraError GetExposureRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_iso")] + internal static extern CameraError SetIso(IntPtr handle, CameraIsoLevel iso); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_iso")] + internal static extern CameraError GetIso(IntPtr handle, out CameraIsoLevel iso); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_theater_mode")] + internal static extern CameraError SetTheaterMode(IntPtr handle, CameraTheaterMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_theater_mode")] + internal static extern CameraError GetTheaterMode(IntPtr handle, out CameraTheaterMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_brightness")] + internal static extern CameraError SetBrightness(IntPtr handle, int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness")] + internal static extern CameraError GetBrightness(IntPtr handle, out int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_brightness_range")] + internal static extern CameraError GetBrightnessRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_contrast")] + internal static extern CameraError SetContrast(IntPtr handle, int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast")] + internal static extern CameraError GetContrast(IntPtr handle, out int level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_contrast_range")] + internal static extern CameraError GetContrastRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_whitebalance")] + internal static extern CameraError SetWhitebalance(IntPtr handle, CameraWhiteBalance level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_whitebalance")] + internal static extern CameraError GetWhiteBalance(IntPtr handle, out CameraWhiteBalance level); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_effect")] + internal static extern CameraError SetEffect(IntPtr handle, CameraEffectMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_effect")] + internal static extern CameraError GetEffect(IntPtr handle, out CameraEffectMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_scene_mode")] + internal static extern CameraError SetSceneMode(IntPtr handle, CameraSceneMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_scene_mode")] + internal static extern CameraError GetSceneMode(IntPtr handle, out CameraSceneMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_tag")] + internal static extern CameraError EnableTag(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_tag")] + internal static extern CameraError IsEnabledTag(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_image_description")] + internal static extern CameraError SetImageDescription(IntPtr handle, string description); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_image_description")] + internal static extern CameraError GetImageDescription(IntPtr handle, out IntPtr description); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_software")] + internal static extern CameraError SetTagSoftware(IntPtr handle, string software); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_software")] + internal static extern CameraError GetTagSoftware(IntPtr handle, out IntPtr software); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tag_orientation")] + internal static extern CameraError SetTagOrientation(IntPtr handle, CameraTagOrientation orientation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tag_orientation")] + internal static extern CameraError GetTagOrientation(IntPtr handle, out CameraTagOrientation orientation); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_geotag")] + internal static extern CameraError SetGeotag(IntPtr handle, double latitude, double longtitude, double altitude); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_geotag")] + internal static extern CameraError GetGeotag(IntPtr handle, out double latitude, out double longtitude, out double altitude); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_remove_geotag")] + internal static extern CameraError RemoveGeotag(IntPtr handle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_flash_mode")] + internal static extern CameraError SetFlashMode(IntPtr handle, CameraFlashMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_flash_mode")] + internal static extern CameraError GetFlashMode(IntPtr handle, out CameraFlashMode mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_lens_orientation")] + internal static extern CameraError GetLensOrientation(IntPtr handle, out int angle); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_rotation")] + internal static extern CameraError SetStreamRotation(IntPtr handle, Rotation mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_rotation")] + internal static extern CameraError GetStreamRotation(IntPtr handle, out Rotation mode); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_stream_flip")] + internal static extern CameraError SetFlip(IntPtr handle, Flips flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_stream_flip")] + internal static extern CameraError GetFlip(IntPtr handle, out Flips flip); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_hdr_mode")] + internal static extern CameraError SetHdrMode(IntPtr handle, CameraHdrMode hdr); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_hdr_mode")] + internal static extern CameraError GetHdrMode(IntPtr handle, out CameraHdrMode hdr); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_anti_shake")] + internal static extern CameraError EnableAntiShake(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = " camera_attr_is_enabled_anti_shake")] + internal static extern CameraError IsEnabledAntiShake(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_video_stabilization")] + internal static extern CameraError EnableVideoStabilization(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_video_stabilization")] + internal static extern CameraError IsEnabledVideoStabilization(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_enable_auto_contrast")] + internal static extern CameraError EnableAutoContrast(IntPtr handle, bool enable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_is_enabled_auto_contrast")] + internal static extern CameraError IsEnabledAutoContrast(IntPtr handle, out bool enabled); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_disable_shutter_sound")] + internal static extern CameraError DisableShutterSound(IntPtr handle, bool disable); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_pan")] + internal static extern CameraError SetPan(IntPtr handle, CameraPtzMoveType type, int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan")] + internal static extern CameraError GetPan(IntPtr handle, out int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_pan_range")] + internal static extern CameraError GetPanRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_tilt")] + internal static extern CameraError SetTilt(IntPtr handle, CameraPtzMoveType type, int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt")] + internal static extern CameraError GetTilt(IntPtr handle, out int step); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_get_tilt_range")] + internal static extern CameraError GetTiltRange(IntPtr handle, out int min, out int max); + + [DllImport(Libraries.Camera, EntryPoint = "camera_attr_set_ptz_type")] + internal static extern CameraError SetPtzType(IntPtr handle, CameraPtzType type); + } +} diff --git a/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..624807e --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Camera = "libcapi-media-camera.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.sln b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.sln new file mode 100755 index 0000000..3b89c98 --- /dev/null +++ b/src/Tizen.Multimedia.Camera/Tizen.Multimedia.Camera.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Camera", "Tizen.Multimedia.Camera.csproj", "{1FE7280C-EF8F-4FE1-A52D-735B8C7D3470}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{D2793EA4-C5AB-4550-8CBC-731759D542CA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{B504FA02-56F5-4B12-B597-7982633A3185}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{5B85A754-78BF-49F0-AFAD-F1919FE82969}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{EF912492-7006-4D31-A270-82B2E3E0E3BA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{47E74EAE-1A0D-49C4-ACCC-56B2D43D7A08}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1FE7280C-EF8F-4FE1-A52D-735B8C7D3470}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1FE7280C-EF8F-4FE1-A52D-735B8C7D3470}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1FE7280C-EF8F-4FE1-A52D-735B8C7D3470}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1FE7280C-EF8F-4FE1-A52D-735B8C7D3470}.Release|Any CPU.Build.0 = Release|Any CPU + {D2793EA4-C5AB-4550-8CBC-731759D542CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2793EA4-C5AB-4550-8CBC-731759D542CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2793EA4-C5AB-4550-8CBC-731759D542CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2793EA4-C5AB-4550-8CBC-731759D542CA}.Release|Any CPU.Build.0 = Release|Any CPU + {B504FA02-56F5-4B12-B597-7982633A3185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B504FA02-56F5-4B12-B597-7982633A3185}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B504FA02-56F5-4B12-B597-7982633A3185}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B504FA02-56F5-4B12-B597-7982633A3185}.Release|Any CPU.Build.0 = Release|Any CPU + {5B85A754-78BF-49F0-AFAD-F1919FE82969}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B85A754-78BF-49F0-AFAD-F1919FE82969}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B85A754-78BF-49F0-AFAD-F1919FE82969}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B85A754-78BF-49F0-AFAD-F1919FE82969}.Release|Any CPU.Build.0 = Release|Any CPU + {EF912492-7006-4D31-A270-82B2E3E0E3BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF912492-7006-4D31-A270-82B2E3E0E3BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF912492-7006-4D31-A270-82B2E3E0E3BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF912492-7006-4D31-A270-82B2E3E0E3BA}.Release|Any CPU.Build.0 = Release|Any CPU + {47E74EAE-1A0D-49C4-ACCC-56B2D43D7A08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47E74EAE-1A0D-49C4-ACCC-56B2D43D7A08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47E74EAE-1A0D-49C4-ACCC-56B2D43D7A08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47E74EAE-1A0D-49C4-ACCC-56B2D43D7A08}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.MediaCodec/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..ba8ac5b --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.Libraries.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.MediaCodec +{ + internal static partial class Interop + { + internal static partial class Libraries + { + public const string MediaCodec = "libcapi-media-codec.so.0"; + public const string MediaTool = "libcapi-media-tool.so.0"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaCodec.cs b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaCodec.cs new file mode 100644 index 0000000..5d484cc --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaCodec.cs @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia.MediaCodec +{ + internal static partial class Interop + { + internal static class MediaCodec + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InputBufferUsedCallback(IntPtr mediaPacket, IntPtr arg); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void OutputBufferAvailableCallback(IntPtr mediaPacket, IntPtr arg); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ErrorCallback(int errorCode, IntPtr arg); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EosCallback(IntPtr arg); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferStatusCallback(int statusCode, IntPtr arg); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportedCodecCallback(int codecType, IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_create")] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_codec")] + internal static extern int Configure(IntPtr handle, int codecType, int flags); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_vdec_info")] + internal static extern int SetVideoDecoderInfo(IntPtr handle, int width, int height); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_venc_info")] + internal static extern int SetVideoEncoderInfo(IntPtr handle, int width, int height, + int fps, int targetBits); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_adec_info")] + internal static extern int SetAudioDecoderInfo(IntPtr handle, int sampleRate, int channel, + int bit); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_aenc_info")] + internal static extern int SetAudioEncoderInfo(IntPtr handle, int sampleRate, int channel, + int bit, int bitRate); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_process_input")] + internal static extern int Process(IntPtr handle, IntPtr mediaPacket, ulong timeoutInUs); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_get_output")] + internal static extern int GetOutput(IntPtr handle, out IntPtr packet, ulong timeoutInUs); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_flush_buffers")] + internal static extern int FlushBuffers(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_input_buffer_used_cb")] + internal static extern int SetInputBufferUsedCb(IntPtr handle, + InputBufferUsedCallback cb, IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_input_buffer_used_cb")] + internal static extern int UnsetInputBufferUsedCb(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_output_buffer_available_cb")] + internal static extern int SetOutputBufferAvailableCb(IntPtr handle, + OutputBufferAvailableCallback cb, IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_output_buffer_available_cb")] + internal static extern int UnsetOutputBufferAvailableCb(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_error_cb")] + internal static extern int SetErrorCb(IntPtr handle, ErrorCallback cb, IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_error_cb")] + internal static extern int UnsetErrorCb(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_eos_cb")] + internal static extern int SetEosCb(IntPtr handle, EosCallback cb, IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_eos_cb")] + internal static extern int UnsetEosCb(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_set_buffer_status_cb")] + internal static extern int SetBufferStatusCb(IntPtr handle, BufferStatusCallback cb, + IntPtr arg); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_unset_buffer_status_cb")] + internal static extern int UnsetBufferStatusCb(IntPtr handle); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_get_supported_type")] + internal static extern int GetSupportedType(IntPtr handle, int codecType, bool isEncoder, + out int value); + + [DllImport(Libraries.MediaCodec, EntryPoint = "mediacodec_foreach_supported_codec_static")] + internal static extern int ForeachSupportedCodec(SupportedCodecCallback cb, IntPtr arg); + } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaTool.cs b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaTool.cs new file mode 100644 index 0000000..318153c --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/Interop/Interop.MediaTool.cs @@ -0,0 +1,14 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia.MediaCodec +{ + internal static partial class Interop + { + internal static class MediaPacket + { + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_destroy")] + internal static extern int Destroy(IntPtr handle); + } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/BufferStatusChangedEventArgs.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/BufferStatusChangedEventArgs.cs new file mode 100644 index 0000000..6beac7c --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/BufferStatusChangedEventArgs.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Provides data for the event. + /// + public class BufferStatusChangedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the BufferStatusChangedEventArgs class. + /// + /// The value representing new status of the codec. + public BufferStatusChangedEventArgs(MediaCodecStatus status) + { + Status = status; + } + + /// + /// Gets the value indicating new status of the codec. + /// + public MediaCodecStatus Status { get; } + + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/InputProcessedEventArgs.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/InputProcessedEventArgs.cs new file mode 100644 index 0000000..1883d95 --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/InputProcessedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Provides data for the event. + /// + public class InputProcessedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the InputProcessedEventArgs class. + /// + /// The packet that the codec has processed. + internal InputProcessedEventArgs(MediaPacket packet) + { + Debug.Assert(packet != null); + + Packet = packet; + } + + /// + /// Gets the packet that the codec has processed. + /// + public MediaPacket Packet { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodec.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodec.cs new file mode 100644 index 0000000..0d37d31 --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodec.cs @@ -0,0 +1,691 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Provides the means to encode and decode video and audio data. + /// + public class MediaCodec : IDisposable + { + private const int CodecTypeMask = 0xFFFF; + private const int CodecKindMask = 0x3000; +// private const int CodecKindAudio = 0x1000; // Not used + private const int CodecKindVideo = 0x2000; + + private IntPtr _handle; + + /// + /// Initialize a new instance of the MediaCodec class. + /// + public MediaCodec() + { + int ret = Interop.MediaCodec.Create(out _handle); + + if (ret == (int)MediaCodecErrorCode.InvalidOperation) + { + throw new InvalidOperationException("Not able to initialize a new media codec."); + } + + MultimediaDebug.AssertNoError(ret); + + RegisterInputProcessed(); + RegisterErrorOccurred(); + } + + #region IDisposable-support + private bool _isDisposed = false; + + protected virtual void Dispose(bool disposing) + { + if (!_isDisposed) + { + if (_handle != IntPtr.Zero) + { + Interop.MediaCodec.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _isDisposed = true; + } + } + + ~MediaCodec() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + + GC.SuppressFinalize(this); + } + #endregion + + /// + /// Validates if the object already has been disposed of. + /// + /// The current object has been disposed of. + private void ValidateNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException(nameof(MediaCodec)); + } + } + + private static IEnumerable _supportedVideoCodecs; + + /// + /// Gets the audio codec list that the current device supports. + /// + public static IEnumerable SupportedVideoCodecs + { + get + { + if (_supportedVideoCodecs == null) + { + LoadSupportedCodec(); + } + + return _supportedVideoCodecs; + } + } + + private static IEnumerable _supportedAudioCodecs; + + + /// + /// Gets the audio codec list that the current device supports. + /// + public static IEnumerable SupportedAudioCodecs + { + get + { + if (_supportedAudioCodecs == null) + { + LoadSupportedCodec(); + } + + return _supportedAudioCodecs; + } + } + + private static bool TryGetMimeTypeFromCodecType(int codecType, ref T result) + { + if (codecType == -1) + { + return false; + } + + foreach (T value in Enum.GetValues(typeof(T))) + { + if ((Convert.ToInt32(value) & CodecTypeMask) == codecType) + { + result = value; + return true; + } + } + + Debug.Fail($"Unknown codec : { codecType }."); + return false; + } + + private static void LoadSupportedCodec() + { + var videoCodecList = new List(); + var audioCodecList = new List(); + + Interop.MediaCodec.SupportedCodecCallback cb = (codecType, _) => + { + if ((codecType & CodecKindMask) == CodecKindVideo) + { + MediaFormatVideoMimeType mimeType = 0; + if (TryGetMimeTypeFromCodecType(codecType, ref mimeType)) + { + videoCodecList.Add(mimeType); + } + } + else + { + MediaFormatAudioMimeType mimeType = 0; + if (TryGetMimeTypeFromCodecType(codecType, ref mimeType)) + { + audioCodecList.Add(mimeType); + } + } + + return true; + }; + + int ret = Interop.MediaCodec.ForeachSupportedCodec(cb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + + _supportedVideoCodecs = videoCodecList.AsReadOnly(); + _supportedAudioCodecs = audioCodecList.AsReadOnly(); + } + + /// + /// Prepares the MediaCodec for encoding or decoding. + /// + /// + /// The codec is not configured, yet.\n + /// -or-\n + /// Internal error. + /// + public void Prepare() + { + ValidateNotDisposed(); + + int ret = Interop.MediaCodec.Prepare(_handle); + + if (ret == (int)MediaCodecErrorCode.NotInitialized) + { + throw new InvalidOperationException("The codec is not configured."); + } + if (ret != (int)MediaCodecErrorCode.None) + { + throw new InvalidOperationException("Operation failed."); + } + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Unprepares the MediaCodec. + /// + public void Unprepare() + { + ValidateNotDisposed(); + + int ret = Interop.MediaCodec.Unprepare(_handle); + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Configures the MediaCodec. + /// + /// The for properties of media data to decode or encode. + /// The value indicating whether the codec works as a encoder or a decoder. + /// The value indicating whether the codec uses hardware acceleration. + /// format is null + /// + /// is invalid.\n + /// -or-\n + /// is neither audio type nor video type. + /// + /// the mime type of the format is not supported. + /// + /// + public void Configure(MediaFormat format, bool encoder, MediaCodecTypes codecType) + { + ValidateNotDisposed(); + + if (format == null) + { + throw new ArgumentNullException(nameof(format)); + } + + if (codecType != MediaCodecTypes.Hardware && codecType != MediaCodecTypes.Software) + { + throw new ArgumentException("codecType is invalid."); + } + + if (format.Type == MediaFormatType.Audio) + { + ConfigureAudio((AudioMediaFormat)format, encoder, codecType); + } + else if (format.Type == MediaFormatType.Video) + { + ConfigureVideo((VideoMediaFormat)format, encoder, codecType); + } + else + { + throw new ArgumentException("Only video and audio formats are allowed."); + } + } + + private void ConfigureAudio(AudioMediaFormat format, bool encoder, + MediaCodecTypes supportType) + { + int codecType = (int)format.MimeType & CodecTypeMask; + + if (!Enum.IsDefined(typeof(SupportedCodecType), codecType)) + { + throw new NotSupportedException("The format is not supported " + + $"mime type : { Enum.GetName(typeof(MediaFormatAudioMimeType), format.MimeType) }"); + } + + DoConfigure(codecType, encoder, supportType); + + if (encoder) + { + int ret = Interop.MediaCodec.SetAudioEncoderInfo(_handle, format.SampleRate, + format.Channel, format.Bit, format.BitRate); + + MultimediaDebug.AssertNoError(ret); + } + else + { + int ret = Interop.MediaCodec.SetAudioDecoderInfo(_handle, format.SampleRate, + format.Channel, format.Bit); + + MultimediaDebug.AssertNoError(ret); + } + } + + private void ConfigureVideo(VideoMediaFormat format, bool encoder, + MediaCodecTypes supportType) + { + int codecType = (int)format.MimeType & CodecTypeMask; + + if (!Enum.IsDefined(typeof(SupportedCodecType), codecType)) + { + throw new NotSupportedException("The format is not supported." + + $"mime type : { Enum.GetName(typeof(MediaFormatVideoMimeType), format.MimeType) }"); + } + + DoConfigure(codecType, encoder, supportType); + + if (encoder) + { + int ret = Interop.MediaCodec.SetVideoEncoderInfo(_handle, format.Size.Width, + format.Size.Height, format.FrameRate, format.BitRate / 1000); + + MultimediaDebug.AssertNoError(ret); + } + else + { + int ret = Interop.MediaCodec.SetVideoDecoderInfo(_handle, format.Size.Width, format.Size.Height); + + MultimediaDebug.AssertNoError(ret); + } + } + + private void DoConfigure(int codecType, bool encoder, MediaCodecTypes supportType) + { + Debug.Assert(Enum.IsDefined(typeof(SupportedCodecType), codecType)); + + int flags = (int)(encoder ? MediaCodecCodingType.Encoder : MediaCodecCodingType.Decoder); + + flags |= (int)supportType; + + int ret = Interop.MediaCodec.Configure(_handle, codecType, flags); + + if (ret == (int)MediaCodecErrorCode.NotSupportedOnDevice) + { + throw new NotSupportedException("The format is not supported."); + } + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Adds the packet to the internal queue of the codec. + /// + /// The packet to be encoded or decoded. + /// packet is null. + /// the current codec is not prepared, yet. + /// Any attempts to modify the packet will be failed until the event for the packet is invoked. + public void ProcessInput(MediaPacket packet) + { + ValidateNotDisposed(); + + if (packet == null) + { + throw new ArgumentNullException(nameof(packet)); + } + + MediaPacket.Lock packetLock = MediaPacket.Lock.Get(packet); + + int ret = Interop.MediaCodec.Process(_handle, packetLock.GetHandle(), 0); + + if (ret == (int)MediaCodecErrorCode.InvalidState) + { + throw new InvalidOperationException("The codec is in invalid state."); + } + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Flushes both input and output buffers. + /// + public void FlushBuffers() + { + ValidateNotDisposed(); + + int ret = Interop.MediaCodec.FlushBuffers(_handle); + + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Retrieves supported codec types for the specified params. + /// + /// The value indicating encoder or decoder. + /// The mime type to query. + /// The values indicating which codec types are supported on the current device. + /// type is invalid. + public MediaCodecTypes GetCodecType(bool encoder, MediaFormatVideoMimeType type) + { + ValidateNotDisposed(); + + if (CheckMimeType(typeof(MediaFormatVideoMimeType), (int)type) == false) + { + return 0; + } + + return GetCodecType((int)type, encoder); + } + + /// + /// Retrieves supported codec types for the specified params. + /// + /// The value indicating encoder or decoder. + /// The mime type to query. + /// The values indicating which codec types are supported on the current device. + /// type is invalid. + public MediaCodecTypes GetCodecType(bool encoder, MediaFormatAudioMimeType type) + { + ValidateNotDisposed(); + + if (CheckMimeType(typeof(MediaFormatAudioMimeType), (int)type) == false) + { + return 0; + } + + return GetCodecType((int)type, encoder); + } + + private MediaCodecTypes GetCodecType(int mimeType, bool isEncoder) + { + int codecType = mimeType & CodecTypeMask; + int value = 0; + + int ret = Interop.MediaCodec.GetSupportedType(_handle, codecType, isEncoder, out value); + + MultimediaDebug.AssertNoError(ret); + + return (MediaCodecTypes)value; + } + + private bool CheckMimeType(Type type, int value) + { + int codecType = value & CodecTypeMask; + + if (!Enum.IsDefined(type, value)) + { + throw new ArgumentException($"The mime type value is invalid : { value }."); + } + + return Enum.IsDefined(typeof(SupportedCodecType), codecType); + } + + #region OutputAvailable event + private EventHandler _outputAvailable; + private Interop.MediaCodec.OutputBufferAvailableCallback _outputBufferAvailableCb; + + /// + /// Occurs when an output buffer is available. + /// + /// The output packet needs to be disposed after it is used to clean up unmanaged resources. + public event EventHandler OutputAvailable + { + add + { + ValidateNotDisposed(); + + if (_outputAvailable == null) + { + RegisterOutputAvailableCallback(); + } + _outputAvailable += value; + + } + remove + { + ValidateNotDisposed(); + + _outputAvailable -= value; + if (_outputAvailable == null) + { + UnregisterOutputAvailableCallback(); + } + } + } + + private void RegisterOutputAvailableCallback() + { + _outputBufferAvailableCb = (packetHandle, _) => + { + OutputAvailableEventArgs args = null; + + try + { + args = new OutputAvailableEventArgs(packetHandle); + } + catch (Exception) + { + Interop.MediaPacket.Destroy(packetHandle); + + // TODO should we throw it to unmanaged code? + throw; + } + + //TODO dispose if no event handler registered + _outputAvailable?.Invoke(this, args); + }; + + int ret = Interop.MediaCodec.SetOutputBufferAvailableCb(_handle, + _outputBufferAvailableCb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + } + + private void UnregisterOutputAvailableCallback() + { + int ret = Interop.MediaCodec.UnsetOutputBufferAvailableCb(_handle); + + MultimediaDebug.AssertNoError(ret); + } + #endregion + + #region InputProcessed event + private Interop.MediaCodec.InputBufferUsedCallback _inputBufferUsedCb; + + /// + /// Occurs when an input packet is processed. + /// + /// + public event EventHandler InputProcessed; + + private void RegisterInputProcessed() + { + _inputBufferUsedCb = (lockedPacketHandle, _) => + { + MediaPacket packet = null; + + // Lock must be disposed here, note that the packet won't be disposed. + using (MediaPacket.Lock packetLock = + MediaPacket.Lock.FromHandle(lockedPacketHandle)) + { + Debug.Assert(packetLock != null); + + packet = packetLock.MediaPacket; + } + Debug.Assert(packet != null); + + InputProcessed?.Invoke(this, new InputProcessedEventArgs(packet)); + }; + + int ret = Interop.MediaCodec.SetInputBufferUsedCb(_handle, + _inputBufferUsedCb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + } + + private void UnregisterInputProcessed() + { + int ret = Interop.MediaCodec.UnsetInputBufferUsedCb(_handle); + + MultimediaDebug.AssertNoError(ret); + } + #endregion + + #region ErrorOccurred event + private Interop.MediaCodec.ErrorCallback _errorCb; + + /// + /// Occurs whenever an error is produced in the codec. + /// + public event EventHandler ErrorOccurred; + + private void RegisterErrorOccurred() + { + _errorCb = (errorCode, _) => + { + MediaCodecError error = (Enum.IsDefined(typeof(MediaCodecError), errorCode)) ? + (MediaCodecError)errorCode : MediaCodecError.InternalError; + + ErrorOccurred?.Invoke(this, new MediaCodecErrorOccurredEventArgs(error)); + }; + int ret = Interop.MediaCodec.SetErrorCb(_handle, _errorCb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + } + + private void UnregisterErrorOccurred() + { + int ret = Interop.MediaCodec.UnsetErrorCb(_handle); + + MultimediaDebug.AssertNoError(ret); + } + #endregion + + #region EosReached event + private EventHandler _eosReached; + private Interop.MediaCodec.EosCallback _eosCb; + + // TODO replace + /// + /// Occurs when the codec processes all input data. + /// + public event EventHandler EosReached + { + add + { + ValidateNotDisposed(); + + if (_eosReached == null) + { + RegisterEosReached(); + } + _eosReached += value; + + } + remove + { + ValidateNotDisposed(); + + _eosReached -= value; + if (_eosReached == null) + { + UnregisterEosReached(); + } + } + } + + private void RegisterEosReached() + { + _eosCb = _ => _eosReached?.Invoke(this, EventArgs.Empty); + + int ret = Interop.MediaCodec.SetEosCb(_handle, _eosCb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + } + + private void UnregisterEosReached() + { + int ret = Interop.MediaCodec.UnsetEosCb(_handle); + + MultimediaDebug.AssertNoError(ret); + } + #endregion + + #region BufferStatusChanged event + private EventHandler _bufferStatusChanged; + private Interop.MediaCodec.BufferStatusCallback _bufferStatusCb; + + /// + /// Occurs when the codec needs more data or has enough data. + /// + public event EventHandler BufferStatusChanged + { + add + { + ValidateNotDisposed(); + + if (_bufferStatusChanged == null) + { + RegisterBufferStatusChanged(); + } + _bufferStatusChanged += value; + + } + remove + { + ValidateNotDisposed(); + + _bufferStatusChanged -= value; + if (_bufferStatusChanged == null) + { + UnregisterBufferStatusChanged(); + } + } + } + + private void RegisterBufferStatusChanged() + { + _bufferStatusCb = (statusCode, _) => + { + Debug.Assert(Enum.IsDefined(typeof(MediaCodecStatus), statusCode), + $"{ statusCode } is not defined in MediaCodecStatus!"); + + _bufferStatusChanged?.Invoke(this, + new BufferStatusChangedEventArgs((MediaCodecStatus)statusCode)); + }; + + int ret = Interop.MediaCodec.SetBufferStatusCb(_handle, _bufferStatusCb, IntPtr.Zero); + + MultimediaDebug.AssertNoError(ret); + } + + private void UnregisterBufferStatusChanged() + { + int ret = Interop.MediaCodec.UnsetBufferStatusCb(_handle); + + MultimediaDebug.AssertNoError(ret); + } + #endregion + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecError.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecError.cs new file mode 100644 index 0000000..14508f2 --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecError.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia.MediaCodec +{ + internal enum MediaCodecErrorCode + { + CodecDefinedBase = -0x019B0000, + + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidParameter, + NotSupportedOnDevice = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + + InvalidState = CodecDefinedBase | 0x01, + InvalidInBuffer = CodecDefinedBase | 0x02, + InvalidOutBuffer = CodecDefinedBase | 0x03, + Internal = CodecDefinedBase | 0x04, + NotInitialized = CodecDefinedBase | 0x05, + InvalidStream = CodecDefinedBase | 0x06, + CodecNotFound = CodecDefinedBase | 0x07, + DecodingError = CodecDefinedBase | 0x08, + OutOfStorage = CodecDefinedBase | 0x09, + StreamNotFound = CodecDefinedBase | 0x0a, + NotSupportedFormat = CodecDefinedBase | 0x0b, + NoAvailableBuffer = CodecDefinedBase | 0x0c, + OverflowInBuffer = CodecDefinedBase | 0x0d, + } + + public enum MediaCodecError + { + NotSupportedFormat = MediaCodecErrorCode.NotSupportedFormat, + InternalError = MediaCodecErrorCode.Internal, + OutOfStorage = MediaCodecErrorCode.OutOfStorage, + InvalidStream = MediaCodecErrorCode.InvalidStream, + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecErrorOccurredEventArgs.cs new file mode 100644 index 0000000..0113b6a --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecErrorOccurredEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Provides data for the event. + /// + public class MediaCodecErrorOccurredEventArgs : EventArgs + { + /// + /// Initializes a new instance of the ErrorOccurredEventArgs class. + /// + /// The value representing the type of the error. + public MediaCodecErrorOccurredEventArgs(MediaCodecError error) + { + Error = error; + } + + /// + /// Gets the value indicating what kind of the error. + /// + public MediaCodecError Error { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecStatus.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecStatus.cs new file mode 100644 index 0000000..32e453d --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecStatus.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Specifies the status of a codec. + /// + public enum MediaCodecStatus + { + /// + /// Not enough data to decode or encode. + /// + LackOfData, + + /// + /// Enough data to decode or encode. + /// + EnoughData + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecType.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecType.cs new file mode 100644 index 0000000..2aaf82e --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/MediaCodecType.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia.MediaCodec +{ + [Flags] + internal enum MediaCodecCodingType + { + Encoder = 0x1, + Decoder = 0x2 + } + + /// + /// Specifies types of codec. + /// + /// This enumeration has a attribute that allows a bitwise combination of its member values. + /// + /// + [Flags] + public enum MediaCodecTypes + { + /// + /// The hardware-accelerated codec. + /// + Hardware = 0x4, + + /// + /// The software codec. + /// + Software = 0x8 + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/OutputAvailableEventArgs.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/OutputAvailableEventArgs.cs new file mode 100644 index 0000000..9c84828 --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/OutputAvailableEventArgs.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia.MediaCodec +{ + /// + /// Provides data for the event. + /// + /// The output packet needs to be disposed after it is used to clean up unmanaged resources. + public class OutputAvailableEventArgs : EventArgs + { + internal OutputAvailableEventArgs(IntPtr packetHandle) + { + Packet = MediaPacket.From(packetHandle); + } + + /// + /// Gets the result packet. + /// + public MediaPacket Packet { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/MediaCodec/SupportedCodecType.cs b/src/Tizen.Multimedia.MediaCodec/MediaCodec/SupportedCodecType.cs new file mode 100644 index 0000000..999808f --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/MediaCodec/SupportedCodecType.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.MediaCodec +{ + internal enum SupportedCodecType + { + // L16 = 0x1010, + // ALaw = 0x1020, + // ULaw = 0x1030, + Amr = 0x1040, + AmrNB = 0x1040, + AmrWb = 0x1041, + // G729 = 0x1050, + Aac = 0x1060, + AacLC = 0x1060, + AacHE = 0x1061, + AacHEPS = 0x1062, + MP3 = 0x1070, + Vorbis = 0x1080, + Flac = 0x1090, + Wma1 = 0x10A0, + Wma2 = 0x10A1, + WmaPro = 0x10A2, + WmaLossless = 0x10A3, + + H261 = 0x2010, + H263 = 0x2020, + H264 = 0x2030, + MJpeg = 0x2040, + Mpeg1 = 0x2050, + Mpeg2 = 0x2060, + Mpeg4 = 0x2070, + // Hevc = 0x2080, + // VP8 = 0x2090, + // VP9 = 0x20A0, + // VC1 = 0x20B0, + } +} diff --git a/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.csproj b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.sln b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.sln new file mode 100755 index 0000000..53ea20b --- /dev/null +++ b/src/Tizen.Multimedia.MediaCodec/Tizen.Multimedia.MediaCodec.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.MediaCodec", "Tizen.Multimedia.MediaCodec.csproj", "{BA07A897-9A81-4D82-BA88-A2F7C92E4237}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{EA824FD1-5996-4C1F-8116-191BD312DCCB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{072466EC-5245-4DB6-9CDA-DC753FC4FA70}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F83DB9A8-9F37-4031-BC48-813B08AEF316}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E6B5E685-4A5A-4FF2-8474-42DFB49CA663}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{8E0E98C3-7983-4CA8-8763-79C64464F9D0}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BA07A897-9A81-4D82-BA88-A2F7C92E4237}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA07A897-9A81-4D82-BA88-A2F7C92E4237}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA07A897-9A81-4D82-BA88-A2F7C92E4237}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA07A897-9A81-4D82-BA88-A2F7C92E4237}.Release|Any CPU.Build.0 = Release|Any CPU + {EA824FD1-5996-4C1F-8116-191BD312DCCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA824FD1-5996-4C1F-8116-191BD312DCCB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA824FD1-5996-4C1F-8116-191BD312DCCB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA824FD1-5996-4C1F-8116-191BD312DCCB}.Release|Any CPU.Build.0 = Release|Any CPU + {072466EC-5245-4DB6-9CDA-DC753FC4FA70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {072466EC-5245-4DB6-9CDA-DC753FC4FA70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {072466EC-5245-4DB6-9CDA-DC753FC4FA70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {072466EC-5245-4DB6-9CDA-DC753FC4FA70}.Release|Any CPU.Build.0 = Release|Any CPU + {F83DB9A8-9F37-4031-BC48-813B08AEF316}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F83DB9A8-9F37-4031-BC48-813B08AEF316}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F83DB9A8-9F37-4031-BC48-813B08AEF316}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F83DB9A8-9F37-4031-BC48-813B08AEF316}.Release|Any CPU.Build.0 = Release|Any CPU + {E6B5E685-4A5A-4FF2-8474-42DFB49CA663}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6B5E685-4A5A-4FF2-8474-42DFB49CA663}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6B5E685-4A5A-4FF2-8474-42DFB49CA663}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6B5E685-4A5A-4FF2-8474-42DFB49CA663}.Release|Any CPU.Build.0 = Release|Any CPU + {8E0E98C3-7983-4CA8-8763-79C64464F9D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E0E98C3-7983-4CA8-8763-79C64464F9D0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E0E98C3-7983-4CA8-8763-79C64464F9D0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E0E98C3-7983-4CA8-8763-79C64464F9D0}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.AudioEffect.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.AudioEffect.cs new file mode 100644 index 0000000..10a935e --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.AudioEffect.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class AudioEffect + { + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_bands_count")] + internal static extern PlayerErrorCode GetEqualizerBandsCount(IntPtr player, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_band_level")] + internal static extern PlayerErrorCode SetEqualizerBandLevel(IntPtr player, int index, int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_level")] + internal static extern PlayerErrorCode GetEqualizerBandLevel(IntPtr player, int index, out int level); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_set_equalizer_all_bands")] + internal static extern PlayerErrorCode SetEqualizerAllBands(IntPtr player, out int band_levels, int length); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_level_range")] + internal static extern PlayerErrorCode GetEqualizerLevelRange(IntPtr player, out int min, out int max); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency")] + internal static extern PlayerErrorCode GetEqualizerBandFrequency(IntPtr player, int index, out int frequency); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_get_equalizer_band_frequency_range")] + internal static extern PlayerErrorCode GetEqualizerBandFrequencyRange(IntPtr player, int index, out int range); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_clear")] + internal static extern PlayerErrorCode EqualizerClear(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_audio_effect_equalizer_is_available")] + internal static extern PlayerErrorCode EqualizerIsAvailable(IntPtr player, out bool available); + } + +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Display.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Display.cs new file mode 100644 index 0000000..3572b6a --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Display.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class Display + { + [DllImport(Libraries.Player, EntryPoint = "player_set_display_mode")] + internal static extern PlayerErrorCode SetMode(IntPtr player, PlayerDisplayMode mode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_mode")] + internal static extern PlayerErrorCode GetMode(IntPtr player, out PlayerDisplayMode mode); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_visible")] + internal static extern PlayerErrorCode SetVisible(IntPtr player, bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_is_display_visible")] + internal static extern PlayerErrorCode IsVisible(IntPtr player, out bool visible); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_rotation")] + internal static extern PlayerErrorCode SetRotation(IntPtr player, Rotation rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_get_display_rotation")] + internal static extern PlayerErrorCode GetRotation(IntPtr player, out Rotation rotation); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display_roi_area")] + internal static extern PlayerErrorCode SetRoi(IntPtr player, int x, int y, int width, int height); + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..1fd8784 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Player = "libcapi-media-player.so.0"; + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs new file mode 100644 index 0000000..b748044 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Interop/Interop.Player.cs @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class NativePlayer + { + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackCompletedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackInterruptedCallback(PlaybackInterruptionReason code, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackErrorCallback(int code, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoFrameDecodedCallback(IntPtr packetHandle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SubtitleUpdatedCallback(uint duration, string text, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferingProgressCallback(int percent, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoStreamChangedCallback(int width, int height, int fps, int bitrate, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaStreamBufferStatusCallback(MediaStreamBufferStatus status, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MediaStreamSeekCallback(ulong offset, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VideoCaptureCallback(IntPtr data, int width, int height, uint size, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PrepareCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SeekCompletedCallback(IntPtr userData); + + [DllImport(Libraries.Player, EntryPoint = "player_create")] + internal static extern PlayerErrorCode Create(out PlayerHandle player); + + [DllImport(Libraries.Player, EntryPoint = "player_destroy")] + internal static extern PlayerErrorCode Destroy(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_prepare")] + internal static extern PlayerErrorCode Prepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_unprepare")] + internal static extern PlayerErrorCode Unprepare(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_uri")] + internal static extern PlayerErrorCode SetUri(IntPtr player, string uri); + + [DllImport(Libraries.Player, EntryPoint = "player_set_display")] + internal static extern PlayerErrorCode SetDisplay(IntPtr player, DisplayType type, IntPtr display); + + [DllImport(Libraries.Player, EntryPoint = "player_start")] + internal static extern PlayerErrorCode Start(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_stop")] + internal static extern PlayerErrorCode Stop(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_pause")] + internal static extern PlayerErrorCode Pause(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_memory_buffer")] + internal static extern PlayerErrorCode SetMemoryBuffer(IntPtr player, byte[] data, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_state")] + internal static extern PlayerErrorCode GetState(IntPtr player, out int state); + + [DllImport(Libraries.Player, EntryPoint = "player_set_volume")] + internal static extern PlayerErrorCode SetVolume(IntPtr player, float left, float right); + + [DllImport(Libraries.Player, EntryPoint = "player_get_volume")] + internal static extern PlayerErrorCode GetVolume(IntPtr player, out float left, out float right); + + [DllImport(Libraries.Player, EntryPoint = "player_set_sound_stream_info")] + internal static extern PlayerErrorCode SetAudioPolicyInfo(IntPtr player, IntPtr streamInfo); + + [DllImport(Libraries.Player, EntryPoint = "player_set_audio_latency_mode")] + internal static extern PlayerErrorCode SetAudioLatencyMode(IntPtr player, AudioLatencyMode latencyMode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_latency_mode")] + internal static extern PlayerErrorCode GetAudioLatencyMode(IntPtr player, out AudioLatencyMode latencyMode); + + [DllImport(Libraries.Player, EntryPoint = "player_get_play_position")] + internal static extern PlayerErrorCode GetPlayPosition(IntPtr player, out int millisecond); + + [DllImport(Libraries.Player, EntryPoint = "player_set_play_position")] + internal static extern PlayerErrorCode SetPlayPosition(IntPtr player, int millisecond, + bool accurate, SeekCompletedCallback cb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_set_mute")] + internal static extern PlayerErrorCode SetMute(IntPtr player, bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_is_muted")] + internal static extern PlayerErrorCode IsMuted(IntPtr player, out bool muted); + + [DllImport(Libraries.Player, EntryPoint = "player_set_looping")] + internal static extern PlayerErrorCode SetLooping(IntPtr player, bool looping); + + [DllImport(Libraries.Player, EntryPoint = "player_is_looping")] + internal static extern PlayerErrorCode IsLooping(IntPtr player, out bool looping); + + [DllImport(Libraries.Player, EntryPoint = "player_set_completed_cb")] + internal static extern PlayerErrorCode SetCompletedCb(IntPtr player, + PlaybackCompletedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_completed_cb")] + internal static extern PlayerErrorCode UnsetCompletedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_interrupted_cb")] + internal static extern PlayerErrorCode SetInterruptedCb(IntPtr player, + PlaybackInterruptedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_interrupted_cb")] + internal static extern PlayerErrorCode UnsetInterruptedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_error_cb")] + internal static extern PlayerErrorCode SetErrorCb(IntPtr player, PlaybackErrorCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_error_cb")] + internal static extern PlayerErrorCode UnsetErrorCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_capture_video")] + internal static extern PlayerErrorCode CaptureVideo(IntPtr player, VideoCaptureCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_packet_video_frame_decoded_cb")] + internal static extern PlayerErrorCode SetVideoFrameDecodedCb(IntPtr player, VideoFrameDecodedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_packet_video_frame_decoded_cb")] + internal static extern PlayerErrorCode UnsetVideoFrameDecodedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_cookie")] + internal static extern PlayerErrorCode SetStreamingCookie(IntPtr player, string cookie, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_set_streaming_user_agent")] + internal static extern PlayerErrorCode SetStreamingUserAgent(IntPtr player, string userAgent, int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_streaming_download_progress")] + internal static extern PlayerErrorCode GetStreamingDownloadProgress(IntPtr player, out int start, out int current); + + [DllImport(Libraries.Player, EntryPoint = "player_set_buffering_cb")] + internal static extern PlayerErrorCode SetBufferingCb(IntPtr player, + BufferingProgressCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_buffering_cb")] + internal static extern PlayerErrorCode UnsetBufferingCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_playback_rate")] + internal static extern PlayerErrorCode SetPlaybackRate(IntPtr player, float rate); + + [DllImport(Libraries.Player, EntryPoint = "player_push_media_stream")] + internal static extern PlayerErrorCode PushMediaStream(IntPtr player, IntPtr packet); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_info")] + internal static extern PlayerErrorCode SetMediaStreamInfo(IntPtr player, int type, IntPtr format); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_status_cb")] + internal static extern PlayerErrorCode SetMediaStreamBufferStatusCb(IntPtr player, StreamType type, + MediaStreamBufferStatusCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_buffer_status_cb")] + internal static extern PlayerErrorCode UnsetMediaStreamBufferStatusCb(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_seek_cb")] + internal static extern PlayerErrorCode SetMediaStreamSeekCb(IntPtr player, StreamType type, + MediaStreamSeekCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_media_stream_seek_cb")] + internal static extern PlayerErrorCode UnsetMediaStreamSeekCb(IntPtr player, int type); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_max_size")] + internal static extern PlayerErrorCode SetMediaStreamBufferMaxSize(IntPtr player, StreamType type, ulong maxSize); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_max_size")] + internal static extern PlayerErrorCode GetMediaStreamBufferMaxSize(IntPtr player, StreamType type, out ulong maxSize); + + [DllImport(Libraries.Player, EntryPoint = "player_set_media_stream_buffer_min_threshold")] + internal static extern PlayerErrorCode SetMediaStreamBufferMinThreshold(IntPtr player, StreamType type, uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_get_media_stream_buffer_min_threshold")] + internal static extern PlayerErrorCode GetMediaStreamBufferMinThreshold(IntPtr player, int type, out uint percent); + + [DllImport(Libraries.Player, EntryPoint = "player_get_content_info")] + internal static extern PlayerErrorCode GetContentInfo(IntPtr player, StreamMetadataKey key, out IntPtr value); + + [DllImport(Libraries.Player, EntryPoint = "player_get_codec_info")] + internal static extern PlayerErrorCode GetCodecInfo(IntPtr player, out IntPtr audioCodec, out IntPtr videoCodec); + + [DllImport(Libraries.Player, EntryPoint = "player_get_audio_stream_info")] + internal static extern PlayerErrorCode GetAudioStreamInfo(IntPtr player, out int sampleRate, out int channel, out int bitRate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_stream_info")] + internal static extern PlayerErrorCode GetVideoStreamInfo(IntPtr player, out int fps, out int bitRate); + + [DllImport(Libraries.Player, EntryPoint = "player_get_album_art")] + internal static extern PlayerErrorCode GetAlbumArt(IntPtr player, out IntPtr albumArt, out int size); + + [DllImport(Libraries.Player, EntryPoint = "player_get_video_size")] + internal static extern PlayerErrorCode GetVideoSize(IntPtr player, out int width, out int height); + + [DllImport(Libraries.Player, EntryPoint = "player_get_duration")] + internal static extern PlayerErrorCode GetDuration(IntPtr player, out int duration); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_path")] + internal static extern PlayerErrorCode SetSubtitlePath(IntPtr player, string path); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_updated_cb")] + internal static extern PlayerErrorCode SetSubtitleUpdatedCb(IntPtr player, + SubtitleUpdatedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_subtitle_updated_cb")] + internal static extern PlayerErrorCode UnsetSubtitleUpdatedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_set_subtitle_position_offset")] + internal static extern PlayerErrorCode SetSubtitlePositionOffset(IntPtr player, int millisecond); + + [DllImport(Libraries.Player, EntryPoint = "player_set_video_stream_changed_cb")] + internal static extern PlayerErrorCode SetVideoStreamChangedCb(IntPtr player, + VideoStreamChangedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Player, EntryPoint = "player_unset_video_stream_changed_cb")] + internal static extern PlayerErrorCode UnsetVideoStreamChangedCb(IntPtr player); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_count")] + internal static extern PlayerErrorCode GetTrackCount(IntPtr player, int type, out int count); + + [DllImport(Libraries.Player, EntryPoint = "player_select_track")] + internal static extern PlayerErrorCode SelectTrack(IntPtr player, int type, int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_current_track")] + internal static extern PlayerErrorCode GetCurrentTrack(IntPtr player, int type, out int index); + + [DllImport(Libraries.Player, EntryPoint = "player_get_track_language_code")] + internal static extern PlayerErrorCode GetTrackLanguageCode(IntPtr player, int type, int index, out IntPtr code); + } + + internal class PlayerHandle : SafeHandle + { + protected PlayerHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var ret = NativePlayer.Destroy(handle); + if (ret != PlayerErrorCode.None) + { + Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}"); + return false; + } + + return true; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs b/src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs new file mode 100644 index 0000000..9890398 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/AudioEffect.cs @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Native = Interop.AudioEffect; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to control the audio effects for . + /// + public class AudioEffect + { + private readonly EqualizerBand[] _bands; + + internal AudioEffect(Player owner) + { + Player = owner; + + bool available = false; + + Native.EqualizerIsAvailable(Player.Handle, out available). + ThrowIfFailed("Failed to initialize the AudioEffect"); + + IsAvailable = available; + + if (IsAvailable == false) + { + return; + } + + int count = 0; + Native.GetEqualizerBandsCount(Player.Handle, out count). + ThrowIfFailed("Failed to initialize the AudioEffect"); + + int min = 0; + int max = 0; + Native.GetEqualizerLevelRange(Player.Handle, out min, out max). + ThrowIfFailed("Failed to initialize the AudioEffect"); + + Count = count; + BandLevelRange = new Range(min, max); + + _bands = new EqualizerBand[count]; + } + + /// + /// Gets a at the specified index. + /// + /// The index of the band to get. + /// The has already been disposed of. + /// + /// index is less than zero.\n + /// -or-\n + /// index is equal to or greater than . + /// + public EqualizerBand this[int index] + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + Player.ValidateNotDisposed(); + + if (index < 0 || Count <= index) + { + throw new ArgumentOutOfRangeException(nameof(index), index, + $"Valid index is 0 <= x < { nameof(Count) } "); + } + + if (_bands[index] == null) + { + _bands[index] = new EqualizerBand(this, index); + } + Log.Info(PlayerLog.Tag, "get equalizer band : " + _bands[index]); + return _bands[index]; + } + } + + /// + /// Clears the equalizer effect. + /// + /// The has already been disposed of. + public void Clear() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + Player.ValidateNotDisposed(); + + Native.EqualizerClear(Player.Handle). + ThrowIfFailed("Failed to clear equalizer effect"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Get the number of items. + /// + public int Count { get; } + + /// + /// Get the band level range of the bands in dB. + /// + public Range BandLevelRange { get; } + + /// + /// Gets the value whether the AudioEffect is available or not. + /// + public bool IsAvailable { get; } + + /// + /// Gets the player that this AudioEffect belongs to. + /// + public Player Player { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs new file mode 100644 index 0000000..d7d88a8 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/BufferingProgressChangedEventArgs.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class BufferingProgressChangedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the BufferingProgressChangedEventArgs class. + /// + /// The value indicating the buffering percentage. + public BufferingProgressChangedEventArgs(int percent) + { + Percent = percent; + } + + /// + /// Gets the value indicating the buffering percentage. + /// + /// The percentage of the buffering. + public int Percent { get; } + + public override string ToString() + { + return $"Percent={ Percent.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs b/src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs new file mode 100644 index 0000000..1bd3cac --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/CapturedFrame.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System.Diagnostics; + +namespace Tizen.Multimedia +{ + /// + /// Represents data for a video frame captured. + /// + public class CapturedFrame + { + internal CapturedFrame(byte[] imageBuffer, int width, int height) + { + Debug.Assert(imageBuffer != null, "imageBuffer is null!"); + Debug.Assert(width > 0, $"Width is invalid : {width}!"); + Debug.Assert(height > 0, $"height is invalid : {height}!"); + + Buffer = imageBuffer; + Size = new Size(width, height); + Log.Debug(PlayerLog.Tag, "width : " + width + ", height : " + height); + } + + /// + /// Gets the raw buffer of the captured image. + /// + /// The color space format is RGB888. + public byte[] Buffer { get; } + + /// + /// Gets the size. + /// + public Size Size { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs b/src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs new file mode 100644 index 0000000..d56dce6 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/DownloadProgress.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +namespace Tizen.Multimedia +{ + + /// + /// Represents data for a downloading status. + /// + public struct DownloadProgress + { + /// + /// Initializes a new instance of the DownloadProgress struct. + /// + /// The position that downloading started in percentage. + /// The position indicating the current downloading progress in percentage. + public DownloadProgress(int start, int current) + { + Start = start; + Current = current; + Log.Debug(PlayerLog.Tag, "start : " + start + ", current : " + current); + } + + /// + /// Gets or sets the start position. + /// + /// The position that downloading started in percentage. + public int Start + { + get; + set; + } + + /// + /// Gets or sets the current position. + /// + /// The position indicating the current downloading progress in percentage. + public int Current + { + get; + set; + } + + public override string ToString() + { + return $"Start={ Start.ToString() }, Current={ Current.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs b/src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs new file mode 100644 index 0000000..59dc485 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/EqualizerBand.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Diagnostics; +using Native = Interop.AudioEffect; + +namespace Tizen.Multimedia +{ + + /// + /// Represents a equalizer band of . + /// + public class EqualizerBand + { + private readonly AudioEffect _owner; + private readonly int _index; + + internal EqualizerBand(AudioEffect owner, int index) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + Debug.Assert(owner != null); + + _owner = owner; + _index = index; + + int frequency = 0; + int range = 0; + + Native.GetEqualizerBandFrequency(_owner.Player.Handle, _index, out frequency). + ThrowIfFailed("Failed to initialize equalizer band"); + + Native.GetEqualizerBandFrequencyRange(_owner.Player.Handle, _index, out range). + ThrowIfFailed("Failed to initialize equalizer band"); + + Frequency = frequency; + FrequencyRange = range; + Log.Debug(PlayerLog.Tag, "frequency : " + frequency + ", range : " + range); + } + + /// + /// Sets or gets the gain for the equalizer band. + /// + /// The value indicating new gain in decibel(dB). + /// The player that this EqualizerBand belongs to has already been disposed of. + /// + /// is less than .\n + /// -or-\n + /// is greater than . + /// + public int Level + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + _owner.Player.ValidateNotDisposed(); + + int value = 0; + Native.GetEqualizerBandLevel(_owner.Player.Handle, _index, out value). + ThrowIfFailed("Failed to get the level of the equalizer band"); + Log.Info(PlayerLog.Tag, "get level : " + value); + return value; + } + set + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + _owner.Player.ValidateNotDisposed(); + + if (value < _owner.BandLevelRange.Min || _owner.BandLevelRange.Max < value) + { + Log.Error(PlayerLog.Tag, "invalid level : " + value); + throw new ArgumentOutOfRangeException(nameof(value), value, + $"valid value range is { nameof(AudioEffect.BandLevelRange) }." + + $"but got {value}."); + } + + Native.SetEqualizerBandLevel(_owner.Player.Handle, _index, value). + ThrowIfFailed("Failed to set the level of the equalizer band"); + } + } + + + /// + /// Gets the frequency in dB. + /// + public int Frequency { get; } + + /// + /// Gets the frequency range in dB. + /// + public int FrequencyRange { get; } + + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs new file mode 100644 index 0000000..2fa4cd6 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaBufferSource.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using static Interop; + +namespace Tizen.Multimedia +{ + /// + /// Represents a media source using memory. + /// + /// + /// The buffer has to be filled with appropriate data which means it must be well-formatted. + /// If you provide invalid data, you won't receive an error until is called. + /// + /// + public sealed class MediaBufferSource : MediaSource + { + private byte[] _buffer; + + /// + /// Initialize a new instance of the MediaBufferSource class with an allocated buffer. + /// + /// The value indicating the size of the buffer. + /// + /// is zero.\n + /// -or-\n + /// is less than zero. + /// + public MediaBufferSource(int length) + { + if (length <= 0) + { + Log.Error(PlayerLog.Tag, "invalid length : " + length); + throw new ArgumentOutOfRangeException(nameof(length), length, + "length can't be equal to or less than zero."); + } + _buffer = new byte[length]; + } + + /// + /// Initialize a new instance of the MediaBufferSource class from the buffer. + /// + /// The source array to be copied into the buffer. + /// buffer is null. + public MediaBufferSource(byte[] buffer) : this(buffer, buffer == null ? 0 : buffer.Length) + { + } + + //TODO remove default parameter. + /// + /// Initialize a new instance of the MediaBufferSource class from the buffer + /// with the specified length and the specified offset. + /// + /// The source array to be copied into the buffer. + /// The value indicating the number of bytes to copy from the buffer. + /// The value indicating the offset in the buffer of the first byte to copy. + /// buffer is null. + /// + /// is less than zero.\n + /// -or-\n + /// is equal to or less than zero.\n + /// -or-\n + /// + is greater than buffer.Length. + /// + public MediaBufferSource(byte[] buffer, int length, int offset = 0) + { + if (buffer == null) + { + Log.Error(PlayerLog.Tag, "invalid buffer"); + throw new ArgumentNullException(nameof(buffer)); + } + if (offset < 0) + { + Log.Error(PlayerLog.Tag, "invalid offset : " + offset); + throw new ArgumentOutOfRangeException(nameof(offset), offset, "offset can't be less than zero."); + } + if (length <= 0) + { + Log.Error(PlayerLog.Tag, "invalid length : " + length); + throw new ArgumentOutOfRangeException(nameof(length), length, "length can't be equal to or less than zero."); + } + if (length + offset > buffer.Length) + { + Log.Error(PlayerLog.Tag, "invalid total length : " + (int)(length + offset)); + throw new ArgumentOutOfRangeException($"length + offset can't be greater than the length of the { nameof(buffer) }."); + } + + _buffer = new byte[length]; + + Array.Copy(buffer, offset, _buffer, 0, length); + } + + private MediaBufferSource() + { + } + + /// + /// Create a MediaBufferSource that wraps a byte array. + /// + /// The array to be wrapped. + /// A MediaBufferSource wrapping the byte array. + public static MediaBufferSource Wrap(byte[] buffer) + { + if (buffer == null) + { + Log.Error(PlayerLog.Tag, "invalid buffer"); + throw new ArgumentNullException(nameof(buffer)); + } + + MediaBufferSource source = new MediaBufferSource(); + source._buffer = buffer; + return source; + } + + /// + /// Gets the byte array of this buffer. + /// + public byte[] Buffer => _buffer; + + internal override void OnAttached(Player player) + { + NativePlayer.SetMemoryBuffer(player.Handle, _buffer, _buffer.Length). + ThrowIfFailed("Failed to set the memory buffer"); + } + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs new file mode 100644 index 0000000..428f1cb --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaSource.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +namespace Tizen.Multimedia +{ + /// + /// MediaSource is a base class for sources. + /// + public abstract class MediaSource + { + internal MediaSource() + { + } + + internal void AttachTo(Player player) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + OnAttached(player); + } + + internal void DetachFrom(Player player) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + OnDetached(player); + } + + internal abstract void OnAttached(Player player); + + internal virtual void OnDetached(Player player) + { + } + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs new file mode 100644 index 0000000..15d8e7a --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamBufferStatusChangedEventArgs.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + + /// + /// Provides data for the event. + /// + public class MediaStreamBufferStatusChangedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the MediaStreamBufferStatusChangedEventArgs class. + /// + /// The value indicating the status of the stream. + public MediaStreamBufferStatusChangedEventArgs(MediaStreamBufferStatus status) + { + Status = status; + } + + /// + /// Gets the status. + /// + public MediaStreamBufferStatus Status { get; } + + public override string ToString() + { + return $"Status : { Status.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs new file mode 100644 index 0000000..5448e4e --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamConfiguration.cs @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Diagnostics; +using static Interop; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to configure properties and handle events for . + /// + /// + public class MediaStreamConfiguration + { + private const ulong DefaultBufferMaxSize = 200000; + private const uint DefaultBufferMinThreshold = 0; + + private readonly MediaStreamSource _owner; + private readonly StreamType _streamType; + + private ulong _bufferMaxSize = DefaultBufferMaxSize; + private uint _threshold = DefaultBufferMinThreshold; + + internal MediaStreamConfiguration(MediaStreamSource owner, StreamType streamType) + { + _owner = owner; + _streamType = streamType; + } + + /// + /// Occurs when the buffer underrun or overflow. + /// + /// The event handler will be executed on an internal thread. + /// + /// + public event EventHandler BufferStatusChanged; + + /// + /// Occurs when the seeking is requested. + /// + /// The event handler will be executed on an internal thread. + public event EventHandler SeekingOccurred; + + /// + /// Gets the max size of the buffer. + /// + /// The max size of the buffer. The default is 200000. + /// If the buffer level over the max size, will be raised with . + /// The is not assigned to a player. + /// value is zero. + /// + public ulong BufferMaxSize + { + get + { + return _bufferMaxSize; + } + set + { + if (_owner.Player == null) + { + throw new InvalidOperationException("The source is not assigned to a player yet."); + } + + Debug.Assert(_owner.Player.IsDisposed == false); + + if (value == 0UL) + { + throw new ArgumentOutOfRangeException(nameof(value), value, "the buffer max size can't be zero."); + } + + NativePlayer.SetMediaStreamBufferMaxSize(_owner.Player.Handle, _streamType, value). + ThrowIfFailed("Failed to set the buffer max size"); + + _bufferMaxSize = value; + } + } + + /// + /// Gets the min threshold of the buffer or zero if the is not assigned to a player. + /// + /// The minimum threshold of the buffer in percentage. The default is zero. + /// If the buffer level drops below the threshold value, will be raised with . + /// The is not assigned to a player. + /// value is greater than 100. + /// + public uint BufferMinThreshold + { + get + { + return _threshold; + } + set + { + if (_owner.Player == null) + { + throw new InvalidOperationException("The source is not assigned to a player yet."); + } + + Debug.Assert(_owner.Player.IsDisposed == false); + + if (100 < value) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + $"The threshold can't be greater than 100, but got { value }."); + } + + NativePlayer.SetMediaStreamBufferMinThreshold(_owner.Player.Handle, _streamType, value). + ThrowIfFailed("Failed to set the buffer minimum threshold"); + + _threshold = value; + } + } + + internal void OnPlayerSet(Player player) + { + if (_streamType == StreamType.Audio) + { + player.MediaStreamAudioSeekingOccurred += MediaStreamSeekingOccurred; + player.MediaStreamAudioBufferStatusChanged += MediaStreamBufferStatusChanged; + } + else + { + player.MediaStreamVideoSeekingOccurred += MediaStreamSeekingOccurred; + player.MediaStreamVideoBufferStatusChanged += MediaStreamBufferStatusChanged; + } + + NativePlayer.SetMediaStreamBufferMaxSize(player.Handle, _streamType, _bufferMaxSize). + ThrowIfFailed("Failed to initialize the media stream configuration"); + + NativePlayer.SetMediaStreamBufferMinThreshold(player.Handle, _streamType, _threshold). + ThrowIfFailed("Failed to initialize the media stream configuration"); + } + + internal void OnPlayerUnset(Player player) + { + if (_streamType == StreamType.Audio) + { + player.MediaStreamAudioSeekingOccurred -= MediaStreamSeekingOccurred; + player.MediaStreamAudioBufferStatusChanged -= MediaStreamBufferStatusChanged; + } + else + { + player.MediaStreamVideoSeekingOccurred -= MediaStreamSeekingOccurred; + player.MediaStreamVideoBufferStatusChanged -= MediaStreamBufferStatusChanged; + } + } + + private void MediaStreamBufferStatusChanged(object sender, MediaStreamBufferStatusChangedEventArgs e) + { + BufferStatusChanged?.Invoke(this, e); + } + + private void MediaStreamSeekingOccurred(object sender, MediaStreamSeekingOccurredEventArgs e) + { + SeekingOccurred?.Invoke(this, e); + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs new file mode 100644 index 0000000..e962250 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSeekingOccurredEventArgs.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class MediaStreamSeekingOccurredEventArgs : EventArgs + { + /// + /// Initializes a new instance of the MediaStreamSeekingOccurredEventArgs class. + /// + /// The value indicating the new position to seek. + public MediaStreamSeekingOccurredEventArgs(ulong offset) + { + Offset = offset; + } + + /// + /// Gets the offset. + /// + public ulong Offset { get; } + + public override string ToString() => $"Offset : { Offset.ToString() }"; + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs new file mode 100644 index 0000000..45946be --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaStreamSource.cs @@ -0,0 +1,296 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using static Interop; + +namespace Tizen.Multimedia +{ + + /// + /// Provides the ability to push packets as the source of + /// + /// The source must be set as a source to a player before pushing. + /// + public sealed class MediaStreamSource : MediaSource + { + private readonly MediaFormat _audioMediaFormat; + private readonly MediaFormat _videoMediaFormat; + + /// + /// Gets all supported audio types. + /// + public static IEnumerable SupportedAudioTypes + { + get + { + yield return MediaFormatAudioMimeType.Aac; + } + } + + /// + /// Gets all supported video types. + /// + public static IEnumerable SupportedVideoTypes + { + get + { + yield return MediaFormatVideoMimeType.H264SP; + } + } + + private Player _player; + + private MediaStreamConfiguration CreateAudioConfiguration(AudioMediaFormat format) + { + if( format == null ) + { + return null; + } + + if (!SupportedAudioTypes.Contains(format.MimeType)) + { + Log.Error(PlayerLog.Tag, "The audio format is not supported : " + format.MimeType); + throw new ArgumentException($"The audio format is not supported, Type : {format.MimeType}."); + } + + return new MediaStreamConfiguration(this, StreamType.Audio); + } + + private MediaStreamConfiguration CreateVideoConfiguration(VideoMediaFormat format) + { + if (format == null) + { + return null; + } + + if (!SupportedVideoTypes.Contains(format.MimeType)) + { + Log.Error(PlayerLog.Tag, "The video format is not supported : " + format.MimeType); + throw new ArgumentException($"The video format is not supported, Type : {format.MimeType}."); + } + + return new MediaStreamConfiguration(this, StreamType.Video); + } + + + /// + /// Initialize a new instance of the MediaStreamSource class + /// with the specified and . + /// + /// The for this source. + /// The for this source. + /// AAC and H.264 are supported. + /// Both and are null. + /// + /// is not supported.\n + /// -or-\n + /// is not supported.\n + /// + /// + /// + public MediaStreamSource(AudioMediaFormat audioMediaFormat, VideoMediaFormat videoMediaFormat) + { + if (audioMediaFormat == null && videoMediaFormat == null) + { + throw new ArgumentNullException(nameof(audioMediaFormat) + " and " + nameof(videoMediaFormat)); + } + + _audioMediaFormat = audioMediaFormat; + _videoMediaFormat = videoMediaFormat; + + AudioConfiguration = CreateAudioConfiguration(audioMediaFormat); + VideoConfiguration = CreateVideoConfiguration(videoMediaFormat); + } + + /// + /// Initialize a new instance of the MediaStreamSource class with the specified . + /// + /// The for this source. + /// AAC is supported. + /// is null. + /// is not supported. + /// + public MediaStreamSource(AudioMediaFormat audioMediaFormat) + { + if (audioMediaFormat == null) + { + throw new ArgumentNullException(nameof(audioMediaFormat)); + } + + _audioMediaFormat = audioMediaFormat; + + AudioConfiguration = CreateAudioConfiguration(audioMediaFormat); + } + /// + /// Initialize a new instance of the MediaStreamSource class with the specified . + /// + /// H.264 can is supported. + /// The for this source. + /// is null. + /// is not supported. + /// + public MediaStreamSource(VideoMediaFormat videoMediaFormat) + { + if (videoMediaFormat == null) + { + throw new ArgumentNullException(nameof(videoMediaFormat)); + } + + _videoMediaFormat = videoMediaFormat; + + VideoConfiguration = CreateVideoConfiguration(videoMediaFormat); + } + + /// + /// Gets the audio configuration or null if no AudioMediaFormat is specified in the constructor. + /// + public MediaStreamConfiguration AudioConfiguration { get; } + + /// + /// Gets the video configuration or null if no VideoMediaFormat is specified in the constructor. + /// + public MediaStreamConfiguration VideoConfiguration { get; } + + /// + /// Pushes elementary stream to decode audio or video. + /// + /// This source must be set as a source to a player and the player must be in the , or state. + /// The to decode. + /// + /// This source is not set as a source to a player.\n + /// -or-\n + /// The player is not in the valid state. + /// + /// packet is null. + /// packet has been disposed. + /// + /// is neither video nor audio type.\n + /// -or-\n + /// The format of packet is not matched with the specified format in the constructor. + /// + /// the internal buffer reaches limits. + /// + /// + /// + public void Push(MediaPacket packet) + { + if (_player == null) + { + Log.Error(PlayerLog.Tag, "The source is not set as a source to a player yet."); + throw new InvalidOperationException("The source is not set as a source to a player yet."); + } + if (packet == null) + { + Log.Error(PlayerLog.Tag, "packet is null"); + throw new ArgumentNullException(nameof(packet)); + } + if (packet.IsDisposed) + { + Log.Error(PlayerLog.Tag, "packet is disposed"); + throw new ObjectDisposedException(nameof(packet)); + } + + if (packet.Format.Type == MediaFormatType.Text || packet.Format.Type == MediaFormatType.Container) + { + Log.Error(PlayerLog.Tag, "The format of the packet is invalid : " + packet.Format.Type); + throw new ArgumentException($"The format of the packet is invalid : { packet.Format.Type }."); + } + + if (!packet.Format.Equals(_audioMediaFormat) && !packet.Format.Equals(_videoMediaFormat)) + { + Log.Error(PlayerLog.Tag, "The format of the packet is invalid : Unmatched format."); + throw new ArgumentException($"The format of the packet is invalid : Unmatched format."); + } + + if (packet.Format.Type == MediaFormatType.Video && _videoMediaFormat == null) + { + Log.Error(PlayerLog.Tag, "Video is not configured with the current source."); + throw new ArgumentException("Video is not configured with the current source."); + } + if (packet.Format.Type == MediaFormatType.Audio && _audioMediaFormat == null) + { + Log.Error(PlayerLog.Tag, "Audio is not configured with the current source."); + throw new ArgumentException("Audio is not configured with the current source."); + } + + _player.ValidatePlayerState(PlayerState.Paused, PlayerState.Playing, PlayerState.Ready); + + NativePlayer.PushMediaStream(_player.Handle, packet.GetHandle()). + ThrowIfFailed("Failed to push the packet to the player"); + } + + private void SetMediaStreamInfo(StreamType streamType, MediaFormat mediaFormat) + { + if (mediaFormat == null) + { + Log.Error(PlayerLog.Tag, "invalid media format"); + return; + } + + IntPtr ptr = IntPtr.Zero; + + try + { + ptr = mediaFormat.AsNativeHandle(); + NativePlayer.SetMediaStreamInfo(_player.Handle, (int)streamType, ptr). + ThrowIfFailed("Failed to set the media stream info"); + } + finally + { + MediaFormat.ReleaseNativeHandle(ptr); + } + } + + internal override void OnAttached(Player player) + { + Debug.Assert(player != null); + + if (_player != null) + { + Log.Error(PlayerLog.Tag, "The source is has already been assigned to another player."); + throw new InvalidOperationException("The source is has already been assigned to another player."); + } + + AudioConfiguration?.OnPlayerSet(player); + VideoConfiguration?.OnPlayerSet(player); + + _player = player; + + SetMediaStreamInfo(StreamType.Audio, _audioMediaFormat); + SetMediaStreamInfo(StreamType.Video, _videoMediaFormat); + } + + internal override void OnDetached(Player player) + { + base.OnDetached(player); + + AudioConfiguration?.OnPlayerUnset(player); + VideoConfiguration?.OnPlayerUnset(player); + + _player = null; + } + + /// + /// Gets the that this source is assigned to as a source or null if this source is not assigned. + /// + /// + public Player Player => _player; + + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs b/src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs new file mode 100644 index 0000000..223a10e --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/MediaUriSource.cs @@ -0,0 +1,56 @@ +/// Media Uri source +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using static Interop; + +namespace Tizen.Multimedia +{ + /// + /// Represents a media source with a uri. + /// + /// + /// The internet privilege(http://tizen.org/privilege/internet) must be added if any URLs are used to play from network. + /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any video/audio files are used to play located in the internal storage. + /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any video/audio files are used to play located in the external storage. + /// + /// + public sealed class MediaUriSource : MediaSource + { + // TODO consider using Uri class. + /// + /// Initializes a new instance of the MediaUriSource class with the specified uri. + /// The uri string. + /// For HTTP or RSTP, uri should start with "http://" or "rtsp://". + /// The default protocol is "file://". + /// If you provide an invalid uri, you won't receive an error until is called. + public MediaUriSource(string uri) + { + Uri = uri ?? throw new ArgumentNullException(nameof(uri)); + } + + /// + /// Gets the uri. + /// + public string Uri { get; } + + internal override void OnAttached(Player player) + { + NativePlayer.SetUri(player.Handle, Uri).ThrowIfFailed("Failed to set the source with specified uri"); + } + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs new file mode 100644 index 0000000..8fe0082 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlaybackInterruptedEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class PlaybackInterruptedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the PlaybackInterruptedEventArgs class. + /// + /// The enum value indicating the reason. + public PlaybackInterruptedEventArgs(PlaybackInterruptionReason reason) + { + Reason = reason; + } + + /// + /// Gets the reason. + /// + public PlaybackInterruptionReason Reason { get; } + + public override string ToString() + { + return $"Reason : { Reason.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs new file mode 100644 index 0000000..fd202df --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/Player.cs @@ -0,0 +1,1326 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Diagnostics; +using System.IO; +using System.Threading; +using static Interop; + +namespace Tizen.Multimedia +{ + static internal class PlayerLog + { + internal const string Tag = "Tizen.Multimedia.Player"; + internal const string Enter = "[ENTER]"; + internal const string Leave = "[LEAVE]"; + } + + /// + /// Provides the ability to control media playback. + /// + /// + /// The Player provides functions to play a media content. + /// It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. + /// Note that only one video player can be played at one time. + /// + public class Player : IDisposable, IDisplayable + { + private PlayerHandle _handle; + + /// + /// Occurs when playback of a media is finished. + /// + public event EventHandler PlaybackCompleted; + private NativePlayer.PlaybackCompletedCallback _playbackCompletedCallback; + + /// + /// Occurs when playback of a media is interrupted. + /// + public event EventHandler PlaybackInterrupted; + private NativePlayer.PlaybackInterruptedCallback _playbackInterruptedCallback; + + /// + /// Occurs when any error occurs. + /// + /// The event handler will be executed on an internal thread. + public event EventHandler ErrorOccurred; + private NativePlayer.PlaybackErrorCallback _playbackErrorCallback; + + /// + /// Occurs when the video stream changed. + /// + /// The event handler will be executed on an internal thread. + public event EventHandler VideoStreamChanged; + private NativePlayer.VideoStreamChangedCallback _videoStreamChangedCallback; + + /// + /// Occurs when the subtitle is updated. + /// + /// The event handler will be executed on an internal thread. + public event EventHandler SubtitleUpdated; + private NativePlayer.SubtitleUpdatedCallback _subtitleUpdatedCallback; + + /// + /// Occurs when there is a change in the buffering status of streaming. + /// + public event EventHandler BufferingProgressChanged; + private NativePlayer.BufferingProgressCallback _bufferingProgressCallback; + + internal event EventHandler MediaStreamAudioBufferStatusChanged; + private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamAudioBufferStatusChangedCallback; + + internal event EventHandler MediaStreamVideoBufferStatusChanged; + private NativePlayer.MediaStreamBufferStatusCallback _mediaStreamVideoBufferStatusChangedCallback; + + internal event EventHandler MediaStreamAudioSeekingOccurred; + private NativePlayer.MediaStreamSeekCallback _mediaStreamAudioSeekCallback; + + internal event EventHandler MediaStreamVideoSeekingOccurred; + private NativePlayer.MediaStreamSeekCallback _mediaStreamVideoSeekCallback; + + /// + /// Initialize a new instance of the Player class. + /// + public Player() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + + NativePlayer.Create(out _handle).ThrowIfFailed("Failed to create player"); + + Debug.Assert(_handle != null); + + RetrieveProperties(); + + if (Features.IsSupported(Features.AudioEffect)) + { + _audioEffect = new AudioEffect(this); + } + + if (Features.IsSupported(Features.RawVideo)) + { + RegisterVideoFrameDecodedCallback(); + } + + DisplaySettings = PlayerDisplaySettings.Create(this); + } + + private void RetrieveProperties() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + + NativePlayer.GetAudioLatencyMode(Handle, out _audioLatencyMode). + ThrowIfFailed("Failed to initialize the player"); + + NativePlayer.IsLooping(Handle, out _isLooping).ThrowIfFailed("Failed to initialize the player"); + + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + private bool _callbackRegistered; + + private void RegisterCallbacks() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + + if (_callbackRegistered) + { + return; + } + RegisterSubtitleUpdatedCallback(); + RegisterErrorOccurredCallback(); + RegisterPlaybackInterruptedCallback(); + RegisterVideoStreamChangedCallback(); + RegisterBufferingCallback(); + RegisterMediaStreamBufferStatusCallback(); + RegisterMediaStreamSeekCallback(); + RegisterPlaybackCompletedCallback(); + + _callbackRegistered = true; + } + + /// + /// Gets the native handle of the player. + /// + /// An IntPtr that contains the native handle of the player. + /// The player has already been disposed of. + public IntPtr Handle + { + get + { + ValidateNotDisposed(); + return _handle.DangerousGetHandle(); + } + } + + internal void ValidatePlayerState(params PlayerState[] desiredStates) + { + Debug.Assert(desiredStates.Length > 0); + + ValidateNotDisposed(); + + var curState = State; + if (curState.IsAnyOf(desiredStates)) + { + return; + } + + throw new InvalidOperationException($"The player is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", desiredStates) }."); + } + + #region Properties + #region Network configuration + private string _cookie = ""; + private string _userAgent = ""; + + /// + /// Gets or Sets the cookie for streaming playback. + /// + /// To set, the player must be in the state. + /// The player is not in the valid state. + /// The player has already been disposed of. + /// The value to set is null. + public string Cookie + { + get + { + Log.Info(PlayerLog.Tag, "get cookie : " + _cookie); + return _cookie; + } + set + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Idle); + + if (value == null) + { + Log.Error(PlayerLog.Tag, "cookie can't be null"); + throw new ArgumentNullException(nameof(value), "Cookie can't be null."); + } + + NativePlayer.SetStreamingCookie(Handle, value, value.Length). + ThrowIfFailed("Failed to set the cookie to the player"); + + _cookie = value; + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + } + + /// + /// Gets or Sets the user agent for streaming playback. + /// + /// To set, the player must be in the state. + /// The player is not in the valid state. + /// The player has already been disposed of. + /// The value to set is null. + public string UserAgent + { + get + { + Log.Info(PlayerLog.Tag, "get useragent : " + _userAgent); + return _userAgent; + } + set + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Idle); + + if (value == null) + { + Log.Error(PlayerLog.Tag, "UserAgent can't be null"); + throw new ArgumentNullException(nameof(value), "UserAgent can't be null."); + } + + NativePlayer.SetStreamingUserAgent(Handle, value, value.Length). + ThrowIfFailed("Failed to set the user agent to the player"); + + _userAgent = value; + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + } + #endregion + + /// + /// Gets the state of the player. + /// + /// The current state of the player. + /// The player has already been disposed of. + public PlayerState State + { + get + { + ValidateNotDisposed(); + + if (IsPreparing()) + { + return PlayerState.Preparing; + } + + int state = 0; + NativePlayer.GetState(Handle, out state).ThrowIfFailed("Failed to retrieve the state of the player"); + + Debug.Assert(Enum.IsDefined(typeof(PlayerState), state)); + + return (PlayerState)state; + } + } + + private AudioLatencyMode _audioLatencyMode; + + /// + /// Gets or sets the audio latency mode. + /// + /// A that specifies the mode. The default is . + /// + /// If the mode is , + /// audio output interval can be increased so, it can keep more audio data to play. + /// But, state transition like pause or resume can be more slower than default(). + /// + /// The player has already been disposed of. + /// The value is not valid. + public AudioLatencyMode AudioLatencyMode + { + get + { + Log.Info(PlayerLog.Tag, "get audio latency mode : " + _audioLatencyMode); + return _audioLatencyMode; + } + set + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidateNotDisposed(); + + if (_audioLatencyMode == value) + { + return; + } + ValidationUtil.ValidateEnum(typeof(AudioLatencyMode), value); + + NativePlayer.SetAudioLatencyMode(Handle, value). + ThrowIfFailed("Failed to set the audio latency mode of the player"); + + _audioLatencyMode = value; + } + } + + private bool _isLooping; + + /// + /// Gets or sets the looping state. + /// + /// true if the playback is looping; otherwise, false. The default value is false. + /// The player has already been disposed of. + public bool IsLooping + { + get + { + Log.Info(PlayerLog.Tag, "get looping : " + _isLooping); + return _isLooping; + } + set + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidateNotDisposed(); + + if (_isLooping == value) + { + return; + } + + NativePlayer.SetLooping(Handle, value).ThrowIfFailed("Failed to set the looping state of the player"); + + _isLooping = value; + } + } + + #region Display methods + /// + /// Gets the display settings. + /// + /// A that specifies the display settings. + public PlayerDisplaySettings DisplaySettings { get; } + + private Display _display; + + private PlayerErrorCode SetDisplay(Display display) + { + if (display == null) + { + Log.Info(PlayerLog.Tag, "set display to none"); + return NativePlayer.SetDisplay(Handle, DisplayType.None, IntPtr.Zero); + } + + return display.ApplyTo(this); + } + + private void ReplaceDisplay(Display newDisplay) + { + _display?.SetOwner(null); + _display = newDisplay; + _display?.SetOwner(this); + } + + /// + /// Gets or sets the display. + /// + /// A that specifies the display. + /// The player must be in the state. + /// The player has already been disposed of. + /// The value has already been assigned to another player. + /// The player is not in the valid state. + public Display Display + { + get + { + return _display; + } + set + { + ValidatePlayerState(PlayerState.Idle); + + if (value?.Owner != null) + { + if (ReferenceEquals(this, value.Owner)) + { + return; + } + + throw new ArgumentException("The display has already been assigned to another."); + } + SetDisplay(value).ThrowIfFailed("Failed to set the display to the player"); + + ReplaceDisplay(value); + } + } + + PlayerErrorCode IDisplayable.ApplyEvasDisplay(DisplayType type, ElmSharp.EvasObject evasObject) + { + Debug.Assert(IsDisposed == false); + + Debug.Assert(Enum.IsDefined(typeof(DisplayType), type)); + + return NativePlayer.SetDisplay(Handle, type, evasObject); + } + #endregion + + private PlayerTrackInfo _audioTrack; + + /// + /// Gets the track info for audio. + /// + /// A for audio. + public PlayerTrackInfo AudioTrackInfo + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (_audioTrack == null) + { + _audioTrack = new PlayerTrackInfo(this, StreamType.Audio); + } + return _audioTrack; + } + } + + private PlayerTrackInfo _subtitleTrackInfo; + + /// + /// Gets the track info for subtitle. + /// + /// A for subtitle. + public PlayerTrackInfo SubtitleTrackInfo + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (_subtitleTrackInfo == null) + { + _subtitleTrackInfo = new PlayerTrackInfo(this, StreamType.Text); + } + return _subtitleTrackInfo; + } + } + + private StreamInfo _streamInfo; + + /// + /// Gets the stream information. + /// + /// A for this player. + public StreamInfo StreamInfo + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (_streamInfo == null) + { + _streamInfo = new StreamInfo(this); + } + return _streamInfo; + } + } + + private readonly AudioEffect _audioEffect; + + /// + /// Gets the audio effect. + /// + /// http://tizen.org/feature/multimedia.custom_audio_effect + /// The required feature is not supported. + public AudioEffect AudioEffect + { + get + { + if (_audioEffect == null) + { + throw new NotSupportedException($"The feature({Features.AudioEffect}) is not supported."); + } + + return _audioEffect; + } + } + + #endregion + + #region Dispose support + private bool _disposed; + + /// + /// Releases all resources used by the current instance. + /// + public void Dispose() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + Dispose(true); + } + + private void Dispose(bool disposing) + { + if (!_disposed) + { + ReplaceDisplay(null); + + if (_source != null) + { + try + { + _source.DetachFrom(this); + } + catch (Exception e) + { + Log.Error(PlayerLog.Tag, e.ToString()); + } + } + _source = null; + + if (_handle != null) + { + _handle.Dispose(); + } + _disposed = true; + } + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + Log.Warn(PlayerLog.Tag, "player was disposed"); + throw new ObjectDisposedException(nameof(Player)); + } + } + + internal bool IsDisposed => _disposed; + #endregion + + #region Methods + + /// + /// Gets or sets the mute state. + /// + /// true if the player is muted; otherwise, false. + /// The player has already been disposed of. + public bool Muted + { + get + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + + bool value = false; + NativePlayer.IsMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state of the player"); + + Log.Info(PlayerLog.Tag, "get mute : " + value); + + return value; + } + set + { + NativePlayer.SetMute(Handle, value).ThrowIfFailed("Failed to set the mute state of the player"); + } + } + + /// + /// Gets the streaming download Progress. + /// + /// The containing current download progress. + /// The player must be in the or state. + /// + /// The player is not streaming.\n + /// -or-\n + /// The player is not in the valid state. + /// + /// The player has already been disposed of. + public DownloadProgress GetDownloadProgress() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Playing, PlayerState.Paused); + + int start = 0; + int current = 0; + NativePlayer.GetStreamingDownloadProgress(Handle, out start, out current). + ThrowIfFailed("Failed to get download progress"); + + Log.Info(PlayerLog.Tag, "get download progress : " + start + ", " + current); + + return new DownloadProgress(start, current); + } + + #region Volume + /// + /// Gets or sets the current volume. + /// + /// Valid volume range is from 0 to 1.0, inclusive. + /// The player has already been disposed of. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than 1.0. + /// + public float Volume + { + get + { + float value = 0.0F; + NativePlayer.GetVolume(Handle, out value, out value). + ThrowIfFailed("Failed to get the volume of the player"); + return value; + } + set + { + if (value < 0F || 1.0F < value) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + $"Valid volume range is 0 <= value <= 1.0, but got { value }."); + } + + NativePlayer.SetVolume(Handle, value, value). + ThrowIfFailed("Failed to set the volume of the player"); + } + } + + #endregion + + /// + /// Sets the subtitle path for playback. + /// + /// Only MicroDVD/SubViewer(*.sub), SAMI(*.smi), and SubRip(*.srt) subtitle formats are supported. + /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any files are used to play located in the internal storage. + /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any files are used to play located in the external storage. + /// + /// The player has already been disposed of. + /// is an empty string. + /// The specified path does not exist. + /// The path is null. + public void SetSubtitle(string path) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidateNotDisposed(); + + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + if (path.Length == 0) + { + throw new ArgumentException("The path is empty.", nameof(path)); + } + + if (!File.Exists(path)) + { + throw new FileNotFoundException($"The specified file does not exist.", path); + } + + NativePlayer.SetSubtitlePath(Handle, path). + ThrowIfFailed("Failed to set the subtitle path to the player"); + + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Removes the subtitle path. + /// + /// The player must be in the state. + /// The player has already been disposed of. + /// The player is not in the valid state. + public void ClearSubtitle() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Idle); + + NativePlayer.SetSubtitlePath(Handle, null). + ThrowIfFailed("Failed to clear the subtitle of the player"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Sets the offset for the subtitle. + /// + /// The value indicating a desired offset in milliseconds. + /// The player must be in the or state. + /// The player has already been disposed of. + /// + /// The player is not in the valid state.\n + /// -or-\n + /// No subtitle is set. + /// + /// + public void SetSubtitleOffset(int offset) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Playing, PlayerState.Paused); + + var err = NativePlayer.SetSubtitlePositionOffset(Handle, offset); + + if (err == PlayerErrorCode.FeatureNotSupported) + { + throw new InvalidOperationException("No subtitle set"); + } + + err.ThrowIfFailed("Failed to the subtitle offset of the player"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + private void Prepare() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + NativePlayer.Prepare(Handle).ThrowIfFailed("Failed to prepare the player"); + } + + protected virtual void OnPreparing() + { + RegisterCallbacks(); + } + + /// + /// Prepares the media player for playback, asynchronously. + /// + /// A task that represents the asynchronous prepare operation. + /// To prepare the player, the player must be in the state, + /// and a source must be set. + /// No source is set. + /// The player has already been disposed of. + /// The player is not in the valid state. + public virtual Task PrepareAsync() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (_source == null) + { + throw new InvalidOperationException("No source is set."); + } + + ValidatePlayerState(PlayerState.Idle); + + OnPreparing(); + + var completionSource = new TaskCompletionSource(); + + SetPreparing(); + + Task.Run(() => + { + try + { + Prepare(); + ClearPreparing(); + completionSource.SetResult(true); + } + catch (Exception e) + { + ClearPreparing(); + completionSource.TrySetException(e); + } + }); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + + return completionSource.Task; + } + + /// + /// Unprepares the player. + /// + /// + /// The most recently used source is reset and no longer associated with the player. Playback is no longer possible. + /// If you want to use the player again, you have to set a source and call again. + /// + /// The player must be in the , or state. + /// It has no effect if the player is already in the state. + /// + /// + /// The player has already been disposed of. + /// The player is not in the valid state. + public virtual void Unprepare() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (State == PlayerState.Idle) + { + Log.Warn(PlayerLog.Tag, "idle state already"); + return; + } + ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing); + + NativePlayer.Unprepare(Handle).ThrowIfFailed("Failed to unprepare the player"); + + OnUnprepared(); + } + + protected virtual void OnUnprepared() + { + _source?.DetachFrom(this); + _source = null; + } + + /// + /// Starts or resumes playback. + /// + /// + /// The player must be in the or state. + /// It has no effect if the player is already in the state.\n + /// \n + /// Sound can be mixed with other sounds if you don't control the stream focus using . + /// + /// The player has already been disposed of. + /// The player is not in the valid state. + /// + /// + /// + /// + /// + public virtual void Start() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (State == PlayerState.Playing) + { + Log.Warn(PlayerLog.Tag, "playing state already"); + return; + } + ValidatePlayerState(PlayerState.Ready, PlayerState.Paused); + + NativePlayer.Start(Handle).ThrowIfFailed("Failed to start the player"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Stops playing media content. + /// + /// + /// The player must be in the or state. + /// It has no effect if the player is already in the state. + /// + /// The player has already been disposed of. + /// The player is not in the valid state. + /// + /// + public virtual void Stop() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (State == PlayerState.Ready) + { + Log.Warn(PlayerLog.Tag, "ready state already"); + return; + } + ValidatePlayerState(PlayerState.Paused, PlayerState.Playing); + + NativePlayer.Stop(Handle).ThrowIfFailed("Failed to stop the player"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Pauses the player. + /// + /// + /// The player must be in the state. + /// It has no effect if the player is already in the state. + /// + /// The player has already been disposed of. + /// The player is not in the valid state. + /// + public virtual void Pause() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (State == PlayerState.Paused) + { + Log.Warn(PlayerLog.Tag, "pause state already"); + return; + } + + ValidatePlayerState(PlayerState.Playing); + + NativePlayer.Pause(Handle).ThrowIfFailed("Failed to pause the player"); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + private MediaSource _source; + + /// + /// Sets a media source for the player. + /// + /// A that specifies the source for playback. + /// The player must be in the state. + /// The player has already been disposed of. + /// + /// The player is not in the valid state.\n + /// -or-\n + /// It is not able to assign the source to the player. + /// + /// + public void SetSource(MediaSource source) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Idle); + + if (source != null) + { + source.AttachTo(this); + } + + if (_source != null) + { + _source.DetachFrom(this); + } + + _source = source; + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Captures a video frame asynchronously. + /// + /// A task that represents the asynchronous capture operation. + /// http://tizen.org/feature/multimedia.raw_video + /// The player must be in the or state. + /// The player has already been disposed of. + /// The player is not in the valid state. + /// The required feature is not supported. + public async Task CaptureVideoAsync() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + + ValidationUtil.ValidateFeatureSupported(Features.RawVideo); + + ValidatePlayerState(PlayerState.Playing, PlayerState.Paused); + + TaskCompletionSource t = new TaskCompletionSource(); + + NativePlayer.VideoCaptureCallback cb = (data, width, height, size, _) => + { + Debug.Assert(size <= int.MaxValue); + + byte[] buf = new byte[size]; + Marshal.Copy(data, buf, 0, (int)size); + + t.TrySetResult(new CapturedFrame(buf, width, height)); + }; + + using (var cbKeeper = ObjectKeeper.Get(cb)) + { + NativePlayer.CaptureVideo(Handle, cb) + .ThrowIfFailed("Failed to capture the video"); + + return await t.Task; + } + } + + /// + /// Gets the play position in milliseconds. + /// + /// The player must be in the , or state. + /// The player has already been disposed of. + /// The player is not in the valid state. + /// + public int GetPlayPosition() + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Ready, PlayerState.Paused, PlayerState.Playing); + + int playPosition = 0; + + NativePlayer.GetPlayPosition(Handle, out playPosition). + ThrowIfFailed("Failed to get the play position of the player"); + + Log.Info(PlayerLog.Tag, "get play position : " + playPosition); + + return playPosition; + } + + private void SetPlayPosition(int milliseconds, bool accurate, + NativePlayer.SeekCompletedCallback cb) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + var ret = NativePlayer.SetPlayPosition(Handle, milliseconds, accurate, cb, IntPtr.Zero); + + //Note that we assume invalid param error is returned only when the position value is invalid. + if (ret == PlayerErrorCode.InvalidArgument) + { + throw new ArgumentOutOfRangeException(nameof(milliseconds), milliseconds, + "The position is not valid."); + } + if (ret != PlayerErrorCode.None) + { + Log.Error(PlayerLog.Tag, "Failed to set play position, " + (PlayerError)ret); + } + ret.ThrowIfFailed("Failed to set play position"); + } + + /// + /// Sets the seek position for playback, asynchronously. + /// + /// The value indicating a desired position in milliseconds. + /// The value indicating whether the operation performs with accuracy. + /// + /// The player must be in the , or state. + /// If the is true, the play position will be adjusted as the specified value, + /// but this might be considerably slow. If false, the play position will be a nearest keyframe position. + /// + /// The player has already been disposed of. + /// The player is not in the valid state. + /// The specified position is not valid. + /// + public async Task SetPlayPositionAsync(int position, bool accurate) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + var taskCompletionSource = new TaskCompletionSource(); + + bool immediateResult = _source is MediaStreamSource; + + NativePlayer.SeekCompletedCallback cb = _ => taskCompletionSource.TrySetResult(true); + + using (var cbKeeper = ObjectKeeper.Get(cb)) + { + SetPlayPosition(position, accurate, cb); + if (immediateResult) + { + taskCompletionSource.TrySetResult(true); + } + + await taskCompletionSource.Task; + } + + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Sets playback rate. + /// + /// The value for the playback rate. Valid range is -5.0 to 5.0, inclusive. + /// + /// The player must be in the , or state. + /// The sound will be muted, when the playback rate is under 0.0 or over 2.0. + /// + /// The player has already been disposed of. + /// + /// The player is not in the valid state.\n + /// -or-\n + /// Streaming playback. + /// + /// + /// is less than 5.0.\n + /// -or-\n + /// is greater than 5.0.\n + /// -or-\n + /// is zero. + /// + public void SetPlaybackRate(float rate) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (rate < -5.0F || 5.0F < rate || rate == 0.0F) + { + throw new ArgumentOutOfRangeException(nameof(rate), rate, "Valid range is -5.0 to 5.0 (except 0.0)"); + } + + ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + NativePlayer.SetPlaybackRate(Handle, rate).ThrowIfFailed("Failed to set the playback rate."); + Log.Debug(PlayerLog.Tag, PlayerLog.Leave); + } + + /// + /// Applies the audio stream policy. + /// + /// The to apply. + /// The player must be in the state. + /// + /// The player has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// The player is not in the valid state. + /// is null. + public void ApplyAudioStreamPolicy(AudioStreamPolicy policy) + { + Log.Debug(PlayerLog.Tag, PlayerLog.Enter); + if (policy == null) + { + throw new ArgumentNullException(nameof(policy)); + } + + if (policy.Handle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(policy)); + } + + ValidatePlayerState(PlayerState.Idle); + + NativePlayer.SetAudioPolicyInfo(Handle, policy.Handle). + ThrowIfFailed("Failed to set the audio stream policy to the player"); + } + #endregion + + #region Callback registrations + private void RegisterSubtitleUpdatedCallback() + { + _subtitleUpdatedCallback = (duration, text, _) => + { + Log.Debug(PlayerLog.Tag, "duration : " + duration + ", text : " + text); + SubtitleUpdated?.Invoke(this, new SubtitleUpdatedEventArgs(duration, text)); + }; + + NativePlayer.SetSubtitleUpdatedCb(Handle, _subtitleUpdatedCallback). + ThrowIfFailed("Failed to initialize the player"); + } + + private void RegisterPlaybackCompletedCallback() + { + _playbackCompletedCallback = _ => + { + Log.Debug(PlayerLog.Tag, "completed callback"); + PlaybackCompleted?.Invoke(this, EventArgs.Empty); + }; + NativePlayer.SetCompletedCb(Handle, _playbackCompletedCallback). + ThrowIfFailed("Failed to set PlaybackCompleted"); + } + + private void RegisterPlaybackInterruptedCallback() + { + _playbackInterruptedCallback = (code, _) => + { + if (!Enum.IsDefined(typeof(PlaybackInterruptionReason), code)) + { + return; + } + + if (code == PlaybackInterruptionReason.ResourceConflict) + { + OnUnprepared(); + } + + Log.Warn(PlayerLog.Tag, "interrupted reason : " + code); + PlaybackInterrupted?.Invoke(this, new PlaybackInterruptedEventArgs(code)); + }; + + NativePlayer.SetInterruptedCb(Handle, _playbackInterruptedCallback). + ThrowIfFailed("Failed to set PlaybackInterrupted"); + } + + private void RegisterErrorOccurredCallback() + { + _playbackErrorCallback = (code, _) => + { + //TODO handle service disconnected error. + Log.Warn(PlayerLog.Tag, "error code : " + code); + ErrorOccurred?.Invoke(this, new PlayerErrorOccurredEventArgs((PlayerError)code)); + }; + + NativePlayer.SetErrorCb(Handle, _playbackErrorCallback). + ThrowIfFailed("Failed to set PlaybackError"); + } + + #region VideoFrameDecoded event + + private EventHandler _videoFrameDecoded; + + private NativePlayer.VideoFrameDecodedCallback _videoFrameDecodedCallback; + + /// + /// Occurs when a video frame is decoded. + /// + /// + /// The event handler will be executed on an internal thread. + /// The in event args should be disposed after use. + /// + /// http://tizen.org/feature/multimedia.raw_video + /// The required feature is not supported. + /// + public event EventHandler VideoFrameDecoded + { + add + { + ValidationUtil.ValidateFeatureSupported(Features.RawVideo); + + _videoFrameDecoded += value; + } + remove + { + ValidationUtil.ValidateFeatureSupported(Features.RawVideo); + + _videoFrameDecoded -= value; + } + } + + private void RegisterVideoFrameDecodedCallback() + { + _videoFrameDecodedCallback = (packetHandle, _) => + { + var handler = _videoFrameDecoded; + if (handler != null) + { + Log.Debug(PlayerLog.Tag, "packet : " + packetHandle); + handler.Invoke(this, + new VideoFrameDecodedEventArgs(MediaPacket.From(packetHandle))); + } + else + { + MediaPacket.From(packetHandle).Dispose(); + } + }; + + NativePlayer.SetVideoFrameDecodedCb(Handle, _videoFrameDecodedCallback). + ThrowIfFailed("Failed to register the VideoFrameDecoded"); + } + #endregion + + private void RegisterVideoStreamChangedCallback() + { + ValidatePlayerState(PlayerState.Idle); + + _videoStreamChangedCallback = (width, height, fps, bitrate, _) => + { + Log.Debug(PlayerLog.Tag, "height : " + height + ", width : " + width + + ", fps : " + fps + ", bitrate : " + bitrate); + + VideoStreamChanged?.Invoke(this, new VideoStreamChangedEventArgs(height, width, fps, bitrate)); + }; + + NativePlayer.SetVideoStreamChangedCb(Handle, _videoStreamChangedCallback). + ThrowIfFailed("Failed to set the video stream changed callback"); + } + + private void RegisterBufferingCallback() + { + _bufferingProgressCallback = (percent, _) => + { + Log.Debug(PlayerLog.Tag, $"Buffering callback with percent { percent }"); + BufferingProgressChanged?.Invoke(this, new BufferingProgressChangedEventArgs(percent)); + }; + + NativePlayer.SetBufferingCb(Handle, _bufferingProgressCallback). + ThrowIfFailed("Failed to set BufferingProgress"); + } + + private void RegisterMediaStreamBufferStatusCallback() + { + _mediaStreamAudioBufferStatusChangedCallback = (status, _) => + { + Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status)); + Log.Debug(PlayerLog.Tag, "audio buffer status : " + status); + MediaStreamAudioBufferStatusChanged?.Invoke(this, + new MediaStreamBufferStatusChangedEventArgs(status)); + }; + _mediaStreamVideoBufferStatusChangedCallback = (status, _) => + { + Debug.Assert(Enum.IsDefined(typeof(MediaStreamBufferStatus), status)); + Log.Debug(PlayerLog.Tag, "video buffer status : " + status); + MediaStreamVideoBufferStatusChanged?.Invoke(this, + new MediaStreamBufferStatusChangedEventArgs(status)); + }; + + RegisterMediaStreamBufferStatusCallback(StreamType.Audio, _mediaStreamAudioBufferStatusChangedCallback); + RegisterMediaStreamBufferStatusCallback(StreamType.Video, _mediaStreamVideoBufferStatusChangedCallback); + } + + private void RegisterMediaStreamBufferStatusCallback(StreamType streamType, + NativePlayer.MediaStreamBufferStatusCallback cb) + { + NativePlayer.SetMediaStreamBufferStatusCb(Handle, streamType, cb). + ThrowIfFailed("Failed to SetMediaStreamBufferStatus"); + } + + private void RegisterMediaStreamSeekCallback() + { + _mediaStreamAudioSeekCallback = (offset, _) => + { + Log.Debug(PlayerLog.Tag, "audio seeking offset : " + offset); + MediaStreamAudioSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset)); + }; + _mediaStreamVideoSeekCallback = (offset, _) => + { + Log.Debug(PlayerLog.Tag, "video seeking offset : " + offset); + MediaStreamVideoSeekingOccurred?.Invoke(this, new MediaStreamSeekingOccurredEventArgs(offset)); + }; + + RegisterMediaStreamSeekCallback(StreamType.Audio, _mediaStreamAudioSeekCallback); + RegisterMediaStreamSeekCallback(StreamType.Video, _mediaStreamVideoSeekCallback); + } + + private void RegisterMediaStreamSeekCallback(StreamType streamType, NativePlayer.MediaStreamSeekCallback cb) + { + NativePlayer.SetMediaStreamSeekCb(Handle, streamType, cb). + ThrowIfFailed("Failed to SetMediaStreamSeek"); + } + #endregion + + #region Preparing state + + private int _isPreparing; + + private bool IsPreparing() + { + return Interlocked.CompareExchange(ref _isPreparing, 1, 1) == 1; + } + + private void SetPreparing() + { + Interlocked.Exchange(ref _isPreparing, 1); + } + + private void ClearPreparing() + { + Interlocked.Exchange(ref _isPreparing, 0); + } + + #endregion + + /// + /// This method supports the product infrastructure and is not intended to be used directly from application code. + /// + protected static Exception GetException(int errorCode, string message) => + ((PlayerErrorCode) errorCode).GetException(message); + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs new file mode 100644 index 0000000..3504eb3 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerDisplaySettings.cs @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using Native = Interop.Display; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to configure display settings for video . + /// + public class PlayerDisplaySettings + { + protected PlayerDisplaySettings(Player player) + { + if (player == null) + { + throw new ArgumentNullException(nameof(player)); + } + + Player = player; + } + + internal static PlayerDisplaySettings Create(Player player) => new PlayerDisplaySettings(player); + + protected Player Player { get; } + + /// + /// Gets or sets the . + /// + /// + /// Operation failed; internal error. + /// + /// The player already has been disposed of. + /// The specified value to set is invalid. + public PlayerDisplayMode Mode + { + get + { + Native.GetMode(Player.Handle, out var value). + ThrowIfFailed("Failed to get display mode"); + + return value; + } + set + { + ValidationUtil.ValidateEnum(typeof(PlayerDisplayMode), value); + + Native.SetMode(Player.Handle, value). + ThrowIfFailed("Failed to set display mode"); + } + } + + /// + /// Gets or sets the value indicating whether the display is visible. + /// + /// true if the display is visible; otherwise false. + /// + /// Operation failed; internal error. + /// + /// The player already has been disposed of. + public bool IsVisible + { + get + { + Native.IsVisible(Player.Handle, out var value). + ThrowIfFailed("Failed to get the visible state of the display"); + + return value; + } + set + { + Native.SetVisible(Player.Handle, value).ThrowIfFailed("Failed to set the visible state of the display"); + } + } + + /// + /// Gets or sets the rotation of the display. + /// + /// , , , + /// + /// + /// Operation failed; internal error. + /// + /// The player already has been disposed of. + /// The specified value to set is invalid. + public Rotation Rotation + { + get + { + Native.GetRotation(Player.Handle, out var value). + ThrowIfFailed("Failed to get the rotation state of the display"); + + return value; + } + set + { + ValidationUtil.ValidateEnum(typeof(Rotation), value); + + Native.SetRotation(Player.Handle, value). + ThrowIfFailed("Failed to set the rotation state of the display"); + } + } + + /// + /// Sets the roi(region of interest). + /// + /// The region. + /// + /// To set roi, must be set to first. + /// + /// + /// Operation failed; internal error.\n + /// -or-\n + /// is not set to . + /// + /// The player already has been disposed of. + /// width or height is less than or equal to zero. + public void SetRoi(Rectangle roi) + { + if (roi.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(roi), roi.Width, + $"The width of the roi can't be less than or equal to zero."); + } + if (roi.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(roi), roi.Height, + $"The height of the roi can't be less than or equal to zero."); + } + + if (Mode != PlayerDisplayMode.Roi) + { + throw new InvalidOperationException("Mode is not set to Roi"); + } + + Native.SetRoi(Player.Handle, roi.X, roi.Y, roi.Width, roi.Height). + ThrowIfFailed("Failed to set the roi"); + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs new file mode 100644 index 0000000..efc1c1d --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerEnums.cs @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// Specifies errors. + /// + /// + /// + public enum PlayerError + { + /// + /// File does not exists. + /// + NoSuchFile = ErrorCode.NoSuchFile, + + /// + /// Internal error. + /// + InternalError = ErrorCode.InvalidOperation, + + /// + /// No space. + /// + NoSpaceOnDevice = PlayerErrorCode.NoSpaceOnDevice, + + /// + /// Not enough buffer. + /// + BufferSpace = ErrorCode.BufferSpace, + + /// + /// failed. + /// + SeekFailed = PlayerErrorCode.SeekFailed, + + /// + /// Invalid state. + /// + InvalidState = PlayerErrorCode.InvalidState, + + /// + /// Not supported file. + /// + NotSupportedFile = PlayerErrorCode.NotSupportedFile, + + /// + /// Invalid uri. + /// + InvalidUri = PlayerErrorCode.InvalidUri, + + /// + /// Connection to service failed. + /// + ConnectionFailed = PlayerErrorCode.ConnectionFailed, + + /// + /// Not permitted DRM. + /// + DrmNotPermitted = PlayerErrorCode.DrmNotPermitted, + + /// + /// Service disconnected. + /// + ServiceDisconnected = PlayerErrorCode.ServiceDisconnected, + + /// + /// Not supported audio codec. + /// + AudioCodecNotSupported = PlayerErrorCode.NotSupportedAudioCodec, + + /// + /// Not supported video codec. + /// + VideoCodecNotSupported = PlayerErrorCode.NotSupportedVideoCodec, + + /// + /// Not supported subtitle file. + /// + SubtitleNotSupported = PlayerErrorCode.NotSupportedSubtitle, + } + + /// + /// Specifies states that a can have. + /// + public enum PlayerState + { + /// + /// Initial state, unprepared. + /// + /// + Idle = 1, + + /// + /// Prepared. + /// + /// + Ready, + + /// + /// Playing. + /// + /// + Playing, + + /// + /// Paused while playing media. + /// + /// + Paused, + + /// + /// Preparing in progress. + /// + /// /> + Preparing, + } + + internal static class PlayerStateExtensions + { + internal static bool IsAnyOf(this PlayerState thisState, params PlayerState[] states) + { + return Array.IndexOf(states, thisState) != -1; + } + } + + /// + /// Specifies audio latency modes for . + /// + /// + public enum AudioLatencyMode + { + /// + /// Low audio latency mode. + /// + Low, + + /// + /// Middle audio latency mode. + /// + Mid, + + /// + /// High audio latency mode. + /// + High, + } + + /// + /// Specifies display modes for + /// + /// + public enum PlayerDisplayMode + { + /// + /// Letter box. + /// + LetterBox, + + /// + /// Original size. + /// + OriginalSize, + + /// + /// Full-screen. + /// + FullScreen, + + /// + /// Cropped full-screen. + /// + CroppedFull, + + /// + /// Origin size (if surface size is larger than video size(width/height)) or + /// Letter box (if video size(width/height) is larger than surface size). + /// + OriginalOrFull, + + /// + /// Region of interest, See . + /// + Roi + } + + internal enum StreamType + { + /// + /// Audio element stream type + /// + Audio = 1, + + /// + /// Video element stream type + /// + Video, + + /// + /// Text type + /// + Text + } + + /// + /// Specifies the streaming buffer status. + /// + /// + /// + public enum MediaStreamBufferStatus + { + /// + /// Underrun. + /// + Underrun, + + /// + /// Completed. + /// + Overflow, + } + + /// + /// Specifies the reason for the playback interruption. + /// + /// + public enum PlaybackInterruptionReason + { + /// + /// Interrupted by a resource conflict and the will be unprepared, automatically. + /// + ResourceConflict = 4 + } + + /// + /// Specifies keys for the metadata. + /// + /// + public enum StreamMetadataKey + { + /// + /// Album. + /// + Album, + + /// + /// Artists. + /// + Artist, + + /// + /// Author. + /// + Author, + + /// + /// Genre. + /// + Genre, + + /// + /// Title. + /// + Title, + + /// + /// Year. + /// + Year + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs new file mode 100644 index 0000000..a25bb4e --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerError.cs @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum PlayerErrorCode + { + None = ErrorCode.None, + InvalidArgument = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + NoSuchFile = ErrorCode.NoSuchFile, + InvalidOperation = ErrorCode.InvalidOperation, + NoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + FeatureNotSupported = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + NoBufferSpace = ErrorCode.BufferSpace, + TizenPlayerError = -0x01940000, + PlayerErrorClass = TizenPlayerError | 0x20, + SeekFailed = PlayerErrorClass | 0x01, + InvalidState = PlayerErrorClass | 0x02, + NotSupportedFile = PlayerErrorClass | 0x03, + InvalidUri = PlayerErrorClass | 0x04, + SoundPolicyError = PlayerErrorClass | 0x05, + ConnectionFailed = PlayerErrorClass | 0x06, + VideoCaptureFailed = PlayerErrorClass | 0x07, + DrmExpired = PlayerErrorClass | 0x08, + DrmNoLicense = PlayerErrorClass | 0x09, + DrmFutureUse = PlayerErrorClass | 0x0a, + DrmNotPermitted = PlayerErrorClass | 0x0b, + ResourceLimit = PlayerErrorClass | 0x0c, + ServiceDisconnected = PlayerErrorClass | 0x0d, + NotSupportedAudioCodec = PlayerErrorClass | 0x0e, + NotSupportedVideoCodec = PlayerErrorClass | 0x0f, + NotSupportedSubtitle = PlayerErrorClass | 0x10 + } + + internal static class PlayerErrorCodeExtensions + { + internal static void ThrowIfFailed(this PlayerErrorCode err, string message) + { + if (err == PlayerErrorCode.None) + { + return; + } + + throw err.GetException(message); + } + + internal static Exception GetException(this PlayerErrorCode err, string message) + { + if (err == PlayerErrorCode.None) + { + return null; + } + + string msg = $"{ (message ?? "Operation failed") } : { err.ToString() }."; + + switch (err) + { + case PlayerErrorCode.InvalidArgument: + case PlayerErrorCode.InvalidUri: + throw new ArgumentException(msg); + + case PlayerErrorCode.NoSuchFile: + throw new FileNotFoundException(msg); + + case PlayerErrorCode.OutOfMemory: + throw new OutOfMemoryException(msg); + + case PlayerErrorCode.NoSpaceOnDevice: + throw new IOException(msg); + + case PlayerErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(msg); + + case PlayerErrorCode.NotSupportedFile: + throw new FileFormatException(msg); + + case PlayerErrorCode.FeatureNotSupported: + throw new NotSupportedException(msg); + + case PlayerErrorCode.DrmExpired: + case PlayerErrorCode.DrmNoLicense: + case PlayerErrorCode.DrmFutureUse: + case PlayerErrorCode.DrmNotPermitted: + // TODO consider another exception. + case PlayerErrorCode.InvalidOperation: + case PlayerErrorCode.InvalidState: + case PlayerErrorCode.SeekFailed: + case PlayerErrorCode.ConnectionFailed: + case PlayerErrorCode.VideoCaptureFailed: + throw new InvalidOperationException(msg); + + case PlayerErrorCode.NoBufferSpace: + throw new NoBufferSpaceException(msg); + + case PlayerErrorCode.ResourceLimit: + throw new ResourceLimitException(msg); + + case PlayerErrorCode.NotSupportedAudioCodec: + throw new CodecNotSupportedException(CodecKind.Audio); + + case PlayerErrorCode.NotSupportedVideoCodec: + throw new CodecNotSupportedException(CodecKind.Video); + + } + + throw new InvalidOperationException(msg); + } + } + + /// + /// The exception that is thrown when there is no available space in a buffer. + /// + public class NoBufferSpaceException : InvalidOperationException + { + /// + /// Initializes a new instance of the NoBufferSpaceException class with a specified error message. + /// + /// Error description. + public NoBufferSpaceException(string message) : base(message) + { + } + } + + /// + /// The exception that is thrown when there is no available resource for internal use. + /// + public class ResourceLimitException : InvalidOperationException + { + /// + /// Initializes a new instance of the ResourceLimitException class with a specified error message. + /// + /// Error description. + public ResourceLimitException(string message) : base(message) + { + } + } +} + diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs new file mode 100644 index 0000000..6e72e95 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerErrorOccurredEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class PlayerErrorOccurredEventArgs : EventArgs + { + /// + /// Initializes a new instance of the PlayerErrorOccurredEventArgs class. + /// + /// The value indicating what kind of error occurred. + public PlayerErrorOccurredEventArgs(PlayerError error) + { + Error = error; + } + + /// + /// Gets the error. + /// + public PlayerError Error { get; } + + public override string ToString() + { + return $"Error={ Error.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs new file mode 100644 index 0000000..459f725 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/PlayerTrackInfo.cs @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to retrieve track information. + /// + /// + /// + public class PlayerTrackInfo + { + private readonly int _streamType; + private readonly Player _owner; + + internal PlayerTrackInfo(Player player, StreamType streamType) + { + Debug.Assert(player != null); + + Log.Debug(PlayerLog.Tag, "streamType : " + streamType); + _streamType = (int)streamType; + _owner = player; + } + + /// + /// Gets the number of tracks. + /// + /// The number of tracks. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public int GetCount() + { + _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int count = 0; + NativePlayer.GetTrackCount(_owner.Handle, _streamType, out count). + ThrowIfFailed("Failed to get count of the track"); + Log.Info(PlayerLog.Tag, "get count : " + count); + return count; + } + + /// + /// Gets the language code for the specified index or null if the language is undefined. + /// + /// The number of tracks. + /// + /// The that owns this instance must be in the , or state. + /// The language codes are defined in ISO 639-1. + /// + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + /// + /// is less than zero.\n + /// -or-\n + /// is equal to or greater than + /// + public string GetLanguageCode(int index) + { + _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + if (index < 0 || GetCount() <= index) + { + Log.Error(PlayerLog.Tag, "invalid index"); + throw new ArgumentOutOfRangeException(nameof(index), index, + $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { index }."); + } + + IntPtr code = IntPtr.Zero; + + try + { + NativePlayer.GetTrackLanguageCode(_owner.Handle, _streamType, index, out code). + ThrowIfFailed("Failed to get the selected language of the player"); + + string result = Marshal.PtrToStringAnsi(code); + + if (result == "und") + { + Log.Error(PlayerLog.Tag, "not defined code"); + return null; + } + Log.Info(PlayerLog.Tag, "get language code : " + result); + return result; + } + finally + { + LibcSupport.Free(code); + } + } + + /// + /// Gets or sets the selected track index. + /// + /// The currently selected track index. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + /// + /// is less than zero.\n + /// -or-\n + /// is equal to or greater than + /// + public int Selected + { + get + { + _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int value = 0; + + NativePlayer.GetCurrentTrack(_owner.Handle, _streamType, out value). + ThrowIfFailed("Failed to get the selected index of the player"); + Log.Debug(PlayerLog.Tag, "get selected index : " + value); + return value; + } + set + { + if (value < 0 || GetCount() <= value) + { + Log.Error(PlayerLog.Tag, "invalid index"); + throw new ArgumentOutOfRangeException(nameof(value), value, + $"valid index range is 0 <= x < {nameof(GetCount)}(), but got { value }."); + } + + _owner.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + NativePlayer.SelectTrack(_owner.Handle, _streamType, value). + ThrowIfFailed("Failed to set the selected index of the player"); + } + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs b/src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs new file mode 100644 index 0000000..daa33bd --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/StreamInfo.cs @@ -0,0 +1,334 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Multimedia +{ + /// + /// Represents properties for audio stream. + /// + public struct AudioStreamProperties + { + /// + /// Initialize a new instance of the AudioStreamProperties struct with the specified sample rate, channels and bit rate. + /// + /// The sample rate of the stream. + /// The number of channels of the stream. + /// The bit rate of the stream. + public AudioStreamProperties(int sampleRate, int channels, int bitRate) + { + SampleRate = sampleRate; + Channels = channels; + BitRate = bitRate; + Log.Debug(PlayerLog.Tag, "sampleRate : " + sampleRate + ", channels : " + channels + ", bitRate : " + bitRate); + } + + /// + /// Gets or sets the sample rate. + /// + /// The audio sample rate(Hz). + public int SampleRate + { + get; + set; + } + + /// + /// Gets or sets the channels. + /// + public int Channels + { + get; + set; + } + + /// + /// Gets or sets the bit rate. + /// + /// The audio bit rate(Hz). + public int BitRate + { + get; + set; + } + + public override string ToString() => + $"SampleRate={ SampleRate.ToString() }, Channels={ Channels.ToString() }, BitRate={ BitRate.ToString() }"; + } + + /// + /// Represents properties for video stream. + /// + public struct VideoStreamProperties + { + /// + /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate and size. + /// + /// The fps of the stream. + /// The bit rate of the stream. + /// The size of the stream. + public VideoStreamProperties(int fps, int bitRate, Size size) + { + Fps = fps; + BitRate = bitRate; + Size = size; + Log.Debug(PlayerLog.Tag, "fps : " + fps + ", bitrate : " + bitRate + + ", width : " + size.Width + ", height : " + size.Height); + } + /// + /// Initialize a new instance of the VideoStreamProperties struct with the specified fps, bit rate, width and height. + /// + /// The fps of the stream. + /// The bit rate of the stream. + /// The width of the stream. + /// The height of the stream. + public VideoStreamProperties(int fps, int bitRate, int width, int height) + { + Fps = fps; + BitRate = bitRate; + Size = new Size(width, height); + Log.Debug(PlayerLog.Tag, "fps : " + fps + ", bitrate : " + bitRate + + ", width : " + width + ", height : " + height); + } + + /// + /// Gets or sets the fps. + /// + public int Fps + { + get; + set; + } + /// + /// Gets or sets the bit rate. + /// + public int BitRate + { + get; + set; + } + + /// + /// Gets or sets the size. + /// + public Size Size + { + get; + set; + } + + public override string ToString() + { + return $"Fps={ Fps.ToString() }, BitRate={ BitRate.ToString() }, Size=[{ Size.ToString() }]"; + } + } + + /// + /// Provides a means to retrieve stream information. + /// + public class StreamInfo + { + internal StreamInfo(Player owner) + { + Player = owner; + } + + /// + /// Retrieves the album art of the stream or null if there is no album art data. + /// + /// Raw byte array if album art exists; otherwise null. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public byte[] GetAlbumArt() + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + NativePlayer.GetAlbumArt(Player.Handle, out var art, out var size). + ThrowIfFailed("Failed to get the album art"); + + if (art == IntPtr.Zero || size == 0) + { + Log.Error(PlayerLog.Tag, "art is null or size is 0 : " + size); + return null; + } + + byte[] albumArt = new byte[size]; + Marshal.Copy(art, albumArt, 0, size); + return albumArt; + } + + private string GetCodecInfo(bool audioInfo) + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + IntPtr audioPtr = IntPtr.Zero; + IntPtr videoPtr = IntPtr.Zero; + try + { + NativePlayer.GetCodecInfo(Player.Handle, out audioPtr, out videoPtr). + ThrowIfFailed("Failed to get codec info"); + + if (audioInfo) + { + Log.Debug(PlayerLog.Tag, "it is audio case"); + return Marshal.PtrToStringAnsi(audioPtr); + } + else + { + Log.Debug(PlayerLog.Tag, "it is video case"); + return Marshal.PtrToStringAnsi(videoPtr); + } + } + finally + { + LibcSupport.Free(audioPtr); + LibcSupport.Free(videoPtr); + } + } + + /// + /// Retrieves the codec name of audio or null if there is no audio. + /// + /// A string that represents codec name. + public string GetAudioCodec() + { + return GetCodecInfo(true); + } + + /// + /// Retrieves the codec name of video or null if there is no video. + /// + /// A string that represents codec name. + public string GetVideoCodec() + { + return GetCodecInfo(false); + } + + /// + /// Gets the duration. + /// + /// The duration of the stream. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public int GetDuration() + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int duration = 0; + NativePlayer.GetDuration(Player.Handle, out duration). + ThrowIfFailed("Failed to get the duration"); + + Log.Info(PlayerLog.Tag, "get duration : " + duration); + return duration; + } + + /// + /// Gets the properties of audio. + /// + /// A that contains audio stream information. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public AudioStreamProperties GetAudioProperties() + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int sampleRate = 0; + int channels = 0; + int bitRate = 0; + + NativePlayer.GetAudioStreamInfo(Player.Handle, out sampleRate, out channels, out bitRate). + ThrowIfFailed("Failed to get audio stream info"); + + // TODO should we check value is zero and return null? + + return new AudioStreamProperties(sampleRate, channels, bitRate); + } + + /// + /// Gets the properties of video. + /// + /// A that contains video stream information. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public VideoStreamProperties GetVideoProperties() + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int fps = 0; + int bitRate = 0; + + NativePlayer.GetVideoStreamInfo(Player.Handle, out fps, out bitRate). + ThrowIfFailed("Failed to get the video stream info"); + + // TODO should we check value is zero and return null? + + return new VideoStreamProperties(fps, bitRate, GetVideoSize()); + } + + private Size GetVideoSize() + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + int height = 0; + int width = 0; + + NativePlayer.GetVideoSize(Player.Handle, out width, out height). + ThrowIfFailed("Failed to get the video size"); + + return new Size(width, height); + } + + /// + /// Gets the metadata with the specified key. + /// + /// A string that represents the value of the specified key. + /// The key to query. + /// The that owns this instance must be in the , or state. + /// The that this instance belongs to has been disposed. + /// The that this instance belongs to is not in the valid state. + public string GetMetadata(StreamMetadataKey key) + { + Player.ValidatePlayerState(PlayerState.Ready, PlayerState.Playing, PlayerState.Paused); + + ValidationUtil.ValidateEnum(typeof(StreamMetadataKey), key); + + IntPtr ptr = IntPtr.Zero; + + try + { + NativePlayer.GetContentInfo(Player.Handle, key, out ptr). + ThrowIfFailed($"Failed to get the meta data with the key '{ key }'"); + + return Marshal.PtrToStringAnsi(ptr); + } + finally + { + LibcSupport.Free(ptr); + } + } + + /// + /// Gets the that owns this instance. + /// + public Player Player { get; } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs new file mode 100644 index 0000000..0f1bee8 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/SubtitleUpdatedEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class SubtitleUpdatedEventArgs : EventArgs + { + internal SubtitleUpdatedEventArgs(uint duration, string text) + { + Duration = duration; + Text = text; + } + + /// + /// Gets the duration of the updated subtitle. + /// + public uint Duration { get; } + + /// + /// Gets the text of the updated subtitle. + /// + public string Text { get; } + + public override string ToString() + { + return $"Duration={ Duration.ToString() }, Text={ Text }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs new file mode 100644 index 0000000..daa545d --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/VideoFrameDecodedEventArgs.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class VideoFrameDecodedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the VideoFrameDecodedEventArgs class. + /// + internal VideoFrameDecodedEventArgs(MediaPacket packet) + { + Packet = packet; + } + + /// + /// Gets the packet containing the decoded frame. + /// + public MediaPacket Packet { get; } + + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs b/src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs new file mode 100644 index 0000000..ea54f34 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Player/VideoStreamChangedEventArgs.cs @@ -0,0 +1,59 @@ +/// This File contains VideoStreamEventArgs class +/// +/// Copyright 2016 by Samsung Electronics, Inc., +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class VideoStreamChangedEventArgs : EventArgs + { + + /// + /// Initializes a new instance of the VideoStreamChangedEventArgs class. + /// + internal VideoStreamChangedEventArgs(int height, int width, int fps, int bitRate) + { + Size = new Size(width, height); + Fps = fps; + BitRate = bitRate; + } + + /// + /// Gets the of new video. + /// + public Size Size { get; } + + /// + /// Gets the fps of new video + /// + public int Fps { get; } + + /// + /// Gets the bit rate of new video. + /// + public int BitRate { get; } + + public override string ToString() + { + return $"Size=({ Size.ToString() }), Fps={ Fps.ToString() }, BitRate={ BitRate.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.sln b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.sln new file mode 100755 index 0000000..c178c0e --- /dev/null +++ b/src/Tizen.Multimedia.MediaPlayer/Tizen.Multimedia.MediaPlayer.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.MediaPlayer", "Tizen.Multimedia.MediaPlayer.csproj", "{BB1AF9FB-C940-4623-B218-ECD1943169F8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{A5AF369B-6E56-4B34-A3CF-0ED0A353B57F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{59D17ABA-9010-47B1-9147-195BCB8CC124}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{361E8A4D-5640-49E8-8524-4EB5409646DD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{2B17A608-FCBB-49DB-B977-94E8FF160E1A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{61A19070-B8F4-4672-A77F-3A77762AD6DF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB1AF9FB-C940-4623-B218-ECD1943169F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB1AF9FB-C940-4623-B218-ECD1943169F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB1AF9FB-C940-4623-B218-ECD1943169F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB1AF9FB-C940-4623-B218-ECD1943169F8}.Release|Any CPU.Build.0 = Release|Any CPU + {A5AF369B-6E56-4B34-A3CF-0ED0A353B57F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5AF369B-6E56-4B34-A3CF-0ED0A353B57F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5AF369B-6E56-4B34-A3CF-0ED0A353B57F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5AF369B-6E56-4B34-A3CF-0ED0A353B57F}.Release|Any CPU.Build.0 = Release|Any CPU + {59D17ABA-9010-47B1-9147-195BCB8CC124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59D17ABA-9010-47B1-9147-195BCB8CC124}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59D17ABA-9010-47B1-9147-195BCB8CC124}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59D17ABA-9010-47B1-9147-195BCB8CC124}.Release|Any CPU.Build.0 = Release|Any CPU + {361E8A4D-5640-49E8-8524-4EB5409646DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {361E8A4D-5640-49E8-8524-4EB5409646DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {361E8A4D-5640-49E8-8524-4EB5409646DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {361E8A4D-5640-49E8-8524-4EB5409646DD}.Release|Any CPU.Build.0 = Release|Any CPU + {2B17A608-FCBB-49DB-B977-94E8FF160E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B17A608-FCBB-49DB-B977-94E8FF160E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B17A608-FCBB-49DB-B977-94E8FF160E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B17A608-FCBB-49DB-B977-94E8FF160E1A}.Release|Any CPU.Build.0 = Release|Any CPU + {61A19070-B8F4-4672-A77F-3A77762AD6DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61A19070-B8F4-4672-A77F-3A77762AD6DF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61A19070-B8F4-4672-A77F-3A77762AD6DF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61A19070-B8F4-4672-A77F-3A77762AD6DF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs new file mode 100644 index 0000000..3ace080 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libc.cs @@ -0,0 +1,11 @@ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..df5d155 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MetadataEditor = "libcapi-media-metadata-editor.so"; + public const string MetadataExtractor = "libcapi-media-metadata-extractor.so"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs new file mode 100644 index 0000000..c187e7b --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataEditor.cs @@ -0,0 +1,36 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class MetadataEditor + { + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_create")] + internal static extern MetadataEditorError Create(out IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_path")] + internal static extern MetadataEditorError SetPath(IntPtr handle, string path); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_destroy")] + internal static extern MetadataEditorError Destroy(IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_metadata")] + internal static extern MetadataEditorError GetMetadata(IntPtr handle, MetadataEditorAttr attribute, out IntPtr value); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_set_metadata")] + internal static extern MetadataEditorError SetMetadata(IntPtr handle, MetadataEditorAttr attribute, string value); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_update_metadata")] + internal static extern MetadataEditorError UpdateMetadata(IntPtr handle); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_get_picture")] + internal static extern MetadataEditorError GetPicture(IntPtr handle, int index, out IntPtr picture, out int size, out IntPtr mimeType); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_append_picture")] + internal static extern MetadataEditorError AddPicture(IntPtr handle, string path); + + [DllImport(Libraries.MetadataEditor, EntryPoint = "metadata_editor_remove_picture")] + internal static extern MetadataEditorError RemovePicture(IntPtr handle, int index); + } +} diff --git a/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs new file mode 100644 index 0000000..54a393f --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Interop/Interop.MetadataExtractor.cs @@ -0,0 +1,55 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class MetadataExtractor + { + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_create")] + internal static extern MetadataExtractorError Create(out IntPtr handle); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_path")] + internal static extern MetadataExtractorError SetPath(IntPtr handle, string path); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_set_buffer")] + internal static extern MetadataExtractorError SetBuffer(IntPtr handle, IntPtr buffer, int size); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_destroy")] + internal static extern MetadataExtractorError Destroy(IntPtr handle); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_metadata")] + private static extern MetadataExtractorError GetMetadata(IntPtr handle, MetadataExtractorAttr attribute, out IntPtr value); + + internal static string GetMetadata(IntPtr handle, MetadataExtractorAttr attr) + { + IntPtr valuePtr = IntPtr.Zero; + + try + { + var ret = GetMetadata(handle, attr, out valuePtr); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value for " + attr); + return Marshal.PtrToStringAnsi(valuePtr); + } + finally + { + Libc.Free(valuePtr); + } + } + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_artwork")] + internal static extern MetadataExtractorError GetArtwork(IntPtr handle, out IntPtr artwork, + out int size, out IntPtr mimeType); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame")] + internal static extern MetadataExtractorError GetFrame(IntPtr handle, out IntPtr frame, out int size); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_synclyrics")] + internal static extern MetadataExtractorError GetSynclyrics(IntPtr handle, int index, + out uint timeStamp, out IntPtr lyrics); + + [DllImport(Libraries.MetadataExtractor, EntryPoint = "metadata_extractor_get_frame_at_time")] + internal static extern MetadataExtractorError GetFrameAtTime(IntPtr handle, uint timeStamp, + bool isAccurate, out IntPtr frame, out int size); + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs new file mode 100755 index 0000000..aeda76e --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditor.cs @@ -0,0 +1,537 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to edit the metadata of the media file. + /// + /// + /// If you want to access only internal storage, + /// you should add privilege http://tizen.org/privilege/mediastorage. \n + /// Or if you want to access only external storage, + /// you should add privilege http://tizen.org/privilege/externalstorage. \n + /// + public class MetadataEditor : IDisposable + { + private bool _disposed = false; + private IntPtr _handle = IntPtr.Zero; + private bool _isFileReadOnly; + + private IntPtr Handle + { + get + { + if (_handle == IntPtr.Zero) + { + throw new ObjectDisposedException(nameof(MetadataEditor)); + } + + return _handle; + } + } + + /// + /// Initializes a new instance of the class with the specified path. + /// + /// 3 + /// The path of the media file to edit metadata. + /// is null. + /// is a zero-length string, contains only white space. + /// The file is not supported. + /// File does not exist. + /// Caller does not have required privilege to access the file. + public MetadataEditor(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + if (string.IsNullOrWhiteSpace(path)) + { + throw new ArgumentException($"{nameof(path)} is a zero-length string.", nameof(path)); + } + + Interop.MetadataEditor.Create(out _handle).ThrowIfError("Failed to create metadata"); + + try + { + Interop.MetadataEditor.SetPath(Handle, path).ThrowIfError("Failed to set path"); + + _isFileReadOnly = File.GetAttributes(path).HasFlag(FileAttributes.ReadOnly); + } + catch (Exception) + { + Interop.MetadataEditor.Destroy(_handle); + throw; + } + } + + private string GetParam(MetadataEditorAttr attr) + { + IntPtr val = IntPtr.Zero; + + try + { + Interop.MetadataEditor.GetMetadata(Handle, attr, out val) + .ThrowIfError("Failed to get metadata"); + + return Marshal.PtrToStringAnsi(val); + } + finally + { + Interop.Libc.Free(val); + } + } + + private void SetParam(MetadataEditorAttr attr, string value) + { + if (_isFileReadOnly) + { + throw new InvalidOperationException("The media file is read-only."); + } + + Interop.MetadataEditor.SetMetadata(Handle, attr, value).ThrowIfError("Failed to set value"); + } + + /// + /// Gets or sets the artist of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Artist + { + get + { + return GetParam(MetadataEditorAttr.Artist); + } + + set + { + SetParam(MetadataEditorAttr.Artist, value); + } + } + + /// + /// Gets or sets the title of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Title + { + get + { + return GetParam(MetadataEditorAttr.Title); + } + + set + { + SetParam(MetadataEditorAttr.Title, value); + } + } + + /// + /// Gets or sets the album name of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Album + { + get + { + return GetParam(MetadataEditorAttr.Album); + } + + set + { + SetParam(MetadataEditorAttr.Album, value); + } + } + + /// + /// Gets or sets the genre of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Genre + { + get + { + return GetParam(MetadataEditorAttr.Genre); + } + + set + { + SetParam(MetadataEditorAttr.Genre, value); + } + } + + /// + /// Gets or sets the author of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Author + { + get + { + return GetParam(MetadataEditorAttr.Author); + } + + set + { + SetParam(MetadataEditorAttr.Author, value); + } + } + + /// + /// Gets or sets the copyright of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Copyright + { + get + { + return GetParam(MetadataEditorAttr.Copyright); + } + + set + { + SetParam(MetadataEditorAttr.Copyright, value); + } + } + + /// + /// Gets or sets the date of media. + /// + /// 3 + /// + /// If the media contains ID3 tag, this refers to the recorded date. + /// If the media is a mp4 format, this refers to the year and the value to set will be converted into integer. + /// + /// The file is read-only. + /// The has already been disposed. + public string Date + { + get + { + return GetParam(MetadataEditorAttr.Date); + } + + set + { + SetParam(MetadataEditorAttr.Date, value); + } + } + + /// + /// Gets or sets the description of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Description + { + get + { + return GetParam(MetadataEditorAttr.Description); + } + + set + { + SetParam(MetadataEditorAttr.Description, value); + } + } + + /// + /// Gets or sets the comment of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Comment + { + get + { + return GetParam(MetadataEditorAttr.Comment); + } + + set + { + SetParam(MetadataEditorAttr.Comment, value); + } + } + + /// + /// Gets or sets the track number of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string TrackNumber + { + get + { + return GetParam(MetadataEditorAttr.TrackNumber); + } + + set + { + SetParam(MetadataEditorAttr.TrackNumber, value); + } + } + + /// + /// Gets the count of album arts of media. + /// + /// 3 + /// The has already been disposed. + public int PictureCount + { + get => int.TryParse(GetParam(MetadataEditorAttr.PictureCount), out var value) ? value : 0; + } + + /// + /// Gets or sets the conductor of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string Conductor + { + get + { + return GetParam(MetadataEditorAttr.Conductor); + } + + set + { + SetParam(MetadataEditorAttr.Conductor, value); + } + } + + /// + /// Gets or sets the unsynchronized lyrics of media. + /// + /// 3 + /// The file is read-only. + /// The has already been disposed. + public string UnsyncLyrics + { + get + { + return GetParam(MetadataEditorAttr.UnsyncLyrics); + } + + set + { + SetParam(MetadataEditorAttr.UnsyncLyrics, value); + } + } + + /// + /// Writes the modified metadata to the media file. + /// + /// + /// An internal error occurs.\n + /// -or-\n + /// The file is read-only. + /// + /// The has already been disposed. + public void Commit() + { + if (_isFileReadOnly) + { + throw new InvalidOperationException("The media file is read-only."); + } + + Interop.MetadataEditor.UpdateMetadata(Handle).ThrowIfError("Failed to update file"); + } + + /// + /// Gets the artwork image in the media file. + /// + /// 3 + /// The index of picture to import. + /// Artwork included in the media file. + /// Artwork included in the media file. + /// An internal error occurs. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than or equal to .\n + /// + /// The has already been disposed. + public Artwork GetPicture(int index) + { + if (index < 0) + { + throw new ArgumentOutOfRangeException(nameof(index), index, + "Index should not be less than zero."); + } + + if (index >= PictureCount) + { + throw new ArgumentOutOfRangeException(nameof(index), index, + "Index should not be greater thor or equal to PictureCount."); + } + + IntPtr data = IntPtr.Zero; + IntPtr mimeType = IntPtr.Zero; + + try + { + Interop.MetadataEditor.GetPicture(Handle, index, out data, out var size, out mimeType). + ThrowIfError("Failed to get the value"); + + if (size > 0) + { + byte[] tmpBuf = new byte[size]; + Marshal.Copy(data, tmpBuf, 0, size); + + return new Artwork(tmpBuf, Marshal.PtrToStringAnsi(mimeType)); + } + + return null; + } + finally + { + if (data != IntPtr.Zero) + { + Interop.Libc.Free(data); + } + + if (mimeType != IntPtr.Zero) + { + Interop.Libc.Free(mimeType); + } + } + } + + /// + /// Appends the picture to the media file. + /// + /// 3 + /// The path of picture for adding to the metadata. + /// + /// An internal error occurs.\n + /// -or-\n + /// The media file is read-only. + /// + /// Picture path is null + /// File does not exist. + /// Caller does not have required privilege to access the file. + /// The has already been disposed. + /// The specified file is not supported. + public void AddPicture(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + if (File.Exists(path) == false) + { + throw new FileNotFoundException("File does not exist.", path); + } + + if (_isFileReadOnly) + { + throw new InvalidOperationException("The media file is read-only."); + } + + Interop.MetadataEditor.AddPicture(Handle, path). + ThrowIfError("Failed to append picture"); + } + + /// + /// Removes the picture from the media file. + /// + /// 3 + /// The index of picture to remove. + /// + /// An internal error occurs.\n + /// -or-\n + /// The media file is read-only. + /// + /// + /// is less than zero.\n + /// -or-\n + /// is greater than or equal to .\n + /// + /// The has already been disposed. + public void RemovePicture(int index) + { + if (index < 0) + { + throw new ArgumentOutOfRangeException("Index should be larger than 0 [" + index + "]"); + } + + if (index >= PictureCount) + { + throw new ArgumentOutOfRangeException(nameof(index), index, + "Index should not be greater thor or equal to PictureCount."); + } + + if (_isFileReadOnly) + { + throw new InvalidOperationException("The media file is read-only."); + } + + Interop.MetadataEditor.RemovePicture(Handle, index).ThrowIfError("Failed to remove picture"); + } + + ~MetadataEditor() + { + Dispose(false); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != IntPtr.Zero) + { + Interop.MetadataEditor.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs new file mode 100644 index 0000000..2c9a018 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorAttr.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + internal enum MetadataEditorAttr + { + Artist, + Title, + Album, + Genre, + Author, + Copyright, + Date, + Description, + Comment, + TrackNumber, + PictureCount, + Conductor, + UnsyncLyrics, + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorError.cs b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorError.cs new file mode 100644 index 0000000..4459d60 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataEditor/MetadataEditorError.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for metadata extractor's error codes. + /// + internal enum MetadataEditorError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + FileNotExists = ErrorCode.FileExists, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + TizenMetadataEditorError = -0x019C0000, + OperationFailed = TizenMetadataEditorError | 0x01 + } + + internal static class MetadataEditorErrorExtensions + { + internal static void ThrowIfError(this MetadataEditorError errorCode, string errorMessage) + { + if (errorCode == MetadataEditorError.None) + { + return; + } + + switch (errorCode) + { + case MetadataEditorError.InvalidParameter: + throw new ArgumentException(errorMessage); + + case MetadataEditorError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + + case MetadataEditorError.FileNotExists: + throw new FileNotFoundException(errorMessage); + + case MetadataEditorError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + + case MetadataEditorError.NotSupported: + throw new FileFormatException(errorMessage); + + case MetadataEditorError.OperationFailed: + throw new InvalidOperationException(errorMessage); + } + } + } +} + diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs new file mode 100755 index 0000000..d5a83a7 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Artwork.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents artwork information of media. + /// + public class Artwork + { + /// + /// Initializes a new instance of the Artwork class with the specified data and mime type. + /// + /// 3 + /// The data of the artwork to set metadata. + /// The mime type of the data of the artwork. + public Artwork(byte[] data, string mimeType) + { + Data = data; + MimeType = mimeType; + } + + /// + /// Gets the encoded artwork image. + /// + /// 3 + public byte[] Data { get; } + + /// + /// Gets the mime type of artwork. + /// + /// 3 + public string MimeType { get; } + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs new file mode 100755 index 0000000..4efafa1 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/Metadata.cs @@ -0,0 +1,398 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using static Interop.MetadataExtractor; + +namespace Tizen.Multimedia +{ + /// + /// Represents video metadata information. + /// + public class VideoMetadata + { + private VideoMetadata(int streamCount, IntPtr handle) + { + Debug.Assert(streamCount > 0); + Debug.Assert(handle != IntPtr.Zero); + + StreamCount = streamCount; + BitRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoBitrate)); + Fps = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoFps)); + Width = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoWidth)); + Height = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.VideoHeight)); + Codec = GetMetadata(handle, MetadataExtractorAttr.VideoCodec); + + _description = new Lazy(() => ObjectDescriptionBuilder.BuildWithProperties(this)); + } + + internal static VideoMetadata From(IntPtr handle) + { + var streamCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.VideoStreamCount)); + + return streamCount > 0 ? new VideoMetadata(streamCount, handle) : null; + } + + /// + /// Gets the bitrate. + /// + /// 3 + /// The bitrate value, or null if the information does not exist. + public int? BitRate { get; } + + /// + /// Gets the video FPS. + /// + /// 3 + /// The fps value, or null if the information does not exist. + public int? Fps { get; } + + /// + /// Gets the width of the video. + /// + /// 3 + /// The width value, or null if the information does not exist. + public int? Width { get; } + + /// + /// Gets the height of the video. + /// + /// 3 + /// The height value, or null if the information does not exist. + public int? Height { get; } + + /// + /// Get the codec type of the video. + /// + /// 3 + /// A string representing the codec type, or null if the information does not exist. + public string Codec { get; } + + /// + /// Gets the video stream count. + /// + /// 3 + /// The number of video streams. + public int StreamCount { get; } + + private Lazy _description; + + public override string ToString() + { + return _description.Value; + } + + } + + /// + /// Represents audio metadata information. + /// + public class AudioMetadata + { + private AudioMetadata(int streamCount, IntPtr handle) + { + Debug.Assert(streamCount > 0); + Debug.Assert(handle != IntPtr.Zero); + + StreamCount = streamCount; + BitRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioBitrate)); + Channels = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioChannels)); + SampleRate = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioSamplerate)); + BitPerSample = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.AudioBitPerSample)); + Codec = GetMetadata(handle, MetadataExtractorAttr.AudioCodec); + + _description = new Lazy(() => ObjectDescriptionBuilder.BuildWithProperties(this)); + } + + internal static AudioMetadata From(IntPtr handle) + { + var streamCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.AudioStreamCount)); + + return streamCount > 0 ? new AudioMetadata(streamCount, handle) : null; + } + + /// + /// Gets the audio bitrate. + /// + /// 3 + /// The bit rate value, or null if the information does not exist. + public int? BitRate { get; } + + /// + /// Gets the audio channels. + /// + /// 3 + /// The number of the audio channels, or null if the information does not exist. + public int? Channels { get; } + + /// + /// Gets the audio sample rate. + /// + /// 3 + /// The sample rate, or null if the information does not exist. + public int? SampleRate { get; } + + /// + /// Gets the bit per sample of the audio. + /// + /// 3 + /// The bit per sample, or null if the information does not exist. + public int? BitPerSample { get; } + + /// + /// Gets the audio stream count. + /// + /// 3 + /// The number of audio streams. + public int StreamCount { get; } + + /// + /// Gets the audio codec type. + /// + /// 3 + public string Codec { get; } + + private Lazy _description; + + public override string ToString() + { + return _description.Value; + } + } + + /// + /// Represents metadata information of a media. + /// + public class Metadata + { + internal Metadata(IntPtr handle) + { + Debug.Assert(handle != IntPtr.Zero); + + Video = VideoMetadata.From(handle); + Audio = AudioMetadata.From(handle); + + Duration = ValueConverter.ToNullableInt(GetMetadata(handle, MetadataExtractorAttr.Duration)); + Artist = GetMetadata(handle, MetadataExtractorAttr.Artist); + Title = GetMetadata(handle, MetadataExtractorAttr.Title); + Album = GetMetadata(handle, MetadataExtractorAttr.Album); + AlbumArtist = GetMetadata(handle, MetadataExtractorAttr.AlbumArtist); + Genre = GetMetadata(handle, MetadataExtractorAttr.Genre); + Author = GetMetadata(handle, MetadataExtractorAttr.Author); + Copyright = GetMetadata(handle, MetadataExtractorAttr.Copyright); + DateReleased = GetMetadata(handle, MetadataExtractorAttr.ReleaseDate); + Description = GetMetadata(handle, MetadataExtractorAttr.Description); + Comment = GetMetadata(handle, MetadataExtractorAttr.Comment); + TrackNumber = GetMetadata(handle, MetadataExtractorAttr.TrackNum); + Classification = GetMetadata(handle, MetadataExtractorAttr.Classification); + Rating = GetMetadata(handle, MetadataExtractorAttr.Rating); + Longitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Longitude)); + Latitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Latitude)); + Altitude = ValueConverter.ToNullableDouble(GetMetadata(handle, MetadataExtractorAttr.Altitude)); + Conductor = GetMetadata(handle, MetadataExtractorAttr.Conductor); + UnsyncLyrics = GetMetadata(handle, MetadataExtractorAttr.UnSyncLyrics); + SyncLyricsCount = ValueConverter.ToInt(GetMetadata(handle, MetadataExtractorAttr.SyncLyricsNum)); + DateRecorded = GetMetadata(handle, MetadataExtractorAttr.RecordingDate); + Rotation = GetMetadata(handle, MetadataExtractorAttr.Rotate); + Content360 = GetMetadata(handle, MetadataExtractorAttr.ContentFor360); + + _description = new Lazy(() => ObjectDescriptionBuilder.BuildWithProperties(this)); + } + + /// + /// Gets the duration of the media. + /// + /// 3 + /// The duration value, or null if the information does not exist. + public int? Duration { get; } + + /// + /// Gets the video metadata. + /// + /// 3 + /// The video metadata, or null if the information does not exist. + public VideoMetadata Video { get; } + + /// + /// Gets the audio metadata. + /// + /// 3 + /// The audio metadata, or null if the information does not exist. + public AudioMetadata Audio { get; } + + /// + /// Gets the artist of the media. + /// + /// 3 + /// A string representing the artist, or null if the information does not exist. + public string Artist { get; } + + /// + /// Gets the title of the media. + /// + /// 3 + /// A string representing the title, or null if the information does not exist. + public string Title { get; } + + /// + /// Gets the album name of the media. + /// + /// 3 + /// A string representing the album name, or null if the information does not exist. + public string Album { get; } + + /// + /// Gets the album artist of the media. + /// + /// 3 + /// A string representing the album artist, or null if the information does not exist. + public string AlbumArtist { get; } + + /// + /// Gets the genre of the media. + /// + /// 3 + /// A string representing the genre, or null if the information does not exist. + public string Genre { get; } + + /// + /// Gets the author of the media. + /// + /// 3 + /// A string representing the author, or null if the information does not exist. + public string Author { get; } + + /// + /// Gets the copyright of the media. + /// + /// 3 + /// A string representing the copyright, or null if the information does not exist. + public string Copyright { get; } + + /// + /// Gets the release date of the media. + /// + /// 3 + /// A string representing the release date, or null if the information does not exist. + public string DateReleased { get; } + + /// + /// Gets the description of the media. + /// + /// 3 + /// A string representing the description, or null if the information does not exist. + public string Description { get; } + + /// + /// Gets the comment of the media. + /// + /// 3 + /// A string representing the comment, or null if the information does not exist. + public string Comment { get; } + + /// + /// Gets the track number of the media. + /// + /// 3 + /// A string representing the track number, or null if the information does not exist. + public string TrackNumber { get; } + + /// + /// Gets the classification of the media. + /// + /// 3 + /// A string representing the classification, or null if the information does not exist. + public string Classification { get; } + + /// + /// Gets the rating of the media. + /// + /// 3 + /// A string representing the rating, or null if the information does not exist. + public string Rating { get; } + + /// + /// Gets the longitude of the media. + /// + /// 3 + /// The longitude value, or null if the information does not exist. + public double? Longitude { get; } + + /// + /// Gets the latitude of the media. + /// + /// 3 + /// The latitude value, or null if the information does not exist. + public double? Latitude { get; } + + /// + /// Gets the altitude of the media. + /// + /// 3 + /// The altitude value, or null if the information does not exist. + public double? Altitude { get; } + + /// + /// Gets the conductor of the media. + /// + /// 3 + /// A string representing the conductor, or null if the information does not exist. + public string Conductor { get; } + + /// + /// Gets the unsynchronized lyrics of the media. + /// + /// 3 + /// A string representing the unsynchronized lyrics, or null if the information does not exist. + public string UnsyncLyrics { get; } + + /// + /// Gets the number of synchronized lyrics of the media. + /// + /// 3 + /// The number of the synchronized lyrics. + public int SyncLyricsCount { get; } + + /// + /// Gets the recording date of the media. + /// + /// 3 + /// A string representing the recording date, or null if the information does not exist. + public string DateRecorded { get; } + + /// + /// Gets the rotate(orientation) information of the media. + /// + /// 3 + /// A string representing the rotation information, or null if the information does not exist. + public string Rotation { get; } + + /// + /// Gets the information for 360 content of the media. + /// + /// 3 + /// A string representing the information for 360 content, or null if the information does not exist. + public string Content360 { get; } + + private Lazy _description; + + public override string ToString() + { + return _description.Value; + } + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs new file mode 100755 index 0000000..bc3514c --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractor.cs @@ -0,0 +1,318 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + static internal class MetadataExtractorLog + { + internal const string Tag = "Tizen.Multimedia.MetadataExtractor"; + } + + /// + /// Provides a set of functions to get the metadata from a media file. + /// + public class MetadataExtractor : IDisposable + { + private bool _disposed = false; + private IntPtr _handle = IntPtr.Zero; + private IntPtr _buffer = IntPtr.Zero; + + private void Create(Func initFunc) + { + MetadataExtractorRetValidator.ThrowIfError( + Interop.MetadataExtractor.Create(out _handle), "Failed to create metadata"); + + try + { + MetadataExtractorRetValidator.ThrowIfError(initFunc(), "Failed to init"); + + _metadata = new Lazy(() => new Metadata(Handle)); + } + catch + { + Release(); + throw; + } + } + + /// + /// Initializes a new instance of the MetadataExtractor class with the specified path. + /// + /// 3 + /// The path for the file to extract metadata. + /// is null. + /// is not exist. + public MetadataExtractor(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + Create(() => Interop.MetadataExtractor.SetPath(_handle, path)); + } + + /// + /// Initializes a new instance of the MetadataExtractor class with the specified buffer. + /// + /// 3 + /// The buffer to extract metadata. + /// is null. + /// The length of is zero. + public MetadataExtractor(byte[] buffer) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (buffer.Length == 0) + { + throw new ArgumentException("buffer length is zero.", nameof(buffer)); + } + + _buffer = Marshal.AllocHGlobal(buffer.Length); + Marshal.Copy(buffer, 0, _buffer, buffer.Length); + + try + { + Create(() => Interop.MetadataExtractor.SetBuffer(_handle, _buffer, buffer.Length)); + } + catch (Exception) + { + Marshal.FreeHGlobal(_buffer); + throw; + } + } + + private IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(MetadataExtractor)); + } + + return _handle; + } + } + + private Lazy _metadata; + + /// + /// Retrieves the . + /// + /// 3 + /// A for the given source. + /// Internal process error is occurred. + /// The has been already disposed of. + public Metadata GetMetadata() + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(MetadataExtractor)); + } + + return _metadata.Value; + } + + /// + /// Gets the artwork image in the source. + /// + /// 3 + /// A if it exists, otherwise null. + /// Internal process error is occurred. + /// The has been already disposed of. + public Artwork GetArtwork() + { + IntPtr data = IntPtr.Zero; + IntPtr mimeType = IntPtr.Zero; + + try + { + int size = 0; + + var ret = Interop.MetadataExtractor.GetArtwork(Handle, out data, out size, out mimeType); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value"); + + if (size > 0) + { + var buf = new byte[size]; + Marshal.Copy(data, buf, 0, size); + + return new Artwork(buf, Marshal.PtrToStringAnsi(mimeType)); + } + + return null; + } + finally + { + Interop.Libc.Free(data); + Interop.Libc.Free(mimeType); + } + } + + /// + /// Gets the sync lyrics of the source. + /// + /// 3 + /// The index of lyrics to retrieve. + /// A object if is valid, otherwise null. + /// Internal process error is occurred. + /// The has been already disposed of. + public SyncLyrics GetSyncLyrics(int index) + { + IntPtr lyrics = IntPtr.Zero; + + try + { + uint timestamp = 0; + + var ret = Interop.MetadataExtractor.GetSynclyrics(Handle, index, out timestamp, out lyrics); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get sync lyrics"); + + if (lyrics == IntPtr.Zero) + { + return null; + } + + return new SyncLyrics(Marshal.PtrToStringAnsi(lyrics), timestamp); + } + finally + { + Interop.Libc.Free(lyrics); + } + } + + /// + /// Gets the frame of a video media. + /// + /// 3 + /// The raw thumbnail data in RGB888 if it exists, otherwise null. + /// Internal process error is occurred. + /// The has been already disposed of. + public byte[] GetVideoThumbnail() + { + IntPtr data = IntPtr.Zero; + + try + { + int size = 0; + + var ret = Interop.MetadataExtractor.GetFrame(Handle, out data, out size); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value"); + + if (size == 0) + { + return null; + } + + var buf = new byte[size]; + Marshal.Copy(data, buf, 0, size); + + return buf; + } + finally + { + Interop.Libc.Free(data); + } + } + + /// + /// Gets the frame of a video media. + /// + /// 3 + /// The timestamp in milliseconds. + /// true to get an accurate frame for the given timestamp, + /// otherwise false to get the nearest i-frame of the video rapidly. + /// The raw frame data in RGB888 if a frame at specified time exists, otherwise null. + /// An internal error occurs. + /// The has been already disposed of. + public byte[] GetFrameAt(uint timeStamp, bool accurate) + { + IntPtr data = IntPtr.Zero; + + try + { + int size = 0; + + var ret = Interop.MetadataExtractor.GetFrameAtTime(Handle, timeStamp, accurate, out data, out size); + MetadataExtractorRetValidator.ThrowIfError(ret, "Failed to get value"); + + if (size == 0) + { + return null; + } + + var buf = new byte[size]; + Marshal.Copy(data, buf, 0, size); + + return buf; + } + finally + { + Interop.Libc.Free(data); + } + } + + /// + /// Metadata Extractor destructor + /// + /// 3 + ~MetadataExtractor() + { + Dispose(false); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + Release(); + _disposed = true; + } + } + + private void Release() + { + if (_buffer != IntPtr.Zero) + { + Marshal.FreeHGlobal(_buffer); + } + + if (_handle != IntPtr.Zero) + { + var ret = Interop.MetadataExtractor.Destroy(_handle); + Log.Error(MetadataExtractorLog.Tag, $"DestroyHandle failed : {ret}."); + + _handle = IntPtr.Zero; + } + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs new file mode 100644 index 0000000..574e7a4 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorAttr.cs @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + internal enum MetadataExtractorAttr + { + Duration, + VideoBitrate, + VideoFps, + VideoWidth, + VideoHeight, + VideoStreamCount, + AudioBitrate, + AudioChannels, + AudioSamplerate, + AudioBitPerSample, + AudioStreamCount, + Artist, + Title, + Album, + AlbumArtist, + Genre, + Author, + Copyright, + ReleaseDate, + Description, + Comment, + TrackNum, + Classification, + Rating, + Longitude, + Latitude, + Altitude, + Conductor, + UnSyncLyrics, + SyncLyricsNum, + RecordingDate, + Rotate, + VideoCodec, + AudioCodec, + ContentFor360, + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs new file mode 100644 index 0000000..36d40a2 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/MetadataExtractorError.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for metadata extractor's error codes. + /// + internal enum MetadataExtractorError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + FileExists = ErrorCode.FileExists, + PermissionDenied = ErrorCode.PermissionDenied, + TizenMetadataExtractorError = -0x01930000, + OperationFailed = TizenMetadataExtractorError | 0x01 // Invalid operation + }; + + internal static class MetadataExtractorRetValidator + { + internal static void ThrowIfError(MetadataExtractorError error, string errorMessage) + { + switch (error) + { + case MetadataExtractorError.InvalidParameter: + throw new ArgumentException(errorMessage); + + case MetadataExtractorError.FileExists: + throw new FileNotFoundException(errorMessage); + + case MetadataExtractorError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + + case MetadataExtractorError.OutOfMemory: + throw new OutOfMemoryException(); + + case MetadataExtractorError.OperationFailed: + throw new InvalidOperationException(errorMessage); + } + } + } +} + diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs new file mode 100755 index 0000000..3081964 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/SyncLyrics.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents synchronized lyrics information of media. + /// + public class SyncLyrics + { + /// + /// Initialize a new instance of the MetadataExtractor class with the specified lyrics and timestamp. + /// + /// 3 + /// The text of synchronized lyrics. + /// The timestamp of synchronized lyrics. + public SyncLyrics(string lyrics, uint timestamp) + { + Lyrics = lyrics; + Timestamp = timestamp; + } + + /// + /// Gets the text representation of the lyrics. + /// + /// 3 + public string Lyrics { get; } + + /// + /// Gets the time information of the lyrics. + /// + /// 3 + public uint Timestamp { get; } + } +} diff --git a/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs b/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs new file mode 100644 index 0000000..aa6571e --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/MetadataExtractor/ValueConverter.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using static Interop.MetadataExtractor; + +namespace Tizen.Multimedia +{ + internal static class ValueConverter + { + internal static int? ToNullableInt(string str) + { + if (int.TryParse(str, out var value)) + { + return value; + } + return null; + } + + internal static int ToInt(string str) + { + return int.TryParse(str, out var value) ? value : 0; + } + + internal static double? ToNullableDouble(string str) + { + if (double.TryParse(str, out var value)) + { + return value; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs b/src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs new file mode 100644 index 0000000..96f1f68 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/ObjectDescriptionBuilder.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Reflection; +using System.Text; + +namespace Tizen.Multimedia +{ + /// + /// Represents a point in 2D space. + /// + internal static class ObjectDescriptionBuilder + { + internal static string BuildWithProperties(object obj) + { + StringBuilder sb = new StringBuilder(); + + foreach (var property in obj.GetType().GetRuntimeProperties()) + { + object value = property.GetValue(obj); + + sb.Append(property.Name).Append("="); + + bool isObjectType = Convert.GetTypeCode(value) == TypeCode.Object; + + if (isObjectType) + { + sb.Append("[").Append(value).Append("]"); + } + else + { + sb.Append(value); + } + + sb.Append(", "); + } + if (sb.Length >= 2) + { + sb.Remove(sb.Length - 1, 2); + } + + return sb.ToString(); + } + } +} diff --git a/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.sln b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.sln new file mode 100755 index 0000000..a2cc3dd --- /dev/null +++ b/src/Tizen.Multimedia.Metadata/Tizen.Multimedia.Metadata.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Metadata", "Tizen.Multimedia.Metadata.csproj", "{72F6EF8A-4D43-47E9-909D-B2317F83E636}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{41D45A2A-3EC3-4032-9CA5-B8320C1387EB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{6B32A210-8A28-4DF9-8C9C-01B836F5C2C9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{C409F1B4-D26C-43C7-AFB2-683D446F48F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {72F6EF8A-4D43-47E9-909D-B2317F83E636}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72F6EF8A-4D43-47E9-909D-B2317F83E636}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72F6EF8A-4D43-47E9-909D-B2317F83E636}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72F6EF8A-4D43-47E9-909D-B2317F83E636}.Release|Any CPU.Build.0 = Release|Any CPU + {41D45A2A-3EC3-4032-9CA5-B8320C1387EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41D45A2A-3EC3-4032-9CA5-B8320C1387EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41D45A2A-3EC3-4032-9CA5-B8320C1387EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {41D45A2A-3EC3-4032-9CA5-B8320C1387EB}.Release|Any CPU.Build.0 = Release|Any CPU + {6B32A210-8A28-4DF9-8C9C-01B836F5C2C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B32A210-8A28-4DF9-8C9C-01B836F5C2C9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B32A210-8A28-4DF9-8C9C-01B836F5C2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B32A210-8A28-4DF9-8C9C-01B836F5C2C9}.Release|Any CPU.Build.0 = Release|Any CPU + {C409F1B4-D26C-43C7-AFB2-683D446F48F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C409F1B4-D26C-43C7-AFB2-683D446F48F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C409F1B4-D26C-43C7-AFB2-683D446F48F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C409F1B4-D26C-43C7-AFB2-683D446F48F8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f237099 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Interop/Interop.Libraries.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class Libraries + { + public const string Radio = "libcapi-media-radio.so.0"; + } + } +} diff --git a/src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs b/src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs new file mode 100644 index 0000000..929324b --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Interop/Interop.Radio.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static class Radio + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SeekCompletedCallback(int frequency, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ScanUpdatedCallback(int frequency, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ScanStoppedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ScanCompletedCallback(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptedCallback(RadioInterruptedReason reason, IntPtr userData); + + + [DllImport(Libraries.Radio, EntryPoint = "radio_create")] + internal static extern RadioError Create(out RadioHandle radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_destroy")] + internal static extern RadioError Destroy(IntPtr radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_state")] + internal static extern RadioError GetState(RadioHandle radio, out RadioState state); + + [DllImport(Libraries.Radio, EntryPoint = "radio_start")] + internal static extern RadioError Start(RadioHandle radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_stop")] + internal static extern RadioError Stop(RadioHandle radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_seek_up")] + internal static extern RadioError SeekUp(RadioHandle radio, SeekCompletedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_seek_down")] + internal static extern RadioError SeekDown(RadioHandle radio, SeekCompletedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_set_frequency")] + internal static extern RadioError SetFrequency(RadioHandle radio, int frequency); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_frequency")] + internal static extern RadioError GetFrequency(RadioHandle radio, out int frequency); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_signal_strength")] + internal static extern RadioError GetSignalStrength(RadioHandle radio, out int strength); + + [DllImport(Libraries.Radio, EntryPoint = "radio_scan_start")] + internal static extern RadioError ScanStart(RadioHandle radio, ScanUpdatedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_scan_stop")] + internal static extern RadioError ScanStop(RadioHandle radio, ScanStoppedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_set_mute")] + internal static extern RadioError SetMute(RadioHandle radio, bool muted); + + [DllImport(Libraries.Radio, EntryPoint = "radio_is_muted")] + internal static extern RadioError GetMuted(RadioHandle radio, out bool muted); + + [DllImport(Libraries.Radio, EntryPoint = "radio_set_scan_completed_cb")] + internal static extern RadioError SetScanCompletedCb(RadioHandle radio, + ScanCompletedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_unset_scan_completed_cb")] + internal static extern RadioError UnsetScanCompletedCb(RadioHandle radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_set_interrupted_cb")] + internal static extern RadioError SetInterruptedCb(RadioHandle radio, + InterruptedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.Radio, EntryPoint = "radio_unset_interrupted_cb")] + internal static extern RadioError UnsetInterruptedCb(RadioHandle radio); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_frequency_range")] + internal static extern RadioError GetFrequencyRange(RadioHandle radio, out int minFreq, out int maxFreq); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_channel_spacing")] + internal static extern RadioError GetChannelSpacing(RadioHandle radio, out int channelSpacing); + + [DllImport(Libraries.Radio, EntryPoint = "radio_set_volume")] + internal static extern RadioError SetVolume(RadioHandle radio, float volume); + + [DllImport(Libraries.Radio, EntryPoint = "radio_get_volume")] + internal static extern RadioError GetVolume(RadioHandle radio, out float volume); + } + + internal class RadioHandle : SafeHandle + { + protected RadioHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var ret = Radio.Destroy(handle); + if (ret != RadioError.None) + { + Log.Debug(GetType().FullName, $"Failed to release native handle."); + return false; + } + + return true; + } + } + } +} diff --git a/src/Tizen.Multimedia.Radio/Radio/Radio.cs b/src/Tizen.Multimedia.Radio/Radio/Radio.cs new file mode 100644 index 0000000..521eb50 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/Radio.cs @@ -0,0 +1,391 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.Threading.Tasks; +using Tizen.System; +using static Tizen.Multimedia.Interop.Radio; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means for using the radio feature. + /// + public class Radio : IDisposable + { + private Interop.RadioHandle _handle; + + private const string FeatureFmRadio = "http://tizen.org/feature/fmradio"; + + /// + /// Initialize a new instance of the Radio class. + /// + /// Radio feature is not supported + public Radio() + { + ValidateFeatureSupported(FeatureFmRadio); + + Create(out _handle); + + try + { + SetScanCompletedCb(_handle, ScanCompleteCallback).ThrowIfFailed("Failed to initialize radio"); + SetInterruptedCb(_handle, InterruptedCallback).ThrowIfFailed("Failed to initialize radio"); + } + catch (Exception) + { + _handle.Dispose(); + throw; + } + } + + private Interop.RadioHandle Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + return _handle; + } + } + + /// + /// Occurs when radio scan information is updated. + /// + public event EventHandler ScanUpdated; + + /// + /// Occurs when radio scanning stops. + /// + public event EventHandler ScanStopped; + + /// + /// Occurs when radio scan is completed. + /// + public event EventHandler ScanCompleted; + + /// + /// Occurs when radio is interrupted + /// + public event EventHandler Interrupted; + + /// + /// Gets the current state of the radio. + /// + public RadioState State + { + get + { + RadioState state; + GetState(Handle, out state); + return state; + } + } + + /// + /// Gets or sets the radio frequency, in [87500 ~ 108000] (kHz). + /// + /// + /// is less than of .\n + /// - or - \n + /// is greater than of .\n + /// + public int Frequency + { + get + { + int value = 0; + GetFrequency(Handle, out value).ThrowIfFailed("Failed to get frequency"); + return value; + } + set + { + if (value < FrequencyRange.Min || value > FrequencyRange.Max) + { + throw new ArgumentOutOfRangeException(nameof(Frequency), value, "Frequency must be within FrequencyRange."); + } + + SetFrequency(Handle, value).ThrowIfFailed("Failed to set frequency"); + } + } + + /// + /// Gets the current signal strength, in [-128 ~ 128] (dBm). + /// + public int SignalStrength + { + get + { + int value = 0; + GetSignalStrength(Handle, out value).ThrowIfFailed("Failed to get signal strength"); + return value; + } + } + + /// + /// Gets the value indicating if radio is muted. + /// + /// + /// true if the radio is muted; otherwise, false. + /// The default is false. + /// + public bool IsMuted + { + get + { + bool value; + GetMuted(Handle, out value).ThrowIfFailed("Failed to get the mute state"); + return value; + } + set + { + SetMute(Handle, value).ThrowIfFailed("Failed to set the mute state"); + } + } + + /// + /// Gets the channel spacing for current region. + /// + public int ChannelSpacing + { + get + { + int value; + GetChannelSpacing(Handle, out value).ThrowIfFailed("Failed to get channel spacing"); + return value; + } + } + + /// + /// Gets or sets the radio volume level. + /// + /// Valid volume range is from 0 to 1.0(100%), inclusive. + /// The default is 1.0. + /// + /// is less than zero.\n + /// - or -\n + /// is greater than 1.0. + /// + public float Volume + { + get + { + float value; + GetVolume(Handle, out value).ThrowIfFailed("Failed to get volume level."); + return value; + } + set + { + if (value < 0F || 1.0F < value) + { + throw new ArgumentOutOfRangeException(nameof(value), value, + $"Valid volume range is 0 <= value <= 1.0, but got { value }."); + } + + SetVolume(Handle, value).ThrowIfFailed("Failed to set volume level"); + } + } + + /// + /// Gets the frequency for the region, in [87500 ~ 108000] (kHz). + /// + public Range FrequencyRange + { + get + { + int min, max; + + GetFrequencyRange(Handle, out min, out max).ThrowIfFailed("Failed to get frequency range"); + + return new Range(min, max); + } + } + + /// + /// Starts the radio. + /// + /// The radio must be in the state. + /// The radio is not in the valid state. + public void Start() + { + ValidateRadioState(RadioState.Ready); + + Interop.Radio.Start(Handle).ThrowIfFailed("Failed to start radio"); + } + + /// + /// Stops the radio. + /// + /// The radio must be in the state. + /// The radio is not in the valid state. + public void Stop() + { + ValidateRadioState(RadioState.Playing); + + Interop.Radio.Stop(Handle).ThrowIfFailed("Failed to stop radio"); + } + + /// + /// Starts radio scan, will trigger ScanInformationUpdated event, when scan information is updated + /// + /// The radio must be in the or state. + /// The radio is not in the valid state. + /// + /// + public void StartScan() + { + ValidateRadioState(RadioState.Ready, RadioState.Playing); + + ScanStart(Handle, ScanUpdatedCallback); + } + + /// + /// Stops radio scan. + /// + /// The radio must be in the state. + /// The radio is not in the valid state. + /// + public void StopScan() + { + ValidateRadioState(RadioState.Scanning); + + ScanStop(Handle, ScanStoppedCallback); + } + + /// + /// Seeks up the effective frequency of the radio. + /// + /// + /// A task that represents the asynchronous seeking operation. + /// The result value is the current frequency, in range [87500 ~ 108000] (kHz). + /// It can be -1 if the seeking operation has failed. + /// + /// The radio must be in the state. + /// The radio is not in the valid state. + public async Task SeekUpAsync() + { + ValidateRadioState(RadioState.Playing); + + TaskCompletionSource tcs = new TaskCompletionSource(); + SeekCompletedCallback callback = (currentFrequency, _) => + { + tcs.TrySetResult(currentFrequency); + }; + + SeekUp(Handle, callback); + return await tcs.Task; + } + + /// + /// Seeks down the effective frequency of the radio. + /// + /// + /// A task that represents the asynchronous seeking operation. + /// The result value is the current frequency, in range [87500 ~ 108000] (kHz). + /// It can be -1 if the seeking operation has failed. + /// + /// The radio must be in the state. + /// The radio is not in the valid state. + public async Task SeekDownAsync() + { + ValidateRadioState(RadioState.Playing); + + TaskCompletionSource tcs = new TaskCompletionSource(); + SeekCompletedCallback callback = (currentFrequency, _) => + { + tcs.TrySetResult(currentFrequency); + }; + + SeekDown(Handle, callback); + return await tcs.Task; + } + + private void ValidateFeatureSupported(string featurePath) + { + bool supported = false; + SystemInfo.TryGetValue(featurePath, out supported); + + if (supported == false) + { + throw new NotSupportedException($"The feature({featurePath}) is not supported."); + } + + } + + private void ScanUpdatedCallback(int frequency, IntPtr data) + { + ScanUpdated?.Invoke(this, new ScanUpdatedEventArgs(frequency)); + } + + private void ScanStoppedCallback(IntPtr data) + { + ScanStopped?.Invoke(this, EventArgs.Empty); + } + + private void ScanCompleteCallback(IntPtr data) + { + ScanCompleted?.Invoke(this, EventArgs.Empty); + } + + private void InterruptedCallback(RadioInterruptedReason reason, IntPtr data) + { + Interrupted?.Invoke(this, new RadioInterruptedEventArgs(reason)); + } + + private void ValidateRadioState(params RadioState[] required) + { + RadioState curState = State; + + if (required.Contains(curState) == false) + { + throw new InvalidOperationException($"{curState} is not valid state."); + } + } + + #region IDisposable Support + private bool _disposed = false; + + /// + /// Releases the resources used by the Radio. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != null) + { + _handle.Dispose(); + } + _disposed = true; + } + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + } +} diff --git a/src/Tizen.Multimedia.Radio/Radio/RadioError.cs b/src/Tizen.Multimedia.Radio/Radio/RadioError.cs new file mode 100644 index 0000000..631d9c7 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/RadioError.cs @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + + internal enum RadioError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + + InvalidState = -0x019A0000 | 0x01, + SoundPolicy = -0x019A0000 | 0x02, + NoAntenna = -0x019A0000 | 0x03, + } + + internal static class RadioErrorExtensions + { + internal static void ThrowIfFailed(this RadioError err, string message) + { + if (err == RadioError.None) + { + return; + } + + string errMessage = $"{message}; {err}."; + switch (err) + { + case RadioError.PermissionDenied: + throw new UnauthorizedAccessException(errMessage); + + case RadioError.InvalidParameter: + throw new ArgumentException(errMessage); + + case RadioError.OutOfMemory: + throw new OutOfMemoryException(errMessage); + + case RadioError.NotSupported: + case RadioError.NoAntenna: + throw new NotSupportedException(errMessage); + + default: + throw new InvalidOperationException(errMessage); + } + } + + } + +} diff --git a/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs new file mode 100644 index 0000000..84e4340 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class RadioInterruptedEventArgs : EventArgs + { + internal RadioInterruptedEventArgs(RadioInterruptedReason reason) + { + Reason = reason; + } + + /// + /// Gets the reason. + /// + /// The reason for interruption. + public RadioInterruptedReason Reason { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => $"Reason={ Reason.ToString() }"; + } +} diff --git a/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs new file mode 100644 index 0000000..d6cb24c --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/RadioInterruptedReason.cs @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies interrupted reasons. + /// + public enum RadioInterruptedReason + { + /// + /// By a resource conflict. + /// + ResourceConflict = 4, + } +} diff --git a/src/Tizen.Multimedia.Radio/Radio/RadioState.cs b/src/Tizen.Multimedia.Radio/Radio/RadioState.cs new file mode 100644 index 0000000..38db7f0 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/RadioState.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies states of the . + /// + public enum RadioState + { + /// + /// Ready to play or scan. + /// + Ready, + /// + /// Playing audio from the tuner. + /// + Playing, + /// + /// Scanning; searching for the next station for signal. + /// + Scanning, + } +} diff --git a/src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs b/src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs new file mode 100644 index 0000000..174f670 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Radio/ScanUpdatedEventArgs.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class ScanUpdatedEventArgs : EventArgs + { + internal ScanUpdatedEventArgs(int tunedFrequency) + { + Frequency = tunedFrequency; + } + + /// + /// Gets the tuned radio frequency that is scanned, in range [87500 ~ 108000] (kHz). + /// + public int Frequency { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() + { + return $"Frequency={ Frequency.ToString() }"; + } + } +} diff --git a/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj new file mode 100644 index 0000000..728acb9 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.sln b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.sln new file mode 100755 index 0000000..2a11582 --- /dev/null +++ b/src/Tizen.Multimedia.Radio/Tizen.Multimedia.Radio.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Radio", "Tizen.Multimedia.Radio.csproj", "{2F4014F0-B4F3-405F-A270-CB9ED958A109}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{901E1981-A92B-4993-8FA3-CDA2023E0851}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F1FEC17C-EB01-46D1-B3E8-D01941552256}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{D2D974E3-AB9F-41C2-AE79-EF83338CA753}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{E7063DA3-0D13-430E-B401-FE56AB126B3E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{75DA9762-1230-4492-A171-698FE2654767}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2F4014F0-B4F3-405F-A270-CB9ED958A109}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F4014F0-B4F3-405F-A270-CB9ED958A109}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F4014F0-B4F3-405F-A270-CB9ED958A109}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F4014F0-B4F3-405F-A270-CB9ED958A109}.Release|Any CPU.Build.0 = Release|Any CPU + {901E1981-A92B-4993-8FA3-CDA2023E0851}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {901E1981-A92B-4993-8FA3-CDA2023E0851}.Debug|Any CPU.Build.0 = Debug|Any CPU + {901E1981-A92B-4993-8FA3-CDA2023E0851}.Release|Any CPU.ActiveCfg = Release|Any CPU + {901E1981-A92B-4993-8FA3-CDA2023E0851}.Release|Any CPU.Build.0 = Release|Any CPU + {F1FEC17C-EB01-46D1-B3E8-D01941552256}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1FEC17C-EB01-46D1-B3E8-D01941552256}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1FEC17C-EB01-46D1-B3E8-D01941552256}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1FEC17C-EB01-46D1-B3E8-D01941552256}.Release|Any CPU.Build.0 = Release|Any CPU + {D2D974E3-AB9F-41C2-AE79-EF83338CA753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D2D974E3-AB9F-41C2-AE79-EF83338CA753}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D2D974E3-AB9F-41C2-AE79-EF83338CA753}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D2D974E3-AB9F-41C2-AE79-EF83338CA753}.Release|Any CPU.Build.0 = Release|Any CPU + {E7063DA3-0D13-430E-B401-FE56AB126B3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E7063DA3-0D13-430E-B401-FE56AB126B3E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E7063DA3-0D13-430E-B401-FE56AB126B3E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E7063DA3-0D13-430E-B401-FE56AB126B3E}.Release|Any CPU.Build.0 = Release|Any CPU + {75DA9762-1230-4492-A171-698FE2654767}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75DA9762-1230-4492-A171-698FE2654767}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75DA9762-1230-4492-A171-698FE2654767}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75DA9762-1230-4492-A171-698FE2654767}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..02fd9df --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Recorder = "libcapi-media-recorder.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs new file mode 100644 index 0000000..b2f7ab8 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.Recorder.cs @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class Recorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecorderErrorCallback(RecorderErrorCode error, RecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void InterruptedCallback(RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingLimitReachedCallback(RecordingLimitType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingProgressCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AudioStreamCallback(IntPtr stream, int size, AudioSampleType type, int channel, uint timeStamp, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StatechangedCallback(RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MuxedStreamCallback(IntPtr stream, int size, ulong offset, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_audiorecorder")] + internal static extern RecorderError Create(out IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_create_videorecorder")] + internal static extern RecorderError CreateVideo(IntPtr cameraHandle, out IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_destroy")] + internal static extern RecorderError Destroy(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_prepare")] + internal static extern RecorderError Prepare(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unprepare")] + internal static extern RecorderError Unprepare(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_start")] + internal static extern RecorderError Start(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_pause")] + internal static extern RecorderError Pause(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_commit")] + internal static extern RecorderError Commit(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_cancel")] + internal static extern RecorderError Cancel(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_state")] + internal static extern RecorderError GetState(IntPtr handle, out RecorderState state); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_sound_stream_info")] + internal static extern RecorderError SetAudioStreamPolicy(IntPtr handle, IntPtr streamInfoHandle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_error_cb")] + internal static extern RecorderError SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_error_cb")] + internal static extern RecorderError UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_interrupted_cb")] + internal static extern RecorderError SetInterruptedCallback(IntPtr handle, InterruptedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_interrupted_cb")] + internal static extern RecorderError UnsetInterruptedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_state_changed_cb")] + internal static extern RecorderError SetStateChangedCallback(IntPtr handle, StatechangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_state_changed_cb")] + internal static extern RecorderError UnsetStateChangedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_status_cb")] + internal static extern RecorderError SetRecordingProgressCallback(IntPtr handle, RecordingProgressCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_status_cb")] + internal static extern RecorderError UnsetRecordingProgressCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_stream_cb")] + internal static extern RecorderError SetAudioStreamCallback(IntPtr handle, AudioStreamCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_audio_stream_cb")] + internal static extern RecorderError UnsetAudioStreamCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_recording_limit_reached_cb")] + internal static extern RecorderError SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_recording_limit_reached_cb")] + internal static extern RecorderError UnsetLimitReachedCallback(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_muxed_stream_cb")] + internal static extern RecorderError SetMuxedStreamCallback(IntPtr handle, MuxedStreamCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_unset_muxed_stream_cb")] + internal static extern RecorderError UnsetMuxedStreamCallback(IntPtr handle); + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs new file mode 100644 index 0000000..77d1ec3 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderFeatures.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class RecorderFeatures + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FileFormatCallback(RecorderFileFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AudioEncoderCallback(RecorderAudioCodec codec, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoEncoderCallback(RecorderVideoCodec codec, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_file_format")] + internal static extern RecorderError FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_audio_encoder")] + internal static extern RecorderError AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_encoder")] + internal static extern RecorderError VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_foreach_supported_video_resolution")] + internal static extern RecorderError VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs new file mode 100644 index 0000000..ce0521b --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Interop/Interop.RecorderSettings.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class RecorderSettings + { + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_channel")] + internal static extern RecorderError GetAudioChannel(IntPtr handle, out int channelCount); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_channel")] + internal static extern RecorderError SetAudioChannel(IntPtr handle, int channelCount); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_device")] + internal static extern RecorderError GetAudioDevice(IntPtr handle, out RecorderAudioDevice device); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_device")] + internal static extern RecorderError SetAudioDevice(IntPtr handle, RecorderAudioDevice device); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_level")] + internal static extern RecorderError GetAudioLevel(IntPtr handle, out double dB); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_samplerate")] + internal static extern RecorderError GetAudioSampleRate(IntPtr handle, out int sampleRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_samplerate")] + internal static extern RecorderError SetAudioSampleRate(IntPtr handle, int sampleRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_audio_encoder_bitrate")] + internal static extern RecorderError GetAudioEncoderBitrate(IntPtr handle, out int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_audio_encoder_bitrate")] + internal static extern RecorderError SetAudioEncoderBitrate(IntPtr handle, int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_video_encoder_bitrate")] + internal static extern RecorderError GetVideoEncoderBitrate(IntPtr handle, out int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_video_encoder_bitrate")] + internal static extern RecorderError SetVideoEncoderBitrate(IntPtr handle, int bitRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_audio_encoder")] + internal static extern RecorderError GetAudioEncoder(IntPtr handle, out RecorderAudioCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_audio_encoder")] + internal static extern RecorderError SetAudioEncoder(IntPtr handle, RecorderAudioCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_encoder")] + internal static extern RecorderError GetVideoEncoder(IntPtr handle, out RecorderVideoCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_encoder")] + internal static extern RecorderError SetVideoEncoder(IntPtr handle, RecorderVideoCodec codec); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_file_format")] + internal static extern RecorderError GetFileFormat(IntPtr handle, out RecorderFileFormat format); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_file_format")] + internal static extern RecorderError SetFileFormat(IntPtr handle, RecorderFileFormat format); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_filename")] + internal static extern RecorderError GetFileName(IntPtr handle, out IntPtr path); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_filename")] + internal static extern RecorderError SetFileName(IntPtr handle, string path); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_size_limit")] + internal static extern RecorderError GetSizeLimit(IntPtr handle, out int kbyte); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_size_limit")] + internal static extern RecorderError SetSizeLimit(IntPtr handle, int kbyte); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_time_limit")] + internal static extern RecorderError GetTimeLimit(IntPtr handle, out int second); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_time_limit")] + internal static extern RecorderError SetTimeLimit(IntPtr handle, int second); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_is_muted")] + [return: MarshalAs(UnmanagedType.I1)] + internal static extern bool GetMute(IntPtr handle); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_mute")] + internal static extern RecorderError SetMute(IntPtr handle, bool enable); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_recording_motion_rate")] + internal static extern RecorderError GetMotionRate(IntPtr handle, out double motionRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_recording_motion_rate")] + internal static extern RecorderError SetMotionRate(IntPtr handle, double motionRate); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_get_orientation_tag")] + internal static extern RecorderError GetOrientationTag(IntPtr handle, out Rotation orientation); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_attr_set_orientation_tag")] + internal static extern RecorderError SetOrientationTag(IntPtr handle, Rotation orientation); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_get_video_resolution")] + internal static extern RecorderError GetVideoResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.Recorder, EntryPoint = "recorder_set_video_resolution")] + internal static extern RecorderError SetVideoResolution(IntPtr handle, int width, int height); + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs new file mode 100755 index 0000000..f774918 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/AudioStreamDeliveredEventArgs.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class containing details of audio stream. + /// + public class AudioStreamDeliveredEventArgs : EventArgs + { + internal AudioStreamDeliveredEventArgs(IntPtr stream, int streamSize, AudioSampleType type, int channel, uint recordingTime) + { + Stream = new byte[streamSize]; + Marshal.Copy(stream, Stream, 0, streamSize); + StreamLength = streamSize; + Type = type; + Channel = channel; + RecordingTime = recordingTime; + } + + /// + /// The audio stream data. + /// + /// 3 + public byte[] Stream { get; } + + /// + /// The length of audio stream data. + /// + /// 3 + public int StreamLength { get; } + + /// + /// The audio format type. + /// + /// 3 + public AudioSampleType Type { get; } + + /// + /// The number of channels. + /// + /// 3 + public int Channel { get; } + + /// + /// The recording time of the stream buffer in milliseconds. + /// + /// 3 + public uint RecordingTime { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs new file mode 100755 index 0000000..7c6ea85 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/MuxedStreamEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class containing details of muxed stream(Audio + Video). + /// + public class MuxedStreamDeliveredEventArgs : EventArgs + { + internal MuxedStreamDeliveredEventArgs(IntPtr stream, int streamLength, ulong offset) + { + Stream = new byte[streamLength]; + Marshal.Copy(stream, Stream, 0, streamLength); + StreamLength = streamLength; + Offset = offset; + } + + /// + /// The muexed stream data. + /// + /// 3 + public byte[] Stream { get; } + + /// + /// The length of muxed stream data. + /// + /// 3 + public int StreamLength { get; } + + /// + /// The offset of the stream data. + /// + /// 3 + public ulong Offset { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs b/src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs new file mode 100755 index 0000000..701981c --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/Recorder.cs @@ -0,0 +1,482 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Linq; +using Native = Interop.Recorder; + +namespace Tizen.Multimedia +{ + static internal class RecorderLog + { + internal const string Tag = "Tizen.Multimedia.Recorder"; + } + + /// + /// The recorder class provides methods to create audio/video recorder, + /// to start, stop and save the recorded content. It also provides methods + /// to get/set various attributes and capabilities of recorder. + /// + public class Recorder : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + private RecorderState _state = RecorderState.None; + + /// + /// Audio recorder constructor. + /// + public Recorder() + { + RecorderErrorFactory.ThrowIfError(Native.Create(out _handle), + "Failed to create Audio recorder"); + + Feature = new RecorderFeatures(this); + Setting = new RecorderSettings(this); + + RegisterCallbacks(); + + SetState(RecorderState.Created); + } + + /// + /// Video recorder constructor. + /// + /// + /// The camera object. + /// + public Recorder(Camera camera) + { + RecorderErrorFactory.ThrowIfError(Native.CreateVideo(camera.Handle, out _handle), + "Failed to create Video recorder."); + + Feature = new RecorderFeatures(this); + Setting = new RecorderSettings(this); + + RegisterCallbacks(); + + SetState(RecorderState.Created); + } + + /// + /// Recorder destructor. + /// + ~Recorder() + { + Dispose (false); + } + + internal IntPtr GetHandle() + { + ValidateNotDisposed(); + return _handle; + } + + #region Dispose support + /// + /// Releases the unmanaged resources used by the Recorder. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + if (_handle != IntPtr.Zero) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + } + + /// + /// Releases all resources used by the Recorder. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal void ValidateNotDisposed() + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(Recorder)); + } + } + #endregion Dispose support + + #region Check recorder state + internal void ValidateState(params RecorderState[] required) + { + ValidateNotDisposed(); + + Debug.Assert(required.Length > 0); + + var curState = _state; + if (!required.Contains(curState)) + { + throw new InvalidOperationException($"The recorder is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", required) }."); + } + } + + internal void SetState(RecorderState state) + { + _state = state; + } + #endregion Check recorder state + + #region EventHandlers + /// + /// Event that occurs when an error occurs during recorder operation. + /// + /// 3 + public event EventHandler ErrorOccurred; + private Native.RecorderErrorCallback _errorOccuredCallback; + + /// + /// Event that occurs when recorder is interrupted. + /// + /// 3 + public event EventHandler Interrupted; + private Native.InterruptedCallback _interruptedCallback; + + /// + /// This event occurs when recorder state is changed. + /// + /// 3 + public event EventHandler StateChanged; + private Native.StatechangedCallback _stateChangedCallback; + + /// + /// Event that occurs when recording information changes. + /// + /// 3 + public event EventHandler RecordingProgress; + private Native.RecordingProgressCallback _recordingProgressCallback; + + /// + /// Event that occurs when audio stream data is being delivered. + /// + /// 3 + public event EventHandler AudioStreamDelivered; + private Native.AudioStreamCallback _audioStreamCallback; + + /// + /// Event that occurs when recording limit is reached. + /// + /// 3 + public event EventHandler RecordingLimitReached; + private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; + + /// + /// Event that occurs when muxed stream data is being delivered. + /// + /// 3 + public event EventHandler MuxedStreamDelivered; + private Native.MuxedStreamCallback _muxedStreamCallback; + #endregion EventHandlers + + #region Properties + /// + /// Gets the various recorder features. + /// + /// 3 + public RecorderFeatures Feature { get; } + + /// + /// Get/Set the various recorder settings. + /// + /// 3 + public RecorderSettings Setting { get; } + + /// + /// The current state of the recorder. + /// + /// 3 + /// A that specifies the state of recorder. + /// The camera already has been disposed. + public RecorderState State + { + get + { + ValidateNotDisposed(); + + RecorderState val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetState(_handle, out val), + "Failed to get recorder state."); + + return val; + } + } + #endregion Properties + + #region Methods + /// + /// Prepare the media recorder for recording. + /// The recorder must be in the state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// + /// Before calling the function, it is required to set AudioEncoder, + /// videoencoder and fileformat properties of recorder. + /// + /// In case of any invalid operations. + /// The camera already has been disposed. + public void Prepare() + { + ValidateState(RecorderState.Created); + + RecorderErrorFactory.ThrowIfError(Native.Prepare(_handle), + "Failed to prepare media recorder for recording"); + + SetState(RecorderState.Ready); + } + + /// + /// Resets the media recorder. + /// The recorder must be in the state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// In case of any invalid operations. + /// The camera already has been disposed. + public void Unprepare() + { + ValidateState(RecorderState.Ready); + + RecorderErrorFactory.ThrowIfError(Native.Unprepare(_handle), + "Failed to reset the media recorder"); + + SetState(RecorderState.Created); + } + + /// + /// Starts the recording. + /// The recorder must be in the state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// + /// If file path has been set to an existing file, this file is removed automatically and updated by new one. + /// In the video recorder, some preview format does not support record mode. It will return InvalidOperation error. + /// You should use default preview format or CameraPixelFormatNv12 in the record mode. + /// The filename should be set before this function is invoked. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// In case of any invalid operations. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void Start() + { + ValidateState(RecorderState.Ready, RecorderState.Paused); + + RecorderErrorFactory.ThrowIfError(Native.Start(_handle), + "Failed to start the media recorder"); + + SetState(RecorderState.Recording); + } + + /// + /// Pause the recording. + /// The recorder must be in the state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// + /// Recording can be resumed with Start(). + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// In case of any invalid operations. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void Pause() + { + ValidateState(RecorderState.Recording); + + RecorderErrorFactory.ThrowIfError(Native.Pause(_handle), + "Failed to pause the media recorder"); + + SetState(RecorderState.Paused); + } + + /// + /// Stops recording and saves the result. + /// The recorder must be in the or state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// In case of any invalid operations. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void Commit() + { + ValidateState(RecorderState.Recording, RecorderState.Paused); + + RecorderErrorFactory.ThrowIfError(Native.Commit(_handle), + "Failed to save the recorded content"); + + SetState(RecorderState.Ready); + } + + /// + /// Cancels the recording. + /// The recording data is discarded and not written in the recording file. + /// The recorder must be in the or state. + /// After this method is finished without any exception, + /// The state of recorder will be changed to state. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// In case of any invalid operations. + /// The camera already has been disposed. + /// In case of access to the resources cannot be granted. + public void Cancel() + { + ValidateState(RecorderState.Recording, RecorderState.Paused); + + RecorderErrorFactory.ThrowIfError(Native.Cancel(_handle), + "Failed to cancel the recording"); + + SetState(RecorderState.Ready); + } + + /// + /// Sets the audio stream policy. + /// + /// 3 + /// Policy. + /// The camera already has been disposed. + public void SetAudioStreamPolicy(AudioStreamPolicy policy) + { + ValidateNotDisposed(); + + RecorderErrorFactory.ThrowIfError(Native.SetAudioStreamPolicy(_handle, policy.Handle), + "Failed to set audio stream policy"); + } + #endregion Methods + + #region Callback registrations + private void RegisterCallbacks() + { + RegisterErrorCallback(); + RegisterInterruptedCallback(); + RegisterStateChangedCallback(); + RegisterRecordingProgressCallback(); + RegisterAudioStreamDeliveredCallback(); + RegisterRecordingLimitReachedEvent(); + RegisterMuxedStreamEvent(); + } + + private void RegisterErrorCallback() + { + _errorOccuredCallback = (RecorderErrorCode error, RecorderState current, IntPtr userData) => + { + ErrorOccurred?.Invoke(this, new RecordingErrorOccurredEventArgs(error, current)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetErrorCallback(_handle, _errorOccuredCallback, IntPtr.Zero), + "Setting Error callback failed"); + } + + private void RegisterInterruptedCallback() + { + _interruptedCallback = (RecorderPolicy policy, RecorderState previous, RecorderState current, IntPtr userData) => + { + Interrupted?.Invoke(this, new RecorderInterruptedEventArgs(policy, previous, current)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetInterruptedCallback(_handle, _interruptedCallback, IntPtr.Zero), + "Setting Interrupted callback failed"); + } + + private void RegisterStateChangedCallback() + { + _stateChangedCallback = (RecorderState previous, RecorderState current, bool byPolicy, IntPtr userData) => + { + SetState(current); + Log.Info(RecorderLog.Tag, "Recorder state changed " + previous.ToString() + " -> " + current.ToString()); + StateChanged?.Invoke(this, new RecorderStateChangedEventArgs(previous, current, byPolicy)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetStateChangedCallback(_handle, _stateChangedCallback, IntPtr.Zero), + "Setting state changed callback failed"); + } + + private void RegisterRecordingProgressCallback() + { + _recordingProgressCallback = (ulong elapsedTime, ulong fileSize, IntPtr userData) => + { + RecordingProgress?.Invoke(this, new RecordingProgressEventArgs(elapsedTime, fileSize)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetRecordingProgressCallback(_handle, _recordingProgressCallback, IntPtr.Zero), + "Setting status changed callback failed"); + } + + private void RegisterAudioStreamDeliveredCallback() + { + _audioStreamCallback = (IntPtr stream, int streamSize, AudioSampleType type, int channel, uint recordingTime, IntPtr userData) => + { + AudioStreamDelivered?.Invoke(this, new AudioStreamDeliveredEventArgs(stream, streamSize, type, channel, recordingTime)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetAudioStreamCallback(_handle, _audioStreamCallback, IntPtr.Zero), + "Setting audiostream callback failed"); + } + + private void RegisterRecordingLimitReachedEvent() + { + _recordingLimitReachedCallback = (RecordingLimitType type, IntPtr userData) => + { + RecordingLimitReached?.Invoke(this, new RecordingLimitReachedEventArgs(type)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero), + "Setting limit reached callback failed"); + } + + private void RegisterMuxedStreamEvent() + { + _muxedStreamCallback = (IntPtr stream, int streamSize, ulong offset, IntPtr userData) => + { + MuxedStreamDelivered?.Invoke(this, new MuxedStreamDeliveredEventArgs(stream, streamSize, offset)); + }; + RecorderErrorFactory.ThrowIfError(Native.SetMuxedStreamCallback(_handle, _muxedStreamCallback, IntPtr.Zero), + "Setting muxed stream callback failed"); + } + #endregion Callback registrations + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs new file mode 100755 index 0000000..fa7e84c --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderEnums.cs @@ -0,0 +1,217 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for Audio Codec. + /// + /// 3 + public enum RecorderAudioCodec + { + /// + /// Disable Audio track. + /// + Disable = -1, + /// + /// AMR codec. + /// + Amr = 0, + /// + /// AAC codec. + /// + Aac, + /// + /// Vorbis codec. + /// + Vorbis, + /// + /// PCM codec. + /// + Pcm, + /// + /// The mp3 codec. + /// + Mp3 + } + + /// + /// Enumeration for Audio capture devices. + /// + /// 3 + public enum RecorderAudioDevice + { + /// + /// Capture audio from Mic device. + /// + Mic, + /// + /// Capture audio from modem. + /// + Modem + } + + /// + /// Enumeration for the file container format. + /// + /// 3 + public enum RecorderFileFormat + { + /// + /// 3GP file format. + /// + ThreeGp, + /// + /// MP4 file format. + /// + Mp4, + /// + /// AMR file format. + /// + Amr, + /// + /// ADTS file format. + /// + Adts, + /// + /// WAV file format. + /// + Wav, + /// + /// OGG file format. + /// + Ogg, + /// + /// M2TS file format. + /// + M2ts + } + + /// + /// Enumeration for the recorder policy. + /// + /// 3 + public enum RecorderPolicy + { + /// + /// None. + /// + None = 0, + /// + /// Security policy. + /// + Security = 4, + /// + /// Resource conflict policy. + /// + ResourceConflict = 5 + } + + /// + /// Enumeration for the recording limit. + /// + /// 3 + public enum RecordingLimitType + { + /// + /// Time limit in seconds of recording file + /// + Time, + /// + /// Size limit in KB(KiloBytes) of recording file. + /// + Size, + /// + /// No free space in storage. + /// + Space + } + + /// + /// Enumeration for recorder states. + /// + /// 3 + public enum RecorderState + { + /// + /// Recorder is not created. + /// + None, + /// + /// Recorder is created, but not prepared. + /// + Created, + /// + /// Recorder is ready to record. In case of video recorder, + /// preview display will be shown. + /// + Ready, + /// + /// Recorder is recording media. + /// + Recording, + /// + /// Recorder is paused while recording media. + /// + Paused + } + + /// + /// Enumeration for video codec. + /// + /// 3 + public enum RecorderVideoCodec + { + /// + /// H263 codec. + /// + H263, + /// + /// H264 codec. + /// + H264, + /// + /// MPEG4 codec. + /// + Mpeg4, + /// + /// Theora codec. + /// + Theora + } + + /// + /// Enumeration for recorder failure error. + /// + /// 3 + public enum RecorderErrorCode + { + /// + /// Device Error. + /// + DeviceError = RecorderError.DeviceError, + /// + /// Internal error. + /// + InvalidOperation = RecorderError.InvalidOperation, + /// + /// Out of memory. + /// + OutOfMemory = RecorderError.OutOfMemory + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs new file mode 100644 index 0000000..74a8b46 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderErrorFactory.cs @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.CompilerServices; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum RecorderError + { + TizenErrorRecorder = -0x01950000, + RecorderErrorClass = TizenErrorRecorder | 0x10, + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidState = RecorderErrorClass | 0x02, + OutOfMemory = ErrorCode.OutOfMemory, + DeviceError = RecorderErrorClass | 0x04, + InvalidOperation = ErrorCode.InvalidOperation, + SecurityRestricted = RecorderErrorClass | 0x07, + Esd = RecorderErrorClass | 0x0a, + OutOfStorage = RecorderErrorClass | 0x0b, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + ResourceConflict = RecorderErrorClass | 0x0c, + ServiceDisconnected = RecorderErrorClass | 0x0d + } + + internal static class RecorderErrorFactory + { + internal static void ThrowIfError(RecorderError errorCode, string errorMessage = null, + [CallerMemberName] string caller = null, [CallerLineNumber] int line = 0) + { + if (errorCode == RecorderError.None) + { + return; + } + + Log.Info(RecorderLog.Tag, "errorCode : " + errorCode.ToString() + ", Caller : " + caller + ", line " + line.ToString()); + + switch (errorCode) + { + case RecorderError.InvalidParameter: + throw new ArgumentException(errorMessage); + + case RecorderError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + + case RecorderError.DeviceError: + case RecorderError.Esd: + case RecorderError.SecurityRestricted: + case RecorderError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + + case RecorderError.NotSupported: + throw new NotSupportedException(errorMessage); + + case RecorderError.InvalidState: + case RecorderError.InvalidOperation: + case RecorderError.ResourceConflict: + case RecorderError.ServiceDisconnected: + case RecorderError.OutOfStorage: //TODO need to alloc new proper exception class + throw new InvalidOperationException(errorMessage); + + default: + throw new Exception("Unknown error : " + errorCode.ToString()); + } + } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs new file mode 100755 index 0000000..f1efa79 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderFeatures.cs @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using Native = Interop.RecorderFeatures; + +namespace Tizen.Multimedia +{ + /// + /// The camera setting class provides methods/properties to get and + /// set basic camera attributes. + /// + public class RecorderFeatures + { + internal readonly Recorder _recorder = null; + + private List _fileFormats; + private List _audioCodec; + private List _videoCodec; + private List _videoResolution; + + internal RecorderFeatures(Recorder recorder) + { + _recorder = recorder; + } + + /// + /// Retrieves all the file formats supported by the recorder. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedFileFormats + { + get + { + if (_fileFormats == null) + { + try + { + _fileFormats = new List(); + + Native.FileFormatCallback callback = (RecorderFileFormat format, IntPtr userData) => + { + _fileFormats.Add(format); + return true; + }; + RecorderErrorFactory.ThrowIfError(Native.FileFormats(_recorder.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported fileformats"); + } + catch + { + _fileFormats = null; + throw; + } + } + + return _fileFormats; + } + } + + /// + /// Retrieves all the audio encoders supported by the recorder. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// + /// The camera already has been disposed. + public IEnumerable SupportedAudioEncodings + { + get + { + if (_audioCodec == null) + { + try + { + _audioCodec = new List(); + + Native.AudioEncoderCallback callback = (RecorderAudioCodec codec, IntPtr userData) => + { + _audioCodec.Add(codec); + return true; + }; + RecorderErrorFactory.ThrowIfError(Native.AudioEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported audio encoders"); + } + catch + { + _audioCodec = null; + throw; + } + } + + return _audioCodec; + } + } + + /// + /// Retrieves all the video encoders supported by the recorder. + /// + /// 3 + /// + /// It returns a list containing all the supported . + /// by recorder. + /// + /// The camera already has been disposed. + public IEnumerable SupportedVideoEncodings + { + get + { + if (_videoCodec == null) + { + try + { + _videoCodec = new List(); + + Native.VideoEncoderCallback callback = (RecorderVideoCodec codec, IntPtr userData) => + { + _videoCodec.Add(codec); + return true; + }; + RecorderErrorFactory.ThrowIfError(Native.VideoEncoders(_recorder.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported video encoders"); + } + catch + { + _videoCodec = null; + throw; + } + } + + return _videoCodec; + } + } + + /// + /// Retrieves all the video resolutions supported by the recorder. + /// + /// 3 + /// + /// It returns videoresolution list containing the width and height of + /// different resolutions supported by recorder. + /// + /// The camera already has been disposed. + public IEnumerable SupportedVideoResolutions + { + get + { + if (_videoResolution == null) + { + try + { + _videoResolution = new List(); + + Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => + { + _videoResolution.Add(new Size(width, height)); + return true; + }; + RecorderErrorFactory.ThrowIfError(Native.VideoResolution(_recorder.GetHandle(), callback, IntPtr.Zero), + "Failed to get the supported video resolutions."); + } + catch + { + _videoResolution = null; + throw; + } + } + + return _videoResolution; + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs new file mode 100755 index 0000000..71392fc --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderInterruptedEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// An extended Eventargs class which contains interrupted policy details, previous and current + /// state of the recorder. + /// + public class RecorderInterruptedEventArgs : EventArgs + { + internal RecorderInterruptedEventArgs(RecorderPolicy policy, RecorderState previous, RecorderState current) + { + Policy = policy; + Previous = previous; + Current = current; + } + + /// + /// The policy that interrupted the recorder. + /// + /// 3 + public RecorderPolicy Policy { get; } + + /// + /// The previous state of the recorder. + /// + /// 3 + public RecorderState Previous { get; } + + /// + /// The current state of the recorder. + /// + /// 3 + public RecorderState Current { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs new file mode 100755 index 0000000..9c92ad7 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderSettings.cs @@ -0,0 +1,449 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Linq; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; +using Native = Interop.RecorderSettings; + +namespace Tizen.Multimedia +{ + /// + /// The camera setting class provides methods/properties to get and + /// set basic camera attributes. + /// + public class RecorderSettings + { + internal readonly Recorder _recorder = null; + + internal RecorderSettings(Recorder recorder) + { + _recorder = recorder; + } + + /// + /// The number of audio channel. + /// + /// 3 + /// + /// For mono recording, set channel to 1. + /// For stereo recording, set channel to 2. + /// + /// The camera already has been disposed. + public int AudioChannel + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioChannel(_recorder.GetHandle(), out val), + "Failed to get audio channel."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetAudioChannel(_recorder.GetHandle(), value), + "Failed to set audio channel"); + } + } + + /// + /// The audio device for recording. + /// + /// 3 + /// A that specifies the type of audio device. + /// The camera already has been disposed. + public RecorderAudioDevice AudioDevice + { + get + { + RecorderAudioDevice val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioDevice(_recorder.GetHandle(), out val), + "Failed to get audio device."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetAudioDevice(_recorder.GetHandle(), value), + "Failed to set audio device."); + } + } + + /// + /// Get the peak audio input level in dB + /// + /// 3 + /// + /// 0dB indicates maximum input level, -300dB indicates minimum input level. + /// + /// The camera already has been disposed. + public double AudioLevel + { + get + { + double level = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioLevel(_recorder.GetHandle(), out level), + "Failed to get Audio level."); + + return level; + } + } + + /// + /// The sampling rate of an audio stream in hertz. + /// + /// 3 + /// The camera already has been disposed. + public int AudioSampleRate + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioSampleRate(_recorder.GetHandle(), out val), + "Failed to get audio sample rate."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetAudioSampleRate(_recorder.GetHandle(), value), + "Failed to set audio sample rate."); + } + } + + /// + /// The bitrate of an audio encoder in bits per second. + /// + /// 3 + /// The camera already has been disposed. + public int AudioBitRate + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioEncoderBitrate(_recorder.GetHandle(), out val), + "Failed to get audio bitrate."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoderBitrate(_recorder.GetHandle(), value), + "Failed to set audio bitrate"); + } + } + + /// + /// The bitrate of an video encoder in bits per second. + /// + /// 3 + /// The camera already has been disposed. + public int VideoBitRate + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetVideoEncoderBitrate(_recorder.GetHandle(), out val), + "Failed to get video bitrate."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoderBitrate(_recorder.GetHandle(), value), + "Failed to set video bitrate"); + } + } + + /// + /// The audio codec for encoding an audio stream. + /// + /// 3 + /// A that specifies the type of audio codec. + /// The camera already has been disposed. + public RecorderAudioCodec AudioCodec + { + get + { + RecorderAudioCodec val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetAudioEncoder(_recorder.GetHandle(), out val), + "Failed to get audio codec"); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetAudioEncoder(_recorder.GetHandle(), value), + "Failed to set audio codec"); + } + } + + /// + /// The video codec for encoding video stream. + /// + /// 3 + /// A that specifies the type of video codec. + /// The camera already has been disposed. + public RecorderVideoCodec VideoCodec + { + get + { + RecorderVideoCodec val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetVideoEncoder(_recorder.GetHandle(), out val), + "Failed to get video codec"); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetVideoEncoder(_recorder.GetHandle(), value), + "Failed to set video codec"); + } + } + + /// + /// The file format for recording media stream. + /// + /// 3 + /// A that specifies the file format. + /// The camera already has been disposed. + public RecorderFileFormat FileFormat + { + get + { + RecorderFileFormat val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetFileFormat(_recorder.GetHandle(), out val), + "Failed to get file format."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetFileFormat(_recorder.GetHandle(), value), + "Failed to set file format"); + } + } + + /// + /// The file path to record. + /// + /// 3 + /// + /// If the same file already exists in the file system, then old file + /// will be overwritten. + /// + /// The camera already has been disposed. + public string FilePath + { + get + { + IntPtr val; + RecorderError ret = Native.GetFileName(_recorder.GetHandle(), out val); + if (ret != RecorderError.None) + { + Log.Error(RecorderLog.Tag, "Failed to get filepath, " + (RecorderError)ret); + } + string result = Marshal.PtrToStringAnsi(val); + LibcSupport.Free(val); + return result; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetFileName(_recorder.GetHandle(), value), + "Failed to set filepath"); + } + } + + /// + /// The maximum size of a recording file in KB(kilobytes). If 0, means + /// unlimited recording size. + /// + /// 3 + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// The recorder state must be in 'Ready' or 'Created' state. + /// + /// The camera already has been disposed. + public int SizeLimit + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetSizeLimit(_recorder.GetHandle(), out val), + "Failed to get size limit."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetSizeLimit(_recorder.GetHandle(), value), + "Failed to set size limit"); + } + } + + /// + /// The time limit of a recording file in Seconds. If 0, means unlimited recording + /// time. + /// + /// 3 + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// The recorder state must be in 'Ready' or 'Created' state. + /// + /// The camera already has been disposed. + public int TimeLimit + { + get + { + int val = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetTimeLimit(_recorder.GetHandle(), out val), + "Failed to get time limit."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetTimeLimit(_recorder.GetHandle(), value), + "Failed to set time limit."); + } + } + + /// + /// The mute state of a recorder. + /// + /// 3 + /// The camera already has been disposed. + public bool Mute + { + get + { + return Native.GetMute(_recorder.GetHandle()); + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetMute(_recorder.GetHandle(), value), + "Failed to set mute"); + } + } + + /// + /// The video recording motion rate + /// + /// 3 + /// + /// The attribute is valid only in a video recorder. + /// If the rate is in range of 0-1, video is recorded in a slow motion mode. + /// If the rate is bigger than 1, video is recorded in a fast motion mode. + /// + /// The camera already has been disposed. + public double MotionRate + { + get + { + double val = 0.0; + + RecorderErrorFactory.ThrowIfError(Native.GetMotionRate(_recorder.GetHandle(), out val), + "Failed to get video motion rate."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetMotionRate(_recorder.GetHandle(), value), + "Failed to set video motion rate"); + } + } + + /// + /// The orientation in a video metadata tag. + /// + /// 3 + /// A that specifies the type of orientation. + /// The camera already has been disposed. + public Rotation OrientationTag + { + get + { + RecorderErrorFactory.ThrowIfError(Native.GetOrientationTag(_recorder.GetHandle(), out var val), + "Failed to get recorder orientation."); + + return val; + } + + set + { + RecorderErrorFactory.ThrowIfError(Native.SetOrientationTag(_recorder.GetHandle(), value), + "Failed to set recorder orientation"); + } + } + + /// + /// Resolution of the video. + /// + /// 3 + /// In case of invalid parameters + /// The camera already has been disposed. + public Size VideoResolution + { + get + { + int width = 0; + int height = 0; + + RecorderErrorFactory.ThrowIfError(Native.GetVideoResolution(_recorder.GetHandle(), out width, out height), + "Failed to get camera video resolution"); + + return new Size(width, height); + } + + set + { + Size res = value; + + RecorderErrorFactory.ThrowIfError(Native.SetVideoResolution(_recorder.GetHandle(), res.Width, res.Height), + "Failed to set video resolution."); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs new file mode 100755 index 0000000..42e3af0 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecorderStateChangedEventArgs.cs @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about previous and current state + /// of the recorder when its state is changed. + /// + public class RecorderStateChangedEventArgs : EventArgs + { + internal RecorderStateChangedEventArgs(RecorderState previous, RecorderState current, bool byPolicy) + { + Previous = previous; + Current = current; + IsStateChangedByPolicy = byPolicy; + } + + /// + /// Previous state of the recorder. + /// + /// 3 + public RecorderState Previous { get; } + + /// + /// Current state of the recorder. + /// + /// 3 + public RecorderState Current { get; } + + /// + /// true if the state changed by policy such as Resource Conflict or Security, otherwise false + /// in normal state change. + /// + /// 3 + public bool IsStateChangedByPolicy { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs new file mode 100755 index 0000000..80b6070 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecordingErrorOccurredEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about error status and + /// state of the recorder when it failed. + /// + public class RecordingErrorOccurredEventArgs : EventArgs + { + internal RecordingErrorOccurredEventArgs(RecorderErrorCode error, RecorderState state) + { + Error = error; + State = state; + } + + /// + /// The error code. + /// + /// 3 + public RecorderErrorCode Error { get; } + + /// + /// The state of the recorder. + /// + /// 3 + public RecorderState State { get; } + + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs new file mode 100755 index 0000000..8606748 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecordingLimitReachedEventArgs.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class containing details about the recording limit. + /// + public class RecordingLimitReachedEventArgs : EventArgs + { + internal RecordingLimitReachedEventArgs(RecordingLimitType type) + { + Type = type; + } + + /// + /// The limitation type. + /// + /// 3 + public RecordingLimitType Type { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs b/src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs new file mode 100755 index 0000000..f059fc7 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Recorder/RecordingProgressEventArgs.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extened EventArgs class which contain the details of current recording status. + /// + public class RecordingProgressEventArgs : EventArgs + { + public RecordingProgressEventArgs(ulong elapsedTime, ulong fileSize) + { + ElapsedTime = elapsedTime; + FileSize = fileSize; + } + + /// + /// The time of recording in milliseconds. + /// + /// 3 + public ulong ElapsedTime { get; } + + /// + /// The size of the recording file in Kilobyte. + /// + /// 3 + public ulong FileSize { get; } + } +} diff --git a/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj new file mode 100644 index 0000000..627273f --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.csproj @@ -0,0 +1,15 @@ + + + + + netstandard1.6 + + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.sln b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.sln new file mode 100755 index 0000000..25f0112 --- /dev/null +++ b/src/Tizen.Multimedia.Recorder/Tizen.Multimedia.Recorder.sln @@ -0,0 +1,64 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Recorder", "Tizen.Multimedia.Recorder.csproj", "{78B69A8B-FCDA-40BF-B9F8-7EF17ECEEB63}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{84F6700F-1795-4F1A-A18A-7BC64A9B103D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{94920190-FD55-408C-9F71-EF55173586D5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{1D297A7B-8190-4B39-B8D9-60310118B412}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{20523C8C-62D4-487E-BD17-6C6847B3F3C0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{C62E34CA-BF10-4B7A-87A4-3AC67C488EF0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.AudioIO", "..\Tizen.Multimedia.AudioIO\Tizen.Multimedia.AudioIO.csproj", "{6FCEB61E-089D-4959-A7E0-28AC512AF6BE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Camera", "..\Tizen.Multimedia.Camera\Tizen.Multimedia.Camera.csproj", "{511D947C-5A2C-4E29-B958-7C28065F94C3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78B69A8B-FCDA-40BF-B9F8-7EF17ECEEB63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78B69A8B-FCDA-40BF-B9F8-7EF17ECEEB63}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78B69A8B-FCDA-40BF-B9F8-7EF17ECEEB63}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78B69A8B-FCDA-40BF-B9F8-7EF17ECEEB63}.Release|Any CPU.Build.0 = Release|Any CPU + {84F6700F-1795-4F1A-A18A-7BC64A9B103D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {84F6700F-1795-4F1A-A18A-7BC64A9B103D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {84F6700F-1795-4F1A-A18A-7BC64A9B103D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {84F6700F-1795-4F1A-A18A-7BC64A9B103D}.Release|Any CPU.Build.0 = Release|Any CPU + {94920190-FD55-408C-9F71-EF55173586D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94920190-FD55-408C-9F71-EF55173586D5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94920190-FD55-408C-9F71-EF55173586D5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94920190-FD55-408C-9F71-EF55173586D5}.Release|Any CPU.Build.0 = Release|Any CPU + {1D297A7B-8190-4B39-B8D9-60310118B412}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D297A7B-8190-4B39-B8D9-60310118B412}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D297A7B-8190-4B39-B8D9-60310118B412}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D297A7B-8190-4B39-B8D9-60310118B412}.Release|Any CPU.Build.0 = Release|Any CPU + {20523C8C-62D4-487E-BD17-6C6847B3F3C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20523C8C-62D4-487E-BD17-6C6847B3F3C0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20523C8C-62D4-487E-BD17-6C6847B3F3C0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20523C8C-62D4-487E-BD17-6C6847B3F3C0}.Release|Any CPU.Build.0 = Release|Any CPU + {C62E34CA-BF10-4B7A-87A4-3AC67C488EF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C62E34CA-BF10-4B7A-87A4-3AC67C488EF0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C62E34CA-BF10-4B7A-87A4-3AC67C488EF0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C62E34CA-BF10-4B7A-87A4-3AC67C488EF0}.Release|Any CPU.Build.0 = Release|Any CPU + {6FCEB61E-089D-4959-A7E0-28AC512AF6BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FCEB61E-089D-4959-A7E0-28AC512AF6BE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FCEB61E-089D-4959-A7E0-28AC512AF6BE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FCEB61E-089D-4959-A7E0-28AC512AF6BE}.Release|Any CPU.Build.0 = Release|Any CPU + {511D947C-5A2C-4E29-B958-7C28065F94C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {511D947C-5A2C-4E29-B958-7C28065F94C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {511D947C-5A2C-4E29-B958-7C28065F94C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {511D947C-5A2C-4E29-B958-7C28065F94C3}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..d479daa --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ScreenMirroring = "libcapi-media-screen-mirroring.so.0"; + public const string MediaController = "libcapi-media-controller.so.0"; + } +} + diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs new file mode 100644 index 0000000..7efbf0a --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.MediaController.cs @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; +using Tizen.Multimedia; +using Tizen.Multimedia.MediaController; + +internal static partial class Interop +{ + internal static partial class MediaControllerClient + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServerUpdatedCallback(IntPtr serverName, MediaControllerServerState serverState, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackUpdatedCallback(IntPtr serverName, IntPtr playback, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MetadataUpdatedCallback(IntPtr serverName, IntPtr metadata, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ShuffleModeUpdatedCallback(IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RepeatModeUpdatedCallback(IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CommandReplyRecievedCallback(IntPtr serverName, int result, IntPtr bundle, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SubscribedServerCallback(IntPtr serverName, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ActivatedServerCallback(IntPtr serverName, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_create")] + internal static extern MediaControllerError Create(out IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy")] + internal static extern MediaControllerError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_server_update_cb")] + internal static extern MediaControllerError SetServerUpdatedCb(IntPtr handle, ServerUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_server_update_cb")] + internal static extern MediaControllerError UnsetServerUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_playback_update_cb")] + internal static extern MediaControllerError SetPlaybackUpdatedCb(IntPtr handle, PlaybackUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_playback_update_cb")] + internal static extern MediaControllerError UnsetPlaybackUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_metadata_update_cb")] + internal static extern MediaControllerError SetMetadataUpdatedCb(IntPtr handle, MetadataUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_metadata_update_cb")] + internal static extern MediaControllerError UnsetMetadataUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_shuffle_mode_update_cb")] + internal static extern MediaControllerError SetShuffleModeUpdatedCb(IntPtr handle, ShuffleModeUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_shuffle_mode_update_cb")] + internal static extern MediaControllerError UnsetShuffleModeUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_set_repeat_mode_update_cb")] + internal static extern MediaControllerError SetRepeatModeUpdatedCb(IntPtr handle, RepeatModeUpdatedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unset_repeat_mode_update_cb")] + internal static extern MediaControllerError UnsetRepeatModeUpdatedCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_subscribe")] + internal static extern MediaControllerError Subscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_unsubscribe")] + internal static extern MediaControllerError Unsubscribe(IntPtr handle, MediaControllerSubscriptionType subscriptionType, string serverName); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_state")] + internal static extern MediaControllerError GetPlaybackState(IntPtr playback, out MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_playback_position")] + internal static extern MediaControllerError GetPlaybackPosition(IntPtr playback, out ulong position); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_playback")] + internal static extern MediaControllerError DestroyPlayback(IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_metadata")] + private static extern MediaControllerError GetMetadata(IntPtr metadata, MediaControllerAttributes attribute, out IntPtr value); + + internal static string GetMetadata(IntPtr handle, MediaControllerAttributes attr) + { + IntPtr valuePtr = IntPtr.Zero; + + try + { + var ret = GetMetadata(handle, attr, out valuePtr); + MediaControllerValidator.ThrowIfError(ret, "Failed to get value for " + attr); + return Marshal.PtrToStringAnsi(valuePtr); + } + finally + { + LibcSupport.Free(valuePtr); + } + } + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_destroy_metadata")] + internal static extern MediaControllerError DestroyMetadata(IntPtr metadata); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_latest_server_info")] + internal static extern MediaControllerError GetLatestServer(IntPtr handle, out IntPtr serverName, out MediaControllerServerState serverState); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_playback_info")] + internal static extern MediaControllerError GetServerPlayback(IntPtr handle, string serverName, out IntPtr playback); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_metadata")] + internal static extern MediaControllerError GetServerMetadata(IntPtr handle, string serverName, out IntPtr metadata); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_shuffle_mode")] + internal static extern MediaControllerError GetServerShuffleMode(IntPtr handle, string serverName, out MediaControllerShuffleMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_get_server_repeat_mode")] + internal static extern MediaControllerError GetServerRepeatMode(IntPtr handle, string serverName, out MediaControllerRepeatMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_playback_state_command")] + internal static extern MediaControllerError SendPlaybackStateCommand(IntPtr handle, string serverName, MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_send_custom_command")] + internal static extern MediaControllerError SendCustomCommand(IntPtr handle, string serverName, string command, SafeBundleHandle bundle, CommandReplyRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server_subscribed")] + internal static extern MediaControllerError ForeachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType, SubscribedServerCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_client_foreach_server")] + internal static extern MediaControllerError ForeachActivatedServer(IntPtr handle, ActivatedServerCallback callback, IntPtr userData); + } + + internal static partial class MediaControllerServer + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PlaybackStateCommandRecievedCallback(IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CustomCommandRecievedCallback(IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")] + internal static extern MediaControllerError Create(out IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")] + internal static extern MediaControllerError Destroy(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")] + internal static extern MediaControllerError SetPlaybackState(IntPtr handle, MediaControllerPlaybackState state); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")] + internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")] + internal static extern MediaControllerError UpdatePlayback(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")] + internal static extern MediaControllerError SetMetadata(IntPtr handle, MediaControllerAttributes attribute, string value); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")] + internal static extern MediaControllerError UpdateMetadata(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")] + internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle, MediaControllerShuffleMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")] + internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerRepeatMode mode); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state_command_received_cb")] + internal static extern MediaControllerError SetPlaybackStateCmdRecvCb(IntPtr handle, PlaybackStateCommandRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_state_command_received_cb")] + internal static extern MediaControllerError UnsetPlaybackStateCmdRecvCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_command_received_cb")] + internal static extern MediaControllerError SetCustomCmdRecvCb(IntPtr handle, CustomCommandRecievedCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_custom_command_received_cb")] + internal static extern MediaControllerError UnsetCustomCmdRecvCb(IntPtr handle); + + [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_command_reply")] + internal static extern MediaControllerError SendCommandReply(IntPtr handle, string clientName, int result, SafeBundleHandle bundle); + } +} diff --git a/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs new file mode 100644 index 0000000..5c0a035 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Interop/Interop.ScreenMirroring.cs @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class ScreenMirroring + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(IntPtr userData, + ScreenMirroringState state, ScreenMirroringErrorCode error); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_create")] + internal static extern ScreenMirroringErrorCode Create(out IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_state_changed_cb")] + internal static extern ScreenMirroringErrorCode SetStateChangedCb(IntPtr handle, + StateChangedCallback cb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_ip_and_port")] + internal static extern ScreenMirroringErrorCode SetIpAndPort(IntPtr handle, string ip, string port); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_display")] + internal static extern ScreenMirroringErrorCode SetDisplay(IntPtr handle, int type, IntPtr display); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_set_resolution")] + internal static extern ScreenMirroringErrorCode SetResolution(IntPtr handle, ScreenMirroringResolutions resolution); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_prepare")] + internal static extern ScreenMirroringErrorCode Prepare(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_connect")] + internal static extern ScreenMirroringErrorCode Connect(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_start")] + internal static extern ScreenMirroringErrorCode StartAsync(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_pause")] + internal static extern ScreenMirroringErrorCode PauseAsync(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_resume")] + internal static extern ScreenMirroringErrorCode ResumeAsync(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_disconnect")] + internal static extern ScreenMirroringErrorCode Disconnect(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unprepare")] + internal static extern ScreenMirroringErrorCode Unprepare(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_unset_state_changed_cb")] + internal static extern int UnsetStateChangedCb(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_codec")] + internal static extern ScreenMirroringErrorCode GetNegotiatedVideoCodec(ref IntPtr handle, + out ScreenMirroringVideoCodec codec); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_resolution")] + internal static extern ScreenMirroringErrorCode GetNegotiatedVideoResolution(ref IntPtr handle, + out int width, out int height); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_video_frame_rate")] + internal static extern ScreenMirroringErrorCode GetNegotiatedVideoFrameRate(ref IntPtr handle, + out int frameRate); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_codec")] + internal static extern ScreenMirroringErrorCode GetNegotiatedAudioCodec(ref IntPtr handle, + out ScreenMirroringAudioCodec codec); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_channel")] + internal static extern ScreenMirroringErrorCode GetNegotiatedAudioChannel(ref IntPtr handle, + out int channel); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_sample_rate")] + internal static extern ScreenMirroringErrorCode GetNegotiatedAudioSampleRate(ref IntPtr handle, + out int sampleRate); + + [DllImport(Libraries.ScreenMirroring, EntryPoint = "scmirroring_sink_get_negotiated_audio_bitwidth")] + internal static extern ScreenMirroringErrorCode GetNegotiatedAudioBitwidth(ref IntPtr handle, + out int bitwidth); + } +} diff --git a/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs new file mode 100755 index 0000000..a485e3f --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandEventArgs.cs @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Tizen.Applications; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// CustomCommandRecieved event arguments + /// + /// + /// CustomCommandRecieved event arguments + /// + public class CustomCommandEventArgs : EventArgs + { + internal CustomCommandEventArgs(string name, string command, Bundle bundle) + { + ClientName = name; + Command = command; + BundleData = bundle; + } + + /// + /// Get the Client Name. + /// + /// 3 + public string ClientName { get; } + + /// + /// Get the Custom Command. + /// + /// 3 + public string Command { get; } + + /// + /// Get the Bundle Data. + /// + /// 3 + public Bundle BundleData { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs new file mode 100755 index 0000000..e7bac0e --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/CustomCommandReplyEventArgs.cs @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Tizen.Applications; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// CustomCommandRecieved event arguments + /// + /// + /// CustomCommandRecieved event arguments + /// + public class CustomCommandReplyEventArgs : EventArgs + { + internal CustomCommandReplyEventArgs(string serverName, int result, Bundle bundle) + { + ServerName = serverName; + Result = result; + BundleData = bundle; + } + + /// + /// Get the Sserver Name. + /// + /// 3 + public string ServerName { get; } + + /// + /// Get the Result. + /// + /// 3 + public int Result { get; } + + /// + /// Get the Bundle Data. + /// + /// 3 + public Bundle BundleData { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs new file mode 100755 index 0000000..529719a --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerClient.cs @@ -0,0 +1,595 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using Tizen.Applications; +using Native = Interop.MediaControllerClient; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// The MediaControllerClient class provides APIs required for media-controller-client. + /// + /// + /// http://tizen.org/privilege/mediacontroller.client + /// + /// + /// The MediaControllerClient APIs provides functions to get media information from server. + /// + public class MediaControllerClient : IDisposable + { + internal IntPtr _handle = IntPtr.Zero; + + private bool _disposed = false; + private EventHandler _serverUpdated; + private Native.ServerUpdatedCallback _serverUpdatedCallback; + private EventHandler _playbackUpdated; + private Native.PlaybackUpdatedCallback _playbackUpdatedCallback; + private EventHandler _metadataUpdated; + private Native.MetadataUpdatedCallback _metadataUpdatedCallback; + private EventHandler _shufflemodeUpdated; + private Native.ShuffleModeUpdatedCallback _shufflemodeUpdatedCallback; + private EventHandler _repeatmodeUpdated; + private Native.RepeatModeUpdatedCallback _repeatmodeUpdatedCallback; + private EventHandler _customcommandReply; + private Native.CommandReplyRecievedCallback _customcommandReplyCallback; + + private bool IsValidHandle + { + get { return (_handle != IntPtr.Zero); } + } + + private IntPtr SafeHandle + { + get + { + if (!IsValidHandle) + { + throw new ObjectDisposedException(nameof(MediaControllerClient), "Fail to operate MediaControllerClient"); + } + + return _handle; + } + } + + /// + /// The constructor of MediaControllerClient class. + /// + /// 3 + /// Thrown when the operation is invalid for the current state + /// Thrown when the access is denied for media controller client + public MediaControllerClient() + { + MediaControllerValidator.ThrowIfError( + Native.Create(out _handle), "Create client failed"); + } + + ~MediaControllerClient() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // To be used if there are any other disposable objects + } + + if (IsValidHandle) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// ServerUpdated event is raised when server is changed + /// + /// 3 + public event EventHandler ServerUpdated + { + add + { + if (_serverUpdated == null) + { + RegisterServerUpdatedEvent(); + } + + _serverUpdated += value; + + } + + remove + { + _serverUpdated -= value; + if (_serverUpdated == null) + { + UnregisterServerUpdatedEvent(); + } + } + } + + /// + /// PlaybackUpdated event is raised when playback is changed + /// + /// 3 + public event EventHandler PlaybackUpdated + { + add + { + if (_playbackUpdated == null) + { + RegisterPlaybackUpdatedEvent(); + } + + _playbackUpdated += value; + + } + + remove + { + _playbackUpdated -= value; + if (_playbackUpdated == null) + { + UnregisterPlaybackUpdatedEvent(); + } + } + } + + /// + /// MetadataUpdated event is raised when metadata is changed + /// + /// 3 + public event EventHandler MetadataUpdated + { + add + { + if (_metadataUpdated == null) + { + RegisterMetadataUpdatedEvent(); + } + + _metadataUpdated += value; + + } + + remove + { + _metadataUpdated -= value; + if (_metadataUpdated == null) + { + UnregisterMetadataUpdatedEvent(); + } + } + } + + /// + /// ShuffleModeUpdated event is raised when shuffle mode is changed + /// + /// 3 + public event EventHandler ShuffleModeUpdated + { + add + { + if (_shufflemodeUpdated == null) + { + RegisterShuffleModeUpdatedEvent(); + } + + _shufflemodeUpdated += value; + + } + + remove + { + _shufflemodeUpdated -= value; + if (_shufflemodeUpdated == null) + { + UnregisterShuffleModeUpdatedEvent(); + } + } + } + + /// + /// RepeatModeUpdated event is raised when server is changed + /// + /// 3 + public event EventHandler RepeatModeUpdated + { + add + { + if (_repeatmodeUpdated == null) + { + RegisterRepeatModeUpdatedEvent(); + } + + _repeatmodeUpdated += value; + } + + remove + { + _repeatmodeUpdated -= value; + if (_repeatmodeUpdated == null) + { + UnregisterRepeatModeUpdatedEvent(); + } + } + } + + /// + /// CommandReply event is raised when reply for command is recieved + /// + /// 3 + public event EventHandler CustomCommandReply + { + add + { + if (_customcommandReply == null) + { + _customcommandReplyCallback = (IntPtr serverName, int result, IntPtr bundle, IntPtr userData) => + { + SafeBundleHandle safeBundleHandle = new SafeBundleHandle(bundle, true); + Bundle bundleData = new Bundle(safeBundleHandle); + CustomCommandReplyEventArgs eventArgs = new CustomCommandReplyEventArgs(Marshal.PtrToStringAnsi(serverName), result, bundleData); + _customcommandReply?.Invoke(this, eventArgs); + }; + } + + _customcommandReply += value; + + } + + remove + { + _customcommandReply -= value; + if (_customcommandReply == null) + { + _customcommandReplyCallback = null; + } + } + } + + /// + /// gets latest server information + /// 3 + /// The name and state of the latest media controller server application: ServerInformation object + /// Thrown when the operation is invalid for the current state + public ServerInformation GetLatestServer() + { + IntPtr name = IntPtr.Zero; + MediaControllerServerState state = MediaControllerServerState.None; + + try + { + MediaControllerValidator.ThrowIfError( + Native.GetLatestServer(SafeHandle, out name, out state), "Get Latest server failed"); + return new ServerInformation(Marshal.PtrToStringAnsi(name), (MediaControllerServerState)state); + } + finally + { + LibcSupport.Free(name); + } + } + + /// + /// gets playback information for specific server + /// 3 + /// Server Name + /// The playback state and playback position of the specific media controller server application:MediaControllerPlayback object + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public MediaControllerPlayback GetPlayback(string serverName) + { + IntPtr playbackHandle = IntPtr.Zero; + MediaControllerPlayback playback = null; + + try + { + MediaControllerValidator.ThrowIfError( + Native.GetServerPlayback(SafeHandle, serverName, out playbackHandle), "Get Playback handle failed"); + playback = new MediaControllerPlayback(playbackHandle); + } + finally + { + if (playbackHandle != IntPtr.Zero) + { + MediaControllerValidator.ThrowIfError( + Native.DestroyPlayback(playbackHandle), "Destroy playback failed"); + } + } + + return playback; + } + + /// + /// gets metadata information for specific server + /// 3 + /// Server Name + /// The metadata information of the specific media controller server application:MediaControllerMetadata object + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public MediaControllerMetadata GetMetadata(string serverName) + { + IntPtr metadataHandle = IntPtr.Zero; + MediaControllerMetadata metadata = null; + + try + { + MediaControllerValidator.ThrowIfError( + Native.GetServerMetadata(SafeHandle, serverName, out metadataHandle), "Get Metadata handle failed"); + metadata = new MediaControllerMetadata(metadataHandle); + } + finally + { + if (metadataHandle != IntPtr.Zero) + { + MediaControllerValidator.ThrowIfError( + Native.DestroyMetadata(metadataHandle), "Destroy metadata failed"); + } + } + + return metadata; + } + + /// + /// gets shuffle mode for specific server + /// 3 + /// Server Name + /// The shuffle mode of the specific media controller server application:MediaControllerShuffleMode enum + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public MediaControllerShuffleMode GetShuffleMode(string serverName) + { + MediaControllerShuffleMode shuffleMode = MediaControllerShuffleMode.Off; + + MediaControllerValidator.ThrowIfError( + Native.GetServerShuffleMode(SafeHandle, serverName, out shuffleMode), "Get ShuffleMode failed"); + + return shuffleMode; + } + + /// + /// gets repeat mode for specific server \ + /// 3 + /// Server Name + /// The repeat mode of the specific media controller server application:MediaControllerRepeatMode enum + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public MediaControllerRepeatMode GetRepeatMode(string serverName) + { + MediaControllerRepeatMode repeatMode = MediaControllerRepeatMode.Off; + + MediaControllerValidator.ThrowIfError( + Native.GetServerRepeatMode(SafeHandle, serverName, out repeatMode), "Get RepeatMode failed"); + + return repeatMode; + } + + /// + /// Send command of playback state to server application + /// Server Name + /// Playback State + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void SendPlaybackStateCommand(string serverName, MediaControllerPlaybackState state) + { + MediaControllerValidator.ThrowIfError( + Native.SendPlaybackStateCommand(SafeHandle, serverName, state), "Send playback state command failed"); + } + + /// + /// Send customized command to server application + /// 3 + /// Server Name + /// Command + /// Bundle data + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void SendCustomCommand(string serverName, string command, Bundle bundle) + { + MediaControllerValidator.ThrowIfError( + Native.SendCustomCommand(SafeHandle, serverName, command, bundle.SafeBundleHandle, _customcommandReplyCallback, IntPtr.Zero), + "Send custom command failed"); + } + + /// + /// Subscribe subscription type from specific server application + /// 3 + /// Subscription Type + /// Server Name + /// Thrown when an invalid argument is used + public void Subscribe(MediaControllerSubscriptionType type, string serverName) + { + MediaControllerValidator.ThrowIfError( + Native.Subscribe(SafeHandle, type, serverName), "Subscribe failed"); + } + + /// + /// Subscribe subscription type from specific server application + /// 3 + /// Subscription Type + /// Server Name + /// Thrown when an invalid argument is used + public void Unsubscribe(MediaControllerSubscriptionType type, string serverName) + { + MediaControllerValidator.ThrowIfError( + Native.Unsubscribe(SafeHandle, type, serverName), "Unsubscribe failed"); + } + + /// + /// gets activated server list + /// 3 + /// The list of activated media controller server applications: IEnumerable of string + public Task> GetActivatedServerList() + { + var task = new TaskCompletionSource>(); + + List collectionList = ForEachActivatedServer(SafeHandle); + task.TrySetResult((IEnumerable)collectionList); + + return task.Task; + } + + /// + /// gets subscribed server list + /// 3 + /// Subscription Type + /// The list of subscribed media controller server applications: IEnumerable of string + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public Task> GetSubscribedServerList(MediaControllerSubscriptionType subscriptionType) + { + var task = new TaskCompletionSource>(); + + List collectionList = ForEachSubscribedServer(SafeHandle, subscriptionType); + task.TrySetResult((IEnumerable)collectionList); + + return task.Task; + } + + private void RegisterServerUpdatedEvent() + { + _serverUpdatedCallback = (IntPtr serverName, MediaControllerServerState serverState, IntPtr userData) => + { + ServerUpdatedEventArgs eventArgs = new ServerUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), serverState); + _serverUpdated?.Invoke(this, eventArgs); + }; + Native.SetServerUpdatedCb(SafeHandle, _serverUpdatedCallback, IntPtr.Zero); + } + + private void UnregisterServerUpdatedEvent() + { + Native.UnsetServerUpdatedCb(SafeHandle); + } + + private void RegisterPlaybackUpdatedEvent() + { + _playbackUpdatedCallback = (IntPtr serverName, IntPtr playback, IntPtr userData) => + { + PlaybackUpdatedEventArgs eventArgs = new PlaybackUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), playback); + _playbackUpdated?.Invoke(this, eventArgs); + }; + Native.SetPlaybackUpdatedCb(SafeHandle, _playbackUpdatedCallback, IntPtr.Zero); + } + + private void UnregisterPlaybackUpdatedEvent() + { + Native.UnsetPlaybackUpdatedCb(SafeHandle); + } + + private void RegisterMetadataUpdatedEvent() + { + _metadataUpdatedCallback = (IntPtr serverName, IntPtr metadata, IntPtr userData) => + { + MetadataUpdatedEventArgs eventArgs = new MetadataUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), metadata); + _metadataUpdated?.Invoke(this, eventArgs); + }; + Native.SetMetadataUpdatedCb(SafeHandle, _metadataUpdatedCallback, IntPtr.Zero); + } + + private void UnregisterMetadataUpdatedEvent() + { + Native.UnsetMetadataUpdatedCb(SafeHandle); + } + + private void RegisterShuffleModeUpdatedEvent() + { + _shufflemodeUpdatedCallback = (IntPtr serverName, MediaControllerShuffleMode shuffleMode, IntPtr userData) => + { + ShuffleModeUpdatedEventArgs eventArgs = new ShuffleModeUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), shuffleMode); + _shufflemodeUpdated?.Invoke(this, eventArgs); + }; + + MediaControllerValidator.ThrowIfError( + Native.SetShuffleModeUpdatedCb(SafeHandle, _shufflemodeUpdatedCallback, IntPtr.Zero), + "Set ShuffleModeUpdated callback failed"); + } + + private void UnregisterShuffleModeUpdatedEvent() + { + Native.UnsetShuffleModeUpdatedCb(SafeHandle); + } + + private void RegisterRepeatModeUpdatedEvent() + { + _repeatmodeUpdatedCallback = (IntPtr serverName, MediaControllerRepeatMode repeatMode, IntPtr userData) => + { + RepeatModeUpdatedEventArgs eventArgs = new RepeatModeUpdatedEventArgs(Marshal.PtrToStringAnsi(serverName), repeatMode); + _repeatmodeUpdated?.Invoke(this, eventArgs); + }; + + MediaControllerValidator.ThrowIfError( + Native.SetRepeatModeUpdatedCb(SafeHandle, _repeatmodeUpdatedCallback, IntPtr.Zero), + "Set RepeatModeUpdated callback failed"); + } + + private void UnregisterRepeatModeUpdatedEvent() + { + Native.UnsetRepeatModeUpdatedCb(SafeHandle); + } + + private static List ForEachSubscribedServer(IntPtr handle, MediaControllerSubscriptionType subscriptionType) + { + List subscribedServerCollections = new List(); + + Native.SubscribedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => + { + subscribedServerCollections.Add(Marshal.PtrToStringAnsi(serverName)); + return true; + }; + + MediaControllerValidator.ThrowIfError( + Native.ForeachSubscribedServer(handle, subscriptionType, serverCallback, IntPtr.Zero), + "Foreach Subscribed server failed"); + + return subscribedServerCollections; + } + + private static List ForEachActivatedServer(IntPtr handle) + { + List activatedServerCollections = new List(); + + Native.ActivatedServerCallback serverCallback = (IntPtr serverName, IntPtr userData) => + { + activatedServerCollections.Add(Marshal.PtrToStringAnsi(serverName)); + return true; + }; + + MediaControllerValidator.ThrowIfError( + Native.ForeachActivatedServer(handle, serverCallback, IntPtr.Zero), + "Foreach Activated server failed"); + + return activatedServerCollections; + } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs new file mode 100755 index 0000000..dc12318 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerEnums.cs @@ -0,0 +1,236 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Multimedia.MediaController +{ + /// + /// Specifies states that a can have. + /// + public enum MediaControllerServerState + { + /// + /// Server state is unknown + /// + /// 3 + None, + + /// + /// Server is activated + /// + /// 3 + Activated, + + /// + /// Server is deactivated + /// + /// 3 + Deactivated, + } + + /// + /// Enumeration for playback state + /// + public enum MediaControllerPlaybackState + { + /// + /// Playback state is unknown + /// + /// 3 + None, + + /// + /// Playback is playing + /// + /// 3 + Play, + + /// + /// Playback is paused + /// + /// 3 + Pause, + + /// + /// Playback is next + /// + /// 3 + Next, + + /// + /// Playback is prev + /// + /// 3 + Prev, + + /// + /// Playback is fastforward + /// + /// 3 + FastForward, + + /// + /// Playback is rewind + /// + /// 3 + Rewind, + } + + /// + /// Enumeration for shuffle mode + /// + public enum MediaControllerShuffleMode + { + /// + /// Shuffle mode is On + /// + /// 3 + On, + + /// + /// Shuffle mode is Off + /// + /// 3 + Off, + } + + /// + /// Enumeration for repeat mode + /// + public enum MediaControllerRepeatMode + { + /// + /// Repeat mode is On + /// + /// 3 + On, + + /// + /// Repeat mode is Off + /// + /// 3 + Off, + } + + /// + /// Enumeration for repeat mode + /// + public enum MediaControllerSubscriptionType + { + /// + /// The type of subscription is the state of server + /// + /// 3 + ServerState, + + /// + /// The type of subscription is the playback + /// + /// 3 + Playback, + + /// + /// The type of subscription is the metadata + /// + /// 3 + Metadata, + + /// + /// The type of subscription is the shuffle mode + /// + /// 3 + ShuffleMode, + + /// + /// The type of subscription is the repeat mode + /// + /// 3 + RepeatMode, + } + + /// + /// Enumeration for metadata attributes + /// + internal enum MediaControllerAttributes + { + /// + /// Attribute is title + /// + /// 3 + Title, + + /// + /// Attribute is artist + /// + /// 3 + Artist, + + /// + /// Attribute is album + /// + /// 3 + Album, + + /// + /// Attribute is author + /// + /// 3 + Author, + + /// + /// Attribute is genre + /// + /// 3 + Genre, + + /// + /// Attribute is duration + /// + /// 3 + Duration, + + /// + /// Attribute is date + /// + /// 3 + Date, + + /// + /// Attribute is copyright + /// + /// 3 + Copyright, + + /// + /// Attribute is description + /// + /// 3 + Description, + + /// + /// Attribute is track number + /// + /// 3 + TrackNumber, + + /// + /// Attribute is picture + /// + /// 3 + Picture, + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs new file mode 100644 index 0000000..680bedd --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerError.cs @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia.MediaController +{ + internal enum MediaControllerError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidOperation = ErrorCode.InvalidOperation, + NoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + }; + + internal static class MediaControllerValidator + { + internal static void ThrowIfError(MediaControllerError error, string errorMessage) + { + switch (error) + { + case MediaControllerError.InvalidParameter: + throw new ArgumentException(errorMessage); + + case MediaControllerError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + + case MediaControllerError.InvalidOperation: + throw new InvalidOperationException(errorMessage); + + case MediaControllerError.NoSpaceOnDevice: + throw new IOException(errorMessage); + + case MediaControllerError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + } + } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs new file mode 100644 index 0000000..44eac12 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerLog.cs @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + static internal class MediaControllerLog + { + internal const string LogTag = "Tizen.Multimedia.MediaController"; + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs new file mode 100755 index 0000000..1b0968b --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerMetadata.cs @@ -0,0 +1,123 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Native = Interop.MediaControllerClient; + +namespace Tizen.Multimedia.MediaController +{ + /// + /// Metadata represents a metadata of media for server application to play + /// + public class MediaControllerMetadata + { + /// + /// The constructor of MediaControllerMetadata class. + /// + /// 3 + public MediaControllerMetadata() + { + // Do nothing + } + + internal MediaControllerMetadata(IntPtr handle) + { + if (handle == IntPtr.Zero) + { + throw new InvalidOperationException("MediaControllerMetadata is not valid."); + } + + Title = Native.GetMetadata(handle, MediaControllerAttributes.Title); + Artist = Native.GetMetadata(handle, MediaControllerAttributes.Artist); + Album = Native.GetMetadata(handle, MediaControllerAttributes.Album); + Author = Native.GetMetadata(handle, MediaControllerAttributes.Author); + Genre = Native.GetMetadata(handle, MediaControllerAttributes.Genre); + Duration = Native.GetMetadata(handle, MediaControllerAttributes.Duration); + Date = Native.GetMetadata(handle, MediaControllerAttributes.Date); + Copyright = Native.GetMetadata(handle, MediaControllerAttributes.Copyright); + Description = Native.GetMetadata(handle, MediaControllerAttributes.Description); + TrackNumber = Native.GetMetadata(handle, MediaControllerAttributes.TrackNumber); + Picture = Native.GetMetadata(handle, MediaControllerAttributes.Picture); + } + + /// + /// Set/Get the Title of media + /// + /// 3 + public string Title { get; set; } + + /// + /// Set/Get the Artist of media + /// + /// 3 + public string Artist { get; set; } + + /// + /// Set/Get the Album of media + /// + /// 3 + public string Album { get; set; } + + /// + /// Set/Get the Author of media + /// + /// 3 + public string Author { get; set; } + + /// + /// Set/Get the Genre of media + /// + /// 3 + public string Genre { get; set; } + + /// + /// Set/Get the Duration of media + /// + /// 3 + public string Duration { get; set; } + + /// + /// Set/Get the Date of media + /// + /// 3 + public string Date { get; set; } + + /// + /// Set/Get the Copyright of media + /// + /// 3 + public string Copyright { get; set; } + + /// + /// Set/Get the Description of media + /// + /// 3 + public string Description { get; set; } + + /// + /// Set/Get the Track Number of media + /// + /// 3 + public string TrackNumber { get; set; } + + /// + /// Set/Get the Picture of media + /// + /// 3 + public string Picture { get; set; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs new file mode 100755 index 0000000..52143e5 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerPlayback.cs @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using Native = Interop.MediaControllerClient; + +namespace Tizen.Multimedia.MediaController +{ + /// + /// Playback represents a playback state and playback position. + /// + public class MediaControllerPlayback + { + /// + /// The constructor of MediaControllerPlayback class. + /// + /// 3 + /// + /// The state of the playback which is playing in MediaConttoller server application + /// + /// + /// The position of the playback which is playing in MediaConttoller server application + /// + public MediaControllerPlayback(MediaControllerPlaybackState state, ulong position) + { + State = state; + Position = position; + } + + internal MediaControllerPlayback(IntPtr handle) + { + MediaControllerPlaybackState state = MediaControllerPlaybackState.None; + ulong position = 0L; + + if (handle == IntPtr.Zero) + { + throw new InvalidOperationException("MediaControllerPlayback is not valid."); + } + + MediaControllerValidator.ThrowIfError( + Native.GetPlaybackState(handle, out state), "Get Playback state failed"); + + MediaControllerValidator.ThrowIfError( + Native.GetPlaybackPosition(handle, out position), "Get Playback position failed"); + + State = state; + Position = position; + } + + /// + /// Set/Get the State of playback information + /// + /// 3 + public MediaControllerPlaybackState State { get; } + + /// + /// Set/Get the Position of playback information + /// + /// 3 + public ulong Position { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs new file mode 100755 index 0000000..9928e53 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MediaControllerServer.cs @@ -0,0 +1,302 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using Tizen.Applications; +using Native = Interop.MediaControllerServer; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// The MediaControllerServer class provides APIs required for media-controller-server. + /// + /// + /// http://tizen.org/privilege/mediacontroller.server + /// + /// + /// The MediaControllerServer APIs provides functions to update media information. + /// + public class MediaControllerServer : IDisposable + { + internal IntPtr _handle = IntPtr.Zero; + + private bool _disposed = false; + private EventHandler _playbackCommand; + private Native.PlaybackStateCommandRecievedCallback _playbackCommandCallback; + private EventHandler _customCommand; + private Native.CustomCommandRecievedCallback _customCommandCallback; + + private bool IsValidHandle + { + get { return (_handle != IntPtr.Zero); } + } + + private IntPtr SafeHandle + { + get + { + if (!IsValidHandle) + { + throw new ObjectDisposedException(nameof(MediaControllerServer), "Fail to operate MediaControllerServer"); + } + + return _handle; + } + } + + /// + /// The constructor of MediaControllerServer class. + /// + /// 3 + /// Thrown when the operation is invalid for the current state + /// Thrown when the access is denied for media controller client + public MediaControllerServer() + { + MediaControllerValidator.ThrowIfError( + Native.Create(out _handle), "Create server failed"); + } + + ~MediaControllerServer() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // To be used if there are any other disposable objects + } + + if (IsValidHandle) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + /// + /// PlaybackStateCommandRecieved event is raised when client send command for playback + /// + /// 3 + public event EventHandler PlaybackStateCommand + { + add + { + if (_playbackCommand == null) + { + RegisterPlaybackCmdRecvEvent(); + } + + _playbackCommand += value; + + } + + remove + { + _playbackCommand -= value; + if (_playbackCommand == null) + { + UnregisterPlaybackCmdRecvEvent(); + } + } + } + + /// + /// CustomCommandRecieved event is raised when client send customized command + /// + /// 3 + public event EventHandler CustomCommand + { + add + { + if (_customCommand == null) + { + RegisterCustomCommandEvent(); + } + + _customCommand += value; + + } + + remove + { + _customCommand -= value; + if (_customCommand == null) + { + UnregisterCustomCommandEvent(); + } + } + } + + /// + /// Update playback state and playback position + /// 3 + /// playback state and playback position + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void UpdatePlayback(MediaControllerPlayback playback) + { + if (playback == null) + { + throw new ArgumentNullException("playback is null"); + } + + MediaControllerValidator.ThrowIfError( + Native.SetPlaybackState(SafeHandle, playback.State), "Set Playback state failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetPlaybackPosition(SafeHandle, playback.Position), "Set Playback position failed"); + + MediaControllerValidator.ThrowIfError( + Native.UpdatePlayback(SafeHandle), "Update Playback failed"); + } + + /// + /// Update metadata information + /// 3 + /// metadata information + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void UpdateMetadata(MediaControllerMetadata metadata) + { + if (metadata == null) + { + throw new ArgumentNullException("metadata is null"); + } + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Title, metadata.Title), "Set Title failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Artist, metadata.Artist), "Set Artist failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Album, metadata.Album), "Set Album failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Author, metadata.Author), "Set Author failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Genre, metadata.Genre), "Set Genre failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Duration, metadata.Duration), "Set Duration failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Date, metadata.Date), "Set Date failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Copyright, metadata.Copyright), "Set Copyright failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Description, metadata.Description), "Set Description failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.TrackNumber, metadata.TrackNumber), "Set TrackNumber failed"); + + MediaControllerValidator.ThrowIfError( + Native.SetMetadata(SafeHandle, MediaControllerAttributes.Picture, metadata.Picture), "Set Picture failed"); + + MediaControllerValidator.ThrowIfError( + Native.UpdateMetadata(SafeHandle), "UpdateMetadata Metadata failed"); + } + + /// + /// Update shuffle mode + /// 3 + /// shuffle mode + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void UpdateShuffleMode(MediaControllerShuffleMode mode) + { + MediaControllerValidator.ThrowIfError( + Native.UpdateShuffleMode(SafeHandle, mode), "Update Shuffle Mode failed"); + } + + /// + /// Update repeat mode + /// 3 + /// repeat mode + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void UpdateRepeatMode(MediaControllerRepeatMode mode) + { + MediaControllerValidator.ThrowIfError( + Native.UpdateRepeatMode(SafeHandle, mode), "Update Repeat Mode failed"); + } + + /// + /// Send reply for command from server to client + /// 3 + /// client name to recieve reply + /// result to run command + /// Bundle to send various data + /// Thrown when an invalid argument is used + /// Thrown when the operation is invalid for the current state + public void SendCustomCommandReply(string clientName, int result, Bundle bundle) + { + MediaControllerValidator.ThrowIfError( + Native.SendCommandReply(SafeHandle, clientName, result, bundle.SafeBundleHandle), "Send reply for command failed"); + } + + private void RegisterPlaybackCmdRecvEvent() + { + _playbackCommandCallback = (IntPtr clientName, MediaControllerPlaybackState state, IntPtr userData) => + { + PlaybackStateCommandEventArgs eventArgs = new PlaybackStateCommandEventArgs(Marshal.PtrToStringAnsi(clientName), state); + _playbackCommand?.Invoke(this, eventArgs); + }; + Native.SetPlaybackStateCmdRecvCb(SafeHandle, _playbackCommandCallback, IntPtr.Zero); + } + + private void UnregisterPlaybackCmdRecvEvent() + { + Native.UnsetPlaybackStateCmdRecvCb(SafeHandle); + } + + private void RegisterCustomCommandEvent() + { + _customCommandCallback = (IntPtr clientName, IntPtr command, IntPtr bundle, IntPtr userData) => + { + SafeBundleHandle safeBundleHandle = new SafeBundleHandle(bundle, true); + Bundle bundleData = new Bundle(safeBundleHandle); + CustomCommandEventArgs eventArgs = new CustomCommandEventArgs(Marshal.PtrToStringAnsi(clientName), Marshal.PtrToStringAnsi(command), bundleData); + _customCommand?.Invoke(this, eventArgs); + }; + Native.SetCustomCmdRecvCb(SafeHandle, _customCommandCallback, IntPtr.Zero); + } + + private void UnregisterCustomCommandEvent() + { + Native.UnsetCustomCmdRecvCb(SafeHandle); + } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs new file mode 100755 index 0000000..51a718c --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/MetadataUpdatedEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// MetadataUpdated event arguments + /// + /// + /// MetadataUpdated event arguments + /// + public class MetadataUpdatedEventArgs : EventArgs + { + internal MetadataUpdatedEventArgs(string name, IntPtr handle) + { + ServerName = name; + Metadata = new MediaControllerMetadata(handle); + } + + /// + /// Get the Server Name. + /// + /// 3 + public string ServerName { get; } + + /// + /// Get the Metadata information. + /// + /// 3 + public MediaControllerMetadata Metadata { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs new file mode 100755 index 0000000..339a90b --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackStateCommandEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// PlaybackStateCommand event arguments + /// + /// + /// PlaybackStateCommand event arguments + /// + public class PlaybackStateCommandEventArgs : EventArgs + { + internal PlaybackStateCommandEventArgs(string name, MediaControllerPlaybackState state) + { + ClientName = name; + State = state; + } + + /// + /// Get the Client Name. + /// + /// 3 + public string ClientName { get; } + + /// + /// Get the State of playback. + /// + /// 3 + public MediaControllerPlaybackState State { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs new file mode 100755 index 0000000..e6db63d --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/PlaybackUpdatedEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// PlaybackUpdated event arguments + /// + /// + /// PlaybackUpdated event arguments + /// + public class PlaybackUpdatedEventArgs : EventArgs + { + internal PlaybackUpdatedEventArgs(string name, IntPtr handle) + { + ServerName = name; + PlaybackInfo = new MediaControllerPlayback(handle); + } + + /// + /// Get the Server Name. + /// + /// 3 + public string ServerName { get; } + + /// + /// Get the Playback Information. + /// + /// 3 + public MediaControllerPlayback PlaybackInfo { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs new file mode 100755 index 0000000..e9abebd --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/RepeatModeUpdatedEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// RepeatModeUpdated event arguments + /// + /// + /// RepeatModeUpdated event arguments + /// + public class RepeatModeUpdatedEventArgs : EventArgs + { + internal RepeatModeUpdatedEventArgs(string name, MediaControllerRepeatMode mode) + { + ServerName = name; + RepeatMode = mode; + } + + /// + /// Get the Server Name. + /// + /// 3 + public string ServerName { get; } + + /// + /// Get the Repeat Mode. + /// + /// 3 + public MediaControllerRepeatMode RepeatMode { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs new file mode 100755 index 0000000..39684e8 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/ServerInformation.cs @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + /// + /// ServerInformation represents a name and state of server application. + /// + public class ServerInformation + { + internal ServerInformation(string name, MediaControllerServerState state) + { + Name = name; + State = state; + } + + /// + /// Get the Name of server + /// + /// 3 + public string Name { get; } + + /// + /// Get the State of server + /// + /// 3 + public MediaControllerServerState State { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs new file mode 100755 index 0000000..1fa8319 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/ServerUpdatedEventArgs.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// ServerUpdated event arguments + /// + /// + /// ServerUpdated event arguments + /// + public class ServerUpdatedEventArgs : EventArgs + { + internal ServerUpdatedEventArgs(string name, MediaControllerServerState state) + { + ServerInfo = new ServerInformation(name, state); + } + + /// + /// Get the Server Information. + /// + /// 3 + public ServerInformation ServerInfo { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs new file mode 100755 index 0000000..6d5a5c3 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/MediaController/ShuffleModeUpdatedEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Multimedia.MediaController +{ + + /// + /// ShuffleModeUpdated event arguments + /// + /// + /// ShuffleModeUpdated event arguments + /// + public class ShuffleModeUpdatedEventArgs : EventArgs + { + internal ShuffleModeUpdatedEventArgs(string name, MediaControllerShuffleMode mode) + { + ServerName = name; + ShuffleMode = mode; + } + + /// + /// Get the Server Name. + /// + /// 3 + public string ServerName { get; } + + /// + /// Get the Shuffle Mode. + /// + /// 3 + public MediaControllerShuffleMode ShuffleMode { get; } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/EventArgs.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/EventArgs.cs new file mode 100644 index 0000000..81332b1 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/EventArgs.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + public class ScreenMirroringStateChangedEventArgs : EventArgs + { + internal ScreenMirroringStateChangedEventArgs(ScreenMirroringState state) + { + State = state; + } + + /// + /// Gets the current state of screen mirroring. + /// + public ScreenMirroringState State { get; } + } + + /// + /// Provides data for the event. + /// + public class ScreenMirroringErrorOccurredEventArgs : EventArgs + { + internal ScreenMirroringErrorOccurredEventArgs(ScreenMirroringError error) + { + Error = error; + } + + /// + /// Gets the error that occurred. + /// + public ScreenMirroringError Error { get; } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/InteropHelper.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/InteropHelper.cs new file mode 100644 index 0000000..8e2a055 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/InteropHelper.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class InteropHelper + { + internal delegate ScreenMirroringErrorCode GetFunc(ref IntPtr handle, out T value); + + internal static ScreenMirroringErrorCode GetValue(GetFunc func, IntPtr handle, out T value) + { + return func(ref handle, out value); + } + } +} diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs new file mode 100644 index 0000000..c81fcf3 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs @@ -0,0 +1,533 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Native = Interop.ScreenMirroring; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to connect to and disconnect from a screen mirroring source, + /// start, pause, and resume the screen mirroring as a sink. + /// + public class ScreenMirroring : IDisposable, IDisplayable + { + private const string LogTag = "Tizen.Multimedia.ScreenMirroring"; + + private const int Port = 2022; + + private ScreenMirroringVideoInfo _videoInfo; + private ScreenMirroringAudioInfo _audioInfo; + private IntPtr _handle; + + private AtomicState _state; + + private bool _disposed = false; + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ScreenMirroring)); + } + + return _handle; + } + } + + /// + /// Initializes a new instance of the ScreenMirroring class. + /// + /// http://tizen.org/feature/network.wifi.direct.display + /// The feature is not supported. + public ScreenMirroring() + { + Native.Create(out _handle).ThrowIfError("Failed to create ScreenMirroring."); + + _state = new AtomicState(); + + _audioInfo = new ScreenMirroringAudioInfo(this); + _videoInfo = new ScreenMirroringVideoInfo(this); + + RegisterStateChangedEvent(); + + Log.Debug(LogTag, "screen mirroring sink created : " + _handle); + } + + ~ScreenMirroring() + { + Dispose(false); + } + + /// + /// Occurs when the state is changed. + /// + public event EventHandler StateChanged; + + /// + /// Occurs when an error occurs. + /// + public event EventHandler ErrorOccurred; + + #region Display support + + private Display _display; + + private void DetachDisplay() + { + if (_display != null) + { + _display.SetOwner(null); + _display = null; + } + } + + private void SetDisplay(Display display) + { + if (display == null) + { + throw new ArgumentNullException(nameof(Display)); + } + + display.SetOwner(this); + display.ApplyTo(this).ThrowIfError("Failed to set display."); + + _display = display; + } + + ScreenMirroringErrorCode IDisplayable.ApplyEvasDisplay(DisplayType type, + ElmSharp.EvasObject evasObject) + { + Debug.Assert(Enum.IsDefined(typeof(DisplayType), type)); + + return Native.SetDisplay(Handle, (int)type, evasObject); + } + #endregion + + /// + /// Gets the negotiated audio info. + /// + /// The if it has been connected, otherwise null. + public ScreenMirroringAudioInfo AudioInfo + { + get + { + if (IsConnected == false) + { + return null; + } + + return _audioInfo; + } + } + + /// + /// Gets the negotiated video info. + /// + /// The if it has been connected, otherwise null. + public ScreenMirroringVideoInfo VideoInfo + { + get + { + if (IsConnected == false) + { + return null; + } + + return _videoInfo; + } + } + + private bool IsConnected + { + get + { + return _state.IsOneOf(ScreenMirroringState.Connected, ScreenMirroringState.Playing, + ScreenMirroringState.Paused); + } + } + + /// + /// Prepares the screen mirroring with the specified display. + /// + /// + /// The state must be .\n + /// \n + /// All supported resolutions will be candidates. + /// + /// The display where the mirroring will be played on. + /// + /// has already been assigned to another. + /// + /// is null. + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + public void Prepare(Display display) + { + PrepareCore(display, (ScreenMirroringResolutions)0); + } + + /// + /// Prepares the screen mirroring with the specified display and resolutions. + /// + /// + /// The state must be . + /// + /// The display where the mirroring will be played on. + /// The desired resolutions. + /// + /// contain invalid flags.\n + /// -or-\n + /// has already been assigned to another. + /// + /// is null. + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + public void Prepare(Display display, ScreenMirroringResolutions resolutions) + { + ValidationUtil.ValidateFlagsEnum(resolutions, (ScreenMirroringResolutions)((1 << 7) - 1), nameof(resolutions)); + + PrepareCore(display, resolutions); + } + + private void PrepareCore(Display display, ScreenMirroringResolutions resolutions) + { + ValidateState(ScreenMirroringState.Idle); + + Native.SetResolution(Handle, resolutions).ThrowIfError("Failed to set resolutions."); + + try + { + SetDisplay(display); + + Native.Prepare(Handle).ThrowIfError("Failed to prepare."); + } + catch + { + DetachDisplay(); + throw; + } + } + + /// + /// Creates the connection and ready for receiving data from a mirroring source. + /// + /// The source ip address to connect. + /// + /// The state must be state by + /// . + /// + /// A task that represents the asynchronous operation. + /// http://tizen.org/privilege/internet + /// is null. + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// is a zero-length string, contains only white space. + /// The has already been disposed. + /// Caller does not have required permission. + public Task ConnectAsync(string sourceIp) + { + if (sourceIp == null) + { + throw new ArgumentNullException(nameof(sourceIp)); + } + + if (string.IsNullOrWhiteSpace(sourceIp)) + { + throw new ArgumentException($"{nameof(sourceIp)} is a zero-length string.", nameof(sourceIp)); + } + + ValidateState(ScreenMirroringState.Prepared); + + Native.SetIpAndPort(Handle, sourceIp, Port.ToString()).ThrowIfError("Failed to set ip."); + + var tcs = new TaskCompletionSource(); + + Task.Factory.StartNew(() => + { + Native.Connect(Handle).ThrowIfError("Failed to connect"); + tcs.SetResult(true); + }); + + return tcs.Task; + } + + /// + /// Starts mirroring from the source. + /// + /// + /// The state must be state by + /// . + /// + /// A task that represents the asynchronous operation. + /// http://tizen.org/privilege/internet + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + /// Caller does not have required permission. + public Task StartAsync() + { + ValidateState(ScreenMirroringState.Connected); + + var tcs = new TaskCompletionSource(); + + Task.Factory.StartNew(() => + { + Native.StartAsync(Handle).ThrowIfError("Failed to start."); + tcs.TrySetResult(true); + }); + + return tcs.Task; + } + + /// + /// Pauses mirroring from the source. + /// + /// + /// The state must be state by + /// . + /// + /// A task that represents the asynchronous operation. + /// http://tizen.org/privilege/internet + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + /// Caller does not have required permission. + public Task PauseAsync() + { + ValidateState(ScreenMirroringState.Playing); + + var tcs = new TaskCompletionSource(); + + Task.Factory.StartNew(() => + { + Native.PauseAsync(Handle).ThrowIfError("Failed to prepare."); + tcs.TrySetResult(true); + }); + + return tcs.Task; + } + + /// + /// Resumes mirroring from the source. + /// + /// + /// The state must be state by + /// . + /// + /// A task that represents the asynchronous operation. + /// http://tizen.org/privilege/internet + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + /// Caller does not have required permission. + public Task ResumeAsync() + { + ValidateState(ScreenMirroringState.Paused); + + var tcs = new TaskCompletionSource(); + + Task.Factory.StartNew(() => + { + Native.ResumeAsync(Handle).ThrowIfError("Failed to resume."); + tcs.TrySetResult(true); + }); + + return tcs.Task; + } + + /// + /// Disconnects from the source. + /// + /// + /// The state must be , + /// or . + /// + /// http://tizen.org/privilege/internet + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + /// Caller does not have required permission. + public void Disconnect() + { + ValidateState(ScreenMirroringState.Connected, ScreenMirroringState.Playing, + ScreenMirroringState.Paused); + + Native.Disconnect(Handle).ThrowIfError("Failed to disconnect."); + } + + /// + /// Unprepares the screen mirroring. + /// + /// + /// The state must be , + /// or . + /// + /// + /// The current state is not in the valid.\n + /// -or-\n + /// An internal error occurs. + /// + /// The has already been disposed. + public void Unprepare() + { + ValidateState(ScreenMirroringState.Prepared, ScreenMirroringState.Disconnected); + + Native.Unprepare(Handle).ThrowIfError("Failed to reset."); + + DetachDisplay(); + } + + /// + /// Releases all resource used by the object. + /// + /// + /// Call when you are finished using the . + /// The method leaves the in an unusable + /// state. After calling , you must release all references to the + /// so the garbage collector can reclaim the memory that the + /// was occupying. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the ScreenMirroring. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + DetachDisplay(); + + if (_handle != IntPtr.Zero) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _disposed = true; + } + } + + private Native.StateChangedCallback _stateChangedCallback; + + private void RegisterStateChangedEvent() + { + _stateChangedCallback = (_, state, error) => + { + var prevState = _state.Value; + + _state.Value = state; + + if (prevState != state) + { + StateChanged?.Invoke(this, new ScreenMirroringStateChangedEventArgs(state)); + + } + + if (error != ScreenMirroringErrorCode.None) + { + ErrorOccurred?.Invoke(this, new ScreenMirroringErrorOccurredEventArgs( + ScreenMirroringError.InvalidOperation)); + } + }; + + Native.SetStateChangedCb(Handle, _stateChangedCallback). + ThrowIfError("Failed to initialize StateChanged event."); + } + + private void ValidateState(params ScreenMirroringState[] required) + { + Debug.Assert(required.Length > 0); + + if (_disposed) + { + throw new ObjectDisposedException(nameof(ScreenMirroring)); + } + + var curState = _state.Value; + if (!required.Contains(curState)) + { + throw new InvalidOperationException($"The screen mirroring is not in a valid state. " + + $"Current State : { curState }, Valid State : { string.Join(", ", required) }."); + } + } + + } + + internal class AtomicState + { + private int _value; + + public AtomicState() + { + _value = (int)ScreenMirroringState.Idle; + } + + public ScreenMirroringState Value + { + get + { + return (ScreenMirroringState)Interlocked.CompareExchange(ref _value, 0, 0); + } + set + { + Interlocked.Exchange(ref _value, (int)value); + } + } + + public bool IsOneOf(params ScreenMirroringState[] states) + { + return states.Contains(Value); + } + } +} diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringAudioInfo.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringAudioInfo.cs new file mode 100644 index 0000000..28adf75 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringAudioInfo.cs @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Tizen.Multimedia.InteropHelper; +using Native = Interop.ScreenMirroring; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to retrieve the audio information which is negotiated with the source device. + /// + /// + public class ScreenMirroringAudioInfo + { + private readonly ScreenMirroring _owner; + + internal ScreenMirroringAudioInfo(ScreenMirroring owner) + { + _owner = owner; + } + + /// + /// Gets the negotiated audio codec. + /// + /// An internal error occurs. + /// The has already been disposed. + public ScreenMirroringAudioCodec Codec + { + get + { + GetValue(Native.GetNegotiatedAudioCodec, _owner.Handle, out ScreenMirroringAudioCodec value). + ThrowIfError("Failed to get audio codec."); + + return value; + } + } + + /// + /// Gets the negotiated audio channels. + /// + /// An internal error occurs. + /// The has already been disposed. + public int Channels + { + get + { + GetValue(Native.GetNegotiatedAudioChannel, _owner.Handle, out int value). + ThrowIfError("Failed to get audio channels."); + + return value; + } + } + + /// + /// Gets the negotiated audio sample rate. + /// + /// An internal error occurs. + /// The has already been disposed. + public int SampleRate + { + get + { + GetValue(Native.GetNegotiatedAudioSampleRate, _owner.Handle, out int value). + ThrowIfError("Failed to get audio sample rate."); + + return value; + } + } + + /// + /// Gets the negotiated audio bit width. + /// + /// An internal error occurs. + /// The has already been disposed. + public int BitWidth + { + get + { + GetValue(Native.GetNegotiatedAudioBitwidth, _owner.Handle, out int value). + ThrowIfError("Failed to get audio bit width."); + + return value; + } + } + } +} diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs new file mode 100644 index 0000000..eeaffad --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringEnums.cs @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Specifies audio codecs for . + /// + /// + public enum ScreenMirroringAudioCodec + { + /// + /// Screen mirroring is not negotiated yet. + /// + None, + /// + /// AAC codec for audio. + /// + Aac, + /// + /// AC3 codec for audio. + /// + Ac3, + /// + /// LPCM codec for audio. + /// + Lpcm + } + + /// + /// Specifies video codecs for . + /// + /// + public enum ScreenMirroringVideoCodec + { + /// + /// Screen mirroring is not negotiated yet. + /// + None, + /// + /// H.264 codec for video. + /// + H264 + } + + /// + /// Specifies available combinations of resolutions and fps for . + /// + [Flags] + public enum ScreenMirroringResolutions + { + /// + /// W-1920, H-1080, 30 fps. + /// + R1920x1080P30 = (1 << 0), + /// + /// W-1280, H-720, 30 fps. + /// + R1280x720P30 = (1 << 1), + /// + /// W-960, H-540, 30 fps. + /// + R960x540P30 = (1 << 2), + /// + /// W-864, H-480, 30 fps. + /// + R864x480P30 = (1 << 3), + /// + /// W-720, H-480, 60 fps. + /// + R720x480P60 = (1 << 4), + /// + /// W-640, H-480, 60 fps. + /// + R640x480P60 = (1 << 5), + /// + /// W-640, H-360, 30 fps. + /// + R640x360P30 = (1 << 6) + } + + /// + /// Specifies the states of . + /// + public enum ScreenMirroringState + { + /// + /// Idle. + /// + Idle = 1, + + /// + /// Prepared. + /// + /// + Prepared, + + /// + /// Connected to a source. + /// + /// + Connected, + + /// + /// Playing. + /// + /// + Playing, + + /// + /// Paused while playing media. + /// + /// + Paused, + + /// + /// Disconnected from source. + /// + /// + Disconnected + } + + /// + /// Specifies errors for . + /// + public enum ScreenMirroringError + { + /// + /// Invalid operation. + /// + InvalidOperation = ScreenMirroringErrorCode.InvalidOperation + } +} diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringError.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringError.cs new file mode 100644 index 0000000..805ca2a --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringError.cs @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum ScreenMirroringErrorCode + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidOperation = ErrorCode.InvalidOperation, + ConnectionTimeOut = ErrorCode.ConnectionTimeout, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + Unknown = ErrorCode.Unknown + } + + internal static class ScreenMirroringErrorExtensions + { + internal static void ThrowIfError(this ScreenMirroringErrorCode err, string message) + { + if (err == ScreenMirroringErrorCode.None) + { + return; + } + + switch (err) + { + case ScreenMirroringErrorCode.InvalidParameter: + throw new ArgumentException(message); + + case ScreenMirroringErrorCode.OutOfMemory: + throw new OutOfMemoryException(message); + + case ScreenMirroringErrorCode.PermissionDenied: + throw new UnauthorizedAccessException(message); + + case ScreenMirroringErrorCode.NotSupported: + throw new NotSupportedException(message); + + case ScreenMirroringErrorCode.InvalidOperation: + throw new InvalidOperationException(message); + + case ScreenMirroringErrorCode.ConnectionTimeOut: + throw new TimeoutException(message); + + default: + throw new InvalidOperationException($"Unknown error : {err.ToString()}."); + } + } + } +} + diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringVideoInfo.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringVideoInfo.cs new file mode 100644 index 0000000..62d4625 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroringVideoInfo.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Tizen.Multimedia.InteropHelper; +using Native = Interop.ScreenMirroring; + +namespace Tizen.Multimedia +{ + /// + /// Provides a means to retrieve the video information which is negotiated with the source device. + /// + public class ScreenMirroringVideoInfo + { + private readonly ScreenMirroring _owner; + + internal ScreenMirroringVideoInfo(ScreenMirroring owner) + { + _owner = owner; + } + + /// + /// Gets the negotiated video codec. + /// + /// An internal error occurs. + /// The has already been disposed. + public ScreenMirroringVideoCodec Codec + { + get + { + GetValue(Native.GetNegotiatedVideoCodec, _owner.Handle, out ScreenMirroringVideoCodec value). + ThrowIfError("Failed to get video codec."); + + return value; + } + } + + /// + /// Gets the negotiated video resolution. + /// + /// An internal error occurs. + /// The has already been disposed. + public Size Resolution + { + get + { + var handle = _owner.Handle; + Native.GetNegotiatedVideoResolution(ref handle, out var width, out var height). + ThrowIfError("Failed to get resolution."); + + return new Size(width, height); + } + } + + /// + /// Gets the negotiated video frame rate. + /// + /// An internal error occurs. + /// The has already been disposed. + public int FrameRate + { + get + { + GetValue(Native.GetNegotiatedVideoFrameRate, _owner.Handle, out int value). + ThrowIfError("Failed to get video frame rate."); + + return value; + } + } + } +} diff --git a/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.sln b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.sln new file mode 100755 index 0000000..65d9212 --- /dev/null +++ b/src/Tizen.Multimedia.Remoting/Tizen.Multimedia.Remoting.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Remoting", "Tizen.Multimedia.Remoting.csproj", "{916CC498-AC26-4D6E-8880-39D06512E584}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{CF568069-BFAA-492C-A523-CB213FEB2A77}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{85727CA5-D42F-472A-8F25-4B26590C5E1F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{BEB18EFD-181F-47BD-87F7-920B69C97E38}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{48FB3B03-212C-4206-A30A-C3CD82D31792}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{624D0C3F-9015-4CF7-8F92-E7FBE753C039}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {916CC498-AC26-4D6E-8880-39D06512E584}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {916CC498-AC26-4D6E-8880-39D06512E584}.Debug|Any CPU.Build.0 = Debug|Any CPU + {916CC498-AC26-4D6E-8880-39D06512E584}.Release|Any CPU.ActiveCfg = Release|Any CPU + {916CC498-AC26-4D6E-8880-39D06512E584}.Release|Any CPU.Build.0 = Release|Any CPU + {CF568069-BFAA-492C-A523-CB213FEB2A77}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CF568069-BFAA-492C-A523-CB213FEB2A77}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CF568069-BFAA-492C-A523-CB213FEB2A77}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CF568069-BFAA-492C-A523-CB213FEB2A77}.Release|Any CPU.Build.0 = Release|Any CPU + {85727CA5-D42F-472A-8F25-4B26590C5E1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85727CA5-D42F-472A-8F25-4B26590C5E1F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85727CA5-D42F-472A-8F25-4B26590C5E1F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85727CA5-D42F-472A-8F25-4B26590C5E1F}.Release|Any CPU.Build.0 = Release|Any CPU + {BEB18EFD-181F-47BD-87F7-920B69C97E38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BEB18EFD-181F-47BD-87F7-920B69C97E38}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BEB18EFD-181F-47BD-87F7-920B69C97E38}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BEB18EFD-181F-47BD-87F7-920B69C97E38}.Release|Any CPU.Build.0 = Release|Any CPU + {48FB3B03-212C-4206-A30A-C3CD82D31792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48FB3B03-212C-4206-A30A-C3CD82D31792}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48FB3B03-212C-4206-A30A-C3CD82D31792}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48FB3B03-212C-4206-A30A-C3CD82D31792}.Release|Any CPU.Build.0 = Release|Any CPU + {624D0C3F-9015-4CF7-8F92-E7FBE753C039}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {624D0C3F-9015-4CF7-8F92-E7FBE753C039}.Debug|Any CPU.Build.0 = Debug|Any CPU + {624D0C3F-9015-4CF7-8F92-E7FBE753C039}.Release|Any CPU.ActiveCfg = Release|Any CPU + {624D0C3F-9015-4CF7-8F92-E7FBE753C039}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..43f15f2 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string StreamRecorder = "libcapi-media-streamrecorder.so.0"; + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs new file mode 100644 index 0000000..dd79eab --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Interop/Interop.StreamRecorder.cs @@ -0,0 +1,186 @@ +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +internal static partial class Interop +{ + internal static partial class StreamRecorder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingLimitReachedCallback(StreamRecordingLimitType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecordingStatusCallback(ulong elapsedTime, ulong fileSize, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void NotifiedCallback(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notfication, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecorderErrorCallback(StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BufferConsumedCallback(IntPtr buffer, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoResolutionCallback(int width, int height, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FileFormatCallback(StreamRecorderFileFormat format, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool AudioEncoderCallback(StreamRecorderAudioCodec codec, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VideoEncoderCallback(StreamRecorderVideoCodec codec, IntPtr userData); + + /* begin of method */ + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_create")] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_prepare")] + internal static extern int Prepare(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unprepare")] + internal static extern int Unprepare(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_start")] + internal static extern int Start(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_pause")] + internal static extern int Pause(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_commit")] + internal static extern int Commit(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_cancel")] + internal static extern int Cancel(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_push_stream_buffer")] + internal static extern int PushStreamBuffer(IntPtr handle, IntPtr/* media_packet_h */ inbuf); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_enable_source_buffer")] + internal static extern int EnableSourceBuffer(IntPtr handle, int type); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_state")] + internal static extern int GetState(IntPtr handle, out int state); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_filename")] + internal static extern int SetFileName(IntPtr handle, string path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_filename")] + internal static extern int GetFileName(IntPtr handle, out IntPtr path); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_file_format")] + internal static extern int SetFileFormat(IntPtr handle, int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_file_format")] + internal static extern int GetFileFormat(IntPtr handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder")] + internal static extern int SetAudioEncoder(IntPtr handle, int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder")] + internal static extern int GetAudioEncoder(IntPtr handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder")] + internal static extern int SetVideoEncoder(IntPtr handle, int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder")] + internal static extern int GetVideoEncoder(IntPtr handle, out int codec); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_resolution")] + internal static extern int SetVideoResolution(IntPtr handle, int width, int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_resolution")] + internal static extern int GetVideoResolution(IntPtr handle, out int width, out int height); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_framerate")] + internal static extern int SetVideoFramerate(IntPtr handle, int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_framerate")] + internal static extern int GetVideoFramerate(IntPtr handle, out int framerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_source_format")] + internal static extern int SetVideoSourceFormat(IntPtr handle, int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_source_format")] + internal static extern int GetVideoSourceFormat(IntPtr handle, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit")] + internal static extern int SetRecordingLimit(IntPtr handle, int type, int limit); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_recording_limit")] + internal static extern int GetRecordingLimit(IntPtr handle, int type, out int format); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_samplerate")] + internal static extern int SetAudioSampleRate(IntPtr handle, int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_samplerate")] + internal static extern int GetAudioSampleRate(IntPtr handle, out int samplerate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_encoder_bitrate")] + internal static extern int SetAudioEncoderBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_encoder_bitrate")] + internal static extern int GetAudioEncoderBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_video_encoder_bitrate")] + internal static extern int SetVideoEncoderBitrate(IntPtr handle, int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_video_encoder_bitrate")] + internal static extern int GetVideoEncoderBitrate(IntPtr handle, out int bitrate); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_audio_channel")] + internal static extern int SetAudioChannel(IntPtr handle, int channel); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_get_audio_channel")] + internal static extern int GetAudioChannel(IntPtr handle, out int channel); + /* End of method */ + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_file_format")] + internal static extern int FileFormats(IntPtr handle, FileFormatCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_audio_encoder")] + internal static extern int AudioEncoders(IntPtr handle, AudioEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_encoder")] + internal static extern int VideoEncoders(IntPtr handle, VideoEncoderCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_foreach_supported_video_resolution")] + internal static extern int VideoResolution(IntPtr handle, VideoResolutionCallback callback, IntPtr userData); + /* End of foreach method */ + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_notify_cb")] + internal static extern int SetNotifiedCallback(IntPtr handle, NotifiedCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_notify_cb")] + internal static extern int UnsetNotifiedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_status_cb")] + internal static extern int SetStatusChangedCallback(IntPtr handle, RecordingStatusCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_status_cb")] + internal static extern int UnsetStatusChangedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_recording_limit_reached_cb")] + internal static extern int SetLimitReachedCallback(IntPtr handle, RecordingLimitReachedCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_recording_limit_reached_cb")] + internal static extern int UnsetLimitReachedCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_error_cb")] + internal static extern int SetErrorCallback(IntPtr handle, RecorderErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_error_cb")] + internal static extern int UnsetErrorCallback(IntPtr handle); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_set_buffer_consume_completed_cb")] + internal static extern int SetBufferConsumedCallback(IntPtr handle, BufferConsumedCallback callback, IntPtr userDat); + + [DllImport(Libraries.StreamRecorder, EntryPoint = "streamrecorder_unset_buffer_consume_completed_cb")] + internal static extern int UnsetBufferConsumedCallback(IntPtr handle); + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs new file mode 100644 index 0000000..c534d6c --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorder.cs @@ -0,0 +1,1054 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + static internal class StreamRecorderLog + { + internal const string Tag = "Tizen.Multimedia.StreamRecorder"; + } + + /// + /// Provides methods to control stream recorder. + /// + /// + /// StreamRecorder class provides functions to record raw image frame + /// also provides recording start, stop and save the content etc. + /// + public class StreamRecorder : IDisposable + { + private IntPtr _handle; + private bool _disposed = false; + /// + /// Occurred when recording is progressing for recording status. + /// + private EventHandler _recordingStatusChanged; + private Native.RecordingStatusCallback _recordingStatusCallback; + /// + /// Occurred when recording time or size reach limit. + /// + private EventHandler _recordingLimitReached; + private Native.RecordingLimitReachedCallback _recordingLimitReachedCallback; + /// + /// Occurred when streamrecorder complete to use pushed buffer. + /// + private EventHandler _bufferConsumed; + private Native.BufferConsumedCallback _bufferConsumedCallback; + /// + /// Occurred when streamrecorder state is changed. + /// + private EventHandler _recorderNotified; + private Native.NotifiedCallback _notifiedCallback; + /// + /// Occurred when error is occured. + /// + private EventHandler _recordingErrorOccurred; + private Native.RecorderErrorCallback _recorderErrorCallback; + + private List _formats; + private List _audioCodec; + private List _videoCodec; + private List _resolutions; + StreamRecorderVideoResolution _videoResolution = null; + + /// + /// Stream recorder constructor. + /// + public StreamRecorder() + { + int ret = Native.Create(out _handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to create stream recorder"); + } + _formats = new List(); + _audioCodec = new List(); + _videoCodec = new List(); + _resolutions = new List(); + _videoResolution = new StreamRecorderVideoResolution(_handle); + } + + /// + /// Stream recorder destructor. + /// + ~StreamRecorder() + { + Dispose(false); + } + + /// + /// Event that occurs when streamrecorder state is changed. + /// + public event EventHandler RecorderNotified + { + add + { + if (_recorderNotified == null) + { + RegisterStreamRecorderNotifiedEvent(); + } + _recorderNotified += value; + } + remove + { + _recorderNotified -= value; + if (_recorderNotified == null) + { + UnregisterStreamRecorderNotifiedEvent(); + } + } + } + + /// + /// Event that occurs when buffer had comsumed completely. + /// + public event EventHandler BufferConsumed + { + add + { + if (_bufferConsumed == null) + { + RegisterBufferComsumedEvent(); + } + _bufferConsumed += value; + } + remove + { + _bufferConsumed -= value; + if (_bufferConsumed == null) + { + UnregisterBufferComsumedEvent(); + } + } + } + + /// + /// Event that occurs when recording status changed. + /// + public event EventHandler RecordingStatusChanged + { + add + { + if (_recordingStatusChanged == null) + { + RegisterRecordingStatusChangedEvent(); + } + _recordingStatusChanged += value; + } + remove + { + _recordingStatusChanged -= value; + if (_recordingStatusChanged == null) + { + UnregisterRecordingStatusChangedEvent(); + } + } + } + + /// + /// Event that occurs when recording limit is reached. + /// + public event EventHandler RecordingLimitReached + { + add + { + if (_recordingLimitReached == null) + { + RegisterRecordingLimitReachedEvent(); + } + _recordingLimitReached += value; + } + remove + { + _recordingLimitReached -= value; + if (_recordingLimitReached == null) + { + UnregisterRecordingLimitReachedEvent(); + } + } + } + + /// + /// Event that occurs when an error occured during recorder operation. + /// + public event EventHandler RecordingErrorOccurred + { + add + { + if (_recordingErrorOccurred == null) + { + RegisterRecordingErrorOccurredEvent(); + } + _recordingErrorOccurred += value; + } + remove + { + _recordingErrorOccurred -= value; + if (_recordingErrorOccurred == null) + { + UnregisterRecordingErrorOccurredEvent(); + } + } + } + + /// + /// The file path to record. + /// + /// + /// If the same file already exists in the file system, then old file + /// will be overwritten. + /// + public string FilePath + { + get + { + IntPtr val; + int ret = Native.GetFileName(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get filepath, " + (StreamRecorderError)ret); + } + string result = Marshal.PtrToStringAnsi(val); + LibcSupport.Free(val); + return result; + } + set + { + int ret = Native.SetFileName(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set filepath, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set filepath"); + } + } + } + + /// + /// Get the current state of the stream recorder. + /// + /// The current state of stream recorder. + public StreamRecorderState State + { + get + { + int val = 0; + + int ret = Native.GetState(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get stream recorder state, " + (StreamRecorderError)ret); + } + return (StreamRecorderState)val; + } + } + + /// + /// Get/Set the file format for recording media stream. + /// + /// + /// Must set . + /// The recorder state must be state. + /// + /// The format does not valid. + /// + public StreamRecorderFileFormat FileFormat + { + get + { + int val = 0; + + int ret = Native.GetFileFormat(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get file format, " + (StreamRecorderError)ret); + } + return (StreamRecorderFileFormat)val; + } + set + { + int ret = Native.SetFileFormat(_handle, (int)value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set file format, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); + } + } + } + + /// + /// The audio codec for encoding an audio stream. + /// + /// + /// Must set or + /// by + /// + /// The codec does not valid. + /// + public StreamRecorderAudioCodec AudioCodec + { + get + { + int val = 0; + + int ret = Native.GetAudioEncoder(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get audio codec, " + (StreamRecorderError)ret); + } + return (StreamRecorderAudioCodec)val; + } + set + { + int ret = Native.SetAudioEncoder(_handle, (int)value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set audio codec, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); + } + } + } + + /// + /// The video codec for encoding video stream. + /// + /// + /// Must set or + /// by + /// + /// The codec does not valid. + /// + public StreamRecorderVideoCodec VideoCodec + { + get + { + int val = 0; + + int ret = Native.GetVideoEncoder(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get video codec, " + (StreamRecorderError)ret); + } + return (StreamRecorderVideoCodec)val; + } + set + { + int ret = Native.SetVideoEncoder(_handle, (int)value); + + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set video codec, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); + } + } + } + + /// + /// The maximum size of a recording file in KB(kilobytes). If 0, means + /// unlimited recording size. + /// + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// The recorder state must be state. + /// + /// The value set to below 0. + /// + public int SizeLimit + { + get + { + int val = 0; + + int ret = Native.GetRecordingLimit(_handle, 1, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get size limit, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetRecordingLimit(_handle, 1, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set sizelimit, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set size limit"); + } + } + } + + /// + /// The time limit of a recording file in Seconds. If 0, means unlimited recording + /// time. + /// + /// + /// After reaching the limitation, the data which is being recorded will + /// be discarded and not written to the file. + /// The recorder state must be state. + /// + /// The value set to below 0. + /// + public int TimeLimit + { + get + { + int val = 0; + + int ret = Native.GetRecordingLimit(_handle, 0, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get time limit, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetRecordingLimit(_handle, 0, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set timelimit, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set time limit"); + } + } + } + + /// + /// The sampling rate of an audio stream in hertz. + /// + /// + /// The recorder state must be state. + /// Must set or + /// by . + /// + /// The value set to below 0. + public int AudioSampleRate + { + get + { + int val = 0; + + int ret = Native.GetAudioSampleRate(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get audio samplerate, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetAudioSampleRate(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set audio samplerate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio samplerate"); + } + } + } + + /// + /// The bitrate of an audio encoder in bits per second. + /// + /// + /// The recorder state must be state. + /// Must set or + /// by + /// + /// The value set to below 0. + public int AudioBitRate + { + get + { + int val = 0; + + int ret = Native.GetAudioEncoderBitrate(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get audio bitrate, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetAudioEncoderBitrate(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set audio bitrate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio bitrate"); + } + } + } + + /// + /// The bitrate of an video encoder in bits per second. + /// + /// + /// The recorder state must be state. + /// Must set or + /// by + /// + /// The value set to below 0. + public int VideoBitRate + { + get + { + int val = 0; + + int ret = Native.GetVideoEncoderBitrate(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get video bitrate, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetVideoEncoderBitrate(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set video bitrate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set video bitrate"); + } + } + } + + /// + /// The video frame rate for recording media stream. + /// + /// + /// The recorder state must be state. + /// Must set or + /// by + /// + /// The value set to below 0. + public int VideoFrameRate + { + get + { + int val = 0; + + int ret = Native.GetVideoFramerate(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetVideoFramerate(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); + } + } + } + + /// + /// Get or Set the video source format for recording media stream. + /// + /// The value set to a invalid value. + /// + public StreamRecorderVideoSourceFormat VideoSourceFormat + { + get + { + int val = 0; + + int ret = Native.GetVideoSourceFormat(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get video framerate, " + (StreamRecorderError)ret); + } + return (StreamRecorderVideoSourceFormat)val; + } + set + { + int ret = Native.SetVideoSourceFormat(_handle, (int)value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set video framerate, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret); + } + } + } + + /// + /// The number of audio channel. + /// + /// + /// The attribute is applied only in Created state. + /// For mono recording, set channel to 1. + /// For stereo recording, set channel to 2. + /// The recorder state must be state. + /// + /// The value set to a invalid value. + public int AudioChannel + { + get + { + int val = 0; + + int ret = Native.GetAudioChannel(_handle, out val); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to get audio channel, " + (StreamRecorderError)ret); + } + return val; + } + set + { + int ret = Native.SetAudioChannel(_handle, value); + if ((StreamRecorderError)ret != StreamRecorderError.None) + { + Log.Error(StreamRecorderLog.Tag, "Failed to set audio channel, " + (StreamRecorderError)ret); + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set audio channel"); + } + } + } + + /// + /// Video resolution of the video recording. + /// + /// + /// Must set or + /// by + /// The recorder state must be state. + /// + /// The value set to a invalid value. + /// + public StreamRecorderVideoResolution Resolution + { + get + { + return _videoResolution; + } + } + + /// + /// Retrieves all the file formats supported by the stream recorder. + /// + /// + /// It returns a list containing all the supported file + /// formats by Stream recorder. + /// + /// + public IEnumerable SupportedFileFormats + { + get + { + if (_formats.Count == 0) + { + Native.FileFormatCallback callback = (StreamRecorderFileFormat format, IntPtr userData) => + { + _formats.Add(format); + return true; + }; + int ret = Native.FileFormats(_handle, callback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported fileformats"); + } + } + return _formats; + } + } + + /// + /// Retrieves all the audio encoders supported by the recorder. + /// + /// + /// It returns a list containing all the supported audio encoders + /// by recorder. + /// + /// + public IEnumerable SupportedAudioEncodings + { + get + { + if (_audioCodec.Count == 0) + { + Native.AudioEncoderCallback callback = (StreamRecorderAudioCodec codec, IntPtr userData) => + { + _audioCodec.Add(codec); + return true; + }; + int ret = Native.AudioEncoders(_handle, callback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported audio encoders"); + } + } + return _audioCodec; + } + } + + /// + /// Retrieves all the video encoders supported by the recorder. + /// + /// + /// It returns a list containing all the supported video encoders + /// by recorder. + /// + /// + public IEnumerable SupportedVideoEncodings + { + get + { + if (_videoCodec.Count == 0) + { + Native.VideoEncoderCallback callback = (StreamRecorderVideoCodec codec, IntPtr userData) => + { + _videoCodec.Add(codec); + return true; + }; + int ret = Native.VideoEncoders(_handle, callback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video encoders"); + } + } + return _videoCodec; + } + } + + /// + /// Retrieves all the video resolutions supported by the recorder. + /// + /// + /// It returns videoresolution list containing the width and height of + /// different resolutions supported by recorder. + /// + /// + public IEnumerable SupportedVideoResolutions + { + get + { + if (_resolutions.Count == 0) + { + Native.VideoResolutionCallback callback = (int width, int height, IntPtr userData) => + { + StreamRecorderVideoResolution temp = new StreamRecorderVideoResolution(width, height); + _resolutions.Add(temp); + return true; + }; + int ret = Native.VideoResolution(_handle, callback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to get the supported video resolutions"); + } + } + return _resolutions; + } + } + + /// + /// Prepare the stream recorder. + /// + /// + /// Before calling the function, it is required to set , + /// , and properties of recorder. + /// + /// The streamrecorder is not in the valid state. + /// + public void Prepare() + { + int ret = Native.Prepare(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to prepare stream recorder"); + } + } + + /// + /// Resets the stream recorder. + /// + /// + /// The recorder state must be state by , and . + /// The StreamRecorder state will be . + /// + /// The streamrecorder is not in the valid state. + /// + public void Unprepare() + { + int ret = Native.Unprepare(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to reset the stream recorder"); + } + } + + /// + /// Starts the recording. + /// + /// + /// If file path has been set to an existing file, this file is removed automatically and updated by new one. + /// The filename should be set before this function is invoked. + /// The recorder state must be state by or + /// state by . + /// The filename shuild be set by + /// + /// The streamrecorder is not in the valid state. + /// The access ot the resources can not be granted. + /// + /// + /// + /// + /// + public void Start() + { + int ret = Native.Start(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to start the stream recorder"); + } + } + + /// + /// Pause the recording. + /// + /// + /// Recording can be resumed with . + /// + /// The streamrecorder is not in the valid state. + /// + /// + /// + public void Pause() + { + int ret = Native.Pause(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to pause the stream recorder"); + } + } + + /// + /// Stops recording and saves the result. + /// + /// + /// The recorder state must be state by or + /// state by + /// When you want to record audio or video file, you need to add privilege according to rules below additionally. + /// + /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// + /// + /// The streamrecorder is not in the valid state. + /// The access ot the resources can not be granted. + /// + /// + public void Commit() + { + int ret = Native.Commit(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to save the recorded content"); + } + } + + /// + /// Cancels the recording. + /// The recording data is discarded and not written in the recording file. + /// + /// + /// + public void Cancel() + { + int ret = Native.Cancel(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to cancel the recording"); + } + } + + /// + /// Push stream buffer as recording raw data. + /// + public void PushBuffer(MediaPacket packet) + { + IntPtr _packet_h = packet.GetHandle(); + + Log.Info("Tizen.Multimedia.StreamRecorder", "PUSH stream buffer"); + int ret = Native.PushStreamBuffer(_handle, _packet_h); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to push buffer"); + } + Log.Info("Tizen.Multimedia.StreamRecorder", "PUSH stream buffer END"); + } + + /// + /// Set the source type of pushed data. + /// + public void EnableSourceBuffer(StreamRecorderSourceType type) + { + int ret = Native.EnableSourceBuffer(_handle, (int)type); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Failed to set EnableSourceBuffer"); + } + } + + /// + /// Release any unmanaged resources used by this object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (disposing) + { + // to be used if there are any other disposable objects + } + if (_handle != IntPtr.Zero) + { + Native.Destroy(_handle); + _handle = IntPtr.Zero; + } + _disposed = true; + } + } + + private void RegisterStreamRecorderNotifiedEvent() + { + _notifiedCallback = (StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notify, IntPtr userData) => + { + StreamRecorderNotifiedEventArgs eventArgs = new StreamRecorderNotifiedEventArgs(previous, current, notify); + _recorderNotified?.Invoke(this, eventArgs); + }; + int ret = Native.SetNotifiedCallback(_handle, _notifiedCallback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Setting notify callback failed"); + } + } + + private void UnregisterStreamRecorderNotifiedEvent() + { + int ret = Native.UnsetNotifiedCallback(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting notify callback failed"); + } + } + + private void RegisterBufferComsumedEvent() + { + _bufferConsumedCallback = (IntPtr buffer, IntPtr userData) => + { + StreamRecordingBufferConsumedEventArgs eventArgs = new StreamRecordingBufferConsumedEventArgs(buffer); + _bufferConsumed?.Invoke(this, eventArgs); + }; + int ret = Native.SetBufferConsumedCallback(_handle, _bufferConsumedCallback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Setting buffer consumed callback failed"); + } + } + + private void UnregisterBufferComsumedEvent() + { + int ret = Native.UnsetBufferConsumedCallback(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting buffer consumed callback failed"); + } + } + + private void RegisterRecordingStatusChangedEvent() + { + _recordingStatusCallback = (ulong elapsedTime, ulong fileSize, IntPtr userData) => + { + RecordingProgressEventArgs eventArgs = new RecordingProgressEventArgs(elapsedTime, fileSize); + _recordingStatusChanged?.Invoke(this, eventArgs); + }; + int ret = Native.SetStatusChangedCallback(_handle, _recordingStatusCallback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Setting status changed callback failed"); + } + } + + private void UnregisterRecordingStatusChangedEvent() + { + int ret = Native.UnsetStatusChangedCallback(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting status changed callback failed"); + } + } + + private void RegisterRecordingLimitReachedEvent() + { + _recordingLimitReachedCallback = (StreamRecordingLimitType type, IntPtr userData) => + { + StreamRecordingLimitReachedEventArgs eventArgs = new StreamRecordingLimitReachedEventArgs(type); + _recordingLimitReached?.Invoke(this, eventArgs); + }; + int ret = Native.SetLimitReachedCallback(_handle, _recordingLimitReachedCallback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Setting limit reached callback failed"); + } + } + + private void UnregisterRecordingLimitReachedEvent() + { + int ret = Native.UnsetLimitReachedCallback(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting limit reached callback failed"); + } + } + + private void RegisterRecordingErrorOccurredEvent() + { + _recorderErrorCallback = (StreamRecorderErrorCode error, StreamRecorderState current, IntPtr userData) => + { + StreamRecordingErrorOccurredEventArgs eventArgs = new StreamRecordingErrorOccurredEventArgs(error, current); + _recordingErrorOccurred?.Invoke(this, eventArgs); + }; + int ret = Native.SetErrorCallback(_handle, _recorderErrorCallback, IntPtr.Zero); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Setting Error callback failed"); + } + } + + private void UnregisterRecordingErrorOccurredEvent() + { + int ret = Native.UnsetErrorCallback(_handle); + if (ret != (int)StreamRecorderError.None) + { + StreamRecorderErrorFactory.ThrowException(ret, "Unsetting Error callback failed"); + } + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs new file mode 100644 index 0000000..58b6511 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderEnums.cs @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for Audio Codec. + /// + public enum StreamRecorderAudioCodec + { + /// + /// AMR codec. + /// + Amr = 0, + /// + /// AAC codec. + /// + Aac, + /// + /// PCM codec. + /// + Pcm + } + + /// + /// Enumeration for the file container format. + /// + public enum StreamRecorderFileFormat + { + /// + /// 3GP file format. + /// + ThreeGp, + /// + /// MP4 file format. + /// + Mp4, + /// + /// AMR file format. + /// + Amr, + /// + /// ADTS file format. + /// + Adts, + /// + /// WAV file format. + /// + Wav + } + + /// + /// Enumeration for the recorder notify type. + /// + public enum StreamRecorderNotify + { + /// + /// None. + /// + None = 0, + /// + /// State changed noti. + /// + StateChanged + } + + /// + /// Enumeration for the recording limit type. + /// + public enum StreamRecordingLimitType + { + /// + /// Time limit in seconds of recording file + /// + Time, + /// + /// Size limit in KB(KiloBytes) of recording file. + /// + Size + } + + /// + /// Enumeration for stream recorder states. + /// + public enum StreamRecorderState + { + /// + /// Stream recorder is not created. + /// + None, + /// + /// Stream recorder is created, but not prepared. + /// + Created, + /// + /// Stream recorder is ready to record. + /// + Prepared, + /// + /// Stream recorder is recording pushed packet. + /// + Recording, + /// + /// Stream recorder is paused. + /// + Paused + } + + /// + /// Enumeration for video codec. + /// + public enum StreamRecorderVideoCodec + { + /// + /// H263 codec. + /// + H263, + /// + /// MPEG4 codec. + /// + Mpeg4 + } + + /// + /// Enumeration for source type. + /// + public enum StreamRecorderSourceType + { + /// + /// Video source + /// + Video, + /// + /// Audio source + /// + Audio, + /// + /// Audio/Video both + /// + VideoAudio + } + + /// + /// Enumeration for video source format. + /// + public enum StreamRecorderVideoSourceFormat + { + /// + /// Nv12 Video source format + /// + Nv12, + /// + /// Nv21 video source format + /// + Nv21, + /// + /// I420 video source format + /// + I420 + } + + /// + /// Enumeration for stream recorder failure error. + /// + public enum StreamRecorderErrorCode + { + /// + /// Sucessful. + /// + None = StreamRecorderError.None, + /// + /// Internal error. + /// + InvalidParameter = StreamRecorderError.InvalidParameter, + /// + /// Internal error. + /// + InvalidOperation = StreamRecorderError.InvalidOperation, + /// + /// Out of memory. + /// + OutOfMemory = StreamRecorderError.OutOfMemory + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs new file mode 100644 index 0000000..d16b7c2 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderErrorFactory.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal enum StreamRecorderError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + TizenErrorStreamRecorder = -0x01A10000, + InvalidState = TizenErrorStreamRecorder | 0x01, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidOperation = ErrorCode.InvalidOperation, + OutOfStorage = TizenErrorStreamRecorder | 0x02, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + } + + internal static class StreamRecorderErrorFactory + { + internal static void ThrowException(int errorCode, string errorMessage = null, string paramName = null) + { + StreamRecorderError err = (StreamRecorderError)errorCode; + if(string.IsNullOrEmpty(errorMessage)) { + errorMessage = err.ToString(); + } + switch((StreamRecorderError)errorCode) { + case StreamRecorderError.InvalidParameter: + throw new ArgumentException(errorMessage, paramName); + case StreamRecorderError.OutOfMemory: + throw new OutOfMemoryException(errorMessage); + case StreamRecorderError.PermissionDenied: + throw new UnauthorizedAccessException(errorMessage); + case StreamRecorderError.NotSupported: + throw new NotSupportedException(errorMessage); + case StreamRecorderError.InvalidState: + case StreamRecorderError.InvalidOperation: + case StreamRecorderError.OutOfStorage: + throw new InvalidOperationException(errorMessage); + } + } + } +} + diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs new file mode 100644 index 0000000..0ac92f7 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderNotifiedEventArgs.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// An extended Eventargs class which contains interrupted policy details, previous and current + /// state of the recorder. + /// + public class StreamRecorderNotifiedEventArgs : EventArgs + { + private StreamRecorderState _previous = StreamRecorderState.None; + private StreamRecorderState _current = StreamRecorderState.None; + private StreamRecorderNotify _notify = StreamRecorderNotify.None; + + internal StreamRecorderNotifiedEventArgs(StreamRecorderState previous, StreamRecorderState current, StreamRecorderNotify notify) + { + _previous = previous; + _current = current; + _notify = notify; + } + + /// + /// The previous state of the stream recorder. + /// + public StreamRecorderState Previous { + get { + return _previous; + } + } + + /// + /// The current state of the stream recorder. + /// + public StreamRecorderState Current { + get { + return _current; + } + } + + /// + /// The notify of the event. + /// + public StreamRecorderNotify Notify { + get { + return _notify; + } + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs new file mode 100644 index 0000000..8523098 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecorderVideoResolution.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Native = Interop.StreamRecorder; + +namespace Tizen.Multimedia +{ + /// + /// Resolution for stream recorder. + /// + public class StreamRecorderVideoResolution + { + private int _width, _height; + private bool _interopFlag; + internal IntPtr _Handle; + + internal StreamRecorderVideoResolution(IntPtr handle) + { + _Handle = handle; + _interopFlag = true; + int ret = Native.GetVideoResolution(_Handle, out _width, out _height); + StreamRecorderError err = (StreamRecorderError)ret; + Log.Info(StreamRecorderLog.Tag, "width " + _width + " height " + _height + "return " + err.ToString()); + } + + internal StreamRecorderVideoResolution(int width, int height) + { + _interopFlag = false; + _width = width; + _height = height; + } + + /// + /// The video width. + /// + /// The width. + public int Width { + get { + if(_interopFlag == true) + Native.GetVideoResolution(_Handle, out _width, out _height); + return _width; + } + set { + _width = value; + if(_interopFlag == true) { + int ret = Native.SetVideoResolution(_Handle, _width, _height); + StreamRecorderError err = (StreamRecorderError)ret; + Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); + } + } + } + + /// + /// The video height. + /// + /// The height. + public int Height { + get { + if(_interopFlag == true) + Native.GetVideoResolution(_Handle, out _width, out _height); + return _height; + } + set { + _height = value; + if(_interopFlag == true) { + int ret = Native.SetVideoResolution(_Handle, _width, _height); + StreamRecorderError err = (StreamRecorderError)ret; + Log.Info(StreamRecorderLog.Tag, " set width " + _width + " height " + _height + "set return " + err.ToString()); + } + } + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs new file mode 100644 index 0000000..3628849 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingBufferConsumedEventArgs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs. + /// + public class StreamRecordingBufferConsumedEventArgs : EventArgs + { + private IntPtr _buffer = IntPtr.Zero; + + internal StreamRecordingBufferConsumedEventArgs(IntPtr buffer) + { + _buffer = buffer; + } + + /// + /// Consumed buffer. + /// + public IntPtr Buffer { + get { + return _buffer; + } + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs new file mode 100644 index 0000000..ea127b7 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingErrorOccurredEventArgs.cs @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class which contains details about error status and + /// state of the recorder when it failed. + /// + public class StreamRecordingErrorOccurredEventArgs : EventArgs + { + private StreamRecorderErrorCode _error = StreamRecorderErrorCode.InvalidOperation; + private StreamRecorderState _state = StreamRecorderState.None; + + internal StreamRecordingErrorOccurredEventArgs(StreamRecorderErrorCode error, StreamRecorderState state) + { + _error = error; + _state = state; + } + + /// + /// The error code. + /// + public StreamRecorderErrorCode Error { + get { + return _error; + } + } + + /// + /// The state of the recorder. + /// + public StreamRecorderState State { + get { + return _state; + } + } + + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs new file mode 100644 index 0000000..9b12fdc --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/StreamRecorder/StreamRecordingLimitReachedEventArgs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// An extended EventArgs class containing details about the recording limit. + /// + public class StreamRecordingLimitReachedEventArgs : EventArgs + { + private StreamRecordingLimitType _type = StreamRecordingLimitType.Size; + + internal StreamRecordingLimitReachedEventArgs(StreamRecordingLimitType type) + { + _type = type; + } + + /// + /// The limitation type. + /// + public StreamRecordingLimitType Type { + get { + return _type; + } + } + } +} diff --git a/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj new file mode 100644 index 0000000..6738590 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.sln b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.sln new file mode 100755 index 0000000..c7f1d41 --- /dev/null +++ b/src/Tizen.Multimedia.StreamRecorder/Tizen.Multimedia.StreamRecorder.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.StreamRecorder", "Tizen.Multimedia.StreamRecorder.csproj", "{E637475F-BFC1-40F3-A903-D548C240F677}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Recorder", "..\Tizen.Multimedia.Recorder\Tizen.Multimedia.Recorder.csproj", "{FF4886B5-3225-40C5-9314-1193E0ECAEDF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{C983A5CA-797B-4C30-B9E0-A7A4B1275D88}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AF762B89-151B-413B-B289-9909ABA04371}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{1413EA41-9936-41A5-9BCF-9E1DA243DB7B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E637475F-BFC1-40F3-A903-D548C240F677}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E637475F-BFC1-40F3-A903-D548C240F677}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E637475F-BFC1-40F3-A903-D548C240F677}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E637475F-BFC1-40F3-A903-D548C240F677}.Release|Any CPU.Build.0 = Release|Any CPU + {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FF4886B5-3225-40C5-9314-1193E0ECAEDF}.Release|Any CPU.Build.0 = Release|Any CPU + {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C983A5CA-797B-4C30-B9E0-A7A4B1275D88}.Release|Any CPU.Build.0 = Release|Any CPU + {AF762B89-151B-413B-B289-9909ABA04371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF762B89-151B-413B-B289-9909ABA04371}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF762B89-151B-413B-B289-9909ABA04371}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF762B89-151B-413B-B289-9909ABA04371}.Release|Any CPU.Build.0 = Release|Any CPU + {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1413EA41-9936-41A5-9BCF-9E1DA243DB7B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Util/ImageUtil/BitmapFrame.cs b/src/Tizen.Multimedia.Util/ImageUtil/BitmapFrame.cs new file mode 100644 index 0000000..d964786 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/BitmapFrame.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia.Util +{ + /// + /// Represents image data returned by a decoder class. + /// + public class BitmapFrame + { + internal BitmapFrame(IntPtr nativeBuffer, int width, int height, int size) + { + Debug.Assert(nativeBuffer != IntPtr.Zero); + + byte[] buf = new byte[size]; + Marshal.Copy(nativeBuffer, buf, 0, size); + + Buffer = buf; + + Size = new Size(width, height); + } + + /// + /// Gets the raw image data. + /// + public byte[] Buffer { get; } + + /// + /// Gets the size of the image. + /// + public Size Size { get; } + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/GifFrame.cs b/src/Tizen.Multimedia.Util/ImageUtil/GifFrame.cs new file mode 100644 index 0000000..48a8896 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/GifFrame.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia.Util +{ + /// + /// Represent gif image data used to encode a gif image with . + /// + public class GifFrame + { + + /// + /// Initialize a new instance of the class with a buffer and a delay. + /// + /// The raw image buffer to be encoded. + /// The delay for this image, in 0.001 sec units. + /// is null. + /// The length of is zero. + public GifFrame(byte[] buffer, uint delay) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (buffer.Length == 0) + { + throw new ArgumentException("buffer has no element.", nameof(buffer)); + } + + Buffer = buffer; + Delay = delay; + } + + /// + /// Gets the raw image data. + /// + public byte[] Buffer { get; } + + /// + /// Gets or sets the delay for this image. + /// + /// Time delay in 0.001 sec units. + public uint Delay { get; set; } + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageColorSpace.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageColorSpace.cs new file mode 100644 index 0000000..0572e09 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageColorSpace.cs @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; + +namespace Tizen.Multimedia.Util +{ + internal enum ImageColorSpace + { + /// + /// YV12 - YCrCb planar format + /// + YV12, + /// + /// YUV422 - planar + /// + Yuv422, + /// + /// YUV420 - planar + /// + I420, + /// + /// NV12- planar + /// + NV12, + /// + /// UYVY - packed + /// + Uyvy, + /// + /// YUYV - packed + /// + Yuyv, + /// + /// RGB565, high-byte is Blue + /// + Rgb565, + /// + /// RGB888, high-byte is Blue + /// + Rgb888, + /// + /// ARGB8888, high-byte is Blue + /// + Argb8888, + /// + /// BGRA8888, high-byte is Alpha + /// + Bgra8888, + /// + /// RGBA8888, high-byte is Alpha + /// + Rgba8888, + /// + /// BGRX8888, high-byte is X + /// + Bgrx8888, + /// + /// NV21- planar + /// + NV21, + /// + /// NV16- planar + /// + NV16, + /// + /// NV61- planar + /// + NV61, + } + + internal static class ImageColorSpaceExtensions + { + internal static ColorSpace ToCommonColorSpace(this ImageColorSpace value) + { + Debug.Assert(Enum.IsDefined(typeof(ImageColorSpace), value)); + + switch (value) + { + case ImageColorSpace.YV12: return ColorSpace.YV12; + + case ImageColorSpace.Uyvy: return ColorSpace.Uyvy; + + case ImageColorSpace.Yuyv: return ColorSpace.Yuyv; + + case ImageColorSpace.Yuv422: return ColorSpace.Yuv422; + + case ImageColorSpace.I420: return ColorSpace.I420; + + case ImageColorSpace.Rgb565: return ColorSpace.Rgb565; + + case ImageColorSpace.Rgb888: return ColorSpace.Rgb888; + + case ImageColorSpace.Argb8888: return ColorSpace.Argb8888; + + case ImageColorSpace.Bgra8888: return ColorSpace.Bgra8888; + + case ImageColorSpace.Rgba8888: return ColorSpace.Rgba8888; + + case ImageColorSpace.Bgrx8888: return ColorSpace.Bgrx8888; + + case ImageColorSpace.NV12: return ColorSpace.NV12; + + case ImageColorSpace.NV16: return ColorSpace.NV16; + + case ImageColorSpace.NV21: return ColorSpace.NV21; + + case ImageColorSpace.NV61: return ColorSpace.NV61; + } + + Debug.Fail($"Not supported color space : {value.ToString()}!"); + throw new NotSupportedException("Implementation does not support the specified value."); + } + } + + internal static class ImageColorSpaceSupport + { + internal static ImageColorSpace ToImageColorSpace(this ColorSpace colorSpace) + { + ValidationUtil.ValidateEnum(typeof(ColorSpace), colorSpace, nameof(colorSpace)); + + switch (colorSpace) + { + case ColorSpace.YV12: return ImageColorSpace.YV12; + + case ColorSpace.Uyvy: return ImageColorSpace.Uyvy; + + case ColorSpace.Yuyv: return ImageColorSpace.Yuyv; + + case ColorSpace.Yuv422: return ImageColorSpace.Yuv422; + + case ColorSpace.I420: return ImageColorSpace.I420; + + case ColorSpace.Rgb565: return ImageColorSpace.Rgb565; + + case ColorSpace.Rgb888: return ImageColorSpace.Rgb888; + + case ColorSpace.Argb8888: return ImageColorSpace.Argb8888; + + case ColorSpace.Bgra8888: return ImageColorSpace.Bgra8888; + + case ColorSpace.Rgba8888: return ImageColorSpace.Rgba8888; + + case ColorSpace.Bgrx8888: return ImageColorSpace.Bgrx8888; + + case ColorSpace.NV12: return ImageColorSpace.NV12; + + case ColorSpace.NV16: return ImageColorSpace.NV16; + + case ColorSpace.NV21: return ImageColorSpace.NV21; + + case ColorSpace.NV61: return ImageColorSpace.NV61; + } + + throw new NotSupportedException($"The ColorSpace.{colorSpace.ToString()} is not supported."); + } + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageDecoder.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageDecoder.cs new file mode 100644 index 0000000..891faaa --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageDecoder.cs @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using static Interop; +using static Interop.Decode; + +namespace Tizen.Multimedia.Util +{ + /// + /// This is a base class for image decoders. + /// + public abstract class ImageDecoder : IDisposable + { + private ImageDecoderHandle _handle; + + private ColorSpace? _colorSpace; + + internal ImageDecoder(ImageFormat format) + { + Create(out _handle).ThrowIfFailed("Failed to create ImageDecoder"); + + Debug.Assert(_handle != null); + + InputFormat = format; + } + + /// + /// Gets the image format of this decoder. + /// + public ImageFormat InputFormat { get; } + + private ImageDecoderHandle Handle + { + get + { + if (_handle.IsInvalid) + { + throw new ObjectDisposedException(nameof(ImageDecoder)); + } + return _handle; + } + } + + /// + /// Sets the color-space to decode into. The default is . + /// + /// The value indicating color-space to decode into. + /// is invalid. + /// is not supported by the decoder. + /// + public void SetColorSpace(ColorSpace colorSpace) + { + ValidationUtil.ValidateEnum(typeof(ColorSpace), colorSpace, nameof(ColorSpace)); + + if (ImageUtil.GetSupportedColorSpaces(InputFormat).Contains(colorSpace) == false) + { + throw new NotSupportedException($"{colorSpace.ToString()} is not supported for {InputFormat}."); + } + + _colorSpace = colorSpace; + } + + /// + /// Decodes an image from the specified file. + /// + /// Input file path from which to decode. + /// A task that represents the asynchronous decoding operation. + /// + /// Only Graphics Interchange Format(GIF) codec returns more than one frame.\n + /// \n + /// http://tizen.org/privilege/mediastorage is needed if is relevant to media storage.\n + /// http://tizen.org/privilege/externalstorage is needed if is relevant to external storage. + /// + /// is null. + /// + /// is an empty string.\n + /// - or -\n + /// is not a image file.\n + /// - or -\n + /// The format of is not . + /// + /// does not exists. + /// Caller does not have required permission to access the path. + /// The format of is not . + /// The has already been disposed of. + public async Task> DecodeAsync(string inputFilePath) + { + if (inputFilePath == null) + { + throw new ArgumentNullException(nameof(inputFilePath)); + } + + if (inputFilePath.Length == 0) + { + throw new ArgumentException("path is empty.", nameof(inputFilePath)); + } + + if (CheckHeader(inputFilePath) == false) + { + throw new FileFormatException("The file has an invalid header."); + } + + var pathPtr = Marshal.StringToHGlobalAnsi(inputFilePath); + try + { + + SetInputPath(Handle, pathPtr).ThrowIfFailed("Failed to set input file path for decoding"); + return await DecodeAsync(); + } + finally + { + Marshal.FreeHGlobal(pathPtr); + } + } + + /// + /// Decodes an image from the buffer. + /// + /// The image buffer from which to decode. + /// A task that represents the asynchronous decoding operation. + /// + /// Only Graphics Interchange Format(GIF) codec returns more than one frame.\n + /// + /// is null. + /// + /// is an empty array.\n + /// - or -\n + /// The format of is not . + /// + /// The format of is not . + /// The has already been disposed of. + public Task> DecodeAsync(byte[] inputBuffer) + { + if (inputBuffer == null) + { + throw new ArgumentNullException(nameof(inputBuffer)); + } + + if (inputBuffer.Length == 0) + { + throw new ArgumentException("buffer is empty.", nameof(inputBuffer)); + } + + if (CheckHeader(inputBuffer) == false) + { + throw new FileFormatException("buffer has an invalid header."); + } + + SetInputBuffer(Handle, inputBuffer, (ulong)inputBuffer.Length). + ThrowIfFailed("Failed to set input buffer for decoding"); + + return DecodeAsync(); + } + + private bool CheckHeader(byte[] input) + { + if (input.Length < Header.Length) + { + return false; + } + + for (int i = 0; i < Header.Length; ++i) + { + if (input[i] != Header[i]) + { + return false; + } + } + + return true; + } + + private bool CheckHeader(string inputFile) + { + using (var fs = File.OpenRead(inputFile)) + { + byte[] fileHeader = new byte[Header.Length]; + + if (fs.Read(fileHeader, 0, fileHeader.Length) < Header.Length) + { + return false; + } + return CheckHeader(fileHeader); + } + } + + internal Task> DecodeAsync() + { + Initialize(Handle); + + IntPtr outBuffer = IntPtr.Zero; + SetOutputBuffer(Handle, out outBuffer).ThrowIfFailed("Failed to decode given image"); + + var tcs = new TaskCompletionSource>(); + + Task.Run(() => + { + try + { + int width, height; + ulong size; + + DecodeRun(Handle, out width, out height, out size).ThrowIfFailed("Failed to decode"); + + tcs.SetResult(new[] { new BitmapFrame(outBuffer, width, height, (int)size) }); + } + catch (Exception e) + { + tcs.TrySetException(e); + } + finally + { + LibcSupport.Free(outBuffer); + } + }); + + return tcs.Task; + } + + internal virtual void Initialize(ImageDecoderHandle handle) + { + if (_colorSpace.HasValue) + { + SetColorspace(Handle, _colorSpace.Value.ToImageColorSpace()).ThrowIfFailed("Failed to set color space"); + } + } + + internal abstract byte[] Header { get; } + + #region IDisposable Support + private bool _disposed = false; + + /// + /// Releases the unmanaged resources used by the ImageDecoder. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != null) + { + _handle.Dispose(); + } + _disposed = true; + } + } + + /// + /// Releases all resources used by the ImageDecoder. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + } + + /// + /// Provides the ability to decode Bitmap (BMP) encoded images. + /// + public class BmpDecoder : ImageDecoder + { + private static readonly byte[] _header = { (byte)'B', (byte)'M' }; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public BmpDecoder() : base(ImageFormat.Bmp) + { + } + + internal override byte[] Header => _header; + } + + /// + /// Provides the ability to decode Portable Network Graphics (PNG) encoded images. + /// + public class PngDecoder : ImageDecoder + { + private static readonly byte[] _header = { 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a }; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public PngDecoder() : base(ImageFormat.Png) + { + } + + internal override byte[] Header => _header; + } + + /// + /// Provides the ability to decode Joint Photographic Experts Group (JPEG) encoded images. + /// + public class JpegDecoder : ImageDecoder + { + private static readonly byte[] _header = { 0xFF, 0xD8 }; + + /// + /// A read-only field that represents the default value of . + /// + public static readonly JpegDownscale DefaultJpegDownscale = JpegDownscale.None; + + private JpegDownscale _jpegDownscale = DefaultJpegDownscale; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public JpegDecoder() : base(ImageFormat.Jpeg) + { + } + + /// + /// Gets or sets the downscale at which the jpeg image should be decoded. + /// + /// is invalid. + public JpegDownscale Downscale + { + get + { + return _jpegDownscale; + } + set + { + ValidationUtil.ValidateEnum(typeof(JpegDownscale), value, nameof(Downscale)); + + _jpegDownscale = value; + } + } + + internal override void Initialize(ImageDecoderHandle handle) + { + base.Initialize(handle); + + SetJpegDownscale(handle, Downscale).ThrowIfFailed("Failed to set downscale for decoding"); + } + + internal override byte[] Header => _header; + } + + /// + /// Provides the ability to decode Graphics Interchange Format (GIF) encoded images. + /// + public class GifDecoder : ImageDecoder + { + private static readonly byte[] _header = { (byte)'G', (byte)'I', (byte)'F' }; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public GifDecoder() : base(ImageFormat.Gif) + { + } + + internal override byte[] Header => _header; + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageEncoder.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageEncoder.cs new file mode 100644 index 0000000..d4b8f83 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageEncoder.cs @@ -0,0 +1,462 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using static Interop.ImageUtil; +using Unmanaged = Interop.ImageUtil.Encode; + +namespace Tizen.Multimedia.Util +{ + /// + /// This is a base class for image encoders. + /// + public abstract class ImageEncoder : IDisposable + { + private ImageEncoderHandle _handle; + + private bool _hasResolution; + + internal ImageEncoder(ImageFormat format) + { + Unmanaged.Create(format, out _handle).ThrowIfFailed("Failed to create ImageEncoder"); + + Debug.Assert(_handle != null); + + OutputFormat = format; + } + + private ImageEncoderHandle Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + + return _handle; + } + } + + /// + /// Gets the image format of this encoder. + /// + public ImageFormat OutputFormat { get; } + + /// + /// Sets the resolution of the output image. + /// + /// The target resolution. + /// + /// The width of is less than or equal to zero.\n + /// - or -\n + /// The height of is less than or equal to zero. + /// + public void SetResolution(Size resolution) + { + if (resolution.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(resolution), resolution.Width, + "The width of resolution can't be less than or equal to zero."); + } + if (resolution.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(resolution), resolution.Height, + "The height of resolution can't be less than or equal to zero."); + } + + Unmanaged.SetResolution(Handle, (uint)resolution.Width, (uint)resolution.Height). + ThrowIfFailed("Failed to set the resolution"); + + _hasResolution = true; + } + + /// + /// Sets the color-space of the output image. + /// + /// The target color-space. + /// is invalid. + /// is not supported by the encoder. + /// + public void SetColorSpace(ColorSpace colorSpace) + { + ValidationUtil.ValidateEnum(typeof(ColorSpace), colorSpace, nameof(colorSpace)); + + if (ImageUtil.GetSupportedColorSpaces(OutputFormat).Contains(colorSpace) == false) + { + throw new NotSupportedException($"{colorSpace.ToString()} is not supported for {OutputFormat}."); + } + + Unmanaged.SetColorspace(Handle, colorSpace.ToImageColorSpace()). + ThrowIfFailed("Failed to set the color space"); + } + + private Task Run(Stream outStream) + { + var tcs = new TaskCompletionSource(); + + IntPtr outBuffer = IntPtr.Zero; + Unmanaged.SetOutputBuffer(Handle, out outBuffer).ThrowIfFailed("Failed to initialize encoder"); + + Task.Run(() => + { + try + { + ulong size = 0; + Unmanaged.Run(Handle, out size).ThrowIfFailed("Failed to encode given image"); + + byte[] buf = new byte[size]; + Marshal.Copy(outBuffer, buf, 0, (int)size); + outStream.Write(buf, 0, (int)size); + + tcs.TrySetResult(true); + } + catch (Exception e) + { + tcs.TrySetException(e); + } + finally + { + Interop.Libc.Free(outBuffer); + } + }); + + return tcs.Task; + } + + internal Task EncodeAsync(Action settingInputAction, Stream outStream) + { + Debug.Assert(settingInputAction != null); + + if (outStream == null) + { + throw new ArgumentNullException(nameof(outStream)); + } + + if (outStream.CanWrite == false) + { + throw new ArgumentException("The stream is not writable.", nameof(outStream)); + } + + Initialize(); + + settingInputAction(Handle); + + return Run(outStream); + } + + /// + /// Encodes an image from a raw image buffer to a specified . + /// + /// The image buffer to encode. + /// The stream that the image is encoded to. + /// A task that represents the asynchronous encoding operation. + /// + /// is null.\n + /// - or -\n + /// is null. + /// + /// + /// is an empty array.\n + /// - or -\n + /// is not writable.\n + /// + /// The resolution is not set. + /// The has already been disposed of. + /// + public Task EncodeAsync(byte[] inputBuffer, Stream outStream) + { + if (inputBuffer == null) + { + throw new ArgumentNullException(nameof(inputBuffer)); + } + + if (inputBuffer.Length == 0) + { + throw new ArgumentException("buffer is empty.", nameof(inputBuffer)); + } + + return EncodeAsync(handle => + { + Unmanaged.SetInputBuffer(handle, inputBuffer). + ThrowIfFailed("Failed to configure encoder; InputBuffer"); + }, outStream); + } + + internal void Initialize() + { + Configure(Handle); + + if (_hasResolution == false) + { + throw new InvalidOperationException("Resolution is not set."); + } + } + + internal abstract void Configure(ImageEncoderHandle handle); + + #region IDisposable Support + private bool _disposed = false; + + /// + /// Releases the unmanaged resources used by the ImageEncoder. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + if (_handle != null) + { + _handle.Dispose(); + } + _disposed = true; + } + } + + /// + /// Releases all resources used by the ImageEncoder. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + } + + /// + /// Provides the ability to encode Bitmap (BMP) format images. + /// + public class BmpEncoder : ImageEncoder + { + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public BmpEncoder() : base(ImageFormat.Bmp) + { + } + + internal override void Configure(ImageEncoderHandle handle) + { + } + } + + /// + /// Provides the ability to encode Portable Network Graphics (PNG) format images. + /// + public class PngEncoder : ImageEncoder + { + /// + /// A read-only field that represents the default value of . + /// + public static readonly PngCompression DefaultCompression = PngCompression.Level6; + + private PngCompression? _compression; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public PngEncoder() : + base(ImageFormat.Png) + { + } + + /// + /// Initialize a new instance of the class with . + /// + /// will be the . + /// The compression level of the encoder. + /// is invalid. + public PngEncoder(PngCompression compression) : + base(ImageFormat.Png) + { + Compression = compression; + } + + /// + /// Gets or sets the compression level of the png image. + /// + /// The compression level. The default is . + /// is invalid. + public PngCompression Compression + { + get { return _compression ?? DefaultCompression; } + set + { + ValidationUtil.ValidateEnum(typeof(PngCompression), value, nameof(Compression)); + + _compression = value; + } + } + + internal override void Configure(ImageEncoderHandle handle) + { + if (_compression.HasValue) + { + Unmanaged.SetPngCompression(handle, _compression.Value). + ThrowIfFailed("Failed to configure encoder; PngCompression"); + } + } + } + + /// + /// Provides the ability to encode Joint Photographic Experts Group (JPEG) format images. + /// + public class JpegEncoder : ImageEncoder + { + /// + /// A read-only field that represents the default value of . + /// + public static readonly int DefaultQuality = 75; + + private int? _quality; + + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public JpegEncoder() : base(ImageFormat.Jpeg) + { + } + + + /// + /// Initialize a new instance of the class with initial quality value. + /// + /// The quality for JPEG image encoding; from 1(lowest quality) to 100(highest quality). + /// will be the . + /// + /// is less than or equal to 0.\n + /// - or -\n + /// is greater than 100. + /// + public JpegEncoder(int quality) : + base(ImageFormat.Jpeg) + { + Quality = quality; + } + + /// + /// Gets or sets the quality of the encoded image. + /// + /// + /// The quality of the output image. The default is 75.\n + /// Valid value is from 1(lowest quality) to 100(highest quality). + /// + /// + /// is less than or equal to 0.\n + /// - or -\n + /// is greater than 100. + /// + public int Quality + { + get { return _quality ?? DefaultQuality; } + set + { + if (value <= 0 || value > 100) + { + throw new ArgumentOutOfRangeException(nameof(Quality), value, + "Valid range is from 1 to 100, inclusive."); + } + _quality = value; + } + } + + internal override void Configure(ImageEncoderHandle handle) + { + if (_quality.HasValue) + { + Unmanaged.SetQuality(handle, _quality.Value). + ThrowIfFailed("Failed to configure encoder; Quality"); + } + } + } + + /// + /// Provides the ability to encode Graphics Interchange Format (GIF) format images. + /// + public class GifEncoder : ImageEncoder + { + /// + /// Initialize a new instance of the class. + /// + /// will be the . + public GifEncoder() : base(ImageFormat.Gif) + { + } + + internal override void Configure(ImageEncoderHandle handle) + { + } + + /// + /// Encodes a Graphics Interchange Format (GIF) image from multiple raw image buffers to a specified . + /// + /// The image frames to encode. + /// The stream that the image is encoded to. + /// A task that represents the asynchronous encoding operation. + /// + /// is null.\n + /// - or -\n + /// is null. + /// + /// + /// has no element(empty).\n + /// - or -\n + /// is not writable.\n + /// + /// The resolution is not set. + /// The has already been disposed of. + /// + public Task EncodeAsync(IEnumerable frames, Stream outStream) + { + if (frames == null) + { + throw new ArgumentNullException(nameof(frames)); + } + + if (frames.Count() == 0) + { + throw new ArgumentException("frames is a empty collection", nameof(frames)); + } + + return EncodeAsync(handle => + { + foreach (GifFrame frame in frames) + { + if (frame == null) + { + throw new ArgumentNullException(nameof(frames)); + } + Unmanaged.SetInputBuffer(handle, frame.Buffer). + ThrowIfFailed("Failed to configure encoder; Buffer"); + + Unmanaged.SetGifFrameDelayTime(handle, (ulong)frame.Delay). + ThrowIfFailed("Failed to configure encoder; Delay"); + } + }, outStream); + } + } + +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageFormat.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageFormat.cs new file mode 100644 index 0000000..b600b82 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageFormat.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.Util +{ + /// + /// Specifies image formats for , and . + /// + public enum ImageFormat + { + /// + /// The Joint Photographic Experts Group format. + /// + Jpeg, + /// + /// The Portable Network Graphics format. + /// + Png, + /// + /// The Graphics Interchange Format. + /// + Gif, + /// + /// The Bitmap format. + /// + Bmp, + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageRotation.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageRotation.cs new file mode 100644 index 0000000..7750c88 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageRotation.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.Util +{ + /// + /// Specifies how an image is rotated or flipped. + /// + /// + internal enum ImageRotation + { + /// + /// No rotation. + /// + Rotate0, + /// + /// Rotate 90 degree clockwise. + /// + Rotate90, + /// + /// Rotate 180 degree clockwise. + /// + Rotate180, + /// + /// Rotate 270 degree clockwise. + /// + Rotate270, + /// + /// Flip horizontally. + /// + FlipHorizontal, + /// + /// Flip vertically. + /// + FlipVertical, + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageTransform.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageTransform.cs new file mode 100644 index 0000000..be552b7 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageTransform.cs @@ -0,0 +1,596 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using static Interop.ImageUtil; +using static Interop.ImageUtil.Transform; + +namespace Tizen.Multimedia.Util +{ + /// + /// A base class for image transformations. + /// + public abstract class ImageTransform + { + internal ImageTransform() + { + } + + internal async Task RunAsync(TransformHandle handle, MediaPacket source) + { + var tcs = new TaskCompletionSource(); + + TransformCompletedCallback cb = (nativehandle, errorCode, _) => + { + if (errorCode == ImageUtilError.None) + { + try + { + tcs.TrySetResult(MediaPacket.From(Marshal.PtrToStructure(nativehandle))); + } + catch (Exception e) + { + tcs.TrySetException(e); + } + } + else + { + tcs.TrySetException(errorCode.ToException("Image transformation failed")); + } + }; + + using (var cbKeeper = ObjectKeeper.Get(cb)) + { + Run(handle, source.GetHandle(), cb).ThrowIfFailed("Failed to transform given packet with " + GetType()); + + return await tcs.Task; + } + } + + internal static TransformHandle CreateHandle() + { + Create(out var handle).ThrowIfFailed("Failed to run ImageTransformer"); + Debug.Assert(handle != null); + return handle; + } + + internal abstract void Configure(TransformHandle handle); + + internal virtual Task ApplyAsync(MediaPacket source) + { + using (TransformHandle handle = CreateHandle()) + { + Configure(handle); + + return RunAsync(handle, source); + } + } + } + + /// + /// Represents a collection of objects that can be individually accessed by index. + /// + public class ImageTransformCollection : IEnumerable, IList + { + private List _list = new List(); + + /// + /// Initializes a new instance of the ImageTransformCollection class. + /// + public ImageTransformCollection() + { + } + + /// + /// Gets or sets the at the specified index. + /// + /// The zero-based index of the to get or set. + /// The at the specified index. + /// + /// index is less than 0.\n + /// - or -\n + /// index is equal to or greater than Count. + /// + public ImageTransform this[int index] + { + get { return _list[index]; } + set { _list[index] = value; } + } + + /// + /// Gets the number of items contained in the TransformCollection. + /// + public int Count => _list.Count; + + bool ICollection.IsReadOnly => false; + + /// + /// Adds a to the end of the collection. + /// + /// The to add. + /// + /// accepts null as a valid value for reference types and allows duplicate elements. + /// + public void Add(ImageTransform item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + _list.Add(item); + } + + /// + /// Removes all items. + /// + public void Clear() => _list.Clear(); + + /// + /// Determines whether the contains the specified item. + /// + /// The to locate in the collection. + /// true if the is found in the collection; otherwise, false. + public bool Contains(ImageTransform item) => _list.Contains(item); + + /// + /// Copies the items of the collection to an array, starting at the specified array index. + /// + /// The one-dimensional array that is the destination of the items copied from the collection. + /// The zero-based index in array at which copying begins. + /// is null. + /// is less than 0. + /// + /// The number of elements in the source collection is greater than the available space from arrayIndex to the end of the destination array. + /// + public void CopyTo(ImageTransform[] array, int arrayIndex) => _list.CopyTo(array, arrayIndex); + + /// + /// Determines the index of the specified item in the collection. + /// + /// The to locate in the collection. + /// The index of value if found in the ; otherwise, -1. + public int IndexOf(ImageTransform item) => _list.IndexOf(item); + + /// + /// Inserts a into the collection at the specified index. + /// + /// The zero-based index at which should be inserted. + /// The to insert into the collection. + /// is null. + /// + /// index is less than 0.\n + /// -or-\n + /// index is greater than . + /// + public void Insert(int index, ImageTransform item) + { + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + _list.Insert(index, item); + } + + /// + /// Removes the first occurrence of the specified from the collection. + /// + /// The to remove. + /// true if was removed from the collection; otherwise, false. + public bool Remove(ImageTransform item) => _list.Remove(item); + + /// + /// Removes the at the specified index. + /// + /// The zero-based index to remove. + /// + /// index is less than 0.\n + /// - or -\n + /// index is equal to or greater than . + /// + public void RemoveAt(int index) => _list.RemoveAt(index); + + /// + /// Returns an enumerator that can iterate through the collection. + /// + /// A enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() => _list.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() => _list.GetEnumerator(); + } + + // TODO need to improve performance + /// + /// Represents a that is a composite of the transforms. + /// + public class ImageTransformGroup : ImageTransform + { + /// + /// Gets or sets the . + /// + public ImageTransformCollection Children { get; set; } + + /// + /// Initializes a new instance of the ImageTransformGroup class. + /// + public ImageTransformGroup() + { + Children = new ImageTransformCollection(); + } + + internal override void Configure(TransformHandle handle) + { + // intended blank + } + + internal override async Task ApplyAsync(MediaPacket source) + { + if (Children.Count == 0) + { + return source; + } + + var items = Children; + + MediaPacket curPacket = await items[0].ApplyAsync(source); + + for (int i = 1; i < items.Count; ++i) + { + var oldPacket = curPacket; + try + { + curPacket = await items[i].ApplyAsync(curPacket); + } + finally + { + oldPacket.Dispose(); + } + } + + return curPacket; + } + } + + /// + /// Rotates or flips an image. + /// + /// + public class RotateTransform : ImageTransform + { + private Rotation _rotation; + + /// + /// Initialize a new instance of the class. + /// + /// The value how to rotate an image. + /// is invalid. + /// is . + public RotateTransform(Rotation rotation) + { + Rotation = rotation; + + } + + /// + /// Gets or sets the value how to rotate an image. + /// + /// is invalid. + /// is . + public Rotation Rotation + { + get { return _rotation; } + set + { + ValidationUtil.ValidateEnum(typeof(Rotation), value, nameof(Rotation)); + + if (value == Rotation.Rotate0) + { + throw new ArgumentOutOfRangeException(nameof(value), "Rotation can't be Rotate0."); + } + + _rotation = value; + } + } + + internal override void Configure(TransformHandle handle) + { + SetRotation(handle, GetImageRotation()); + } + + private ImageRotation GetImageRotation() + { + switch (Rotation) + { + case Rotation.Rotate90: return ImageRotation.Rotate90; + case Rotation.Rotate180: return ImageRotation.Rotate180; + case Rotation.Rotate270: return ImageRotation.Rotate270; + } + + Debug.Fail("Rotation is invalid value!"); + return ImageRotation.Rotate0; + } + } + + + /// + /// Rotates or flips an image. + /// + /// + public class FlipTransform : ImageTransform + { + private Flips _flip; + + /// + /// Initialize a new instance of the class. + /// + /// The value how to flip an image. + /// is invalid. + /// is . + public FlipTransform(Flips flip) + { + Flip = flip; + } + + /// + /// Gets or sets the value how to rotate an image. + /// + /// is invalid. + /// is . + public Flips Flip + { + get { return _flip; } + set + { + ValidationUtil.ValidateFlagsEnum(value, Flips.Horizontal | Flips.Vertical, nameof(Flips)); + + if (value == Flips.None) + { + throw new ArgumentOutOfRangeException(nameof(value), "Flip can't be None."); + } + + _flip = value; + } + } + + internal override void Configure(TransformHandle handle) + { + // intended blank + } + + private async Task ApplyAsync(TransformHandle handle, MediaPacket source, + ImageRotation rotation) + { + SetRotation(handle, rotation); + return await RunAsync(handle, source); + } + + internal override async Task ApplyAsync(MediaPacket source) + { + using (TransformHandle handle = CreateHandle()) + { + if (Flip.HasFlag(Flips.Vertical | Flips.Horizontal)) + { + var flipped = await ApplyAsync(handle, source, ImageRotation.FlipHorizontal); + try + { + return await ApplyAsync(handle, flipped, ImageRotation.FlipVertical); + } + finally + { + flipped.Dispose(); + } + } + + return await ApplyAsync(handle, source, Flip.HasFlag(Flips.Horizontal) ? + ImageRotation.FlipHorizontal : ImageRotation.FlipVertical); + } + } + } + + /// + /// Changes colorspace of image. + /// + /// + public class ColorSpaceTransform : ImageTransform + { + private ImageColorSpace _imageColorSpace; + + /// + /// Initialize a new instance of the class. + /// + /// The colorspace of output image. + /// is invalid. + /// is not supported. + /// + public ColorSpaceTransform(ColorSpace colorSpace) + { + ColorSpace = colorSpace; + } + + /// + /// Gets or sets the colorspace of the result image. + /// + /// is invalid. + /// is not supported. + /// + public ColorSpace ColorSpace + { + get { return _imageColorSpace.ToCommonColorSpace(); } + set + { + ValidationUtil.ValidateEnum(typeof(ColorSpace), value, nameof(ColorSpace)); + + _imageColorSpace = value.ToImageColorSpace(); + } + } + + internal override void Configure(TransformHandle handle) + { + SetColorspace(handle, _imageColorSpace); + } + + /// + /// Gets the supported colorspaces for . + /// + public static IEnumerable SupportedColorSpaces + { + get + { + foreach (ImageColorSpace value in Enum.GetValues(typeof(ImageColorSpace))) + { + yield return value.ToCommonColorSpace(); + } + } + } + } + + /// + /// Crops an image. + /// + public class CropTransform : ImageTransform + { + private Rectangle _region; + + /// + /// Initialize a new instance of the class. + /// + /// The crop region. + /// + /// The X-position of is less than zero.\n + /// - or -\n + /// The Y-position of is less than zero.\n + /// - or -\n + /// The width of is less than or equal to zero.\n + /// - or -\n + /// The height of is less than or equal to zero. + /// + public CropTransform(Rectangle region) + { + Region = region; + } + + /// + /// Gets or sets the crop region. + /// + /// + /// The X-position of is less than zero.\n + /// - or -\n + /// The Y-position of is less than zero.\n + /// - or -\n + /// The width of is less than or equal to zero.\n + /// - or -\n + /// The height of is less than or equal to zero. + /// + public Rectangle Region + { + get { return _region; } + set + { + + if (value.X < 0) + { + throw new ArgumentOutOfRangeException(nameof(Region), value, + "X position of the region can't be less than zero."); + } + + if (value.Y < 0) + { + throw new ArgumentOutOfRangeException(nameof(Region), value, + "Y position of the region can't be less than zero."); + } + + if (value.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(Region), value, + "Width of the region can't be less than or equal zero."); + } + + if (value.Height < 0) + { + throw new ArgumentOutOfRangeException(nameof(Region), value, + "Height of the region can't be less than or equal to zero."); + } + + _region = value; + } + } + + internal override void Configure(TransformHandle handle) + { + SetCropArea(handle, Region.Left, Region.Top, Region.Right, Region.Bottom); + } + } + + /// + /// Resizes an image. + /// + public class ResizeTransform : ImageTransform + { + private Size _size; + + /// + /// Initialize a new instance of the class. + /// + /// The size that an image is resized to. + /// + /// The width of is less than or equal to zero.\n + /// - or -\n + /// The height of is less than or equal to zero. + /// + public ResizeTransform(Size size) + { + Size = size; + } + + /// + /// Gets or sets the size that an image is resized to. + /// + /// + /// The width of is less than or equal to zero.\n + /// - or -\n + /// The height of is less than or equal to zero. + /// + public Size Size + { + get { return _size; } + set + { + if (value.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(Size), value, + "Width of the size can't be less than or equal to zero."); + } + + if (value.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(Size), value, + "Height of the size can't be less than or equal to zero."); + } + + _size = value; + } + } + + internal override void Configure(TransformHandle handle) + { + SetResolution(handle, (uint)Size.Width, (uint)Size.Height); + } + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageTransformer.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageTransformer.cs new file mode 100644 index 0000000..d0f81ad --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageTransformer.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Multimedia.Util +{ + /// + /// Provides the ability to transform an image. + /// + public class ImageTransformer : IDisposable + { + /// + /// Initialize a new instance of the class. + /// + public ImageTransformer() + { + } + + /// + /// Transforms an image with . + /// + /// to transform. The of this must be . + /// to apply. + /// A task that represents the asynchronous transforming operation. + /// + /// is null.\n + /// - or -\n + /// is null. + /// + /// The has already been disposed of. + /// Failed to apply . + public Task TransformAsync(MediaPacket source, ImageTransform item) + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ImageTransformer)); + } + + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + if (item == null) + { + throw new ArgumentNullException(nameof(item)); + } + + return item.ApplyAsync(source); + } + + #region IDisposable Support + private bool _disposed = false; + + /// + /// Releases the unmanaged resources used by the ImageTransformer. + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + protected virtual void Dispose(bool disposing) + { + if (!_disposed) + { + _disposed = true; + } + } + + /// + /// Releases all resources used by the ImageTransformer. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs new file mode 100644 index 0000000..215f53f --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageUtil.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using Tizen.Common; +using static Interop.ImageUtil; + +namespace Tizen.Multimedia.Util +{ + /// + /// Provides utilities for images. + /// + public static class ImageUtil + { + /// + /// Retrieves supported colorspaces for a that represents formats for and . + /// + /// An IEnumerable of representing the supported color-spaces. + /// The . + /// is invalid. + public static IEnumerable GetSupportedColorSpaces(ImageFormat format) + { + ValidationUtil.ValidateEnum(typeof(ImageFormat), format, nameof(format)); + + var colorspaces = new List(); + + ForeachSupportedColorspace(format, + (colorspace, _) => { colorspaces.Add(colorspace.ToCommonColorSpace()); return true; }). + ThrowIfFailed("Failed to get supported color-space list from native handle"); + + return colorspaces; + } + + /// + /// Calculates the size of the image buffer for the specified resolution and color-space. + /// + /// The resolution of the image. + /// of the image. + /// The buffer size. + /// + /// width of is less than or equal to zero.\n + /// - or -\n + /// height of is less than or equal to zero. + /// + /// is invalid. + public static int CalculateBufferSize(Size resolution, ColorSpace colorSpace) + { + if (resolution.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(resolution), resolution.Width, + "width can't be less than or equal to zero."); + } + if (resolution.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(resolution), resolution.Height, + "height can't be less than or equal to zero."); + } + + ValidationUtil.ValidateEnum(typeof(ColorSpace), colorSpace, nameof(colorSpace)); + + uint bufferSize; + global::Interop.ImageUtil.CalculateBufferSize(resolution.Width, resolution.Height, + colorSpace.ToImageColorSpace(), out bufferSize) + .ThrowIfFailed("Failed to calculate buffer size for given parameter"); + + return (int)bufferSize; + } + + /// + /// Extracts representative color from an image buffer. + /// + /// Raw image buffer. + /// Resolution of the image. + /// The image should be . + /// The representative color of the image. + /// + /// is null. + /// is empty. + /// + /// width of is less than or equal to zero.\n + /// - or -\n + /// height of is less than or equal to zero. + /// + public static Color GetColor(byte[] buffer, Size size) + { + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (buffer.Length == 0) + { + throw new ArgumentException("buffer is empty.", nameof(buffer)); + } + + if (size.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Width, + "width can't be less than or equal to zero."); + } + if (size.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Height, + "height can't be less than or equal to zero."); + } + + + byte r, g, b; + ExtractColorFromMemory(buffer, size.Width, size.Height, out r, out g, out b) + .ThrowIfFailed("Failed to extract color from buffer"); + + return Color.FromRgb(r, g, b); + } + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/ImageUtilError.cs b/src/Tizen.Multimedia.Util/ImageUtil/ImageUtilError.cs new file mode 100644 index 0000000..efeec4b --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/ImageUtilError.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia.Util +{ + + internal enum ImageUtilError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + InvalidOperation = ErrorCode.InvalidOperation, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoSuchFile = ErrorCode.NoSuchFile, + NotSupportedFormat = -0x01920000 | 0x01, + } + + internal static class ImageUtilErrorExtensions + { + internal static void ThrowIfFailed(this ImageUtilError err, string message) + { + if (err == ImageUtilError.None) + { + return; + } + + throw err.ToException(message); + } + + internal static Exception ToException(this ImageUtilError err, string message) + { + Debug.Assert(err != ImageUtilError.None); + + string errMessage = $"{message}; {err}."; + switch (err) + { + case ImageUtilError.PermissionDenied: + return new UnauthorizedAccessException(errMessage); + + case ImageUtilError.InvalidParameter: + return new ArgumentException(errMessage); + + case ImageUtilError.NoSuchFile: + return new FileNotFoundException(errMessage); + + case ImageUtilError.OutOfMemory: + return new OutOfMemoryException(errMessage); + + case ImageUtilError.NotSupported: + return new NotSupportedException(errMessage); + + case ImageUtilError.NotSupportedFormat: + return new FileFormatException(errMessage); + + case ImageUtilError.InvalidOperation: + default: + return new InvalidOperationException(errMessage); + } + } + } + +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/JpegDownscale.cs b/src/Tizen.Multimedia.Util/ImageUtil/JpegDownscale.cs new file mode 100644 index 0000000..842eaf6 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/JpegDownscale.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.Util +{ + /// + /// Specifies JPEG Downscale options for decoding. + /// + public enum JpegDownscale + { + /// + /// No downscale. + /// + None, + /// + /// 1/2 downscale. + /// + OneHalf, + /// + /// 1/4 downscale. + /// + OneFourth, + /// + /// 1/8 downscale. + /// + OneEighth, + } +} diff --git a/src/Tizen.Multimedia.Util/ImageUtil/PngCompression.cs b/src/Tizen.Multimedia.Util/ImageUtil/PngCompression.cs new file mode 100644 index 0000000..c2ea191 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ImageUtil/PngCompression.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia.Util +{ + /// + /// Specifies PNG compression levels. + /// + public enum PngCompression + { + /// + /// No Compression. + /// + None, + /// + /// Compression Level 1. Best speed. + /// + Level1, + /// + /// Compression Level 2. + /// + Level2, + /// + /// Compression Level 3. + /// + Level3, + /// + /// Compression Level 4. + /// + Level4, + /// + /// Compression Level 5. + /// + Level5, + /// + /// Compression Level 6. + /// + Level6, + /// + /// Compression Level 7. + /// + Level7, + /// + /// Compression Level 8. + /// + Level8, + /// + /// Compression Level 9. + /// + Level9, + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs new file mode 100644 index 0000000..f7636c6 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Decode.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia.Util; + +internal static partial class Interop +{ + internal static class Decode + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DecodeCompletedCallback(ImageUtilError error, IntPtr userData, int width, int height, ulong size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_create")] + public static extern ImageUtilError Create(out ImageDecoderHandle handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_destroy")] + internal static extern ImageUtilError Destroy(IntPtr handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_path")] + internal static extern ImageUtilError SetInputPath(ImageDecoderHandle handle, IntPtr path); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_input_buffer")] + internal static extern ImageUtilError SetInputBuffer(ImageDecoderHandle handle, byte[] srcBuffer, ulong srcSize); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_output_buffer")] + internal static extern ImageUtilError SetOutputBuffer(ImageDecoderHandle handle, out IntPtr dstBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_colorspace")] + internal static extern ImageUtilError SetColorspace(ImageDecoderHandle handle, ImageColorSpace colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_set_jpeg_downscale")] + internal static extern ImageUtilError SetJpegDownscale(ImageDecoderHandle handle, JpegDownscale downscale); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run_async")] + internal static extern ImageUtilError DecodeRunAsync(ImageDecoderHandle handle, DecodeCompletedCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_decode_run")] + internal static extern ImageUtilError DecodeRun(ImageDecoderHandle handle, out int width, + out int height, out ulong size); + } + + internal class ImageDecoderHandle : SafeHandle + { + protected ImageDecoderHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var ret = Decode.Destroy(handle); + if (ret != ImageUtilError.None) + { + Log.Debug(GetType().FullName, $"Failed to release native {GetType()}"); + return false; + } + + return true; + } + + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs new file mode 100644 index 0000000..ada1c39 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Encode.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia.Util; + +internal static partial class Interop +{ + internal static partial class ImageUtil + { + internal static class Encode + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EncodeCompletedCallback(ImageUtilError ImageUtilError, IntPtr userData, ulong size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run_async")] + internal static extern ImageUtilError EncodeRunAsync(ImageEncoderHandle handle, + EncodeCompletedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_create")] + internal static extern ImageUtilError Create(ImageFormat type, out ImageEncoderHandle handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_destroy")] + internal static extern ImageUtilError Destroy(IntPtr handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_resolution")] + internal static extern ImageUtilError SetResolution(ImageEncoderHandle handle, uint width, uint height); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_colorspace")] + internal static extern ImageUtilError SetColorspace(ImageEncoderHandle handle, ImageColorSpace colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_quality")] + internal static extern ImageUtilError SetQuality(ImageEncoderHandle handle, int quality); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_png_compression")] + internal static extern ImageUtilError SetPngCompression(ImageEncoderHandle handle, PngCompression compression); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_gif_frame_delay_time")] + internal static extern ImageUtilError SetGifFrameDelayTime(ImageEncoderHandle handle, ulong delayTime); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_path")] + internal static extern ImageUtilError SetOutputPath(ImageEncoderHandle handle, string path); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_input_buffer")] + internal static extern ImageUtilError SetInputBuffer(ImageEncoderHandle handle, byte[] srcBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_set_output_buffer")] + internal static extern ImageUtilError SetOutputBuffer(ImageEncoderHandle handle, out IntPtr dstBuffer); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_encode_run")] + internal static extern ImageUtilError Run(ImageEncoderHandle handle, out ulong size); + } + + internal class ImageEncoderHandle : SafeHandle + { + protected ImageEncoderHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + + protected override bool ReleaseHandle() + { + var ret = Encode.Destroy(handle); + if (ret != ImageUtilError.None) + { + Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}"); + return false; + } + + return true; + } + } + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs new file mode 100644 index 0000000..056266d --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.Transform.cs @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia.Util; + +internal static partial class Interop +{ + internal static partial class ImageUtil + { + internal static class Transform + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TransformCompletedCallback(IntPtr resultPacket, ImageUtilError errorCode, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_run")] + internal static extern ImageUtilError Run(TransformHandle handle, IntPtr srcPacket, + TransformCompletedCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_create")] + internal static extern ImageUtilError Create(out TransformHandle handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_destroy")] + internal static extern ImageUtilError Destroy(IntPtr handle); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_colorspace")] + internal static extern ImageUtilError GetColorspace(TransformHandle handle, out ImageColorSpace colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_colorspace")] + internal static extern ImageUtilError SetColorspace(TransformHandle handle, ImageColorSpace colorspace); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_hardware_acceleration")] + internal static extern ImageUtilError SetHardwareAcceleration(TransformHandle handle, bool mode); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_rotation")] + internal static extern ImageUtilError SetRotation(TransformHandle handle, ImageRotation rotation); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_crop_area")] + internal static extern ImageUtilError GetCropArea(TransformHandle handle, out uint startX, out uint startY, out uint endX, out uint endY); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_crop_area")] + internal static extern ImageUtilError SetCropArea(TransformHandle handle, int startX, int startY, int endX, int endY); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_get_resolution")] + internal static extern ImageUtilError GetResolution(TransformHandle handle, out uint width, out uint height); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_transform_set_resolution")] + internal static extern ImageUtilError SetResolution(TransformHandle handle, uint width, uint height); + } + + internal class TransformHandle : SafeHandle + { + protected TransformHandle() : base(IntPtr.Zero, true) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var ret = Transform.Destroy(handle); + if (ret != ImageUtilError.None) + { + Log.Debug(GetType().FullName, $"Failed to release native {GetType().Name}"); + return false; + } + + return true; + } + } + } + +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs new file mode 100644 index 0000000..728f4c0 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ImageUtil.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia.Util; + +internal static partial class Interop +{ + internal static partial class ImageUtil + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportedColorspaceCallback(ImageColorSpace colorspace, IntPtr userData); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_foreach_supported_colorspace")] + internal static extern ImageUtilError ForeachSupportedColorspace(ImageFormat type, SupportedColorspaceCallback callback, + IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_calculate_buffer_size")] + internal static extern ImageUtilError CalculateBufferSize(int width, int height, ImageColorSpace colorspace, out uint size); + + [DllImport(Libraries.ImageUtil, EntryPoint = "image_util_extract_color_from_memory")] + internal static extern ImageUtilError ExtractColorFromMemory(byte[] buffer, int width, int height, out byte rgbR, out byte rgbG, out byte rgbB); + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..3b5ae55 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ImageUtil = "libcapi-media-image-util.so.0"; + public const string ThumbnailExtractor = "libcapi-media-thumbnail-util.so"; + } +} diff --git a/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs b/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs new file mode 100644 index 0000000..53d73db --- /dev/null +++ b/src/Tizen.Multimedia.Util/Interop/Interop.ThumbnailExtractor.cs @@ -0,0 +1,56 @@ +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Multimedia.Util; + +internal static partial class Interop +{ + internal static class ThumbnailExtractor + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ThumbnailExtractCallback(ThumbnailExtractorError error, string requestId, + int thumbWidth, int thumbHeight, IntPtr thumbData, int thumbSize, IntPtr userData); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_create")] + internal static extern ThumbnailExtractorError Create(out ThumbnailExtractorHandle handle); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_extract")] + internal static extern ThumbnailExtractorError Extract(ThumbnailExtractorHandle handle, + ThumbnailExtractCallback callback, IntPtr userData, out IntPtr requestId); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_path")] + internal static extern ThumbnailExtractorError SetPath(ThumbnailExtractorHandle handle, string path); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_set_size")] + internal static extern ThumbnailExtractorError SetSize(ThumbnailExtractorHandle handle, int width, int height); + + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_cancel")] + internal static extern ThumbnailExtractorError Cancel(ThumbnailExtractorHandle handle, string requestId); + + [DllImport(Libraries.ThumbnailExtractor, EntryPoint = "thumbnail_util_destroy")] + internal static extern ThumbnailExtractorError Destroy(IntPtr handle); + } + + internal class ThumbnailExtractorHandle : CriticalHandle + { + protected ThumbnailExtractorHandle() : base(IntPtr.Zero) + { + } + + public override bool IsInvalid => handle == IntPtr.Zero; + + protected override bool ReleaseHandle() + { + var result = ThumbnailExtractor.Destroy(handle); + + if (result == ThumbnailExtractorError.None) + { + return true; + } + + Log.Error(GetType().Name, $"Failed to destroy handle : {result}"); + return false; + } + } +} diff --git a/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractionResult.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractionResult.cs new file mode 100755 index 0000000..25aa238 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractionResult.cs @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Multimedia.Util +{ + /// + /// Represents the result of thumbnail extraction. + /// + public class ThumbnailExtractionResult + { + internal ThumbnailExtractionResult(byte[] thumbnailData, int width, int height) + { + RawData = thumbnailData; + Size = new Size(width, height); + } + + /// + /// The thumbnail data. + /// + /// 3 + public byte[] RawData { get; } + + /// + /// The size of the thumbnail. + /// + /// 3 + public Size Size { get; } + } +} diff --git a/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs new file mode 100755 index 0000000..1201d9e --- /dev/null +++ b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractor.cs @@ -0,0 +1,240 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; +using Handle = Interop.ThumbnailExtractorHandle; +using Native = Interop.ThumbnailExtractor; + +namespace Tizen.Multimedia.Util +{ + /// + /// Provides the ability to extract the thumbnail from media files. + /// + public static class ThumbnailExtractor + { + private static Handle CreateHandle() + { + Native.Create(out var handle).ThrowIfError("Failed to extract."); + + return handle; + } + + /// + /// Extracts the thumbnail for the given media with the specified path. + /// + /// 3 + /// A task that represents the asynchronous extracting operation. + /// The size of the thumbnail will be the default size(320x240).\n + /// The path of the media file to extract the thumbnail. + /// is null. + /// Requested does not exist. + /// Internal error occurred. + /// Caller does not have required privilege for accessing the . + /// The specified file is not supported. + public static Task ExtractAsync(string path) + { + return RunExtractAsync(path, null, CancellationToken.None); + } + + /// + /// Extracts the thumbnail for the given media with the specified path. + /// + /// A task that represents the asynchronous extracting operation. + /// The size of the thumbnail will be the default size(320x240).\n + /// The path of the media file to extract the thumbnail. + /// The token to stop the operation. + /// is null. + /// Requested does not exist. + /// Internal error occurred. + /// Caller does not have required privilege for accessing the . + /// The specified file is not supported. + public static Task ExtractAsync(string path, CancellationToken cancellationToken) + { + return RunExtractAsync(path, null, cancellationToken); + } + + /// + /// Extracts the thumbnail for the given media with the specified path and size. + /// + /// 3 + /// A task that represents the asynchronous extracting operation. + /// + /// If the width is not a multiple of 8, it can be changed by inner process.\n + /// The width will be a multiple of 8 greater than the set value. + /// + /// The path of the media file to extract the thumbnail. + /// The size of the thumbnail. + /// is null. + /// Requested does not exist. + /// Internal error occurred. + /// Caller does not have required privilege for accessing the . + /// + /// Width or height of is less than or equal to zero. + /// + /// The specified file is not supported. + public static Task ExtractAsync(string path, Size size) + { + return RunExtractAsync(path, size, CancellationToken.None); + } + + /// + /// Extracts the thumbnail for the given media with the specified path and size. + /// + /// 3 + /// A task that represents the asynchronous extracting operation. + /// + /// If the width is not a multiple of 8, it can be changed by inner process.\n + /// The width will be a multiple of 8 greater than the set value. + /// + /// The path of the media file to extract the thumbnail. + /// The size of the thumbnail. + /// The token to stop the operation. + /// is null. + /// Requested does not exist. + /// Internal error occurred. + /// Caller does not have required privilege for accessing the . + /// + /// Width or height of is less than or equal to zero. + /// + /// The specified file is not supported. + public static Task ExtractAsync(string path, Size size, + CancellationToken cancellationToken) + { + return RunExtractAsync(path, size, cancellationToken); + } + + private static Task RunExtractAsync(string path, Size? size, + CancellationToken cancellationToken) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + if (File.Exists(path) == false) + { + throw new FileNotFoundException("File does not exists.", path); + } + + if (size.HasValue) + { + if (size.Value.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Value.Width, + "The width must be greater than zero."); + } + + if (size.Value.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Value.Height, + "The height must be greater than zero."); + } + } + + return cancellationToken.IsCancellationRequested ? + Task.FromCanceled(cancellationToken) : + ExtractAsyncCore(path, size, cancellationToken); + } + + + private static async Task ExtractAsyncCore(string path, Size? size, + CancellationToken cancellationToken) + { + using (var handle = CreateHandle()) + { + Native.SetPath(handle, path).ThrowIfError("Failed to extract; failed to set the path."); + + if (size.HasValue) + { + Native.SetSize(handle, size.Value.Width, size.Value.Height). + ThrowIfError("Failed to extract; failed to set the size"); + } + + var tcs = new TaskCompletionSource(); + + IntPtr id = IntPtr.Zero; + + try + { + Native.Extract(handle, GetCallback(tcs), IntPtr.Zero, out id) + .ThrowIfError("Failed to extract."); + + using (RegisterCancellationToken(tcs, cancellationToken, handle, Marshal.PtrToStringAnsi(id))) + { + return await tcs.Task; + } + } + finally + { + LibcSupport.Free(id); + } + } + } + + private static Native.ThumbnailExtractCallback GetCallback(TaskCompletionSource tcs) + { + return (error, requestId, thumbWidth, thumbHeight, thumbData, dataSize, _) => + { + if (error == ThumbnailExtractorError.None) + { + try + { + byte[] tmpBuf = new byte[dataSize]; + Marshal.Copy(thumbData, tmpBuf, 0, dataSize); + + tcs.SetResult(new ThumbnailExtractionResult(tmpBuf, thumbWidth, thumbHeight)); + } + catch (Exception e) + { + tcs.SetException(new InvalidOperationException("[" + error + "] Failed to copy data.", e)); + } + finally + { + LibcSupport.Free(thumbData); + } + } + else + { + tcs.SetException(error.ToException("Failed to extract.")); + } + }; + } + + private static IDisposable RegisterCancellationToken(TaskCompletionSource tcs, + CancellationToken cancellationToken, Handle handle, string id) + { + if (cancellationToken.CanBeCanceled == false) + { + return null; + } + + return cancellationToken.Register(() => + { + if (tcs.Task.IsCompleted) + { + return; + } + + Native.Cancel(handle, id).ThrowIfError("Failed to cancel."); + tcs.TrySetCanceled(); + }); + } + } +} diff --git a/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorError.cs b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorError.cs new file mode 100644 index 0000000..f14ea05 --- /dev/null +++ b/src/Tizen.Multimedia.Util/ThumbnailExtractor/ThumbnailExtractorError.cs @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia.Util +{ + internal enum ThumbnailExtractorError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidOperation = ErrorCode.InvalidOperation, + FileNoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + TizenThumbnailUtilError = -0x02F90000, + UnsupportedContent = TizenThumbnailUtilError | 0x01, + }; + + internal static class ThumbnailExtractorErrorExtensions + { + internal static void ThrowIfError(this ThumbnailExtractorError errorCode, string errorMessage) + { + if (errorCode == ThumbnailExtractorError.None) + { + return; + } + + throw errorCode.ToException(errorMessage); + } + + internal static Exception ToException(this ThumbnailExtractorError errorCode, string errorMessage) + { + switch (errorCode) + { + case ThumbnailExtractorError.InvalidParameter: + return new ArgumentException(errorMessage); + + case ThumbnailExtractorError.OutOfMemory: + return new OutOfMemoryException(errorMessage); + + case ThumbnailExtractorError.InvalidOperation: + return new InvalidOperationException(errorMessage); + + case ThumbnailExtractorError.FileNoSpaceOnDevice: + return new IOException("No space to write on the device."); + + case ThumbnailExtractorError.PermissionDenied: + return new UnauthorizedAccessException("[" + errorCode.ToString() + "]" + errorMessage); + + case ThumbnailExtractorError.UnsupportedContent: + return new FileFormatException(errorMessage); + } + + return new InvalidOperationException("[" + errorCode.ToString() + "]" + errorMessage); + } + } +} + diff --git a/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.sln b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.sln new file mode 100755 index 0000000..1e5b8ad --- /dev/null +++ b/src/Tizen.Multimedia.Util/Tizen.Multimedia.Util.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Util", "Tizen.Multimedia.Util.csproj", "{7B123B52-9A9F-4785-960E-C8AA5A9D2AF8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{A35FBE9E-543B-4D4C-AA97-E88A13D3C34F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{A4960572-B5DF-4CEA-9ECB-EC91ED527997}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{975A2DDA-1842-438F-9A40-AD34FCDE50B0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{65032A36-D61E-420E-AB34-CF3313895F0D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7B123B52-9A9F-4785-960E-C8AA5A9D2AF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7B123B52-9A9F-4785-960E-C8AA5A9D2AF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7B123B52-9A9F-4785-960E-C8AA5A9D2AF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7B123B52-9A9F-4785-960E-C8AA5A9D2AF8}.Release|Any CPU.Build.0 = Release|Any CPU + {A35FBE9E-543B-4D4C-AA97-E88A13D3C34F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A35FBE9E-543B-4D4C-AA97-E88A13D3C34F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A35FBE9E-543B-4D4C-AA97-E88A13D3C34F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A35FBE9E-543B-4D4C-AA97-E88A13D3C34F}.Release|Any CPU.Build.0 = Release|Any CPU + {A4960572-B5DF-4CEA-9ECB-EC91ED527997}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4960572-B5DF-4CEA-9ECB-EC91ED527997}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4960572-B5DF-4CEA-9ECB-EC91ED527997}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4960572-B5DF-4CEA-9ECB-EC91ED527997}.Release|Any CPU.Build.0 = Release|Any CPU + {975A2DDA-1842-438F-9A40-AD34FCDE50B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {975A2DDA-1842-438F-9A40-AD34FCDE50B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {975A2DDA-1842-438F-9A40-AD34FCDE50B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {975A2DDA-1842-438F-9A40-AD34FCDE50B0}.Release|Any CPU.Build.0 = Release|Any CPU + {65032A36-D61E-420E-AB34-CF3313895F0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65032A36-D61E-420E-AB34-CF3313895F0D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65032A36-D61E-420E-AB34-CF3313895F0D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65032A36-D61E-420E-AB34-CF3313895F0D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..c48de1c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MediaVision = "libcapi-media-vision.so.0"; + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs new file mode 100644 index 0000000..03a0013 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.BarCode.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for barcode detector APIs + /// + internal static partial class BarcodeDetector + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_detect")] + internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, Rectangle roi, + DetectedCallback detectCb, IntPtr userData = default(IntPtr)); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DetectedCallback( + IntPtr source, + IntPtr engineCfg, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 5)] + Quadrangle[] locations, + [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 5)] + string[] messages, + BarcodeType[] types, + int numberOfBarcodes, + IntPtr userData); + } + + /// + /// Interop for barcode generator APIs + /// + internal static partial class BarcodeGenerator + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_source")] + internal static extern MediaVisionError GenerateSource(IntPtr engineCfg, string message, + BarcodeType type, int qrEncMode, int qrEcc, int qrVersion, IntPtr source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_barcode_generate_image")] + internal static extern MediaVisionError GenerateImage(IntPtr engineCfg, + string message, int imageWidth, int imageHeight, BarcodeType type, + int qrEncMode, int qrEcc, int qrVersion, string imagePath, BarcodeImageFormat imageFormat); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs new file mode 100644 index 0000000..771749f --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Common.cs @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + internal static Tizen.Multimedia.Point ToApiStruct(this MediaVision.Point pt) + { + return new Tizen.Multimedia.Point(pt.x, pt.y); + } + + internal static MediaVision.Point ToMarshalable(this Tizen.Multimedia.Point pt) + { + return new MediaVision.Point() { x = pt.X, y = pt.Y }; + } + + internal static MediaVision.Point[] ToMarshalable(Tizen.Multimedia.Point[] pts) + { + var result = new MediaVision.Point[pts.Length]; + for (int i = 0; i < pts.Length; ++i) + { + result[i] = pts[i].ToMarshalable(); + } + return result; + } + + + internal static Tizen.Multimedia.Quadrangle ToApiStruct(this MediaVision.Quadrangle quadrangle) + { + Tizen.Multimedia.Point[] points = new Tizen.Multimedia.Point[4]; + for (int i = 0; i < 4; ++i) + { + points[i] = quadrangle.points[i].ToApiStruct(); + } + return new Tizen.Multimedia.Quadrangle(points); + } + + internal static MediaVision.Quadrangle ToMarshalable(this Tizen.Multimedia.Quadrangle quadrangle) + { + MediaVision.Point[] points = new MediaVision.Point[4]; + for (int i = 0; i < 4; ++i) + { + points[i] = quadrangle.Points[i].ToMarshalable(); + } + return new MediaVision.Quadrangle() { points = points }; + } + + internal static Tizen.Multimedia.Rectangle ToApiStruct(this MediaVision.Rectangle rectangle) + { + return new Tizen.Multimedia.Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + } + + internal static MediaVision.Rectangle ToMarshalable(this Tizen.Multimedia.Rectangle rectangle) + { + return new MediaVision.Rectangle() + { + x = rectangle.X, + y = rectangle.Y, + width = rectangle.Width, + height = rectangle.Height + }; + } + + internal static Tizen.Multimedia.Rectangle[] ToApiStruct(MediaVision.Rectangle[] rects) + { + var result = new Tizen.Multimedia.Rectangle[rects.Length]; + + for (int i = 0; i < rects.Length; i++) + { + result[i] = rects[i].ToApiStruct(); + } + return result; + } + + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + [StructLayout(LayoutKind.Sequential)] + internal struct Point + { + internal int x; + internal int y; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct Rectangle + { + internal int x; + internal int y; + internal int width; + internal int height; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct Quadrangle + { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + internal Point[] points; + } + + /// + /// Interop for media vision source APIs + /// + internal static partial class MediaSource + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_source")] + internal static extern MediaVisionError Create(out IntPtr source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_source")] + internal static extern int Destroy(IntPtr /* mv_source_h */ source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_media_packet")] + internal static extern MediaVisionError FillMediaPacket(IntPtr source, IntPtr mediaPacket); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_fill_by_buffer")] + internal static extern MediaVisionError FillBuffer(IntPtr source, byte[] buffer, + int bufferSize, uint imageWidth, uint imageHeight, Colorspace colorspace); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_clear")] + internal static extern int Clear(IntPtr /* mv_source_h */ source); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_buffer")] + internal static extern MediaVisionError GetBuffer(IntPtr source, out IntPtr buffer, out int bufferSize); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_height")] + internal static extern int GetHeight(IntPtr source, out uint imageHeight); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_width")] + internal static extern int GetWidth(IntPtr source, out uint imageWidth); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_source_get_colorspace")] + internal static extern int GetColorspace(IntPtr /* mv_source_h */ source, out Tizen.Multimedia.Colorspace colorspace); + } + + /// + /// Interop for engine configuration APIs + /// + internal static partial class EngineConfig + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_create_engine_config")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_destroy_engine_config")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_double_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetDouble(IntPtr handle, string name, double value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_int_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetInt(IntPtr handle, string name, int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_bool_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetBool(IntPtr handle, string name, bool value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_set_string_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError SetString(IntPtr handle, string name, string value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_double_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetDouble(IntPtr handle, string name, out double value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_int_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetInt(IntPtr handle, string name, out int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_bool_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetBool(IntPtr handle, string name, out bool value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_engine_config_get_string_attribute")] + internal static extern Tizen.Multimedia.MediaVisionError GetString(IntPtr handle, string name, out IntPtr value); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs new file mode 100644 index 0000000..224caa8 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for Face APIs + /// + internal static partial class Face + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_detect")] + internal static extern MediaVisionError Detect(IntPtr source, IntPtr engineCfg, + DetectedCallback detectedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, + IntPtr faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr recognitionModel, IntPtr engineCfg, + ref Rectangle faceLocation, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_track")] + internal static extern MediaVisionError Track(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, + TrackedCallback trackedCb, bool doLearn, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_eye_condition_recognize")] + internal static extern MediaVisionError RecognizeEyeCondition(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, EyeConditionRecognizedCallback eyeConditionRecognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_facial_expression_recognize")] + internal static extern MediaVisionError RecognizeFacialExpression(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, MvFaceFacialExpressionRecognizedCallback expressionRecognizedCb, + IntPtr userData = default(IntPtr)); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DetectedCallback(IntPtr source, IntPtr engineCfg, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] Rectangle[] facesLocations, + int numberOfFaces, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecognizedCallback(IntPtr source, IntPtr recognitionModel, + IntPtr engineCfg, IntPtr faceLocation, IntPtr faceLabel, double confidence, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TrackedCallback(IntPtr source, IntPtr trackingModel, IntPtr engineCfg, + IntPtr location, double confidence, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EyeConditionRecognizedCallback(IntPtr source, IntPtr engineCfg, + Rectangle faceLocation, EyeCondition eyeCondition, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MvFaceFacialExpressionRecognizedCallback(IntPtr source, + IntPtr engineCfg, Rectangle faceLocation, FacialExpression facialExpression, IntPtr userData); + } + + /// + /// Interop for FaceRecognitionModel APIs + /// + internal static partial class FaceRecognitionModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] + internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, + ref Rectangle exampleLocation, int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_add")] + internal static extern MediaVisionError Add(IntPtr source, IntPtr recognitionModel, + IntPtr exampleLocation, int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] + internal static extern MediaVisionError Reset(IntPtr recognitionModel, IntPtr faceLabel = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_reset")] + internal static extern MediaVisionError Remove(IntPtr recognitionModel, ref int faceLabel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_learn")] + internal static extern MediaVisionError Learn(IntPtr engineCfg, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_recognition_model_query_labels")] + internal static extern MediaVisionError QueryLabels(IntPtr handle, out IntPtr labels, out uint numberOfLabels); + } + + /// + /// Interop for FaceTrackingModel APIs + /// + internal static partial class FaceTrackingModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] + internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, + IntPtr source, ref Quadrangle location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_prepare")] + internal static extern MediaVisionError Prepare(IntPtr trackingModel, IntPtr engineCfg, + IntPtr source, IntPtr location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_face_tracking_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs new file mode 100644 index 0000000..215331b --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Image.cs @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for Media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for Image APIs + /// + internal static partial class Image + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_recognize")] + internal static extern MediaVisionError Recognize(IntPtr source, IntPtr[] imageObjects, + int numberOfObjects, IntPtr engineCfg, RecognizedCallback recognizedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_track")] + internal static extern MediaVisionError Track(IntPtr source, IntPtr imageTrackingModel, + IntPtr engineCfg, TrackedCallback trackedCb, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_create")] + internal static extern MediaVisionError Create(out IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] + internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, ref Rectangle location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_fill")] + internal static extern MediaVisionError Fill(IntPtr handle, IntPtr engineCfg, IntPtr source, IntPtr location); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_recognition_rate")] + internal static extern MediaVisionError GetRecognitionRate(IntPtr handle, out double recognitionRate); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_set_label")] + internal static extern MediaVisionError SetLabel(IntPtr handle, int label); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_get_label")] + internal static extern MediaVisionError GetLabel(IntPtr handle, out int label); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dst); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr handle); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_object_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr handle); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecognizedCallback(IntPtr source, IntPtr engineCfg, IntPtr imageObjects, + [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)] + IntPtr[] locations, uint numberOfObjects, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TrackedCallback(IntPtr source, IntPtr imageTrackingModel, + IntPtr engineCfg, IntPtr location, IntPtr userData); + } + + /// + /// Interop for ImageTrackingModel APIs + /// + internal static partial class ImageTrackingModel + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_create")] + internal static extern MediaVisionError Create(out IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_set_target")] + internal static extern MediaVisionError SetTarget(IntPtr handle, IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_destroy")] + internal static extern int Destroy(IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_refresh")] + internal static extern MediaVisionError Refresh(IntPtr imageTrackingModel, IntPtr engineCfg); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_save")] + internal static extern MediaVisionError Save(string fileName, IntPtr imageTrackingModel); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_image_tracking_model_load")] + internal static extern MediaVisionError Load(string fileName, out IntPtr imageTrackingModel); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs new file mode 100644 index 0000000..5119730 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Surveillance.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Multimedia; + +/// +/// Interop APIs +/// +internal static partial class Interop +{ + /// + /// Interop for media vision APIs + /// + internal static partial class MediaVision + { + /// + /// Interop for surveillance APIs + /// + internal static partial class Surveillance + { + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_create")] + internal static extern MediaVisionError EventTriggerCreate(string eventType, out IntPtr trigger); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_event_trigger_destroy")] + internal static extern int EventTriggerDestroy(IntPtr trigger); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_type")] + internal static extern int GetEventTriggerType(IntPtr trigger, out string eventType); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_set_event_trigger_roi")] + internal static extern MediaVisionError SetEventTriggerRoi(IntPtr trigger, int numberOfPoints, Point[] roi); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_event_trigger_roi")] + internal static extern MediaVisionError GetEventTriggerRoi(IntPtr trigger, out int numberOfPoints, out IntPtr roi); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_subscribe_event_trigger")] + internal static extern MediaVisionError SubscribeEventTrigger(IntPtr trigger, int videoStreamId, + IntPtr engineCfg, EventOccurredCallback callback, IntPtr userData = default(IntPtr)); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_unsubscribe_event_trigger")] + internal static extern MediaVisionError UnsubscribeEventTrigger(IntPtr trigger, int videoStreamId); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_push_source")] + internal static extern MediaVisionError PushSource(IntPtr source, int videoStreamId); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_supported_event_type")] + internal static extern int ForeachSupportedEventType(EventTypeCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_foreach_event_result_name")] + internal static extern int ForeachEventResultName(string eventType, EventResultNameCallback callback, + IntPtr userData); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, out int value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] int[] value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] double[] value); + + [DllImport(Libraries.MediaVision, EntryPoint = "mv_surveillance_get_result_value")] + internal static extern MediaVisionError GetResultValue(IntPtr result, string name, [Out] Rectangle[] value); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EventOccurredCallback(IntPtr trigger, IntPtr source, + int videoStreamId, IntPtr eventResult, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EventTypeCallback(string eventType, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool EventResultNameCallback(string name, IntPtr userData); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs b/src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs new file mode 100755 index 0000000..6735533 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/Barcode.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a detected barcode. + /// + /// 3 + public class Barcode + { + /// + /// Initializes a new instance of the class. + /// + /// 3 + public Barcode(Quadrangle region, string message, BarcodeType type) + { + Region = region; + Message = message; + Type = type; + } + + /// + /// The quadrangle location of detected barcode. + /// + /// 3 + public Quadrangle Region { get; } + + /// + /// The decoded message of barcode. + /// + /// 3 + public string Message { get; } + + /// + /// The type of detected barcode. + /// + /// 3 + public BarcodeType Type { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => + $"Region={Region}, Message={Message}, Type={Type.ToString()}"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs new file mode 100755 index 0000000..1da6986 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionConfiguration.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of . + /// + /// + /// 3 + public class BarcodeDetectionConfiguration : EngineConfiguration + { + private const string KeyAttrTarget = "MV_BARCODE_DETECT_ATTR_TARGET"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public BarcodeDetectionConfiguration() : base("barcode_detection") + { + } + + /// + /// Gets or sets the target of the barcode detection. + /// + /// is not valid. + /// The already has been disposed of. + /// 3 + public BarcodeDetectionTarget Target + { + get + { + return (BarcodeDetectionTarget)GetInt(KeyAttrTarget); + } + set + { + ValidationUtil.ValidateEnum(typeof(BarcodeDetectionTarget), value); + Set(KeyAttrTarget, (int)value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs new file mode 100755 index 0000000..231dce5 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetectionTarget.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the target of . + /// + /// 3 + public enum BarcodeDetectionTarget + { + /// + /// 1D and 2D. + /// + /// 3 + All, + + /// + /// 1D barcode only. + /// + /// 3 + Barcode1D, + + /// + /// 2D barcode only. + /// + /// 3 + Barcode2D, + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs new file mode 100755 index 0000000..df4d6da --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeDetector.cs @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using InteropBarcode = Interop.MediaVision.BarcodeDetector; +using Unmanaged = Interop.MediaVision; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to detect barcodes on image sources. + /// + /// 3 + public static class BarcodeDetector + { + /// + /// Detects barcodes on source and reads message from it. + /// + /// The instance. + /// Region of interest - rectangular area on the source which will be used for + /// barcode detection. Note that roi should be inside area on the source. + /// is null. + /// The feature is not supported. + /// already has been disposed of. + /// A task that represents the asynchronous detect operation. + /// + /// 3 + public static async Task> DetectAsync(MediaVisionSource source, + Rectangle roi) + { + return await DetectAsync(source, roi, null); + } + + /// + /// Detects barcodes on source and reads message from it with . + /// + /// The instance. + /// Region of interest - rectangular area on the source which will be used for + /// barcode detection. Note that roi should be inside area on the source. + /// The configuration of the barcode detector. This value can be null. + /// A task that represents the asynchronous detect operation. + /// is null. + /// The feature is not supported. + /// + /// already has been disposed of.\n + /// -or-\n + /// already has been disposed of. + /// + /// + /// 3 + public static async Task> DetectAsync(MediaVisionSource source, + Rectangle roi, BarcodeDetectionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + var tcs = new TaskCompletionSource>(); + + using (var cb = ObjectKeeper.Get(GetCallback(tcs))) + { + InteropBarcode.Detect(source.Handle, EngineConfiguration.GetHandle(config), + roi.ToMarshalable(), cb.Target).Validate("Failed to detect barcode."); + + return await tcs.Task; + } + } + + private static Barcode[] CreateBarcodes(Unmanaged.Quadrangle[] locations, string[] messages, + BarcodeType[] types, int numberOfBarcodes) + { + Barcode[] barcodes = new Barcode[numberOfBarcodes]; + + for (int i = 0; i < numberOfBarcodes; i++) + { + barcodes[i] = new Barcode(locations[i].ToApiStruct(), messages[i], types[i]); + + Log.Info(MediaVisionLog.Tag, barcodes[i].ToString()); + } + + return barcodes; + } + + private static InteropBarcode.DetectedCallback GetCallback(TaskCompletionSource> tcs) + { + return (IntPtr mvSource, IntPtr engineCfg, Unmanaged.Quadrangle[] locations, string[] messages, + BarcodeType[] types, int numberOfBarcodes, IntPtr userData) => + { + Log.Info(MediaVisionLog.Tag, $"Barcodes detected, count : {numberOfBarcodes}"); + + try + { + tcs.TrySetResult(CreateBarcodes(locations, messages, types, numberOfBarcodes)); + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to handle barcode detection callback", e); + tcs.TrySetException(e); + } + }; + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs new file mode 100755 index 0000000..eb29a04 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerationConfiguration.cs @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Tizen.Common; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of instances. + /// + /// + /// 3 + public class BarcodeGenerationConfiguration : EngineConfiguration + { + private const string KeyTextAttr = "MV_BARCODE_GENERATE_ATTR_TEXT"; + private const string KeyForegroundColorAttr = "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT"; + private const string KeyBackgroundColorAttr = "MV_BARCODE_GENERATE_ATTR_COLOR_BACK"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public BarcodeGenerationConfiguration() : base("barcode_generation") + { + } + + /// + /// Gets or sets the text visibility of the barcode to be generated. + /// + /// is not valid. + /// The already has been disposed of. + /// 3 + public Visibility TextVisibility + { + get + { + return (Visibility)GetInt(KeyTextAttr); + } + set + { + ValidationUtil.ValidateEnum(typeof(Visibility), value); + Set(KeyTextAttr, (int)value); + } + } + + private Color _foregroundColor = Color.Black; + + /// + /// Gets or sets the foreground color of the barcode to be generated. + /// + /// + /// The alpha value of the color will be ignored. + /// + /// The already has been disposed of. + /// 3 + public Color ForegroundColor + { + get + { + return _foregroundColor; + } + set + { + Set(KeyForegroundColorAttr, string.Format("{0:x2}{1:x2}{2:x2}", value.R, value.G, value.B)); + _foregroundColor = value; + } + } + + private Color _backgroundColor = Color.White; + + /// + /// Gets or sets the background color of the barcode to be generated. + /// + /// + /// The alpha value of the color will be ignored. + /// + /// The already has been disposed of. + /// 3 + public Color BackgroundColor + { + get + { + return _backgroundColor; + } + set + { + Set(KeyBackgroundColorAttr, string.Format("{0:x2}{1:x2}{2:x2}", value.R, value.G, value.B)); + _backgroundColor = value; + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs new file mode 100755 index 0000000..b4be4a1 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeGenerator.cs @@ -0,0 +1,357 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using InteropBarcode = Interop.MediaVision.BarcodeGenerator; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to generate barcodes and QR codes. + /// Different encoding types , error correction codes + /// and code versions are supported for QRCodes. + /// + /// + /// 3 + public static class BarcodeGenerator + { + private const int NoneErrorCorrection = (int)ErrorCorrectionLevel.High + 1; + private const int NoneQrMode = (int)QrMode.Utf8 + 1; + + private static MediaVisionSource GenerateSource(BarcodeGenerationConfiguration config, + string message, BarcodeType type, int qrMode, int qrEcc, int qrVersion) + { + if (message == null) + { + throw new ArgumentNullException(nameof(message)); + } + + ValidationUtil.ValidateEnum(typeof(BarcodeType), type); + + MediaVisionSource source = new MediaVisionSource(); + try + { + InteropBarcode.GenerateSource(EngineConfiguration.GetHandle(config), + message, type, qrMode, qrEcc, qrVersion, source.Handle). + Validate("Failed to generate source"); + } + catch (Exception) + { + source.Dispose(); + throw; + } + return source; + } + + /// + /// Generates a QR image with the specified message. + /// + /// The message to be encoded in the barcode. + /// The instance. + /// containing the generated QR image. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// contains characters which are illegal by the . + /// + /// The feature is not supported. + /// + /// 3 + public static MediaVisionSource GenerateSource(string message, QrConfiguration qrConfig) + { + return GenerateSource(message, qrConfig, null); + } + + /// + /// Generates a QR image with the specified message with . + /// + /// The message to be encoded in the barcode. + /// The instance. + /// The configuration of the barcode generator. This value can be null. + /// containing the generated QR image. + /// + /// must be , + /// because the text visibility is not supported in the QR code. + /// + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// contains characters which are illegal by the . + /// + /// + /// The feature is not supported.\n + /// -or-\n + /// is the . + /// + /// already has been disposed of. + /// + /// 3 + public static MediaVisionSource GenerateSource(string message, QrConfiguration qrConfig, + BarcodeGenerationConfiguration config) + { + if (qrConfig == null) + { + throw new ArgumentNullException(nameof(qrConfig)); + } + + if (config != null) + { + if (config.TextVisibility == Visibility.Visible) + { + throw new NotSupportedException("Text can't be visible in QR."); + } + } + + return GenerateSource(config, message, BarcodeType.QR, (int)qrConfig.Mode, + (int)qrConfig.ErrorCorrectionLevel, qrConfig.Version); + } + + /// + /// Generates a barcode image with the specified message. + /// + /// The message to be encoded in the barcode. + /// Type of the barcode to be generated. + /// containing the generated barcode image. + /// is null. + /// + /// is too long.\n + /// -or-\n + /// is .\n + /// -or-\n + /// is invalid. + /// -or-\n + /// contains illegal characters. + /// + /// The feature is not supported. + /// 3 + public static MediaVisionSource GenerateSource(string message, BarcodeType type) + { + return GenerateSource(message, type, null); + } + + /// + /// Generates a barcode image with the specified message and . + /// + /// The message to be encoded in the barcode. + /// Type of the barcode to be generated. + /// The configuration of the barcode generator. This value can be null. + /// containing the generated barcode image. + /// is null. + /// + /// is too long.\n + /// -or-\n + /// is . + /// -or-\n + /// is invalid. + /// -or-\n + /// contains illegal characters. + /// + /// The feature is not supported. + /// already has been disposed of. + /// 3 + public static MediaVisionSource GenerateSource(string message, BarcodeType type, + BarcodeGenerationConfiguration config) + { + if (type == BarcodeType.QR) + { + throw new ArgumentException($"Invalid barcode type : {type}."); + } + + return GenerateSource(config, message, type, NoneQrMode, NoneErrorCorrection, 0); + } + + private static void GenerateImage(BarcodeGenerationConfiguration config, + string message, BarcodeType type, BarcodeImageConfiguration imageConfig, + int qrMode, int qrEcc, int qrVersion) + { + if (message == null) + { + throw new ArgumentNullException(nameof(message)); + } + + if (imageConfig == null) + { + throw new ArgumentNullException(nameof(imageConfig)); + } + + ValidationUtil.ValidateEnum(typeof(BarcodeType), type); + + InteropBarcode.GenerateImage(EngineConfiguration.GetHandle(config), message, + imageConfig.Width, imageConfig.Height, type, qrMode, qrEcc, qrVersion, + imageConfig.Path, imageConfig.Format). + Validate("Failed to generate image"); + } + + /// + /// Generates a QR image file with the specified message. + /// + /// + /// must be , + /// because the text visibility is not supported in the QR code. + /// + /// The message to be encoded in the barcode. + /// The instance. + /// The that contains information about the file to be generated. + /// + /// is null.\n + /// -or-\n + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// contains characters which are illegal by the . + /// + /// No permission to write a file. + /// The feature is not supported. + /// + /// 3 + public static void GenerateImage(string message, QrConfiguration qrConfig, + BarcodeImageConfiguration imageConfig) + { + GenerateImage(message, qrConfig, imageConfig, null); + } + + /// + /// Generates a QR image file with the specified message and . + /// + /// + /// must be , + /// because the text visibility is not supported in the QR code. + /// + /// The message to be encoded in the barcode. + /// The instance. + /// The that contains + /// information about the file to be generated. + /// The configuration of the barcode generator. This value can be null. + /// + /// is null.\n + /// -or-\n + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// contains characters which are illegal by the . + /// + /// No permission to write a file. + /// + /// The feature is not supported.\n + /// -or-\n + /// is the . + /// + /// already has been disposed of. + /// 3 + public static void GenerateImage(string message, QrConfiguration qrConfig, + BarcodeImageConfiguration imageConfig, BarcodeGenerationConfiguration config) + { + if (qrConfig == null) + { + throw new ArgumentNullException(nameof(qrConfig)); + } + + if (config != null) + { + if (config.TextVisibility == Visibility.Visible) + { + throw new NotSupportedException("Text can't be visible in QR."); + } + } + + GenerateImage(config, message, BarcodeType.QR, imageConfig, (int)qrConfig.Mode, + (int)qrConfig.ErrorCorrectionLevel, qrConfig.Version); + } + + /// + /// Generates a barcode image file with the specified message. + /// + /// The message to be encoded in the barcode. + /// Type of the barcode to be generated. + /// The that contains + /// information about the file to be generated. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// is . + /// -or-\n + /// is invalid. + /// -or-\n + /// contains illegal characters. + /// + /// No permission to write a file. + /// The feature is not supported. + /// 3 + public static void GenerateImage(string message, BarcodeType type, BarcodeImageConfiguration imageConfig) + { + GenerateImage(message, type, imageConfig, null); + } + + /// + /// Generates a barcode image file with the specified message and . + /// + /// The message to be encoded in the barcode. + /// Type of the barcode to be generated. + /// The that contains + /// information about the file to be generated. + /// The configuration of the barcode generator. This value can be null. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// is too long.\n + /// -or-\n + /// is . + /// -or-\n + /// is invalid. + /// -or-\n + /// contains illegal characters. + /// + /// No permission to write a file. + /// The feature is not supported. + /// already has been disposed of. + /// 3 + public static void GenerateImage(string message, + BarcodeType type, BarcodeImageConfiguration imageConfig, BarcodeGenerationConfiguration config) + { + if (type == BarcodeType.QR) + { + throw new ArgumentException($"Invalid barcode type : {type}."); + } + GenerateImage(config, message, type, imageConfig, NoneQrMode, NoneErrorCorrection, 0); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs new file mode 100755 index 0000000..6227c88 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageConfiguration.cs @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration for the image to be generated by . + /// + /// 3 + public class BarcodeImageConfiguration + { + /// + /// Initializes a new instance of the class. + /// + /// + /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) is needed if image path is relevant to media storage.\n + /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if image path is relevant to external storage. + /// + /// The of the generated image. + /// The path to the file to be generated. + /// The format of the output image. + /// + /// The width of is less than or equal to zero.\n + /// -or-\n + /// The height of is less than or equal to zero. + /// + /// is null. + /// is invalid. + /// + /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(new Size(500, 400), "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG); + /// + /// 3 + public BarcodeImageConfiguration(Size size, string path, BarcodeImageFormat imageFormat) + { + if (size.Width <= 0) + { + throw new ArgumentOutOfRangeException(nameof(Size.Width), size.Width, + "width can't be less than or equal to zero."); + } + + if (size.Height <= 0) + { + throw new ArgumentOutOfRangeException(nameof(Size.Height), size.Height, + "height can't be less than or equal to zero."); + } + + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + ValidationUtil.ValidateEnum(typeof(BarcodeImageFormat), imageFormat); + + Size = size; + Path = path; + Format = imageFormat; + } + + /// + /// Initializes a new instance of the class. + /// + /// + /// The mediastorage privilege(http://tizen.org/privilege/mediastorage) is needed if image path is relevant to media storage.\n + /// The externalstorage privilege(http://tizen.org/privilege/externalstorage) is needed if image path is relevant to external storage. + /// + /// The width of the image to be generated. + /// The height of the image to be generated. + /// The path to the file to be generated. + /// The format of the output image. + /// + /// is less than or equal to zero.\n + /// -or-\n + /// is less than or equal to zero. + /// + /// is null. + /// is invalid. + /// + /// BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration(500, 400, "/opt/usr/test-barcode-generate-new", BarcodeImageFormat.JPG); + /// + /// 3 + public BarcodeImageConfiguration(int width, int height, string path, BarcodeImageFormat imageFormat) + : this(new Size(width, height), path, imageFormat) + { + } + + /// + /// Gets the size of the image. + /// + /// 3 + public Size Size { get; } + + /// + /// Gets the width of the image. + /// + /// 3 + public int Width => Size.Width; + + /// + /// Gets the height of the image. + /// + /// 3 + public int Height => Size.Height; + + /// + /// Gets the path to the file that has to be generated. + /// + /// + /// The mediastorage privilege http://tizen.org/privilege/mediastorage is needed if image path is relevant to media storage.\n + /// The externalstorage privilege http://tizen.org/privilege/externalstorage is needed if image path is relevant to external storage. + /// + /// 3 + public string Path { get; } + + /// + /// Gets the format of the output image. + /// + /// 3 + public BarcodeImageFormat Format { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs new file mode 100755 index 0000000..5481510 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeImageFormat.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies supported image formats for + /// + /// + /// 3 + public enum BarcodeImageFormat + { + /// + /// BMP image format. + /// + /// 3 + Bmp, + /// + /// JPEG image format. + /// + /// 3 + Jpeg, + /// + /// PNG image format. + /// + /// 3 + Png + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs new file mode 100755 index 0000000..2cc4283 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/BarcodeType.cs @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the supported barcode types. + /// + /// + /// QR codes (versions 1 to 40) and set of 1D barcodes are supported + /// + /// + /// + /// 3 + public enum BarcodeType + { + /// + /// 2D barcode - Quick Response code. + /// + /// 3 + QR, + /// + /// 1D barcode - Universal Product Code with 12-digit. + /// + /// 3 + UpcA, + /// + /// 1D barcode - Universal Product Code with 6-digit. + /// + /// 3 + UpcE, + /// + /// 1D barcode - International Article Number with 8-digit. + /// + /// 3 + Ean8, + /// + /// 1D barcode - International Article Number with 13-digit. + /// + /// 3 + Ean13, + /// + /// 1D barcode - Code 128. + /// + /// 3 + Code128, + /// + /// 1D barcode - Code 39. + /// + /// 3 + Code39, + /// + /// 1D barcode - Interleaved Two of Five. + /// + /// 3 + I25 + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs b/src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs new file mode 100755 index 0000000..79135e0 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/Colorspace.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies colorspaces for MediaVision. + /// + /// 3 + public enum Colorspace + { + /// + /// The colorspace type is invalid. + /// + /// 3 + Invalid, + /// + /// The colorspace type is Y800. + /// + /// 3 + Y800, + /// + /// The colorspace type is I420. + /// + /// 3 + I420, + /// + /// The colorspace type is NV12. + /// + /// 3 + NV12, + /// + /// The colorspace type is YV12. + /// + /// 3 + YV12, + /// + /// The colorspace type is NV21. + /// + /// 3 + NV21, + /// + /// The colorspace type is YUYV. + /// + /// 3 + Yuyv, + /// + /// The colorspace type is UYVY. + /// + /// 3 + Uyvy, + /// + /// The colorspace type is 422P. + /// + /// 3 + Yuv422P, + /// + /// The colorspace type is RGB565. + /// + /// 3 + Rgb565, + /// + /// The colorspace type is RGB888. + /// + /// 3 + Rgb888, + /// + /// The colorspace type is RGBA. + /// + /// 3 + Rgba + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs new file mode 100755 index 0000000..354205c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/EngineConfiguration.cs @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.System; +using System.Runtime.InteropServices; +using static Interop.MediaVision; + +namespace Tizen.Multimedia +{ + /// + /// A base class for configuration classes. + /// + /// 3 + public abstract class EngineConfiguration : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + private const string _featurePath = "http://tizen.org/feature/vision."; + + private bool IsSupportedEngineType(string type) + { + bool isSupported = false; + + string featureType = _featurePath + type; + + bool ret = SystemInfo.TryGetValue(featureType, out isSupported); + + return (isSupported && ret) ? true : false; + } + + private bool IsSupportedEngineType(string type1, string type2) + { + return (IsSupportedEngineType(type1) && IsSupportedEngineType(type2)) ? true : false; + } + + internal EngineConfiguration(string engineType) + { + if (IsSupportedEngineType(engineType) == false) + { + throw new NotSupportedException($"{engineType} : Not Supported"); + } + + EngineConfig.Create(out _handle).Validate("Failed to create media vision engine."); + } + + internal EngineConfiguration(string engineType1, string engineType2) + { + + if (IsSupportedEngineType(engineType1, engineType2) == false) + { + throw new NotSupportedException($"{engineType1} or {engineType2} : Not Supported"); + } + + EngineConfig.Create(out _handle).Validate("Failed to create media vision engine."); + } + + ~EngineConfiguration() + { + Dispose(false); + } + + internal static IntPtr GetHandle(EngineConfiguration config) + { + if (config == null) + { + return IntPtr.Zero; + } + + if (config._disposed) + { + throw new ObjectDisposedException(config.GetType().Name); + } + + return config._handle; + } + + internal void Set(string key, double value) + { + EngineConfig.SetDouble(Handle, key, value).Validate("Failed to set attribute"); + } + + internal void Set(string key, int value) + { + EngineConfig.SetInt(Handle, key, value).Validate("Failed to set attribute"); + } + + + internal void Set(string key, bool value) + { + EngineConfig.SetBool(Handle, key, value).Validate("Failed to set attribute"); + } + + internal void Set(string key, string value) + { + EngineConfig.SetString(Handle, key, value).Validate("Failed to set attribute"); + } + + internal int GetInt(string key) + { + int value = 0; + EngineConfig.GetInt(Handle, key, out value).Validate("Failed to get the value"); + return value; + } + + internal double GetDouble(string key) + { + double value = 0; + EngineConfig.GetDouble(Handle, key, out value).Validate("Failed to get the value"); + return value; + } + + internal bool GetBool(string key) + { + bool value = false; + EngineConfig.GetBool(Handle, key, out value).Validate("Failed to get the value"); + return value; + } + + internal string GetString(string key) + { + IntPtr ptr = IntPtr.Zero; + + try + { + EngineConfig.GetString(Handle, key, out ptr).Validate("Failed to get the value"); + return Marshal.PtrToStringAnsi(ptr); + } + finally + { + LibcSupport.Free(ptr); + } + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + EngineConfig.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(EngineConfiguration)); + } + return _handle; + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs b/src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs new file mode 100755 index 0000000..7388c4f --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ErrorCorrectionLevel.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the supported QR code error correction level. + /// + /// 3 + public enum ErrorCorrectionLevel + { + /// + /// Recovery up to 7% losses. + /// + /// 3 + Low, + /// + /// Recovery up to 15% losses. + /// + /// 3 + Medium, + /// + /// Recovery up to 25% losses. + /// + /// 3 + Quartile, + /// + /// Recovery up to 30% losses. + /// + /// 3 + High + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs b/src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs new file mode 100755 index 0000000..7cf912f --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/EyeCondition.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the eyes state types. + /// + /// 3 + public enum EyeCondition + { + /// + /// Eyes are open. + /// + /// 3 + Open, + + /// + /// Eyes are closed. + /// + /// 3 + Closed, + + /// + /// The eyes condition wasn't determined. + /// + /// 3 + NotFound + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs new file mode 100755 index 0000000..cd08d30 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetectionConfiguration.cs @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of instances. + /// + /// 3 + public class FaceDetectionConfiguration : EngineConfiguration + { + private const string KeyModelFilePath = "MV_FACE_DETECTION_MODEL_FILE_PATH"; + private const string KeyRoiX = "MV_FACE_DETECTION_ROI_X"; + private const string KeyRoiY = "MV_FACE_DETECTION_ROI_Y"; + private const string KeyRoiWidth = "MV_FACE_DETECTION_ROI_WIDTH"; + private const string KeyRoiHeight = "MV_FACE_DETECTION_ROI_HEIGHT"; + private const string KeyMinWidth = "MV_FACE_DETECTION_MIN_SIZE_WIDTH"; + private const string KeyMinHeight = "MV_FACE_DETECTION_MIN_SIZE_HEIGHT"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public FaceDetectionConfiguration() : base("face_recognition") + { + } + + /// + /// Gets or sets the face detection haarcascade xml file for face detection. + /// + /// is null. + /// 3 + public string ModelFilePath + { + get + { + return GetString(KeyModelFilePath); + } + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(ModelFilePath), "ModeFilePath can't be null."); + } + Set(KeyModelFilePath, value); + } + } + + + /// + /// Gets or sets minimum height of face which will be detected. + /// + /// + /// Default value is null (all detected faces will be applied), can be changed to specify the minimum face height. + /// + /// is less than zero. + /// 3 + public int? MinHeight + { + get + { + int value = GetInt(KeyMinHeight); + if (value == -1) return null; + return value; + } + set + { + if (value.HasValue && value < 0) + { + throw new ArgumentOutOfRangeException(nameof(MinHeight), value, + $"{nameof(MinHeight)} can't be less than zero."); + } + + Set(KeyMinHeight, value ?? -1); + } + } + + /// + /// Gets or sets minimum width of face which will be detected. + /// + /// + /// Default value is null (all detected faces will be applied), can be changed to specify the minimum face width. + /// + /// is less than zero. + /// 3 + public int? MinWidth + { + get + { + int value = GetInt(KeyMinWidth); + if (value == -1) return null; + return value; + } + set + { + if (value.HasValue && value < 0) + { + throw new ArgumentOutOfRangeException(nameof(MinWidth), value, + $"{nameof(MinWidth)} can't be less than zero."); + } + + Set(KeyMinWidth, value ?? -1); + } + } + + private static readonly Rectangle DefaultRoi = new Rectangle(-1, -1, -1, -1); + + private Rectangle? _roi; + + /// + /// Gets or sets the roi of the face detection. + /// + /// + /// Default value is null (the roi will be a full image) can be changed to specify the roi for face detection. + /// + /// + /// The width of is less than or equal to zero.\n + /// -or-\n + /// The height of is less than or equal to zero.\n + /// -or-\n + /// The x position of is less than zero.\n + /// -or-\n + /// The y position of is less than zero.\n + /// + /// 3 + public Rectangle? Roi + { + get + { + return _roi; + } + set + { + if (value != null) + { + ValidateRoi(value.Value); + } + + SetRoi(value ?? DefaultRoi); + + _roi = value; + } + } + + private static void ValidateRoi(Rectangle roi) + { + if (roi.Width <= 0) + { + throw new ArgumentOutOfRangeException("Roi.Width", roi.Width, + "The width of roi can't be less than or equal to zero."); + } + + if (roi.Height <= 0) + { + throw new ArgumentOutOfRangeException("Roi.Height", roi.Height, + "The height of roi can't be less than or equal to zero."); + } + + if (roi.X < 0) + { + throw new ArgumentOutOfRangeException("Roi.X", roi.X, + "The x position of roi can't be less than zero."); + } + + if (roi.Y < 0) + { + throw new ArgumentOutOfRangeException("Roi.Y", roi.Y, + "The y position of roi can't be less than zero."); + } + } + + private void SetRoi(Rectangle roi) + { + Set(KeyRoiX, roi.X); + Set(KeyRoiY, roi.Y); + Set(KeyRoiWidth, roi.Width); + Set(KeyRoiHeight, roi.Height); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs new file mode 100755 index 0000000..c99d966 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceDetector.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using InteropFace = Interop.MediaVision.Face; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to detect faces on image sources. + /// + /// 3 + public static class FaceDetector + { + + /// + /// Detects faces on the source.\n + /// Each time when DetectAsync is called, a set of the detected faces at the media source are received asynchronously. + /// + /// The source of the media where faces will be detected. + /// A task that represents the asynchronous detect operation. + /// is null. + /// + /// The feature is not supported.\n + /// -or-\n + /// The format of is not supported. + /// + /// 3 + public static async Task DetectAsync(MediaVisionSource source) + { + return await DetectAsync(source, null); + } + + /// + /// Detects faces on the source.\n + /// Each time when DetectAsync is called, a set of the detected faces at the media source are received asynchronously. + /// + /// The source of the media where faces will be detected. + /// The configuration of engine will be used for detecting. This value can be null. + /// A task that represents the asynchronous detect operation. + /// is null. + /// The feature is not supported. + /// 3 + public static async Task DetectAsync(MediaVisionSource source, + FaceDetectionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + + using (var cb = ObjectKeeper.Get(GetCallback(tcs))) + { + InteropFace.Detect(source.Handle, EngineConfiguration.GetHandle(config), cb.Target). + Validate("Failed to perform face detection"); + + return await tcs.Task; + } + } + + private static InteropFace.DetectedCallback GetCallback(TaskCompletionSource tcs) + { + return (IntPtr sourceHandle, IntPtr engineConfig, global::Interop.MediaVision.Rectangle[] facesLocations, + int numberOfFaces, IntPtr _) => + { + try + { + Log.Info(MediaVisionLog.Tag, $"Faces detected, count : {numberOfFaces}."); + Rectangle[] locations = new Rectangle[numberOfFaces]; + for (int i = 0; i < numberOfFaces; i++) + { + locations[i] = facesLocations[i].ToApiStruct(); + Log.Info(MediaVisionLog.Tag, $"Face {0} detected : {locations}."); + } + + if (!tcs.TrySetResult(locations)) + { + Log.Error(MediaVisionLog.Tag, "Failed to set face detection result."); + } + } + catch (Exception e) + { + MultimediaLog.Info(MediaVisionLog.Tag, "Failed to handle face detection.", e); + tcs.TrySetException(e); + } + }; + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs new file mode 100755 index 0000000..d3451f8 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionConfiguration.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of instances. + /// + /// 3 + public class FaceRecognitionConfiguration : EngineConfiguration + { + private const string KeyModelType = "MV_FACE_RECOGNITION_MODEL_TYPE"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public FaceRecognitionConfiguration() : base("face_recognition") + { + } + + /// + /// Gets or sets the method used for face recognition model learning. + /// Default value is . + /// + /// is not valid. + /// 3 + public FaceRecognitionModelType ModelType + { + get + { + return (FaceRecognitionModelType)GetInt(KeyModelType); + } + set + { + ValidationUtil.ValidateEnum(typeof(FaceRecognitionModelType), value); + Set(KeyModelType, (int)value); + } + } + + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs new file mode 100755 index 0000000..fc67b3d --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModel.cs @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Runtime.InteropServices; +using InteropModel = Interop.MediaVision.FaceRecognitionModel; + +namespace Tizen.Multimedia +{ + /// + /// Represents the face recognition model interface. + /// + /// 3 + public class FaceRecognitionModel : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public FaceRecognitionModel() + { + InteropModel.Create(out _handle).Validate("Failed to create FaceRecognitionModel"); + } + + /// + /// Initializes a new instance of the class with the specified path. + /// + /// + /// Models have been saved by can be loaded. + /// + /// Path to the model to load. + /// is null. + /// is invalid. + /// + /// The feature is not supported.\n + /// -or-\n + /// is not supported format. + /// + /// No permission to access the specified file. + /// + /// 3 + public FaceRecognitionModel(string modelPath) + { + if (modelPath == null) + { + throw new ArgumentNullException(nameof(modelPath)); + } + + InteropModel.Load(modelPath, out _handle). + Validate("Failed to load FaceRecognitionModel from file"); + } + + ~FaceRecognitionModel() + { + Dispose(false); + } + + /// + /// Gets labels that had been learned by the model. + /// + /// 3 + public int[] Labels + { + get + { + IntPtr unmangedArray = IntPtr.Zero; + try + { + uint numOfLabels = 0; + + InteropModel.QueryLabels(Handle, out unmangedArray, out numOfLabels). + Validate("Failed to retrieve face labels."); + + int[] labels = new int[numOfLabels]; + Marshal.Copy(unmangedArray, labels, 0, (int)numOfLabels); + + return labels; + } + finally + { + if (unmangedArray != IntPtr.Zero) + { + LibcSupport.Free(unmangedArray); + } + } + } + } + + /// + /// Saves the recognition model to the file. + /// + /// Path to the file to save the model. + /// is null. + /// No permission to write to the specified path. + /// The has already been disposed of. + /// The directory for does not exist. + /// 3 + public void Save(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + var ret = InteropModel.Save(path, Handle); + + if (ret == MediaVisionError.InvalidPath) + { + throw new DirectoryNotFoundException($"The directory for the path({path}) does not exist."); + } + + ret.Validate("Failed to save recognition model to file"); + } + + private MediaVisionError InvokeAdd(MediaVisionSource source, int label, Rectangle? area) + { + if (area != null) + { + var rect = area.Value.ToMarshalable(); + return InteropModel.Add(source.Handle, Handle, ref rect, label); + } + + return InteropModel.Add(source.Handle, Handle, IntPtr.Zero, label); + } + + /// + /// Adds face image example to be used for face recognition model learning. + /// + /// The that contains face image. + /// The label that identifies face for which example is adding. + /// Specify the same labels for the face images of a single person when calling this method. + /// Has to be unique for each face. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been dispose of. + /// + /// + /// 3 + public void Add(MediaVisionSource source, int label) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InvokeAdd(source, label, null).Validate("Failed to add face example image"); + } + + /// + /// Adds face image example to be used for face recognition model learning. + /// + /// The that contains face image. + /// The label that identifies face for which example is adding. + /// Specify the same labels for the face images of a single person when calling this method. + /// Has to be unique for each face. + /// The rectangular region of the face image at the source image. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been dispose of. + /// + /// + /// 3 + public void Add(MediaVisionSource source, int label, Rectangle area) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InvokeAdd(source, label, area).Validate("Failed to add face example image"); + } + + /// + /// Removes all face examples added with the specified label. + /// + /// The label that identifies face for which examples will be removed. + /// The has already been disposed of. + /// true if the examples are successfully removed; otherwise, false if there is no example labeled with the specified label. + /// + /// + /// 3 + public bool Remove(int label) + { + var ret = InteropModel.Remove(Handle, ref label); + + if (ret == MediaVisionError.KeyNotAvailable) + { + return false; + } + + ret.Validate("Failed to remove image example"); + return true; + } + + /// + /// Removes all face examples. + /// + /// The has already been disposed of. + /// 3 + public void Reset() + { + InteropModel.Reset(Handle).Validate("Failed to reset image example"); + } + + + /// + /// Learns face recognition model. + /// + /// + /// Before you start learning process, face recognition models has to be filled with training data - face image examples. + /// These examples has to be provided by or . + /// Recognition accuracy is usually increased when the different examples of the identical face are added more and more. + /// But it depends on the used learning algorithm. + /// + /// The has already been disposed of. + /// No examples added. + /// + /// + /// 3 + public void Learn() + { + Learn(null); + } + + /// + /// Learns face recognition model with . + /// + /// + /// Before you start learning process, face recognition models has to be filled with training data - face image examples. + /// These examples has to be provided by or . + /// Recognition accuracy is usually increased when the different examples of the identical face are added more and more. + /// But it depends on the used learning algorithm. + /// + /// The configuration used for learning of the recognition models. This value can be null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// No examples added. + /// + /// + /// 3 + public void Learn(FaceRecognitionConfiguration config) + { + InteropModel.Learn(EngineConfiguration.GetHandle(config), Handle). + Validate("Failed to learn"); + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + InteropModel.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(FaceRecognitionModel)); + } + return _handle; + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs new file mode 100755 index 0000000..f701f9e --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionModelType.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the face recognition model learning algorithms. + /// + /// 3 + public enum FaceRecognitionModelType + { + /// + /// Eigenfaces. + /// + /// 3 + EigenFaces = 1, + + /// + /// Fisherfaces. + /// + /// 3 + FisherFaces, + + /// + /// Local Binary Patterns Histograms (LBPH); The default type. + /// + /// 3 + Lbph + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs new file mode 100755 index 0000000..63d2fca --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognitionResult.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents result of operations. + /// + /// 3 + public class FaceRecognitionResult + { + internal FaceRecognitionResult(bool recognized, double confidence, int label, Rectangle? area) + { + Success = recognized; + Label = label; + Area = area; + Confidence = confidence; + } + + /// + /// Gets the value indicating the recognition is successful. + /// + /// 3 + public bool Success { get; } + + /// + /// Gets the label of the recognized face. + /// + /// 3 + public int Label { get; } + + /// + /// Gets the location of the recognized face. + /// + /// 3 + public Rectangle? Area { get; } + + /// + /// The confidence of the recognition model that face has been recognized correctly (value from 0.0 to 1.0). + /// No faces were recognized if confidence was 0.0. When model has been learned on large amount of examples, + /// threshold for this value can be high (0.85-0.95). If model was learned for small amount of examples, + /// then threshold can be reduced (0.5-0.85). + /// + /// 3 + public double Confidence { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs new file mode 100755 index 0000000..ba52619 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceRecognizer.cs @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using InteropFace = Interop.MediaVision.Face; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to recognize faces, face expressions and eye condition on image sources. + /// + /// 3 + public static class FaceRecognizer + { + + /// + /// Performs face recognition on the source with . + /// + /// The of the media to recognize faces for. + /// The to be used for recognition. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// has already been disposed of. + /// is untrained model. + /// 3 + public static async Task RecognizeAsync(MediaVisionSource source, + FaceRecognitionModel recognitionModel) + { + return await InvokeRecognizeAsync(source, recognitionModel, null, null); + } + + /// + /// Performs face recognition on the source with and a bounding box. + /// + /// The of the media to recognize faces for. + /// The to be used for recognition. + /// Rectangular box bounding face image on the source. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// has already been disposed of. + /// is untrained model. + /// 3 + public static async Task RecognizeAsync(MediaVisionSource source, + FaceRecognitionModel recognitionModel, Rectangle bound) + { + return await InvokeRecognizeAsync(source, recognitionModel, bound, null); + } + + /// + /// Performs face recognition on the source with and . + /// + /// The of the media to recognize faces for. + /// The to be used for recognition. + /// The configuration used for recognition. This value can be null. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// is untrained model. + /// 3 + public static async Task RecognizeAsync(MediaVisionSource source, + FaceRecognitionModel recognitionModel, FaceRecognitionConfiguration config) + { + return await InvokeRecognizeAsync(source, recognitionModel, null, config); + } + + + /// + /// Performs face recognition on the source with , + /// and a bounding box. + /// + /// The of the media to recognize faces for. + /// The to be used for recognition. + /// Rectangular box bounding face image on the source. + /// The used for recognition. This value can be null. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// is untrained model. + /// 3 + public static async Task RecognizeAsync(MediaVisionSource source, + FaceRecognitionModel recognitionModel, Rectangle bound, FaceRecognitionConfiguration config) + { + return await InvokeRecognizeAsync(source, recognitionModel, bound, config); + } + + private static MediaVisionError InvokeRecognize(IntPtr sourceHandle, IntPtr modelHandle, + IntPtr configHandle, InteropFace.RecognizedCallback cb, Rectangle? area) + { + if (area == null) + { + return InteropFace.Recognize(sourceHandle, modelHandle, configHandle, IntPtr.Zero, cb); + } + + var rect = area.Value.ToMarshalable(); + return InteropFace.Recognize(sourceHandle, modelHandle, configHandle, ref rect, cb); + } + + private static async Task InvokeRecognizeAsync(MediaVisionSource source, + FaceRecognitionModel recognitionModel, Rectangle? area, + FaceRecognitionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + if (recognitionModel == null) + { + throw new ArgumentNullException(nameof(recognitionModel)); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + + using (var cb = ObjectKeeper.Get(GetRecognizedCallback(tcs))) + { + InvokeRecognize(source.Handle, recognitionModel.Handle, EngineConfiguration.GetHandle(config), + cb.Target, area).Validate("Failed to perform face recognition."); + + return await tcs.Task; + } + } + + private static FaceRecognitionResult CreateRecognitionResult( + IntPtr faceLocationPtr, IntPtr faceLabelPtr, double confidence) + { + int faceLabel = 0; + if (faceLabelPtr != IntPtr.Zero) + { + faceLabel = Marshal.ReadInt32(faceLabelPtr); + } + + Rectangle? faceLocation = null; + if (faceLocationPtr != IntPtr.Zero) + { + var area = Marshal.PtrToStructure(faceLocationPtr); + faceLocation = area.ToApiStruct(); + } + + return new FaceRecognitionResult(faceLabelPtr != IntPtr.Zero, confidence, faceLabel, faceLocation); + } + + private static InteropFace.RecognizedCallback GetRecognizedCallback( + TaskCompletionSource tcs) + { + return (IntPtr sourceHandle, IntPtr recognitionModelHandle, + IntPtr engineCfgHandle, IntPtr faceLocationPtr, IntPtr faceLabelPtr, double confidence, IntPtr _) => + { + try + { + if (!tcs.TrySetResult(CreateRecognitionResult(faceLocationPtr, faceLabelPtr, confidence))) + { + Log.Error(MediaVisionLog.Tag, "Failed to set result"); + } + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Setting recognition result failed.", e); + tcs.TrySetException(e); + } + }; + } + + /// + /// Determines eye-blink condition on media source. + /// + /// The source of the media to recognize eye-blink condition for. + /// The bounding the face at the source. + /// A task that represents the asynchronous recognition operation. + /// is null. + /// has already been disposed of. + /// The feature is not supported. + /// 3 + public static async Task RecognizeEyeConditionAsync(MediaVisionSource source, + Rectangle bound) + { + return await RecognizeEyeConditionAsync(source, bound, null); + } + + /// + /// Determines eye-blink condition on media source. + /// + /// The source of the media to recognize eye-blink condition for. + /// The bounding the face at the source. + /// The configuration used for eye-blink condition recognition. This value can be null. + /// A task that represents the asynchronous recognition operation. + /// is null. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// The feature is not supported. + /// 3 + public static async Task RecognizeEyeConditionAsync(MediaVisionSource source, + Rectangle bound, FaceRecognitionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + + InteropFace.EyeConditionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle, + global::Interop.MediaVision.Rectangle faceLocation, EyeCondition eyeCondition, IntPtr _) => + { + Log.Info(MediaVisionLog.Tag, $"Eye condition recognized, eye condition : {eyeCondition}"); + if (!tcs.TrySetResult(eyeCondition)) + { + Log.Error(MediaVisionLog.Tag, "Failed to set eye condition result"); + } + }; + + using (var cbKeeper = ObjectKeeper.Get(cb)) + { + InteropFace.RecognizeEyeCondition(source.Handle, EngineConfiguration.GetHandle(config), + bound.ToMarshalable(), cb).Validate("Failed to perform eye condition recognition."); + + return await tcs.Task; + } + } + + /// + /// Determines facial expression on media source. + /// + /// The source of the media to recognize facial expression for. + /// The location bounding the face at the source. + /// A task that represents the asynchronous recognition operation. + /// is null. + /// has already been disposed of. + /// The feature is not supported. + /// 3 + public static async Task RecognizeFacialExpressionAsync(MediaVisionSource source, + Rectangle bound) + { + return await RecognizeFacialExpressionAsync(source, bound, null); + } + + /// + /// Determines facial expression on media source. + /// + /// The source of the media to recognize facial expression for. + /// The location bounding the face at the source. + /// The configuration used for expression recognition. This value can be null. + /// A task that represents the asynchronous recognition operation. + /// is null. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// The feature is not supported. + /// 3 + public static async Task RecognizeFacialExpressionAsync(MediaVisionSource source, + Rectangle bound, FaceRecognitionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + TaskCompletionSource tcsResult = new TaskCompletionSource(); + + InteropFace.MvFaceFacialExpressionRecognizedCallback cb = (IntPtr sourceHandle, IntPtr engineCfgHandle, + global::Interop.MediaVision.Rectangle faceLocation, FacialExpression facialExpression, IntPtr _) => + { + Log.Info(MediaVisionLog.Tag, $"Facial expression recognized, expression : {facialExpression}"); + if (!tcsResult.TrySetResult(facialExpression)) + { + Log.Error(MediaVisionLog.Tag, "Failed to set facial result"); + } + }; + + using (var cbKeeper = ObjectKeeper.Get(cb)) + { + InteropFace.RecognizeFacialExpression(source.Handle, EngineConfiguration.GetHandle(config), + bound.ToMarshalable(), cb). + Validate("Failed to perform facial expression recognition."); + + return await tcsResult.Task; + } + } + } +} + diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs new file mode 100755 index 0000000..4824579 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceTracker.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using InteropFace = Interop.MediaVision.Face; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to track faces on image sources. + /// + /// 3 + public static class FaceTracker + { + + /// + /// Performs face tracking on the source with the trackingModel. + /// + /// The source of the media to recognize face for. + /// The model will be used for tracking. + /// The value indicating whether model learning while tracking. If it is true then model will try to learn + /// (if it supports learning feature), otherwise model will be not learned during the invoking tracking iteration. + /// Learning process improves tracking correctness, but can decrease tracking performance. + /// A task that represents the asynchronous tracking operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// The feature is not supported. + /// is not prepared. + /// 3 + public static async Task TrackAsync(MediaVisionSource source, + FaceTrackingModel trackingModel, bool doLearn) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + if (trackingModel == null) + { + throw new ArgumentNullException(nameof(trackingModel)); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + + using (var cb = ObjectKeeper.Get(GetTrackCallback(tcs))) + { + InteropFace.Track(source.Handle, trackingModel.Handle, IntPtr.Zero, + cb.Target, doLearn).Validate("Failed to perform face tracking."); + + return await tcs.Task; + } + } + + private static InteropFace.TrackedCallback GetTrackCallback(TaskCompletionSource tcs) + { + return (IntPtr sourceHandle, IntPtr trackingModelHandle, IntPtr engineCfgHandle, + IntPtr locationPtr, double confidence, IntPtr _) => + { + try + { + Quadrangle area = null; + if (locationPtr != IntPtr.Zero) + { + area = Marshal.PtrToStructure(locationPtr).ToApiStruct(); + } + + Log.Info(MediaVisionLog.Tag, $"Tracked area : {area}, confidence : {confidence}"); + + if (!tcs.TrySetResult(new FaceTrackingResult(locationPtr != IntPtr.Zero, confidence, area))) + { + Log.Error(MediaVisionLog.Tag, "Failed to set tracking result"); + } + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Setting tracking result failed.", e); + tcs.TrySetException(e); + } + }; + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs new file mode 100755 index 0000000..be9ae12 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingModel.cs @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using InteropModel = Interop.MediaVision.FaceTrackingModel; + +namespace Tizen.Multimedia +{ + /// + /// Represents face tracking model. + /// + /// 3 + public class FaceTrackingModel : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public FaceTrackingModel() + { + InteropModel.Create(out _handle).Validate("Failed to create FaceTrackingModel."); + } + + /// + /// Initializes a new instance of the class with the specified path. + /// + /// + /// Models has been saved by can be loaded. + /// + /// Path to the model to load. + /// is null. + /// is invalid. + /// + /// The feature is not supported.\n + /// -or-\n + /// is not supported format. + /// + /// No permission to access the specified file. + /// + /// 3 + public FaceTrackingModel(string modelPath) + { + if (modelPath == null) + { + throw new ArgumentNullException(nameof(modelPath)); + } + InteropModel.Load(modelPath, out _handle).Validate("Failed to load FaceTrackingModel from file."); + } + + ~FaceTrackingModel() + { + Dispose(false); + } + + private MediaVisionError InvokePrepare(MediaVisionSource source, Quadrangle region) + { + if (region != null) + { + var quad = region.ToMarshalable(); + return InteropModel.Prepare(Handle, IntPtr.Zero, source.Handle, ref quad); + } + + return InteropModel.Prepare(Handle, IntPtr.Zero, source.Handle, IntPtr.Zero); + } + + /// + /// Initializes tracking model by the location of the face to be tracked. + /// + /// It is usually called once after tracking model is created and each time before tracking + /// is started for the new sequence of sources which is not the direct continuation of + /// the sequence for which tracking has been performed before. But it is allowed to call it + /// between tracking sessions to allow Media Vision start to track more accurately. + /// + /// + /// needs to be the position of the face to be tracked when called first time for the tracking model. + /// is fitted to the valid region of if has invalid points. + /// + /// The source where face location is specified. + /// Usually it is the first frame of the video or the first image in the continuous + /// image sequence planned to be used for tracking. + /// The region determining position of the face to be tracked on the source. + /// If null, then tracking model will try to find previously tracked face by itself. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already bean disposed of. + /// + /// 3 + public void Prepare(MediaVisionSource source, Quadrangle region) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InvokePrepare(source, region).Validate("Failed to prepare tracking model."); + } + + /// + /// Saves the tracking model to the file. + /// + /// Path to the file to save the model. + /// is null. + /// No permission to write to the specified path. + /// The has already been disposed of. + /// The directory for does not exist. + /// 3 + public void Save(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + var ret = InteropModel.Save(path, Handle); + + if (ret == MediaVisionError.InvalidPath) + { + throw new DirectoryNotFoundException($"The directory for the path({path}) does not exist."); + } + + ret.Validate("Failed to save tracking model to file"); + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + InteropModel.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(FaceTrackingModel)); + } + return _handle; + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs new file mode 100755 index 0000000..3ee5f6b --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FaceTrackingResult.cs @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents result of face tracking operation. + /// + /// 3 + public class FaceTrackingResult + { + internal FaceTrackingResult(bool success, double confidence, Quadrangle region) + { + Success = success; + Confidence = confidence; + Region = region; + } + + /// + /// Gets the value indicating the recognition is successful. + /// + /// 3 + public bool Success { get; } + + /// + /// Gets the region which determines new position of the tracked face on the source. + /// + /// 3 + public Quadrangle Region { get; } + + /// + /// The confidence of the tracking model that new location of the face was determined correctly + /// (value from 0.0 to 1.0). If no location was determined during last track iteration, then value is 0.0. + /// + /// 3 + public double Confidence { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs b/src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs new file mode 100755 index 0000000..c136d97 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/FacialExpression.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the expression types for faces. + /// + /// 3 + public enum FacialExpression + { + /// + /// Unknown face expression. + /// + /// 3 + Unknown, + + /// + /// Face expression is neutral. + /// + /// 3 + Neutral, + + /// + /// Face expression is smiling. + /// + /// 3 + Smile, + + /// + /// Face expression is sadness. + /// + /// 3 + Sadness, + + /// + /// Face expression is surprise. + /// + /// 3 + Surprise, + + /// + /// Face expression is anger. + /// + /// 3 + Anger, + + /// + /// Face expression is fear. + /// + /// 3 + Fear, + + /// + /// Face expression is disgust. + /// + /// 3 + Disgust + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs new file mode 100755 index 0000000..3b22467 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageFillConfiguration.cs @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of fill operations of instances. + /// + /// 3 + public class ImageFillConfiguration : EngineConfiguration + { + private const string KeyScaleFactor = "MV_IMAGE_RECOGNITION_OBJECT_SCALE_FACTOR"; + private const string KeyMaxKeypoints = "MV_IMAGE_RECOGNITION_OBJECT_MAX_KEYPOINTS_NUM"; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultScaleFactor = 1.2; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultMaxKeypoints = 1000; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public ImageFillConfiguration() : base("image_recognition") + { + } + + /// + /// Gets or sets the scale factor the image to be recognized.\n + /// The value of the factor will be used for resizing of the images (objects) for recognition. + /// The default value is 1.2. + /// + /// The already has been disposed of. + /// 3 + public double ObjectScaleFactor + { + get + { + return GetDouble(KeyScaleFactor); + } + set + { + Set(KeyScaleFactor, value); + } + } + + /// + /// Gets or sets the maximum key points should be detected on the image.\n + /// The maximal number of key points can be selected on the image object to calculate descriptors. + /// This key points will be used for image (object) recognition and has to be specified as integer number. + /// The default value is 1000. + /// + /// The already has been disposed of. + /// 3 + public int ObjectMaxKeyPoints + { + get + { + return GetInt(KeyMaxKeypoints); + } + set + { + Set(KeyMaxKeypoints, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs new file mode 100755 index 0000000..ac932c5 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageObject.cs @@ -0,0 +1,300 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using InteropImage = Interop.MediaVision.Image; + +namespace Tizen.Multimedia +{ + /// + /// Represents an image object. + /// + /// 3 + public class ImageObject : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public ImageObject() + { + InteropImage.Create(out _handle).Validate("Failed to create image object"); + } + + /// + /// Initializes a new instance of the class from the specified file. + /// + /// + /// ImageObject has been saved by can be loaded. + /// + /// Path to the image object to load. + /// is null. + /// is invalid. + /// + /// The feature is not supported.\n + /// -or-\n + /// is not supported file. + /// + /// No permission to access the specified file. + /// + /// 3 + public ImageObject(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + InteropImage.Load(path, out _handle).Validate("Failed to load image object from file"); + } + + ~ImageObject() + { + Dispose(false); + } + + /// + /// Gets a value that determines how well an image object can be recognized. + /// + /// + /// If recognition rate is too low, try to use another image or change some configuration parameters + /// and fill the image object again. + /// + /// + /// Recognition rate determines how well an image object can be recognized. This value can be from 0 to 1. + /// If the recognition rate is 0 object can not be recognized and the bigger it is the more likely to recognize the object. + /// + /// The has already been disposed of. + /// + /// + /// + /// + /// + /// 3 + public double RecognitionRate + { + get + { + InteropImage.GetRecognitionRate(Handle, out var rate).Validate("Failed to get recognition rate"); + return rate; + } + } + + #region Methods + /// + /// Gets the label for the image object. + /// + /// + /// The label value if the has label, otherwise null. + /// + /// The has already been disposed of. + /// + /// 3 + public int? GetLabel() + { + var ret = InteropImage.GetLabel(Handle, out var label); + + if (ret == MediaVisionError.NoData) + { + return null; + } + + ret.Validate("Failed to get label"); + return label; + } + + /// + /// Sets the label for the . + /// + /// + /// 3 + public void SetLabel(int label) + { + InteropImage.SetLabel(Handle, label).Validate("Failed to set label"); + } + + /// + /// Fills the image object.\n + /// Extracts data from @a source image which will be needed for recognition of depicted object in @a location. + /// + /// The source image where image object is depicted. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// 3 + public void Fill(MediaVisionSource source) + { + InvokeFill(source, null, null); + } + + /// + /// Fills the image object.\n + /// Extracts data from @a source image which will be needed for recognition of depicted object in @a location. + /// + /// The source image where image object is depicted. + /// The configuration used for extract recognition data from source. This value can be null. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// 3 + public void Fill(MediaVisionSource source, ImageFillConfiguration config) + { + InvokeFill(source, config, null); + } + + /// + /// Fills the image object.\n + /// Extracts data from @a source image which will be needed for recognition of depicted object in @a location. + /// + /// The source image where image object is depicted. + /// Rectangular bound of the image object on the source image. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of.\n + /// + /// 3 + public void Fill(MediaVisionSource source, Rectangle rect) + { + InvokeFill(source, null, rect); + } + + /// + /// Fills the image object.\n + /// Extracts data from @a source image which will be needed for recognition of depicted object in @a location. + /// + /// The source image where image object is depicted. + /// The configuration used for extract recognition data from source. This value can be null. + /// Rectangular bound of the image object on the source image. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// 3 + public void Fill(MediaVisionSource source, ImageFillConfiguration config, Rectangle rect) + { + InvokeFill(source, config, rect); + } + + private MediaVisionError InvokeFill(IntPtr source, IntPtr config, Rectangle? area) + { + if (area == null) + { + return InteropImage.Fill(Handle, config, source, IntPtr.Zero); + } + + var rect = area.Value.ToMarshalable(); + + return InteropImage.Fill(Handle, config, source, ref rect); + } + + private void InvokeFill(MediaVisionSource source, ImageFillConfiguration config, Rectangle? area) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + InvokeFill(source.Handle, EngineConfiguration.GetHandle(config), area). + Validate("Failed to fill the image object"); + } + + /// + /// Saves the image object. + /// + /// Path to the file to save the model. + /// is null. + /// No permission to write to the specified path. + /// The has already been disposed of. + /// The directory for does not exist. + /// 3 + public void Save(string path) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + + var ret = InteropImage.Save(path, Handle); + + if (ret == MediaVisionError.InvalidPath) + { + throw new DirectoryNotFoundException($"The directory for the path({path}) does not exist."); + } + + ret.Validate("Failed to save the image object"); + } + #endregion + + #region IDisposable-support + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + InteropImage.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ImageObject)); + } + return _handle; + } + } + #endregion + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs new file mode 100755 index 0000000..15dbd2e --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionConfiguration.cs @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of . + /// + /// 3 + public class ImageRecognitionConfiguration : EngineConfiguration + { + private const string KeySceneScaleFactor = "MV_IMAGE_RECOGNITION_SCENE_SCALE_FACTOR"; + private const string KeySceneMaxKeypoints = "MV_IMAGE_RECOGNITION_SCENE_MAX_KEYPOINTS_NUM"; + + private const string KeyMinKeypointsMatch = "MV_IMAGE_RECOGNITION_MIN_MATCH_NUM"; + private const string KeyReqMatchPartKey = "MV_IMAGE_RECOGNITION_REQ_MATCH_PART"; + private const string KeyTolerantPartMatchingError = "MV_IMAGE_RECOGNITION_TOLERANT_MATCH_PART_ERR"; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultSceneScaleFactor = 1.2; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultSceneMaxKeypoints = 5000; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultMinKeyPointMatches = 30; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultRequiredMatchPart = 0.05; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultTolerantPartMatchError = 0.1; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public ImageRecognitionConfiguration() : base("image_recognition") + { + } + + /// + /// Gets or sets the scene scale factor. + /// + /// + /// The value indicating the factor will be used for resizing of the scene including the images (objects) for recognition. + /// The default is 1.2. + /// + /// The already has been disposed of. + /// 3 + public double SceneScaleFactor + { + get + { + return GetDouble(KeySceneScaleFactor); + } + set + { + Set(KeySceneScaleFactor, value); + } + } + + /// + /// Gets or sets the maximum key points that should be detected on the scene. + /// The maximal number of key points can be selected on the scene including the images (objects) to calculate descriptors. + /// + /// + /// The maximal key points for image recognition. + /// The default is 5000. + /// + /// The already has been disposed of. + /// is less than zero. + /// 3 + public int SceneMaxKeyPoints + { + get + { + return GetInt(KeySceneMaxKeypoints); + } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(SceneMaxKeyPoints), value, + $"{nameof(SceneMaxKeyPoints)} can't be less than zero."); + } + Set(KeySceneMaxKeypoints, value); + } + } + + /// + /// Gets or sets the minimum number of key points matches required for recognition. + /// + /// + /// The minimal number of key points should be matched between an image and a scene for image objects recognition. + /// The default is 30. + /// + /// The already has been disposed of. + /// is less than zero. + /// 3 + public int MinKeyPointMatches + { + get + { + return GetInt(KeyMinKeypointsMatch); + } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(MinKeyPointMatches), value, + $"{nameof(MinKeyPointMatches)} can't be less than zero."); + } + Set(KeyMinKeypointsMatch, value); + } + } + + /// + /// Gets or sets the required matching part for the image recognition. + /// To recognize occluded or hidden an image by other images, required relative part of the matches in respect to the total + /// amount of matching keypoints required for image recognition. Too low value will result in unsustainable behavior, + /// but effect of object overlapping will be reduced. + /// + /// + /// The value indicating required relative part of the matches; can be from 0 to 1, inclusive. + /// The default is 0.05. + /// + /// The already has been disposed of. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than one. + /// + /// 3 + public double RequiredMatchingPart + { + get + { + return GetDouble(KeyReqMatchPartKey); + } + set + { + if (value < 0 || value > 1) + { + throw new ArgumentOutOfRangeException(nameof(value), value, "Valid range is 0 to 1 inclusive,"); + } + Set(KeyReqMatchPartKey, value); + } + } + + /// + /// Gets or sets the part matching error for the image recognition.\n + /// Allowable error of matches number. + /// + /// + /// The value indicating allowable error of matches; can be from 0 to 1, inclusive. + /// The default is 0.1. + /// + /// The already has been disposed of. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than one. + /// + /// 3 + public double TolerantPartMatchError + { + get + { + return GetDouble(KeyTolerantPartMatchingError); + } + set + { + if (value < 0 || value > 1) + { + throw new ArgumentOutOfRangeException(nameof(value), value, "Valid range is 0 to 1 inclusive."); + } + + Set(KeyTolerantPartMatchingError, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs new file mode 100755 index 0000000..0eafa1a --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognitionResult.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a result of RecognizeAsync operations of . + /// + /// 3 + public class ImageRecognitionResult + { + + internal ImageRecognitionResult(bool success, Quadrangle region) + { + Success = success; + Region = region; + } + + /// + /// The region of recognized image object on the source image. + /// + /// 3 + public Quadrangle Region { get; } + + /// + /// Gets the value indicating the recognition is successful. + /// + /// 3 + public bool Success { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs new file mode 100755 index 0000000..ef9c27e --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageRecognizer.cs @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using InteropImage = Interop.MediaVision.Image; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to recognize images on image sources. + /// + /// 3 + public static class ImageRecognizer + { + /// + /// Recognizes the given image objects on the source image.\n + /// + /// The source image on which image objects will be recognized. + /// The array of image objects which will be processed as targets of recognition. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null.\n + /// -or-\n + /// contains null reference. + /// + /// has no elements.(The length is zero.) + /// The feature is not supported. + /// has already been disposed of. + /// 3 + public static async Task> RecognizeAsync( + MediaVisionSource source, ImageObject[] imageObjects) + { + return await RecognizeAsync(source, imageObjects, null); + } + + /// + /// Recognizes the given image objects on the source image.\n + /// + /// The source image on which image objects will be recognized. + /// The array of image objects which will be processed as targets of recognition. + /// The configuration used for recognition. This value can be null. + /// A task that represents the asynchronous recognition operation. + /// + /// is null.\n + /// -or-\n + /// is null.\n + /// -or-\n + /// contains null elements. + /// + /// has no elements.(The length is zero.) + /// The feature is not supported. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// 3 + public static async Task> RecognizeAsync(MediaVisionSource source, + ImageObject[] imageObjects, ImageRecognitionConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + if (imageObjects == null) + { + throw new ArgumentNullException(nameof(imageObjects)); + } + if (imageObjects.Length == 0) + { + throw new ArgumentException("No image object to recognize.", nameof(imageObjects)); + } + + var tcs = new TaskCompletionSource>(); + + using (var cb = ObjectKeeper.Get(GetCallback(tcs))) + using (var imageHandles = ObjectKeeper.Get(GetHandles(imageObjects))) + { + InteropImage.Recognize(source.Handle, imageHandles.Target, imageHandles.Target.Length, + EngineConfiguration.GetHandle(config), cb.Target). + Validate("Failed to perform image recognition."); + + return await tcs.Task; + } + } + + private static ImageRecognitionResult[] CreateResults(IntPtr[] locations, uint numOfObjects) + { + ImageRecognitionResult[] results = new ImageRecognitionResult[numOfObjects]; + + for (int i = 0; i < numOfObjects; i++) + { + Quadrangle quadrangle = locations[i] != IntPtr.Zero ? + Marshal.PtrToStructure(locations[i]).ToApiStruct() : null; + + results[i] = new ImageRecognitionResult(locations[i] != IntPtr.Zero, quadrangle); + } + + return results; + } + + private static InteropImage.RecognizedCallback GetCallback( + TaskCompletionSource> tcs) + { + return (IntPtr source, IntPtr engineConfig, IntPtr imageObjectHandles, + IntPtr[] locations, uint numOfObjects, IntPtr _) => + { + try + { + if (!tcs.TrySetResult(CreateResults(locations, numOfObjects))) + { + Log.Info(MediaVisionLog.Tag, "Failed to set recognition result"); + } + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to handle recognition result", e); + tcs.TrySetException(e); + } + }; + } + + private static IntPtr[] GetHandles(ImageObject[] imageObjects) + { + IntPtr[] imageHandles = new IntPtr[imageObjects.Length]; + for (int i = 0; i < imageObjects.Length; i++) + { + if (imageObjects[i] == null) + { + throw new ArgumentNullException($"{nameof(imageObjects)}[{i}]"); + } + + imageHandles[i] = imageObjects[i].Handle; + } + + return imageHandles; + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs new file mode 100755 index 0000000..bcf07c1 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageTracker.cs @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using InteropImage = Interop.MediaVision.Image; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to track images on image sources. + /// + /// 3 + public static class ImageTracker + { + /// + /// Tracks the given image tracking model on the current frame. + /// + /// The current image of sequence where image tracking model will be tracked. + /// The image tracking model which processed as target of tracking. + /// A task that represents the asynchronous tracking operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// has no target. + /// + /// 3 + public static async Task TrackAsync(MediaVisionSource source, + ImageTrackingModel trackingModel) + { + return await TrackAsync(source, trackingModel, null); + } + + /// + /// Tracks the given image tracking model on the current frame and . + /// + /// The current image of sequence where image tracking model will be tracked. + /// The image tracking model which processed as target of tracking. + /// The configuration used for tracking. This value can be null. + /// A task that represents the asynchronous tracking operation. + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// The feature is not supported. + /// + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// has no target. + /// + /// 3 + public static async Task TrackAsync(MediaVisionSource source, + ImageTrackingModel trackingModel, ImageTrackingConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + if (trackingModel == null) + { + throw new ArgumentNullException(nameof(trackingModel)); + } + + TaskCompletionSource tcs = new TaskCompletionSource(); + + using (var cb = ObjectKeeper.Get(GetCallback(tcs))) + { + InteropImage.Track(source.Handle, trackingModel.Handle, EngineConfiguration.GetHandle(config), + cb.Target).Validate("Failed to perform image tracking."); + + return await tcs.Task; + } + } + + private static InteropImage.TrackedCallback GetCallback(TaskCompletionSource tcs) + { + return (IntPtr sourceHandle, IntPtr imageTrackingModelHandle, IntPtr engineCfgHandle, IntPtr locationPtr, IntPtr _) => + { + try + { + Quadrangle region = null; + if (locationPtr != IntPtr.Zero) + { + region = Marshal.PtrToStructure(locationPtr).ToApiStruct(); + } + + Log.Info(MediaVisionLog.Tag, $"Image tracked, region : {region}"); + + if (!tcs.TrySetResult(region)) + { + Log.Info(MediaVisionLog.Tag, "Failed to set track result"); + } + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to handle track result", e); + tcs.TrySetException(e); + } + }; + + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs new file mode 100755 index 0000000..042b64b --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingConfiguration.cs @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of . + /// + /// 3 + public class ImageTrackingConfiguration : ImageRecognitionConfiguration + { + private const string KeyHistoryAmount = "MV_IMAGE_TRACKING_HISTORY_AMOUNT"; + private const string KeyExpectedOffset = "MV_IMAGE_TRACKING_EXPECTED_OFFSET"; + private const string KeyUseStabilization = "MV_IMAGE_TRACKING_USE_STABLIZATION"; + private const string KeyStabilizationTolerantShift = "MV_IMAGE_TRACKING_STABLIZATION_TOLERANT_SHIFT"; + private const string KeyStabilizationSpeed = "MV_IMAGE_TRACKING_STABLIZATION_SPEED"; + private const string KeyStabilizationAcceleration = "MV_IMAGE_TRACKING_STABLIZATION_ACCELERATION"; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultHistoryAmount = 3; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultExpectedOffset = 0; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly bool DefaultStabilizationEnabled = true; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultStabilizationTolerantShift = 0.00006; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultStabilizationSpeed = 0.3; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly double DefaultStabilizationAcceleration = 0.1; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public ImageTrackingConfiguration() + { + } + + /// + /// Gets or sets the number of recognition results in the tracking history. + /// + /// + /// The number of previous recognition results, which will influence the stabilization.\n + /// The default is 3. + /// + /// The already has been disposed of. + /// is less than zero. + /// 3 + public int HistoryAmount + { + get + { + return GetInt(KeyHistoryAmount); + } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(HistoryAmount), value, + $"{nameof(HistoryAmount)} can't be less than zero."); + } + Set(KeyHistoryAmount, value); + } + } + + /// + /// Gets or sets the expected tracking offset. + /// + /// + /// Relative offset value, for which the object offset is expected (relative to the object size in the current frame).\n + /// The default is 0. + /// + /// The already has been disposed of. + /// 3 + public double ExpectedOffset + { + get + { + return GetDouble(KeyExpectedOffset); + } + set + { + Set(KeyExpectedOffset, value); + } + } + + /// + /// Gets or sets the acceleration of the tracking stabilization. + /// + /// + /// Acceleration will be used for image stabilization (relative to the distance from current location to stabilized location); + /// from 0 to 1, inclusive.\n + /// The default is 0.1. + /// + /// The already has been disposed of. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than one. + /// + /// 3 + public double StabilizationAcceleration + { + get + { + return GetDouble(KeyStabilizationAcceleration); + } + set + { + if (value < 0 || value > 1) + { + throw new ArgumentOutOfRangeException(nameof(value), value, "Valid range is 0 to 1 inclusive."); + } + + Set(KeyStabilizationAcceleration, value); + } + } + + /// + /// Gets or sets the speed of the tracking stabilization. + /// + /// + /// The start speed value used for image stabilization.\n + /// The default is 0.3. + /// + /// The already has been disposed of. + /// 3 + public double StabilizationSpeed + { + get + { + return GetDouble(KeyStabilizationSpeed); + } + set + { + Set(KeyStabilizationSpeed, value); + } + } + + /// + /// Gets or sets the relative tolerant shift for the tracking stabilization. + /// + /// + /// It is component of tolerant shift which will be ignored by stabilization process. + /// (this value is relative to the object size in the current frame). + /// Tolerant shift will be computed like R * S + C, where R is the value set to , + /// S is the area of object location on frame, C is a constant value 1.3.\n + /// \n + /// The default is 0.00006. + /// + /// The already has been disposed of. + /// 3 + public double StabilizationTolerantShift + { + get + { + return GetDouble(KeyStabilizationTolerantShift); + } + set + { + Set(KeyStabilizationTolerantShift, value); + } + } + + /// + /// Gets or sets the state of the contour stabilization during tracking process. + /// + /// + /// true if the contour stabilization is enabled; otherwise, false.\n + /// The default is true. + /// + /// The already has been disposed of. + /// 3 + public bool IsStabilizationEnabled + { + get + { + return GetBool(KeyUseStabilization); + } + set + { + Set(KeyUseStabilization, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs new file mode 100755 index 0000000..8c86572 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/ImageTrackingModel.cs @@ -0,0 +1,173 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using InteropModel = Interop.MediaVision.ImageTrackingModel; + +namespace Tizen.Multimedia +{ + /// + /// Represents the image tracking model interface. + /// + /// 3 + public class ImageTrackingModel : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public ImageTrackingModel() + { + InteropModel.Create(out _handle).Validate("Failed to create FaceTrackingModel"); + } + + /// + /// Initializes a new instance of the class with the specified path. + /// + /// + /// Model have been saved by can be loaded. + /// + /// Path to the model to load. + /// is null. + /// is invalid. + /// + /// The feature is not supported.\n + /// -or-\n + /// is not supported format. + /// + /// No permission to access the specified file. + /// + /// 3 + public ImageTrackingModel(string modelPath) + { + if (modelPath == null) + { + throw new ArgumentNullException(nameof(modelPath)); + } + InteropModel.Load(modelPath, out _handle).Validate("Failed to load ImageTrackingModel from file"); + } + + ~ImageTrackingModel() + { + Dispose(false); + } + + /// + /// Sets target of image tracking model.\n + /// Sets image object which will be tracked by using tracking functionality with this tracking model. + /// + /// Image object which will be set as the target for tracking. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// 3 + public void SetTarget(ImageObject imageObject) + { + if (imageObject == null) + { + throw new ArgumentNullException(nameof(imageObject)); + } + + InteropModel.SetTarget(imageObject.Handle, Handle). + Validate("Failed to set target of image tracking model"); + } + + /// + /// Refreshes the state of image tracking model.\n + /// Clears moving history and change state to undetected. It is usually called each time before tracking is started + /// for the new sequence of sources which is not the direct continuation of the sequence for which tracking has been performed before. + /// Tracking algorithm will try to find image by itself. + /// + /// The has already been disposed of. + /// 3 + public void Refresh() + { + InteropModel.Refresh(Handle, IntPtr.Zero).Validate("Failed to refresh state"); + } + + /// + /// Saves tracking model to the file. + /// + /// Path to the file to save the model. + /// is null. + /// No permission to write to the specified path. + /// The has already been disposed of. + /// The directory for does not exist. + /// 3 + public void Save(string path) + { + if (path == null) + { + throw new ArgumentNullException(path); + } + + var ret = InteropModel.Save(path, Handle); + + if (ret == MediaVisionError.InvalidPath) + { + throw new DirectoryNotFoundException($"The directory for the path({path}) does not exist."); + } + + ret.Validate("Failed to save tracking model to file"); + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + InteropModel.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(ImageTrackingModel)); + } + return _handle; + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs new file mode 100755 index 0000000..8298cfd --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionError.cs @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + internal static class MediaVisionLog + { + internal const string Tag = "Tizen.Multimedia.MediaVision"; + } + + /// + /// Enumeration for media vision's error codes. + /// + internal enum MediaVisionError + { + MediaVisionErrorCode = -0x019D0000, + /// + /// Successful + /// + None = ErrorCode.None, + /// + /// Not supported + /// + NotSupported = ErrorCode.NotSupported, + /// + /// Message too long + /// + MsgTooLong = ErrorCode.MsgTooLong, + /// + /// No data + /// + NoData = ErrorCode.NoData, + /// + /// Key not available + /// + KeyNotAvailable = ErrorCode.KeyNotAvailable, + /// + /// Out of memory + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// Invalid parameter + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Invalid operation + /// + InvalidOperation = ErrorCode.InvalidOperation, + /// + /// Permission denied + /// + PermissionDenied = ErrorCode.NotPermitted, + /// + /// Not supported format + /// + NotSupportedFormat = MediaVisionErrorCode | 0x01, + /// + /// Internal error + /// + Internal = MediaVisionErrorCode | 0x02, + /// + /// Invalid data + /// + InvalidData = MediaVisionErrorCode | 0x03, + /// + /// Invalid path (Since 3.0) + /// + InvalidPath = MediaVisionErrorCode | 0x04 + } + + internal static class MediaVisionErrorExtensions + { + public static void Validate(this MediaVisionError error, string msg) + { + if (error == MediaVisionError.None) + { + return; + } + + switch (error) + { + case MediaVisionError.NotSupported: + throw new NotSupportedException(msg); + case MediaVisionError.MsgTooLong: + throw new ArgumentException($"{msg} : Message too long."); + case MediaVisionError.NoData: + throw new InvalidOperationException($"{msg} : No Data."); + case MediaVisionError.KeyNotAvailable: + throw new ArgumentException($"{msg} : Key Not Available."); + case MediaVisionError.OutOfMemory: + throw new OutOfMemoryException($"{msg} : Out of Memory."); + case MediaVisionError.InvalidParameter: + throw new ArgumentException($"{msg} : Invalid argument."); + case MediaVisionError.InvalidOperation: + throw new InvalidOperationException($"{msg} : Invalid Operation."); + case MediaVisionError.PermissionDenied: + throw new UnauthorizedAccessException($"{msg} : Permission Denied."); + case MediaVisionError.NotSupportedFormat: + throw new NotSupportedException($"{msg} : Not Supported Format."); + case MediaVisionError.Internal: + throw new InvalidOperationException($"{msg} : Internal Error."); + case MediaVisionError.InvalidData: + throw new ArgumentException($"{msg} : Invalid Data."); + case MediaVisionError.InvalidPath: + throw new FileNotFoundException($"{msg} : Invalid Path."); + default: + throw new InvalidOperationException($"{msg} : Unknown Error."); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs new file mode 100755 index 0000000..28ce4d9 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/MediaVisionSource.cs @@ -0,0 +1,248 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using InteropSource = Interop.MediaVision.MediaSource; + +namespace Tizen.Multimedia +{ + /// + /// Represents the media vision source to keep information on image or video frame data as raw buffer. + /// + /// 3 + public class MediaVisionSource : IBufferOwner, IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + internal MediaVisionSource() + { + InteropSource.Create(out _handle).Validate("Failed to create media vision source"); + } + + private MediaVisionSource(Action fillAction) + : this() + { + try + { + fillAction(_handle); + } + catch(Exception) + { + InteropSource.Destroy(_handle); + _disposed = true; + throw; + } + } + + private static void FillMediaPacket(IntPtr handle, MediaPacket mediaPacket) + { + Debug.Assert(handle != IntPtr.Zero); + + if (mediaPacket == null) + { + throw new ArgumentNullException(nameof(mediaPacket)); + } + + InteropSource.FillMediaPacket(handle, mediaPacket.GetHandle()). + Validate("Failed to fill media packet"); + } + + /// + /// Initializes a new instance of the class based on the . + /// + /// The from which the source will be filled. + /// The feature is not supported. + /// is null. + /// has already been disposed of. + /// 3 + public MediaVisionSource(MediaPacket mediaPacket) + : this(handle => FillMediaPacket(handle, mediaPacket)) + { + } + + private static void FillBuffer(IntPtr handle, byte[] buffer, uint width, uint height, Colorspace colorspace) + { + Debug.Assert(handle != IntPtr.Zero); + + if (buffer == null) + { + throw new ArgumentNullException(nameof(buffer)); + } + + if (buffer.Length == 0) + { + throw new ArgumentException("Buffer.Length is zero.", nameof(buffer)); + } + + if (colorspace == Colorspace.Invalid) + { + throw new ArgumentException($"color space must not be {Colorspace.Invalid}.", nameof(colorspace)); + } + + ValidationUtil.ValidateEnum(typeof(Colorspace), colorspace, nameof(colorspace)); + + InteropSource.FillBuffer(handle, buffer, buffer.Length, width, height, colorspace). + Validate("Failed to fill buffer"); + } + + /// + /// Initializes a new instance of the class based on the buffer and . + /// + /// The buffer of image data. + /// The width of image. + /// The height of image. + /// The image . + /// The feature is not supported. + /// is null. + /// + /// has no element.(The length is zero.)\n + /// -or-\n + /// is invalid. + /// + /// 3 + public MediaVisionSource(byte[] buffer, uint width, uint height, Colorspace colorspace) + : this(handle => FillBuffer(handle, buffer, width, height, colorspace)) + { + } + + ~MediaVisionSource() + { + Dispose(false); + } + + private IMediaBuffer _buffer; + + /// + /// Gets the buffer of the media source. + /// + /// The has already been disposed of. + /// 3 + public IMediaBuffer Buffer + { + get + { + if (_buffer == null) + { + IntPtr bufferHandle = IntPtr.Zero; + int bufferSize = 0; + + InteropSource.GetBuffer(Handle, out bufferHandle, out bufferSize). + Validate("Failed to get buffer"); + + _buffer = new DependentMediaBuffer(this, bufferHandle, bufferSize); + } + return _buffer; + } + } + + /// + /// Gets height of the media source. + /// + /// The has already been disposed of. + /// 3 + public uint Height + { + get + { + uint height = 0; + var ret = InteropSource.GetHeight(Handle, out height); + MultimediaDebug.AssertNoError(ret); + return height; + } + } + + /// + /// Gets width of the media source. + /// + /// The has already been disposed of. + /// 3 + public uint Width + { + get + { + uint width = 0; + var ret = InteropSource.GetWidth(Handle, out width); + MultimediaDebug.AssertNoError(ret); + return width; + } + } + + /// + /// Gets of the media source. + /// + /// The has already been disposed of. + /// 3 + public Colorspace Colorspace + { + get + { + Colorspace colorspace = Colorspace.Invalid; + var ret = InteropSource.GetColorspace(Handle, out colorspace); + MultimediaDebug.AssertNoError(ret); + return colorspace; + } + } + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + InteropSource.Destroy(_handle); + _disposed = true; + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(nameof(MediaVisionSource)); + } + return _handle; + } + } + + bool IBufferOwner.IsBufferAccessible(object buffer, MediaBufferAccessMode accessMode) + { + return true; + } + + bool IBufferOwner.IsDisposed + { + get { return _disposed; } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs new file mode 100755 index 0000000..3456c5d --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + /// 3 + public class MovementDetectedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// 3 + public MovementDetectedEventArgs(IEnumerable areas) + { + Areas = areas; + } + + /// + /// Gets a set of rectangular regions where movement was detected. + /// + /// 3 + public IEnumerable Areas { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs new file mode 100755 index 0000000..a9aebe8 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetectionConfiguration.cs @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of . + /// + /// 3 + public class MovementDetectionConfiguration : SurveillanceEngineConfiguration + { + private const string KeyThreshold = "MV_SURVEILLANCE_MOVEMENT_DETECTION_THRESHOLD"; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultThreshold = 10; + + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public MovementDetectionConfiguration() + { + } + + /// + /// Gets or sets movement detection threshold.\n + /// This value might be set before subscription on event + /// to specify the sensitivity of the movement detector. + /// + /// + /// The value indicating the sensitivity of the from 0 to 255 inclusive + /// where 255 means that no movements will be detected and 0 means that all frame changes + /// will be interpreted as movements.\n + /// The default is 10. + /// + /// The already has been disposed of. + /// + /// is less than zero.\n + /// -or-\n + /// is greater than 255. + /// + /// 3 + public int Threshold + { + get + { + return GetInt(KeyThreshold); + } + set + { + if (value < 0 || value > 255) + { + throw new ArgumentOutOfRangeException(nameof(Threshold), value, + $"Valid {nameof(Threshold)} range is 0 to 255 inclusive"); + } + + Set(KeyThreshold, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs new file mode 100755 index 0000000..d5861d0 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/MovementDetector.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.MediaVision.Surveillance; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to detect movement on image sources. + /// + /// + /// 3 + public class MovementDetector : SurveillanceEngine + { + private const string KeyNumberOfRegions = "NUMBER_OF_MOVEMENT_REGIONS"; + private const string KeyRegions = "MOVEMENT_REGIONS"; + + private const string MovementDetectedEventType = "MV_SURVEILLANCE_EVENT_MOVEMENT_DETECTED"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public MovementDetector() : base(MovementDetectedEventType) + { + } + + /// + /// Occurs when the movement detected. + /// + /// The event handler will be executed on an internal thread. + /// 3 + public event EventHandler Detected; + + internal override void OnEventDetected(IntPtr trigger, IntPtr source, int streamId, + IntPtr result, IntPtr _) + { + try + { + Detected?.Invoke(this, CreateMovementDetectedEventArgs(result)); + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to invoke Recognized event.", e); + } + } + + private static Rectangle[] RetrieveAreas(IntPtr result) + { + int count = 0; + GetResultValue(result, KeyNumberOfRegions, out count).Validate("Failed to get result count"); + + if (count == 0) + { + return new Rectangle[0]; + } + + var rects = new global::Interop.MediaVision.Rectangle[count]; + + GetResultValue(result, KeyRegions, rects).Validate("Failed to get regions"); + + return global::Interop.ToApiStruct(rects); + } + + private static MovementDetectedEventArgs CreateMovementDetectedEventArgs(IntPtr result) + { + return new MovementDetectedEventArgs(RetrieveAreas(result)); + } + + + /// + /// Adds . + /// + /// The source used for recognition. + /// is null. + /// The has already been disposed of. + /// + /// 3 + public void AddSource(SurveillanceSource source) + { + AddSource(source, null); + } + + /// + /// Adds with the provided . + /// + /// The source used for recognition. + /// The config for the . This value can be null. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// + /// 3 + public void AddSource(SurveillanceSource source, MovementDetectionConfiguration config) + { + InvokeAddSource(source, config); + } + + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs new file mode 100755 index 0000000..7c9576a --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectedEventArgs.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + /// 3 + public class PersonAppearanceDetectedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// 3 + public PersonAppearanceDetectedEventArgs(IEnumerable appeared, + IEnumerable disappeared, IEnumerable tracked) + { + AppearanceAreas = appeared; + DisappearanceAreas = disappeared; + TrackedAreas = tracked; + } + + /// + /// Gets a set of rectangular regions where appearances of the persons were detected. + /// + /// 3 + public IEnumerable AppearanceAreas { get; } + + /// + /// Gets a set of rectangular regions where disappearances of the persons were detected. + /// + /// 3 + public IEnumerable DisappearanceAreas { get; } + + /// + /// Gets a set of rectangular regions where persons were tracked. + /// + /// 3 + public IEnumerable TrackedAreas { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs new file mode 100755 index 0000000..b4ef07b --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetectionConfiguration.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of instances. + /// + /// 3 + public class PersonAppearanceDetectionConfiguration : SurveillanceEngineConfiguration + { + private const string KeySkipFramesCount = "MV_SURVEILLANCE_SKIP_FRAMES_COUNT"; + + /// + /// A read-only field that represents the default value of . + /// + /// 3 + public static readonly int DefaultSkipFramesCount = 0; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public PersonAppearanceDetectionConfiguration() + { + } + + /// + /// Gets or sets how many frames will be skipped during push source.\n + /// + /// + /// The value to specify the number of calls will be ignored by subscription + /// of the event trigger.\n + /// + /// The default is 0. It means that no frames will be skipped and all will + /// be processed. + /// + /// The already has been disposed of. + /// is less than zero. + /// + /// 3 + public int SkipFramesCount + { + get + { + return GetInt(KeySkipFramesCount); + } + set + { + if (value < 0) + { + throw new ArgumentOutOfRangeException(nameof(SkipFramesCount), value, + $"{nameof(SkipFramesCount)} can't be less than zero."); + } + Set(KeySkipFramesCount, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs new file mode 100755 index 0000000..ef6d305 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonAppearanceDetector.cs @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.MediaVision.Surveillance; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to detect person appearance changes on image sources. + /// + /// + /// 3 + public class PersonAppearanceDetector : SurveillanceEngine + { + private const string KeyAppearedNumber = "NUMBER_OF_APPEARED_PERSONS"; + private const string KeyDisappearedNumber = "NUMBER_OF_DISAPPEARED_PERSONS"; + private const string KeyTrackedNumber = "NUMBER_OF_TRACKED_PERSONS"; + private const string KeyAppearedLocations = "APPEARED_PERSONS_LOCATIONS"; + private const string KeyDisappearedLocations = "DISAPPEARED_PERSONS_LOCATIONS"; + private const string KeyTrackedLocations = "TRACKED_PERSONS_LOCATIONS"; + + private const string PersonAppearanceEventType = "MV_SURVEILLANCE_EVENT_PERSON_APPEARED_DISAPEARED"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public PersonAppearanceDetector() : base(PersonAppearanceEventType) + { + } + + /// + /// Occurs when the any appearance changes detected. + /// + /// The event handler will be executed on an internal thread. + /// 3 + public event EventHandler Detected; + + internal override void OnEventDetected(IntPtr trigger, IntPtr source, int streamId, + IntPtr result, IntPtr _) + { + try + { + Detected?.Invoke(this, CreatePersonAppearanceChangedEventArgs(result)); + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to invoke Recognized event.", e); + } + } + + + private PersonAppearanceDetectedEventArgs CreatePersonAppearanceChangedEventArgs(IntPtr result) + { + return new PersonAppearanceDetectedEventArgs( + GetResultAreas(result, KeyAppearedNumber, KeyAppearedLocations), + GetResultAreas(result, KeyDisappearedNumber, KeyDisappearedLocations), + GetResultAreas(result, KeyTrackedNumber, KeyTrackedLocations) + ); + } + + private static Rectangle[] GetResultAreas(IntPtr result, string countKey, string regionsKey) + { + int count = 0; + GetResultValue(result, countKey, out count).Validate("Failed to get result"); + + var rects = new global::Interop.MediaVision.Rectangle[count]; + if (count > 0) + { + GetResultValue(result, regionsKey, rects).Validate("Failed to get result"); + } + + return global::Interop.ToApiStruct(rects); + } + + /// + /// Adds . + /// + /// The source used for recognition. + /// is null. + /// The has already been disposed of. + /// + /// 3 + public void AddSource(SurveillanceSource source) + { + AddSource(source, null); + } + + /// + /// Adds with the provided . + /// + /// The source used for recognition. + /// The config for the . This value can be null. + /// is null. + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// + /// 3 + public void AddSource(SurveillanceSource source, PersonAppearanceDetectionConfiguration config) + { + InvokeAddSource(source, config); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs new file mode 100755 index 0000000..dd179a3 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionConfiguration.cs @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a configuration of instances. + /// + /// 3 + public class PersonRecognitionConfiguration : SurveillanceEngineConfiguration + { + private const string KeyFaceRecognitionModelFilePath = "MV_SURVEILLANCE_FACE_RECOGNITION_MODEL_FILE_PATH"; + + /// + /// Initializes a new instance of the class. + /// + /// Path to the face recognition model. + /// is null. + /// The feature is not supported. + /// 3 + public PersonRecognitionConfiguration(string modelPath) + { + FaceRecognitionModelPath = modelPath; + } + + /// + /// Gets or sets face recognition model file path. + /// + /// is null. + /// The already has been disposed of. + /// 3 + public string FaceRecognitionModelPath + { + get + { + return GetString(KeyFaceRecognitionModelFilePath); + } + set + { + if (value == null) + { + throw new ArgumentNullException(nameof(FaceRecognitionModelPath)); + } + Set(KeyFaceRecognitionModelFilePath, value); + } + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs new file mode 100755 index 0000000..a7589c8 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognitionInfo.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Represents a result of instances. + /// + /// 3 + public class PersonRecognitionInfo + { + /// + /// Initializes a new instance of the class. + /// + /// 3 + public PersonRecognitionInfo(Rectangle area, int label, double confidence) + { + Area = area; + Label = label; + Confidence = confidence; + } + + /// + /// Gets the rectangular location where person face was recognized. + /// + /// 3 + public Rectangle Area { get; } + + /// + /// Gets the label that correspond to the recognized person. + /// + /// 3 + public int Label { get; } + + /// + /// Gets the confidence value that correspond to the recognized person. + /// + /// 3 + public double Confidence { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs new file mode 100755 index 0000000..bbe65a9 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizedEventArgs.cs @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + /// + /// Provides data for the event. + /// + /// 3 + public class PersonRecognizedEventArgs : EventArgs + { + /// + /// Initializes a new instance of the class. + /// + /// 3 + public PersonRecognizedEventArgs(IEnumerable recognitionInfo) + { + Recognitions = recognitionInfo; + } + + /// + /// Gets a set of information that correspond to the recognized persons. + /// + /// 3 + public IEnumerable Recognitions { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs new file mode 100755 index 0000000..e14e38c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/PersonRecognizer.cs @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.MediaVision.Surveillance; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to recognize person on image sources. + /// + /// + /// 3 + public class PersonRecognizer : SurveillanceEngine + { + private const string KeyCount = "NUMBER_OF_PERSONS"; + private const string KeyLocations = "PERSONS_LOCATIONS"; + private const string KeyLabels = "PERSONS_LABELS"; + private const string KeyConfidences = "PERSONS_CONFIDENCES"; + + private const string PersonRecognizedEventType = "MV_SURVEILLANCE_EVENT_PERSON_RECOGNIZED"; + + /// + /// Initializes a new instance of the class. + /// + /// The feature is not supported. + /// 3 + public PersonRecognizer() : base(PersonRecognizedEventType) + { + } + + /// + /// Occurs when a person recognized. + /// + /// The event handler will be executed on an internal thread. + /// + /// 3 + public event EventHandler Recognized; + + internal override void OnEventDetected(IntPtr trigger, IntPtr source, int streamId, + IntPtr result, IntPtr _) + { + try + { + Recognized?.Invoke(this, CreatePersonRecognizedEventArgs(result)); + } + catch (Exception e) + { + MultimediaLog.Error(MediaVisionLog.Tag, "Failed to invoke Recognized event.", e); + } + } + + private PersonRecognizedEventArgs CreatePersonRecognizedEventArgs(IntPtr result) + { + int count; + + GetResultValue(result, KeyCount, out count).Validate("Failed to get result count"); + + var recognitionInfo = new PersonRecognitionInfo[count]; + + if (count > 0) + { + var rects = new global::Interop.MediaVision.Rectangle[count]; + GetResultValue(result, KeyLocations, rects).Validate("Failed to get location"); + + var labels = new int[count]; + GetResultValue(result, KeyLabels, labels).Validate("Failed to get label"); + + var confidences = new double[count]; + GetResultValue(result, KeyConfidences, confidences).Validate("Failed to get confidence"); + + for (int i = 0; i < count; i++) + { + recognitionInfo[i] = new PersonRecognitionInfo(rects[i].ToApiStruct(), + labels[i], confidences[i]); + } + } + + return new PersonRecognizedEventArgs(recognitionInfo); + } + + /// + /// Adds with the provided . + /// + /// The source used for recognition. + /// The config for the . + /// + /// is null.\n + /// -or-\n + /// is null. + /// + /// + /// The has already been disposed of.\n + /// -or-\n + /// has already been disposed of. + /// + /// + /// of does not exists. + /// + /// + /// No permission to access to the . + /// + /// The model file is not supported format or file. + /// + /// 3 + public void AddSource(SurveillanceSource source, PersonRecognitionConfiguration config) + { + if (config == null) + { + throw new ArgumentNullException(nameof(config)); + } + InvokeAddSource(source, config); + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs new file mode 100755 index 0000000..b090a38 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/QrConfiguration.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a QR configuration of . + /// + /// 3 + public class QrConfiguration + { + /// + /// Initializes a new instance of the class. + /// + /// Encoding mode for the message. + /// Error correction level. + /// QR code version. From 1 to 40 inclusive. + /// + /// var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30); + /// + /// + /// is less than 1.\n + /// -or-\n + /// is greater than 40. + /// + /// + /// is invalid.\n + /// -or- + /// is invalid. + /// + /// 3 + public QrConfiguration(QrMode qrMode, ErrorCorrectionLevel ecc, int version) + { + if (version < 1 || version > 40) + { + throw new ArgumentOutOfRangeException(nameof(version), version, + "Valid version range is 1 to 40 inclusive."); + } + ValidationUtil.ValidateEnum(typeof(QrMode), qrMode, nameof(qrMode)); + ValidationUtil.ValidateEnum(typeof(ErrorCorrectionLevel), ecc, nameof(ecc)); + + Mode = qrMode; + ErrorCorrectionLevel = ecc; + Version = version; + } + + /// + /// Gets the encoding mode for the message. + /// + /// 3 + public QrMode Mode { get; } + + /// + /// Gets the error correction level. + /// + /// 3 + public ErrorCorrectionLevel ErrorCorrectionLevel { get; } + + /// + /// Gets the QR code version. + /// + /// 3 + public int Version { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs b/src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs new file mode 100755 index 0000000..489a066 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/QrMode.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the supported QR code encoding mode. + /// + /// 3 + public enum QrMode + { + /// + /// Numeric digits. + /// + /// 3 + Numeric, + /// + /// Alphanumeric characters, '$', '%', '*', '+', '-', '.', '/' and ':'. + /// + /// 3 + AlphaNumeric, + /// + /// Raw 8-bit bytes. + /// + /// 3 + Byte, + /// + /// UTF-8 character encoding. + /// + /// 3 + Utf8 + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs b/src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs new file mode 100755 index 0000000..577b5cd --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/Quadrangle.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a region with 4 s. + /// + /// 3 + public class Quadrangle + { + + /// + /// Initialize a new instance of the class with an array of . + /// + /// must have 4 elements. + /// four points that define object bounding quadrangle. + /// The Length of is not 4. + /// 3 + public Quadrangle(Point[] points) + { + if (points.Length != 4) + { + throw new ArgumentException($"{points} must have 4 elements."); + } + + Points = points; + } + + /// + /// Gets four points that define the object bounding quadrangle. + /// + /// 3 + public Point[] Points { get; } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => + $"[{{{Points[0].ToString()}}}, {{{Points[1].ToString()}}}, {{{Points[2].ToString()}}}, {{{Points[3].ToString()}}}]"; + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs new file mode 100755 index 0000000..a80ccc0 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceConfiguration.cs @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// SurveillanceEngineConfiguration is a base class for surveillance configurations. + /// + /// 3 + public class SurveillanceEngineConfiguration : EngineConfiguration + { + internal SurveillanceEngineConfiguration() : base("face_recognition", "image_recognition") + { + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs new file mode 100755 index 0000000..f1ce4ec --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceEngine.cs @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using static Interop.MediaVision.Surveillance; + +namespace Tizen.Multimedia +{ + /// + /// SurveillanceEngine is a base class for surveillance event triggers. + /// Media Vision Surveillance provides functionality can be utilized for creation of video surveillance systems. + /// + /// + /// + /// + /// 3 + public abstract class SurveillanceEngine : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private bool _disposed = false; + + /// + /// Initializes a new instance of the class. + /// + /// The type of the event trigger + internal SurveillanceEngine(string eventType) + { + EventTriggerCreate(eventType, out _handle).Validate("Failed to create surveillance event trigger."); + } + + ~SurveillanceEngine() + { + Dispose(false); + } + + internal IntPtr Handle + { + get + { + if (_disposed) + { + throw new ObjectDisposedException(GetType().Name); + } + return _handle; + } + } + + /// + /// Sets and gets ROI (Region Of Interest). + /// + /// The has already been disposed of. + /// 3 + public Point[] Roi + { + get + { + IntPtr roiPtr = IntPtr.Zero; + try + { + int count = 0; + GetEventTriggerRoi(Handle, out count, out roiPtr).Validate("Failed to get roi"); + + Point[] points = new Point[count]; + IntPtr iterPtr = roiPtr; + + for (int i = 0; i < count; i++) + { + points[i] = Marshal.PtrToStructure(iterPtr).ToApiStruct(); + iterPtr = IntPtr.Add(iterPtr, Marshal.SizeOf()); + } + + return points; + } + finally + { + LibcSupport.Free(roiPtr); + } + } + set + { + int length = value == null ? 0 : value.Length; + + var points = value == null ? null : global::Interop.ToMarshalable(value); + + SetEventTriggerRoi(Handle, length, points).Validate("Failed to set roi"); + } + } + + internal abstract void OnEventDetected(IntPtr trigger, IntPtr source, + int streamId, IntPtr eventResult, IntPtr userData); + + internal void InvokeAddSource(SurveillanceSource source, SurveillanceEngineConfiguration config) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + SubscribeEventTrigger(Handle, source.StreamId, EngineConfiguration.GetHandle(config), + OnEventDetected).Validate("Failed to subscribe trigger"); + } + + /// + /// Removes the source from . + /// + /// is null. + /// The has already been disposed of. + /// has not been added. + /// 3 + public void RemoveSource(SurveillanceSource source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + UnsubscribeEventTrigger(Handle, source.StreamId).Validate("Failed to unsubscribe event trigger"); + } + + + /// + /// Releases all resources used by the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + EventTriggerDestroy(_handle); + _disposed = true; + } + } +} diff --git a/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs new file mode 100755 index 0000000..792243c --- /dev/null +++ b/src/Tizen.Multimedia.Vision/MediaVision/SurveillanceSource.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.MediaVision.Surveillance; + +namespace Tizen.Multimedia +{ + /// + /// Provides the ability to push source to surveillance engines. + /// + /// + /// + /// + /// 3 + public class SurveillanceSource + { + private static int _nextStreamId = int.MinValue; + + private static int GetNextStreamId() + { + if (_nextStreamId == int.MaxValue) + { + return _nextStreamId = int.MinValue; + } + return _nextStreamId++; + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + public SurveillanceSource() + { + StreamId = GetNextStreamId(); + } + + /// + /// Pushes source to the surveillance system to detect events. + /// + /// The media source used for surveillance. + /// is null. + /// has already been disposed of. + /// This has not been added yet. + /// + /// + /// + /// + /// + /// 3 + public void Push(MediaVisionSource source) + { + if (source == null) + { + throw new ArgumentNullException(nameof(source)); + } + + PushSource(source.Handle, StreamId).Validate("Failed to push source"); + } + + internal int StreamId { get; } + } +} diff --git a/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj new file mode 100644 index 0000000..54f2094 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.sln b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.sln new file mode 100755 index 0000000..12ec2f9 --- /dev/null +++ b/src/Tizen.Multimedia.Vision/Tizen.Multimedia.Vision.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia.Vision", "Tizen.Multimedia.Vision.csproj", "{2BF51BFD-D43A-45D8-BAD6-E41B12B775A5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "..\Tizen.Multimedia\Tizen.Multimedia.csproj", "{AA876642-6C17-43C9-B7DA-A8B68EDB7AC9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{E48B2C17-F195-4513-83BC-AC8FEED2A18B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2BF51BFD-D43A-45D8-BAD6-E41B12B775A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BF51BFD-D43A-45D8-BAD6-E41B12B775A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BF51BFD-D43A-45D8-BAD6-E41B12B775A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BF51BFD-D43A-45D8-BAD6-E41B12B775A5}.Release|Any CPU.Build.0 = Release|Any CPU + {AA876642-6C17-43C9-B7DA-A8B68EDB7AC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA876642-6C17-43C9-B7DA-A8B68EDB7AC9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA876642-6C17-43C9-B7DA-A8B68EDB7AC9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA876642-6C17-43C9-B7DA-A8B68EDB7AC9}.Release|Any CPU.Build.0 = Release|Any CPU + {E48B2C17-F195-4513-83BC-AC8FEED2A18B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E48B2C17-F195-4513-83BC-AC8FEED2A18B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E48B2C17-F195-4513-83BC-AC8FEED2A18B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E48B2C17-F195-4513-83BC-AC8FEED2A18B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Multimedia/AssemblyAttrs.cs b/src/Tizen.Multimedia/AssemblyAttrs.cs new file mode 100644 index 0000000..c9f90b1 --- /dev/null +++ b/src/Tizen.Multimedia/AssemblyAttrs.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + // This file specifies any assembly atrributes. + // Note that InternalsVisibleToAttribute can be removed or added and needs to be only Multimedia packages only. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Camera, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.MediaCodec, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.MediaPlayer, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Recorder, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.StreamRecorder, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Remoting, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Util, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] + +[assembly: InternalsVisibleTo("Tizen.Multimedia.Vision, " + + "PublicKey=0024000004800000940000000602000000240000525341310004000001000100d115b100424841" + + "6b12d21b626cfb17149c9303fe394693fd3b32d7872e89559a4fa96c98110c2e62eea48aca693b" + + "ddbe17094ca8ea2e2cd79970ca590fb672b9b371b5d7002076817321f62d6483ea50c56dbd1f37" + + "b185a4c24c47718876e6ae6d266508c551170d4cbdda3f82edaff9405ee3d7857282d8269e8e518d2f0fb2")] \ No newline at end of file diff --git a/src/Tizen.Multimedia/AudioManager/AudioDevice.cs b/src/Tizen.Multimedia/AudioManager/AudioDevice.cs new file mode 100755 index 0000000..e085d9c --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioDevice.cs @@ -0,0 +1,110 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static class AudioDeviceLog + { + internal const string Tag = "Tizen.Multimedia.AudioDevice"; + } + + /// + /// The Device API provides functions to query the information of sound devices. + /// + public class AudioDevice + { + private readonly int _id; + private readonly string _name; + private readonly AudioDeviceType _type; + private readonly AudioDeviceIoDirection _ioDirection; + private readonly AudioDeviceState _state; + private readonly IntPtr _handle; + + internal AudioDevice(IntPtr deviceHandle) + { + _handle = deviceHandle; + int ret; + + ret = Interop.AudioDevice.GetDeviceId(_handle, out _id); + if (ret != 0) + { + Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device Id: " + (AudioManagerError)ret); + } + AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device Id"); + + IntPtr name; + ret = Interop.AudioDevice.GetDeviceName(_handle, out name); + if (ret != 0) + { + Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device name" + (AudioManagerError)ret); + } + AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device name"); + + _name = Marshal.PtrToStringAnsi(name); + + ret = Interop.AudioDevice.GetDeviceType(_handle, out _type); + if (ret != 0) + { + Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device type" + (AudioManagerError)ret); + } + AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device type"); + + ret = Interop.AudioDevice.GetDeviceIoDirection(_handle, out _ioDirection); + if (ret != 0) + { + Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device IoDirection" + (AudioManagerError)ret); + } + AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device IO Direction"); + + ret = Interop.AudioDevice.GetDeviceState(_handle, out _state); + if (ret != 0) + { + Tizen.Log.Error(AudioDeviceLog.Tag, "Unable to get device state" + (AudioManagerError)ret); + } + AudioManagerErrorFactory.CheckAndThrowException(ret, _handle, "Unable to get device state"); + } + + /// + /// The id of the device. + /// + public int Id => _id; + + /// + /// The name of the device. + /// + public string Name => _name; + + /// + /// The type of the device. + /// + public AudioDeviceType Type => _type; + + /// + /// The io direction of the device. + /// + public AudioDeviceIoDirection IoDirection => _ioDirection; + + /// + /// The state of the device. + /// + public AudioDeviceState State => _state; + + internal IntPtr Handle => _handle; + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioDeviceConnectionChangedEventArgs.cs b/src/Tizen.Multimedia/AudioManager/AudioDeviceConnectionChangedEventArgs.cs new file mode 100644 index 0000000..9369a99 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioDeviceConnectionChangedEventArgs.cs @@ -0,0 +1,42 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Class extending EventArgs which contains parameters to be passed to event handler of DeviceConnected event + /// + public class AudioDeviceConnectionChangedEventArgs : EventArgs + { + internal AudioDeviceConnectionChangedEventArgs(AudioDevice device, bool isConnected) + { + Device = device; + IsConnected = isConnected; + } + + /// + /// The object of sound device + /// + public AudioDevice Device { get; } + + /// + /// The state of device connection: (true = connected, false = disconnected) + /// + public bool IsConnected { get; } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioDeviceStateChangedEventArgs.cs b/src/Tizen.Multimedia/AudioManager/AudioDeviceStateChangedEventArgs.cs new file mode 100644 index 0000000..41a5564 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioDeviceStateChangedEventArgs.cs @@ -0,0 +1,42 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Class extending EventArgs which contains parameters to be passed to event handler of DeviceInformationChanged event + /// + public class AudioDeviceStateChangedEventArgs : EventArgs + { + internal AudioDeviceStateChangedEventArgs(AudioDevice device, AudioDeviceState changedState) + { + Device = device; + ChangedState = changedState; + } + + /// + /// The object of sound device + /// + public AudioDevice Device { get; } + + /// + /// The entry of sound device state + /// + public AudioDeviceState ChangedState { get; } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioManager.cs b/src/Tizen.Multimedia/AudioManager/AudioManager.cs new file mode 100755 index 0000000..1469637 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioManager.cs @@ -0,0 +1,198 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Multimedia +{ + internal static class AudioManagerLog + { + internal const string Tag = "Tizen.Multimedia.AudioManager"; + } + + /// + /// The Audio Manager class provides functions to get and set sound parameters like volume and devices. + /// + public static class AudioManager + { + private static int _deviceConnectionChangedCallbackId = -1; + private static int _deviceStateChangedCallbackId = -1; + + private static Interop.SoundDeviceConnectionChangedCallback _audioDeviceConnectionChangedCallback; + private static Interop.SoundDeviceStateChangedCallback _audioDeviceStateChangedCallback; + + private static EventHandler _audioDeviceConnectionChanged; + private static EventHandler _audioDeviceStateChanged; + + /// + /// Constructor for AudioManager. Initializes the VolumeController property etc. + /// + static AudioManager() + { + VolumeController = new AudioVolume(); + } + + /// + /// Registers/Unregisters a function to be invoked when the state of connection of an Audio device was changed. + /// + public static event EventHandler DeviceConnectionChanged + { + add + { + if (_audioDeviceConnectionChanged == null) + { + RegisterAudioDeviceEvent(); + Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event registered"); + } + _audioDeviceConnectionChanged += value; + Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event added"); + } + remove + { + if (_audioDeviceConnectionChanged?.GetInvocationList()?.GetLength(0) == 1) + { + UnregisterDeviceConnectionChangedEvent(); + } + _audioDeviceConnectionChanged -= value; + Tizen.Log.Info(AudioManagerLog.Tag, "DeviceConnectionChanged event removed"); + } + } + + /// + /// Registers/Unregisters a callback function to be invoked when the state of an Audio sound device was changed. + /// + public static event EventHandler DeviceStateChanged + { + add + { + if (_audioDeviceStateChanged == null) + { + RegisterDeviceStateChangedEvent(); + } + _audioDeviceStateChanged += value; + Tizen.Log.Info(AudioManagerLog.Tag, "DeviceStateChanged event added"); + } + remove + { + if (_audioDeviceStateChanged?.GetInvocationList()?.GetLength(0) == 1) + { + UnregisterDeviceStateChangedEvent(); + } + _audioDeviceStateChanged -= value; + Tizen.Log.Info(AudioManagerLog.Tag, "DeviceStateChanged event removed"); + } + } + + /// + /// The VolumeController object (singleton) is-a part of SoundManager and its properties and methods are used via AudioManager + /// + public static AudioVolume VolumeController { get; } + + /// + /// Gets the list consisting of all devices currently connected. + /// + /// The audio device options + /// The list of connected devices: IEnumerable of Device objects + public static IEnumerable GetCurrentDevices(AudioDeviceOptions options) + { + List audioDeviceList = new List(); + IntPtr deviceListHandle; + IntPtr handlePosition; + AudioDeviceIoDirection ioDirection; + + int ret = Interop.AudioDevice.GetCurrentDeviceList(options, out deviceListHandle); + if (ret != (int)AudioManagerError.NoData) + { + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to get next device"); + } + while (ret == (int)AudioManagerError.None) + { + ret = Interop.AudioDevice.GetNextDevice(deviceListHandle, out handlePosition); + if (ret == (int)AudioManagerError.NoData) + { + break; + } + else if (ret != (int)AudioManagerError.None) + { + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to get next device"); + } + + if (options == AudioDeviceOptions.Input || (options == AudioDeviceOptions.Output)) + { + ret = Interop.AudioDevice.GetDeviceIoDirection(handlePosition, out ioDirection); + if (ret != 0) + { + Tizen.Log.Error(AudioManagerLog.Tag, "Unable to get device IoDirection" + (AudioManagerError)ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, handlePosition, "Unable to get device IO Direction"); + } + else if (ioDirection == AudioDeviceIoDirection.InputAndOutput) + { + continue; + } + } + audioDeviceList.Add(new AudioDevice(handlePosition)); + } + return audioDeviceList; + } + + private static void RegisterAudioDeviceEvent() + { + _audioDeviceConnectionChangedCallback = (IntPtr device, bool isConnected, IntPtr userData) => + { + AudioDeviceConnectionChangedEventArgs eventArgs = new AudioDeviceConnectionChangedEventArgs(new AudioDevice(device), isConnected); + _audioDeviceConnectionChanged?.Invoke(null, eventArgs); + }; + int ret = Interop.AudioDevice.AddDeviceConnectionChangedCallback(AudioDeviceOptions.All, _audioDeviceConnectionChangedCallback, IntPtr.Zero, out _deviceConnectionChangedCallbackId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device connection changed callback"); + Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceConnectionChanged Event registered"); + } + + private static void RegisterDeviceStateChangedEvent() + { + _audioDeviceStateChangedCallback = (IntPtr device, AudioDeviceState changedState, IntPtr userData) => + { + AudioDeviceStateChangedEventArgs eventArgs = new AudioDeviceStateChangedEventArgs(new AudioDevice(device), changedState); + _audioDeviceStateChanged?.Invoke(null, eventArgs); + }; + int ret = Interop.AudioDevice.AddDeviceStateChangedCallback(AudioDeviceOptions.All, _audioDeviceStateChangedCallback, IntPtr.Zero, out _deviceStateChangedCallbackId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device state changed callback"); + Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceStateChangedEvent callback registered"); + } + + private static void UnregisterDeviceConnectionChangedEvent() + { + if (_deviceConnectionChangedCallbackId > 0) + { + int ret = Interop.AudioDevice.RemoveDeviceConnectionChangedCallback(_deviceConnectionChangedCallbackId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device connection changed callback"); + Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceConnectionChangedEvent callback unregistered"); + _deviceConnectionChangedCallbackId = -1; + } + } + + private static void UnregisterDeviceStateChangedEvent() + { + if (_deviceStateChangedCallbackId > 0) + { + int ret = Interop.AudioDevice.RemoveDeviceStateChangedCallback(_deviceStateChangedCallbackId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device state changed callback"); + Tizen.Log.Info(AudioManagerLog.Tag, "AudioDeviceStateChanged callback unregistered"); + _deviceStateChangedCallbackId = -1; + } + } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioManagerEnumerations.cs b/src/Tizen.Multimedia/AudioManager/AudioManagerEnumerations.cs new file mode 100755 index 0000000..6b50ee2 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioManagerEnumerations.cs @@ -0,0 +1,326 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace Tizen.Multimedia +{ + /// + /// Enumeration for audio device options. + /// + public enum AudioDeviceOptions + { + /// + /// Mask for input devices + /// + Input = 0x0001, + /// + /// Mask for output devices + /// + Output = 0x0002, + /// + /// Mask for input/output devices (both directions are available) + /// + InputAndOutput = 0x0004, + /// + /// Mask for built-in devices + /// + Internal = 0x00010, + /// + /// Mask for external devices + /// + External = 0x0020, + /// + /// Mask for deactivated devices + /// + Deactivated = 0x1000, + /// + /// Mask for activated devices + /// + Activated = 0x2000, + /// + /// Mask for all devices + /// + All = 0xFFFF + } + + /// + /// Enumeration for audio device type. + /// + public enum AudioDeviceType + { + /// + /// Built-in speaker + /// + BuiltinSpeaker, + /// + /// Built-in receiver + /// + BuiltinReceiver, + /// + /// Built-in mic + /// + BuiltinMic, + /// + /// Audio jack that can be connected to wired accessory such as headphones and headsets + /// + AudioJack, + /// + /// Bluetooth Media (A2DP) + /// + BluetoothMedia, + /// + /// HDMI + /// + Hdmi, + /// + /// Device for forwarding + /// + Forwarding, + /// + /// USB Audio + /// + UsbAudio, + /// + /// Bluetooth Voice (SCO) + /// + BluetoothVoice + } + + /// + /// Enumeration for audio device direction. + /// + public enum AudioDeviceIoDirection + { + /// + /// Input device + /// + Input, + /// + /// Output device + /// + Output, + /// + /// Input/output device (both directions are available) + /// + InputAndOutput + } + + /// + /// Enumeration for audio device state. + /// + public enum AudioDeviceState + { + /// + /// Deactivated state + /// + Deactivated, + /// + /// Activated state + /// + Activated + } + + /// + /// Enumeration for audio volume type. + /// + public enum AudioVolumeType + { + /// + /// Volume type for system + /// + System, + /// + /// Volume type for notification + /// + Notification, + /// + /// Volume type for alarm + /// + Alarm, + /// + /// Volume type for ringtone + /// + Ringtone, + /// + /// Volume type for media + /// + Media, + /// + /// Volume type for call + /// + Call, + /// + /// Volume type for voip + /// + Voip, + /// + /// Volume type for voice + /// + Voice, + /// + /// Volume type None + /// + None + } + + /// + /// Enumeration for audio stream type. + /// + public enum AudioStreamType + { + /// + /// Audio stream type for media + /// + Media, + /// + /// Audio stream type for system + /// + System, + /// + /// Audio stream type for alarm + /// + Alarm, + /// + /// Audio stream type for notification + /// + Notification, + /// + /// Audio stream type for emergency + /// + Emergency, + /// + /// Audio stream type for voice information + /// + VoiceInformation, + /// + /// Audio stream type for voice recognition + /// + VoiceRecognition, + /// + /// Audio stream type for ringtone for VoIP + /// + RingtoneVoip, + /// + /// Audio stream type for VoIP + /// + Voip, + /// + /// Audio stream type for media only for external devices + /// + MediaExternalOnly + } + + /// + /// Enumeration for change reason of audio stream focus state. + /// + public enum AudioStreamFocusChangedReason + { + /// + /// Changed by the stream type for media + /// + Media, + /// + /// Changed by the stream type for system + /// + System, + /// + /// Changed by the stream type for alarm + /// + Alarm, + /// + /// Changed by the stream type for notification + /// + Notification, + /// + /// Changed by the stream type for emergency + /// + Emergency, + /// + /// Changed by the stream type for voice information + /// + VoiceInformation, + /// + /// Changed by the stream type for voice recognition + /// + VoiceRecognition, + /// + /// Changed by the stream type for ringtone + /// + RingtoneVoip, + /// + /// Changed by the stream type for VoIP + /// + Voip, + /// + /// Changed by the stream type for voice-call or video-call + /// + Call, + /// + /// Changed by the stream type for media only for external devices + /// + MediaExternalOnly + } + + /// + /// Enumeration for audio stream focus options. + /// + public enum AudioStreamFocusOptions + { + /// + /// Mask for playback focus + /// + Playback = 0x0001, + /// + /// Mask for recording focus + /// + Recording = 0x0002 + } + + /// + /// Enumeration for audio stream focus state. + /// + public enum AudioStreamFocusState + { + /// + /// Focus state for release + /// + Released, + /// + ///Focus state for acquisition + /// + Acquired + } + + /// + /// Enumeration for audio stream behavior + /// + [Flags] + public enum AudioStreamBehavior + { + /// + /// Audio Stream Behavior NONE + /// + None = 0x0000, + /// + /// Audio Stream Behavior No Resume + /// + NoResume = 0x0001, + /// + /// Audio Stream Behavior Fading + /// + Fading = 0x0002 + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioManagerErrorFactory.cs b/src/Tizen.Multimedia/AudioManager/AudioManagerErrorFactory.cs new file mode 100644 index 0000000..22fba2f --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioManagerErrorFactory.cs @@ -0,0 +1,120 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// Enumeration for sound manager's error codes. + /// + internal enum AudioManagerError{ + + SoundManagerError = -0x01960000, + /// + /// Successful + /// + None = ErrorCode.None, + /// + /// Out of memory + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// Invalid parameter + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Invalid operation + /// + InvalidOperation = ErrorCode.InvalidOperation, + /// + /// Permission denied + /// + PermissionDenied = ErrorCode.PermissionDenied, + /// + /// Not supported + /// + NotSupported = ErrorCode.NotSupported, + /// + /// No data + /// + NoData = ErrorCode.NoData, + /// + /// Internal error inside the sound system + /// + Internal = SoundManagerError | 01, + /// + /// Noncompliance with the sound system policy + /// + Policy = SoundManagerError | 02, + /// + /// No playing sound + /// + NoPlayingSound = SoundManagerError | 03, + /// + /// Invalid state (Since 3.0) + /// + InvalidState = SoundManagerError | 04 + } + + internal static class AudioManagerErrorFactory + { + static internal void CheckAndThrowException(int error, string msg) + { + AudioManagerError e = (AudioManagerError) error; + switch (e) + { + case AudioManagerError.None: + return; + case AudioManagerError.OutOfMemory: + throw new InvalidOperationException("Out of Memory: " + msg); + case AudioManagerError.InvalidParameter: + throw new ArgumentException("Invalid Parameter: " + msg); + case AudioManagerError.InvalidOperation: + throw new InvalidOperationException("Invalid Opertation: " + msg); + case AudioManagerError.PermissionDenied: + throw new InvalidOperationException("Permission Denied: " + msg); + case AudioManagerError.NotSupported: + throw new InvalidOperationException("Not Supported: " + msg); + case AudioManagerError.NoData: + throw new InvalidOperationException("No Data: " + msg); + case AudioManagerError.Internal: + throw new InvalidOperationException("Internal Error: " + msg); + case AudioManagerError.Policy: + throw new InvalidOperationException("Noncomplaince with System Sound Policy error: " + msg); + case AudioManagerError.NoPlayingSound: + throw new InvalidOperationException("No playing sound: " + msg); + case AudioManagerError.InvalidState: + throw new InvalidOperationException("Invalid State: " + msg); + default: + throw new InvalidOperationException("Unknown Error Code: " + msg); + } + } + + static internal void CheckAndThrowException(int error, IntPtr handle, string msg) + { + if (handle == IntPtr.Zero) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + else + { + CheckAndThrowException(error, msg); + } + } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs b/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs new file mode 100755 index 0000000..b914c9c --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioStreamPolicy.cs @@ -0,0 +1,334 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class AudioStreamPolicyLog + { + internal const string Tag = "Tizen.Multimedia.AudioStreamPolicy"; + } + + /// + /// The Stream Policy API provides functions to control a sound stream. + /// + public class AudioStreamPolicy : IDisposable + { + private static int _focusStateWatchCounter = 0; + private static EventHandler _focusStateWatchForPlayback; + private static EventHandler _focusStateWatchForRecording; + private static Interop.SoundStreamFocusStateWatchCallback _focusStateWatchCallback; + private static int _focusWatchCbId; + + private IntPtr _streamInfo; + private AudioStreamType _streamType; + private bool _disposed = false; + private EventHandler _focusStateChanged; + private Interop.SoundStreamFocusStateChangedCallback _focusStateChangedCallback; + + /// + /// Creates and returns an AudioStreamPolicy object + /// + /// + /// To apply the stream policy according to this stream information, this object should be passed to other APIs + /// related to playback or recording. (e.g., player, wav-player, audio-io, etc.) + /// + /// Type of sound stream for which policy needs to be created + /// StreamPolicy object + public AudioStreamPolicy(AudioStreamType streamType) + { + _streamType = streamType; + + _focusStateChangedCallback = (IntPtr streamInfo, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, int reason, int audioStreamBehavior, string extraInfo, IntPtr userData) => { + StreamFocusStateChangedEventArgs eventArgs = new StreamFocusStateChangedEventArgs((AudioStreamFocusChangedReason)reason, extraInfo); + _focusStateChanged?.Invoke(this, eventArgs); + }; + int ret = Interop.AudioStreamPolicy.CreateStreamInformation((int)streamType, _focusStateChangedCallback, IntPtr.Zero, out _streamInfo); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to create stream information"); + } + + ~AudioStreamPolicy() + { + Dispose(false); + } + + /// + /// Registers the watch function to be invoked when the focus state for each sound stream type is changed regardless of the process. + /// + /// Remarks: You can set this only once per process. + /// + /// + public static event EventHandler PlaybackFocusStateWatch { + add { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _focusStateWatchCounter" + _focusStateWatchCounter); + if(_focusStateWatchCounter == 0) { + RegisterFocusStateWatchEvent(); + } + _focusStateWatchCounter++; + _focusStateWatchForPlayback += value; + } + remove { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _focusStateWatchCounter" + _focusStateWatchCounter); + _focusStateWatchForPlayback -= value; + _focusStateWatchCounter--; + if(_focusStateWatchCounter == 0) { + UnregisterFocusStateWatch(); + } + } + } + + /// + /// Registers the watch function to be invoked when the focus state for each sound stream type is changed regardless of the process. + /// + /// Remarks: You can set this only once per process. + /// + /// + public static event EventHandler RecordingFocusStateWatch { + add { + if(_focusStateWatchCounter == 0) { + RegisterFocusStateWatchEvent(); + } + _focusStateWatchCounter++; + _focusStateWatchForRecording += value; + } + remove { + _focusStateWatchForRecording -= value; + _focusStateWatchCounter--; + if(_focusStateWatchCounter == 0) { + UnregisterFocusStateWatch(); + } + } + } + + /// + /// Registers function to be called when the state of focus that belongs to the current + /// streamInfo is changed. + /// + /// + /// Remarks: This function is issued in the internal thread of the sound manager. Therefore it is recommended not to call UI update function in this function. + /// Postcondition : Check PlaybackFocusState and RecordingFocusState in the registered event handler to figure out how the focus state of the StreamInfo has been changed. + /// + public event EventHandler StreamFocusStateChanged { + add { + _focusStateChanged += value; + } + remove { + _focusStateChanged -= value; + } + } + + /// + /// The sound type of the stream information. + /// + public AudioVolumeType VolumeType { + get { + AudioVolumeType soundType; + int ret = Interop.AudioStreamPolicy.GetSoundType(_streamInfo, out soundType); + if(ret != 0) { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get sound type:" + (AudioManagerError)ret); + return AudioVolumeType.None; + } + return soundType; + } + } + + /// + /// The state of focus for playback. + /// + public AudioStreamFocusState PlaybackFocusState { + get { + AudioStreamFocusState stateForPlayback; + AudioStreamFocusState stateForRecording; + int ret = Interop.AudioStreamPolicy.GetFocusState(_streamInfo, out stateForPlayback, out stateForRecording); + if(ret != 0) { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus state" + (AudioManagerError)ret); + return AudioStreamFocusState.Released; + } + return stateForPlayback; + } + } + + /// + /// The state of focus for recording. + /// + public AudioStreamFocusState RecordingFocusState { + get { + AudioStreamFocusState stateForPlayback; + AudioStreamFocusState stateForRecording; + int ret = Interop.AudioStreamPolicy.GetFocusState(_streamInfo, out stateForPlayback, out stateForRecording); + if(ret != 0) { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus state" + (AudioManagerError)ret); + return AudioStreamFocusState.Released; + } + return stateForRecording; + } + } + + /// + /// Auto focus reacquisition property + /// + /// + /// The focus reacquistion is set as default. If you don't want to reacquire the focus you've lost automatically, disable the focus reacqusition setting by using this API and vice versa. + /// + public bool FocusReacquisitionEnabled { + get { + bool enabled; + int ret = Interop.AudioStreamPolicy.GetFocusReacquisition(_streamInfo, out enabled); + if(ret != 0) { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Unable to get focus reacquisition" + (AudioManagerError)ret); + return true; + } + return enabled; + } + set { + int ret = Interop.AudioStreamPolicy.SetFocusReacquisition(_streamInfo, value); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set focus reacquisition"); + } + } + + public IntPtr Handle { + get { + return _streamInfo; + } + } + + /// + /// Acquires the stream focus. + /// + /// The focus mask that user wants to acquire + /// The required action for releaser + /// The Extra information for this request (optional, this can be null) + /// + /// Do not call this API within event handlers of FocuStateChanged and StreamFocusStateWatch else it will throw and exception + /// + public void AcquireFocus(AudioStreamFocusOptions options, AudioStreamBehavior audioStreamBehavior, string extraInformation) + { + int ret = Interop.AudioStreamPolicy.AcquireFocus(_streamInfo, options, (int)audioStreamBehavior, extraInformation); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Acquire focus return: " + ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to acquire focus"); + } + + /// + /// Releases the acquired focus. + /// + /// The focus mask that user wants to release + /// The required action for acquirer + /// he Extra information for this request (optional, this can be null) + /// + /// Do not call this API within event handlers of FocuStateChanged and StreamFocusStateWatch else it will throw and exception + /// + public void ReleaseFocus(AudioStreamFocusOptions options, AudioStreamBehavior audioStreamBehavior, string extraInformation) + { + int ret = Interop.AudioStreamPolicy.ReleaseFocus(_streamInfo, options, (int)audioStreamBehavior, extraInformation); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Release focus return: " + ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to release focus"); + } + + /// + /// Applies the stream routing. + /// + /// + /// If the stream has not been made yet, this setting will be applied when the stream starts to play. + /// Precondition: Call AddDeviceForStreamRouting() before calling this function. + /// + public void ApplyStreamRouting() + { + int ret = Interop.AudioStreamPolicy.ApplyStreamRouting(_streamInfo); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Apply Routing: " + (AudioManagerError)ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to apply stream routing"); + } + + /// + /// Adds the device to the stream information for the stream routing. + /// + /// + /// Remarks: Use SoundManager.GetCurrentDeviceList() to get the device. + /// The available types of the StreamInfo for this API are SoundStreamTypeVoip and SoundStreamTypeMediaExternalOnly. + /// Postcondition: You can apply this setting by calling ApplyStreamRouting(). + /// + /// The device item from the current sound devices list. + public void AddDeviceForStreamRouting(AudioDevice soundDevice) + { + int ret = Interop.AudioStreamPolicy.AddDeviceForStreamRouting(_streamInfo, soundDevice.Handle); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Add stream routing: " + (AudioManagerError)ret); + + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to add device for stream routing"); + } + + /// + /// Removes the device to the stream information for the stream routing. + /// + /// + /// Remarks: Use SoundManager.GetCurrentDeviceList() to get the device. + /// The available types of the StreamInfo for this API are SoundStreamTypeVoip and SoundStreamTypeMediaExternalOnly. + /// Postcondition: You can apply this setting by calling ApplyStreamRouting(). + /// + /// The device item from the current sound devices list. + public void RemoveDeviceForStreamRouting(AudioDevice soundDevice) + { + int ret = Interop.AudioStreamPolicy.RemoveDeviceForStreamRouting(_streamInfo, soundDevice.Handle); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "Remove stream routing: " + (AudioManagerError)ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to remove device for stream routing"); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if(!_disposed) { + if(disposing) { + // to be used if there are any other disposable objects + } + if(_streamInfo != IntPtr.Zero) { + Interop.AudioStreamPolicy.DestroyStreamInformation(_streamInfo); // Destroy the handle + _streamInfo = IntPtr.Zero; + } + _disposed = true; + } + } + + private static void RegisterFocusStateWatchEvent() + { + _focusStateWatchCallback = (int id, AudioStreamFocusOptions options, AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData) => { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _Inside _focusStateWatchCallback : id = " + id + "options = " + options); + FocusStateChangedEventArgs eventArgs = new FocusStateChangedEventArgs(focusState, reason, extraInfo); + if(options == AudioStreamFocusOptions.Playback) { + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _eventArgs = " + eventArgs); + _focusStateWatchForPlayback?.Invoke(null, eventArgs); + } else if(options == AudioStreamFocusOptions.Recording) { + _focusStateWatchForRecording?.Invoke(null, eventArgs); + } else if(options == (AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording)) { + _focusStateWatchForPlayback?.Invoke(null, eventArgs); + _focusStateWatchForRecording?.Invoke(null, eventArgs); + } + }; + int ret = Interop.AudioStreamPolicy.AddFocusStateWatchCallback(AudioStreamFocusOptions.Playback | AudioStreamFocusOptions.Recording, _focusStateWatchCallback, IntPtr.Zero, out _focusWatchCbId); + Tizen.Log.Info(AudioStreamPolicyLog.Tag, "############# _AddFocusStateWatchCallback : ret = " + ret + " ID = " + _focusWatchCbId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set focus state watch callback"); + } + + private static void UnregisterFocusStateWatch() + { + int ret = Interop.AudioStreamPolicy.RemoveFocusStateWatchCallback(_focusWatchCbId); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to unset focus state watch callback"); + } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/AudioVolume.cs b/src/Tizen.Multimedia/AudioManager/AudioVolume.cs new file mode 100755 index 0000000..d87eab2 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/AudioVolume.cs @@ -0,0 +1,107 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class AudioVolumeLog + { + internal const string Tag = "Tizen.Multimedia.AudioVolume"; + } + + /// + /// The AudioVolume API provides functions to check and control volumes. + /// + public class AudioVolume + { + private static int _volumeChangedCallbackId = -1; + private EventHandler _volumeChanged; + private Interop.SoundManagerVolumeChangedCallback _volumeChangedCallback; + + internal AudioVolume() + { + Level = new VolumeLevel(); + MaxLevel = new MaxVolumeLevel(); + } + + /// + /// Registers a function to be invoked when the volume level is changed. + /// + public event EventHandler Changed { + add { + Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed Event added...."); + if(_volumeChanged == null) { + RegisterVolumeChangedEvent(); + } + _volumeChanged += value; + } + remove { + Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Changed Event removed...."); + if(_volumeChanged?.GetInvocationList()?.GetLength(0) == 1) { + UnregisterVolumeChangedEvent(); + } + _volumeChanged -= value; + } + } + + /// + /// The Audio Manager has predefined volume types.(system, notification, alarm, ringtone, media, call, voip, voice). + /// The volume type of the sound being currently played. + /// + public AudioVolumeType CurrentPlaybackType { + get { + AudioVolumeType currentType; + int ret = Interop.AudioVolume.GetCurrentSoundType(out currentType); + if(ret != 0) { + Tizen.Log.Info(AudioVolumeLog.Tag, "Unable to get current playback sound type" + (AudioManagerError)ret); + return AudioVolumeType.None; + } + return currentType; + } + } + + /// + /// The indexer class which is used to get/set volume level specified for a particular sound type. + /// + public VolumeLevel Level; + + /// + /// The indexer class which is used to get maximum volume level supported for a particular sound type. + /// + public MaxVolumeLevel MaxLevel; + + private void RegisterVolumeChangedEvent() + { + _volumeChangedCallback = (AudioVolumeType type, uint volume, IntPtr userData) => { + VolumeChangedEventArgs eventArgs = new VolumeChangedEventArgs(type, volume); + _volumeChanged.Invoke(this, eventArgs); + }; + int error = Interop.AudioVolume.AddVolumeChangedCallback(_volumeChangedCallback, IntPtr.Zero, out _volumeChangedCallbackId); + Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Add Changed Event return id:" + _volumeChangedCallbackId + "error:" + error); + AudioManagerErrorFactory.CheckAndThrowException(error, "unable to add level changed callback"); + } + + private void UnregisterVolumeChangedEvent() + { + if (_volumeChangedCallbackId > 0) { + int error = Interop.AudioVolume.RemoveVolumeChangedCallback(_volumeChangedCallbackId); + Tizen.Log.Info(AudioVolumeLog.Tag, "VolumeController Remove Changed Event(id:" + _volumeChangedCallbackId + ") return error: " + error); + AudioManagerErrorFactory.CheckAndThrowException(error, "unable to remove level changed callback"); + } + } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/FocusStateChangedEventArgs.cs b/src/Tizen.Multimedia/AudioManager/FocusStateChangedEventArgs.cs new file mode 100644 index 0000000..cf17aae --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/FocusStateChangedEventArgs.cs @@ -0,0 +1,48 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Class extending EventArgs and contains the necessary parameters to passed to FocusStateWatch event handler + /// + public class FocusStateChangedEventArgs : EventArgs + { + internal FocusStateChangedEventArgs(AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInformation) + { + FocusState = focusState; + FocusChangedReason = reason; + ExtraInformation = extraInformation; + } + + /// + /// The changed focus state + /// + public AudioStreamFocusState FocusState { get; } + + /// + /// The reason for state change of the focus + /// + public AudioStreamFocusChangedReason FocusChangedReason { get; } + + /// + /// The extra information + /// + public string ExtraInformation { get; } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/MaxVolumeLevel.cs b/src/Tizen.Multimedia/AudioManager/MaxVolumeLevel.cs new file mode 100644 index 0000000..5e1ed72 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/MaxVolumeLevel.cs @@ -0,0 +1,46 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class MaxVolumeLog + { + internal const string Tag = "Tizen.Multimedia.MaxVolume"; + } + + /// + /// This is a indexer class which is used to get the maximum volume level + /// supported for a particular sound type. + /// + public class MaxVolumeLevel + { + public int this [AudioVolumeType type] { + get { + if(type == AudioVolumeType.None) + throw new ArgumentException("Wrong Audio volume type. Cannot get max volume level for AudioVolumeType.None"); + int maxVolume; + int ret = Interop.AudioVolume.GetMaxVolume(type, out maxVolume); + if(ret != 0) { + Tizen.Log.Info(MaxVolumeLog.Tag, "Max Level Error: " + (AudioManagerError)ret); + return -1; + } + return maxVolume; + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/AudioManager/StreamFocusStateChangedEventArgs.cs b/src/Tizen.Multimedia/AudioManager/StreamFocusStateChangedEventArgs.cs new file mode 100755 index 0000000..225cbe4 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/StreamFocusStateChangedEventArgs.cs @@ -0,0 +1,43 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Class extending EventArgs and contains the necessary parameters to passed to FocusStateChanged event handler + /// + public class StreamFocusStateChangedEventArgs : EventArgs + { + /* FIXME */ + internal StreamFocusStateChangedEventArgs(AudioStreamFocusChangedReason reason, string extraInformation) + { + FocusChangedReason = reason; + ExtraInformation = extraInformation; + } + + /// + /// The reason for state change of the focus + /// + public AudioStreamFocusChangedReason FocusChangedReason { get; } + + /// + /// The extra information + /// + public string ExtraInformation { get; } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/VolumeChangedEventArgs.cs b/src/Tizen.Multimedia/AudioManager/VolumeChangedEventArgs.cs new file mode 100755 index 0000000..1643976 --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/VolumeChangedEventArgs.cs @@ -0,0 +1,42 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Extnded EventArgs which contains the parameteres to be passed to the AudioVolume Changed event + /// + public class VolumeChangedEventArgs : EventArgs + { + internal VolumeChangedEventArgs(AudioVolumeType type, uint level) + { + Type = type; + Level = level; + } + + /// + /// The sound type of the changed volume + /// + public AudioVolumeType Type { get; } + + /// + /// The new volume value + /// + public uint Level { get; } + } +} diff --git a/src/Tizen.Multimedia/AudioManager/VolumeLevel.cs b/src/Tizen.Multimedia/AudioManager/VolumeLevel.cs new file mode 100644 index 0000000..a4aeaed --- /dev/null +++ b/src/Tizen.Multimedia/AudioManager/VolumeLevel.cs @@ -0,0 +1,55 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal static class VolumeLevelLog + { + internal const string Tag = "Tizen.Multimedia.VolumeLevel"; + } + + /// + /// This is a indexer class which is used to get/set the volume level + /// specified for a particular sound type. + /// + public class VolumeLevel + { + public int this [AudioVolumeType type] { + get { + if(type == AudioVolumeType.None) + throw new ArgumentException("Wrong Audio volume type. Cannot get volume level for AudioVolumeType.None"); + int volume; + int ret = Interop.AudioVolume.GetVolume(type, out volume); + if(ret != 0) { + Tizen.Log.Info(VolumeLevelLog.Tag, "Get Level Error: " + (AudioManagerError)ret); + return -1; + } + return volume; + } + set { + if(type == AudioVolumeType.None) + throw new ArgumentException("Wrong Audio volume type. Cannot set volume level for AudioVolumeType.None"); + int ret = Interop.AudioVolume.SetVolume(type, value); + if(ret != 0) { + Tizen.Log.Info(VolumeLevelLog.Tag, "Set Level Error: " + (AudioManagerError)ret); + AudioManagerErrorFactory.CheckAndThrowException(ret, "Unable to set level"); + } + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Common.Internal/Features.cs b/src/Tizen.Multimedia/Common.Internal/Features.cs new file mode 100644 index 0000000..50c8508 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/Features.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Tizen.System; + +namespace Tizen.Multimedia +{ + internal static class Features + { + internal const string AudioEffect = "http://tizen.org/feature/multimedia.custom_audio_effect"; + internal const string RawVideo = "http://tizen.org/feature/multimedia.raw_video"; + + internal static bool IsSupported(string featureKey) + { + bool supported = false; + SystemInfo.TryGetValue(featureKey, out supported); + return supported; + } + + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/FileUtil.cs b/src/Tizen.Multimedia/Common.Internal/FileUtil.cs new file mode 100644 index 0000000..2b3e6f5 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/FileUtil.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; + +namespace Tizen.Multimedia +{ + internal static class FileUtil + { + public static bool HasReadPermission(string path) + { + return Access(path, Interop.Libc.AccessMode.R_OK); + } + + public static bool HasWritePermission(string path) + { + + return Access(Path.GetDirectoryName(path), Interop.Libc.AccessMode.W_OK); + } + + private static bool Access(string path, int mode) + { + if (path == null) + { + throw new ArgumentNullException(nameof(path)); + } + return Interop.Libc.Access(path, mode) == 0; + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs b/src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs new file mode 100644 index 0000000..f779510 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/IBufferOwner.cs @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + internal enum MediaBufferAccessMode + { + Read, + Write + } + + internal interface IBufferOwner + { + bool IsBufferAccessible(object buffer, MediaBufferAccessMode accessMode); + + bool IsDisposed { get; } + } + + + internal static class BufferOwnerExtensions + { + internal static void ValidateBufferReadable(this IBufferOwner bufferOwner, IReadOnlyBuffer buffer) + { + if (bufferOwner.IsDisposed) + { + throw new ObjectDisposedException(bufferOwner.GetType().Name); + } + + if (!bufferOwner.IsBufferAccessible(buffer, MediaBufferAccessMode.Read)) + { + throw new InvalidOperationException("The buffer is not in the readable state."); + } + } + + internal static void ValidateBufferWritable(this IBufferOwner bufferOwner, IMediaBuffer buffer) + { + if (bufferOwner.IsDisposed) + { + throw new ObjectDisposedException(bufferOwner.GetType().Name); + } + + if (!bufferOwner.IsBufferAccessible(buffer, MediaBufferAccessMode.Write)) + { + throw new InvalidOperationException("The buffer is not in writable state."); + } + } + } + +} diff --git a/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs b/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs new file mode 100644 index 0000000..0f11db1 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/LibcSupport.cs @@ -0,0 +1,13 @@ + +using System; + +namespace Tizen.Multimedia +{ + internal static class LibcSupport + { + internal static void Free(IntPtr ptr) + { + Interop.Libc.Free(ptr); + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs b/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs new file mode 100644 index 0000000..3e00569 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/MultimediaDebug.cs @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Diagnostics; + +namespace Tizen.Multimedia +{ + internal class MultimediaDebug + { + [Conditional("DEBUG")] + internal static void AssertNoError(int errorCode) + { + Debug.Assert(errorCode == (int)Internals.Errors.ErrorCode.None, + $"The API is supposed not to return an error! But it returns error({ errorCode }).", + "Implementation of core may have been changed, modify the call to throw if the return code is not ok."); + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs b/src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs new file mode 100644 index 0000000..e844bdd --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/MultimediaLog.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Tizen.Multimedia +{ + internal static class MultimediaLog + { + [Conditional("DEBUG")] + public static void Debug(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Debug(tag, BuildMessage(message, e), file, func, line); + } + + public static void Error(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Error(tag, BuildMessage(message, e), file, func, line); + } + + public static void Fatal(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Fatal(tag, BuildMessage(message, e), file, func, line); + } + + public static void Info(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Info(tag, BuildMessage(message, e), file, func, line); + } + + public static void Verbose(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Verbose(tag, BuildMessage(message, e), file, func, line); + } + + public static void Warn(string tag, string message, Exception e = null, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + Log.Warn(tag, BuildMessage(message, e), file, func, line); + } + + private static string BuildMessage(string message, Exception exception) + { + if (exception == null) + { + return message; + } + + StringBuilder sb = new StringBuilder(); + + Exception e = exception; + while (e != null) + { + message += e.Message + Environment.NewLine + e.StackTrace; + e = e.InnerException; + } + + return sb.ToString(); + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs b/src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs new file mode 100644 index 0000000..6f4de80 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/ObjectKeeper.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal abstract class ObjectKeeper : IDisposable + { + private ObjectKeeper() + { + } + + public abstract void Dispose(); + + public static ObjectKeeperImpl Get(T target) + { + return new ObjectKeeperImpl(target); + } + + internal class ObjectKeeperImpl : ObjectKeeper + { + private readonly GCHandle _handle; + + internal ObjectKeeperImpl(T obj) + { + Target = obj; + _handle = GCHandle.Alloc(obj); + } + + ~ObjectKeeperImpl() + { + Dispose(false); + } + + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + _handle.Free(); + } + + disposedValue = true; + } + } + + public override void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + public T Target + { + get; + } + } + } +} diff --git a/src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs b/src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs new file mode 100644 index 0000000..b2b7bf6 --- /dev/null +++ b/src/Tizen.Multimedia/Common.Internal/ValdiationUtil.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Globalization; + +namespace Tizen.Multimedia +{ + internal static class ValidationUtil + { + internal static void ValidateEnum(Type enumType, object value) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Invalid { enumType.Name } value : { value }"); + } + } + + internal static void ValidateEnum(Type enumType, object value, string paramName) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Invalid { enumType.Name } value : { value }", paramName); + } + } + + internal static void ValidateFlagsEnum(T value, T allMasks, string paramName) where T : IConvertible + { + if (((~allMasks.ToInt32(CultureInfo.InvariantCulture)) & value.ToInt32(CultureInfo.InvariantCulture)) != 0) + { + throw new ArgumentException($"Invalid { typeof(T).Name } value : { value }", paramName); + } + } + + internal static void ValidateFeatureSupported(string featureKey) + { + if (Features.IsSupported(featureKey) == false) + { + throw new NotSupportedException($"The feature({featureKey}) is not supported."); + } + } + } +} diff --git a/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs b/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs new file mode 100644 index 0000000..ed8dec6 --- /dev/null +++ b/src/Tizen.Multimedia/Common/CodecNotSupportedException.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Specifies whether a codec is audio codec or video codec. + /// + public enum CodecKind + { + /// + /// Audio codec + /// + Audio, + + /// + /// Video codec + /// + Video + } + + /// + /// The exception that is thrown when the codec for an input file or a data stream is not supported + /// or the input is malformed. + /// + public class CodecNotSupportedException : InvalidOperationException + { + /// + /// Initializes a new instance of the class + /// with indicating which codec is not supported. + /// + public CodecNotSupportedException(CodecKind kind) + { + CodecKind = kind; + } + + /// + /// Initializes a new instance of the class with + /// indicating which codec is not supported and a specified error message. + /// + public CodecNotSupportedException(CodecKind kind, string message) : base(message) + { + CodecKind = kind; + } + + /// + /// Gets the of the exception. + /// + public CodecKind CodecKind { get; } + } +} diff --git a/src/Tizen.Multimedia/Common/ColorSpace.cs b/src/Tizen.Multimedia/Common/ColorSpace.cs new file mode 100644 index 0000000..edbb001 --- /dev/null +++ b/src/Tizen.Multimedia/Common/ColorSpace.cs @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies color spaces for Tizen.Multimedia. + /// + public enum ColorSpace + { + /// + /// Y800 + /// + Y800, + + /// + /// I420 + /// + I420, + + /// + /// NV12 + /// + NV12, + + /// + /// NV16 + /// + NV16, + + /// + /// NV21 + /// + NV21, + + /// + /// NV61 + /// + NV61, + + /// + /// YV12 + /// + /// + YV12, + + /// + /// YUYV + /// + Yuyv, + + /// + /// YUV422 + /// + Yuv422, + + /// + /// UYVY + /// + Uyvy, + + /// + /// YUV422P + /// + /// + Yuv422P, + + /// + /// RGB565 + /// + Rgb565, + + /// + /// RGB888 + /// + Rgb888, + + /// + /// RGBA8888 + /// + Rgba8888, + + /// + /// ARGB8888 + /// + Argb8888, + + /// + /// BGRA8888 + /// + Bgra8888, + + /// + /// BGRX8888 + /// + Bgrx8888 + + } +} diff --git a/src/Tizen.Multimedia/Common/Display.cs b/src/Tizen.Multimedia/Common/Display.cs new file mode 100644 index 0000000..d300c57d --- /dev/null +++ b/src/Tizen.Multimedia/Common/Display.cs @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using ElmSharp; + +namespace Tizen.Multimedia +{ + internal enum DisplayType + { + /// + /// Overlay surface display + /// + Overlay, + + /// + /// Evas image object surface display + /// + Surface, + + /// + /// This disposes off buffers + /// + None, + } + + internal interface IDisplayable + { + ErrorType ApplyEvasDisplay(DisplayType type, EvasObject evasObject); + } + + /// + /// Provides a means to wrap various display types. + /// + /// + /// + /// + public class Display + { + private Display(DisplayType type, EvasObject target) + { + if (target == null) + { + throw new ArgumentNullException(nameof(target)); + } + + if (target == IntPtr.Zero) + { + throw new ArgumentException("The evas object is not realized."); + } + + Type = type; + EvasObject = target; + } + + /// + /// Initializes a new instance of the class with a class. + /// + /// http://tizen.org/feature/multimedia.raw_video + /// The required feature is not supported. + public Display(MediaView mediaView) : this(DisplayType.Surface, mediaView) + { + ValidationUtil.ValidateFeatureSupported(Features.RawVideo); + } + + /// + /// Initializes a new instance of the class with a class. + /// + public Display(Window window) : this(DisplayType.Overlay, window) + { + } + + private EvasObject EvasObject { get; } + + private DisplayType Type { get; } + + private object _owner; + + internal object Owner => _owner; + + internal void SetOwner(object newOwner) + { + if (_owner != null && newOwner != null) + { + throw new ArgumentException("The display has already been assigned to another."); + } + + _owner = newOwner; + } + + internal ErrorType ApplyTo(IDisplayable target) + { + return target.ApplyEvasDisplay(Type, EvasObject); + } + } +} diff --git a/src/Tizen.Multimedia/Common/FileFormatException.cs b/src/Tizen.Multimedia/Common/FileFormatException.cs new file mode 100644 index 0000000..e7d7d9a --- /dev/null +++ b/src/Tizen.Multimedia/Common/FileFormatException.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// The exception that is thrown when an input file or a data stream that is supposed to conform + /// to a certain file format specification is malformed. + /// + public class FileFormatException : FormatException + { + /// + /// Initializes a new instance of the class. + /// + public FileFormatException() + { + } + + /// + /// Initializes a new instance of the class with a specified error message. + /// + public FileFormatException(string message) : base(message) + { + } + } +} diff --git a/src/Tizen.Multimedia/Common/Flips.cs b/src/Tizen.Multimedia/Common/Flips.cs new file mode 100644 index 0000000..977be45 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Flips.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Specifies the flip operation. + /// + [Flags] + public enum Flips + { + /// + /// No flip operation. + /// + None = 0, + + /// + /// Flip horizontally. + /// + Horizontal = 1, + + /// + /// Flip vertically. + /// + Vertical = 2, + } +} diff --git a/src/Tizen.Multimedia/Common/IMediaBuffer.cs b/src/Tizen.Multimedia/Common/IMediaBuffer.cs new file mode 100644 index 0000000..f1f3f72 --- /dev/null +++ b/src/Tizen.Multimedia/Common/IMediaBuffer.cs @@ -0,0 +1,219 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// Provides functionality to read a media buffer. + /// + public interface IReadOnlyBuffer + { + /// + /// Gets or sets a value at the specified index. + /// + /// The index of the value to get or set. + /// + /// index is less than zero.\n + /// -or-\n + /// index is equal to or greater than . + /// + /// The object that owns the current buffer already has been disposed of. + /// The buffer is not available. i.e. not writable state. + byte this[int index] + { + get; + set; + } + /// + /// Gets the size of the buffer, in bytes. + /// + int Length + { + get; + } + + /// + /// Copies data from a byte array to the buffer. + /// + /// The array to copy to. + /// The zero-based index in the source array where copying should start. + /// The number of array elements to copy. + /// startIndex or length is not valid. + /// The object that owns the current buffer already has been disposed of. + void CopyTo(byte[] dest, int startIndex, int length); + + /// + /// Copies data from a byte array to the buffer. + /// + /// The array to copy to. + /// The zero-based index in the source array where copying should start. + /// The number of array elements to copy. + /// The zero-based index in the buffer where copying should start. + /// startIndex, offset or length is not valid. + /// The object that owns the current buffer already has been disposed of. + void CopyTo(byte[] dest, int startIndex, int length, int offset); + } + + /// + /// Provides functionality to read and write a media buffer. + /// + public interface IMediaBuffer : IReadOnlyBuffer + { + /// + /// Copies data from the buffer to a byte array. + /// + /// The array to copy from. + /// The zero-based index in the dest array where copying should start. + /// The number of elements to copy. + /// startIndex or length is not valid. + /// The object that owns the current buffer already has been disposed of. + /// The buffer is not available. i.e. not writable state. + + void CopyFrom(byte[] source, int startIndex, int length); + + /// + /// Copies data from the buffer to a byte array. + /// + /// The array to copy from. + /// The zero-based index in the dest array where copying should start. + /// The number of elements to copy. + /// The zero-based index in the buffer where copying should start. + /// startIndex, offset or length is not valid. + /// The object that owns the current buffer already has been disposed of. + /// The buffer is not available. i.e. not writable state. + void CopyFrom(byte[] source, int startIndex, int length, int offset); + } + + /// + /// Represents a buffer for a . + /// + internal class DependentMediaBuffer : IMediaBuffer + { + private readonly IBufferOwner _owner; + private readonly IntPtr _dataHandle; + + internal DependentMediaBuffer(IBufferOwner owner, IntPtr dataHandle, int size) + { + Debug.Assert(owner != null, "Owner is null!"); + Debug.Assert(!owner.IsDisposed, "Owner has been already disposed!"); + Debug.Assert(dataHandle != IntPtr.Zero, "dataHandle is null!"); + Debug.Assert(size >= 0, "size must not be negative!"); + + _owner = owner; + _dataHandle = dataHandle; + Length = size; + } + + public byte this[int index] + { + get + { + _owner.ValidateBufferReadable(this); + + if (index < 0 || index >= Length) + { + throw new ArgumentOutOfRangeException($"Valid index range is [0, { nameof(Length) })."); + } + + return Marshal.ReadByte(_dataHandle, index); + } + set + { + _owner.ValidateBufferWritable(this); + + Marshal.WriteByte(_dataHandle, index, value); + } + } + + /// + /// Validates the range + /// + /// + /// + /// + /// offset + length is greater than .\n + /// -or-\n + /// offset or length is less than zero. + /// + private void ValidateRange(int offset, int length) + { + if (offset + length > Length) + { + throw new ArgumentOutOfRangeException("offset + length can't be greater than length of the buffer."); + } + if (length < 0) + { + throw new ArgumentOutOfRangeException($"Length can't be less than zero : { length }."); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException($"Offset can't be less than zero : { offset }."); + } + } + + public void CopyFrom(byte[] source, int startIndex, int length, int offset) + { + _owner.ValidateBufferReadable(this); + + if (startIndex < 0) + { + throw new ArgumentOutOfRangeException("startIndex can't be less than zero."); + } + if (startIndex + length > source.Length) + { + throw new ArgumentOutOfRangeException("startIndex + length can't be greater than source.Length."); + } + + ValidateRange(offset, length); + + Marshal.Copy(source, startIndex, IntPtr.Add(_dataHandle, offset), length); + } + + public void CopyFrom(byte[] source, int startIndex, int length) + { + CopyFrom(source, startIndex, length, 0); + } + + public void CopyTo(byte[] dest, int startIndex, int length, int offset) + { + _owner.ValidateBufferWritable(this); + + if (startIndex < 0) + { + throw new ArgumentOutOfRangeException("Start index can't be less than zero."); + } + if (startIndex + length > dest.Length) + { + throw new ArgumentOutOfRangeException("startIndex + length can't be greater than dest.Length."); + } + + ValidateRange(offset, length); + + Marshal.Copy(IntPtr.Add(_dataHandle, offset), dest, startIndex, length); + } + + public void CopyTo(byte[] dest, int startIndex, int length) + { + CopyTo(dest, startIndex, length, 0); + } + + public int Length { get; } + } +} diff --git a/src/Tizen.Multimedia/Common/Point.cs b/src/Tizen.Multimedia/Common/Point.cs new file mode 100644 index 0000000..07357b5 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Point.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a point in 2D space. + /// + public struct Point + { + + /// + /// Initializes a new instance of the Point with the specified coordinates. + /// + /// X-axis coordinate of the point in 2D space. + /// Y-axis coordinate of the point in 2D space. + public Point(int x, int y) + { + X = x; + Y = y; + } + + /// + /// Gets or sets X-axis coordinate of the point in 2D space. + /// + public int X + { + get; + set; + } + + /// + /// Gets or sets Y-axis coordinate of the point in 2D space. + /// + public int Y + { + get; + set; + } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => $"X={X.ToString()}, Y={Y.ToString()}"; + + /// + /// Gets the hash code for this instance of . + /// + /// The hash code for this instance of . + public override int GetHashCode() + { + return new { X, Y }.GetHashCode(); + } + + /// + /// Compares an object to an instance of for equality. + /// + /// A to compare. + /// true if the points are equal; otherwise, false. + public override bool Equals(object obj) + { + return obj is Point && this == (Point)obj; + } + + /// + /// Compares two instances of for equality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are equal; otherwise false. + public static bool operator ==(Point point1, Point point2) + { + return point1.X == point2.X && point1.Y == point2.Y; + } + + /// + /// Compares two instances of for inequality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are not equal; otherwise false. + public static bool operator !=(Point point1, Point point2) + { + return !(point1 == point2); + } + } +} diff --git a/src/Tizen.Multimedia/Common/Range.cs b/src/Tizen.Multimedia/Common/Range.cs new file mode 100644 index 0000000..a1fe5e7 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Range.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a range(min, max) value. + /// + public struct Range + { + /// + /// Initializes a new instance of the Range with the specified values. + /// + /// Minimum value of the range. + /// Maximum value of the range. + /// is less than . + public Range(int min, int max) + { + if (min > max) + { + throw new ArgumentException($"min can't be greater than max."); + } + Min = min; + Max = max; + } + + /// + /// Gets or sets minimum value of the range. + /// + public int Min + { + get; + set; + } + + /// + /// Gets or sets maximum value of the range. + /// + public int Max + { + get; + set; + } + + /// + /// Gets length of the range. + /// + public int Length => Max - Min; + + /// + /// Determines if the specified value is inside of the range. + /// + /// A value to check. + /// true if the value is inside of the range; otherwise false. + public bool IsInside(int value) + { + return Min <= value && value <= Max; + } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => $"Min={Min.ToString()}, Max={Max.ToString()}"; + + /// + /// Gets the hash code for this instance of . + /// + /// The hash code for this instance of . + public override int GetHashCode() + { + return new { Min, Max }.GetHashCode(); + } + + /// + /// Compares an object to an instance of for equality. + /// + /// A to compare. + /// true if the two ranges are equal; otherwise, false. + public override bool Equals(object obj) + { + return obj is Range && this == (Range)obj; + } + + /// + /// Compares two instances of for equality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are equal; otherwise false. + public static bool operator ==(Range range1, Range range2) + { + return range1.Min == range2.Min && range1.Max == range2.Max; + } + + /// + /// Compares two instances of for inequality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are not equal; otherwise false. + public static bool operator !=(Range range1, Range range2) + { + return !(range1 == range2); + } + } +} + diff --git a/src/Tizen.Multimedia/Common/Rectangle.cs b/src/Tizen.Multimedia/Common/Rectangle.cs new file mode 100644 index 0000000..8f37ee1 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Rectangle.cs @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// This class represents location of the object bounded by rectangle defined by + /// coordinates of top left corner, width and height. + /// + public struct Rectangle + { + private Point _location; + private Size _size; + + /// + /// Initializes a new instance of the Rectangle with the specified values. + /// + /// The x-coordinate of the upper-left corner of the rectangle. + /// The y-coordinate of the upper-left corner of the rectangle. + /// The Width of the rectangle. + /// The Height of the rectangle. + public Rectangle(int x, int y, int width, int height) : this(new Point(x, y), + new Size(width, height)) + { + } + + /// + /// Initializes a new instance of the Rectangle with the specified values. + /// + /// A that represents the upper-left corner of the rectangular region. + /// A that represents the width and height of the rectangular region. + public Rectangle(Point location, Size size) + { + _location = location; + _size = size; + } + + /// + /// Gets or sets the coordinates of the upper-left corner of the rectangle. + /// + public Point Location + { + get { return _location; } + set { _location = value; } + } + + /// + /// Gets or sets the x-coordinate of the upper-left corner of the rectangle. + /// + public int X + { + get { return _location.X; } + set { _location.X = value; } + } + + /// + /// Gets or sets the y-coordinate of the upper-left corner of the rectangle. + /// + public int Y + { + get { return _location.Y; } + set { _location.Y = value; } + } + + /// + /// Gets or sets the width of the rectangle. + /// + public int Width + { + get { return _size.Width; } + set { _size.Width = value; } + } + + /// + /// Gets or sets the height of the rectangle. + /// + public int Height + { + get { return _size.Height; } + set { _size.Height = value; } + } + + /// + /// Gets the x-coordinate of the left edge of the rectangle. + /// + public int Left => X; + + /// + /// Gets the y-coordinate of the top edge of the rectangle. + /// + public int Top => Y; + + /// + /// Gets the x-coordinate of the right edge of the rectangle. + /// + public int Right => X + Width; + + /// + /// Gets the y-coordinate of the bottom edge of the rectangle. + /// + public int Bottom => Y + Height; + + /// + /// Gets or sets the size of the rectangle. + /// + public Size Size + { + get { return _size; } + set { _size = value; } + } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => $"{_location.ToString()}, {_size.ToString()}"; + + /// + /// Gets the hash code for this instance of . + /// + /// The hash code for this instance of . + public override int GetHashCode() + { + return new { Location, Size }.GetHashCode(); + } + + /// + /// Compares an object to an instance of for equality. + /// + /// A to compare. + /// true if the rectangles are equal; otherwise, false. + public override bool Equals(object obj) + { + return obj is Rectangle && this == (Rectangle)obj; + } + + /// + /// Compares two instances of for equality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are equal; otherwise false. + public static bool operator ==(Rectangle rect1, Rectangle rect2) + { + return rect1.Location == rect2.Location && rect1.Size == rect2.Size; + } + + /// + /// Compares two instances of for inequality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are not equal; otherwise false. + public static bool operator !=(Rectangle rect1, Rectangle rect2) + { + return !(rect1 == rect2); + } + } +} diff --git a/src/Tizen.Multimedia/Common/Rotation.cs b/src/Tizen.Multimedia/Common/Rotation.cs new file mode 100644 index 0000000..78241b3 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Rotation.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the directions of rotation. + /// + public enum Rotation + { + /// + /// No rotation. + /// + Rotate0, + + /// + /// Rotate clockwise by 90 degrees. + /// + Rotate90, + + /// + /// Rotate clockwise by 180 degrees. + /// + Rotate180, + + /// + /// Rotate clockwise by 270 degrees. + /// + Rotate270 + } +} diff --git a/src/Tizen.Multimedia/Common/Size.cs b/src/Tizen.Multimedia/Common/Size.cs new file mode 100644 index 0000000..2ccf856 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Size.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Represents a size in 2D space. + /// + public struct Size + { + /// + /// Initializes a new instance of the Size with the specified values. + /// + /// Width of the size. + /// Height of the size. + public Size(int width, int height) + { + Width = width; + Height = height; + } + + /// + /// Gets or sets the width of the Size. + /// + public int Width + { + get; + set; + } + + /// + /// Gets or sets the height of the Size. + /// + public int Height + { + get; + set; + } + + /// + /// Returns a string that represents the current object. + /// + /// A string that represents the current object. + public override string ToString() => $"Width={ Width.ToString() }, Height={ Height.ToString() }"; + + /// + /// Gets the hash code for this instance of . + /// + /// The hash code for this instance of . + public override int GetHashCode() + { + return new { Width, Height }.GetHashCode(); + } + + /// + /// Compares an object to an instance of for equality. + /// + /// A to compare. + /// true if the two sizes are equal; otherwise, false. + public override bool Equals(object obj) + { + return obj is Size && this == (Size)obj; + } + + /// + /// Compares two instances of for equality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are equal; otherwise false. + public static bool operator ==(Size size1, Size size2) + { + return size1.Width == size2.Width && size1.Height == size2.Height; + } + + /// + /// Compares two instances of for inequality. + /// + /// A to compare. + /// A to compare. + /// true if the two instances of are not equal; otherwise false. + public static bool operator !=(Size size1, Size size2) + { + return !(size1 == size2); + } + } +} diff --git a/src/Tizen.Multimedia/Common/Visibility.cs b/src/Tizen.Multimedia/Common/Visibility.cs new file mode 100644 index 0000000..97e6d07 --- /dev/null +++ b/src/Tizen.Multimedia/Common/Visibility.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies visibilities. + /// + public enum Visibility + { + /// + /// Invisible. + /// + Invisible, + /// + /// Visible. + /// + Visible + } +} diff --git a/src/Tizen.Multimedia/Interop/Interop.Device.cs b/src/Tizen.Multimedia/Interop/Interop.Device.cs new file mode 100644 index 0000000..c8ae644 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Device.cs @@ -0,0 +1,53 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SoundDeviceConnectionChangedCallback(IntPtr device, bool isConnected, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SoundDeviceStateChangedCallback(IntPtr device, AudioDeviceState changedState, IntPtr userData); + + internal static partial class AudioDevice + { + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_list")] + internal static extern int GetCurrentDeviceList(AudioDeviceOptions deviceMask, out IntPtr deviceList); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_free_device_list")] + internal static extern int FreeDeviceList(IntPtr deviceList); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_next_device")] + internal static extern int GetNextDevice(IntPtr deviceList, out IntPtr device); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_type")] + internal static extern int GetDeviceType(IntPtr device, out AudioDeviceType type); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_io_direction")] + internal static extern int GetDeviceIoDirection(IntPtr device, out AudioDeviceIoDirection ioDirection); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_id")] + internal static extern int GetDeviceId(IntPtr device, out int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_name")] + internal static extern int GetDeviceName(IntPtr device, out IntPtr name); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_device_state")] + internal static extern int GetDeviceState(IntPtr device, out AudioDeviceState state); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_connection_changed_cb")] + internal static extern int AddDeviceConnectionChangedCallback(AudioDeviceOptions deviceMask, SoundDeviceConnectionChangedCallback callback, IntPtr userData, out int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_connection_changed_cb")] + internal static extern int RemoveDeviceConnectionChangedCallback(int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_state_changed_cb")] + internal static extern int AddDeviceStateChangedCallback(AudioDeviceOptions deviceMask, SoundDeviceStateChangedCallback callback, IntPtr userData, out int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_state_changed_cb")] + internal static extern int RemoveDeviceStateChangedCallback(int id); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.EvasObject.cs b/src/Tizen.Multimedia/Interop/Interop.EvasObject.cs new file mode 100644 index 0000000..4a06dd0 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.EvasObject.cs @@ -0,0 +1,18 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class EvasObject + { + [DllImport("libevas.so.1")] + internal static extern IntPtr evas_object_image_add(IntPtr parent); + [DllImport("libevas.so.1")] + internal static extern IntPtr evas_object_evas_get(IntPtr obj); + [DllImport("libevas.so.1")] + internal static extern void evas_object_show(IntPtr obj); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Libc.cs b/src/Tizen.Multimedia/Interop/Interop.Libc.cs new file mode 100644 index 0000000..7e9cb41 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Libc.cs @@ -0,0 +1,25 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class Libc + { + internal static class AccessMode + { + internal const int W_OK = 0x02; + internal const int R_OK = 0x04; + } + + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr ptr); + + + + [DllImport(Libraries.Libc, EntryPoint = "access")] + public static extern int Access(string path, int mode); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Libraries.cs b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f0ce791 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Libraries.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static partial class Libraries + { + public const string SoundManager = "libcapi-media-sound-manager.so.0"; + public const string MediaTool = "libcapi-media-tool.so.0"; + public const string Libc = "libc.so.6"; + } + } +} diff --git a/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs b/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs new file mode 100644 index 0000000..e72f8c2 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.MediaTool.cs @@ -0,0 +1,157 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + internal static class MediaPacket + { + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_create")] + internal static extern int Create(IntPtr format, IntPtr finalizeCb, IntPtr cbData, out IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_alloc")] + internal static extern int Alloc(IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_destroy")] + internal static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_format")] + internal static extern int GetFormat(IntPtr handle, out IntPtr format); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_data_ptr")] + internal static extern int GetBufferData(IntPtr handle, out IntPtr dataHandle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_buffer_size")] + internal static extern int GetBufferSize(IntPtr handle, out ulong size); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_buffer_size")] + internal static extern int SetBufferSize(IntPtr handle, ulong size); + + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_allocated_buffer_size")] + internal static extern int GetAllocatedBufferSize(IntPtr handle, out int size); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_number_of_video_planes")] + internal static extern int GetNumberOfVideoPlanes(IntPtr handle, out uint num); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_width")] + internal static extern int GetVideoStrideWidth(IntPtr handle, int planeIndex, out int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_stride_height")] + internal static extern int GetVideoStrideHeight(IntPtr handle, int planeIndex, out int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_video_plane_data_ptr")] + internal static extern int GetVideoPlaneData(IntPtr handle, int planeIndex, out IntPtr dataHandle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_is_encoded")] + internal static extern int IsEncoded(IntPtr handle, out bool value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_flags")] + internal static extern int GetBufferFlags(IntPtr handle, out int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_flags")] + internal static extern int SetBufferFlags(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_reset_flags")] + internal static extern int ResetBufferFlags(IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_pts")] + internal static extern int GetPts(IntPtr handle, out ulong value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_dts")] + internal static extern int GetDts(IntPtr handle, out ulong value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_pts")] + internal static extern int SetPts(IntPtr handle, ulong value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_dts")] + internal static extern int SetDts(IntPtr handle, ulong value); + + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_set_extra")] + internal static extern int SetExtra(IntPtr handle, IntPtr value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_packet_get_extra")] + internal static extern int GetExtra(IntPtr handle, out IntPtr value); + } + + internal static class MediaFormat + { + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_create")] + internal static extern int Create(out IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_unref")] + internal static extern int Unref(IntPtr handle); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_type")] + internal static extern int GetType(IntPtr handle, out int type); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_container_mime")] + internal static extern int GetContainerMimeType(IntPtr handle, out int mimeType); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_container_mime")] + internal static extern int SetContainerMimeType(IntPtr handle, int mimeType); + + #region Video apis + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_info")] + internal static extern int GetVideoInfo(IntPtr handle, out int mimeType, + out int width, out int height, out int averageBps, out int maxBps); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_video_frame_rate")] + internal static extern int GetVideoFrameRate(IntPtr handle, out int frameRate); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_mime")] + internal static extern int SetVideoMimeType(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_width")] + internal static extern int SetVideoWidth(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_height")] + internal static extern int SetVideoHeight(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_avg_bps")] + internal static extern int SetVideoAverageBps(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_video_frame_rate")] + internal static extern int SetVideoFrameRate(IntPtr handle, int value); + #endregion + + #region Audio apis + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_info")] + internal static extern int GetAudioInfo(IntPtr handle, out int mimeType, + out int channel, out int sampleRate, out int bit, out int averageBps); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_audio_aac_header_type")] + internal static extern int GetAudioAacType(IntPtr handle, out int aacType); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_mime")] + internal static extern int SetAudioMimeType(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_channel")] + internal static extern int SetAudioChannel(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_samplerate")] + internal static extern int SetAudioSampleRate(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_bit")] + internal static extern int SetAudioBit(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_avg_bps")] + internal static extern int SetAudioAverageBps(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_audio_aac_header_type")] + internal static extern int SetAudioAacType(IntPtr handle, int value); + #endregion + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_get_text_info")] + internal static extern int GetTextInfo(IntPtr handle, out int mimeType, out int textType); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_mime")] + internal static extern int SetTextMimeType(IntPtr handle, int value); + + [DllImport(Libraries.MediaTool, EntryPoint = "media_format_set_text_type")] + internal static extern int SetTextType(IntPtr handle, int value); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.StreamPolicy.cs b/src/Tizen.Multimedia/Interop/Interop.StreamPolicy.cs new file mode 100644 index 0000000..9a7c59c --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.StreamPolicy.cs @@ -0,0 +1,56 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SoundStreamFocusStateChangedCallback(IntPtr streamInfo, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, int reason, int audioStreamBehavior, string extraInfo, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SoundStreamFocusStateWatchCallback(int id, AudioStreamFocusOptions focusMask, AudioStreamFocusState focusState, AudioStreamFocusChangedReason reason, string extraInfo, IntPtr userData); + + internal static partial class AudioStreamPolicy + { + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_create_stream_information")] + internal static extern int CreateStreamInformation(int streamType, SoundStreamFocusStateChangedCallback callback, IntPtr userData, out IntPtr streamInfo); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_destroy_stream_information")] + internal static extern int DestroyStreamInformation(IntPtr streamInfo); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_device_for_stream_routing")] + internal static extern int AddDeviceForStreamRouting(IntPtr streamInfo, IntPtr device); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_device_for_stream_routing")] + internal static extern int RemoveDeviceForStreamRouting(IntPtr streamInfo, IntPtr device); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_apply_stream_routing")] + internal static extern int ApplyStreamRouting(IntPtr streamInfo); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_acquire_focus")] + internal static extern int AcquireFocus(IntPtr streamInfo, AudioStreamFocusOptions focusMask, int audioStreamBehavior, string extraInfo); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_release_focus")] + internal static extern int ReleaseFocus(IntPtr streamInfo, AudioStreamFocusOptions focusMask, int audioStreamBehavior, string extraInfo); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_state")] + internal static extern int GetFocusState(IntPtr streaInfo, out AudioStreamFocusState stateForPlayback, out AudioStreamFocusState stateForRecording); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_set_focus_reacquisition")] + internal static extern int SetFocusReacquisition(IntPtr streamInfo, bool enable); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_focus_reacquisition")] + internal static extern int GetFocusReacquisition(IntPtr streamInfo, out bool enabled); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_sound_type")] + internal static extern int GetSoundType(IntPtr streamInfo, out AudioVolumeType soundType); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_focus_state_watch_cb")] + internal static extern int AddFocusStateWatchCallback(AudioStreamFocusOptions focusMask, SoundStreamFocusStateWatchCallback callback, IntPtr userData, out int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_focus_state_watch_cb")] + internal static extern int RemoveFocusStateWatchCallback(int id); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/Interop/Interop.Volume.cs b/src/Tizen.Multimedia/Interop/Interop.Volume.cs new file mode 100644 index 0000000..1b3f205 --- /dev/null +++ b/src/Tizen.Multimedia/Interop/Interop.Volume.cs @@ -0,0 +1,32 @@ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + internal static partial class Interop + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SoundManagerVolumeChangedCallback(AudioVolumeType type, uint volume, IntPtr userData); + + internal static partial class AudioVolume + { + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_max_volume")] + internal static extern int GetMaxVolume(AudioVolumeType type, out int max); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_set_volume")] + internal static extern int SetVolume(AudioVolumeType type, int volume); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_volume")] + internal static extern int GetVolume(AudioVolumeType type, out int volume); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_get_current_sound_type")] + internal static extern int GetCurrentSoundType(out AudioVolumeType type); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_add_volume_changed_cb")] + internal static extern int AddVolumeChangedCallback(SoundManagerVolumeChangedCallback callback, IntPtr userData, out int id); + + [DllImportAttribute(Libraries.SoundManager, EntryPoint = "sound_manager_remove_volume_changed_cb")] + internal static extern int RemoveVolumeChangedCallback(int id); + } + } +} \ No newline at end of file diff --git a/src/Tizen.Multimedia/MediaTool/MediaFormat.cs b/src/Tizen.Multimedia/MediaTool/MediaFormat.cs new file mode 100755 index 0000000..5a2092b --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaFormat.cs @@ -0,0 +1,808 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Diagnostics; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// MediaFormat is a base class for media formats. + /// + public abstract class MediaFormat + { + /// + /// Initializes a new instance of the ContainerMediaFormat class with a type. + /// + /// A type for the format. + internal MediaFormat(MediaFormatType type) + { + Type = type; + } + + /// + /// Gets the type of the current format. + /// + public MediaFormatType Type + { + get; + } + + /// + /// Creates a media format from a native handle. + /// + /// A native handle. + /// An object of one of subclasses of . + internal static MediaFormat FromHandle(IntPtr handle) + { + if (handle == IntPtr.Zero) + { + throw new ArgumentException("The handle value is invalid."); + } + + int type = 0; + int ret = Interop.MediaFormat.GetType(handle, out type); + + if (ret != (int)ErrorCode.InvalidOperation) + { + MultimediaDebug.AssertNoError(ret); + + switch ((MediaFormatType)type) + { + case MediaFormatType.Container: + return new ContainerMediaFormat(handle); + + case MediaFormatType.Video: + return new VideoMediaFormat(handle); + + case MediaFormatType.Audio: + return new AudioMediaFormat(handle); + + case MediaFormatType.Text: + return new TextMediaFormat(handle); + } + } + + throw new ArgumentException("looks like handle is corrupted."); + } + + /// + /// Create a native media format from this object. + /// + /// A converted native handle. + /// The returned handle must be destroyed using . + internal IntPtr AsNativeHandle() + { + IntPtr handle; + int ret = Interop.MediaFormat.Create(out handle); + + MultimediaDebug.AssertNoError(ret); + + AsNativeHandle(handle); + + return handle; + } + + internal static void ReleaseNativeHandle(IntPtr handle) + { + Interop.MediaFormat.Unref(handle); + } + + /// + /// Fill out properties of a native media format with the current media format object. + /// + /// A native handle to be written. + internal abstract void AsNativeHandle(IntPtr handle); + } + + /// + /// Represents a container media format. This class cannot be inherited. + /// + public sealed class ContainerMediaFormat : MediaFormat + { + /// + /// Initializes a new instance of the ContainerMediaFormat class. + /// + /// The mime type of the container format. + /// mimeType is invalid(i.e. undefined value). + public ContainerMediaFormat(MediaFormatContainerMimeType mimeType) + : base(MediaFormatType.Container) + { + if (!Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType)) + { + throw new ArgumentException($"Invalid mime type value : { (int)mimeType }"); + } + MimeType = mimeType; + } + + /// + /// Initializes a new instance of the ContainerMediaFormat class from a native handle. + /// + /// A native media format handle. + internal ContainerMediaFormat(IntPtr handle) + : base(MediaFormatType.Container) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int mimeType = 0; + + int ret = Interop.MediaFormat.GetContainerMimeType(handle, out mimeType); + + MultimediaDebug.AssertNoError(ret); + + Debug.Assert(Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType), + "Invalid container mime type!"); + + MimeType = (MediaFormatContainerMimeType)mimeType; + } + + /// + /// Gets the mime type of the current format. + /// + public MediaFormatContainerMimeType MimeType + { + get; + } + + internal override void AsNativeHandle(IntPtr handle) + { + Debug.Assert(Type == MediaFormatType.Container); + + int ret = Interop.MediaFormat.SetContainerMimeType(handle, (int)MimeType); + + MultimediaDebug.AssertNoError(ret); + } + + public override string ToString() + { + return $"MimeType={ MimeType.ToString() }"; + } + + public override bool Equals(object obj) + { + var rhs = obj as ContainerMediaFormat; + if (rhs == null) + { + return false; + } + + return MimeType == rhs.MimeType; + } + + public override int GetHashCode() + { + return (int)MimeType; + } + } + + /// + /// Represents a video media format. This class cannot be inherited. + /// + public sealed class VideoMediaFormat : MediaFormat + { + private const int DefaultFrameRate = 0; + private const int DefaultBitRate = 0; + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, width and height. + /// + /// The mime type of the format. + /// The width value of the format. + /// The height value of the format + /// mimeType is invalid(i.e. undefined value). + /// width, or height is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height) + : this(mimeType, width, height, DefaultFrameRate) + { + } + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type and size. + /// + /// The mime type of the format. + /// The size of the format. + /// mimeType is invalid(i.e. undefined value). + /// width, or height is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size) + : this(mimeType, size, DefaultFrameRate) + { + } + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, + /// width, height and frame rate. + /// + /// The mime type of the format. + /// The width value of the format. + /// The height value of the format + /// The frame rate of the format. + /// mimeType is invalid(i.e. undefined value). + /// width, height or frameRate is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height, + int frameRate) + : this(mimeType, width, height, frameRate, DefaultBitRate) + { + } + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, + /// width, height and frame rate. + /// + /// The mime type of the format. + /// The video size of the format. + /// The frame rate of the format. + /// mimeType is invalid(i.e. undefined value). + /// width, height or frameRate is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size, + int frameRate) + : this(mimeType, size, frameRate, DefaultBitRate) + { + } + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, + /// width, height, frame rate and bit rate. + /// + /// The mime type of the format. + /// The width value of the format. + /// The height value of the format + /// The frame rate of the format. + /// The bit rate of the format. + /// mimeType is invalid(i.e. undefined value). + /// width, height, frameRate or bitRate is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, int width, int height, + int frameRate, int bitRate) + : this(mimeType, new Size(width, height), frameRate, bitRate) + { + } + + /// + /// Initializes a new instance of the VideoMediaFormat class with the specified mime type, + /// size, frame rate and bit rate. + /// + /// The mime type of the format. + /// The size of the format. + /// The frame rate of the format. + /// The bit rate of the format. + /// mimeType is invalid(i.e. undefined value). + /// width, height, frameRate or bitRate is less than zero. + public VideoMediaFormat(MediaFormatVideoMimeType mimeType, Size size, + int frameRate, int bitRate) + : base(MediaFormatType.Video) + { + if (!Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType)) + { + throw new ArgumentException($"Invalid mime type value : { (int)mimeType }"); + } + if (size.Width < 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Width, "Size.Width value can't be less than zero."); + } + if (size.Height < 0) + { + throw new ArgumentOutOfRangeException(nameof(size), size.Height, "Size.Height value can't be less than zero."); + } + if (frameRate < 0) + { + throw new ArgumentOutOfRangeException(nameof(frameRate), frameRate, "Frame rate can't be less than zero."); + } + if (bitRate < 0) + { + throw new ArgumentOutOfRangeException(nameof(bitRate), bitRate, "Bit rate value can't be less than zero."); + } + + MimeType = mimeType; + Size = size; + FrameRate = frameRate; + BitRate = bitRate; + } + + /// + /// Initializes a new instance of the VideoMediaForma class from a native handle. + /// + /// A native handle. + internal VideoMediaFormat(IntPtr handle) + : base(MediaFormatType.Video) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int width = 0; + int height = 0; + int bitRate = 0; + int frameRate = 0; + MediaFormatVideoMimeType mimeType; + GetInfo(handle, out width, out height, out bitRate, out mimeType); + + GetFrameRate(handle, out frameRate); + + MimeType = mimeType; + Size = new Size(width, height); + FrameRate = frameRate; + BitRate = bitRate; + } + + /// + /// Retrieves video properties of media format from a native handle. + /// + /// A native handle that properties are retrieved from. + /// An out parameter for width. + /// An out parameter for height. + /// An out parameter for bit rate. + /// An out parameter for mime type. + private static void GetInfo(IntPtr handle, out int width, out int height, out int bitRate, + out MediaFormatVideoMimeType mimeType) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int mimeTypeValue = 0; + int maxBps = 0; + + int ret = Interop.MediaFormat.GetVideoInfo(handle, + out mimeTypeValue, out width, out height, out bitRate, out maxBps); + + MultimediaDebug.AssertNoError(ret); + + mimeType = (MediaFormatVideoMimeType)mimeTypeValue; + + Debug.Assert(Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType), + "Invalid video mime type!"); + } + + /// + /// Retrieves frame rate from a native handle. + /// + /// A native handle that properties are retrieved from. + /// An out parameter for frame rate. + private static void GetFrameRate(IntPtr handle, out int frameRate) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int ret = Interop.MediaFormat.GetVideoFrameRate(handle, out frameRate); + + MultimediaDebug.AssertNoError(ret); + } + + internal override void AsNativeHandle(IntPtr handle) + { + Debug.Assert(Type == MediaFormatType.Video); + + int ret = Interop.MediaFormat.SetVideoMimeType(handle, (int)MimeType); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetVideoWidth(handle, Size.Width); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetVideoHeight(handle, Size.Height); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetVideoAverageBps(handle, BitRate); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetVideoFrameRate(handle, FrameRate); + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Gets the mime type of the current format. + /// + public MediaFormatVideoMimeType MimeType { get; } + + /// + /// Gets the size of the current format. + /// + public Size Size { get; } + + /// + /// Gets the frame rate value of the current format. + /// + public int FrameRate { get; } + + /// + /// Gets the bit rate value of the current format. + /// + public int BitRate { get; } + + public override string ToString() + { + return $@"MimeType={ MimeType.ToString() }, Size=({ Size.ToString() }), FrameRate= + { FrameRate.ToString() }, BitRate={ BitRate.ToString() }"; + } + + public override bool Equals(object obj) + { + var rhs = obj as VideoMediaFormat; + if (rhs == null) + { + return false; + } + + return MimeType == rhs.MimeType && Size == rhs.Size && + FrameRate == rhs.FrameRate && BitRate == rhs.BitRate; + } + + public override int GetHashCode() + { + return new { MimeType, Size, FrameRate, BitRate }.GetHashCode(); + } + } + + /// + /// Represents an audio media format. This class cannot be inherited. + /// + public sealed class AudioMediaFormat : MediaFormat + { + + /// + /// Initializes a new instance of the AudioMediaFormat class with the specified mime type, + /// channel, sample rate, bit and bit rate. + /// + /// The mime type of the format. + /// The channel value of the format. + /// The sample rate value of the format. + /// The bit value of the format. + /// The bit rate value of the format. + /// is invalid(i.e. undefined value). + /// + /// , , or is less than zero. + /// + public AudioMediaFormat(MediaFormatAudioMimeType mimeType, + int channel, int sampleRate, int bit, int bitRate) + : this(mimeType, channel, sampleRate, bit, bitRate, MediaFormatAacType.None) + { + } + + /// + /// Initializes a new instance of the AudioMediaFormat class with the specified mime type, + /// channel, sample rate, bit, bit rate and aac type. + /// + /// The mime type of the format. + /// The channel value of the format. + /// The sample rate value of the format. + /// The bit value of the format. + /// The bit rate value of the format. + /// The AAC bitstream format(ADIF or ADTS). + /// + /// or is invalid(i.e. undefined value).\n + /// -or-\n + /// is not , but is one of aac types. + /// + /// + /// , , or is less than zero. + /// + public AudioMediaFormat(MediaFormatAudioMimeType mimeType, + int channel, int sampleRate, int bit, int bitRate, MediaFormatAacType aacType) + : base(MediaFormatType.Audio) + { + if (!Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType)) + { + throw new ArgumentException($"Invalid mime type value : { (int)mimeType }"); + } + if (channel < 0) + { + throw new ArgumentOutOfRangeException("Channel value can't be negative."); + } + if (sampleRate < 0) + { + throw new ArgumentOutOfRangeException("Sample rate value can't be negative."); + } + if (bit < 0) + { + throw new ArgumentOutOfRangeException("Bit value can't be negative."); + } + if (bitRate < 0) + { + throw new ArgumentOutOfRangeException("Bit rate value can't be negative."); + } + if (!Enum.IsDefined(typeof(MediaFormatAacType), aacType)) + { + throw new ArgumentException($"Invalid aac type value : { (int)aacType }"); + } + if (!IsAacSupportedMimeType(mimeType) && aacType != MediaFormatAacType.None) + { + throw new ArgumentException("Aac is supported only with aac mime types."); + } + + MimeType = mimeType; + Channel = channel; + SampleRate = sampleRate; + Bit = bit; + BitRate = bitRate; + AacType = aacType; + } + + /// + /// Initializes a new instance of the AudioMediaFormat class from a native handle. + /// + /// A native handle. + internal AudioMediaFormat(IntPtr handle) + : base(MediaFormatType.Audio) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + MediaFormatAudioMimeType mimeType; + int channel = 0; + int sampleRate = 0; + int bit = 0; + int bitRate = 0; + MediaFormatAacType aacType; + GetInfo(handle, out mimeType, out channel, out sampleRate, out bit, out bitRate); + + if (IsAacSupportedMimeType(mimeType)) + { + GetAacType(handle, out aacType); + } + else + { + aacType = MediaFormatAacType.None; + } + + MimeType = mimeType; + Channel = channel; + SampleRate = sampleRate; + Bit = bit; + BitRate = bitRate; + AacType = aacType; + } + + /// + /// Returns an indication whether a specified mime type is a aac type. + /// + /// A mime type. + private static bool IsAacSupportedMimeType(MediaFormatAudioMimeType mimeType) + { + return mimeType == MediaFormatAudioMimeType.AacLC || + mimeType == MediaFormatAudioMimeType.AacHE || + mimeType == MediaFormatAudioMimeType.AacHEPS; + } + + /// + /// Retrieves audio properties of media format from a native handle. + /// + /// A native handle that properties are retrieved from. + /// An out parameter for mime type. + /// An out parameter for channel. + /// An out parameter for sample rate. + /// An out parameter for bit. + /// An out parameter for bit rate. + private static void GetInfo(IntPtr handle, out MediaFormatAudioMimeType mimeType, + out int channel, out int sampleRate, out int bit, out int bitRate) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int mimeTypeValue = 0; + + int ret = Interop.MediaFormat.GetAudioInfo(handle, + out mimeTypeValue, out channel, out sampleRate, out bit, out bitRate); + + mimeType = (MediaFormatAudioMimeType)mimeTypeValue; + + MultimediaDebug.AssertNoError(ret); + + Debug.Assert(Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType), + "Invalid audio mime type!"); + } + + /// + /// Retrieves aac type value from a native handle. + /// + /// A native handle that properties are retrieved from. + /// An out parameter for aac type. + private static void GetAacType(IntPtr handle, out MediaFormatAacType aacType) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + int aacTypeValue = 0; + + int ret = Interop.MediaFormat.GetAudioAacType(handle, out aacTypeValue); + + MultimediaDebug.AssertNoError(ret); + + aacType = (MediaFormatAacType)aacTypeValue; + + Debug.Assert(Enum.IsDefined(typeof(MediaFormatAacType), aacType), "Invalid aac type!"); + } + + internal override void AsNativeHandle(IntPtr handle) + { + Debug.Assert(Type == MediaFormatType.Audio); + + int ret = Interop.MediaFormat.SetAudioMimeType(handle, (int)MimeType); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetAudioChannel(handle, Channel); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetAudioSampleRate(handle, SampleRate); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetAudioBit(handle, Bit); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetAudioAverageBps(handle, BitRate); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetAudioAacType(handle, (int)AacType); + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Gets the mime type of the current format. + /// + public MediaFormatAudioMimeType MimeType { get; } + + /// + /// Gets the channel value of the current format. + /// + public int Channel { get; } + + /// + /// Gets the sample rate value of the current format. + /// + public int SampleRate { get; } + + /// + /// Gets the bit value of the current format. + /// + public int Bit { get; } + + /// + /// Gets the bit rate value of the current format. + /// + public int BitRate { get; } + + /// + /// Gets the aac type of the current format. + /// + public MediaFormatAacType AacType { get; } + + public override string ToString() + { + return $@"MimeTyp={ MimeType.ToString() }, Channel={ Channel.ToString() }, SampleRate= + { SampleRate }, Bit={ Bit.ToString() }, BitRate={ BitRate.ToString() }, AacType={ AacType.ToString() }"; + } + + public override bool Equals(object obj) + { + var rhs = obj as AudioMediaFormat; + if (rhs == null) + { + return false; + } + + return MimeType == rhs.MimeType && Channel == rhs.Channel && SampleRate == rhs.SampleRate && + Bit == rhs.Bit && BitRate == rhs.BitRate; + } + + public override int GetHashCode() + { + return new { MimeType, Channel, SampleRate, Bit, BitRate }.GetHashCode(); + } + } + + /// + /// Represents a text media format. This class cannot be inherited. + /// + public sealed class TextMediaFormat : MediaFormat + { + /// + /// Initializes a new instance of the TextMediaFormat class with the specified mime type + /// and text type. + /// + /// The mime type of the format. + /// The text type of the format. + /// + /// mimeType or textType is invalid(i.e. undefined value). + public TextMediaFormat(MediaFormatTextMimeType mimeType, MediaFormatTextType textType) + : base(MediaFormatType.Text) + { + if (!Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType)) + { + throw new ArgumentException($"Invalid mime type value : { (int)mimeType }"); + } + if (!Enum.IsDefined(typeof(MediaFormatTextType), textType)) + { + throw new ArgumentException($"Invalid text type value : { (int)textType }"); + } + MimeType = mimeType; + TextType = textType; + } + + /// + /// Initializes a new instance of the TextMediaFormat class from a native handle. + /// + /// A native handle. + internal TextMediaFormat(IntPtr handle) + : base(MediaFormatType.Text) + { + Debug.Assert(handle != IntPtr.Zero, "The handle is invalid!"); + + MediaFormatTextMimeType mimeType; + MediaFormatTextType textType; + + GetInfo(handle, out mimeType, out textType); + + MimeType = mimeType; + TextType = textType; + } + + /// + /// Retrieves text properties of media format from a native handle. + /// + /// A native handle that properties are retrieved from. + /// An out parameter for mime type. + /// An out parameter for text type. + private static void GetInfo(IntPtr handle, out MediaFormatTextMimeType mimeType, + out MediaFormatTextType textType) + { + int mimeTypeValue = 0; + int textTypeValue = 0; + + int ret = Interop.MediaFormat.GetTextInfo(handle, out mimeTypeValue, out textTypeValue); + + MultimediaDebug.AssertNoError(ret); + + mimeType = (MediaFormatTextMimeType)mimeTypeValue; + textType = (MediaFormatTextType)textTypeValue; + + Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType), + "Invalid text mime type!"); + Debug.Assert(Enum.IsDefined(typeof(MediaFormatTextType), textType), + "Invalid text type!"); + } + + internal override void AsNativeHandle(IntPtr handle) + { + Debug.Assert(Type == MediaFormatType.Text); + + int ret = Interop.MediaFormat.SetTextMimeType(handle, (int)MimeType); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaFormat.SetTextType(handle, (int)TextType); + MultimediaDebug.AssertNoError(ret); + } + + /// + /// Gets the mime type of the current format. + /// + public MediaFormatTextMimeType MimeType { get; } + + /// + /// Gets the text type of the current format. + /// + public MediaFormatTextType TextType { get; } + + public override string ToString() + { + return $"MimeType={ MimeType.ToString() }, TextType={ TextType.ToString() }"; + } + + public override bool Equals(object obj) + { + var rhs = obj as TextMediaFormat; + if (rhs == null) + { + return false; + } + + return MimeType == rhs.MimeType && TextType == rhs.TextType; + } + + public override int GetHashCode() + { + return new { MimeType, TextType }.GetHashCode(); + } + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaFormatAacType.cs b/src/Tizen.Multimedia/MediaTool/MediaFormatAacType.cs new file mode 100644 index 0000000..6839c9f --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaFormatAacType.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies aac types for . + /// + public enum MediaFormatAacType + { + /// + /// Raw, no header + /// + None, + /// + /// ADTS header + /// + Adts, + /// + /// ADIF header + /// + Adif + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaFormatMimeType.cs b/src/Tizen.Multimedia/MediaTool/MediaFormatMimeType.cs new file mode 100755 index 0000000..9e23406 --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaFormatMimeType.cs @@ -0,0 +1,363 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies the media format types. + /// + /// + public enum MediaFormatType + { + /// + /// Audio media format. + /// + Audio = 0x01000000, + + /// + /// Video media format. + /// + Video = 0x02000000, + + /// + /// Container media format. + /// + Container = 0x04000000, + + /// + /// Text media format. + /// + Text = 0x03000000, + } + + /// + /// Enumeration for media format data type + /// + internal enum MediaFormatDataType + { + /// + /// Encoded type + /// + Encoded = 0x10000000, + + /// + /// Raw type + /// + Raw = 0x20000000, + } + + /// + /// Specifies the mime types for audio media formats. + /// + public enum MediaFormatAudioMimeType + { + /// + /// AMR, Alias for . + /// + Amr = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1040), + + /// + /// AMR-NB. + /// + AmrNB = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1040), + + /// + /// AMR-WB. + /// + AmrWB = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1041), + + /// + /// AAC, Alias for . + /// + Aac = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1060), + + /// + /// AAC-LC (Advanced Audio Coding Low-Complexity profile). + /// + AacLC = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1060), + + /// + /// HE-AAC (High-Efficiency Advanced Audio Coding). + /// + AacHE = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1061), + + /// + /// HE-AAC-PS (High-Efficiency Advanced Audio Coding with Parametric Stereo). + /// + AacHEPS = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1062), + + /// + /// MP3. + /// + MP3 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1070), + + /// + /// VORBIS. + /// + Vorbis = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1080), + + /// + /// FLAC. + /// + Flac = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x1090), + + /// + /// Windows Media Audio 1. + /// + Wma1 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A0), + + /// + /// Windows Media Audio 2. + /// + Wma2 = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A1), + + /// + /// Windows Media Audio Professional. + /// + WmaPro = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A2), + + /// + /// Windows Media Audio Lossless. + /// + WmaLossless = (MediaFormatType.Audio | MediaFormatDataType.Encoded | 0x10A3), + + /// + /// PCM. + /// + Pcm = (MediaFormatType.Audio | MediaFormatDataType.Raw | 0x1510), + } + + /// + /// Specifies the mime types for video media formats. + /// + public enum MediaFormatVideoMimeType + { + /// + /// H261. + /// + H261 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2010), + + /// + /// H263. + /// + H263 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2020), + + /// + /// H263P. + /// + H263P = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2021), + + /// + /// H264_SP + /// + H264SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2030), + + /// + /// H264_MP. + /// + H264MP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2031), + + /// + /// H264_HP. + /// + H264HP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2032), + + /// + /// MJPEG + /// + MJpeg = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2040), + + /// + /// MPEG1. + /// + Mpeg1 = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2050), + + /// + /// MPEG2_SP. + /// + Mpeg2SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2060), + + /// + /// MPEG2_MP. + /// + Mpeg2MP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2061), + + /// + /// MPEG2_HP. + /// + Mpeg2HP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2062), + + /// + /// MPEG4_SP. + /// + Mpeg4SP = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2070), + + /// + /// MPEG4_ASP. + /// + Mpeg4Asp = (MediaFormatType.Video | MediaFormatDataType.Encoded | 0x2071), + + /// + /// I420 + /// + I420 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2510), + + /// + /// NV12. + /// + NV12 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2520), + + /// + /// NV12T. + /// + NV12T = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2530), + + /// + /// YV12. + /// + YV12 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2540), + + /// + /// NV21. + /// + NV21 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2550), + + /// + /// NV16. + /// + NV16 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2560), + + /// + /// YUYV. + /// + Yuyv = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2570), + + /// + /// UYVY. + /// + Uyvy = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2580), + + /// + /// 422P. + /// + Yuv422P = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x2590), + + /// + /// RGB565. + /// + Rgb565 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25a0), + + /// + /// RGB888. + /// + Rgb888 = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25b0), + + /// + /// RGBA. + /// + Rgba = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25c0), + + /// + /// ARGB. + /// + Argb = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25d0), + + /// + /// BGRA. + /// + Bgra = (MediaFormatType.Video | MediaFormatDataType.Raw | 0x25e0), + + } + + /// + /// Specifies the mime types for container media formats. + /// + public enum MediaFormatContainerMimeType + { + /// + /// MP4 container, Video. + /// + MP4 = (MediaFormatType.Container | 0x3010), + + /// + /// AVI container, Video. + /// + Avi = (MediaFormatType.Container | 0x3020), + + /// + /// MPEG2TS container, Video. + /// + Mpeg2TS = (MediaFormatType.Container | 0x3030), + + /// + /// MPEG2PS container, Video. + /// + Mpeg2PS = (MediaFormatType.Container | 0x3040), + + /// + /// MATROSKA container, Video. + /// + Matroska = (MediaFormatType.Container | 0x3050), + + /// + /// WEBM container, Video. + /// + Webm = (MediaFormatType.Container | 0x3060), + + /// + /// 3GP container, Video. + /// + ThreeGP = (MediaFormatType.Container | 0x3070), + + /// + /// WAV container, Audio. + /// + Wav = (MediaFormatType.Container | 0x4010), + + /// + /// OGG container, Audio + /// + Ogg = (MediaFormatType.Container | 0x4020), + + /// + /// AAC_ADTS container, Audio + /// + AacAdts = (MediaFormatType.Container | 0x4030), + + /// + /// AAC_ADIF container, Audio + /// + AacAdif = (MediaFormatType.Container | 0x4031), + } + + /// + /// Enumeration for text mime type + /// + public enum MediaFormatTextMimeType + { + /// + /// MP4. + /// + MP4 = (MediaFormatType.Text | MediaFormatDataType.Encoded | 0x8010), + + /// + /// 3GP. + /// + ThreeGP = (MediaFormatType.Text | MediaFormatDataType.Encoded | 0x8020), + } + +} + diff --git a/src/Tizen.Multimedia/MediaTool/MediaFormatTextType.cs b/src/Tizen.Multimedia/MediaTool/MediaFormatTextType.cs new file mode 100755 index 0000000..38d3a5a --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaFormatTextType.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Multimedia +{ + /// + /// Specifies text types. + /// + public enum MediaFormatTextType + { + /// + /// This indicates no type specified. + /// + None, + + /// + /// The mp4 type. + /// + MP4, + + /// + /// The 3gpp type. + /// + ThreeGpp + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacket.cs b/src/Tizen.Multimedia/MediaTool/MediaPacket.cs new file mode 100644 index 0000000..4755d96 --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaPacket.cs @@ -0,0 +1,750 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading; +using Tizen.Internals.Errors; + +namespace Tizen.Multimedia +{ + /// + /// Represents a packet for multimedia. + /// + public abstract class MediaPacket : IDisposable + { + private IntPtr _handle = IntPtr.Zero; + + /// + /// Initializes a new instance of the MediaPacket class with the specified media format. + /// + /// The media format containing properties for the packet. + /// format is null. + /// + /// of the specified format is . + /// Operation failed. + internal MediaPacket(MediaFormat format) + { + if (format == null) + { + throw new ArgumentNullException(nameof(format)); + } + + if (format.Type == MediaFormatType.Container) + { + throw new ArgumentException("Container format can't be used to create a new packet."); + } + + Initialize(format); + _format = format; + } + + /// + /// Initializes a new instance of the MediaPacket class from a native handle. + /// + /// The native handle to be used. + internal MediaPacket(IntPtr handle) + { + _handle = handle; + + IntPtr formatHandle; + int ret = Interop.MediaPacket.GetFormat(handle, out formatHandle); + + MultimediaDebug.AssertNoError(ret); + + try + { + if (formatHandle != IntPtr.Zero) + { + _format = MediaFormat.FromHandle(formatHandle); + } + } + finally + { + Interop.MediaFormat.Unref(formatHandle); + } + } + + ~MediaPacket() + { + Dispose(false); + } + + /// + /// Creates and initializes a native handle for the current object. + /// + /// The format to be set to the media format. + /// Operation failed. + private void Initialize(MediaFormat format) + { + if (format.Type == MediaFormatType.Container) + { + throw new ArgumentException("Creating a packet for container is not supported."); + } + + IntPtr formatHandle = IntPtr.Zero; + + try + { + formatHandle = format.AsNativeHandle(); + + int ret = Interop.MediaPacket.Create(formatHandle, IntPtr.Zero, IntPtr.Zero, out _handle); + MultimediaDebug.AssertNoError(ret); + + Debug.Assert(_handle != IntPtr.Zero, "Created handle must not be null"); + + Alloc(); + } + catch (Exception) + { + if (_handle != IntPtr.Zero) + { + Interop.MediaPacket.Destroy(_handle); + _handle = IntPtr.Zero; + } + + throw; + } + finally + { + if (formatHandle != IntPtr.Zero) + { + Interop.MediaFormat.Unref(formatHandle); + } + } + } + + /// + /// Allocates internal buffer. + /// + /// Operation failed. + private void Alloc() + { + ErrorCode ret = (ErrorCode)Interop.MediaPacket.Alloc(_handle); + if (ret == ErrorCode.None) + { + return; + } + + switch (ret) + { + case ErrorCode.OutOfMemory: + throw new OutOfMemoryException("Failed to allocate buffer for the packet."); + + default: + throw new InvalidOperationException("Failed to create a packet."); + } + + } + + private readonly MediaFormat _format; + + /// + /// Gets the media format of the current packet. + /// + public MediaFormat Format + { + get + { + ValidateNotDisposed(); + return _format; + } + } + + /// + /// Gets or sets the PTS(Presentation Time Stamp) value of the current packet. + /// + /// The MediaPacket has already been disposed. + /// + /// The MediaPacket is not writable state which means it being used by another module. + public ulong Pts + { + get + { + ValidateNotDisposed(); + + ulong value = 0; + int ret = Interop.MediaPacket.GetPts(_handle, out value); + + MultimediaDebug.AssertNoError(ret); + + return value; + } + set + { + ValidateNotDisposed(); + ValidateNotLocked(); + + int ret = Interop.MediaPacket.SetPts(_handle, value); + + MultimediaDebug.AssertNoError(ret); + } + } + + /// + /// Gets or sets the DTS(Decoding Time Stamp) value of the current packet. + /// + /// The MediaPacket has already been disposed. + /// + /// The MediaPacket is not in writable state which means it being used by another module. + public ulong Dts + { + get + { + ValidateNotDisposed(); + + ulong value = 0; + int ret = Interop.MediaPacket.GetDts(_handle, out value); + + MultimediaDebug.AssertNoError(ret); + + return value; + } + set + { + ValidateNotDisposed(); + ValidateNotLocked(); + + int ret = Interop.MediaPacket.SetDts(_handle, value); + + MultimediaDebug.AssertNoError(ret); + } + } + + /// + /// Gets a value indicating whether the packet is encoded type. + /// + /// true if the packet is encoded type; otherwise, false. + /// The MediaPacket has already been disposed. + public bool IsEncoded + { + get + { + ValidateNotDisposed(); + + bool value = false; + int ret = Interop.MediaPacket.IsEncoded(_handle, out value); + + MultimediaDebug.AssertNoError(ret); + + return value; + } + } + + private MediaPacketBuffer _buffer; + + /// + /// Gets the buffer of the packet. + /// + /// The allocated to the packet. + /// This property will return null if the packet is raw video format. + /// The MediaPacket has already been disposed. + /// + /// + public MediaPacketBuffer Buffer + { + get + { + ValidateNotDisposed(); + + if (IsVideoPlaneSupported) + { + return null; + } + + if (_buffer == null) + { + _buffer = GetBuffer(); + } + + return _buffer; + } + } + + /// + /// Gets or sets a length of data written in the . + /// + /// The MediaPacket has already been disposed. + /// + /// The value specified for this property is less than zero or greater than . + /// + /// The MediaPacket has instead of .\n + /// -or-\n + /// The MediaPacket is not in writable state which means it being used by another module. + /// + public int BufferWrittenLength + { + get + { + ValidateNotDisposed(); + + ulong value = 0; + int ret = Interop.MediaPacket.GetBufferSize(_handle, out value); + MultimediaDebug.AssertNoError(ret); + + Debug.Assert(value < int.MaxValue); + + return (int)value; + } + set + { + ValidateNotDisposed(); + ValidateNotLocked(); + + if (IsVideoPlaneSupported) + { + throw new InvalidOperationException( + "This packet uses VideoPlanes instead of Buffer."); + } + + Debug.Assert(Buffer != null); + + if (value < 0 || value >= Buffer.Length) + { + throw new ArgumentOutOfRangeException("value must be less than Buffer.Size."); + } + + int ret = Interop.MediaPacket.SetBufferSize(_handle, (ulong)value); + MultimediaDebug.AssertNoError(ret); + } + } + + private MediaPacketVideoPlane[] _videoPlanes; + + /// + /// Gets the video planes of the packet. + /// + /// The s allocated to the packet. + /// This property will return null if the packet is not raw video format. + /// The MediaPacket has already been disposed. + /// + /// + public MediaPacketVideoPlane[] VideoPlanes + { + get + { + ValidateNotDisposed(); + + if (!IsVideoPlaneSupported) + { + return null; + } + + if (_videoPlanes == null) + { + _videoPlanes = GetVideoPlanes(); + } + + return _videoPlanes; + } + } + + /// + /// Gets or sets the buffer flags of the packet. + /// + /// The MediaPacket has already been disposed. + /// + /// The MediaPacket is not in writable state which means it being used by another module. + /// + public MediaPacketBufferFlags BufferFlags + { + get + { + ValidateNotDisposed(); + + int value = 0; + + int ret = Interop.MediaPacket.GetBufferFlags(_handle, out value); + + MultimediaDebug.AssertNoError(ret); + + return (MediaPacketBufferFlags)value; + } + + set + { + ValidateNotDisposed(); + ValidateNotLocked(); + + int ret = Interop.MediaPacket.ResetBufferFlags(_handle); + + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaPacket.SetBufferFlags(_handle, (int)value); + + MultimediaDebug.AssertNoError(ret); + } + } + + /// + /// Gets a value indicating whether the packet has been disposed of. + /// + /// true if the packet has been disposed of; otherwise, false. + public bool IsDisposed + { + get + { + return _isDisposed; + } + } + + private bool _isDisposed = false; + + + /// + /// Releases all resources used by the object. + /// + /// + /// The MediaPacket can not be disposed which means it being used by another module. + /// + public void Dispose() + { + if (_isDisposed) + { + return; + } + ValidateNotLocked(); + + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases the resources used by the object. + /// + /// + /// true to release both managed and unmanaged resources; false to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (_isDisposed) + { + return; + } + + if (_handle != IntPtr.Zero) + { + Interop.MediaPacket.Destroy(_handle); + _handle = IntPtr.Zero; + } + + _isDisposed = true; + } + + internal IntPtr GetHandle() + { + ValidateNotDisposed(); + + Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!"); + + return _handle; + } + + /// + /// Validate the current object has not been disposed of. + /// + /// The MediaPacket has already been disposed of. + private void ValidateNotDisposed() + { + if (_isDisposed) + { + throw new ObjectDisposedException("This packet has already been disposed of."); + } + } + + /// + /// Validate the current object is not locked. + /// + /// The MediaPacket has already been disposed of. + /// The MediaPacket is in use by another module. + private void ValidateNotLocked() + { + ValidateNotDisposed(); + + if (_lock.IsLocked) + { + throw new InvalidOperationException("Can't perform any writing operation." + + "The packet is in use, internally."); + } + } + /// + /// Ensures whether the packet is writable. + /// + /// The MediaPacket already has been disposed of. + /// The MediaPacket is being used by another module. + internal void EnsureWritableState() + { + ValidateNotDisposed(); + ValidateNotLocked(); + } + + /// + /// Ensures whether the packet is readable. + /// + /// The MediaPacket already has been disposed of. + internal void EnsureReadableState() + { + ValidateNotDisposed(); + } + + /// + /// Gets a value indicating whether the packet is raw video format. + /// + /// true if the packet is raw video format; otherwise, false. + private bool IsVideoPlaneSupported + { + get + { + return !IsEncoded && Format.Type == MediaFormatType.Video; + } + } + + /// + /// Retrieves video planes of the current packet. + /// + /// The s allocated to the current MediaPacket. + private MediaPacketVideoPlane[] GetVideoPlanes() + { + Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!"); + + uint numberOfPlanes = 0; + int ret = Interop.MediaPacket.GetNumberOfVideoPlanes(_handle, out numberOfPlanes); + + MultimediaDebug.AssertNoError(ret); + + MediaPacketVideoPlane[] planes = new MediaPacketVideoPlane[numberOfPlanes]; + + for (int i = 0; i < numberOfPlanes; ++i) + { + planes[i] = new MediaPacketVideoPlane(this, i); + } + + return planes; + } + + /// + /// Retrieves the buffer of the current packet. + /// + /// The allocated to the current MediaPacket. + private MediaPacketBuffer GetBuffer() + { + Debug.Assert(_handle != IntPtr.Zero, "The handle is invalid!"); + + IntPtr dataHandle; + + int ret = Interop.MediaPacket.GetBufferData(_handle, out dataHandle); + MultimediaDebug.AssertNoError(ret); + + Debug.Assert(dataHandle != IntPtr.Zero, "Data handle is invalid!"); + + int size = 0; + ret = Interop.MediaPacket.GetAllocatedBufferSize(_handle, out size); + MultimediaDebug.AssertNoError(ret); + + return new MediaPacketBuffer(this, dataHandle, size); + } + + #region Lock operations + private readonly LockState _lock = new LockState(); + + /// + /// Provides a thread-safe lock state controller. + /// + private sealed class LockState + { + const int LOCKED = 1; + const int UNLOCKED = 0; + + private int _locked = UNLOCKED; + + internal void SetLock() + { + if (Interlocked.CompareExchange(ref _locked, LOCKED, UNLOCKED) == LOCKED) + { + throw new InvalidOperationException("The packet is already locked."); + } + } + + internal void SetUnlock() + { + if (Interlocked.CompareExchange(ref _locked, UNLOCKED, LOCKED) == UNLOCKED) + { + Debug.Fail("The packet to unlock is not locked. " + + "There must be an error somewhere that a lock isn't disposed correctly."); + } + } + + internal bool IsLocked + { + get + { + return Interlocked.CompareExchange(ref _locked, 0, 0) == LOCKED; + } + } + } + + /// + /// Provides a thread-safe lock controller. + /// + /// + /// using (var lock = BaseMediaPacket.Lock(mediaPacket)) + /// { + /// .... + /// } + /// + internal sealed class Lock : IDisposable + { + private readonly MediaPacket _packet; + private readonly GCHandle _gcHandle; + private int _lockCount; + + internal static Lock Get(MediaPacket packet) + { + Debug.Assert(packet != null); + + lock (packet) + { + Lock lck = FromHandle(packet._handle); + + if (lck == null) + { + lck = new Lock(packet); + } + + lck._lockCount++; + + return lck; + } + } + + private Lock(MediaPacket packet) + { + Debug.Assert(packet != null, "The packet is null!"); + + packet.ValidateNotDisposed(); + + _packet = packet; + + _packet._lock.SetLock(); + + _gcHandle = GCHandle.Alloc(this); + + SetExtra(GCHandle.ToIntPtr(_gcHandle)); + } + + internal static Lock FromHandle(IntPtr handle) + { + Debug.Assert(handle != IntPtr.Zero); + + IntPtr extra = GetExtra(handle); + + if (extra == IntPtr.Zero) + { + return null; + } + + return (Lock)GCHandle.FromIntPtr(extra).Target; + } + + private void SetExtra(IntPtr ptr) + { + int ret = Interop.MediaPacket.SetExtra(_packet._handle, ptr); + + MultimediaDebug.AssertNoError(ret); + } + + private static IntPtr GetExtra(IntPtr handle) + { + IntPtr value; + + int ret = Interop.MediaPacket.GetExtra(handle, out value); + + MultimediaDebug.AssertNoError(ret); + + return value; + } + + internal IntPtr GetHandle() + { + return _packet.GetHandle(); + } + + internal MediaPacket MediaPacket + { + get + { + return _packet; + } + } + + private bool _isDisposed = false; + + public void Dispose() + { + if (!_isDisposed) + { + lock (_packet) + { + _lockCount--; + + if (_lockCount == 0) + { + SetExtra(IntPtr.Zero); + + if (_gcHandle.IsAllocated) + { + _gcHandle.Free(); + } + + //We can assure that at this point '_packet' is always locked by this lock. + _packet._lock.SetUnlock(); + } + } + + _isDisposed = true; + } + } + } + #endregion + + /// + /// Creates an object of the MediaPacket with the specified . + /// + /// The media format for the new packet. + /// A new MediaPacket object. + public static MediaPacket Create(MediaFormat format) + { + return new SimpleMediaPacket(format); + } + + internal static MediaPacket From(IntPtr handle) + { + return new SimpleMediaPacket(handle); + } + } + + internal class SimpleMediaPacket : MediaPacket + { + internal SimpleMediaPacket(MediaFormat format) : base(format) + { + } + + internal SimpleMediaPacket(IntPtr handle) : base(handle) + { + } + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacketBuffer.cs b/src/Tizen.Multimedia/MediaTool/MediaPacketBuffer.cs new file mode 100644 index 0000000..49b9caf --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaPacketBuffer.cs @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace Tizen.Multimedia +{ + /// + /// Represents a buffer for a . + /// + public class MediaPacketBuffer + { + private readonly MediaPacket _packet; + private readonly IntPtr _dataHandle; + + internal MediaPacketBuffer(MediaPacket packet, IntPtr dataHandle, int size) + { + Debug.Assert(packet != null, "Packet is null!"); + Debug.Assert(!packet.IsDisposed, "Packet is already disposed!"); + Debug.Assert(dataHandle != IntPtr.Zero, "dataHandle is null!"); + Debug.Assert(size >= 0, "size must not be negative!"); + + _packet = packet; + _dataHandle = dataHandle; + _length = size; + } + + /// + /// Gets or sets a value at the specified index. + /// + /// The index of the value to get or set. + /// + /// index is less than zero.\n + /// -or-\n + /// index is equal to or greater than . + /// + /// The MediaPacket that owns the current buffer already has been disposed of. + /// The MediaPacket that owns the current buffer is being used by another module. + public byte this[int index] + { + get + { + _packet.EnsureReadableState(); + + if (index < 0 || index >= Length) + { + throw new ArgumentOutOfRangeException($"Valid index range is [0, { nameof(Length) })."); + } + + return Marshal.ReadByte(_dataHandle, index); + } + set + { + _packet.EnsureWritableState(); + + Marshal.WriteByte(_dataHandle, index, value); + } + } + + /// + /// Validates the range + /// + /// + /// + /// + /// offset + length is greater than .\n + /// -or-\n + /// offset or length is less than zero. + /// + private void ValidateRange(int offset, int length) + { + if (offset + length > _length) + { + throw new ArgumentOutOfRangeException("offset + length can't be greater than length of the buffer."); + } + if (length < 0) + { + throw new ArgumentOutOfRangeException($"Length can't be less than zero : { length }."); + } + if (offset < 0) + { + throw new ArgumentOutOfRangeException($"Offset can't be less than zero : { offset }."); + } + } + + /// + /// Copies data from a byte array to the buffer. + /// + /// The array to copy from. + /// The zero-based index in the source array where copying should start. + /// The number of array elements to copy. + /// The zero-based index in the buffer where copying should start. + /// startIndex, offset or length is not valid. + /// The MediaPacket that owns the current buffer already has been disposed of. + public void CopyFrom(byte[] source, int startIndex, int length, int offset = 0) + { + _packet.EnsureReadableState(); + + if (startIndex < 0) + { + throw new ArgumentOutOfRangeException("startIndex can't be less than zero."); + } + if (startIndex + length > source.Length) + { + throw new ArgumentOutOfRangeException("startIndex + length can't be greater than source.Length."); + } + + ValidateRange(offset, length); + + Marshal.Copy(source, startIndex, IntPtr.Add(_dataHandle, offset), length); + } + + /// + /// Copies data from the buffer to a byte array. + /// + /// The array to copy to. + /// The zero-based index in the dest array where copying should start. + /// The number of elements to copy. + /// The zero-based index in the buffer where copying should start. + /// startIndex, offset or length is not valid. + /// The MediaPacket that owns the current buffer already has been disposed of. + /// The MediaPacket that owns the current buffer is being used by another module. + public void CopyTo(byte[] dest, int startIndex, int length, int offset = 0) + { + _packet.EnsureWritableState(); + + if (startIndex < 0) + { + throw new ArgumentOutOfRangeException("Start index can't be less than zero."); + } + if (startIndex + length > dest.Length) + { + throw new ArgumentOutOfRangeException("startIndex + length can't be greater than dest.Length."); + } + + ValidateRange(offset, length); + + Marshal.Copy(IntPtr.Add(_dataHandle, offset), dest, startIndex, length); + } + + private readonly int _length; + + /// + /// Gets the size of the buffer, in bytes. + /// + /// The MediaPacket that owns the current buffer already has been disposed of. + public int Length + { + get + { + _packet.EnsureReadableState(); + + return _length; + } + } + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacketBufferFlags.cs b/src/Tizen.Multimedia/MediaTool/MediaPacketBufferFlags.cs new file mode 100644 index 0000000..7c1bf05 --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaPacketBufferFlags.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Multimedia +{ + /// + /// Specifies the flag for a buffer. + /// + /// This enumeration has a attribute that allows a bitwise combination of its member values. + /// + /// + [Flags] + public enum MediaPacketBufferFlags + { + /// + /// The buffer contains codec initialization or codec specific data instead of media data. + /// + CodecConfig = 0x1, + + /// + /// The buffer indicates the end of stream. + /// + EndOfStream = 0x2, + + /// + /// The buffer contains a sync frame. + /// + SyncFrame = 0x4, + } +} diff --git a/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs b/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs new file mode 100644 index 0000000..3291221 --- /dev/null +++ b/src/Tizen.Multimedia/MediaTool/MediaPacketVideoPlane.cs @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Diagnostics; + +namespace Tizen.Multimedia +{ + /// + /// Represents a video plane for . + /// This class is used if and only if the format of the packet is raw video. + /// + public class MediaPacketVideoPlane + { + private readonly MediaPacket _packet; + private readonly int _strideWidth; + private readonly int _strideHeight; + private readonly MediaPacketBuffer _buffer; + + internal MediaPacketVideoPlane(MediaPacket packet, int index) + { + Debug.Assert(packet != null, "The packet is null!"); + Debug.Assert(!packet.IsDisposed, "Packet is already disposed!"); + Debug.Assert(index >= 0, "Video plane index must not be negative!"); + + _packet = packet; + + int ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideWidth); + MultimediaDebug.AssertNoError(ret); + + ret = Interop.MediaPacket.GetVideoStrideWidth(packet.GetHandle(), index, out _strideHeight); + MultimediaDebug.AssertNoError(ret); + + IntPtr dataHandle; + ret = Interop.MediaPacket.GetVideoPlaneData(packet.GetHandle(), index, out dataHandle); + MultimediaDebug.AssertNoError(ret); + + _buffer = new MediaPacketBuffer(packet, dataHandle, _strideWidth * _strideHeight); + } + + /// + /// Gets the buffer of the current video plane. + /// + /// The MediaPacket that owns the current buffer already has been disposed of. + public MediaPacketBuffer Buffer + { + get + { + _packet.EnsureReadableState(); + return _buffer; + } + } + + /// + /// Gets the stride width of the current video plane. + /// + /// The MediaPacket that owns the current buffer already has been disposed of. + public int StrideWidth + { + get + { + _packet.EnsureReadableState(); + return _strideWidth; + } + } + + /// + /// Gets the stride height of the current video plane. + /// + /// The MediaPacket that owns the current buffer already has been disposed of. + public int StrideHeight + { + get + { + _packet.EnsureReadableState(); + return _strideHeight; + } + } + } +} diff --git a/src/Tizen.Multimedia/MediaView/MediaView.cs b/src/Tizen.Multimedia/MediaView/MediaView.cs new file mode 100755 index 0000000..41d351a --- /dev/null +++ b/src/Tizen.Multimedia/MediaView/MediaView.cs @@ -0,0 +1,36 @@ +using System; +using ElmSharp; + +namespace Tizen.Multimedia +{ + /// + /// The MediaView class allows application developers to display the video output on screen. + /// + /// + /// This view should not be instantiated directly.\n + /// Use to create the view. + /// + /// + /// + /// Tizen.Xamarin.Forms.Extension.MediaView mediaView = ... + /// ... + /// var display = new Display((Tizen.Multimedia.MediaView)MediaView.NativeView); + /// + /// + public class MediaView : EvasObject + { + /// + /// This constructor is used by the infrastructure and is not intended to be used directly from application code. + /// + public MediaView(EvasObject parent) : base(parent) + { + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + IntPtr evas = Interop.EvasObject.evas_object_evas_get(parent); + return Interop.EvasObject.evas_object_image_add(evas); + } + } +} + diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.csproj b/src/Tizen.Multimedia/Tizen.Multimedia.csproj new file mode 100644 index 0000000..2bb3515 --- /dev/null +++ b/src/Tizen.Multimedia/Tizen.Multimedia.csproj @@ -0,0 +1,15 @@ + + + + + netstandard1.6 + + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Multimedia/Tizen.Multimedia.sln b/src/Tizen.Multimedia/Tizen.Multimedia.sln new file mode 100755 index 0000000..5cf6cc0 --- /dev/null +++ b/src/Tizen.Multimedia/Tizen.Multimedia.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Multimedia", "Tizen.Multimedia.csproj", "{CE0306EA-C972-4D11-916B-3A453FA18616}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{11BB8B68-9E10-49F4-B9AB-9AD64703C81B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{8C5FA5D9-925E-434C-B2E2-023AE99439D7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{A93E036B-A06F-4A3F-A724-73DCD57B8AEB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{C85B022F-7CB1-4420-8231-412EDC25BCBC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{14A1C9D0-F301-4A1D-BAE0-A39B85E840CA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE0306EA-C972-4D11-916B-3A453FA18616}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE0306EA-C972-4D11-916B-3A453FA18616}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE0306EA-C972-4D11-916B-3A453FA18616}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE0306EA-C972-4D11-916B-3A453FA18616}.Release|Any CPU.Build.0 = Release|Any CPU + {11BB8B68-9E10-49F4-B9AB-9AD64703C81B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11BB8B68-9E10-49F4-B9AB-9AD64703C81B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11BB8B68-9E10-49F4-B9AB-9AD64703C81B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11BB8B68-9E10-49F4-B9AB-9AD64703C81B}.Release|Any CPU.Build.0 = Release|Any CPU + {8C5FA5D9-925E-434C-B2E2-023AE99439D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C5FA5D9-925E-434C-B2E2-023AE99439D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C5FA5D9-925E-434C-B2E2-023AE99439D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C5FA5D9-925E-434C-B2E2-023AE99439D7}.Release|Any CPU.Build.0 = Release|Any CPU + {A93E036B-A06F-4A3F-A724-73DCD57B8AEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A93E036B-A06F-4A3F-A724-73DCD57B8AEB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A93E036B-A06F-4A3F-A724-73DCD57B8AEB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A93E036B-A06F-4A3F-A724-73DCD57B8AEB}.Release|Any CPU.Build.0 = Release|Any CPU + {C85B022F-7CB1-4420-8231-412EDC25BCBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C85B022F-7CB1-4420-8231-412EDC25BCBC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C85B022F-7CB1-4420-8231-412EDC25BCBC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C85B022F-7CB1-4420-8231-412EDC25BCBC}.Release|Any CPU.Build.0 = Release|Any CPU + {14A1C9D0-F301-4A1D-BAE0-A39B85E840CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {14A1C9D0-F301-4A1D-BAE0-A39B85E840CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {14A1C9D0-F301-4A1D-BAE0-A39B85E840CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {14A1C9D0-F301-4A1D-BAE0-A39B85E840CA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.NUI/Tizen.NUI.csproj b/src/Tizen.NUI/Tizen.NUI.csproj new file mode 100755 index 0000000..ec640e5 --- /dev/null +++ b/src/Tizen.NUI/Tizen.NUI.csproj @@ -0,0 +1,27 @@ + + + + + netstandard1.6 + $(DefineConstants);DEBUG_ON + + + + + + + + + + + + + + + TizenSystemSettings + + + + + + \ No newline at end of file diff --git a/src/Tizen.NUI/Tizen.NUI.sln b/src/Tizen.NUI/Tizen.NUI.sln new file mode 100755 index 0000000..b086733 --- /dev/null +++ b/src/Tizen.NUI/Tizen.NUI.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.NUI", "Tizen.NUI.csproj", "{473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.SystemSettings", "..\Tizen.System.SystemSettings\Tizen.System.SystemSettings.csproj", "{8D71B1B6-9901-436F-8914-9F812E1B10A7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{33B7EFD5-0050-416D-A2D1-8F18F26F106D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{1C550C1F-9370-42FF-86FA-EDCD6262B258}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {473C3BEC-2F67-4285-85FC-BF4E96BFFF1C}.Release|Any CPU.Build.0 = Release|Any CPU + {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D71B1B6-9901-436F-8914-9F812E1B10A7}.Release|Any CPU.Build.0 = Release|Any CPU + {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33B7EFD5-0050-416D-A2D1-8F18F26F106D}.Release|Any CPU.Build.0 = Release|Any CPU + {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C550C1F-9370-42FF-86FA-EDCD6262B258}.Release|Any CPU.Build.0 = Release|Any CPU + {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2AEDCAA7-543F-48A1-BEA3-CF3E14F6EDC2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.NUI/src/internal/AccessibilityActionSignal.cs b/src/Tizen.NUI/src/internal/AccessibilityActionSignal.cs new file mode 100755 index 0000000..6e97809 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AccessibilityActionSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AccessibilityActionSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AccessibilityActionSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AccessibilityActionSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AccessibilityActionSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AccessibilityActionSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.AccessibilityActionSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.AccessibilityActionSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AccessibilityActionSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AccessibilityActionSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(AccessibilityManager arg) + { + bool ret = NDalicPINVOKE.AccessibilityActionSignal_Emit(swigCPtr, AccessibilityManager.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal() : this(NDalicPINVOKE.new_AccessibilityActionSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AccessibilityFocusOvershotSignal.cs b/src/Tizen.NUI/src/internal/AccessibilityFocusOvershotSignal.cs new file mode 100755 index 0000000..01d4f98 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AccessibilityFocusOvershotSignal.cs @@ -0,0 +1,146 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class AccessibilityFocusOvershotSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AccessibilityFocusOvershotSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AccessibilityFocusOvershotSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AccessibilityFocusOvershotSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AccessibilityFocusOvershotSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.AccessibilityFocusOvershotSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.AccessibilityFocusOvershotSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AccessibilityFocusOvershotSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AccessibilityFocusOvershotSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, AccessibilityManager.FocusOvershotDirection arg2) + { + NDalicPINVOKE.AccessibilityFocusOvershotSignal_Emit(swigCPtr, View.getCPtr(arg1), (int)arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AccessibilityFocusOvershotSignal() : this(NDalicPINVOKE.new_AccessibilityFocusOvershotSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AccessibilityManager.cs b/src/Tizen.NUI/src/internal/AccessibilityManager.cs new file mode 100755 index 0000000..2fc7605 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AccessibilityManager.cs @@ -0,0 +1,2723 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + internal class AccessibilityManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal AccessibilityManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.AccessibilityManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AccessibilityManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AccessibilityManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /** + * @brief Event arguments that passed via StatusChanged signal + * + */ + public class StatusChangedEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionNext signal + * + */ + public class ActionNextEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionPrevious signal + * + */ + public class ActionPreviousEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionActivate signal + * + */ + public class ActionActivateEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionRead signal + * + */ + public class ActionReadEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionOver signal + * + */ + public class ActionOverEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadNext signal + * + */ + public class ActionReadNextEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadPrevious signal + * + */ + public class ActionReadPreviousEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionUp signal + * + */ + public class ActionUpEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionDown signal + * + */ + public class ActionDownEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionClearFocus signal + * + */ + public class ActionClearFocusEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionBack signal + * + */ + public class ActionBackEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionScrollUp signal + * + */ + public class ActionScrollUpEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionScrollDown signal + * + */ + public class ActionScrollDownEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionPageLeft signal + * + */ + public class ActionPageLeftEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionPageRight signal + * + */ + public class ActionPageRightEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionPageUp signal + * + */ + public class ActionPageUpEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionPageDown signal + * + */ + public class ActionPageDownEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionMoveToFirst signal + * + */ + public class ActionMoveToFirstEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionMoveToLast signal + * + */ + public class ActionMoveToLastEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadFromTop signal + * + */ + public class ActionReadFromTopEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadFromNext signal + * + */ + public class ActionReadFromNextEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionZoom signal + * + */ + public class ActionZoomEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadIndicatorInformation signal + * + */ + public class ActionReadIndicatorInformationEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionReadPauseResume signal + * + */ + public class ActionReadPauseResumeEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionStartStop signal + * + */ + public class ActionStartStopEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + } + + /** + * @brief Event arguments that passed via ActionScroll signal + * + */ + /* + // To be replaced by a new event that takes Touch + public class ActionScrollEventArgs : EventArgs + { + private AccessibilityManager _accessibilityManager; + private TouchEvent _touchEvent; + + public AccessibilityManager AccessibilityManager + { + get + { + return _accessibilityManager; + } + set + { + _accessibilityManager = value; + } + } + + public TouchEvent TouchEvent + { + get + { + return _touchEvent; + } + set + { + _touchEvent = value; + } + } + } + */ + + /** + * @brief Event arguments that passed via ActionPageUp signal + * + */ + public class FocusChangedEventArgs : EventArgs + { + private View _viewCurrent; + private View _viewNext; + + public View ViewCurrent + { + get + { + return _viewCurrent; + } + set + { + _viewCurrent = value; + } + } + + public View ViewNext + { + get + { + return _viewNext; + } + set + { + _viewNext = value; + } + } + } + + /** + * @brief Event arguments that passed via FocusedViewActivated signal + * + */ + public class FocusedViewActivatedEventArgs : EventArgs + { + private View _view; + + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + /** + * @brief Event arguments that passed via FocusOvershot signal + * + */ + public class FocusOvershotEventArgs : EventArgs + { + private View _currentFocusedView; + private AccessibilityManager.FocusOvershotDirection _focusOvershotDirection; + + public View CurrentFocusedView + { + get + { + return _currentFocusedView; + } + set + { + _currentFocusedView = value; + } + } + + public AccessibilityManager.FocusOvershotDirection FocusOvershotDirection + { + get + { + return _focusOvershotDirection; + } + set + { + _focusOvershotDirection = value; + } + } + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool StatusChangedEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerStatusChangedEventHandler; + private StatusChangedEventCallbackDelegate _accessibilityManagerStatusChangedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionNextEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionNextEventHandler; + private ActionNextEventCallbackDelegate _accessibilityManagerActionNextEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionPreviousEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionPreviousEventHandler; + private ActionPreviousEventCallbackDelegate _accessibilityManagerActionPreviousEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionActivateEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionActivateEventHandler; + private ActionActivateEventCallbackDelegate _accessibilityManagerActionActivateEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadEventHandler; + private ActionReadEventCallbackDelegate _accessibilityManagerActionReadEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionOverEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionOverEventHandler; + private ActionOverEventCallbackDelegate _accessibilityManagerActionOverEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadNextEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadNextEventHandler; + private ActionReadNextEventCallbackDelegate _accessibilityManagerActionReadNextEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadPreviousEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadPreviousEventHandler; + private ActionReadPreviousEventCallbackDelegate _accessibilityManagerActionReadPreviousEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionUpEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionUpEventHandler; + private ActionUpEventCallbackDelegate _accessibilityManagerActionUpEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionDownEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionDownEventHandler; + private ActionDownEventCallbackDelegate _accessibilityManagerActionDownEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionClearFocusEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionClearFocusEventHandler; + private ActionClearFocusEventCallbackDelegate _accessibilityManagerActionClearFocusEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionBackEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionBackEventHandler; + private ActionBackEventCallbackDelegate _accessibilityManagerActionBackEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionScrollUpEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionScrollUpEventHandler; + private ActionScrollUpEventCallbackDelegate _accessibilityManagerActionScrollUpEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionScrollDownEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionScrollDownEventHandler; + private ActionScrollDownEventCallbackDelegate _accessibilityManagerActionScrollDownEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionPageLeftEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionPageLeftEventHandler; + private ActionPageLeftEventCallbackDelegate _accessibilityManagerActionPageLeftEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionPageRightEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionPageRightEventHandler; + private ActionPageRightEventCallbackDelegate _accessibilityManagerActionPageRightEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionPageUpEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionPageUpEventHandler; + private ActionPageUpEventCallbackDelegate _accessibilityManagerActionPageUpEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionPageDownEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionPageDownEventHandler; + private ActionPageDownEventCallbackDelegate _accessibilityManagerActionPageDownEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionMoveToFirstEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionMoveToFirstEventHandler; + private ActionMoveToFirstEventCallbackDelegate _accessibilityManagerActionMoveToFirstEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionMoveToLastEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionMoveToLastEventHandler; + private ActionMoveToLastEventCallbackDelegate _accessibilityManagerActionMoveToLastEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadFromTopEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadFromTopEventHandler; + private ActionReadFromTopEventCallbackDelegate _accessibilityManagerActionReadFromTopEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadFromNextEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadFromNextEventHandler; + private ActionReadFromNextEventCallbackDelegate _accessibilityManagerActionReadFromNextEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionZoomEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionZoomEventHandler; + private ActionZoomEventCallbackDelegate _accessibilityManagerActionZoomEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadIndicatorInformationEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadIndicatorInformationEventHandler; + private ActionReadIndicatorInformationEventCallbackDelegate _accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionReadPauseResumeEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionReadPauseResumeEventHandler; + private ActionReadPauseResumeEventCallbackDelegate _accessibilityManagerActionReadPauseResumeEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionStartStopEventCallbackDelegate(IntPtr accessibilityManager); + private DaliEventHandlerWithReturnType _accessibilityManagerActionStartStopEventHandler; + private ActionStartStopEventCallbackDelegate _accessibilityManagerActionStartStopEventCallbackDelegate; + + /* + // To be replaced by a new event that takes Touch + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ActionScrollEventCallbackDelegate(IntPtr accessibilityManager, IntPtr touchEvent); + private DaliEventHandlerWithReturnType _accessibilityManagerActionScrollEventHandler; + private ActionScrollEventCallbackDelegate _accessibilityManagerActionScrollEventCallbackDelegate; + */ + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusChangedEventCallbackDelegate(IntPtr view1, IntPtr view2); + private DaliEventHandler _accessibilityManagerFocusChangedEventHandler; + private FocusChangedEventCallbackDelegate _accessibilityManagerFocusChangedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusedViewActivatedEventCallbackDelegate(IntPtr view); + private DaliEventHandler _accessibilityManagerFocusedViewActivatedEventHandler; + private FocusedViewActivatedEventCallbackDelegate _accessibilityManagerFocusedViewActivatedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusOvershotEventCallbackDelegate(IntPtr currentFocusedView, AccessibilityManager.FocusOvershotDirection direction); + private DaliEventHandler _accessibilityManagerFocusOvershotEventHandler; + private FocusOvershotEventCallbackDelegate _accessibilityManagerFocusOvershotEventCallbackDelegate; + + public event DaliEventHandlerWithReturnType StatusChanged + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerStatusChangedEventHandler == null) + { + _accessibilityManagerStatusChangedEventHandler += value; + + _accessibilityManagerStatusChangedEventCallbackDelegate = new StatusChangedEventCallbackDelegate(OnStatusChanged); + this.StatusChangedSignal().Connect(_accessibilityManagerStatusChangedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerStatusChangedEventHandler != null) + { + this.StatusChangedSignal().Disconnect(_accessibilityManagerStatusChangedEventCallbackDelegate); + } + + _accessibilityManagerStatusChangedEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager StatusChangedSignal + private bool OnStatusChanged(IntPtr data) + { + StatusChangedEventArgs e = new StatusChangedEventArgs(); + + // Populate all members of "e" (StatusChangedEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerStatusChangedEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerStatusChangedEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionNext + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionNextEventHandler == null) + { + _accessibilityManagerActionNextEventHandler += value; + + _accessibilityManagerActionNextEventCallbackDelegate = new ActionNextEventCallbackDelegate(OnActionNext); + this.ActionNextSignal().Connect(_accessibilityManagerActionNextEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionNextEventHandler != null) + { + this.ActionNextSignal().Disconnect(_accessibilityManagerActionNextEventCallbackDelegate); + } + + _accessibilityManagerActionNextEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionNextSignal + private bool OnActionNext(IntPtr data) + { + ActionNextEventArgs e = new ActionNextEventArgs(); + + // Populate all members of "e" (ActionNextEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionNextEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionNextEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionPrevious + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionPreviousEventHandler == null) + { + _accessibilityManagerActionPreviousEventHandler += value; + + _accessibilityManagerActionPreviousEventCallbackDelegate = new ActionPreviousEventCallbackDelegate(OnActionPrevious); + this.ActionPreviousSignal().Connect(_accessibilityManagerActionPreviousEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionPreviousEventHandler != null) + { + this.ActionPreviousSignal().Disconnect(_accessibilityManagerActionPreviousEventCallbackDelegate); + } + + _accessibilityManagerActionPreviousEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionPreviousSignal + private bool OnActionPrevious(IntPtr data) + { + ActionPreviousEventArgs e = new ActionPreviousEventArgs(); + + // Populate all members of "e" (ActionPreviousEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionPreviousEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionPreviousEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionActivate + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionActivateEventHandler == null) + { + _accessibilityManagerActionActivateEventHandler += value; + + _accessibilityManagerActionActivateEventCallbackDelegate = new ActionActivateEventCallbackDelegate(OnActionActivate); + this.ActionActivateSignal().Connect(_accessibilityManagerActionActivateEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionActivateEventHandler != null) + { + this.ActionActivateSignal().Disconnect(_accessibilityManagerActionActivateEventCallbackDelegate); + } + + _accessibilityManagerActionActivateEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionActivateSignal + private bool OnActionActivate(IntPtr data) + { + ActionActivateEventArgs e = new ActionActivateEventArgs(); + + // Populate all members of "e" (ActionActivateEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionActivateEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionActivateEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionRead + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadEventHandler == null) + { + _accessibilityManagerActionReadEventHandler += value; + + _accessibilityManagerActionReadEventCallbackDelegate = new ActionReadEventCallbackDelegate(OnActionRead); + this.ActionReadSignal().Connect(_accessibilityManagerActionReadEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadEventHandler != null) + { + this.ActionReadSignal().Disconnect(_accessibilityManagerActionReadEventCallbackDelegate); + } + + _accessibilityManagerActionReadEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadSignal + private bool OnActionRead(IntPtr data) + { + ActionReadEventArgs e = new ActionReadEventArgs(); + + // Populate all members of "e" (ActionReadEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionOver + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionOverEventHandler == null) + { + _accessibilityManagerActionOverEventHandler += value; + + _accessibilityManagerActionOverEventCallbackDelegate = new ActionOverEventCallbackDelegate(OnActionOver); + this.ActionOverSignal().Connect(_accessibilityManagerActionOverEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionOverEventHandler != null) + { + this.ActionOverSignal().Disconnect(_accessibilityManagerActionOverEventCallbackDelegate); + } + + _accessibilityManagerActionOverEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionOverSignal + private bool OnActionOver(IntPtr data) + { + ActionOverEventArgs e = new ActionOverEventArgs(); + + // Populate all members of "e" (ActionOverEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionOverEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionOverEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionReadNext + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadNextEventHandler == null) + { + _accessibilityManagerActionReadNextEventHandler += value; + + _accessibilityManagerActionReadNextEventCallbackDelegate = new ActionReadNextEventCallbackDelegate(OnActionReadNext); + this.ActionReadNextSignal().Connect(_accessibilityManagerActionReadNextEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadNextEventHandler != null) + { + this.ActionReadNextSignal().Disconnect(_accessibilityManagerActionReadNextEventCallbackDelegate); + } + + _accessibilityManagerActionReadNextEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadNextSignal + private bool OnActionReadNext(IntPtr data) + { + ActionReadNextEventArgs e = new ActionReadNextEventArgs(); + + // Populate all members of "e" (ActionReadNextEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadNextEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadNextEventHandler(this, e); + } + return false; + } + + + public event DaliEventHandlerWithReturnType ActionReadPrevious + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadPreviousEventHandler == null) + { + _accessibilityManagerActionReadPreviousEventHandler += value; + + _accessibilityManagerActionReadPreviousEventCallbackDelegate = new ActionReadPreviousEventCallbackDelegate(OnActionReadPrevious); + this.ActionReadPreviousSignal().Connect(_accessibilityManagerActionReadPreviousEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadPreviousEventHandler != null) + { + this.ActionReadPreviousSignal().Disconnect(_accessibilityManagerActionReadPreviousEventCallbackDelegate); + } + + _accessibilityManagerActionReadPreviousEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadPreviousSignal + private bool OnActionReadPrevious(IntPtr data) + { + ActionReadPreviousEventArgs e = new ActionReadPreviousEventArgs(); + + // Populate all members of "e" (ActionReadPreviousEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadPreviousEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadPreviousEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionUp + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionUpEventHandler == null) + { + _accessibilityManagerActionUpEventHandler += value; + + _accessibilityManagerActionUpEventCallbackDelegate = new ActionUpEventCallbackDelegate(OnActionUp); + this.ActionUpSignal().Connect(_accessibilityManagerActionUpEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionUpEventHandler != null) + { + this.ActionUpSignal().Disconnect(_accessibilityManagerActionUpEventCallbackDelegate); + } + + _accessibilityManagerActionUpEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionUpSignal + private bool OnActionUp(IntPtr data) + { + ActionUpEventArgs e = new ActionUpEventArgs(); + + // Populate all members of "e" (ActionUpEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionUpEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionUpEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionDown + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionDownEventHandler == null) + { + _accessibilityManagerActionDownEventHandler += value; + + _accessibilityManagerActionDownEventCallbackDelegate = new ActionDownEventCallbackDelegate(OnActionDown); + this.ActionDownSignal().Connect(_accessibilityManagerActionDownEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionDownEventHandler != null) + { + this.ActionDownSignal().Disconnect(_accessibilityManagerActionDownEventCallbackDelegate); + } + + _accessibilityManagerActionDownEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionDownSignal + private bool OnActionDown(IntPtr data) + { + ActionDownEventArgs e = new ActionDownEventArgs(); + + // Populate all members of "e" (ActionDownEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionDownEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionDownEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionClearFocus + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionClearFocusEventHandler == null) + { + _accessibilityManagerActionClearFocusEventHandler += value; + + _accessibilityManagerActionClearFocusEventCallbackDelegate = new ActionClearFocusEventCallbackDelegate(OnActionClearFocus); + this.ActionClearFocusSignal().Connect(_accessibilityManagerActionClearFocusEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionClearFocusEventHandler != null) + { + this.ActionClearFocusSignal().Disconnect(_accessibilityManagerActionClearFocusEventCallbackDelegate); + } + + _accessibilityManagerActionClearFocusEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionClearFocusSignal + private bool OnActionClearFocus(IntPtr data) + { + ActionClearFocusEventArgs e = new ActionClearFocusEventArgs(); + + // Populate all members of "e" (ActionClearFocusEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionClearFocusEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionClearFocusEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionBack + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionBackEventHandler == null) + { + _accessibilityManagerActionBackEventHandler += value; + + _accessibilityManagerActionBackEventCallbackDelegate = new ActionBackEventCallbackDelegate(OnActionBack); + this.ActionBackSignal().Connect(_accessibilityManagerActionBackEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionBackEventHandler != null) + { + this.ActionBackSignal().Disconnect(_accessibilityManagerActionBackEventCallbackDelegate); + } + + _accessibilityManagerActionBackEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionBackSignal + private bool OnActionBack(IntPtr data) + { + ActionBackEventArgs e = new ActionBackEventArgs(); + + // Populate all members of "e" (ActionBackEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionBackEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionBackEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionScrollUp + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionScrollUpEventHandler == null) + { + _accessibilityManagerActionScrollUpEventHandler += value; + + _accessibilityManagerActionScrollUpEventCallbackDelegate = new ActionScrollUpEventCallbackDelegate(OnActionScrollUp); + this.ActionScrollUpSignal().Connect(_accessibilityManagerActionScrollUpEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionScrollUpEventHandler != null) + { + this.ActionScrollUpSignal().Disconnect(_accessibilityManagerActionScrollUpEventCallbackDelegate); + } + + _accessibilityManagerActionScrollUpEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionScrollUpSignal + private bool OnActionScrollUp(IntPtr data) + { + ActionScrollUpEventArgs e = new ActionScrollUpEventArgs(); + + // Populate all members of "e" (ActionScrollUpEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionScrollUpEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionScrollUpEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionScrollDown + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionScrollDownEventHandler == null) + { + _accessibilityManagerActionScrollDownEventHandler += value; + + _accessibilityManagerActionScrollDownEventCallbackDelegate = new ActionScrollDownEventCallbackDelegate(OnActionScrollDown); + this.ActionScrollDownSignal().Connect(_accessibilityManagerActionScrollDownEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionScrollDownEventHandler != null) + { + this.ActionScrollDownSignal().Disconnect(_accessibilityManagerActionScrollDownEventCallbackDelegate); + } + + _accessibilityManagerActionScrollDownEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionScrollDownSignal + private bool OnActionScrollDown(IntPtr data) + { + ActionScrollDownEventArgs e = new ActionScrollDownEventArgs(); + + // Populate all members of "e" (ActionScrollDownEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionScrollDownEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionScrollDownEventHandler(this, e); + } + return false; + } + + + public event DaliEventHandlerWithReturnType ActionPageLeft + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionPageLeftEventHandler == null) + { + _accessibilityManagerActionPageLeftEventHandler += value; + + _accessibilityManagerActionPageLeftEventCallbackDelegate = new ActionPageLeftEventCallbackDelegate(OnActionPageLeft); + this.ActionPageLeftSignal().Connect(_accessibilityManagerActionPageLeftEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionPageLeftEventHandler != null) + { + this.ActionPageLeftSignal().Disconnect(_accessibilityManagerActionPageLeftEventCallbackDelegate); + } + + _accessibilityManagerActionPageLeftEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionPageLeftSignal + private bool OnActionPageLeft(IntPtr data) + { + ActionPageLeftEventArgs e = new ActionPageLeftEventArgs(); + + // Populate all members of "e" (ActionPageLeftEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionPageLeftEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionPageLeftEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionPageRight + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionPageRightEventHandler == null) + { + _accessibilityManagerActionPageRightEventHandler += value; + + _accessibilityManagerActionPageRightEventCallbackDelegate = new ActionPageRightEventCallbackDelegate(OnActionPageRight); + this.ActionPageRightSignal().Connect(_accessibilityManagerActionPageRightEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionPageRightEventHandler != null) + { + this.ActionPageRightSignal().Disconnect(_accessibilityManagerActionPageRightEventCallbackDelegate); + } + + _accessibilityManagerActionPageRightEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionPageRightSignal + private bool OnActionPageRight(IntPtr data) + { + ActionPageRightEventArgs e = new ActionPageRightEventArgs(); + + // Populate all members of "e" (ActionPageRightEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionPageRightEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionPageRightEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionPageUp + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionPageUpEventHandler == null) + { + _accessibilityManagerActionPageUpEventHandler += value; + + _accessibilityManagerActionPageUpEventCallbackDelegate = new ActionPageUpEventCallbackDelegate(OnActionPageUp); + this.ActionPageUpSignal().Connect(_accessibilityManagerActionPageUpEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionPageUpEventHandler != null) + { + this.ActionPageUpSignal().Disconnect(_accessibilityManagerActionPageUpEventCallbackDelegate); + } + + _accessibilityManagerActionPageUpEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionPageUpSignal + private bool OnActionPageUp(IntPtr data) + { + ActionPageUpEventArgs e = new ActionPageUpEventArgs(); + + // Populate all members of "e" (ActionPageUpEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionPageUpEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionPageUpEventHandler(this, e); + } + return false; + } + + + public event DaliEventHandlerWithReturnType ActionPageDown + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionPageDownEventHandler == null) + { + _accessibilityManagerActionPageDownEventHandler += value; + + _accessibilityManagerActionPageDownEventCallbackDelegate = new ActionPageDownEventCallbackDelegate(OnActionPageDown); + this.ActionPageDownSignal().Connect(_accessibilityManagerActionPageDownEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionPageDownEventHandler != null) + { + this.ActionPageDownSignal().Disconnect(_accessibilityManagerActionPageDownEventCallbackDelegate); + } + + _accessibilityManagerActionPageDownEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionPageDownSignal + private bool OnActionPageDown(IntPtr data) + { + ActionPageDownEventArgs e = new ActionPageDownEventArgs(); + + // Populate all members of "e" (ActionPageDownEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionPageDownEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionPageDownEventHandler(this, e); + } + return false; + } + + + public event DaliEventHandlerWithReturnType ActionMoveToFirst + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionMoveToFirstEventHandler == null) + { + _accessibilityManagerActionMoveToFirstEventHandler += value; + + _accessibilityManagerActionMoveToFirstEventCallbackDelegate = new ActionMoveToFirstEventCallbackDelegate(OnActionMoveToFirst); + this.ActionMoveToFirstSignal().Connect(_accessibilityManagerActionMoveToFirstEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionMoveToFirstEventHandler != null) + { + this.ActionMoveToFirstSignal().Disconnect(_accessibilityManagerActionMoveToFirstEventCallbackDelegate); + } + + _accessibilityManagerActionMoveToFirstEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionMoveToFirstSignal + private bool OnActionMoveToFirst(IntPtr data) + { + ActionMoveToFirstEventArgs e = new ActionMoveToFirstEventArgs(); + + // Populate all members of "e" (ActionMoveToFirstEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionMoveToFirstEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionMoveToFirstEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionMoveToLast + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionMoveToLastEventHandler == null) + { + _accessibilityManagerActionMoveToLastEventHandler += value; + + _accessibilityManagerActionMoveToLastEventCallbackDelegate = new ActionMoveToLastEventCallbackDelegate(OnActionMoveToLast); + this.ActionMoveToLastSignal().Connect(_accessibilityManagerActionMoveToLastEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionMoveToLastEventHandler != null) + { + this.ActionMoveToLastSignal().Disconnect(_accessibilityManagerActionMoveToLastEventCallbackDelegate); + } + + _accessibilityManagerActionMoveToLastEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionMoveToLastSignal + private bool OnActionMoveToLast(IntPtr data) + { + ActionMoveToLastEventArgs e = new ActionMoveToLastEventArgs(); + + // Populate all members of "e" (ActionMoveToLastEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionMoveToLastEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionMoveToLastEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionReadFromTop + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadFromTopEventHandler == null) + { + _accessibilityManagerActionReadFromTopEventHandler += value; + + _accessibilityManagerActionReadFromTopEventCallbackDelegate = new ActionReadFromTopEventCallbackDelegate(OnActionReadFromTop); + this.ActionReadFromTopSignal().Connect(_accessibilityManagerActionReadFromTopEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadFromTopEventHandler != null) + { + this.ActionReadFromTopSignal().Disconnect(_accessibilityManagerActionReadFromTopEventCallbackDelegate); + } + + _accessibilityManagerActionReadFromTopEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadFromTopSignal + private bool OnActionReadFromTop(IntPtr data) + { + ActionReadFromTopEventArgs e = new ActionReadFromTopEventArgs(); + + // Populate all members of "e" (ActionReadFromTopEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadFromTopEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadFromTopEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionReadFromNext + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadFromNextEventHandler == null) + { + _accessibilityManagerActionReadFromNextEventHandler += value; + + _accessibilityManagerActionReadFromNextEventCallbackDelegate = new ActionReadFromNextEventCallbackDelegate(OnActionReadFromNext); + this.ActionReadFromNextSignal().Connect(_accessibilityManagerActionReadFromNextEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadFromNextEventHandler != null) + { + this.ActionReadFromNextSignal().Disconnect(_accessibilityManagerActionReadFromNextEventCallbackDelegate); + } + + _accessibilityManagerActionReadFromNextEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadFromNextSignal + private bool OnActionReadFromNext(IntPtr data) + { + ActionReadFromNextEventArgs e = new ActionReadFromNextEventArgs(); + + // Populate all members of "e" (ActionReadFromNextEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadFromNextEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadFromNextEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionZoom + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionZoomEventHandler == null) + { + _accessibilityManagerActionZoomEventHandler += value; + + _accessibilityManagerActionZoomEventCallbackDelegate = new ActionZoomEventCallbackDelegate(OnActionZoom); + this.ActionZoomSignal().Connect(_accessibilityManagerActionZoomEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionZoomEventHandler != null) + { + this.ActionZoomSignal().Disconnect(_accessibilityManagerActionZoomEventCallbackDelegate); + } + + _accessibilityManagerActionZoomEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionZoomSignal + private bool OnActionZoom(IntPtr data) + { + ActionZoomEventArgs e = new ActionZoomEventArgs(); + + // Populate all members of "e" (ActionZoomEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionZoomEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionZoomEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionReadIndicatorInformation + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadIndicatorInformationEventHandler == null) + { + _accessibilityManagerActionReadIndicatorInformationEventHandler += value; + + _accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate = new ActionReadIndicatorInformationEventCallbackDelegate(OnActionReadIndicatorInformation); + this.ActionReadIndicatorInformationSignal().Connect(_accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadIndicatorInformationEventHandler != null) + { + this.ActionReadIndicatorInformationSignal().Disconnect(_accessibilityManagerActionReadIndicatorInformationEventCallbackDelegate); + } + + _accessibilityManagerActionReadIndicatorInformationEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadIndicatorInformationSignal + private bool OnActionReadIndicatorInformation(IntPtr data) + { + ActionReadIndicatorInformationEventArgs e = new ActionReadIndicatorInformationEventArgs(); + + // Populate all members of "e" (ActionReadIndicatorInformationEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadIndicatorInformationEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadIndicatorInformationEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionReadPauseResume + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionReadPauseResumeEventHandler == null) + { + _accessibilityManagerActionReadPauseResumeEventHandler += value; + + _accessibilityManagerActionReadPauseResumeEventCallbackDelegate = new ActionReadPauseResumeEventCallbackDelegate(OnActionReadPauseResume); + this.ActionReadPauseResumeSignal().Connect(_accessibilityManagerActionReadPauseResumeEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionReadPauseResumeEventHandler != null) + { + this.ActionReadPauseResumeSignal().Disconnect(_accessibilityManagerActionReadPauseResumeEventCallbackDelegate); + } + + _accessibilityManagerActionReadPauseResumeEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionReadPauseResumeSignal + private bool OnActionReadPauseResume(IntPtr data) + { + ActionReadPauseResumeEventArgs e = new ActionReadPauseResumeEventArgs(); + + // Populate all members of "e" (ActionReadPauseResumeEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionReadPauseResumeEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionReadPauseResumeEventHandler(this, e); + } + return false; + } + + public event DaliEventHandlerWithReturnType ActionStartStop + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerActionStartStopEventHandler == null) + { + _accessibilityManagerActionStartStopEventHandler += value; + + _accessibilityManagerActionStartStopEventCallbackDelegate = new ActionStartStopEventCallbackDelegate(OnActionStartStop); + this.ActionStartStopSignal().Connect(_accessibilityManagerActionStartStopEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerActionStartStopEventHandler != null) + { + this.ActionStartStopSignal().Disconnect(_accessibilityManagerActionStartStopEventCallbackDelegate); + } + + _accessibilityManagerActionStartStopEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionStartStopSignal + private bool OnActionStartStop(IntPtr data) + { + ActionStartStopEventArgs e = new ActionStartStopEventArgs(); + + // Populate all members of "e" (ActionStartStopEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(data); + + if (_accessibilityManagerActionStartStopEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionStartStopEventHandler(this, e); + } + return false; + } + + /* + // To be replaced by a new event that takes Touch + public event DaliEventHandlerWithReturnType ActionScroll + { + add + { + lock(this) + { + // Restricted to only one listener + if (_accessibilityManagerActionScrollEventHandler == null) + { + _accessibilityManagerActionScrollEventHandler += value; + + _accessibilityManagerActionScrollEventCallbackDelegate = new ActionScrollEventCallbackDelegate(OnActionScroll); + this.ActionScrollSignal().Connect(_accessibilityManagerActionScrollEventCallbackDelegate); + } + } + } + + remove + { + lock(this) + { + if (_accessibilityManagerActionScrollEventHandler != null) + { + this.ActionScrollSignal().Disconnect(_accessibilityManagerActionScrollEventCallbackDelegate); + } + + _accessibilityManagerActionScrollEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager ActionScrollSignal + private bool OnActionScroll(IntPtr accessibilityManager, IntPtr touchEvent) + { + ActionScrollEventArgs e = new ActionScrollEventArgs(); + + // Populate all members of "e" (ActionScrollEventArgs) with real data + e.AccessibilityManager = AccessibilityManager.GetAccessibilityManagerFromPtr(accessibilityManager); + e.TouchEvent = TouchEvent.GetTouchEventFromPtr(touchEvent); + + if (_accessibilityManagerActionScrollEventHandler != null) + { + //here we send all data to user event handlers + return _accessibilityManagerActionScrollEventHandler(this, e); + } + return false; + } + */ + + public event DaliEventHandler FocusChanged + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerFocusChangedEventHandler == null) + { + _accessibilityManagerFocusChangedEventHandler += value; + + _accessibilityManagerFocusChangedEventCallbackDelegate = new FocusChangedEventCallbackDelegate(OnFocusChanged); + this.FocusChangedSignal().Connect(_accessibilityManagerFocusChangedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerFocusChangedEventHandler != null) + { + this.FocusChangedSignal().Disconnect(_accessibilityManagerFocusChangedEventCallbackDelegate); + } + + _accessibilityManagerFocusChangedEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager FocusChangedSignal + private void OnFocusChanged(IntPtr view1, IntPtr view2) + { + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + // Populate all members of "e" (FocusChangedEventArgs) with real data + e.ViewCurrent = Registry.GetManagedBaseHandleFromNativePtr(view1) as View; + e.ViewNext = Registry.GetManagedBaseHandleFromNativePtr(view2) as View; + + if (_accessibilityManagerFocusChangedEventHandler != null) + { + //here we send all data to user event handlers + _accessibilityManagerFocusChangedEventHandler(this, e); + } + } + + public event DaliEventHandler FocusedViewActivated + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerFocusedViewActivatedEventHandler == null) + { + _accessibilityManagerFocusedViewActivatedEventHandler += value; + + _accessibilityManagerFocusedViewActivatedEventCallbackDelegate = new FocusedViewActivatedEventCallbackDelegate(OnFocusedViewActivated); + this.FocusedViewActivatedSignal().Connect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerFocusedViewActivatedEventHandler != null) + { + this.FocusedViewActivatedSignal().Disconnect(_accessibilityManagerFocusedViewActivatedEventCallbackDelegate); + } + + _accessibilityManagerFocusedViewActivatedEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager FocusedViewActivatedSignal + private void OnFocusedViewActivated(IntPtr view) + { + FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs(); + + // Populate all members of "e" (FocusedViewActivatedEventArgs) with real data + e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View; + + if (_accessibilityManagerFocusedViewActivatedEventHandler != null) + { + //here we send all data to user event handlers + _accessibilityManagerFocusedViewActivatedEventHandler(this, e); + } + } + + + public event DaliEventHandler FocusOvershot + { + add + { + lock (this) + { + // Restricted to only one listener + if (_accessibilityManagerFocusOvershotEventHandler == null) + { + _accessibilityManagerFocusOvershotEventHandler += value; + + _accessibilityManagerFocusOvershotEventCallbackDelegate = new FocusOvershotEventCallbackDelegate(OnFocusOvershot); + this.FocusOvershotSignal().Connect(_accessibilityManagerFocusOvershotEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_accessibilityManagerFocusOvershotEventHandler != null) + { + this.FocusOvershotSignal().Disconnect(_accessibilityManagerFocusOvershotEventCallbackDelegate); + } + + _accessibilityManagerFocusOvershotEventHandler -= value; + } + } + } + + // Callback for AccessibilityManager FocusOvershotSignal + private void OnFocusOvershot(IntPtr currentFocusedView, AccessibilityManager.FocusOvershotDirection direction) + { + FocusOvershotEventArgs e = new FocusOvershotEventArgs(); + + // Populate all members of "e" (FocusOvershotEventArgs) with real data + e.CurrentFocusedView = Registry.GetManagedBaseHandleFromNativePtr(currentFocusedView) as View; + e.FocusOvershotDirection = direction; + + if (_accessibilityManagerFocusOvershotEventHandler != null) + { + //here we send all data to user event handlers + _accessibilityManagerFocusOvershotEventHandler(this, e); + } + } + + + public static AccessibilityManager GetAccessibilityManagerFromPtr(global::System.IntPtr cPtr) + { + AccessibilityManager ret = new AccessibilityManager(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public AccessibilityManager() : this(NDalicPINVOKE.new_AccessibilityManager(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static AccessibilityManager Get() + { + AccessibilityManager ret = new AccessibilityManager(NDalicPINVOKE.AccessibilityManager_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAccessibilityAttribute(View view, AccessibilityManager.AccessibilityAttribute type, string text) + { + NDalicPINVOKE.AccessibilityManager_SetAccessibilityAttribute(swigCPtr, View.getCPtr(view), (int)type, text); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string GetAccessibilityAttribute(View view, AccessibilityManager.AccessibilityAttribute type) + { + string ret = NDalicPINVOKE.AccessibilityManager_GetAccessibilityAttribute(swigCPtr, View.getCPtr(view), (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFocusOrder(View view, uint order) + { + NDalicPINVOKE.AccessibilityManager_SetFocusOrder(swigCPtr, View.getCPtr(view), order); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetFocusOrder(View view) + { + uint ret = NDalicPINVOKE.AccessibilityManager_GetFocusOrder(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GenerateNewFocusOrder() + { + uint ret = NDalicPINVOKE.AccessibilityManager_GenerateNewFocusOrder(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View GetViewByFocusOrder(uint order) + { + View ret = new View(NDalicPINVOKE.AccessibilityManager_GetActorByFocusOrder(swigCPtr, order), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool SetCurrentFocusView(View view) + { + bool ret = NDalicPINVOKE.AccessibilityManager_SetCurrentFocusActor(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View GetCurrentFocusView() + { + View ret = new View(NDalicPINVOKE.AccessibilityManager_GetCurrentFocusActor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View GetCurrentFocusGroup() + { + View ret = new View(NDalicPINVOKE.AccessibilityManager_GetCurrentFocusGroup(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetCurrentFocusOrder() + { + uint ret = NDalicPINVOKE.AccessibilityManager_GetCurrentFocusOrder(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool MoveFocusForward() + { + bool ret = NDalicPINVOKE.AccessibilityManager_MoveFocusForward(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool MoveFocusBackward() + { + bool ret = NDalicPINVOKE.AccessibilityManager_MoveFocusBackward(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ClearFocus() + { + NDalicPINVOKE.AccessibilityManager_ClearFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new void Reset() + { + NDalicPINVOKE.AccessibilityManager_Reset(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetFocusGroup(View view, bool isFocusGroup) + { + NDalicPINVOKE.AccessibilityManager_SetFocusGroup(swigCPtr, View.getCPtr(view), isFocusGroup); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsFocusGroup(View view) + { + bool ret = NDalicPINVOKE.AccessibilityManager_IsFocusGroup(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetGroupMode(bool enabled) + { + NDalicPINVOKE.AccessibilityManager_SetGroupMode(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetGroupMode() + { + bool ret = NDalicPINVOKE.AccessibilityManager_GetGroupMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetWrapMode(bool wrapped) + { + NDalicPINVOKE.AccessibilityManager_SetWrapMode(swigCPtr, wrapped); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetWrapMode() + { + bool ret = NDalicPINVOKE.AccessibilityManager_GetWrapMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFocusIndicatorView(View indicator) + { + NDalicPINVOKE.AccessibilityManager_SetFocusIndicatorActor(swigCPtr, View.getCPtr(indicator)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public View GetFocusIndicatorView() + { + View ret = new View(NDalicPINVOKE.AccessibilityManager_GetFocusIndicatorActor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View GetFocusGroup(View view) + { + View ret = new View(NDalicPINVOKE.AccessibilityManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector2 GetReadPosition() + { + Vector2 ret = new Vector2(NDalicPINVOKE.AccessibilityManager_GetReadPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public FocusChangedSignal FocusChangedSignal() + { + FocusChangedSignal ret = new FocusChangedSignal(NDalicPINVOKE.AccessibilityManager_FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityFocusOvershotSignal FocusOvershotSignal() + { + AccessibilityFocusOvershotSignal ret = new AccessibilityFocusOvershotSignal(NDalicPINVOKE.AccessibilityManager_FocusOvershotSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ViewSignal FocusedViewActivatedSignal() + { + ViewSignal ret = new ViewSignal(NDalicPINVOKE.AccessibilityManager_FocusedActorActivatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal StatusChangedSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_StatusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionNextSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionNextSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionPreviousSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionPreviousSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionActivateSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionActivateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionOverSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionOverSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadNextSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadNextSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadPreviousSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadPreviousSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionUpSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionUpSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionDownSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionDownSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionClearFocusSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionClearFocusSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionBackSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionBackSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionScrollUpSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionScrollUpSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionScrollDownSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionScrollDownSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionPageLeftSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionPageLeftSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionPageRightSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionPageRightSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionPageUpSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionPageUpSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionPageDownSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionPageDownSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionMoveToFirstSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionMoveToFirstSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionMoveToLastSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionMoveToLastSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadFromTopSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadFromTopSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadFromNextSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadFromNextSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionZoomSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionZoomSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadIndicatorInformationSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadIndicatorInformationSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionReadPauseResumeSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionReadPauseResumeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AccessibilityActionSignal ActionStartStopSignal() + { + AccessibilityActionSignal ret = new AccessibilityActionSignal(NDalicPINVOKE.AccessibilityManager_ActionStartStopSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t ActionScrollSignal() + { + SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t ret = new SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t(NDalicPINVOKE.AccessibilityManager_ActionScrollSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum AccessibilityAttribute + { + ACCESSIBILITY_LABEL = 0, + ACCESSIBILITY_TRAIT, + ACCESSIBILITY_VALUE, + ACCESSIBILITY_HINT, + ACCESSIBILITY_ATTRIBUTE_NUM + } + + public enum FocusOvershotDirection + { + OVERSHOT_PREVIOUS = -1, + OVERSHOT_NEXT = 1 + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ActivatedSignalType.cs b/src/Tizen.NUI/src/internal/ActivatedSignalType.cs new file mode 100755 index 0000000..8728e98 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ActivatedSignalType.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be deprecated")] + public class ActivatedSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ActivatedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ActivatedSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ActivatedSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ActivatedSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.ActivatedSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.ActivatedSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ActivatedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ActivatedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(ImfManager arg) + { + NDalicManualPINVOKE.ActivatedSignalType_Emit(swigCPtr, ImfManager.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ActivatedSignalType() : this(NDalicManualPINVOKE.new_ActivatedSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AdaptorSignalType.cs b/src/Tizen.NUI/src/internal/AdaptorSignalType.cs new file mode 100755 index 0000000..ede7447 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AdaptorSignalType.cs @@ -0,0 +1,103 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class AdaptorSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AdaptorSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AdaptorSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~AdaptorSignalType() + { + Dispose(); + } + + public virtual void Dispose() + { + lock (this) + { + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_AdaptorSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.AdaptorSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.AdaptorSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.AdaptorSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.AdaptorSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Adaptor arg) + { + NDalicManualPINVOKE.AdaptorSignalType_Emit(swigCPtr, Adaptor.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AdaptorSignalType() : this(NDalicManualPINVOKE.new_AdaptorSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Alignment.cs b/src/Tizen.NUI/src/internal/Alignment.cs new file mode 100755 index 0000000..c49d4f7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Alignment.cs @@ -0,0 +1,318 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class Alignment : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Alignment(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Alignment_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Alignment obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Alignment(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class Padding : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Padding(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Padding obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Padding() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Alignment_Padding(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Padding() : this(NDalicPINVOKE.new_Alignment_Padding__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Padding(float l, float r, float t, float b) : this(NDalicPINVOKE.new_Alignment_Padding__SWIG_1(l, r, t, b), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float left + { + set + { + NDalicPINVOKE.Alignment_Padding_left_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Alignment_Padding_left_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float right + { + set + { + NDalicPINVOKE.Alignment_Padding_right_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Alignment_Padding_right_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float top + { + set + { + NDalicPINVOKE.Alignment_Padding_top_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Alignment_Padding_top_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float bottom + { + set + { + NDalicPINVOKE.Alignment_Padding_bottom_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Alignment_Padding_bottom_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + public Alignment(Alignment.Type horizontal, Alignment.Type vertical) : this(NDalicPINVOKE.Alignment_New__SWIG_0((int)horizontal, (int)vertical), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Alignment(Alignment.Type horizontal) : this(NDalicPINVOKE.Alignment_New__SWIG_1((int)horizontal), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Alignment() : this(NDalicPINVOKE.Alignment_New__SWIG_2(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Alignment(Alignment alignment) : this(NDalicPINVOKE.new_Alignment__SWIG_1(Alignment.getCPtr(alignment)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new static Alignment DownCast(BaseHandle handle) + { + Alignment ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Alignment; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAlignmentType(Alignment.Type type) + { + NDalicPINVOKE.Alignment_SetAlignmentType(swigCPtr, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Alignment.Type GetAlignmentType() + { + Alignment.Type ret = (Alignment.Type)NDalicPINVOKE.Alignment_GetAlignmentType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScaling(Alignment.Scaling scaling) + { + NDalicPINVOKE.Alignment_SetScaling(swigCPtr, (int)scaling); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Alignment.Scaling GetScaling() + { + Alignment.Scaling ret = (Alignment.Scaling)NDalicPINVOKE.Alignment_GetScaling(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetPadding(Alignment.Padding padding) + { + NDalicPINVOKE.Alignment_SetPadding(swigCPtr, Alignment.Padding.getCPtr(padding)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Alignment.Padding GetPadding() + { + Alignment.Padding ret = new Alignment.Padding(NDalicPINVOKE.Alignment_GetPadding(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Alignment Assign(Alignment alignment) + { + Alignment ret = new Alignment(NDalicPINVOKE.Alignment_Assign(swigCPtr, Alignment.getCPtr(alignment)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum Type + { + HorizontalLeft = 1, + HorizontalCenter = 2, + HorizontalRight = 4, + VerticalTop = 8, + VerticalCenter = 16, + VerticalBottom = 32 + } + + public enum Scaling + { + ScaleNone, + ScaleToFill, + ScaleToFitKeepAspect, + ScaleToFillKeepAspect, + ShrinkToFit, + ShrinkToFitKeepAspect + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AngleAxis.cs b/src/Tizen.NUI/src/internal/AngleAxis.cs new file mode 100755 index 0000000..0d35c60 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AngleAxis.cs @@ -0,0 +1,146 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AngleAxis : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AngleAxis(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AngleAxis obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AngleAxis() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AngleAxis(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public AngleAxis() : this(NDalicPINVOKE.new_AngleAxis__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AngleAxis(Radian initialAngle, Vector3 initialAxis) : this(NDalicPINVOKE.new_AngleAxis__SWIG_1(Radian.getCPtr(initialAngle), Vector3.getCPtr(initialAxis)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Radian angle + { + set + { + NDalicPINVOKE.AngleAxis_angle_set(swigCPtr, Radian.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AngleAxis_angle_get(swigCPtr); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Vector3 axis + { + set + { + NDalicPINVOKE.AngleAxis_axis_set(swigCPtr, Vector3.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AngleAxis_axis_get(swigCPtr); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AngleThresholdPair.cs b/src/Tizen.NUI/src/internal/AngleThresholdPair.cs new file mode 100755 index 0000000..84bb542 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AngleThresholdPair.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AngleThresholdPair : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AngleThresholdPair(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AngleThresholdPair obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AngleThresholdPair() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AngleThresholdPair(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public AngleThresholdPair() : this(NDalicPINVOKE.new_AngleThresholdPair__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AngleThresholdPair(Radian t, Radian u) : this(NDalicPINVOKE.new_AngleThresholdPair__SWIG_1(Radian.getCPtr(t), Radian.getCPtr(u)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AngleThresholdPair(AngleThresholdPair p) : this(NDalicPINVOKE.new_AngleThresholdPair__SWIG_2(AngleThresholdPair.getCPtr(p)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Radian first + { + set + { + NDalicPINVOKE.AngleThresholdPair_first_set(swigCPtr, Radian.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AngleThresholdPair_first_get(swigCPtr); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Radian second + { + set + { + NDalicPINVOKE.AngleThresholdPair_second_set(swigCPtr, Radian.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AngleThresholdPair_second_get(swigCPtr); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AnimatablePropertyComponentRegistration.cs b/src/Tizen.NUI/src/internal/AnimatablePropertyComponentRegistration.cs new file mode 100755 index 0000000..702e432 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AnimatablePropertyComponentRegistration.cs @@ -0,0 +1,109 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AnimatablePropertyComponentRegistration : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AnimatablePropertyComponentRegistration(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnimatablePropertyComponentRegistration obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AnimatablePropertyComponentRegistration() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AnimatablePropertyComponentRegistration(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public AnimatablePropertyComponentRegistration(TypeRegistration registered, string name, int index, int baseIndex, uint componentIndex) : this(NDalicPINVOKE.new_AnimatablePropertyComponentRegistration(TypeRegistration.getCPtr(registered), name, index, baseIndex, componentIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AnimatablePropertyRegistration.cs b/src/Tizen.NUI/src/internal/AnimatablePropertyRegistration.cs new file mode 100755 index 0000000..15eba93 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AnimatablePropertyRegistration.cs @@ -0,0 +1,114 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AnimatablePropertyRegistration : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AnimatablePropertyRegistration(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnimatablePropertyRegistration obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AnimatablePropertyRegistration() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AnimatablePropertyRegistration(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public AnimatablePropertyRegistration(TypeRegistration registered, string name, int index, PropertyType type) : this(NDalicPINVOKE.new_AnimatablePropertyRegistration__SWIG_0(TypeRegistration.getCPtr(registered), name, index, (int)type), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AnimatablePropertyRegistration(TypeRegistration registered, string name, int index, PropertyValue value) : this(NDalicPINVOKE.new_AnimatablePropertyRegistration__SWIG_1(TypeRegistration.getCPtr(registered), name, index, PropertyValue.getCPtr(value)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AnimationSignal.cs b/src/Tizen.NUI/src/internal/AnimationSignal.cs new file mode 100755 index 0000000..85d624d --- /dev/null +++ b/src/Tizen.NUI/src/internal/AnimationSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AnimationSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AnimationSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnimationSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AnimationSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AnimationSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.AnimationSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.AnimationSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AnimationSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.AnimationSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Animation arg) + { + NDalicPINVOKE.AnimationSignal_Emit(swigCPtr, Animation.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AnimationSignal() : this(NDalicPINVOKE.new_AnimationSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Any.cs b/src/Tizen.NUI/src/internal/Any.cs new file mode 100755 index 0000000..0bc189d --- /dev/null +++ b/src/Tizen.NUI/src/internal/Any.cs @@ -0,0 +1,294 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class Any : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Any(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Any obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Any() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Any(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public Any() : this(NDalicPINVOKE.new_Any__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void AssertAlways(string assertMessage) + { + NDalicPINVOKE.Any_AssertAlways(assertMessage); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Any(Any any) : this(NDalicPINVOKE.new_Any__SWIG_2(Any.getCPtr(any)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Any Assign(Any any) + { + Any ret = new Any(NDalicPINVOKE.Any_Assign(swigCPtr, Any.getCPtr(any)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_std__type_info GetType() + { + SWIGTYPE_p_std__type_info ret = new SWIGTYPE_p_std__type_info(NDalicPINVOKE.Any_GetType(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.Any_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public class AnyContainerBase : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AnyContainerBase(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AnyContainerBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AnyContainerBase() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Any_AnyContainerBase(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public AnyContainerBase(SWIGTYPE_p_std__type_info type, SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase cloneFunc, SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void deleteFunc) : this(NDalicPINVOKE.new_Any_AnyContainerBase(SWIGTYPE_p_std__type_info.getCPtr(type), SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.getCPtr(cloneFunc), SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.getCPtr(deleteFunc)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public SWIGTYPE_p_std__type_info GetType() + { + SWIGTYPE_p_std__type_info ret = new SWIGTYPE_p_std__type_info(NDalicPINVOKE.Any_AnyContainerBase_GetType(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_std__type_info mType + { + get + { + SWIGTYPE_p_std__type_info ret = new SWIGTYPE_p_std__type_info(NDalicPINVOKE.Any_AnyContainerBase_mType_get(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase mCloneFunc + { + set + { + NDalicPINVOKE.Any_AnyContainerBase_mCloneFunc_set(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Any_AnyContainerBase_mCloneFunc_get(swigCPtr); + SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void mDeleteFunc + { + set + { + NDalicPINVOKE.Any_AnyContainerBase_mDeleteFunc_set(swigCPtr, SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Any_AnyContainerBase_mDeleteFunc_get(swigCPtr); + SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + public Any.AnyContainerBase mContainer + { + set + { + NDalicPINVOKE.Any_mContainer_set(swigCPtr, Any.AnyContainerBase.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Any_mContainer_get(swigCPtr); + Any.AnyContainerBase ret = (cPtr == global::System.IntPtr.Zero) ? null : new Any.AnyContainerBase(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Application.cs b/src/Tizen.NUI/src/internal/Application.cs new file mode 100755 index 0000000..91b60e4 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Application.cs @@ -0,0 +1,1323 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + /** + * @brief Event arguments that passed via NUIApplicationInit signal + * + */ + internal class NUIApplicationInitEventArgs : EventArgs + { + private Application _application; + + /** + * @brief Application - is the application that is being initialized + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationTerminate signal + * + */ + internal class NUIApplicationTerminatingEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being Terminated + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationPause signal + * + */ + internal class NUIApplicationPausedEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being Paused + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationResume signal + * + */ + internal class NUIApplicationResumedEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being Resumed + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationReset signal + * + */ + internal class NUIApplicationResetEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being Reset + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationResize signal + * + */ + internal class NUIApplicationResizedEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being Resized + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationLanguageChanged signal + * + */ + internal class NUIApplicationLanguageChangedEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being affected with Device's language change + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationRegionChanged signal + * + */ + internal class NUIApplicationRegionChangedEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being affected with Device's region change + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationBatteryLow signal + * + */ + internal class NUIApplicationBatteryLowEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being affected when the battery level of the device is low + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationMemoryLow signal + * + */ + internal class NUIApplicationMemoryLowEventArgs : EventArgs + { + private Application _application; + /** + * @brief Application - is the application that is being affected when the memory level of the device is low + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + } + + /** + * @brief Event arguments that passed via NUIApplicationAppControl signal + * + */ + internal class NUIApplicationAppControlEventArgs : EventArgs + { + private Application _application; + private IntPtr _voidp; + /** + * @brief Application - is the application that is receiving the launch request from another application + * + */ + public Application Application + { + get + { + return _application; + } + set + { + _application = value; + } + } + /** + * @brief VoidP - contains the information about why the application is launched + * + */ + public IntPtr VoidP + { + get + { + return _voidp; + } + set + { + _voidp = value; + } + } + } + + internal class Application : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Application(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Application_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Application obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Application(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationInitEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationInitEventHandler; + private NUIApplicationInitEventCallbackDelegate _applicationInitEventCallbackDelegate; + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationTerminateEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationTerminateEventHandler; + private NUIApplicationTerminateEventCallbackDelegate _applicationTerminateEventCallbackDelegate; + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationPauseEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationPauseEventHandler; + private NUIApplicationPauseEventCallbackDelegate _applicationPauseEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationResumeEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResumeEventHandler; + private NUIApplicationResumeEventCallbackDelegate _applicationResumeEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationResetEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResetEventHandler; + private NUIApplicationResetEventCallbackDelegate _applicationResetEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationResizeEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationResizeEventHandler; + private NUIApplicationResizeEventCallbackDelegate _applicationResizeEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationLanguageChangedEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationLanguageChangedEventHandler; + private NUIApplicationLanguageChangedEventCallbackDelegate _applicationLanguageChangedEventCallbackDelegate; + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationRegionChangedEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationRegionChangedEventHandler; + private NUIApplicationRegionChangedEventCallbackDelegate _applicationRegionChangedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationBatteryLowEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationBatteryLowEventHandler; + private NUIApplicationBatteryLowEventCallbackDelegate _applicationBatteryLowEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationMemoryLowEventCallbackDelegate(IntPtr application); + private DaliEventHandler _applicationMemoryLowEventHandler; + private NUIApplicationMemoryLowEventCallbackDelegate _applicationMemoryLowEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NUIApplicationAppControlEventCallbackDelegate(IntPtr application, IntPtr voidp); + private DaliEventHandler _applicationAppControlEventHandler; + private NUIApplicationAppControlEventCallbackDelegate _applicationAppControlEventCallbackDelegate; + + /** + * @brief Event for Initialized signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationInitEventHandler - DaliEventHandler) + * provided by the user. Initialized signal is emitted when application is initialised + */ + public event DaliEventHandler Initialized + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationInitEventHandler == null) + { + _applicationInitEventHandler += value; + + _applicationInitEventCallbackDelegate = new NUIApplicationInitEventCallbackDelegate(OnApplicationInit); + this.InitSignal().Connect(_applicationInitEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationInitEventHandler != null) + { + this.InitSignal().Disconnect(_applicationInitEventCallbackDelegate); + } + + _applicationInitEventHandler -= value; + } + } + } + + // Callback for Application InitSignal + private void OnApplicationInit(IntPtr data) + { + // Initialize DisposeQueue Singleton class. This is also required to create DisposeQueue on main thread. + DisposeQueue.Instance.Initialize(); + NUIApplicationInitEventArgs e = new NUIApplicationInitEventArgs(); + + // Populate all members of "e" (NUIApplicationInitEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationInitEventHandler != null) + { + //here we send all data to user event handlers + _applicationInitEventHandler(this, e); + } + } + + /** + * @brief Event for Terminated signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationTerminateEventHandler-DaliEventHandler) + * provided by the user. Terminated signal is emitted when application is terminating + */ + public event DaliEventHandler Terminating + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationTerminateEventHandler == null) + { + _applicationTerminateEventHandler += value; + + _applicationTerminateEventCallbackDelegate = new NUIApplicationTerminateEventCallbackDelegate(OnNUIApplicationTerminate); + this.TerminateSignal().Connect(_applicationTerminateEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationTerminateEventHandler != null) + { + this.TerminateSignal().Disconnect(_applicationTerminateEventCallbackDelegate); + } + + _applicationTerminateEventHandler -= value; + } + } + } + + // Callback for Application TerminateSignal + private void OnNUIApplicationTerminate(IntPtr data) + { + NUIApplicationTerminatingEventArgs e = new NUIApplicationTerminatingEventArgs(); + + // Populate all members of "e" (NUIApplicationTerminateEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationTerminateEventHandler != null) + { + //here we send all data to user event handlers + _applicationTerminateEventHandler(this, e); + } + } + + /** + * @brief Event for Paused signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationPauseEventHandler-DaliEventHandler) + * provided by the user. Paused signal is emitted when application is paused + */ + public event DaliEventHandler Paused + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationPauseEventHandler == null) + { + _applicationPauseEventHandler += value; + + _applicationPauseEventCallbackDelegate = new NUIApplicationPauseEventCallbackDelegate(OnNUIApplicationPause); + this.PauseSignal().Connect(_applicationPauseEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationPauseEventHandler != null) + { + this.PauseSignal().Disconnect(_applicationPauseEventCallbackDelegate); + } + + _applicationPauseEventHandler -= value; + } + } + } + + // Callback for Application PauseSignal + private void OnNUIApplicationPause(IntPtr data) + { + NUIApplicationPausedEventArgs e = new NUIApplicationPausedEventArgs(); + + // Populate all members of "e" (NUIApplicationPauseEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationPauseEventHandler != null) + { + //here we send all data to user event handlers + _applicationPauseEventHandler(this, e); + } + } + + /** + * @brief Event for Resumed signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationResumeEventHandler-DaliEventHandler) + * provided by the user. Resumed signal is emitted when application is resumed + */ + public event DaliEventHandler Resumed + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationResumeEventHandler == null) + { + _applicationResumeEventHandler += value; + + _applicationResumeEventCallbackDelegate = new NUIApplicationResumeEventCallbackDelegate(OnNUIApplicationResume); + this.ResumeSignal().Connect(_applicationResumeEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationResumeEventHandler != null) + { + this.ResumeSignal().Disconnect(_applicationResumeEventCallbackDelegate); + } + + _applicationResumeEventHandler -= value; + } + } + } + + // Callback for Application ResumeSignal + private void OnNUIApplicationResume(IntPtr data) + { + NUIApplicationResumedEventArgs e = new NUIApplicationResumedEventArgs(); + + // Populate all members of "e" (NUIApplicationResumeEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationResumeEventHandler != null) + { + //here we send all data to user event handlers + _applicationResumeEventHandler(this, e); + } + } + + /** + * @brief Event for Reset signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationResetEventHandler-DaliEventHandler) + * provided by the user. Reset signal is emitted when application is reset + */ + public event DaliEventHandler Reset + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationResetEventHandler == null) + { + _applicationResetEventHandler += value; + + _applicationResetEventCallbackDelegate = new NUIApplicationResetEventCallbackDelegate(OnNUIApplicationReset); + this.ResetSignal().Connect(_applicationResetEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationResetEventHandler != null) + { + this.ResetSignal().Disconnect(_applicationResetEventCallbackDelegate); + } + + _applicationResetEventHandler -= value; + } + } + } + + // Callback for Application ResetSignal + private void OnNUIApplicationReset(IntPtr data) + { + NUIApplicationResetEventArgs e = new NUIApplicationResetEventArgs(); + + // Populate all members of "e" (NUIApplicationResetEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationResetEventHandler != null) + { + //here we send all data to user event handlers + _applicationResetEventHandler(this, e); + } + } + + /** + * @brief Event for Resized signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationResizeEventHandler-DaliEventHandler) + * provided by the user. Resized signal is emitted when application is resized + */ + public event DaliEventHandler Resized + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationResizeEventHandler == null) + { + _applicationResizeEventHandler += value; + + _applicationResizeEventCallbackDelegate = new NUIApplicationResizeEventCallbackDelegate(OnNUIApplicationResize); + this.ResizeSignal().Connect(_applicationResizeEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationResizeEventHandler != null) + { + this.ResizeSignal().Disconnect(_applicationResizeEventCallbackDelegate); + } + + _applicationResizeEventHandler -= value; + } + } + } + + // Callback for Application ResizeSignal + private void OnNUIApplicationResize(IntPtr data) + { + NUIApplicationResizedEventArgs e = new NUIApplicationResizedEventArgs(); + + // Populate all members of "e" (NUIApplicationResizeEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationResizeEventHandler != null) + { + //here we send all data to user event handlers + _applicationResizeEventHandler(this, e); + } + } + + /** + * @brief Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationLanguageChangedEventHandler-DaliEventHandler) + * provided by the user. LanguageChanged signal is emitted when the region of the device is changed. + */ + public event DaliEventHandler LanguageChanged + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationLanguageChangedEventHandler == null) + { + _applicationLanguageChangedEventHandler += value; + + _applicationLanguageChangedEventCallbackDelegate = new NUIApplicationLanguageChangedEventCallbackDelegate(OnNUIApplicationLanguageChanged); + this.LanguageChangedSignal().Connect(_applicationLanguageChangedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationLanguageChangedEventHandler != null) + { + this.LanguageChangedSignal().Disconnect(_applicationLanguageChangedEventCallbackDelegate); + } + + _applicationLanguageChangedEventHandler -= value; + } + } + } + + // Callback for Application LanguageChangedSignal + private void OnNUIApplicationLanguageChanged(IntPtr data) + { + NUIApplicationLanguageChangedEventArgs e = new NUIApplicationLanguageChangedEventArgs(); + + // Populate all members of "e" (NUIApplicationLanguageChangedEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationLanguageChangedEventHandler != null) + { + //here we send all data to user event handlers + _applicationLanguageChangedEventHandler(this, e); + } + } + + /** + * @brief Event for RegionChanged signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationRegionChangedEventHandler-DaliEventHandler) + * provided by the user. RegionChanged signal is emitted when the region of the device is changed. + */ + public event DaliEventHandler RegionChanged + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationRegionChangedEventHandler == null) + { + _applicationRegionChangedEventHandler += value; + + _applicationRegionChangedEventCallbackDelegate = new NUIApplicationRegionChangedEventCallbackDelegate(OnNUIApplicationRegionChanged); + this.RegionChangedSignal().Connect(_applicationRegionChangedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationRegionChangedEventHandler != null) + { + this.RegionChangedSignal().Disconnect(_applicationRegionChangedEventCallbackDelegate); + } + + _applicationRegionChangedEventHandler -= value; + } + } + } + + // Callback for Application RegionChangedSignal + private void OnNUIApplicationRegionChanged(IntPtr data) + { + NUIApplicationRegionChangedEventArgs e = new NUIApplicationRegionChangedEventArgs(); + + // Populate all members of "e" (NUIApplicationRegionChangedEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationRegionChangedEventHandler != null) + { + //here we send all data to user event handlers + _applicationRegionChangedEventHandler(this, e); + } + } + + /** + * @brief Event for BatteryLow signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationBatteryLowEventHandler-DaliEventHandler) + * provided by the user. BatteryLow signal is emitted when the battery level of the device is low. + */ + public event DaliEventHandler BatteryLow + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationBatteryLowEventHandler == null) + { + _applicationBatteryLowEventHandler += value; + + _applicationBatteryLowEventCallbackDelegate = new NUIApplicationBatteryLowEventCallbackDelegate(OnNUIApplicationBatteryLow); + this.BatteryLowSignal().Connect(_applicationBatteryLowEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationBatteryLowEventHandler != null) + { + this.BatteryLowSignal().Disconnect(_applicationBatteryLowEventCallbackDelegate); + } + + _applicationBatteryLowEventHandler -= value; + } + } + } + + // Callback for Application BatteryLowSignal + private void OnNUIApplicationBatteryLow(IntPtr data) + { + NUIApplicationBatteryLowEventArgs e = new NUIApplicationBatteryLowEventArgs(); + + // Populate all members of "e" (NUIApplicationBatteryLowEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationBatteryLowEventHandler != null) + { + //here we send all data to user event handlers + _applicationBatteryLowEventHandler(this, e); + } + } + + /** + * @brief Event for MemoryLow signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationMemoryLowEventHandler-DaliEventHandler) + * provided by the user. MemoryLow signal is emitted when the memory level of the device is low. + */ + public event DaliEventHandler MemoryLow + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationMemoryLowEventHandler == null) + { + _applicationMemoryLowEventHandler += value; + + _applicationMemoryLowEventCallbackDelegate = new NUIApplicationMemoryLowEventCallbackDelegate(OnNUIApplicationMemoryLow); + this.MemoryLowSignal().Connect(_applicationMemoryLowEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationMemoryLowEventHandler != null) + { + this.MemoryLowSignal().Disconnect(_applicationMemoryLowEventCallbackDelegate); + } + + _applicationMemoryLowEventHandler -= value; + } + } + } + + // Callback for Application MemoryLowSignal + private void OnNUIApplicationMemoryLow(IntPtr data) + { + NUIApplicationMemoryLowEventArgs e = new NUIApplicationMemoryLowEventArgs(); + + // Populate all members of "e" (NUIApplicationMemoryLowEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(data); + + if (_applicationMemoryLowEventHandler != null) + { + //here we send all data to user event handlers + _applicationMemoryLowEventHandler(this, e); + } + } + + /** + * @brief Event for AppControl signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NUIApplicationAppControlEventHandler-DaliEventHandler) + * provided by the user. AppControl signal is emitted when another application sends a launch request to the application. + */ + public event DaliEventHandler AppControl + { + add + { + lock (this) + { + // Restricted to only one listener + if (_applicationAppControlEventHandler == null) + { + _applicationAppControlEventHandler += value; + + _applicationAppControlEventCallbackDelegate = new NUIApplicationAppControlEventCallbackDelegate(OnNUIApplicationAppControl); + this.AppControlSignal().Connect(_applicationAppControlEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_applicationAppControlEventHandler != null) + { + this.AppControlSignal().Disconnect(_applicationAppControlEventCallbackDelegate); + } + + _applicationAppControlEventHandler -= value; + } + } + } + + // Callback for Application AppControlSignal + private void OnNUIApplicationAppControl(IntPtr application, IntPtr voidp) + { + NUIApplicationAppControlEventArgs e = new NUIApplicationAppControlEventArgs(); + + // Populate all members of "e" (NUIApplicationAppControlEventArgs) with real data + e.Application = Application.GetApplicationFromPtr(application); + e.VoidP = voidp; + + if (_applicationAppControlEventHandler != null) + { + //here we send all data to user event handlers + _applicationAppControlEventHandler(this, e); + } + } + + private static Application _instance; // singleton + + public delegate void InitDelegate(); + + public delegate void TerminateDelegate(); + + public delegate void PauseDelegate(); + + public delegate void ResumeDelegate(); + + public delegate void ResizeDelegate(); + + public delegate void AppControlDelegate(); + + public delegate void LanguageChangedDelegate(); + + public delegate void RegionChangedDelegate(); + + public delegate void BatteryLowDelegate(); + + public delegate void MemoryLowDelegate(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void InitDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void TerminateDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void PauseDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void ResumeDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void ResizeDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void AppControlDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void LanguageChangedDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void RegionChangedDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void BatteryLowDelegateInternal(); + + [System.Runtime.InteropServices.UnmanagedFunctionPointer(System.Runtime.InteropServices.CallingConvention.StdCall)] + internal delegate void MemoryLowDelegateInternal(); + + static void Initialization() + { + // instance.InitDelegate(); + } + + public static Application Instance + { + get + { + return _instance; + } + } + + public static Application GetApplicationFromPtr(global::System.IntPtr cPtr) + { + Application ret = new Application(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetupDelegates() + { + InitDelegateInternal initializeCallback = new InitDelegateInternal(Initialization); + + NUILog.Debug("InitSignal connection count"); + + this.InitSignal().Connect(initializeCallback); + + NUILog.Debug("InitSignal connection count = " + InitSignal().GetConnectionCount()); + } + + public static Application NewApplication() + { + _instance = NewApplication("", Application.WindowMode.Opaque); + return _instance; + } + + public static Application NewApplication(string stylesheet) + { + _instance = NewApplication(stylesheet, Application.WindowMode.Opaque); + return _instance; + } + + public static Application NewApplication(string stylesheet, Application.WindowMode windowMode) + { + // register all Views with the type registry, so that can be created / styled via JSON + //ViewRegistryHelper.Initialize(); //moved to Application side. + + Application ret = New(1, stylesheet, windowMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + // we've got an application now connect the signals + ret.SetupDelegates(); + // set the singleton + _instance = ret; + return ret; + } + + //Removed from v0.2.33 + /*public bool AddIdle(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip)); + + bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2)); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + }*/ + + + + /** + * Outer::outer_method(int) + */ + public static Application New() + { + NUILog.Debug("New() is called!"); + + Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_0(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Application New(int argc) + { + NUILog.Debug("New(int argc) is called!"); + + Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_1(argc), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Application New(int argc, string stylesheet) + { + NUILog.Debug("New(int argc, string stylesheet) is called!"); + + Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_2(argc, stylesheet), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Application New(int argc, string stylesheet, Application.WindowMode windowMode) + { + NUILog.Debug("New(int argc, string stylesheet, Application.WindowMode windowMode) is called!"); + + Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_3(argc, stylesheet, (int)windowMode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Application New(int argc, string stylesheet, Application.WindowMode windowMode, Rectangle positionSize) + { + Application ret = new Application(NDalicPINVOKE.Application_New__SWIG_4(argc, stylesheet, (int)windowMode, Rectangle.getCPtr(positionSize)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Application() : this(NDalicPINVOKE.new_Application__SWIG_0(), true) + { + NUILog.Debug("Application() is called!"); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Application(Application application) : this(NDalicPINVOKE.new_Application__SWIG_1(Application.getCPtr(application)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Application Assign(Application application) + { + Application ret = new Application(NDalicPINVOKE.Application_Assign(swigCPtr, Application.getCPtr(application)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void MainLoop() + { + NDalicPINVOKE.Application_MainLoop__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void MainLoop(SWIGTYPE_p_Configuration__ContextLoss configuration) + { + NDalicPINVOKE.Application_MainLoop__SWIG_1(swigCPtr, SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Lower() + { + NDalicPINVOKE.Application_Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Quit() + { + NDalicPINVOKE.Application_Quit(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback) + { + bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Window GetWindow() + { + Window ret = new Window(NDalicPINVOKE.Application_GetWindow(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ReplaceWindow(Rectangle windowPosition, string name) + { + NDalicPINVOKE.Application_ReplaceWindow(swigCPtr, Rectangle.getCPtr(windowPosition), name); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static string GetResourcePath() + { + string ret = NDalicPINVOKE.Application_GetResourcePath(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetViewMode(ViewMode viewMode) + { + NDalicPINVOKE.Application_SetViewMode(swigCPtr, (int)viewMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ViewMode GetViewMode() + { + ViewMode ret = (ViewMode)NDalicPINVOKE.Application_GetViewMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetStereoBase(float stereoBase) + { + NDalicPINVOKE.Application_SetStereoBase(swigCPtr, stereoBase); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetStereoBase() + { + float ret = NDalicPINVOKE.Application_GetStereoBase(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal InitSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_InitSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal TerminateSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_TerminateSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal PauseSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_PauseSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal ResumeSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResumeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal ResetSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResetSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal ResizeSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_ResizeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationControlSignal AppControlSignal() + { + ApplicationControlSignal ret = new ApplicationControlSignal(NDalicPINVOKE.Application_AppControlSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal LanguageChangedSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_LanguageChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal RegionChangedSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_RegionChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal BatteryLowSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_BatteryLowSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ApplicationSignal MemoryLowSignal() + { + ApplicationSignal ret = new ApplicationSignal(NDalicPINVOKE.Application_MemoryLowSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum WindowMode + { + Opaque = 0, + Transparent = 1 + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ApplicationControlSignal.cs b/src/Tizen.NUI/src/internal/ApplicationControlSignal.cs new file mode 100755 index 0000000..fba3f81 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ApplicationControlSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ApplicationControlSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ApplicationControlSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ApplicationControlSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ApplicationControlSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ApplicationControlSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ApplicationControlSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ApplicationControlSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ApplicationControlSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ApplicationControlSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Application arg1, System.IntPtr arg2) + { + NDalicPINVOKE.ApplicationControlSignal_Emit(swigCPtr, Application.getCPtr(arg1), arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ApplicationControlSignal() : this(NDalicPINVOKE.new_ApplicationControlSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ApplicationExtensions.cs b/src/Tizen.NUI/src/internal/ApplicationExtensions.cs new file mode 100755 index 0000000..bf5aace --- /dev/null +++ b/src/Tizen.NUI/src/internal/ApplicationExtensions.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ApplicationExtensions : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ApplicationExtensions(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ApplicationExtensions obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ApplicationExtensions() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ApplicationExtensions(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public ApplicationExtensions() : this(NDalicPINVOKE.new_ApplicationExtensions__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ApplicationExtensions(Application application) : this(NDalicPINVOKE.new_ApplicationExtensions__SWIG_1(Application.getCPtr(application)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Init() + { + NDalicPINVOKE.ApplicationExtensions_Init(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Start() + { + NDalicPINVOKE.ApplicationExtensions_Start(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Terminate() + { + NDalicPINVOKE.ApplicationExtensions_Terminate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Pause() + { + NDalicPINVOKE.ApplicationExtensions_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Resume() + { + NDalicPINVOKE.ApplicationExtensions_Resume(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void LanguageChange() + { + NDalicPINVOKE.ApplicationExtensions_LanguageChange(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ApplicationSignal.cs b/src/Tizen.NUI/src/internal/ApplicationSignal.cs new file mode 100755 index 0000000..6c97b0f --- /dev/null +++ b/src/Tizen.NUI/src/internal/ApplicationSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ApplicationSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ApplicationSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ApplicationSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ApplicationSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ApplicationSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ApplicationSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ApplicationSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ApplicationSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ApplicationSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Application arg) + { + NDalicPINVOKE.ApplicationSignal_Emit(swigCPtr, Application.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ApplicationSignal() : this(NDalicPINVOKE.new_ApplicationSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/AsyncImageLoader.cs b/src/Tizen.NUI/src/internal/AsyncImageLoader.cs new file mode 100755 index 0000000..d01e131 --- /dev/null +++ b/src/Tizen.NUI/src/internal/AsyncImageLoader.cs @@ -0,0 +1,138 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class AsyncImageLoader : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal AsyncImageLoader(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.AsyncImageLoader_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AsyncImageLoader obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AsyncImageLoader(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public AsyncImageLoader() : this(NDalicPINVOKE.AsyncImageLoader_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public AsyncImageLoader(AsyncImageLoader handle) : this(NDalicPINVOKE.new_AsyncImageLoader__SWIG_1(AsyncImageLoader.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AsyncImageLoader Assign(AsyncImageLoader handle) + { + AsyncImageLoader ret = new AsyncImageLoader(NDalicPINVOKE.AsyncImageLoader_Assign(swigCPtr, AsyncImageLoader.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static AsyncImageLoader DownCast(BaseHandle handle) + { + AsyncImageLoader ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as AsyncImageLoader; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint Load(string url) + { + uint ret = NDalicPINVOKE.AsyncImageLoader_Load__SWIG_0(swigCPtr, url); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint Load(string url, Uint16Pair dimensions) + { + uint ret = NDalicPINVOKE.AsyncImageLoader_Load__SWIG_1(swigCPtr, url, Uint16Pair.getCPtr(dimensions)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint Load(string url, Uint16Pair dimensions, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) + { + uint ret = NDalicPINVOKE.AsyncImageLoader_Load__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(dimensions), (int)fittingMode, (int)samplingMode, orientationCorrection); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Cancel(uint loadingTaskId) + { + bool ret = NDalicPINVOKE.AsyncImageLoader_Cancel(swigCPtr, loadingTaskId); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void CancelAll() + { + NDalicPINVOKE.AsyncImageLoader_CancelAll(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t ImageLoadedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t(NDalicPINVOKE.AsyncImageLoader_ImageLoadedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public AsyncImageLoader(SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader impl) : this(NDalicPINVOKE.new_AsyncImageLoader__SWIG_2(SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader.getCPtr(impl)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/BaseObject.cs b/src/Tizen.NUI/src/internal/BaseObject.cs new file mode 100755 index 0000000..5f7d219 --- /dev/null +++ b/src/Tizen.NUI/src/internal/BaseObject.cs @@ -0,0 +1,97 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class BaseObject : RefObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal BaseObject(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.BaseObject_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BaseObject obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //you can override it to clean-up your own resources. + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public bool DoAction(string actionName, PropertyMap attributes) + { + bool ret = NDalicPINVOKE.BaseObject_DoAction(swigCPtr, actionName, PropertyMap.getCPtr(attributes)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetTypeName() + { + string ret = NDalicPINVOKE.BaseObject_GetTypeName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool GetTypeInfo(TypeInfo info) + { + bool ret = NDalicPINVOKE.BaseObject_GetTypeInfo(swigCPtr, TypeInfo.getCPtr(info)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool DoConnectSignal(ConnectionTrackerInterface connectionTracker, string signalName, SWIGTYPE_p_FunctorDelegate functorDelegate) + { + bool ret = NDalicPINVOKE.BaseObject_DoConnectSignal(swigCPtr, ConnectionTrackerInterface.getCPtr(connectionTracker), signalName, SWIGTYPE_p_FunctorDelegate.getCPtr(functorDelegate)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/BlendEquationType.cs b/src/Tizen.NUI/src/internal/BlendEquationType.cs new file mode 100755 index 0000000..a9515a8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/BlendEquationType.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum BlendEquationType + { + ADD = 0x8006, + SUBTRACT = 0x800A, + REVERSE_SUBTRACT = 0x800B + } + +} diff --git a/src/Tizen.NUI/src/internal/BlendFactorType.cs b/src/Tizen.NUI/src/internal/BlendFactorType.cs new file mode 100755 index 0000000..8842930 --- /dev/null +++ b/src/Tizen.NUI/src/internal/BlendFactorType.cs @@ -0,0 +1,39 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum BlendFactorType + { + ZERO = 0, + ONE = 1, + SRC_COLOR = 0x0300, + ONE_MINUS_SRC_COLOR = 0x0301, + SRC_ALPHA = 0x0302, + ONE_MINUS_SRC_ALPHA = 0x0303, + DST_ALPHA = 0x0304, + ONE_MINUS_DST_ALPHA = 0x0305, + DST_COLOR = 0x0306, + ONE_MINUS_DST_COLOR = 0x0307, + SRC_ALPHA_SATURATE = 0x0308, + CONSTANT_COLOR = 0x8001, + ONE_MINUS_CONSTANT_COLOR = 0x8002, + CONSTANT_ALPHA = 0x8003, + ONE_MINUS_CONSTANT_ALPHA = 0x8004 + } + +} diff --git a/src/Tizen.NUI/src/internal/BlendModeType.cs b/src/Tizen.NUI/src/internal/BlendModeType.cs new file mode 100755 index 0000000..db96801 --- /dev/null +++ b/src/Tizen.NUI/src/internal/BlendModeType.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum BlendModeType + { + OFF, + AUTO, + ON + } + +} diff --git a/src/Tizen.NUI/src/internal/BufferImage.cs b/src/Tizen.NUI/src/internal/BufferImage.cs new file mode 100755 index 0000000..0f15466 --- /dev/null +++ b/src/Tizen.NUI/src/internal/BufferImage.cs @@ -0,0 +1,170 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class BufferImage : Image + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal BufferImage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.BufferImage_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BufferImage obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_BufferImage(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public BufferImage(uint width, uint height, PixelFormat pixelformat) : this(NDalicPINVOKE.BufferImage_New__SWIG_0(width, height, (int)pixelformat), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public BufferImage(uint width, uint height) : this(NDalicPINVOKE.BufferImage_New__SWIG_1(width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public BufferImage(byte[] pixelBuffer, uint width, uint height, PixelFormat pixelFormat, uint stride) : this(NDalicPINVOKE.BufferImage_New__SWIG_2(pixelBuffer, width, height, (int)pixelFormat, stride), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public BufferImage(byte[] pixelBuffer, uint width, uint height, PixelFormat pixelFormat) : this(NDalicPINVOKE.BufferImage_New__SWIG_3(pixelBuffer, width, height, (int)pixelFormat), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public BufferImage(byte[] pixelBuffer, uint width, uint height) : this(NDalicPINVOKE.BufferImage_New__SWIG_4(pixelBuffer, width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static BufferImage DownCast(BaseHandle handle) + { + BufferImage ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as BufferImage; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public BufferImage(BufferImage handle) : this(NDalicPINVOKE.new_BufferImage__SWIG_1(BufferImage.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public BufferImage Assign(BufferImage rhs) + { + BufferImage ret = new BufferImage(NDalicPINVOKE.BufferImage_Assign(swigCPtr, BufferImage.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static BufferImage WHITE() + { + BufferImage ret = new BufferImage(NDalicPINVOKE.BufferImage_WHITE(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_unsigned_char GetBuffer() + { + global::System.IntPtr cPtr = NDalicPINVOKE.BufferImage_GetBuffer(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetBufferSize() + { + uint ret = NDalicPINVOKE.BufferImage_GetBufferSize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetBufferStride() + { + uint ret = NDalicPINVOKE.BufferImage_GetBufferStride(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PixelFormat GetPixelFormat() + { + PixelFormat ret = (PixelFormat)NDalicPINVOKE.BufferImage_GetPixelFormat(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Update() + { + NDalicPINVOKE.BufferImage_Update__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Update(SWIGTYPE_p_Dali__RectT_unsigned_int_t updateArea) + { + NDalicPINVOKE.BufferImage_Update__SWIG_1(swigCPtr, SWIGTYPE_p_Dali__RectT_unsigned_int_t.getCPtr(updateArea)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsDataExternal() + { + bool ret = NDalicPINVOKE.BufferImage_IsDataExternal(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Builder.cs b/src/Tizen.NUI/src/internal/Builder.cs new file mode 100755 index 0000000..aaa87be --- /dev/null +++ b/src/Tizen.NUI/src/internal/Builder.cs @@ -0,0 +1,316 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + + internal class Builder : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Builder(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Builder_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Builder obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Builder(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class QuitEventArgs : EventArgs + { + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void QuitEventCallbackDelegate(); + private DaliEventHandler _builderQuitEventHandler; + private QuitEventCallbackDelegate _builderQuitEventCallbackDelegate; + + public event DaliEventHandler Quit + { + add + { + lock (this) + { + // Restricted to only one listener + if (_builderQuitEventHandler == null) + { + _builderQuitEventHandler += value; + + _builderQuitEventCallbackDelegate = new QuitEventCallbackDelegate(OnQuit); + this.QuitSignal().Connect(_builderQuitEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_builderQuitEventHandler != null) + { + this.QuitSignal().Disconnect(_builderQuitEventCallbackDelegate); + } + + _builderQuitEventHandler -= value; + } + } + } + + // Callback for Builder QuitSignal + private void OnQuit() + { + QuitEventArgs e = new QuitEventArgs(); + + if (_builderQuitEventHandler != null) + { + //here we send all data to user event handlers + _builderQuitEventHandler(this, e); + } + } + + /// + public void LoadFromFile(string fileName) + { + try + { + string json = System.IO.File.ReadAllText(fileName); + if (json.Length > 0) + { + LoadFromString(json); + } + else + { + throw new global::System.InvalidOperationException("Failed to load file " + fileName); + + } + } + catch (System.Exception e) + { + throw new global::System.InvalidOperationException("Failed to parse " + fileName); + } + } + + + + public Builder() : this(NDalicPINVOKE.Builder_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public void LoadFromString(string data, Builder.UIFormat format) + { + NDalicPINVOKE.Builder_LoadFromString__SWIG_0(swigCPtr, data, (int)format); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void LoadFromString(string data) + { + NDalicPINVOKE.Builder_LoadFromString__SWIG_1(swigCPtr, data); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddConstants(PropertyMap map) + { + NDalicPINVOKE.Builder_AddConstants(swigCPtr, PropertyMap.getCPtr(map)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddConstant(string key, PropertyValue value) + { + NDalicPINVOKE.Builder_AddConstant(swigCPtr, key, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyMap GetConstants() + { + PropertyMap ret = new PropertyMap(NDalicPINVOKE.Builder_GetConstants(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyValue GetConstant(string key) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Builder_GetConstant(swigCPtr, key), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animation CreateAnimation(string animationName) + { + Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_0(swigCPtr, animationName), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animation CreateAnimation(string animationName, PropertyMap map) + { + Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_1(swigCPtr, animationName, PropertyMap.getCPtr(map)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animation CreateAnimation(string animationName, View sourceActor) + { + Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_2(swigCPtr, animationName, View.getCPtr(sourceActor)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animation CreateAnimation(string animationName, PropertyMap map, View sourceActor) + { + Animation ret = new Animation(NDalicPINVOKE.Builder_CreateAnimation__SWIG_3(swigCPtr, animationName, PropertyMap.getCPtr(map), View.getCPtr(sourceActor)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View Create(string templateName) + { + View ret = new View(NDalicPINVOKE.Builder_Create__SWIG_0(swigCPtr, templateName), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public BaseHandle Create(string templateName, PropertyMap map) + { + BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_Create__SWIG_1(swigCPtr, templateName, PropertyMap.getCPtr(map)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public BaseHandle CreateFromJson(string json) + { + BaseHandle ret = new BaseHandle(NDalicPINVOKE.Builder_CreateFromJson(swigCPtr, json), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool ApplyStyle(string styleName, Animatable handle) + { + bool ret = NDalicPINVOKE.Builder_ApplyStyle(swigCPtr, styleName, Animatable.getCPtr(handle)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool ApplyFromJson(Animatable handle, string json) + { + bool ret = NDalicPINVOKE.Builder_ApplyFromJson(swigCPtr, Animatable.getCPtr(handle), json); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void AddViews(View toActor) + { + NDalicPINVOKE.Builder_AddActors__SWIG_0(swigCPtr, View.getCPtr(toActor)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddViews(string sectionName, View toActor) + { + NDalicPINVOKE.Builder_AddActors__SWIG_1(swigCPtr, sectionName, View.getCPtr(toActor)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void CreateRenderTask(string name) + { + NDalicPINVOKE.Builder_CreateRenderTask(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal FrameBufferImage GetFrameBufferImage(string name) + { + FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.Builder_GetFrameBufferImage(swigCPtr, name), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Path GetPath(string name) + { + Path ret = new Path(NDalicPINVOKE.Builder_GetPath(swigCPtr, name), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal PathConstrainer GetPathConstrainer(string pathConstrainerName) + { + PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.Builder_GetPathConstrainer(swigCPtr, pathConstrainerName), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal LinearConstrainer GetLinearConstrainer(string linearConstrainerName) + { + LinearConstrainer ret = new LinearConstrainer(NDalicPINVOKE.Builder_GetLinearConstrainer(swigCPtr, linearConstrainerName), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal QuitSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Builder_QuitSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum UIFormat + { + JSON + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ButtonSignal.cs b/src/Tizen.NUI/src/internal/ButtonSignal.cs new file mode 100755 index 0000000..a6fc806 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ButtonSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ButtonSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ButtonSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ButtonSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ButtonSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ButtonSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ButtonSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ButtonSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ButtonSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ButtonSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(Tizen.NUI.UIComponents.Button arg) + { + bool ret = NDalicPINVOKE.ButtonSignal_Emit(swigCPtr, Tizen.NUI.UIComponents.Button.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ButtonSignal() : this(NDalicPINVOKE.new_ButtonSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Camera.cs b/src/Tizen.NUI/src/internal/Camera.cs new file mode 100755 index 0000000..f43ba7f --- /dev/null +++ b/src/Tizen.NUI/src/internal/Camera.cs @@ -0,0 +1,500 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class Camera : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Camera(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CameraActor_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Camera obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_CameraActor(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_CameraActor_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public Property() : this(NDalicPINVOKE.new_CameraActor_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int TYPE = NDalicPINVOKE.CameraActor_Property_TYPE_get(); + public static readonly int PROJECTION_MODE = NDalicPINVOKE.CameraActor_Property_PROJECTION_MODE_get(); + public static readonly int FIELD_OF_VIEW = NDalicPINVOKE.CameraActor_Property_FIELD_OF_VIEW_get(); + public static readonly int ASPECT_RATIO = NDalicPINVOKE.CameraActor_Property_ASPECT_RATIO_get(); + public static readonly int NEAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_NEAR_PLANE_DISTANCE_get(); + public static readonly int FAR_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_FAR_PLANE_DISTANCE_get(); + public static readonly int LEFT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_LEFT_PLANE_DISTANCE_get(); + public static readonly int RIGHT_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_RIGHT_PLANE_DISTANCE_get(); + public static readonly int TOP_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_TOP_PLANE_DISTANCE_get(); + public static readonly int BOTTOM_PLANE_DISTANCE = NDalicPINVOKE.CameraActor_Property_BOTTOM_PLANE_DISTANCE_get(); + public static readonly int TARGET_POSITION = NDalicPINVOKE.CameraActor_Property_TARGET_POSITION_get(); + public static readonly int PROJECTION_MATRIX = NDalicPINVOKE.CameraActor_Property_PROJECTION_MATRIX_get(); + public static readonly int VIEW_MATRIX = NDalicPINVOKE.CameraActor_Property_VIEW_MATRIX_get(); + public static readonly int INVERT_Y_AXIS = NDalicPINVOKE.CameraActor_Property_INVERT_Y_AXIS_get(); + + } + + public Camera() : this(NDalicPINVOKE.CameraActor_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Camera(Vector2 size) : this(NDalicPINVOKE.CameraActor_New__SWIG_1(Vector2.getCPtr(size)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static Camera DownCast(BaseHandle handle) + { + Camera ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Camera; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Camera(Camera copy) : this(NDalicPINVOKE.new_CameraActor__SWIG_1(Camera.getCPtr(copy)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Camera Assign(Camera rhs) + { + Camera ret = new Camera(NDalicPINVOKE.CameraActor_Assign(swigCPtr, Camera.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetType(CameraType type) + { + NDalicPINVOKE.CameraActor_SetType(swigCPtr, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public CameraType GetType() + { + CameraType ret = (CameraType)NDalicPINVOKE.CameraActor_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetProjectionMode(ProjectionMode mode) + { + NDalicPINVOKE.CameraActor_SetProjectionMode(swigCPtr, (int)mode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ProjectionMode GetProjectionMode() + { + ProjectionMode ret = (ProjectionMode)NDalicPINVOKE.CameraActor_GetProjectionMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFieldOfView(float fieldOfView) + { + NDalicPINVOKE.CameraActor_SetFieldOfView(swigCPtr, fieldOfView); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetFieldOfView() + { + float ret = NDalicPINVOKE.CameraActor_GetFieldOfView(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAspectRatio(float aspectRatio) + { + NDalicPINVOKE.CameraActor_SetAspectRatio(swigCPtr, aspectRatio); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetAspectRatio() + { + float ret = NDalicPINVOKE.CameraActor_GetAspectRatio(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetNearClippingPlane(float nearClippingPlane) + { + NDalicPINVOKE.CameraActor_SetNearClippingPlane(swigCPtr, nearClippingPlane); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetNearClippingPlane() + { + float ret = NDalicPINVOKE.CameraActor_GetNearClippingPlane(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFarClippingPlane(float farClippingPlane) + { + NDalicPINVOKE.CameraActor_SetFarClippingPlane(swigCPtr, farClippingPlane); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetFarClippingPlane() + { + float ret = NDalicPINVOKE.CameraActor_GetFarClippingPlane(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetTargetPosition(Vector3 targetPosition) + { + NDalicPINVOKE.CameraActor_SetTargetPosition(swigCPtr, Vector3.getCPtr(targetPosition)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector3 GetTargetPosition() + { + Vector3 ret = new Vector3(NDalicPINVOKE.CameraActor_GetTargetPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetInvertYAxis(bool invertYAxis) + { + NDalicPINVOKE.CameraActor_SetInvertYAxis(swigCPtr, invertYAxis); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetInvertYAxis() + { + bool ret = NDalicPINVOKE.CameraActor_GetInvertYAxis(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetPerspectiveProjection(Vector2 size) + { + NDalicPINVOKE.CameraActor_SetPerspectiveProjection(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetOrthographicProjection(Vector2 size) + { + NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_0(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetOrthographicProjection(float left, float right, float top, float bottom, float near, float far) + { + NDalicPINVOKE.CameraActor_SetOrthographicProjection__SWIG_1(swigCPtr, left, right, top, bottom, near, far); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string Type + { + get + { + string temp; + GetProperty(Camera.Property.TYPE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.TYPE, new Tizen.NUI.PropertyValue(value)); + } + } + public string ProjectionMode + { + get + { + string temp; + GetProperty(Camera.Property.PROJECTION_MODE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.PROJECTION_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public float FieldOfView + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.FIELD_OF_VIEW).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.FIELD_OF_VIEW, new Tizen.NUI.PropertyValue(value)); + } + } + public float AspectRatio + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.ASPECT_RATIO).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.ASPECT_RATIO, new Tizen.NUI.PropertyValue(value)); + } + } + public float NearPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.NEAR_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.NEAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float FarPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.FAR_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.FAR_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float LeftPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.LEFT_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.LEFT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float RightPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.RIGHT_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.RIGHT_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float TopPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.TOP_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.TOP_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float BottomPlaneDistance + { + get + { + float temp = 0.0f; + GetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.BOTTOM_PLANE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector3 TargetPosition + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(Camera.Property.TARGET_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(Camera.Property.TARGET_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + internal Matrix ProjectionMatrix + { + get + { + Matrix temp = new Matrix(); + GetProperty(Camera.Property.PROJECTION_MATRIX).Get(temp); + return temp; + } + } + internal Matrix ViewMatrix + { + get + { + Matrix temp = new Matrix(); + GetProperty(Camera.Property.VIEW_MATRIX).Get(temp); + return temp; + } + } + public bool InvertYAxis + { + get + { + bool temp = false; + GetProperty(Camera.Property.INVERT_Y_AXIS).Get(out temp); + return temp; + } + set + { + SetProperty(Camera.Property.INVERT_Y_AXIS, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ChildPropertyRegistration.cs b/src/Tizen.NUI/src/internal/ChildPropertyRegistration.cs new file mode 100755 index 0000000..773d061 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ChildPropertyRegistration.cs @@ -0,0 +1,109 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ChildPropertyRegistration : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ChildPropertyRegistration(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ChildPropertyRegistration obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ChildPropertyRegistration() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ChildPropertyRegistration(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public ChildPropertyRegistration(TypeRegistration registered, string name, int index, PropertyType type) : this(NDalicPINVOKE.new_ChildPropertyRegistration(TypeRegistration.getCPtr(registered), name, index, (int)type), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ConnectionTracker.cs b/src/Tizen.NUI/src/internal/ConnectionTracker.cs new file mode 100755 index 0000000..165375f --- /dev/null +++ b/src/Tizen.NUI/src/internal/ConnectionTracker.cs @@ -0,0 +1,93 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ConnectionTracker : ConnectionTrackerInterface + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ConnectionTracker(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ConnectionTracker_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ConnectionTracker obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ConnectionTracker(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public void DisconnectAll() + { + NDalicPINVOKE.ConnectionTracker_DisconnectAll(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicPINVOKE.ConnectionTracker_SignalConnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicPINVOKE.ConnectionTracker_SignalDisconnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ConnectionTracker_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ConnectionTrackerInterface.cs b/src/Tizen.NUI/src/internal/ConnectionTrackerInterface.cs new file mode 100755 index 0000000..3505e46 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ConnectionTrackerInterface.cs @@ -0,0 +1,77 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class ConnectionTrackerInterface : SignalObserver + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ConnectionTrackerInterface(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ConnectionTrackerInterface_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ConnectionTrackerInterface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ConnectionTrackerInterface(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public virtual void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_CallbackBase callback) + { + NDalicPINVOKE.ConnectionTrackerInterface_SignalConnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ControlKeySignal.cs b/src/Tizen.NUI/src/internal/ControlKeySignal.cs new file mode 100755 index 0000000..10ffc54 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ControlKeySignal.cs @@ -0,0 +1,151 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class ControlKeySignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ControlKeySignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ControlKeySignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ControlKeySignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ControlKeySignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ControlKeySignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ControlKeySignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ControlKeySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ControlKeySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(View arg1, Key arg2) + { + bool ret = NDalicPINVOKE.ControlKeySignal_Emit(swigCPtr, View.getCPtr(arg1), Key.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ControlKeySignal() : this(NDalicPINVOKE.new_ControlKeySignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/CustomActor.cs b/src/Tizen.NUI/src/internal/CustomActor.cs new file mode 100755 index 0000000..6f7bf4d --- /dev/null +++ b/src/Tizen.NUI/src/internal/CustomActor.cs @@ -0,0 +1,104 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class CustomActor : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal CustomActor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CustomActor_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CustomActor obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_CustomActor(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public CustomActor() : this(NDalicPINVOKE.new_CustomActor__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new static CustomActor DownCast(BaseHandle handle) + { + CustomActor ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as CustomActor; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public CustomActorImpl GetImplementation() + { + CustomActorImpl ret = new CustomActorImpl(NDalicPINVOKE.CustomActor_GetImplementation(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public CustomActor(CustomActorImpl implementation) : this(NDalicPINVOKE.new_CustomActor__SWIG_1(CustomActorImpl.getCPtr(implementation)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public CustomActor(CustomActor copy) : this(NDalicPINVOKE.new_CustomActor__SWIG_2(CustomActor.getCPtr(copy)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public CustomActor Assign(CustomActor rhs) + { + CustomActor ret = new CustomActor(NDalicPINVOKE.CustomActor_Assign(swigCPtr, CustomActor.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/CustomActorImpl.cs b/src/Tizen.NUI/src/internal/CustomActorImpl.cs new file mode 100755 index 0000000..0bd19a1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/CustomActorImpl.cs @@ -0,0 +1,239 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class CustomActorImpl : RefObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal CustomActorImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CustomActorImpl_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CustomActorImpl obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal CustomActor Self() + { + CustomActor ret = new CustomActor(NDalicPINVOKE.CustomActorImpl_Self(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnStageConnection(int depth) + { + NDalicPINVOKE.CustomActorImpl_OnStageConnection(swigCPtr, depth); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnStageDisconnection() + { + NDalicPINVOKE.CustomActorImpl_OnStageDisconnection(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnChildAdd(View child) + { + NDalicPINVOKE.CustomActorImpl_OnChildAdd(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnChildRemove(View child) + { + NDalicPINVOKE.CustomActorImpl_OnChildRemove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnPropertySet(int index, PropertyValue propertyValue) + { + NDalicPINVOKE.CustomActorImpl_OnPropertySet(swigCPtr, index, PropertyValue.getCPtr(propertyValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnSizeSet(Vector3 targetSize) + { + NDalicPINVOKE.CustomActorImpl_OnSizeSet(swigCPtr, Vector3.getCPtr(targetSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize) + { + NDalicPINVOKE.CustomActorImpl_OnSizeAnimation(swigCPtr, Animation.getCPtr(animation), Vector3.getCPtr(targetSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal virtual bool OnTouchEvent(SWIGTYPE_p_Dali__TouchEvent arg0) + { + bool ret = NDalicPINVOKE.CustomActorImpl_OnTouchEvent(swigCPtr, SWIGTYPE_p_Dali__TouchEvent.getCPtr(arg0)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnHoverEvent(Hover arg0) + { + bool ret = NDalicPINVOKE.CustomActorImpl_OnHoverEvent(swigCPtr, Hover.getCPtr(arg0)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnKeyEvent(Key arg0) + { + bool ret = NDalicPINVOKE.CustomActorImpl_OnKeyEvent(swigCPtr, Key.getCPtr(arg0)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnWheelEvent(Wheel arg0) + { + bool ret = NDalicPINVOKE.CustomActorImpl_OnWheelEvent(swigCPtr, Wheel.getCPtr(arg0)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnRelayout(Vector2 size, RelayoutContainer container) + { + NDalicPINVOKE.CustomActorImpl_OnRelayout(swigCPtr, Vector2.getCPtr(size), RelayoutContainer.getCPtr(container)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + NDalicPINVOKE.CustomActorImpl_OnSetResizePolicy(swigCPtr, (int)policy, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual Vector3 GetNaturalSize() + { + Vector3 ret = new Vector3(NDalicPINVOKE.CustomActorImpl_GetNaturalSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float CalculateChildSize(View child, DimensionType dimension) + { + float ret = NDalicPINVOKE.CustomActorImpl_CalculateChildSize(swigCPtr, View.getCPtr(child), (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetHeightForWidth(float width) + { + float ret = NDalicPINVOKE.CustomActorImpl_GetHeightForWidth(swigCPtr, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetWidthForHeight(float height) + { + float ret = NDalicPINVOKE.CustomActorImpl_GetWidthForHeight(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool RelayoutDependentOnChildren(DimensionType dimension) + { + bool ret = NDalicPINVOKE.CustomActorImpl_RelayoutDependentOnChildren__SWIG_0(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool RelayoutDependentOnChildren() + { + bool ret = NDalicPINVOKE.CustomActorImpl_RelayoutDependentOnChildren__SWIG_1(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnCalculateRelayoutSize(DimensionType dimension) + { + NDalicPINVOKE.CustomActorImpl_OnCalculateRelayoutSize(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnLayoutNegotiated(float size, DimensionType dimension) + { + NDalicPINVOKE.CustomActorImpl_OnLayoutNegotiated(swigCPtr, size, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool RequiresTouchEvents() + { + bool ret = NDalicPINVOKE.CustomActorImpl_RequiresTouchEvents(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool RequiresHoverEvents() + { + bool ret = NDalicPINVOKE.CustomActorImpl_RequiresHoverEvents(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool RequiresWheelEvents() + { + bool ret = NDalicPINVOKE.CustomActorImpl_RequiresWheelEvents(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsRelayoutEnabled() + { + bool ret = NDalicPINVOKE.CustomActorImpl_IsRelayoutEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs new file mode 100755 index 0000000..0749e24 --- /dev/null +++ b/src/Tizen.NUI/src/internal/CustomAlgorithmInterface.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System.Reflection; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class CustomAlgorithmInterface : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal CustomAlgorithmInterface(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CustomAlgorithmInterface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~CustomAlgorithmInterface() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_CustomAlgorithmInterface(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public virtual View GetNextFocusableView(View current, View proposed, View.FocusDirection direction) + { + View ret = new View(NDalicPINVOKE.CustomAlgorithmInterface_GetNextFocusableActor(swigCPtr, View.getCPtr(current), View.getCPtr(proposed), (int)direction), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal CustomAlgorithmInterface() : this(NDalicPINVOKE.new_CustomAlgorithmInterface(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + SwigDirectorConnect(); + } + + private void SwigDirectorConnect() + { + if (SwigDerivedClassHasMethod("GetNextFocusableView", swigMethodTypes0)) + swigDelegate0 = new SwigDelegateCustomAlgorithmInterface_0(SwigDirectorGetNextFocusableView); + NDalicPINVOKE.CustomAlgorithmInterface_director_connect(swigCPtr, swigDelegate0); + } + + private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) + { + global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); + bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(CustomAlgorithmInterface)); + return hasDerivedMethod && (methodInfo != null); + } + + private global::System.IntPtr SwigDirectorGetNextFocusableView(global::System.IntPtr current, global::System.IntPtr proposed, int direction) + { + View currentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + View proposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View; + + return View.getCPtr(GetNextFocusableView(currentView, proposedView, (View.FocusDirection)direction)).Handle; + } + + internal delegate global::System.IntPtr SwigDelegateCustomAlgorithmInterface_0(global::System.IntPtr current, global::System.IntPtr proposed, int direction); + + private SwigDelegateCustomAlgorithmInterface_0 swigDelegate0; + + private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(View), typeof(View), typeof(View.FocusDirection) }; + } + +} diff --git a/src/Tizen.NUI/src/internal/DaliEnumConstants.cs b/src/Tizen.NUI/src/internal/DaliEnumConstants.cs new file mode 100755 index 0000000..58320ba --- /dev/null +++ b/src/Tizen.NUI/src/internal/DaliEnumConstants.cs @@ -0,0 +1,110 @@ +/** Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Reflection; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace Tizen.NUI +{ + namespace Constants + { + /// + /// Enumeration for texture types. + /// + public enum TextureType + { + Texture2D = Tizen.NUI.TextureType.TEXTURE_2D, ///< One 2D image + TextureCube = Tizen.NUI.TextureType.TEXTURE_CUBE ///< Six 2D images arranged in a cube-shape + } + + /// + /// Enumeration for stereoscopic view modes. + /// + public enum ViewMode + { + Mono = Tizen.NUI.ViewMode.MONO, ///< Monoscopic (single camera). This is the default. + StereoHorizontal = Tizen.NUI.ViewMode.STEREO_HORIZONTAL, ///< Stereoscopic. Frame buffer is split horizontally with the left and right camera views in their respective sides. + StereoVertical = Tizen.NUI.ViewMode.STEREO_VERTICAL, ///< Stereoscopic. Frame buffer is split vertically with the left camera view at the top and the right camera view at the bottom. + StereoInterlaced = Tizen.NUI.ViewMode.STEREO_INTERLACED ///< Stereoscopic. Left/Right camera views are rendered into the framebuffer on alternate frames. + } + + public struct Direction + { + public enum Type + { + LeftToRight = Tizen.NUI.DirectionType.LEFT_TO_RIGHT, + RightToLeft = Tizen.NUI.DirectionType.RIGHT_TO_LEFT + } + } + + + + + public struct Tooltip + { + public struct Property + { + public static readonly int Content = NDalic.TOOLTIP_CONTENT; + public static readonly int Layout = NDalic.TOOLTIP_LAYOUT; + public static readonly int WaitTime = NDalic.TOOLTIP_WAIT_TIME; + public static readonly int Background = NDalic.TOOLTIP_BACKGROUND; + public static readonly int Tail = NDalic.TOOLTIP_TAIL; + public static readonly int Position = NDalic.TOOLTIP_POSITION; + public static readonly int HoverPointOffset = NDalic.TOOLTIP_HOVER_POINT_OFFSET; + public static readonly int MovementThreshold = NDalic.TOOLTIP_MOVEMENT_THRESHOLD; + public static readonly int DisappearOnMovement = NDalic.TOOLTIP_DISAPPEAR_ON_MOVEMENT; + } + + public struct BackgroundProperty + { + public static readonly int Visual = NDalic.TOOLTIP_BACKGROUND_VISUAL; + public static readonly int Border = NDalic.TOOLTIP_BACKGROUND_BORDER; + } + + public struct TailProperty + { + public static readonly int Visibility = NDalic.TOOLTIP_TAIL_VISIBILITY; + public static readonly int AboveVisual = NDalic.TOOLTIP_TAIL_ABOVE_VISUAL; + public static readonly int BelowVisual = NDalic.TOOLTIP_TAIL_BELOW_VISUAL; + } + } + } // namespace Constants + + +internal class NUILog +{ + [Conditional("DEBUG_ON")] + public static void Debug(string msg, + [CallerLineNumber] int lineNum = 0, + [CallerMemberName] string caller = null, + [CallerFilePath] string file = null + ) + { + Tizen.Log.Debug("NUI", $"{msg} (at {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")} line {lineNum} of {caller} in {file})" ); + } + + public static void Error(string msg, + [CallerLineNumber] int lineNum = 0, + [CallerMemberName] string caller = null, + [CallerFilePath] string file = null + ) + { + Tizen.Log.Debug("NUI", $"[ERROR] {msg} (at {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")} line {lineNum} of {caller} in {file})" ); + } +} + +} // namesapce Dali diff --git a/src/Tizen.NUI/src/internal/DaliEventHandler.cs b/src/Tizen.NUI/src/internal/DaliEventHandler.cs new file mode 100755 index 0000000..45f5c7d --- /dev/null +++ b/src/Tizen.NUI/src/internal/DaliEventHandler.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate R DaliEventHandlerWithReturnType(T source, U e); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void EventCallbackDelegateType0(); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void EventCallbackDelegateType1(IntPtr arg1); + + + //this should be removed with EventHandler from .NET + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate void DaliEventHandler(T source, U e); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + public delegate R EventHandlerWithReturnType(T source, U e); + + +} diff --git a/src/Tizen.NUI/src/internal/DaliException.cs b/src/Tizen.NUI/src/internal/DaliException.cs new file mode 100755 index 0000000..8f29848 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DaliException.cs @@ -0,0 +1,139 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class DaliException : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal DaliException(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DaliException obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~DaliException() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_DaliException(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public DaliException(string location, string condition) : this(NDalicPINVOKE.new_DaliException(location, condition), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string location + { + set + { + NDalicPINVOKE.DaliException_location_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.DaliException_location_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public string condition + { + set + { + NDalicPINVOKE.DaliException_condition_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.DaliException_condition_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/DefaultItemLayoutProperty.cs b/src/Tizen.NUI/src/internal/DefaultItemLayoutProperty.cs new file mode 100755 index 0000000..0cd544e --- /dev/null +++ b/src/Tizen.NUI/src/internal/DefaultItemLayoutProperty.cs @@ -0,0 +1,50 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DefaultItemLayoutProperty + { + TYPE = 0, + ITEM_SIZE, + ORIENTATION, + GRID_COLUMN_NUMBER, + GRID_ROW_SPACING, + GRID_COLUMN_SPACING, + GRID_TOP_MARGIN, + GRID_BOTTOM_MARGIN, + GRID_SIDE_MARGIN, + GRID_SCROLL_SPEED_FACTOR, + GRID_MAXIMUM_SWIPE_SPEED, + GRID_ITEM_FLICK_ANIMATION_DURATION, + DEPTH_COLUMN_NUMBER, + DEPTH_ROW_NUMBER, + DEPTH_ROW_SPACING, + DEPTH_SCROLL_SPEED_FACTOR, + DEPTH_MAXIMUM_SWIPE_SPEED, + DEPTH_ITEM_FLICK_ANIMATION_DURATION, + DEPTH_TILT_ANGLE, + DEPTH_ITEM_TILT_ANGLE, + SPIRAL_ITEM_SPACING, + SPIRAL_SCROLL_SPEED_FACTOR, + SPIRAL_MAXIMUM_SWIPE_SPEED, + SPIRAL_ITEM_FLICK_ANIMATION_DURATION, + SPIRAL_REVOLUTION_DISTANCE, + SPIRAL_TOP_ITEM_ALIGNMENT + } + +} diff --git a/src/Tizen.NUI/src/internal/DefaultItemLayoutType.cs b/src/Tizen.NUI/src/internal/DefaultItemLayoutType.cs new file mode 100755 index 0000000..6b3c178 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DefaultItemLayoutType.cs @@ -0,0 +1,28 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DefaultItemLayoutType + { + DEPTH, + GRID, + LIST, + SPIRAL + } + +} diff --git a/src/Tizen.NUI/src/internal/DefaultRuler.cs b/src/Tizen.NUI/src/internal/DefaultRuler.cs new file mode 100755 index 0000000..15dcd2c --- /dev/null +++ b/src/Tizen.NUI/src/internal/DefaultRuler.cs @@ -0,0 +1,101 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class DefaultRuler : Ruler + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal DefaultRuler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.DefaultRuler_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DefaultRuler obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_DefaultRuler(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public DefaultRuler() : this(NDalicPINVOKE.new_DefaultRuler(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public override float Snap(float x, float bias) + { + float ret = NDalicPINVOKE.DefaultRuler_Snap(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = NDalicPINVOKE.DefaultRuler_GetPositionFromPage(swigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override uint GetPageFromPosition(float position, bool wrap) + { + uint ret = NDalicPINVOKE.DefaultRuler_GetPageFromPosition(swigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override uint GetTotalPages() + { + uint ret = NDalicPINVOKE.DefaultRuler_GetTotalPages(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/DepthFunctionType.cs b/src/Tizen.NUI/src/internal/DepthFunctionType.cs new file mode 100755 index 0000000..61975b2 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DepthFunctionType.cs @@ -0,0 +1,32 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DepthFunctionType + { + NEVER, + ALWAYS, + LESS, + GREATER, + EQUAL, + NOT_EQUAL, + LESS_EQUAL, + GREATER_EQUAL + } + +} diff --git a/src/Tizen.NUI/src/internal/DepthTestModeType.cs b/src/Tizen.NUI/src/internal/DepthTestModeType.cs new file mode 100755 index 0000000..900cefa --- /dev/null +++ b/src/Tizen.NUI/src/internal/DepthTestModeType.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DepthTestModeType + { + OFF, + AUTO, + ON + } + +} diff --git a/src/Tizen.NUI/src/internal/DepthWriteModeType.cs b/src/Tizen.NUI/src/internal/DepthWriteModeType.cs new file mode 100755 index 0000000..b4b05bb --- /dev/null +++ b/src/Tizen.NUI/src/internal/DepthWriteModeType.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DepthWriteModeType + { + OFF, + AUTO, + ON + } + +} diff --git a/src/Tizen.NUI/src/internal/DirectionType.cs b/src/Tizen.NUI/src/internal/DirectionType.cs new file mode 100755 index 0000000..c789f75 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DirectionType.cs @@ -0,0 +1,26 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum DirectionType + { + LEFT_TO_RIGHT = 0, + RIGHT_TO_LEFT + } + +} diff --git a/src/Tizen.NUI/src/internal/DisposeQueue.cs b/src/Tizen.NUI/src/internal/DisposeQueue.cs new file mode 100755 index 0000000..7c06194 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DisposeQueue.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +// PROPRIETARY/CONFIDENTIAL +// This software is the confidential and proprietary +// information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall +// not disclose such Confidential Information and shall use it only in +// accordance with the terms of the license agreement you entered into with +// SAMSUNG ELECTRONICS. +// + +using System; +using System.Collections.Generic; + +namespace Tizen.NUI +{ + + internal class DisposeQueue + { + private static readonly DisposeQueue _disposableQueue = new DisposeQueue(); + private List _disposables = new List(); + private System.Object _listLock = new object(); + private EventThreadCallback _eventThreadCallback; + private EventThreadCallback.CallbackDelegate _disposeQueueProcessDisposablesDelegate; + + private DisposeQueue() + { + } + + ~DisposeQueue() + { + } + + public static DisposeQueue Instance + { + get { return _disposableQueue; } + } + + public void Initialize() + { + _disposeQueueProcessDisposablesDelegate = new EventThreadCallback.CallbackDelegate(ProcessDisposables); + _eventThreadCallback = new EventThreadCallback(_disposeQueueProcessDisposablesDelegate); + } + + public void Add(IDisposable disposable) + { + lock (_listLock) + { + _disposables.Add(disposable); + } + + if (_eventThreadCallback != null) + { + _eventThreadCallback.Trigger(); + } + } + + private void ProcessDisposables() + { + lock (_listLock) + { + foreach (IDisposable disposable in _disposables) + { + disposable.Dispose(); + } + _disposables.Clear(); + } + } + } +} diff --git a/src/Tizen.NUI/src/internal/DragAndDropDetector.cs b/src/Tizen.NUI/src/internal/DragAndDropDetector.cs new file mode 100755 index 0000000..5861ba3 --- /dev/null +++ b/src/Tizen.NUI/src/internal/DragAndDropDetector.cs @@ -0,0 +1,116 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class DragAndDropDetector : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal DragAndDropDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.DragAndDropDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(DragAndDropDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_DragAndDropDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public DragAndDropDetector() : this(NDalicPINVOKE.new_DragAndDropDetector(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string GetContent() + { + string ret = NDalicPINVOKE.DragAndDropDetector_GetContent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector2 GetCurrentScreenPosition() + { + Vector2 ret = new Vector2(NDalicPINVOKE.DragAndDropDetector_GetCurrentScreenPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t EnteredSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t(NDalicPINVOKE.DragAndDropDetector_EnteredSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t ExitedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t(NDalicPINVOKE.DragAndDropDetector_ExitedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t MovedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t(NDalicPINVOKE.DragAndDropDetector_MovedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t DroppedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t(NDalicPINVOKE.DragAndDropDetector_DroppedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/EncodedBufferImage.cs b/src/Tizen.NUI/src/internal/EncodedBufferImage.cs new file mode 100755 index 0000000..4019bc6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/EncodedBufferImage.cs @@ -0,0 +1,102 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class EncodedBufferImage : Image + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal EncodedBufferImage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.EncodedBufferImage_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EncodedBufferImage obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_EncodedBufferImage(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public EncodedBufferImage(SWIGTYPE_p_uint8_t encodedImage, uint encodedImageByteCount) : this(NDalicPINVOKE.EncodedBufferImage_New__SWIG_0(SWIGTYPE_p_uint8_t.getCPtr(encodedImage), encodedImageByteCount), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public EncodedBufferImage(SWIGTYPE_p_uint8_t encodedImage, uint encodedImageByteCount, Uint16Pair size, FittingModeType fittingMode, SamplingModeType samplingMode, bool orientationCorrection) : this(NDalicPINVOKE.EncodedBufferImage_New__SWIG_1(SWIGTYPE_p_uint8_t.getCPtr(encodedImage), encodedImageByteCount, Uint16Pair.getCPtr(size), (int)fittingMode, (int)samplingMode, orientationCorrection), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public EncodedBufferImage(SWIGTYPE_p_uint8_t encodedImage, uint encodedImageByteCount, Uint16Pair size, FittingModeType fittingMode, SamplingModeType samplingMode) : this(NDalicPINVOKE.EncodedBufferImage_New__SWIG_2(SWIGTYPE_p_uint8_t.getCPtr(encodedImage), encodedImageByteCount, Uint16Pair.getCPtr(size), (int)fittingMode, (int)samplingMode), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static EncodedBufferImage DownCast(BaseHandle handle) + { + EncodedBufferImage ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as EncodedBufferImage; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public EncodedBufferImage(EncodedBufferImage handle) : this(NDalicPINVOKE.new_EncodedBufferImage__SWIG_1(EncodedBufferImage.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public EncodedBufferImage Assign(EncodedBufferImage rhs) + { + EncodedBufferImage ret = new EncodedBufferImage(NDalicPINVOKE.EncodedBufferImage_Assign(swigCPtr, EncodedBufferImage.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/EventThreadCallback.cs b/src/Tizen.NUI/src/internal/EventThreadCallback.cs new file mode 100755 index 0000000..d8c5b1a --- /dev/null +++ b/src/Tizen.NUI/src/internal/EventThreadCallback.cs @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + + internal class EventThreadCallback : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + public delegate void CallbackDelegate(); + + internal EventThreadCallback(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EventThreadCallback obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~EventThreadCallback() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_EventThreadCallback(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public EventThreadCallback(CallbackDelegate func) : this(NDalicManualPINVOKE.new_EventThreadCallback(func), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Trigger() + { + if ((System.IntPtr)swigCPtr != global::System.IntPtr.Zero) + { + NDalicManualPINVOKE.EventThreadCallback_Trigger(swigCPtr); + } + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + +} diff --git a/src/Tizen.NUI/src/internal/FaceCullingModeType.cs b/src/Tizen.NUI/src/internal/FaceCullingModeType.cs new file mode 100755 index 0000000..ebfa480 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FaceCullingModeType.cs @@ -0,0 +1,28 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum FaceCullingModeType + { + NONE, + FRONT, + BACK, + FRONT_AND_BACK + } + +} diff --git a/src/Tizen.NUI/src/internal/FixedRuler.cs b/src/Tizen.NUI/src/internal/FixedRuler.cs new file mode 100755 index 0000000..9c424f5 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FixedRuler.cs @@ -0,0 +1,106 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class FixedRuler : Ruler + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal FixedRuler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.FixedRuler_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FixedRuler obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FixedRuler(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public FixedRuler(float spacing) : this(NDalicPINVOKE.new_FixedRuler__SWIG_0(spacing), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FixedRuler() : this(NDalicPINVOKE.new_FixedRuler__SWIG_1(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public override float Snap(float x, float bias) + { + float ret = NDalicPINVOKE.FixedRuler_Snap(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = NDalicPINVOKE.FixedRuler_GetPositionFromPage(swigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override uint GetPageFromPosition(float position, bool wrap) + { + uint ret = NDalicPINVOKE.FixedRuler_GetPageFromPosition(swigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public override uint GetTotalPages() + { + uint ret = NDalicPINVOKE.FixedRuler_GetTotalPages(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FloatSignal.cs b/src/Tizen.NUI/src/internal/FloatSignal.cs new file mode 100755 index 0000000..0af06f1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FloatSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class FloatSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal FloatSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FloatSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~FloatSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FloatSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.FloatSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.FloatSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FloatSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FloatSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(float arg) + { + NDalicPINVOKE.FloatSignal_Emit(swigCPtr, arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FloatSignal() : this(NDalicPINVOKE.new_FloatSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FocusChangedSignal.cs b/src/Tizen.NUI/src/internal/FocusChangedSignal.cs new file mode 100755 index 0000000..4b00d4a --- /dev/null +++ b/src/Tizen.NUI/src/internal/FocusChangedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class FocusChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal FocusChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~FocusChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FocusChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.FocusChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.FocusChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FocusChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FocusChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, View arg2) + { + NDalicPINVOKE.FocusChangedSignal_Emit(swigCPtr, View.getCPtr(arg1), View.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FocusChangedSignal() : this(NDalicPINVOKE.new_FocusChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FocusGroupChangedSignal.cs b/src/Tizen.NUI/src/internal/FocusGroupChangedSignal.cs new file mode 100755 index 0000000..439ebb8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FocusGroupChangedSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class FocusGroupChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal FocusGroupChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusGroupChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~FocusGroupChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FocusGroupChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.FocusGroupChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.FocusGroupChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FocusGroupChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.FocusGroupChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, bool arg2) + { + NDalicPINVOKE.FocusGroupChangedSignal_Emit(swigCPtr, View.getCPtr(arg1), arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FocusGroupChangedSignal() : this(NDalicPINVOKE.new_FocusGroupChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FrameBuffer.cs b/src/Tizen.NUI/src/internal/FrameBuffer.cs new file mode 100755 index 0000000..1db1867 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FrameBuffer.cs @@ -0,0 +1,106 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class FrameBuffer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal FrameBuffer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.FrameBuffer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FrameBuffer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FrameBuffer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class Attachment + { + public enum Mask + { + NONE = 0, + DEPTH = 1 << 0, + STENCIL = 1 << 1, + DEPTH_STENCIL = DEPTH | STENCIL + } + } + + public FrameBuffer(uint width, uint height, uint attachments) : this(NDalicPINVOKE.FrameBuffer_New(width, height, attachments), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public void AttachColorTexture(Texture texture) + { + NDalicPINVOKE.FrameBuffer_AttachColorTexture__SWIG_0(swigCPtr, Texture.getCPtr(texture)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AttachColorTexture(Texture texture, uint mipmapLevel, uint layer) + { + NDalicPINVOKE.FrameBuffer_AttachColorTexture__SWIG_1(swigCPtr, Texture.getCPtr(texture), mipmapLevel, layer); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Texture GetColorTexture() + { + global::System.IntPtr cPtr = NDalicPINVOKE.FrameBuffer_GetColorTexture(swigCPtr); + Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FrameBufferImage.cs b/src/Tizen.NUI/src/internal/FrameBufferImage.cs new file mode 100755 index 0000000..7cc5961 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FrameBufferImage.cs @@ -0,0 +1,119 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class FrameBufferImage : Image + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal FrameBufferImage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.FrameBufferImage_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FrameBufferImage obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FrameBufferImage(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public FrameBufferImage(uint width, uint height, PixelFormat pixelFormat, RenderBufferFormat bufferFormat) : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_0(width, height, (int)pixelFormat, (int)bufferFormat), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public FrameBufferImage(uint width, uint height, PixelFormat pixelFormat) : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_1(width, height, (int)pixelFormat), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public FrameBufferImage(uint width, uint height) : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_2(width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public FrameBufferImage(uint width) : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_3(width), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public FrameBufferImage() : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_4(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public FrameBufferImage(NativeImageInterface image) : this(NDalicPINVOKE.FrameBufferImage_New__SWIG_5(NativeImageInterface.getCPtr(image)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static FrameBufferImage DownCast(BaseHandle handle) + { + FrameBufferImage ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as FrameBufferImage; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public FrameBufferImage(FrameBufferImage handle) : this(NDalicPINVOKE.new_FrameBufferImage__SWIG_1(FrameBufferImage.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FrameBufferImage Assign(FrameBufferImage rhs) + { + FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.FrameBufferImage_Assign(swigCPtr, FrameBufferImage.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/FriendAssembly.cs b/src/Tizen.NUI/src/internal/FriendAssembly.cs new file mode 100755 index 0000000..6ba2744 --- /dev/null +++ b/src/Tizen.NUI/src/internal/FriendAssembly.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +// friend assembly setting +// compile with: /target:Tizen.NUI.ExtTEST /keyfile:FriendAssemblies.snk + +using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("Tizen.NUI.Extension.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001004d7c7c03a196ecb8e7cc5056750e1f40ee2bbe99f0e53a07f2538f2b0f450bd731b9dca3706503a0378baca74a09cf3af6261b330c031f44817ab6ed64189460765a402279d3e0c1fa7295ae1dccb2e3ff329705fd85b58d66ae7cb7e95ba06e0d847c3e3ba918798f579e5caeb1c6149955e6baf24236eec46227a623e494b1")] +[assembly: InternalsVisibleTo("Tizen.Multimedia, PublicKey=0024000004800000940000000602000000240000525341310004000001000100bd36a93b6d224759632d08a501b9dcb99a533e8ff0c3a1fc7044f5b05e176c005e5a7fc4d1dfa54da4d4cad4868c4518aa1f661380fb90685dc699d5e48dcc697b33c1e38b70845f405612d6827e7337c191ddd0a0aa35fdad654efe4c54881fdaa82ce35dce18ea918953e448c7aa284a47ed6fe3aa9404930b2b973a28cddf")] +[assembly: InternalsVisibleTo("Tizen.TV.NUI, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed445c2a988d35b99e5766f42eef33d89d1f67225db051f011abcfce47a4788875c39750a2e5695f1ec117f41d96610419811762669f98131db30a6e64c6bb8fde3731f373f6cda4c0087d121f5108559f216dc015807dc46ec5a4d1b63f5deff64c01754a0db0dc849bc300672572cbd2697432ab6c193ebf9fade6bf0f2aad")] + +namespace Tizen.NUI +{ +} diff --git a/src/Tizen.NUI/src/internal/GaussianBlurView.cs b/src/Tizen.NUI/src/internal/GaussianBlurView.cs new file mode 100755 index 0000000..306c597 --- /dev/null +++ b/src/Tizen.NUI/src/internal/GaussianBlurView.cs @@ -0,0 +1,248 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + + internal class GaussianBlurView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal GaussianBlurView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.GaussianBlurView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GaussianBlurView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_GaussianBlurView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class FinishedEventArgs : EventArgs + { + private GaussianBlurView _gaussianBlurView; + + public GaussianBlurView GaussianBlurView + { + get + { + return _gaussianBlurView; + } + set + { + _gaussianBlurView = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FinishedEventCallbackDelegate(IntPtr application); + private DaliEventHandler _gaussianFinishedEventHandler; + private FinishedEventCallbackDelegate _gaussianFinishedEventCallbackDelegate; + + public event DaliEventHandler Finished + { + add + { + lock (this) + { + // Restricted to only one listener + if (_gaussianFinishedEventHandler == null) + { + _gaussianFinishedEventHandler += value; + + _gaussianFinishedEventCallbackDelegate = new FinishedEventCallbackDelegate(OnFinished); + this.FinishedSignal().Connect(_gaussianFinishedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_gaussianFinishedEventHandler != null) + { + this.FinishedSignal().Disconnect(_gaussianFinishedEventCallbackDelegate); + } + + _gaussianFinishedEventHandler -= value; + } + } + } + + // Callback for GaussianBlurView FinishedSignal + private void OnFinished(IntPtr data) + { + FinishedEventArgs e = new FinishedEventArgs(); + + // Populate all members of "e" (FinishedEventArgs) with real data + e.GaussianBlurView = Registry.GetManagedBaseHandleFromNativePtr(data) as GaussianBlurView; + + if (_gaussianFinishedEventHandler != null) + { + //here we send all data to user event handlers + _gaussianFinishedEventHandler(this, e); + } + } + + public GaussianBlurView() : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public GaussianBlurView(uint numSamples, float blurBellCurveWidth, PixelFormat renderTargetPixelFormat, float downsampleWidthScale, float downsampleHeightScale, bool blurUserImage) : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_1(numSamples, blurBellCurveWidth, (int)renderTargetPixelFormat, downsampleWidthScale, downsampleHeightScale, blurUserImage), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public GaussianBlurView(uint numSamples, float blurBellCurveWidth, PixelFormat renderTargetPixelFormat, float downsampleWidthScale, float downsampleHeightScale) : this(NDalicPINVOKE.GaussianBlurView_New__SWIG_2(numSamples, blurBellCurveWidth, (int)renderTargetPixelFormat, downsampleWidthScale, downsampleHeightScale), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public GaussianBlurView(GaussianBlurView handle) : this(NDalicPINVOKE.new_GaussianBlurView__SWIG_1(GaussianBlurView.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public GaussianBlurView Assign(GaussianBlurView ZoomView) + { + GaussianBlurView ret = new GaussianBlurView(NDalicPINVOKE.GaussianBlurView_Assign(swigCPtr, GaussianBlurView.getCPtr(ZoomView)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new static GaussianBlurView DownCast(BaseHandle handle) + { + GaussianBlurView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as GaussianBlurView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new void Add(View child) + { + NDalicPINVOKE.GaussianBlurView_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new void Remove(View child) + { + NDalicPINVOKE.GaussianBlurView_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Activate() + { + NDalicPINVOKE.GaussianBlurView_Activate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ActivateOnce() + { + NDalicPINVOKE.GaussianBlurView_ActivateOnce(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Deactivate() + { + NDalicPINVOKE.GaussianBlurView_Deactivate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetUserImageAndOutputRenderTarget(Image inputImage, FrameBufferImage outputRenderTarget) + { + NDalicPINVOKE.GaussianBlurView_SetUserImageAndOutputRenderTarget(swigCPtr, Image.getCPtr(inputImage), FrameBufferImage.getCPtr(outputRenderTarget)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int GetBlurStrengthPropertyIndex() + { + int ret = NDalicPINVOKE.GaussianBlurView_GetBlurStrengthPropertyIndex(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public FrameBufferImage GetBlurredRenderTarget() + { + FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.GaussianBlurView_GetBlurredRenderTarget(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new void SetBackgroundColor(Vector4 color) + { + NDalicPINVOKE.GaussianBlurView_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new Vector4 GetBackgroundColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.GaussianBlurView_GetBackgroundColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public GaussianBlurViewSignal FinishedSignal() + { + GaussianBlurViewSignal ret = new GaussianBlurViewSignal(NDalicPINVOKE.GaussianBlurView_FinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/GaussianBlurViewSignal.cs b/src/Tizen.NUI/src/internal/GaussianBlurViewSignal.cs new file mode 100755 index 0000000..4eaed53 --- /dev/null +++ b/src/Tizen.NUI/src/internal/GaussianBlurViewSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class GaussianBlurViewSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal GaussianBlurViewSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GaussianBlurViewSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~GaussianBlurViewSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_GaussianBlurViewSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.GaussianBlurViewSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.GaussianBlurViewSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.GaussianBlurViewSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.GaussianBlurViewSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(GaussianBlurView arg) + { + NDalicPINVOKE.GaussianBlurViewSignal_Emit(swigCPtr, GaussianBlurView.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public GaussianBlurViewSignal() : this(NDalicPINVOKE.new_GaussianBlurViewSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/GestureDetector.cs b/src/Tizen.NUI/src/internal/GestureDetector.cs new file mode 100755 index 0000000..a9e8217 --- /dev/null +++ b/src/Tizen.NUI/src/internal/GestureDetector.cs @@ -0,0 +1,124 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class GestureDetector : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal GestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.GestureDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GestureDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_GestureDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public GestureDetector() : this(NDalicPINVOKE.new_GestureDetector__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new static GestureDetector DownCast(BaseHandle handle) + { + GestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as GestureDetector; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public GestureDetector(GestureDetector handle) : this(NDalicPINVOKE.new_GestureDetector__SWIG_1(GestureDetector.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public GestureDetector Assign(GestureDetector rhs) + { + GestureDetector ret = new GestureDetector(NDalicPINVOKE.GestureDetector_Assign(swigCPtr, GestureDetector.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Attach(View view) + { + NDalicPINVOKE.GestureDetector_Attach(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Detach(View view) + { + NDalicPINVOKE.GestureDetector_Detach(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void DetachAll() + { + NDalicPINVOKE.GestureDetector_DetachAll(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetAttachedViewCount() + { + uint ret = NDalicPINVOKE.GestureDetector_GetAttachedActorCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public View GetAttachedView(uint index) + { + View ret = new View(NDalicPINVOKE.GestureDetector_GetAttachedActor(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/HoverSignal.cs b/src/Tizen.NUI/src/internal/HoverSignal.cs new file mode 100755 index 0000000..aaf415e --- /dev/null +++ b/src/Tizen.NUI/src/internal/HoverSignal.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + + internal class HoverSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal HoverSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(HoverSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~HoverSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ActorHoverSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ActorHoverSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ActorHoverSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorHoverSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorHoverSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(View arg1, Hover arg2) + { + bool ret = NDalicPINVOKE.ActorHoverSignal_Emit(swigCPtr, View.getCPtr(arg1), Hover.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public HoverSignal() : this(NDalicPINVOKE.new_ActorHoverSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Image.cs b/src/Tizen.NUI/src/internal/Image.cs new file mode 100755 index 0000000..928305a --- /dev/null +++ b/src/Tizen.NUI/src/internal/Image.cs @@ -0,0 +1,208 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + + internal class Image : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Image(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Image_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Image obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Image(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + /** + * @brief Event arguments that passed via Uploaded signal + * + */ + public class UploadedEventArgs : EventArgs + { + private Image _image; + /** + * @brief Image - is the image data that gets uploaded to GL. + * + */ + public Image Image + { + get + { + return _image; + } + set + { + _image = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void UploadedEventCallbackDelegate(IntPtr image); + private DaliEventHandler _imageUploadedEventHandler; + private UploadedEventCallbackDelegate _imageUploadedEventCallbackDelegate; + + /** + * @brief Event for Uploaded signal which can be used to subscribe/unsubscribe the event handler + * (in the type of UploadedEventHandler-DaliEventHandler) + * provided by the user. Uploaded signal is emitted when the image data gets uploaded to GL. + */ + public event DaliEventHandler Uploaded + { + add + { + lock (this) + { + // Restricted to only one listener + if (_imageUploadedEventHandler == null) + { + _imageUploadedEventHandler += value; + + _imageUploadedEventCallbackDelegate = new UploadedEventCallbackDelegate(OnUploaded); + this.UploadedSignal().Connect(_imageUploadedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_imageUploadedEventHandler != null) + { + this.UploadedSignal().Disconnect(_imageUploadedEventCallbackDelegate); + } + + _imageUploadedEventHandler -= value; + } + } + } + + // Callback for Image UploadedSignal + private void OnUploaded(IntPtr data) + { + UploadedEventArgs e = new UploadedEventArgs(); + + // Populate all members of "e" (UploadedEventArgs) with real data + e.Image = Image.GetImageFromPtr(data); + + if (_imageUploadedEventHandler != null) + { + //here we send all data to user event handlers + _imageUploadedEventHandler(this, e); + } + } + + + public static Image GetImageFromPtr(global::System.IntPtr cPtr) + { + Image ret = new Image(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public Image() : this(NDalicPINVOKE.new_Image__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Image(Image handle) : this(NDalicPINVOKE.new_Image__SWIG_1(Image.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Image Assign(Image rhs) + { + Image ret = new Image(NDalicPINVOKE.Image_Assign(swigCPtr, Image.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Image DownCast(BaseHandle handle) + { + Image ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Image; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetWidth() + { + uint ret = NDalicPINVOKE.Image_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetHeight() + { + uint ret = NDalicPINVOKE.Image_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ImageSignal UploadedSignal() + { + ImageSignal ret = new ImageSignal(NDalicPINVOKE.Image_UploadedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ImageSignal.cs b/src/Tizen.NUI/src/internal/ImageSignal.cs new file mode 100755 index 0000000..3ccc0ae --- /dev/null +++ b/src/Tizen.NUI/src/internal/ImageSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ImageSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ImageSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ImageSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ImageSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ImageSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ImageSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ImageSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ImageSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Image arg) + { + NDalicPINVOKE.ImageSignal_Emit(swigCPtr, Image.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ImageSignal() : this(NDalicPINVOKE.new_ImageSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ImfEventSignalType.cs b/src/Tizen.NUI/src/internal/ImfEventSignalType.cs new file mode 100755 index 0000000..a2334ac --- /dev/null +++ b/src/Tizen.NUI/src/internal/ImfEventSignalType.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be deprecated")] + public class ImfEventSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ImfEventSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ImfEventSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ImfEventSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.ImfEventSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.ImfEventSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ImfEventSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ImfEventSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public ImfManager.ImfCallbackData Emit(ImfManager arg1, ImfManager.ImfEventData arg2) + { + ImfManager.ImfCallbackData ret = new ImfManager.ImfCallbackData(NDalicManualPINVOKE.ImfEventSignalType_Emit(swigCPtr, ImfManager.getCPtr(arg1), ImfManager.ImfEventData.getCPtr(arg2)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ImfEventSignalType() : this(NDalicManualPINVOKE.new_ImfEventSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ImfVoidSignalType.cs b/src/Tizen.NUI/src/internal/ImfVoidSignalType.cs new file mode 100755 index 0000000..ca597c1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ImfVoidSignalType.cs @@ -0,0 +1,154 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class ImfVoidSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ImfVoidSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfVoidSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ImfVoidSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ImfVoidSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public ImfVoidSignalType() : this(NDalicManualPINVOKE.new_ImfVoidSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.ImfVoidSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.ImfVoidSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ImfVoidSignalType_Connect__SWIG_0(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ImfVoidSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Connect(ConnectionTrackerInterface connectionTracker, SWIGTYPE_p_Dali__FunctorDelegate arg1) + { + NDalicManualPINVOKE.ImfVoidSignalType_Connect__SWIG_4(swigCPtr, ConnectionTrackerInterface.getCPtr(connectionTracker), SWIGTYPE_p_Dali__FunctorDelegate.getCPtr(arg1)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Emit() + { + NDalicManualPINVOKE.ImfVoidSignalType_Emit(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/InputMethodOptions.cs b/src/Tizen.NUI/src/internal/InputMethodOptions.cs new file mode 100755 index 0000000..09b69a0 --- /dev/null +++ b/src/Tizen.NUI/src/internal/InputMethodOptions.cs @@ -0,0 +1,133 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class InputMethodOptions : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal InputMethodOptions(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InputMethodOptions obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~InputMethodOptions() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_InputMethodOptions(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public InputMethodOptions() : this(NDalicManualPINVOKE.new_InputMethodOptions(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsPassword() + { + bool ret = NDalicManualPINVOKE.InputMethodOptions_IsPassword(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ApplyProperty(PropertyMap settings) + { + NDalicManualPINVOKE.InputMethodOptions_ApplyProperty(swigCPtr, PropertyMap.getCPtr(settings)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RetrieveProperty(PropertyMap settings) + { + NDalicManualPINVOKE.InputMethodOptions_RetrieveProperty(swigCPtr, PropertyMap.getCPtr(settings)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool CompareAndSet(InputMethod.CategoryType type, InputMethodOptions options, SWIGTYPE_p_int index) + { + bool ret = NDalicManualPINVOKE.InputMethodOptions_CompareAndSet(swigCPtr, (int)type, InputMethodOptions.getCPtr(options), SWIGTYPE_p_int.getCPtr(index)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Item.cs b/src/Tizen.NUI/src/internal/Item.cs new file mode 100755 index 0000000..96f8838 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Item.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class Item : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Item(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Item obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Item() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Item(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Item() : this(NDalicPINVOKE.new_Item__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Item(uint t, View u) : this(NDalicPINVOKE.new_Item__SWIG_1(t, View.getCPtr(u)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Item(Item p) : this(NDalicPINVOKE.new_Item__SWIG_2(Item.getCPtr(p)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint first + { + set + { + NDalicPINVOKE.Item_first_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Item_first_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public View second + { + set + { + NDalicPINVOKE.Item_second_set(swigCPtr, View.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Item_second_get(swigCPtr); + View ret = (cPtr == global::System.IntPtr.Zero) ? null : new View(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemContainer.cs b/src/Tizen.NUI/src/internal/ItemContainer.cs new file mode 100755 index 0000000..7740126 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemContainer.cs @@ -0,0 +1,425 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ItemContainer : global::System.IDisposable, global::System.Collections.IEnumerable + , global::System.Collections.Generic.IEnumerable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ItemContainer(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ItemContainer() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemContainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public ItemContainer(global::System.Collections.ICollection c) : this() + { + if (c == null) + throw new global::System.ArgumentNullException("c"); + foreach (Item element in c) + { + this.Add(element); + } + } + + public bool IsFixedSize + { + get + { + return false; + } + } + + public bool IsReadOnly + { + get + { + return false; + } + } + + public Item this[int index] + { + get + { + return getitem(index); + } + set + { + setitem(index, value); + } + } + + public int Capacity + { + get + { + return (int)capacity(); + } + set + { + if (value < size()) + throw new global::System.ArgumentOutOfRangeException("Capacity"); + reserve((uint)value); + } + } + + public int Count + { + get + { + return (int)size(); + } + } + + public bool IsSynchronized + { + get + { + return false; + } + } + + public void CopyTo(Item[] array) + { + CopyTo(0, array, 0, this.Count); + } + + public void CopyTo(Item[] array, int arrayIndex) + { + CopyTo(0, array, arrayIndex, this.Count); + } + + public void CopyTo(int index, Item[] array, int arrayIndex, int count) + { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (index < 0) + throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (count < 0) + throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (index + count > this.Count || arrayIndex + count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + for (int i = 0; i < count; i++) + array.SetValue(getitemcopy(index + i), arrayIndex + i); + } + + global::System.Collections.Generic.IEnumerator global::System.Collections.Generic.IEnumerable.GetEnumerator() + { + return new ItemContainerEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() + { + return new ItemContainerEnumerator(this); + } + + public ItemContainerEnumerator GetEnumerator() + { + return new ItemContainerEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class ItemContainerEnumerator : global::System.Collections.IEnumerator + , global::System.Collections.Generic.IEnumerator + { + private ItemContainer collectionRef; + private int currentIndex; + private object currentObject; + private int currentSize; + + public ItemContainerEnumerator(ItemContainer collection) + { + collectionRef = collection; + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public Item Current + { + get + { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return (Item)currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current + { + get + { + return Current; + } + } + + public bool MoveNext() + { + int size = collectionRef.Count; + bool moveOkay = (currentIndex + 1 < size) && (size == currentSize); + if (moveOkay) + { + currentIndex++; + currentObject = collectionRef[currentIndex]; + } + else + { + currentObject = null; + } + return moveOkay; + } + + public void Reset() + { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) + { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() + { + currentIndex = -1; + currentObject = null; + } + } + + public void Clear() + { + NDalicPINVOKE.ItemContainer_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Add(Item x) + { + NDalicPINVOKE.ItemContainer_Add(swigCPtr, Item.getCPtr(x)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private uint size() + { + uint ret = NDalicPINVOKE.ItemContainer_size(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private uint capacity() + { + uint ret = NDalicPINVOKE.ItemContainer_capacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void reserve(uint n) + { + NDalicPINVOKE.ItemContainer_reserve(swigCPtr, n); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemContainer() : this(NDalicPINVOKE.new_ItemContainer__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemContainer(ItemContainer other) : this(NDalicPINVOKE.new_ItemContainer__SWIG_1(ItemContainer.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemContainer(int capacity) : this(NDalicPINVOKE.new_ItemContainer__SWIG_2(capacity), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Item getitemcopy(int index) + { + Item ret = new Item(NDalicPINVOKE.ItemContainer_getitemcopy(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Item getitem(int index) + { + Item ret = new Item(NDalicPINVOKE.ItemContainer_getitem(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void setitem(int index, Item val) + { + NDalicPINVOKE.ItemContainer_setitem(swigCPtr, index, Item.getCPtr(val)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddRange(ItemContainer values) + { + NDalicPINVOKE.ItemContainer_AddRange(swigCPtr, ItemContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemContainer GetRange(int index, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_GetRange(swigCPtr, index, count); + ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Insert(int index, Item x) + { + NDalicPINVOKE.ItemContainer_Insert(swigCPtr, index, Item.getCPtr(x)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void InsertRange(int index, ItemContainer values) + { + NDalicPINVOKE.ItemContainer_InsertRange(swigCPtr, index, ItemContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveAt(int index) + { + NDalicPINVOKE.ItemContainer_RemoveAt(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveRange(int index, int count) + { + NDalicPINVOKE.ItemContainer_RemoveRange(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static ItemContainer Repeat(Item value, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.ItemContainer_Repeat(Item.getCPtr(value), count); + ItemContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reverse() + { + NDalicPINVOKE.ItemContainer_Reverse__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reverse(int index, int count) + { + NDalicPINVOKE.ItemContainer_Reverse__SWIG_1(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetRange(int index, ItemContainer values) + { + NDalicPINVOKE.ItemContainer_SetRange(swigCPtr, index, ItemContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemFactory.cs b/src/Tizen.NUI/src/internal/ItemFactory.cs new file mode 100755 index 0000000..22a4cda --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemFactory.cs @@ -0,0 +1,177 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System.Reflection; + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class ItemFactory : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ItemFactory(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemFactory obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ItemFactory() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemFactory(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public virtual uint GetNumberOfItems() + { + uint ret = NDalicPINVOKE.ItemFactory_GetNumberOfItems(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual View NewItem(uint itemId) + { + View ret = new View(NDalicPINVOKE.ItemFactory_NewItem(swigCPtr, itemId), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void ItemReleased(uint itemId, View view) + { + if (SwigDerivedClassHasMethod("ItemReleased", swigMethodTypes2)) NDalicPINVOKE.ItemFactory_ItemReleasedSwigExplicitItemFactory(swigCPtr, itemId, View.getCPtr(view)); else NDalicPINVOKE.ItemFactory_ItemReleased(swigCPtr, itemId, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemFactory() : this(NDalicPINVOKE.new_ItemFactory(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + SwigDirectorConnect(); + } + + private void SwigDirectorConnect() + { + if (SwigDerivedClassHasMethod("GetNumberOfItems", swigMethodTypes0)) + swigDelegate0 = new SwigDelegateItemFactory_0(SwigDirectorGetNumberOfItems); + if (SwigDerivedClassHasMethod("NewItem", swigMethodTypes1)) + swigDelegate1 = new SwigDelegateItemFactory_1(SwigDirectorNewItem); + if (SwigDerivedClassHasMethod("ItemReleased", swigMethodTypes2)) + swigDelegate2 = new SwigDelegateItemFactory_2(SwigDirectorItemReleased); + NDalicPINVOKE.ItemFactory_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2); + } + + private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) + { + global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); + bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(ItemFactory)); + NUILog.Debug("hasDerivedMethod=" + hasDerivedMethod); + return hasDerivedMethod && (methodInfo != null); + } + + private uint SwigDirectorGetNumberOfItems() + { + return GetNumberOfItems(); + } + + private global::System.IntPtr SwigDirectorNewItem(uint itemId) + { + return View.getCPtr(NewItem(itemId)).Handle; + } + + private void SwigDirectorItemReleased(uint itemId, global::System.IntPtr actor) + { + ItemReleased(itemId, new View(actor, true)); + } + + public delegate uint SwigDelegateItemFactory_0(); + public delegate global::System.IntPtr SwigDelegateItemFactory_1(uint itemId); + public delegate void SwigDelegateItemFactory_2(uint itemId, global::System.IntPtr actor); + + private SwigDelegateItemFactory_0 swigDelegate0; + private SwigDelegateItemFactory_1 swigDelegate1; + private SwigDelegateItemFactory_2 swigDelegate2; + + private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { typeof(uint) }; + private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { typeof(uint), typeof(View) }; + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemIdContainer.cs b/src/Tizen.NUI/src/internal/ItemIdContainer.cs new file mode 100755 index 0000000..79ab437 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemIdContainer.cs @@ -0,0 +1,453 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ItemIdContainer : global::System.IDisposable, global::System.Collections.IEnumerable + , global::System.Collections.Generic.IList + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ItemIdContainer(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemIdContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ItemIdContainer() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemIdContainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public ItemIdContainer(global::System.Collections.ICollection c) : this() + { + if (c == null) + throw new global::System.ArgumentNullException("c"); + foreach (uint element in c) + { + this.Add(element); + } + } + + public bool IsFixedSize + { + get + { + return false; + } + } + + public bool IsReadOnly + { + get + { + return false; + } + } + + public uint this[int index] + { + get + { + return getitem(index); + } + set + { + setitem(index, value); + } + } + + public int Capacity + { + get + { + return (int)capacity(); + } + set + { + if (value < size()) + throw new global::System.ArgumentOutOfRangeException("Capacity"); + reserve((uint)value); + } + } + + public int Count + { + get + { + return (int)size(); + } + } + + public bool IsSynchronized + { + get + { + return false; + } + } + + public void CopyTo(uint[] array) + { + CopyTo(0, array, 0, this.Count); + } + + public void CopyTo(uint[] array, int arrayIndex) + { + CopyTo(0, array, arrayIndex, this.Count); + } + + public void CopyTo(int index, uint[] array, int arrayIndex, int count) + { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (index < 0) + throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (count < 0) + throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (index + count > this.Count || arrayIndex + count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + for (int i = 0; i < count; i++) + array.SetValue(getitemcopy(index + i), arrayIndex + i); + } + + global::System.Collections.Generic.IEnumerator global::System.Collections.Generic.IEnumerable.GetEnumerator() + { + return new ItemIdContainerEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() + { + return new ItemIdContainerEnumerator(this); + } + + public ItemIdContainerEnumerator GetEnumerator() + { + return new ItemIdContainerEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class ItemIdContainerEnumerator : global::System.Collections.IEnumerator + , global::System.Collections.Generic.IEnumerator + { + private ItemIdContainer collectionRef; + private int currentIndex; + private object currentObject; + private int currentSize; + + public ItemIdContainerEnumerator(ItemIdContainer collection) + { + collectionRef = collection; + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public uint Current + { + get + { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return (uint)currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current + { + get + { + return Current; + } + } + + public bool MoveNext() + { + int size = collectionRef.Count; + bool moveOkay = (currentIndex + 1 < size) && (size == currentSize); + if (moveOkay) + { + currentIndex++; + currentObject = collectionRef[currentIndex]; + } + else + { + currentObject = null; + } + return moveOkay; + } + + public void Reset() + { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) + { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() + { + currentIndex = -1; + currentObject = null; + } + } + + public void Clear() + { + NDalicPINVOKE.ItemIdContainer_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Add(uint x) + { + NDalicPINVOKE.ItemIdContainer_Add(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private uint size() + { + uint ret = NDalicPINVOKE.ItemIdContainer_size(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private uint capacity() + { + uint ret = NDalicPINVOKE.ItemIdContainer_capacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void reserve(uint n) + { + NDalicPINVOKE.ItemIdContainer_reserve(swigCPtr, n); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemIdContainer() : this(NDalicPINVOKE.new_ItemIdContainer__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemIdContainer(ItemIdContainer other) : this(NDalicPINVOKE.new_ItemIdContainer__SWIG_1(ItemIdContainer.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemIdContainer(int capacity) : this(NDalicPINVOKE.new_ItemIdContainer__SWIG_2(capacity), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private uint getitemcopy(int index) + { + uint ret = NDalicPINVOKE.ItemIdContainer_getitemcopy(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private uint getitem(int index) + { + uint ret = NDalicPINVOKE.ItemIdContainer_getitem(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void setitem(int index, uint val) + { + NDalicPINVOKE.ItemIdContainer_setitem(swigCPtr, index, val); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddRange(ItemIdContainer values) + { + NDalicPINVOKE.ItemIdContainer_AddRange(swigCPtr, ItemIdContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemIdContainer GetRange(int index, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.ItemIdContainer_GetRange(swigCPtr, index, count); + ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Insert(int index, uint x) + { + NDalicPINVOKE.ItemIdContainer_Insert(swigCPtr, index, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void InsertRange(int index, ItemIdContainer values) + { + NDalicPINVOKE.ItemIdContainer_InsertRange(swigCPtr, index, ItemIdContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveAt(int index) + { + NDalicPINVOKE.ItemIdContainer_RemoveAt(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveRange(int index, int count) + { + NDalicPINVOKE.ItemIdContainer_RemoveRange(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static ItemIdContainer Repeat(uint value, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.ItemIdContainer_Repeat(value, count); + ItemIdContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new ItemIdContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reverse() + { + NDalicPINVOKE.ItemIdContainer_Reverse__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reverse(int index, int count) + { + NDalicPINVOKE.ItemIdContainer_Reverse__SWIG_1(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetRange(int index, ItemIdContainer values) + { + NDalicPINVOKE.ItemIdContainer_SetRange(swigCPtr, index, ItemIdContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool Contains(uint value) + { + bool ret = NDalicPINVOKE.ItemIdContainer_Contains(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int IndexOf(uint value) + { + int ret = NDalicPINVOKE.ItemIdContainer_IndexOf(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int LastIndexOf(uint value) + { + int ret = NDalicPINVOKE.ItemIdContainer_LastIndexOf(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Remove(uint value) + { + bool ret = NDalicPINVOKE.ItemIdContainer_Remove(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemLayout.cs b/src/Tizen.NUI/src/internal/ItemLayout.cs new file mode 100755 index 0000000..6bb38a9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemLayout.cs @@ -0,0 +1,199 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class ItemLayout : RefObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ItemLayout(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ItemLayout_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemLayout obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemLayout(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public void SetLayoutProperties(PropertyMap properties) + { + NDalicPINVOKE.ItemLayout_SetLayoutProperties(swigCPtr, PropertyMap.getCPtr(properties)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyMap GetLayoutProperties() + { + PropertyMap ret = new PropertyMap(NDalicPINVOKE.ItemLayout_GetLayoutProperties(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void GetItemSize(uint itemId, Vector3 layoutSize, Vector3 itemSize) + { + NDalicPINVOKE.ItemLayout_GetItemSize(swigCPtr, itemId, Vector3.getCPtr(layoutSize), Vector3.getCPtr(itemSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetItemSize(Vector3 itemSize) + { + NDalicPINVOKE.ItemLayout_SetItemSize(swigCPtr, Vector3.getCPtr(itemSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual float GetMinimumLayoutPosition(uint numberOfItems, Vector3 layoutSize) + { + float ret = NDalicPINVOKE.ItemLayout_GetMinimumLayoutPosition(swigCPtr, numberOfItems, Vector3.getCPtr(layoutSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetClosestAnchorPosition(float layoutPosition) + { + float ret = NDalicPINVOKE.ItemLayout_GetClosestAnchorPosition(swigCPtr, layoutPosition); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetItemScrollToPosition(uint itemId) + { + float ret = NDalicPINVOKE.ItemLayout_GetItemScrollToPosition(swigCPtr, itemId); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual ItemRange GetItemsWithinArea(float firstItemPosition, Vector3 layoutSize) + { + ItemRange ret = new ItemRange(NDalicPINVOKE.ItemLayout_GetItemsWithinArea(swigCPtr, firstItemPosition, Vector3.getCPtr(layoutSize)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetClosestOnScreenLayoutPosition(int itemID, float currentLayoutPosition, Vector3 layoutSize) + { + float ret = NDalicPINVOKE.ItemLayout_GetClosestOnScreenLayoutPosition(swigCPtr, itemID, currentLayoutPosition, Vector3.getCPtr(layoutSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual uint GetReserveItemCount(Vector3 layoutSize) + { + uint ret = NDalicPINVOKE.ItemLayout_GetReserveItemCount(swigCPtr, Vector3.getCPtr(layoutSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void GetDefaultItemSize(uint itemId, Vector3 layoutSize, Vector3 itemSize) + { + NDalicPINVOKE.ItemLayout_GetDefaultItemSize(swigCPtr, itemId, Vector3.getCPtr(layoutSize), Vector3.getCPtr(itemSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual Degree GetScrollDirection() + { + Degree ret = new Degree(NDalicPINVOKE.ItemLayout_GetScrollDirection(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetScrollSpeedFactor() + { + float ret = NDalicPINVOKE.ItemLayout_GetScrollSpeedFactor(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetMaximumSwipeSpeed() + { + float ret = NDalicPINVOKE.ItemLayout_GetMaximumSwipeSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetItemFlickAnimationDuration() + { + float ret = NDalicPINVOKE.ItemLayout_GetItemFlickAnimationDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual int GetNextFocusItemID(int itemID, int maxItems, View.FocusDirection direction, bool loopEnabled) + { + int ret = NDalicPINVOKE.ItemLayout_GetNextFocusItemID(swigCPtr, itemID, maxItems, (int)direction, loopEnabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetFlickSpeedFactor() + { + float ret = NDalicPINVOKE.ItemLayout_GetFlickSpeedFactor(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void ApplyConstraints(View view, int itemId, Vector3 layoutSize, View itemView) + { + NDalicPINVOKE.ItemLayout_ApplyConstraints(swigCPtr, View.getCPtr(view), itemId, Vector3.getCPtr(layoutSize), View.getCPtr(itemView)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual Vector3 GetItemPosition(int itemID, float currentLayoutPosition, Vector3 layoutSize) + { + Vector3 ret = new Vector3(NDalicPINVOKE.ItemLayout_GetItemPosition(swigCPtr, itemID, currentLayoutPosition, Vector3.getCPtr(layoutSize)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemRange.cs b/src/Tizen.NUI/src/internal/ItemRange.cs new file mode 100755 index 0000000..30c6a7d --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemRange.cs @@ -0,0 +1,166 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ItemRange : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ItemRange(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemRange obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ItemRange() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemRange(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public ItemRange(uint beginItem, uint endItem) : this(NDalicPINVOKE.new_ItemRange__SWIG_0(beginItem, endItem), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemRange(ItemRange copy) : this(NDalicPINVOKE.new_ItemRange__SWIG_1(ItemRange.getCPtr(copy)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ItemRange Assign(ItemRange range) + { + ItemRange ret = new ItemRange(NDalicPINVOKE.ItemRange_Assign(swigCPtr, ItemRange.getCPtr(range)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Within(uint itemId) + { + bool ret = NDalicPINVOKE.ItemRange_Within(swigCPtr, itemId); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ItemRange Intersection(ItemRange second) + { + ItemRange ret = new ItemRange(NDalicPINVOKE.ItemRange_Intersection(swigCPtr, ItemRange.getCPtr(second)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint begin + { + set + { + NDalicPINVOKE.ItemRange_begin_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.ItemRange_begin_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public uint end + { + set + { + NDalicPINVOKE.ItemRange_end_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.ItemRange_end_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ItemView.cs b/src/Tizen.NUI/src/internal/ItemView.cs new file mode 100755 index 0000000..ad354db --- /dev/null +++ b/src/Tizen.NUI/src/internal/ItemView.cs @@ -0,0 +1,492 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + + internal class ItemView : Scrollable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ItemView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ItemView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ItemView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ItemView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public Tizen.NUI.PropertyArray Layout + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(ItemView.Property.LAYOUT).Get(temp); + return temp; + } + set + { + SetProperty(ItemView.Property.LAYOUT, new Tizen.NUI.PropertyValue(value)); + } + } + + public class Property + { + public static readonly int LAYOUT = NDalicManualPINVOKE.ItemView_Property_LAYOUT_get(); + public static readonly int MINIMUM_SWIPE_SPEED = NDalicPINVOKE.ItemView_Property_MINIMUM_SWIPE_SPEED_get(); + public static readonly int MINIMUM_SWIPE_DISTANCE = NDalicPINVOKE.ItemView_Property_MINIMUM_SWIPE_DISTANCE_get(); + public static readonly int WHEEL_SCROLL_DISTANCE_STEP = NDalicPINVOKE.ItemView_Property_WHEEL_SCROLL_DISTANCE_STEP_get(); + public static readonly int SNAP_TO_ITEM_ENABLED = NDalicPINVOKE.ItemView_Property_SNAP_TO_ITEM_ENABLED_get(); + public static readonly int REFRESH_INTERVAL = NDalicPINVOKE.ItemView_Property_REFRESH_INTERVAL_get(); + public static readonly int LAYOUT_POSITION = NDalicPINVOKE.ItemView_Property_LAYOUT_POSITION_get(); + public static readonly int SCROLL_SPEED = NDalicPINVOKE.ItemView_Property_SCROLL_SPEED_get(); + public static readonly int OVERSHOOT = NDalicPINVOKE.ItemView_Property_OVERSHOOT_get(); + public static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ItemView_Property_SCROLL_DIRECTION_get(); + public static readonly int LAYOUT_ORIENTATION = NDalicPINVOKE.ItemView_Property_LAYOUT_ORIENTATION_get(); + public static readonly int SCROLL_CONTENT_SIZE = NDalicPINVOKE.ItemView_Property_SCROLL_CONTENT_SIZE_get(); + } + + public ItemView(ItemFactory factory) : this(NDalicPINVOKE.ItemView_New(ItemFactory.getCPtr(factory)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + internal new static ItemView DownCast(BaseHandle handle) + { + ItemView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ItemView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetLayoutCount() + { + uint ret = NDalicPINVOKE.ItemView_GetLayoutCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void AddLayout(ItemLayout layout) + { + NDalicPINVOKE.ItemView_AddLayout(swigCPtr, ItemLayout.getCPtr(layout)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveLayout(uint layoutIndex) + { + NDalicPINVOKE.ItemView_RemoveLayout(swigCPtr, layoutIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetLayout(uint layoutIndex) + { + SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(NDalicPINVOKE.ItemView_GetLayout(swigCPtr, layoutIndex), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t GetActiveLayout() + { + SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(NDalicPINVOKE.ItemView_GetActiveLayout(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetCurrentLayoutPosition(uint itemId) + { + float ret = NDalicPINVOKE.ItemView_GetCurrentLayoutPosition(swigCPtr, itemId); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ActivateLayout(uint layoutIndex, Vector3 targetSize, float durationSeconds) + { + NDalicPINVOKE.ItemView_ActivateLayout(swigCPtr, layoutIndex, Vector3.getCPtr(targetSize), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void DeactivateCurrentLayout() + { + NDalicPINVOKE.ItemView_DeactivateCurrentLayout(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetMinimumSwipeSpeed(float speed) + { + NDalicPINVOKE.ItemView_SetMinimumSwipeSpeed(swigCPtr, speed); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetMinimumSwipeSpeed() + { + float ret = NDalicPINVOKE.ItemView_GetMinimumSwipeSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMinimumSwipeDistance(float distance) + { + NDalicPINVOKE.ItemView_SetMinimumSwipeDistance(swigCPtr, distance); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetMinimumSwipeDistance() + { + float ret = NDalicPINVOKE.ItemView_GetMinimumSwipeDistance(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetWheelScrollDistanceStep(float step) + { + NDalicPINVOKE.ItemView_SetWheelScrollDistanceStep(swigCPtr, step); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetWheelScrollDistanceStep() + { + float ret = NDalicPINVOKE.ItemView_GetWheelScrollDistanceStep(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAnchoring(bool enabled) + { + NDalicPINVOKE.ItemView_SetAnchoring(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetAnchoring() + { + bool ret = NDalicPINVOKE.ItemView_GetAnchoring(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAnchoringDuration(float durationSeconds) + { + NDalicPINVOKE.ItemView_SetAnchoringDuration(swigCPtr, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetAnchoringDuration() + { + float ret = NDalicPINVOKE.ItemView_GetAnchoringDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ScrollToItem(uint itemId, float durationSeconds) + { + NDalicPINVOKE.ItemView_ScrollToItem(swigCPtr, itemId, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetRefreshInterval(float intervalLayoutPositions) + { + NDalicPINVOKE.ItemView_SetRefreshInterval(swigCPtr, intervalLayoutPositions); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetRefreshInterval() + { + float ret = NDalicPINVOKE.ItemView_GetRefreshInterval(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Refresh() + { + NDalicPINVOKE.ItemView_Refresh(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public View GetItem(uint itemId) + { + View ret = new View(NDalicPINVOKE.ItemView_GetItem(swigCPtr, itemId), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetItemId(View view) + { + uint ret = NDalicPINVOKE.ItemView_GetItemId(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void InsertItem(Item newItem, float durationSeconds) + { + NDalicPINVOKE.ItemView_InsertItem(swigCPtr, Item.getCPtr(newItem), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void InsertItems(ItemContainer newItems, float durationSeconds) + { + NDalicPINVOKE.ItemView_InsertItems(swigCPtr, ItemContainer.getCPtr(newItems), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveItem(uint itemId, float durationSeconds) + { + NDalicPINVOKE.ItemView_RemoveItem(swigCPtr, itemId, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveItems(ItemIdContainer itemIds, float durationSeconds) + { + NDalicPINVOKE.ItemView_RemoveItems(swigCPtr, ItemIdContainer.getCPtr(itemIds), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ReplaceItem(Item replacementItem, float durationSeconds) + { + NDalicPINVOKE.ItemView_ReplaceItem(swigCPtr, Item.getCPtr(replacementItem), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ReplaceItems(ItemContainer replacementItems, float durationSeconds) + { + NDalicPINVOKE.ItemView_ReplaceItems(swigCPtr, ItemContainer.getCPtr(replacementItems), durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetItemsParentOrigin(Vector3 parentOrigin) + { + NDalicPINVOKE.ItemView_SetItemsParentOrigin(swigCPtr, Vector3.getCPtr(parentOrigin)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector3 GetItemsParentOrigin() + { + Vector3 ret = new Vector3(NDalicPINVOKE.ItemView_GetItemsParentOrigin(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetItemsAnchorPoint(Vector3 anchorPoint) + { + NDalicPINVOKE.ItemView_SetItemsAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector3 GetItemsAnchorPoint() + { + Vector3 ret = new Vector3(NDalicPINVOKE.ItemView_GetItemsAnchorPoint(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void GetItemsRange(ItemRange range) + { + NDalicPINVOKE.ItemView_GetItemsRange(swigCPtr, ItemRange.getCPtr(range)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VoidSignal LayoutActivatedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.ItemView_LayoutActivatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float MinimumSwipeSpeed + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.MINIMUM_SWIPE_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + public float MinimumSwipeDistance + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.MINIMUM_SWIPE_DISTANCE, new Tizen.NUI.PropertyValue(value)); + } + } + public float WheelScrollDistanceStep + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Tizen.NUI.PropertyValue(value)); + } + } + public bool SnapToItemEnabled + { + get + { + bool temp = false; + GetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.SNAP_TO_ITEM_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + public float RefreshInterval + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.REFRESH_INTERVAL).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.REFRESH_INTERVAL, new Tizen.NUI.PropertyValue(value)); + } + } + public float LayoutPosition + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.LAYOUT_POSITION).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.LAYOUT_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + public float ScrollSpeed + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.SCROLL_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + public float Overshoot + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.OVERSHOOT).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.OVERSHOOT, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollDirection + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ItemView.Property.SCROLL_DIRECTION).Get(temp); + return temp; + } + set + { + SetProperty(ItemView.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(value)); + } + } + public int LayoutOrientation + { + get + { + int temp = 0; + GetProperty(ItemView.Property.LAYOUT_ORIENTATION).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.LAYOUT_ORIENTATION, new Tizen.NUI.PropertyValue(value)); + } + } + public float ScrollContentSize + { + get + { + float temp = 0.0f; + GetProperty(ItemView.Property.SCROLL_CONTENT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(ItemView.Property.SCROLL_CONTENT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/KeyEventSignal.cs b/src/Tizen.NUI/src/internal/KeyEventSignal.cs new file mode 100755 index 0000000..f3334d4 --- /dev/null +++ b/src/Tizen.NUI/src/internal/KeyEventSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class KeyEventSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal KeyEventSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyEventSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~KeyEventSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_KeyEventSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.KeyEventSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.KeyEventSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.KeyEventSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.KeyEventSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Key arg) + { + NDalicPINVOKE.KeyEventSignal_Emit(swigCPtr, Key.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public KeyEventSignal() : this(NDalicPINVOKE.new_KeyEventSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/KeyInputFocusManager.cs b/src/Tizen.NUI/src/internal/KeyInputFocusManager.cs new file mode 100755 index 0000000..dd6f093 --- /dev/null +++ b/src/Tizen.NUI/src/internal/KeyInputFocusManager.cs @@ -0,0 +1,107 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + internal class KeyInputFocusManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal KeyInputFocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.KeyInputFocusManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyInputFocusManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_KeyInputFocusManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + private KeyInputFocusManager() : this(NDalicPINVOKE.new_KeyInputFocusManager(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static KeyInputFocusManager Get() + { + KeyInputFocusManager ret = new KeyInputFocusManager(NDalicPINVOKE.KeyInputFocusManager_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFocus(View control) + { + NDalicPINVOKE.KeyInputFocusManager_SetFocus(swigCPtr, View.getCPtr(control)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public View GetCurrentFocusControl() + { + View ret = new View(NDalicPINVOKE.KeyInputFocusManager_GetCurrentFocusControl(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RemoveFocus(View control) + { + NDalicPINVOKE.KeyInputFocusManager_RemoveFocus(swigCPtr, View.getCPtr(control)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t KeyInputFocusChangedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t(NDalicPINVOKE.KeyInputFocusManager_KeyInputFocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/KeyInputFocusSignal.cs b/src/Tizen.NUI/src/internal/KeyInputFocusSignal.cs new file mode 100755 index 0000000..146220c --- /dev/null +++ b/src/Tizen.NUI/src/internal/KeyInputFocusSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class KeyInputFocusSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal KeyInputFocusSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyInputFocusSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~KeyInputFocusSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_KeyInputFocusSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.KeyInputFocusSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.KeyInputFocusSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.KeyInputFocusSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.KeyInputFocusSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg) + { + NDalicPINVOKE.KeyInputFocusSignal_Emit(swigCPtr, View.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public KeyInputFocusSignal() : this(NDalicPINVOKE.new_KeyInputFocusSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/KeyboardTypeSignalType.cs b/src/Tizen.NUI/src/internal/KeyboardTypeSignalType.cs new file mode 100755 index 0000000..6d8670d --- /dev/null +++ b/src/Tizen.NUI/src/internal/KeyboardTypeSignalType.cs @@ -0,0 +1,146 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class KeyboardTypeSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal KeyboardTypeSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyboardTypeSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~KeyboardTypeSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_KeyboardTypeSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.KeyboardTypeSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.KeyboardTypeSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.KeyboardTypeSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.KeyboardTypeSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(ImfManager.KeyboardType arg) + { + NDalicManualPINVOKE.KeyboardTypeSignalType_Emit(swigCPtr, (int)arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public KeyboardTypeSignalType() : this(NDalicManualPINVOKE.new_KeyboardTypeSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/LinearConstrainer.cs b/src/Tizen.NUI/src/internal/LinearConstrainer.cs new file mode 100755 index 0000000..5a21f4c --- /dev/null +++ b/src/Tizen.NUI/src/internal/LinearConstrainer.cs @@ -0,0 +1,229 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class LinearConstrainer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal LinearConstrainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LinearConstrainer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LinearConstrainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_LinearConstrainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_LinearConstrainer_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + internal Property() : this(NDalicPINVOKE.new_LinearConstrainer_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static readonly int VALUE = NDalicPINVOKE.LinearConstrainer_Property_VALUE_get(); + internal static readonly int PROGRESS = NDalicPINVOKE.LinearConstrainer_Property_PROGRESS_get(); + } + + public LinearConstrainer() : this(NDalicPINVOKE.LinearConstrainer_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal new static LinearConstrainer DownCast(BaseHandle handle) + { + LinearConstrainer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as LinearConstrainer; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal LinearConstrainer(LinearConstrainer handle) : this(NDalicPINVOKE.new_LinearConstrainer__SWIG_1(LinearConstrainer.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal LinearConstrainer Assign(LinearConstrainer rhs) + { + LinearConstrainer ret = new LinearConstrainer(NDalicPINVOKE.LinearConstrainer_Assign(swigCPtr, LinearConstrainer.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Apply(Property target, Property source, Vector2 range, Vector2 wrap) + { + NDalicPINVOKE.LinearConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Apply(Property target, Property source, Vector2 range) + { + NDalicPINVOKE.LinearConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Remove(Animatable target) + { + NDalicPINVOKE.LinearConstrainer_Remove(swigCPtr, Animatable.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyArray Value + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, LinearConstrainer.Property.VALUE).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, LinearConstrainer.Property.VALUE, new Tizen.NUI.PropertyValue(value)); + } + } + public PropertyArray Progress + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, LinearConstrainer.Property.PROGRESS).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, LinearConstrainer.Property.PROGRESS, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/LoadingState.cs b/src/Tizen.NUI/src/internal/LoadingState.cs new file mode 100755 index 0000000..8a99b06 --- /dev/null +++ b/src/Tizen.NUI/src/internal/LoadingState.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum LoadingState + { + ResourceLoading, + ResourceLoadingSucceeded, + ResourceLoadingFailed + } + +} diff --git a/src/Tizen.NUI/src/internal/LongPressGestureDetectedSignal.cs b/src/Tizen.NUI/src/internal/LongPressGestureDetectedSignal.cs new file mode 100755 index 0000000..1ba97fc --- /dev/null +++ b/src/Tizen.NUI/src/internal/LongPressGestureDetectedSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class LongPressGestureDetectedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal LongPressGestureDetectedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGestureDetectedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~LongPressGestureDetectedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_LongPressGestureDetectedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + + public bool Empty() + { + bool ret = NDalicPINVOKE.LongPressGestureDetectedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.LongPressGestureDetectedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.LongPressGestureDetectedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.LongPressGestureDetectedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, LongPressGesture arg2) + { + NDalicPINVOKE.LongPressGestureDetectedSignal_Emit(swigCPtr, View.getCPtr(arg1), LongPressGesture.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public LongPressGestureDetectedSignal() : this(NDalicPINVOKE.new_LongPressGestureDetectedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs b/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs new file mode 100755 index 0000000..a168ca7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/LongPressGestureDetector.cs @@ -0,0 +1,232 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + internal class LongPressGestureDetector : GestureDetector + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal LongPressGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LongPressGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGestureDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_LongPressGestureDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public class DetectedEventArgs : EventArgs + { + private View _view; + private LongPressGesture _longPressGesture; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + public LongPressGesture LongPressGesture + { + get + { + return _longPressGesture; + } + set + { + _longPressGesture = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr longPressGesture); + private DaliEventHandler _longPressGestureEventHandler; + private DetectedCallbackDelegate _longPressGestureCallbackDelegate; + + + public event DaliEventHandler Detected + { + add + { + lock (this) + { + // Restricted to only one listener + if (_longPressGestureEventHandler == null) + { + _longPressGestureEventHandler += value; + + _longPressGestureCallbackDelegate = new DetectedCallbackDelegate(OnLongPressGestureDetected); + this.DetectedSignal().Connect(_longPressGestureCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_longPressGestureEventHandler != null) + { + this.DetectedSignal().Disconnect(_longPressGestureCallbackDelegate); + } + + _longPressGestureEventHandler -= value; + } + } + } + + private void OnLongPressGestureDetected(IntPtr actor, IntPtr longPressGesture) + { + DetectedEventArgs e = new DetectedEventArgs(); + + // Populate all members of "e" (LongPressGestureEventArgs) with real data + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; + e.LongPressGesture = Tizen.NUI.LongPressGesture.GetLongPressGestureFromPtr(longPressGesture); + + if (_longPressGestureEventHandler != null) + { + //here we send all data to user event handlers + _longPressGestureEventHandler(this, e); + } + + } + + + public static LongPressGestureDetector GetLongPressGestureDetectorFromPtr(global::System.IntPtr cPtr) + { + LongPressGestureDetector ret = new LongPressGestureDetector(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public LongPressGestureDetector() : this(NDalicPINVOKE.LongPressGestureDetector_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public LongPressGestureDetector(uint touchesRequired) : this(NDalicPINVOKE.LongPressGestureDetector_New__SWIG_1(touchesRequired), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public LongPressGestureDetector(uint minTouches, uint maxTouches) : this(NDalicPINVOKE.LongPressGestureDetector_New__SWIG_2(minTouches, maxTouches), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static LongPressGestureDetector DownCast(BaseHandle handle) + { + LongPressGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as LongPressGestureDetector; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public LongPressGestureDetector(LongPressGestureDetector handle) : this(NDalicPINVOKE.new_LongPressGestureDetector__SWIG_1(LongPressGestureDetector.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public LongPressGestureDetector Assign(LongPressGestureDetector rhs) + { + LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.LongPressGestureDetector_Assign(swigCPtr, LongPressGestureDetector.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetTouchesRequired(uint touches) + { + NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_0(swigCPtr, touches); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetTouchesRequired(uint minTouches, uint maxTouches) + { + NDalicPINVOKE.LongPressGestureDetector_SetTouchesRequired__SWIG_1(swigCPtr, minTouches, maxTouches); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetMinimumTouchesRequired() + { + uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMinimumTouchesRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetMaximumTouchesRequired() + { + uint ret = NDalicPINVOKE.LongPressGestureDetector_GetMaximumTouchesRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal LongPressGestureDetectedSignal DetectedSignal() + { + LongPressGestureDetectedSignal ret = new LongPressGestureDetectedSignal(NDalicPINVOKE.LongPressGestureDetector_DetectedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ManualPINVOKE.cs b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs new file mode 100755 index 0000000..ba61c57 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ManualPINVOKE.cs @@ -0,0 +1,1043 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + class NDalicManualPINVOKE + { + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_new_KeyboardFocusManager")] + public static extern global::System.IntPtr new_FocusManager(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_delete_KeyboardFocusManager")] + public static extern void delete_FocusManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_Get")] + public static extern global::System.IntPtr FocusManager_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_SetCurrentFocusActor")] + public static extern bool FocusManager_SetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_GetCurrentFocusActor")] + public static extern global::System.IntPtr FocusManager_GetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_MoveFocus")] + public static extern bool FocusManager_MoveFocus(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_ClearFocus")] + public static extern void FocusManager_ClearFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_SetFocusGroupLoop")] + public static extern void FocusManager_SetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_GetFocusGroupLoop")] + public static extern bool FocusManager_GetFocusGroupLoop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_SetAsFocusGroup")] + public static extern void FocusManager_SetAsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_IsFocusGroup")] + public static extern bool FocusManager_IsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_GetFocusGroup")] + public static extern global::System.IntPtr FocusManager_GetFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_SetFocusIndicatorActor")] + public static extern void FocusManager_SetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_GetFocusIndicatorActor")] + public static extern global::System.IntPtr FocusManager_GetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_MoveFocusBackward")] + public static extern void FocusManager_MoveFocusBackward(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_PreFocusChangeSignal")] + public static extern global::System.IntPtr FocusManager_PreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_FocusChangedSignal")] + public static extern global::System.IntPtr FocusManager_FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_FocusGroupChangedSignal")] + public static extern global::System.IntPtr FocusManager_FocusGroupChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_FocusedActorEnterKeySignal")] + public static extern global::System.IntPtr FocusManager_FocusedActorEnterKeySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Empty")] + public static extern bool PreFocusChangeSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_GetConnectionCount")] + public static extern uint PreFocusChangeSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Connect")] + public static extern void PreFocusChangeSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, FocusManager.PreFocusChangeEventCallback delegate1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Disconnect")] + public static extern void PreFocusChangeSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardPreFocusChangeSignal_Emit")] + public static extern global::System.IntPtr PreFocusChangeSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_new_KeyboardPreFocusChangeSignal")] + public static extern global::System.IntPtr new_PreFocusChangeSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_delete_KeyboardPreFocusChangeSignal")] + public static extern void delete_PreFocusChangeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_KeyboardFocusManager_SWIGUpcast")] + public static extern global::System.IntPtr FocusManager_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapperImpl_CONTROL_BEHAVIOUR_FLAG_COUNT_get")] + public static extern int ViewWrapperImpl_CONTROL_BEHAVIOUR_FLAG_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ViewWrapperImpl")] + public static extern global::System.IntPtr new_ViewWrapperImpl(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapperImpl_New")] + public static extern global::System.IntPtr ViewWrapperImpl_New(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ViewWrapperImpl")] + public static extern void delete_ViewWrapperImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapperImpl_director_connect")] + public static extern void ViewWrapperImpl_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, ViewWrapperImpl.DelegateViewWrapperImpl_0 delegate0, ViewWrapperImpl.DelegateViewWrapperImpl_1 delegate1, ViewWrapperImpl.DelegateViewWrapperImpl_2 delegate2, ViewWrapperImpl.DelegateViewWrapperImpl_3 delegate3, ViewWrapperImpl.DelegateViewWrapperImpl_4 delegate4, ViewWrapperImpl.DelegateViewWrapperImpl_5 delegate5, ViewWrapperImpl.DelegateViewWrapperImpl_6 delegate6, ViewWrapperImpl.DelegateViewWrapperImpl_7 delegate7, ViewWrapperImpl.DelegateViewWrapperImpl_8 delegate8, ViewWrapperImpl.DelegateViewWrapperImpl_9 delegate9, ViewWrapperImpl.DelegateViewWrapperImpl_10 delegate10, ViewWrapperImpl.DelegateViewWrapperImpl_11 delegate11, ViewWrapperImpl.DelegateViewWrapperImpl_12 delegate12, ViewWrapperImpl.DelegateViewWrapperImpl_13 delegate13, ViewWrapperImpl.DelegateViewWrapperImpl_14 delegate14, ViewWrapperImpl.DelegateViewWrapperImpl_15 delegate15, ViewWrapperImpl.DelegateViewWrapperImpl_16 delegate16, ViewWrapperImpl.DelegateViewWrapperImpl_17 delegate17, ViewWrapperImpl.DelegateViewWrapperImpl_18 delegate18, ViewWrapperImpl.DelegateViewWrapperImpl_19 delegate19, ViewWrapperImpl.DelegateViewWrapperImpl_20 delegate20, ViewWrapperImpl.DelegateViewWrapperImpl_21 delegate21, ViewWrapperImpl.DelegateViewWrapperImpl_22 delegate22, ViewWrapperImpl.DelegateViewWrapperImpl_23 delegate23, ViewWrapperImpl.DelegateViewWrapperImpl_24 delegate24, ViewWrapperImpl.DelegateViewWrapperImpl_25 delegate25, ViewWrapperImpl.DelegateViewWrapperImpl_26 delegate26, ViewWrapperImpl.DelegateViewWrapperImpl_27 delegate27, ViewWrapperImpl.DelegateViewWrapperImpl_28 delegate28, ViewWrapperImpl.DelegateViewWrapperImpl_29 delegate29, ViewWrapperImpl.DelegateViewWrapperImpl_30 delegate30, ViewWrapperImpl.DelegateViewWrapperImpl_31 delegate31, ViewWrapperImpl.DelegateViewWrapperImpl_32 delegate32, ViewWrapperImpl.DelegateViewWrapperImpl_33 delegate33, ViewWrapperImpl.DelegateViewWrapperImpl_34 delegate34, ViewWrapperImpl.DelegateViewWrapperImpl_35 delegate35, ViewWrapperImpl.DelegateViewWrapperImpl_36 delegate36, ViewWrapperImpl.DelegateViewWrapperImpl_37 delegate37, ViewWrapperImpl.DelegateViewWrapperImpl_38 delegate38, ViewWrapperImpl.DelegateViewWrapperImpl_39 delegate39, ViewWrapperImpl.DelegateViewWrapperImpl_40 delegate40); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetControlWrapperImpl__SWIG_0")] + public static extern global::System.IntPtr GetControlWrapperImpl__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapper_New")] + public static extern global::System.IntPtr ViewWrapper_New(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ViewWrapper__SWIG_0")] + public static extern global::System.IntPtr new_ViewWrapper__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ViewWrapper")] + public static extern void delete_ViewWrapper(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ViewWrapper__SWIG_1")] + public static extern global::System.IntPtr new_ViewWrapper__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapper_Assign")] + public static extern global::System.IntPtr ViewWrapper_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapper_DownCast")] + public static extern global::System.IntPtr ViewWrapper_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapperImpl_SWIGUpcast")] + public static extern global::System.IntPtr ViewWrapperImpl_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapper_SWIGUpcast")] + public static extern global::System.IntPtr ViewWrapper_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_RelayoutRequest")] + public static extern void ViewWrapperImpl_RelayoutRequest(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_GetHeightForWidthBase")] + public static extern float ViewWrapperImpl_GetHeightForWidthBase(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_GetWidthForHeightBase")] + public static extern float ViewWrapperImpl_GetWidthForHeightBase(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_CalculateChildSizeBase")] + public static extern float ViewWrapperImpl_CalculateChildSizeBase(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_0")] + public static extern bool ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_1")] + public static extern bool ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_RegisterVisual__SWIG_0")] + public static extern void ViewWrapperImpl_RegisterVisual__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_RegisterVisual__SWIG_1")] + public static extern void ViewWrapperImpl_RegisterVisual__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_UnregisterVisual")] + public static extern void ViewWrapperImpl_UnregisterVisual(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_GetVisual")] + public static extern global::System.IntPtr ViewWrapperImpl_GetVisual(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_EnableVisual")] + public static extern void ViewWrapperImpl_EnableVisual(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_IsVisualEnabled")] + public static extern bool ViewWrapperImpl_IsVisualEnabled(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_CreateTransition")] + public static extern global::System.IntPtr ViewWrapperImpl_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_CreateTransition")] + public static extern global::System.IntPtr View_CreateTransition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ViewWrapperImpl_EmitKeyInputFocusSignal")] + public static extern void ViewWrapperImpl_EmitKeyInputFocusSignal(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewWrapperImpl_ApplyThemeStyle")] + public static extern void ViewWrapperImpl_ApplyThemeStyle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_EventThreadCallback")] + public static extern global::System.IntPtr new_EventThreadCallback(EventThreadCallback.CallbackDelegate delegate1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_EventThreadCallback")] + public static extern void delete_EventThreadCallback(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EventThreadCallback_Trigger")] + public static extern void EventThreadCallback_Trigger(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Actor_Property_SIBLING_ORDER_get")] + public static extern int Actor_Property_SIBLING_ORDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Actor_Property_OPACITY_get")] + public static extern int Actor_Property_OPACITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Actor_Property_SCREEN_POSITION_get")] + public static extern int Actor_Property_SCREEN_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Actor_Property_POSITION_USES_ANCHOR_POINT_get")] + public static extern int Actor_Property_POSITION_USES_ANCHOR_POINT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_TOOLTIP_get")] + public static extern int View_Property_TOOLTIP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_STATE_get")] + public static extern int View_Property_STATE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_SUB_STATE_get")] + public static extern int View_Property_SUB_STATE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_LEFT_FOCUSABLE_ACTOR_ID_get")] + public static extern int View_Property_LEFT_FOCUSABLE_ACTOR_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get")] + public static extern int View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_UP_FOCUSABLE_ACTOR_ID_get")] + public static extern int View_Property_UP_FOCUSABLE_ACTOR_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_View_Property_DOWN_FOCUSABLE_ACTOR_ID_get")] + public static extern int View_Property_DOWN_FOCUSABLE_ACTOR_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_ItemView_Property_LAYOUT_get")] + public static extern int ItemView_Property_LAYOUT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_UNSELECTED_VISUAL_get")] + public static extern int Button_Property_UNSELECTED_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_SELECTED_VISUAL_get")] + public static extern int Button_Property_SELECTED_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_DISABLED_SELECTED_VISUAL_get")] + public static extern int Button_Property_DISABLED_SELECTED_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_DISABLED_UNSELECTED_VISUAL_get")] + public static extern int Button_Property_DISABLED_UNSELECTED_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_UNSELECTED_BACKGROUND_VISUAL_get")] + public static extern int Button_Property_UNSELECTED_BACKGROUND_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_SELECTED_BACKGROUND_VISUAL_get")] + public static extern int Button_Property_SELECTED_BACKGROUND_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get")] + public static extern int Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get")] + public static extern int Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_LABEL_RELATIVE_ALIGNMENT_get")] + public static extern int Button_Property_LABEL_RELATIVE_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_LABEL_PADDING_get")] + public static extern int Button_Property_LABEL_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Button_Property_VISUAL_PADDING_get")] + public static extern int Button_Property_VISUAL_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Visual_Property_TRANSFORM_get")] + public static extern int Visual_Property_TRANSFORM_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Visual_Property_PREMULTIPLIED_ALPHA_get")] + public static extern int Visual_Property_PREMULTIPLIED_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Visual_Property_MIX_COLOR_get")] + public static extern int Visual_Property_MIX_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Image_Visual_BORDER_get")] + public static extern int Image_Visual_BORDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_NativeVersionCheck")] + public static extern bool NativeVersionCheck(ref int ver1, ref int ver2, ref int ver3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_GrabKeyTopmost")] + public static extern bool GrabKeyTopmost(System.IntPtr Window, int DaliKey); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_UngrabKeyTopmost")] + public static extern bool UngrabKeyTopmost(System.IntPtr Window, int DaliKey); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_GrabKey")] + public static extern bool GrabKey(System.IntPtr Window, int DaliKey, int GrabMode); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_UngrabKey")] + public static extern bool UngrabKey(System.IntPtr Window, int DaliKey); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_GetNativeWindowHandler")] + public static extern System.IntPtr GetNativeWindowHandler(System.IntPtr Window); + + //////////////////////ImfManager + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SWIGUpcast")] + public static extern global::System.IntPtr ImfManager_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfManager_ImfEventData__SWIG_0")] + public static extern global::System.IntPtr new_ImfManager_ImfEventData__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfManager_ImfEventData__SWIG_1")] + public static extern global::System.IntPtr new_ImfManager_ImfEventData__SWIG_1(int jarg1, string jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_predictiveString_set")] + public static extern void ImfManager_ImfEventData_predictiveString_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_predictiveString_get")] + public static extern string ImfManager_ImfEventData_predictiveString_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_eventName_set")] + public static extern void ImfManager_ImfEventData_eventName_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_eventName_get")] + public static extern int ImfManager_ImfEventData_eventName_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_cursorOffset_set")] + public static extern void ImfManager_ImfEventData_cursorOffset_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_cursorOffset_get")] + public static extern int ImfManager_ImfEventData_cursorOffset_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_numberOfChars_set")] + public static extern void ImfManager_ImfEventData_numberOfChars_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfEventData_numberOfChars_get")] + public static extern int ImfManager_ImfEventData_numberOfChars_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImfManager_ImfEventData")] + public static extern void delete_ImfManager_ImfEventData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfManager_ImfCallbackData__SWIG_0")] + public static extern global::System.IntPtr new_ImfManager_ImfCallbackData__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfManager_ImfCallbackData__SWIG_1")] + public static extern global::System.IntPtr new_ImfManager_ImfCallbackData__SWIG_1(bool jarg1, int jarg2, string jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_currentText_set")] + public static extern void ImfManager_ImfCallbackData_currentText_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_currentText_get")] + public static extern string ImfManager_ImfCallbackData_currentText_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_cursorPosition_set")] + public static extern void ImfManager_ImfCallbackData_cursorPosition_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_cursorPosition_get")] + public static extern int ImfManager_ImfCallbackData_cursorPosition_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_update_set")] + public static extern void ImfManager_ImfCallbackData_update_set(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_update_get")] + public static extern bool ImfManager_ImfCallbackData_update_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_preeditResetRequired_set")] + public static extern void ImfManager_ImfCallbackData_preeditResetRequired_set(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ImfCallbackData_preeditResetRequired_get")] + public static extern bool ImfManager_ImfCallbackData_preeditResetRequired_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImfManager_ImfCallbackData")] + public static extern void delete_ImfManager_ImfCallbackData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_Get")] + public static extern global::System.IntPtr ImfManager_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_Activate")] + public static extern void ImfManager_Activate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_Deactivate")] + public static extern void ImfManager_Deactivate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_RestoreAfterFocusLost")] + public static extern bool ImfManager_RestoreAfterFocusLost(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SetRestoreAfterFocusLost")] + public static extern void ImfManager_SetRestoreAfterFocusLost(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_Reset")] + public static extern void ImfManager_Reset(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_NotifyCursorPosition")] + public static extern void ImfManager_NotifyCursorPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SetCursorPosition")] + public static extern void ImfManager_SetCursorPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetCursorPosition")] + public static extern uint ImfManager_GetCursorPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SetSurroundingText")] + public static extern void ImfManager_SetSurroundingText(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetSurroundingText")] + public static extern string ImfManager_GetSurroundingText(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_NotifyTextInputMultiLine")] + public static extern void ImfManager_NotifyTextInputMultiLine(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetTextDirection")] + public static extern int ImfManager_GetTextDirection(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetInputMethodArea")] + public static extern global::System.IntPtr ImfManager_GetInputMethodArea(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ApplyOptions")] + public static extern void ImfManager_ApplyOptions(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SetInputPanelUserData")] + public static extern void ImfManager_SetInputPanelUserData(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetInputPanelUserData")] + public static extern void ImfManager_GetInputPanelUserData(global::System.Runtime.InteropServices.HandleRef jarg1, out string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetInputPanelState")] + public static extern int ImfManager_GetInputPanelState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_SetReturnKeyState")] + public static extern void ImfManager_SetReturnKeyState(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_AutoEnableInputPanel")] + public static extern void ImfManager_AutoEnableInputPanel(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ShowInputPanel")] + public static extern void ImfManager_ShowInputPanel(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_HideInputPanel")] + public static extern void ImfManager_HideInputPanel(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetKeyboardType")] + public static extern int ImfManager_GetKeyboardType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_GetInputPanelLocale")] + public static extern string ImfManager_GetInputPanelLocale(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ActivatedSignal")] + public static extern global::System.IntPtr ImfManager_ActivatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_EventReceivedSignal")] + public static extern global::System.IntPtr ImfManager_EventReceivedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_StatusChangedSignal")] + public static extern global::System.IntPtr ImfManager_StatusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_ResizedSignal")] + public static extern global::System.IntPtr ImfManager_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_LanguageChangedSignal")] + public static extern global::System.IntPtr ImfManager_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfManager_KeyboardTypeChangedSignal")] + public static extern global::System.IntPtr ImfManager_KeyboardTypeChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfManager")] + public static extern global::System.IntPtr new_ImfManager(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImfManager")] + public static extern void delete_ImfManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + ////////////////////// ImfManager signals + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActivatedSignalType_Empty")] + public static extern bool ActivatedSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActivatedSignalType_GetConnectionCount")] + public static extern uint ActivatedSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActivatedSignalType_Connect")] + public static extern void ActivatedSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActivatedSignalType_Disconnect")] + public static extern void ActivatedSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActivatedSignalType_Emit")] + public static extern void ActivatedSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActivatedSignalType")] + public static extern global::System.IntPtr new_ActivatedSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActivatedSignalType")] + public static extern void delete_ActivatedSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfEventSignalType_Empty")] + public static extern bool ImfEventSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfEventSignalType_GetConnectionCount")] + public static extern uint ImfEventSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfEventSignalType_Connect")] + public static extern void ImfEventSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfEventSignalType_Disconnect")] + public static extern void ImfEventSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfEventSignalType_Emit")] + public static extern global::System.IntPtr ImfEventSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfEventSignalType")] + public static extern global::System.IntPtr new_ImfEventSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImfEventSignalType")] + public static extern void delete_ImfEventSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImfVoidSignalType")] + public static extern global::System.IntPtr new_ImfVoidSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImfVoidSignalType")] + public static extern void delete_ImfVoidSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_Empty")] + public static extern bool ImfVoidSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_GetConnectionCount")] + public static extern uint ImfVoidSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_Connect__SWIG_0")] + public static extern void ImfVoidSignalType_Connect__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_Disconnect")] + public static extern void ImfVoidSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_Connect__SWIG_4")] + public static extern void ImfVoidSignalType_Connect__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImfVoidSignalType_Emit")] + public static extern void ImfVoidSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StatusSignalType_Empty")] + public static extern bool StatusSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StatusSignalType_GetConnectionCount")] + public static extern uint StatusSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StatusSignalType_Connect")] + public static extern void StatusSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StatusSignalType_Disconnect")] + public static extern void StatusSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StatusSignalType_Emit")] + public static extern void StatusSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StatusSignalType")] + public static extern global::System.IntPtr new_StatusSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StatusSignalType")] + public static extern void delete_StatusSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardTypeSignalType_Empty")] + public static extern bool KeyboardTypeSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardTypeSignalType_GetConnectionCount")] + public static extern uint KeyboardTypeSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardTypeSignalType_Connect")] + public static extern void KeyboardTypeSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardTypeSignalType_Disconnect")] + public static extern void KeyboardTypeSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyboardTypeSignalType_Emit")] + public static extern void KeyboardTypeSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyboardTypeSignalType")] + public static extern global::System.IntPtr new_KeyboardTypeSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyboardTypeSignalType")] + public static extern void delete_KeyboardTypeSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + //////////////////////InputMethodOptions + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_InputMethodOptions")] + public static extern global::System.IntPtr new_InputMethodOptions(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_InputMethodOptions_IsPassword")] + public static extern bool InputMethodOptions_IsPassword(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_InputMethodOptions_ApplyProperty")] + public static extern void InputMethodOptions_ApplyProperty(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_InputMethodOptions_RetrieveProperty")] + public static extern void InputMethodOptions_RetrieveProperty(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_InputMethodOptions_CompareAndSet")] + public static extern bool InputMethodOptions_CompareAndSet(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_InputMethodOptions")] + public static extern void delete_InputMethodOptions(global::System.Runtime.InteropServices.HandleRef jarg1); + + + ///////////////////////////////////////////////////////////// + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_SMOOTH_SCROLL_get")] + public static extern int TextEditor_Property_SMOOTH_SCROLL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_SMOOTH_SCROLL_DURATION_get")] + public static extern int TextEditor_Property_SMOOTH_SCROLL_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_ENABLE_SCROLL_BAR_get")] + public static extern int TextEditor_Property_ENABLE_SCROLL_BAR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_SCROLL_BAR_SHOW_DURATION_get")] + public static extern int TextEditor_Property_SCROLL_BAR_SHOW_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_SCROLL_BAR_FADE_DURATION_get")] + public static extern int TextEditor_Property_SCROLL_BAR_FADE_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_PIXEL_SIZE_get")] + public static extern int TextEditor_Property_PIXEL_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_LINE_COUNT_get")] + public static extern int TextEditor_Property_LINE_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_PLACEHOLDER_TEXT_get")] + public static extern int TextEditor_Property_PLACEHOLDER_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get")] + public static extern int TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_ENABLE_SELECTION_get")] + public static extern int TextEditor_Property_ENABLE_SELECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_PLACEHOLDER_get")] + public static extern int TextEditor_Property_PLACEHOLDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextEditor_Property_LINE_WRAP_MODE_get")] + public static extern int TextEditor_Property_LINE_WRAP_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextField_Property_HIDDEN_INPUT_SETTINGS_get")] + public static extern int TextField_Property_HIDDEN_INPUT_SETTINGS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextField_Property_PIXEL_SIZE_get")] + public static extern int TextField_Property_PIXEL_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextField_Property_ENABLE_SELECTION_get")] + public static extern int TextField_Property_ENABLE_SELECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextField_Property_PLACEHOLDER_get")] + public static extern int TextField_Property_PLACEHOLDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_PIXEL_SIZE_get")] + public static extern int TextLabel_Property_PIXEL_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_ELLIPSIS_get")] + public static extern int TextLabel_Property_ELLIPSIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_TextLabel_Property_AUTO_SCROLL_STOP_MODE_get")] + public static extern int TextLabel_Property_AUTO_SCROLL_STOP_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get")] + public static extern int TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_LINE_COUNT_get")] + public static extern int TextLabel_Property_LINE_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_TextLabel_Property_LINE_WRAP_MODE_get")] + public static extern int TextLabel_Property_LINE_WRAP_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_MODE_get")] + public static extern int HIDDENINPUT_PROPERTY_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get")] + public static extern int HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get")] + public static extern int HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_HIDDENINPUT_PROPERTY_SHOW_DURATION_get")] + public static extern int HIDDENINPUT_PROPERTY_SHOW_DURATION_get(); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_SWIGUpcast")] + public static extern global::System.IntPtr TtsPlayer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TtsPlayer__SWIG_0")] + public static extern global::System.IntPtr new_TtsPlayer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Get__SWIG_0")] + public static extern global::System.IntPtr TtsPlayer_Get__SWIG_0(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Get__SWIG_1")] + public static extern global::System.IntPtr TtsPlayer_Get__SWIG_1(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TtsPlayer")] + public static extern void delete_TtsPlayer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TtsPlayer__SWIG_1")] + public static extern global::System.IntPtr new_TtsPlayer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Assign")] + public static extern global::System.IntPtr TtsPlayer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Play")] + public static extern void TtsPlayer_Play(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Stop")] + public static extern void TtsPlayer_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Pause")] + public static extern void TtsPlayer_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_Resume")] + public static extern void TtsPlayer_Resume(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_GetState")] + public static extern int TtsPlayer_GetState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TtsPlayer_StateChangedSignal")] + public static extern global::System.IntPtr TtsPlayer_StateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Empty")] + public static extern bool StateChangedSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_GetConnectionCount")] + public static extern uint StateChangedSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Connect")] + public static extern void StateChangedSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Disconnect")] + public static extern void StateChangedSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StateChangedSignalType_Emit")] + public static extern void StateChangedSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StateChangedSignalType")] + public static extern global::System.IntPtr new_StateChangedSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StateChangedSignalType")] + public static extern void delete_StateChangedSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + //manual pinvoke for text-editor ScrollStateChangedSignal + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_ScrollStateChangedSignal")] + public static extern global::System.IntPtr TextEditor_ScrollStateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollStateChangedSignal_Empty")] + public static extern bool ScrollStateChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollStateChangedSignal_GetConnectionCount")] + public static extern uint ScrollStateChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollStateChangedSignal_Connect")] + public static extern void ScrollStateChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollStateChangedSignal_Disconnect")] + public static extern void ScrollStateChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollStateChangedSignal_Emit")] + public static extern void ScrollStateChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollStateChangedSignal")] + public static extern global::System.IntPtr new_ScrollStateChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollStateChangedSignal")] + public static extern void delete_ScrollStateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + // For windows resized signal + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_ResizedSignal")] + public static extern global::System.IntPtr Window_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizedSignal_Empty")] + public static extern bool ResizedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizedSignal_GetConnectionCount")] + public static extern uint ResizedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizedSignal_Connect")] + public static extern void ResizedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizedSignal_Disconnect")] + public static extern void ResizedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizedSignal_Emit")] + public static extern void ResizedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ResizedSignal")] + public static extern global::System.IntPtr new_ResizedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ResizedSignal")] + public static extern void delete_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SetSize")] + public static extern void SetSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetSize")] + public static extern global::System.IntPtr GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SetPosition")] + public static extern void SetPosition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetPosition")] + public static extern global::System.IntPtr GetPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + //for widget view + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_WIDGET_ID_get")] + public static extern int WidgetView_Property_WIDGET_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_INSTANCE_ID_get")] + public static extern int WidgetView_Property_INSTANCE_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_CONTENT_INFO_get")] + public static extern int WidgetView_Property_CONTENT_INFO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_TITLE_get")] + public static extern int WidgetView_Property_TITLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_UPDATE_PERIOD_get")] + public static extern int WidgetView_Property_UPDATE_PERIOD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_PREVIEW_get")] + public static extern int WidgetView_Property_PREVIEW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_LOADING_TEXT_get")] + public static extern int WidgetView_Property_LOADING_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_WIDGET_STATE_FAULTED_get")] + public static extern int WidgetView_Property_WIDGET_STATE_FAULTED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Property_PERMANENT_DELETE_get")] + public static extern int WidgetView_Property_PERMANENT_DELETE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView_Property")] + public static extern global::System.IntPtr new_WidgetView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetView_Property")] + public static extern void delete_WidgetView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_New")] + public static extern global::System.IntPtr WidgetView_New(string jarg1, string jarg2, int jarg3, int jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_DownCast")] + public static extern global::System.IntPtr WidgetView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView__SWIG_0")] + public static extern global::System.IntPtr new_WidgetView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetView__SWIG_1")] + public static extern global::System.IntPtr new_WidgetView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_Assign")] + public static extern global::System.IntPtr WidgetView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetView")] + public static extern void delete_WidgetView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_PauseWidget")] + public static extern bool WidgetView_PauseWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_ResumeWidget")] + public static extern bool WidgetView_ResumeWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_CancelTouchEvent")] + public static extern bool WidgetView_CancelTouchEvent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_ActivateFaultedWidget")] + public static extern void WidgetView_ActivateFaultedWidget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetAddedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetAddedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetDeletedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetDeletedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetCreationAbortedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetCreationAbortedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetContentUpdatedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetContentUpdatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetUpdatePeriodChangedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetUpdatePeriodChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_WidgetFaultedSignal")] + public static extern global::System.IntPtr WidgetView_WidgetFaultedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Empty")] + public static extern bool WidgetViewSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_GetConnectionCount")] + public static extern uint WidgetViewSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Connect")] + public static extern void WidgetViewSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Disconnect")] + public static extern void WidgetViewSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewSignal_Emit")] + public static extern void WidgetViewSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetViewSignal")] + public static extern global::System.IntPtr new_WidgetViewSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetViewSignal")] + public static extern void delete_WidgetViewSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetView_SWIGUpcast")] + public static extern global::System.IntPtr WidgetView_SWIGUpcast(global::System.IntPtr jarg1); + + // For widget view manager + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_New")] + public static extern global::System.IntPtr WidgetViewManager_New(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_DownCast")] + public static extern global::System.IntPtr WidgetViewManager_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetViewManager__SWIG_0")] + public static extern global::System.IntPtr new_WidgetViewManager__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_WidgetViewManager__SWIG_1")] + public static extern global::System.IntPtr new_WidgetViewManager__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_Assign")] + public static extern global::System.IntPtr WidgetViewManager_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_WidgetViewManager")] + public static extern void delete_WidgetViewManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_AddWidget")] + public static extern global::System.IntPtr WidgetViewManager_AddWidget(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5, float jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WidgetViewManager_SWIGUpcast")] + public static extern global::System.IntPtr WidgetViewManager_SWIGUpcast(global::System.IntPtr jarg1); + + //For Adaptor + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_0")] + public static extern global::System.IntPtr Adaptor_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_1")] + public static extern global::System.IntPtr Adaptor_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_2")] + public static extern global::System.IntPtr Adaptor_New__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_New__SWIG_3")] + public static extern global::System.IntPtr Adaptor_New__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Adaptor")] + public static extern void delete_Adaptor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Start")] + public static extern void Adaptor_Start(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Pause")] + public static extern void Adaptor_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Resume")] + public static extern void Adaptor_Resume(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Stop")] + public static extern void Adaptor_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_AddIdle")] + public static extern bool Adaptor_AddIdle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_RemoveIdle")] + public static extern void Adaptor_RemoveIdle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ReplaceSurface")] + public static extern void Adaptor_ReplaceSurface(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_GetSurface")] + public static extern global::System.IntPtr Adaptor_GetSurface(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_GetNativeWindowHandle")] + public static extern global::System.IntPtr Adaptor_GetNativeWindowHandle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ReleaseSurfaceLock")] + public static extern void Adaptor_ReleaseSurfaceLock(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetRenderRefreshRate")] + public static extern void Adaptor_SetRenderRefreshRate(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetUseHardwareVSync")] + public static extern void Adaptor_SetUseHardwareVSync(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_Get")] + public static extern global::System.IntPtr Adaptor_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_IsAvailable")] + public static extern bool Adaptor_IsAvailable(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_NotifySceneCreated")] + public static extern void Adaptor_NotifySceneCreated(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_NotifyLanguageChanged")] + public static extern void Adaptor_NotifyLanguageChanged(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetMinimumPinchDistance")] + public static extern void Adaptor_SetMinimumPinchDistance(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedTouchPoint")] + public static extern void Adaptor_FeedTouchPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedWheelEvent")] + public static extern void Adaptor_FeedWheelEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_FeedKeyEvent")] + public static extern void Adaptor_FeedKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SceneCreated")] + public static extern void Adaptor_SceneCreated(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetViewMode")] + public static extern void Adaptor_SetViewMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_SetStereoBase")] + public static extern void Adaptor_SetStereoBase(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_ResizedSignal")] + public static extern global::System.IntPtr Adaptor_ResizedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Adaptor_LanguageChangedSignal")] + public static extern global::System.IntPtr Adaptor_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + //Adaptor Signal Type + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Empty")] + public static extern bool AdaptorSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_GetConnectionCount")] + public static extern uint AdaptorSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Connect")] + public static extern void AdaptorSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Disconnect")] + public static extern void AdaptorSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AdaptorSignalType_Emit")] + public static extern void AdaptorSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AdaptorSignalType")] + public static extern global::System.IntPtr new_AdaptorSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AdaptorSignalType")] + public static extern void delete_AdaptorSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + } +} diff --git a/src/Tizen.NUI/src/internal/Matrix.cs b/src/Tizen.NUI/src/internal/Matrix.cs new file mode 100755 index 0000000..a60d193 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Matrix.cs @@ -0,0 +1,321 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class Matrix : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Matrix(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Matrix() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Matrix(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public static Vector4 operator *(Matrix arg1, Vector4 arg2) + { + return arg1.Multiply(arg2); + } + + public Matrix() : this(NDalicPINVOKE.new_Matrix__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix(bool initialize) : this(NDalicPINVOKE.new_Matrix__SWIG_1(initialize), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix(float[] array) : this(NDalicPINVOKE.new_Matrix__SWIG_2(array), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix(Rotation rotation) : this(NDalicPINVOKE.new_Matrix__SWIG_3(Rotation.getCPtr(rotation)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix(Matrix matrix) : this(NDalicPINVOKE.new_Matrix__SWIG_4(Matrix.getCPtr(matrix)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix Assign(Matrix matrix) + { + Matrix ret = new Matrix(NDalicPINVOKE.Matrix_Assign(swigCPtr, Matrix.getCPtr(matrix)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Matrix IDENTITY + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Matrix_IDENTITY_get(); + Matrix ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public void SetIdentity() + { + NDalicPINVOKE.Matrix_SetIdentity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetIdentityAndScale(Vector3 scale) + { + NDalicPINVOKE.Matrix_SetIdentityAndScale(swigCPtr, Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void InvertTransform(Matrix result) + { + NDalicPINVOKE.Matrix_InvertTransform(swigCPtr, Matrix.getCPtr(result)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool Invert() + { + bool ret = NDalicPINVOKE.Matrix_Invert(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Transpose() + { + NDalicPINVOKE.Matrix_Transpose(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector3 GetXAxis() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Matrix_GetXAxis(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector3 GetYAxis() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Matrix_GetYAxis(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector3 GetZAxis() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Matrix_GetZAxis(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetXAxis(Vector3 axis) + { + NDalicPINVOKE.Matrix_SetXAxis(swigCPtr, Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetYAxis(Vector3 axis) + { + NDalicPINVOKE.Matrix_SetYAxis(swigCPtr, Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetZAxis(Vector3 axis) + { + NDalicPINVOKE.Matrix_SetZAxis(swigCPtr, Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector4 GetTranslation() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Matrix_GetTranslation(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector3 GetTranslation3() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Matrix_GetTranslation3(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetTranslation(Vector4 translation) + { + NDalicPINVOKE.Matrix_SetTranslation__SWIG_0(swigCPtr, Vector4.getCPtr(translation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetTranslation(Vector3 translation) + { + NDalicPINVOKE.Matrix_SetTranslation__SWIG_1(swigCPtr, Vector3.getCPtr(translation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void OrthoNormalize() + { + NDalicPINVOKE.Matrix_OrthoNormalize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public SWIGTYPE_p_float AsFloat() + { + global::System.IntPtr cPtr = NDalicPINVOKE.Matrix_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void Multiply(Matrix result, Matrix lhs, Matrix rhs) + { + NDalicPINVOKE.Matrix_Multiply__SWIG_0(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Matrix.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void Multiply(Matrix result, Matrix lhs, Rotation rhs) + { + NDalicPINVOKE.Matrix_Multiply__SWIG_1(Matrix.getCPtr(result), Matrix.getCPtr(lhs), Rotation.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector4 Multiply(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Matrix_Multiply__SWIG_2(swigCPtr, Vector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Matrix rhs) + { + bool ret = NDalicPINVOKE.Matrix_EqualTo(swigCPtr, Matrix.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Matrix rhs) + { + bool ret = NDalicPINVOKE.Matrix_NotEqualTo(swigCPtr, Matrix.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation) + { + NDalicPINVOKE.Matrix_SetTransformComponents(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetInverseTransformComponents(Vector3 scale, Rotation rotation, Vector3 translation) + { + NDalicPINVOKE.Matrix_SetInverseTransformComponents__SWIG_0(swigCPtr, Vector3.getCPtr(scale), Rotation.getCPtr(rotation), Vector3.getCPtr(translation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetInverseTransformComponents(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 translation) + { + NDalicPINVOKE.Matrix_SetInverseTransformComponents__SWIG_1(swigCPtr, Vector3.getCPtr(xAxis), Vector3.getCPtr(yAxis), Vector3.getCPtr(zAxis), Vector3.getCPtr(translation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void GetTransformComponents(Vector3 position, Rotation rotation, Vector3 scale) + { + NDalicPINVOKE.Matrix_GetTransformComponents(swigCPtr, Vector3.getCPtr(position), Rotation.getCPtr(rotation), Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Matrix3.cs b/src/Tizen.NUI/src/internal/Matrix3.cs new file mode 100755 index 0000000..7f14709 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Matrix3.cs @@ -0,0 +1,217 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class Matrix3 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Matrix3(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Matrix3 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Matrix3() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Matrix3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public static Matrix3 IDENTITY + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Matrix3_IDENTITY_get(); + Matrix3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Matrix3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Matrix3() : this(NDalicPINVOKE.new_Matrix3__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix3(Matrix3 m) : this(NDalicPINVOKE.new_Matrix3__SWIG_1(Matrix3.getCPtr(m)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix3(Matrix m) : this(NDalicPINVOKE.new_Matrix3__SWIG_2(Matrix.getCPtr(m)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix3(float s00, float s01, float s02, float s10, float s11, float s12, float s20, float s21, float s22) : this(NDalicPINVOKE.new_Matrix3__SWIG_3(s00, s01, s02, s10, s11, s12, s20, s21, s22), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Matrix3 Assign(Matrix3 matrix) + { + Matrix3 ret = new Matrix3(NDalicPINVOKE.Matrix3_Assign__SWIG_0(swigCPtr, Matrix3.getCPtr(matrix)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Matrix3 Assign(Matrix matrix) + { + Matrix3 ret = new Matrix3(NDalicPINVOKE.Matrix3_Assign__SWIG_1(swigCPtr, Matrix.getCPtr(matrix)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EqualTo(Matrix3 rhs) + { + bool ret = NDalicPINVOKE.Matrix3_EqualTo(swigCPtr, Matrix3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(Matrix3 rhs) + { + bool ret = NDalicPINVOKE.Matrix3_NotEqualTo(swigCPtr, Matrix3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetIdentity() + { + NDalicPINVOKE.Matrix3_SetIdentity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public SWIGTYPE_p_float AsFloat() + { + global::System.IntPtr cPtr = NDalicPINVOKE.Matrix3_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Invert() + { + bool ret = NDalicPINVOKE.Matrix3_Invert(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Transpose() + { + bool ret = NDalicPINVOKE.Matrix3_Transpose(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Scale(float scale) + { + NDalicPINVOKE.Matrix3_Scale(swigCPtr, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float Magnitude() + { + float ret = NDalicPINVOKE.Matrix3_Magnitude(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool ScaledInverseTranspose() + { + bool ret = NDalicPINVOKE.Matrix3_ScaledInverseTranspose(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void Multiply(Matrix3 result, Matrix3 lhs, Matrix3 rhs) + { + NDalicPINVOKE.Matrix3_Multiply(Matrix3.getCPtr(result), Matrix3.getCPtr(lhs), Matrix3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Model3dView.cs b/src/Tizen.NUI/src/internal/Model3dView.cs new file mode 100755 index 0000000..cb053aa --- /dev/null +++ b/src/Tizen.NUI/src/internal/Model3dView.cs @@ -0,0 +1,309 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class Model3dView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Model3dView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Model3dView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Model3dView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Model3dView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Model3dView_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Property() : this(NDalicPINVOKE.new_Model3dView_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int GEOMETRY_URL = NDalicPINVOKE.Model3dView_Property_GEOMETRY_URL_get(); + public static readonly int MATERIAL_URL = NDalicPINVOKE.Model3dView_Property_MATERIAL_URL_get(); + public static readonly int IMAGES_URL = NDalicPINVOKE.Model3dView_Property_IMAGES_URL_get(); + public static readonly int ILLUMINATION_TYPE = NDalicPINVOKE.Model3dView_Property_ILLUMINATION_TYPE_get(); + public static readonly int TEXTURE0_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE0_URL_get(); + public static readonly int TEXTURE1_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE1_URL_get(); + public static readonly int TEXTURE2_URL = NDalicPINVOKE.Model3dView_Property_TEXTURE2_URL_get(); + public static readonly int LIGHT_POSITION = NDalicPINVOKE.Model3dView_Property_LIGHT_POSITION_get(); + + } + + public Model3dView() : this(NDalicPINVOKE.Model3dView_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Model3dView(string objUrl, string mtlUrl, string imagesUrl) : this(NDalicPINVOKE.Model3dView_New__SWIG_1(objUrl, mtlUrl, imagesUrl), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Model3dView(Model3dView model3dView) : this(NDalicPINVOKE.new_Model3dView__SWIG_1(Model3dView.getCPtr(model3dView)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Model3dView Assign(Model3dView model3dView) + { + Model3dView ret = new Model3dView(NDalicPINVOKE.Model3dView_Assign(swigCPtr, Model3dView.getCPtr(model3dView)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new static Model3dView DownCast(BaseHandle handle) + { + Model3dView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Model3dView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum IluminationTypeEnum + { + DIFFUSE, + DIFFUSE_WITH_TEXTURE, + DIFFUSE_WITH_NORMAL_MAP + } + + public string GeometryUrl + { + get + { + string temp; + GetProperty(Model3dView.Property.GEOMETRY_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.GEOMETRY_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public string MaterialUrl + { + get + { + string temp; + GetProperty(Model3dView.Property.MATERIAL_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.MATERIAL_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public string ImagesUrl + { + get + { + string temp; + GetProperty(Model3dView.Property.IMAGES_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.IMAGES_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public int IlluminationType + { + get + { + int temp = 0; + GetProperty(Model3dView.Property.ILLUMINATION_TYPE).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.ILLUMINATION_TYPE, new Tizen.NUI.PropertyValue(value)); + } + } + public string Texture0Url + { + get + { + string temp; + GetProperty(Model3dView.Property.TEXTURE0_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.TEXTURE0_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public string Texture1Url + { + get + { + string temp; + GetProperty(Model3dView.Property.TEXTURE1_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.TEXTURE1_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public string Texture2Url + { + get + { + string temp; + GetProperty(Model3dView.Property.TEXTURE2_URL).Get(out temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.TEXTURE2_URL, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector3 LightPosition + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(Model3dView.Property.LIGHT_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(Model3dView.Property.LIGHT_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/NDalic.cs b/src/Tizen.NUI/src/internal/NDalic.cs new file mode 100755 index 0000000..b9b3ce3 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NDalic.cs @@ -0,0 +1,981 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class NDalic + { + public static uint int_to_uint(int x) + { + uint ret = NDalicPINVOKE.int_to_uint(x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public static readonly int VISUAL_PROPERTY_TRANSFORM = NDalicManualPINVOKE.Visual_Property_TRANSFORM_get(); + public static readonly int VISUAL_PROPERTY_PREMULTIPLIED_ALPHA = NDalicManualPINVOKE.Visual_Property_PREMULTIPLIED_ALPHA_get(); + public static readonly int VISUAL_PROPERTY_MIX_COLOR = NDalicManualPINVOKE.Visual_Property_MIX_COLOR_get(); + public static readonly int IMAGE_VISUAL_BORDER = NDalicManualPINVOKE.Image_Visual_BORDER_get(); + + public static void DaliAssertMessage(string location, string condition) + { + NDalicPINVOKE.DaliAssertMessage(location, condition); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static Vector2 Min(Vector2 a, Vector2 b) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Min__SWIG_0(Vector2.getCPtr(a), Vector2.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector2 Max(Vector2 a, Vector2 b) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Max__SWIG_0(Vector2.getCPtr(a), Vector2.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector2 Clamp(Vector2 v, float min, float max) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Clamp__SWIG_0(Vector2.getCPtr(v), min, max), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector3 Min(Vector3 a, Vector3 b) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Min__SWIG_1(Vector3.getCPtr(a), Vector3.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector3 Max(Vector3 a, Vector3 b) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Max__SWIG_1(Vector3.getCPtr(a), Vector3.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector3 Clamp(Vector3 v, float min, float max) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Clamp__SWIG_1(Vector3.getCPtr(v), min, max), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector4 Min(Vector4 a, Vector4 b) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Min__SWIG_2(Vector4.getCPtr(a), Vector4.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector4 Max(Vector4 a, Vector4 b) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Max__SWIG_2(Vector4.getCPtr(a), Vector4.getCPtr(b)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static Vector4 Clamp(Vector4 v, float min, float max) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Clamp__SWIG_2(Vector4.getCPtr(v), min, max), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static bool EqualTo(AngleAxis lhs, AngleAxis rhs) + { + bool ret = NDalicPINVOKE.EqualTo__SWIG_9(AngleAxis.getCPtr(lhs), AngleAxis.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static uint NextPowerOfTwo(uint i) + { + uint ret = NDalicPINVOKE.NextPowerOfTwo(i); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static bool IsPowerOfTwo(uint i) + { + bool ret = NDalicPINVOKE.IsPowerOfTwo(i); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static float GetRangedEpsilon(float a, float b) + { + float ret = NDalicPINVOKE.GetRangedEpsilon(a, b); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static bool EqualsZero(float value) + { + bool ret = NDalicPINVOKE.EqualsZero(value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static bool Equals(float a, float b) + { + bool ret = NDalicPINVOKE.Equals__SWIG_0(a, b); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static bool Equals(float a, float b, float epsilon) + { + bool ret = NDalicPINVOKE.Equals__SWIG_1(a, b, epsilon); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static float Round(float value, int pos) + { + float ret = NDalicPINVOKE.Round(value, pos); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static float WrapInDomain(float x, float start, float end) + { + float ret = NDalicPINVOKE.WrapInDomain(x, start, end); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static float ShortestDistanceInDomain(float a, float b, float start, float end) + { + float ret = NDalicPINVOKE.ShortestDistanceInDomain(a, b, start, end); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static string GetName(PropertyType type) + { + string ret = NDalicPINVOKE.GetName((int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static BaseObject GetImplementation(BaseHandle handle) + { + BaseObject ret = new BaseObject(NDalicPINVOKE.GetImplementation(BaseHandle.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition LessThanCondition(float arg) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.LessThanCondition(arg), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition GreaterThanCondition(float arg) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.GreaterThanCondition(arg), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition InsideCondition(float arg0, float arg1) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.InsideCondition(arg0, arg1), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition OutsideCondition(float arg0, float arg1) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.OutsideCondition(arg0, arg1), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition StepCondition(float stepAmount, float initialValue) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_0(stepAmount, initialValue), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static PropertyCondition StepCondition(float stepAmount) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.StepCondition__SWIG_1(stepAmount), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static int WEIGHT + { + get + { + int ret = NDalicPINVOKE.WEIGHT_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool RegisterType(string name, SWIGTYPE_p_std__type_info baseType, System.Delegate f) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(f); + { + bool ret = NDalicPINVOKE.RegisterType(name, SWIGTYPE_p_std__type_info.getCPtr(baseType), new System.Runtime.InteropServices.HandleRef(null, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool RegisterProperty(string objectName, string name, int index, PropertyType type, System.Delegate setFunc, System.Delegate getFunc) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(setFunc); + System.IntPtr ip2 = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(getFunc); + { + bool ret = NDalicPINVOKE.RegisterProperty(objectName, name, index, (int)type, new System.Runtime.InteropServices.HandleRef(null, ip), new System.Runtime.InteropServices.HandleRef(null, ip2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float ParentOriginTop + { + get + { + float ret = NDalicPINVOKE.ParentOriginTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float ParentOriginBottom + { + get + { + float ret = NDalicPINVOKE.ParentOriginBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float ParentOriginLeft + { + get + { + float ret = NDalicPINVOKE.ParentOriginLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float ParentOriginRight + { + get + { + float ret = NDalicPINVOKE.ParentOriginRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float ParentOriginMiddle + { + get + { + float ret = NDalicPINVOKE.ParentOriginMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 ParentOriginBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float AnchorPointTop + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float AnchorPointBottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float AnchorPointLeft + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float AnchorPointRight + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static float AnchorPointMiddle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector3 AnchorPointBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 BLACK + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.BLACK_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 WHITE + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.WHITE_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 RED + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.RED_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 GREEN + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.GREEN_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 BLUE + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.BLUE_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 YELLOW + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.YELLOW_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 MAGENTA + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.MAGENTA_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 CYAN + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.CYAN_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 TRANSPARENT + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TRANSPARENT_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_0 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_0_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_1 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_1_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_10 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_10_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_100 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_100_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_1000 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_1000_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static float MACHINE_EPSILON_10000 + { + get + { + float ret = NDalicPINVOKE.MACHINE_EPSILON_10000_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static PixelFormat FIRST_VALID_PIXEL_FORMAT + { + get + { + PixelFormat ret = (PixelFormat)NDalicPINVOKE.FIRST_VALID_PIXEL_FORMAT_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static PixelFormat LAST_VALID_PIXEL_FORMAT + { + get + { + PixelFormat ret = (PixelFormat)NDalicPINVOKE.LAST_VALID_PIXEL_FORMAT_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static bool HasAlpha(PixelFormat pixelformat) + { + bool ret = NDalicPINVOKE.HasAlpha((int)pixelformat); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static uint GetBytesPerPixel(PixelFormat pixelFormat) + { + uint ret = NDalicPINVOKE.GetBytesPerPixel((int)pixelFormat); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static void GetAlphaOffsetAndMask(PixelFormat pixelFormat, SWIGTYPE_p_int byteOffset, SWIGTYPE_p_int bitMask) + { + NDalicPINVOKE.GetAlphaOffsetAndMask((int)pixelFormat, SWIGTYPE_p_int.getCPtr(byteOffset), SWIGTYPE_p_int.getCPtr(bitMask)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static uint POSITIVE_X + { + get + { + uint ret = NDalicPINVOKE.POSITIVE_X_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static uint NEGATIVE_X + { + get + { + uint ret = NDalicPINVOKE.NEGATIVE_X_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static uint POSITIVE_Y + { + get + { + uint ret = NDalicPINVOKE.POSITIVE_Y_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static uint NEGATIVE_Y + { + get + { + uint ret = NDalicPINVOKE.NEGATIVE_Y_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static uint POSITIVE_Z + { + get + { + uint ret = NDalicPINVOKE.POSITIVE_Z_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static uint NEGATIVE_Z + { + get + { + uint ret = NDalicPINVOKE.NEGATIVE_Z_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private static string GetDeviceName(Key keyEvent) + { + string ret = NDalicPINVOKE.GetDeviceName(Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static DeviceClassType GetDeviceClass(Key keyEvent) + { + DeviceClassType ret = (DeviceClassType)NDalicPINVOKE.GetDeviceClass(Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void Raise(View view) + { + NDalicPINVOKE.Raise(View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void Lower(View view) + { + NDalicPINVOKE.Lower(View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void RaiseToTop(View view) + { + NDalicPINVOKE.RaiseToTop(View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void LowerToBottom(View view) + { + NDalicPINVOKE.LowerToBottom(View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void RaiseAbove(View view, View target) + { + NDalicPINVOKE.RaiseAbove(View.getCPtr(view), View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static void LowerBelow(View view, View target) + { + NDalicPINVOKE.LowerBelow(View.getCPtr(view), View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static ViewImpl GetImplementation(View handle) + { + ViewImpl ret = new ViewImpl(NDalicPINVOKE.GetImplementation__SWIG_0(View.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t NewItemLayout(DefaultItemLayoutType type) + { + SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t ret = new SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(NDalicPINVOKE.NewItemLayout((int)type), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static void SetCustomAlgorithm(SWIGTYPE_p_KeyboardFocusManager keyboardFocusManager, CustomAlgorithmInterface arg1) + { + NDalicPINVOKE.SetCustomAlgorithm(SWIGTYPE_p_KeyboardFocusManager.getCPtr(keyboardFocusManager), CustomAlgorithmInterface.getCPtr(arg1)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static readonly int VISUAL_PROPERTY_TYPE = NDalicPINVOKE.VISUAL_PROPERTY_TYPE_get(); + internal static readonly int VISUAL_PROPERTY_SHADER = NDalicPINVOKE.VISUAL_PROPERTY_SHADER_get(); + + internal static readonly int VISUAL_SHADER_VERTEX = NDalicPINVOKE.VISUAL_SHADER_VERTEX_get(); + internal static readonly int VISUAL_SHADER_FRAGMENT = NDalicPINVOKE.VISUAL_SHADER_FRAGMENT_get(); + internal static readonly int VISUAL_SHADER_SUBDIVIDE_GRID_X = NDalicPINVOKE.VISUAL_SHADER_SUBDIVIDE_GRID_X_get(); + internal static readonly int VISUAL_SHADER_SUBDIVIDE_GRID_Y = NDalicPINVOKE.VISUAL_SHADER_SUBDIVIDE_GRID_Y_get(); + internal static readonly int VISUAL_SHADER_HINTS = NDalicPINVOKE.VISUAL_SHADER_HINTS_get(); + + internal static readonly int BORDER_VISUAL_COLOR = NDalicPINVOKE.BORDER_VISUAL_COLOR_get(); + internal static readonly int BORDER_VISUAL_SIZE = NDalicPINVOKE.BORDER_VISUAL_SIZE_get(); + internal static readonly int BORDER_VISUAL_ANTI_ALIASING = NDalicPINVOKE.BORDER_VISUAL_ANTI_ALIASING_get(); + + internal static readonly int COLOR_VISUAL_MIX_COLOR = NDalicPINVOKE.COLOR_VISUAL_MIX_COLOR_get(); + + internal static readonly int GRADIENT_VISUAL_START_POSITION = NDalicPINVOKE.GRADIENT_VISUAL_START_POSITION_get(); + internal static readonly int GRADIENT_VISUAL_END_POSITION = NDalicPINVOKE.GRADIENT_VISUAL_END_POSITION_get(); + internal static readonly int GRADIENT_VISUAL_CENTER = NDalicPINVOKE.GRADIENT_VISUAL_CENTER_get(); + internal static readonly int GRADIENT_VISUAL_RADIUS = NDalicPINVOKE.GRADIENT_VISUAL_RADIUS_get(); + internal static readonly int GRADIENT_VISUAL_STOP_OFFSET = NDalicPINVOKE.GRADIENT_VISUAL_STOP_OFFSET_get(); + internal static readonly int GRADIENT_VISUAL_STOP_COLOR = NDalicPINVOKE.GRADIENT_VISUAL_STOP_COLOR_get(); + internal static readonly int GRADIENT_VISUAL_UNITS = NDalicPINVOKE.GRADIENT_VISUAL_UNITS_get(); + internal static readonly int GRADIENT_VISUAL_SPREAD_METHOD = NDalicPINVOKE.GRADIENT_VISUAL_SPREAD_METHOD_get(); + + internal static readonly int IMAGE_VISUAL_URL = NDalicPINVOKE.IMAGE_VISUAL_URL_get(); + internal static readonly int IMAGE_VISUAL_ALPHA_MASK_URL = NDalicPINVOKE.IMAGE_VISUAL_ALPHA_MASK_URL_get(); + internal static readonly int IMAGE_VISUAL_FITTING_MODE = NDalicPINVOKE.IMAGE_VISUAL_FITTING_MODE_get(); + internal static readonly int IMAGE_VISUAL_SAMPLING_MODE = NDalicPINVOKE.IMAGE_VISUAL_SAMPLING_MODE_get(); + internal static readonly int IMAGE_VISUAL_DESIRED_WIDTH = NDalicPINVOKE.IMAGE_VISUAL_DESIRED_WIDTH_get(); + internal static readonly int IMAGE_VISUAL_DESIRED_HEIGHT = NDalicPINVOKE.IMAGE_VISUAL_DESIRED_HEIGHT_get(); + internal static readonly int IMAGE_VISUAL_SYNCHRONOUS_LOADING = NDalicPINVOKE.IMAGE_VISUAL_SYNCHRONOUS_LOADING_get(); + internal static readonly int IMAGE_VISUAL_BORDER_ONLY = NDalicPINVOKE.IMAGE_VISUAL_BORDER_ONLY_get(); + internal static readonly int IMAGE_VISUAL_PIXEL_AREA = NDalicPINVOKE.IMAGE_VISUAL_PIXEL_AREA_get(); + internal static readonly int IMAGE_VISUAL_WRAP_MODE_U = NDalicPINVOKE.IMAGE_VISUAL_WRAP_MODE_U_get(); + internal static readonly int IMAGE_VISUAL_WRAP_MODE_V = NDalicPINVOKE.IMAGE_VISUAL_WRAP_MODE_V_get(); + internal static readonly int IMAGE_VISUAL_BATCH_SIZE = NDalicPINVOKE.IMAGE_VISUAL_BATCH_SIZE_get(); + internal static readonly int IMAGE_VISUAL_CACHE_SIZE = NDalicPINVOKE.IMAGE_VISUAL_CACHE_SIZE_get(); + internal static readonly int IMAGE_VISUAL_FRAME_DELAY = NDalicPINVOKE.IMAGE_VISUAL_FRAME_DELAY_get(); + internal static readonly int IMAGE_VISUAL_MASK_CONTENT_SCALE = NDalicPINVOKE.IMAGE_VISUAL_MASK_CONTENT_SCALE_get(); + internal static readonly int IMAGE_VISUAL_CROP_TO_MASK = NDalicPINVOKE.IMAGE_VISUAL_CROP_TO_MASK_get(); + + internal static readonly int MESH_VISUAL_OBJECT_URL = NDalicPINVOKE.MESH_VISUAL_OBJECT_URL_get(); + internal static readonly int MESH_VISUAL_MATERIAL_URL = NDalicPINVOKE.MESH_VISUAL_MATERIAL_URL_get(); + internal static readonly int MESH_VISUAL_TEXTURES_PATH = NDalicPINVOKE.MESH_VISUAL_TEXTURES_PATH_get(); + internal static readonly int MESH_VISUAL_SHADING_MODE = NDalicPINVOKE.MESH_VISUAL_SHADING_MODE_get(); + internal static readonly int MESH_VISUAL_USE_MIPMAPPING = NDalicPINVOKE.MESH_VISUAL_USE_MIPMAPPING_get(); + internal static readonly int MESH_VISUAL_USE_SOFT_NORMALS = NDalicPINVOKE.MESH_VISUAL_USE_SOFT_NORMALS_get(); + internal static readonly int MESH_VISUAL_LIGHT_POSITION = NDalicPINVOKE.MESH_VISUAL_LIGHT_POSITION_get(); + + internal static readonly int PRIMITIVE_VISUAL_SHAPE = NDalicPINVOKE.PRIMITIVE_VISUAL_SHAPE_get(); + internal static readonly int PRIMITIVE_VISUAL_MIX_COLOR = NDalicPINVOKE.PRIMITIVE_VISUAL_MIX_COLOR_get(); + internal static readonly int PRIMITIVE_VISUAL_SLICES = NDalicPINVOKE.PRIMITIVE_VISUAL_SLICES_get(); + internal static readonly int PRIMITIVE_VISUAL_STACKS = NDalicPINVOKE.PRIMITIVE_VISUAL_STACKS_get(); + internal static readonly int PRIMITIVE_VISUAL_SCALE_TOP_RADIUS = NDalicPINVOKE.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS_get(); + internal static readonly int PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS = NDalicPINVOKE.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS_get(); + internal static readonly int PRIMITIVE_VISUAL_SCALE_HEIGHT = NDalicPINVOKE.PRIMITIVE_VISUAL_SCALE_HEIGHT_get(); + internal static readonly int PRIMITIVE_VISUAL_SCALE_RADIUS = NDalicPINVOKE.PRIMITIVE_VISUAL_SCALE_RADIUS_get(); + internal static readonly int PRIMITIVE_VISUAL_SCALE_DIMENSIONS = NDalicPINVOKE.PRIMITIVE_VISUAL_SCALE_DIMENSIONS_get(); + internal static readonly int PRIMITIVE_VISUAL_BEVEL_PERCENTAGE = NDalicPINVOKE.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE_get(); + internal static readonly int PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS = NDalicPINVOKE.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS_get(); + internal static readonly int PRIMITIVE_VISUAL_LIGHT_POSITION = NDalicPINVOKE.PRIMITIVE_VISUAL_LIGHT_POSITION_get(); + + internal static readonly int TEXT_VISUAL_TEXT = NDalicPINVOKE.TEXT_VISUAL_TEXT_get(); + internal static readonly int TEXT_VISUAL_FONT_FAMILY = NDalicPINVOKE.TEXT_VISUAL_FONT_FAMILY_get(); + internal static readonly int TEXT_VISUAL_FONT_STYLE = NDalicPINVOKE.TEXT_VISUAL_FONT_STYLE_get(); + internal static readonly int TEXT_VISUAL_POINT_SIZE = NDalicPINVOKE.TEXT_VISUAL_POINT_SIZE_get(); + internal static readonly int TEXT_VISUAL_MULTI_LINE = NDalicPINVOKE.TEXT_VISUAL_MULTI_LINE_get(); + internal static readonly int TEXT_VISUAL_HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TEXT_VISUAL_HORIZONTAL_ALIGNMENT_get(); + internal static readonly int TEXT_VISUAL_VERTICAL_ALIGNMENT = NDalicPINVOKE.TEXT_VISUAL_VERTICAL_ALIGNMENT_get(); + internal static readonly int TEXT_VISUAL_TEXT_COLOR = NDalicPINVOKE.TEXT_VISUAL_TEXT_COLOR_get(); + internal static readonly int TEXT_VISUAL_ENABLE_MARKUP = NDalicPINVOKE.TEXT_VISUAL_ENABLE_MARKUP_get(); + + internal static readonly int TOOLTIP_CONTENT = NDalicPINVOKE.TOOLTIP_CONTENT_get(); + internal static readonly int TOOLTIP_LAYOUT = NDalicPINVOKE.TOOLTIP_LAYOUT_get(); + internal static readonly int TOOLTIP_WAIT_TIME = NDalicPINVOKE.TOOLTIP_WAIT_TIME_get(); + internal static readonly int TOOLTIP_BACKGROUND = NDalicPINVOKE.TOOLTIP_BACKGROUND_get(); + internal static readonly int TOOLTIP_TAIL = NDalicPINVOKE.TOOLTIP_TAIL_get(); + internal static readonly int TOOLTIP_POSITION = NDalicPINVOKE.TOOLTIP_POSITION_get(); + internal static readonly int TOOLTIP_HOVER_POINT_OFFSET = NDalicPINVOKE.TOOLTIP_HOVER_POINT_OFFSET_get(); + internal static readonly int TOOLTIP_MOVEMENT_THRESHOLD = NDalicPINVOKE.TOOLTIP_MOVEMENT_THRESHOLD_get(); + internal static readonly int TOOLTIP_DISAPPEAR_ON_MOVEMENT = NDalicPINVOKE.TOOLTIP_DISAPPEAR_ON_MOVEMENT_get(); + + internal static readonly int TOOLTIP_BACKGROUND_VISUAL = NDalicPINVOKE.TOOLTIP_BACKGROUND_VISUAL_get(); + internal static readonly int TOOLTIP_BACKGROUND_BORDER = NDalicPINVOKE.TOOLTIP_BACKGROUND_BORDER_get(); + + internal static readonly int TOOLTIP_TAIL_VISIBILITY = NDalicPINVOKE.TOOLTIP_TAIL_VISIBILITY_get(); + internal static readonly int TOOLTIP_TAIL_ABOVE_VISUAL = NDalicPINVOKE.TOOLTIP_TAIL_ABOVE_VISUAL_get(); + internal static readonly int TOOLTIP_TAIL_BELOW_VISUAL = NDalicPINVOKE.TOOLTIP_TAIL_BELOW_VISUAL_get(); + + } + +} diff --git a/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs new file mode 100755 index 0000000..1939974 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NDalicPINVOKE.cs @@ -0,0 +1,11226 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI { + +class NDalicPINVOKE { + + protected class SWIGExceptionHelper { + + public delegate void ExceptionDelegate(string message); + public delegate void ExceptionArgumentDelegate(string message, string paramName); + + static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException); + static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException); + static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException); + static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException); + static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException); + static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException); + static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException); + static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException); + static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException); + static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException); + static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException); + + static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException); + static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException); + static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="SWIGRegisterExceptionCallbacks_NDalic")] + public static extern void SWIGRegisterExceptionCallbacks_NDalic( + ExceptionDelegate applicationDelegate, + ExceptionDelegate arithmeticDelegate, + ExceptionDelegate divideByZeroDelegate, + ExceptionDelegate indexOutOfRangeDelegate, + ExceptionDelegate invalidCastDelegate, + ExceptionDelegate invalidOperationDelegate, + ExceptionDelegate ioDelegate, + ExceptionDelegate nullReferenceDelegate, + ExceptionDelegate outOfMemoryDelegate, + ExceptionDelegate overflowDelegate, + ExceptionDelegate systemExceptionDelegate); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_NDalic")] + public static extern void SWIGRegisterExceptionCallbacksArgument_NDalic( + ExceptionArgumentDelegate argumentDelegate, + ExceptionArgumentDelegate argumentNullDelegate, + ExceptionArgumentDelegate argumentOutOfRangeDelegate); + + static void SetPendingApplicationException(string message) { + SWIGPendingException.Set(new global::System.ApplicationException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingArithmeticException(string message) { + SWIGPendingException.Set(new global::System.ArithmeticException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingDivideByZeroException(string message) { + SWIGPendingException.Set(new global::System.DivideByZeroException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingIndexOutOfRangeException(string message) { + SWIGPendingException.Set(new global::System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingInvalidCastException(string message) { + SWIGPendingException.Set(new global::System.InvalidCastException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingInvalidOperationException(string message) { + SWIGPendingException.Set(new global::System.InvalidOperationException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingIOException(string message) { + SWIGPendingException.Set(new global::System.IO.IOException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingNullReferenceException(string message) { + SWIGPendingException.Set(new global::System.NullReferenceException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingOutOfMemoryException(string message) { + SWIGPendingException.Set(new global::System.OutOfMemoryException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingOverflowException(string message) { + SWIGPendingException.Set(new global::System.OverflowException(message, SWIGPendingException.Retrieve())); + } + static void SetPendingSystemException(string message) { + SWIGPendingException.Set(new global::System.SystemException(message, SWIGPendingException.Retrieve())); + } + + static void SetPendingArgumentException(string message, string paramName) { + SWIGPendingException.Set(new global::System.ArgumentException(message, paramName, SWIGPendingException.Retrieve())); + } + static void SetPendingArgumentNullException(string message, string paramName) { + global::System.Exception e = SWIGPendingException.Retrieve(); + if (e != null) message = message + " Inner Exception: " + e.Message; + SWIGPendingException.Set(new global::System.ArgumentNullException(message, paramName)); + } + static void SetPendingArgumentOutOfRangeException(string message, string paramName) { + global::System.Exception e = SWIGPendingException.Retrieve(); + if (e != null) message = message + " Inner Exception: " + e.Message; + SWIGPendingException.Set(new global::System.ArgumentOutOfRangeException(paramName, message)); + } + + static SWIGExceptionHelper() { + SWIGRegisterExceptionCallbacks_NDalic( + applicationDelegate, + arithmeticDelegate, + divideByZeroDelegate, + indexOutOfRangeDelegate, + invalidCastDelegate, + invalidOperationDelegate, + ioDelegate, + nullReferenceDelegate, + outOfMemoryDelegate, + overflowDelegate, + systemDelegate); + + SWIGRegisterExceptionCallbacksArgument_NDalic( + argumentDelegate, + argumentNullDelegate, + argumentOutOfRangeDelegate); + } + } + + protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper(); + + public class SWIGPendingException { + [global::System.ThreadStatic] + private static global::System.Exception pendingException = null; + private static int numExceptionsPending = 0; + + public static bool Pending { + get { + bool pending = false; + if (numExceptionsPending > 0) + if (pendingException != null) + pending = true; + return pending; + } + } + + public static void Set(global::System.Exception e) { + if (pendingException != null) + throw new global::System.ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e); + pendingException = e; + lock(typeof(NDalicPINVOKE)) { + numExceptionsPending++; + } + } + + public static global::System.Exception Retrieve() { + global::System.Exception e = null; + if (numExceptionsPending > 0) { + if (pendingException != null) { + e = pendingException; + pendingException = null; + lock(typeof(NDalicPINVOKE)) { + numExceptionsPending--; + } + } + } + return e; + } + } + + + protected class SWIGStringHelper { + + public delegate string SWIGStringDelegate(string message); + static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="SWIGRegisterStringCallback_NDalic")] + public static extern void SWIGRegisterStringCallback_NDalic(SWIGStringDelegate stringDelegate); + + static string CreateString(string cString) { + return cString; + } + + static SWIGStringHelper() { + SWIGRegisterStringCallback_NDalic(stringDelegate); + } + } + + static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper(); + + + static NDalicPINVOKE() { + } + + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_floatp")] + public static extern global::System.IntPtr new_floatp(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_floatp")] + public static extern void delete_floatp(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_floatp_assign")] + public static extern void floatp_assign(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_floatp_value")] + public static extern float floatp_value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_floatp_cast")] + public static extern global::System.IntPtr floatp_cast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_floatp_frompointer")] + public static extern global::System.IntPtr floatp_frompointer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_intp")] + public static extern global::System.IntPtr new_intp(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_intp")] + public static extern void delete_intp(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_intp_assign")] + public static extern void intp_assign(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_intp_value")] + public static extern int intp_value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_intp_cast")] + public static extern global::System.IntPtr intp_cast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_intp_frompointer")] + public static extern global::System.IntPtr intp_frompointer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_doublep")] + public static extern global::System.IntPtr new_doublep(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_doublep")] + public static extern void delete_doublep(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_doublep_assign")] + public static extern void doublep_assign(global::System.Runtime.InteropServices.HandleRef jarg1, double jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_doublep_value")] + public static extern double doublep_value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_doublep_cast")] + public static extern global::System.IntPtr doublep_cast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_doublep_frompointer")] + public static extern global::System.IntPtr doublep_frompointer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_uintp")] + public static extern global::System.IntPtr new_uintp(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_uintp")] + public static extern void delete_uintp(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_uintp_assign")] + public static extern void uintp_assign(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_uintp_value")] + public static extern uint uintp_value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_uintp_cast")] + public static extern global::System.IntPtr uintp_cast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_uintp_frompointer")] + public static extern global::System.IntPtr uintp_frompointer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ushortp")] + public static extern global::System.IntPtr new_ushortp(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ushortp")] + public static extern void delete_ushortp(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ushortp_assign")] + public static extern void ushortp_assign(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ushortp_value")] + public static extern ushort ushortp_value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ushortp_cast")] + public static extern global::System.IntPtr ushortp_cast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ushortp_frompointer")] + public static extern global::System.IntPtr ushortp_frompointer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_int_to_uint")] + public static extern uint int_to_uint(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RefObject_Reference")] + public static extern void RefObject_Reference(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RefObject_Unreference")] + public static extern void RefObject_Unreference(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RefObject_ReferenceCount")] + public static extern int RefObject_ReferenceCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Any__SWIG_0")] + public static extern global::System.IntPtr new_Any__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Any")] + public static extern void delete_Any(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AssertAlways")] + public static extern void Any_AssertAlways(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Any__SWIG_2")] + public static extern global::System.IntPtr new_Any__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_Assign")] + public static extern global::System.IntPtr Any_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_GetType")] + public static extern global::System.IntPtr Any_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_Empty")] + public static extern bool Any_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Any_AnyContainerBase")] + public static extern global::System.IntPtr new_Any_AnyContainerBase(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_GetType")] + public static extern global::System.IntPtr Any_AnyContainerBase_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_mType_get")] + public static extern global::System.IntPtr Any_AnyContainerBase_mType_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_mCloneFunc_set")] + public static extern void Any_AnyContainerBase_mCloneFunc_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_mCloneFunc_get")] + public static extern global::System.IntPtr Any_AnyContainerBase_mCloneFunc_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_mDeleteFunc_set")] + public static extern void Any_AnyContainerBase_mDeleteFunc_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_AnyContainerBase_mDeleteFunc_get")] + public static extern global::System.IntPtr Any_AnyContainerBase_mDeleteFunc_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Any_AnyContainerBase")] + public static extern void delete_Any_AnyContainerBase(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_mContainer_set")] + public static extern void Any_mContainer_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Any_mContainer_get")] + public static extern global::System.IntPtr Any_mContainer_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DaliAssertMessage")] + public static extern void DaliAssertMessage(string jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_DaliException")] + public static extern global::System.IntPtr new_DaliException(string jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DaliException_location_set")] + public static extern void DaliException_location_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DaliException_location_get")] + public static extern string DaliException_location_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DaliException_condition_set")] + public static extern void DaliException_condition_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DaliException_condition_get")] + public static extern string DaliException_condition_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_DaliException")] + public static extern void delete_DaliException(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector2__SWIG_0")] + public static extern global::System.IntPtr new_Vector2__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector2__SWIG_1")] + public static extern global::System.IntPtr new_Vector2__SWIG_1(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector2__SWIG_2")] + public static extern global::System.IntPtr new_Vector2__SWIG_2([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector2__SWIG_3")] + public static extern global::System.IntPtr new_Vector2__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector2__SWIG_4")] + public static extern global::System.IntPtr new_Vector2__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_ONE_get")] + public static extern global::System.IntPtr Vector2_ONE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_XAXIS_get")] + public static extern global::System.IntPtr Vector2_XAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_YAXIS_get")] + public static extern global::System.IntPtr Vector2_YAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_NEGATIVE_XAXIS_get")] + public static extern global::System.IntPtr Vector2_NEGATIVE_XAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_NEGATIVE_YAXIS_get")] + public static extern global::System.IntPtr Vector2_NEGATIVE_YAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_ZERO_get")] + public static extern global::System.IntPtr Vector2_ZERO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Assign__SWIG_0")] + public static extern global::System.IntPtr Vector2_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Assign__SWIG_1")] + public static extern global::System.IntPtr Vector2_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Assign__SWIG_2")] + public static extern global::System.IntPtr Vector2_Assign__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Add")] + public static extern global::System.IntPtr Vector2_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_AddAssign")] + public static extern global::System.IntPtr Vector2_AddAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Subtract__SWIG_0")] + public static extern global::System.IntPtr Vector2_Subtract__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_SubtractAssign")] + public static extern global::System.IntPtr Vector2_SubtractAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Multiply__SWIG_0")] + public static extern global::System.IntPtr Vector2_Multiply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Multiply__SWIG_1")] + public static extern global::System.IntPtr Vector2_Multiply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_MultiplyAssign__SWIG_0")] + public static extern global::System.IntPtr Vector2_MultiplyAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_MultiplyAssign__SWIG_1")] + public static extern global::System.IntPtr Vector2_MultiplyAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Divide__SWIG_0")] + public static extern global::System.IntPtr Vector2_Divide__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Divide__SWIG_1")] + public static extern global::System.IntPtr Vector2_Divide__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_DivideAssign__SWIG_0")] + public static extern global::System.IntPtr Vector2_DivideAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_DivideAssign__SWIG_1")] + public static extern global::System.IntPtr Vector2_DivideAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Subtract__SWIG_1")] + public static extern global::System.IntPtr Vector2_Subtract__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_EqualTo")] + public static extern bool Vector2_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_NotEqualTo")] + public static extern bool Vector2_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_ValueOfIndex__SWIG_0")] + public static extern float Vector2_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Length")] + public static extern float Vector2_Length(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_LengthSquared")] + public static extern float Vector2_LengthSquared(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Normalize")] + public static extern void Vector2_Normalize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Clamp")] + public static extern void Vector2_Clamp(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_AsFloat__SWIG_0")] + public static extern global::System.IntPtr Vector2_AsFloat__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_X_set")] + public static extern void Vector2_X_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_X_get")] + public static extern float Vector2_X_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Width_set")] + public static extern void Vector2_Width_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Width_get")] + public static extern float Vector2_Width_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Y_set")] + public static extern void Vector2_Y_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Y_get")] + public static extern float Vector2_Y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Height_set")] + public static extern void Vector2_Height_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector2_Height_get")] + public static extern float Vector2_Height_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Vector2")] + public static extern void delete_Vector2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Min__SWIG_0")] + public static extern global::System.IntPtr Min__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Max__SWIG_0")] + public static extern global::System.IntPtr Max__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Clamp__SWIG_0")] + public static extern global::System.IntPtr Clamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector3__SWIG_0")] + public static extern global::System.IntPtr new_Vector3__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector3__SWIG_1")] + public static extern global::System.IntPtr new_Vector3__SWIG_1(float jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector3__SWIG_2")] + public static extern global::System.IntPtr new_Vector3__SWIG_2([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector3__SWIG_3")] + public static extern global::System.IntPtr new_Vector3__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector3__SWIG_4")] + public static extern global::System.IntPtr new_Vector3__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_ONE_get")] + public static extern global::System.IntPtr Vector3_ONE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_XAXIS_get")] + public static extern global::System.IntPtr Vector3_XAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_YAXIS_get")] + public static extern global::System.IntPtr Vector3_YAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_ZAXIS_get")] + public static extern global::System.IntPtr Vector3_ZAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_NEGATIVE_XAXIS_get")] + public static extern global::System.IntPtr Vector3_NEGATIVE_XAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_NEGATIVE_YAXIS_get")] + public static extern global::System.IntPtr Vector3_NEGATIVE_YAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_NEGATIVE_ZAXIS_get")] + public static extern global::System.IntPtr Vector3_NEGATIVE_ZAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_ZERO_get")] + public static extern global::System.IntPtr Vector3_ZERO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Assign__SWIG_0")] + public static extern global::System.IntPtr Vector3_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Assign__SWIG_1")] + public static extern global::System.IntPtr Vector3_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Assign__SWIG_2")] + public static extern global::System.IntPtr Vector3_Assign__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Add")] + public static extern global::System.IntPtr Vector3_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_AddAssign")] + public static extern global::System.IntPtr Vector3_AddAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Subtract__SWIG_0")] + public static extern global::System.IntPtr Vector3_Subtract__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_SubtractAssign")] + public static extern global::System.IntPtr Vector3_SubtractAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Multiply__SWIG_0")] + public static extern global::System.IntPtr Vector3_Multiply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Multiply__SWIG_1")] + public static extern global::System.IntPtr Vector3_Multiply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_MultiplyAssign__SWIG_0")] + public static extern global::System.IntPtr Vector3_MultiplyAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_MultiplyAssign__SWIG_1")] + public static extern global::System.IntPtr Vector3_MultiplyAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_MultiplyAssign__SWIG_2")] + public static extern global::System.IntPtr Vector3_MultiplyAssign__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Divide__SWIG_0")] + public static extern global::System.IntPtr Vector3_Divide__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Divide__SWIG_1")] + public static extern global::System.IntPtr Vector3_Divide__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_DivideAssign__SWIG_0")] + public static extern global::System.IntPtr Vector3_DivideAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_DivideAssign__SWIG_1")] + public static extern global::System.IntPtr Vector3_DivideAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Subtract__SWIG_1")] + public static extern global::System.IntPtr Vector3_Subtract__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_EqualTo")] + public static extern bool Vector3_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_NotEqualTo")] + public static extern bool Vector3_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_ValueOfIndex__SWIG_0")] + public static extern float Vector3_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Dot")] + public static extern float Vector3_Dot(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Cross")] + public static extern global::System.IntPtr Vector3_Cross(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Length")] + public static extern float Vector3_Length(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_LengthSquared")] + public static extern float Vector3_LengthSquared(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Normalize")] + public static extern void Vector3_Normalize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Clamp")] + public static extern void Vector3_Clamp(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_AsFloat__SWIG_0")] + public static extern global::System.IntPtr Vector3_AsFloat__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_GetVectorXY__SWIG_0")] + public static extern global::System.IntPtr Vector3_GetVectorXY__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_GetVectorYZ__SWIG_0")] + public static extern global::System.IntPtr Vector3_GetVectorYZ__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_X_set")] + public static extern void Vector3_X_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_X_get")] + public static extern float Vector3_X_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Width_set")] + public static extern void Vector3_Width_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Width_get")] + public static extern float Vector3_Width_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_r_set")] + public static extern void Vector3_r_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_r_get")] + public static extern float Vector3_r_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Y_set")] + public static extern void Vector3_Y_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Y_get")] + public static extern float Vector3_Y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Height_set")] + public static extern void Vector3_Height_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Height_get")] + public static extern float Vector3_Height_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_g_set")] + public static extern void Vector3_g_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_g_get")] + public static extern float Vector3_g_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Z_set")] + public static extern void Vector3_Z_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Z_get")] + public static extern float Vector3_Z_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Depth_set")] + public static extern void Vector3_Depth_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_Depth_get")] + public static extern float Vector3_Depth_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_b_set")] + public static extern void Vector3_b_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector3_b_get")] + public static extern float Vector3_b_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Vector3")] + public static extern void delete_Vector3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Min__SWIG_1")] + public static extern global::System.IntPtr Min__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Max__SWIG_1")] + public static extern global::System.IntPtr Max__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Clamp__SWIG_1")] + public static extern global::System.IntPtr Clamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector4__SWIG_0")] + public static extern global::System.IntPtr new_Vector4__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector4__SWIG_1")] + public static extern global::System.IntPtr new_Vector4__SWIG_1(float jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector4__SWIG_2")] + public static extern global::System.IntPtr new_Vector4__SWIG_2([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector4__SWIG_3")] + public static extern global::System.IntPtr new_Vector4__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Vector4__SWIG_4")] + public static extern global::System.IntPtr new_Vector4__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_ONE_get")] + public static extern global::System.IntPtr Vector4_ONE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_XAXIS_get")] + public static extern global::System.IntPtr Vector4_XAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_YAXIS_get")] + public static extern global::System.IntPtr Vector4_YAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_ZAXIS_get")] + public static extern global::System.IntPtr Vector4_ZAXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_ZERO_get")] + public static extern global::System.IntPtr Vector4_ZERO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Assign__SWIG_0")] + public static extern global::System.IntPtr Vector4_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Assign__SWIG_1")] + public static extern global::System.IntPtr Vector4_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Assign__SWIG_2")] + public static extern global::System.IntPtr Vector4_Assign__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Add")] + public static extern global::System.IntPtr Vector4_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_AddAssign")] + public static extern global::System.IntPtr Vector4_AddAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Subtract__SWIG_0")] + public static extern global::System.IntPtr Vector4_Subtract__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_SubtractAssign")] + public static extern global::System.IntPtr Vector4_SubtractAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Multiply__SWIG_0")] + public static extern global::System.IntPtr Vector4_Multiply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Multiply__SWIG_1")] + public static extern global::System.IntPtr Vector4_Multiply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_MultiplyAssign__SWIG_0")] + public static extern global::System.IntPtr Vector4_MultiplyAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_MultiplyAssign__SWIG_1")] + public static extern global::System.IntPtr Vector4_MultiplyAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Divide__SWIG_0")] + public static extern global::System.IntPtr Vector4_Divide__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Divide__SWIG_1")] + public static extern global::System.IntPtr Vector4_Divide__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_DivideAssign__SWIG_0")] + public static extern global::System.IntPtr Vector4_DivideAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_DivideAssign__SWIG_1")] + public static extern global::System.IntPtr Vector4_DivideAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Subtract__SWIG_1")] + public static extern global::System.IntPtr Vector4_Subtract__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_EqualTo")] + public static extern bool Vector4_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_NotEqualTo")] + public static extern bool Vector4_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_ValueOfIndex__SWIG_0")] + public static extern float Vector4_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Dot__SWIG_0")] + public static extern float Vector4_Dot__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Dot__SWIG_1")] + public static extern float Vector4_Dot__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Dot4")] + public static extern float Vector4_Dot4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Cross")] + public static extern global::System.IntPtr Vector4_Cross(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Length")] + public static extern float Vector4_Length(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_LengthSquared")] + public static extern float Vector4_LengthSquared(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Normalize")] + public static extern void Vector4_Normalize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Clamp")] + public static extern void Vector4_Clamp(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_AsFloat__SWIG_0")] + public static extern global::System.IntPtr Vector4_AsFloat__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_X_set")] + public static extern void Vector4_X_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_X_get")] + public static extern float Vector4_X_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_r_set")] + public static extern void Vector4_r_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_r_get")] + public static extern float Vector4_r_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_s_set")] + public static extern void Vector4_s_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_s_get")] + public static extern float Vector4_s_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Y_set")] + public static extern void Vector4_Y_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Y_get")] + public static extern float Vector4_Y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_g_set")] + public static extern void Vector4_g_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_g_get")] + public static extern float Vector4_g_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_t_set")] + public static extern void Vector4_t_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_t_get")] + public static extern float Vector4_t_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Z_set")] + public static extern void Vector4_Z_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_Z_get")] + public static extern float Vector4_Z_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_b_set")] + public static extern void Vector4_b_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_b_get")] + public static extern float Vector4_b_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_p_set")] + public static extern void Vector4_p_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_p_get")] + public static extern float Vector4_p_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_W_set")] + public static extern void Vector4_W_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_W_get")] + public static extern float Vector4_W_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_a_set")] + public static extern void Vector4_a_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_a_get")] + public static extern float Vector4_a_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_q_set")] + public static extern void Vector4_q_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Vector4_q_get")] + public static extern float Vector4_q_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Vector4")] + public static extern void delete_Vector4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Min__SWIG_2")] + public static extern global::System.IntPtr Min__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Max__SWIG_2")] + public static extern global::System.IntPtr Max__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Clamp__SWIG_2")] + public static extern global::System.IntPtr Clamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Uint16Pair__SWIG_0")] + public static extern global::System.IntPtr new_Uint16Pair__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Uint16Pair__SWIG_1")] + public static extern global::System.IntPtr new_Uint16Pair__SWIG_1(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Uint16Pair__SWIG_2")] + public static extern global::System.IntPtr new_Uint16Pair__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_SetWidth")] + public static extern void Uint16Pair_SetWidth(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_GetWidth")] + public static extern ushort Uint16Pair_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_SetHeight")] + public static extern void Uint16Pair_SetHeight(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_GetHeight")] + public static extern ushort Uint16Pair_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_SetX")] + public static extern void Uint16Pair_SetX(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_GetX")] + public static extern ushort Uint16Pair_GetX(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_SetY")] + public static extern void Uint16Pair_SetY(global::System.Runtime.InteropServices.HandleRef jarg1, ushort jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_GetY")] + public static extern ushort Uint16Pair_GetY(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_Assign")] + public static extern global::System.IntPtr Uint16Pair_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_EqualTo")] + public static extern bool Uint16Pair_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_NotEqualTo")] + public static extern bool Uint16Pair_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_LessThan")] + public static extern bool Uint16Pair_LessThan(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Uint16Pair_GreaterThan")] + public static extern bool Uint16Pair_GreaterThan(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Uint16Pair")] + public static extern void delete_Uint16Pair(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Degree__SWIG_0")] + public static extern global::System.IntPtr new_Degree__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Degree__SWIG_1")] + public static extern global::System.IntPtr new_Degree__SWIG_1(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Degree__SWIG_2")] + public static extern global::System.IntPtr new_Degree__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Degree_degree_set")] + public static extern void Degree_degree_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Degree_degree_get")] + public static extern float Degree_degree_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Degree")] + public static extern void delete_Degree(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_360_get")] + public static extern global::System.IntPtr ANGLE_360_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_315_get")] + public static extern global::System.IntPtr ANGLE_315_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_270_get")] + public static extern global::System.IntPtr ANGLE_270_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_225_get")] + public static extern global::System.IntPtr ANGLE_225_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_180_get")] + public static extern global::System.IntPtr ANGLE_180_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_135_get")] + public static extern global::System.IntPtr ANGLE_135_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_120_get")] + public static extern global::System.IntPtr ANGLE_120_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_90_get")] + public static extern global::System.IntPtr ANGLE_90_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_60_get")] + public static extern global::System.IntPtr ANGLE_60_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_45_get")] + public static extern global::System.IntPtr ANGLE_45_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_30_get")] + public static extern global::System.IntPtr ANGLE_30_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ANGLE_0_get")] + public static extern global::System.IntPtr ANGLE_0_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualTo__SWIG_5")] + public static extern bool EqualTo__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NotEqualTo__SWIG_4")] + public static extern bool NotEqualTo__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Clamp__SWIG_3")] + public static extern global::System.IntPtr Clamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Radian__SWIG_0")] + public static extern global::System.IntPtr new_Radian__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Radian__SWIG_1")] + public static extern global::System.IntPtr new_Radian__SWIG_1(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Radian__SWIG_2")] + public static extern global::System.IntPtr new_Radian__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Radian_Assign__SWIG_0")] + public static extern global::System.IntPtr Radian_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Radian_Assign__SWIG_1")] + public static extern global::System.IntPtr Radian_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Radian_ConvertToFloat")] + public static extern float Radian_ConvertToFloat(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Radian_radian_set")] + public static extern void Radian_radian_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Radian_radian_get")] + public static extern float Radian_radian_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Radian")] + public static extern void delete_Radian(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualTo__SWIG_6")] + public static extern bool EqualTo__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NotEqualTo__SWIG_5")] + public static extern bool NotEqualTo__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualTo__SWIG_7")] + public static extern bool EqualTo__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NotEqualTo__SWIG_6")] + public static extern bool NotEqualTo__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualTo__SWIG_8")] + public static extern bool EqualTo__SWIG_8(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NotEqualTo__SWIG_7")] + public static extern bool NotEqualTo__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GreaterThan__SWIG_0")] + public static extern bool GreaterThan__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GreaterThan__SWIG_1")] + public static extern bool GreaterThan__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GreaterThan__SWIG_2")] + public static extern bool GreaterThan__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LessThan__SWIG_0")] + public static extern bool LessThan__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LessThan__SWIG_1")] + public static extern bool LessThan__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LessThan__SWIG_2")] + public static extern bool LessThan__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Multiply")] + public static extern global::System.IntPtr Multiply(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Subtract")] + public static extern global::System.IntPtr Subtract(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Clamp__SWIG_4")] + public static extern global::System.IntPtr Clamp__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Rotation__SWIG_0")] + public static extern global::System.IntPtr new_Rotation__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Rotation__SWIG_1")] + public static extern global::System.IntPtr new_Rotation__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Rotation")] + public static extern void delete_Rotation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_IDENTITY_get")] + public static extern global::System.IntPtr Rotation_IDENTITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_IsIdentity")] + public static extern bool Rotation_IsIdentity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_GetAxisAngle")] + public static extern bool Rotation_GetAxisAngle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Add")] + public static extern global::System.IntPtr Rotation_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Subtract__SWIG_0")] + public static extern global::System.IntPtr Rotation_Subtract__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Multiply__SWIG_0")] + public static extern global::System.IntPtr Rotation_Multiply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Multiply__SWIG_1")] + public static extern global::System.IntPtr Rotation_Multiply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Divide__SWIG_0")] + public static extern global::System.IntPtr Rotation_Divide__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Multiply__SWIG_2")] + public static extern global::System.IntPtr Rotation_Multiply__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Divide__SWIG_1")] + public static extern global::System.IntPtr Rotation_Divide__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Subtract__SWIG_1")] + public static extern global::System.IntPtr Rotation_Subtract__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_AddAssign")] + public static extern global::System.IntPtr Rotation_AddAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_SubtractAssign")] + public static extern global::System.IntPtr Rotation_SubtractAssign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_MultiplyAssign__SWIG_0")] + public static extern global::System.IntPtr Rotation_MultiplyAssign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_MultiplyAssign__SWIG_1")] + public static extern global::System.IntPtr Rotation_MultiplyAssign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_DivideAssign")] + public static extern global::System.IntPtr Rotation_DivideAssign(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_EqualTo")] + public static extern bool Rotation_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_NotEqualTo")] + public static extern bool Rotation_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Length")] + public static extern float Rotation_Length(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_LengthSquared")] + public static extern float Rotation_LengthSquared(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Normalize")] + public static extern void Rotation_Normalize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Normalized")] + public static extern global::System.IntPtr Rotation_Normalized(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Conjugate")] + public static extern void Rotation_Conjugate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Invert")] + public static extern void Rotation_Invert(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Log")] + public static extern global::System.IntPtr Rotation_Log(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Exp")] + public static extern global::System.IntPtr Rotation_Exp(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Dot")] + public static extern float Rotation_Dot(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Lerp")] + public static extern global::System.IntPtr Rotation_Lerp(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Slerp")] + public static extern global::System.IntPtr Rotation_Slerp(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_SlerpNoInvert")] + public static extern global::System.IntPtr Rotation_SlerpNoInvert(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_Squad")] + public static extern global::System.IntPtr Rotation_Squad(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rotation_AngleBetween")] + public static extern float Rotation_AngleBetween(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix__SWIG_0")] + public static extern global::System.IntPtr new_Matrix__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix__SWIG_1")] + public static extern global::System.IntPtr new_Matrix__SWIG_1(bool jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix__SWIG_2")] + public static extern global::System.IntPtr new_Matrix__SWIG_2([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]float[] jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix__SWIG_3")] + public static extern global::System.IntPtr new_Matrix__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix__SWIG_4")] + public static extern global::System.IntPtr new_Matrix__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Assign")] + public static extern global::System.IntPtr Matrix_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_IDENTITY_get")] + public static extern global::System.IntPtr Matrix_IDENTITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetIdentity")] + public static extern void Matrix_SetIdentity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetIdentityAndScale")] + public static extern void Matrix_SetIdentityAndScale(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_InvertTransform")] + public static extern void Matrix_InvertTransform(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Invert")] + public static extern bool Matrix_Invert(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Transpose")] + public static extern void Matrix_Transpose(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetXAxis")] + public static extern global::System.IntPtr Matrix_GetXAxis(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetYAxis")] + public static extern global::System.IntPtr Matrix_GetYAxis(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetZAxis")] + public static extern global::System.IntPtr Matrix_GetZAxis(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetXAxis")] + public static extern void Matrix_SetXAxis(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetYAxis")] + public static extern void Matrix_SetYAxis(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetZAxis")] + public static extern void Matrix_SetZAxis(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetTranslation")] + public static extern global::System.IntPtr Matrix_GetTranslation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetTranslation3")] + public static extern global::System.IntPtr Matrix_GetTranslation3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetTranslation__SWIG_0")] + public static extern void Matrix_SetTranslation__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetTranslation__SWIG_1")] + public static extern void Matrix_SetTranslation__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_OrthoNormalize")] + public static extern void Matrix_OrthoNormalize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_AsFloat__SWIG_0")] + public static extern global::System.IntPtr Matrix_AsFloat__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Multiply__SWIG_0")] + public static extern void Matrix_Multiply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Multiply__SWIG_1")] + public static extern void Matrix_Multiply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_Multiply__SWIG_2")] + public static extern global::System.IntPtr Matrix_Multiply__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_EqualTo")] + public static extern bool Matrix_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_NotEqualTo")] + public static extern bool Matrix_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetTransformComponents")] + public static extern void Matrix_SetTransformComponents(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetInverseTransformComponents__SWIG_0")] + public static extern void Matrix_SetInverseTransformComponents__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_SetInverseTransformComponents__SWIG_1")] + public static extern void Matrix_SetInverseTransformComponents__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix_GetTransformComponents")] + public static extern void Matrix_GetTransformComponents(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Matrix")] + public static extern void delete_Matrix(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_IDENTITY_get")] + public static extern global::System.IntPtr Matrix3_IDENTITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix3__SWIG_0")] + public static extern global::System.IntPtr new_Matrix3__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix3__SWIG_1")] + public static extern global::System.IntPtr new_Matrix3__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix3__SWIG_2")] + public static extern global::System.IntPtr new_Matrix3__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Matrix3__SWIG_3")] + public static extern global::System.IntPtr new_Matrix3__SWIG_3(float jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7, float jarg8, float jarg9); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Assign__SWIG_0")] + public static extern global::System.IntPtr Matrix3_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Assign__SWIG_1")] + public static extern global::System.IntPtr Matrix3_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_EqualTo")] + public static extern bool Matrix3_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_NotEqualTo")] + public static extern bool Matrix3_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Matrix3")] + public static extern void delete_Matrix3(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_SetIdentity")] + public static extern void Matrix3_SetIdentity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_AsFloat__SWIG_0")] + public static extern global::System.IntPtr Matrix3_AsFloat__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Invert")] + public static extern bool Matrix3_Invert(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Transpose")] + public static extern bool Matrix3_Transpose(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Scale")] + public static extern void Matrix3_Scale(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Magnitude")] + public static extern float Matrix3_Magnitude(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_ScaledInverseTranspose")] + public static extern bool Matrix3_ScaledInverseTranspose(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Matrix3_Multiply")] + public static extern void Matrix3_Multiply(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Range")] + public static extern float Range(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Axis")] + public static extern global::System.IntPtr Axis(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AngleAxis__SWIG_0")] + public static extern global::System.IntPtr new_AngleAxis__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AngleAxis__SWIG_1")] + public static extern global::System.IntPtr new_AngleAxis__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleAxis_angle_set")] + public static extern void AngleAxis_angle_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleAxis_angle_get")] + public static extern global::System.IntPtr AngleAxis_angle_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleAxis_axis_set")] + public static extern void AngleAxis_axis_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleAxis_axis_get")] + public static extern global::System.IntPtr AngleAxis_axis_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AngleAxis")] + public static extern void delete_AngleAxis(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualTo__SWIG_9")] + public static extern bool EqualTo__SWIG_9(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NextPowerOfTwo")] + public static extern uint NextPowerOfTwo(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsPowerOfTwo")] + public static extern bool IsPowerOfTwo(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetRangedEpsilon")] + public static extern float GetRangedEpsilon(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EqualsZero")] + public static extern bool EqualsZero(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Equals__SWIG_0")] + public static extern bool Equals__SWIG_0(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Equals__SWIG_1")] + public static extern bool Equals__SWIG_1(float jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Round")] + public static extern float Round(float jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WrapInDomain")] + public static extern float WrapInDomain(float jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ShortestDistanceInDomain")] + public static extern float ShortestDistanceInDomain(float jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_INVALID_INDEX_get")] + public static extern int Property_INVALID_INDEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_INVALID_KEY_get")] + public static extern int Property_INVALID_KEY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_INVALID_COMPONENT_INDEX_get")] + public static extern int Property_INVALID_COMPONENT_INDEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property__SWIG_0")] + public static extern global::System.IntPtr new_Property__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property__SWIG_1")] + public static extern global::System.IntPtr new_Property__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property__SWIG_2")] + public static extern global::System.IntPtr new_Property__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property__SWIG_3")] + public static extern global::System.IntPtr new_Property__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Property")] + public static extern void delete_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property__object_set")] + public static extern void Property__object_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property__object_get")] + public static extern global::System.IntPtr Property__object_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_propertyIndex_set")] + public static extern void Property_propertyIndex_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_propertyIndex_get")] + public static extern int Property_propertyIndex_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_componentIndex_set")] + public static extern void Property_componentIndex_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_componentIndex_get")] + public static extern int Property_componentIndex_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Array__SWIG_0")] + public static extern global::System.IntPtr new_Property_Array__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Array__SWIG_1")] + public static extern global::System.IntPtr new_Property_Array__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Property_Array")] + public static extern void delete_Property_Array(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Size")] + public static extern uint Property_Array_Size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Count")] + public static extern uint Property_Array_Count(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Empty")] + public static extern bool Property_Array_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Clear")] + public static extern void Property_Array_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Reserve")] + public static extern void Property_Array_Reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Resize")] + public static extern void Property_Array_Resize(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Capacity")] + public static extern uint Property_Array_Capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_PushBack")] + public static extern void Property_Array_PushBack(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Add")] + public static extern global::System.IntPtr Property_Array_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_GetElementAt__SWIG_0")] + public static extern global::System.IntPtr Property_Array_GetElementAt__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr Property_Array_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Array_Assign")] + public static extern global::System.IntPtr Property_Array_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_type_set")] + public static extern void Property_Key_type_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_type_get")] + public static extern int Property_Key_type_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_indexKey_set")] + public static extern void Property_Key_indexKey_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_indexKey_get")] + public static extern int Property_Key_indexKey_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_stringKey_set")] + public static extern void Property_Key_stringKey_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_stringKey_get")] + public static extern string Property_Key_stringKey_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Key__SWIG_0")] + public static extern global::System.IntPtr new_Property_Key__SWIG_0(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Key__SWIG_1")] + public static extern global::System.IntPtr new_Property_Key__SWIG_1(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_EqualTo__SWIG_0")] + public static extern bool Property_Key_EqualTo__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_EqualTo__SWIG_1")] + public static extern bool Property_Key_EqualTo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_EqualTo__SWIG_2")] + public static extern bool Property_Key_EqualTo__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_NotEqualTo__SWIG_0")] + public static extern bool Property_Key_NotEqualTo__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_NotEqualTo__SWIG_1")] + public static extern bool Property_Key_NotEqualTo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Key_NotEqualTo__SWIG_2")] + public static extern bool Property_Key_NotEqualTo__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Property_Key")] + public static extern void delete_Property_Key(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Map__SWIG_0")] + public static extern global::System.IntPtr new_Property_Map__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Map__SWIG_1")] + public static extern global::System.IntPtr new_Property_Map__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Property_Map")] + public static extern void delete_Property_Map(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Count")] + public static extern uint Property_Map_Count(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Empty")] + public static extern bool Property_Map_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Insert__SWIG_0")] + public static extern void Property_Map_Insert__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Insert__SWIG_2")] + public static extern void Property_Map_Insert__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Add__SWIG_0")] + public static extern global::System.IntPtr Property_Map_Add__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Add__SWIG_2")] + public static extern global::System.IntPtr Property_Map_Add__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_GetValue")] + public static extern global::System.IntPtr Property_Map_GetValue(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_GetKey")] + public static extern string Property_Map_GetKey(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_GetKeyAt")] + public static extern global::System.IntPtr Property_Map_GetKeyAt(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_GetPair")] + public static extern global::System.IntPtr Property_Map_GetPair(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Find__SWIG_0")] + public static extern global::System.IntPtr Property_Map_Find__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Find__SWIG_2")] + public static extern global::System.IntPtr Property_Map_Find__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Find__SWIG_3")] + public static extern global::System.IntPtr Property_Map_Find__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Find__SWIG_4")] + public static extern global::System.IntPtr Property_Map_Find__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Find__SWIG_5")] + public static extern global::System.IntPtr Property_Map_Find__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Clear")] + public static extern void Property_Map_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Merge")] + public static extern void Property_Map_Merge(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr Property_Map_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_ValueOfIndex__SWIG_2")] + public static extern global::System.IntPtr Property_Map_ValueOfIndex__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Map_Assign")] + public static extern global::System.IntPtr Property_Map_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_0")] + public static extern global::System.IntPtr new_Property_Value__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_1")] + public static extern global::System.IntPtr new_Property_Value__SWIG_1(bool jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_2")] + public static extern global::System.IntPtr new_Property_Value__SWIG_2(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_3")] + public static extern global::System.IntPtr new_Property_Value__SWIG_3(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_4")] + public static extern global::System.IntPtr new_Property_Value__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_5")] + public static extern global::System.IntPtr new_Property_Value__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_6")] + public static extern global::System.IntPtr new_Property_Value__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_7")] + public static extern global::System.IntPtr new_Property_Value__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_8")] + public static extern global::System.IntPtr new_Property_Value__SWIG_8(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_9")] + public static extern global::System.IntPtr new_Property_Value__SWIG_9(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_10")] + public static extern global::System.IntPtr new_Property_Value__SWIG_10(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_11")] + public static extern global::System.IntPtr new_Property_Value__SWIG_11(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_12")] + public static extern global::System.IntPtr new_Property_Value__SWIG_12(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_14")] + public static extern global::System.IntPtr new_Property_Value__SWIG_14(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_15")] + public static extern global::System.IntPtr new_Property_Value__SWIG_15(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_16")] + public static extern global::System.IntPtr new_Property_Value__SWIG_16(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Property_Value__SWIG_17")] + public static extern global::System.IntPtr new_Property_Value__SWIG_17(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Assign")] + public static extern global::System.IntPtr Property_Value_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Property_Value")] + public static extern void delete_Property_Value(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_GetType")] + public static extern int Property_Value_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_1")] + public static extern bool Property_Value_Get__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, out bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_2")] + public static extern bool Property_Value_Get__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, out float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_3")] + public static extern bool Property_Value_Get__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, out int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_4")] + public static extern bool Property_Value_Get__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_5")] + public static extern bool Property_Value_Get__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_6")] + public static extern bool Property_Value_Get__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_7")] + public static extern bool Property_Value_Get__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_8")] + public static extern bool Property_Value_Get__SWIG_8(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_9")] + public static extern bool Property_Value_Get__SWIG_9(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_10")] + public static extern bool Property_Value_Get__SWIG_10(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_11")] + public static extern bool Property_Value_Get__SWIG_11(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_12")] + public static extern bool Property_Value_Get__SWIG_12(global::System.Runtime.InteropServices.HandleRef jarg1, out string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_13")] + public static extern bool Property_Value_Get__SWIG_13(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_Get__SWIG_14")] + public static extern bool Property_Value_Get__SWIG_14(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_GetArray")] + public static extern global::System.IntPtr Property_Value_GetArray(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Property_Value_GetMap")] + public static extern global::System.IntPtr Property_Value_GetMap(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetName")] + public static extern string GetName(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_DoAction")] + public static extern bool BaseObject_DoAction(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_GetTypeName")] + public static extern string BaseObject_GetTypeName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_GetTypeInfo")] + public static extern bool BaseObject_GetTypeInfo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_DoConnectSignal")] + public static extern bool BaseObject_DoConnectSignal(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetImplementation")] + public static extern global::System.IntPtr GetImplementation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_BaseHandle__SWIG_0")] + public static extern global::System.IntPtr new_BaseHandle__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_BaseHandle__SWIG_1")] + public static extern global::System.IntPtr new_BaseHandle__SWIG_1(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_BaseHandle")] + public static extern void delete_BaseHandle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_BaseHandle__SWIG_2")] + public static extern global::System.IntPtr new_BaseHandle__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_Assign")] + public static extern global::System.IntPtr BaseHandle_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_DoAction")] + public static extern bool BaseHandle_DoAction(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_GetTypeName")] + public static extern string BaseHandle_GetTypeName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_GetTypeInfo")] + public static extern bool BaseHandle_GetTypeInfo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_GetBaseObject__SWIG_0")] + public static extern global::System.IntPtr BaseHandle_GetBaseObject__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_Reset")] + public static extern void BaseHandle_Reset(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_EqualTo")] + public static extern bool BaseHandle_EqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_NotEqualTo")] + public static extern bool BaseHandle_NotEqualTo(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_GetObjectPtr")] + public static extern global::System.IntPtr BaseHandle_GetObjectPtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_HasBody")] + public static extern bool BaseHandle_HasBody(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseHandle_IsEqual")] + public static extern bool BaseHandle_IsEqual(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LessThan__SWIG_3")] + public static extern bool LessThan__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ConnectionTrackerInterface")] + public static extern void delete_ConnectionTrackerInterface(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTrackerInterface_SignalConnected")] + public static extern void ConnectionTrackerInterface_SignalConnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_SignalObserver")] + public static extern void delete_SignalObserver(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SignalObserver_SignalDisconnected")] + public static extern void SignalObserver_SignalDisconnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_SlotObserver")] + public static extern void delete_SlotObserver(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SlotObserver_SlotDisconnected")] + public static extern void SlotObserver_SlotDisconnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ConnectionTracker")] + public static extern void delete_ConnectionTracker(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTracker_DisconnectAll")] + public static extern void ConnectionTracker_DisconnectAll(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTracker_SignalConnected")] + public static extern void ConnectionTracker_SignalConnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTracker_SignalDisconnected")] + public static extern void ConnectionTracker_SignalDisconnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTracker_GetConnectionCount")] + public static extern uint ConnectionTracker_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ObjectRegistry__SWIG_0")] + public static extern global::System.IntPtr new_ObjectRegistry__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ObjectRegistry")] + public static extern void delete_ObjectRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ObjectRegistry__SWIG_1")] + public static extern global::System.IntPtr new_ObjectRegistry__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectRegistry_Assign")] + public static extern global::System.IntPtr ObjectRegistry_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectRegistry_ObjectCreatedSignal")] + public static extern global::System.IntPtr ObjectRegistry_ObjectCreatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectRegistry_ObjectDestroyedSignal")] + public static extern global::System.IntPtr ObjectRegistry_ObjectDestroyedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyCondition__SWIG_0")] + public static extern global::System.IntPtr new_PropertyCondition__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PropertyCondition")] + public static extern void delete_PropertyCondition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyCondition__SWIG_1")] + public static extern global::System.IntPtr new_PropertyCondition__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyCondition_Assign")] + public static extern global::System.IntPtr PropertyCondition_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyCondition_GetArgumentCount")] + public static extern uint PropertyCondition_GetArgumentCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyCondition_GetArgument")] + public static extern float PropertyCondition_GetArgument(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LessThanCondition")] + public static extern global::System.IntPtr LessThanCondition(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GreaterThanCondition")] + public static extern global::System.IntPtr GreaterThanCondition(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_InsideCondition")] + public static extern global::System.IntPtr InsideCondition(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_OutsideCondition")] + public static extern global::System.IntPtr OutsideCondition(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StepCondition__SWIG_0")] + public static extern global::System.IntPtr StepCondition__SWIG_0(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StepCondition__SWIG_1")] + public static extern global::System.IntPtr StepCondition__SWIG_1(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VariableStepCondition")] + public static extern global::System.IntPtr VariableStepCondition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyNotification__SWIG_0")] + public static extern global::System.IntPtr new_PropertyNotification__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_DownCast")] + public static extern global::System.IntPtr PropertyNotification_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PropertyNotification")] + public static extern void delete_PropertyNotification(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyNotification__SWIG_1")] + public static extern global::System.IntPtr new_PropertyNotification__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_Assign")] + public static extern global::System.IntPtr PropertyNotification_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_GetCondition__SWIG_0")] + public static extern global::System.IntPtr PropertyNotification_GetCondition__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_GetTarget")] + public static extern global::System.IntPtr PropertyNotification_GetTarget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_GetTargetProperty")] + public static extern int PropertyNotification_GetTargetProperty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_SetNotifyMode")] + public static extern void PropertyNotification_SetNotifyMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_GetNotifyMode")] + public static extern int PropertyNotification_GetNotifyMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_GetNotifyResult")] + public static extern bool PropertyNotification_GetNotifyResult(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_NotifySignal")] + public static extern global::System.IntPtr PropertyNotification_NotifySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Handle__SWIG_0")] + public static extern global::System.IntPtr new_Handle__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_New")] + public static extern global::System.IntPtr Handle_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Handle")] + public static extern void delete_Handle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Handle__SWIG_1")] + public static extern global::System.IntPtr new_Handle__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_Assign")] + public static extern global::System.IntPtr Handle_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_DownCast")] + public static extern global::System.IntPtr Handle_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_Supports")] + public static extern bool Handle_Supports(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetPropertyCount")] + public static extern uint Handle_GetPropertyCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetPropertyName")] + public static extern string Handle_GetPropertyName(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetPropertyIndex")] + public static extern int Handle_GetPropertyIndex(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_IsPropertyWritable")] + public static extern bool Handle_IsPropertyWritable(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_IsPropertyAnimatable")] + public static extern bool Handle_IsPropertyAnimatable(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_IsPropertyAConstraintInput")] + public static extern bool Handle_IsPropertyAConstraintInput(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetPropertyType")] + public static extern int Handle_GetPropertyType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_SetProperty")] + public static extern void Handle_SetProperty(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RegisterProperty__SWIG_0")] + public static extern int Handle_RegisterProperty__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RegisterProperty__SWIG_1")] + public static extern int Handle_RegisterProperty__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetProperty")] + public static extern global::System.IntPtr Handle_GetProperty(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_GetPropertyIndices")] + public static extern void Handle_GetPropertyIndices(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_AddPropertyNotification__SWIG_0")] + public static extern global::System.IntPtr Handle_AddPropertyNotification__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_AddPropertyNotification__SWIG_1")] + public static extern global::System.IntPtr Handle_AddPropertyNotification__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RemovePropertyNotification")] + public static extern void Handle_RemovePropertyNotification(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RemovePropertyNotifications")] + public static extern void Handle_RemovePropertyNotifications(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RemoveConstraints__SWIG_0")] + public static extern void Handle_RemoveConstraints__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_RemoveConstraints__SWIG_1")] + public static extern void Handle_RemoveConstraints__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WEIGHT_get")] + public static extern int WEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_New")] + public static extern global::System.IntPtr New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeInfo__SWIG_0")] + public static extern global::System.IntPtr new_TypeInfo__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TypeInfo")] + public static extern void delete_TypeInfo(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeInfo__SWIG_1")] + public static extern global::System.IntPtr new_TypeInfo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_Assign")] + public static extern global::System.IntPtr TypeInfo_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetName")] + public static extern string TypeInfo_GetName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetBaseName")] + public static extern string TypeInfo_GetBaseName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_CreateInstance")] + public static extern global::System.IntPtr TypeInfo_CreateInstance(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetActionCount")] + public static extern uint TypeInfo_GetActionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetActionName")] + public static extern string TypeInfo_GetActionName(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetSignalCount")] + public static extern uint TypeInfo_GetSignalCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetSignalName")] + public static extern string TypeInfo_GetSignalName(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetPropertyCount")] + public static extern uint TypeInfo_GetPropertyCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetPropertyIndices")] + public static extern void TypeInfo_GetPropertyIndices(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_GetPropertyName")] + public static extern string TypeInfo_GetPropertyName(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_Get")] + public static extern global::System.IntPtr TypeRegistry_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistry__SWIG_0")] + public static extern global::System.IntPtr new_TypeRegistry__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TypeRegistry")] + public static extern void delete_TypeRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistry__SWIG_1")] + public static extern global::System.IntPtr new_TypeRegistry__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_Assign")] + public static extern global::System.IntPtr TypeRegistry_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_GetTypeInfo__SWIG_0")] + public static extern global::System.IntPtr TypeRegistry_GetTypeInfo__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_GetTypeInfo__SWIG_1")] + public static extern global::System.IntPtr TypeRegistry_GetTypeInfo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_GetTypeNameCount")] + public static extern uint TypeRegistry_GetTypeNameCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_GetTypeName")] + public static extern string TypeRegistry_GetTypeName(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistry__SWIG_2")] + public static extern global::System.IntPtr new_TypeRegistry__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistration__SWIG_0")] + public static extern global::System.IntPtr new_TypeRegistration__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistration__SWIG_1")] + public static extern global::System.IntPtr new_TypeRegistration__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeRegistration__SWIG_2")] + public static extern global::System.IntPtr new_TypeRegistration__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistration_RegisteredName")] + public static extern string TypeRegistration_RegisteredName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistration_RegisterControl")] + public static extern void TypeRegistration_RegisterControl(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistration_RegisterProperty")] + public static extern void TypeRegistration_RegisterProperty(string jarg1, string jarg2, int jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TypeRegistration")] + public static extern void delete_TypeRegistration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_SignalConnectorType")] + public static extern global::System.IntPtr new_SignalConnectorType(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_SignalConnectorType")] + public static extern void delete_SignalConnectorType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TypeAction")] + public static extern global::System.IntPtr new_TypeAction(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TypeAction")] + public static extern void delete_TypeAction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyRegistration")] + public static extern global::System.IntPtr new_PropertyRegistration(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PropertyRegistration")] + public static extern void delete_PropertyRegistration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AnimatablePropertyRegistration__SWIG_0")] + public static extern global::System.IntPtr new_AnimatablePropertyRegistration__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AnimatablePropertyRegistration__SWIG_1")] + public static extern global::System.IntPtr new_AnimatablePropertyRegistration__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AnimatablePropertyRegistration")] + public static extern void delete_AnimatablePropertyRegistration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AnimatablePropertyComponentRegistration")] + public static extern global::System.IntPtr new_AnimatablePropertyComponentRegistration(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4, uint jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AnimatablePropertyComponentRegistration")] + public static extern void delete_AnimatablePropertyComponentRegistration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ChildPropertyRegistration")] + public static extern global::System.IntPtr new_ChildPropertyRegistration(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ChildPropertyRegistration")] + public static extern void delete_ChildPropertyRegistration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RegisterType")] + public static extern bool RegisterType(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RegisterProperty")] + public static extern bool RegisterProperty(string jarg1, string jarg2, int jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginTop_get")] + public static extern float ParentOriginTop_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginBottom_get")] + public static extern float ParentOriginBottom_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginLeft_get")] + public static extern float ParentOriginLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginRight_get")] + public static extern float ParentOriginRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginMiddle_get")] + public static extern float ParentOriginMiddle_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginTopLeft_get")] + public static extern global::System.IntPtr ParentOriginTopLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginTopCenter_get")] + public static extern global::System.IntPtr ParentOriginTopCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginTopRight_get")] + public static extern global::System.IntPtr ParentOriginTopRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginCenterLeft_get")] + public static extern global::System.IntPtr ParentOriginCenterLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginCenter_get")] + public static extern global::System.IntPtr ParentOriginCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginCenterRight_get")] + public static extern global::System.IntPtr ParentOriginCenterRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginBottomLeft_get")] + public static extern global::System.IntPtr ParentOriginBottomLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginBottomCenter_get")] + public static extern global::System.IntPtr ParentOriginBottomCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ParentOriginBottomRight_get")] + public static extern global::System.IntPtr ParentOriginBottomRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointTop_get")] + public static extern float AnchorPointTop_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointBottom_get")] + public static extern float AnchorPointBottom_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointLeft_get")] + public static extern float AnchorPointLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointRight_get")] + public static extern float AnchorPointRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointMiddle_get")] + public static extern float AnchorPointMiddle_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointTopLeft_get")] + public static extern global::System.IntPtr AnchorPointTopLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointTopCenter_get")] + public static extern global::System.IntPtr AnchorPointTopCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointTopRight_get")] + public static extern global::System.IntPtr AnchorPointTopRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointCenterLeft_get")] + public static extern global::System.IntPtr AnchorPointCenterLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointCenter_get")] + public static extern global::System.IntPtr AnchorPointCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointCenterRight_get")] + public static extern global::System.IntPtr AnchorPointCenterRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointBottomLeft_get")] + public static extern global::System.IntPtr AnchorPointBottomLeft_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointBottomCenter_get")] + public static extern global::System.IntPtr AnchorPointBottomCenter_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnchorPointBottomRight_get")] + public static extern global::System.IntPtr AnchorPointBottomRight_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BLACK_get")] + public static extern global::System.IntPtr BLACK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WHITE_get")] + public static extern global::System.IntPtr WHITE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RED_get")] + public static extern global::System.IntPtr RED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GREEN_get")] + public static extern global::System.IntPtr GREEN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BLUE_get")] + public static extern global::System.IntPtr BLUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_YELLOW_get")] + public static extern global::System.IntPtr YELLOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MAGENTA_get")] + public static extern global::System.IntPtr MAGENTA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CYAN_get")] + public static extern global::System.IntPtr CYAN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TRANSPARENT_get")] + public static extern global::System.IntPtr TRANSPARENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_0_get")] + public static extern float MACHINE_EPSILON_0_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_1_get")] + public static extern float MACHINE_EPSILON_1_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_10_get")] + public static extern float MACHINE_EPSILON_10_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_100_get")] + public static extern float MACHINE_EPSILON_100_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_1000_get")] + public static extern float MACHINE_EPSILON_1000_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MACHINE_EPSILON_10000_get")] + public static extern float MACHINE_EPSILON_10000_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PI_get")] + public static extern float PI_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PI_2_get")] + public static extern float PI_2_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PI_4_get")] + public static extern float PI_4_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PI_OVER_180_get")] + public static extern float PI_OVER_180_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ONE80_OVER_PI_get")] + public static extern float ONE80_OVER_PI_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResizePolicyDefault_get")] + public static extern int ResizePolicyDefault_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorBase_Count")] + public static extern uint VectorBase_Count(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorBase_Size")] + public static extern uint VectorBase_Size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorBase_Empty")] + public static extern bool VectorBase_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorBase_Capacity")] + public static extern uint VectorBase_Capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorBase_Release")] + public static extern void VectorBase_Release(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Image__SWIG_0")] + public static extern global::System.IntPtr new_Image__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Image")] + public static extern void delete_Image(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Image__SWIG_1")] + public static extern global::System.IntPtr new_Image__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_Assign")] + public static extern global::System.IntPtr Image_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_DownCast")] + public static extern global::System.IntPtr Image_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_GetWidth")] + public static extern uint Image_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_GetHeight")] + public static extern uint Image_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_UploadedSignal")] + public static extern global::System.IntPtr Image_UploadedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FIRST_VALID_PIXEL_FORMAT_get")] + public static extern int FIRST_VALID_PIXEL_FORMAT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LAST_VALID_PIXEL_FORMAT_get")] + public static extern int LAST_VALID_PIXEL_FORMAT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_HasAlpha")] + public static extern bool HasAlpha(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetBytesPerPixel")] + public static extern uint GetBytesPerPixel(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetAlphaOffsetAndMask")] + public static extern void GetAlphaOffsetAndMask(int jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_New")] + public static extern global::System.IntPtr PixelData_New([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5, int jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PixelData__SWIG_0")] + public static extern global::System.IntPtr new_PixelData__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PixelData")] + public static extern void delete_PixelData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PixelData__SWIG_1")] + public static extern global::System.IntPtr new_PixelData__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_Assign")] + public static extern global::System.IntPtr PixelData_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_GetWidth")] + public static extern uint PixelData_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_GetHeight")] + public static extern uint PixelData_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_GetPixelFormat")] + public static extern int PixelData_GetPixelFormat(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_POSITIVE_X_get")] + public static extern uint POSITIVE_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NEGATIVE_X_get")] + public static extern uint NEGATIVE_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_POSITIVE_Y_get")] + public static extern uint POSITIVE_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NEGATIVE_Y_get")] + public static extern uint NEGATIVE_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_POSITIVE_Z_get")] + public static extern uint POSITIVE_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NEGATIVE_Z_get")] + public static extern uint NEGATIVE_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_New__SWIG_0")] + public static extern global::System.IntPtr Texture_New__SWIG_0(int jarg1, int jarg2, uint jarg3, uint jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_New__SWIG_1")] + public static extern global::System.IntPtr Texture_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Texture__SWIG_0")] + public static extern global::System.IntPtr new_Texture__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Texture")] + public static extern void delete_Texture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Texture__SWIG_1")] + public static extern global::System.IntPtr new_Texture__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_DownCast")] + public static extern global::System.IntPtr Texture_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_Assign")] + public static extern global::System.IntPtr Texture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_Upload__SWIG_0")] + public static extern bool Texture_Upload__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_Upload__SWIG_1")] + public static extern bool Texture_Upload__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3, uint jarg4, uint jarg5, uint jarg6, uint jarg7, uint jarg8); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_GenerateMipmaps")] + public static extern void Texture_GenerateMipmaps(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_GetWidth")] + public static extern uint Texture_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_GetHeight")] + public static extern uint Texture_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Texture__SWIG_2")] + public static extern global::System.IntPtr new_Texture__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_New")] + public static extern global::System.IntPtr Sampler_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Sampler__SWIG_0")] + public static extern global::System.IntPtr new_Sampler__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Sampler")] + public static extern void delete_Sampler(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Sampler__SWIG_1")] + public static extern global::System.IntPtr new_Sampler__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_DownCast")] + public static extern global::System.IntPtr Sampler_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_Assign")] + public static extern global::System.IntPtr Sampler_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_SetFilterMode")] + public static extern void Sampler_SetFilterMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_SetWrapMode__SWIG_0")] + public static extern void Sampler_SetWrapMode__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_SetWrapMode__SWIG_1")] + public static extern void Sampler_SetWrapMode__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_New")] + public static extern global::System.IntPtr TextureSet_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextureSet__SWIG_0")] + public static extern global::System.IntPtr new_TextureSet__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextureSet")] + public static extern void delete_TextureSet(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextureSet__SWIG_1")] + public static extern global::System.IntPtr new_TextureSet__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_DownCast")] + public static extern global::System.IntPtr TextureSet_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_Assign")] + public static extern global::System.IntPtr TextureSet_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_SetTexture")] + public static extern void TextureSet_SetTexture(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_GetTexture")] + public static extern global::System.IntPtr TextureSet_GetTexture(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_SetSampler")] + public static extern void TextureSet_SetSampler(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_GetSampler")] + public static extern global::System.IntPtr TextureSet_GetSampler(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_GetTextureCount")] + public static extern uint TextureSet_GetTextureCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_New")] + public static extern global::System.IntPtr PropertyBuffer_New(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyBuffer__SWIG_0")] + public static extern global::System.IntPtr new_PropertyBuffer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PropertyBuffer")] + public static extern void delete_PropertyBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyBuffer__SWIG_1")] + public static extern global::System.IntPtr new_PropertyBuffer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_DownCast")] + public static extern global::System.IntPtr PropertyBuffer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_Assign")] + public static extern global::System.IntPtr PropertyBuffer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_SetData")] + public static extern void PropertyBuffer_SetData(global::System.Runtime.InteropServices.HandleRef jarg1, System.IntPtr jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_GetSize")] + public static extern uint PropertyBuffer_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_New")] + public static extern global::System.IntPtr Geometry_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Geometry__SWIG_0")] + public static extern global::System.IntPtr new_Geometry__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Geometry")] + public static extern void delete_Geometry(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Geometry__SWIG_1")] + public static extern global::System.IntPtr new_Geometry__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_DownCast")] + public static extern global::System.IntPtr Geometry_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_Assign")] + public static extern global::System.IntPtr Geometry_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_AddVertexBuffer")] + public static extern uint Geometry_AddVertexBuffer(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_GetNumberOfVertexBuffers")] + public static extern uint Geometry_GetNumberOfVertexBuffers(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_RemoveVertexBuffer")] + public static extern void Geometry_RemoveVertexBuffer(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_SetIndexBuffer")] + public static extern void Geometry_SetIndexBuffer(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]ushort[] jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_SetType")] + public static extern void Geometry_SetType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_GetType")] + public static extern int Geometry_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Shader_Hint")] + public static extern global::System.IntPtr new_Shader_Hint(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Shader_Hint")] + public static extern void delete_Shader_Hint(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_Property_PROGRAM_get")] + public static extern int Shader_Property_PROGRAM_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Shader_Property")] + public static extern global::System.IntPtr new_Shader_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Shader_Property")] + public static extern void delete_Shader_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_New__SWIG_0")] + public static extern global::System.IntPtr Shader_New__SWIG_0(string jarg1, string jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_New__SWIG_1")] + public static extern global::System.IntPtr Shader_New__SWIG_1(string jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Shader__SWIG_0")] + public static extern global::System.IntPtr new_Shader__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Shader")] + public static extern void delete_Shader(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Shader__SWIG_1")] + public static extern global::System.IntPtr new_Shader__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_DownCast")] + public static extern global::System.IntPtr Shader_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_Assign")] + public static extern global::System.IntPtr Shader_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_DEPTH_INDEX_get")] + public static extern int Renderer_Property_DEPTH_INDEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_FACE_CULLING_MODE_get")] + public static extern int Renderer_Property_FACE_CULLING_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_MODE_get")] + public static extern int Renderer_Property_BLEND_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_EQUATION_RGB_get")] + public static extern int Renderer_Property_BLEND_EQUATION_RGB_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_EQUATION_ALPHA_get")] + public static extern int Renderer_Property_BLEND_EQUATION_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_FACTOR_SRC_RGB_get")] + public static extern int Renderer_Property_BLEND_FACTOR_SRC_RGB_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_FACTOR_DEST_RGB_get")] + public static extern int Renderer_Property_BLEND_FACTOR_DEST_RGB_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get")] + public static extern int Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get")] + public static extern int Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_COLOR_get")] + public static extern int Renderer_Property_BLEND_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get")] + public static extern int Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_INDEX_RANGE_FIRST_get")] + public static extern int Renderer_Property_INDEX_RANGE_FIRST_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_INDEX_RANGE_COUNT_get")] + public static extern int Renderer_Property_INDEX_RANGE_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_DEPTH_WRITE_MODE_get")] + public static extern int Renderer_Property_DEPTH_WRITE_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_DEPTH_FUNCTION_get")] + public static extern int Renderer_Property_DEPTH_FUNCTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_DEPTH_TEST_MODE_get")] + public static extern int Renderer_Property_DEPTH_TEST_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_RENDER_MODE_get")] + public static extern int Renderer_Property_RENDER_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_FUNCTION_get")] + public static extern int Renderer_Property_STENCIL_FUNCTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_FUNCTION_MASK_get")] + public static extern int Renderer_Property_STENCIL_FUNCTION_MASK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_FUNCTION_REFERENCE_get")] + public static extern int Renderer_Property_STENCIL_FUNCTION_REFERENCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_MASK_get")] + public static extern int Renderer_Property_STENCIL_MASK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_OPERATION_ON_FAIL_get")] + public static extern int Renderer_Property_STENCIL_OPERATION_ON_FAIL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get")] + public static extern int Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get")] + public static extern int Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Renderer_Property")] + public static extern global::System.IntPtr new_Renderer_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Renderer_Property")] + public static extern void delete_Renderer_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_New")] + public static extern global::System.IntPtr Renderer_New(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Renderer__SWIG_0")] + public static extern global::System.IntPtr new_Renderer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Renderer")] + public static extern void delete_Renderer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Renderer__SWIG_1")] + public static extern global::System.IntPtr new_Renderer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_DownCast")] + public static extern global::System.IntPtr Renderer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_Assign")] + public static extern global::System.IntPtr Renderer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_SetGeometry")] + public static extern void Renderer_SetGeometry(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_GetGeometry")] + public static extern global::System.IntPtr Renderer_GetGeometry(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_SetIndexRange")] + public static extern void Renderer_SetIndexRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_SetTextures")] + public static extern void Renderer_SetTextures(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_GetTextures")] + public static extern global::System.IntPtr Renderer_GetTextures(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_SetShader")] + public static extern void Renderer_SetShader(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_GetShader")] + public static extern global::System.IntPtr Renderer_GetShader(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FrameBuffer_Attachment")] + public static extern global::System.IntPtr new_FrameBuffer_Attachment(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FrameBuffer_Attachment")] + public static extern void delete_FrameBuffer_Attachment(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_New")] + public static extern global::System.IntPtr FrameBuffer_New(uint jarg1, uint jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FrameBuffer__SWIG_0")] + public static extern global::System.IntPtr new_FrameBuffer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FrameBuffer")] + public static extern void delete_FrameBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FrameBuffer__SWIG_1")] + public static extern global::System.IntPtr new_FrameBuffer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_DownCast")] + public static extern global::System.IntPtr FrameBuffer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_Assign")] + public static extern global::System.IntPtr FrameBuffer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_AttachColorTexture__SWIG_0")] + public static extern void FrameBuffer_AttachColorTexture__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_AttachColorTexture__SWIG_1")] + public static extern void FrameBuffer_AttachColorTexture__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3, uint jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_GetColorTexture")] + public static extern global::System.IntPtr FrameBuffer_GetColorTexture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTaskList__SWIG_0")] + public static extern global::System.IntPtr new_RenderTaskList__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_DownCast")] + public static extern global::System.IntPtr RenderTaskList_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RenderTaskList")] + public static extern void delete_RenderTaskList(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTaskList__SWIG_1")] + public static extern global::System.IntPtr new_RenderTaskList__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_Assign")] + public static extern global::System.IntPtr RenderTaskList_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_CreateTask")] + public static extern global::System.IntPtr RenderTaskList_CreateTask(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_RemoveTask")] + public static extern void RenderTaskList_RemoveTask(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_GetTaskCount")] + public static extern uint RenderTaskList_GetTaskCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_GetTask")] + public static extern global::System.IntPtr RenderTaskList_GetTask(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_Property_VIEWPORT_POSITION_get")] + public static extern int RenderTask_Property_VIEWPORT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_Property_VIEWPORT_SIZE_get")] + public static extern int RenderTask_Property_VIEWPORT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_Property_CLEAR_COLOR_get")] + public static extern int RenderTask_Property_CLEAR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_Property_REQUIRES_SYNC_get")] + public static extern int RenderTask_Property_REQUIRES_SYNC_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTask_Property")] + public static extern global::System.IntPtr new_RenderTask_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RenderTask_Property")] + public static extern void delete_RenderTask_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION_get")] + public static extern global::System.IntPtr RenderTask_DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_FULLSCREEN_FRAMEBUFFER_FUNCTION_get")] + public static extern global::System.IntPtr RenderTask_FULLSCREEN_FRAMEBUFFER_FUNCTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_EXCLUSIVE_get")] + public static extern bool RenderTask_DEFAULT_EXCLUSIVE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_INPUT_ENABLED_get")] + public static extern bool RenderTask_DEFAULT_INPUT_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_CLEAR_COLOR_get")] + public static extern global::System.IntPtr RenderTask_DEFAULT_CLEAR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_CLEAR_ENABLED_get")] + public static extern bool RenderTask_DEFAULT_CLEAR_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_CULL_MODE_get")] + public static extern bool RenderTask_DEFAULT_CULL_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DEFAULT_REFRESH_RATE_get")] + public static extern uint RenderTask_DEFAULT_REFRESH_RATE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTask__SWIG_0")] + public static extern global::System.IntPtr new_RenderTask__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_DownCast")] + public static extern global::System.IntPtr RenderTask_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RenderTask")] + public static extern void delete_RenderTask(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTask__SWIG_1")] + public static extern global::System.IntPtr new_RenderTask__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_Assign")] + public static extern global::System.IntPtr RenderTask_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetSourceActor")] + public static extern void RenderTask_SetSourceActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetSourceActor")] + public static extern global::System.IntPtr RenderTask_GetSourceActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetExclusive")] + public static extern void RenderTask_SetExclusive(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_IsExclusive")] + public static extern bool RenderTask_IsExclusive(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetInputEnabled")] + public static extern void RenderTask_SetInputEnabled(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetInputEnabled")] + public static extern bool RenderTask_GetInputEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetCameraActor")] + public static extern void RenderTask_SetCameraActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetCameraActor")] + public static extern global::System.IntPtr RenderTask_GetCameraActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetTargetFrameBuffer")] + public static extern void RenderTask_SetTargetFrameBuffer(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetTargetFrameBuffer")] + public static extern global::System.IntPtr RenderTask_GetTargetFrameBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetFrameBuffer")] + public static extern void RenderTask_SetFrameBuffer(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetFrameBuffer")] + public static extern global::System.IntPtr RenderTask_GetFrameBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetScreenToFrameBufferFunction")] + public static extern void RenderTask_SetScreenToFrameBufferFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetScreenToFrameBufferFunction")] + public static extern global::System.IntPtr RenderTask_GetScreenToFrameBufferFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetScreenToFrameBufferMappingActor")] + public static extern void RenderTask_SetScreenToFrameBufferMappingActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetScreenToFrameBufferMappingActor")] + public static extern global::System.IntPtr RenderTask_GetScreenToFrameBufferMappingActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetViewportPosition")] + public static extern void RenderTask_SetViewportPosition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetCurrentViewportPosition")] + public static extern global::System.IntPtr RenderTask_GetCurrentViewportPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetViewportSize")] + public static extern void RenderTask_SetViewportSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetCurrentViewportSize")] + public static extern global::System.IntPtr RenderTask_GetCurrentViewportSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetViewport")] + public static extern void RenderTask_SetViewport(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetViewport")] + public static extern global::System.IntPtr RenderTask_GetViewport(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetClearColor")] + public static extern void RenderTask_SetClearColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetClearColor")] + public static extern global::System.IntPtr RenderTask_GetClearColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetClearEnabled")] + public static extern void RenderTask_SetClearEnabled(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetClearEnabled")] + public static extern bool RenderTask_GetClearEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetCullMode")] + public static extern void RenderTask_SetCullMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetCullMode")] + public static extern bool RenderTask_GetCullMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SetRefreshRate")] + public static extern void RenderTask_SetRefreshRate(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_GetRefreshRate")] + public static extern uint RenderTask_GetRefreshRate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_WorldToViewport")] + public static extern bool RenderTask_WorldToViewport(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, out float jarg3, out float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_ViewportToLocal")] + public static extern bool RenderTask_ViewportToLocal(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, float jarg4, out float jarg5, out float jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_FinishedSignal")] + public static extern global::System.IntPtr RenderTask_FinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchPoint__SWIG_0")] + public static extern global::System.IntPtr new_TouchPoint__SWIG_0(int jarg1, int jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchPoint__SWIG_1")] + public static extern global::System.IntPtr new_TouchPoint__SWIG_1(int jarg1, int jarg2, float jarg3, float jarg4, float jarg5, float jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TouchPoint")] + public static extern void delete_TouchPoint(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_deviceId_set")] + public static extern void TouchPoint_deviceId_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_deviceId_get")] + public static extern int TouchPoint_deviceId_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_state_set")] + public static extern void TouchPoint_state_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_state_get")] + public static extern int TouchPoint_state_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_hitActor_set")] + public static extern void TouchPoint_hitActor_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_hitActor_get")] + public static extern global::System.IntPtr TouchPoint_hitActor_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_local_set")] + public static extern void TouchPoint_local_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_local_get")] + public static extern global::System.IntPtr TouchPoint_local_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_screen_set")] + public static extern void TouchPoint_screen_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPoint_screen_get")] + public static extern global::System.IntPtr TouchPoint_screen_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Touch__SWIG_0")] + public static extern global::System.IntPtr new_Touch__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Touch__SWIG_1")] + public static extern global::System.IntPtr new_Touch__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Touch")] + public static extern void delete_Touch(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_Assign")] + public static extern global::System.IntPtr Touch_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetTime")] + public static extern uint Touch_GetTime(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetPointCount")] + public static extern uint Touch_GetPointCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetDeviceId")] + public static extern int Touch_GetDeviceId(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetState")] + public static extern int Touch_GetState(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetHitActor")] + public static extern global::System.IntPtr Touch_GetHitActor(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetLocalPosition")] + public static extern global::System.IntPtr Touch_GetLocalPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetScreenPosition")] + public static extern global::System.IntPtr Touch_GetScreenPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetRadius")] + public static extern float Touch_GetRadius(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetEllipseRadius")] + public static extern global::System.IntPtr Touch_GetEllipseRadius(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetPressure")] + public static extern float Touch_GetPressure(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_GetAngle")] + public static extern global::System.IntPtr Touch_GetAngle(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_GestureDetector__SWIG_0")] + public static extern global::System.IntPtr new_GestureDetector__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_DownCast")] + public static extern global::System.IntPtr GestureDetector_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_GestureDetector")] + public static extern void delete_GestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_GestureDetector__SWIG_1")] + public static extern global::System.IntPtr new_GestureDetector__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_Assign")] + public static extern global::System.IntPtr GestureDetector_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_Attach")] + public static extern void GestureDetector_Attach(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_Detach")] + public static extern void GestureDetector_Detach(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_DetachAll")] + public static extern void GestureDetector_DetachAll(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_GetAttachedActorCount")] + public static extern uint GestureDetector_GetAttachedActorCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_GetAttachedActor")] + public static extern global::System.IntPtr GestureDetector_GetAttachedActor(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Gesture")] + public static extern global::System.IntPtr new_Gesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_Assign")] + public static extern global::System.IntPtr Gesture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Gesture")] + public static extern void delete_Gesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_type_set")] + public static extern void Gesture_type_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_type_get")] + public static extern int Gesture_type_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_state_set")] + public static extern void Gesture_state_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_state_get")] + public static extern int Gesture_state_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_time_set")] + public static extern void Gesture_time_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Gesture_time_get")] + public static extern uint Gesture_time_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Hover__SWIG_0")] + public static extern global::System.IntPtr new_Hover__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Hover__SWIG_1")] + public static extern global::System.IntPtr new_Hover__SWIG_1(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Hover")] + public static extern void delete_Hover(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_points_set")] + public static extern void Hover_points_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_points_get")] + public static extern global::System.IntPtr Hover_points_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_time_set")] + public static extern void Hover_time_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_time_get")] + public static extern uint Hover_time_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_GetPointCount")] + public static extern uint Hover_GetPointCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hover_GetPoint")] + public static extern global::System.IntPtr Hover_GetPoint(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Key__SWIG_0")] + public static extern global::System.IntPtr new_Key__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Key__SWIG_1")] + public static extern global::System.IntPtr new_Key__SWIG_1(string jarg1, string jarg2, int jarg3, int jarg4, uint jarg5, int jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Key__SWIG_2")] + public static extern global::System.IntPtr new_Key__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_Assign")] + public static extern global::System.IntPtr Key_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Key")] + public static extern void delete_Key(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_IsShiftModifier")] + public static extern bool Key_IsShiftModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_IsCtrlModifier")] + public static extern bool Key_IsCtrlModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_IsAltModifier")] + public static extern bool Key_IsAltModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyPressedName_set")] + public static extern void Key_keyPressedName_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyPressedName_get")] + public static extern string Key_keyPressedName_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyPressed_set")] + public static extern void Key_keyPressed_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyPressed_get")] + public static extern string Key_keyPressed_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyCode_set")] + public static extern void Key_keyCode_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyCode_get")] + public static extern int Key_keyCode_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyModifier_set")] + public static extern void Key_keyModifier_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_keyModifier_get")] + public static extern int Key_keyModifier_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_time_set")] + public static extern void Key_time_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_time_get")] + public static extern uint Key_time_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_state_set")] + public static extern void Key_state_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Key_state_get")] + public static extern int Key_state_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LongPressGestureDetector__SWIG_0")] + public static extern global::System.IntPtr new_LongPressGestureDetector__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_New__SWIG_0")] + public static extern global::System.IntPtr LongPressGestureDetector_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_New__SWIG_1")] + public static extern global::System.IntPtr LongPressGestureDetector_New__SWIG_1(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_New__SWIG_2")] + public static extern global::System.IntPtr LongPressGestureDetector_New__SWIG_2(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_DownCast")] + public static extern global::System.IntPtr LongPressGestureDetector_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LongPressGestureDetector")] + public static extern void delete_LongPressGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LongPressGestureDetector__SWIG_1")] + public static extern global::System.IntPtr new_LongPressGestureDetector__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_Assign")] + public static extern global::System.IntPtr LongPressGestureDetector_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_SetTouchesRequired__SWIG_0")] + public static extern void LongPressGestureDetector_SetTouchesRequired__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_SetTouchesRequired__SWIG_1")] + public static extern void LongPressGestureDetector_SetTouchesRequired__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_GetMinimumTouchesRequired")] + public static extern uint LongPressGestureDetector_GetMinimumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_GetMaximumTouchesRequired")] + public static extern uint LongPressGestureDetector_GetMaximumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_DetectedSignal")] + public static extern global::System.IntPtr LongPressGestureDetector_DetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LongPressGesture__SWIG_0")] + public static extern global::System.IntPtr new_LongPressGesture__SWIG_0(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LongPressGesture__SWIG_1")] + public static extern global::System.IntPtr new_LongPressGesture__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_Assign")] + public static extern global::System.IntPtr LongPressGesture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LongPressGesture")] + public static extern void delete_LongPressGesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_numberOfTouches_set")] + public static extern void LongPressGesture_numberOfTouches_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_numberOfTouches_get")] + public static extern uint LongPressGesture_numberOfTouches_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_screenPoint_set")] + public static extern void LongPressGesture_screenPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_screenPoint_get")] + public static extern global::System.IntPtr LongPressGesture_screenPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_localPoint_set")] + public static extern void LongPressGesture_localPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_localPoint_get")] + public static extern global::System.IntPtr LongPressGesture_localPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Wheel__SWIG_0")] + public static extern global::System.IntPtr new_Wheel__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Wheel__SWIG_1")] + public static extern global::System.IntPtr new_Wheel__SWIG_1(int jarg1, int jarg2, uint jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, int jarg5, uint jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Wheel")] + public static extern void delete_Wheel(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_IsShiftModifier")] + public static extern bool Wheel_IsShiftModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_IsCtrlModifier")] + public static extern bool Wheel_IsCtrlModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_IsAltModifier")] + public static extern bool Wheel_IsAltModifier(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_type_set")] + public static extern void Wheel_type_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_type_get")] + public static extern int Wheel_type_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_direction_set")] + public static extern void Wheel_direction_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_direction_get")] + public static extern int Wheel_direction_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_modifiers_set")] + public static extern void Wheel_modifiers_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_modifiers_get")] + public static extern uint Wheel_modifiers_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_point_set")] + public static extern void Wheel_point_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_point_get")] + public static extern global::System.IntPtr Wheel_point_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_z_set")] + public static extern void Wheel_z_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_z_get")] + public static extern int Wheel_z_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_timeStamp_set")] + public static extern void Wheel_timeStamp_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Wheel_timeStamp_get")] + public static extern uint Wheel_timeStamp_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetDeviceName")] + public static extern string GetDeviceName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetDeviceClass")] + public static extern int GetDeviceClass(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_PARENT_ORIGIN_get")] + public static extern int Actor_Property_PARENT_ORIGIN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_PARENT_ORIGIN_X_get")] + public static extern int Actor_Property_PARENT_ORIGIN_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_PARENT_ORIGIN_Y_get")] + public static extern int Actor_Property_PARENT_ORIGIN_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_PARENT_ORIGIN_Z_get")] + public static extern int Actor_Property_PARENT_ORIGIN_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_ANCHOR_POINT_get")] + public static extern int Actor_Property_ANCHOR_POINT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_ANCHOR_POINT_X_get")] + public static extern int Actor_Property_ANCHOR_POINT_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_ANCHOR_POINT_Y_get")] + public static extern int Actor_Property_ANCHOR_POINT_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_ANCHOR_POINT_Z_get")] + public static extern int Actor_Property_ANCHOR_POINT_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_get")] + public static extern int Actor_Property_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_WIDTH_get")] + public static extern int Actor_Property_SIZE_WIDTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_HEIGHT_get")] + public static extern int Actor_Property_SIZE_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_DEPTH_get")] + public static extern int Actor_Property_SIZE_DEPTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_POSITION_get")] + public static extern int Actor_Property_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_POSITION_X_get")] + public static extern int Actor_Property_POSITION_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_POSITION_Y_get")] + public static extern int Actor_Property_POSITION_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_POSITION_Z_get")] + public static extern int Actor_Property_POSITION_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_POSITION_get")] + public static extern int Actor_Property_WORLD_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_POSITION_X_get")] + public static extern int Actor_Property_WORLD_POSITION_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_POSITION_Y_get")] + public static extern int Actor_Property_WORLD_POSITION_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_POSITION_Z_get")] + public static extern int Actor_Property_WORLD_POSITION_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_ORIENTATION_get")] + public static extern int Actor_Property_ORIENTATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_ORIENTATION_get")] + public static extern int Actor_Property_WORLD_ORIENTATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SCALE_get")] + public static extern int Actor_Property_SCALE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SCALE_X_get")] + public static extern int Actor_Property_SCALE_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SCALE_Y_get")] + public static extern int Actor_Property_SCALE_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SCALE_Z_get")] + public static extern int Actor_Property_SCALE_Z_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_SCALE_get")] + public static extern int Actor_Property_WORLD_SCALE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_VISIBLE_get")] + public static extern int Actor_Property_VISIBLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_get")] + public static extern int Actor_Property_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_RED_get")] + public static extern int Actor_Property_COLOR_RED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_GREEN_get")] + public static extern int Actor_Property_COLOR_GREEN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_BLUE_get")] + public static extern int Actor_Property_COLOR_BLUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_ALPHA_get")] + public static extern int Actor_Property_COLOR_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_COLOR_get")] + public static extern int Actor_Property_WORLD_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WORLD_MATRIX_get")] + public static extern int Actor_Property_WORLD_MATRIX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_NAME_get")] + public static extern int Actor_Property_NAME_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SENSITIVE_get")] + public static extern int Actor_Property_SENSITIVE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_LEAVE_REQUIRED_get")] + public static extern int Actor_Property_LEAVE_REQUIRED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_INHERIT_ORIENTATION_get")] + public static extern int Actor_Property_INHERIT_ORIENTATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_INHERIT_SCALE_get")] + public static extern int Actor_Property_INHERIT_SCALE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_COLOR_MODE_get")] + public static extern int Actor_Property_COLOR_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_POSITION_INHERITANCE_get")] + public static extern int Actor_Property_POSITION_INHERITANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_DRAW_MODE_get")] + public static extern int Actor_Property_DRAW_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_MODE_FACTOR_get")] + public static extern int Actor_Property_SIZE_MODE_FACTOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WIDTH_RESIZE_POLICY_get")] + public static extern int Actor_Property_WIDTH_RESIZE_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_HEIGHT_RESIZE_POLICY_get")] + public static extern int Actor_Property_HEIGHT_RESIZE_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_SIZE_SCALE_POLICY_get")] + public static extern int Actor_Property_SIZE_SCALE_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_WIDTH_FOR_HEIGHT_get")] + public static extern int Actor_Property_WIDTH_FOR_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_HEIGHT_FOR_WIDTH_get")] + public static extern int Actor_Property_HEIGHT_FOR_WIDTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_PADDING_get")] + public static extern int Actor_Property_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_MINIMUM_SIZE_get")] + public static extern int Actor_Property_MINIMUM_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_MAXIMUM_SIZE_get")] + public static extern int Actor_Property_MAXIMUM_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_INHERIT_POSITION_get")] + public static extern int Actor_Property_INHERIT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Property_CLIPPING_MODE_get")] + public static extern int Actor_Property_CLIPPING_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Actor_Property")] + public static extern global::System.IntPtr new_Actor_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Actor_Property")] + public static extern void delete_Actor_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Actor__SWIG_0")] + public static extern global::System.IntPtr new_Actor__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_New")] + public static extern global::System.IntPtr Actor_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_DownCast")] + public static extern global::System.IntPtr Actor_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Actor")] + public static extern void delete_Actor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Actor__SWIG_1")] + public static extern global::System.IntPtr new_Actor__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Assign")] + public static extern global::System.IntPtr Actor_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetName")] + public static extern string Actor_GetName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetName")] + public static extern void Actor_SetName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetId")] + public static extern uint Actor_GetId(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsRoot")] + public static extern bool Actor_IsRoot(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_OnStage")] + public static extern bool Actor_OnStage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsLayer")] + public static extern bool Actor_IsLayer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetLayer")] + public static extern global::System.IntPtr Actor_GetLayer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Add")] + public static extern void Actor_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Remove")] + public static extern void Actor_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_Unparent")] + public static extern void Actor_Unparent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetChildCount")] + public static extern uint Actor_GetChildCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetChildAt")] + public static extern global::System.IntPtr Actor_GetChildAt(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_FindChildByName")] + public static extern global::System.IntPtr Actor_FindChildByName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_FindChildById")] + public static extern global::System.IntPtr Actor_FindChildById(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetParent")] + public static extern global::System.IntPtr Actor_GetParent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetParentOrigin")] + public static extern void Actor_SetParentOrigin(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentParentOrigin")] + public static extern global::System.IntPtr Actor_GetCurrentParentOrigin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetAnchorPoint")] + public static extern void Actor_SetAnchorPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentAnchorPoint")] + public static extern global::System.IntPtr Actor_GetCurrentAnchorPoint(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSize__SWIG_0")] + public static extern void Actor_SetSize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSize__SWIG_1")] + public static extern void Actor_SetSize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSize__SWIG_2")] + public static extern void Actor_SetSize__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSize__SWIG_3")] + public static extern void Actor_SetSize__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetTargetSize")] + public static extern global::System.IntPtr Actor_GetTargetSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentSize")] + public static extern global::System.IntPtr Actor_GetCurrentSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetNaturalSize")] + public static extern global::System.IntPtr Actor_GetNaturalSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetPosition__SWIG_0")] + public static extern void Actor_SetPosition__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetPosition__SWIG_1")] + public static extern void Actor_SetPosition__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetPosition__SWIG_2")] + public static extern void Actor_SetPosition__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetX")] + public static extern void Actor_SetX(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetY")] + public static extern void Actor_SetY(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetZ")] + public static extern void Actor_SetZ(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_TranslateBy")] + public static extern void Actor_TranslateBy(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentPosition")] + public static extern global::System.IntPtr Actor_GetCurrentPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentWorldPosition")] + public static extern global::System.IntPtr Actor_GetCurrentWorldPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetInheritPosition")] + public static extern void Actor_SetInheritPosition(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetPositionInheritanceMode")] + public static extern int Actor_GetPositionInheritanceMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsPositionInherited")] + public static extern bool Actor_IsPositionInherited(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetOrientation__SWIG_0")] + public static extern void Actor_SetOrientation__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetOrientation__SWIG_1")] + public static extern void Actor_SetOrientation__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetOrientation__SWIG_2")] + public static extern void Actor_SetOrientation__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_RotateBy__SWIG_0")] + public static extern void Actor_RotateBy__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_RotateBy__SWIG_1")] + public static extern void Actor_RotateBy__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_RotateBy__SWIG_2")] + public static extern void Actor_RotateBy__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentOrientation")] + public static extern global::System.IntPtr Actor_GetCurrentOrientation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetInheritOrientation")] + public static extern void Actor_SetInheritOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsOrientationInherited")] + public static extern bool Actor_IsOrientationInherited(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentWorldOrientation")] + public static extern global::System.IntPtr Actor_GetCurrentWorldOrientation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetScale__SWIG_0")] + public static extern void Actor_SetScale__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetScale__SWIG_1")] + public static extern void Actor_SetScale__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetScale__SWIG_2")] + public static extern void Actor_SetScale__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_ScaleBy")] + public static extern void Actor_ScaleBy(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentScale")] + public static extern global::System.IntPtr Actor_GetCurrentScale(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentWorldScale")] + public static extern global::System.IntPtr Actor_GetCurrentWorldScale(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetInheritScale")] + public static extern void Actor_SetInheritScale(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsScaleInherited")] + public static extern bool Actor_IsScaleInherited(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentWorldMatrix")] + public static extern global::System.IntPtr Actor_GetCurrentWorldMatrix(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetVisible")] + public static extern void Actor_SetVisible(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsVisible")] + public static extern bool Actor_IsVisible(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetOpacity")] + public static extern void Actor_SetOpacity(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentOpacity")] + public static extern float Actor_GetCurrentOpacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetColor")] + public static extern void Actor_SetColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentColor")] + public static extern global::System.IntPtr Actor_GetCurrentColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetColorMode")] + public static extern void Actor_SetColorMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetColorMode")] + public static extern int Actor_GetColorMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetCurrentWorldColor")] + public static extern global::System.IntPtr Actor_GetCurrentWorldColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetDrawMode")] + public static extern void Actor_SetDrawMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetDrawMode")] + public static extern int Actor_GetDrawMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSensitive")] + public static extern void Actor_SetSensitive(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsSensitive")] + public static extern bool Actor_IsSensitive(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_ScreenToLocal")] + public static extern bool Actor_ScreenToLocal(global::System.Runtime.InteropServices.HandleRef jarg1, out float jarg2, out float jarg3, float jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetLeaveRequired")] + public static extern void Actor_SetLeaveRequired(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetLeaveRequired")] + public static extern bool Actor_GetLeaveRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetKeyboardFocusable")] + public static extern void Actor_SetKeyboardFocusable(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_IsKeyboardFocusable")] + public static extern bool Actor_IsKeyboardFocusable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetResizePolicy")] + public static extern void Actor_SetResizePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetResizePolicy")] + public static extern int Actor_GetResizePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSizeScalePolicy")] + public static extern void Actor_SetSizeScalePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetSizeScalePolicy")] + public static extern int Actor_GetSizeScalePolicy(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetSizeModeFactor")] + public static extern void Actor_SetSizeModeFactor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetSizeModeFactor")] + public static extern global::System.IntPtr Actor_GetSizeModeFactor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetHeightForWidth")] + public static extern float Actor_GetHeightForWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetWidthForHeight")] + public static extern float Actor_GetWidthForHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetRelayoutSize")] + public static extern float Actor_GetRelayoutSize(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetPadding")] + public static extern void Actor_SetPadding(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetPadding")] + public static extern void Actor_GetPadding(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetMinimumSize")] + public static extern void Actor_SetMinimumSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetMinimumSize")] + public static extern global::System.IntPtr Actor_GetMinimumSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SetMaximumSize")] + public static extern void Actor_SetMaximumSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetMaximumSize")] + public static extern global::System.IntPtr Actor_GetMaximumSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetHierarchyDepth")] + public static extern int Actor_GetHierarchyDepth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_AddRenderer")] + public static extern uint Actor_AddRenderer(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetRendererCount")] + public static extern uint Actor_GetRendererCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_GetRendererAt")] + public static extern global::System.IntPtr Actor_GetRendererAt(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_RemoveRenderer__SWIG_0")] + public static extern void Actor_RemoveRenderer__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_RemoveRenderer__SWIG_1")] + public static extern void Actor_RemoveRenderer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_TouchedSignal")] + public static extern global::System.IntPtr Actor_TouchedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_TouchSignal")] + public static extern global::System.IntPtr Actor_TouchSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_HoveredSignal")] + public static extern global::System.IntPtr Actor_HoveredSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_WheelEventSignal")] + public static extern global::System.IntPtr Actor_WheelEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_OnStageSignal")] + public static extern global::System.IntPtr Actor_OnStageSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_OffStageSignal")] + public static extern global::System.IntPtr Actor_OffStageSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_OnRelayoutSignal")] + public static extern global::System.IntPtr Actor_OnRelayoutSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_UnparentAndReset")] + public static extern void UnparentAndReset(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Raise")] + public static extern void Raise(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Lower")] + public static extern void Lower(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RaiseToTop")] + public static extern void RaiseToTop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LowerToBottom")] + public static extern void LowerToBottom(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RaiseAbove")] + public static extern void RaiseAbove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LowerBelow")] + public static extern void LowerBelow(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisibilityChangedSignal")] + public static extern global::System.IntPtr VisibilityChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Property_CLIPPING_ENABLE_get")] + public static extern int Layer_Property_CLIPPING_ENABLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Property_CLIPPING_BOX_get")] + public static extern int Layer_Property_CLIPPING_BOX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Property_BEHAVIOR_get")] + public static extern int Layer_Property_BEHAVIOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Layer_Property")] + public static extern global::System.IntPtr new_Layer_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Layer_Property")] + public static extern void delete_Layer_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Layer__SWIG_0")] + public static extern global::System.IntPtr new_Layer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_New")] + public static extern global::System.IntPtr Layer_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_DownCast")] + public static extern global::System.IntPtr Layer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Layer")] + public static extern void delete_Layer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Layer__SWIG_1")] + public static extern global::System.IntPtr new_Layer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Assign")] + public static extern global::System.IntPtr Layer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_GetDepth")] + public static extern uint Layer_GetDepth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Raise")] + public static extern void Layer_Raise(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_Lower")] + public static extern void Layer_Lower(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_RaiseAbove")] + public static extern void Layer_RaiseAbove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_LowerBelow")] + public static extern void Layer_LowerBelow(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_RaiseToTop")] + public static extern void Layer_RaiseToTop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_LowerToBottom")] + public static extern void Layer_LowerToBottom(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_MoveAbove")] + public static extern void Layer_MoveAbove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_MoveBelow")] + public static extern void Layer_MoveBelow(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetBehavior")] + public static extern void Layer_SetBehavior(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_GetBehavior")] + public static extern int Layer_GetBehavior(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetClipping")] + public static extern void Layer_SetClipping(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_IsClipping")] + public static extern bool Layer_IsClipping(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetClippingBox__SWIG_0")] + public static extern void Layer_SetClippingBox__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetClippingBox__SWIG_1")] + public static extern void Layer_SetClippingBox__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_GetClippingBox")] + public static extern global::System.IntPtr Layer_GetClippingBox(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetDepthTestDisabled")] + public static extern void Layer_SetDepthTestDisabled(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_IsDepthTestDisabled")] + public static extern bool Layer_IsDepthTestDisabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetSortFunction")] + public static extern void Layer_SetSortFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetTouchConsumed")] + public static extern void Layer_SetTouchConsumed(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_IsTouchConsumed")] + public static extern bool Layer_IsTouchConsumed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SetHoverConsumed")] + public static extern void Layer_SetHoverConsumed(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_IsHoverConsumed")] + public static extern bool Layer_IsHoverConsumed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_DEFAULT_BACKGROUND_COLOR_get")] + public static extern global::System.IntPtr Stage_DEFAULT_BACKGROUND_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_DEBUG_BACKGROUND_COLOR_get")] + public static extern global::System.IntPtr Stage_DEBUG_BACKGROUND_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Stage__SWIG_0")] + public static extern global::System.IntPtr new_Stage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetCurrent")] + public static extern global::System.IntPtr Stage_GetCurrent(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_IsInstalled")] + public static extern bool Stage_IsInstalled(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Stage")] + public static extern void delete_Stage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Stage__SWIG_1")] + public static extern global::System.IntPtr new_Stage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_Assign")] + public static extern global::System.IntPtr Stage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_Add")] + public static extern void Stage_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_Remove")] + public static extern void Stage_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetSize")] + public static extern global::System.IntPtr Stage_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetRenderTaskList")] + public static extern global::System.IntPtr Stage_GetRenderTaskList(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetLayerCount")] + public static extern uint Stage_GetLayerCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetLayer")] + public static extern global::System.IntPtr Stage_GetLayer(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetRootLayer")] + public static extern global::System.IntPtr Stage_GetRootLayer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_SetBackgroundColor")] + public static extern void Stage_SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetBackgroundColor")] + public static extern global::System.IntPtr Stage_GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetDpi")] + public static extern global::System.IntPtr Stage_GetDpi(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_GetObjectRegistry")] + public static extern global::System.IntPtr Stage_GetObjectRegistry(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_KeepRendering")] + public static extern void Stage_KeepRendering(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_KeyEventSignal")] + public static extern global::System.IntPtr Stage_KeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_EventProcessingFinishedSignal")] + public static extern global::System.IntPtr Stage_EventProcessingFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_TouchSignal")] + public static extern global::System.IntPtr Stage_TouchSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_WheelEventSignal")] + public static extern global::System.IntPtr Stage_WheelEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_ContextLostSignal")] + public static extern global::System.IntPtr Stage_ContextLostSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_ContextRegainedSignal")] + public static extern global::System.IntPtr Stage_ContextRegainedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_SceneCreatedSignal")] + public static extern global::System.IntPtr Stage_SceneCreatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RelayoutContainer")] + public static extern void delete_RelayoutContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RelayoutContainer_Add")] + public static extern void RelayoutContainer_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_Self")] + public static extern global::System.IntPtr CustomActorImpl_Self(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnStageConnection")] + public static extern void CustomActorImpl_OnStageConnection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnStageDisconnection")] + public static extern void CustomActorImpl_OnStageDisconnection(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnChildAdd")] + public static extern void CustomActorImpl_OnChildAdd(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnChildRemove")] + public static extern void CustomActorImpl_OnChildRemove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnPropertySet")] + public static extern void CustomActorImpl_OnPropertySet(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnSizeSet")] + public static extern void CustomActorImpl_OnSizeSet(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnSizeAnimation")] + public static extern void CustomActorImpl_OnSizeAnimation(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnTouchEvent")] + public static extern bool CustomActorImpl_OnTouchEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnHoverEvent")] + public static extern bool CustomActorImpl_OnHoverEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnKeyEvent")] + public static extern bool CustomActorImpl_OnKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnWheelEvent")] + public static extern bool CustomActorImpl_OnWheelEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnRelayout")] + public static extern void CustomActorImpl_OnRelayout(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnSetResizePolicy")] + public static extern void CustomActorImpl_OnSetResizePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_GetNaturalSize")] + public static extern global::System.IntPtr CustomActorImpl_GetNaturalSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_CalculateChildSize")] + public static extern float CustomActorImpl_CalculateChildSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_GetHeightForWidth")] + public static extern float CustomActorImpl_GetHeightForWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_GetWidthForHeight")] + public static extern float CustomActorImpl_GetWidthForHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_RelayoutDependentOnChildren__SWIG_0")] + public static extern bool CustomActorImpl_RelayoutDependentOnChildren__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_RelayoutDependentOnChildren__SWIG_1")] + public static extern bool CustomActorImpl_RelayoutDependentOnChildren__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnCalculateRelayoutSize")] + public static extern void CustomActorImpl_OnCalculateRelayoutSize(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_OnLayoutNegotiated")] + public static extern void CustomActorImpl_OnLayoutNegotiated(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_RequiresTouchEvents")] + public static extern bool CustomActorImpl_RequiresTouchEvents(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_RequiresHoverEvents")] + public static extern bool CustomActorImpl_RequiresHoverEvents(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_RequiresWheelEvents")] + public static extern bool CustomActorImpl_RequiresWheelEvents(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_IsRelayoutEnabled")] + public static extern bool CustomActorImpl_IsRelayoutEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CustomActor__SWIG_0")] + public static extern global::System.IntPtr new_CustomActor__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActor_DownCast")] + public static extern global::System.IntPtr CustomActor_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_CustomActor")] + public static extern void delete_CustomActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActor_GetImplementation")] + public static extern global::System.IntPtr CustomActor_GetImplementation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CustomActor__SWIG_1")] + public static extern global::System.IntPtr new_CustomActor__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CustomActor__SWIG_2")] + public static extern global::System.IntPtr new_CustomActor__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActor_Assign")] + public static extern global::System.IntPtr CustomActor_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_SCREEN_POSITION_get")] + public static extern int PanGestureDetector_Property_SCREEN_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_SCREEN_DISPLACEMENT_get")] + public static extern int PanGestureDetector_Property_SCREEN_DISPLACEMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_SCREEN_VELOCITY_get")] + public static extern int PanGestureDetector_Property_SCREEN_VELOCITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_LOCAL_POSITION_get")] + public static extern int PanGestureDetector_Property_LOCAL_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_LOCAL_DISPLACEMENT_get")] + public static extern int PanGestureDetector_Property_LOCAL_DISPLACEMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_LOCAL_VELOCITY_get")] + public static extern int PanGestureDetector_Property_LOCAL_VELOCITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Property_PANNING_get")] + public static extern int PanGestureDetector_Property_PANNING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGestureDetector_Property")] + public static extern global::System.IntPtr new_PanGestureDetector_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PanGestureDetector_Property")] + public static extern void delete_PanGestureDetector_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_LEFT_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_RIGHT_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_UP_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_UP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_DOWN_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_DOWN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_HORIZONTAL_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_HORIZONTAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DIRECTION_VERTICAL_get")] + public static extern global::System.IntPtr PanGestureDetector_DIRECTION_VERTICAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DEFAULT_THRESHOLD_get")] + public static extern global::System.IntPtr PanGestureDetector_DEFAULT_THRESHOLD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGestureDetector__SWIG_0")] + public static extern global::System.IntPtr new_PanGestureDetector__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_New")] + public static extern global::System.IntPtr PanGestureDetector_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DownCast")] + public static extern global::System.IntPtr PanGestureDetector_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PanGestureDetector")] + public static extern void delete_PanGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGestureDetector__SWIG_1")] + public static extern global::System.IntPtr new_PanGestureDetector__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_Assign")] + public static extern global::System.IntPtr PanGestureDetector_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_SetMinimumTouchesRequired")] + public static extern void PanGestureDetector_SetMinimumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_SetMaximumTouchesRequired")] + public static extern void PanGestureDetector_SetMaximumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_GetMinimumTouchesRequired")] + public static extern uint PanGestureDetector_GetMinimumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_GetMaximumTouchesRequired")] + public static extern uint PanGestureDetector_GetMaximumTouchesRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_AddAngle__SWIG_0")] + public static extern void PanGestureDetector_AddAngle__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_AddAngle__SWIG_1")] + public static extern void PanGestureDetector_AddAngle__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_AddDirection__SWIG_0")] + public static extern void PanGestureDetector_AddDirection__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_AddDirection__SWIG_1")] + public static extern void PanGestureDetector_AddDirection__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_GetAngleCount")] + public static extern uint PanGestureDetector_GetAngleCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_GetAngle")] + public static extern global::System.IntPtr PanGestureDetector_GetAngle(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_ClearAngles")] + public static extern void PanGestureDetector_ClearAngles(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_RemoveAngle")] + public static extern void PanGestureDetector_RemoveAngle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_RemoveDirection")] + public static extern void PanGestureDetector_RemoveDirection(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_DetectedSignal")] + public static extern global::System.IntPtr PanGestureDetector_DetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_SetPanGestureProperties")] + public static extern void PanGestureDetector_SetPanGestureProperties(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGesture__SWIG_0")] + public static extern global::System.IntPtr new_PanGesture__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGesture__SWIG_1")] + public static extern global::System.IntPtr new_PanGesture__SWIG_1(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGesture__SWIG_2")] + public static extern global::System.IntPtr new_PanGesture__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_Assign")] + public static extern global::System.IntPtr PanGesture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PanGesture")] + public static extern void delete_PanGesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_velocity_set")] + public static extern void PanGesture_velocity_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_velocity_get")] + public static extern global::System.IntPtr PanGesture_velocity_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_displacement_set")] + public static extern void PanGesture_displacement_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_displacement_get")] + public static extern global::System.IntPtr PanGesture_displacement_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_position_set")] + public static extern void PanGesture_position_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_position_get")] + public static extern global::System.IntPtr PanGesture_position_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenVelocity_set")] + public static extern void PanGesture_screenVelocity_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenVelocity_get")] + public static extern global::System.IntPtr PanGesture_screenVelocity_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenDisplacement_set")] + public static extern void PanGesture_screenDisplacement_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenDisplacement_get")] + public static extern global::System.IntPtr PanGesture_screenDisplacement_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenPosition_set")] + public static extern void PanGesture_screenPosition_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_screenPosition_get")] + public static extern global::System.IntPtr PanGesture_screenPosition_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_numberOfTouches_set")] + public static extern void PanGesture_numberOfTouches_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_numberOfTouches_get")] + public static extern uint PanGesture_numberOfTouches_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_GetSpeed")] + public static extern float PanGesture_GetSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_GetDistance")] + public static extern float PanGesture_GetDistance(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_GetScreenSpeed")] + public static extern float PanGesture_GetScreenSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_GetScreenDistance")] + public static extern float PanGesture_GetScreenDistance(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PinchGestureDetector__SWIG_0")] + public static extern global::System.IntPtr new_PinchGestureDetector__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetector_New")] + public static extern global::System.IntPtr PinchGestureDetector_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetector_DownCast")] + public static extern global::System.IntPtr PinchGestureDetector_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PinchGestureDetector")] + public static extern void delete_PinchGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PinchGestureDetector__SWIG_1")] + public static extern global::System.IntPtr new_PinchGestureDetector__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetector_Assign")] + public static extern global::System.IntPtr PinchGestureDetector_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetector_DetectedSignal")] + public static extern global::System.IntPtr PinchGestureDetector_DetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PinchGesture__SWIG_0")] + public static extern global::System.IntPtr new_PinchGesture__SWIG_0(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PinchGesture__SWIG_1")] + public static extern global::System.IntPtr new_PinchGesture__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_Assign")] + public static extern global::System.IntPtr PinchGesture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PinchGesture")] + public static extern void delete_PinchGesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_scale_set")] + public static extern void PinchGesture_scale_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_scale_get")] + public static extern float PinchGesture_scale_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_speed_set")] + public static extern void PinchGesture_speed_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_speed_get")] + public static extern float PinchGesture_speed_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_screenCenterPoint_set")] + public static extern void PinchGesture_screenCenterPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_screenCenterPoint_get")] + public static extern global::System.IntPtr PinchGesture_screenCenterPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_localCenterPoint_set")] + public static extern void PinchGesture_localCenterPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_localCenterPoint_get")] + public static extern global::System.IntPtr PinchGesture_localCenterPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TapGestureDetector__SWIG_0")] + public static extern global::System.IntPtr new_TapGestureDetector__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_New__SWIG_0")] + public static extern global::System.IntPtr TapGestureDetector_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_New__SWIG_1")] + public static extern global::System.IntPtr TapGestureDetector_New__SWIG_1(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_DownCast")] + public static extern global::System.IntPtr TapGestureDetector_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TapGestureDetector")] + public static extern void delete_TapGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TapGestureDetector__SWIG_1")] + public static extern global::System.IntPtr new_TapGestureDetector__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_Assign")] + public static extern global::System.IntPtr TapGestureDetector_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_SetMinimumTapsRequired")] + public static extern void TapGestureDetector_SetMinimumTapsRequired(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_SetMaximumTapsRequired")] + public static extern void TapGestureDetector_SetMaximumTapsRequired(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_GetMinimumTapsRequired")] + public static extern uint TapGestureDetector_GetMinimumTapsRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_GetMaximumTapsRequired")] + public static extern uint TapGestureDetector_GetMaximumTapsRequired(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_DetectedSignal")] + public static extern global::System.IntPtr TapGestureDetector_DetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TapGesture__SWIG_0")] + public static extern global::System.IntPtr new_TapGesture__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TapGesture__SWIG_1")] + public static extern global::System.IntPtr new_TapGesture__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_Assign")] + public static extern global::System.IntPtr TapGesture_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TapGesture")] + public static extern void delete_TapGesture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_numberOfTaps_set")] + public static extern void TapGesture_numberOfTaps_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_numberOfTaps_get")] + public static extern uint TapGesture_numberOfTaps_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_numberOfTouches_set")] + public static extern void TapGesture_numberOfTouches_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_numberOfTouches_get")] + public static extern uint TapGesture_numberOfTouches_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_screenPoint_set")] + public static extern void TapGesture_screenPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_screenPoint_get")] + public static extern global::System.IntPtr TapGesture_screenPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_localPoint_set")] + public static extern void TapGesture_localPoint_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_localPoint_get")] + public static extern global::System.IntPtr TapGesture_localPoint_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AlphaFunction__SWIG_0")] + public static extern global::System.IntPtr new_AlphaFunction__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AlphaFunction__SWIG_1")] + public static extern global::System.IntPtr new_AlphaFunction__SWIG_1(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AlphaFunction__SWIG_2")] + public static extern global::System.IntPtr new_AlphaFunction__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AlphaFunction__SWIG_3")] + public static extern global::System.IntPtr new_AlphaFunction__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AlphaFunction_GetBezierControlPoints")] + public static extern global::System.IntPtr AlphaFunction_GetBezierControlPoints(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AlphaFunction_GetCustomFunction")] + public static extern global::System.IntPtr AlphaFunction_GetCustomFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AlphaFunction_GetBuiltinFunction")] + public static extern int AlphaFunction_GetBuiltinFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AlphaFunction_GetMode")] + public static extern int AlphaFunction_GetMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AlphaFunction")] + public static extern void delete_AlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_New")] + public static extern global::System.IntPtr KeyFrames_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_DownCast")] + public static extern global::System.IntPtr KeyFrames_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyFrames__SWIG_0")] + public static extern global::System.IntPtr new_KeyFrames__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyFrames")] + public static extern void delete_KeyFrames(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyFrames__SWIG_1")] + public static extern global::System.IntPtr new_KeyFrames__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_Assign")] + public static extern global::System.IntPtr KeyFrames_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_GetType")] + public static extern int KeyFrames_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_Add__SWIG_0")] + public static extern void KeyFrames_Add__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_Add__SWIG_1")] + public static extern void KeyFrames_Add__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_Property_POINTS_get")] + public static extern int Path_Property_POINTS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_Property_CONTROL_POINTS_get")] + public static extern int Path_Property_CONTROL_POINTS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Path_Property")] + public static extern global::System.IntPtr new_Path_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Path_Property")] + public static extern void delete_Path_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_New")] + public static extern global::System.IntPtr Path_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_DownCast")] + public static extern global::System.IntPtr Path_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Path__SWIG_0")] + public static extern global::System.IntPtr new_Path__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Path")] + public static extern void delete_Path(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Path__SWIG_1")] + public static extern global::System.IntPtr new_Path__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_Assign")] + public static extern global::System.IntPtr Path_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_AddPoint")] + public static extern void Path_AddPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_AddControlPoint")] + public static extern void Path_AddControlPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_GenerateControlPoints")] + public static extern void Path_GenerateControlPoints(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_Sample")] + public static extern void Path_Sample(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_GetPoint")] + public static extern global::System.IntPtr Path_GetPoint(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_GetControlPoint")] + public static extern global::System.IntPtr Path_GetControlPoint(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_GetPointCount")] + public static extern uint Path_GetPointCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TimePeriod__SWIG_0")] + public static extern global::System.IntPtr new_TimePeriod__SWIG_0(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TimePeriod__SWIG_1")] + public static extern global::System.IntPtr new_TimePeriod__SWIG_1(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TimePeriod")] + public static extern void delete_TimePeriod(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimePeriod_delaySeconds_set")] + public static extern void TimePeriod_delaySeconds_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimePeriod_delaySeconds_get")] + public static extern float TimePeriod_delaySeconds_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimePeriod_durationSeconds_set")] + public static extern void TimePeriod_durationSeconds_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimePeriod_durationSeconds_get")] + public static extern float TimePeriod_durationSeconds_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + //Animation Pinvoke + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Animation__SWIG_0")] + public static extern global::System.IntPtr new_Animation__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_New")] + public static extern global::System.IntPtr Animation_New(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_DownCast")] + public static extern global::System.IntPtr Animation_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Animation")] + public static extern void delete_Animation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Animation__SWIG_1")] + public static extern global::System.IntPtr new_Animation__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Assign")] + public static extern global::System.IntPtr Animation_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetDuration")] + public static extern void Animation_SetDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetDuration")] + public static extern float Animation_GetDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetLooping")] + public static extern void Animation_SetLooping(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetLoopCount")] + public static extern void Animation_SetLoopCount(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetLoopCount")] + public static extern int Animation_GetLoopCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetCurrentLoop")] + public static extern int Animation_GetCurrentLoop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_IsLooping")] + public static extern bool Animation_IsLooping(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetEndAction")] + public static extern void Animation_SetEndAction(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetEndAction")] + public static extern int Animation_GetEndAction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetDisconnectAction")] + public static extern void Animation_SetDisconnectAction(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetDisconnectAction")] + public static extern int Animation_GetDisconnectAction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetDefaultAlphaFunction")] + public static extern void Animation_SetDefaultAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetDefaultAlphaFunction")] + public static extern global::System.IntPtr Animation_GetDefaultAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetCurrentProgress")] + public static extern void Animation_SetCurrentProgress(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetCurrentProgress")] + public static extern float Animation_GetCurrentProgress(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetSpeedFactor")] + public static extern void Animation_SetSpeedFactor(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetSpeedFactor")] + public static extern float Animation_GetSpeedFactor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetPlayRange")] + public static extern void Animation_SetPlayRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetPlayRange")] + public static extern global::System.IntPtr Animation_GetPlayRange(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Play")] + public static extern void Animation_Play(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_PlayFrom")] + public static extern void Animation_PlayFrom(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Pause")] + public static extern void Animation_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetState")] + public static extern int Animation_GetState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Stop")] + public static extern void Animation_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Clear")] + public static extern void Animation_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SetProgressNotification")] + public static extern void Animation_SetProgressNotification(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_GetProgressNotification")] + public static extern float Animation_GetProgressNotification(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_FinishedSignal")] + public static extern global::System.IntPtr Animation_FinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_ProgressReachedSignal")] + public static extern global::System.IntPtr Animation_ProgressReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_PlayAfter")] + public static extern void Animation_PlayAfter(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBy__SWIG_0")] + public static extern void Animation_AnimateBy__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBy__SWIG_1")] + public static extern void Animation_AnimateBy__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBy__SWIG_2")] + public static extern void Animation_AnimateBy__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBy__SWIG_3")] + public static extern void Animation_AnimateBy__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateTo__SWIG_0")] + public static extern void Animation_AnimateTo__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateTo__SWIG_1")] + public static extern void Animation_AnimateTo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateTo__SWIG_2")] + public static extern void Animation_AnimateTo__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateTo__SWIG_3")] + public static extern void Animation_AnimateTo__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_0")] + public static extern void Animation_AnimateBetween__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_1")] + public static extern void Animation_AnimateBetween__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_2")] + public static extern void Animation_AnimateBetween__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_3")] + public static extern void Animation_AnimateBetween__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_4")] + public static extern void Animation_AnimateBetween__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_5")] + public static extern void Animation_AnimateBetween__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_6")] + public static extern void Animation_AnimateBetween__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_AnimateBetween__SWIG_7")] + public static extern void Animation_AnimateBetween__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, int jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Animate__SWIG_0")] + public static extern void Animation_Animate__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Animate__SWIG_1")] + public static extern void Animation_Animate__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Animate__SWIG_2")] + public static extern void Animation_Animate__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Animate__SWIG_3")] + public static extern void Animation_Animate__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Show")] + public static extern void Animation_Show(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_Hide")] + public static extern void Animation_Hide(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Property_VALUE_get")] + public static extern int LinearConstrainer_Property_VALUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Property_PROGRESS_get")] + public static extern int LinearConstrainer_Property_PROGRESS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LinearConstrainer_Property")] + public static extern global::System.IntPtr new_LinearConstrainer_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LinearConstrainer_Property")] + public static extern void delete_LinearConstrainer_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_New")] + public static extern global::System.IntPtr LinearConstrainer_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_DownCast")] + public static extern global::System.IntPtr LinearConstrainer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LinearConstrainer__SWIG_0")] + public static extern global::System.IntPtr new_LinearConstrainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LinearConstrainer")] + public static extern void delete_LinearConstrainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LinearConstrainer__SWIG_1")] + public static extern global::System.IntPtr new_LinearConstrainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Assign")] + public static extern global::System.IntPtr LinearConstrainer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Apply__SWIG_0")] + public static extern void LinearConstrainer_Apply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Apply__SWIG_1")] + public static extern void LinearConstrainer_Apply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_Remove")] + public static extern void LinearConstrainer_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Property_FORWARD_get")] + public static extern int PathConstrainer_Property_FORWARD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Property_POINTS_get")] + public static extern int PathConstrainer_Property_POINTS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Property_CONTROL_POINTS_get")] + public static extern int PathConstrainer_Property_CONTROL_POINTS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PathConstrainer_Property")] + public static extern global::System.IntPtr new_PathConstrainer_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PathConstrainer_Property")] + public static extern void delete_PathConstrainer_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_New")] + public static extern global::System.IntPtr PathConstrainer_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_DownCast")] + public static extern global::System.IntPtr PathConstrainer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PathConstrainer__SWIG_0")] + public static extern global::System.IntPtr new_PathConstrainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PathConstrainer")] + public static extern void delete_PathConstrainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PathConstrainer__SWIG_1")] + public static extern global::System.IntPtr new_PathConstrainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Assign")] + public static extern global::System.IntPtr PathConstrainer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Apply__SWIG_0")] + public static extern void PathConstrainer_Apply__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Apply__SWIG_1")] + public static extern void PathConstrainer_Apply__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_Remove")] + public static extern void PathConstrainer_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FittingModeDefault_get")] + public static extern int FittingModeDefault_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DEFAULT_get")] + public static extern int DEFAULT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_BufferImage__SWIG_0")] + public static extern global::System.IntPtr new_BufferImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_New__SWIG_0")] + public static extern global::System.IntPtr BufferImage_New__SWIG_0(uint jarg1, uint jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_New__SWIG_1")] + public static extern global::System.IntPtr BufferImage_New__SWIG_1(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_New__SWIG_2")] + public static extern global::System.IntPtr BufferImage_New__SWIG_2([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg1, uint jarg2, uint jarg3, int jarg4, uint jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_New__SWIG_3")] + public static extern global::System.IntPtr BufferImage_New__SWIG_3([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg1, uint jarg2, uint jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_New__SWIG_4")] + public static extern global::System.IntPtr BufferImage_New__SWIG_4([global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg1, uint jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_DownCast")] + public static extern global::System.IntPtr BufferImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_BufferImage")] + public static extern void delete_BufferImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_BufferImage__SWIG_1")] + public static extern global::System.IntPtr new_BufferImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_Assign")] + public static extern global::System.IntPtr BufferImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_WHITE")] + public static extern global::System.IntPtr BufferImage_WHITE(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_GetBuffer")] + public static extern global::System.IntPtr BufferImage_GetBuffer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_GetBufferSize")] + public static extern uint BufferImage_GetBufferSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_GetBufferStride")] + public static extern uint BufferImage_GetBufferStride(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_GetPixelFormat")] + public static extern int BufferImage_GetPixelFormat(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_Update__SWIG_0")] + public static extern void BufferImage_Update__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_Update__SWIG_1")] + public static extern void BufferImage_Update__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_IsDataExternal")] + public static extern bool BufferImage_IsDataExternal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_EncodedBufferImage__SWIG_0")] + public static extern global::System.IntPtr new_EncodedBufferImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_New__SWIG_0")] + public static extern global::System.IntPtr EncodedBufferImage_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_New__SWIG_1")] + public static extern global::System.IntPtr EncodedBufferImage_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4, int jarg5, bool jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_New__SWIG_2")] + public static extern global::System.IntPtr EncodedBufferImage_New__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_DownCast")] + public static extern global::System.IntPtr EncodedBufferImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_EncodedBufferImage")] + public static extern void delete_EncodedBufferImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_EncodedBufferImage__SWIG_1")] + public static extern global::System.IntPtr new_EncodedBufferImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_Assign")] + public static extern global::System.IntPtr EncodedBufferImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_NativeImage__SWIG_0")] + public static extern global::System.IntPtr new_NativeImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_NativeImage")] + public static extern void delete_NativeImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_NativeImage__SWIG_1")] + public static extern global::System.IntPtr new_NativeImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_Assign")] + public static extern global::System.IntPtr NativeImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_CreateGlTexture")] + public static extern void NativeImage_CreateGlTexture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_New")] + public static extern global::System.IntPtr NativeImage_New(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_DownCast")] + public static extern global::System.IntPtr NativeImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_GetCustomFragmentPreFix")] + public static extern string NativeImage_GetCustomFragmentPreFix(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_GetCustomSamplerTypename")] + public static extern string NativeImage_GetCustomSamplerTypename(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_GlExtensionCreate")] + public static extern bool NativeImageInterface_GlExtensionCreate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_GlExtensionDestroy")] + public static extern void NativeImageInterface_GlExtensionDestroy(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_TargetTexture")] + public static extern uint NativeImageInterface_TargetTexture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_PrepareTexture")] + public static extern void NativeImageInterface_PrepareTexture(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_GetWidth")] + public static extern uint NativeImageInterface_GetWidth(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_GetHeight")] + public static extern uint NativeImageInterface_GetHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_RequiresBlending")] + public static extern bool NativeImageInterface_RequiresBlending(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_GetImageSize")] + public static extern global::System.IntPtr ResourceImage_GetImageSize(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ResourceImage__SWIG_0")] + public static extern global::System.IntPtr new_ResourceImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ResourceImage")] + public static extern void delete_ResourceImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ResourceImage__SWIG_1")] + public static extern global::System.IntPtr new_ResourceImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_Assign")] + public static extern global::System.IntPtr ResourceImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_0")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_0(string jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_1")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_1(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_2")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_3")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_3(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_4")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_4(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_New__SWIG_5")] + public static extern global::System.IntPtr ResourceImage_New__SWIG_5(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_DownCast")] + public static extern global::System.IntPtr ResourceImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_GetLoadingState")] + public static extern int ResourceImage_GetLoadingState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_GetUrl")] + public static extern string ResourceImage_GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_Reload")] + public static extern void ResourceImage_Reload(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_LoadingFinishedSignal")] + public static extern global::System.IntPtr ResourceImage_LoadingFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FrameBufferImage__SWIG_0")] + public static extern global::System.IntPtr new_FrameBufferImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_0")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_0(uint jarg1, uint jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_1")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_1(uint jarg1, uint jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_2")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_2(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_3")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_3(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_4")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_4(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_New__SWIG_5")] + public static extern global::System.IntPtr FrameBufferImage_New__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_DownCast")] + public static extern global::System.IntPtr FrameBufferImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FrameBufferImage")] + public static extern void delete_FrameBufferImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FrameBufferImage__SWIG_1")] + public static extern global::System.IntPtr new_FrameBufferImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_Assign")] + public static extern global::System.IntPtr FrameBufferImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_NinePatchImage__SWIG_0")] + public static extern global::System.IntPtr new_NinePatchImage__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_New")] + public static extern global::System.IntPtr NinePatchImage_New(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_DownCast")] + public static extern global::System.IntPtr NinePatchImage_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_NinePatchImage")] + public static extern void delete_NinePatchImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_NinePatchImage__SWIG_1")] + public static extern global::System.IntPtr new_NinePatchImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_Assign")] + public static extern global::System.IntPtr NinePatchImage_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_GetStretchBorders")] + public static extern global::System.IntPtr NinePatchImage_GetStretchBorders(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_GetStretchPixelsX")] + public static extern global::System.IntPtr NinePatchImage_GetStretchPixelsX(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_GetStretchPixelsY")] + public static extern global::System.IntPtr NinePatchImage_GetStretchPixelsY(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_GetChildRectangle")] + public static extern global::System.IntPtr NinePatchImage_GetChildRectangle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_CreateCroppedBufferImage")] + public static extern global::System.IntPtr NinePatchImage_CreateCroppedBufferImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_IsNinePatchUrl")] + public static extern bool NinePatchImage_IsNinePatchUrl(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_TYPE_get")] + public static extern int CameraActor_Property_TYPE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_PROJECTION_MODE_get")] + public static extern int CameraActor_Property_PROJECTION_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_FIELD_OF_VIEW_get")] + public static extern int CameraActor_Property_FIELD_OF_VIEW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_ASPECT_RATIO_get")] + public static extern int CameraActor_Property_ASPECT_RATIO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_NEAR_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_NEAR_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_FAR_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_FAR_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_LEFT_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_LEFT_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_RIGHT_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_RIGHT_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_TOP_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_TOP_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_BOTTOM_PLANE_DISTANCE_get")] + public static extern int CameraActor_Property_BOTTOM_PLANE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_TARGET_POSITION_get")] + public static extern int CameraActor_Property_TARGET_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_PROJECTION_MATRIX_get")] + public static extern int CameraActor_Property_PROJECTION_MATRIX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_VIEW_MATRIX_get")] + public static extern int CameraActor_Property_VIEW_MATRIX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Property_INVERT_Y_AXIS_get")] + public static extern int CameraActor_Property_INVERT_Y_AXIS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CameraActor_Property")] + public static extern global::System.IntPtr new_CameraActor_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_CameraActor_Property")] + public static extern void delete_CameraActor_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CameraActor__SWIG_0")] + public static extern global::System.IntPtr new_CameraActor__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_New__SWIG_0")] + public static extern global::System.IntPtr CameraActor_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_New__SWIG_1")] + public static extern global::System.IntPtr CameraActor_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_DownCast")] + public static extern global::System.IntPtr CameraActor_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_CameraActor")] + public static extern void delete_CameraActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CameraActor__SWIG_1")] + public static extern global::System.IntPtr new_CameraActor__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_Assign")] + public static extern global::System.IntPtr CameraActor_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetType")] + public static extern void CameraActor_SetType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetType")] + public static extern int CameraActor_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetProjectionMode")] + public static extern void CameraActor_SetProjectionMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetProjectionMode")] + public static extern int CameraActor_GetProjectionMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetFieldOfView")] + public static extern void CameraActor_SetFieldOfView(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetFieldOfView")] + public static extern float CameraActor_GetFieldOfView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetAspectRatio")] + public static extern void CameraActor_SetAspectRatio(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetAspectRatio")] + public static extern float CameraActor_GetAspectRatio(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetNearClippingPlane")] + public static extern void CameraActor_SetNearClippingPlane(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetNearClippingPlane")] + public static extern float CameraActor_GetNearClippingPlane(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetFarClippingPlane")] + public static extern void CameraActor_SetFarClippingPlane(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetFarClippingPlane")] + public static extern float CameraActor_GetFarClippingPlane(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetTargetPosition")] + public static extern void CameraActor_SetTargetPosition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetTargetPosition")] + public static extern global::System.IntPtr CameraActor_GetTargetPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetInvertYAxis")] + public static extern void CameraActor_SetInvertYAxis(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_GetInvertYAxis")] + public static extern bool CameraActor_GetInvertYAxis(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetPerspectiveProjection")] + public static extern void CameraActor_SetPerspectiveProjection(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetOrthographicProjection__SWIG_0")] + public static extern void CameraActor_SetOrthographicProjection__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SetOrthographicProjection__SWIG_1")] + public static extern void CameraActor_SetOrthographicProjection__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, float jarg6, float jarg7); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StringValuePair__SWIG_0")] + public static extern global::System.IntPtr new_StringValuePair__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StringValuePair__SWIG_1")] + public static extern global::System.IntPtr new_StringValuePair__SWIG_1(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StringValuePair__SWIG_2")] + public static extern global::System.IntPtr new_StringValuePair__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StringValuePair_first_set")] + public static extern void StringValuePair_first_set(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StringValuePair_first_get")] + public static extern string StringValuePair_first_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StringValuePair_second_set")] + public static extern void StringValuePair_second_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StringValuePair_second_get")] + public static extern global::System.IntPtr StringValuePair_second_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StringValuePair")] + public static extern void delete_StringValuePair(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Clear")] + public static extern void TouchPointContainer_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Add")] + public static extern void TouchPointContainer_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_size")] + public static extern uint TouchPointContainer_size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_capacity")] + public static extern uint TouchPointContainer_capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_reserve")] + public static extern void TouchPointContainer_reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchPointContainer__SWIG_0")] + public static extern global::System.IntPtr new_TouchPointContainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchPointContainer__SWIG_1")] + public static extern global::System.IntPtr new_TouchPointContainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchPointContainer__SWIG_2")] + public static extern global::System.IntPtr new_TouchPointContainer__SWIG_2(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_getitemcopy")] + public static extern global::System.IntPtr TouchPointContainer_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_getitem")] + public static extern global::System.IntPtr TouchPointContainer_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_setitem")] + public static extern void TouchPointContainer_setitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_AddRange")] + public static extern void TouchPointContainer_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_GetRange")] + public static extern global::System.IntPtr TouchPointContainer_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Insert")] + public static extern void TouchPointContainer_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_InsertRange")] + public static extern void TouchPointContainer_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_RemoveAt")] + public static extern void TouchPointContainer_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_RemoveRange")] + public static extern void TouchPointContainer_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Repeat")] + public static extern global::System.IntPtr TouchPointContainer_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Reverse__SWIG_0")] + public static extern void TouchPointContainer_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_Reverse__SWIG_1")] + public static extern void TouchPointContainer_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchPointContainer_SetRange")] + public static extern void TouchPointContainer_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TouchPointContainer")] + public static extern void delete_TouchPointContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Rectangle__SWIG_0")] + public static extern global::System.IntPtr new_Rectangle__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Rectangle__SWIG_1")] + public static extern global::System.IntPtr new_Rectangle__SWIG_1(int jarg1, int jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Rectangle__SWIG_2")] + public static extern global::System.IntPtr new_Rectangle__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Assign")] + public static extern global::System.IntPtr Rectangle_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Set")] + public static extern void Rectangle_Set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_IsEmpty")] + public static extern bool Rectangle_IsEmpty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Left")] + public static extern int Rectangle_Left(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Right")] + public static extern int Rectangle_Right(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Top")] + public static extern int Rectangle_Top(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Bottom")] + public static extern int Rectangle_Bottom(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Area")] + public static extern int Rectangle_Area(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Intersects")] + public static extern bool Rectangle_Intersects(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_Contains")] + public static extern bool Rectangle_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_x_set")] + public static extern void Rectangle_x_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_x_get")] + public static extern int Rectangle_x_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_left_set")] + public static extern void Rectangle_left_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_left_get")] + public static extern int Rectangle_left_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_y_set")] + public static extern void Rectangle_y_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_y_get")] + public static extern int Rectangle_y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_right_set")] + public static extern void Rectangle_right_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_right_get")] + public static extern int Rectangle_right_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_width_set")] + public static extern void Rectangle_width_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_width_get")] + public static extern int Rectangle_width_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_bottom_set")] + public static extern void Rectangle_bottom_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_bottom_get")] + public static extern int Rectangle_bottom_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_height_set")] + public static extern void Rectangle_height_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_height_get")] + public static extern int Rectangle_height_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_top_set")] + public static extern void Rectangle_top_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Rectangle_top_get")] + public static extern int Rectangle_top_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Rectangle")] + public static extern void delete_Rectangle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PaddingType__SWIG_0")] + public static extern global::System.IntPtr new_PaddingType__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PaddingType__SWIG_1")] + public static extern global::System.IntPtr new_PaddingType__SWIG_1(float jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PaddingType__SWIG_2")] + public static extern global::System.IntPtr new_PaddingType__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_Assign")] + public static extern global::System.IntPtr PaddingType_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_Set")] + public static extern void PaddingType_Set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_x_set")] + public static extern void PaddingType_x_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_x_get")] + public static extern float PaddingType_x_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_left_set")] + public static extern void PaddingType_left_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_left_get")] + public static extern float PaddingType_left_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_y_set")] + public static extern void PaddingType_y_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_y_get")] + public static extern float PaddingType_y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_right_set")] + public static extern void PaddingType_right_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_right_get")] + public static extern float PaddingType_right_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_width_set")] + public static extern void PaddingType_width_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_width_get")] + public static extern float PaddingType_width_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_bottom_set")] + public static extern void PaddingType_bottom_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_bottom_get")] + public static extern float PaddingType_bottom_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_height_set")] + public static extern void PaddingType_height_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_height_get")] + public static extern float PaddingType_height_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_top_set")] + public static extern void PaddingType_top_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PaddingType_top_get")] + public static extern float PaddingType_top_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PaddingType")] + public static extern void delete_PaddingType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_BaseType_get")] + public static extern int VectorInteger_BaseType_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorInteger__SWIG_0")] + public static extern global::System.IntPtr new_VectorInteger__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VectorInteger")] + public static extern void delete_VectorInteger(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorInteger__SWIG_1")] + public static extern global::System.IntPtr new_VectorInteger__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Assign")] + public static extern global::System.IntPtr VectorInteger_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Begin")] + public static extern global::System.IntPtr VectorInteger_Begin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_End")] + public static extern global::System.IntPtr VectorInteger_End(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr VectorInteger_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_PushBack")] + public static extern void VectorInteger_PushBack(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Insert__SWIG_0")] + public static extern void VectorInteger_Insert__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Insert__SWIG_1")] + public static extern void VectorInteger_Insert__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Reserve")] + public static extern void VectorInteger_Reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Resize__SWIG_0")] + public static extern void VectorInteger_Resize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Resize__SWIG_1")] + public static extern void VectorInteger_Resize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Erase__SWIG_0")] + public static extern global::System.IntPtr VectorInteger_Erase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Erase__SWIG_1")] + public static extern global::System.IntPtr VectorInteger_Erase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Remove")] + public static extern void VectorInteger_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Swap")] + public static extern void VectorInteger_Swap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Clear")] + public static extern void VectorInteger_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorInteger_Release")] + public static extern void VectorInteger_Release(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_BaseType_get")] + public static extern int VectorFloat_BaseType_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorFloat__SWIG_0")] + public static extern global::System.IntPtr new_VectorFloat__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VectorFloat")] + public static extern void delete_VectorFloat(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorFloat__SWIG_1")] + public static extern global::System.IntPtr new_VectorFloat__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Assign")] + public static extern global::System.IntPtr VectorFloat_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Begin")] + public static extern global::System.IntPtr VectorFloat_Begin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_End")] + public static extern global::System.IntPtr VectorFloat_End(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr VectorFloat_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_PushBack")] + public static extern void VectorFloat_PushBack(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Insert__SWIG_0")] + public static extern void VectorFloat_Insert__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Insert__SWIG_1")] + public static extern void VectorFloat_Insert__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Reserve")] + public static extern void VectorFloat_Reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Resize__SWIG_0")] + public static extern void VectorFloat_Resize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Resize__SWIG_1")] + public static extern void VectorFloat_Resize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Erase__SWIG_0")] + public static extern global::System.IntPtr VectorFloat_Erase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Erase__SWIG_1")] + public static extern global::System.IntPtr VectorFloat_Erase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Remove")] + public static extern void VectorFloat_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Swap")] + public static extern void VectorFloat_Swap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Clear")] + public static extern void VectorFloat_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorFloat_Release")] + public static extern void VectorFloat_Release(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_BaseType_get")] + public static extern int VectorUnsignedChar_BaseType_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorUnsignedChar__SWIG_0")] + public static extern global::System.IntPtr new_VectorUnsignedChar__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VectorUnsignedChar")] + public static extern void delete_VectorUnsignedChar(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorUnsignedChar__SWIG_1")] + public static extern global::System.IntPtr new_VectorUnsignedChar__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Assign")] + public static extern global::System.IntPtr VectorUnsignedChar_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Begin")] + public static extern global::System.IntPtr VectorUnsignedChar_Begin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_End")] + public static extern global::System.IntPtr VectorUnsignedChar_End(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr VectorUnsignedChar_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_PushBack")] + public static extern void VectorUnsignedChar_PushBack(global::System.Runtime.InteropServices.HandleRef jarg1, byte jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Insert__SWIG_0")] + public static extern void VectorUnsignedChar_Insert__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg2, byte jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Insert__SWIG_1")] + public static extern void VectorUnsignedChar_Insert__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Reserve")] + public static extern void VectorUnsignedChar_Reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Resize__SWIG_0")] + public static extern void VectorUnsignedChar_Resize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Resize__SWIG_1")] + public static extern void VectorUnsignedChar_Resize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, byte jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Erase__SWIG_0")] + public static extern global::System.IntPtr VectorUnsignedChar_Erase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Erase__SWIG_1")] + public static extern global::System.IntPtr VectorUnsignedChar_Erase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Remove")] + public static extern void VectorUnsignedChar_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, [global::System.Runtime.InteropServices.In, global::System.Runtime.InteropServices.MarshalAs(global::System.Runtime.InteropServices.UnmanagedType.LPArray)]byte[] jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Swap")] + public static extern void VectorUnsignedChar_Swap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Clear")] + public static extern void VectorUnsignedChar_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUnsignedChar_Release")] + public static extern void VectorUnsignedChar_Release(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_BaseType_get")] + public static extern int VectorUint16Pair_BaseType_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorUint16Pair__SWIG_0")] + public static extern global::System.IntPtr new_VectorUint16Pair__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VectorUint16Pair")] + public static extern void delete_VectorUint16Pair(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VectorUint16Pair__SWIG_1")] + public static extern global::System.IntPtr new_VectorUint16Pair__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Assign")] + public static extern global::System.IntPtr VectorUint16Pair_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Begin")] + public static extern global::System.IntPtr VectorUint16Pair_Begin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_End")] + public static extern global::System.IntPtr VectorUint16Pair_End(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_ValueOfIndex__SWIG_0")] + public static extern global::System.IntPtr VectorUint16Pair_ValueOfIndex__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_PushBack")] + public static extern void VectorUint16Pair_PushBack(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Insert__SWIG_0")] + public static extern void VectorUint16Pair_Insert__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Insert__SWIG_1")] + public static extern void VectorUint16Pair_Insert__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Reserve")] + public static extern void VectorUint16Pair_Reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Resize__SWIG_0")] + public static extern void VectorUint16Pair_Resize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Resize__SWIG_1")] + public static extern void VectorUint16Pair_Resize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Erase__SWIG_0")] + public static extern global::System.IntPtr VectorUint16Pair_Erase__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Erase__SWIG_1")] + public static extern global::System.IntPtr VectorUint16Pair_Erase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Remove")] + public static extern void VectorUint16Pair_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Swap")] + public static extern void VectorUint16Pair_Swap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Clear")] + public static extern void VectorUint16Pair_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VectorUint16Pair_Release")] + public static extern void VectorUint16Pair_Release(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VoidSignal")] + public static extern global::System.IntPtr new_VoidSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VoidSignal")] + public static extern void delete_VoidSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_Empty")] + public static extern bool VoidSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_GetConnectionCount")] + public static extern uint VoidSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_Connect__SWIG_0")] + public static extern void VoidSignal_Connect__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_Disconnect")] + public static extern void VoidSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_Connect__SWIG_4")] + public static extern void VoidSignal_Connect__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VoidSignal_Emit")] + public static extern void VoidSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FloatSignal_Empty")] + public static extern bool FloatSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FloatSignal_GetConnectionCount")] + public static extern uint FloatSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FloatSignal_Connect")] + public static extern void FloatSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FloatSignal_Disconnect")] + public static extern void FloatSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FloatSignal_Emit")] + public static extern void FloatSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FloatSignal")] + public static extern global::System.IntPtr new_FloatSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FloatSignal")] + public static extern void delete_FloatSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectCreatedSignal_Empty")] + public static extern bool ObjectCreatedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectCreatedSignal_GetConnectionCount")] + public static extern uint ObjectCreatedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectCreatedSignal_Connect")] + public static extern void ObjectCreatedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectCreatedSignal_Disconnect")] + public static extern void ObjectCreatedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectCreatedSignal_Emit")] + public static extern void ObjectCreatedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ObjectCreatedSignal")] + public static extern global::System.IntPtr new_ObjectCreatedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ObjectCreatedSignal")] + public static extern void delete_ObjectCreatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectDestroyedSignal_Empty")] + public static extern bool ObjectDestroyedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectDestroyedSignal_GetConnectionCount")] + public static extern uint ObjectDestroyedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectDestroyedSignal_Connect")] + public static extern void ObjectDestroyedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectDestroyedSignal_Disconnect")] + public static extern void ObjectDestroyedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectDestroyedSignal_Emit")] + public static extern void ObjectDestroyedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ObjectDestroyedSignal")] + public static extern global::System.IntPtr new_ObjectDestroyedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ObjectDestroyedSignal")] + public static extern void delete_ObjectDestroyedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotifySignal_Empty")] + public static extern bool PropertyNotifySignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotifySignal_GetConnectionCount")] + public static extern uint PropertyNotifySignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotifySignal_Connect")] + public static extern void PropertyNotifySignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotifySignal_Disconnect")] + public static extern void PropertyNotifySignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotifySignal_Emit")] + public static extern void PropertyNotifySignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PropertyNotifySignal")] + public static extern global::System.IntPtr new_PropertyNotifySignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PropertyNotifySignal")] + public static extern void delete_PropertyNotifySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageSignal_Empty")] + public static extern bool ImageSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageSignal_GetConnectionCount")] + public static extern uint ImageSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageSignal_Connect")] + public static extern void ImageSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageSignal_Disconnect")] + public static extern void ImageSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageSignal_Emit")] + public static extern void ImageSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImageSignal")] + public static extern global::System.IntPtr new_ImageSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImageSignal")] + public static extern void delete_ImageSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RenderTaskSignal")] + public static extern global::System.IntPtr new_RenderTaskSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RenderTaskSignal")] + public static extern void delete_RenderTaskSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetectedSignal_Empty")] + public static extern bool LongPressGestureDetectedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetectedSignal_GetConnectionCount")] + public static extern uint LongPressGestureDetectedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetectedSignal_Connect")] + public static extern void LongPressGestureDetectedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetectedSignal_Disconnect")] + public static extern void LongPressGestureDetectedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetectedSignal_Emit")] + public static extern void LongPressGestureDetectedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_LongPressGestureDetectedSignal")] + public static extern global::System.IntPtr new_LongPressGestureDetectedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_LongPressGestureDetectedSignal")] + public static extern void delete_LongPressGestureDetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorTouchDataSignal_Empty")] + public static extern bool ActorTouchDataSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorTouchDataSignal_GetConnectionCount")] + public static extern uint ActorTouchDataSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorTouchDataSignal_Connect")] + public static extern void ActorTouchDataSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorTouchDataSignal_Disconnect")] + public static extern void ActorTouchDataSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorTouchDataSignal_Emit")] + public static extern bool ActorTouchDataSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorTouchDataSignal")] + public static extern global::System.IntPtr new_ActorTouchDataSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActorTouchDataSignal")] + public static extern void delete_ActorTouchDataSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorHoverSignal_Empty")] + public static extern bool ActorHoverSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorHoverSignal_GetConnectionCount")] + public static extern uint ActorHoverSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorHoverSignal_Connect")] + public static extern void ActorHoverSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorHoverSignal_Disconnect")] + public static extern void ActorHoverSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorHoverSignal_Emit")] + public static extern bool ActorHoverSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorHoverSignal")] + public static extern global::System.IntPtr new_ActorHoverSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActorHoverSignal")] + public static extern void delete_ActorHoverSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorWheelSignal_Empty")] + public static extern bool ActorWheelSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorWheelSignal_GetConnectionCount")] + public static extern uint ActorWheelSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorWheelSignal_Connect")] + public static extern void ActorWheelSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorWheelSignal_Disconnect")] + public static extern void ActorWheelSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorWheelSignal_Emit")] + public static extern bool ActorWheelSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorWheelSignal")] + public static extern global::System.IntPtr new_ActorWheelSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActorWheelSignal")] + public static extern void delete_ActorWheelSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorSignal_Empty")] + public static extern bool ActorSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorSignal_GetConnectionCount")] + public static extern uint ActorSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorSignal_Connect")] + public static extern void ActorSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorSignal_Disconnect")] + public static extern void ActorSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorSignal_Emit")] + public static extern void ActorSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorSignal")] + public static extern global::System.IntPtr new_ActorSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActorSignal")] + public static extern void delete_ActorSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyEventSignal_Empty")] + public static extern bool KeyEventSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyEventSignal_GetConnectionCount")] + public static extern uint KeyEventSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyEventSignal_Connect")] + public static extern void KeyEventSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyEventSignal_Disconnect")] + public static extern void KeyEventSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyEventSignal_Emit")] + public static extern void KeyEventSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyEventSignal")] + public static extern global::System.IntPtr new_KeyEventSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyEventSignal")] + public static extern void delete_KeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchSignal_Empty")] + public static extern bool TouchSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchSignal_GetConnectionCount")] + public static extern uint TouchSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchSignal_Connect")] + public static extern void TouchSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchSignal_Disconnect")] + public static extern void TouchSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TouchSignal_Emit")] + public static extern void TouchSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TouchSignal")] + public static extern global::System.IntPtr new_TouchSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TouchSignal")] + public static extern void delete_TouchSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StageWheelSignal_Empty")] + public static extern bool StageWheelSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StageWheelSignal_GetConnectionCount")] + public static extern uint StageWheelSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StageWheelSignal_Connect")] + public static extern void StageWheelSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StageWheelSignal_Disconnect")] + public static extern void StageWheelSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StageWheelSignal_Emit")] + public static extern void StageWheelSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StageWheelSignal")] + public static extern global::System.IntPtr new_StageWheelSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StageWheelSignal")] + public static extern void delete_StageWheelSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AngleThresholdPair__SWIG_0")] + public static extern global::System.IntPtr new_AngleThresholdPair__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AngleThresholdPair__SWIG_1")] + public static extern global::System.IntPtr new_AngleThresholdPair__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AngleThresholdPair__SWIG_2")] + public static extern global::System.IntPtr new_AngleThresholdPair__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleThresholdPair_first_set")] + public static extern void AngleThresholdPair_first_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleThresholdPair_first_get")] + public static extern global::System.IntPtr AngleThresholdPair_first_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleThresholdPair_second_set")] + public static extern void AngleThresholdPair_second_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AngleThresholdPair_second_get")] + public static extern global::System.IntPtr AngleThresholdPair_second_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AngleThresholdPair")] + public static extern void delete_AngleThresholdPair(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetectedSignal_Empty")] + public static extern bool PanGestureDetectedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetectedSignal_GetConnectionCount")] + public static extern uint PanGestureDetectedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetectedSignal_Connect")] + public static extern void PanGestureDetectedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetectedSignal_Disconnect")] + public static extern void PanGestureDetectedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetectedSignal_Emit")] + public static extern void PanGestureDetectedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PanGestureDetectedSignal")] + public static extern global::System.IntPtr new_PanGestureDetectedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PanGestureDetectedSignal")] + public static extern void delete_PanGestureDetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetectedSignal_Empty")] + public static extern bool PinchGestureDetectedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetectedSignal_GetConnectionCount")] + public static extern uint PinchGestureDetectedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetectedSignal_Connect")] + public static extern void PinchGestureDetectedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetectedSignal_Disconnect")] + public static extern void PinchGestureDetectedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetectedSignal_Emit")] + public static extern void PinchGestureDetectedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PinchGestureDetectedSignal")] + public static extern global::System.IntPtr new_PinchGestureDetectedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PinchGestureDetectedSignal")] + public static extern void delete_PinchGestureDetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetectedSignal_Empty")] + public static extern bool TapGestureDetectedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetectedSignal_GetConnectionCount")] + public static extern uint TapGestureDetectedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetectedSignal_Connect")] + public static extern void TapGestureDetectedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetectedSignal_Disconnect")] + public static extern void TapGestureDetectedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetectedSignal_Emit")] + public static extern void TapGestureDetectedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TapGestureDetectedSignal")] + public static extern global::System.IntPtr new_TapGestureDetectedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TapGestureDetectedSignal")] + public static extern void delete_TapGestureDetectedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnimationSignal_Empty")] + public static extern bool AnimationSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnimationSignal_GetConnectionCount")] + public static extern uint AnimationSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnimationSignal_Connect")] + public static extern void AnimationSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnimationSignal_Disconnect")] + public static extern void AnimationSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AnimationSignal_Emit")] + public static extern void AnimationSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AnimationSignal")] + public static extern global::System.IntPtr new_AnimationSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AnimationSignal")] + public static extern void delete_AnimationSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImageSignal_Empty")] + public static extern bool ResourceImageSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImageSignal_GetConnectionCount")] + public static extern uint ResourceImageSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImageSignal_Connect")] + public static extern void ResourceImageSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImageSignal_Disconnect")] + public static extern void ResourceImageSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImageSignal_Emit")] + public static extern void ResourceImageSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ResourceImageSignal")] + public static extern global::System.IntPtr new_ResourceImageSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ResourceImageSignal")] + public static extern void delete_ResourceImageSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewVisibilityChangedSignal_Empty")] + public static extern bool ViewVisibilityChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewVisibilityChangedSignal_GetConnectionCount")] + public static extern uint ViewVisibilityChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewVisibilityChangedSignal_Connect")] + public static extern void ViewVisibilityChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewVisibilityChangedSignal_Disconnect")] + public static extern void ViewVisibilityChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewVisibilityChangedSignal_Emit")] + public static extern void ViewVisibilityChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ViewVisibilityChangedSignal")] + public static extern global::System.IntPtr new_ViewVisibilityChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ViewVisibilityChangedSignal")] + public static extern void delete_ViewVisibilityChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Timer__SWIG_0")] + public static extern global::System.IntPtr new_Timer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_New")] + public static extern global::System.IntPtr Timer_New(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Timer__SWIG_1")] + public static extern global::System.IntPtr new_Timer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_Assign")] + public static extern global::System.IntPtr Timer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Timer")] + public static extern void delete_Timer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_DownCast")] + public static extern global::System.IntPtr Timer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_Start")] + public static extern void Timer_Start(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_Stop")] + public static extern void Timer_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_SetInterval")] + public static extern void Timer_SetInterval(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_GetInterval")] + public static extern uint Timer_GetInterval(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_IsRunning")] + public static extern bool Timer_IsRunning(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_TickSignal")] + public static extern global::System.IntPtr Timer_TickSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_DragAndDropDetector")] + public static extern global::System.IntPtr new_DragAndDropDetector(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_DragAndDropDetector")] + public static extern void delete_DragAndDropDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_GetContent")] + public static extern string DragAndDropDetector_GetContent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_GetCurrentScreenPosition")] + public static extern global::System.IntPtr DragAndDropDetector_GetCurrentScreenPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_EnteredSignal")] + public static extern global::System.IntPtr DragAndDropDetector_EnteredSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_ExitedSignal")] + public static extern global::System.IntPtr DragAndDropDetector_ExitedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_MovedSignal")] + public static extern global::System.IntPtr DragAndDropDetector_MovedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_DroppedSignal")] + public static extern global::System.IntPtr DragAndDropDetector_DroppedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ApplicationExtensions__SWIG_0")] + public static extern global::System.IntPtr new_ApplicationExtensions__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ApplicationExtensions__SWIG_1")] + public static extern global::System.IntPtr new_ApplicationExtensions__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ApplicationExtensions")] + public static extern void delete_ApplicationExtensions(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_Init")] + public static extern void ApplicationExtensions_Init(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_Start")] + public static extern void ApplicationExtensions_Start(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_Terminate")] + public static extern void ApplicationExtensions_Terminate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_Pause")] + public static extern void ApplicationExtensions_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_Resume")] + public static extern void ApplicationExtensions_Resume(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationExtensions_LanguageChange")] + public static extern void ApplicationExtensions_LanguageChange(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_New__SWIG_0")] + public static extern global::System.IntPtr Window_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_New__SWIG_1")] + public static extern global::System.IntPtr Window_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_New__SWIG_2")] + public static extern global::System.IntPtr Window_New__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_New__SWIG_3")] + public static extern global::System.IntPtr Window_New__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Window__SWIG_0")] + public static extern global::System.IntPtr new_Window__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Window")] + public static extern void delete_Window(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Window__SWIG_1")] + public static extern global::System.IntPtr new_Window__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_Assign")] + public static extern global::System.IntPtr Window_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_ShowIndicator")] + public static extern void Window_ShowIndicator(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SetIndicatorBgOpacity")] + public static extern void Window_SetIndicatorBgOpacity(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_RotateIndicator")] + public static extern void Window_RotateIndicator(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SetClass")] + public static extern void Window_SetClass(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_Raise")] + public static extern void Window_Raise(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_Lower")] + public static extern void Window_Lower(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_Activate")] + public static extern void Window_Activate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_AddAvailableOrientation")] + public static extern void Window_AddAvailableOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_RemoveAvailableOrientation")] + public static extern void Window_RemoveAvailableOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SetPreferredOrientation")] + public static extern void Window_SetPreferredOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetPreferredOrientation")] + public static extern int Window_GetPreferredOrientation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetDragAndDropDetector")] + public static extern global::System.IntPtr Window_GetDragAndDropDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_GetNativeHandle")] + public static extern global::System.IntPtr Window_GetNativeHandle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal")] + public static extern global::System.IntPtr FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetAcceptFocus")] + public static extern void SetAcceptFocus(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsFocusAcceptable")] + public static extern bool IsFocusAcceptable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Show")] + public static extern void Show(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Hide")] + public static extern void Hide(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsVisible")] + public static extern bool IsVisible(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetSupportedAuxiliaryHintCount")] + public static extern uint GetSupportedAuxiliaryHintCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetSupportedAuxiliaryHint")] + public static extern string GetSupportedAuxiliaryHint(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AddAuxiliaryHint")] + public static extern uint AddAuxiliaryHint(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RemoveAuxiliaryHint")] + public static extern bool RemoveAuxiliaryHint(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetAuxiliaryHintValue")] + public static extern bool SetAuxiliaryHintValue(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetAuxiliaryHintValue")] + public static extern string GetAuxiliaryHintValue(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetAuxiliaryHintId")] + public static extern uint GetAuxiliaryHintId(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetInputRegion")] + public static extern void SetInputRegion(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetType")] + public static extern void SetType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetType")] + public static extern int GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetNotificationLevel")] + public static extern bool SetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetNotificationLevel")] + public static extern int GetNotificationLevel(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetOpaqueState")] + public static extern void SetOpaqueState(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsOpaqueState")] + public static extern bool IsOpaqueState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetScreenMode")] + public static extern bool SetScreenMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetScreenMode")] + public static extern int GetScreenMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetBrightness")] + public static extern bool SetBrightness(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetBrightness")] + public static extern int GetBrightness(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__SWIG_0")] + public static extern global::System.IntPtr Application_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__SWIG_1")] + public static extern global::System.IntPtr Application_New__SWIG_1(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__SWIG_2")] + public static extern global::System.IntPtr Application_New__SWIG_2(int jarg1, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_New__SWIG_3")] + public static extern global::System.IntPtr Application_New__SWIG_3(int jarg1, string jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Application__SWIG_0")] + public static extern global::System.IntPtr new_Application__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Application__SWIG_1")] + public static extern global::System.IntPtr new_Application__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_Assign")] + public static extern global::System.IntPtr Application_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Application")] + public static extern void delete_Application(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_MainLoop__SWIG_0")] + public static extern void Application_MainLoop__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_MainLoop__SWIG_1")] + public static extern void Application_MainLoop__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_Lower")] + public static extern void Application_Lower(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_Quit")] + public static extern void Application_Quit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_AddIdle")] + public static extern bool Application_AddIdle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_GetWindow")] + public static extern global::System.IntPtr Application_GetWindow(global::System.Runtime.InteropServices.HandleRef jarg1); + + + //window handle test + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_GetWindowHandleFromNUI")] + public static extern global::System.IntPtr Application_GetWindowHandleFromNUI(global::System.Runtime.InteropServices.HandleRef jarg1); + + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_ReplaceWindow")] + public static extern void Application_ReplaceWindow(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_GetResourcePath")] + public static extern string Application_GetResourcePath(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_SetViewMode")] + public static extern void Application_SetViewMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_GetViewMode")] + public static extern int Application_GetViewMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_SetStereoBase")] + public static extern void Application_SetStereoBase(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_GetStereoBase")] + public static extern float Application_GetStereoBase(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_InitSignal")] + public static extern global::System.IntPtr Application_InitSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_TerminateSignal")] + public static extern global::System.IntPtr Application_TerminateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_PauseSignal")] + public static extern global::System.IntPtr Application_PauseSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_ResumeSignal")] + public static extern global::System.IntPtr Application_ResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_ResetSignal")] + public static extern global::System.IntPtr Application_ResetSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_ResizeSignal")] + public static extern global::System.IntPtr Application_ResizeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_AppControlSignal")] + public static extern global::System.IntPtr Application_AppControlSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_LanguageChangedSignal")] + public static extern global::System.IntPtr Application_LanguageChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_RegionChangedSignal")] + public static extern global::System.IntPtr Application_RegionChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_BatteryLowSignal")] + public static extern global::System.IntPtr Application_BatteryLowSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_MemoryLowSignal")] + public static extern global::System.IntPtr Application_MemoryLowSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationSignal_Empty")] + public static extern bool ApplicationSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationSignal_GetConnectionCount")] + public static extern uint ApplicationSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationSignal_Connect")] + public static extern void ApplicationSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationSignal_Disconnect")] + public static extern void ApplicationSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationSignal_Emit")] + public static extern void ApplicationSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ApplicationSignal")] + public static extern global::System.IntPtr new_ApplicationSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ApplicationSignal")] + public static extern void delete_ApplicationSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationControlSignal_Empty")] + public static extern bool ApplicationControlSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationControlSignal_GetConnectionCount")] + public static extern uint ApplicationControlSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationControlSignal_Connect")] + public static extern void ApplicationControlSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationControlSignal_Disconnect")] + public static extern void ApplicationControlSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ApplicationControlSignal_Emit")] + public static extern void ApplicationControlSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, System.IntPtr jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ApplicationControlSignal")] + public static extern global::System.IntPtr new_ApplicationControlSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ApplicationControlSignal")] + public static extern void delete_ApplicationControlSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_Application_New__SWIG_4")] + public static extern global::System.IntPtr Application_New__SWIG_4(int jarg1, string jarg3, int jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_Empty")] + public static extern bool TimerSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_GetConnectionCount")] + public static extern uint TimerSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_Connect")] + public static extern void TimerSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_Disconnect")] + public static extern void TimerSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TimerSignalType_Emit")] + public static extern bool TimerSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TimerSignalType")] + public static extern global::System.IntPtr new_TimerSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TimerSignalType")] + public static extern void delete_TimerSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_WindowFocusSignalType_Empty")] + public static extern bool WindowFocusSignalType_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_WindowFocusSignalType_GetConnectionCount")] + public static extern uint WindowFocusSignalType_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_WindowFocusSignalType_Connect")] + public static extern void WindowFocusSignalType_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_WindowFocusSignalType_Disconnect")] + public static extern void WindowFocusSignalType_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_WindowFocusSignalType_Emit")] + public static extern void WindowFocusSignalType_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_new_WindowFocusSignalType")] + public static extern global::System.IntPtr new_WindowFocusSignalType(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint = "CSharp_Dali_delete_WindowFocusSignalType")] + public static extern void delete_WindowFocusSignalType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_PROPERTY_TYPE_get")] + public static extern int VISUAL_PROPERTY_TYPE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_PROPERTY_SHADER_get")] + public static extern int VISUAL_PROPERTY_SHADER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_SHADER_VERTEX_get")] + public static extern int VISUAL_SHADER_VERTEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_SHADER_FRAGMENT_get")] + public static extern int VISUAL_SHADER_FRAGMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_SHADER_SUBDIVIDE_GRID_X_get")] + public static extern int VISUAL_SHADER_SUBDIVIDE_GRID_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_SHADER_SUBDIVIDE_GRID_Y_get")] + public static extern int VISUAL_SHADER_SUBDIVIDE_GRID_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VISUAL_SHADER_HINTS_get")] + public static extern int VISUAL_SHADER_HINTS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BORDER_VISUAL_COLOR_get")] + public static extern int BORDER_VISUAL_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BORDER_VISUAL_SIZE_get")] + public static extern int BORDER_VISUAL_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BORDER_VISUAL_ANTI_ALIASING_get")] + public static extern int BORDER_VISUAL_ANTI_ALIASING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_COLOR_VISUAL_MIX_COLOR_get")] + public static extern int COLOR_VISUAL_MIX_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_START_POSITION_get")] + public static extern int GRADIENT_VISUAL_START_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_END_POSITION_get")] + public static extern int GRADIENT_VISUAL_END_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_CENTER_get")] + public static extern int GRADIENT_VISUAL_CENTER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_RADIUS_get")] + public static extern int GRADIENT_VISUAL_RADIUS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_STOP_OFFSET_get")] + public static extern int GRADIENT_VISUAL_STOP_OFFSET_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_STOP_COLOR_get")] + public static extern int GRADIENT_VISUAL_STOP_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_UNITS_get")] + public static extern int GRADIENT_VISUAL_UNITS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GRADIENT_VISUAL_SPREAD_METHOD_get")] + public static extern int GRADIENT_VISUAL_SPREAD_METHOD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_URL_get")] + public static extern int IMAGE_VISUAL_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_ALPHA_MASK_URL_get")] + public static extern int IMAGE_VISUAL_ALPHA_MASK_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_FITTING_MODE_get")] + public static extern int IMAGE_VISUAL_FITTING_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_SAMPLING_MODE_get")] + public static extern int IMAGE_VISUAL_SAMPLING_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_DESIRED_WIDTH_get")] + public static extern int IMAGE_VISUAL_DESIRED_WIDTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_DESIRED_HEIGHT_get")] + public static extern int IMAGE_VISUAL_DESIRED_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_SYNCHRONOUS_LOADING_get")] + public static extern int IMAGE_VISUAL_SYNCHRONOUS_LOADING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_BORDER_ONLY_get")] + public static extern int IMAGE_VISUAL_BORDER_ONLY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_PIXEL_AREA_get")] + public static extern int IMAGE_VISUAL_PIXEL_AREA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_WRAP_MODE_U_get")] + public static extern int IMAGE_VISUAL_WRAP_MODE_U_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_WRAP_MODE_V_get")] + public static extern int IMAGE_VISUAL_WRAP_MODE_V_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_BATCH_SIZE_get")] + public static extern int IMAGE_VISUAL_BATCH_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_CACHE_SIZE_get")] + public static extern int IMAGE_VISUAL_CACHE_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_FRAME_DELAY_get")] + public static extern int IMAGE_VISUAL_FRAME_DELAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_MASK_CONTENT_SCALE_get")] + public static extern int IMAGE_VISUAL_MASK_CONTENT_SCALE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IMAGE_VISUAL_CROP_TO_MASK_get")] + public static extern int IMAGE_VISUAL_CROP_TO_MASK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_OBJECT_URL_get")] + public static extern int MESH_VISUAL_OBJECT_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_MATERIAL_URL_get")] + public static extern int MESH_VISUAL_MATERIAL_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_TEXTURES_PATH_get")] + public static extern int MESH_VISUAL_TEXTURES_PATH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_SHADING_MODE_get")] + public static extern int MESH_VISUAL_SHADING_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_USE_MIPMAPPING_get")] + public static extern int MESH_VISUAL_USE_MIPMAPPING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_USE_SOFT_NORMALS_get")] + public static extern int MESH_VISUAL_USE_SOFT_NORMALS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MESH_VISUAL_LIGHT_POSITION_get")] + public static extern int MESH_VISUAL_LIGHT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SHAPE_get")] + public static extern int PRIMITIVE_VISUAL_SHAPE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_MIX_COLOR_get")] + public static extern int PRIMITIVE_VISUAL_MIX_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SLICES_get")] + public static extern int PRIMITIVE_VISUAL_SLICES_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_STACKS_get")] + public static extern int PRIMITIVE_VISUAL_STACKS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SCALE_TOP_RADIUS_get")] + public static extern int PRIMITIVE_VISUAL_SCALE_TOP_RADIUS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS_get")] + public static extern int PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SCALE_HEIGHT_get")] + public static extern int PRIMITIVE_VISUAL_SCALE_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SCALE_RADIUS_get")] + public static extern int PRIMITIVE_VISUAL_SCALE_RADIUS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_SCALE_DIMENSIONS_get")] + public static extern int PRIMITIVE_VISUAL_SCALE_DIMENSIONS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_BEVEL_PERCENTAGE_get")] + public static extern int PRIMITIVE_VISUAL_BEVEL_PERCENTAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS_get")] + public static extern int PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PRIMITIVE_VISUAL_LIGHT_POSITION_get")] + public static extern int PRIMITIVE_VISUAL_LIGHT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_TEXT_get")] + public static extern int TEXT_VISUAL_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_FONT_FAMILY_get")] + public static extern int TEXT_VISUAL_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_FONT_STYLE_get")] + public static extern int TEXT_VISUAL_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_POINT_SIZE_get")] + public static extern int TEXT_VISUAL_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_MULTI_LINE_get")] + public static extern int TEXT_VISUAL_MULTI_LINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_HORIZONTAL_ALIGNMENT_get")] + public static extern int TEXT_VISUAL_HORIZONTAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_VERTICAL_ALIGNMENT_get")] + public static extern int TEXT_VISUAL_VERTICAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_TEXT_COLOR_get")] + public static extern int TEXT_VISUAL_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TEXT_VISUAL_ENABLE_MARKUP_get")] + public static extern int TEXT_VISUAL_ENABLE_MARKUP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Builder")] + public static extern global::System.IntPtr new_Builder(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_New")] + public static extern global::System.IntPtr Builder_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Builder")] + public static extern void delete_Builder(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_LoadFromString__SWIG_0")] + public static extern void Builder_LoadFromString__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_LoadFromString__SWIG_1")] + public static extern void Builder_LoadFromString__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_AddConstants")] + public static extern void Builder_AddConstants(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_AddConstant")] + public static extern void Builder_AddConstant(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetConstants")] + public static extern global::System.IntPtr Builder_GetConstants(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetConstant")] + public static extern global::System.IntPtr Builder_GetConstant(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateAnimation__SWIG_0")] + public static extern global::System.IntPtr Builder_CreateAnimation__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateAnimation__SWIG_1")] + public static extern global::System.IntPtr Builder_CreateAnimation__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateAnimation__SWIG_2")] + public static extern global::System.IntPtr Builder_CreateAnimation__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateAnimation__SWIG_3")] + public static extern global::System.IntPtr Builder_CreateAnimation__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_Create__SWIG_0")] + public static extern global::System.IntPtr Builder_Create__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_Create__SWIG_1")] + public static extern global::System.IntPtr Builder_Create__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateFromJson")] + public static extern global::System.IntPtr Builder_CreateFromJson(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_ApplyStyle")] + public static extern bool Builder_ApplyStyle(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_ApplyFromJson")] + public static extern bool Builder_ApplyFromJson(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_AddActors__SWIG_0")] + public static extern void Builder_AddActors__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_AddActors__SWIG_1")] + public static extern void Builder_AddActors__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_CreateRenderTask")] + public static extern void Builder_CreateRenderTask(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetFrameBufferImage")] + public static extern global::System.IntPtr Builder_GetFrameBufferImage(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetPath")] + public static extern global::System.IntPtr Builder_GetPath(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetPathConstrainer")] + public static extern global::System.IntPtr Builder_GetPathConstrainer(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_GetLinearConstrainer")] + public static extern global::System.IntPtr Builder_GetLinearConstrainer(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_QuitSignal")] + public static extern global::System.IntPtr Builder_QuitSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TransitionData__SWIG_0")] + public static extern global::System.IntPtr new_TransitionData__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TransitionData")] + public static extern void delete_TransitionData(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_New__SWIG_0")] + public static extern global::System.IntPtr TransitionData_New__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_New__SWIG_1")] + public static extern global::System.IntPtr TransitionData_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_DownCast")] + public static extern global::System.IntPtr TransitionData_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TransitionData__SWIG_1")] + public static extern global::System.IntPtr new_TransitionData__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_Assign")] + public static extern global::System.IntPtr TransitionData_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_Count")] + public static extern uint TransitionData_Count(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_GetAnimatorAt")] + public static extern global::System.IntPtr TransitionData_GetAnimatorAt(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TransitionData__SWIG_2")] + public static extern global::System.IntPtr new_TransitionData__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_CONTENT_get")] + public static extern int TOOLTIP_CONTENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_LAYOUT_get")] + public static extern int TOOLTIP_LAYOUT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_WAIT_TIME_get")] + public static extern int TOOLTIP_WAIT_TIME_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_BACKGROUND_get")] + public static extern int TOOLTIP_BACKGROUND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_TAIL_get")] + public static extern int TOOLTIP_TAIL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_POSITION_get")] + public static extern int TOOLTIP_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_HOVER_POINT_OFFSET_get")] + public static extern int TOOLTIP_HOVER_POINT_OFFSET_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_MOVEMENT_THRESHOLD_get")] + public static extern int TOOLTIP_MOVEMENT_THRESHOLD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_DISAPPEAR_ON_MOVEMENT_get")] + public static extern int TOOLTIP_DISAPPEAR_ON_MOVEMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_BACKGROUND_VISUAL_get")] + public static extern int TOOLTIP_BACKGROUND_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_BACKGROUND_BORDER_get")] + public static extern int TOOLTIP_BACKGROUND_BORDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_TAIL_VISIBILITY_get")] + public static extern int TOOLTIP_TAIL_VISIBILITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_TAIL_ABOVE_VISUAL_get")] + public static extern int TOOLTIP_TAIL_ABOVE_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TOOLTIP_TAIL_BELOW_VISUAL_get")] + public static extern int TOOLTIP_TAIL_BELOW_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_New")] + public static extern global::System.IntPtr ViewImpl_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetStyleName")] + public static extern void ViewImpl_SetStyleName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetStyleName")] + public static extern string ViewImpl_GetStyleName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetBackgroundColor")] + public static extern void ViewImpl_SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetBackgroundColor")] + public static extern global::System.IntPtr ViewImpl_GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetBackgroundImage")] + public static extern void ViewImpl_SetBackgroundImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetBackground")] + public static extern void ViewImpl_SetBackground(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_ClearBackground")] + public static extern void ViewImpl_ClearBackground(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_EnableGestureDetection")] + public static extern void ViewImpl_EnableGestureDetection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_DisableGestureDetection")] + public static extern void ViewImpl_DisableGestureDetection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetPinchGestureDetector")] + public static extern global::System.IntPtr ViewImpl_GetPinchGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetPanGestureDetector")] + public static extern global::System.IntPtr ViewImpl_GetPanGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetTapGestureDetector")] + public static extern global::System.IntPtr ViewImpl_GetTapGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetLongPressGestureDetector")] + public static extern global::System.IntPtr ViewImpl_GetLongPressGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetKeyboardNavigationSupport")] + public static extern void ViewImpl_SetKeyboardNavigationSupport(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_IsKeyboardNavigationSupported")] + public static extern bool ViewImpl_IsKeyboardNavigationSupported(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetKeyInputFocus")] + public static extern void ViewImpl_SetKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_HasKeyInputFocus")] + public static extern bool ViewImpl_HasKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_ClearKeyInputFocus")] + public static extern void ViewImpl_ClearKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SetAsKeyboardFocusGroup")] + public static extern void ViewImpl_SetAsKeyboardFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_IsKeyboardFocusGroup")] + public static extern bool ViewImpl_IsKeyboardFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_AccessibilityActivate")] + public static extern void ViewImpl_AccessibilityActivate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_KeyboardEnter")] + public static extern void ViewImpl_KeyboardEnter(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_KeyEventSignal")] + public static extern global::System.IntPtr ViewImpl_KeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_KeyInputFocusGainedSignal")] + public static extern global::System.IntPtr ViewImpl_KeyInputFocusGainedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_KeyInputFocusLostSignal")] + public static extern global::System.IntPtr ViewImpl_KeyInputFocusLostSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_EmitKeyEventSignal")] + public static extern bool ViewImpl_EmitKeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStageConnection")] + public static extern void ViewImpl_OnStageConnection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStageConnectionSwigExplicitViewImpl")] + public static extern void ViewImpl_OnStageConnectionSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStageDisconnection")] + public static extern void ViewImpl_OnStageDisconnection(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStageDisconnectionSwigExplicitViewImpl")] + public static extern void ViewImpl_OnStageDisconnectionSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnChildAdd")] + public static extern void ViewImpl_OnChildAdd(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnChildAddSwigExplicitViewImpl")] + public static extern void ViewImpl_OnChildAddSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnChildRemove")] + public static extern void ViewImpl_OnChildRemove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnChildRemoveSwigExplicitViewImpl")] + public static extern void ViewImpl_OnChildRemoveSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPropertySet")] + public static extern void ViewImpl_OnPropertySet(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPropertySetSwigExplicitViewImpl")] + public static extern void ViewImpl_OnPropertySetSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSizeSet")] + public static extern void ViewImpl_OnSizeSet(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSizeSetSwigExplicitViewImpl")] + public static extern void ViewImpl_OnSizeSetSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSizeAnimation")] + public static extern void ViewImpl_OnSizeAnimation(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSizeAnimationSwigExplicitViewImpl")] + public static extern void ViewImpl_OnSizeAnimationSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnTouchEvent")] + public static extern bool ViewImpl_OnTouchEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnTouchEventSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnTouchEventSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnHoverEvent")] + public static extern bool ViewImpl_OnHoverEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnHoverEventSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnHoverEventSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyEvent")] + public static extern bool ViewImpl_OnKeyEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyEventSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnKeyEventSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnWheelEvent")] + public static extern bool ViewImpl_OnWheelEvent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnWheelEventSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnWheelEventSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnRelayout")] + public static extern void ViewImpl_OnRelayout(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnRelayoutSwigExplicitViewImpl")] + public static extern void ViewImpl_OnRelayoutSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSetResizePolicy")] + public static extern void ViewImpl_OnSetResizePolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnSetResizePolicySwigExplicitViewImpl")] + public static extern void ViewImpl_OnSetResizePolicySwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetNaturalSize")] + public static extern global::System.IntPtr ViewImpl_GetNaturalSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetNaturalSizeSwigExplicitViewImpl")] + public static extern global::System.IntPtr ViewImpl_GetNaturalSizeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_CalculateChildSize")] + public static extern float ViewImpl_CalculateChildSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_CalculateChildSizeSwigExplicitViewImpl")] + public static extern float ViewImpl_CalculateChildSizeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetHeightForWidth")] + public static extern float ViewImpl_GetHeightForWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetHeightForWidthSwigExplicitViewImpl")] + public static extern float ViewImpl_GetHeightForWidthSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetWidthForHeight")] + public static extern float ViewImpl_GetWidthForHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetWidthForHeightSwigExplicitViewImpl")] + public static extern float ViewImpl_GetWidthForHeightSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_RelayoutDependentOnChildren__SWIG_0")] + public static extern bool ViewImpl_RelayoutDependentOnChildren__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_0")] + public static extern bool ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_RelayoutDependentOnChildren__SWIG_1")] + public static extern bool ViewImpl_RelayoutDependentOnChildren__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_1")] + public static extern bool ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnCalculateRelayoutSize")] + public static extern void ViewImpl_OnCalculateRelayoutSize(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnCalculateRelayoutSizeSwigExplicitViewImpl")] + public static extern void ViewImpl_OnCalculateRelayoutSizeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnLayoutNegotiated")] + public static extern void ViewImpl_OnLayoutNegotiated(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnLayoutNegotiatedSwigExplicitViewImpl")] + public static extern void ViewImpl_OnLayoutNegotiatedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnInitialize")] + public static extern void ViewImpl_OnInitialize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnInitializeSwigExplicitViewImpl")] + public static extern void ViewImpl_OnInitializeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnControlChildAdd")] + public static extern void ViewImpl_OnControlChildAdd(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnControlChildAddSwigExplicitViewImpl")] + public static extern void ViewImpl_OnControlChildAddSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnControlChildRemove")] + public static extern void ViewImpl_OnControlChildRemove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnControlChildRemoveSwigExplicitViewImpl")] + public static extern void ViewImpl_OnControlChildRemoveSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStyleChange")] + public static extern void ViewImpl_OnStyleChange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnStyleChangeSwigExplicitViewImpl")] + public static extern void ViewImpl_OnStyleChangeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityActivated")] + public static extern bool ViewImpl_OnAccessibilityActivated(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityActivatedSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnAccessibilityActivatedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityPan")] + public static extern bool ViewImpl_OnAccessibilityPan(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityPanSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnAccessibilityPanSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityTouch")] + public static extern bool ViewImpl_OnAccessibilityTouch(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityTouchSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnAccessibilityTouchSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityValueChange")] + public static extern bool ViewImpl_OnAccessibilityValueChange(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityValueChangeSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnAccessibilityValueChangeSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityZoom")] + public static extern bool ViewImpl_OnAccessibilityZoom(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnAccessibilityZoomSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnAccessibilityZoomSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyInputFocusGained")] + public static extern void ViewImpl_OnKeyInputFocusGained(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyInputFocusGainedSwigExplicitViewImpl")] + public static extern void ViewImpl_OnKeyInputFocusGainedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyInputFocusLost")] + public static extern void ViewImpl_OnKeyInputFocusLost(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyInputFocusLostSwigExplicitViewImpl")] + public static extern void ViewImpl_OnKeyInputFocusLostSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetNextKeyboardFocusableActor")] + public static extern global::System.IntPtr ViewImpl_GetNextKeyboardFocusableActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_GetNextKeyboardFocusableActorSwigExplicitViewImpl")] + public static extern global::System.IntPtr ViewImpl_GetNextKeyboardFocusableActorSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyboardFocusChangeCommitted")] + public static extern void ViewImpl_OnKeyboardFocusChangeCommitted(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyboardFocusChangeCommittedSwigExplicitViewImpl")] + public static extern void ViewImpl_OnKeyboardFocusChangeCommittedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyboardEnter")] + public static extern bool ViewImpl_OnKeyboardEnter(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnKeyboardEnterSwigExplicitViewImpl")] + public static extern bool ViewImpl_OnKeyboardEnterSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPinch")] + public static extern void ViewImpl_OnPinch(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPinchSwigExplicitViewImpl")] + public static extern void ViewImpl_OnPinchSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPan")] + public static extern void ViewImpl_OnPan(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnPanSwigExplicitViewImpl")] + public static extern void ViewImpl_OnPanSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnTap")] + public static extern void ViewImpl_OnTap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnTapSwigExplicitViewImpl")] + public static extern void ViewImpl_OnTapSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnLongPress")] + public static extern void ViewImpl_OnLongPress(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_OnLongPressSwigExplicitViewImpl")] + public static extern void ViewImpl_OnLongPressSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SignalConnected")] + public static extern void ViewImpl_SignalConnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SignalConnectedSwigExplicitViewImpl")] + public static extern void ViewImpl_SignalConnectedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SignalDisconnected")] + public static extern void ViewImpl_SignalDisconnected(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SignalDisconnectedSwigExplicitViewImpl")] + public static extern void ViewImpl_SignalDisconnectedSwigExplicitViewImpl(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_director_connect")] + public static extern void ViewImpl_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, ViewImpl.SwigDelegateViewImpl_0 delegate0, ViewImpl.SwigDelegateViewImpl_1 delegate1, ViewImpl.SwigDelegateViewImpl_2 delegate2, ViewImpl.SwigDelegateViewImpl_3 delegate3, ViewImpl.SwigDelegateViewImpl_4 delegate4, ViewImpl.SwigDelegateViewImpl_5 delegate5, ViewImpl.SwigDelegateViewImpl_6 delegate6, ViewImpl.SwigDelegateViewImpl_7 delegate7, ViewImpl.SwigDelegateViewImpl_8 delegate8, ViewImpl.SwigDelegateViewImpl_9 delegate9, ViewImpl.SwigDelegateViewImpl_10 delegate10, ViewImpl.SwigDelegateViewImpl_11 delegate11, ViewImpl.SwigDelegateViewImpl_12 delegate12, ViewImpl.SwigDelegateViewImpl_13 delegate13, ViewImpl.SwigDelegateViewImpl_14 delegate14, ViewImpl.SwigDelegateViewImpl_15 delegate15, ViewImpl.SwigDelegateViewImpl_16 delegate16, ViewImpl.SwigDelegateViewImpl_17 delegate17, ViewImpl.SwigDelegateViewImpl_18 delegate18, ViewImpl.SwigDelegateViewImpl_19 delegate19, ViewImpl.SwigDelegateViewImpl_20 delegate20, ViewImpl.SwigDelegateViewImpl_21 delegate21, ViewImpl.SwigDelegateViewImpl_22 delegate22, ViewImpl.SwigDelegateViewImpl_23 delegate23, ViewImpl.SwigDelegateViewImpl_24 delegate24, ViewImpl.SwigDelegateViewImpl_25 delegate25, ViewImpl.SwigDelegateViewImpl_26 delegate26, ViewImpl.SwigDelegateViewImpl_27 delegate27, ViewImpl.SwigDelegateViewImpl_28 delegate28, ViewImpl.SwigDelegateViewImpl_29 delegate29, ViewImpl.SwigDelegateViewImpl_30 delegate30, ViewImpl.SwigDelegateViewImpl_31 delegate31, ViewImpl.SwigDelegateViewImpl_32 delegate32, ViewImpl.SwigDelegateViewImpl_33 delegate33, ViewImpl.SwigDelegateViewImpl_34 delegate34, ViewImpl.SwigDelegateViewImpl_35 delegate35, ViewImpl.SwigDelegateViewImpl_36 delegate36, ViewImpl.SwigDelegateViewImpl_37 delegate37, ViewImpl.SwigDelegateViewImpl_38 delegate38, ViewImpl.SwigDelegateViewImpl_39 delegate39, ViewImpl.SwigDelegateViewImpl_40 delegate40); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetImplementation__SWIG_0")] + public static extern global::System.IntPtr GetImplementation__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Property_STYLE_NAME_get")] + public static extern int View_Property_STYLE_NAME_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Property_BACKGROUND_COLOR_get")] + public static extern int View_Property_BACKGROUND_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Property_BACKGROUND_IMAGE_get")] + public static extern int View_Property_BACKGROUND_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Property_KEY_INPUT_FOCUS_get")] + public static extern int View_Property_KEY_INPUT_FOCUS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Property_BACKGROUND_get")] + public static extern int View_Property_BACKGROUND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_View_Property")] + public static extern global::System.IntPtr new_View_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_View_Property")] + public static extern void delete_View_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_View_KeyboardFocus")] + public static extern global::System.IntPtr new_View_KeyboardFocus(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_View_KeyboardFocus")] + public static extern void delete_View_KeyboardFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_New")] + public static extern global::System.IntPtr View_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_View__SWIG_0")] + public static extern global::System.IntPtr new_View__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_View__SWIG_1")] + public static extern global::System.IntPtr new_View__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_View")] + public static extern void delete_View(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_Assign")] + public static extern global::System.IntPtr View_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_DownCast")] + public static extern global::System.IntPtr View_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_SetKeyInputFocus")] + public static extern void View_SetKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_HasKeyInputFocus")] + public static extern bool View_HasKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_ClearKeyInputFocus")] + public static extern void View_ClearKeyInputFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetPinchGestureDetector")] + public static extern global::System.IntPtr View_GetPinchGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetPanGestureDetector")] + public static extern global::System.IntPtr View_GetPanGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetTapGestureDetector")] + public static extern global::System.IntPtr View_GetTapGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetLongPressGestureDetector")] + public static extern global::System.IntPtr View_GetLongPressGestureDetector(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_SetStyleName")] + public static extern void View_SetStyleName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetStyleName")] + public static extern string View_GetStyleName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_SetBackgroundColor")] + public static extern void View_SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_GetBackgroundColor")] + public static extern global::System.IntPtr View_GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_SetBackgroundImage")] + public static extern void View_SetBackgroundImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_ClearBackground")] + public static extern void View_ClearBackground(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_KeyEventSignal")] + public static extern global::System.IntPtr View_KeyEventSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_KeyInputFocusGainedSignal")] + public static extern global::System.IntPtr View_KeyInputFocusGainedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_KeyInputFocusLostSignal")] + public static extern global::System.IntPtr View_KeyInputFocusLostSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_View__SWIG_2")] + public static extern global::System.IntPtr new_View__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceReadySignal")] + public static extern global::System.IntPtr ResourceReadySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsResourceReady")] + public static extern bool IsResourceReady(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyInputFocusManager")] + public static extern global::System.IntPtr new_KeyInputFocusManager(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyInputFocusManager")] + public static extern void delete_KeyInputFocusManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_Get")] + public static extern global::System.IntPtr KeyInputFocusManager_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_SetFocus")] + public static extern void KeyInputFocusManager_SetFocus(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_GetCurrentFocusControl")] + public static extern global::System.IntPtr KeyInputFocusManager_GetCurrentFocusControl(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_RemoveFocus")] + public static extern void KeyInputFocusManager_RemoveFocus(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_KeyInputFocusChangedSignal")] + public static extern global::System.IntPtr KeyInputFocusManager_KeyInputFocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Alignment_Padding__SWIG_0")] + public static extern global::System.IntPtr new_Alignment_Padding__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Alignment_Padding__SWIG_1")] + public static extern global::System.IntPtr new_Alignment_Padding__SWIG_1(float jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_left_set")] + public static extern void Alignment_Padding_left_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_left_get")] + public static extern float Alignment_Padding_left_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_right_set")] + public static extern void Alignment_Padding_right_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_right_get")] + public static extern float Alignment_Padding_right_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_top_set")] + public static extern void Alignment_Padding_top_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_top_get")] + public static extern float Alignment_Padding_top_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_bottom_set")] + public static extern void Alignment_Padding_bottom_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Padding_bottom_get")] + public static extern float Alignment_Padding_bottom_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Alignment_Padding")] + public static extern void delete_Alignment_Padding(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Alignment__SWIG_0")] + public static extern global::System.IntPtr new_Alignment__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_New__SWIG_0")] + public static extern global::System.IntPtr Alignment_New__SWIG_0(int jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_New__SWIG_1")] + public static extern global::System.IntPtr Alignment_New__SWIG_1(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_New__SWIG_2")] + public static extern global::System.IntPtr Alignment_New__SWIG_2(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Alignment__SWIG_1")] + public static extern global::System.IntPtr new_Alignment__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Alignment")] + public static extern void delete_Alignment(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_DownCast")] + public static extern global::System.IntPtr Alignment_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_SetAlignmentType")] + public static extern void Alignment_SetAlignmentType(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_GetAlignmentType")] + public static extern int Alignment_GetAlignmentType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_SetScaling")] + public static extern void Alignment_SetScaling(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_GetScaling")] + public static extern int Alignment_GetScaling(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_SetPadding")] + public static extern void Alignment_SetPadding(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_GetPadding")] + public static extern global::System.IntPtr Alignment_GetPadding(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_Assign")] + public static extern global::System.IntPtr Alignment_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_DISABLED_get")] + public static extern int Button_Property_DISABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_AUTO_REPEATING_get")] + public static extern int Button_Property_AUTO_REPEATING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_INITIAL_AUTO_REPEATING_DELAY_get")] + public static extern int Button_Property_INITIAL_AUTO_REPEATING_DELAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_NEXT_AUTO_REPEATING_DELAY_get")] + public static extern int Button_Property_NEXT_AUTO_REPEATING_DELAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_TOGGLABLE_get")] + public static extern int Button_Property_TOGGLABLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_SELECTED_get")] + public static extern int Button_Property_SELECTED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_UNSELECTED_STATE_IMAGE_get")] + public static extern int Button_Property_UNSELECTED_STATE_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_SELECTED_STATE_IMAGE_get")] + public static extern int Button_Property_SELECTED_STATE_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_DISABLED_STATE_IMAGE_get")] + public static extern int Button_Property_DISABLED_STATE_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_UNSELECTED_COLOR_get")] + public static extern int Button_Property_UNSELECTED_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_SELECTED_COLOR_get")] + public static extern int Button_Property_SELECTED_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_LABEL_get")] + public static extern int Button_Property_LABEL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Property_LABEL_TEXT_get")] + public static extern int Button_Property_LABEL_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Button_Property")] + public static extern global::System.IntPtr new_Button_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Button_Property")] + public static extern void delete_Button_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Button__SWIG_0")] + public static extern global::System.IntPtr new_Button__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Button__SWIG_1")] + public static extern global::System.IntPtr new_Button__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_Assign")] + public static extern global::System.IntPtr Button_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_DownCast")] + public static extern global::System.IntPtr Button_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Button")] + public static extern void delete_Button(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_IsDisabled")] + public static extern bool Button_IsDisabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_IsAutoRepeating")] + public static extern bool Button_IsAutoRepeating(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetInitialAutoRepeatingDelay")] + public static extern float Button_GetInitialAutoRepeatingDelay(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetNextAutoRepeatingDelay")] + public static extern float Button_GetNextAutoRepeatingDelay(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_IsTogglableButton")] + public static extern bool Button_IsTogglableButton(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_IsSelected")] + public static extern bool Button_IsSelected(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetAnimationTime")] + public static extern float Button_GetAnimationTime(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetLabelText")] + public static extern string Button_GetLabelText(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_SetLabel")] + public static extern void Button_SetLabel(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_SetButtonImage")] + public static extern void Button_SetButtonImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_SetSelectedImage")] + public static extern void Button_SetSelectedImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetButtonImage")] + public static extern global::System.IntPtr Button_GetButtonImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_GetSelectedImage")] + public static extern global::System.IntPtr Button_GetSelectedImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_PressedSignal")] + public static extern global::System.IntPtr Button_PressedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_ReleasedSignal")] + public static extern global::System.IntPtr Button_ReleasedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_ClickedSignal")] + public static extern global::System.IntPtr Button_ClickedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_StateChangedSignal")] + public static extern global::System.IntPtr Button_StateChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CheckBoxButton__SWIG_0")] + public static extern global::System.IntPtr new_CheckBoxButton__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CheckBoxButton__SWIG_1")] + public static extern global::System.IntPtr new_CheckBoxButton__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CheckBoxButton_Assign")] + public static extern global::System.IntPtr CheckBoxButton_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_CheckBoxButton")] + public static extern void delete_CheckBoxButton(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CheckBoxButton_New")] + public static extern global::System.IntPtr CheckBoxButton_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CheckBoxButton_DownCast")] + public static extern global::System.IntPtr CheckBoxButton_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Property_UNSELECTED_ICON_get")] + public static extern int PushButton_Property_UNSELECTED_ICON_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Property_SELECTED_ICON_get")] + public static extern int PushButton_Property_SELECTED_ICON_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Property_ICON_ALIGNMENT_get")] + public static extern int PushButton_Property_ICON_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Property_LABEL_PADDING_get")] + public static extern int PushButton_Property_LABEL_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Property_ICON_PADDING_get")] + public static extern int PushButton_Property_ICON_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PushButton_Property")] + public static extern global::System.IntPtr new_PushButton_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PushButton_Property")] + public static extern void delete_PushButton_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PushButton__SWIG_0")] + public static extern global::System.IntPtr new_PushButton__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PushButton__SWIG_1")] + public static extern global::System.IntPtr new_PushButton__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_Assign")] + public static extern global::System.IntPtr PushButton_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PushButton")] + public static extern void delete_PushButton(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_New")] + public static extern global::System.IntPtr PushButton_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_DownCast")] + public static extern global::System.IntPtr PushButton_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetButtonImage__SWIG_0_0")] + public static extern void PushButton_SetButtonImage__SWIG_0_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetButtonImage__SWIG_1")] + public static extern void PushButton_SetButtonImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetBackgroundImage")] + public static extern void PushButton_SetBackgroundImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetSelectedImage__SWIG_0_0")] + public static extern void PushButton_SetSelectedImage__SWIG_0_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetSelectedImage__SWIG_1")] + public static extern void PushButton_SetSelectedImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetSelectedBackgroundImage")] + public static extern void PushButton_SetSelectedBackgroundImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetDisabledBackgroundImage")] + public static extern void PushButton_SetDisabledBackgroundImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetDisabledImage")] + public static extern void PushButton_SetDisabledImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SetDisabledSelectedImage")] + public static extern void PushButton_SetDisabledSelectedImage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RadioButton__SWIG_0")] + public static extern global::System.IntPtr new_RadioButton__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RadioButton__SWIG_1")] + public static extern global::System.IntPtr new_RadioButton__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RadioButton_Assign")] + public static extern global::System.IntPtr RadioButton_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RadioButton")] + public static extern void delete_RadioButton(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RadioButton_New__SWIG_0")] + public static extern global::System.IntPtr RadioButton_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RadioButton_New__SWIG_1")] + public static extern global::System.IntPtr RadioButton_New__SWIG_1(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RadioButton_DownCast")] + public static extern global::System.IntPtr RadioButton_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_CONTENT_DIRECTION_get")] + public static extern int FlexContainer_Property_CONTENT_DIRECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_FLEX_DIRECTION_get")] + public static extern int FlexContainer_Property_FLEX_DIRECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_FLEX_WRAP_get")] + public static extern int FlexContainer_Property_FLEX_WRAP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_JUSTIFY_CONTENT_get")] + public static extern int FlexContainer_Property_JUSTIFY_CONTENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_ALIGN_ITEMS_get")] + public static extern int FlexContainer_Property_ALIGN_ITEMS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Property_ALIGN_CONTENT_get")] + public static extern int FlexContainer_Property_ALIGN_CONTENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FlexContainer_Property")] + public static extern global::System.IntPtr new_FlexContainer_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FlexContainer_Property")] + public static extern void delete_FlexContainer_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_ChildProperty_FLEX_get")] + public static extern int FlexContainer_ChildProperty_FLEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_ChildProperty_ALIGN_SELF_get")] + public static extern int FlexContainer_ChildProperty_ALIGN_SELF_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_ChildProperty_FLEX_MARGIN_get")] + public static extern int FlexContainer_ChildProperty_FLEX_MARGIN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FlexContainer_ChildProperty")] + public static extern global::System.IntPtr new_FlexContainer_ChildProperty(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FlexContainer_ChildProperty")] + public static extern void delete_FlexContainer_ChildProperty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FlexContainer__SWIG_0")] + public static extern global::System.IntPtr new_FlexContainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FlexContainer__SWIG_1")] + public static extern global::System.IntPtr new_FlexContainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_Assign")] + public static extern global::System.IntPtr FlexContainer_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FlexContainer")] + public static extern void delete_FlexContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_New")] + public static extern global::System.IntPtr FlexContainer_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_DownCast")] + public static extern global::System.IntPtr FlexContainer_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_Property_RESOURCE_URL_get")] + public static extern int ImageView_Property_RESOURCE_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_Property_IMAGE_get")] + public static extern int ImageView_Property_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_Property_PRE_MULTIPLIED_ALPHA_get")] + public static extern int ImageView_Property_PRE_MULTIPLIED_ALPHA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_Property_PIXEL_AREA_get")] + public static extern int ImageView_Property_PIXEL_AREA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImageView_Property")] + public static extern global::System.IntPtr new_ImageView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImageView_Property")] + public static extern void delete_ImageView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImageView__SWIG_0")] + public static extern global::System.IntPtr new_ImageView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_New__SWIG_0")] + public static extern global::System.IntPtr ImageView_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_New__SWIG_1")] + public static extern global::System.IntPtr ImageView_New__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_New__SWIG_2")] + public static extern global::System.IntPtr ImageView_New__SWIG_2(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_New__SWIG_3")] + public static extern global::System.IntPtr ImageView_New__SWIG_3(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ImageView")] + public static extern void delete_ImageView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ImageView__SWIG_1")] + public static extern global::System.IntPtr new_ImageView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_Assign")] + public static extern global::System.IntPtr ImageView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_DownCast")] + public static extern global::System.IntPtr ImageView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_SetImage__SWIG_0")] + public static extern void ImageView_SetImage__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_SetImage__SWIG_1")] + public static extern void ImageView_SetImage__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_SetImage__SWIG_2")] + public static extern void ImageView_SetImage__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_GetImage")] + public static extern global::System.IntPtr ImageView_GetImage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_GEOMETRY_URL_get")] + public static extern int Model3dView_Property_GEOMETRY_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_MATERIAL_URL_get")] + public static extern int Model3dView_Property_MATERIAL_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_IMAGES_URL_get")] + public static extern int Model3dView_Property_IMAGES_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_ILLUMINATION_TYPE_get")] + public static extern int Model3dView_Property_ILLUMINATION_TYPE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_TEXTURE0_URL_get")] + public static extern int Model3dView_Property_TEXTURE0_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_TEXTURE1_URL_get")] + public static extern int Model3dView_Property_TEXTURE1_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_TEXTURE2_URL_get")] + public static extern int Model3dView_Property_TEXTURE2_URL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Property_LIGHT_POSITION_get")] + public static extern int Model3dView_Property_LIGHT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Model3dView_Property")] + public static extern global::System.IntPtr new_Model3dView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Model3dView_Property")] + public static extern void delete_Model3dView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_New__SWIG_0")] + public static extern global::System.IntPtr Model3dView_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_New__SWIG_1")] + public static extern global::System.IntPtr Model3dView_New__SWIG_1(string jarg1, string jarg2, string jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Model3dView__SWIG_0")] + public static extern global::System.IntPtr new_Model3dView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Model3dView")] + public static extern void delete_Model3dView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Model3dView__SWIG_1")] + public static extern global::System.IntPtr new_Model3dView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_Assign")] + public static extern global::System.IntPtr Model3dView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_DownCast")] + public static extern global::System.IntPtr Model3dView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_SCROLL_DIRECTION_get")] + public static extern int ScrollBar_Property_SCROLL_DIRECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get")] + public static extern int ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get")] + public static extern int ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_SHOW_DURATION_get")] + public static extern int ScrollBar_Property_INDICATOR_SHOW_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_HIDE_DURATION_get")] + public static extern int ScrollBar_Property_INDICATOR_HIDE_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_SCROLL_POSITION_INTERVALS_get")] + public static extern int ScrollBar_Property_SCROLL_POSITION_INTERVALS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get")] + public static extern int ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_START_PADDING_get")] + public static extern int ScrollBar_Property_INDICATOR_START_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Property_INDICATOR_END_PADDING_get")] + public static extern int ScrollBar_Property_INDICATOR_END_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollBar_Property")] + public static extern global::System.IntPtr new_ScrollBar_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollBar_Property")] + public static extern void delete_ScrollBar_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollBar__SWIG_0")] + public static extern global::System.IntPtr new_ScrollBar__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollBar__SWIG_1")] + public static extern global::System.IntPtr new_ScrollBar__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_Assign")] + public static extern global::System.IntPtr ScrollBar_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollBar")] + public static extern void delete_ScrollBar(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_New__SWIG_0")] + public static extern global::System.IntPtr ScrollBar_New__SWIG_0(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_New__SWIG_1")] + public static extern global::System.IntPtr ScrollBar_New__SWIG_1(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_DownCast")] + public static extern global::System.IntPtr ScrollBar_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetScrollPropertySource")] + public static extern void ScrollBar_SetScrollPropertySource(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, int jarg5, int jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetScrollIndicator")] + public static extern void ScrollBar_SetScrollIndicator(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetScrollIndicator")] + public static extern global::System.IntPtr ScrollBar_GetScrollIndicator(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetScrollPositionIntervals")] + public static extern void ScrollBar_SetScrollPositionIntervals(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetScrollPositionIntervals")] + public static extern global::System.IntPtr ScrollBar_GetScrollPositionIntervals(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetScrollDirection")] + public static extern void ScrollBar_SetScrollDirection(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetScrollDirection")] + public static extern int ScrollBar_GetScrollDirection(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetIndicatorHeightPolicy")] + public static extern void ScrollBar_SetIndicatorHeightPolicy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetIndicatorHeightPolicy")] + public static extern int ScrollBar_GetIndicatorHeightPolicy(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetIndicatorFixedHeight")] + public static extern void ScrollBar_SetIndicatorFixedHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetIndicatorFixedHeight")] + public static extern float ScrollBar_GetIndicatorFixedHeight(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetIndicatorShowDuration")] + public static extern void ScrollBar_SetIndicatorShowDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetIndicatorShowDuration")] + public static extern float ScrollBar_GetIndicatorShowDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SetIndicatorHideDuration")] + public static extern void ScrollBar_SetIndicatorHideDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_GetIndicatorHideDuration")] + public static extern float ScrollBar_GetIndicatorHideDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_ShowIndicator")] + public static extern void ScrollBar_ShowIndicator(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_HideIndicator")] + public static extern void ScrollBar_HideIndicator(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_PanFinishedSignal")] + public static extern global::System.IntPtr ScrollBar_PanFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_ScrollPositionIntervalReachedSignal")] + public static extern global::System.IntPtr ScrollBar_ScrollPositionIntervalReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_OVERSHOOT_EFFECT_COLOR_get")] + public static extern int Scrollable_Property_OVERSHOOT_EFFECT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_OVERSHOOT_ANIMATION_SPEED_get")] + public static extern int Scrollable_Property_OVERSHOOT_ANIMATION_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_OVERSHOOT_ENABLED_get")] + public static extern int Scrollable_Property_OVERSHOOT_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_OVERSHOOT_SIZE_get")] + public static extern int Scrollable_Property_OVERSHOOT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_TO_ALPHA_FUNCTION_get")] + public static extern int Scrollable_Property_SCROLL_TO_ALPHA_FUNCTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_RELATIVE_POSITION_get")] + public static extern int Scrollable_Property_SCROLL_RELATIVE_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MIN_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MIN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MIN_X_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MIN_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MIN_Y_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MIN_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MAX_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MAX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MAX_X_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MAX_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_SCROLL_POSITION_MAX_Y_get")] + public static extern int Scrollable_Property_SCROLL_POSITION_MAX_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_CAN_SCROLL_VERTICAL_get")] + public static extern int Scrollable_Property_CAN_SCROLL_VERTICAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Property_CAN_SCROLL_HORIZONTAL_get")] + public static extern int Scrollable_Property_CAN_SCROLL_HORIZONTAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Scrollable_Property")] + public static extern global::System.IntPtr new_Scrollable_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Scrollable_Property")] + public static extern void delete_Scrollable_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Scrollable__SWIG_0")] + public static extern global::System.IntPtr new_Scrollable__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Scrollable__SWIG_1")] + public static extern global::System.IntPtr new_Scrollable__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_Assign")] + public static extern global::System.IntPtr Scrollable_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Scrollable")] + public static extern void delete_Scrollable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_DownCast")] + public static extern global::System.IntPtr Scrollable_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_IsOvershootEnabled")] + public static extern bool Scrollable_IsOvershootEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_SetOvershootEnabled")] + public static extern void Scrollable_SetOvershootEnabled(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_SetOvershootEffectColor")] + public static extern void Scrollable_SetOvershootEffectColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_GetOvershootEffectColor")] + public static extern global::System.IntPtr Scrollable_GetOvershootEffectColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_SetOvershootAnimationSpeed")] + public static extern void Scrollable_SetOvershootAnimationSpeed(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_GetOvershootAnimationSpeed")] + public static extern float Scrollable_GetOvershootAnimationSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_ScrollStartedSignal")] + public static extern global::System.IntPtr Scrollable_ScrollStartedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_ScrollUpdatedSignal")] + public static extern global::System.IntPtr Scrollable_ScrollUpdatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_ScrollCompletedSignal")] + public static extern global::System.IntPtr Scrollable_ScrollCompletedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsVertical")] + public static extern bool IsVertical(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_IsHorizontal")] + public static extern bool IsHorizontal(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemRange__SWIG_0")] + public static extern global::System.IntPtr new_ItemRange__SWIG_0(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemRange__SWIG_1")] + public static extern global::System.IntPtr new_ItemRange__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_Assign")] + public static extern global::System.IntPtr ItemRange_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_Within")] + public static extern bool ItemRange_Within(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_Intersection")] + public static extern global::System.IntPtr ItemRange_Intersection(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_begin_set")] + public static extern void ItemRange_begin_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_begin_get")] + public static extern uint ItemRange_begin_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_end_set")] + public static extern void ItemRange_end_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemRange_end_get")] + public static extern uint ItemRange_end_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemRange")] + public static extern void delete_ItemRange(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemLayout")] + public static extern void delete_ItemLayout(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_SetOrientation")] + public static extern void ItemLayout_SetOrientation(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetOrientation")] + public static extern int ItemLayout_GetOrientation(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_SetLayoutProperties")] + public static extern void ItemLayout_SetLayoutProperties(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetLayoutProperties")] + public static extern global::System.IntPtr ItemLayout_GetLayoutProperties(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetItemSize")] + public static extern void ItemLayout_GetItemSize(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_SetItemSize")] + public static extern void ItemLayout_SetItemSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetMinimumLayoutPosition")] + public static extern float ItemLayout_GetMinimumLayoutPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetClosestAnchorPosition")] + public static extern float ItemLayout_GetClosestAnchorPosition(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetItemScrollToPosition")] + public static extern float ItemLayout_GetItemScrollToPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetItemsWithinArea")] + public static extern global::System.IntPtr ItemLayout_GetItemsWithinArea(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetClosestOnScreenLayoutPosition")] + public static extern float ItemLayout_GetClosestOnScreenLayoutPosition(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, float jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetReserveItemCount")] + public static extern uint ItemLayout_GetReserveItemCount(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetDefaultItemSize")] + public static extern void ItemLayout_GetDefaultItemSize(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetScrollDirection")] + public static extern global::System.IntPtr ItemLayout_GetScrollDirection(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetScrollSpeedFactor")] + public static extern float ItemLayout_GetScrollSpeedFactor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetMaximumSwipeSpeed")] + public static extern float ItemLayout_GetMaximumSwipeSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetItemFlickAnimationDuration")] + public static extern float ItemLayout_GetItemFlickAnimationDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetNextFocusItemID")] + public static extern int ItemLayout_GetNextFocusItemID(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetFlickSpeedFactor")] + public static extern float ItemLayout_GetFlickSpeedFactor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_ApplyConstraints")] + public static extern void ItemLayout_ApplyConstraints(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_GetItemPosition")] + public static extern global::System.IntPtr ItemLayout_GetItemPosition(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, float jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NewItemLayout")] + public static extern global::System.IntPtr NewItemLayout(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemFactory")] + public static extern void delete_ItemFactory(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemFactory_GetNumberOfItems")] + public static extern uint ItemFactory_GetNumberOfItems(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemFactory_NewItem")] + public static extern global::System.IntPtr ItemFactory_NewItem(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemFactory_ItemReleased")] + public static extern void ItemFactory_ItemReleased(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemFactory_ItemReleasedSwigExplicitItemFactory")] + public static extern void ItemFactory_ItemReleasedSwigExplicitItemFactory(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemFactory")] + public static extern global::System.IntPtr new_ItemFactory(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemFactory_director_connect")] + public static extern void ItemFactory_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, ItemFactory.SwigDelegateItemFactory_0 delegate0, ItemFactory.SwigDelegateItemFactory_1 delegate1, ItemFactory.SwigDelegateItemFactory_2 delegate2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_MINIMUM_SWIPE_SPEED_get")] + public static extern int ItemView_Property_MINIMUM_SWIPE_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_MINIMUM_SWIPE_DISTANCE_get")] + public static extern int ItemView_Property_MINIMUM_SWIPE_DISTANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_WHEEL_SCROLL_DISTANCE_STEP_get")] + public static extern int ItemView_Property_WHEEL_SCROLL_DISTANCE_STEP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_SNAP_TO_ITEM_ENABLED_get")] + public static extern int ItemView_Property_SNAP_TO_ITEM_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_REFRESH_INTERVAL_get")] + public static extern int ItemView_Property_REFRESH_INTERVAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_LAYOUT_POSITION_get")] + public static extern int ItemView_Property_LAYOUT_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_SCROLL_SPEED_get")] + public static extern int ItemView_Property_SCROLL_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_OVERSHOOT_get")] + public static extern int ItemView_Property_OVERSHOOT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_SCROLL_DIRECTION_get")] + public static extern int ItemView_Property_SCROLL_DIRECTION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_LAYOUT_ORIENTATION_get")] + public static extern int ItemView_Property_LAYOUT_ORIENTATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Property_SCROLL_CONTENT_SIZE_get")] + public static extern int ItemView_Property_SCROLL_CONTENT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemView_Property")] + public static extern global::System.IntPtr new_ItemView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemView_Property")] + public static extern void delete_ItemView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemView__SWIG_0")] + public static extern global::System.IntPtr new_ItemView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemView__SWIG_1")] + public static extern global::System.IntPtr new_ItemView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Assign")] + public static extern global::System.IntPtr ItemView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemView")] + public static extern void delete_ItemView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_New")] + public static extern global::System.IntPtr ItemView_New(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_DownCast")] + public static extern global::System.IntPtr ItemView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetLayoutCount")] + public static extern uint ItemView_GetLayoutCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_AddLayout")] + public static extern void ItemView_AddLayout(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_RemoveLayout")] + public static extern void ItemView_RemoveLayout(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetLayout")] + public static extern global::System.IntPtr ItemView_GetLayout(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetActiveLayout")] + public static extern global::System.IntPtr ItemView_GetActiveLayout(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetCurrentLayoutPosition")] + public static extern float ItemView_GetCurrentLayoutPosition(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_ActivateLayout")] + public static extern void ItemView_ActivateLayout(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_DeactivateCurrentLayout")] + public static extern void ItemView_DeactivateCurrentLayout(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetMinimumSwipeSpeed")] + public static extern void ItemView_SetMinimumSwipeSpeed(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetMinimumSwipeSpeed")] + public static extern float ItemView_GetMinimumSwipeSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetMinimumSwipeDistance")] + public static extern void ItemView_SetMinimumSwipeDistance(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetMinimumSwipeDistance")] + public static extern float ItemView_GetMinimumSwipeDistance(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetWheelScrollDistanceStep")] + public static extern void ItemView_SetWheelScrollDistanceStep(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetWheelScrollDistanceStep")] + public static extern float ItemView_GetWheelScrollDistanceStep(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetAnchoring")] + public static extern void ItemView_SetAnchoring(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetAnchoring")] + public static extern bool ItemView_GetAnchoring(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetAnchoringDuration")] + public static extern void ItemView_SetAnchoringDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetAnchoringDuration")] + public static extern float ItemView_GetAnchoringDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_ScrollToItem")] + public static extern void ItemView_ScrollToItem(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetRefreshInterval")] + public static extern void ItemView_SetRefreshInterval(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetRefreshInterval")] + public static extern float ItemView_GetRefreshInterval(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_Refresh")] + public static extern void ItemView_Refresh(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetItem")] + public static extern global::System.IntPtr ItemView_GetItem(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetItemId")] + public static extern uint ItemView_GetItemId(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_InsertItem")] + public static extern void ItemView_InsertItem(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_InsertItems")] + public static extern void ItemView_InsertItems(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_RemoveItem")] + public static extern void ItemView_RemoveItem(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_RemoveItems")] + public static extern void ItemView_RemoveItems(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_ReplaceItem")] + public static extern void ItemView_ReplaceItem(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_ReplaceItems")] + public static extern void ItemView_ReplaceItems(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetItemsParentOrigin")] + public static extern void ItemView_SetItemsParentOrigin(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetItemsParentOrigin")] + public static extern global::System.IntPtr ItemView_GetItemsParentOrigin(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SetItemsAnchorPoint")] + public static extern void ItemView_SetItemsAnchorPoint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetItemsAnchorPoint")] + public static extern global::System.IntPtr ItemView_GetItemsAnchorPoint(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_GetItemsRange")] + public static extern void ItemView_GetItemsRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_LayoutActivatedSignal")] + public static extern global::System.IntPtr ItemView_LayoutActivatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_MoveActorConstraint")] + public static extern void MoveActorConstraint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_WrapActorConstraint")] + public static extern void WrapActorConstraint(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollViewEffect")] + public static extern global::System.IntPtr new_ScrollViewEffect(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollViewEffect")] + public static extern void delete_ScrollViewEffect(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewPagePathEffect_New")] + public static extern global::System.IntPtr ScrollViewPagePathEffect_New(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, uint jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollViewPagePathEffect")] + public static extern global::System.IntPtr new_ScrollViewPagePathEffect(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewPagePathEffect_DownCast")] + public static extern global::System.IntPtr ScrollViewPagePathEffect_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewPagePathEffect_ApplyToPage")] + public static extern void ScrollViewPagePathEffect_ApplyToPage(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollViewPagePathEffect")] + public static extern void delete_ScrollViewPagePathEffect(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ClampState2D_x_set")] + public static extern void ClampState2D_x_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ClampState2D_x_get")] + public static extern int ClampState2D_x_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ClampState2D_y_set")] + public static extern void ClampState2D_y_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ClampState2D_y_get")] + public static extern int ClampState2D_y_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ClampState2D")] + public static extern global::System.IntPtr new_ClampState2D(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ClampState2D")] + public static extern void delete_ClampState2D(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RulerDomain__SWIG_0")] + public static extern global::System.IntPtr new_RulerDomain__SWIG_0(float jarg1, float jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RulerDomain__SWIG_1")] + public static extern global::System.IntPtr new_RulerDomain__SWIG_1(float jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_min_set")] + public static extern void RulerDomain_min_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_min_get")] + public static extern float RulerDomain_min_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_max_set")] + public static extern void RulerDomain_max_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_max_get")] + public static extern float RulerDomain_max_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_enabled_set")] + public static extern void RulerDomain_enabled_set(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_enabled_get")] + public static extern bool RulerDomain_enabled_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_Clamp__SWIG_0")] + public static extern float RulerDomain_Clamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_Clamp__SWIG_1")] + public static extern float RulerDomain_Clamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_Clamp__SWIG_2")] + public static extern float RulerDomain_Clamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_Clamp__SWIG_3")] + public static extern float RulerDomain_Clamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerDomain_GetSize")] + public static extern float RulerDomain_GetSize(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RulerDomain")] + public static extern void delete_RulerDomain(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Snap__SWIG_0")] + public static extern float Ruler_Snap__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Snap__SWIG_1")] + public static extern float Ruler_Snap__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_GetPositionFromPage")] + public static extern float Ruler_GetPositionFromPage(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, out uint jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_GetPageFromPosition")] + public static extern uint Ruler_GetPageFromPosition(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_GetTotalPages")] + public static extern uint Ruler_GetTotalPages(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_GetType")] + public static extern int Ruler_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_IsEnabled")] + public static extern bool Ruler_IsEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Enable")] + public static extern void Ruler_Enable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Disable")] + public static extern void Ruler_Disable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SetDomain")] + public static extern void Ruler_SetDomain(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_GetDomain")] + public static extern global::System.IntPtr Ruler_GetDomain(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_DisableDomain")] + public static extern void Ruler_DisableDomain(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Clamp__SWIG_0")] + public static extern float Ruler_Clamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Clamp__SWIG_1")] + public static extern float Ruler_Clamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Clamp__SWIG_2")] + public static extern float Ruler_Clamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_Clamp__SWIG_3")] + public static extern float Ruler_Clamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SnapAndClamp__SWIG_0")] + public static extern float Ruler_SnapAndClamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SnapAndClamp__SWIG_1")] + public static extern float Ruler_SnapAndClamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SnapAndClamp__SWIG_2")] + public static extern float Ruler_SnapAndClamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SnapAndClamp__SWIG_3")] + public static extern float Ruler_SnapAndClamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SnapAndClamp__SWIG_4")] + public static extern float Ruler_SnapAndClamp__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_DefaultRuler")] + public static extern global::System.IntPtr new_DefaultRuler(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DefaultRuler_Snap")] + public static extern float DefaultRuler_Snap(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DefaultRuler_GetPositionFromPage")] + public static extern float DefaultRuler_GetPositionFromPage(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, out uint jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DefaultRuler_GetPageFromPosition")] + public static extern uint DefaultRuler_GetPageFromPosition(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DefaultRuler_GetTotalPages")] + public static extern uint DefaultRuler_GetTotalPages(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_DefaultRuler")] + public static extern void delete_DefaultRuler(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FixedRuler__SWIG_0")] + public static extern global::System.IntPtr new_FixedRuler__SWIG_0(float jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FixedRuler__SWIG_1")] + public static extern global::System.IntPtr new_FixedRuler__SWIG_1(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FixedRuler_Snap")] + public static extern float FixedRuler_Snap(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FixedRuler_GetPositionFromPage")] + public static extern float FixedRuler_GetPositionFromPage(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, out uint jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FixedRuler_GetPageFromPosition")] + public static extern uint FixedRuler_GetPageFromPosition(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FixedRuler_GetTotalPages")] + public static extern uint FixedRuler_GetTotalPages(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FixedRuler")] + public static extern void delete_FixedRuler(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_scale_set")] + public static extern void ScrollView_ClampEvent_scale_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_scale_get")] + public static extern global::System.IntPtr ScrollView_ClampEvent_scale_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_position_set")] + public static extern void ScrollView_ClampEvent_position_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_position_get")] + public static extern global::System.IntPtr ScrollView_ClampEvent_position_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_rotation_set")] + public static extern void ScrollView_ClampEvent_rotation_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ClampEvent_rotation_get")] + public static extern int ScrollView_ClampEvent_rotation_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollView_ClampEvent")] + public static extern global::System.IntPtr new_ScrollView_ClampEvent(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollView_ClampEvent")] + public static extern void delete_ScrollView_ClampEvent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_type_set")] + public static extern void ScrollView_SnapEvent_type_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_type_get")] + public static extern int ScrollView_SnapEvent_type_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_position_set")] + public static extern void ScrollView_SnapEvent_position_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_position_get")] + public static extern global::System.IntPtr ScrollView_SnapEvent_position_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_duration_set")] + public static extern void ScrollView_SnapEvent_duration_set(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapEvent_duration_get")] + public static extern float ScrollView_SnapEvent_duration_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollView_SnapEvent")] + public static extern global::System.IntPtr new_ScrollView_SnapEvent(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollView_SnapEvent")] + public static extern void delete_ScrollView_SnapEvent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_WRAP_ENABLED_get")] + public static extern int ScrollView_Property_WRAP_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_PANNING_ENABLED_get")] + public static extern int ScrollView_Property_PANNING_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_AXIS_AUTO_LOCK_ENABLED_get")] + public static extern int ScrollView_Property_AXIS_AUTO_LOCK_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_WHEEL_SCROLL_DISTANCE_STEP_get")] + public static extern int ScrollView_Property_WHEEL_SCROLL_DISTANCE_STEP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_MODE_get")] + public static extern int ScrollView_Property_SCROLL_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_POSITION_get")] + public static extern int ScrollView_Property_SCROLL_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_X_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_Y_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_MAX_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_MAX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_MAX_X_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_MAX_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_PRE_POSITION_MAX_Y_get")] + public static extern int ScrollView_Property_SCROLL_PRE_POSITION_MAX_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_OVERSHOOT_X_get")] + public static extern int ScrollView_Property_OVERSHOOT_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_OVERSHOOT_Y_get")] + public static extern int ScrollView_Property_OVERSHOOT_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_FINAL_get")] + public static extern int ScrollView_Property_SCROLL_FINAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_FINAL_X_get")] + public static extern int ScrollView_Property_SCROLL_FINAL_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_FINAL_Y_get")] + public static extern int ScrollView_Property_SCROLL_FINAL_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_WRAP_get")] + public static extern int ScrollView_Property_WRAP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_PANNING_get")] + public static extern int ScrollView_Property_PANNING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLLING_get")] + public static extern int ScrollView_Property_SCROLLING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_DOMAIN_SIZE_get")] + public static extern int ScrollView_Property_SCROLL_DOMAIN_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_DOMAIN_SIZE_X_get")] + public static extern int ScrollView_Property_SCROLL_DOMAIN_SIZE_X_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_DOMAIN_SIZE_Y_get")] + public static extern int ScrollView_Property_SCROLL_DOMAIN_SIZE_Y_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_DOMAIN_OFFSET_get")] + public static extern int ScrollView_Property_SCROLL_DOMAIN_OFFSET_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_SCROLL_POSITION_DELTA_get")] + public static extern int ScrollView_Property_SCROLL_POSITION_DELTA_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Property_START_PAGE_POSITION_get")] + public static extern int ScrollView_Property_START_PAGE_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollView_Property")] + public static extern global::System.IntPtr new_ScrollView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollView_Property")] + public static extern void delete_ScrollView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollView__SWIG_0")] + public static extern global::System.IntPtr new_ScrollView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollView__SWIG_1")] + public static extern global::System.IntPtr new_ScrollView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_Assign")] + public static extern global::System.IntPtr ScrollView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollView")] + public static extern void delete_ScrollView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_New")] + public static extern global::System.IntPtr ScrollView_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_DownCast")] + public static extern global::System.IntPtr ScrollView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetScrollSnapAlphaFunction")] + public static extern global::System.IntPtr ScrollView_GetScrollSnapAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollSnapAlphaFunction")] + public static extern void ScrollView_SetScrollSnapAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetScrollFlickAlphaFunction")] + public static extern global::System.IntPtr ScrollView_GetScrollFlickAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollFlickAlphaFunction")] + public static extern void ScrollView_SetScrollFlickAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetScrollSnapDuration")] + public static extern float ScrollView_GetScrollSnapDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollSnapDuration")] + public static extern void ScrollView_SetScrollSnapDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetScrollFlickDuration")] + public static extern float ScrollView_GetScrollFlickDuration(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollFlickDuration")] + public static extern void ScrollView_SetScrollFlickDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetRulerX")] + public static extern void ScrollView_SetRulerX(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetRulerY")] + public static extern void ScrollView_SetRulerY(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollSensitive")] + public static extern void ScrollView_SetScrollSensitive(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetMaxOvershoot")] + public static extern void ScrollView_SetMaxOvershoot(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetSnapOvershootAlphaFunction")] + public static extern void ScrollView_SetSnapOvershootAlphaFunction(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetSnapOvershootDuration")] + public static extern void ScrollView_SetSnapOvershootDuration(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetActorAutoSnap")] + public static extern void ScrollView_SetActorAutoSnap(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetWrapMode")] + public static extern void ScrollView_SetWrapMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetScrollUpdateDistance")] + public static extern int ScrollView_GetScrollUpdateDistance(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollUpdateDistance")] + public static extern void ScrollView_SetScrollUpdateDistance(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetAxisAutoLock")] + public static extern bool ScrollView_GetAxisAutoLock(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetAxisAutoLock")] + public static extern void ScrollView_SetAxisAutoLock(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetAxisAutoLockGradient")] + public static extern float ScrollView_GetAxisAutoLockGradient(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetAxisAutoLockGradient")] + public static extern void ScrollView_SetAxisAutoLockGradient(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetFrictionCoefficient")] + public static extern float ScrollView_GetFrictionCoefficient(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetFrictionCoefficient")] + public static extern void ScrollView_SetFrictionCoefficient(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetFlickSpeedCoefficient")] + public static extern float ScrollView_GetFlickSpeedCoefficient(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetFlickSpeedCoefficient")] + public static extern void ScrollView_SetFlickSpeedCoefficient(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetMinimumDistanceForFlick")] + public static extern global::System.IntPtr ScrollView_GetMinimumDistanceForFlick(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetMinimumDistanceForFlick")] + public static extern void ScrollView_SetMinimumDistanceForFlick(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetMinimumSpeedForFlick")] + public static extern float ScrollView_GetMinimumSpeedForFlick(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetMinimumSpeedForFlick")] + public static extern void ScrollView_SetMinimumSpeedForFlick(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetMaxFlickSpeed")] + public static extern float ScrollView_GetMaxFlickSpeed(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetMaxFlickSpeed")] + public static extern void ScrollView_SetMaxFlickSpeed(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetWheelScrollDistanceStep")] + public static extern global::System.IntPtr ScrollView_GetWheelScrollDistanceStep(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetWheelScrollDistanceStep")] + public static extern void ScrollView_SetWheelScrollDistanceStep(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetCurrentScrollPosition")] + public static extern global::System.IntPtr ScrollView_GetCurrentScrollPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_GetCurrentPage")] + public static extern uint ScrollView_GetCurrentPage(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_0")] + public static extern void ScrollView_ScrollTo__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_1")] + public static extern void ScrollView_ScrollTo__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_2")] + public static extern void ScrollView_ScrollTo__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_3")] + public static extern void ScrollView_ScrollTo__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, int jarg4, int jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_4")] + public static extern void ScrollView_ScrollTo__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, global::System.Runtime.InteropServices.HandleRef jarg4, int jarg5, int jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_5")] + public static extern void ScrollView_ScrollTo__SWIG_5(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_6")] + public static extern void ScrollView_ScrollTo__SWIG_6(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_7")] + public static extern void ScrollView_ScrollTo__SWIG_7(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_8")] + public static extern void ScrollView_ScrollTo__SWIG_8(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollTo__SWIG_9")] + public static extern void ScrollView_ScrollTo__SWIG_9(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ScrollToSnapPoint")] + public static extern bool ScrollView_ScrollToSnapPoint(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ApplyConstraintToChildren")] + public static extern void ScrollView_ApplyConstraintToChildren(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_RemoveConstraintsFromChildren")] + public static extern void ScrollView_RemoveConstraintsFromChildren(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_ApplyEffect")] + public static extern void ScrollView_ApplyEffect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_RemoveEffect")] + public static extern void ScrollView_RemoveEffect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_RemoveAllEffects")] + public static extern void ScrollView_RemoveAllEffects(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_BindActor")] + public static extern void ScrollView_BindActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_UnbindActor")] + public static extern void ScrollView_UnbindActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollingDirection__SWIG_0")] + public static extern void ScrollView_SetScrollingDirection__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SetScrollingDirection__SWIG_1")] + public static extern void ScrollView_SetScrollingDirection__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_RemoveScrollingDirection")] + public static extern void ScrollView_RemoveScrollingDirection(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SnapStartedSignal")] + public static extern global::System.IntPtr ScrollView_SnapStartedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Property_ROWS_get")] + public static extern int TableView_Property_ROWS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Property_COLUMNS_get")] + public static extern int TableView_Property_COLUMNS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Property_CELL_PADDING_get")] + public static extern int TableView_Property_CELL_PADDING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Property_LAYOUT_ROWS_get")] + public static extern int TableView_Property_LAYOUT_ROWS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Property_LAYOUT_COLUMNS_get")] + public static extern int TableView_Property_LAYOUT_COLUMNS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_Property")] + public static extern global::System.IntPtr new_TableView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TableView_Property")] + public static extern void delete_TableView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_ChildProperty_CELL_INDEX_get")] + public static extern int TableView_ChildProperty_CELL_INDEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_ChildProperty_ROW_SPAN_get")] + public static extern int TableView_ChildProperty_ROW_SPAN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_ChildProperty_COLUMN_SPAN_get")] + public static extern int TableView_ChildProperty_COLUMN_SPAN_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_ChildProperty_CELL_HORIZONTAL_ALIGNMENT_get")] + public static extern int TableView_ChildProperty_CELL_HORIZONTAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_ChildProperty_CELL_VERTICAL_ALIGNMENT_get")] + public static extern int TableView_ChildProperty_CELL_VERTICAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_ChildProperty")] + public static extern global::System.IntPtr new_TableView_ChildProperty(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TableView_ChildProperty")] + public static extern void delete_TableView_ChildProperty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_CellPosition__SWIG_0")] + public static extern global::System.IntPtr new_TableView_CellPosition__SWIG_0(uint jarg1, uint jarg2, uint jarg3, uint jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_CellPosition__SWIG_1")] + public static extern global::System.IntPtr new_TableView_CellPosition__SWIG_1(uint jarg1, uint jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_CellPosition__SWIG_2")] + public static extern global::System.IntPtr new_TableView_CellPosition__SWIG_2(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_CellPosition__SWIG_3")] + public static extern global::System.IntPtr new_TableView_CellPosition__SWIG_3(uint jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView_CellPosition__SWIG_4")] + public static extern global::System.IntPtr new_TableView_CellPosition__SWIG_4(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_rowIndex_set")] + public static extern void TableView_CellPosition_rowIndex_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_rowIndex_get")] + public static extern uint TableView_CellPosition_rowIndex_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_columnIndex_set")] + public static extern void TableView_CellPosition_columnIndex_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_columnIndex_get")] + public static extern uint TableView_CellPosition_columnIndex_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_rowSpan_set")] + public static extern void TableView_CellPosition_rowSpan_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_rowSpan_get")] + public static extern uint TableView_CellPosition_rowSpan_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_columnSpan_set")] + public static extern void TableView_CellPosition_columnSpan_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_CellPosition_columnSpan_get")] + public static extern uint TableView_CellPosition_columnSpan_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TableView_CellPosition")] + public static extern void delete_TableView_CellPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView__SWIG_0")] + public static extern global::System.IntPtr new_TableView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TableView__SWIG_1")] + public static extern global::System.IntPtr new_TableView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Assign")] + public static extern global::System.IntPtr TableView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TableView")] + public static extern void delete_TableView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_New")] + public static extern global::System.IntPtr TableView_New(uint jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_DownCast")] + public static extern global::System.IntPtr TableView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_AddChild")] + public static extern bool TableView_AddChild(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetChildAt")] + public static extern global::System.IntPtr TableView_GetChildAt(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_RemoveChildAt")] + public static extern global::System.IntPtr TableView_RemoveChildAt(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_FindChildPosition")] + public static extern bool TableView_FindChildPosition(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_InsertRow")] + public static extern void TableView_InsertRow(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_DeleteRow__SWIG_0")] + public static extern void TableView_DeleteRow__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_DeleteRow__SWIG_1")] + public static extern void TableView_DeleteRow__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_InsertColumn")] + public static extern void TableView_InsertColumn(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_DeleteColumn__SWIG_0")] + public static extern void TableView_DeleteColumn__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_DeleteColumn__SWIG_1")] + public static extern void TableView_DeleteColumn__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Resize__SWIG_0")] + public static extern void TableView_Resize__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_Resize__SWIG_1")] + public static extern void TableView_Resize__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, uint jarg3, global::System.Runtime.InteropServices.HandleRef jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetCellPadding")] + public static extern void TableView_SetCellPadding(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetCellPadding")] + public static extern global::System.IntPtr TableView_GetCellPadding(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetFitHeight")] + public static extern void TableView_SetFitHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_IsFitHeight")] + public static extern bool TableView_IsFitHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetFitWidth")] + public static extern void TableView_SetFitWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_IsFitWidth")] + public static extern bool TableView_IsFitWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetFixedHeight")] + public static extern void TableView_SetFixedHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetFixedHeight")] + public static extern float TableView_GetFixedHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetRelativeHeight")] + public static extern void TableView_SetRelativeHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetRelativeHeight")] + public static extern float TableView_GetRelativeHeight(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetFixedWidth")] + public static extern void TableView_SetFixedWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetFixedWidth")] + public static extern float TableView_GetFixedWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetRelativeWidth")] + public static extern void TableView_SetRelativeWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetRelativeWidth")] + public static extern float TableView_GetRelativeWidth(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetRows")] + public static extern uint TableView_GetRows(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_GetColumns")] + public static extern uint TableView_GetColumns(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SetCellAlignment")] + public static extern void TableView_SetCellAlignment(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DEFAULT_RENDERING_BACKEND_get")] + public static extern uint DEFAULT_RENDERING_BACKEND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_RENDERING_BACKEND_get")] + public static extern int TextEditor_Property_RENDERING_BACKEND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_TEXT_get")] + public static extern int TextEditor_Property_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_TEXT_COLOR_get")] + public static extern int TextEditor_Property_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_FONT_FAMILY_get")] + public static extern int TextEditor_Property_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_FONT_STYLE_get")] + public static extern int TextEditor_Property_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_POINT_SIZE_get")] + public static extern int TextEditor_Property_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_HORIZONTAL_ALIGNMENT_get")] + public static extern int TextEditor_Property_HORIZONTAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SCROLL_THRESHOLD_get")] + public static extern int TextEditor_Property_SCROLL_THRESHOLD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SCROLL_SPEED_get")] + public static extern int TextEditor_Property_SCROLL_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_PRIMARY_CURSOR_COLOR_get")] + public static extern int TextEditor_Property_PRIMARY_CURSOR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SECONDARY_CURSOR_COLOR_get")] + public static extern int TextEditor_Property_SECONDARY_CURSOR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_ENABLE_CURSOR_BLINK_get")] + public static extern int TextEditor_Property_ENABLE_CURSOR_BLINK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_CURSOR_BLINK_INTERVAL_get")] + public static extern int TextEditor_Property_CURSOR_BLINK_INTERVAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_CURSOR_BLINK_DURATION_get")] + public static extern int TextEditor_Property_CURSOR_BLINK_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_CURSOR_WIDTH_get")] + public static extern int TextEditor_Property_CURSOR_WIDTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_GRAB_HANDLE_IMAGE_get")] + public static extern int TextEditor_Property_GRAB_HANDLE_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_GRAB_HANDLE_PRESSED_IMAGE_get")] + public static extern int TextEditor_Property_GRAB_HANDLE_PRESSED_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_IMAGE_LEFT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_IMAGE_RIGHT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get")] + public static extern int TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SELECTION_HIGHLIGHT_COLOR_get")] + public static extern int TextEditor_Property_SELECTION_HIGHLIGHT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_DECORATION_BOUNDING_BOX_get")] + public static extern int TextEditor_Property_DECORATION_BOUNDING_BOX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_ENABLE_MARKUP_get")] + public static extern int TextEditor_Property_ENABLE_MARKUP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_COLOR_get")] + public static extern int TextEditor_Property_INPUT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_FONT_FAMILY_get")] + public static extern int TextEditor_Property_INPUT_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_FONT_STYLE_get")] + public static extern int TextEditor_Property_INPUT_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_POINT_SIZE_get")] + public static extern int TextEditor_Property_INPUT_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_LINE_SPACING_get")] + public static extern int TextEditor_Property_LINE_SPACING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_LINE_SPACING_get")] + public static extern int TextEditor_Property_INPUT_LINE_SPACING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_UNDERLINE_get")] + public static extern int TextEditor_Property_UNDERLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_UNDERLINE_get")] + public static extern int TextEditor_Property_INPUT_UNDERLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_SHADOW_get")] + public static extern int TextEditor_Property_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_SHADOW_get")] + public static extern int TextEditor_Property_INPUT_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_EMBOSS_get")] + public static extern int TextEditor_Property_EMBOSS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_EMBOSS_get")] + public static extern int TextEditor_Property_INPUT_EMBOSS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_OUTLINE_get")] + public static extern int TextEditor_Property_OUTLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Property_INPUT_OUTLINE_get")] + public static extern int TextEditor_Property_INPUT_OUTLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextEditor_Property")] + public static extern global::System.IntPtr new_TextEditor_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextEditor_Property")] + public static extern void delete_TextEditor_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextEditor_InputStyle")] + public static extern global::System.IntPtr new_TextEditor_InputStyle(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextEditor_InputStyle")] + public static extern void delete_TextEditor_InputStyle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_New")] + public static extern global::System.IntPtr TextEditor_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextEditor__SWIG_0")] + public static extern global::System.IntPtr new_TextEditor__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextEditor__SWIG_1")] + public static extern global::System.IntPtr new_TextEditor__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_Assign")] + public static extern global::System.IntPtr TextEditor_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextEditor")] + public static extern void delete_TextEditor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_DownCast")] + public static extern global::System.IntPtr TextEditor_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_TextChangedSignal")] + public static extern global::System.IntPtr TextEditor_TextChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_InputStyleChangedSignal")] + public static extern global::System.IntPtr TextEditor_InputStyleChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_RENDERING_BACKEND_get")] + public static extern int TextField_Property_RENDERING_BACKEND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_TEXT_get")] + public static extern int TextField_Property_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_PLACEHOLDER_TEXT_get")] + public static extern int TextField_Property_PLACEHOLDER_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get")] + public static extern int TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_FONT_FAMILY_get")] + public static extern int TextField_Property_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_FONT_STYLE_get")] + public static extern int TextField_Property_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_POINT_SIZE_get")] + public static extern int TextField_Property_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_MAX_LENGTH_get")] + public static extern int TextField_Property_MAX_LENGTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_EXCEED_POLICY_get")] + public static extern int TextField_Property_EXCEED_POLICY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_HORIZONTAL_ALIGNMENT_get")] + public static extern int TextField_Property_HORIZONTAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_VERTICAL_ALIGNMENT_get")] + public static extern int TextField_Property_VERTICAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_TEXT_COLOR_get")] + public static extern int TextField_Property_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_PLACEHOLDER_TEXT_COLOR_get")] + public static extern int TextField_Property_PLACEHOLDER_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SHADOW_OFFSET_get")] + public static extern int TextField_Property_SHADOW_OFFSET_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SHADOW_COLOR_get")] + public static extern int TextField_Property_SHADOW_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_PRIMARY_CURSOR_COLOR_get")] + public static extern int TextField_Property_PRIMARY_CURSOR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SECONDARY_CURSOR_COLOR_get")] + public static extern int TextField_Property_SECONDARY_CURSOR_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_ENABLE_CURSOR_BLINK_get")] + public static extern int TextField_Property_ENABLE_CURSOR_BLINK_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_CURSOR_BLINK_INTERVAL_get")] + public static extern int TextField_Property_CURSOR_BLINK_INTERVAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_CURSOR_BLINK_DURATION_get")] + public static extern int TextField_Property_CURSOR_BLINK_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_CURSOR_WIDTH_get")] + public static extern int TextField_Property_CURSOR_WIDTH_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_GRAB_HANDLE_IMAGE_get")] + public static extern int TextField_Property_GRAB_HANDLE_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get")] + public static extern int TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SCROLL_THRESHOLD_get")] + public static extern int TextField_Property_SCROLL_THRESHOLD_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SCROLL_SPEED_get")] + public static extern int TextField_Property_SCROLL_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get")] + public static extern int TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SELECTION_HIGHLIGHT_COLOR_get")] + public static extern int TextField_Property_SELECTION_HIGHLIGHT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_DECORATION_BOUNDING_BOX_get")] + public static extern int TextField_Property_DECORATION_BOUNDING_BOX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_METHOD_SETTINGS_get")] + public static extern int TextField_Property_INPUT_METHOD_SETTINGS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_COLOR_get")] + public static extern int TextField_Property_INPUT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_ENABLE_MARKUP_get")] + public static extern int TextField_Property_ENABLE_MARKUP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_FONT_FAMILY_get")] + public static extern int TextField_Property_INPUT_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_FONT_STYLE_get")] + public static extern int TextField_Property_INPUT_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_POINT_SIZE_get")] + public static extern int TextField_Property_INPUT_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_UNDERLINE_get")] + public static extern int TextField_Property_UNDERLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_UNDERLINE_get")] + public static extern int TextField_Property_INPUT_UNDERLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_SHADOW_get")] + public static extern int TextField_Property_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_SHADOW_get")] + public static extern int TextField_Property_INPUT_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_EMBOSS_get")] + public static extern int TextField_Property_EMBOSS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_EMBOSS_get")] + public static extern int TextField_Property_INPUT_EMBOSS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_OUTLINE_get")] + public static extern int TextField_Property_OUTLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Property_INPUT_OUTLINE_get")] + public static extern int TextField_Property_INPUT_OUTLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextField_Property")] + public static extern global::System.IntPtr new_TextField_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextField_Property")] + public static extern void delete_TextField_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextField_InputStyle")] + public static extern global::System.IntPtr new_TextField_InputStyle(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextField_InputStyle")] + public static extern void delete_TextField_InputStyle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_New")] + public static extern global::System.IntPtr TextField_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextField__SWIG_0")] + public static extern global::System.IntPtr new_TextField__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextField__SWIG_1")] + public static extern global::System.IntPtr new_TextField__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_Assign")] + public static extern global::System.IntPtr TextField_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextField")] + public static extern void delete_TextField(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_DownCast")] + public static extern global::System.IntPtr TextField_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_TextChangedSignal")] + public static extern global::System.IntPtr TextField_TextChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_MaxLengthReachedSignal")] + public static extern global::System.IntPtr TextField_MaxLengthReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_InputStyleChangedSignal")] + public static extern global::System.IntPtr TextField_InputStyleChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_RENDERING_BACKEND_get")] + public static extern int TextLabel_Property_RENDERING_BACKEND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_TEXT_get")] + public static extern int TextLabel_Property_TEXT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_FONT_FAMILY_get")] + public static extern int TextLabel_Property_FONT_FAMILY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_FONT_STYLE_get")] + public static extern int TextLabel_Property_FONT_STYLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_POINT_SIZE_get")] + public static extern int TextLabel_Property_POINT_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_MULTI_LINE_get")] + public static extern int TextLabel_Property_MULTI_LINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_HORIZONTAL_ALIGNMENT_get")] + public static extern int TextLabel_Property_HORIZONTAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_VERTICAL_ALIGNMENT_get")] + public static extern int TextLabel_Property_VERTICAL_ALIGNMENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_TEXT_COLOR_get")] + public static extern int TextLabel_Property_TEXT_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_TEXT_COLOR_ANIMATABLE_get")] + public static extern int TextLabel_Property_TEXT_COLOR_ANIMATABLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_SHADOW_OFFSET_get")] + public static extern int TextLabel_Property_SHADOW_OFFSET_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_SHADOW_COLOR_get")] + public static extern int TextLabel_Property_SHADOW_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_UNDERLINE_ENABLED_get")] + public static extern int TextLabel_Property_UNDERLINE_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_UNDERLINE_COLOR_get")] + public static extern int TextLabel_Property_UNDERLINE_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_UNDERLINE_HEIGHT_get")] + public static extern int TextLabel_Property_UNDERLINE_HEIGHT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_ENABLE_MARKUP_get")] + public static extern int TextLabel_Property_ENABLE_MARKUP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_ENABLE_AUTO_SCROLL_get")] + public static extern int TextLabel_Property_ENABLE_AUTO_SCROLL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_AUTO_SCROLL_SPEED_get")] + public static extern int TextLabel_Property_AUTO_SCROLL_SPEED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get")] + public static extern int TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_AUTO_SCROLL_GAP_get")] + public static extern int TextLabel_Property_AUTO_SCROLL_GAP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_LINE_SPACING_get")] + public static extern int TextLabel_Property_LINE_SPACING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_UNDERLINE_get")] + public static extern int TextLabel_Property_UNDERLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_SHADOW_get")] + public static extern int TextLabel_Property_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_EMBOSS_get")] + public static extern int TextLabel_Property_EMBOSS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Property_OUTLINE_get")] + public static extern int TextLabel_Property_OUTLINE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextLabel_Property")] + public static extern global::System.IntPtr new_TextLabel_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextLabel_Property")] + public static extern void delete_TextLabel_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_New__SWIG_0")] + public static extern global::System.IntPtr TextLabel_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_New__SWIG_1")] + public static extern global::System.IntPtr TextLabel_New__SWIG_1(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextLabel__SWIG_0")] + public static extern global::System.IntPtr new_TextLabel__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextLabel__SWIG_1")] + public static extern global::System.IntPtr new_TextLabel__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_Assign")] + public static extern global::System.IntPtr TextLabel_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextLabel")] + public static extern void delete_TextLabel(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_DownCast")] + public static extern global::System.IntPtr TextLabel_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AccessibilityManager")] + public static extern global::System.IntPtr new_AccessibilityManager(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AccessibilityManager")] + public static extern void delete_AccessibilityManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_Get")] + public static extern global::System.IntPtr AccessibilityManager_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetAccessibilityAttribute")] + public static extern void AccessibilityManager_SetAccessibilityAttribute(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, string jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetAccessibilityAttribute")] + public static extern string AccessibilityManager_GetAccessibilityAttribute(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetFocusOrder")] + public static extern void AccessibilityManager_SetFocusOrder(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetFocusOrder")] + public static extern uint AccessibilityManager_GetFocusOrder(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GenerateNewFocusOrder")] + public static extern uint AccessibilityManager_GenerateNewFocusOrder(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetActorByFocusOrder")] + public static extern global::System.IntPtr AccessibilityManager_GetActorByFocusOrder(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetCurrentFocusActor")] + public static extern bool AccessibilityManager_SetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetCurrentFocusActor")] + public static extern global::System.IntPtr AccessibilityManager_GetCurrentFocusActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetCurrentFocusGroup")] + public static extern global::System.IntPtr AccessibilityManager_GetCurrentFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetCurrentFocusOrder")] + public static extern uint AccessibilityManager_GetCurrentFocusOrder(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_MoveFocusForward")] + public static extern bool AccessibilityManager_MoveFocusForward(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_MoveFocusBackward")] + public static extern bool AccessibilityManager_MoveFocusBackward(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ClearFocus")] + public static extern void AccessibilityManager_ClearFocus(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_Reset")] + public static extern void AccessibilityManager_Reset(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetFocusGroup")] + public static extern void AccessibilityManager_SetFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_IsFocusGroup")] + public static extern bool AccessibilityManager_IsFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetGroupMode")] + public static extern void AccessibilityManager_SetGroupMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetGroupMode")] + public static extern bool AccessibilityManager_GetGroupMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetWrapMode")] + public static extern void AccessibilityManager_SetWrapMode(global::System.Runtime.InteropServices.HandleRef jarg1, bool jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetWrapMode")] + public static extern bool AccessibilityManager_GetWrapMode(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SetFocusIndicatorActor")] + public static extern void AccessibilityManager_SetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetFocusIndicatorActor")] + public static extern global::System.IntPtr AccessibilityManager_GetFocusIndicatorActor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetFocusGroup")] + public static extern global::System.IntPtr AccessibilityManager_GetFocusGroup(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_GetReadPosition")] + public static extern global::System.IntPtr AccessibilityManager_GetReadPosition(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_FocusChangedSignal")] + public static extern global::System.IntPtr AccessibilityManager_FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_FocusOvershotSignal")] + public static extern global::System.IntPtr AccessibilityManager_FocusOvershotSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_FocusedActorActivatedSignal")] + public static extern global::System.IntPtr AccessibilityManager_FocusedActorActivatedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_StatusChangedSignal")] + public static extern global::System.IntPtr AccessibilityManager_StatusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionNextSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionNextSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionPreviousSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionPreviousSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionActivateSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionActivateSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionOverSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionOverSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadNextSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadNextSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadPreviousSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadPreviousSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionUpSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionUpSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionDownSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionDownSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionClearFocusSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionClearFocusSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionBackSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionBackSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionScrollUpSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionScrollUpSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionScrollDownSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionScrollDownSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionPageLeftSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionPageLeftSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionPageRightSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionPageRightSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionPageUpSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionPageUpSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionPageDownSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionPageDownSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionMoveToFirstSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionMoveToFirstSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionMoveToLastSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionMoveToLastSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadFromTopSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadFromTopSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadFromNextSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadFromNextSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionZoomSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionZoomSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadIndicatorInformationSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadIndicatorInformationSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionReadPauseResumeSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionReadPauseResumeSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionStartStopSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionStartStopSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_ActionScrollSignal")] + public static extern global::System.IntPtr AccessibilityManager_ActionScrollSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StyleManager")] + public static extern global::System.IntPtr new_StyleManager(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StyleManager")] + public static extern void delete_StyleManager(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_Get")] + public static extern global::System.IntPtr StyleManager_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_ApplyTheme")] + public static extern void StyleManager_ApplyTheme(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_ApplyDefaultTheme")] + public static extern void StyleManager_ApplyDefaultTheme(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_SetStyleConstant")] + public static extern void StyleManager_SetStyleConstant(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_GetStyleConstant")] + public static extern bool StyleManager_GetStyleConstant(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_ApplyStyle")] + public static extern void StyleManager_ApplyStyle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, string jarg3, string jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_StyleChangedSignal")] + public static extern global::System.IntPtr StyleManager_StyleChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_LOWER_BOUND_get")] + public static extern int Slider_Property_LOWER_BOUND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_UPPER_BOUND_get")] + public static extern int Slider_Property_UPPER_BOUND_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_VALUE_get")] + public static extern int Slider_Property_VALUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_TRACK_VISUAL_get")] + public static extern int Slider_Property_TRACK_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_HANDLE_VISUAL_get")] + public static extern int Slider_Property_HANDLE_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_PROGRESS_VISUAL_get")] + public static extern int Slider_Property_PROGRESS_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_POPUP_VISUAL_get")] + public static extern int Slider_Property_POPUP_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_POPUP_ARROW_VISUAL_get")] + public static extern int Slider_Property_POPUP_ARROW_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_DISABLED_COLOR_get")] + public static extern int Slider_Property_DISABLED_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_VALUE_PRECISION_get")] + public static extern int Slider_Property_VALUE_PRECISION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_SHOW_POPUP_get")] + public static extern int Slider_Property_SHOW_POPUP_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_SHOW_VALUE_get")] + public static extern int Slider_Property_SHOW_VALUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_MARKS_get")] + public static extern int Slider_Property_MARKS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_SNAP_TO_MARKS_get")] + public static extern int Slider_Property_SNAP_TO_MARKS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Property_MARK_TOLERANCE_get")] + public static extern int Slider_Property_MARK_TOLERANCE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Slider_Property")] + public static extern global::System.IntPtr new_Slider_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Slider_Property")] + public static extern void delete_Slider_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_New")] + public static extern global::System.IntPtr Slider_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Slider__SWIG_0")] + public static extern global::System.IntPtr new_Slider__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Slider__SWIG_1")] + public static extern global::System.IntPtr new_Slider__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_Assign")] + public static extern global::System.IntPtr Slider_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Slider")] + public static extern void delete_Slider(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_DownCast")] + public static extern global::System.IntPtr Slider_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_ValueChangedSignal")] + public static extern global::System.IntPtr Slider_ValueChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_SlidingFinishedSignal")] + public static extern global::System.IntPtr Slider_SlidingFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_MarkReachedSignal")] + public static extern global::System.IntPtr Slider_MarkReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Property_VIDEO_get")] + public static extern int VideoView_Property_VIDEO_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Property_LOOPING_get")] + public static extern int VideoView_Property_LOOPING_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Property_MUTED_get")] + public static extern int VideoView_Property_MUTED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Property_VOLUME_get")] + public static extern int VideoView_Property_VOLUME_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VideoView_Property")] + public static extern global::System.IntPtr new_VideoView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VideoView_Property")] + public static extern void delete_VideoView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_New__SWIG_0")] + public static extern global::System.IntPtr VideoView_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_New__SWIG_1")] + public static extern global::System.IntPtr VideoView_New__SWIG_1(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VideoView__SWIG_0")] + public static extern global::System.IntPtr new_VideoView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VideoView")] + public static extern void delete_VideoView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VideoView__SWIG_1")] + public static extern global::System.IntPtr new_VideoView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Assign")] + public static extern global::System.IntPtr VideoView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_DownCast")] + public static extern global::System.IntPtr VideoView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Play")] + public static extern void VideoView_Play(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Pause")] + public static extern void VideoView_Pause(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Stop")] + public static extern void VideoView_Stop(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Forward")] + public static extern void VideoView_Forward(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_Backward")] + public static extern void VideoView_Backward(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_FinishedSignal")] + public static extern global::System.IntPtr VideoView_FinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TITLE_get")] + public static extern int Popup_Property_TITLE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_CONTENT_get")] + public static extern int Popup_Property_CONTENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_FOOTER_get")] + public static extern int Popup_Property_FOOTER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_DISPLAY_STATE_get")] + public static extern int Popup_Property_DISPLAY_STATE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TOUCH_TRANSPARENT_get")] + public static extern int Popup_Property_TOUCH_TRANSPARENT_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_VISIBILITY_get")] + public static extern int Popup_Property_TAIL_VISIBILITY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_POSITION_get")] + public static extern int Popup_Property_TAIL_POSITION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_CONTEXTUAL_MODE_get")] + public static extern int Popup_Property_CONTEXTUAL_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_ANIMATION_DURATION_get")] + public static extern int Popup_Property_ANIMATION_DURATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_ANIMATION_MODE_get")] + public static extern int Popup_Property_ANIMATION_MODE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_ENTRY_ANIMATION_get")] + public static extern int Popup_Property_ENTRY_ANIMATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_EXIT_ANIMATION_get")] + public static extern int Popup_Property_EXIT_ANIMATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_AUTO_HIDE_DELAY_get")] + public static extern int Popup_Property_AUTO_HIDE_DELAY_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_BACKING_ENABLED_get")] + public static extern int Popup_Property_BACKING_ENABLED_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_BACKING_COLOR_get")] + public static extern int Popup_Property_BACKING_COLOR_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_POPUP_BACKGROUND_IMAGE_get")] + public static extern int Popup_Property_POPUP_BACKGROUND_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_POPUP_BACKGROUND_BORDER_get")] + public static extern int Popup_Property_POPUP_BACKGROUND_BORDER_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_UP_IMAGE_get")] + public static extern int Popup_Property_TAIL_UP_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_DOWN_IMAGE_get")] + public static extern int Popup_Property_TAIL_DOWN_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_LEFT_IMAGE_get")] + public static extern int Popup_Property_TAIL_LEFT_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Property_TAIL_RIGHT_IMAGE_get")] + public static extern int Popup_Property_TAIL_RIGHT_IMAGE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Popup_Property")] + public static extern global::System.IntPtr new_Popup_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Popup_Property")] + public static extern void delete_Popup_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Popup__SWIG_0")] + public static extern global::System.IntPtr new_Popup__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_New")] + public static extern global::System.IntPtr Popup_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Popup")] + public static extern void delete_Popup(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Popup__SWIG_1")] + public static extern global::System.IntPtr new_Popup__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_Assign")] + public static extern global::System.IntPtr Popup_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_DownCast")] + public static extern global::System.IntPtr Popup_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_SetTitle")] + public static extern void Popup_SetTitle(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_GetTitle")] + public static extern global::System.IntPtr Popup_GetTitle(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_SetContent")] + public static extern void Popup_SetContent(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_GetContent")] + public static extern global::System.IntPtr Popup_GetContent(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_SetFooter")] + public static extern void Popup_SetFooter(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_GetFooter")] + public static extern global::System.IntPtr Popup_GetFooter(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_SetDisplayState")] + public static extern void Popup_SetDisplayState(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_GetDisplayState")] + public static extern int Popup_GetDisplayState(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_OutsideTouchedSignal")] + public static extern global::System.IntPtr Popup_OutsideTouchedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_ShowingSignal")] + public static extern global::System.IntPtr Popup_ShowingSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_ShownSignal")] + public static extern global::System.IntPtr Popup_ShownSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_HidingSignal")] + public static extern global::System.IntPtr Popup_HidingSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_HiddenSignal")] + public static extern global::System.IntPtr Popup_HiddenSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_PROGRESS_VALUE_get")] + public static extern int ProgressBar_Property_PROGRESS_VALUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get")] + public static extern int ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_INDETERMINATE_get")] + public static extern int ProgressBar_Property_INDETERMINATE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_TRACK_VISUAL_get")] + public static extern int ProgressBar_Property_TRACK_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_PROGRESS_VISUAL_get")] + public static extern int ProgressBar_Property_PROGRESS_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get")] + public static extern int ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_INDETERMINATE_VISUAL_get")] + public static extern int ProgressBar_Property_INDETERMINATE_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get")] + public static extern int ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Property_LABEL_VISUAL_get")] + public static extern int ProgressBar_Property_LABEL_VISUAL_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ProgressBar_Property")] + public static extern global::System.IntPtr new_ProgressBar_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ProgressBar_Property")] + public static extern void delete_ProgressBar_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_New")] + public static extern global::System.IntPtr ProgressBar_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ProgressBar__SWIG_0")] + public static extern global::System.IntPtr new_ProgressBar__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ProgressBar__SWIG_1")] + public static extern global::System.IntPtr new_ProgressBar__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_Assign")] + public static extern global::System.IntPtr ProgressBar_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ProgressBar")] + public static extern void delete_ProgressBar(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_DownCast")] + public static extern global::System.IntPtr ProgressBar_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_ValueChangedSignal")] + public static extern global::System.IntPtr ProgressBar_ValueChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_GaussianBlurView__SWIG_0")] + public static extern global::System.IntPtr new_GaussianBlurView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_GaussianBlurView__SWIG_1")] + public static extern global::System.IntPtr new_GaussianBlurView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_Assign")] + public static extern global::System.IntPtr GaussianBlurView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_GaussianBlurView")] + public static extern void delete_GaussianBlurView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_DownCast")] + public static extern global::System.IntPtr GaussianBlurView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_New__SWIG_0")] + public static extern global::System.IntPtr GaussianBlurView_New__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_New__SWIG_1")] + public static extern global::System.IntPtr GaussianBlurView_New__SWIG_1(uint jarg1, float jarg2, int jarg3, float jarg4, float jarg5, bool jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_New__SWIG_2")] + public static extern global::System.IntPtr GaussianBlurView_New__SWIG_2(uint jarg1, float jarg2, int jarg3, float jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_Add")] + public static extern void GaussianBlurView_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_Remove")] + public static extern void GaussianBlurView_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_Activate")] + public static extern void GaussianBlurView_Activate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_ActivateOnce")] + public static extern void GaussianBlurView_ActivateOnce(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_Deactivate")] + public static extern void GaussianBlurView_Deactivate(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_SetUserImageAndOutputRenderTarget")] + public static extern void GaussianBlurView_SetUserImageAndOutputRenderTarget(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_GetBlurStrengthPropertyIndex")] + public static extern int GaussianBlurView_GetBlurStrengthPropertyIndex(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_GetBlurredRenderTarget")] + public static extern global::System.IntPtr GaussianBlurView_GetBlurredRenderTarget(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_SetBackgroundColor")] + public static extern void GaussianBlurView_SetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_GetBackgroundColor")] + public static extern global::System.IntPtr GaussianBlurView_GetBackgroundColor(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_FinishedSignal")] + public static extern global::System.IntPtr GaussianBlurView_FinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageFactory")] + public static extern void delete_PageFactory(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageFactory_GetNumberOfPages")] + public static extern uint PageFactory_GetNumberOfPages(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageFactory_NewPage")] + public static extern global::System.IntPtr PageFactory_NewPage(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_Property_PAGE_SIZE_get")] + public static extern int PageTurnView_Property_PAGE_SIZE_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_Property_CURRENT_PAGE_ID_get")] + public static extern int PageTurnView_Property_CURRENT_PAGE_ID_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_Property_SPINE_SHADOW_get")] + public static extern int PageTurnView_Property_SPINE_SHADOW_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnView_Property")] + public static extern global::System.IntPtr new_PageTurnView_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageTurnView_Property")] + public static extern void delete_PageTurnView_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnView__SWIG_0")] + public static extern global::System.IntPtr new_PageTurnView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnView__SWIG_1")] + public static extern global::System.IntPtr new_PageTurnView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_Assign")] + public static extern global::System.IntPtr PageTurnView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageTurnView")] + public static extern void delete_PageTurnView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_DownCast")] + public static extern global::System.IntPtr PageTurnView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_PageTurnStartedSignal")] + public static extern global::System.IntPtr PageTurnView_PageTurnStartedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_PageTurnFinishedSignal")] + public static extern global::System.IntPtr PageTurnView_PageTurnFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_PagePanStartedSignal")] + public static extern global::System.IntPtr PageTurnView_PagePanStartedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_PagePanFinishedSignal")] + public static extern global::System.IntPtr PageTurnView_PagePanFinishedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnLandscapeView__SWIG_0")] + public static extern global::System.IntPtr new_PageTurnLandscapeView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnLandscapeView__SWIG_1")] + public static extern global::System.IntPtr new_PageTurnLandscapeView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnLandscapeView_Assign")] + public static extern global::System.IntPtr PageTurnLandscapeView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageTurnLandscapeView")] + public static extern void delete_PageTurnLandscapeView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnLandscapeView_New")] + public static extern global::System.IntPtr PageTurnLandscapeView_New(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnLandscapeView_DownCast")] + public static extern global::System.IntPtr PageTurnLandscapeView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnPortraitView__SWIG_0")] + public static extern global::System.IntPtr new_PageTurnPortraitView__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnPortraitView__SWIG_1")] + public static extern global::System.IntPtr new_PageTurnPortraitView__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnPortraitView_Assign")] + public static extern global::System.IntPtr PageTurnPortraitView_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageTurnPortraitView")] + public static extern void delete_PageTurnPortraitView(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnPortraitView_New")] + public static extern global::System.IntPtr PageTurnPortraitView_New(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnPortraitView_DownCast")] + public static extern global::System.IntPtr PageTurnPortraitView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_Property_STATE_VISUALS_get")] + public static extern int ToggleButton_Property_STATE_VISUALS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_Property_TOOLTIPS_get")] + public static extern int ToggleButton_Property_TOOLTIPS_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_Property_CURRENT_STATE_INDEX_get")] + public static extern int ToggleButton_Property_CURRENT_STATE_INDEX_get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ToggleButton_Property")] + public static extern global::System.IntPtr new_ToggleButton_Property(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ToggleButton_Property")] + public static extern void delete_ToggleButton_Property(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ToggleButton__SWIG_0")] + public static extern global::System.IntPtr new_ToggleButton__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ToggleButton__SWIG_1")] + public static extern global::System.IntPtr new_ToggleButton__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_Assign")] + public static extern global::System.IntPtr ToggleButton_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ToggleButton")] + public static extern void delete_ToggleButton(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_New")] + public static extern global::System.IntPtr ToggleButton_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_DownCast")] + public static extern global::System.IntPtr ToggleButton_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VisualBase__SWIG_0")] + public static extern global::System.IntPtr new_VisualBase__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VisualBase")] + public static extern void delete_VisualBase(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VisualBase__SWIG_1")] + public static extern global::System.IntPtr new_VisualBase__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_Assign")] + public static extern global::System.IntPtr VisualBase_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_SetName")] + public static extern void VisualBase_SetName(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_GetName")] + public static extern string VisualBase_GetName(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_SetTransformAndSize")] + public static extern void VisualBase_SetTransformAndSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_GetHeightForWidth")] + public static extern float VisualBase_GetHeightForWidth(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_GetWidthForHeight")] + public static extern float VisualBase_GetWidthForHeight(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_GetNaturalSize")] + public static extern void VisualBase_GetNaturalSize(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_SetDepthIndex")] + public static extern void VisualBase_SetDepthIndex(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_GetDepthIndex")] + public static extern int VisualBase_GetDepthIndex(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_CreatePropertyMap")] + public static extern void VisualBase_CreatePropertyMap(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VisualBase__SWIG_2")] + public static extern global::System.IntPtr new_VisualBase__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_Get")] + public static extern global::System.IntPtr VisualFactory_Get(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VisualFactory__SWIG_0")] + public static extern global::System.IntPtr new_VisualFactory__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VisualFactory")] + public static extern void delete_VisualFactory(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VisualFactory__SWIG_1")] + public static extern global::System.IntPtr new_VisualFactory__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_Assign")] + public static extern global::System.IntPtr VisualFactory_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_CreateVisual__SWIG_0")] + public static extern global::System.IntPtr VisualFactory_CreateVisual__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_CreateVisual__SWIG_1")] + public static extern global::System.IntPtr VisualFactory_CreateVisual__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_CreateVisual__SWIG_2")] + public static extern global::System.IntPtr VisualFactory_CreateVisual__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AsyncImageLoader__SWIG_0")] + public static extern global::System.IntPtr new_AsyncImageLoader__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AsyncImageLoader")] + public static extern void delete_AsyncImageLoader(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AsyncImageLoader__SWIG_1")] + public static extern global::System.IntPtr new_AsyncImageLoader__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_Assign")] + public static extern global::System.IntPtr AsyncImageLoader_Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_New")] + public static extern global::System.IntPtr AsyncImageLoader_New(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_DownCast")] + public static extern global::System.IntPtr AsyncImageLoader_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_Load__SWIG_0")] + public static extern uint AsyncImageLoader_Load__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_Load__SWIG_1")] + public static extern uint AsyncImageLoader_Load__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_Load__SWIG_2")] + public static extern uint AsyncImageLoader_Load__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4, int jarg5, bool jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_Cancel")] + public static extern bool AsyncImageLoader_Cancel(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_CancelAll")] + public static extern void AsyncImageLoader_CancelAll(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_ImageLoadedSignal")] + public static extern global::System.IntPtr AsyncImageLoader_ImageLoadedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AsyncImageLoader__SWIG_2")] + public static extern global::System.IntPtr new_AsyncImageLoader__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageSynchronously__SWIG_0")] + public static extern global::System.IntPtr LoadImageSynchronously__SWIG_0(string jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageSynchronously__SWIG_1")] + public static extern global::System.IntPtr LoadImageSynchronously__SWIG_1(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LoadImageSynchronously__SWIG_2")] + public static extern global::System.IntPtr LoadImageSynchronously__SWIG_2(string jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3, int jarg4, bool jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_CustomAlgorithmInterface")] + public static extern void delete_CustomAlgorithmInterface(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomAlgorithmInterface_GetNextFocusableActor")] + public static extern global::System.IntPtr CustomAlgorithmInterface_GetNextFocusableActor(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3, int jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_CustomAlgorithmInterface")] + public static extern global::System.IntPtr new_CustomAlgorithmInterface(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomAlgorithmInterface_director_connect")] + public static extern void CustomAlgorithmInterface_director_connect(global::System.Runtime.InteropServices.HandleRef jarg1, CustomAlgorithmInterface.SwigDelegateCustomAlgorithmInterface_0 delegate0); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SetCustomAlgorithm")] + public static extern void SetCustomAlgorithm(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Clear")] + public static extern void ItemIdContainer_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Add")] + public static extern void ItemIdContainer_Add(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_size")] + public static extern uint ItemIdContainer_size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_capacity")] + public static extern uint ItemIdContainer_capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_reserve")] + public static extern void ItemIdContainer_reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemIdContainer__SWIG_0")] + public static extern global::System.IntPtr new_ItemIdContainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemIdContainer__SWIG_1")] + public static extern global::System.IntPtr new_ItemIdContainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemIdContainer__SWIG_2")] + public static extern global::System.IntPtr new_ItemIdContainer__SWIG_2(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_getitemcopy")] + public static extern uint ItemIdContainer_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_getitem")] + public static extern uint ItemIdContainer_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_setitem")] + public static extern void ItemIdContainer_setitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_AddRange")] + public static extern void ItemIdContainer_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_GetRange")] + public static extern global::System.IntPtr ItemIdContainer_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Insert")] + public static extern void ItemIdContainer_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, uint jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_InsertRange")] + public static extern void ItemIdContainer_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_RemoveAt")] + public static extern void ItemIdContainer_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_RemoveRange")] + public static extern void ItemIdContainer_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Repeat")] + public static extern global::System.IntPtr ItemIdContainer_Repeat(uint jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Reverse__SWIG_0")] + public static extern void ItemIdContainer_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Reverse__SWIG_1")] + public static extern void ItemIdContainer_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_SetRange")] + public static extern void ItemIdContainer_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Contains")] + public static extern bool ItemIdContainer_Contains(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_IndexOf")] + public static extern int ItemIdContainer_IndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_LastIndexOf")] + public static extern int ItemIdContainer_LastIndexOf(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemIdContainer_Remove")] + public static extern bool ItemIdContainer_Remove(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemIdContainer")] + public static extern void delete_ItemIdContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Item__SWIG_0")] + public static extern global::System.IntPtr new_Item__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Item__SWIG_1")] + public static extern global::System.IntPtr new_Item__SWIG_1(uint jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_Item__SWIG_2")] + public static extern global::System.IntPtr new_Item__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Item_first_set")] + public static extern void Item_first_set(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Item_first_get")] + public static extern uint Item_first_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Item_second_set")] + public static extern void Item_second_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Item_second_get")] + public static extern global::System.IntPtr Item_second_get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_Item")] + public static extern void delete_Item(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Clear")] + public static extern void ItemContainer_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Add")] + public static extern void ItemContainer_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_size")] + public static extern uint ItemContainer_size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_capacity")] + public static extern uint ItemContainer_capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_reserve")] + public static extern void ItemContainer_reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemContainer__SWIG_0")] + public static extern global::System.IntPtr new_ItemContainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemContainer__SWIG_1")] + public static extern global::System.IntPtr new_ItemContainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ItemContainer__SWIG_2")] + public static extern global::System.IntPtr new_ItemContainer__SWIG_2(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_getitemcopy")] + public static extern global::System.IntPtr ItemContainer_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_getitem")] + public static extern global::System.IntPtr ItemContainer_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_setitem")] + public static extern void ItemContainer_setitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_AddRange")] + public static extern void ItemContainer_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_GetRange")] + public static extern global::System.IntPtr ItemContainer_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Insert")] + public static extern void ItemContainer_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_InsertRange")] + public static extern void ItemContainer_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_RemoveAt")] + public static extern void ItemContainer_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_RemoveRange")] + public static extern void ItemContainer_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Repeat")] + public static extern global::System.IntPtr ItemContainer_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Reverse__SWIG_0")] + public static extern void ItemContainer_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_Reverse__SWIG_1")] + public static extern void ItemContainer_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemContainer_SetRange")] + public static extern void ItemContainer_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ItemContainer")] + public static extern void delete_ItemContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Clear")] + public static extern void ActorContainer_Clear(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Add")] + public static extern void ActorContainer_Add(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_size")] + public static extern uint ActorContainer_size(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_capacity")] + public static extern uint ActorContainer_capacity(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_reserve")] + public static extern void ActorContainer_reserve(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorContainer__SWIG_0")] + public static extern global::System.IntPtr new_ActorContainer__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorContainer__SWIG_1")] + public static extern global::System.IntPtr new_ActorContainer__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ActorContainer__SWIG_2")] + public static extern global::System.IntPtr new_ActorContainer__SWIG_2(int jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_getitemcopy")] + public static extern global::System.IntPtr ActorContainer_getitemcopy(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_getitem")] + public static extern global::System.IntPtr ActorContainer_getitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_setitem")] + public static extern void ActorContainer_setitem(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_AddRange")] + public static extern void ActorContainer_AddRange(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_GetRange")] + public static extern global::System.IntPtr ActorContainer_GetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Insert")] + public static extern void ActorContainer_Insert(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_InsertRange")] + public static extern void ActorContainer_InsertRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_RemoveAt")] + public static extern void ActorContainer_RemoveAt(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_RemoveRange")] + public static extern void ActorContainer_RemoveRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Repeat")] + public static extern global::System.IntPtr ActorContainer_Repeat(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Reverse__SWIG_0")] + public static extern void ActorContainer_Reverse__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_Reverse__SWIG_1")] + public static extern void ActorContainer_Reverse__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ActorContainer_SetRange")] + public static extern void ActorContainer_SetRange(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ActorContainer")] + public static extern void delete_ActorContainer(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityActionSignal_Empty")] + public static extern bool AccessibilityActionSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityActionSignal_GetConnectionCount")] + public static extern uint AccessibilityActionSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityActionSignal_Connect")] + public static extern void AccessibilityActionSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityActionSignal_Disconnect")] + public static extern void AccessibilityActionSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityActionSignal_Emit")] + public static extern bool AccessibilityActionSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AccessibilityActionSignal")] + public static extern global::System.IntPtr new_AccessibilityActionSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AccessibilityActionSignal")] + public static extern void delete_AccessibilityActionSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityFocusOvershotSignal_Empty")] + public static extern bool AccessibilityFocusOvershotSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityFocusOvershotSignal_GetConnectionCount")] + public static extern uint AccessibilityFocusOvershotSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityFocusOvershotSignal_Connect")] + public static extern void AccessibilityFocusOvershotSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityFocusOvershotSignal_Disconnect")] + public static extern void AccessibilityFocusOvershotSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityFocusOvershotSignal_Emit")] + public static extern void AccessibilityFocusOvershotSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_AccessibilityFocusOvershotSignal")] + public static extern global::System.IntPtr new_AccessibilityFocusOvershotSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_AccessibilityFocusOvershotSignal")] + public static extern void delete_AccessibilityFocusOvershotSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal_Empty")] + public static extern bool FocusChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal_GetConnectionCount")] + public static extern uint FocusChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal_Connect")] + public static extern void FocusChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal_Disconnect")] + public static extern void FocusChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusChangedSignal_Emit")] + public static extern void FocusChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FocusChangedSignal")] + public static extern global::System.IntPtr new_FocusChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FocusChangedSignal")] + public static extern void delete_FocusChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusGroupChangedSignal_Empty")] + public static extern bool FocusGroupChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusGroupChangedSignal_GetConnectionCount")] + public static extern uint FocusGroupChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusGroupChangedSignal_Connect")] + public static extern void FocusGroupChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusGroupChangedSignal_Disconnect")] + public static extern void FocusGroupChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FocusGroupChangedSignal_Emit")] + public static extern void FocusGroupChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_FocusGroupChangedSignal")] + public static extern global::System.IntPtr new_FocusGroupChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_FocusGroupChangedSignal")] + public static extern void delete_FocusGroupChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleChangedSignal_Empty")] + public static extern bool StyleChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleChangedSignal_GetConnectionCount")] + public static extern uint StyleChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleChangedSignal_Connect")] + public static extern void StyleChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleChangedSignal_Disconnect")] + public static extern void StyleChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleChangedSignal_Emit")] + public static extern void StyleChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_StyleChangedSignal")] + public static extern global::System.IntPtr new_StyleChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_StyleChangedSignal")] + public static extern void delete_StyleChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ButtonSignal_Empty")] + public static extern bool ButtonSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ButtonSignal_GetConnectionCount")] + public static extern uint ButtonSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ButtonSignal_Connect")] + public static extern void ButtonSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ButtonSignal_Disconnect")] + public static extern void ButtonSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ButtonSignal_Emit")] + public static extern bool ButtonSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ButtonSignal")] + public static extern global::System.IntPtr new_ButtonSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ButtonSignal")] + public static extern void delete_ButtonSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurViewSignal_Empty")] + public static extern bool GaussianBlurViewSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurViewSignal_GetConnectionCount")] + public static extern uint GaussianBlurViewSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurViewSignal_Connect")] + public static extern void GaussianBlurViewSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurViewSignal_Disconnect")] + public static extern void GaussianBlurViewSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurViewSignal_Emit")] + public static extern void GaussianBlurViewSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_GaussianBlurViewSignal")] + public static extern global::System.IntPtr new_GaussianBlurViewSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_GaussianBlurViewSignal")] + public static extern void delete_GaussianBlurViewSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnSignal_Empty")] + public static extern bool PageTurnSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnSignal_GetConnectionCount")] + public static extern uint PageTurnSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnSignal_Connect")] + public static extern void PageTurnSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnSignal_Disconnect")] + public static extern void PageTurnSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnSignal_Emit")] + public static extern void PageTurnSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, uint jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PageTurnSignal")] + public static extern global::System.IntPtr new_PageTurnSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PageTurnSignal")] + public static extern void delete_PageTurnSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PagePanSignal_Empty")] + public static extern bool PagePanSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PagePanSignal_GetConnectionCount")] + public static extern uint PagePanSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PagePanSignal_Connect")] + public static extern void PagePanSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PagePanSignal_Disconnect")] + public static extern void PagePanSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PagePanSignal_Emit")] + public static extern void PagePanSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_PagePanSignal")] + public static extern global::System.IntPtr new_PagePanSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_PagePanSignal")] + public static extern void delete_PagePanSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBarValueChangedSignal_Empty")] + public static extern bool ProgressBarValueChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBarValueChangedSignal_GetConnectionCount")] + public static extern uint ProgressBarValueChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBarValueChangedSignal_Connect")] + public static extern void ProgressBarValueChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBarValueChangedSignal_Disconnect")] + public static extern void ProgressBarValueChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBarValueChangedSignal_Emit")] + public static extern void ProgressBarValueChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ProgressBarValueChangedSignal")] + public static extern global::System.IntPtr new_ProgressBarValueChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ProgressBarValueChangedSignal")] + public static extern void delete_ProgressBarValueChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewSnapStartedSignal_Empty")] + public static extern bool ScrollViewSnapStartedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewSnapStartedSignal_GetConnectionCount")] + public static extern uint ScrollViewSnapStartedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewSnapStartedSignal_Connect")] + public static extern void ScrollViewSnapStartedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewSnapStartedSignal_Disconnect")] + public static extern void ScrollViewSnapStartedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewSnapStartedSignal_Emit")] + public static extern void ScrollViewSnapStartedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollViewSnapStartedSignal")] + public static extern global::System.IntPtr new_ScrollViewSnapStartedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollViewSnapStartedSignal")] + public static extern void delete_ScrollViewSnapStartedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollableSignal_Empty")] + public static extern bool ScrollableSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollableSignal_GetConnectionCount")] + public static extern uint ScrollableSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollableSignal_Connect")] + public static extern void ScrollableSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollableSignal_Disconnect")] + public static extern void ScrollableSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollableSignal_Emit")] + public static extern void ScrollableSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ScrollableSignal")] + public static extern global::System.IntPtr new_ScrollableSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ScrollableSignal")] + public static extern void delete_ScrollableSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditorSignal_Empty")] + public static extern bool TextEditorSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditorSignal_GetConnectionCount")] + public static extern uint TextEditorSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditorSignal_Connect")] + public static extern void TextEditorSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditorSignal_Disconnect")] + public static extern void TextEditorSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditorSignal_Emit")] + public static extern void TextEditorSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextEditorSignal")] + public static extern global::System.IntPtr new_TextEditorSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextEditorSignal")] + public static extern void delete_TextEditorSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextFieldSignal_Empty")] + public static extern bool TextFieldSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextFieldSignal_GetConnectionCount")] + public static extern uint TextFieldSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextFieldSignal_Connect")] + public static extern void TextFieldSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextFieldSignal_Disconnect")] + public static extern void TextFieldSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextFieldSignal_Emit")] + public static extern void TextFieldSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_TextFieldSignal")] + public static extern global::System.IntPtr new_TextFieldSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_TextFieldSignal")] + public static extern void delete_TextFieldSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ControlKeySignal_Empty")] + public static extern bool ControlKeySignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ControlKeySignal_GetConnectionCount")] + public static extern uint ControlKeySignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ControlKeySignal_Connect")] + public static extern void ControlKeySignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ControlKeySignal_Disconnect")] + public static extern void ControlKeySignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ControlKeySignal_Emit")] + public static extern bool ControlKeySignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, global::System.Runtime.InteropServices.HandleRef jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ControlKeySignal")] + public static extern global::System.IntPtr new_ControlKeySignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ControlKeySignal")] + public static extern void delete_ControlKeySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusSignal_Empty")] + public static extern bool KeyInputFocusSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusSignal_GetConnectionCount")] + public static extern uint KeyInputFocusSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusSignal_Connect")] + public static extern void KeyInputFocusSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusSignal_Disconnect")] + public static extern void KeyInputFocusSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusSignal_Emit")] + public static extern void KeyInputFocusSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_KeyInputFocusSignal")] + public static extern global::System.IntPtr new_KeyInputFocusSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_KeyInputFocusSignal")] + public static extern void delete_KeyInputFocusSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoViewSignal_Empty")] + public static extern bool VideoViewSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoViewSignal_GetConnectionCount")] + public static extern uint VideoViewSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoViewSignal_Connect")] + public static extern void VideoViewSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoViewSignal_Disconnect")] + public static extern void VideoViewSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoViewSignal_Emit")] + public static extern void VideoViewSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_VideoViewSignal")] + public static extern global::System.IntPtr new_VideoViewSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_VideoViewSignal")] + public static extern void delete_VideoViewSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderValueChangedSignal_Empty")] + public static extern bool SliderValueChangedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderValueChangedSignal_GetConnectionCount")] + public static extern uint SliderValueChangedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderValueChangedSignal_Connect")] + public static extern void SliderValueChangedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderValueChangedSignal_Disconnect")] + public static extern void SliderValueChangedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderValueChangedSignal_Emit")] + public static extern bool SliderValueChangedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_SliderValueChangedSignal")] + public static extern global::System.IntPtr new_SliderValueChangedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_SliderValueChangedSignal")] + public static extern void delete_SliderValueChangedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderMarkReachedSignal_Empty")] + public static extern bool SliderMarkReachedSignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderMarkReachedSignal_GetConnectionCount")] + public static extern uint SliderMarkReachedSignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderMarkReachedSignal_Connect")] + public static extern void SliderMarkReachedSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderMarkReachedSignal_Disconnect")] + public static extern void SliderMarkReachedSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_SliderMarkReachedSignal_Emit")] + public static extern bool SliderMarkReachedSignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, int jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_SliderMarkReachedSignal")] + public static extern global::System.IntPtr new_SliderMarkReachedSignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_SliderMarkReachedSignal")] + public static extern void delete_SliderMarkReachedSignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RulerPtr__SWIG_0")] + public static extern global::System.IntPtr new_RulerPtr__SWIG_0(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RulerPtr__SWIG_1")] + public static extern global::System.IntPtr new_RulerPtr__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_RulerPtr__SWIG_2")] + public static extern global::System.IntPtr new_RulerPtr__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_RulerPtr")] + public static extern void delete_RulerPtr(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Get")] + public static extern global::System.IntPtr RulerPtr_Get(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr___deref__")] + public static extern global::System.IntPtr RulerPtr___deref__(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr___ref__")] + public static extern global::System.IntPtr RulerPtr___ref__(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Assign__SWIG_0")] + public static extern global::System.IntPtr RulerPtr_Assign__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Assign__SWIG_1")] + public static extern global::System.IntPtr RulerPtr_Assign__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Reset__SWIG_0")] + public static extern void RulerPtr_Reset__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Reset__SWIG_1")] + public static extern void RulerPtr_Reset__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Detach")] + public static extern global::System.IntPtr RulerPtr_Detach(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Snap__SWIG_0")] + public static extern float RulerPtr_Snap__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Snap__SWIG_1")] + public static extern float RulerPtr_Snap__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_GetPositionFromPage")] + public static extern float RulerPtr_GetPositionFromPage(global::System.Runtime.InteropServices.HandleRef jarg1, uint jarg2, out uint jarg3, bool jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_GetPageFromPosition")] + public static extern uint RulerPtr_GetPageFromPosition(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, bool jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_GetTotalPages")] + public static extern uint RulerPtr_GetTotalPages(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_GetType")] + public static extern int RulerPtr_GetType(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_IsEnabled")] + public static extern bool RulerPtr_IsEnabled(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Enable")] + public static extern void RulerPtr_Enable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Disable")] + public static extern void RulerPtr_Disable(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SetDomain")] + public static extern void RulerPtr_SetDomain(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_GetDomain")] + public static extern global::System.IntPtr RulerPtr_GetDomain(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_DisableDomain")] + public static extern void RulerPtr_DisableDomain(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Clamp__SWIG_0")] + public static extern float RulerPtr_Clamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Clamp__SWIG_1")] + public static extern float RulerPtr_Clamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Clamp__SWIG_2")] + public static extern float RulerPtr_Clamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Clamp__SWIG_3")] + public static extern float RulerPtr_Clamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, global::System.Runtime.InteropServices.HandleRef jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SnapAndClamp__SWIG_0")] + public static extern float RulerPtr_SnapAndClamp__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SnapAndClamp__SWIG_1")] + public static extern float RulerPtr_SnapAndClamp__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SnapAndClamp__SWIG_2")] + public static extern float RulerPtr_SnapAndClamp__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SnapAndClamp__SWIG_3")] + public static extern float RulerPtr_SnapAndClamp__SWIG_3(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_SnapAndClamp__SWIG_4")] + public static extern float RulerPtr_SnapAndClamp__SWIG_4(global::System.Runtime.InteropServices.HandleRef jarg1, float jarg2, float jarg3, float jarg4, float jarg5, global::System.Runtime.InteropServices.HandleRef jarg6); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Reference")] + public static extern void RulerPtr_Reference(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_Unreference")] + public static extern void RulerPtr_Unreference(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RulerPtr_ReferenceCount")] + public static extern int RulerPtr_ReferenceCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewResourceReadySignal_Empty")] + public static extern bool ViewResourceReadySignal_Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewResourceReadySignal_GetConnectionCount")] + public static extern uint ViewResourceReadySignal_GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewResourceReadySignal_Connect")] + public static extern void ViewResourceReadySignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewResourceReadySignal_Disconnect")] + public static extern void ViewResourceReadySignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewResourceReadySignal_Emit")] + public static extern void ViewResourceReadySignal_Emit(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_new_ViewResourceReadySignal")] + public static extern global::System.IntPtr new_ViewResourceReadySignal(); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_delete_ViewResourceReadySignal")] + public static extern void delete_ViewResourceReadySignal(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GetRefObjectPtr")] + public static extern global::System.IntPtr GetRefObjectPtr(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BaseObject_SWIGUpcast")] + public static extern global::System.IntPtr BaseObject_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTrackerInterface_SWIGUpcast")] + public static extern global::System.IntPtr ConnectionTrackerInterface_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ConnectionTracker_SWIGUpcast")] + public static extern global::System.IntPtr ConnectionTracker_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ObjectRegistry_SWIGUpcast")] + public static extern global::System.IntPtr ObjectRegistry_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyCondition_SWIGUpcast")] + public static extern global::System.IntPtr PropertyCondition_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyNotification_SWIGUpcast")] + public static extern global::System.IntPtr PropertyNotification_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Handle_SWIGUpcast")] + public static extern global::System.IntPtr Handle_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeInfo_SWIGUpcast")] + public static extern global::System.IntPtr TypeInfo_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TypeRegistry_SWIGUpcast")] + public static extern global::System.IntPtr TypeRegistry_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Image_SWIGUpcast")] + public static extern global::System.IntPtr Image_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PixelData_SWIGUpcast")] + public static extern global::System.IntPtr PixelData_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Texture_SWIGUpcast")] + public static extern global::System.IntPtr Texture_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Sampler_SWIGUpcast")] + public static extern global::System.IntPtr Sampler_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextureSet_SWIGUpcast")] + public static extern global::System.IntPtr TextureSet_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PropertyBuffer_SWIGUpcast")] + public static extern global::System.IntPtr PropertyBuffer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Geometry_SWIGUpcast")] + public static extern global::System.IntPtr Geometry_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Shader_SWIGUpcast")] + public static extern global::System.IntPtr Shader_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Renderer_SWIGUpcast")] + public static extern global::System.IntPtr Renderer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBuffer_SWIGUpcast")] + public static extern global::System.IntPtr FrameBuffer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTaskList_SWIGUpcast")] + public static extern global::System.IntPtr RenderTaskList_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RenderTask_SWIGUpcast")] + public static extern global::System.IntPtr RenderTask_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Touch_SWIGUpcast")] + public static extern global::System.IntPtr Touch_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GestureDetector_SWIGUpcast")] + public static extern global::System.IntPtr GestureDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGestureDetector_SWIGUpcast")] + public static extern global::System.IntPtr LongPressGestureDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LongPressGesture_SWIGUpcast")] + public static extern global::System.IntPtr LongPressGesture_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Actor_SWIGUpcast")] + public static extern global::System.IntPtr Actor_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Layer_SWIGUpcast")] + public static extern global::System.IntPtr Layer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Stage_SWIGUpcast")] + public static extern global::System.IntPtr Stage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActorImpl_SWIGUpcast")] + public static extern global::System.IntPtr CustomActorImpl_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CustomActor_SWIGUpcast")] + public static extern global::System.IntPtr CustomActor_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGestureDetector_SWIGUpcast")] + public static extern global::System.IntPtr PanGestureDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PanGesture_SWIGUpcast")] + public static extern global::System.IntPtr PanGesture_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGestureDetector_SWIGUpcast")] + public static extern global::System.IntPtr PinchGestureDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PinchGesture_SWIGUpcast")] + public static extern global::System.IntPtr PinchGesture_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGestureDetector_SWIGUpcast")] + public static extern global::System.IntPtr TapGestureDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TapGesture_SWIGUpcast")] + public static extern global::System.IntPtr TapGesture_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyFrames_SWIGUpcast")] + public static extern global::System.IntPtr KeyFrames_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Path_SWIGUpcast")] + public static extern global::System.IntPtr Path_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Animation_SWIGUpcast")] + public static extern global::System.IntPtr Animation_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_LinearConstrainer_SWIGUpcast")] + public static extern global::System.IntPtr LinearConstrainer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PathConstrainer_SWIGUpcast")] + public static extern global::System.IntPtr PathConstrainer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_BufferImage_SWIGUpcast")] + public static extern global::System.IntPtr BufferImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_EncodedBufferImage_SWIGUpcast")] + public static extern global::System.IntPtr EncodedBufferImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImage_SWIGUpcast")] + public static extern global::System.IntPtr NativeImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NativeImageInterface_SWIGUpcast")] + public static extern global::System.IntPtr NativeImageInterface_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ResourceImage_SWIGUpcast")] + public static extern global::System.IntPtr ResourceImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FrameBufferImage_SWIGUpcast")] + public static extern global::System.IntPtr FrameBufferImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_NinePatchImage_SWIGUpcast")] + public static extern global::System.IntPtr NinePatchImage_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CameraActor_SWIGUpcast")] + public static extern global::System.IntPtr CameraActor_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Timer_SWIGUpcast")] + public static extern global::System.IntPtr Timer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DragAndDropDetector_SWIGUpcast")] + public static extern global::System.IntPtr DragAndDropDetector_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Window_SWIGUpcast")] + public static extern global::System.IntPtr Window_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Application_SWIGUpcast")] + public static extern global::System.IntPtr Application_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Builder_SWIGUpcast")] + public static extern global::System.IntPtr Builder_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TransitionData_SWIGUpcast")] + public static extern global::System.IntPtr TransitionData_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ViewImpl_SWIGUpcast")] + public static extern global::System.IntPtr ViewImpl_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_View_SWIGUpcast")] + public static extern global::System.IntPtr View_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_KeyInputFocusManager_SWIGUpcast")] + public static extern global::System.IntPtr KeyInputFocusManager_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Alignment_SWIGUpcast")] + public static extern global::System.IntPtr Alignment_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Button_SWIGUpcast")] + public static extern global::System.IntPtr Button_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_CheckBoxButton_SWIGUpcast")] + public static extern global::System.IntPtr CheckBoxButton_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PushButton_SWIGUpcast")] + public static extern global::System.IntPtr PushButton_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_RadioButton_SWIGUpcast")] + public static extern global::System.IntPtr RadioButton_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FlexContainer_SWIGUpcast")] + public static extern global::System.IntPtr FlexContainer_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ImageView_SWIGUpcast")] + public static extern global::System.IntPtr ImageView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Model3dView_SWIGUpcast")] + public static extern global::System.IntPtr Model3dView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollBar_SWIGUpcast")] + public static extern global::System.IntPtr ScrollBar_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Scrollable_SWIGUpcast")] + public static extern global::System.IntPtr Scrollable_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemLayout_SWIGUpcast")] + public static extern global::System.IntPtr ItemLayout_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ItemView_SWIGUpcast")] + public static extern global::System.IntPtr ItemView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewEffect_SWIGUpcast")] + public static extern global::System.IntPtr ScrollViewEffect_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollViewPagePathEffect_SWIGUpcast")] + public static extern global::System.IntPtr ScrollViewPagePathEffect_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Ruler_SWIGUpcast")] + public static extern global::System.IntPtr Ruler_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_DefaultRuler_SWIGUpcast")] + public static extern global::System.IntPtr DefaultRuler_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_FixedRuler_SWIGUpcast")] + public static extern global::System.IntPtr FixedRuler_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ScrollView_SWIGUpcast")] + public static extern global::System.IntPtr ScrollView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TableView_SWIGUpcast")] + public static extern global::System.IntPtr TableView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextEditor_SWIGUpcast")] + public static extern global::System.IntPtr TextEditor_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextField_SWIGUpcast")] + public static extern global::System.IntPtr TextField_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_TextLabel_SWIGUpcast")] + public static extern global::System.IntPtr TextLabel_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AccessibilityManager_SWIGUpcast")] + public static extern global::System.IntPtr AccessibilityManager_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_StyleManager_SWIGUpcast")] + public static extern global::System.IntPtr StyleManager_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Slider_SWIGUpcast")] + public static extern global::System.IntPtr Slider_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VideoView_SWIGUpcast")] + public static extern global::System.IntPtr VideoView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_Popup_SWIGUpcast")] + public static extern global::System.IntPtr Popup_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ProgressBar_SWIGUpcast")] + public static extern global::System.IntPtr ProgressBar_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_GaussianBlurView_SWIGUpcast")] + public static extern global::System.IntPtr GaussianBlurView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnView_SWIGUpcast")] + public static extern global::System.IntPtr PageTurnView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnLandscapeView_SWIGUpcast")] + public static extern global::System.IntPtr PageTurnLandscapeView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_PageTurnPortraitView_SWIGUpcast")] + public static extern global::System.IntPtr PageTurnPortraitView_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_ToggleButton_SWIGUpcast")] + public static extern global::System.IntPtr ToggleButton_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualBase_SWIGUpcast")] + public static extern global::System.IntPtr VisualBase_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_VisualFactory_SWIGUpcast")] + public static extern global::System.IntPtr VisualFactory_SWIGUpcast(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport("libdali-csharp-binder.so", EntryPoint="CSharp_Dali_AsyncImageLoader_SWIGUpcast")] + public static extern global::System.IntPtr AsyncImageLoader_SWIGUpcast(global::System.IntPtr jarg1); +} + +} diff --git a/src/Tizen.NUI/src/internal/NUICoreBackend.cs b/src/Tizen.NUI/src/internal/NUICoreBackend.cs new file mode 100755 index 0000000..05744b8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NUICoreBackend.cs @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; + +using Tizen.Applications.CoreBackend; +using Tizen.Applications; +using Tizen.NUI; + +namespace Tizen.NUI +{ + class NUICoreBackend : ICoreBackend + { + /// + /// Application instance to connect event. + /// + protected Application _application; + + /// + /// Dictionary to contain each type of event callback. + /// + protected IDictionary Handlers = new Dictionary(); + + /// + /// The default Constructor. + /// + public NUICoreBackend() + { + _application = Application.NewApplication(); + } + + /// + /// The constructor with stylesheet. + /// + public NUICoreBackend(string stylesheet) + { + _application = Application.NewApplication(stylesheet); + } + + /// + /// The constructor with stylesheet and window mode. + /// + public NUICoreBackend(string stylesheet, NUIApplication.WindowMode windowMode) + { + _application = Application.NewApplication(stylesheet, (Application.WindowMode)windowMode ); + } + + /// + /// Add NUIApplication event to Application. + /// Put each type of event callback in Dictionary. + /// + /// Type of event + /// Event callback + public void AddEventHandler(EventType evType, Action handler) + { + Handlers.Add(evType, handler); + } + + /// + /// Add NUIApplication event to Application. + /// Put each type of event callback in Dictionary. + /// + /// Argument type for the event + /// Type of event + /// Event callback + public void AddEventHandler(EventType evType, Action handler) where TEventArgs : EventArgs + { + Handlers.Add(evType, handler); + } + + + /// + /// Dispose function. + /// + public void Dispose() + { + _application.Dispose(); + } + + /// + /// Exit Application. + /// + public void Exit() + { + _application.Quit(); + } + + /// + /// Run Application. + /// + /// Arguments from commandline. + public void Run(string[] args) + { + TizenSynchronizationContext.Initialize(); + _application.BatteryLow += OnBatteryLow; + _application.LanguageChanged += OnLanguageChanged; + _application.MemoryLow += OnMemoryLow; + _application.RegionChanged += OnRegionChanged; + + _application.Initialized += OnInitialized; + _application.Resumed += OnResumed; + _application.Terminating += OnTerminated; + _application.Paused += OnPaused; + _application.AppControl += OnAppControl; + + _application.MainLoop(); + } + + /// + /// Region changed event callback function. + /// + /// Application instance + /// Event argument for RegionChanged + private void OnRegionChanged(object source, NUIApplicationRegionChangedEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnRegionChanged Called"); + var handler = Handlers[EventType.RegionFormatChanged] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke( new RegionFormatChangedEventArgs("")); + } + + /// + /// Memory Low event callback function. + /// + /// Application instance + /// Event argument for MemoryLow + private void OnMemoryLow(object source, NUIApplicationMemoryLowEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnMemoryLow Called"); + var handler = Handlers[EventType.LowMemory] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke( new LowMemoryEventArgs(LowMemoryStatus.None)); + } + + /// + /// Language changed event callback function. + /// + /// Application instance + /// Event argument for LanguageChanged + private void OnLanguageChanged(object source, NUIApplicationLanguageChangedEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnLanguageChanged Called"); + var handler = Handlers[EventType.LocaleChanged] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke( new LocaleChangedEventArgs("")); + } + + /// + /// Battery low event callback function. + /// + /// Application instance + /// Event argument for BatteryLow + private void OnBatteryLow(object source, NUIApplicationBatteryLowEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnBatteryLow Called"); + var handler = Handlers[EventType.LowBattery] as Action; + // Need to make new signal return in native to return right value. + handler?.Invoke(new LowBatteryEventArgs(LowBatteryStatus.None)); + } + + /// + /// Initialized event callback function. + /// + /// Application instance + /// Event argument for Initialized + private void OnInitialized(object source, NUIApplicationInitEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnPreCreated Called"); + var preCreateHandler = Handlers[EventType.PreCreated] as Action; + preCreateHandler?.Invoke(); + + Log.Debug("NUI", "NUICorebackend OnCreate Called"); + var createHandler = Handlers[EventType.Created] as Action; + createHandler?.Invoke(); + } + + /// + /// Terminated event callback function. + /// + /// Application instance + /// Event argument for Terminated + private void OnTerminated(object source, NUIApplicationTerminatingEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnTerminated Called"); + var handler = Handlers[EventType.Terminated] as Action; + handler?.Invoke(); + } + + /// + /// Resumed event callback function. + /// + /// Application instance + /// Event argument for Resumed + private void OnResumed(object source, NUIApplicationResumedEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnResumed Called"); + var handler = Handlers[EventType.Resumed] as Action; + handler?.Invoke(); + } + + /// + /// App control event callback function. + /// + /// Application instance + /// Event argument for AppControl + private void OnAppControl(object source, NUIApplicationAppControlEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnAppControl Called"); + /* can invoke after making new api which getting control handle at application. + var handler = Handlers[EventType.AppControlReceived] as Action; + handler?.Invoke(); + */ + } + + /// + /// Paused event callback function. + /// + /// Application instance + /// Event argument for Paused + private void OnPaused(object source, NUIApplicationPausedEventArgs e) + { + Log.Debug("NUI", "NUICorebackend OnPaused Called"); + var handler = Handlers[EventType.Paused] as Action; + handler?.Invoke(); + } + + + internal Application ApplicationHandle + { + get + { + return _application; + } + } + + } +} diff --git a/src/Tizen.NUI/src/internal/NUIEventType.cs b/src/Tizen.NUI/src/internal/NUIEventType.cs new file mode 100755 index 0000000..a9ee287 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NUIEventType.cs @@ -0,0 +1,47 @@ +/* Copyright(c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using Tizen.Applications.CoreBackend; + +namespace Tizen.NUI +{ + /// + /// Class that represents the type of NUI event for backends. This class can be converted from string type. + /// + public class NUIEventType : EventType + { + /// + /// Initializes the EventType class. + /// + /// The name of event type. + public NUIEventType(string name) : base(name) + { + } + + /// + /// Pre-defined event type. "Reset" + /// + public static readonly NUIEventType Reset = "Reset"; + + /// + /// Converts a string to NUIEventType instance. + /// + public static implicit operator NUIEventType(string value) + { + return new NUIEventType(value); + } + } +} diff --git a/src/Tizen.NUI/src/internal/NativeImage.cs b/src/Tizen.NUI/src/internal/NativeImage.cs new file mode 100755 index 0000000..a3a6183 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NativeImage.cs @@ -0,0 +1,113 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class NativeImage : Image + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal NativeImage(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.NativeImage_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImage obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_NativeImage(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public NativeImage(NativeImageInterface nativeImageInterface) : this(NDalicPINVOKE.NativeImage_New(NativeImageInterface.getCPtr(nativeImageInterface)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public NativeImage(NativeImage handle) : this(NDalicPINVOKE.new_NativeImage__SWIG_1(NativeImage.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public NativeImage Assign(NativeImage rhs) + { + NativeImage ret = new NativeImage(NDalicPINVOKE.NativeImage_Assign(swigCPtr, NativeImage.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void CreateGlTexture() + { + NDalicPINVOKE.NativeImage_CreateGlTexture(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new static NativeImage DownCast(BaseHandle handle) + { + NativeImage ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as NativeImage; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetCustomFragmentPreFix() + { + string ret = NDalicPINVOKE.NativeImage_GetCustomFragmentPreFix(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetCustomSamplerTypename() + { + string ret = NDalicPINVOKE.NativeImage_GetCustomSamplerTypename(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/NativeImageInterface.cs b/src/Tizen.NUI/src/internal/NativeImageInterface.cs new file mode 100755 index 0000000..38c1c54 --- /dev/null +++ b/src/Tizen.NUI/src/internal/NativeImageInterface.cs @@ -0,0 +1,116 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class NativeImageInterface : RefObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal NativeImageInterface(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.NativeImageInterface_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(NativeImageInterface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public virtual bool GlExtensionCreate() + { + bool ret = NDalicPINVOKE.NativeImageInterface_GlExtensionCreate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void GlExtensionDestroy() + { + NDalicPINVOKE.NativeImageInterface_GlExtensionDestroy(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual uint TargetTexture() + { + uint ret = NDalicPINVOKE.NativeImageInterface_TargetTexture(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void PrepareTexture() + { + NDalicPINVOKE.NativeImageInterface_PrepareTexture(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual uint GetWidth() + { + uint ret = NDalicPINVOKE.NativeImageInterface_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual uint GetHeight() + { + uint ret = NDalicPINVOKE.NativeImageInterface_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool RequiresBlending() + { + bool ret = NDalicPINVOKE.NativeImageInterface_RequiresBlending(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Object.cs b/src/Tizen.NUI/src/internal/Object.cs new file mode 100755 index 0000000..b59f3c2 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Object.cs @@ -0,0 +1,41 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +/** + * Static Helper class for Property + * Internal + */ + +namespace Tizen.NUI +{ + + internal static class Object + { + public static PropertyValue GetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Handle_GetProperty(handle, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void SetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index, PropertyValue propertyValue) + { + NDalicPINVOKE.Handle_SetProperty(handle, index, PropertyValue.getCPtr(propertyValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + +} diff --git a/src/Tizen.NUI/src/internal/ObjectCreatedSignal.cs b/src/Tizen.NUI/src/internal/ObjectCreatedSignal.cs new file mode 100755 index 0000000..0c0a18b --- /dev/null +++ b/src/Tizen.NUI/src/internal/ObjectCreatedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ObjectCreatedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ObjectCreatedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ObjectCreatedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ObjectCreatedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ObjectCreatedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ObjectCreatedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ObjectCreatedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ObjectCreatedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ObjectCreatedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(BaseHandle arg) + { + NDalicPINVOKE.ObjectCreatedSignal_Emit(swigCPtr, BaseHandle.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ObjectCreatedSignal() : this(NDalicPINVOKE.new_ObjectCreatedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ObjectDestroyedSignal.cs b/src/Tizen.NUI/src/internal/ObjectDestroyedSignal.cs new file mode 100755 index 0000000..de482c7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ObjectDestroyedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ObjectDestroyedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ObjectDestroyedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ObjectDestroyedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ObjectDestroyedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ObjectDestroyedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ObjectDestroyedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ObjectDestroyedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ObjectDestroyedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ObjectDestroyedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(RefObject arg) + { + NDalicPINVOKE.ObjectDestroyedSignal_Emit(swigCPtr, RefObject.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ObjectDestroyedSignal() : this(NDalicPINVOKE.new_ObjectDestroyedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ObjectRegistry.cs b/src/Tizen.NUI/src/internal/ObjectRegistry.cs new file mode 100755 index 0000000..5051c31 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ObjectRegistry.cs @@ -0,0 +1,242 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + + internal class ObjectRegistry : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ObjectRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ObjectRegistry_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ObjectRegistry obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ObjectRegistry(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public class ObjectCreatedEventArgs : EventArgs + { + private BaseHandle _baseHandle; + + public BaseHandle BaseHandle + { + get + { + return _baseHandle; + } + set + { + _baseHandle = value; + } + } + } + + public class ObjectDestroyedEventArgs : EventArgs + { + private RefObject _refObject; + + public RefObject RefObject + { + get + { + return _refObject; + } + set + { + _refObject = value; + } + } + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ObjectCreatedEventCallbackDelegate(IntPtr baseHandle); + private DaliEventHandler _objectRegistryObjectCreatedEventHandler; + private ObjectCreatedEventCallbackDelegate _objectRegistryObjectCreatedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ObjectDestroyedEventCallbackDelegate(IntPtr fefObject); + private DaliEventHandler _objectRegistryObjectDestroyedEventHandler; + private ObjectDestroyedEventCallbackDelegate _objectRegistryObjectDestroyedEventCallbackDelegate; + + public event DaliEventHandler ObjectCreated + { + add + { + lock (this) + { + // Restricted to only one listener + if (_objectRegistryObjectCreatedEventHandler == null) + { + _objectRegistryObjectCreatedEventHandler += value; + + _objectRegistryObjectCreatedEventCallbackDelegate = new ObjectCreatedEventCallbackDelegate(OnObjectCreated); + this.ObjectCreatedSignal().Connect(_objectRegistryObjectCreatedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_objectRegistryObjectCreatedEventHandler != null) + { + this.ObjectCreatedSignal().Disconnect(_objectRegistryObjectCreatedEventCallbackDelegate); + } + + _objectRegistryObjectCreatedEventHandler -= value; + } + } + } + + // Callback for ObjectRegistry ObjectCreatedSignal + private void OnObjectCreated(IntPtr baseHandle) + { + ObjectCreatedEventArgs e = new ObjectCreatedEventArgs(); + + // Populate all members of "e" (ObjectCreatedEventArgs) with real data + //e.BaseHandle = BaseHandle.GetBaseHandleFromPtr(baseHandle); //GetBaseHandleFromPtr() is not present in BaseHandle.cs. Not sure what is the reason? + + if (_objectRegistryObjectCreatedEventHandler != null) + { + //here we send all data to user event handlers + _objectRegistryObjectCreatedEventHandler(this, e); + } + } + + public event DaliEventHandler ObjectDestroyed + { + add + { + lock (this) + { + // Restricted to only one listener + if (_objectRegistryObjectDestroyedEventHandler == null) + { + _objectRegistryObjectDestroyedEventHandler += value; + + _objectRegistryObjectDestroyedEventCallbackDelegate = new ObjectDestroyedEventCallbackDelegate(OnObjectDestroyed); + this.ObjectDestroyedSignal().Connect(_objectRegistryObjectDestroyedEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_objectRegistryObjectDestroyedEventHandler != null) + { + this.ObjectDestroyedSignal().Disconnect(_objectRegistryObjectDestroyedEventCallbackDelegate); + } + + _objectRegistryObjectDestroyedEventHandler -= value; + } + } + } + + // Callback for ObjectRegistry ObjectDestroyedSignal + private void OnObjectDestroyed(IntPtr refObject) + { + ObjectDestroyedEventArgs e = new ObjectDestroyedEventArgs(); + + // Populate all members of "e" (ObjectDestroyedEventArgs) with real data + e.RefObject = RefObject.GetRefObjectFromPtr(refObject); + + if (_objectRegistryObjectDestroyedEventHandler != null) + { + //here we send all data to user event handlers + _objectRegistryObjectDestroyedEventHandler(this, e); + } + } + + + public ObjectRegistry() : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ObjectRegistry(ObjectRegistry handle) : this(NDalicPINVOKE.new_ObjectRegistry__SWIG_1(ObjectRegistry.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ObjectRegistry Assign(ObjectRegistry rhs) + { + ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.ObjectRegistry_Assign(swigCPtr, ObjectRegistry.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ObjectCreatedSignal ObjectCreatedSignal() + { + ObjectCreatedSignal ret = new ObjectCreatedSignal(NDalicPINVOKE.ObjectRegistry_ObjectCreatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public ObjectDestroyedSignal ObjectDestroyedSignal() + { + ObjectDestroyedSignal ret = new ObjectDestroyedSignal(NDalicPINVOKE.ObjectRegistry_ObjectDestroyedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PageFactory.cs b/src/Tizen.NUI/src/internal/PageFactory.cs new file mode 100755 index 0000000..b09464d --- /dev/null +++ b/src/Tizen.NUI/src/internal/PageFactory.cs @@ -0,0 +1,118 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PageFactory : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PageFactory(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PageFactory obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PageFactory() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageFactory(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public virtual uint GetNumberOfPages() + { + uint ret = NDalicPINVOKE.PageFactory_GetNumberOfPages(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual Texture NewPage(uint pageId) + { + Texture ret = new Texture(NDalicPINVOKE.PageFactory_NewPage(swigCPtr, pageId), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PagePanSignal.cs b/src/Tizen.NUI/src/internal/PagePanSignal.cs new file mode 100755 index 0000000..67de631 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PagePanSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PagePanSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PagePanSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PagePanSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PagePanSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PagePanSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.PagePanSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.PagePanSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PagePanSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PagePanSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(PageTurnView arg) + { + NDalicPINVOKE.PagePanSignal_Emit(swigCPtr, PageTurnView.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PagePanSignal() : this(NDalicPINVOKE.new_PagePanSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs b/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs new file mode 100755 index 0000000..d2e501b --- /dev/null +++ b/src/Tizen.NUI/src/internal/PageTurnLandscapeView.cs @@ -0,0 +1,92 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PageTurnLandscapeView : PageTurnView + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PageTurnLandscapeView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PageTurnLandscapeView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PageTurnLandscapeView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageTurnLandscapeView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public PageTurnLandscapeView(PageFactory pageFactory, Vector2 pageSize) : this(NDalicPINVOKE.PageTurnLandscapeView_New(PageFactory.getCPtr(pageFactory), Vector2.getCPtr(pageSize)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public PageTurnLandscapeView(PageTurnLandscapeView pageTurnLandscapeView) : this(NDalicPINVOKE.new_PageTurnLandscapeView__SWIG_1(PageTurnLandscapeView.getCPtr(pageTurnLandscapeView)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PageTurnLandscapeView Assign(PageTurnLandscapeView pageTurnLandscapeView) + { + PageTurnLandscapeView ret = new PageTurnLandscapeView(NDalicPINVOKE.PageTurnLandscapeView_Assign(swigCPtr, PageTurnLandscapeView.getCPtr(pageTurnLandscapeView)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new static PageTurnLandscapeView DownCast(BaseHandle handle) + { + PageTurnLandscapeView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PageTurnLandscapeView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs b/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs new file mode 100755 index 0000000..607b476 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PageTurnPortraitView.cs @@ -0,0 +1,92 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PageTurnPortraitView : PageTurnView + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PageTurnPortraitView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PageTurnPortraitView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PageTurnPortraitView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageTurnPortraitView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public PageTurnPortraitView(PageFactory pageFactory, Vector2 pageSize) : this(NDalicPINVOKE.PageTurnPortraitView_New(PageFactory.getCPtr(pageFactory), Vector2.getCPtr(pageSize)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public PageTurnPortraitView(PageTurnPortraitView pageTurnPortraitView) : this(NDalicPINVOKE.new_PageTurnPortraitView__SWIG_1(PageTurnPortraitView.getCPtr(pageTurnPortraitView)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PageTurnPortraitView Assign(PageTurnPortraitView pageTurnPortraitView) + { + PageTurnPortraitView ret = new PageTurnPortraitView(NDalicPINVOKE.PageTurnPortraitView_Assign(swigCPtr, PageTurnPortraitView.getCPtr(pageTurnPortraitView)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new static PageTurnPortraitView DownCast(BaseHandle handle) + { + PageTurnPortraitView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PageTurnPortraitView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PageTurnSignal.cs b/src/Tizen.NUI/src/internal/PageTurnSignal.cs new file mode 100755 index 0000000..0ba7fbe --- /dev/null +++ b/src/Tizen.NUI/src/internal/PageTurnSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PageTurnSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PageTurnSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PageTurnSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PageTurnSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageTurnSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.PageTurnSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.PageTurnSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PageTurnSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PageTurnSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(PageTurnView arg1, uint arg2, bool arg3) + { + NDalicPINVOKE.PageTurnSignal_Emit(swigCPtr, PageTurnView.getCPtr(arg1), arg2, arg3); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PageTurnSignal() : this(NDalicPINVOKE.new_PageTurnSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PageTurnView.cs b/src/Tizen.NUI/src/internal/PageTurnView.cs new file mode 100755 index 0000000..9a2ebbe --- /dev/null +++ b/src/Tizen.NUI/src/internal/PageTurnView.cs @@ -0,0 +1,603 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + internal class PageTurnView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PageTurnView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PageTurnView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PageTurnView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageTurnView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + + public class PagePanStartedEventArgs : EventArgs + { + private PageTurnView _pageTurnView; + + public PageTurnView PageTurnView + { + get + { + return _pageTurnView; + } + set + { + _pageTurnView = value; + } + } + } + + public class PagePanFinishedEventArgs : EventArgs + { + private PageTurnView _pageTurnView; + + public PageTurnView PageTurnView + { + get + { + return _pageTurnView; + } + set + { + _pageTurnView = value; + } + } + } + + public class PageTurnStartedEventArgs : EventArgs + { + private PageTurnView _pageTurnView; + private uint _pageIndex; + private bool _isTurningForward; + + public PageTurnView PageTurnView + { + get + { + return _pageTurnView; + } + set + { + _pageTurnView = value; + } + } + + public uint PageIndex + { + get + { + return _pageIndex; + } + set + { + _pageIndex = value; + } + } + + public bool IsTurningForward + { + get + { + return _isTurningForward; + } + set + { + _isTurningForward = value; + } + } + + } + + public class PageTurnFinishedEventArgs : EventArgs + { + private PageTurnView _pageTurnView; + private uint _pageIndex; + private bool _isTurningForward; + + public PageTurnView PageTurnView + { + get + { + return _pageTurnView; + } + set + { + _pageTurnView = value; + } + } + + public uint PageIndex + { + get + { + return _pageIndex; + } + set + { + _pageIndex = value; + } + } + + public bool IsTurningForward + { + get + { + return _isTurningForward; + } + set + { + _isTurningForward = value; + } + } + + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PagePanStartedCallbackDelegate(IntPtr page); + private DaliEventHandler _pageTurnViewPagePanStartedEventHandler; + private PagePanStartedCallbackDelegate _pageTurnViewPagePanStartedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PagePanFinishedCallbackDelegate(IntPtr page); + private DaliEventHandler _pageTurnViewPagePanFinishedEventHandler; + private PagePanFinishedCallbackDelegate _pageTurnViewPagePanFinishedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PageTurnStartedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward); + private DaliEventHandler _pageTurnViewPageTurnStartedEventHandler; + private PageTurnStartedCallbackDelegate _pageTurnViewPageTurnStartedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PageTurnFinishedCallbackDelegate(IntPtr page, uint pageIndex, bool isTurningForward); + private DaliEventHandler _pageTurnViewPageTurnFinishedEventHandler; + private PageTurnFinishedCallbackDelegate _pageTurnViewPageTurnFinishedCallbackDelegate; + + public event DaliEventHandler PagePanStarted + { + add + { + lock (this) + { + // Restricted to only one listener + if (_pageTurnViewPagePanStartedEventHandler == null) + { + _pageTurnViewPagePanStartedEventHandler += value; + + _pageTurnViewPagePanStartedCallbackDelegate = new PagePanStartedCallbackDelegate(OnPagePanStarted); + this.PagePanStartedSignal().Connect(_pageTurnViewPagePanStartedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_pageTurnViewPagePanStartedEventHandler != null) + { + this.PagePanStartedSignal().Disconnect(_pageTurnViewPagePanStartedCallbackDelegate); + } + + _pageTurnViewPagePanStartedEventHandler -= value; + } + } + } + + // Callback for PageTurnView PagePanStarted signal + private void OnPagePanStarted(IntPtr page) + { + PagePanStartedEventArgs e = new PagePanStartedEventArgs(); + + // Populate all members of "e" (PagePanStartedEventArgs) with real page + e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr(page); + + if (_pageTurnViewPagePanStartedEventHandler != null) + { + //here we send all page to user event handlers + _pageTurnViewPagePanStartedEventHandler(this, e); + } + } + + public event DaliEventHandler PagePanFinished + { + add + { + lock (this) + { + // Restricted to only one listener + if (_pageTurnViewPagePanFinishedEventHandler == null) + { + _pageTurnViewPagePanFinishedEventHandler += value; + + _pageTurnViewPagePanFinishedCallbackDelegate = new PagePanFinishedCallbackDelegate(OnPagePanFinished); + this.PagePanFinishedSignal().Connect(_pageTurnViewPagePanFinishedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_pageTurnViewPagePanFinishedEventHandler != null) + { + this.PagePanFinishedSignal().Disconnect(_pageTurnViewPagePanFinishedCallbackDelegate); + } + + _pageTurnViewPagePanFinishedEventHandler -= value; + } + } + } + + // Callback for PageTurnView PagePanFinished signal + private void OnPagePanFinished(IntPtr page) + { + PagePanFinishedEventArgs e = new PagePanFinishedEventArgs(); + + // Populate all members of "e" (PagePanFinishedEventArgs) with real page + e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr(page); + + if (_pageTurnViewPagePanFinishedEventHandler != null) + { + //here we send all page to user event handlers + _pageTurnViewPagePanFinishedEventHandler(this, e); + } + } + + + public event DaliEventHandler PageTurnStarted + { + add + { + lock (this) + { + // Restricted to only one listener + if (_pageTurnViewPageTurnStartedEventHandler == null) + { + _pageTurnViewPageTurnStartedEventHandler += value; + + _pageTurnViewPageTurnStartedCallbackDelegate = new PageTurnStartedCallbackDelegate(OnPageTurnStarted); + this.PageTurnStartedSignal().Connect(_pageTurnViewPageTurnStartedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_pageTurnViewPageTurnStartedEventHandler != null) + { + this.PageTurnStartedSignal().Disconnect(_pageTurnViewPageTurnStartedCallbackDelegate); + } + + _pageTurnViewPageTurnStartedEventHandler -= value; + } + } + } + + // Callback for PageTurnView PageTurnStarted signal + private void OnPageTurnStarted(IntPtr page, uint pageIndex, bool isTurningForward) + { + PageTurnStartedEventArgs e = new PageTurnStartedEventArgs(); + + // Populate all members of "e" (PageTurnStartedEventArgs) with real page + e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr(page); + e.PageIndex = pageIndex; + e.IsTurningForward = isTurningForward; + + + if (_pageTurnViewPageTurnStartedEventHandler != null) + { + //here we send all page to user event handlers + _pageTurnViewPageTurnStartedEventHandler(this, e); + } + } + + + public event DaliEventHandler PageTurnFinished + { + add + { + lock (this) + { + // Restricted to only one listener + if (_pageTurnViewPageTurnFinishedEventHandler == null) + { + _pageTurnViewPageTurnFinishedEventHandler += value; + + _pageTurnViewPageTurnFinishedCallbackDelegate = new PageTurnFinishedCallbackDelegate(OnPageTurnFinished); + this.PageTurnFinishedSignal().Connect(_pageTurnViewPageTurnFinishedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_pageTurnViewPageTurnFinishedEventHandler != null) + { + this.PageTurnFinishedSignal().Disconnect(_pageTurnViewPageTurnFinishedCallbackDelegate); + } + + _pageTurnViewPageTurnFinishedEventHandler -= value; + } + } + } + + // Callback for PageTurnView PageTurnFinished signal + private void OnPageTurnFinished(IntPtr page, uint pageIndex, bool isTurningForward) + { + PageTurnFinishedEventArgs e = new PageTurnFinishedEventArgs(); + + // Populate all members of "e" (PageTurnFinishedEventArgs) with real page + e.PageTurnView = PageTurnView.GetPageTurnViewFromPtr(page); + e.PageIndex = pageIndex; + e.IsTurningForward = isTurningForward; + + + if (_pageTurnViewPageTurnFinishedEventHandler != null) + { + //here we send all page to user event handlers + _pageTurnViewPageTurnFinishedEventHandler(this, e); + } + } + + public static PageTurnView GetPageTurnViewFromPtr(global::System.IntPtr cPtr) + { + PageTurnView ret = new PageTurnView(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PageTurnView_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Property() : this(NDalicPINVOKE.new_PageTurnView_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int PAGE_SIZE = NDalicPINVOKE.PageTurnView_Property_PAGE_SIZE_get(); + public static readonly int CURRENT_PAGE_ID = NDalicPINVOKE.PageTurnView_Property_CURRENT_PAGE_ID_get(); + public static readonly int SPINE_SHADOW = NDalicPINVOKE.PageTurnView_Property_SPINE_SHADOW_get(); + + } + + public PageTurnView() : this(NDalicPINVOKE.new_PageTurnView__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PageTurnView(PageTurnView handle) : this(NDalicPINVOKE.new_PageTurnView__SWIG_1(PageTurnView.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PageTurnView Assign(PageTurnView handle) + { + PageTurnView ret = new PageTurnView(NDalicPINVOKE.PageTurnView_Assign(swigCPtr, PageTurnView.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public new static PageTurnView DownCast(BaseHandle handle) + { + PageTurnView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PageTurnView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PageTurnSignal PageTurnStartedSignal() + { + PageTurnSignal ret = new PageTurnSignal(NDalicPINVOKE.PageTurnView_PageTurnStartedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PageTurnSignal PageTurnFinishedSignal() + { + PageTurnSignal ret = new PageTurnSignal(NDalicPINVOKE.PageTurnView_PageTurnFinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PagePanSignal PagePanStartedSignal() + { + PagePanSignal ret = new PagePanSignal(NDalicPINVOKE.PageTurnView_PagePanStartedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PagePanSignal PagePanFinishedSignal() + { + PagePanSignal ret = new PagePanSignal(NDalicPINVOKE.PageTurnView_PagePanFinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public Vector2 PageSize + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(PageTurnView.Property.PAGE_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(PageTurnView.Property.PAGE_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + public int CurrentPageId + { + get + { + int temp = 0; + GetProperty(PageTurnView.Property.CURRENT_PAGE_ID).Get(out temp); + return temp; + } + set + { + SetProperty(PageTurnView.Property.CURRENT_PAGE_ID, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 SpineShadow + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(PageTurnView.Property.SPINE_SHADOW).Get(temp); + return temp; + } + set + { + SetProperty(PageTurnView.Property.SPINE_SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PanGestureDetectedSignal.cs b/src/Tizen.NUI/src/internal/PanGestureDetectedSignal.cs new file mode 100755 index 0000000..3f97cec --- /dev/null +++ b/src/Tizen.NUI/src/internal/PanGestureDetectedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class PanGestureDetectedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PanGestureDetectedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGestureDetectedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PanGestureDetectedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PanGestureDetectedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.PanGestureDetectedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.PanGestureDetectedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PanGestureDetectedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PanGestureDetectedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, PanGesture arg2) + { + NDalicPINVOKE.PanGestureDetectedSignal_Emit(swigCPtr, View.getCPtr(arg1), PanGesture.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PanGestureDetectedSignal() : this(NDalicPINVOKE.new_PanGestureDetectedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PanGestureDetector.cs b/src/Tizen.NUI/src/internal/PanGestureDetector.cs new file mode 100755 index 0000000..2573744 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PanGestureDetector.cs @@ -0,0 +1,523 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + + internal class PanGestureDetector : GestureDetector + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PanGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PanGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGestureDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PanGestureDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class DetectedEventArgs : EventArgs + { + private View _view; + private PanGesture _panGesture; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + public PanGesture PanGesture + { + get + { + return _panGesture; + } + set + { + _panGesture = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr panGesture); + private DaliEventHandler _panGestureEventHandler; + private DetectedCallbackDelegate _panGestureCallbackDelegate; + + + public event DaliEventHandler Detected + { + add + { + lock (this) + { + // Restricted to only one listener + if (_panGestureEventHandler == null) + { + _panGestureEventHandler += value; + + _panGestureCallbackDelegate = new DetectedCallbackDelegate(OnPanGestureDetected); + this.DetectedSignal().Connect(_panGestureCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_panGestureEventHandler != null) + { + this.DetectedSignal().Disconnect(_panGestureCallbackDelegate); + } + + _panGestureEventHandler -= value; + } + } + } + + private void OnPanGestureDetected(IntPtr actor, IntPtr panGesture) + { + DetectedEventArgs e = new DetectedEventArgs(); + + // Populate all members of "e" (PanGestureEventArgs) with real data + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; + e.PanGesture = Tizen.NUI.PanGesture.GetPanGestureFromPtr(panGesture); + + if (_panGestureEventHandler != null) + { + //here we send all data to user event handlers + _panGestureEventHandler(this, e); + } + + } + + + public static PanGestureDetector GetPanGestureDetectorFromPtr(global::System.IntPtr cPtr) + { + PanGestureDetector ret = new PanGestureDetector(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PanGestureDetector_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Property() : this(NDalicPINVOKE.new_PanGestureDetector_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int SCREEN_POSITION = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_POSITION_get(); + public static readonly int SCREEN_DISPLACEMENT = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_DISPLACEMENT_get(); + public static readonly int SCREEN_VELOCITY = NDalicPINVOKE.PanGestureDetector_Property_SCREEN_VELOCITY_get(); + public static readonly int LOCAL_POSITION = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_POSITION_get(); + public static readonly int LOCAL_DISPLACEMENT = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_DISPLACEMENT_get(); + public static readonly int LOCAL_VELOCITY = NDalicPINVOKE.PanGestureDetector_Property_LOCAL_VELOCITY_get(); + public static readonly int PANNING = NDalicPINVOKE.PanGestureDetector_Property_PANNING_get(); + + } + + public static Radian DIRECTION_LEFT + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_LEFT_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DIRECTION_RIGHT + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_RIGHT_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DIRECTION_UP + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_UP_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DIRECTION_DOWN + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_DOWN_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DIRECTION_HORIZONTAL + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_HORIZONTAL_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DIRECTION_VERTICAL + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DIRECTION_VERTICAL_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Radian DEFAULT_THRESHOLD + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGestureDetector_DEFAULT_THRESHOLD_get(); + Radian ret = (cPtr == global::System.IntPtr.Zero) ? null : new Radian(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public PanGestureDetector() : this(NDalicPINVOKE.PanGestureDetector_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static PanGestureDetector DownCast(BaseHandle handle) + { + PanGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PanGestureDetector; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PanGestureDetector(PanGestureDetector handle) : this(NDalicPINVOKE.new_PanGestureDetector__SWIG_1(PanGestureDetector.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PanGestureDetector Assign(PanGestureDetector rhs) + { + PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.PanGestureDetector_Assign(swigCPtr, PanGestureDetector.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMinimumTouchesRequired(uint minimum) + { + NDalicPINVOKE.PanGestureDetector_SetMinimumTouchesRequired(swigCPtr, minimum); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetMaximumTouchesRequired(uint maximum) + { + NDalicPINVOKE.PanGestureDetector_SetMaximumTouchesRequired(swigCPtr, maximum); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetMinimumTouchesRequired() + { + uint ret = NDalicPINVOKE.PanGestureDetector_GetMinimumTouchesRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetMaximumTouchesRequired() + { + uint ret = NDalicPINVOKE.PanGestureDetector_GetMaximumTouchesRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void AddAngle(Radian angle, Radian threshold) + { + NDalicPINVOKE.PanGestureDetector_AddAngle__SWIG_0(swigCPtr, Radian.getCPtr(angle), Radian.getCPtr(threshold)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddAngle(Radian angle) + { + NDalicPINVOKE.PanGestureDetector_AddAngle__SWIG_1(swigCPtr, Radian.getCPtr(angle)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddDirection(Radian direction, Radian threshold) + { + NDalicPINVOKE.PanGestureDetector_AddDirection__SWIG_0(swigCPtr, Radian.getCPtr(direction), Radian.getCPtr(threshold)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddDirection(Radian direction) + { + NDalicPINVOKE.PanGestureDetector_AddDirection__SWIG_1(swigCPtr, Radian.getCPtr(direction)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetAngleCount() + { + uint ret = NDalicPINVOKE.PanGestureDetector_GetAngleCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal AngleThresholdPair GetAngle(uint index) + { + AngleThresholdPair ret = new AngleThresholdPair(NDalicPINVOKE.PanGestureDetector_GetAngle(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ClearAngles() + { + NDalicPINVOKE.PanGestureDetector_ClearAngles(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveAngle(Radian angle) + { + NDalicPINVOKE.PanGestureDetector_RemoveAngle(swigCPtr, Radian.getCPtr(angle)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveDirection(Radian direction) + { + NDalicPINVOKE.PanGestureDetector_RemoveDirection(swigCPtr, Radian.getCPtr(direction)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PanGestureDetectedSignal DetectedSignal() + { + PanGestureDetectedSignal ret = new PanGestureDetectedSignal(NDalicPINVOKE.PanGestureDetector_DetectedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void SetPanGestureProperties(PanGesture pan) + { + NDalicPINVOKE.PanGestureDetector_SetPanGestureProperties(PanGesture.getCPtr(pan)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 ScreenPosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_POSITION).Get(temp); + return temp; + } + } + public Vector2 ScreenDisplacement + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_DISPLACEMENT).Get(temp); + return temp; + } + } + public Vector2 ScreenVelocity + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.SCREEN_VELOCITY).Get(temp); + return temp; + } + } + public Vector2 LocalPosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_POSITION).Get(temp); + return temp; + } + } + public Vector2 LocalDisplacement + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_DISPLACEMENT).Get(temp); + return temp; + } + } + public Vector2 LocalVelocity + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.LOCAL_VELOCITY).Get(temp); + return temp; + } + } + public bool Panning + { + get + { + bool temp = false; + Tizen.NUI.Object.GetProperty(swigCPtr, PanGestureDetector.Property.PANNING).Get(out temp); + return temp; + } + } + } + +} diff --git a/src/Tizen.NUI/src/internal/PathConstrainer.cs b/src/Tizen.NUI/src/internal/PathConstrainer.cs new file mode 100755 index 0000000..98e2d9e --- /dev/null +++ b/src/Tizen.NUI/src/internal/PathConstrainer.cs @@ -0,0 +1,248 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PathConstrainer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PathConstrainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PathConstrainer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PathConstrainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PathConstrainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PathConstrainer_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Property() : this(NDalicPINVOKE.new_PathConstrainer_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static readonly int FORWARD = NDalicPINVOKE.PathConstrainer_Property_FORWARD_get(); + internal static readonly int POINTS = NDalicPINVOKE.PathConstrainer_Property_POINTS_get(); + internal static readonly int CONTROL_POINTS = NDalicPINVOKE.PathConstrainer_Property_CONTROL_POINTS_get(); + + } + + public PathConstrainer() : this(NDalicPINVOKE.PathConstrainer_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static PathConstrainer DownCast(BaseHandle handle) + { + PathConstrainer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PathConstrainer; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal PathConstrainer(PathConstrainer handle) : this(NDalicPINVOKE.new_PathConstrainer__SWIG_1(PathConstrainer.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PathConstrainer Assign(PathConstrainer rhs) + { + PathConstrainer ret = new PathConstrainer(NDalicPINVOKE.PathConstrainer_Assign(swigCPtr, PathConstrainer.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Apply(Property target, Property source, Vector2 range, Vector2 wrap) + { + NDalicPINVOKE.PathConstrainer_Apply__SWIG_0(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range), Vector2.getCPtr(wrap)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Apply(Property target, Property source, Vector2 range) + { + NDalicPINVOKE.PathConstrainer_Apply__SWIG_1(swigCPtr, Property.getCPtr(target), Property.getCPtr(source), Vector2.getCPtr(range)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Remove(Animatable target) + { + NDalicPINVOKE.PathConstrainer_Remove(swigCPtr, Animatable.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector3 Forward + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.FORWARD).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.FORWARD, new Tizen.NUI.PropertyValue(value)); + } + } + + public PropertyArray Points + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.POINTS).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.POINTS, new Tizen.NUI.PropertyValue(value)); + } + } + + public PropertyArray ControlPoints + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, PathConstrainer.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PinchGestureDetectedSignal.cs b/src/Tizen.NUI/src/internal/PinchGestureDetectedSignal.cs new file mode 100755 index 0000000..1d88dbf --- /dev/null +++ b/src/Tizen.NUI/src/internal/PinchGestureDetectedSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class PinchGestureDetectedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PinchGestureDetectedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGestureDetectedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PinchGestureDetectedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PinchGestureDetectedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.PinchGestureDetectedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.PinchGestureDetectedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PinchGestureDetectedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PinchGestureDetectedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, PinchGesture arg2) + { + NDalicPINVOKE.PinchGestureDetectedSignal_Emit(swigCPtr, View.getCPtr(arg1), PinchGesture.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PinchGestureDetectedSignal() : this(NDalicPINVOKE.new_PinchGestureDetectedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PinchGestureDetector.cs b/src/Tizen.NUI/src/internal/PinchGestureDetector.cs new file mode 100755 index 0000000..449509f --- /dev/null +++ b/src/Tizen.NUI/src/internal/PinchGestureDetector.cs @@ -0,0 +1,199 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + + internal class PinchGestureDetector : GestureDetector + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PinchGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PinchGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGestureDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PinchGestureDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public class DetectedEventArgs : EventArgs + { + private View _view; + private PinchGesture _pinchGesture; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + public PinchGesture PinchGesture + { + get + { + return _pinchGesture; + } + set + { + _pinchGesture = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr pinchGesture); + private DaliEventHandler _pinchGestureEventHandler; + private DetectedCallbackDelegate _pinchGestureCallbackDelegate; + + + public event DaliEventHandler Detected + { + add + { + lock (this) + { + // Restricted to only one listener + if (_pinchGestureEventHandler == null) + { + _pinchGestureEventHandler += value; + + _pinchGestureCallbackDelegate = new DetectedCallbackDelegate(OnPinchGestureDetected); + this.DetectedSignal().Connect(_pinchGestureCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_pinchGestureEventHandler != null) + { + this.DetectedSignal().Disconnect(_pinchGestureCallbackDelegate); + } + + _pinchGestureEventHandler -= value; + } + } + } + + private void OnPinchGestureDetected(IntPtr actor, IntPtr pinchGesture) + { + DetectedEventArgs e = new DetectedEventArgs(); + + // Populate all members of "e" (DetectedEventArgs) with real data + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; + e.PinchGesture = Tizen.NUI.PinchGesture.GetPinchGestureFromPtr(pinchGesture); + + if (_pinchGestureEventHandler != null) + { + //here we send all data to user event handlers + _pinchGestureEventHandler(this, e); + } + + } + + + public static PinchGestureDetector GetPinchGestureDetectorFromPtr(global::System.IntPtr cPtr) + { + PinchGestureDetector ret = new PinchGestureDetector(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public PinchGestureDetector() : this(NDalicPINVOKE.PinchGestureDetector_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static PinchGestureDetector DownCast(BaseHandle handle) + { + PinchGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PinchGestureDetector; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PinchGestureDetector(PinchGestureDetector handle) : this(NDalicPINVOKE.new_PinchGestureDetector__SWIG_1(PinchGestureDetector.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PinchGestureDetector Assign(PinchGestureDetector rhs) + { + PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.PinchGestureDetector_Assign(swigCPtr, PinchGestureDetector.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal PinchGestureDetectedSignal DetectedSignal() + { + PinchGestureDetectedSignal ret = new PinchGestureDetectedSignal(NDalicPINVOKE.PinchGestureDetector_DetectedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PreFocusChangeSignal.cs b/src/Tizen.NUI/src/internal/PreFocusChangeSignal.cs new file mode 100755 index 0000000..78799a7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PreFocusChangeSignal.cs @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using Tizen.NUI.BaseComponents; + +using System; + +namespace Tizen.NUI +{ + + internal delegate IntPtr SwigDelegatePreFocusChangeSignal(IntPtr current, IntPtr proposed, View.FocusDirection direction); + + internal class PreFocusChangeSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PreFocusChangeSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PreFocusChangeSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PreFocusChangeSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_PreFocusChangeSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.PreFocusChangeSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.PreFocusChangeSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(FocusManager.PreFocusChangeEventCallback func) + { + NDalicManualPINVOKE.PreFocusChangeSignal_Connect(swigCPtr, func); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.PreFocusChangeSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public View Emit(View arg1, View arg2, View.FocusDirection arg3) + { + View ret = new View(NDalicManualPINVOKE.PreFocusChangeSignal_Emit(swigCPtr, View.getCPtr(arg1), View.getCPtr(arg2), (int)arg3), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PreFocusChangeSignal() : this(NDalicManualPINVOKE.new_PreFocusChangeSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ProgressBarValueChangedSignal.cs b/src/Tizen.NUI/src/internal/ProgressBarValueChangedSignal.cs new file mode 100755 index 0000000..b1f5b6b --- /dev/null +++ b/src/Tizen.NUI/src/internal/ProgressBarValueChangedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ProgressBarValueChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ProgressBarValueChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ProgressBarValueChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ProgressBarValueChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ProgressBarValueChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ProgressBarValueChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ProgressBarValueChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ProgressBarValueChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ProgressBarValueChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Tizen.NUI.UIComponents.ProgressBar arg1, float arg2, float arg3) + { + NDalicPINVOKE.ProgressBarValueChangedSignal_Emit(swigCPtr, Tizen.NUI.UIComponents.ProgressBar.getCPtr(arg1), arg2, arg3); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ProgressBarValueChangedSignal() : this(NDalicPINVOKE.new_ProgressBarValueChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PropertyCondition.cs b/src/Tizen.NUI/src/internal/PropertyCondition.cs new file mode 100755 index 0000000..278349f --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyCondition.cs @@ -0,0 +1,100 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PropertyCondition : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PropertyCondition(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PropertyCondition_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyCondition obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PropertyCondition(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public PropertyCondition() : this(NDalicPINVOKE.new_PropertyCondition__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyCondition(PropertyCondition handle) : this(NDalicPINVOKE.new_PropertyCondition__SWIG_1(PropertyCondition.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyCondition Assign(PropertyCondition rhs) + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.PropertyCondition_Assign(swigCPtr, PropertyCondition.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetArgumentCount() + { + uint ret = NDalicPINVOKE.PropertyCondition_GetArgumentCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetArgument(uint index) + { + float ret = NDalicPINVOKE.PropertyCondition_GetArgument(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PropertyNotification.cs b/src/Tizen.NUI/src/internal/PropertyNotification.cs new file mode 100755 index 0000000..50dc344 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyNotification.cs @@ -0,0 +1,239 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + + internal class PropertyNotification : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PropertyNotification(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PropertyNotification_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyNotification obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PropertyNotification(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /** + * @brief Event arguments that passed via Notify signal + * + */ + public class NotifyEventArgs : EventArgs + { + private PropertyNotification _propertyNotification; + + /** + * @brief PropertyNotification - is the PropertyNotification handle that has the notification properties. + * + */ + public PropertyNotification PropertyNotification + { + get + { + return _propertyNotification; + } + set + { + _propertyNotification = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void NotifyEventCallbackDelegate(IntPtr propertyNotification); + private DaliEventHandler _propertyNotificationNotifyEventHandler; + private NotifyEventCallbackDelegate _propertyNotificationNotifyEventCallbackDelegate; + + /** + * @brief Event for Notified signal which can be used to subscribe/unsubscribe the event handler + * (in the type of NotifyEventHandler-DaliEventHandler) provided by the user. + * Notified signal is emitted when the notification upon a condition of the property being met, has occurred. + */ + public event DaliEventHandler Notified + { + add + { + lock (this) + { + // Restricted to only one listener + if (_propertyNotificationNotifyEventHandler == null) + { + _propertyNotificationNotifyEventHandler += value; + + _propertyNotificationNotifyEventCallbackDelegate = new NotifyEventCallbackDelegate(OnPropertyNotificationNotify); + this.NotifySignal().Connect(_propertyNotificationNotifyEventCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_propertyNotificationNotifyEventHandler != null) + { + this.NotifySignal().Disconnect(_propertyNotificationNotifyEventCallbackDelegate); + } + + _propertyNotificationNotifyEventHandler -= value; + } + } + } + + // Callback for PropertyNotification NotifySignal + private void OnPropertyNotificationNotify(IntPtr propertyNotification) + { + NotifyEventArgs e = new NotifyEventArgs(); + e.PropertyNotification = GetPropertyNotificationFromPtr(propertyNotification); + + if (_propertyNotificationNotifyEventHandler != null) + { + //here we send all data to user event handlers + _propertyNotificationNotifyEventHandler(this, e); + } + } + + public static PropertyNotification GetPropertyNotificationFromPtr(global::System.IntPtr cPtr) + { + PropertyNotification ret = new PropertyNotification(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public PropertyNotification() : this(NDalicPINVOKE.new_PropertyNotification__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static PropertyNotification DownCast(BaseHandle handle) + { + PropertyNotification ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PropertyNotification; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyNotification(PropertyNotification handle) : this(NDalicPINVOKE.new_PropertyNotification__SWIG_1(PropertyNotification.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyNotification Assign(PropertyNotification rhs) + { + PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.PropertyNotification_Assign(swigCPtr, PropertyNotification.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyCondition GetCondition() + { + PropertyCondition ret = new PropertyCondition(NDalicPINVOKE.PropertyNotification_GetCondition__SWIG_0(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animatable GetTarget() + { + Animatable ret = new Animatable(NDalicPINVOKE.PropertyNotification_GetTarget(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int GetTargetProperty() + { + int ret = NDalicPINVOKE.PropertyNotification_GetTargetProperty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetNotifyMode(PropertyNotification.NotifyMode mode) + { + NDalicPINVOKE.PropertyNotification_SetNotifyMode(swigCPtr, (int)mode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyNotification.NotifyMode GetNotifyMode() + { + PropertyNotification.NotifyMode ret = (PropertyNotification.NotifyMode)NDalicPINVOKE.PropertyNotification_GetNotifyMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool GetNotifyResult() + { + bool ret = NDalicPINVOKE.PropertyNotification_GetNotifyResult(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyNotifySignal NotifySignal() + { + PropertyNotifySignal ret = new PropertyNotifySignal(NDalicPINVOKE.PropertyNotification_NotifySignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum NotifyMode + { + Disabled, + NotifyOnTrue, + NotifyOnFalse, + NotifyOnChanged + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PropertyNotifySignal.cs b/src/Tizen.NUI/src/internal/PropertyNotifySignal.cs new file mode 100755 index 0000000..59e96cb --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyNotifySignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PropertyNotifySignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyNotifySignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyNotifySignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PropertyNotifySignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PropertyNotifySignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.PropertyNotifySignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.PropertyNotifySignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PropertyNotifySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.PropertyNotifySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(PropertyNotification arg) + { + NDalicPINVOKE.PropertyNotifySignal_Emit(swigCPtr, PropertyNotification.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PropertyNotifySignal() : this(NDalicPINVOKE.new_PropertyNotifySignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/PropertyRangeManager.cs b/src/Tizen.NUI/src/internal/PropertyRangeManager.cs new file mode 100755 index 0000000..c875ef9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyRangeManager.cs @@ -0,0 +1,141 @@ + + +using System.Reflection; +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// Helper class for calculating what property indexes should be assigned to C# View (view) classes. + /// + internal class PropertyRangeManager + { + private Dictionary _propertyRange; + + /// + /// Initializes a new instance of the class. + /// + public PropertyRangeManager() + { + _propertyRange = new Dictionary(); + } + + /// + /// Only called if a View has scriptable properties + /// + private PropertyRange RegisterView(string viewName, System.Type viewType) + { + PropertyRange range; + + if (_propertyRange.TryGetValue(viewName, out range)) + { + // already registered + return range; + } + + // Find out the event and animatable start indexes for the type + range = new PropertyRange(); + + GetPropertyStartRange(viewType, ref range); + + // add it to our dictionary + _propertyRange.Add(viewName, range); + + return range; + + } + + /// + /// Gets the index of the property. + /// Each property has to have unique index for this view type + /// + /// The property index. + /// View name + /// View type + /// Type. + public int GetPropertyIndex(string viewName, System.Type viewType, ScriptableProperty.ScriptableType type) + { + + PropertyRange range; + + if (!_propertyRange.TryGetValue(viewName, out range)) + { + // view not found, register it now + range = RegisterView(viewName, viewType); + } + + int index = range.GetNextFreePropertyIndex(type); + + // update the dictionary + _propertyRange[viewName] = range; + + return index; + + } + + /// + /// We calculate the start property indices, based on the type and it's class heirachy, e.g. DateView (70,000)- > Spin (60,000) -> View (50,000) + /// + private void GetPropertyStartRange(System.Type viewType, ref PropertyRange range) + { + const int maxCountPerDerivation = 1000; // For child and animtable properties we use a gap of 1000 between each + // views property range in the heirachy + + // custom views start there property index, at view_PROPERTY_END_INDEX + // we add 1000, just incase View class (our C# custom view base) starts using scriptable properties + int startEventPropertyIndex = (int)View.PropertyRange.CONTROL_PROPERTY_END_INDEX + maxCountPerDerivation; + + // for animatable properties current range starts at ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX, + // we add 1000, just incase View class starts using animatable properties + int startAnimatablePropertyIndex = (int)Tizen.NUI.PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + maxCountPerDerivation; + + while (viewType.GetTypeInfo().BaseType.Name != "CustomView") // custom view is our C# view base class. we don't go any deeper. + { + // for every base class increase property start index + startEventPropertyIndex += (int)Tizen.NUI.PropertyRanges.DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION; // DALi uses 10,000 + startAnimatablePropertyIndex += maxCountPerDerivation; + NUILog.Debug("getStartPropertyIndex = " + viewType.Name + "current index " + startEventPropertyIndex); + viewType = viewType.GetTypeInfo().BaseType; + } + + range.startEventIndex = startEventPropertyIndex; + range.lastUsedEventIndex = startEventPropertyIndex; + + range.startAnimationIndex = startAnimatablePropertyIndex; + range.lastUsedAnimationIndex = startAnimatablePropertyIndex; + + } + + + public struct PropertyRange + { + + public int GetNextFreePropertyIndex(ScriptableProperty.ScriptableType type) + { + if (type == ScriptableProperty.ScriptableType.Default) + { + lastUsedEventIndex++; + return lastUsedEventIndex; + } + else + { + lastUsedAnimationIndex++; + return lastUsedAnimationIndex; + } + } + + + public int startEventIndex; /// start of the property range + public int lastUsedEventIndex; /// last used of the property index + + public int startAnimationIndex; /// start of the property range + public int lastUsedAnimationIndex; /// last used of the property index + }; + + + + } +} diff --git a/src/Tizen.NUI/src/internal/PropertyRanges.cs b/src/Tizen.NUI/src/internal/PropertyRanges.cs new file mode 100755 index 0000000..3378a87 --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyRanges.cs @@ -0,0 +1,42 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum PropertyRanges + { + DEFAULT_OBJECT_PROPERTY_START_INDEX = 0, + DEFAULT_ACTOR_PROPERTY_START_INDEX = DEFAULT_OBJECT_PROPERTY_START_INDEX, + DEFAULT_ACTOR_PROPERTY_MAX_COUNT = 10000, + DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX = DEFAULT_ACTOR_PROPERTY_START_INDEX + DEFAULT_ACTOR_PROPERTY_MAX_COUNT, + DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION = 10000, + DEFAULT_GESTURE_DETECTOR_PROPERTY_START_INDEX = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX, + DEFAULT_RENDERER_PROPERTY_START_INDEX = 9000000, + DEFAULT_RENDERER_PROPERTY_MAX_INDEX = DEFAULT_RENDERER_PROPERTY_START_INDEX + 100000, + PROPERTY_REGISTRATION_START_INDEX = 10000000, + DEFAULT_PROPERTY_MAX_COUNT = PROPERTY_REGISTRATION_START_INDEX, + PROPERTY_REGISTRATION_MAX_INDEX = 19999999, + ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX = 20000000, + ANIMATABLE_PROPERTY_REGISTRATION_MAX_INDEX = 29999999, + CHILD_PROPERTY_REGISTRATION_START_INDEX = 45000000, + CHILD_PROPERTY_REGISTRATION_MAX_INDEX = 49999999, + PROPERTY_CUSTOM_START_INDEX = 50000000, + PROPERTY_CUSTOM_MAX_INDEX = 59999999, + CORE_PROPERTY_MAX_INDEX = PROPERTY_CUSTOM_MAX_INDEX + } + +} diff --git a/src/Tizen.NUI/src/internal/PropertyRegistration.cs b/src/Tizen.NUI/src/internal/PropertyRegistration.cs new file mode 100755 index 0000000..66bc5ea --- /dev/null +++ b/src/Tizen.NUI/src/internal/PropertyRegistration.cs @@ -0,0 +1,110 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class PropertyRegistration : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyRegistration(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyRegistration obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PropertyRegistration() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PropertyRegistration(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public PropertyRegistration(TypeRegistration registered, string name, int index, PropertyType type, SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void setFunc, SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value getFunc) : this(NDalicPINVOKE.new_PropertyRegistration(TypeRegistration.getCPtr(registered), name, index, (int)type, SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void.getCPtr(setFunc), SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value.getCPtr(getFunc)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RefObject.cs b/src/Tizen.NUI/src/internal/RefObject.cs new file mode 100755 index 0000000..2ef4811 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RefObject.cs @@ -0,0 +1,129 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class RefObject : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RefObject(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RefObject obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~RefObject() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public static RefObject GetRefObjectFromPtr(global::System.IntPtr cPtr) + { + RefObject ret = new RefObject(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reference() + { + NDalicPINVOKE.RefObject_Reference(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Unreference() + { + NDalicPINVOKE.RefObject_Unreference(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int ReferenceCount() + { + int ret = NDalicPINVOKE.RefObject_ReferenceCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Registry.cs b/src/Tizen.NUI/src/internal/Registry.cs new file mode 100755 index 0000000..cf91e4e --- /dev/null +++ b/src/Tizen.NUI/src/internal/Registry.cs @@ -0,0 +1,116 @@ + +using System.Reflection; +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// This is used to store a mapping between C++ base handle objects and it's C# instances. + /// + /// + internal sealed class Registry + { + /// + /// Registry is a singleton + /// + private static Registry instance = null; + + /// + /// Given a C++ object the dictionary allows us to find which C# object it belongs to. + /// By keeping the weak reference only, it will allow the object to be garbage collected. + /// + private Dictionary _controlMap; + + private Registry() + { + _controlMap = new Dictionary(); + } + + + /// + /// Store the mapping between this instance of BaseHandle (C# base class) and native part. + /// + /// The instance of BaseHandle (C# base class) + internal static void Register(BaseHandle baseHandle) + { + // We store a pointer to the RefObject for the control + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); + + NUILog.Debug("________Storing ref object cptr in control map Hex: {0:X}" + refCptr); + + if (!Instance._controlMap.ContainsKey(refCptr)) + { + Instance._controlMap.Add(refCptr, new WeakReference(baseHandle, false)); + } + + return; + } + + /// + /// Remove the this instance of BaseHandle (C# base class) and native part from the mapping table. + /// + /// The instance of BaseHandle (C# base class) + internal static void Unregister(BaseHandle baseHandle) + { + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refCptr = (IntPtr)RefObject.getCPtr(refObj); + + if (Instance._controlMap.ContainsKey(refCptr)) + { + Instance._controlMap.Remove(refCptr); + } + + return; + } + + private static Registry Instance + { + get + { + if (instance == null) + { + instance = new Registry(); + } + return instance; + } + } + + internal static BaseHandle GetManagedBaseHandleFromNativePtr(BaseHandle baseHandle) + { + RefObject refObj = baseHandle.GetObjectPtr(); + IntPtr refObjectPtr = (IntPtr)RefObject.getCPtr(refObj); + + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); + } + + internal static BaseHandle GetManagedBaseHandleFromNativePtr(IntPtr cPtr) + { + IntPtr refObjectPtr = NDalicPINVOKE.GetRefObjectPtr(cPtr); + + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + return GetManagedBaseHandleFromRefObject(refObjectPtr); + } + + internal static BaseHandle GetManagedBaseHandleFromRefObject(IntPtr refObjectPtr) + { + // we store a dictionary of ref-obects (C++ land) to managed obects (C# land) + WeakReference weakReference; + + if (Instance._controlMap.TryGetValue(refObjectPtr, out weakReference)) + { + BaseHandle ret = weakReference.Target as BaseHandle; + return ret; + } + else + { + return null; + } + } + + } +} diff --git a/src/Tizen.NUI/src/internal/RenderBufferFormat.cs b/src/Tizen.NUI/src/internal/RenderBufferFormat.cs new file mode 100755 index 0000000..5336007 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderBufferFormat.cs @@ -0,0 +1,28 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum RenderBufferFormat + { + COLOR, + COLOR_DEPTH, + COLOR_STENCIL, + COLOR_DEPTH_STENCIL + } + +} diff --git a/src/Tizen.NUI/src/internal/RenderModeType.cs b/src/Tizen.NUI/src/internal/RenderModeType.cs new file mode 100755 index 0000000..c3f7f32 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderModeType.cs @@ -0,0 +1,29 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum RenderModeType + { + NONE, + AUTO, + COLOR, + STENCIL, + COLOR_STENCIL + } + +} diff --git a/src/Tizen.NUI/src/internal/RenderTask.cs b/src/Tizen.NUI/src/internal/RenderTask.cs new file mode 100755 index 0000000..babb0ed --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderTask.cs @@ -0,0 +1,554 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class RenderTask : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal RenderTask(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.RenderTask_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RenderTask obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RenderTask(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public static RenderTask GetRenderTaskFromPtr(global::System.IntPtr cPtr) + { + RenderTask ret = new RenderTask(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RenderTask_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public Property() : this(NDalicPINVOKE.new_RenderTask_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int VIEWPORT_POSITION = NDalicPINVOKE.RenderTask_Property_VIEWPORT_POSITION_get(); + public static readonly int VIEWPORT_SIZE = NDalicPINVOKE.RenderTask_Property_VIEWPORT_SIZE_get(); + public static readonly int CLEAR_COLOR = NDalicPINVOKE.RenderTask_Property_CLEAR_COLOR_get(); + public static readonly int REQUIRES_SYNC = NDalicPINVOKE.RenderTask_Property_REQUIRES_SYNC_get(); + + } + + internal static SWIGTYPE_p_f_r_Dali__Vector2__bool DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.RenderTask_DEFAULT_SCREEN_TO_FRAMEBUFFER_FUNCTION_get(); + SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static SWIGTYPE_p_f_r_Dali__Vector2__bool FULLSCREEN_FRAMEBUFFER_FUNCTION + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.RenderTask_FULLSCREEN_FRAMEBUFFER_FUNCTION_get(); + SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool DEFAULT_EXCLUSIVE + { + get + { + bool ret = NDalicPINVOKE.RenderTask_DEFAULT_EXCLUSIVE_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool DEFAULT_INPUT_ENABLED + { + get + { + bool ret = NDalicPINVOKE.RenderTask_DEFAULT_INPUT_ENABLED_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static Vector4 DEFAULT_CLEAR_COLOR + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.RenderTask_DEFAULT_CLEAR_COLOR_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool DEFAULT_CLEAR_ENABLED + { + get + { + bool ret = NDalicPINVOKE.RenderTask_DEFAULT_CLEAR_ENABLED_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static bool DEFAULT_CULL_MODE + { + get + { + bool ret = NDalicPINVOKE.RenderTask_DEFAULT_CULL_MODE_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public static uint DEFAULT_REFRESH_RATE + { + get + { + uint ret = NDalicPINVOKE.RenderTask_DEFAULT_REFRESH_RATE_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public RenderTask() : this(NDalicPINVOKE.new_RenderTask__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public new static RenderTask DownCast(BaseHandle handle) + { + RenderTask ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as RenderTask; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RenderTask(RenderTask handle) : this(NDalicPINVOKE.new_RenderTask__SWIG_1(RenderTask.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RenderTask Assign(RenderTask rhs) + { + RenderTask ret = new RenderTask(NDalicPINVOKE.RenderTask_Assign(swigCPtr, RenderTask.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetSourceView(View view) + { + NDalicPINVOKE.RenderTask_SetSourceActor(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public View GetSourceView() + { + View ret = new View(NDalicPINVOKE.RenderTask_GetSourceActor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetExclusive(bool exclusive) + { + NDalicPINVOKE.RenderTask_SetExclusive(swigCPtr, exclusive); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsExclusive() + { + bool ret = NDalicPINVOKE.RenderTask_IsExclusive(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetInputEnabled(bool enabled) + { + NDalicPINVOKE.RenderTask_SetInputEnabled(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetInputEnabled() + { + bool ret = NDalicPINVOKE.RenderTask_GetInputEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetCamera(Camera camera) + { + NDalicPINVOKE.RenderTask_SetCameraActor(swigCPtr, Camera.getCPtr(camera)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Camera GetCamera() + { + Camera ret = new Camera(NDalicPINVOKE.RenderTask_GetCameraActor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetTargetFrameBuffer(FrameBufferImage frameBuffer) + { + NDalicPINVOKE.RenderTask_SetTargetFrameBuffer(swigCPtr, FrameBufferImage.getCPtr(frameBuffer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FrameBufferImage GetTargetFrameBuffer() + { + FrameBufferImage ret = new FrameBufferImage(NDalicPINVOKE.RenderTask_GetTargetFrameBuffer(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFrameBuffer(FrameBuffer frameBuffer) + { + NDalicPINVOKE.RenderTask_SetFrameBuffer(swigCPtr, FrameBuffer.getCPtr(frameBuffer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public FrameBuffer GetFrameBuffer() + { + FrameBuffer ret = new FrameBuffer(NDalicPINVOKE.RenderTask_GetFrameBuffer(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetScreenToFrameBufferFunction(SWIGTYPE_p_f_r_Dali__Vector2__bool conversionFunction) + { + NDalicPINVOKE.RenderTask_SetScreenToFrameBufferFunction(swigCPtr, SWIGTYPE_p_f_r_Dali__Vector2__bool.getCPtr(conversionFunction)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_f_r_Dali__Vector2__bool GetScreenToFrameBufferFunction() + { + global::System.IntPtr cPtr = NDalicPINVOKE.RenderTask_GetScreenToFrameBufferFunction(swigCPtr); + SWIGTYPE_p_f_r_Dali__Vector2__bool ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_r_Dali__Vector2__bool(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScreenToFrameBufferMappingView(View mappingView) + { + NDalicPINVOKE.RenderTask_SetScreenToFrameBufferMappingActor(swigCPtr, View.getCPtr(mappingView)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public View GetScreenToFrameBufferMappingView() + { + View ret = new View(NDalicPINVOKE.RenderTask_GetScreenToFrameBufferMappingActor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetViewportPosition(Vector2 position) + { + NDalicPINVOKE.RenderTask_SetViewportPosition(swigCPtr, Vector2.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 GetCurrentViewportPosition() + { + Vector2 ret = new Vector2(NDalicPINVOKE.RenderTask_GetCurrentViewportPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetViewportSize(Vector2 size) + { + NDalicPINVOKE.RenderTask_SetViewportSize(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 GetCurrentViewportSize() + { + Vector2 ret = new Vector2(NDalicPINVOKE.RenderTask_GetCurrentViewportSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetViewport(Rectangle viewport) + { + NDalicPINVOKE.RenderTask_SetViewport(swigCPtr, Rectangle.getCPtr(viewport)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Rectangle GetViewport() + { + Rectangle ret = new Rectangle(NDalicPINVOKE.RenderTask_GetViewport(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetClearColor(Vector4 color) + { + NDalicPINVOKE.RenderTask_SetClearColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector4 GetClearColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.RenderTask_GetClearColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetClearEnabled(bool enabled) + { + NDalicPINVOKE.RenderTask_SetClearEnabled(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetClearEnabled() + { + bool ret = NDalicPINVOKE.RenderTask_GetClearEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetCullMode(bool cullMode) + { + NDalicPINVOKE.RenderTask_SetCullMode(swigCPtr, cullMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetCullMode() + { + bool ret = NDalicPINVOKE.RenderTask_GetCullMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetRefreshRate(uint refreshRate) + { + NDalicPINVOKE.RenderTask_SetRefreshRate(swigCPtr, refreshRate); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetRefreshRate() + { + uint ret = NDalicPINVOKE.RenderTask_GetRefreshRate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool WorldToViewport(Vector3 position, out float viewportX, out float viewportY) + { + bool ret = NDalicPINVOKE.RenderTask_WorldToViewport(swigCPtr, Vector3.getCPtr(position), out viewportX, out viewportY); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool ViewportToLocal(View view, float viewportX, float viewportY, out float localX, out float localY) + { + bool ret = NDalicPINVOKE.RenderTask_ViewportToLocal(swigCPtr, View.getCPtr(view), viewportX, viewportY, out localX, out localY); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal RenderTaskSignal FinishedSignal() + { + RenderTaskSignal ret = new RenderTaskSignal(NDalicPINVOKE.RenderTask_FinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum RefreshRate + { + REFRESH_ONCE = 0, + REFRESH_ALWAYS = 1 + } + + public Vector2 ViewportPosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(RenderTask.Property.VIEWPORT_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(RenderTask.Property.VIEWPORT_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ViewportSize + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(RenderTask.Property.VIEWPORT_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(RenderTask.Property.VIEWPORT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector4 ClearColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(RenderTask.Property.CLEAR_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(RenderTask.Property.CLEAR_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + public bool RequiresSync + { + get + { + bool temp = false; + GetProperty(RenderTask.Property.REQUIRES_SYNC).Get(out temp); + return temp; + } + set + { + SetProperty(RenderTask.Property.REQUIRES_SYNC, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RenderTaskList.cs b/src/Tizen.NUI/src/internal/RenderTaskList.cs new file mode 100755 index 0000000..2c82275 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderTaskList.cs @@ -0,0 +1,120 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class RenderTaskList : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal RenderTaskList(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.RenderTaskList_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RenderTaskList obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RenderTaskList(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public RenderTaskList() : this(NDalicPINVOKE.new_RenderTaskList__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static RenderTaskList DownCast(BaseHandle handle) + { + RenderTaskList ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as RenderTaskList; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RenderTaskList(RenderTaskList handle) : this(NDalicPINVOKE.new_RenderTaskList__SWIG_1(RenderTaskList.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RenderTaskList Assign(RenderTaskList rhs) + { + RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.RenderTaskList_Assign(swigCPtr, RenderTaskList.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RenderTask CreateTask() + { + RenderTask ret = new RenderTask(NDalicPINVOKE.RenderTaskList_CreateTask(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RemoveTask(RenderTask task) + { + NDalicPINVOKE.RenderTaskList_RemoveTask(swigCPtr, RenderTask.getCPtr(task)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetTaskCount() + { + uint ret = NDalicPINVOKE.RenderTaskList_GetTaskCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RenderTask GetTask(uint index) + { + RenderTask ret = new RenderTask(NDalicPINVOKE.RenderTaskList_GetTask(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RenderTaskSignal.cs b/src/Tizen.NUI/src/internal/RenderTaskSignal.cs new file mode 100755 index 0000000..bfb2be3 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderTaskSignal.cs @@ -0,0 +1,110 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class RenderTaskSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RenderTaskSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RenderTaskSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~RenderTaskSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RenderTaskSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public RenderTaskSignal() : this(NDalicPINVOKE.new_RenderTaskSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RenderingType.cs b/src/Tizen.NUI/src/internal/RenderingType.cs new file mode 100755 index 0000000..5dc946a --- /dev/null +++ b/src/Tizen.NUI/src/internal/RenderingType.cs @@ -0,0 +1,26 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum RenderingType + { + RENDERING_SHARED_ATLAS, + RENDERING_VECTOR_BASED + } + +} diff --git a/src/Tizen.NUI/src/internal/ResizedSignal.cs b/src/Tizen.NUI/src/internal/ResizedSignal.cs new file mode 100755 index 0000000..cc69abf --- /dev/null +++ b/src/Tizen.NUI/src/internal/ResizedSignal.cs @@ -0,0 +1,146 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ResizedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ResizedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ResizedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~ResizedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ResizedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.ResizedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.ResizedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ResizedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ResizedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Size2D arg) + { + NDalicManualPINVOKE.ResizedSignal_Emit(swigCPtr, Size2D.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ResizedSignal() : this(NDalicManualPINVOKE.new_ResizedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Ruler.cs b/src/Tizen.NUI/src/internal/Ruler.cs new file mode 100755 index 0000000..ce8e8e7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Ruler.cs @@ -0,0 +1,217 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class Ruler : RefObject + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Ruler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Ruler_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Ruler obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public virtual float Snap(float x, float bias) + { + float ret = NDalicPINVOKE.Ruler_Snap__SWIG_0(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float Snap(float x) + { + float ret = NDalicPINVOKE.Ruler_Snap__SWIG_1(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = NDalicPINVOKE.Ruler_GetPositionFromPage(swigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual uint GetPageFromPosition(float position, bool wrap) + { + uint ret = NDalicPINVOKE.Ruler_GetPageFromPosition(swigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual uint GetTotalPages() + { + uint ret = NDalicPINVOKE.Ruler_GetTotalPages(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Ruler.RulerType GetType() + { + Ruler.RulerType ret = (Ruler.RulerType)NDalicPINVOKE.Ruler_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsEnabled() + { + bool ret = NDalicPINVOKE.Ruler_IsEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Enable() + { + NDalicPINVOKE.Ruler_Enable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Disable() + { + NDalicPINVOKE.Ruler_Disable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetDomain(RulerDomain domain) + { + NDalicPINVOKE.Ruler_SetDomain(swigCPtr, RulerDomain.getCPtr(domain)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RulerDomain GetDomain() + { + RulerDomain ret = new RulerDomain(NDalicPINVOKE.Ruler_GetDomain(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void DisableDomain() + { + NDalicPINVOKE.Ruler_DisableDomain(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float Clamp(float x, float length, float scale) + { + float ret = NDalicPINVOKE.Ruler_Clamp__SWIG_0(swigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x, float length) + { + float ret = NDalicPINVOKE.Ruler_Clamp__SWIG_1(swigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x) + { + float ret = NDalicPINVOKE.Ruler_Clamp__SWIG_2(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Clamp(float x, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped) + { + float ret = NDalicPINVOKE.Ruler_Clamp__SWIG_3(swigCPtr, x, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias, float length, float scale) + { + float ret = NDalicPINVOKE.Ruler_SnapAndClamp__SWIG_0(swigCPtr, x, bias, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias, float length) + { + float ret = NDalicPINVOKE.Ruler_SnapAndClamp__SWIG_1(swigCPtr, x, bias, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias) + { + float ret = NDalicPINVOKE.Ruler_SnapAndClamp__SWIG_2(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x) + { + float ret = NDalicPINVOKE.Ruler_SnapAndClamp__SWIG_3(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float SnapAndClamp(float x, float bias, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped) + { + float ret = NDalicPINVOKE.Ruler_SnapAndClamp__SWIG_4(swigCPtr, x, bias, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum RulerType + { + Fixed, + Free + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RulerDomain.cs b/src/Tizen.NUI/src/internal/RulerDomain.cs new file mode 100755 index 0000000..dcec7a9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/RulerDomain.cs @@ -0,0 +1,195 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class RulerDomain : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RulerDomain(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RulerDomain obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~RulerDomain() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RulerDomain(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public RulerDomain(float min, float max, bool enabled) : this(NDalicPINVOKE.new_RulerDomain__SWIG_0(min, max, enabled), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RulerDomain(float min, float max) : this(NDalicPINVOKE.new_RulerDomain__SWIG_1(min, max), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float min + { + set + { + NDalicPINVOKE.RulerDomain_min_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.RulerDomain_min_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float max + { + set + { + NDalicPINVOKE.RulerDomain_max_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.RulerDomain_max_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public bool enabled + { + set + { + NDalicPINVOKE.RulerDomain_enabled_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = NDalicPINVOKE.RulerDomain_enabled_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float Clamp(float x, float length, float scale) + { + float ret = NDalicPINVOKE.RulerDomain_Clamp__SWIG_0(swigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x, float length) + { + float ret = NDalicPINVOKE.RulerDomain_Clamp__SWIG_1(swigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x) + { + float ret = NDalicPINVOKE.RulerDomain_Clamp__SWIG_2(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Clamp(float x, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped) + { + float ret = NDalicPINVOKE.RulerDomain_Clamp__SWIG_3(swigCPtr, x, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetSize() + { + float ret = NDalicPINVOKE.RulerDomain_GetSize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/RulerPtr.cs b/src/Tizen.NUI/src/internal/RulerPtr.cs new file mode 100755 index 0000000..548642e --- /dev/null +++ b/src/Tizen.NUI/src/internal/RulerPtr.cs @@ -0,0 +1,339 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class RulerPtr : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RulerPtr(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RulerPtr obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~RulerPtr() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RulerPtr(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public RulerPtr() : this(NDalicPINVOKE.new_RulerPtr__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RulerPtr(Ruler p) : this(NDalicPINVOKE.new_RulerPtr__SWIG_1(Ruler.getCPtr(p)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RulerPtr(RulerPtr rhs) : this(NDalicPINVOKE.new_RulerPtr__SWIG_2(RulerPtr.getCPtr(rhs)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Ruler Get() + { + global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr_Get(swigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Ruler __deref__() + { + global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr___deref__(swigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Ruler __ref__() + { + Ruler ret = new Ruler(NDalicPINVOKE.RulerPtr___ref__(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RulerPtr Assign(RulerPtr rhs) + { + RulerPtr ret = new RulerPtr(NDalicPINVOKE.RulerPtr_Assign__SWIG_0(swigCPtr, RulerPtr.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public RulerPtr Assign(Ruler rhs) + { + RulerPtr ret = new RulerPtr(NDalicPINVOKE.RulerPtr_Assign__SWIG_1(swigCPtr, Ruler.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reset() + { + NDalicPINVOKE.RulerPtr_Reset__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reset(Ruler rhs) + { + NDalicPINVOKE.RulerPtr_Reset__SWIG_1(swigCPtr, Ruler.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Ruler Detach() + { + global::System.IntPtr cPtr = NDalicPINVOKE.RulerPtr_Detach(swigCPtr); + Ruler ret = (cPtr == global::System.IntPtr.Zero) ? null : new Ruler(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Snap(float x, float bias) + { + float ret = NDalicPINVOKE.RulerPtr_Snap__SWIG_0(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Snap(float x) + { + float ret = NDalicPINVOKE.RulerPtr_Snap__SWIG_1(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetPositionFromPage(uint page, out uint volume, bool wrap) + { + float ret = NDalicPINVOKE.RulerPtr_GetPositionFromPage(swigCPtr, page, out volume, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetPageFromPosition(float position, bool wrap) + { + uint ret = NDalicPINVOKE.RulerPtr_GetPageFromPosition(swigCPtr, position, wrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetTotalPages() + { + uint ret = NDalicPINVOKE.RulerPtr_GetTotalPages(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Ruler.RulerType GetType() + { + Ruler.RulerType ret = (Ruler.RulerType)NDalicPINVOKE.RulerPtr_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsEnabled() + { + bool ret = NDalicPINVOKE.RulerPtr_IsEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Enable() + { + NDalicPINVOKE.RulerPtr_Enable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Disable() + { + NDalicPINVOKE.RulerPtr_Disable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetDomain(RulerDomain domain) + { + NDalicPINVOKE.RulerPtr_SetDomain(swigCPtr, RulerDomain.getCPtr(domain)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public RulerDomain GetDomain() + { + RulerDomain ret = new RulerDomain(NDalicPINVOKE.RulerPtr_GetDomain(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void DisableDomain() + { + NDalicPINVOKE.RulerPtr_DisableDomain(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float Clamp(float x, float length, float scale) + { + float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_0(swigCPtr, x, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x, float length) + { + float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_1(swigCPtr, x, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float Clamp(float x) + { + float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_2(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Clamp(float x, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped) + { + float ret = NDalicPINVOKE.RulerPtr_Clamp__SWIG_3(swigCPtr, x, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias, float length, float scale) + { + float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_0(swigCPtr, x, bias, length, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias, float length) + { + float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_1(swigCPtr, x, bias, length); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x, float bias) + { + float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_2(swigCPtr, x, bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float SnapAndClamp(float x) + { + float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_3(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float SnapAndClamp(float x, float bias, float length, float scale, SWIGTYPE_p_Dali__Toolkit__ClampState clamped) + { + float ret = NDalicPINVOKE.RulerPtr_SnapAndClamp__SWIG_4(swigCPtr, x, bias, length, scale, SWIGTYPE_p_Dali__Toolkit__ClampState.getCPtr(clamped)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reference() + { + NDalicPINVOKE.RulerPtr_Reference(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Unreference() + { + NDalicPINVOKE.RulerPtr_Unreference(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int ReferenceCount() + { + int ret = NDalicPINVOKE.RulerPtr_ReferenceCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_CallbackBase.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_CallbackBase.cs new file mode 100755 index 0000000..9413739 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_CallbackBase.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class SWIGTYPE_p_CallbackBase + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_CallbackBase(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_CallbackBase() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_CallbackBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Configuration__ContextLoss.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Configuration__ContextLoss.cs new file mode 100755 index 0000000..f861201 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Configuration__ContextLoss.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Configuration__ContextLoss + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Configuration__ContextLoss(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Configuration__ContextLoss() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Configuration__ContextLoss obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CallbackBase.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CallbackBase.cs new file mode 100755 index 0000000..0030697 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CallbackBase.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class SWIGTYPE_p_Dali__CallbackBase + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__CallbackBase(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__CallbackBase() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__CallbackBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Constraint.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Constraint.cs new file mode 100755 index 0000000..d0b0127 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Constraint.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Constraint + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Constraint(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Constraint() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Constraint obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CustomActorImpl__Extension.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CustomActorImpl__Extension.cs new file mode 100755 index 0000000..c9befa2 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__CustomActorImpl__Extension.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__CustomActorImpl__Extension + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__CustomActorImpl__Extension(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__CustomActorImpl__Extension() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__CustomActorImpl__Extension obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__FunctorDelegate.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__FunctorDelegate.cs new file mode 100755 index 0000000..33d505a --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__FunctorDelegate.cs @@ -0,0 +1,36 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class SWIGTYPE_p_Dali__FunctorDelegate + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__FunctorDelegate(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__FunctorDelegate() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__FunctorDelegate obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__Texture.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__Texture.cs new file mode 100755 index 0000000..3fbcf72 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__Texture.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Internal__Texture + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Internal__Texture(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Internal__Texture() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Internal__Texture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__TypeRegistry.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__TypeRegistry.cs new file mode 100755 index 0000000..472a681 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Internal__TypeRegistry.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Internal__TypeRegistry + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Internal__TypeRegistry(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Internal__TypeRegistry() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Internal__TypeRegistry obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t.cs new file mode 100755 index 0000000..b6a2520 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__IntrusivePtrT_Dali__Toolkit__ItemLayout_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RectT_unsigned_int_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RectT_unsigned_int_t.cs new file mode 100755 index 0000000..3246a31 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RectT_unsigned_int_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__RectT_unsigned_int_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__RectT_unsigned_int_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__RectT_unsigned_int_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__RectT_unsigned_int_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs new file mode 100755 index 0000000..8693098 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__RenderSurface.cs @@ -0,0 +1,40 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__RenderSurface + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__RenderSurface(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__RenderSurface() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__RenderSurface obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t.cs new file mode 100755 index 0000000..3531893 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_bool_fDali__Actor_Dali__TouchEvent_const_RF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t.cs new file mode 100755 index 0000000..88e24e6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_bool_fDali__Toolkit__AccessibilityManager_R_Dali__TouchEvent_const_RF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t.cs new file mode 100755 index 0000000..f07cda2 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fDali__Actor_bool_Dali__DevelActor__VisibilityChange__TypeF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t.cs new file mode 100755 index 0000000..ab9f636 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fDali__DragAndDropDetectorF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t.cs new file mode 100755 index 0000000..bae8b9e --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__Control_Dali__Toolkit__ControlF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t.cs new file mode 100755 index 0000000..b096399 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t.cs new file mode 100755 index 0000000..c09e5f3 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t.cs new file mode 100755 index 0000000..d523deb --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__SignalT_void_fuint32_t_Dali__PixelDataF_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ClampState.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ClampState.cs new file mode 100755 index 0000000..510b8b5 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ClampState.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__ClampState + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__ClampState(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__ClampState() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__ClampState obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader.cs new file mode 100755 index 0000000..e288d78 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__Internal__AsyncImageLoader obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension.cs new file mode 100755 index 0000000..4628a67 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__Internal__Control__Extension obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData.cs new file mode 100755 index 0000000..049002a --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.cs new file mode 100755 index 0000000..4533321 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension.cs new file mode 100755 index 0000000..cd942db --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__Toolkit__ItemFactory__Extension obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__TouchEvent.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__TouchEvent.cs new file mode 100755 index 0000000..a5e71bc --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_Dali__TouchEvent.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_Dali__TouchEvent + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_Dali__TouchEvent(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_Dali__TouchEvent() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_Dali__TouchEvent obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_FunctorDelegate.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_FunctorDelegate.cs new file mode 100755 index 0000000..171b20b --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_FunctorDelegate.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_FunctorDelegate + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_FunctorDelegate(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_FunctorDelegate() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_FunctorDelegate obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_KeyboardFocusManager.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_KeyboardFocusManager.cs new file mode 100755 index 0000000..b1a5186 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_KeyboardFocusManager.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_KeyboardFocusManager + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_KeyboardFocusManager(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_KeyboardFocusManager() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_KeyboardFocusManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_PropertyInputContainer.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_PropertyInputContainer.cs new file mode 100755 index 0000000..32f9d65 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_PropertyInputContainer.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_PropertyInputContainer + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_PropertyInputContainer(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_PropertyInputContainer() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_PropertyInputContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_double.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_double.cs new file mode 100755 index 0000000..048186e --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_double.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_double + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_double(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_double() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_double obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_float__float.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_float__float.cs new file mode 100755 index 0000000..209b5fe --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_float__float.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_float__float + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_float__float(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_float__float() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_float__float obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value.cs new file mode 100755 index 0000000..fa6d79c --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_Dali__BaseObject_Dali__Property__Index__Dali__Property__Value obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void.cs new file mode 100755 index 0000000..e332f4f --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_Dali__BaseObject_int_r_q_const__Dali__Property__Value__void obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs new file mode 100755 index 0000000..cce5fc9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool.cs new file mode 100755 index 0000000..3b8400b --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.cs new file mode 100755 index 0000000..ca1cbb9 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__Dali__Any__AnyContainerBase__void obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_Dali__Vector2__bool.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_Dali__Vector2__bool.cs new file mode 100755 index 0000000..bc2f6af --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_Dali__Vector2__bool.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_r_Dali__Vector2__bool + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_r_Dali__Vector2__bool(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_r_Dali__Vector2__bool() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_r_Dali__Vector2__bool obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.cs new file mode 100755 index 0000000..d44c6c1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_r_q_const__Dali__Any__AnyContainerBase__p_Dali__Any__AnyContainerBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.cs new file mode 100755 index 0000000..aa663d7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_f_r_q_const__Dali__Vector3__float + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_f_r_q_const__Dali__Vector3__float(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_r_q_const__Dali__Vector3__float() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_float.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_float.cs new file mode 100755 index 0000000..a014065 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_float.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_float + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_float(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_float() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_float obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_int.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_int.cs new file mode 100755 index 0000000..a00f2ee --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_int.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_int + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_int(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_int() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_int obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_std__type_info.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_std__type_info.cs new file mode 100755 index 0000000..d6a09d8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_std__type_info.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_std__type_info + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_std__type_info(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_std__type_info() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_std__type_info obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_uint8_t.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_uint8_t.cs new file mode 100755 index 0000000..3504f15 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_uint8_t.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_uint8_t + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_uint8_t(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_uint8_t() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_uint8_t obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_char.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_char.cs new file mode 100755 index 0000000..4be1d02 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_char.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_unsigned_char + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_char(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_char() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_int.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_int.cs new file mode 100755 index 0000000..0da738e --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_int.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_unsigned_int + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_int(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_int() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_short.cs b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_short.cs new file mode 100755 index 0000000..812757c --- /dev/null +++ b/src/Tizen.NUI/src/internal/SWIGTYPE_p_unsigned_short.cs @@ -0,0 +1,34 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.9 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + internal class SWIGTYPE_p_unsigned_short + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal SWIGTYPE_p_unsigned_short(global::System.IntPtr cPtr, bool futureUse) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_unsigned_short() + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + } + +} diff --git a/src/Tizen.NUI/src/internal/ScrollStateChangedSignal.cs b/src/Tizen.NUI/src/internal/ScrollStateChangedSignal.cs new file mode 100755 index 0000000..d24bc85 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ScrollStateChangedSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class ScrollStateChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ScrollStateChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollStateChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ScrollStateChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ScrollStateChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.ScrollStateChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.ScrollStateChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ScrollStateChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.ScrollStateChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg) + { + NDalicManualPINVOKE.ScrollStateChangedSignal_Emit(swigCPtr, View.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ScrollStateChangedSignal() : this(NDalicManualPINVOKE.new_ScrollStateChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ScrollViewPagePathEffect.cs b/src/Tizen.NUI/src/internal/ScrollViewPagePathEffect.cs new file mode 100755 index 0000000..d710aa8 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ScrollViewPagePathEffect.cs @@ -0,0 +1,86 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class ScrollViewPagePathEffect : ScrollViewEffect + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ScrollViewPagePathEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollViewPagePathEffect_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollViewPagePathEffect obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollViewPagePathEffect(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public ScrollViewPagePathEffect(Path path, Vector3 forward, int inputPropertyIndex, Vector3 pageSize, uint pageCount) : this(NDalicPINVOKE.ScrollViewPagePathEffect_New(Path.getCPtr(path), Vector3.getCPtr(forward), inputPropertyIndex, Vector3.getCPtr(pageSize), pageCount), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public static ScrollViewPagePathEffect DownCast(BaseHandle handle) + { + ScrollViewPagePathEffect ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ScrollViewPagePathEffect; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ApplyToPage(View page, uint pageOrder) + { + NDalicPINVOKE.ScrollViewPagePathEffect_ApplyToPage(swigCPtr, View.getCPtr(page), pageOrder); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ScrollViewSnapStartedSignal.cs b/src/Tizen.NUI/src/internal/ScrollViewSnapStartedSignal.cs new file mode 100755 index 0000000..26b4f0a --- /dev/null +++ b/src/Tizen.NUI/src/internal/ScrollViewSnapStartedSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ScrollViewSnapStartedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ScrollViewSnapStartedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollViewSnapStartedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ScrollViewSnapStartedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollViewSnapStartedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.ScrollViewSnapStartedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ScrollViewSnapStartedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ScrollViewSnapStartedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ScrollViewSnapStartedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(ScrollView.SnapEvent arg) + { + NDalicPINVOKE.ScrollViewSnapStartedSignal_Emit(swigCPtr, ScrollView.SnapEvent.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ScrollViewSnapStartedSignal() : this(NDalicPINVOKE.new_ScrollViewSnapStartedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ScrollableSignal.cs b/src/Tizen.NUI/src/internal/ScrollableSignal.cs new file mode 100755 index 0000000..06b3bbc --- /dev/null +++ b/src/Tizen.NUI/src/internal/ScrollableSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ScrollableSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ScrollableSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollableSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ScrollableSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollableSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.ScrollableSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ScrollableSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ScrollableSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ScrollableSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Vector2 arg) + { + NDalicPINVOKE.ScrollableSignal_Emit(swigCPtr, Vector2.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ScrollableSignal() : this(NDalicPINVOKE.new_ScrollableSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SignalConnectorType.cs b/src/Tizen.NUI/src/internal/SignalConnectorType.cs new file mode 100755 index 0000000..706600c --- /dev/null +++ b/src/Tizen.NUI/src/internal/SignalConnectorType.cs @@ -0,0 +1,109 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class SignalConnectorType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SignalConnectorType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SignalConnectorType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SignalConnectorType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_SignalConnectorType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public SignalConnectorType(TypeRegistration typeRegistration, string name, SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool func) : this(NDalicPINVOKE.new_SignalConnectorType(TypeRegistration.getCPtr(typeRegistration), name, SWIGTYPE_p_f_p_Dali__BaseObject_p_Dali__ConnectionTrackerInterface_r_q_const__std__string_p_Dali__FunctorDelegate__bool.getCPtr(func)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SignalObserver.cs b/src/Tizen.NUI/src/internal/SignalObserver.cs new file mode 100755 index 0000000..2e98240 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SignalObserver.cs @@ -0,0 +1,112 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class SignalObserver : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SignalObserver(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SignalObserver obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SignalObserver() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_SignalObserver(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public virtual void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicPINVOKE.SignalObserver_SignalDisconnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Size.cs b/src/Tizen.NUI/src/internal/Size.cs new file mode 100755 index 0000000..4cb6c0e --- /dev/null +++ b/src/Tizen.NUI/src/internal/Size.cs @@ -0,0 +1,403 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; + +namespace Tizen.NUI +{ + + [Obsolete("Please do not use! This will be changed to internal class")] + public class Size : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Size(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + /// + /// Dispose + /// + ~Size() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + /// + /// Addition operator for A+B + /// + /// Size, A + /// Size to assign, B + /// A Size containing the result of the addition + public static Size operator +(Size arg1, Size arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator for A-B + /// + /// Size, A + /// Size to subtract, B + /// A Size containing the result of the subtraction + public static Size operator -(Size arg1, Size arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Size for unary negation + /// A Size containg the negation + public static Size operator -(Size arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// Size for multiplication + /// The Size to multipl + /// A Size containing the result of the multiplication + public static Size operator *(Size arg1, Size arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// Size for multiplication + /// The float value to scale the Size + /// A Size containing the result of the scaling + public static Size operator *(Size arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// Size for division + /// The Size to divide + /// A Size containing the result of the division> + public static Size operator /(Size arg1, Size arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// Size for division + /// The float value to scale the Size by + /// A Size containing the result of the scaling + public static Size operator /(Size arg1, float arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Array subscript operator. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Size GetSizeFromPtr(global::System.IntPtr cPtr) + { + Size ret = new Size(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Constructor. + /// + public Size() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// x (or width) component + /// y (or height) component + /// z (or depth) component + public Size(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// Size2D with x (width) and y (height) + public Size(Size2D size2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Size2D.getCPtr(size2d)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Zero constant, (0.0f, 0.0f, 0.0f). + /// + public static Size Zero + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get(); + Size ret = (cPtr == global::System.IntPtr.Zero) ? null : new Size(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Size Add(Size rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Add(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Subtract(Size rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Multiply(Size rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Multiply(float rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Divide(Size rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Size.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Divide(float rhs) + { + Size ret = new Size(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size Subtract() + { + Size ret = new Size(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check equality.
+ /// Utilizes appropriate machine epsilon values.
+ ///
+ /// The Size to test against + /// True if the Sizes are equal + public bool EqualTo(Size rhs) + { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Size.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check inequality.
+ /// Utilizes appropriate machine epsilon values.
+ ///
+ /// The Size to test against + /// True if the Sizes are not equal + public bool NotEqualTo(Size rhs) + { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Size.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Width property for width component of Siz + /// + public float Width + { + set + { + NDalicPINVOKE.Vector3_Width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Height property for height component of Size + /// + public float Height + { + set + { + NDalicPINVOKE.Vector3_Height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Depth property for depth component of Size + /// + public float Depth + { + set + { + NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Type cast operator, Size to Vector3. + /// + /// Object of Size type + public static implicit operator Vector3(Size size) + { + return new Vector3(size.Width, size.Height, size.Depth); + } + + /// + /// Type cast operator, Vector3 to Size type. + /// + /// Object of Vector3 type + public static implicit operator Size(Vector3 vec) + { + return new Size(vec.Width, vec.Height, vec.Depth); + } + + } + +} + diff --git a/src/Tizen.NUI/src/internal/SliderMarkReachedSignal.cs b/src/Tizen.NUI/src/internal/SliderMarkReachedSignal.cs new file mode 100755 index 0000000..1171946 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SliderMarkReachedSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class SliderMarkReachedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SliderMarkReachedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SliderMarkReachedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SliderMarkReachedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_SliderMarkReachedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.SliderMarkReachedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.SliderMarkReachedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.SliderMarkReachedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.SliderMarkReachedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(Tizen.NUI.UIComponents.Slider arg1, int arg2) + { + bool ret = NDalicPINVOKE.SliderMarkReachedSignal_Emit(swigCPtr, Tizen.NUI.UIComponents.Slider.getCPtr(arg1), arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SliderMarkReachedSignal() : this(NDalicPINVOKE.new_SliderMarkReachedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SliderValueChangedSignal.cs b/src/Tizen.NUI/src/internal/SliderValueChangedSignal.cs new file mode 100755 index 0000000..3678c78 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SliderValueChangedSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class SliderValueChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SliderValueChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SliderValueChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SliderValueChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_SliderValueChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.SliderValueChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.SliderValueChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.SliderValueChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.SliderValueChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(Tizen.NUI.UIComponents.Slider arg1, float arg2) + { + bool ret = NDalicPINVOKE.SliderValueChangedSignal_Emit(swigCPtr, Tizen.NUI.UIComponents.Slider.getCPtr(arg1), arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SliderValueChangedSignal() : this(NDalicPINVOKE.new_SliderValueChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SlotObserver.cs b/src/Tizen.NUI/src/internal/SlotObserver.cs new file mode 100755 index 0000000..9b034fe --- /dev/null +++ b/src/Tizen.NUI/src/internal/SlotObserver.cs @@ -0,0 +1,113 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be internal")] + public class SlotObserver : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SlotObserver(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SlotObserver obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SlotObserver() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_SlotObserver(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public virtual void SlotDisconnected(SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicPINVOKE.SlotObserver_SlotDisconnected(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/SnapType.cs b/src/Tizen.NUI/src/internal/SnapType.cs new file mode 100755 index 0000000..dd656f0 --- /dev/null +++ b/src/Tizen.NUI/src/internal/SnapType.cs @@ -0,0 +1,26 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum SnapType + { + Snap, + Flick + } + +} diff --git a/src/Tizen.NUI/src/internal/StageWheelSignal.cs b/src/Tizen.NUI/src/internal/StageWheelSignal.cs new file mode 100755 index 0000000..2ac9951 --- /dev/null +++ b/src/Tizen.NUI/src/internal/StageWheelSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class StageWheelSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal StageWheelSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StageWheelSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~StageWheelSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_StageWheelSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.StageWheelSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.StageWheelSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.StageWheelSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.StageWheelSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Wheel arg) + { + NDalicPINVOKE.StageWheelSignal_Emit(swigCPtr, Wheel.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StageWheelSignal() : this(NDalicPINVOKE.new_StageWheelSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/StateChangedSignalType.cs b/src/Tizen.NUI/src/internal/StateChangedSignalType.cs new file mode 100755 index 0000000..7f0555e --- /dev/null +++ b/src/Tizen.NUI/src/internal/StateChangedSignalType.cs @@ -0,0 +1,144 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + internal class StateChangedSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal StateChangedSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StateChangedSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~StateChangedSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_StateChangedSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.StateChangedSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.StateChangedSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.StateChangedSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.StateChangedSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(TTSPlayer.TTSState arg1, TTSPlayer.TTSState arg2) + { + NDalicManualPINVOKE.StateChangedSignalType_Emit(swigCPtr, (int)arg1, (int)arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StateChangedSignalType() : this(NDalicManualPINVOKE.new_StateChangedSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/StatusSignalType.cs b/src/Tizen.NUI/src/internal/StatusSignalType.cs new file mode 100755 index 0000000..70c0c8f --- /dev/null +++ b/src/Tizen.NUI/src/internal/StatusSignalType.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + [Obsolete("Please do not use! this will be deprecated")] + public class StatusSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal StatusSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StatusSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~StatusSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_StatusSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.StatusSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.StatusSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.StatusSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.StatusSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(bool arg) + { + NDalicManualPINVOKE.StatusSignalType_Emit(swigCPtr, arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StatusSignalType() : this(NDalicManualPINVOKE.new_StatusSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/StencilFunctionType.cs b/src/Tizen.NUI/src/internal/StencilFunctionType.cs new file mode 100755 index 0000000..a55ccfd --- /dev/null +++ b/src/Tizen.NUI/src/internal/StencilFunctionType.cs @@ -0,0 +1,32 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum StencilFunctionType + { + NEVER, + LESS, + EQUAL, + LESS_EQUAL, + GREATER, + NOT_EQUAL, + GREATER_EQUAL, + ALWAYS + } + +} diff --git a/src/Tizen.NUI/src/internal/StencilOperationType.cs b/src/Tizen.NUI/src/internal/StencilOperationType.cs new file mode 100755 index 0000000..fe279e0 --- /dev/null +++ b/src/Tizen.NUI/src/internal/StencilOperationType.cs @@ -0,0 +1,32 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum StencilOperationType + { + ZERO, + KEEP, + REPLACE, + INCREMENT, + DECREMENT, + INVERT, + INCREMENT_WRAP, + DECREMENT_WRAP + } + +} diff --git a/src/Tizen.NUI/src/internal/StringValuePair.cs b/src/Tizen.NUI/src/internal/StringValuePair.cs new file mode 100755 index 0000000..84320ee --- /dev/null +++ b/src/Tizen.NUI/src/internal/StringValuePair.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class StringValuePair : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal StringValuePair(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StringValuePair obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~StringValuePair() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_StringValuePair(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + public StringValuePair() : this(NDalicPINVOKE.new_StringValuePair__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StringValuePair(string t, PropertyValue u) : this(NDalicPINVOKE.new_StringValuePair__SWIG_1(t, PropertyValue.getCPtr(u)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StringValuePair(StringValuePair p) : this(NDalicPINVOKE.new_StringValuePair__SWIG_2(StringValuePair.getCPtr(p)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string first + { + set + { + NDalicPINVOKE.StringValuePair_first_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.StringValuePair_first_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public PropertyValue second + { + set + { + NDalicPINVOKE.StringValuePair_second_set(swigCPtr, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.StringValuePair_second_get(swigCPtr); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/StyleChangedSignal.cs b/src/Tizen.NUI/src/internal/StyleChangedSignal.cs new file mode 100755 index 0000000..93b4b80 --- /dev/null +++ b/src/Tizen.NUI/src/internal/StyleChangedSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class StyleChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal StyleChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StyleChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~StyleChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_StyleChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.StyleChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.StyleChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.StyleChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.StyleChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(StyleManager arg1, StyleChangeType arg2) + { + NDalicPINVOKE.StyleChangedSignal_Emit(swigCPtr, StyleManager.getCPtr(arg1), (int)arg2); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public StyleChangedSignal() : this(NDalicPINVOKE.new_StyleChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TapGestureDetectedSignal.cs b/src/Tizen.NUI/src/internal/TapGestureDetectedSignal.cs new file mode 100755 index 0000000..6c5f8ca --- /dev/null +++ b/src/Tizen.NUI/src/internal/TapGestureDetectedSignal.cs @@ -0,0 +1,147 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class TapGestureDetectedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TapGestureDetectedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetectedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TapGestureDetectedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TapGestureDetectedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.TapGestureDetectedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.TapGestureDetectedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TapGestureDetectedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TapGestureDetectedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg1, TapGesture arg2) + { + NDalicPINVOKE.TapGestureDetectedSignal_Emit(swigCPtr, View.getCPtr(arg1), TapGesture.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TapGestureDetectedSignal() : this(NDalicPINVOKE.new_TapGestureDetectedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TapGestureDetector.cs b/src/Tizen.NUI/src/internal/TapGestureDetector.cs new file mode 100755 index 0000000..a3c9c6e --- /dev/null +++ b/src/Tizen.NUI/src/internal/TapGestureDetector.cs @@ -0,0 +1,227 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + internal class TapGestureDetector : GestureDetector + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TapGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGestureDetector_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGestureDetector obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TapGestureDetector(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public class DetectedEventArgs : EventArgs + { + private View _view; + private TapGesture _tapGesture; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + public TapGesture TapGesture + { + get + { + return _tapGesture; + } + set + { + _tapGesture = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void DetectedCallbackDelegate(IntPtr actor, IntPtr TapGesture); + private DaliEventHandler _tapGestureEventHandler; + private DetectedCallbackDelegate _tapGestureCallbackDelegate; + + + public event DaliEventHandler Detected + { + add + { + lock (this) + { + // Restricted to only one listener + if (_tapGestureEventHandler == null) + { + _tapGestureEventHandler += value; + + _tapGestureCallbackDelegate = new DetectedCallbackDelegate(OnTapGestureDetected); + this.DetectedSignal().Connect(_tapGestureCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_tapGestureEventHandler != null) + { + this.DetectedSignal().Disconnect(_tapGestureCallbackDelegate); + } + + _tapGestureEventHandler -= value; + } + } + } + + private void OnTapGestureDetected(IntPtr actor, IntPtr tapGesture) + { + DetectedEventArgs e = new DetectedEventArgs(); + + // Populate all members of "e" (DetectedEventArgs) with real data + e.View = Registry.GetManagedBaseHandleFromNativePtr(actor) as View; + e.TapGesture = Tizen.NUI.TapGesture.GetTapGestureFromPtr(tapGesture); + + if (_tapGestureEventHandler != null) + { + //here we send all data to user event handlers + _tapGestureEventHandler(this, e); + } + + } + + + public static TapGestureDetector GetTapGestureDetectorFromPtr(global::System.IntPtr cPtr) + { + TapGestureDetector ret = new TapGestureDetector(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public TapGestureDetector() : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public TapGestureDetector(uint tapsRequired) : this(NDalicPINVOKE.TapGestureDetector_New__SWIG_1(tapsRequired), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public new static TapGestureDetector DownCast(BaseHandle handle) + { + TapGestureDetector ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TapGestureDetector; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TapGestureDetector(TapGestureDetector handle) : this(NDalicPINVOKE.new_TapGestureDetector__SWIG_1(TapGestureDetector.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TapGestureDetector Assign(TapGestureDetector rhs) + { + TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.TapGestureDetector_Assign(swigCPtr, TapGestureDetector.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMinimumTapsRequired(uint minimumTaps) + { + NDalicPINVOKE.TapGestureDetector_SetMinimumTapsRequired(swigCPtr, minimumTaps); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetMaximumTapsRequired(uint maximumTaps) + { + NDalicPINVOKE.TapGestureDetector_SetMaximumTapsRequired(swigCPtr, maximumTaps); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetMinimumTapsRequired() + { + uint ret = NDalicPINVOKE.TapGestureDetector_GetMinimumTapsRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetMaximumTapsRequired() + { + uint ret = NDalicPINVOKE.TapGestureDetector_GetMaximumTapsRequired(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TapGestureDetectedSignal DetectedSignal() + { + TapGestureDetectedSignal ret = new TapGestureDetectedSignal(NDalicPINVOKE.TapGestureDetector_DetectedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TextEditorSignal.cs b/src/Tizen.NUI/src/internal/TextEditorSignal.cs new file mode 100755 index 0000000..f2e9c0d --- /dev/null +++ b/src/Tizen.NUI/src/internal/TextEditorSignal.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class TextEditorSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TextEditorSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditorSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TextEditorSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextEditorSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.TextEditorSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.TextEditorSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TextEditorSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TextEditorSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(TextEditor arg) + { + NDalicPINVOKE.TextEditorSignal_Emit(swigCPtr, TextEditor.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TextEditorSignal() : this(NDalicPINVOKE.new_TextEditorSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TextFieldSignal.cs b/src/Tizen.NUI/src/internal/TextFieldSignal.cs new file mode 100755 index 0000000..51eae91 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TextFieldSignal.cs @@ -0,0 +1,150 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class TextFieldSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TextFieldSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextFieldSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TextFieldSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextFieldSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.TextFieldSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.TextFieldSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TextFieldSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TextFieldSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(TextField arg) + { + NDalicPINVOKE.TextFieldSignal_Emit(swigCPtr, TextField.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TextFieldSignal() : this(NDalicPINVOKE.new_TextFieldSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TimePeriod.cs b/src/Tizen.NUI/src/internal/TimePeriod.cs new file mode 100755 index 0000000..cd4e0cd --- /dev/null +++ b/src/Tizen.NUI/src/internal/TimePeriod.cs @@ -0,0 +1,145 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TimePeriod : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TimePeriod(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TimePeriod obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TimePeriod() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TimePeriod(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public TimePeriod(float durationSeconds) : this(NDalicPINVOKE.new_TimePeriod__SWIG_0(durationSeconds), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TimePeriod(float delaySeconds, float durationSeconds) : this(NDalicPINVOKE.new_TimePeriod__SWIG_1(delaySeconds, durationSeconds), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float DelaySeconds + { + set + { + NDalicPINVOKE.TimePeriod_delaySeconds_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.TimePeriod_delaySeconds_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float DurationSeconds + { + set + { + NDalicPINVOKE.TimePeriod_durationSeconds_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.TimePeriod_durationSeconds_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TimerSignalType.cs b/src/Tizen.NUI/src/internal/TimerSignalType.cs new file mode 100755 index 0000000..f893c86 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TimerSignalType.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TimerSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TimerSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TimerSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TimerSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TimerSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.TimerSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.TimerSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TimerSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TimerSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit() + { + bool ret = NDalicPINVOKE.TimerSignalType_Emit(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TimerSignalType() : this(NDalicPINVOKE.new_TimerSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ToolkitPropertyRange.cs b/src/Tizen.NUI/src/internal/ToolkitPropertyRange.cs new file mode 100755 index 0000000..71349db --- /dev/null +++ b/src/Tizen.NUI/src/internal/ToolkitPropertyRange.cs @@ -0,0 +1,28 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum ToolkitPropertyRange + { + VISUAL_PROPERTY_BASE_START_INDEX = PropertyRanges.CORE_PROPERTY_MAX_INDEX + 1, + VISUAL_PROPERTY_BASE_END_INDEX = VISUAL_PROPERTY_BASE_START_INDEX + 100, + VISUAL_PROPERTY_START_INDEX = VISUAL_PROPERTY_BASE_END_INDEX + 1, + VISUAL_PROPERTY_END_INDEX = VISUAL_PROPERTY_START_INDEX + 100000 + } + +} diff --git a/src/Tizen.NUI/src/internal/TooltipPositionType.cs b/src/Tizen.NUI/src/internal/TooltipPositionType.cs new file mode 100755 index 0000000..3e605e4 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TooltipPositionType.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum TooltipPositionType + { + ABOVE, + BELOW, + HOVER_POINT + } + +} diff --git a/src/Tizen.NUI/src/internal/TouchDataSignal.cs b/src/Tizen.NUI/src/internal/TouchDataSignal.cs new file mode 100755 index 0000000..0f08252 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TouchDataSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class TouchDataSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TouchDataSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TouchDataSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TouchDataSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ActorTouchDataSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ActorTouchDataSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ActorTouchDataSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorTouchDataSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorTouchDataSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(View arg1, Touch arg2) + { + bool ret = NDalicPINVOKE.ActorTouchDataSignal_Emit(swigCPtr, View.getCPtr(arg1), Touch.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TouchDataSignal() : this(NDalicPINVOKE.new_ActorTouchDataSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TouchPoint.cs b/src/Tizen.NUI/src/internal/TouchPoint.cs new file mode 100755 index 0000000..956a3c6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TouchPoint.cs @@ -0,0 +1,207 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using Tizen.NUI.BaseComponents; + internal class TouchPoint : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TouchPoint(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TouchPoint obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TouchPoint() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TouchPoint(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public TouchPoint(int id, TouchPoint.StateType state, float screenX, float screenY) : this(NDalicPINVOKE.new_TouchPoint__SWIG_0(id, (int)state, screenX, screenY), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchPoint(int id, TouchPoint.StateType state, float screenX, float screenY, float localX, float localY) : this(NDalicPINVOKE.new_TouchPoint__SWIG_1(id, (int)state, screenX, screenY, localX, localY), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int DeviceId + { + set + { + NDalicPINVOKE.TouchPoint_deviceId_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.TouchPoint_deviceId_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public TouchPoint.StateType State + { + set + { + NDalicPINVOKE.TouchPoint_state_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + TouchPoint.StateType ret = (TouchPoint.StateType)NDalicPINVOKE.TouchPoint_state_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public View HitView + { + set + { + NDalicPINVOKE.TouchPoint_hitActor_set(swigCPtr, View.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TouchPoint_hitActor_get(swigCPtr); + View ret = (cPtr == global::System.IntPtr.Zero) ? null : Registry.GetManagedBaseHandleFromRefObject(cPtr) as View; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Vector2 Local + { + set + { + NDalicPINVOKE.TouchPoint_local_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TouchPoint_local_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Vector2 Screen + { + set + { + NDalicPINVOKE.TouchPoint_screen_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TouchPoint_screen_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public enum StateType + { + Started, + Finished, + Down = Started, + Up = Finished, + Motion, + Leave, + Stationary, + Interrupted, + Last + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TouchPointContainer.cs b/src/Tizen.NUI/src/internal/TouchPointContainer.cs new file mode 100755 index 0000000..4f4e18b --- /dev/null +++ b/src/Tizen.NUI/src/internal/TouchPointContainer.cs @@ -0,0 +1,425 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TouchPointContainer : global::System.IDisposable, global::System.Collections.IEnumerable + , global::System.Collections.Generic.IEnumerable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TouchPointContainer(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TouchPointContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TouchPointContainer() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TouchPointContainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public TouchPointContainer(global::System.Collections.ICollection c) : this() + { + if (c == null) + throw new global::System.ArgumentNullException("c"); + foreach (TouchPoint element in c) + { + this.Add(element); + } + } + + public bool IsFixedSize + { + get + { + return false; + } + } + + public bool IsReadOnly + { + get + { + return false; + } + } + + public TouchPoint this[int index] + { + get + { + return getitem(index); + } + set + { + setitem(index, value); + } + } + + public int Capacity + { + get + { + return (int)capacity(); + } + set + { + if (value < size()) + throw new global::System.ArgumentOutOfRangeException("Capacity"); + reserve((uint)value); + } + } + + public int Count + { + get + { + return (int)size(); + } + } + + public bool IsSynchronized + { + get + { + return false; + } + } + + public void CopyTo(TouchPoint[] array) + { + CopyTo(0, array, 0, this.Count); + } + + public void CopyTo(TouchPoint[] array, int arrayIndex) + { + CopyTo(0, array, arrayIndex, this.Count); + } + + public void CopyTo(int index, TouchPoint[] array, int arrayIndex, int count) + { + if (array == null) + throw new global::System.ArgumentNullException("array"); + if (index < 0) + throw new global::System.ArgumentOutOfRangeException("index", "Value is less than zero"); + if (arrayIndex < 0) + throw new global::System.ArgumentOutOfRangeException("arrayIndex", "Value is less than zero"); + if (count < 0) + throw new global::System.ArgumentOutOfRangeException("count", "Value is less than zero"); + if (array.Rank > 1) + throw new global::System.ArgumentException("Multi dimensional array.", "array"); + if (index + count > this.Count || arrayIndex + count > array.Length) + throw new global::System.ArgumentException("Number of elements to copy is too large."); + for (int i = 0; i < count; i++) + array.SetValue(getitemcopy(index + i), arrayIndex + i); + } + + global::System.Collections.Generic.IEnumerator global::System.Collections.Generic.IEnumerable.GetEnumerator() + { + return new TouchPointContainerEnumerator(this); + } + + global::System.Collections.IEnumerator global::System.Collections.IEnumerable.GetEnumerator() + { + return new TouchPointContainerEnumerator(this); + } + + public TouchPointContainerEnumerator GetEnumerator() + { + return new TouchPointContainerEnumerator(this); + } + + // Type-safe enumerator + /// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown + /// whenever the collection is modified. This has been done for changes in the size of the + /// collection but not when one of the elements of the collection is modified as it is a bit + /// tricky to detect unmanaged code that modifies the collection under our feet. + public sealed class TouchPointContainerEnumerator : global::System.Collections.IEnumerator + , global::System.Collections.Generic.IEnumerator + { + private TouchPointContainer collectionRef; + private int currentIndex; + private object currentObject; + private int currentSize; + + public TouchPointContainerEnumerator(TouchPointContainer collection) + { + collectionRef = collection; + currentIndex = -1; + currentObject = null; + currentSize = collectionRef.Count; + } + + // Type-safe iterator Current + public TouchPoint Current + { + get + { + if (currentIndex == -1) + throw new global::System.InvalidOperationException("Enumeration not started."); + if (currentIndex > currentSize - 1) + throw new global::System.InvalidOperationException("Enumeration finished."); + if (currentObject == null) + throw new global::System.InvalidOperationException("Collection modified."); + return (TouchPoint)currentObject; + } + } + + // Type-unsafe IEnumerator.Current + object global::System.Collections.IEnumerator.Current + { + get + { + return Current; + } + } + + public bool MoveNext() + { + int size = collectionRef.Count; + bool moveOkay = (currentIndex + 1 < size) && (size == currentSize); + if (moveOkay) + { + currentIndex++; + currentObject = collectionRef[currentIndex]; + } + else + { + currentObject = null; + } + return moveOkay; + } + + public void Reset() + { + currentIndex = -1; + currentObject = null; + if (collectionRef.Count != currentSize) + { + throw new global::System.InvalidOperationException("Collection modified."); + } + } + + public void Dispose() + { + currentIndex = -1; + currentObject = null; + } + } + + public void Clear() + { + NDalicPINVOKE.TouchPointContainer_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Add(TouchPoint x) + { + NDalicPINVOKE.TouchPointContainer_Add(swigCPtr, TouchPoint.getCPtr(x)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private uint size() + { + uint ret = NDalicPINVOKE.TouchPointContainer_size(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private uint capacity() + { + uint ret = NDalicPINVOKE.TouchPointContainer_capacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void reserve(uint n) + { + NDalicPINVOKE.TouchPointContainer_reserve(swigCPtr, n); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchPointContainer() : this(NDalicPINVOKE.new_TouchPointContainer__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchPointContainer(TouchPointContainer other) : this(NDalicPINVOKE.new_TouchPointContainer__SWIG_1(TouchPointContainer.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchPointContainer(int capacity) : this(NDalicPINVOKE.new_TouchPointContainer__SWIG_2(capacity), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private TouchPoint getitemcopy(int index) + { + TouchPoint ret = new TouchPoint(NDalicPINVOKE.TouchPointContainer_getitemcopy(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private TouchPoint getitem(int index) + { + TouchPoint ret = new TouchPoint(NDalicPINVOKE.TouchPointContainer_getitem(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void setitem(int index, TouchPoint val) + { + NDalicPINVOKE.TouchPointContainer_setitem(swigCPtr, index, TouchPoint.getCPtr(val)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void AddRange(TouchPointContainer values) + { + NDalicPINVOKE.TouchPointContainer_AddRange(swigCPtr, TouchPointContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchPointContainer GetRange(int index, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.TouchPointContainer_GetRange(swigCPtr, index, count); + TouchPointContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new TouchPointContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Insert(int index, TouchPoint x) + { + NDalicPINVOKE.TouchPointContainer_Insert(swigCPtr, index, TouchPoint.getCPtr(x)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void InsertRange(int index, TouchPointContainer values) + { + NDalicPINVOKE.TouchPointContainer_InsertRange(swigCPtr, index, TouchPointContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveAt(int index) + { + NDalicPINVOKE.TouchPointContainer_RemoveAt(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveRange(int index, int count) + { + NDalicPINVOKE.TouchPointContainer_RemoveRange(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static TouchPointContainer Repeat(TouchPoint value, int count) + { + global::System.IntPtr cPtr = NDalicPINVOKE.TouchPointContainer_Repeat(TouchPoint.getCPtr(value), count); + TouchPointContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new TouchPointContainer(cPtr, true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Reverse() + { + NDalicPINVOKE.TouchPointContainer_Reverse__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reverse(int index, int count) + { + NDalicPINVOKE.TouchPointContainer_Reverse__SWIG_1(swigCPtr, index, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetRange(int index, TouchPointContainer values) + { + NDalicPINVOKE.TouchPointContainer_SetRange(swigCPtr, index, TouchPointContainer.getCPtr(values)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TouchSignal.cs b/src/Tizen.NUI/src/internal/TouchSignal.cs new file mode 100755 index 0000000..420b58e --- /dev/null +++ b/src/Tizen.NUI/src/internal/TouchSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TouchSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TouchSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TouchSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TouchSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TouchSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.TouchSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.TouchSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TouchSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.TouchSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(Touch arg) + { + NDalicPINVOKE.TouchSignal_Emit(swigCPtr, Touch.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TouchSignal() : this(NDalicPINVOKE.new_TouchSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Type.cs b/src/Tizen.NUI/src/internal/Type.cs new file mode 100755 index 0000000..64099f1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Type.cs @@ -0,0 +1,32 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public enum Type + { + NONE, + USER, + KEYBOARD, + MOUSE, + TOUCH, + PEN, + POINTER, + GAMEPAD + } + +} diff --git a/src/Tizen.NUI/src/internal/TypeAction.cs b/src/Tizen.NUI/src/internal/TypeAction.cs new file mode 100755 index 0000000..8ad9180 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TypeAction.cs @@ -0,0 +1,110 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TypeAction : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TypeAction(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TypeAction obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TypeAction() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TypeAction(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + internal TypeAction(TypeRegistration registered, string name, SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool f) : this(NDalicPINVOKE.new_TypeAction(TypeRegistration.getCPtr(registered), name, SWIGTYPE_p_f_p_Dali__BaseObject_r_q_const__std__string_r_q_const__Dali__Property__Map__bool.getCPtr(f)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TypeRegistration.cs b/src/Tizen.NUI/src/internal/TypeRegistration.cs new file mode 100755 index 0000000..64f2e7e --- /dev/null +++ b/src/Tizen.NUI/src/internal/TypeRegistration.cs @@ -0,0 +1,162 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TypeRegistration : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal TypeRegistration(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TypeRegistration obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~TypeRegistration() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TypeRegistration(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + static private global::System.IntPtr SwigConstructTypeRegistration(SWIGTYPE_p_std__type_info registerType, SWIGTYPE_p_std__type_info baseType, System.Delegate f) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(f); + return NDalicPINVOKE.new_TypeRegistration__SWIG_0(SWIGTYPE_p_std__type_info.getCPtr(registerType), SWIGTYPE_p_std__type_info.getCPtr(baseType), new System.Runtime.InteropServices.HandleRef(null, ip)); + } + + internal TypeRegistration(SWIGTYPE_p_std__type_info registerType, SWIGTYPE_p_std__type_info baseType, System.Delegate f) : this(TypeRegistration.SwigConstructTypeRegistration(registerType, baseType, f), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + static private global::System.IntPtr SwigConstructTypeRegistration(SWIGTYPE_p_std__type_info registerType, SWIGTYPE_p_std__type_info baseType, System.Delegate f, bool callCreateOnInit) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(f); + return NDalicPINVOKE.new_TypeRegistration__SWIG_1(SWIGTYPE_p_std__type_info.getCPtr(registerType), SWIGTYPE_p_std__type_info.getCPtr(baseType), new System.Runtime.InteropServices.HandleRef(null, ip), callCreateOnInit); + } + + internal TypeRegistration(SWIGTYPE_p_std__type_info registerType, SWIGTYPE_p_std__type_info baseType, System.Delegate f, bool callCreateOnInit) : this(TypeRegistration.SwigConstructTypeRegistration(registerType, baseType, f, callCreateOnInit), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + static private global::System.IntPtr SwigConstructTypeRegistration(string name, SWIGTYPE_p_std__type_info baseType, System.Delegate f) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(f); + return NDalicPINVOKE.new_TypeRegistration__SWIG_2(name, SWIGTYPE_p_std__type_info.getCPtr(baseType), new System.Runtime.InteropServices.HandleRef(null, ip)); + } + + internal TypeRegistration(string name, SWIGTYPE_p_std__type_info baseType, System.Delegate f) : this(TypeRegistration.SwigConstructTypeRegistration(name, baseType, f), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string RegisteredName() + { + string ret = NDalicPINVOKE.TypeRegistration_RegisteredName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static void RegisterControl(string controlName, System.Delegate createFunc) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(createFunc); + { + NDalicPINVOKE.TypeRegistration_RegisterControl(controlName, new System.Runtime.InteropServices.HandleRef(null, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public static void RegisterProperty(string controlName, string propertyName, int index, PropertyType type, System.Delegate setFunc, System.Delegate getFunc) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(setFunc); + System.IntPtr ip2 = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(getFunc); + { + NDalicPINVOKE.TypeRegistration_RegisterProperty(controlName, propertyName, index, (int)type, new System.Runtime.InteropServices.HandleRef(null, ip), new System.Runtime.InteropServices.HandleRef(null, ip2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/TypeRegistry.cs b/src/Tizen.NUI/src/internal/TypeRegistry.cs new file mode 100755 index 0000000..2ac7953 --- /dev/null +++ b/src/Tizen.NUI/src/internal/TypeRegistry.cs @@ -0,0 +1,125 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class TypeRegistry : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TypeRegistry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TypeRegistry_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TypeRegistry obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TypeRegistry(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public static TypeRegistry Get() + { + TypeRegistry ret = new TypeRegistry(NDalicPINVOKE.TypeRegistry_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TypeRegistry() : this(NDalicPINVOKE.new_TypeRegistry__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TypeRegistry(TypeRegistry handle) : this(NDalicPINVOKE.new_TypeRegistry__SWIG_1(TypeRegistry.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TypeRegistry Assign(TypeRegistry rhs) + { + TypeRegistry ret = new TypeRegistry(NDalicPINVOKE.TypeRegistry_Assign(swigCPtr, TypeRegistry.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TypeInfo GetTypeInfo(string uniqueTypeName) + { + TypeInfo ret = new TypeInfo(NDalicPINVOKE.TypeRegistry_GetTypeInfo__SWIG_0(swigCPtr, uniqueTypeName), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TypeInfo GetTypeInfo(SWIGTYPE_p_std__type_info registerType) + { + TypeInfo ret = new TypeInfo(NDalicPINVOKE.TypeRegistry_GetTypeInfo__SWIG_1(swigCPtr, SWIGTYPE_p_std__type_info.getCPtr(registerType)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetTypeNameCount() + { + uint ret = NDalicPINVOKE.TypeRegistry_GetTypeNameCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetTypeName(uint index) + { + string ret = NDalicPINVOKE.TypeRegistry_GetTypeName(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TypeRegistry(SWIGTYPE_p_Dali__Internal__TypeRegistry typeRegistry) : this(NDalicPINVOKE.new_TypeRegistry__SWIG_2(SWIGTYPE_p_Dali__Internal__TypeRegistry.getCPtr(typeRegistry)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/Uint16Pair.cs b/src/Tizen.NUI/src/internal/Uint16Pair.cs new file mode 100755 index 0000000..c2d201f --- /dev/null +++ b/src/Tizen.NUI/src/internal/Uint16Pair.cs @@ -0,0 +1,220 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; + +namespace Tizen.NUI +{ + + [Obsolete("Please do not use! this will be deprecated")] + public class Uint16Pair : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Uint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Uint16Pair obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~Uint16Pair() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Uint16Pair(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public static bool operator <(Uint16Pair arg1, Uint16Pair arg2) + { + return arg1.LessThan(arg2); + } + + public static bool operator >(Uint16Pair arg1, Uint16Pair arg2) + { + return arg1.GreaterThan(arg2); + } + + public Uint16Pair() : this(NDalicPINVOKE.new_Uint16Pair__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Uint16Pair(uint width, uint height) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_1(width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Uint16Pair(Uint16Pair rhs) : this(NDalicPINVOKE.new_Uint16Pair__SWIG_2(Uint16Pair.getCPtr(rhs)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetWidth(ushort width) + { + NDalicPINVOKE.Uint16Pair_SetWidth(swigCPtr, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ushort GetWidth() + { + ushort ret = NDalicPINVOKE.Uint16Pair_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetHeight(ushort height) + { + NDalicPINVOKE.Uint16Pair_SetHeight(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ushort GetHeight() + { + ushort ret = NDalicPINVOKE.Uint16Pair_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetX(ushort x) + { + NDalicPINVOKE.Uint16Pair_SetX(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ushort GetX() + { + ushort ret = NDalicPINVOKE.Uint16Pair_GetX(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetY(ushort y) + { + NDalicPINVOKE.Uint16Pair_SetY(swigCPtr, y); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ushort GetY() + { + ushort ret = NDalicPINVOKE.Uint16Pair_GetY(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Uint16Pair Assign(Uint16Pair rhs) + { + Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.Uint16Pair_Assign(swigCPtr, Uint16Pair.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool EqualTo(Uint16Pair rhs) + { + bool ret = NDalicPINVOKE.Uint16Pair_EqualTo(swigCPtr, Uint16Pair.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool NotEqualTo(Uint16Pair rhs) + { + bool ret = NDalicPINVOKE.Uint16Pair_NotEqualTo(swigCPtr, Uint16Pair.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool LessThan(Uint16Pair rhs) + { + bool ret = NDalicPINVOKE.Uint16Pair_LessThan(swigCPtr, Uint16Pair.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool GreaterThan(Uint16Pair rhs) + { + bool ret = NDalicPINVOKE.Uint16Pair_GreaterThan(swigCPtr, Uint16Pair.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/VectorBase.cs b/src/Tizen.NUI/src/internal/VectorBase.cs new file mode 100755 index 0000000..d3a8135 --- /dev/null +++ b/src/Tizen.NUI/src/internal/VectorBase.cs @@ -0,0 +1,139 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class VectorBase : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal VectorBase(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VectorBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~VectorBase() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public uint Count() + { + uint ret = NDalicPINVOKE.VectorBase_Count(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint Size() + { + uint ret = NDalicPINVOKE.VectorBase_Size(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.VectorBase_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint Capacity() + { + uint ret = NDalicPINVOKE.VectorBase_Capacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Release() + { + NDalicPINVOKE.VectorBase_Release(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/VectorUint16Pair.cs b/src/Tizen.NUI/src/internal/VectorUint16Pair.cs new file mode 100755 index 0000000..ed9f24c --- /dev/null +++ b/src/Tizen.NUI/src/internal/VectorUint16Pair.cs @@ -0,0 +1,223 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class VectorUint16Pair : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal VectorUint16Pair(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VectorUint16Pair obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~VectorUint16Pair() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VectorUint16Pair(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public VectorUint16Pair() : this(NDalicPINVOKE.new_VectorUint16Pair__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VectorUint16Pair(VectorUint16Pair vector) : this(NDalicPINVOKE.new_VectorUint16Pair__SWIG_1(VectorUint16Pair.getCPtr(vector)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VectorUint16Pair Assign(VectorUint16Pair vector) + { + VectorUint16Pair ret = new VectorUint16Pair(NDalicPINVOKE.VectorUint16Pair_Assign(swigCPtr, VectorUint16Pair.getCPtr(vector)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Uint16Pair Begin() + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUint16Pair_Begin(swigCPtr); + Uint16Pair ret = (cPtr == global::System.IntPtr.Zero) ? null : new Uint16Pair(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Uint16Pair End() + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUint16Pair_End(swigCPtr); + Uint16Pair ret = (cPtr == global::System.IntPtr.Zero) ? null : new Uint16Pair(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Uint16Pair ValueOfIndex(uint index) + { + Uint16Pair ret = new Uint16Pair(NDalicPINVOKE.VectorUint16Pair_ValueOfIndex__SWIG_0(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void PushBack(Uint16Pair element) + { + NDalicPINVOKE.VectorUint16Pair_PushBack(swigCPtr, Uint16Pair.getCPtr(element)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Insert(Uint16Pair at, Uint16Pair element) + { + NDalicPINVOKE.VectorUint16Pair_Insert__SWIG_0(swigCPtr, Uint16Pair.getCPtr(at), Uint16Pair.getCPtr(element)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Insert(Uint16Pair at, Uint16Pair from, Uint16Pair to) + { + NDalicPINVOKE.VectorUint16Pair_Insert__SWIG_1(swigCPtr, Uint16Pair.getCPtr(at), Uint16Pair.getCPtr(from), Uint16Pair.getCPtr(to)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reserve(uint count) + { + NDalicPINVOKE.VectorUint16Pair_Reserve(swigCPtr, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Resize(uint count) + { + NDalicPINVOKE.VectorUint16Pair_Resize__SWIG_0(swigCPtr, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Resize(uint count, Uint16Pair item) + { + NDalicPINVOKE.VectorUint16Pair_Resize__SWIG_1(swigCPtr, count, Uint16Pair.getCPtr(item)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Uint16Pair Erase(Uint16Pair iterator) + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUint16Pair_Erase__SWIG_0(swigCPtr, Uint16Pair.getCPtr(iterator)); + Uint16Pair ret = (cPtr == global::System.IntPtr.Zero) ? null : new Uint16Pair(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Uint16Pair Erase(Uint16Pair first, Uint16Pair last) + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUint16Pair_Erase__SWIG_1(swigCPtr, Uint16Pair.getCPtr(first), Uint16Pair.getCPtr(last)); + Uint16Pair ret = (cPtr == global::System.IntPtr.Zero) ? null : new Uint16Pair(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Remove(Uint16Pair iterator) + { + NDalicPINVOKE.VectorUint16Pair_Remove(swigCPtr, Uint16Pair.getCPtr(iterator)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Swap(VectorUint16Pair vector) + { + NDalicPINVOKE.VectorUint16Pair_Swap(swigCPtr, VectorUint16Pair.getCPtr(vector)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Clear() + { + NDalicPINVOKE.VectorUint16Pair_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Release() + { + NDalicPINVOKE.VectorUint16Pair_Release(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int BaseType = NDalicPINVOKE.VectorUint16Pair_BaseType_get(); + + } + +} diff --git a/src/Tizen.NUI/src/internal/VectorUnsignedChar.cs b/src/Tizen.NUI/src/internal/VectorUnsignedChar.cs new file mode 100755 index 0000000..d8832f6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/VectorUnsignedChar.cs @@ -0,0 +1,223 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class VectorUnsignedChar : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal VectorUnsignedChar(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VectorUnsignedChar obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~VectorUnsignedChar() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VectorUnsignedChar(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public VectorUnsignedChar() : this(NDalicPINVOKE.new_VectorUnsignedChar__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VectorUnsignedChar(VectorUnsignedChar vector) : this(NDalicPINVOKE.new_VectorUnsignedChar__SWIG_1(VectorUnsignedChar.getCPtr(vector)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VectorUnsignedChar Assign(VectorUnsignedChar vector) + { + VectorUnsignedChar ret = new VectorUnsignedChar(NDalicPINVOKE.VectorUnsignedChar_Assign(swigCPtr, VectorUnsignedChar.getCPtr(vector)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_char Begin() + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUnsignedChar_Begin(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_char End() + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUnsignedChar_End(swigCPtr); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_char ValueOfIndex(uint index) + { + SWIGTYPE_p_unsigned_char ret = new SWIGTYPE_p_unsigned_char(NDalicPINVOKE.VectorUnsignedChar_ValueOfIndex__SWIG_0(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void PushBack(byte element) + { + NDalicPINVOKE.VectorUnsignedChar_PushBack(swigCPtr, element); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Insert(byte[] at, byte element) + { + NDalicPINVOKE.VectorUnsignedChar_Insert__SWIG_0(swigCPtr, at, element); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Insert(byte[] at, SWIGTYPE_p_unsigned_char from, SWIGTYPE_p_unsigned_char to) + { + NDalicPINVOKE.VectorUnsignedChar_Insert__SWIG_1(swigCPtr, at, SWIGTYPE_p_unsigned_char.getCPtr(from), SWIGTYPE_p_unsigned_char.getCPtr(to)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Reserve(uint count) + { + NDalicPINVOKE.VectorUnsignedChar_Reserve(swigCPtr, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Resize(uint count) + { + NDalicPINVOKE.VectorUnsignedChar_Resize__SWIG_0(swigCPtr, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Resize(uint count, byte item) + { + NDalicPINVOKE.VectorUnsignedChar_Resize__SWIG_1(swigCPtr, count, item); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_unsigned_char Erase(byte[] iterator) + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUnsignedChar_Erase__SWIG_0(swigCPtr, iterator); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_char Erase(byte[] first, SWIGTYPE_p_unsigned_char last) + { + global::System.IntPtr cPtr = NDalicPINVOKE.VectorUnsignedChar_Erase__SWIG_1(swigCPtr, first, SWIGTYPE_p_unsigned_char.getCPtr(last)); + SWIGTYPE_p_unsigned_char ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Remove(byte[] iterator) + { + NDalicPINVOKE.VectorUnsignedChar_Remove(swigCPtr, iterator); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Swap(VectorUnsignedChar vector) + { + NDalicPINVOKE.VectorUnsignedChar_Swap(swigCPtr, VectorUnsignedChar.getCPtr(vector)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Clear() + { + NDalicPINVOKE.VectorUnsignedChar_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Release() + { + NDalicPINVOKE.VectorUnsignedChar_Release(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public static readonly int BaseType = NDalicPINVOKE.VectorUnsignedChar_BaseType_get(); + + } + +} diff --git a/src/Tizen.NUI/src/internal/VideoViewSignal.cs b/src/Tizen.NUI/src/internal/VideoViewSignal.cs new file mode 100755 index 0000000..e234ffa --- /dev/null +++ b/src/Tizen.NUI/src/internal/VideoViewSignal.cs @@ -0,0 +1,140 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI { + + internal class VideoViewSignal : global::System.IDisposable { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal VideoViewSignal(global::System.IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoViewSignal obj) { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~VideoViewSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VideoViewSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() { + bool ret = NDalicPINVOKE.VideoViewSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() { + uint ret = NDalicPINVOKE.VideoViewSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) { +System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.VideoViewSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) { +System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.VideoViewSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(VideoView arg) { + NDalicPINVOKE.VideoViewSignal_Emit(swigCPtr, VideoView.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VideoViewSignal() : this(NDalicPINVOKE.new_VideoViewSignal(), true) { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + +} + +} diff --git a/src/Tizen.NUI/src/internal/ViewImpl.cs b/src/Tizen.NUI/src/internal/ViewImpl.cs new file mode 100755 index 0000000..aea5d39 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewImpl.cs @@ -0,0 +1,966 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System.Reflection; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class ViewImpl : CustomActorImpl + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ViewImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ViewImpl_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewImpl obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + throw new global::System.MethodAccessException("C++ destructor does not have public access"); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public static View New() + { + View ret = new View(NDalicPINVOKE.ViewImpl_New(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetStyleName(string styleName) + { + NDalicPINVOKE.ViewImpl_SetStyleName(swigCPtr, styleName); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string GetStyleName() + { + string ret = NDalicPINVOKE.ViewImpl_GetStyleName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetBackgroundColor(Vector4 color) + { + NDalicPINVOKE.ViewImpl_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector4 GetBackgroundColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.ViewImpl_GetBackgroundColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetBackgroundImage(Image image) + { + NDalicPINVOKE.ViewImpl_SetBackgroundImage(swigCPtr, Image.getCPtr(image)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetBackground(PropertyMap map) + { + NDalicPINVOKE.ViewImpl_SetBackground(swigCPtr, PropertyMap.getCPtr(map)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ClearBackground() + { + NDalicPINVOKE.ViewImpl_ClearBackground(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void EnableGestureDetection(Gesture.GestureType type) + { + NDalicPINVOKE.ViewImpl_EnableGestureDetection(swigCPtr, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void DisableGestureDetection(Gesture.GestureType type) + { + NDalicPINVOKE.ViewImpl_DisableGestureDetection(swigCPtr, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PinchGestureDetector GetPinchGestureDetector() + { + PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.ViewImpl_GetPinchGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PanGestureDetector GetPanGestureDetector() + { + PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.ViewImpl_GetPanGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public TapGestureDetector GetTapGestureDetector() + { + TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.ViewImpl_GetTapGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public LongPressGestureDetector GetLongPressGestureDetector() + { + LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.ViewImpl_GetLongPressGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetKeyboardNavigationSupport(bool isSupported) + { + NDalicPINVOKE.ViewImpl_SetKeyboardNavigationSupport(swigCPtr, isSupported); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsKeyboardNavigationSupported() + { + bool ret = NDalicPINVOKE.ViewImpl_IsKeyboardNavigationSupported(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetKeyInputFocus() + { + NDalicPINVOKE.ViewImpl_SetKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool HasKeyInputFocus() + { + bool ret = NDalicPINVOKE.ViewImpl_HasKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ClearKeyInputFocus() + { + NDalicPINVOKE.ViewImpl_ClearKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetAsFocusGroup(bool isFocusGroup) + { + NDalicPINVOKE.ViewImpl_SetAsKeyboardFocusGroup(swigCPtr, isFocusGroup); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsFocusGroup() + { + bool ret = NDalicPINVOKE.ViewImpl_IsKeyboardFocusGroup(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void AccessibilityActivate() + { + NDalicPINVOKE.ViewImpl_AccessibilityActivate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void KeyboardEnter() + { + NDalicPINVOKE.ViewImpl_KeyboardEnter(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ControlKeySignal KeyEventSignal() + { + ControlKeySignal ret = new ControlKeySignal(NDalicPINVOKE.ViewImpl_KeyEventSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal KeyInputFocusSignal KeyInputFocusGainedSignal() + { + KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.ViewImpl_KeyInputFocusGainedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal KeyInputFocusSignal KeyInputFocusLostSignal() + { + KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.ViewImpl_KeyInputFocusLostSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool EmitKeyEventSignal(Key arg0) + { + bool ret = NDalicPINVOKE.ViewImpl_EmitKeyEventSignal(swigCPtr, Key.getCPtr(arg0)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new void OnStageConnection(int depth) + { + if (SwigDerivedClassHasMethod("OnStageConnection", swigMethodTypes0)) NDalicPINVOKE.ViewImpl_OnStageConnectionSwigExplicitViewImpl(swigCPtr, depth); else NDalicPINVOKE.ViewImpl_OnStageConnection(swigCPtr, depth); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnStageDisconnection() + { + if (SwigDerivedClassHasMethod("OnStageDisconnection", swigMethodTypes1)) NDalicPINVOKE.ViewImpl_OnStageDisconnectionSwigExplicitViewImpl(swigCPtr); else NDalicPINVOKE.ViewImpl_OnStageDisconnection(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnChildAdd(View child) + { + if (SwigDerivedClassHasMethod("OnChildAdd", swigMethodTypes2)) NDalicPINVOKE.ViewImpl_OnChildAddSwigExplicitViewImpl(swigCPtr, View.getCPtr(child)); else NDalicPINVOKE.ViewImpl_OnChildAdd(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnChildRemove(View child) + { + if (SwigDerivedClassHasMethod("OnChildRemove", swigMethodTypes3)) NDalicPINVOKE.ViewImpl_OnChildRemoveSwigExplicitViewImpl(swigCPtr, View.getCPtr(child)); else NDalicPINVOKE.ViewImpl_OnChildRemove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnPropertySet(int index, PropertyValue propertyValue) + { + if (SwigDerivedClassHasMethod("OnPropertySet", swigMethodTypes4)) NDalicPINVOKE.ViewImpl_OnPropertySetSwigExplicitViewImpl(swigCPtr, index, PropertyValue.getCPtr(propertyValue)); else NDalicPINVOKE.ViewImpl_OnPropertySet(swigCPtr, index, PropertyValue.getCPtr(propertyValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnSizeSet(Vector3 targetSize) + { + if (SwigDerivedClassHasMethod("OnSizeSet", swigMethodTypes5)) NDalicPINVOKE.ViewImpl_OnSizeSetSwigExplicitViewImpl(swigCPtr, Vector3.getCPtr(targetSize)); else NDalicPINVOKE.ViewImpl_OnSizeSet(swigCPtr, Vector3.getCPtr(targetSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnSizeAnimation(Animation animation, Vector3 targetSize) + { + if (SwigDerivedClassHasMethod("OnSizeAnimation", swigMethodTypes6)) NDalicPINVOKE.ViewImpl_OnSizeAnimationSwigExplicitViewImpl(swigCPtr, Animation.getCPtr(animation), Vector3.getCPtr(targetSize)); else NDalicPINVOKE.ViewImpl_OnSizeAnimation(swigCPtr, Animation.getCPtr(animation), Vector3.getCPtr(targetSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal virtual new bool OnTouchEvent(SWIGTYPE_p_Dali__TouchEvent arg0) + { + bool ret = (SwigDerivedClassHasMethod("OnTouchEvent", swigMethodTypes7) ? NDalicPINVOKE.ViewImpl_OnTouchEventSwigExplicitViewImpl(swigCPtr, SWIGTYPE_p_Dali__TouchEvent.getCPtr(arg0)) : NDalicPINVOKE.ViewImpl_OnTouchEvent(swigCPtr, SWIGTYPE_p_Dali__TouchEvent.getCPtr(arg0))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new bool OnHoverEvent(Hover arg0) + { + bool ret = (SwigDerivedClassHasMethod("OnHoverEvent", swigMethodTypes8) ? NDalicPINVOKE.ViewImpl_OnHoverEventSwigExplicitViewImpl(swigCPtr, Hover.getCPtr(arg0)) : NDalicPINVOKE.ViewImpl_OnHoverEvent(swigCPtr, Hover.getCPtr(arg0))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new bool OnKeyEvent(Key arg0) + { + bool ret = (SwigDerivedClassHasMethod("OnKeyEvent", swigMethodTypes9) ? NDalicPINVOKE.ViewImpl_OnKeyEventSwigExplicitViewImpl(swigCPtr, Key.getCPtr(arg0)) : NDalicPINVOKE.ViewImpl_OnKeyEvent(swigCPtr, Key.getCPtr(arg0))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new bool OnWheelEvent(Wheel arg0) + { + bool ret = (SwigDerivedClassHasMethod("OnWheelEvent", swigMethodTypes10) ? NDalicPINVOKE.ViewImpl_OnWheelEventSwigExplicitViewImpl(swigCPtr, Wheel.getCPtr(arg0)) : NDalicPINVOKE.ViewImpl_OnWheelEvent(swigCPtr, Wheel.getCPtr(arg0))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new void OnRelayout(Vector2 size, RelayoutContainer container) + { + if (SwigDerivedClassHasMethod("OnRelayout", swigMethodTypes11)) NDalicPINVOKE.ViewImpl_OnRelayoutSwigExplicitViewImpl(swigCPtr, Vector2.getCPtr(size), RelayoutContainer.getCPtr(container)); else NDalicPINVOKE.ViewImpl_OnRelayout(swigCPtr, Vector2.getCPtr(size), RelayoutContainer.getCPtr(container)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + if (SwigDerivedClassHasMethod("OnSetResizePolicy", swigMethodTypes12)) NDalicPINVOKE.ViewImpl_OnSetResizePolicySwigExplicitViewImpl(swigCPtr, (int)policy, (int)dimension); else NDalicPINVOKE.ViewImpl_OnSetResizePolicy(swigCPtr, (int)policy, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new Vector3 GetNaturalSize() + { + Vector3 ret = new Vector3((SwigDerivedClassHasMethod("GetNaturalSize", swigMethodTypes13) ? NDalicPINVOKE.ViewImpl_GetNaturalSizeSwigExplicitViewImpl(swigCPtr) : NDalicPINVOKE.ViewImpl_GetNaturalSize(swigCPtr)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new float CalculateChildSize(View child, DimensionType dimension) + { + float ret = (SwigDerivedClassHasMethod("CalculateChildSize", swigMethodTypes14) ? NDalicPINVOKE.ViewImpl_CalculateChildSizeSwigExplicitViewImpl(swigCPtr, View.getCPtr(child), (int)dimension) : NDalicPINVOKE.ViewImpl_CalculateChildSize(swigCPtr, View.getCPtr(child), (int)dimension)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new float GetHeightForWidth(float width) + { + float ret = (SwigDerivedClassHasMethod("GetHeightForWidth", swigMethodTypes15) ? NDalicPINVOKE.ViewImpl_GetHeightForWidthSwigExplicitViewImpl(swigCPtr, width) : NDalicPINVOKE.ViewImpl_GetHeightForWidth(swigCPtr, width)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new float GetWidthForHeight(float height) + { + float ret = (SwigDerivedClassHasMethod("GetWidthForHeight", swigMethodTypes16) ? NDalicPINVOKE.ViewImpl_GetWidthForHeightSwigExplicitViewImpl(swigCPtr, height) : NDalicPINVOKE.ViewImpl_GetWidthForHeight(swigCPtr, height)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new bool RelayoutDependentOnChildren(DimensionType dimension) + { + bool ret = (SwigDerivedClassHasMethod("RelayoutDependentOnChildren", swigMethodTypes17) ? NDalicPINVOKE.ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_0(swigCPtr, (int)dimension) : NDalicPINVOKE.ViewImpl_RelayoutDependentOnChildren__SWIG_0(swigCPtr, (int)dimension)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new bool RelayoutDependentOnChildren() + { + bool ret = (SwigDerivedClassHasMethod("RelayoutDependentOnChildren", swigMethodTypes18) ? NDalicPINVOKE.ViewImpl_RelayoutDependentOnChildrenSwigExplicitViewImpl__SWIG_1(swigCPtr) : NDalicPINVOKE.ViewImpl_RelayoutDependentOnChildren__SWIG_1(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + protected virtual new void OnCalculateRelayoutSize(DimensionType dimension) + { + if (SwigDerivedClassHasMethod("OnCalculateRelayoutSize", swigMethodTypes19)) NDalicPINVOKE.ViewImpl_OnCalculateRelayoutSizeSwigExplicitViewImpl(swigCPtr, (int)dimension); else NDalicPINVOKE.ViewImpl_OnCalculateRelayoutSize(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + protected virtual new void OnLayoutNegotiated(float size, DimensionType dimension) + { + if (SwigDerivedClassHasMethod("OnLayoutNegotiated", swigMethodTypes20)) NDalicPINVOKE.ViewImpl_OnLayoutNegotiatedSwigExplicitViewImpl(swigCPtr, size, (int)dimension); else NDalicPINVOKE.ViewImpl_OnLayoutNegotiated(swigCPtr, size, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnInitialize() + { + if (SwigDerivedClassHasMethod("OnInitialize", swigMethodTypes21)) NDalicPINVOKE.ViewImpl_OnInitializeSwigExplicitViewImpl(swigCPtr); else NDalicPINVOKE.ViewImpl_OnInitialize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnControlChildAdd(View child) + { + if (SwigDerivedClassHasMethod("OnControlChildAdd", swigMethodTypes22)) NDalicPINVOKE.ViewImpl_OnControlChildAddSwigExplicitViewImpl(swigCPtr, View.getCPtr(child)); else NDalicPINVOKE.ViewImpl_OnControlChildAdd(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnControlChildRemove(View child) + { + if (SwigDerivedClassHasMethod("OnControlChildRemove", swigMethodTypes23)) NDalicPINVOKE.ViewImpl_OnControlChildRemoveSwigExplicitViewImpl(swigCPtr, View.getCPtr(child)); else NDalicPINVOKE.ViewImpl_OnControlChildRemove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change) + { + if (SwigDerivedClassHasMethod("OnStyleChange", swigMethodTypes24)) NDalicPINVOKE.ViewImpl_OnStyleChangeSwigExplicitViewImpl(swigCPtr, StyleManager.getCPtr(styleManager), (int)change); else NDalicPINVOKE.ViewImpl_OnStyleChange(swigCPtr, StyleManager.getCPtr(styleManager), (int)change); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual bool OnAccessibilityActivated() + { + bool ret = (SwigDerivedClassHasMethod("OnAccessibilityActivated", swigMethodTypes25) ? NDalicPINVOKE.ViewImpl_OnAccessibilityActivatedSwigExplicitViewImpl(swigCPtr) : NDalicPINVOKE.ViewImpl_OnAccessibilityActivated(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnAccessibilityPan(PanGesture gesture) + { + bool ret = (SwigDerivedClassHasMethod("OnAccessibilityPan", swigMethodTypes26) ? NDalicPINVOKE.ViewImpl_OnAccessibilityPanSwigExplicitViewImpl(swigCPtr, PanGesture.getCPtr(gesture)) : NDalicPINVOKE.ViewImpl_OnAccessibilityPan(swigCPtr, PanGesture.getCPtr(gesture))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal virtual bool OnAccessibilityTouch(SWIGTYPE_p_Dali__TouchEvent touchEvent) + { + bool ret = (SwigDerivedClassHasMethod("OnAccessibilityTouch", swigMethodTypes27) ? NDalicPINVOKE.ViewImpl_OnAccessibilityTouchSwigExplicitViewImpl(swigCPtr, SWIGTYPE_p_Dali__TouchEvent.getCPtr(touchEvent)) : NDalicPINVOKE.ViewImpl_OnAccessibilityTouch(swigCPtr, SWIGTYPE_p_Dali__TouchEvent.getCPtr(touchEvent))); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnAccessibilityValueChange(bool isIncrease) + { + bool ret = (SwigDerivedClassHasMethod("OnAccessibilityValueChange", swigMethodTypes28) ? NDalicPINVOKE.ViewImpl_OnAccessibilityValueChangeSwigExplicitViewImpl(swigCPtr, isIncrease) : NDalicPINVOKE.ViewImpl_OnAccessibilityValueChange(swigCPtr, isIncrease)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual bool OnAccessibilityZoom() + { + bool ret = (SwigDerivedClassHasMethod("OnAccessibilityZoom", swigMethodTypes29) ? NDalicPINVOKE.ViewImpl_OnAccessibilityZoomSwigExplicitViewImpl(swigCPtr) : NDalicPINVOKE.ViewImpl_OnAccessibilityZoom(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnKeyInputFocusGained() + { + if (SwigDerivedClassHasMethod("OnKeyInputFocusGained", swigMethodTypes30)) NDalicPINVOKE.ViewImpl_OnKeyInputFocusGainedSwigExplicitViewImpl(swigCPtr); else NDalicPINVOKE.ViewImpl_OnKeyInputFocusGained(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnKeyInputFocusLost() + { + if (SwigDerivedClassHasMethod("OnKeyInputFocusLost", swigMethodTypes31)) NDalicPINVOKE.ViewImpl_OnKeyInputFocusLostSwigExplicitViewImpl(swigCPtr); else NDalicPINVOKE.ViewImpl_OnKeyInputFocusLost(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled) + { + View ret = new View((SwigDerivedClassHasMethod("GetNextFocusableView", swigMethodTypes32) ? NDalicPINVOKE.ViewImpl_GetNextKeyboardFocusableActorSwigExplicitViewImpl(swigCPtr, View.getCPtr(currentFocusedView), (int)direction, loopEnabled) : NDalicPINVOKE.ViewImpl_GetNextKeyboardFocusableActor(swigCPtr, View.getCPtr(currentFocusedView), (int)direction, loopEnabled)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnFocusChangeCommitted(View commitedFocusableView) + { + if (SwigDerivedClassHasMethod("OnFocusChangeCommitted", swigMethodTypes33)) NDalicPINVOKE.ViewImpl_OnKeyboardFocusChangeCommittedSwigExplicitViewImpl(swigCPtr, View.getCPtr(commitedFocusableView)); else NDalicPINVOKE.ViewImpl_OnKeyboardFocusChangeCommitted(swigCPtr, View.getCPtr(commitedFocusableView)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual bool OnKeyboardEnter() + { + bool ret = (SwigDerivedClassHasMethod("OnKeyboardEnter", swigMethodTypes34) ? NDalicPINVOKE.ViewImpl_OnKeyboardEnterSwigExplicitViewImpl(swigCPtr) : NDalicPINVOKE.ViewImpl_OnKeyboardEnter(swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public virtual void OnPinch(PinchGesture pinch) + { + if (SwigDerivedClassHasMethod("OnPinch", swigMethodTypes35)) NDalicPINVOKE.ViewImpl_OnPinchSwigExplicitViewImpl(swigCPtr, PinchGesture.getCPtr(pinch)); else NDalicPINVOKE.ViewImpl_OnPinch(swigCPtr, PinchGesture.getCPtr(pinch)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnPan(PanGesture pan) + { + if (SwigDerivedClassHasMethod("OnPan", swigMethodTypes36)) NDalicPINVOKE.ViewImpl_OnPanSwigExplicitViewImpl(swigCPtr, PanGesture.getCPtr(pan)); else NDalicPINVOKE.ViewImpl_OnPan(swigCPtr, PanGesture.getCPtr(pan)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnTap(TapGesture tap) + { + if (SwigDerivedClassHasMethod("OnTap", swigMethodTypes37)) NDalicPINVOKE.ViewImpl_OnTapSwigExplicitViewImpl(swigCPtr, TapGesture.getCPtr(tap)); else NDalicPINVOKE.ViewImpl_OnTap(swigCPtr, TapGesture.getCPtr(tap)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public virtual void OnLongPress(LongPressGesture longPress) + { + if (SwigDerivedClassHasMethod("OnLongPress", swigMethodTypes38)) NDalicPINVOKE.ViewImpl_OnLongPressSwigExplicitViewImpl(swigCPtr, LongPressGesture.getCPtr(longPress)); else NDalicPINVOKE.ViewImpl_OnLongPress(swigCPtr, LongPressGesture.getCPtr(longPress)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal virtual void SignalConnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + if (SwigDerivedClassHasMethod("SignalConnected", swigMethodTypes39)) NDalicPINVOKE.ViewImpl_SignalConnectedSwigExplicitViewImpl(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); else NDalicPINVOKE.ViewImpl_SignalConnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal virtual void SignalDisconnected(SlotObserver slotObserver, SWIGTYPE_p_Dali__CallbackBase callback) + { + if (SwigDerivedClassHasMethod("SignalDisconnected", swigMethodTypes40)) NDalicPINVOKE.ViewImpl_SignalDisconnectedSwigExplicitViewImpl(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); else NDalicPINVOKE.ViewImpl_SignalDisconnected(swigCPtr, SlotObserver.getCPtr(slotObserver), SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private void SwigDirectorConnect() + { + if (SwigDerivedClassHasMethod("OnStageConnection", swigMethodTypes0)) + swigDelegate0 = new SwigDelegateViewImpl_0(SwigDirectorOnStageConnection); + if (SwigDerivedClassHasMethod("OnStageDisconnection", swigMethodTypes1)) + swigDelegate1 = new SwigDelegateViewImpl_1(SwigDirectorOnStageDisconnection); + if (SwigDerivedClassHasMethod("OnChildAdd", swigMethodTypes2)) + swigDelegate2 = new SwigDelegateViewImpl_2(SwigDirectorOnChildAdd); + if (SwigDerivedClassHasMethod("OnChildRemove", swigMethodTypes3)) + swigDelegate3 = new SwigDelegateViewImpl_3(SwigDirectorOnChildRemove); + if (SwigDerivedClassHasMethod("OnPropertySet", swigMethodTypes4)) + swigDelegate4 = new SwigDelegateViewImpl_4(SwigDirectorOnPropertySet); + if (SwigDerivedClassHasMethod("OnSizeSet", swigMethodTypes5)) + swigDelegate5 = new SwigDelegateViewImpl_5(SwigDirectorOnSizeSet); + if (SwigDerivedClassHasMethod("OnSizeAnimation", swigMethodTypes6)) + swigDelegate6 = new SwigDelegateViewImpl_6(SwigDirectorOnSizeAnimation); + if (SwigDerivedClassHasMethod("OnTouchEvent", swigMethodTypes7)) + swigDelegate7 = new SwigDelegateViewImpl_7(SwigDirectorOnTouchEvent); + if (SwigDerivedClassHasMethod("OnHoverEvent", swigMethodTypes8)) + swigDelegate8 = new SwigDelegateViewImpl_8(SwigDirectorOnHoverEvent); + if (SwigDerivedClassHasMethod("OnKeyEvent", swigMethodTypes9)) + swigDelegate9 = new SwigDelegateViewImpl_9(SwigDirectorOnKeyEvent); + if (SwigDerivedClassHasMethod("OnWheelEvent", swigMethodTypes10)) + swigDelegate10 = new SwigDelegateViewImpl_10(SwigDirectorOnWheelEvent); + if (SwigDerivedClassHasMethod("OnRelayout", swigMethodTypes11)) + swigDelegate11 = new SwigDelegateViewImpl_11(SwigDirectorOnRelayout); + if (SwigDerivedClassHasMethod("OnSetResizePolicy", swigMethodTypes12)) + swigDelegate12 = new SwigDelegateViewImpl_12(SwigDirectorOnSetResizePolicy); + if (SwigDerivedClassHasMethod("GetNaturalSize", swigMethodTypes13)) + swigDelegate13 = new SwigDelegateViewImpl_13(SwigDirectorGetNaturalSize); + if (SwigDerivedClassHasMethod("CalculateChildSize", swigMethodTypes14)) + swigDelegate14 = new SwigDelegateViewImpl_14(SwigDirectorCalculateChildSize); + if (SwigDerivedClassHasMethod("GetHeightForWidth", swigMethodTypes15)) + swigDelegate15 = new SwigDelegateViewImpl_15(SwigDirectorGetHeightForWidth); + if (SwigDerivedClassHasMethod("GetWidthForHeight", swigMethodTypes16)) + swigDelegate16 = new SwigDelegateViewImpl_16(SwigDirectorGetWidthForHeight); + if (SwigDerivedClassHasMethod("RelayoutDependentOnChildren", swigMethodTypes17)) + swigDelegate17 = new SwigDelegateViewImpl_17(SwigDirectorRelayoutDependentOnChildren__SWIG_0); + if (SwigDerivedClassHasMethod("RelayoutDependentOnChildren", swigMethodTypes18)) + swigDelegate18 = new SwigDelegateViewImpl_18(SwigDirectorRelayoutDependentOnChildren__SWIG_1); + if (SwigDerivedClassHasMethod("OnCalculateRelayoutSize", swigMethodTypes19)) + swigDelegate19 = new SwigDelegateViewImpl_19(SwigDirectorOnCalculateRelayoutSize); + if (SwigDerivedClassHasMethod("OnLayoutNegotiated", swigMethodTypes20)) + swigDelegate20 = new SwigDelegateViewImpl_20(SwigDirectorOnLayoutNegotiated); + if (SwigDerivedClassHasMethod("OnInitialize", swigMethodTypes21)) + swigDelegate21 = new SwigDelegateViewImpl_21(SwigDirectorOnInitialize); + if (SwigDerivedClassHasMethod("OnControlChildAdd", swigMethodTypes22)) + swigDelegate22 = new SwigDelegateViewImpl_22(SwigDirectorOnControlChildAdd); + if (SwigDerivedClassHasMethod("OnControlChildRemove", swigMethodTypes23)) + swigDelegate23 = new SwigDelegateViewImpl_23(SwigDirectorOnControlChildRemove); + if (SwigDerivedClassHasMethod("OnStyleChange", swigMethodTypes24)) + swigDelegate24 = new SwigDelegateViewImpl_24(SwigDirectorOnStyleChange); + if (SwigDerivedClassHasMethod("OnAccessibilityActivated", swigMethodTypes25)) + swigDelegate25 = new SwigDelegateViewImpl_25(SwigDirectorOnAccessibilityActivated); + if (SwigDerivedClassHasMethod("OnAccessibilityPan", swigMethodTypes26)) + swigDelegate26 = new SwigDelegateViewImpl_26(SwigDirectorOnAccessibilityPan); + if (SwigDerivedClassHasMethod("OnAccessibilityTouch", swigMethodTypes27)) + swigDelegate27 = new SwigDelegateViewImpl_27(SwigDirectorOnAccessibilityTouch); + if (SwigDerivedClassHasMethod("OnAccessibilityValueChange", swigMethodTypes28)) + swigDelegate28 = new SwigDelegateViewImpl_28(SwigDirectorOnAccessibilityValueChange); + if (SwigDerivedClassHasMethod("OnAccessibilityZoom", swigMethodTypes29)) + swigDelegate29 = new SwigDelegateViewImpl_29(SwigDirectorOnAccessibilityZoom); + if (SwigDerivedClassHasMethod("OnKeyInputFocusGained", swigMethodTypes30)) + swigDelegate30 = new SwigDelegateViewImpl_30(SwigDirectorOnKeyInputFocusGained); + if (SwigDerivedClassHasMethod("OnKeyInputFocusLost", swigMethodTypes31)) + swigDelegate31 = new SwigDelegateViewImpl_31(SwigDirectorOnKeyInputFocusLost); + if (SwigDerivedClassHasMethod("GetNextFocusableView", swigMethodTypes32)) + swigDelegate32 = new SwigDelegateViewImpl_32(SwigDirectorGetNextKeyboardFocusableView); + if (SwigDerivedClassHasMethod("OnFocusChangeCommitted", swigMethodTypes33)) + swigDelegate33 = new SwigDelegateViewImpl_33(SwigDirectorOnKeyboardFocusChangeCommitted); + if (SwigDerivedClassHasMethod("OnKeyboardEnter", swigMethodTypes34)) + swigDelegate34 = new SwigDelegateViewImpl_34(SwigDirectorOnKeyboardEnter); + if (SwigDerivedClassHasMethod("OnPinch", swigMethodTypes35)) + swigDelegate35 = new SwigDelegateViewImpl_35(SwigDirectorOnPinch); + if (SwigDerivedClassHasMethod("OnPan", swigMethodTypes36)) + swigDelegate36 = new SwigDelegateViewImpl_36(SwigDirectorOnPan); + if (SwigDerivedClassHasMethod("OnTap", swigMethodTypes37)) + swigDelegate37 = new SwigDelegateViewImpl_37(SwigDirectorOnTap); + if (SwigDerivedClassHasMethod("OnLongPress", swigMethodTypes38)) + swigDelegate38 = new SwigDelegateViewImpl_38(SwigDirectorOnLongPress); + if (SwigDerivedClassHasMethod("SignalConnected", swigMethodTypes39)) + swigDelegate39 = new SwigDelegateViewImpl_39(SwigDirectorSignalConnected); + if (SwigDerivedClassHasMethod("SignalDisconnected", swigMethodTypes40)) + swigDelegate40 = new SwigDelegateViewImpl_40(SwigDirectorSignalDisconnected); + NDalicPINVOKE.ViewImpl_director_connect(swigCPtr, swigDelegate0, swigDelegate1, swigDelegate2, swigDelegate3, swigDelegate4, swigDelegate5, swigDelegate6, swigDelegate7, swigDelegate8, swigDelegate9, swigDelegate10, swigDelegate11, swigDelegate12, swigDelegate13, swigDelegate14, swigDelegate15, swigDelegate16, swigDelegate17, swigDelegate18, swigDelegate19, swigDelegate20, swigDelegate21, swigDelegate22, swigDelegate23, swigDelegate24, swigDelegate25, swigDelegate26, swigDelegate27, swigDelegate28, swigDelegate29, swigDelegate30, swigDelegate31, swigDelegate32, swigDelegate33, swigDelegate34, swigDelegate35, swigDelegate36, swigDelegate37, swigDelegate38, swigDelegate39, swigDelegate40); + } + + + private bool SwigDerivedClassHasMethod(string methodName, global::System.Type[] methodTypes) + { + global::System.Reflection.MethodInfo methodInfo = this.GetType().GetMethod(methodName, methodTypes); + bool hasDerivedMethod = this.GetType().GetTypeInfo().IsSubclassOf(typeof(ViewImpl)); + + NUILog.Debug("hasDerivedMethod=" + hasDerivedMethod); + + return hasDerivedMethod && (methodInfo != null); + } + + private void SwigDirectorOnStageConnection(int depth) + { + OnStageConnection(depth); + } + + private void SwigDirectorOnStageDisconnection() + { + OnStageDisconnection(); + } + + private void SwigDirectorOnChildAdd(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + + if (view) + { + OnChildAdd(view); + } + } + + private void SwigDirectorOnChildRemove(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + + if (view) + { + OnChildRemove(view); + } + } + + private void SwigDirectorOnPropertySet(int index, global::System.IntPtr propertyValue) + { + OnPropertySet(index, new PropertyValue(propertyValue, true)); + } + + private void SwigDirectorOnSizeSet(global::System.IntPtr targetSize) + { + OnSizeSet(new Vector3(targetSize, false)); + } + + private void SwigDirectorOnSizeAnimation(global::System.IntPtr animation, global::System.IntPtr targetSize) + { + OnSizeAnimation(new Animation(animation, false), new Vector3(targetSize, false)); + } + + private bool SwigDirectorOnTouchEvent(global::System.IntPtr arg0) + { + return OnTouchEvent(new SWIGTYPE_p_Dali__TouchEvent(arg0, false)); + } + + private bool SwigDirectorOnHoverEvent(global::System.IntPtr arg0) + { + return OnHoverEvent(new Hover(arg0, false)); + } + + private bool SwigDirectorOnKeyEvent(global::System.IntPtr arg0) + { + return OnKeyEvent(new Key(arg0, false)); + } + + private bool SwigDirectorOnWheelEvent(global::System.IntPtr arg0) + { + return OnWheelEvent(new Wheel(arg0, false)); + } + + private void SwigDirectorOnRelayout(global::System.IntPtr size, global::System.IntPtr container) + { + OnRelayout(new Vector2(size, false), new RelayoutContainer(container, false)); + } + + private void SwigDirectorOnSetResizePolicy(int policy, int dimension) + { + OnSetResizePolicy((ResizePolicyType)policy, (DimensionType)dimension); + } + + private global::System.IntPtr SwigDirectorGetNaturalSize() + { + return Vector3.getCPtr(GetNaturalSize()).Handle; + } + + private float SwigDirectorCalculateChildSize(global::System.IntPtr child, int dimension) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + return CalculateChildSize(view, (DimensionType)dimension); + } + return 0.0f; + } + + private float SwigDirectorGetHeightForWidth(float width) + { + return GetHeightForWidth(width); + } + + private float SwigDirectorGetWidthForHeight(float height) + { + return GetWidthForHeight(height); + } + + private bool SwigDirectorRelayoutDependentOnChildren__SWIG_0(int dimension) + { + return RelayoutDependentOnChildren((DimensionType)dimension); + } + + private bool SwigDirectorRelayoutDependentOnChildren__SWIG_1() + { + return RelayoutDependentOnChildren(); + } + + private void SwigDirectorOnCalculateRelayoutSize(int dimension) + { + OnCalculateRelayoutSize((DimensionType)dimension); + } + + private void SwigDirectorOnLayoutNegotiated(float size, int dimension) + { + OnLayoutNegotiated(size, (DimensionType)dimension); + } + + private void SwigDirectorOnInitialize() + { + OnInitialize(); + } + + private void SwigDirectorOnControlChildAdd(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnControlChildAdd(view); + } + } + + private void SwigDirectorOnControlChildRemove(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnControlChildRemove(view); + } + } + + private void SwigDirectorOnStyleChange(global::System.IntPtr styleManager, int change) + { + StyleManager stManager = Registry.GetManagedBaseHandleFromNativePtr(styleManager) as StyleManager; + if (stManager) + { + OnStyleChange(stManager, (StyleChangeType)change); + } + } + + private bool SwigDirectorOnAccessibilityActivated() + { + return OnAccessibilityActivated(); + } + + private bool SwigDirectorOnAccessibilityPan(global::System.IntPtr gesture) + { + return OnAccessibilityPan(new PanGesture(gesture, true)); + } + + private bool SwigDirectorOnAccessibilityTouch(global::System.IntPtr touchEvent) + { + return OnAccessibilityTouch(new SWIGTYPE_p_Dali__TouchEvent(touchEvent, false)); + } + + private bool SwigDirectorOnAccessibilityValueChange(bool isIncrease) + { + return OnAccessibilityValueChange(isIncrease); + } + + private bool SwigDirectorOnAccessibilityZoom() + { + return OnAccessibilityZoom(); + } + + private void SwigDirectorOnKeyInputFocusGained() + { + OnKeyInputFocusGained(); + } + + private void SwigDirectorOnKeyInputFocusLost() + { + OnKeyInputFocusLost(); + } + + private global::System.IntPtr SwigDirectorGetNextKeyboardFocusableView(global::System.IntPtr currentFocusedView, int direction, bool loopEnabled) + { + return View.getCPtr(GetNextFocusableView(Registry.GetManagedBaseHandleFromNativePtr(currentFocusedView) as View, (View.FocusDirection)direction, loopEnabled)).Handle; + } + + private void SwigDirectorOnKeyboardFocusChangeCommitted(global::System.IntPtr commitedFocusableView) + { + OnFocusChangeCommitted(Registry.GetManagedBaseHandleFromNativePtr(commitedFocusableView) as View); + } + + private bool SwigDirectorOnKeyboardEnter() + { + return OnKeyboardEnter(); + } + + private void SwigDirectorOnPinch(global::System.IntPtr pinch) + { + OnPinch(new PinchGesture(pinch, false)); + } + + private void SwigDirectorOnPan(global::System.IntPtr pan) + { + OnPan(new PanGesture(pan, false)); + } + + private void SwigDirectorOnTap(global::System.IntPtr tap) + { + OnTap(new TapGesture(tap, false)); + } + + private void SwigDirectorOnLongPress(global::System.IntPtr longPress) + { + OnLongPress(new LongPressGesture(longPress, false)); + } + + private void SwigDirectorSignalConnected(global::System.IntPtr slotObserver, global::System.IntPtr callback) + { + SignalConnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false)); + } + + private void SwigDirectorSignalDisconnected(global::System.IntPtr slotObserver, global::System.IntPtr callback) + { + SignalDisconnected((slotObserver == global::System.IntPtr.Zero) ? null : new SlotObserver(slotObserver, false), (callback == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_Dali__CallbackBase(callback, false)); + } + + public delegate void SwigDelegateViewImpl_0(int depth); + public delegate void SwigDelegateViewImpl_1(); + public delegate void SwigDelegateViewImpl_2(global::System.IntPtr child); + public delegate void SwigDelegateViewImpl_3(global::System.IntPtr child); + public delegate void SwigDelegateViewImpl_4(int index, global::System.IntPtr propertyValue); + public delegate void SwigDelegateViewImpl_5(global::System.IntPtr targetSize); + public delegate void SwigDelegateViewImpl_6(global::System.IntPtr animation, global::System.IntPtr targetSize); + public delegate bool SwigDelegateViewImpl_7(global::System.IntPtr arg0); + public delegate bool SwigDelegateViewImpl_8(global::System.IntPtr arg0); + public delegate bool SwigDelegateViewImpl_9(global::System.IntPtr arg0); + public delegate bool SwigDelegateViewImpl_10(global::System.IntPtr arg0); + public delegate void SwigDelegateViewImpl_11(global::System.IntPtr size, global::System.IntPtr container); + public delegate void SwigDelegateViewImpl_12(int policy, int dimension); + public delegate global::System.IntPtr SwigDelegateViewImpl_13(); + public delegate float SwigDelegateViewImpl_14(global::System.IntPtr child, int dimension); + public delegate float SwigDelegateViewImpl_15(float width); + public delegate float SwigDelegateViewImpl_16(float height); + public delegate bool SwigDelegateViewImpl_17(int dimension); + public delegate bool SwigDelegateViewImpl_18(); + public delegate void SwigDelegateViewImpl_19(int dimension); + public delegate void SwigDelegateViewImpl_20(float size, int dimension); + public delegate void SwigDelegateViewImpl_21(); + public delegate void SwigDelegateViewImpl_22(global::System.IntPtr child); + public delegate void SwigDelegateViewImpl_23(global::System.IntPtr child); + public delegate void SwigDelegateViewImpl_24(global::System.IntPtr styleManager, int change); + public delegate bool SwigDelegateViewImpl_25(); + public delegate bool SwigDelegateViewImpl_26(global::System.IntPtr gesture); + public delegate bool SwigDelegateViewImpl_27(global::System.IntPtr touchEvent); + public delegate bool SwigDelegateViewImpl_28(bool isIncrease); + public delegate bool SwigDelegateViewImpl_29(); + public delegate void SwigDelegateViewImpl_30(); + public delegate void SwigDelegateViewImpl_31(); + public delegate global::System.IntPtr SwigDelegateViewImpl_32(global::System.IntPtr currentFocusedActor, int direction, bool loopEnabled); + public delegate void SwigDelegateViewImpl_33(global::System.IntPtr commitedFocusableActor); + public delegate bool SwigDelegateViewImpl_34(); + public delegate void SwigDelegateViewImpl_35(global::System.IntPtr pinch); + public delegate void SwigDelegateViewImpl_36(global::System.IntPtr pan); + public delegate void SwigDelegateViewImpl_37(global::System.IntPtr tap); + public delegate void SwigDelegateViewImpl_38(global::System.IntPtr longPress); + public delegate void SwigDelegateViewImpl_39(global::System.IntPtr slotObserver, global::System.IntPtr callback); + public delegate void SwigDelegateViewImpl_40(global::System.IntPtr slotObserver, global::System.IntPtr callback); + + private SwigDelegateViewImpl_0 swigDelegate0; + private SwigDelegateViewImpl_1 swigDelegate1; + private SwigDelegateViewImpl_2 swigDelegate2; + private SwigDelegateViewImpl_3 swigDelegate3; + private SwigDelegateViewImpl_4 swigDelegate4; + private SwigDelegateViewImpl_5 swigDelegate5; + private SwigDelegateViewImpl_6 swigDelegate6; + private SwigDelegateViewImpl_7 swigDelegate7; + private SwigDelegateViewImpl_8 swigDelegate8; + private SwigDelegateViewImpl_9 swigDelegate9; + private SwigDelegateViewImpl_10 swigDelegate10; + private SwigDelegateViewImpl_11 swigDelegate11; + private SwigDelegateViewImpl_12 swigDelegate12; + private SwigDelegateViewImpl_13 swigDelegate13; + private SwigDelegateViewImpl_14 swigDelegate14; + private SwigDelegateViewImpl_15 swigDelegate15; + private SwigDelegateViewImpl_16 swigDelegate16; + private SwigDelegateViewImpl_17 swigDelegate17; + private SwigDelegateViewImpl_18 swigDelegate18; + private SwigDelegateViewImpl_19 swigDelegate19; + private SwigDelegateViewImpl_20 swigDelegate20; + private SwigDelegateViewImpl_21 swigDelegate21; + private SwigDelegateViewImpl_22 swigDelegate22; + private SwigDelegateViewImpl_23 swigDelegate23; + private SwigDelegateViewImpl_24 swigDelegate24; + private SwigDelegateViewImpl_25 swigDelegate25; + private SwigDelegateViewImpl_26 swigDelegate26; + private SwigDelegateViewImpl_27 swigDelegate27; + private SwigDelegateViewImpl_28 swigDelegate28; + private SwigDelegateViewImpl_29 swigDelegate29; + private SwigDelegateViewImpl_30 swigDelegate30; + private SwigDelegateViewImpl_31 swigDelegate31; + private SwigDelegateViewImpl_32 swigDelegate32; + private SwigDelegateViewImpl_33 swigDelegate33; + private SwigDelegateViewImpl_34 swigDelegate34; + private SwigDelegateViewImpl_35 swigDelegate35; + private SwigDelegateViewImpl_36 swigDelegate36; + private SwigDelegateViewImpl_37 swigDelegate37; + private SwigDelegateViewImpl_38 swigDelegate38; + private SwigDelegateViewImpl_39 swigDelegate39; + private SwigDelegateViewImpl_40 swigDelegate40; + + private static global::System.Type[] swigMethodTypes0 = new global::System.Type[] { typeof(int) }; + private static global::System.Type[] swigMethodTypes1 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes2 = new global::System.Type[] { typeof(View) }; + private static global::System.Type[] swigMethodTypes3 = new global::System.Type[] { typeof(View) }; + private static global::System.Type[] swigMethodTypes4 = new global::System.Type[] { typeof(int), typeof(PropertyValue) }; + private static global::System.Type[] swigMethodTypes5 = new global::System.Type[] { typeof(Vector3) }; + private static global::System.Type[] swigMethodTypes6 = new global::System.Type[] { typeof(Animation), typeof(Vector3) }; + private static global::System.Type[] swigMethodTypes7 = new global::System.Type[] { typeof(SWIGTYPE_p_Dali__TouchEvent) }; + private static global::System.Type[] swigMethodTypes8 = new global::System.Type[] { typeof(Hover) }; + private static global::System.Type[] swigMethodTypes9 = new global::System.Type[] { typeof(Key) }; + private static global::System.Type[] swigMethodTypes10 = new global::System.Type[] { typeof(Wheel) }; + private static global::System.Type[] swigMethodTypes11 = new global::System.Type[] { typeof(Vector2), typeof(RelayoutContainer) }; + private static global::System.Type[] swigMethodTypes12 = new global::System.Type[] { typeof(ResizePolicyType), typeof(DimensionType) }; + private static global::System.Type[] swigMethodTypes13 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes14 = new global::System.Type[] { typeof(View), typeof(DimensionType) }; + private static global::System.Type[] swigMethodTypes15 = new global::System.Type[] { typeof(float) }; + private static global::System.Type[] swigMethodTypes16 = new global::System.Type[] { typeof(float) }; + private static global::System.Type[] swigMethodTypes17 = new global::System.Type[] { typeof(DimensionType) }; + private static global::System.Type[] swigMethodTypes18 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes19 = new global::System.Type[] { typeof(DimensionType) }; + private static global::System.Type[] swigMethodTypes20 = new global::System.Type[] { typeof(float), typeof(DimensionType) }; + private static global::System.Type[] swigMethodTypes21 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes22 = new global::System.Type[] { typeof(View) }; + private static global::System.Type[] swigMethodTypes23 = new global::System.Type[] { typeof(View) }; + private static global::System.Type[] swigMethodTypes24 = new global::System.Type[] { typeof(StyleManager), typeof(StyleChangeType) }; + private static global::System.Type[] swigMethodTypes25 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes26 = new global::System.Type[] { typeof(PanGesture) }; + private static global::System.Type[] swigMethodTypes27 = new global::System.Type[] { typeof(SWIGTYPE_p_Dali__TouchEvent) }; + private static global::System.Type[] swigMethodTypes28 = new global::System.Type[] { typeof(bool) }; + private static global::System.Type[] swigMethodTypes29 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes30 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes31 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes32 = new global::System.Type[] { typeof(View), typeof(View.FocusDirection), typeof(bool) }; + private static global::System.Type[] swigMethodTypes33 = new global::System.Type[] { typeof(View) }; + private static global::System.Type[] swigMethodTypes34 = new global::System.Type[] { }; + private static global::System.Type[] swigMethodTypes35 = new global::System.Type[] { typeof(PinchGesture) }; + private static global::System.Type[] swigMethodTypes36 = new global::System.Type[] { typeof(PanGesture) }; + private static global::System.Type[] swigMethodTypes37 = new global::System.Type[] { typeof(TapGesture) }; + private static global::System.Type[] swigMethodTypes38 = new global::System.Type[] { typeof(LongPressGesture) }; + private static global::System.Type[] swigMethodTypes39 = new global::System.Type[] { typeof(SlotObserver), typeof(SWIGTYPE_p_Dali__CallbackBase) }; + private static global::System.Type[] swigMethodTypes40 = new global::System.Type[] { typeof(SlotObserver), typeof(SWIGTYPE_p_Dali__CallbackBase) }; + } + +} diff --git a/src/Tizen.NUI/src/internal/ViewMode.cs b/src/Tizen.NUI/src/internal/ViewMode.cs new file mode 100755 index 0000000..7e17e07 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewMode.cs @@ -0,0 +1,28 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal enum ViewMode + { + MONO, + STEREO_HORIZONTAL, + STEREO_VERTICAL, + STEREO_INTERLACED + } + +} diff --git a/src/Tizen.NUI/src/internal/ViewResourceReadySignal.cs b/src/Tizen.NUI/src/internal/ViewResourceReadySignal.cs new file mode 100755 index 0000000..599c106 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewResourceReadySignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + internal class ViewResourceReadySignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ViewResourceReadySignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewResourceReadySignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ViewResourceReadySignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ViewResourceReadySignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.ViewResourceReadySignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ViewResourceReadySignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ViewResourceReadySignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ViewResourceReadySignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg) + { + NDalicPINVOKE.ViewResourceReadySignal_Emit(swigCPtr, View.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ViewResourceReadySignal() : this(NDalicPINVOKE.new_ViewResourceReadySignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ViewSignal.cs b/src/Tizen.NUI/src/internal/ViewSignal.cs new file mode 100755 index 0000000..1226794 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewSignal.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class ViewSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ViewSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ViewSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ActorSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ActorSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ActorSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg) + { + NDalicPINVOKE.ActorSignal_Emit(swigCPtr, View.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ViewSignal() : this(NDalicPINVOKE.new_ActorSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ViewVisibilityChangedSignal.cs b/src/Tizen.NUI/src/internal/ViewVisibilityChangedSignal.cs new file mode 100755 index 0000000..5881954 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewVisibilityChangedSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; +namespace Tizen.NUI +{ + + internal class ViewVisibilityChangedSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ViewVisibilityChangedSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewVisibilityChangedSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ViewVisibilityChangedSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ViewVisibilityChangedSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ViewVisibilityChangedSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ViewVisibilityChangedSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ViewVisibilityChangedSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ViewVisibilityChangedSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(View arg) + { + NDalicPINVOKE.ViewVisibilityChangedSignal_Emit(swigCPtr, View.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ViewVisibilityChangedSignal() : this(NDalicPINVOKE.new_ViewVisibilityChangedSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs new file mode 100755 index 0000000..94e182e --- /dev/null +++ b/src/Tizen.NUI/src/internal/ViewWrapperImpl.cs @@ -0,0 +1,615 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using Tizen.NUI.BaseComponents; +namespace Tizen.NUI +{ + internal sealed class ViewWrapperImpl : ViewImpl + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + public delegate void OnStageConnectionDelegate(int depth); + public delegate void OnStageDisconnectionDelegate(); + public delegate void OnChildAddDelegate(View view); + public delegate void OnChildRemoveDelegate(View view); + public delegate void OnPropertySetDelegate(int index, PropertyValue propertyValue); + public delegate void OnSizeSetDelegate(Vector3 targetSize); + public delegate void OnSizeAnimationDelegate(Animation animation, Vector3 targetSize); + public delegate bool OnTouchDelegate(Touch touch); + public delegate bool OnHoverDelegate(Hover hover); + public delegate bool OnKeyDelegate(Key key); + public delegate bool OnWheelDelegate(Wheel wheel); + public delegate void OnRelayoutDelegate(Vector2 size, RelayoutContainer container); + public delegate void OnSetResizePolicyDelegate(ResizePolicyType policy, DimensionType dimension); + public delegate Size2D GetNaturalSizeDelegate(); + public delegate float CalculateChildSizeDelegate(View child, DimensionType dimension); + public delegate float GetHeightForWidthDelegate(float width); + public delegate float GetWidthForHeightDelegate(float height); + public delegate bool RelayoutDependentOnChildrenDimensionDelegate(DimensionType dimension); + public delegate bool RelayoutDependentOnChildrenDelegate(); + public delegate void OnCalculateRelayoutSizeDelegate(DimensionType dimension); + public delegate void OnLayoutNegotiatedDelegate(float size, DimensionType dimension); + public delegate void OnControlChildAddDelegate(View child); + public delegate void OnControlChildRemoveDelegate(View child); + public delegate void OnStyleChangeDelegate(StyleManager styleManager, StyleChangeType change); + public delegate bool OnAccessibilityActivatedDelegate(); + public delegate bool OnAccessibilityPanDelegate(PanGesture gestures); + public delegate bool OnAccessibilityTouchDelegate(Touch touch); + public delegate bool OnAccessibilityValueChangeDelegate(bool isIncrease); + public delegate bool OnAccessibilityZoomDelegate(); + public delegate void OnFocusGainedDelegate(); + public delegate void OnFocusLostDelegate(); + public delegate View GetNextFocusableViewDelegate(View currentFocusedView, View.FocusDirection direction, bool loopEnabled); + public delegate void OnFocusChangeCommittedDelegate(View commitedFocusableView); + public delegate bool OnKeyboardEnterDelegate(); + public delegate void OnPinchDelegate(PinchGesture pinch); + public delegate void OnPanDelegate(PanGesture pan); + public delegate void OnTapDelegate(TapGesture tap); + public delegate void OnLongPressDelegate(LongPressGesture longPress); + + public OnStageConnectionDelegate OnStageConnection; + public OnStageDisconnectionDelegate OnStageDisconnection; + public OnChildAddDelegate OnChildAdd; + public OnChildRemoveDelegate OnChildRemove; + public OnPropertySetDelegate OnPropertySet; + public OnSizeSetDelegate OnSizeSet; + public OnSizeAnimationDelegate OnSizeAnimation; + public OnTouchDelegate OnTouch; + public OnHoverDelegate OnHover; + public OnKeyDelegate OnKey; + public OnWheelDelegate OnWheel; + public OnRelayoutDelegate OnRelayout; + public OnSetResizePolicyDelegate OnSetResizePolicy; + public GetNaturalSizeDelegate GetNaturalSize; + public CalculateChildSizeDelegate CalculateChildSize; + public GetHeightForWidthDelegate GetHeightForWidth; + public GetWidthForHeightDelegate GetWidthForHeight; + public RelayoutDependentOnChildrenDimensionDelegate RelayoutDependentOnChildrenDimension; + public RelayoutDependentOnChildrenDelegate RelayoutDependentOnChildren; + public OnCalculateRelayoutSizeDelegate OnCalculateRelayoutSize; + public OnLayoutNegotiatedDelegate OnLayoutNegotiated; + public OnControlChildAddDelegate OnControlChildAdd; + public OnControlChildRemoveDelegate OnControlChildRemove; + public OnStyleChangeDelegate OnStyleChange; + public OnAccessibilityActivatedDelegate OnAccessibilityActivated; + public OnAccessibilityPanDelegate OnAccessibilityPan; + public OnAccessibilityTouchDelegate OnAccessibilityTouch; + public OnAccessibilityValueChangeDelegate OnAccessibilityValueChange; + public OnAccessibilityZoomDelegate OnAccessibilityZoom; + public OnFocusGainedDelegate OnFocusGained; + public OnFocusLostDelegate OnFocusLost; + public GetNextFocusableViewDelegate GetNextFocusableView; + public OnFocusChangeCommittedDelegate OnFocusChangeCommitted; + public OnKeyboardEnterDelegate OnKeyboardEnter; + public OnPinchDelegate OnPinch; + public OnPanDelegate OnPan; + public OnTapDelegate OnTap; + public OnLongPressDelegate OnLongPress; + + internal ViewWrapperImpl(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ViewWrapperImpl_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewWrapperImpl obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ViewWrapperImpl(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public ViewWrapperImpl(CustomViewBehaviour behaviourFlags) : this(NDalicManualPINVOKE.new_ViewWrapperImpl((int)behaviourFlags), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + DirectorConnect(); + } + + public static ViewWrapper New(string typeName, ViewWrapperImpl viewWrapper) + { + ViewWrapper ret = new ViewWrapper(NDalicManualPINVOKE.ViewWrapperImpl_New(typeName, ViewWrapperImpl.getCPtr(viewWrapper)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RelayoutRequest() + { + NDalicManualPINVOKE.ViewWrapperImpl_RelayoutRequest(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetHeightForWidthBase(float width) + { + float ret = NDalicManualPINVOKE.ViewWrapperImpl_GetHeightForWidthBase(swigCPtr, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetWidthForHeightBase(float height) + { + float ret = NDalicManualPINVOKE.ViewWrapperImpl_GetWidthForHeightBase(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float CalculateChildSizeBase(View child, DimensionType dimension) + { + float ret = NDalicManualPINVOKE.ViewWrapperImpl_CalculateChildSizeBase(swigCPtr, View.getCPtr(child), (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool RelayoutDependentOnChildrenBase(DimensionType dimension) + { + bool ret = NDalicManualPINVOKE.ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_0(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool RelayoutDependentOnChildrenBase() + { + bool ret = NDalicManualPINVOKE.ViewWrapperImpl_RelayoutDependentOnChildrenBase__SWIG_1(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RegisterVisual(int index, VisualBase visual) + { + NDalicManualPINVOKE.ViewWrapperImpl_RegisterVisual__SWIG_0(swigCPtr, index, VisualBase.getCPtr(visual)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RegisterVisual(int index, VisualBase visual, bool enabled) + { + NDalicManualPINVOKE.ViewWrapperImpl_RegisterVisual__SWIG_1(swigCPtr, index, VisualBase.getCPtr(visual), enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void UnregisterVisual(int index) + { + NDalicManualPINVOKE.ViewWrapperImpl_UnregisterVisual(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public VisualBase GetVisual(int index) + { + System.IntPtr cPtr = NDalicManualPINVOKE.ViewWrapperImpl_GetVisual(swigCPtr, index); + VisualBase ret = Registry.GetManagedBaseHandleFromRefObject(cPtr) as VisualBase; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void EnableVisual(int index, bool enable) + { + NDalicManualPINVOKE.ViewWrapperImpl_EnableVisual(swigCPtr, index, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool IsVisualEnabled(int index) + { + bool ret = NDalicManualPINVOKE.ViewWrapperImpl_IsVisualEnabled(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Animation CreateTransition(TransitionData transitionData) + { + Animation ret = new Animation(NDalicManualPINVOKE.ViewWrapperImpl_CreateTransition(swigCPtr, TransitionData.getCPtr(transitionData)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void EmitFocusSignal(bool focusGained) + { + NDalicManualPINVOKE.ViewWrapperImpl_EmitKeyInputFocusSignal(swigCPtr, focusGained); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ApplyThemeStyle() + { + NDalicManualPINVOKE.ViewWrapperImpl_ApplyThemeStyle(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private void DirectorConnect() + { + Delegate0 = new DelegateViewWrapperImpl_0(DirectorOnStageConnection); + Delegate1 = new DelegateViewWrapperImpl_1(DirectorOnStageDisconnection); + Delegate2 = new DelegateViewWrapperImpl_2(DirectorOnChildAdd); + Delegate3 = new DelegateViewWrapperImpl_3(DirectorOnChildRemove); + Delegate4 = new DelegateViewWrapperImpl_4(DirectorOnPropertySet); + Delegate5 = new DelegateViewWrapperImpl_5(DirectorOnSizeSet); + Delegate6 = new DelegateViewWrapperImpl_6(DirectorOnSizeAnimation); + Delegate7 = new DelegateViewWrapperImpl_7(DirectorOnTouch); + Delegate8 = new DelegateViewWrapperImpl_8(DirectorOnHover); + Delegate9 = new DelegateViewWrapperImpl_9(DirectorOnKey); + Delegate10 = new DelegateViewWrapperImpl_10(DirectorOnWheel); + Delegate11 = new DelegateViewWrapperImpl_11(DirectorOnRelayout); + Delegate12 = new DelegateViewWrapperImpl_12(DirectorOnSetResizePolicy); + Delegate13 = new DelegateViewWrapperImpl_13(DirectorGetNaturalSize); + Delegate14 = new DelegateViewWrapperImpl_14(DirectorCalculateChildSize); + Delegate15 = new DelegateViewWrapperImpl_15(DirectorGetHeightForWidth); + Delegate16 = new DelegateViewWrapperImpl_16(DirectorGetWidthForHeight); + Delegate17 = new DelegateViewWrapperImpl_17(DirectorRelayoutDependentOnChildren__SWIG_0); + Delegate18 = new DelegateViewWrapperImpl_18(DirectorRelayoutDependentOnChildren__SWIG_1); + Delegate19 = new DelegateViewWrapperImpl_19(DirectorOnCalculateRelayoutSize); + Delegate20 = new DelegateViewWrapperImpl_20(DirectorOnLayoutNegotiated); + Delegate21 = new DelegateViewWrapperImpl_21(DirectorOnInitialize); + Delegate22 = new DelegateViewWrapperImpl_22(DirectorOnControlChildAdd); + Delegate23 = new DelegateViewWrapperImpl_23(DirectorOnControlChildRemove); + Delegate24 = new DelegateViewWrapperImpl_24(DirectorOnStyleChange); + Delegate25 = new DelegateViewWrapperImpl_25(DirectorOnAccessibilityActivated); + Delegate26 = new DelegateViewWrapperImpl_26(DirectorOnAccessibilityPan); + Delegate27 = new DelegateViewWrapperImpl_27(DirectorOnAccessibilityTouch); + Delegate28 = new DelegateViewWrapperImpl_28(DirectorOnAccessibilityValueChange); + Delegate29 = new DelegateViewWrapperImpl_29(DirectorOnAccessibilityZoom); + Delegate30 = new DelegateViewWrapperImpl_30(DirectorOnFocusGained); + Delegate31 = new DelegateViewWrapperImpl_31(DirectorOnFocusLost); + Delegate32 = new DelegateViewWrapperImpl_32(DirectorGetNextFocusableActor); + Delegate33 = new DelegateViewWrapperImpl_33(DirectorOnFocusChangeCommitted); + Delegate34 = new DelegateViewWrapperImpl_34(DirectorOnKeyboardEnter); + Delegate35 = new DelegateViewWrapperImpl_35(DirectorOnPinch); + Delegate36 = new DelegateViewWrapperImpl_36(DirectorOnPan); + Delegate37 = new DelegateViewWrapperImpl_37(DirectorOnTap); + Delegate38 = new DelegateViewWrapperImpl_38(DirectorOnLongPress); + NDalicManualPINVOKE.ViewWrapperImpl_director_connect(swigCPtr, Delegate0, Delegate1, Delegate2, Delegate3, Delegate4, Delegate5, Delegate6, Delegate7, Delegate8, Delegate9, Delegate10, Delegate11, Delegate12, Delegate13, Delegate14, Delegate15, Delegate16, Delegate17, Delegate18, Delegate19, Delegate20, Delegate21, Delegate22, Delegate23, Delegate24, Delegate25, Delegate26, Delegate27, Delegate28, Delegate29, Delegate30, Delegate31, Delegate32, Delegate33, Delegate34, Delegate35, Delegate36, Delegate37, Delegate38, null, null); + } + + private void DirectorOnStageConnection(int depth) + { + OnStageConnection(depth); + } + + private void DirectorOnStageDisconnection() + { + OnStageDisconnection(); + } + + private void DirectorOnChildAdd(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnChildAdd(view); + } + } + + private void DirectorOnChildRemove(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnChildRemove(view); + } + } + + private void DirectorOnPropertySet(int index, global::System.IntPtr propertyValue) + { + if (OnPropertySet != null) + { + OnPropertySet(index, new PropertyValue(propertyValue, true)); + } + } + + private void DirectorOnSizeSet(global::System.IntPtr targetSize) + { + OnSizeSet(new Vector3(targetSize, false)); + } + + private void DirectorOnSizeAnimation(global::System.IntPtr animation, global::System.IntPtr targetSize) + { + OnSizeAnimation(new Animation(animation, false), new Vector3(targetSize, false)); + } + + private bool DirectorOnTouch(global::System.IntPtr arg0) + { + return OnTouch(new Touch(arg0, false)); + } + + private bool DirectorOnHover(global::System.IntPtr arg0) + { + return OnHover(new Hover(arg0, false)); + } + + private bool DirectorOnKey(global::System.IntPtr arg0) + { + return OnKey(new Key(arg0, false)); + } + + private bool DirectorOnWheel(global::System.IntPtr arg0) + { + return OnWheel(new Wheel(arg0, false)); + } + + private void DirectorOnRelayout(global::System.IntPtr size, global::System.IntPtr container) + { + OnRelayout(new Vector2(size, false), new RelayoutContainer(container, false)); + } + + private void DirectorOnSetResizePolicy(int policy, int dimension) + { + OnSetResizePolicy((ResizePolicyType)policy, (DimensionType)dimension); + } + + private global::System.IntPtr DirectorGetNaturalSize() + { + return Size2D.getCPtr(GetNaturalSize()).Handle; + } + + private float DirectorCalculateChildSize(global::System.IntPtr child, int dimension) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + return CalculateChildSize(view, (DimensionType)dimension); + } + return 0.0f; + } + + private float DirectorGetHeightForWidth(float width) + { + return GetHeightForWidth(width); + } + + private float DirectorGetWidthForHeight(float height) + { + return GetWidthForHeight(height); + } + + private bool DirectorRelayoutDependentOnChildren__SWIG_0(int dimension) + { + return RelayoutDependentOnChildrenDimension((DimensionType)dimension); + } + + private bool DirectorRelayoutDependentOnChildren__SWIG_1() + { + return RelayoutDependentOnChildren(); + } + + private void DirectorOnCalculateRelayoutSize(int dimension) + { + OnCalculateRelayoutSize((DimensionType)dimension); + } + + private void DirectorOnLayoutNegotiated(float size, int dimension) + { + OnLayoutNegotiated(size, (DimensionType)dimension); + } + + private void DirectorOnInitialize() + { + } + + private void DirectorOnControlChildAdd(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnControlChildAdd(view); + } + } + + private void DirectorOnControlChildRemove(global::System.IntPtr child) + { + View view = Registry.GetManagedBaseHandleFromNativePtr(child) as View; + if (view) + { + OnControlChildRemove(view); + } + } + + private void DirectorOnStyleChange(global::System.IntPtr styleManager, int change) + { + if (OnStyleChange != null) + { + OnStyleChange(new StyleManager(styleManager, false), (StyleChangeType)change); + } + } + + private bool DirectorOnAccessibilityActivated() + { + return OnAccessibilityActivated(); + } + + private bool DirectorOnAccessibilityPan(global::System.IntPtr gesture) + { + return OnAccessibilityPan(new PanGesture(gesture, false)); + } + + private bool DirectorOnAccessibilityTouch(global::System.IntPtr touch) + { + return OnAccessibilityTouch(new Touch(touch, false)); + } + + private bool DirectorOnAccessibilityValueChange(bool isIncrease) + { + return OnAccessibilityValueChange(isIncrease); + } + + private bool DirectorOnAccessibilityZoom() + { + return OnAccessibilityZoom(); + } + + private void DirectorOnFocusGained() + { + OnFocusGained(); + } + + private void DirectorOnFocusLost() + { + OnFocusLost(); + } + + private global::System.IntPtr DirectorGetNextFocusableActor(global::System.IntPtr currentFocusedActor, int direction, bool loopEnabled) + { + View view = GetNextFocusableView(Registry.GetManagedBaseHandleFromNativePtr(currentFocusedActor) as View, (View.FocusDirection)direction, loopEnabled); + if (view) + { + return View.getCPtr(view).Handle; + } + else + { + return currentFocusedActor; + } + } + + private void DirectorOnFocusChangeCommitted(global::System.IntPtr commitedFocusableView) + { + OnFocusChangeCommitted(Registry.GetManagedBaseHandleFromNativePtr(commitedFocusableView) as View); + } + + private bool DirectorOnKeyboardEnter() + { + return OnKeyboardEnter(); + } + + private void DirectorOnPinch(global::System.IntPtr pinch) + { + OnPinch(new PinchGesture(pinch, false)); + } + + private void DirectorOnPan(global::System.IntPtr pan) + { + OnPan(new PanGesture(pan, false)); + } + + private void DirectorOnTap(global::System.IntPtr tap) + { + OnTap(new TapGesture(tap, false)); + } + + private void DirectorOnLongPress(global::System.IntPtr longPress) + { + OnLongPress(new LongPressGesture(longPress, false)); + } + + public delegate void DelegateViewWrapperImpl_0(int depth); + public delegate void DelegateViewWrapperImpl_1(); + public delegate void DelegateViewWrapperImpl_2(global::System.IntPtr child); + public delegate void DelegateViewWrapperImpl_3(global::System.IntPtr child); + public delegate void DelegateViewWrapperImpl_4(int index, global::System.IntPtr propertyValue); + public delegate void DelegateViewWrapperImpl_5(global::System.IntPtr targetSize); + public delegate void DelegateViewWrapperImpl_6(global::System.IntPtr animation, global::System.IntPtr targetSize); + public delegate bool DelegateViewWrapperImpl_7(global::System.IntPtr arg0); + public delegate bool DelegateViewWrapperImpl_8(global::System.IntPtr arg0); + public delegate bool DelegateViewWrapperImpl_9(global::System.IntPtr arg0); + public delegate bool DelegateViewWrapperImpl_10(global::System.IntPtr arg0); + public delegate void DelegateViewWrapperImpl_11(global::System.IntPtr size, global::System.IntPtr container); + public delegate void DelegateViewWrapperImpl_12(int policy, int dimension); + public delegate global::System.IntPtr DelegateViewWrapperImpl_13(); + public delegate float DelegateViewWrapperImpl_14(global::System.IntPtr child, int dimension); + public delegate float DelegateViewWrapperImpl_15(float width); + public delegate float DelegateViewWrapperImpl_16(float height); + public delegate bool DelegateViewWrapperImpl_17(int dimension); + public delegate bool DelegateViewWrapperImpl_18(); + public delegate void DelegateViewWrapperImpl_19(int dimension); + public delegate void DelegateViewWrapperImpl_20(float size, int dimension); + public delegate void DelegateViewWrapperImpl_21(); + public delegate void DelegateViewWrapperImpl_22(global::System.IntPtr child); + public delegate void DelegateViewWrapperImpl_23(global::System.IntPtr child); + public delegate void DelegateViewWrapperImpl_24(global::System.IntPtr styleManager, int change); + public delegate bool DelegateViewWrapperImpl_25(); + public delegate bool DelegateViewWrapperImpl_26(global::System.IntPtr gesture); + public delegate bool DelegateViewWrapperImpl_27(global::System.IntPtr touch); + public delegate bool DelegateViewWrapperImpl_28(bool isIncrease); + public delegate bool DelegateViewWrapperImpl_29(); + public delegate void DelegateViewWrapperImpl_30(); + public delegate void DelegateViewWrapperImpl_31(); + public delegate global::System.IntPtr DelegateViewWrapperImpl_32(global::System.IntPtr currentFocusedActor, int direction, bool loopEnabled); + public delegate void DelegateViewWrapperImpl_33(global::System.IntPtr commitedFocusableActor); + public delegate bool DelegateViewWrapperImpl_34(); + public delegate void DelegateViewWrapperImpl_35(global::System.IntPtr pinch); + public delegate void DelegateViewWrapperImpl_36(global::System.IntPtr pan); + public delegate void DelegateViewWrapperImpl_37(global::System.IntPtr tap); + public delegate void DelegateViewWrapperImpl_38(global::System.IntPtr longPress); + public delegate void DelegateViewWrapperImpl_39(global::System.IntPtr slotObserver, global::System.IntPtr callback); + public delegate void DelegateViewWrapperImpl_40(global::System.IntPtr slotObserver, global::System.IntPtr callback); + + private DelegateViewWrapperImpl_0 Delegate0; + private DelegateViewWrapperImpl_1 Delegate1; + private DelegateViewWrapperImpl_2 Delegate2; + private DelegateViewWrapperImpl_3 Delegate3; + private DelegateViewWrapperImpl_4 Delegate4; + private DelegateViewWrapperImpl_5 Delegate5; + private DelegateViewWrapperImpl_6 Delegate6; + private DelegateViewWrapperImpl_7 Delegate7; + private DelegateViewWrapperImpl_8 Delegate8; + private DelegateViewWrapperImpl_9 Delegate9; + private DelegateViewWrapperImpl_10 Delegate10; + private DelegateViewWrapperImpl_11 Delegate11; + private DelegateViewWrapperImpl_12 Delegate12; + private DelegateViewWrapperImpl_13 Delegate13; + private DelegateViewWrapperImpl_14 Delegate14; + private DelegateViewWrapperImpl_15 Delegate15; + private DelegateViewWrapperImpl_16 Delegate16; + private DelegateViewWrapperImpl_17 Delegate17; + private DelegateViewWrapperImpl_18 Delegate18; + private DelegateViewWrapperImpl_19 Delegate19; + private DelegateViewWrapperImpl_20 Delegate20; + private DelegateViewWrapperImpl_21 Delegate21; + private DelegateViewWrapperImpl_22 Delegate22; + private DelegateViewWrapperImpl_23 Delegate23; + private DelegateViewWrapperImpl_24 Delegate24; + private DelegateViewWrapperImpl_25 Delegate25; + private DelegateViewWrapperImpl_26 Delegate26; + private DelegateViewWrapperImpl_27 Delegate27; + private DelegateViewWrapperImpl_28 Delegate28; + private DelegateViewWrapperImpl_29 Delegate29; + private DelegateViewWrapperImpl_30 Delegate30; + private DelegateViewWrapperImpl_31 Delegate31; + private DelegateViewWrapperImpl_32 Delegate32; + private DelegateViewWrapperImpl_33 Delegate33; + private DelegateViewWrapperImpl_34 Delegate34; + private DelegateViewWrapperImpl_35 Delegate35; + private DelegateViewWrapperImpl_36 Delegate36; + private DelegateViewWrapperImpl_37 Delegate37; + private DelegateViewWrapperImpl_38 Delegate38; + private DelegateViewWrapperImpl_39 Delegate39; + private DelegateViewWrapperImpl_40 Delegate40; + + public static readonly int VIEW_BEHAVIOUR_FLAG_COUNT = NDalicManualPINVOKE.ViewWrapperImpl_CONTROL_BEHAVIOUR_FLAG_COUNT_get(); + } +} diff --git a/src/Tizen.NUI/src/internal/VoidSignal.cs b/src/Tizen.NUI/src/internal/VoidSignal.cs new file mode 100755 index 0000000..bf6251a --- /dev/null +++ b/src/Tizen.NUI/src/internal/VoidSignal.cs @@ -0,0 +1,154 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class VoidSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal VoidSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VoidSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~VoidSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VoidSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public VoidSignal() : this(NDalicPINVOKE.new_VoidSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.VoidSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.VoidSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.VoidSignal_Connect__SWIG_0(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.VoidSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + internal void Connect(ConnectionTrackerInterface connectionTracker, SWIGTYPE_p_Dali__FunctorDelegate arg1) + { + NDalicPINVOKE.VoidSignal_Connect__SWIG_4(swigCPtr, ConnectionTrackerInterface.getCPtr(connectionTracker), SWIGTYPE_p_Dali__FunctorDelegate.getCPtr(arg1)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Emit() + { + NDalicPINVOKE.VoidSignal_Emit(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WeakEventHandler.cs b/src/Tizen.NUI/src/internal/WeakEventHandler.cs new file mode 100755 index 0000000..b273b60 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WeakEventHandler.cs @@ -0,0 +1,32 @@ +using System; +using System.Reflection; + +namespace Tizen.NUI +{ + internal sealed class WeakEventHandler where TEventArgs : EventArgs + { + private readonly WeakReference _targetReference; + private readonly MethodInfo _method; + + public WeakEventHandler(EventHandler callback) + { + _method = callback.GetMethodInfo(); + _targetReference = new WeakReference(callback.Target, true); + } + + public void Handler(object sender, TEventArgs e) + { + var target = _targetReference.Target; + if (target != null) + { + var callback = (Action)_method.CreateDelegate(typeof(Action), target); + if (callback != null) + { + callback(sender, e); + } + } + } +} + +} + diff --git a/src/Tizen.NUI/src/internal/WheelSignal.cs b/src/Tizen.NUI/src/internal/WheelSignal.cs new file mode 100755 index 0000000..51bd0d1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WheelSignal.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + internal class WheelSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WheelSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WheelSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~WheelSignal() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ActorWheelSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public bool Empty() + { + bool ret = NDalicPINVOKE.ActorWheelSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.ActorWheelSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorWheelSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.ActorWheelSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public bool Emit(View arg1, Wheel arg2) + { + bool ret = NDalicPINVOKE.ActorWheelSignal_Emit(swigCPtr, View.getCPtr(arg1), Wheel.getCPtr(arg2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public WheelSignal() : this(NDalicPINVOKE.new_ActorWheelSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WidgetViewSignal.cs b/src/Tizen.NUI/src/internal/WidgetViewSignal.cs new file mode 100755 index 0000000..bab8ae1 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WidgetViewSignal.cs @@ -0,0 +1,97 @@ +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + public class WidgetViewSignal : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WidgetViewSignal(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetViewSignal obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + ~WidgetViewSignal() + { + Dispose(); + } + + public virtual void Dispose() + { + lock (this) + { + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetViewSignal(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + global::System.GC.SuppressFinalize(this); + } + } + + public bool Empty() + { + bool ret = NDalicManualPINVOKE.WidgetViewSignal_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicManualPINVOKE.WidgetViewSignal_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetViewSignal_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicManualPINVOKE.WidgetViewSignal_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(WidgetView arg) + { + NDalicManualPINVOKE.WidgetViewSignal_Emit(swigCPtr, WidgetView.getCPtr(arg)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WidgetViewSignal() : this(NDalicManualPINVOKE.new_WidgetViewSignal(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/WindowFocusSignalType.cs b/src/Tizen.NUI/src/internal/WindowFocusSignalType.cs new file mode 100755 index 0000000..9ac3a13 --- /dev/null +++ b/src/Tizen.NUI/src/internal/WindowFocusSignalType.cs @@ -0,0 +1,148 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class WindowFocusSignalType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal WindowFocusSignalType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WindowFocusSignalType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~WindowFocusSignalType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_WindowFocusSignalType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public bool Empty() + { + bool ret = NDalicPINVOKE.WindowFocusSignalType_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetConnectionCount() + { + uint ret = NDalicPINVOKE.WindowFocusSignalType_GetConnectionCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.WindowFocusSignalType_Connect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + NDalicPINVOKE.WindowFocusSignalType_Disconnect(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + public void Emit(bool arg) + { + NDalicPINVOKE.WindowFocusSignalType_Emit(swigCPtr, arg); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public WindowFocusSignalType() : this(NDalicPINVOKE.new_WindowFocusSignalType(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs b/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs new file mode 100755 index 0000000..be7d0dd --- /dev/null +++ b/src/Tizen.NUI/src/internal/dotnetcore/AddedException.cs @@ -0,0 +1,54 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace System +{ + public class ApplicationException : Exception + { + public ApplicationException() + { + new global::System.ApplicationException(); + } + + public ApplicationException(string message) + { + new global::System.ApplicationException(message); + } + + public ApplicationException(string message, Exception innerException) + { + new global::System.ApplicationException(message, innerException); + } + } + + public class SystemException : Exception + { + public SystemException() + { + new global::System.SystemException(); + } + + public SystemException(string message) + { + new global::System.SystemException(message); + } + + public SystemException(string message, Exception innerException) + { + new global::System.SystemException(message, innerException); + } + } +} diff --git a/src/Tizen.NUI/src/internal/dotnetcore/HandleRef.cs b/src/Tizen.NUI/src/internal/dotnetcore/HandleRef.cs new file mode 100755 index 0000000..db34d4a --- /dev/null +++ b/src/Tizen.NUI/src/internal/dotnetcore/HandleRef.cs @@ -0,0 +1,55 @@ +// ==++== +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// ==--== +namespace System.Runtime.InteropServices +{ + + using System; + + [System.Runtime.InteropServices.ComVisible(true)] + public struct HandleRef + { + + // ! Do not add or rearrange fields as the EE depends on this layout. + //------------------------------------------------------------------ + internal Object m_wrapper; + internal IntPtr m_handle; + //------------------------------------------------------------------ + + + public HandleRef(Object wrapper, IntPtr handle) + { + m_wrapper = wrapper; + m_handle = handle; + } + + public Object Wrapper + { + get + { + return m_wrapper; + } + } + + public IntPtr Handle + { + get + { + return m_handle; + } + } + + + public static explicit operator IntPtr(HandleRef value) + { + return value.m_handle; + } + + public static IntPtr ToIntPtr(HandleRef value) + { + return value.m_handle; + } + } +} diff --git a/src/Tizen.NUI/src/internal/doublep.cs b/src/Tizen.NUI/src/internal/doublep.cs new file mode 100755 index 0000000..903a32c --- /dev/null +++ b/src/Tizen.NUI/src/internal/doublep.cs @@ -0,0 +1,138 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class doublep : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal doublep(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(doublep obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~doublep() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_doublep(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public doublep() : this(NDalicPINVOKE.new_doublep(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void assign(double value) + { + NDalicPINVOKE.doublep_assign(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public double value() + { + double ret = NDalicPINVOKE.doublep_value(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_double cast() + { + global::System.IntPtr cPtr = NDalicPINVOKE.doublep_cast(swigCPtr); + SWIGTYPE_p_double ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_double(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static doublep frompointer(SWIGTYPE_p_double t) + { + global::System.IntPtr cPtr = NDalicPINVOKE.doublep_frompointer(SWIGTYPE_p_double.getCPtr(t)); + doublep ret = (cPtr == global::System.IntPtr.Zero) ? null : new doublep(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/floatp.cs b/src/Tizen.NUI/src/internal/floatp.cs new file mode 100755 index 0000000..ec184fc --- /dev/null +++ b/src/Tizen.NUI/src/internal/floatp.cs @@ -0,0 +1,138 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class floatp : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal floatp(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(floatp obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~floatp() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_floatp(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public floatp() : this(NDalicPINVOKE.new_floatp(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void assign(float value) + { + NDalicPINVOKE.floatp_assign(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float value() + { + float ret = NDalicPINVOKE.floatp_value(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_float cast() + { + global::System.IntPtr cPtr = NDalicPINVOKE.floatp_cast(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static floatp frompointer(SWIGTYPE_p_float t) + { + global::System.IntPtr cPtr = NDalicPINVOKE.floatp_frompointer(SWIGTYPE_p_float.getCPtr(t)); + floatp ret = (cPtr == global::System.IntPtr.Zero) ? null : new floatp(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/intp.cs b/src/Tizen.NUI/src/internal/intp.cs new file mode 100755 index 0000000..7b745f6 --- /dev/null +++ b/src/Tizen.NUI/src/internal/intp.cs @@ -0,0 +1,138 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class intp : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal intp(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(intp obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~intp() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_intp(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public intp() : this(NDalicPINVOKE.new_intp(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void assign(int value) + { + NDalicPINVOKE.intp_assign(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int value() + { + int ret = NDalicPINVOKE.intp_value(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_int cast() + { + global::System.IntPtr cPtr = NDalicPINVOKE.intp_cast(swigCPtr); + SWIGTYPE_p_int ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_int(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public static intp frompointer(SWIGTYPE_p_int t) + { + global::System.IntPtr cPtr = NDalicPINVOKE.intp_frompointer(SWIGTYPE_p_int.getCPtr(t)); + intp ret = (cPtr == global::System.IntPtr.Zero) ? null : new intp(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/uintp.cs b/src/Tizen.NUI/src/internal/uintp.cs new file mode 100755 index 0000000..43feb91 --- /dev/null +++ b/src/Tizen.NUI/src/internal/uintp.cs @@ -0,0 +1,139 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class uintp : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal uintp(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(uintp obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~uintp() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_uintp(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + public uintp() : this(NDalicPINVOKE.new_uintp(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void assign(uint value) + { + NDalicPINVOKE.uintp_assign(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint value() + { + uint ret = NDalicPINVOKE.uintp_value(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_unsigned_int cast() + { + global::System.IntPtr cPtr = NDalicPINVOKE.uintp_cast(swigCPtr); + SWIGTYPE_p_unsigned_int ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_int(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static uintp frompointer(SWIGTYPE_p_unsigned_int t) + { + global::System.IntPtr cPtr = NDalicPINVOKE.uintp_frompointer(SWIGTYPE_p_unsigned_int.getCPtr(t)); + uintp ret = (cPtr == global::System.IntPtr.Zero) ? null : new uintp(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/internal/ushortp.cs b/src/Tizen.NUI/src/internal/ushortp.cs new file mode 100755 index 0000000..b0ed447 --- /dev/null +++ b/src/Tizen.NUI/src/internal/ushortp.cs @@ -0,0 +1,138 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + internal class ushortp : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ushortp(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ushortp obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ushortp() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ushortp(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public ushortp() : this(NDalicPINVOKE.new_ushortp(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void assign(ushort value) + { + NDalicPINVOKE.ushortp_assign(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public ushort value() + { + ushort ret = NDalicPINVOKE.ushortp_value(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public SWIGTYPE_p_unsigned_short cast() + { + global::System.IntPtr cPtr = NDalicPINVOKE.ushortp_cast(swigCPtr); + SWIGTYPE_p_unsigned_short ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_short(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static ushortp frompointer(SWIGTYPE_p_unsigned_short t) + { + global::System.IntPtr cPtr = NDalicPINVOKE.ushortp_frompointer(SWIGTYPE_p_unsigned_short.getCPtr(t)); + ushortp ret = (cPtr == global::System.IntPtr.Zero) ? null : new ushortp(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Adaptor.cs b/src/Tizen.NUI/src/public/Adaptor.cs new file mode 100755 index 0000000..bffcd33 --- /dev/null +++ b/src/Tizen.NUI/src/public/Adaptor.cs @@ -0,0 +1,518 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + /// + /// An Adaptor object is used to initialize and control how Dali runs. + /// + /// It provides a lifecycle interface that allows the application + /// writer to provide their own main loop and other platform related + /// features. + /// + /// The Adaptor class provides a means for initialising the resources required by the Dali::Core. + /// + /// When dealing with platform events, the application writer MUST ensure that Dali is called in a + /// thread-safe manner. + /// + /// As soon as the Adaptor class is created and started, the application writer can initialise their + /// View objects straight away or as required by the main loop they intend to use (there is no + /// need to wait for an initialise signal as per the Tizen.NUI.Application class). + /// + /// + public class Adaptor : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Adaptor(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Adaptor obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Adaptor() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_Adaptor(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + internal static Adaptor GetAdaptorFromPtr(global::System.IntPtr cPtr) + { + Adaptor ret = new Adaptor(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Window window) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_0(Window.getCPtr(window)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Window window, SWIGTYPE_p_Configuration__ContextLoss configuration) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_1(Window.getCPtr(window), SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_2(Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Adaptor New(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface, SWIGTYPE_p_Configuration__ContextLoss configuration) + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_New__SWIG_3(Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface), SWIGTYPE_p_Configuration__ContextLoss.getCPtr(configuration)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Starts the Adaptor. + /// + internal void Start() + { + NDalicManualPINVOKE.Adaptor_Start(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Pauses the Adaptor. + /// + internal void Pause() + { + NDalicManualPINVOKE.Adaptor_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resumes the Adaptor, if previously paused. + /// + /// If the adaptor is not paused, this does not do anything. + internal void Resume() + { + NDalicManualPINVOKE.Adaptor_Resume(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Stops the Adaptor. + /// + internal void Stop() + { + NDalicManualPINVOKE.Adaptor_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool AddIdle(SWIGTYPE_p_Dali__CallbackBase callback) + { + bool ret = NDalicManualPINVOKE.Adaptor_AddIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void RemoveIdle(SWIGTYPE_p_Dali__CallbackBase callback) + { + NDalicManualPINVOKE.Adaptor_RemoveIdle(swigCPtr, SWIGTYPE_p_Dali__CallbackBase.getCPtr(callback)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void ReplaceSurface(Any nativeWindow, SWIGTYPE_p_Dali__RenderSurface surface) + { + NDalicManualPINVOKE.Adaptor_ReplaceSurface(swigCPtr, Any.getCPtr(nativeWindow), SWIGTYPE_p_Dali__RenderSurface.getCPtr(surface)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_Dali__RenderSurface GetSurface() + { + SWIGTYPE_p_Dali__RenderSurface ret = new SWIGTYPE_p_Dali__RenderSurface(NDalicManualPINVOKE.Adaptor_GetSurface(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Any GetNativeWindowHandle() + { + Any ret = new Any(NDalicManualPINVOKE.Adaptor_GetNativeWindowHandle(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Release any locks the surface may hold. + /// + /// + /// For example, after compositing an offscreen surface, use this method to allow rendering to continue. + /// + internal void ReleaseSurfaceLock() + { + NDalicManualPINVOKE.Adaptor_ReleaseSurfaceLock(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set the number of frames per render. + /// + /// The number of vsyncs between successive renders.. + /// + /// Suggest this is a power of two: + /// 1 - render each vsync frame + /// 2 - render every other vsync frame + /// 4 - render every fourth vsync frame + /// 8 - render every eighth vsync frame + /// + internal void SetRenderRefreshRate(uint numberOfVSyncsPerRender) + { + NDalicManualPINVOKE.Adaptor_SetRenderRefreshRate(swigCPtr, numberOfVSyncsPerRender); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Set whether the frame count per render is managed using the hardware VSync or manually timed. + /// + /// True if the hardware VSync should be used. + internal void SetUseHardwareVSync(bool useHardware) + { + NDalicManualPINVOKE.Adaptor_SetUseHardwareVSync(swigCPtr, useHardware); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private static readonly Adaptor instance = Adaptor.Get(); + + internal static Adaptor Get() + { + Adaptor ret = new Adaptor(NDalicManualPINVOKE.Adaptor_Get(), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns a reference to the instance of the adaptor used by the current thread. + /// + /// The adaptor has been initialised.This is only valid in the main thread. + public static Adaptor Instance + { + get + { + return instance; + } + } + + /// + /// Checks whether the adaptor is available. + /// + /// true, if it is available, false otherwise. + internal static bool IsAvailable() + { + bool ret = NDalicManualPINVOKE.Adaptor_IsAvailable(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Call this method to notify Dali when scene is created and initialized. + /// Notify Adaptor that the scene has been created. + /// + internal void NotifySceneCreated() + { + NDalicManualPINVOKE.Adaptor_NotifySceneCreated(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Call this method to notify Dali when the system language changes. + /// + /// Use this only when NOT using Dali::Application, As Application created using + /// Application will automatically receive notification of language change. + /// When Dali::Application is not used, the application developer should + /// use app-core to receive language change notifications and should update Dali + /// by calling this method. + /// + internal void NotifyLanguageChanged() + { + NDalicManualPINVOKE.Adaptor_NotifyLanguageChanged(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets minimum distance in pixels that the fingers must move towards/away from each other in order to trigger a pinch gesture. + /// + /// The minimum pinch distance in pixels. + internal void SetMinimumPinchDistance(float distance) + { + NDalicManualPINVOKE.Adaptor_SetMinimumPinchDistance(swigCPtr, distance); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void FeedTouchPoint(TouchPoint point, int timeStamp) + { + NDalicManualPINVOKE.Adaptor_FeedTouchPoint(swigCPtr, TouchPoint.getCPtr(point), timeStamp); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feed a wheel event to the adaptor. + /// + /// wheel event. + public void FeedWheelEvent(Wheel wheelEvent) + { + NDalicManualPINVOKE.Adaptor_FeedWheelEvent(swigCPtr, Wheel.getCPtr(wheelEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Feed a key event to the adaptor. + /// + /// The key event holding the key information. + public void FeedKeyEvent(Key keyEvent) + { + NDalicManualPINVOKE.Adaptor_FeedKeyEvent(swigCPtr, Key.getCPtr(keyEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Notify Core that the scene has been created. + /// + internal void SceneCreated() + { + NDalicManualPINVOKE.Adaptor_SceneCreated(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetViewMode(ViewMode viewMode) + { + NDalicManualPINVOKE.Adaptor_SetViewMode(swigCPtr, (int)viewMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets the stereo base (eye separation) for Stereoscopic 3D. + /// The stereo base is the distance in millimetres between the eyes. Typical values are + /// between 50mm and 70mm. The default value is 65mm. + /// + /// The stereo base (eye separation) for Stereoscopic 3D. + internal void SetStereoBase(float stereoBase) + { + NDalicManualPINVOKE.Adaptor_SetStereoBase(swigCPtr, stereoBase); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Event arguments that passed via Resized signal. + /// + internal class ResizedEventArgs : EventArgs + { + + /// + /// Adaptor - is the adaptor which has size changed. + /// + public Adaptor Adaptor + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResizedCallbackDelegate(IntPtr adaptor); + private EventHandler _resizedEventHandler; + private ResizedCallbackDelegate _resizedCallbackDelegate; + + /// + /// Event for Resized signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. Resized signal is emitted when the size changes.
+ ///
+ internal event EventHandler Resized + { + add + { + if (_resizedEventHandler == null) + { + _resizedCallbackDelegate = (OnResized); + ResizedSignal().Connect(_resizedCallbackDelegate); + } + _resizedEventHandler += value; + } + remove + { + _resizedEventHandler -= value; + if (_resizedEventHandler == null && ResizedSignal().Empty() == false) + { + ResizedSignal().Disconnect(_resizedCallbackDelegate); + } + } + } + + private void OnResized(IntPtr adaptor) + { + ResizedEventArgs e = new ResizedEventArgs(); + if (adaptor != null) + { + e.Adaptor = Adaptor.GetAdaptorFromPtr(adaptor); + } + + if (_resizedEventHandler != null) + { + //here we send all data to user event handlers + _resizedEventHandler(this, e); + } + } + + internal AdaptorSignalType ResizedSignal() + { + AdaptorSignalType ret = new AdaptorSignalType(NDalicManualPINVOKE.Adaptor_ResizedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments that passed via LanguageChanged signal. + /// + internal class LanguageChangedEventArgs : EventArgs + { + + /// + /// Adaptor - is the adaptor which has language changed. + /// + public Adaptor Adaptor + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void LanguageChangedCallbackDelegate(IntPtr adaptor); + private EventHandler _languageChangedEventHandler; + private LanguageChangedCallbackDelegate _languageChangedCallbackDelegate; + + /// + /// Event for LanguageChanged signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. LanguageChanged signal is emitted when the language changes.
+ ///
+ internal event EventHandler LanguageChanged + { + add + { + if (_languageChangedEventHandler == null) + { + _languageChangedCallbackDelegate = (OnLanguageChanged); + LanguageChangedSignal().Connect(_languageChangedCallbackDelegate); + } + _languageChangedEventHandler += value; + } + remove + { + _languageChangedEventHandler -= value; + if (_languageChangedEventHandler == null && LanguageChangedSignal().Empty() == false) + { + LanguageChangedSignal().Disconnect(_languageChangedCallbackDelegate); + } + } + } + + private void OnLanguageChanged(IntPtr adaptor) + { + LanguageChangedEventArgs e = new LanguageChangedEventArgs(); + if (adaptor != null) + { + e.Adaptor = Adaptor.GetAdaptorFromPtr(adaptor); + } + + if (_languageChangedEventHandler != null) + { + //here we send all data to user event handlers + _languageChangedEventHandler(this, e); + } + } + + internal AdaptorSignalType LanguageChangedSignal() + { + AdaptorSignalType ret = new AdaptorSignalType(NDalicManualPINVOKE.Adaptor_LanguageChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/AlphaFunction.cs b/src/Tizen.NUI/src/public/AlphaFunction.cs new file mode 100755 index 0000000..ed35633 --- /dev/null +++ b/src/Tizen.NUI/src/public/AlphaFunction.cs @@ -0,0 +1,365 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +namespace Tizen.NUI +{ + + /// + /// Alpha functions are used in animations to specify the rate of change of the animation parameter over time.
+ /// Understanding an animation as a parametric function over time, the alpha function is applied to the parameter of + /// the animation before computing the final animation value. + ///
+ public class AlphaFunction : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal AlphaFunction(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(AlphaFunction obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~AlphaFunction() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + /// + /// To make AlphaFunction instance be disposed. + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_AlphaFunction(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Constructor.
+ /// Creates an alpha function object with user defined alpha function.
+ ///
+ /// User defined fuction. It must be a method formatted as float alphafunction(float progress) + public AlphaFunction(System.Delegate func) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(new SWIGTYPE_p_f_float__float(System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func), true))), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Default constructor.
+ /// Creates an alpha function object with the default built-in alpha function.
+ ///
+ public AlphaFunction() : this(NDalicPINVOKE.new_AlphaFunction__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor.
+ /// Creates an alpha function object with the built-in alpha function passed as a parameter to the constructor.
+ ///
+ /// One of the built-in alpha functions + public AlphaFunction(AlphaFunction.BuiltinFunctions function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_1((int)function), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal AlphaFunction(SWIGTYPE_p_f_float__float function) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_2(SWIGTYPE_p_f_float__float.getCPtr(function)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor.
+ /// Creates a bezier alpha function.The bezier will have the first point at(0,0) and the end point at(1,1).
+ ///
+ /// The x components of the control points will be clamped to the range[0, 1] to prevent non monotonic curves. + /// A Vector2 which will be used as the first control point of the curve + /// A Vector2 which will be used as the second control point of the curve + public AlphaFunction(Vector2 controlPoint0, Vector2 controlPoint1) : this(NDalicPINVOKE.new_AlphaFunction__SWIG_3(Vector2.getCPtr(controlPoint0), Vector2.getCPtr(controlPoint1)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrives the control points of the alpha function.
+ ///
+ /// A Vector2 which is used as the first control point of the curve + /// A Vector2 which is used as the second control point of the curve + public void GetBezierControlPoints(out Vector2 controlPoint0, out Vector2 controlPoint1) + { + Vector4 ret = new Vector4(NDalicPINVOKE.AlphaFunction_GetBezierControlPoints(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + controlPoint0 = new Vector2(ret.X, ret.Y); + controlPoint1 = new Vector2(ret.Z, ret.W); + } + + internal SWIGTYPE_p_f_float__float GetCustomFunction() + { + global::System.IntPtr cPtr = NDalicPINVOKE.AlphaFunction_GetCustomFunction(swigCPtr); + SWIGTYPE_p_f_float__float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_float__float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the built-in function used by the alpha function.
+ /// In case no built-in function has been specified, it will return AlphaFunction::DEFAULT.
+ ///
+ /// One of the built-in alpha functions. + public AlphaFunction.BuiltinFunctions GetBuiltinFunction() + { + AlphaFunction.BuiltinFunctions ret = (AlphaFunction.BuiltinFunctions)NDalicPINVOKE.AlphaFunction_GetBuiltinFunction(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the functioning mode of the alpha function + /// + /// The functioning mode of the alpha function + public AlphaFunction.Modes GetMode() + { + AlphaFunction.Modes ret = (AlphaFunction.Modes)NDalicPINVOKE.AlphaFunction_GetMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// This specifies the various types of BuiltinFunctions + /// + public enum BuiltinFunctions + { + /// + /// Linear + /// + Default, + /// + /// No transformation + /// + Linear, + /// + /// Reverse linear + /// + Reverse, + /// + /// Speeds up and comes to a sudden stop (Square) + /// + EaseInSquare, + /// + /// Sudden start and slows to a gradual stop (Square) + /// + EaseOutSquare, + /// + /// Speeds up and comes to a sudden stop (Cubic) + /// + EaseIn, + /// + /// Sudden start and slows to a gradual stop (Cubic) + /// + EaseOut, + /// + /// Speeds up and slows to a gradual stop (Cubic) + /// + EaseInOut, + /// + /// Speeds up and comes to a sudden stop (sinusoidal) + /// + EaseInSine, + /// + /// Sudden start and slows to a gradual stop (sinusoidal) + /// + EaseOutSine, + /// + /// Speeds up and slows to a gradual stop (sinusoidal) + /// + EaseInOutSine, + /// + /// Sudden start, loses momentum and returns to start position + /// + Bounce, + /// + /// Single revolution + /// + Sin, + /// + /// Sudden start, exceed end position and return to a gradual stop + /// + EaseOutBack, + Count + } + + /// + /// This specifies which mode is set for AlphaFuction + /// + public enum Modes + { + /// + /// The user has used a built-in function. + /// + BuiltinFunction, + + /// + /// The user has provided a custom function + /// + CustomFunction, + /// + /// The user has provided the control points of a bezier curve + /// + Bezier + } + + internal static string BuiltinToPropertyKey(BuiltinFunctions? alphaFunction) + { + string propertyKey = null; + if (alphaFunction != null) + { + switch (alphaFunction) + { + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + propertyKey = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + propertyKey = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + propertyKey = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + propertyKey = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + propertyKey = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + propertyKey = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + propertyKey = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + propertyKey = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + propertyKey = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + propertyKey = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + propertyKey = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + propertyKey = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + propertyKey = "EASE_OUT_BACK"; + break; + } + default: + { + propertyKey = "DEFAULT"; + break; + } + } + } + return propertyKey; + } + } +} diff --git a/src/Tizen.NUI/src/public/Animatable.cs b/src/Tizen.NUI/src/public/Animatable.cs new file mode 100755 index 0000000..578477f --- /dev/null +++ b/src/Tizen.NUI/src/public/Animatable.cs @@ -0,0 +1,185 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Animatable : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Animatable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Handle_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animatable obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Handle(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public Animatable() : this(NDalicPINVOKE.Handle_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + internal uint GetPropertyCount() + { + uint ret = NDalicPINVOKE.Handle_GetPropertyCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetPropertyName(int index) + { + string ret = NDalicPINVOKE.Handle_GetPropertyName(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int GetPropertyIndex(string name) + { + int ret = NDalicPINVOKE.Handle_GetPropertyIndex(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsPropertyWritable(int index) + { + bool ret = NDalicPINVOKE.Handle_IsPropertyWritable(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsPropertyAnimatable(int index) + { + bool ret = NDalicPINVOKE.Handle_IsPropertyAnimatable(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyType GetPropertyType(int index) + { + PropertyType ret = (PropertyType)NDalicPINVOKE.Handle_GetPropertyType(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetProperty(int index, PropertyValue propertyValue) + { + Tizen.NUI.Object.SetProperty(swigCPtr, index, propertyValue); + } + + public int RegisterProperty(string name, PropertyValue propertyValue) + { + int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_0(swigCPtr, name, PropertyValue.getCPtr(propertyValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int RegisterProperty(string name, PropertyValue propertyValue, PropertyAccessMode accessMode) + { + int ret = NDalicPINVOKE.Handle_RegisterProperty__SWIG_1(swigCPtr, name, PropertyValue.getCPtr(propertyValue), (int)accessMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyValue GetProperty(int index) + { + PropertyValue ret = Tizen.NUI.Object.GetProperty(swigCPtr, index); + return ret; + } + + internal PropertyNotification AddPropertyNotification(int index, PropertyCondition condition) + { + PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_0(swigCPtr, index, PropertyCondition.getCPtr(condition)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal PropertyNotification AddPropertyNotification(int index, int componentIndex, PropertyCondition condition) + { + PropertyNotification ret = new PropertyNotification(NDalicPINVOKE.Handle_AddPropertyNotification__SWIG_1(swigCPtr, index, componentIndex, PropertyCondition.getCPtr(condition)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void RemovePropertyNotification(PropertyNotification propertyNotification) + { + NDalicPINVOKE.Handle_RemovePropertyNotification(swigCPtr, PropertyNotification.getCPtr(propertyNotification)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RemovePropertyNotifications() + { + NDalicPINVOKE.Handle_RemovePropertyNotifications(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RemoveConstraints() + { + NDalicPINVOKE.Handle_RemoveConstraints__SWIG_0(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RemoveConstraints(uint tag) + { + NDalicPINVOKE.Handle_RemoveConstraints__SWIG_1(swigCPtr, tag); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public enum Capability + { + DYNAMIC_PROPERTIES = 0x01 + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Animation.cs b/src/Tizen.NUI/src/public/Animation.cs new file mode 100755 index 0000000..b0deba5 --- /dev/null +++ b/src/Tizen.NUI/src/public/Animation.cs @@ -0,0 +1,1155 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// Animation can be used to animate the properties of any number of objects, typically View.
+ /// If the "Finished" event is connected to a member function of an object, it must be disconnected before the object is destroyed.
+ /// This is typically done in the object destructor, and requires either the Animation handle to be stored.
+ /// The overall animation time is superseded by the values given in the animation time used when calling the AnimateTo(), AnimateBy(), AnimateBetween() and AnimatePath() methods.
+ /// If any of the individual calls to those functions exceeds the overall animation time(Duration), then the overall animation time is automatically extended.
+ ///
+ public class Animation : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Animation(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Animation_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Animation obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Animation instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + else if(type == DisposeTypes.Implicit) + { + + } + + if(this) + { + this.Clear(); + this.Reset(); + NUILog.Error("Now Animation is playing! Clear and Reset here!"); + //throw new System.InvalidOperationException("Animation Instance should not be disposed until getting Finished event. Should be a global variable"); + } + + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Animation(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Create an initialized Animation.
+ /// The animation will not loop.
+ /// The default end action is "Cancel".
+ /// The default Alpha function is linear.
+ ///
+ /// DurationmSeconds must be greater than zero. + /// The duration in milli seconds. + public Animation(int durationMilliSeconds) : this(NDalicPINVOKE.Animation_New((float)durationMilliSeconds / 1000.0f), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private AnimationFinishedEventCallbackType _animationFinishedEventCallback; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void AnimationFinishedEventCallbackType(IntPtr data); + private event EventHandler _animationFinishedEventHandler; + /** + * @brief Event for Finished signal which can be used to subscribe/unsubscribe the event handler. + * Finished signal is emitted when an Animation's animations have finished. + */ + public event EventHandler Finished + { + add + { + if (_animationFinishedEventHandler == null) + { + NUILog.Debug("[add before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + _animationFinishedEventCallback = OnFinished; + FinishedSignal().Connect(_animationFinishedEventCallback); + NUILog.Debug("[add after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + } + _animationFinishedEventHandler += value; + } + remove + { + _animationFinishedEventHandler -= value; + + if (_animationFinishedEventHandler == null && FinishedSignal().Empty() == false) + { + NUILog.Debug("[remove before]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + FinishedSignal().Disconnect(_animationFinishedEventCallback); + NUILog.Debug("[remove after]FinishedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + } + } + } + private void OnFinished(IntPtr data) + { + if (_animationFinishedEventHandler != null) + { + //here we send all data to user event handlers + _animationFinishedEventHandler(this, null); + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void AnimationProgressReachedEventCallbackType(IntPtr data); + private AnimationProgressReachedEventCallbackType _animationProgressReachedEventCallback; + private event EventHandler _animationProgressReachedEventHandler; + /** + * @brief Event for ProgressReached signal which can be used to subscribe/unsubscribe the event handler. + * ProgressReached signal is emitted when the Animation has reached a given progress percentage, this is set in the api SetProgressNotification. + */ + public event EventHandler ProgressReached + { + add + { + if (_animationProgressReachedEventHandler == null) + { + NUILog.Debug("[add before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + _animationProgressReachedEventCallback = OnProgressReached; + ProgressReachedSignal().Connect(_animationProgressReachedEventCallback); + NUILog.Debug("[add after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + } + + _animationProgressReachedEventHandler += value; + } + remove + { + _animationProgressReachedEventHandler -= value; + + if (_animationProgressReachedEventHandler == null && ProgressReachedSignal().Empty() == false) + { + NUILog.Debug("[remove before]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + ProgressReachedSignal().Disconnect(_animationProgressReachedEventHandler); + NUILog.Debug("[remove after]ProgressReachedSignal().Empty=" + FinishedSignal().Empty() + " GetConnectionCount=" + FinishedSignal().GetConnectionCount()); + } + } + } + private void OnProgressReached(IntPtr data) + { + if (_animationProgressReachedEventHandler != null) + { + //here we send all data to user event handlers + _animationProgressReachedEventHandler(this, null); + } + } + + private float MilliSecondsToSeconds(int millisec) + { + return (float)millisec / 1000.0f; + } + + private int SecondsToMilliSeconds(float sec) + { + return (int)(sec * 1000); + } + + + /// + /// Gets/Sets the duration in milli seconds of the animation. + /// + public int Duration + { + set + { + SetDuration(MilliSecondsToSeconds(value)); + } + get + { + return SecondsToMilliSeconds(GetDuration()); + } + } + + /// + /// Gets/Sets the default alpha function for the animation. + /// + public AlphaFunction DefaultAlphaFunction + { + set + { + SetDefaultAlphaFunction(value); + } + get + { + AlphaFunction ret = GetDefaultAlphaFunction(); + return ret; + } + } + + /// + /// Queries the state of the animation. + /// + public States State + { + get + { + return GetState(); + } + } + + /// + /// Set : Enables looping for 'count' repeats. A zero is the same as Looping = true; i.e.repeat forever.
+ /// If Play() Stop() or 'count' loops is reached, the loop counter will reset.
+ /// Setting this parameter does not cause the animation to Play().
+ /// Get : Gets the loop count. A zero is the same as Looping = true; ie repeat forever.
+ /// The loop count is initially 1 for play once.
+ ///
+ public int LoopCount + { + set + { + SetLoopCount(value); + } + get + { + int ret = GetLoopCount(); + return ret; + } + } + + /// + /// Gets/Sets the status of whether the animation will loop.
+ /// This property resets the loop count and should not be used with LoopCount property.
+ /// Setting this parameter does not cause the animation to Play().
+ ///
+ public bool Looping + { + set + { + SetLooping(value); + } + get + { + bool ret = IsLooping(); + return ret; + } + } + + + /// + /// Gets/Sets the end action of the animation.
+ /// This action is performed when the animation ends or if it is stopped.
+ /// Default end action is Cancel.
+ ///
+ public EndActions EndAction + { + set + { + SetEndAction(value); + } + get + { + return GetEndAction(); + } + } + + + /// + /// Stops the animation. + /// + /// end action can be set + public void Stop(EndActions action = EndActions.Cancel) + { + SetEndAction(action); + NDalicPINVOKE.Animation_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the current loop count.
+ /// A value 0 indicating the current loop count when looping.
+ ///
+ public int CurrentLoop + { + get + { + return GetCurrentLoop(); + } + } + + /// + /// Gets/Sets the disconnect action.
+ /// If any of the animated property owners are disconnected from the stage while the animation is being played, then this action is performed.
+ /// Default action is to Cancel.
+ ///
+ public EndActions DisconnectAction + { + set + { + NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + + /// + /// Gets/Sets the progress of the animation.
+ /// The animation will play(or continue playing) from this point.
+ /// The progress must be in the 0-1 interval or in the play range interval if defined.
+ /// otherwise, it will be ignored.
+ ///
+ public float CurrentProgress + { + set + { + NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Gets/Sets Specifies a speed factor for the animation.
+ /// The speed factor is a multiplier of the normal velocity of the animation.
+ /// Values between[0, 1] will slow down the animation and values above one will speed up the animation.
+ /// It is also possible to specify a negative multiplier to play the animation in reverse.
+ ///
+ public float SpeedFactor + { + set + { + NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Gets/Sets the playing range.
+ /// Animation will play between the values specified. Both values(range.x and range.y ) should be between 0-1, + /// otherwise they will be ignored.If the range provided is not in proper order(minimum, maximum ), it will be reordered.
+ ///
+ public RelativeVector2 PlayRange + { + set + { + NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + + /// + /// Gets/Sets the Progress notification marker which triggers the ProgressReachedSignal.
+ /// percentage of animation progress should be greater than 0 and less than 1, e.g 0.3 for 30%
+ /// One notification can be set on each animation + ///
+ public float ProgressNotification + { + set + { + NDalicPINVOKE.Animation_SetProgressNotification(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Animation_GetProgressNotification(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Animates a property value by a relative amount.
+ ///
+ /// The target object to animate + /// The target property to animate + /// The property value will change by this amount + /// The alpha function to apply + public void AnimateBy(View target, string property, object relativeValue, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); + if(propertyType.Equals(PropertyType.Float)) + { + System.Type type = relativeValue.GetType(); + if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int))) + { + int num = (int)relativeValue; + relativeValue = (float)num; + } + } + + PropertyValue val = PropertyValue.CreateFromObject(relativeValue); + + if (alphaFunction != null) + { + AnimateBy(_prop, val, alphaFunction); + } + else + { + AnimateBy(_prop, val); + } + } + + /// + /// Animates a property value by a relative amount.
+ ///
+ /// The target object to animate + /// The target property to animate + /// The property value will change by this amount + /// Start time of animation + /// End time of animation + /// The alpha function to apply + public void AnimateBy(View target, string property, object relativeValue, int startTime, int endTime, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); + if(propertyType.Equals(PropertyType.Float)) + { + System.Type type = relativeValue.GetType(); + if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int))) + { + int num = (int)relativeValue; + relativeValue = (float)num; + } + } + + PropertyValue val = PropertyValue.CreateFromObject(relativeValue); + + if (alphaFunction != null) + { + Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + AnimateBy(_prop, val, alphaFunction, time); + } + else + { + Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + AnimateBy(_prop, val, time); + } + } + + /// + /// Animates a property to a destination value.
+ ///
+ /// The target object to animate + /// The target property to animate + /// The destination value + /// The alpha function to apply + public void AnimateTo(View target, string property, object destinationValue, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); + if(propertyType.Equals(PropertyType.Float)) + { + System.Type type = destinationValue.GetType(); + if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int))) + { + int num = (int)destinationValue; + destinationValue = (float)num; + } + } + + PropertyValue val = PropertyValue.CreateFromObject(destinationValue); + + if (alphaFunction != null) + { + AnimateTo(_prop, val, alphaFunction); + } + else + { + AnimateTo(_prop, val); + } + } + + /// + /// Animates a property to a destination value.
+ ///
+ /// The target object to animate + /// The target property to animate + /// The destination value + /// The alpha function to apply + /// Start time of animation + /// End time of animation + /// The alpha function to apply + public void AnimateTo(View target, string property, object destinationValue, int startTime, int endTime, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + PropertyType propertyType = target.GetPropertyType(_prop.propertyIndex); + if(propertyType.Equals(PropertyType.Float)) + { + System.Type type = destinationValue.GetType(); + if (type.Equals(typeof(System.Int32)) || type.Equals(typeof(int))) + { + int num = (int)destinationValue; + destinationValue = (float)num; + } + } + + PropertyValue val = PropertyValue.CreateFromObject(destinationValue); + + if (alphaFunction != null) + { + Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + AnimateTo(_prop, val, alphaFunction, time); + } + else + { + Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + AnimateTo(_prop, val, time); + } + } + + /// + /// Animates a property between keyframes. + /// + /// The target object to animate + /// The target property to animate + /// The set of time/value pairs between which to animate + /// The method used to interpolate between values + /// The alpha function to apply + public void AnimateBetween(View target, string property, KeyFrames keyFrames, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + if (alphaFunction != null) + { + AnimateBetween(_prop, keyFrames, alphaFunction, interpolation); + } + else + { + AnimateBetween(_prop, keyFrames, interpolation); + } + } + + + /// + /// Animates a property between keyframes. + /// + /// The target object to animate + /// The target property to animate + /// The set of time/value pairs between which to animate + /// Start time of animation in milli seconds + /// End time of animation in milli seconds + /// The method used to interpolate between values + /// The alpha function to apply + public void AnimateBetween(View target, string property, KeyFrames keyFrames, int startTime, int endTime, Interpolation interpolation = Interpolation.Linear, AlphaFunction alphaFunction = null) + { + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + + Property _prop = new Property(target, _str); + if (_prop.propertyIndex == Property.INVALID_INDEX) + { + throw new System.ArgumentException("second argument string property is invalid parameter!"); + } + + Tizen.NUI.TimePeriod time = new Tizen.NUI.TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + if (alphaFunction != null) + { + AnimateBetween(_prop, keyFrames, alphaFunction, time, interpolation); + } + else + { + AnimateBetween(_prop, keyFrames, time, interpolation); + } + } + + /// + /// Animates an view's position and orientation through a predefined path.
+ /// The view will rotate to orient the supplied forward vector with the path's tangent.
+ /// If forward is the zero vector then no rotation will happen.
+ ///
+ /// The view to animate + /// It defines position and orientation + /// The vector (in local space coordinate system) that will be oriented with the path's tangent direction + /// The alpha function to apply + public void AnimatePath(View view, Path path, Vector3 forward, AlphaFunction alphaFunction = null) + { + if (alphaFunction == null) + { + Animate(view, path, forward); + } + else + { + Animate(view, path, forward, alphaFunction); + } + } + + /// + /// Animates an view's position and orientation through a predefined path.
+ /// The view will rotate to orient the supplied forward vector with the path's tangent.
+ /// If forward is the zero vector then no rotation will happen.
+ ///
+ /// The view to animate + /// It defines position and orientation + /// The vector (in local space coordinate system) that will be oriented with the path's tangent direction + /// Start time of animation + /// End time of animation + /// The alpha function to apply + public void AnimatePath(View view, Path path, Vector3 forward, int startTime, int endTime, AlphaFunction alphaFunction = null) + { + TimePeriod time = new TimePeriod(MilliSecondsToSeconds(startTime), MilliSecondsToSeconds(endTime - startTime)); + if (alphaFunction == null) + { + Animate(view, path, forward, time); + } + else + { + Animate(view, path, forward, alphaFunction, time); + } + } + + /// + /// Creates an initialized Animation.
+ /// The animation will not loop.
+ /// The default end action is "Cancel".
+ /// The default alpha function is linear.
+ ///
+ public Animation() : this(NDalicPINVOKE.Animation_New(0.0f), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animation(float durationSeconds) : this(NDalicPINVOKE.Animation_New(durationSeconds), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Downcasts a handle to Animation handle.
+ /// If handle points to an Animation object, the downcast produces valid handle.
+ /// If not, the returned handle is left uninitialized.
+ ///
+ /// Handle to an object + /// Handle to an Animation object or an uninitialized handle + public static Animation DownCast(BaseHandle handle) + { + Animation ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Animation; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Animation(Animation handle) : this(NDalicPINVOKE.new_Animation__SWIG_1(Animation.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animation Assign(Animation rhs) + { + Animation ret = new Animation(NDalicPINVOKE.Animation_Assign(swigCPtr, Animation.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetDuration(float seconds) + { + NDalicPINVOKE.Animation_SetDuration(swigCPtr, seconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetDuration() + { + float ret = NDalicPINVOKE.Animation_GetDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetLooping(bool looping) + { + NDalicPINVOKE.Animation_SetLooping(swigCPtr, looping); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetLoopCount(int count) + { + NDalicPINVOKE.Animation_SetLoopCount(swigCPtr, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal int GetLoopCount() + { + int ret = NDalicPINVOKE.Animation_GetLoopCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal int GetCurrentLoop() + { + int ret = NDalicPINVOKE.Animation_GetCurrentLoop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool IsLooping() + { + bool ret = NDalicPINVOKE.Animation_IsLooping(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetEndAction(Animation.EndActions action) + { + NDalicPINVOKE.Animation_SetEndAction(swigCPtr, (int)action); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animation.EndActions GetEndAction() + { + Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetEndAction(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetDisconnectAction(Animation.EndActions disconnectAction) + { + NDalicPINVOKE.Animation_SetDisconnectAction(swigCPtr, (int)disconnectAction); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animation.EndActions GetDisconnectAction() + { + Animation.EndActions ret = (Animation.EndActions)NDalicPINVOKE.Animation_GetDisconnectAction(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetDefaultAlphaFunction(AlphaFunction alpha) + { + NDalicPINVOKE.Animation_SetDefaultAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal AlphaFunction GetDefaultAlphaFunction() + { + AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.Animation_GetDefaultAlphaFunction(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetCurrentProgress(float progress) + { + NDalicPINVOKE.Animation_SetCurrentProgress(swigCPtr, progress); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetCurrentProgress() + { + float ret = NDalicPINVOKE.Animation_GetCurrentProgress(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetSpeedFactor(float factor) + { + NDalicPINVOKE.Animation_SetSpeedFactor(swigCPtr, factor); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetSpeedFactor() + { + float ret = NDalicPINVOKE.Animation_GetSpeedFactor(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetPlayRange(Vector2 range) + { + NDalicPINVOKE.Animation_SetPlayRange(swigCPtr, Vector2.getCPtr(range)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector2 GetPlayRange() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Animation_GetPlayRange(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Plays the animation. + /// + public void Play() + { + NDalicPINVOKE.Animation_Play(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); +#if DISABLE_ANIMATION + Stop(EndActions.StopFinal); +#endif + } + + /// + /// Plays the animation from a given point.
+ /// The progress must be in the 0-1 interval or in the play range interval if defined, + /// otherwise, it will be ignored.
+ ///
+ /// A value between [0,1], or between the play range if specified, from where the animation should start playing + public void PlayFrom(float progress) + { + NDalicPINVOKE.Animation_PlayFrom(swigCPtr, progress); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Play the animation after a given delay time.
+ /// The delay time is not included in the looping time.
+ /// When the delay time is negative value, it would treat as play immediately.
+ ///
+ /// The delay time + public void PlayAfter(int delayMiliSeconds) + { + NDalicPINVOKE.Animation_PlayAfter(swigCPtr, MilliSecondsToSeconds(delayMiliSeconds)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Pauses the animation. + /// + public void Pause() + { + NDalicPINVOKE.Animation_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animation.States GetState() + { + Animation.States ret = (Animation.States)NDalicPINVOKE.Animation_GetState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Stops the animation. + /// + public void Stop() + { + NDalicPINVOKE.Animation_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Clears the animation.
+ /// This disconnects any objects that were being animated, effectively stopping the animation.
+ ///
+ public void Clear() + { + NDalicPINVOKE.Animation_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal AnimationSignal FinishedSignal() + { + AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_FinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal AnimationSignal ProgressReachedSignal() + { + AnimationSignal ret = new AnimationSignal(NDalicPINVOKE.Animation_ProgressReachedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void AnimateBy(Property target, PropertyValue relativeValue) + { + NDalicPINVOKE.Animation_AnimateBy__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha) + { + NDalicPINVOKE.Animation_AnimateBy__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBy(Property target, PropertyValue relativeValue, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateBy__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBy(Property target, PropertyValue relativeValue, AlphaFunction alpha, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateBy__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(relativeValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateTo(Property target, PropertyValue destinationValue) + { + NDalicPINVOKE.Animation_AnimateTo__SWIG_0(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha) + { + NDalicPINVOKE.Animation_AnimateTo__SWIG_1(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateTo(Property target, PropertyValue destinationValue, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateTo__SWIG_2(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateTo(Property target, PropertyValue destinationValue, AlphaFunction alpha, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateTo__SWIG_3(swigCPtr, Property.getCPtr(target), PropertyValue.getCPtr(destinationValue), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_0(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, Animation.Interpolation interpolation) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_1(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), (int)interpolation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_2(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, Animation.Interpolation interpolation) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_3(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), (int)interpolation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_4(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, TimePeriod period, Animation.Interpolation interpolation) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_5(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), TimePeriod.getCPtr(period), (int)interpolation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_6(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AnimateBetween(Property target, KeyFrames keyFrames, AlphaFunction alpha, TimePeriod period, Animation.Interpolation interpolation) + { + NDalicPINVOKE.Animation_AnimateBetween__SWIG_7(swigCPtr, Property.getCPtr(target), KeyFrames.getCPtr(keyFrames), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period), (int)interpolation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Animate(View view, Path path, Vector3 forward) + { + NDalicPINVOKE.Animation_Animate__SWIG_0(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha) + { + NDalicPINVOKE.Animation_Animate__SWIG_1(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Animate(View view, Path path, Vector3 forward, TimePeriod period) + { + NDalicPINVOKE.Animation_Animate__SWIG_2(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Animate(View view, Path path, Vector3 forward, AlphaFunction alpha, TimePeriod period) + { + NDalicPINVOKE.Animation_Animate__SWIG_3(swigCPtr, View.getCPtr(view), Path.getCPtr(path), Vector3.getCPtr(forward), AlphaFunction.getCPtr(alpha), TimePeriod.getCPtr(period)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Show(View view, float delaySeconds) + { + NDalicPINVOKE.Animation_Show(swigCPtr, View.getCPtr(view), delaySeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Hide(View view, float delaySeconds) + { + NDalicPINVOKE.Animation_Hide(swigCPtr, View.getCPtr(view), delaySeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Enumeration for what to do when the animation ends, is stopped, or is destroyed. + /// + public enum EndActions + { + /// + /// When the animation ends, the animated property values are saved. + /// + Cancel, + /// + /// When the animation ends, the animated property values are forgotten. + /// + Discard, + /// + /// If the animation is stopped, the animated property values are saved as if the animation had run to completion, otherwise behaves like Cancel. + /// + StopFinal + } + + /// + /// Enumeration for what interpolation method to use on key-frame animations. + /// + public enum Interpolation + { + /// + /// Values in between key frames are interpolated using a linear polynomial. (Default) + /// + Linear, + /// + /// Values in between key frames are interpolated using a cubic polynomial. + /// + Cubic + } + + /// + /// Enumeration for what state the animation is in. + /// + /// Calling Reset() on this class will NOT reset the animation. It will call BaseHandle.Reset() which drops the object handle. + public enum States + { + /// + /// Animation has stopped + /// + Stopped, + /// + /// The animation is playing + /// + Playing, + /// + /// The animation is paused + /// + Paused + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs b/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs new file mode 100755 index 0000000..3f2d165 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs @@ -0,0 +1,715 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI.BaseComponents +{ + /// + /// CustomView provides some common functionality required by all views. + /// + public class CustomView : ViewWrapper + { + public CustomView(string typeName, CustomViewBehaviour behaviour) : base(typeName, new ViewWrapperImpl(behaviour)) + { + // Registering CustomView virtual functions to viewWrapperImpl delegates. + viewWrapperImpl.OnStageConnection = new ViewWrapperImpl.OnStageConnectionDelegate(OnStageConnection); + viewWrapperImpl.OnStageDisconnection = new ViewWrapperImpl.OnStageDisconnectionDelegate(OnStageDisconnection); + viewWrapperImpl.OnChildAdd = new ViewWrapperImpl.OnChildAddDelegate(OnChildAdd); + viewWrapperImpl.OnChildRemove = new ViewWrapperImpl.OnChildRemoveDelegate(OnChildRemove); + viewWrapperImpl.OnPropertySet = new ViewWrapperImpl.OnPropertySetDelegate(OnPropertySet); + viewWrapperImpl.OnSizeSet = new ViewWrapperImpl.OnSizeSetDelegate(OnSizeSet); + viewWrapperImpl.OnSizeAnimation = new ViewWrapperImpl.OnSizeAnimationDelegate(OnSizeAnimation); + viewWrapperImpl.OnTouch = new ViewWrapperImpl.OnTouchDelegate(OnTouch); + viewWrapperImpl.OnHover = new ViewWrapperImpl.OnHoverDelegate(OnHover); + viewWrapperImpl.OnKey = new ViewWrapperImpl.OnKeyDelegate(OnKey); + viewWrapperImpl.OnWheel = new ViewWrapperImpl.OnWheelDelegate(OnWheel); + viewWrapperImpl.OnRelayout = new ViewWrapperImpl.OnRelayoutDelegate(OnRelayout); + viewWrapperImpl.OnSetResizePolicy = new ViewWrapperImpl.OnSetResizePolicyDelegate(OnSetResizePolicy); + viewWrapperImpl.GetNaturalSize = new ViewWrapperImpl.GetNaturalSizeDelegate(GetNaturalSize); + viewWrapperImpl.CalculateChildSize = new ViewWrapperImpl.CalculateChildSizeDelegate(CalculateChildSize); + viewWrapperImpl.GetHeightForWidth = new ViewWrapperImpl.GetHeightForWidthDelegate(GetHeightForWidth); + viewWrapperImpl.GetWidthForHeight = new ViewWrapperImpl.GetWidthForHeightDelegate(GetWidthForHeight); + viewWrapperImpl.RelayoutDependentOnChildrenDimension = new ViewWrapperImpl.RelayoutDependentOnChildrenDimensionDelegate(RelayoutDependentOnChildren); + viewWrapperImpl.RelayoutDependentOnChildren = new ViewWrapperImpl.RelayoutDependentOnChildrenDelegate(RelayoutDependentOnChildren); + viewWrapperImpl.OnCalculateRelayoutSize = new ViewWrapperImpl.OnCalculateRelayoutSizeDelegate(OnCalculateRelayoutSize); + viewWrapperImpl.OnLayoutNegotiated = new ViewWrapperImpl.OnLayoutNegotiatedDelegate(OnLayoutNegotiated); + viewWrapperImpl.OnControlChildAdd = new ViewWrapperImpl.OnControlChildAddDelegate(OnControlChildAdd); + viewWrapperImpl.OnControlChildRemove = new ViewWrapperImpl.OnControlChildRemoveDelegate(OnControlChildRemove); + viewWrapperImpl.OnStyleChange = new ViewWrapperImpl.OnStyleChangeDelegate(OnStyleChange); + viewWrapperImpl.OnAccessibilityActivated = new ViewWrapperImpl.OnAccessibilityActivatedDelegate(OnAccessibilityActivated); + viewWrapperImpl.OnAccessibilityPan = new ViewWrapperImpl.OnAccessibilityPanDelegate(OnAccessibilityPan); + viewWrapperImpl.OnAccessibilityTouch = new ViewWrapperImpl.OnAccessibilityTouchDelegate(OnAccessibilityTouch); + viewWrapperImpl.OnAccessibilityValueChange = new ViewWrapperImpl.OnAccessibilityValueChangeDelegate(OnAccessibilityValueChange); + viewWrapperImpl.OnAccessibilityZoom = new ViewWrapperImpl.OnAccessibilityZoomDelegate(OnAccessibilityZoom); + viewWrapperImpl.OnFocusGained = new ViewWrapperImpl.OnFocusGainedDelegate(OnFocusGained); + viewWrapperImpl.OnFocusLost = new ViewWrapperImpl.OnFocusLostDelegate(OnFocusLost); + viewWrapperImpl.GetNextFocusableView = new ViewWrapperImpl.GetNextFocusableViewDelegate(GetNextFocusableView); + viewWrapperImpl.OnFocusChangeCommitted = new ViewWrapperImpl.OnFocusChangeCommittedDelegate(OnFocusChangeCommitted); + viewWrapperImpl.OnKeyboardEnter = new ViewWrapperImpl.OnKeyboardEnterDelegate(OnKeyboardEnter); + viewWrapperImpl.OnPinch = new ViewWrapperImpl.OnPinchDelegate(OnPinch); + viewWrapperImpl.OnPan = new ViewWrapperImpl.OnPanDelegate(OnPan); + viewWrapperImpl.OnTap = new ViewWrapperImpl.OnTapDelegate(OnTap); + viewWrapperImpl.OnLongPress = new ViewWrapperImpl.OnLongPressDelegate(OnLongPress); + + // Make sure CustomView is initialized. + OnInitialize(); + + // Set the StyleName the name of the View + // We have to do this because the StyleManager on Native side can't workout it out + // This will also ensure that the style of views/visuals initialized above are applied by the style manager. + SetStyleName(this.GetType().Name); + } + + /// + /// Set the background with a property map. + /// + /// The background property map + public void SetBackground(Tizen.NUI.PropertyMap map) + { + viewWrapperImpl.SetBackground(map); + } + + /// + /// Allows deriving classes to enable any of the gesture detectors that are available.
+ /// Gesture detection can be enabled one at a time or in bitwise format.
+ ///
+ /// The gesture type(s) to enable + public void EnableGestureDetection(Gesture.GestureType type) + { + viewWrapperImpl.EnableGestureDetection(type); + } + + /// + /// Allows deriving classes to disable any of the gesture detectors.
+ /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.
+ ///
+ /// The gesture type(s) to disable + internal void DisableGestureDetection(Gesture.GestureType type) + { + viewWrapperImpl.DisableGestureDetection(type); + } + + /// + /// Sets whether this control supports two dimensional keyboard navigation + /// (i.e. whether it knows how to handle the keyboard focus movement between its child views).
+ /// The control doesn't support it by default.
+ ///
+ /// Whether this control supports two dimensional keyboard navigation. + public bool FocusNavigationSupport + { + get + { + return IsKeyboardNavigationSupported(); + } + set + { + SetKeyboardNavigationSupport(value); + } + } + + internal void SetKeyboardNavigationSupport(bool isSupported) + { + viewWrapperImpl.SetKeyboardNavigationSupport(isSupported); + } + + /// + /// Gets whether this control supports two dimensional keyboard navigation. + /// + /// true if this control supports two dimensional keyboard navigation + internal bool IsKeyboardNavigationSupported() + { + return viewWrapperImpl.IsKeyboardNavigationSupported(); + } + + + /// + /// Sets or Gets whether this control is a focus group for keyboard navigation. + /// + /// true if this control is set as a focus group for keyboard navigation + public bool FocusGroup + { + get + { + return IsKeyboardFocusGroup(); + } + set + { + SetAsKeyboardFocusGroup(value); + } + } + + /// + /// Sets whether this control is a focus group for keyboard navigation. + /// (i.e. the scope of keyboard focus movement can be limitied to its child views). The control is not a focus group by default. + /// + /// Whether this control is set as a focus group for keyboard navigation + internal void SetAsKeyboardFocusGroup(bool isFocusGroup) + { + viewWrapperImpl.SetAsFocusGroup(isFocusGroup); + } + + /// + /// Gets whether this control is a focus group for keyboard navigation. + /// + internal bool IsKeyboardFocusGroup() + { + return viewWrapperImpl.IsFocusGroup(); + } + + /// + /// Called by the AccessibilityManager to activate the Control. + /// + internal void AccessibilityActivate() + { + viewWrapperImpl.AccessibilityActivate(); + } + + /// + /// Called by the KeyboardFocusManager. + /// + internal void KeyboardEnter() + { + viewWrapperImpl.KeyboardEnter(); + } + + /// + /// Called by the KeyInputFocusManager to emit key event signals. + /// + /// The key event + /// True if the event was consumed + internal bool EmitKeyEventSignal(Key key) + { + return viewWrapperImpl.EmitKeyEventSignal(key); + } + + /// + /// Request a relayout, which means performing a size negotiation on this view, its parent and children (and potentially whole scene).
+ /// This method can also be called from a derived class every time it needs a different size.
+ /// At the end of event processing, the relayout process starts and all controls which requested Relayout will have their sizes (re)negotiated.
+ /// It can be called multiple times; the size negotiation is still only performed once, i.e. there is no need to keep track of this in the calling side.
+ /// + protected void RelayoutRequest() + { + viewWrapperImpl.RelayoutRequest(); + } + + /// + /// Provides the View implementation of GetHeightForWidth. + /// + /// Width to use + /// The height based on the width + protected float GetHeightForWidthBase(float width) + { + return viewWrapperImpl.GetHeightForWidthBase(width); + } + + /// + /// Provides the View implementation of GetWidthForHeight. + /// + /// Height to use + /// The width based on the height + protected float GetWidthForHeightBase(float height) + { + return viewWrapperImpl.GetWidthForHeightBase(height); + } + + /// + /// Calculate the size for a child using the base view object. + /// + /// The child view to calculate the size for + /// The dimension to calculate the size for. E.g. width or height + /// Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found + protected float CalculateChildSizeBase(View child, DimensionType dimension) + { + return viewWrapperImpl.CalculateChildSizeBase(child, dimension); + } + + /// + /// Determine if this view is dependent on it's children for relayout from the base class. + /// + /// The dimension(s) to check for + /// Return if the view is dependent on it's children + protected bool RelayoutDependentOnChildrenBase(DimensionType dimension) + { + return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension); + } + + /// + /// Determine if this view is dependent on it's children for relayout from the base class. + /// + /// Return if the view is dependent on it's children + protected bool RelayoutDependentOnChildrenBase() + { + return viewWrapperImpl.RelayoutDependentOnChildrenBase(); + } + + /// + /// Register a visual by Property Index, linking an View to visual when required.
+ /// In the case of the visual being an view or control deeming visual not required then visual should be an empty handle.
+ /// No parenting is done during registration, this should be done by derived class.
+ ///
+ /// The Property index of the visual, used to reference visual + /// The visual to register + protected void RegisterVisual(int index, VisualBase visual) + { + viewWrapperImpl.RegisterVisual(index, visual); + } + + /// + /// Register a visual by Property Index, linking an View to visual when required.
+ /// In the case of the visual being an view or control deeming visual not required then visual should be an empty handle.
+ /// If enabled is false then the visual is not set on stage until enabled by the derived class.
+ ///
+ /// The Property index of the visual, used to reference visual + /// The visual to register + /// false if derived class wants to control when visual is set on stage + protected void RegisterVisual(int index, VisualBase visual, bool enabled) + { + viewWrapperImpl.RegisterVisual(index, visual, enabled); + } + + /// + /// Erase the entry matching the given index from the list of registered visuals. + /// + /// The Property index of the visual, used to reference visual + protected void UnregisterVisual(int index) + { + viewWrapperImpl.UnregisterVisual(index); + } + + /// + /// Retrieve the visual associated with the given property index.
+ /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ ///
+ /// The Property index of the visual, used to reference visual + /// The registered visual if exist, otherwise empty handle + protected VisualBase GetVisual(int index) + { + return viewWrapperImpl.GetVisual(index); + } + + /// + /// Sets the given visual to be displayed or not when parent staged.
+ /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ ///
+ /// The Property index of the visual, used to reference visual + /// flag to set enabled or disabled + protected void EnableVisual(int index, bool enable) + { + viewWrapperImpl.EnableVisual(index, enable); + } + + /// + /// Queries if the given visual is to be displayed when parent staged.
+ /// For managing object life-cycle, do not store the returned visual as a member which increments its reference count.
+ ///
+ /// The Property index of the visual + /// Whether visual is enabled or not + protected bool IsVisualEnabled(int index) + { + return viewWrapperImpl.IsVisualEnabled(index); + } + + /// + /// Create a transition effect on the control. + /// + /// transitionData The transition data describing the effect to create + /// A handle to an animation defined with the given effect, or an empty handle if no properties match + protected Animation CreateTransition(TransitionData transitionData) + { + return viewWrapperImpl.CreateTransition(transitionData); + } + + /// + /// Emits KeyInputFocusGained signal if true else emits KeyInputFocusLost signal.
+ /// Should be called last by the control after it acts on the Input Focus change.
+ ///
+ /// focusGained True if gained, False if lost + protected void EmitFocusSignal(bool focusGained) + { + viewWrapperImpl.EmitFocusSignal(focusGained); + } + + /// + /// This method is called after the Control has been initialized.
+ /// Derived classes should do any second phase initialization by overriding this method.
+ ///
+ public virtual void OnInitialize() + { + } + + /// + /// Called after the view has been connected to the stage.
+ /// When an view is connected, it will be directly or indirectly parented to the root View.
+ /// The root View is provided automatically by Tizen.NUI.Stage, and is always considered to be connected.
+ /// When the parent of a set of views is connected to the stage, then all of the children will received this callback.
+ ///
+ /// The depth in the hierarchy for the view + public virtual void OnStageConnection(int depth) + { + } + + /// + /// Called after the view has been disconnected from Stage.
+ /// If an view is disconnected it either has no parent, or is parented to a disconnected view.
+ /// When the parent of a set of views is disconnected to the stage, then all of the children will received this callback, starting with the leaf views.
+ ///
+ public virtual void OnStageDisconnection() + { + } + + /// + /// Called after a child has been added to the owning view. + /// + /// The child which has been added + public virtual void OnChildAdd(View view) + { + } + + /// + /// Called after the owning view has attempted to remove a child( regardless of whether it succeeded or not ). + /// + /// The child being removed + public virtual void OnChildRemove(View view) + { + } + + /// + /// Called when the owning view property is set. + /// + /// The Property index that was set + /// The value to set + public virtual void OnPropertySet(int index, Tizen.NUI.PropertyValue propertyValue) + { + } + + /// + /// Called when the owning view's size is set e.g. using View.SetSize(). + /// + /// The target size + public virtual void OnSizeSet(Vector3 targetSize) + { + } + + /// + /// Called when the owning view's size is animated e.g. using Animation::AnimateTo( Property( view, View::Property::SIZE ), ... ). + /// + /// The object which is animating the owning view + /// The target size + public virtual void OnSizeAnimation(Animation animation, Vector3 targetSize) + { + } + + /// + /// Called after a touch-event is received by the owning view.
+ /// CustomViewBehaviour.REQUIRES_TOUCH_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
+ ///
+ /// The touch event + /// True if the event should be consumed + public virtual bool OnTouch(Touch touch) + { + return false; // Do not consume + } + + /// + /// Called after a hover-event is received by the owning view.
+ /// CustomViewBehaviour.REQUIRES_HOVER_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
+ ///
+ /// The hover event + /// True if the hover event should be consumed + public virtual bool OnHover(Hover hover) + { + return false; // Do not consume + } + + /// + /// Called after a key-event is received by the view that has had its focus set. + /// + /// The key event + /// True if the key event should be consumed + public virtual bool OnKey(Key key) + { + return false; // Do not consume + } + + /// + /// Called after a wheel-event is received by the owning view.
+ /// CustomViewBehaviour.REQUIRES_WHEEL_EVENTS must be enabled during construction. See CustomView(ViewWrapperImpl.CustomViewBehaviour behaviour).
+ ///
+ /// The wheel event + /// True if the wheel event should be consumed + public virtual bool OnWheel(Wheel wheel) + { + return false; // Do not consume + } + + /// + /// Called after the size negotiation has been finished for this control.
+ /// The control is expected to assign this given size to itself/its children.
+ /// Should be overridden by derived classes if they need to layout views differently after certain operations like add or remove views, resize or after changing specific properties.
+ /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored).
+ ///
+ /// The allocated size + /// The control should add views to this container that it is not able to allocate a size for + public virtual void OnRelayout(Vector2 size, RelayoutContainer container) + { + } + + /// + /// Notification for deriving classes. + /// + /// policy The policy being set + /// dimension The dimension the policy is being set for + public virtual void OnSetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + } + + /// + /// Return the natural size of the view. + /// + /// The view's natural size + public virtual Size2D GetNaturalSize() + { + return new Size2D(0, 0); + } + + /// + /// Calculate the size for a child. + /// + /// The child view to calculate the size for + /// The dimension to calculate the size for. E.g. width or height + /// Return the calculated size for the given dimension. If more than one dimension is requested, just return the first one found. + public virtual float CalculateChildSize(View child, DimensionType dimension) + { + return viewWrapperImpl.CalculateChildSizeBase(child, dimension); + } + + /// + /// This method is called during size negotiation when a height is required for a given width.
+ /// Derived classes should override this if they wish to customize the height returned.
+ ///
+ /// Width to use + /// The height based on the width + public virtual float GetHeightForWidth(float width) + { + return viewWrapperImpl.GetHeightForWidthBase(width); + } + + /// + /// This method is called during size negotiation when a width is required for a given height.
+ /// Derived classes should override this if they wish to customize the width returned.
+ ///
+ /// Height to use + /// The width based on the width + public virtual float GetWidthForHeight(float height) + { + return viewWrapperImpl.GetWidthForHeightBase(height); + } + + /// + /// Determine if this view is dependent on it's children for relayout. + /// + /// The dimension(s) to check for + /// Return if the view is dependent on it's children + public virtual bool RelayoutDependentOnChildren(DimensionType dimension) + { + return viewWrapperImpl.RelayoutDependentOnChildrenBase(dimension); + } + + /// + /// Determine if this view is dependent on it's children for relayout from the base class. + /// + /// Return true if the view is dependent on it's children + public virtual bool RelayoutDependentOnChildren() + { + return viewWrapperImpl.RelayoutDependentOnChildrenBase(); + } + + /// + /// Virtual method to notify deriving classes that relayout dependencies have been + /// met and the size for this object is about to be calculated for the given dimension. + /// + /// The dimension that is about to be calculated + public virtual void OnCalculateRelayoutSize(DimensionType dimension) + { + } + + /// + /// Virtual method to notify deriving classes that the size for a dimension has just been negotiated. + /// + /// The new size for the given dimension + /// The dimension that was just negotiated + public virtual void OnLayoutNegotiated(float size, DimensionType dimension) + { + } + + /// + /// This method should be overridden by deriving classes requiring notifications when the style changes. + /// + /// The StyleManager object + /// Information denoting what has changed + public virtual void OnStyleChange(StyleManager styleManager, StyleChangeType change) + { + } + + /// + /// This method is called when the control is accessibility activated.
+ /// Derived classes should override this to perform custom accessibility activation.
+ ///
+ /// true if this control can perform accessibility activation + internal virtual bool OnAccessibilityActivated() + { + return false; + } + + /// + /// This method should be overridden by deriving classes when they wish to respond the accessibility. + /// + /// The pan gesture + /// true if the pan gesture has been consumed by this control + internal virtual bool OnAccessibilityPan(PanGesture gestures) + { + return false; + } + + /// + /// This method should be overridden by deriving classes when they wish to respond the accessibility + /// + /// The touch gesture + /// true if the touch event has been consumed by this control + internal virtual bool OnAccessibilityTouch(Touch touch) + { + return false; + } + + /// + /// This method should be overridden by deriving classes when they wish to respond the accessibility up and down action (i.e. value change of slider control). + /// + /// isIncrease Whether the value should be increased or decreased + /// true if the value changed action has been consumed by this control + internal virtual bool OnAccessibilityValueChange(bool isIncrease) + { + return false; + } + + /// + /// This method should be overridden by deriving classes when they wish to respond the accessibility zoom action. + /// + /// true if the zoom action has been consumed by this control + internal virtual bool OnAccessibilityZoom() + { + return false; + } + + /// + /// Called when the control gain key input focus. Should be overridden by derived classes if they need to customize what happens when focus is gained. + /// + public virtual void OnFocusGained() + { + } + + /// + /// Called when the control loses key input focus. Should be overridden by derived classes if they need to customize what happens when focus is lost. + /// + public virtual void OnFocusLost() + { + } + + /// + /// Gets the next keyboard focusable view in this control towards the given direction.
+ /// A control needs to override this function in order to support two dimensional keyboard navigation.
+ ///
+ /// The current focused view + /// The direction to move the focus towards + /// Whether the focus movement should be looped within the control + /// the next keyboard focusable view in this control or an empty handle if no view can be focused + public virtual View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled) + { + return new View(); + } + + /// + /// Informs this control that its chosen focusable view will be focused.
+ /// This allows the application to preform any actions if wishes before the focus is actually moved to the chosen view.
+ ///
+ /// The commited focused view + public virtual void OnFocusChangeCommitted(View commitedFocusableView) + { + } + + /// + /// This method is called when the control has enter pressed on it.
+ /// Derived classes should override this to perform custom actions.
+ ///
+ /// true if this control supported this action + public virtual bool OnKeyboardEnter() + { + return false; + } + + /// + /// Called whenever a pinch gesture is detected on this control.
+ /// This can be overridden by deriving classes when pinch detection is enabled. The default behaviour is to scale the control by the pinch scale.
+ /// If overridden, then the default behaviour will not occur.
+ /// Pinch detection should be enabled via EnableGestureDetection().
+ ///
+ /// pinch tap gesture + internal virtual void OnPinch(PinchGesture pinch) + { + } + + /// + /// Called whenever a pan gesture is detected on this control.
+ /// This should be overridden by deriving classes when pan detection is enabled.
+ /// There is no default behaviour with panning.
+ /// Pan detection should be enabled via EnableGestureDetection().
+ ///
+ /// The pan gesture + public virtual void OnPan(PanGesture pan) + { + } + + /// + /// Called whenever a tap gesture is detected on this control.
+ /// This should be overridden by deriving classes when tap detection is enabled.
+ /// There is no default behaviour with a tap.
+ /// Tap detection should be enabled via EnableGestureDetection().
+ ///
+ /// The tap gesture + public virtual void OnTap(TapGesture tap) + { + } + + /// + /// Called whenever a long press gesture is detected on this control.
+ /// This should be overridden by deriving classes when long press detection is enabled.
+ /// There is no default behaviour associated with a long press.
+ /// Long press detection should be enabled via EnableGestureDetection().
+ ///
+ /// The long press gesture + internal virtual void OnLongPress(LongPressGesture longPress) + { + } + + private void OnControlChildAdd(View child) + { + } + + private void OnControlChildRemove(View child) + { + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/FlexContainer.cs b/src/Tizen.NUI/src/public/BaseComponents/FlexContainer.cs new file mode 100755 index 0000000..05c42a7 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/FlexContainer.cs @@ -0,0 +1,265 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.BaseComponents +{ + /// + /// FlexContainer implements a subset of the flexbox spec (defined by W3C):https://www.w3.org/TR/css3-flexbox/
+ /// It aims at providing a more efficient way to lay out, align and distribute space among items in the container, even when their size is unknown or dynamic.
+ /// FlexContainer has the ability to alter the width and height of its children (i.e. flex items) to fill the available space in the best possible way on different screen sizes.
+ /// FlexContainer can expand items to fill available free space, or shrink them to prevent overflow.
+ ///
+ public class FlexContainer : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal FlexContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.FlexContainer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FlexContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_FlexContainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal class Property + { + internal static readonly int CONTENT_DIRECTION = NDalicPINVOKE.FlexContainer_Property_CONTENT_DIRECTION_get(); + internal static readonly int FLEX_DIRECTION = NDalicPINVOKE.FlexContainer_Property_FLEX_DIRECTION_get(); + internal static readonly int FLEX_WRAP = NDalicPINVOKE.FlexContainer_Property_FLEX_WRAP_get(); + internal static readonly int JUSTIFY_CONTENT = NDalicPINVOKE.FlexContainer_Property_JUSTIFY_CONTENT_get(); + internal static readonly int ALIGN_ITEMS = NDalicPINVOKE.FlexContainer_Property_ALIGN_ITEMS_get(); + internal static readonly int ALIGN_CONTENT = NDalicPINVOKE.FlexContainer_Property_ALIGN_CONTENT_get(); + + } + + /// + /// Enumeration for the instance of child properties belonging to the FlexContainer class. + /// + public class ChildProperty + { + internal static readonly int FLEX = NDalicPINVOKE.FlexContainer_ChildProperty_FLEX_get(); + internal static readonly int ALIGN_SELF = NDalicPINVOKE.FlexContainer_ChildProperty_ALIGN_SELF_get(); + internal static readonly int FLEX_MARGIN = NDalicPINVOKE.FlexContainer_ChildProperty_FLEX_MARGIN_get(); + } + + /// + /// Creates a FlexContainer handle. + /// Calling member functions with an uninitialized handle is not allowed. + /// + public FlexContainer() : this(NDalicPINVOKE.FlexContainer_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Enumeration for the direction of the main axis in the flex container. This determines + /// the direction that flex items are laid out in the flex container. + /// + public enum FlexDirectionType + { + Column, + ColumnReverse, + Row, + RowReverse + } + + /// + /// Enumeration for the primary direction in which content is ordered in the flex container + /// and on which sides the ?�start??and ?�end??are. + /// + public enum ContentDirectionType + { + Inherit, + LTR, + RTL + } + + /// + /// Enumeration for the alignment of the flex items when the items do not use all available + /// space on the main-axis. + /// + public enum Justification + { + JustifyFlexStart, + JustifyCenter, + JustifyFlexEnd, + JustifySpaceBetween, + JustifySpaceAround + } + + /// + /// Enumeration for the alignment of the flex items or lines when the items or lines do not + /// use all the available space on the cross-axis. + /// + public enum Alignment + { + AlignAuto, + AlignFlexStart, + AlignCenter, + AlignFlexEnd, + AlignStretch + } + + /// + /// Enumeration for the wrap type of the flex container when there is no enough room for + /// all the items on one flex line. + /// + public enum WrapType + { + NoWrap, + Wrap + } + + /// + /// The primary direction in which content is ordered + /// + public ContentDirectionType ContentDirection + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.CONTENT_DIRECTION).Get(out temp); + return (ContentDirectionType)temp; + } + set + { + SetProperty(FlexContainer.Property.CONTENT_DIRECTION, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// The direction of the main-axis which determines the direction that flex items are laid out + /// + public FlexDirectionType FlexDirection + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.FLEX_DIRECTION).Get(out temp); + return (FlexDirectionType)temp; + } + set + { + SetProperty(FlexContainer.Property.FLEX_DIRECTION, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Whether the flex items should wrap or not if there is no enough room for them on one flex line + /// + public WrapType FlexWrap + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.FLEX_WRAP).Get(out temp); + return (WrapType)temp; + } + set + { + SetProperty(FlexContainer.Property.FLEX_WRAP, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// The alignment of flex items when the items do not use all available space on the main-axis + /// + public Justification JustifyContent + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.JUSTIFY_CONTENT).Get(out temp); + return (Justification)temp; + } + set + { + SetProperty(FlexContainer.Property.JUSTIFY_CONTENT, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// The alignment of flex items when the items do not use all available space on the cross-axis + /// + public Alignment AlignItems + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.ALIGN_ITEMS).Get(out temp); + return (Alignment)temp; + } + set + { + SetProperty(FlexContainer.Property.ALIGN_ITEMS, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Similar to "alignItems", but it aligns flex lines, so only works when there are multiple lines + /// + public Alignment AlignContent + { + get + { + int temp = 0; + GetProperty(FlexContainer.Property.ALIGN_CONTENT).Get(out temp); + return (Alignment)temp; + } + set + { + SetProperty(FlexContainer.Property.ALIGN_CONTENT, new Tizen.NUI.PropertyValue((int)value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs new file mode 100755 index 0000000..5182c4f --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -0,0 +1,395 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.BaseComponents +{ + using System; + using System.Runtime.InteropServices; + + /// + /// ImageView is a class for displaying an image resource.
+ /// An instance of ImageView can be created using a URL or an Image instance.
+ ///
+ public class ImageView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ImageView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ImageView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImageView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + /// + /// Event arguments of resource ready. + /// + public class ResourceReadyEventArgs : EventArgs + { + private View _view; + + /// + /// The view whose resource is ready. + /// + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + private EventHandler _resourceReadyEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResourceReadyEventCallbackType(IntPtr data); + private ResourceReadyEventCallbackType _resourceReadyEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler ResourceReady + { + add + { + if (_resourceReadyEventHandler == null) + { + _resourceReadyEventCallback = OnResourceReady; + ResourceReadySignal(this).Connect(_resourceReadyEventCallback); + } + + _resourceReadyEventHandler += value; + } + + remove + { + _resourceReadyEventHandler -= value; + + if (_resourceReadyEventHandler == null && ResourceReadySignal(this).Empty() == false) + { + ResourceReadySignal(this).Disconnect(_resourceReadyEventCallback); + } + } + } + + // Callback for View ResourceReady signal + private void OnResourceReady(IntPtr data) + { + ResourceReadyEventArgs e = new ResourceReadyEventArgs(); + if(data != null) + { + e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View; + } + + if (_resourceReadyEventHandler != null) + { + _resourceReadyEventHandler(this, e); + } + } + + //you can override it to clean-up your own resources. + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + _border?.Dispose(); + _border = null; + _nPatchMap?.Dispose(); + _nPatchMap = null; + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ImageView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal class Property + { + internal static readonly int RESOURCE_URL = NDalicPINVOKE.ImageView_Property_RESOURCE_URL_get(); + internal static readonly int IMAGE = NDalicPINVOKE.ImageView_Property_IMAGE_get(); + internal static readonly int PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.ImageView_Property_PRE_MULTIPLIED_ALPHA_get(); + internal static readonly int PIXEL_AREA = NDalicPINVOKE.ImageView_Property_PIXEL_AREA_get(); + } + + /// + /// Creates an initialized ImageView. + /// + public ImageView() : this(NDalicPINVOKE.ImageView_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + /// + /// Creates an initialized ImageView from an URL to an image resource.
+ /// If the string is empty, ImageView will not display anything.
+ ///
+ /// The url of the image resource to display + public ImageView(string url) : this(NDalicPINVOKE.ImageView_New__SWIG_2(url), true) + { + _url = url; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal ImageView(string url, Uint16Pair size) : this(NDalicPINVOKE.ImageView_New__SWIG_3(url, Uint16Pair.getCPtr(size)), true) + { + _url = url; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static ImageView DownCast(BaseHandle handle) + { + ImageView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ImageView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + /// + /// Sets this ImageView from the given URL.
+ /// If the URL is empty, ImageView will not display anything.
+ ///
+ /// The URL to the image resource to display + public void SetImage(string url) + { + _url = url; + NDalicPINVOKE.ImageView_SetImage__SWIG_1(swigCPtr, url); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + internal void SetImage(string url, Uint16Pair size) + { + _url = url; + NDalicPINVOKE.ImageView_SetImage__SWIG_2(swigCPtr, url, Uint16Pair.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ViewResourceReadySignal ResourceReadySignal(View view) { + ViewResourceReadySignal ret = new ViewResourceReadySignal(NDalicPINVOKE.ResourceReadySignal(View.getCPtr(view)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Query if all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ /// true if the resources are loaded and ready, false otherwise.
+ ///
+ public bool IsResourceReady() + { + bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImageView ResourceUrl, type string + /// + public string ResourceUrl + { + get + { + GetProperty(ImageView.Property.RESOURCE_URL).Get(out _url); + return _url; + } + set + { + _url = value; + UpdateImage(); + } + } + + /// + /// ImageView ImageMap, type PropertyMap : string if it is a url, map otherwise + /// + public PropertyMap ImageMap + { + get + { + if (_border == null) + { + PropertyMap temp = new PropertyMap(); + GetProperty(ImageView.Property.IMAGE).Get(temp); + return temp; + } + else + { + return null; + } + } + set + { + if (_border == null) + { + SetProperty(ImageView.Property.IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + } + + /// + /// ImageView PreMultipliedAlpha, type Boolean.
+ /// Image must be initialized.
+ ///
+ public bool PreMultipliedAlpha + { + get + { + bool temp = false; + GetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA).Get(out temp); + return temp; + } + set + { + SetProperty(ImageView.Property.PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ImageView PixelArea, type Vector4 (Animatable property).
+ /// Pixel area is a relative value with the whole image area as [0.0, 0.0, 1.0, 1.0].
+ ///
+ public RelativeVector4 PixelArea + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(ImageView.Property.PIXEL_AREA).Get(temp); + return temp; + } + set + { + SetProperty(ImageView.Property.PIXEL_AREA, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The border of the image in the order: left, right, bottom, top.
+ /// If set, ImageMap will be ignored.
+ /// For N-Patch images only.
+ /// Optional. + ///
+ public Rectangle Border + { + get + { + return _border; + } + set + { + _border = value; + UpdateImage(); + } + } + + /// + /// Get or set whether to draws the borders only(If true).
+ /// If not specified, the default is false.
+ /// For N-Patch images only.
+ /// Optional. + ///
+ public bool BorderOnly + { + get + { + return _borderOnly ?? false; + } + set + { + _borderOnly = value; + UpdateImage(); + } + } + + public bool SynchronosLoading + { + get + { + return _synchronousLoading ?? false; + } + set + { + _synchronousLoading = value; + UpdateImage(); + } + } + + private void UpdateImage() + { + if (_url != null) + { + if (_border != null) + { // for nine-patch image + _nPatchMap = new PropertyMap(); + _nPatchMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); + _nPatchMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); + _nPatchMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); + if (_borderOnly != null) { _nPatchMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } + if (_synchronousLoading != null) _nPatchMap.Add(NpatchImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); + SetProperty(ImageView.Property.IMAGE, new PropertyValue(_nPatchMap)); + } + else if(_synchronousLoading != null) + { // for normal image, with synchronous loading property + PropertyMap imageMap = new PropertyMap(); + imageMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); + imageMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); + imageMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); + SetProperty(ImageView.Property.IMAGE, new PropertyValue(imageMap)); + } + else + { // just for normal image + SetProperty(ImageView.Property.RESOURCE_URL, new PropertyValue(_url)); + } + } + } + + private Rectangle _border = null; + private PropertyMap _nPatchMap = null; + private bool? _synchronousLoading = null; + private bool? _borderOnly = null; + private string _url = null; + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs new file mode 100755 index 0000000..37b8cfd --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/Scrollable.cs @@ -0,0 +1,491 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.BaseComponents +{ + + using System; + using System.Runtime.InteropServices; + + public class Scrollable : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Scrollable(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Scrollable_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Scrollable obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Scrollable(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class StartedEventArgs : EventArgs + { + private Vector2 _vector2; + + public Vector2 Vector2 + { + get + { + return _vector2; + } + set + { + _vector2 = value; + } + } + } + + public class UpdatedEventArgs : EventArgs + { + private Vector2 _vector2; + + public Vector2 Vector2 + { + get + { + return _vector2; + } + set + { + _vector2 = value; + } + } + } + + public class CompletedEventArgs : EventArgs + { + private Vector2 _vector2; + + public Vector2 Vector2 + { + get + { + return _vector2; + } + set + { + _vector2 = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void StartedCallbackDelegate(IntPtr vector2); + private DaliEventHandler _scrollableStartedEventHandler; + private StartedCallbackDelegate _scrollableStartedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void UpdatedCallbackDelegate(IntPtr vector2); + private DaliEventHandler _scrollableUpdatedEventHandler; + private UpdatedCallbackDelegate _scrollableUpdatedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void CompletedCallbackDelegate(IntPtr vector2); + private DaliEventHandler _scrollableCompletedEventHandler; + private CompletedCallbackDelegate _scrollableCompletedCallbackDelegate; + + public event DaliEventHandler ScrollStarted + { + add + { + lock (this) + { + // Restricted to only one listener + if (_scrollableStartedEventHandler == null) + { + _scrollableStartedEventHandler += value; + + _scrollableStartedCallbackDelegate = new StartedCallbackDelegate(OnStarted); + this.ScrollStartedSignal().Connect(_scrollableStartedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_scrollableStartedEventHandler != null) + { + this.ScrollStartedSignal().Disconnect(_scrollableStartedCallbackDelegate); + } + + _scrollableStartedEventHandler -= value; + } + } + } + + private void OnStarted(IntPtr vector2) + { + StartedEventArgs e = new StartedEventArgs(); + + // Populate all members of "e" (StartedEventArgs) with real data + e.Vector2 = Tizen.NUI.Vector2.GetVector2FromPtr(vector2); + + if (_scrollableStartedEventHandler != null) + { + //here we send all data to user event handlers + _scrollableStartedEventHandler(this, e); + } + + } + + public event DaliEventHandler ScrollUpdated + { + add + { + lock (this) + { + // Restricted to only one listener + if (_scrollableUpdatedEventHandler == null) + { + _scrollableUpdatedEventHandler += value; + + _scrollableUpdatedCallbackDelegate = new UpdatedCallbackDelegate(OnUpdated); + this.ScrollUpdatedSignal().Connect(_scrollableUpdatedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_scrollableUpdatedEventHandler != null) + { + this.ScrollUpdatedSignal().Disconnect(_scrollableUpdatedCallbackDelegate); + } + + _scrollableUpdatedEventHandler -= value; + } + } + } + + private void OnUpdated(IntPtr vector2) + { + UpdatedEventArgs e = new UpdatedEventArgs(); + + // Populate all members of "e" (UpdatedEventArgs) with real data + e.Vector2 = Tizen.NUI.Vector2.GetVector2FromPtr(vector2); + + if (_scrollableUpdatedEventHandler != null) + { + //here we send all data to user event handlers + _scrollableUpdatedEventHandler(this, e); + } + + } + + public event DaliEventHandler ScrollCompleted + { + add + { + lock (this) + { + // Restricted to only one listener + if (_scrollableCompletedEventHandler == null) + { + _scrollableCompletedEventHandler += value; + + _scrollableCompletedCallbackDelegate = new CompletedCallbackDelegate(OnCompleted); + this.ScrollCompletedSignal().Connect(_scrollableCompletedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_scrollableCompletedEventHandler != null) + { + this.ScrollCompletedSignal().Disconnect(_scrollableCompletedCallbackDelegate); + } + + _scrollableCompletedEventHandler -= value; + } + } + } + + private void OnCompleted(IntPtr vector2) + { + CompletedEventArgs e = new CompletedEventArgs(); + + // Populate all members of "e" (CompletedEventArgs) with real data + e.Vector2 = Tizen.NUI.Vector2.GetVector2FromPtr(vector2); + + if (_scrollableCompletedEventHandler != null) + { + //here we send all data to user event handlers + _scrollableCompletedEventHandler(this, e); + } + + } + + + public class Property + { + public static readonly int OVERSHOOT_EFFECT_COLOR = NDalicPINVOKE.Scrollable_Property_OVERSHOOT_EFFECT_COLOR_get(); + public static readonly int OVERSHOOT_ANIMATION_SPEED = NDalicPINVOKE.Scrollable_Property_OVERSHOOT_ANIMATION_SPEED_get(); + public static readonly int OVERSHOOT_ENABLED = NDalicPINVOKE.Scrollable_Property_OVERSHOOT_ENABLED_get(); + public static readonly int OVERSHOOT_SIZE = NDalicPINVOKE.Scrollable_Property_OVERSHOOT_SIZE_get(); + public static readonly int SCROLL_TO_ALPHA_FUNCTION = NDalicPINVOKE.Scrollable_Property_SCROLL_TO_ALPHA_FUNCTION_get(); + public static readonly int SCROLL_RELATIVE_POSITION = NDalicPINVOKE.Scrollable_Property_SCROLL_RELATIVE_POSITION_get(); + public static readonly int SCROLL_POSITION_MIN = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MIN_get(); + public static readonly int SCROLL_POSITION_MIN_X = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MIN_X_get(); + public static readonly int SCROLL_POSITION_MIN_Y = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MIN_Y_get(); + public static readonly int SCROLL_POSITION_MAX = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MAX_get(); + public static readonly int SCROLL_POSITION_MAX_X = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MAX_X_get(); + public static readonly int SCROLL_POSITION_MAX_Y = NDalicPINVOKE.Scrollable_Property_SCROLL_POSITION_MAX_Y_get(); + public static readonly int CAN_SCROLL_VERTICAL = NDalicPINVOKE.Scrollable_Property_CAN_SCROLL_VERTICAL_get(); + public static readonly int CAN_SCROLL_HORIZONTAL = NDalicPINVOKE.Scrollable_Property_CAN_SCROLL_HORIZONTAL_get(); + + } + + public Scrollable() : this(NDalicPINVOKE.new_Scrollable__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private bool IsOvershootEnabled() + { + bool ret = NDalicPINVOKE.Scrollable_IsOvershootEnabled(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void SetOvershootEnabled(bool enable) + { + NDalicPINVOKE.Scrollable_SetOvershootEnabled(swigCPtr, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private void SetOvershootEffectColor(Vector4 color) + { + NDalicPINVOKE.Scrollable_SetOvershootEffectColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Vector4 GetOvershootEffectColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Scrollable_GetOvershootEffectColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private void SetOvershootAnimationSpeed(float pixelsPerSecond) + { + NDalicPINVOKE.Scrollable_SetOvershootAnimationSpeed(swigCPtr, pixelsPerSecond); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private float GetOvershootAnimationSpeed() + { + float ret = NDalicPINVOKE.Scrollable_GetOvershootAnimationSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ScrollableSignal ScrollStartedSignal() + { + ScrollableSignal ret = new ScrollableSignal(NDalicPINVOKE.Scrollable_ScrollStartedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ScrollableSignal ScrollUpdatedSignal() + { + ScrollableSignal ret = new ScrollableSignal(NDalicPINVOKE.Scrollable_ScrollUpdatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ScrollableSignal ScrollCompletedSignal() + { + ScrollableSignal ret = new ScrollableSignal(NDalicPINVOKE.Scrollable_ScrollCompletedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Vector4 OvershootEffectColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Scrollable.Property.OVERSHOOT_EFFECT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.OVERSHOOT_EFFECT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + public float OvershootAnimationSpeed + { + get + { + float temp = 0.0f; + GetProperty(Scrollable.Property.OVERSHOOT_ANIMATION_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.OVERSHOOT_ANIMATION_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + public bool OvershootEnabled + { + get + { + bool temp = false; + GetProperty(Scrollable.Property.OVERSHOOT_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.OVERSHOOT_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 OvershootSize + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(Scrollable.Property.OVERSHOOT_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.OVERSHOOT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + public int ScrollToAlphaFunction + { + get + { + int temp = 0; + GetProperty(Scrollable.Property.SCROLL_TO_ALPHA_FUNCTION).Get(out temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.SCROLL_TO_ALPHA_FUNCTION, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollRelativePosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(Scrollable.Property.SCROLL_RELATIVE_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.SCROLL_RELATIVE_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPositionMin + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(Scrollable.Property.SCROLL_POSITION_MIN).Get(temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.SCROLL_POSITION_MIN, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPositionMax + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(Scrollable.Property.SCROLL_POSITION_MAX).Get(temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.SCROLL_POSITION_MAX, new Tizen.NUI.PropertyValue(value)); + } + } + public bool CanScrollVertical + { + get + { + bool temp = false; + GetProperty(Scrollable.Property.CAN_SCROLL_VERTICAL).Get(out temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.CAN_SCROLL_VERTICAL, new Tizen.NUI.PropertyValue(value)); + } + } + public bool CanScrollHorizontal + { + get + { + bool temp = false; + GetProperty(Scrollable.Property.CAN_SCROLL_HORIZONTAL).Get(out temp); + return temp; + } + set + { + SetProperty(Scrollable.Property.CAN_SCROLL_HORIZONTAL, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/TableView.cs b/src/Tizen.NUI/src/public/BaseComponents/TableView.cs new file mode 100755 index 0000000..48b57d3 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/TableView.cs @@ -0,0 +1,705 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; + +namespace Tizen.NUI.BaseComponents +{ + + /// + /// TableView is a layout container for aligning child actors in a grid like layout.
+ /// TableView constrains the x and y position and width and height of the child actors.
+ /// z position and depth are left intact so that 3D model actors can also be laid out + /// in a grid without loosing their depth scaling.
+ ///
+ public class TableView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TableView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TableView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TableView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TableView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal class Property + { + internal static readonly int ROWS = NDalicPINVOKE.TableView_Property_ROWS_get(); + internal static readonly int COLUMNS = NDalicPINVOKE.TableView_Property_COLUMNS_get(); + internal static readonly int CELL_PADDING = NDalicPINVOKE.TableView_Property_CELL_PADDING_get(); + internal static readonly int LAYOUT_ROWS = NDalicPINVOKE.TableView_Property_LAYOUT_ROWS_get(); + internal static readonly int LAYOUT_COLUMNS = NDalicPINVOKE.TableView_Property_LAYOUT_COLUMNS_get(); + } + + internal class ChildProperty + { + internal static readonly int CELL_INDEX = NDalicPINVOKE.TableView_ChildProperty_CELL_INDEX_get(); + internal static readonly int ROW_SPAN = NDalicPINVOKE.TableView_ChildProperty_ROW_SPAN_get(); + internal static readonly int COLUMN_SPAN = NDalicPINVOKE.TableView_ChildProperty_COLUMN_SPAN_get(); + internal static readonly int CELL_HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TableView_ChildProperty_CELL_HORIZONTAL_ALIGNMENT_get(); + internal static readonly int CELL_VERTICAL_ALIGNMENT = NDalicPINVOKE.TableView_ChildProperty_CELL_VERTICAL_ALIGNMENT_get(); + } + + /// + /// Class to specify layout position for child view. + /// + public class CellPosition : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal CellPosition(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CellPosition obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~CellPosition() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TableView_CellPosition(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Constructor. + /// + /// The row index initialized + /// The column index initialized + /// The row span initialized + /// The column span initialized + public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan, uint columnSpan) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_0(rowIndex, columnIndex, rowSpan, columnSpan), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor to initialise values to defaults for convenience. + /// + /// The row index initialized + /// The column index initialized + /// The row span initialized + public CellPosition(uint rowIndex, uint columnIndex, uint rowSpan) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_1(rowIndex, columnIndex, rowSpan), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor to initialise values to defaults for convenience. + /// + /// The row index initialized + /// The column index initialized + public CellPosition(uint rowIndex, uint columnIndex) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_2(rowIndex, columnIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor to initialise values to defaults for convenience. + /// + /// The row index initialized + public CellPosition(uint rowIndex) : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_3(rowIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Default constructor + /// + public CellPosition() : this(NDalicPINVOKE.new_TableView_CellPosition__SWIG_4(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Index of row + /// + public uint rowIndex + { + set + { + NDalicPINVOKE.TableView_CellPosition_rowIndex_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TableView_CellPosition_rowIndex_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Index of column + /// + public uint columnIndex + { + set + { + NDalicPINVOKE.TableView_CellPosition_columnIndex_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TableView_CellPosition_columnIndex_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Span of row + /// + public uint rowSpan + { + set + { + NDalicPINVOKE.TableView_CellPosition_rowSpan_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TableView_CellPosition_rowSpan_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Span of column + /// + public uint columnSpan + { + set + { + NDalicPINVOKE.TableView_CellPosition_columnSpan_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TableView_CellPosition_columnSpan_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + /// + /// Creates the TableView view. + /// + /// initialRows for the table + /// initialColumns for the table + public TableView(uint initialRows, uint initialColumns) : this(NDalicPINVOKE.TableView_New(initialRows, initialColumns), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Copy constructor. Creates another handle that points to the same real object. + /// + /// Handle to copy from + public TableView(TableView handle) : this(NDalicPINVOKE.new_TableView__SWIG_1(TableView.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static TableView DownCast(BaseHandle handle) + { + TableView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TableView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds a child to the table.
+ /// If the row or column index is outside the table, the table gets resized bigger.
+ ///
+ /// The child to add + /// The position for the child + /// Tue if the addition succeeded and false if the cell is already occupied + public bool AddChild(View child, TableView.CellPosition position) + { + bool ret = NDalicPINVOKE.TableView_AddChild(swigCPtr, View.getCPtr(child), TableView.CellPosition.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns a child from the given layout position. + /// + /// The position in the table + /// Child that was in the cell or an uninitialized handle + public View GetChildAt(TableView.CellPosition position) + { + IntPtr cPtr = NDalicPINVOKE.TableView_GetChildAt(swigCPtr, TableView.CellPosition.getCPtr(position)); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Removes a child from the given layout position. + /// + /// The position for the child to remove + /// Child that was removed or an uninitialized handle + public View RemoveChildAt(TableView.CellPosition position) + { + IntPtr cPtr = NDalicPINVOKE.TableView_RemoveChildAt(swigCPtr, TableView.CellPosition.getCPtr(position)); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Finds the child's layout position. + /// + /// The child to search for + /// The position for the child + /// true if the child was included in this TableView + public bool FindChildPosition(View child, TableView.CellPosition position) + { + bool ret = NDalicPINVOKE.TableView_FindChildPosition(swigCPtr, View.getCPtr(child), TableView.CellPosition.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Inserts a new row to given index. + /// + /// The rowIndex of the new row + public void InsertRow(uint rowIndex) + { + NDalicPINVOKE.TableView_InsertRow(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Deletes a row from the given index.
+ /// Removed elements are deleted.
+ ///
+ /// The rowIndex of the row to delete + public void DeleteRow(uint rowIndex) + { + NDalicPINVOKE.TableView_DeleteRow__SWIG_0(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Inserts a new column to the given index. + /// + /// The columnIndex of the new column + public void InsertColumn(uint columnIndex) + { + NDalicPINVOKE.TableView_InsertColumn(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Deletes a column from the given index.
+ /// Removed elements are deleted.
+ ///
+ /// The columnIndex of the column to delete + public void DeleteColumn(uint columnIndex) + { + NDalicPINVOKE.TableView_DeleteColumn__SWIG_0(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resizes the TableView. + /// + /// The rows for the table + /// The columns for the table + public void Resize(uint rows, uint columns) + { + NDalicPINVOKE.TableView_Resize__SWIG_0(swigCPtr, rows, columns); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets horizontal and vertical padding between cells. + /// + /// Width and height + public void SetCellPadding(Size2D padding) + { + NDalicPINVOKE.TableView_SetCellPadding(swigCPtr, Size2D.getCPtr(padding)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the current padding as width and height. + /// + /// The current padding as width and height + public Vector2 GetCellPadding() + { + Vector2 ret = new Vector2(NDalicPINVOKE.TableView_GetCellPadding(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Specifies this row as fitting its height to its children. + /// + /// The row to set + public void SetFitHeight(uint rowIndex) + { + NDalicPINVOKE.TableView_SetFitHeight(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Checks if the row is a fit row. + /// + /// The row to check + /// true if the row is fit + public bool IsFitHeight(uint rowIndex) + { + bool ret = NDalicPINVOKE.TableView_IsFitHeight(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Specifies this column as fitting its width to its children. + /// + /// The column to set + public void SetFitWidth(uint columnIndex) + { + NDalicPINVOKE.TableView_SetFitWidth(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Checks if the column is a fit column. + /// + /// The column to check + /// true if the column is fit + public bool IsFitWidth(uint columnIndex) + { + bool ret = NDalicPINVOKE.TableView_IsFitWidth(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a row to have fixed height.
+ /// Setting a fixed height of 0 has no effect.
+ ///
+ /// The rowIndex for row with fixed height + /// The height in world coordinate units + public void SetFixedHeight(uint rowIndex, float height) + { + NDalicPINVOKE.TableView_SetFixedHeight(swigCPtr, rowIndex, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets a row's fixed height. + /// + /// The row index with fixed height + /// height The height in world coordinate units + public float GetFixedHeight(uint rowIndex) + { + float ret = NDalicPINVOKE.TableView_GetFixedHeight(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a row to have relative height. Relative height means percentage of + /// the remainder of the table height after subtracting Padding and Fixed height rows.
+ /// Setting a relative height of 0 has no effect.
+ ///
+ /// The rowIndex for row with relative height + /// The height percentage between 0.0f and 1.0f + public void SetRelativeHeight(uint rowIndex, float heightPercentage) + { + NDalicPINVOKE.TableView_SetRelativeHeight(swigCPtr, rowIndex, heightPercentage); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets a row's relative height. + /// + /// The row index with relative height + /// Height in percentage units, between 0.0f and 1.0f + public float GetRelativeHeight(uint rowIndex) + { + float ret = NDalicPINVOKE.TableView_GetRelativeHeight(swigCPtr, rowIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a column to have fixed width.
+ /// Setting a fixed width of 0 has no effect.
+ ///
+ /// The columnIndex for column with fixed width + /// The width in world coordinate units + public void SetFixedWidth(uint columnIndex, float width) + { + NDalicPINVOKE.TableView_SetFixedWidth(swigCPtr, columnIndex, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets a column's fixed width. + /// + /// The column index with fixed width + /// Width in world coordinate units + public float GetFixedWidth(uint columnIndex) + { + float ret = NDalicPINVOKE.TableView_GetFixedWidth(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a column to have relative width. Relative width means percentage of + /// the remainder of table width after subtracting Padding and Fixed width columns.
+ /// Setting a relative width of 0 has no effect.
+ ///
+ /// The columnIndex for column with fixed width + /// The widthPercentage between 0.0f and 1.0f + public void SetRelativeWidth(uint columnIndex, float widthPercentage) + { + NDalicPINVOKE.TableView_SetRelativeWidth(swigCPtr, columnIndex, widthPercentage); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets a column's relative width. + /// + /// The column index with relative width + /// Width in percentage units, between 0.0f and 1.0f + public float GetRelativeWidth(uint columnIndex) + { + float ret = NDalicPINVOKE.TableView_GetRelativeWidth(swigCPtr, columnIndex); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the alignment on a cell.
+ /// Cells without calling this function have the default values of LEFT and TOP respectively.
+ ///
+ /// The cell to set alignment on + /// The horizontal alignment + /// The vertical alignment + public void SetCellAlignment(TableView.CellPosition position, HorizontalAlignmentType horizontal, VerticalAlignmentType vertical) + { + NDalicPINVOKE.TableView_SetCellAlignment(swigCPtr, TableView.CellPosition.getCPtr(position), (int)horizontal, (int)vertical); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Enumeration for describing how the size of a row / column has been set. + /// + public enum LayoutPolicy + { + Fixed, + Relative, + Fill, + Fit + } + + /// + /// the amount of rows in the table. + /// + public int Rows + { + get + { + int temp = 0; + GetProperty(TableView.Property.ROWS).Get(out temp); + return temp; + } + set + { + SetProperty(TableView.Property.ROWS, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// the amount of columns in the table. + /// + public int Columns + { + get + { + int temp = 0; + GetProperty(TableView.Property.COLUMNS).Get(out temp); + return temp; + } + set + { + SetProperty(TableView.Property.COLUMNS, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// padding between cells. + /// + public Vector2 CellPadding + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(TableView.Property.CELL_PADDING).Get(temp); + return temp; + } + set + { + SetProperty(TableView.Property.CELL_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The number of layout rows + /// + public PropertyMap LayoutRows + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TableView.Property.LAYOUT_ROWS).Get(temp); + return temp; + } + set + { + SetProperty(TableView.Property.LAYOUT_ROWS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The number of layout columns + /// + public PropertyMap LayoutColumns + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TableView.Property.LAYOUT_COLUMNS).Get(temp); + return temp; + } + set + { + SetProperty(TableView.Property.LAYOUT_COLUMNS, new Tizen.NUI.PropertyValue(value)); + } + } + + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs new file mode 100755 index 0000000..5ccab67 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/TextEditor.cs @@ -0,0 +1,1375 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +extern alias TizenSystemSettings; +using TizenSystemSettings.Tizen.System; +namespace Tizen.NUI.BaseComponents +{ + + using System; + using System.Runtime.InteropServices; + using System.Globalization; + + /// + /// A control which provides a multi-line editable text editor. + /// + public class TextEditor : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private string textEditorTextSid = null; + private string textEditorPlaceHolderTextSid = null; + private bool systemlangTextFlag = false; + + internal TextEditor(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextEditor_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextEditor obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextEditor(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Event arguments that passed via TextChanged signal. + /// + public class TextChangedEventArgs : EventArgs + { + private TextEditor _textEditor; + + /// + /// TextEditor - is the texteditor control which has the text contents changed. + /// + public TextEditor TextEditor + { + get + { + return _textEditor; + } + set + { + _textEditor = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void TextChangedCallbackDelegate(IntPtr textEditor); + private EventHandler _textEditorTextChangedEventHandler; + private TextChangedCallbackDelegate _textEditorTextChangedCallbackDelegate; + + /// + /// Event for TextChanged signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. TextChanged signal is emitted when the text changes.
+ ///
+ public event EventHandler TextChanged + { + add + { + if (_textEditorTextChangedEventHandler == null) + { + _textEditorTextChangedCallbackDelegate = (OnTextChanged); + TextChangedSignal().Connect(_textEditorTextChangedCallbackDelegate); + } + _textEditorTextChangedEventHandler += value; + } + remove + { + _textEditorTextChangedEventHandler -= value; + if (_textEditorTextChangedEventHandler == null && TextChangedSignal().Empty() == false) + { + TextChangedSignal().Disconnect(_textEditorTextChangedCallbackDelegate); + } + } + } + + private void OnTextChanged(IntPtr textEditor) + { + TextChangedEventArgs e = new TextChangedEventArgs(); + + // Populate all members of "e" (TextChangedEventArgs) with real data + e.TextEditor = Registry.GetManagedBaseHandleFromNativePtr(textEditor) as TextEditor; + + if (_textEditorTextChangedEventHandler != null) + { + //here we send all data to user event handlers + _textEditorTextChangedEventHandler(this, e); + } + + } + + /// + /// Event arguments that passed via ScrollStateChanged signal. + /// + public class ScrollStateChangedEventArgs : EventArgs + { + private TextEditor _textEditor; + private ScrollState _scrollState; + + /// + /// TextEditor - is the texteditor control which has the scroll state changed. + /// + public TextEditor TextEditor + { + get + { + return _textEditor; + } + set + { + _textEditor = value; + } + } + + /// + /// ScrollState - is the texteditor control scroll state. + /// + public ScrollState ScrollState + { + get + { + return _scrollState; + } + set + { + _scrollState = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ScrollStateChangedCallbackDelegate(IntPtr textEditor, ScrollState state); + private EventHandler _textEditorScrollStateChangedEventHandler; + private ScrollStateChangedCallbackDelegate _textEditorScrollStateChangedCallbackDelegate; + + /// + /// Event for ScrollStateChanged signal which can be used to subscribe/unsubscribe the event handler + /// provided by the user. ScrollStateChanged signal is emitted when the scroll state changes.
+ ///
+ public event EventHandler ScrollStateChanged + { + add + { + if (_textEditorScrollStateChangedEventHandler == null) + { + _textEditorScrollStateChangedCallbackDelegate = OnScrollStateChanged; + ScrollStateChangedSignal(this).Connect(_textEditorScrollStateChangedCallbackDelegate); + } + _textEditorScrollStateChangedEventHandler += value; + } + remove + { + _textEditorScrollStateChangedEventHandler -= value; + if (_textEditorScrollStateChangedEventHandler == null && ScrollStateChangedSignal(this).Empty() == false) + { + ScrollStateChangedSignal(this).Disconnect(_textEditorScrollStateChangedCallbackDelegate); + } + } + } + + private void OnScrollStateChanged(IntPtr textEditor, ScrollState state) + { + ScrollStateChangedEventArgs e = new ScrollStateChangedEventArgs(); + + if (textEditor != null) + { + // Populate all members of "e" (ScrollStateChangedEventArgs) with real data + e.TextEditor = Registry.GetManagedBaseHandleFromNativePtr(textEditor) as TextEditor; + e.ScrollState = state; + } + + if (_textEditorScrollStateChangedEventHandler != null) + { + //here we send all data to user event handlers + _textEditorScrollStateChangedEventHandler(this, e); + } + } + + internal class Property + { + internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextEditor_Property_RENDERING_BACKEND_get(); + internal static readonly int TEXT = NDalicPINVOKE.TextEditor_Property_TEXT_get(); + internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextEditor_Property_TEXT_COLOR_get(); + internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextEditor_Property_FONT_FAMILY_get(); + internal static readonly int FONT_STYLE = NDalicPINVOKE.TextEditor_Property_FONT_STYLE_get(); + internal static readonly int POINT_SIZE = NDalicPINVOKE.TextEditor_Property_POINT_SIZE_get(); + internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextEditor_Property_HORIZONTAL_ALIGNMENT_get(); + internal static readonly int SCROLL_THRESHOLD = NDalicPINVOKE.TextEditor_Property_SCROLL_THRESHOLD_get(); + internal static readonly int SCROLL_SPEED = NDalicPINVOKE.TextEditor_Property_SCROLL_SPEED_get(); + internal static readonly int PRIMARY_CURSOR_COLOR = NDalicPINVOKE.TextEditor_Property_PRIMARY_CURSOR_COLOR_get(); + internal static readonly int SECONDARY_CURSOR_COLOR = NDalicPINVOKE.TextEditor_Property_SECONDARY_CURSOR_COLOR_get(); + internal static readonly int ENABLE_CURSOR_BLINK = NDalicPINVOKE.TextEditor_Property_ENABLE_CURSOR_BLINK_get(); + internal static readonly int CURSOR_BLINK_INTERVAL = NDalicPINVOKE.TextEditor_Property_CURSOR_BLINK_INTERVAL_get(); + internal static readonly int CURSOR_BLINK_DURATION = NDalicPINVOKE.TextEditor_Property_CURSOR_BLINK_DURATION_get(); + internal static readonly int CURSOR_WIDTH = NDalicPINVOKE.TextEditor_Property_CURSOR_WIDTH_get(); + internal static readonly int GRAB_HANDLE_IMAGE = NDalicPINVOKE.TextEditor_Property_GRAB_HANDLE_IMAGE_get(); + internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = NDalicPINVOKE.TextEditor_Property_GRAB_HANDLE_PRESSED_IMAGE_get(); + internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = NDalicPINVOKE.TextEditor_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HIGHLIGHT_COLOR = NDalicPINVOKE.TextEditor_Property_SELECTION_HIGHLIGHT_COLOR_get(); + internal static readonly int DECORATION_BOUNDING_BOX = NDalicPINVOKE.TextEditor_Property_DECORATION_BOUNDING_BOX_get(); + internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextEditor_Property_ENABLE_MARKUP_get(); + internal static readonly int INPUT_COLOR = NDalicPINVOKE.TextEditor_Property_INPUT_COLOR_get(); + internal static readonly int INPUT_FONT_FAMILY = NDalicPINVOKE.TextEditor_Property_INPUT_FONT_FAMILY_get(); + internal static readonly int INPUT_FONT_STYLE = NDalicPINVOKE.TextEditor_Property_INPUT_FONT_STYLE_get(); + internal static readonly int INPUT_POINT_SIZE = NDalicPINVOKE.TextEditor_Property_INPUT_POINT_SIZE_get(); + internal static readonly int LINE_SPACING = NDalicPINVOKE.TextEditor_Property_LINE_SPACING_get(); + internal static readonly int INPUT_LINE_SPACING = NDalicPINVOKE.TextEditor_Property_INPUT_LINE_SPACING_get(); + internal static readonly int UNDERLINE = NDalicPINVOKE.TextEditor_Property_UNDERLINE_get(); + internal static readonly int INPUT_UNDERLINE = NDalicPINVOKE.TextEditor_Property_INPUT_UNDERLINE_get(); + internal static readonly int SHADOW = NDalicPINVOKE.TextEditor_Property_SHADOW_get(); + internal static readonly int INPUT_SHADOW = NDalicPINVOKE.TextEditor_Property_INPUT_SHADOW_get(); + internal static readonly int EMBOSS = NDalicPINVOKE.TextEditor_Property_EMBOSS_get(); + internal static readonly int INPUT_EMBOSS = NDalicPINVOKE.TextEditor_Property_INPUT_EMBOSS_get(); + internal static readonly int OUTLINE = NDalicPINVOKE.TextEditor_Property_OUTLINE_get(); + internal static readonly int INPUT_OUTLINE = NDalicPINVOKE.TextEditor_Property_INPUT_OUTLINE_get(); + internal static readonly int SMOOTH_SCROLL = NDalicManualPINVOKE.TextEditor_Property_SMOOTH_SCROLL_get(); + internal static readonly int SMOOTH_SCROLL_DURATION = NDalicManualPINVOKE.TextEditor_Property_SMOOTH_SCROLL_DURATION_get(); + internal static readonly int ENABLE_SCROLL_BAR = NDalicManualPINVOKE.TextEditor_Property_ENABLE_SCROLL_BAR_get(); + internal static readonly int SCROLL_BAR_SHOW_DURATION = NDalicManualPINVOKE.TextEditor_Property_SCROLL_BAR_SHOW_DURATION_get(); + internal static readonly int SCROLL_BAR_FADE_DURATION = NDalicManualPINVOKE.TextEditor_Property_SCROLL_BAR_FADE_DURATION_get(); + internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextEditor_Property_PIXEL_SIZE_get(); + internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextEditor_Property_LINE_COUNT_get(); + internal static readonly int PLACEHOLDER_TEXT = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_get(); + internal static readonly int PLACEHOLDER_TEXT_COLOR = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_TEXT_COLOR_get(); + internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextEditor_Property_ENABLE_SELECTION_get(); + internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextEditor_Property_PLACEHOLDER_get(); + internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextEditor_Property_LINE_WRAP_MODE_get(); + } + + internal class InputStyle + { + internal enum Mask + { + None = 0x0000, + Color = 0x0001, + FontFamily = 0x0002, + PointSize = 0x0004, + FontStyle = 0x0008, + LineSpacing = 0x0010, + Underline = 0x0020, + Shadow = 0x0040, + Emboss = 0x0080, + Outline = 0x0100 + } + } + + /// + /// Creates the TextEditor control. + /// + public TextEditor() : this(NDalicPINVOKE.TextEditor_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal TextEditor(TextEditor handle) : this(NDalicPINVOKE.new_TextEditor__SWIG_1(TextEditor.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static TextEditor DownCast(BaseHandle handle) + { + TextEditor ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextEditor; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TextEditorSignal TextChangedSignal() + { + TextEditorSignal ret = new TextEditorSignal(NDalicPINVOKE.TextEditor_TextChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ScrollStateChangedSignal ScrollStateChangedSignal(TextEditor textEditor) + { + ScrollStateChangedSignal ret = new ScrollStateChangedSignal(NDalicManualPINVOKE.TextEditor_ScrollStateChangedSignal(TextEditor.getCPtr(textEditor)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t InputStyleChangedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextEditor_Dali__Toolkit__TextEditor__InputStyle__MaskF_t(NDalicPINVOKE.TextEditor_InputStyleChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// TranslatableText property.
+ /// The text can be set SID value.
+ ///
+ /// + /// ResourceManager about multilingual is null + /// + public string TranslatableText + { + get + { + return textEditorTextSid; + } + set + { + if (NUIApplication.MultilingualResourceManager == null) + { + throw new ArgumentNullException("ResourceManager about multilingual is null"); + } + textEditorTextSid = value; + Text = SetTranslatable(textEditorTextSid); + } + } + /// + /// TranslatablePlaceholderText property.
+ /// The text can be set SID value.
+ ///
+ /// + /// ResourceManager about multilingual is null + /// + public string TranslatablePlaceholderText + { + get + { + return textEditorPlaceHolderTextSid; + } + set + { + if (NUIApplication.MultilingualResourceManager == null) + { + throw new ArgumentNullException("ResourceManager about multilingual is null"); + } + textEditorPlaceHolderTextSid = value; + PlaceholderText = SetTranslatable(textEditorPlaceHolderTextSid); + } + } + private string SetTranslatable(string textEditorSid) + { + string translatableText = null; + translatableText = NUIApplication.MultilingualResourceManager?.GetString(textEditorSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); + if (translatableText != null) + { + if (systemlangTextFlag == false) + { + SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; + systemlangTextFlag = true; + } + return translatableText; + } + else + { + translatableText = ""; + return translatableText; + } + } + private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) + { + if (textEditorTextSid != null) + { + Text = NUIApplication.MultilingualResourceManager?.GetString(textEditorTextSid, new CultureInfo(e.Value.Replace("_", "-"))); + } + if (textEditorPlaceHolderTextSid != null) + { + PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textEditorPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-"))); + } + } + /// Text property. + ///
+ public string Text + { + get + { + string temp; + GetProperty(TextEditor.Property.TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Text color property. + /// + public Vector4 TextColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.TEXT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Font family property. + /// + public string FontFamily + { + get + { + string temp; + GetProperty(TextEditor.Property.FONT_FAMILY).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Font style property. + /// + public PropertyMap FontStyle + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.FONT_STYLE).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.FONT_STYLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Point size property. + /// + public float PointSize + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.POINT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.POINT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Horizontal alignment property. + /// + public HorizontalAlignment HorizontalAlignment + { + get + { + string temp; + if (GetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("HorizontalAlignment get error!"); + } + + switch (temp) + { + case "BEGIN": + return HorizontalAlignment.Begin; + case "CENTER": + return HorizontalAlignment.Center; + case "END": + return HorizontalAlignment.End; + default: + return HorizontalAlignment.Begin; + } + } + set + { + string valueToString = ""; + switch (value) + { + case HorizontalAlignment.Begin: + { + valueToString = "BEGIN"; + break; + } + case HorizontalAlignment.Center: + { + valueToString = "CENTER"; + break; + } + case HorizontalAlignment.End: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextEditor.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// Scroll threshold property. + /// + public float ScrollThreshold + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.SCROLL_THRESHOLD).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SCROLL_THRESHOLD, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Scroll speed property. + /// + public float ScrollSpeed + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.SCROLL_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Primary cursor color property. + /// + public Vector4 PrimaryCursorColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.PRIMARY_CURSOR_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.PRIMARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SecondaryCursorColor property. + /// + public Vector4 SecondaryCursorColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.SECONDARY_CURSOR_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SECONDARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableCursorBlink property. + /// + public bool EnableCursorBlink + { + get + { + bool temp = false; + GetProperty(TextEditor.Property.ENABLE_CURSOR_BLINK).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.ENABLE_CURSOR_BLINK, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorBlinkInterval property. + /// + public float CursorBlinkInterval + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.CURSOR_BLINK_INTERVAL).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.CURSOR_BLINK_INTERVAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorBlinkDuration property. + /// + public float CursorBlinkDuration + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.CURSOR_BLINK_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.CURSOR_BLINK_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorWidth property. + /// + public int CursorWidth + { + get + { + int temp = 0; + GetProperty(TextEditor.Property.CURSOR_WIDTH).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.CURSOR_WIDTH, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// GrabHandleImage property. + /// + public string GrabHandleImage + { + get + { + string temp; + GetProperty(TextEditor.Property.GRAB_HANDLE_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.GRAB_HANDLE_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// GrabHandlePressedImage property. + /// + public string GrabHandlePressedImage + { + get + { + string temp; + GetProperty(TextEditor.Property.GRAB_HANDLE_PRESSED_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.GRAB_HANDLE_PRESSED_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleImageLeft property. + /// + public PropertyMap SelectionHandleImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleImageRight property. + /// + public PropertyMap SelectionHandleImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandlePressedImageLeft property. + /// + public PropertyMap SelectionHandlePressedImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandlePressedImageRight property. + /// + public PropertyMap SelectionHandlePressedImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleMarkerImageLeft property. + /// + public PropertyMap SelectionHandleMarkerImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleMarkerImageRight property. + /// + public PropertyMap SelectionHandleMarkerImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHighlightColor property. + /// + public Vector4 SelectionHighlightColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.SELECTION_HIGHLIGHT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SELECTION_HIGHLIGHT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// DecorationBoundingBox property. + /// + public Rectangle DecorationBoundingBox + { + get + { + Rectangle temp = new Rectangle(0, 0, 0, 0); + GetProperty(TextEditor.Property.DECORATION_BOUNDING_BOX).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.DECORATION_BOUNDING_BOX, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableMarkup property. + /// + public bool EnableMarkup + { + get + { + bool temp = false; + GetProperty(TextEditor.Property.ENABLE_MARKUP).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputColor property. + /// + public Vector4 InputColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.INPUT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputFontFamily property. + /// + public string InputFontFamily + { + get + { + string temp; + GetProperty(TextEditor.Property.INPUT_FONT_FAMILY).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_FONT_FAMILY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputFontStyle property. + /// + public PropertyMap InputFontStyle + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.INPUT_FONT_STYLE).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_FONT_STYLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputPointSize property. + /// + public float InputPointSize + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.INPUT_POINT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_POINT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// LineSpacing property. + /// + public float LineSpacing + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.LINE_SPACING).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.LINE_SPACING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputLineSpacing property. + /// + public float InputLineSpacing + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.INPUT_LINE_SPACING).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_LINE_SPACING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Underline property. + /// + public PropertyMap Underline + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.UNDERLINE).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.UNDERLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputUnderline property. + /// + public string InputUnderline + { + get + { + string temp; + GetProperty(TextEditor.Property.INPUT_UNDERLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_UNDERLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Shadow property. + /// + public PropertyMap Shadow + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextEditor.Property.SHADOW).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputShadow property. + /// + public string InputShadow + { + get + { + string temp; + GetProperty(TextEditor.Property.INPUT_SHADOW).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Emboss property. + /// + public string Emboss + { + get + { + string temp; + GetProperty(TextEditor.Property.EMBOSS).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.EMBOSS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputEmboss property. + /// + public string InputEmboss + { + get + { + string temp; + GetProperty(TextEditor.Property.INPUT_EMBOSS).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_EMBOSS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Outline property. + /// + public string Outline + { + get + { + string temp; + GetProperty(TextEditor.Property.OUTLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.OUTLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputOutline property. + /// + public string InputOutline + { + get + { + string temp; + GetProperty(TextEditor.Property.INPUT_OUTLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.INPUT_OUTLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SmoothScroll property. + /// + public bool SmoothScroll + { + get + { + bool temp = false; + GetProperty(TextEditor.Property.SMOOTH_SCROLL).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SMOOTH_SCROLL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SmoothScrollDuration property. + /// + public float SmoothScrollDuration + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.SMOOTH_SCROLL_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SMOOTH_SCROLL_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableScrollBar property. + /// + public bool EnableScrollBar + { + get + { + bool temp = false; + GetProperty(TextEditor.Property.ENABLE_SCROLL_BAR).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.ENABLE_SCROLL_BAR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ScrollBarShowDuration property. + /// + public float ScrollBarShowDuration + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.SCROLL_BAR_SHOW_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SCROLL_BAR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ScrollBarFadeDuration property. + /// + public float ScrollBarFadeDuration + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.SCROLL_BAR_FADE_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.SCROLL_BAR_FADE_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PixelSize property. + /// + public float PixelSize + { + get + { + float temp = 0.0f; + GetProperty(TextEditor.Property.PIXEL_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The line count of text. + /// + public int LineCount + { + get + { + int temp = 0; + GetProperty(TextEditor.Property.LINE_COUNT).Get(out temp); + return temp; + } + } + + /// + /// The text to display when the TextEditor is empty and inactive. + /// + public string PlaceholderText + { + get + { + string temp; + GetProperty(TextEditor.Property.PLACEHOLDER_TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.PLACEHOLDER_TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The placeholder-text color. + /// + public Color PlaceholderTextColor + { + get + { + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextEditor.Property.PLACEHOLDER_TEXT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.PLACEHOLDER_TEXT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Enable selection property. + /// + public bool EnableSelection + { + get + { + bool temp = false; + GetProperty(TextEditor.Property.ENABLE_SELECTION).Get(out temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.ENABLE_SELECTION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Placeholder property. + /// Gets/Sets the placeholder : text, color, font family, font style, point size, and pixel size. + /// + /// + /// The following example demonstrates how to set the placeholder property. + /// + /// PropertyMap propertyMap = new PropertyMap(); + /// propertyMap.Add("placeholderText", new PropertyValue("Setting Placeholder Text")); + /// propertyMap.Add("placeholderTextFocused", new PropertyValue("Setting Placeholder Text Focused")); + /// propertyMap.Add("placeholderColor", new PropertyValue(Color.Red)); + /// propertyMap.Add("placeholderFontFamily", new PropertyValue("Arial")); + /// propertyMap.Add("placeholderPointSize", new PropertyValue(12.0f)); + /// + /// PropertyMap fontStyleMap = new PropertyMap(); + /// fontStyleMap.Add("weight", new PropertyValue("bold")); + /// fontStyleMap.Add("width", new PropertyValue("condensed")); + /// fontStyleMap.Add("slant", new PropertyValue("italic")); + /// propertyMap.Add("placeholderFontStyle", new PropertyValue(fontStyleMap)); + /// + /// TextEditor editor = new TextEditor(); + /// editor.Placeholder = propertyMap; + /// + /// + public Tizen.NUI.PropertyMap Placeholder + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(TextEditor.Property.PLACEHOLDER).Get(temp); + return temp; + } + set + { + SetProperty(TextEditor.Property.PLACEHOLDER, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// LineWrapMode property.
+ /// line wrap mode when the text lines over layout width.
+ ///
+ public LineWrapMode LineWrapMode + { + get + { + string temp; + if(GetProperty(TextEditor.Property.LINE_WRAP_MODE).Get(out temp) == false) + { + NUILog.Error("LineWrapMode get error!"); + } + switch (temp) + { + case "WORD": + return LineWrapMode.Word; + case "CHARACTER": + return LineWrapMode.Character; + default: + return LineWrapMode.Word; + } + } + set + { + string temp = ""; + switch (value) + { + case LineWrapMode.Word: + { + temp = "WORD"; + break; + } + case LineWrapMode.Character: + { + temp = "CHARACTER"; + break; + } + } + SetProperty(TextEditor.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextField.cs b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs new file mode 100755 index 0000000..ba7d45c --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/TextField.cs @@ -0,0 +1,1359 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +extern alias TizenSystemSettings; +using TizenSystemSettings.Tizen.System; +namespace Tizen.NUI.BaseComponents +{ + + using System; + using System.Runtime.InteropServices; + using System.Globalization; + /// + /// A control which provides a single-line editable text field. + /// + public class TextField : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private string textFieldTextSid = null; + private string textFieldPlaceHolderTextSid = null; + private bool systemlangTextFlag = false; + + internal TextField(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextField_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextField obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + DisposeQueue.Instance.Add(this); + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextField(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Text changed event arguments. + /// + public class TextChangedEventArgs : EventArgs + { + private TextField _textField; + + /// + /// TextField. + /// + public TextField TextField + { + get + { + return _textField; + } + set + { + _textField = value; + } + } + } + + /// + /// MaxLengthReached event arguments. + /// + public class MaxLengthReachedEventArgs : EventArgs + { + private TextField _textField; + + /// + /// TextField. + /// + public TextField TextField + { + get + { + return _textField; + } + set + { + _textField = value; + } + } + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void TextChangedCallbackDelegate(IntPtr textField); + private EventHandler _textFieldTextChangedEventHandler; + private TextChangedCallbackDelegate _textFieldTextChangedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void MaxLengthReachedCallbackDelegate(IntPtr textField); + private EventHandler _textFieldMaxLengthReachedEventHandler; + private MaxLengthReachedCallbackDelegate _textFieldMaxLengthReachedCallbackDelegate; + + /// + /// TextChanged event. + /// + public event EventHandler TextChanged + { + add + { + if (_textFieldTextChangedEventHandler == null) + { + _textFieldTextChangedCallbackDelegate = (OnTextChanged); + TextChangedSignal().Connect(_textFieldTextChangedCallbackDelegate); + } + _textFieldTextChangedEventHandler += value; + } + remove + { + _textFieldTextChangedEventHandler -= value; + if (_textFieldTextChangedEventHandler == null && TextChangedSignal().Empty() == false) + { + TextChangedSignal().Disconnect(_textFieldTextChangedCallbackDelegate); + } + } + } + + private void OnTextChanged(IntPtr textField) + { + TextChangedEventArgs e = new TextChangedEventArgs(); + + // Populate all members of "e" (TextChangedEventArgs) with real data + e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField; + + if (_textFieldTextChangedEventHandler != null) + { + //here we send all data to user event handlers + _textFieldTextChangedEventHandler(this, e); + } + + } + + /// + /// MaxLengthReached event. + /// + public event EventHandler MaxLengthReached + { + add + { + if (_textFieldMaxLengthReachedEventHandler == null) + { + _textFieldMaxLengthReachedCallbackDelegate = (OnMaxLengthReached); + MaxLengthReachedSignal().Connect(_textFieldMaxLengthReachedCallbackDelegate); + } + _textFieldMaxLengthReachedEventHandler += value; + } + remove + { + if (_textFieldMaxLengthReachedEventHandler == null && MaxLengthReachedSignal().Empty() == false) + { + this.MaxLengthReachedSignal().Disconnect(_textFieldMaxLengthReachedCallbackDelegate); + } + _textFieldMaxLengthReachedEventHandler -= value; + } + } + + private void OnMaxLengthReached(IntPtr textField) + { + MaxLengthReachedEventArgs e = new MaxLengthReachedEventArgs(); + + // Populate all members of "e" (MaxLengthReachedEventArgs) with real data + e.TextField = Registry.GetManagedBaseHandleFromNativePtr(textField) as TextField; + + if (_textFieldMaxLengthReachedEventHandler != null) + { + //here we send all data to user event handlers + _textFieldMaxLengthReachedEventHandler(this, e); + } + + } + + internal class Property + { + internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextField_Property_RENDERING_BACKEND_get(); + internal static readonly int TEXT = NDalicPINVOKE.TextField_Property_TEXT_get(); + internal static readonly int PLACEHOLDER_TEXT = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_get(); + internal static readonly int PLACEHOLDER_TEXT_FOCUSED = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_FOCUSED_get(); + internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextField_Property_FONT_FAMILY_get(); + internal static readonly int FONT_STYLE = NDalicPINVOKE.TextField_Property_FONT_STYLE_get(); + internal static readonly int POINT_SIZE = NDalicPINVOKE.TextField_Property_POINT_SIZE_get(); + internal static readonly int MAX_LENGTH = NDalicPINVOKE.TextField_Property_MAX_LENGTH_get(); + internal static readonly int EXCEED_POLICY = NDalicPINVOKE.TextField_Property_EXCEED_POLICY_get(); + internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextField_Property_HORIZONTAL_ALIGNMENT_get(); + internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextField_Property_VERTICAL_ALIGNMENT_get(); + internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextField_Property_TEXT_COLOR_get(); + internal static readonly int PLACEHOLDER_TEXT_COLOR = NDalicPINVOKE.TextField_Property_PLACEHOLDER_TEXT_COLOR_get(); + internal static readonly int SHADOW_OFFSET = NDalicPINVOKE.TextField_Property_SHADOW_OFFSET_get(); + internal static readonly int SHADOW_COLOR = NDalicPINVOKE.TextField_Property_SHADOW_COLOR_get(); + internal static readonly int PRIMARY_CURSOR_COLOR = NDalicPINVOKE.TextField_Property_PRIMARY_CURSOR_COLOR_get(); + internal static readonly int SECONDARY_CURSOR_COLOR = NDalicPINVOKE.TextField_Property_SECONDARY_CURSOR_COLOR_get(); + internal static readonly int ENABLE_CURSOR_BLINK = NDalicPINVOKE.TextField_Property_ENABLE_CURSOR_BLINK_get(); + internal static readonly int CURSOR_BLINK_INTERVAL = NDalicPINVOKE.TextField_Property_CURSOR_BLINK_INTERVAL_get(); + internal static readonly int CURSOR_BLINK_DURATION = NDalicPINVOKE.TextField_Property_CURSOR_BLINK_DURATION_get(); + internal static readonly int CURSOR_WIDTH = NDalicPINVOKE.TextField_Property_CURSOR_WIDTH_get(); + internal static readonly int GRAB_HANDLE_IMAGE = NDalicPINVOKE.TextField_Property_GRAB_HANDLE_IMAGE_get(); + internal static readonly int GRAB_HANDLE_PRESSED_IMAGE = NDalicPINVOKE.TextField_Property_GRAB_HANDLE_PRESSED_IMAGE_get(); + internal static readonly int SCROLL_THRESHOLD = NDalicPINVOKE.TextField_Property_SCROLL_THRESHOLD_get(); + internal static readonly int SCROLL_SPEED = NDalicPINVOKE.TextField_Property_SCROLL_SPEED_get(); + internal static readonly int SELECTION_HANDLE_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_PRESSED_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_LEFT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_LEFT_get(); + internal static readonly int SELECTION_HANDLE_MARKER_IMAGE_RIGHT = NDalicPINVOKE.TextField_Property_SELECTION_HANDLE_MARKER_IMAGE_RIGHT_get(); + internal static readonly int SELECTION_HIGHLIGHT_COLOR = NDalicPINVOKE.TextField_Property_SELECTION_HIGHLIGHT_COLOR_get(); + internal static readonly int DECORATION_BOUNDING_BOX = NDalicPINVOKE.TextField_Property_DECORATION_BOUNDING_BOX_get(); + internal static readonly int INPUT_METHOD_SETTINGS = NDalicPINVOKE.TextField_Property_INPUT_METHOD_SETTINGS_get(); + internal static readonly int INPUT_COLOR = NDalicPINVOKE.TextField_Property_INPUT_COLOR_get(); + internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextField_Property_ENABLE_MARKUP_get(); + internal static readonly int INPUT_FONT_FAMILY = NDalicPINVOKE.TextField_Property_INPUT_FONT_FAMILY_get(); + internal static readonly int INPUT_FONT_STYLE = NDalicPINVOKE.TextField_Property_INPUT_FONT_STYLE_get(); + internal static readonly int INPUT_POINT_SIZE = NDalicPINVOKE.TextField_Property_INPUT_POINT_SIZE_get(); + internal static readonly int UNDERLINE = NDalicPINVOKE.TextField_Property_UNDERLINE_get(); + internal static readonly int INPUT_UNDERLINE = NDalicPINVOKE.TextField_Property_INPUT_UNDERLINE_get(); + internal static readonly int SHADOW = NDalicPINVOKE.TextField_Property_SHADOW_get(); + internal static readonly int INPUT_SHADOW = NDalicPINVOKE.TextField_Property_INPUT_SHADOW_get(); + internal static readonly int EMBOSS = NDalicPINVOKE.TextField_Property_EMBOSS_get(); + internal static readonly int INPUT_EMBOSS = NDalicPINVOKE.TextField_Property_INPUT_EMBOSS_get(); + internal static readonly int OUTLINE = NDalicPINVOKE.TextField_Property_OUTLINE_get(); + internal static readonly int INPUT_OUTLINE = NDalicPINVOKE.TextField_Property_INPUT_OUTLINE_get(); + internal static readonly int HIDDEN_INPUT_SETTINGS = NDalicManualPINVOKE.TextField_Property_HIDDEN_INPUT_SETTINGS_get(); + internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextField_Property_PIXEL_SIZE_get(); + internal static readonly int ENABLE_SELECTION = NDalicManualPINVOKE.TextField_Property_ENABLE_SELECTION_get(); + internal static readonly int PLACEHOLDER = NDalicManualPINVOKE.TextField_Property_PLACEHOLDER_get(); + + } + + internal class InputStyle + { + internal enum Mask + { + None = 0x0000, + Color = 0x0001, + FontFamily = 0x0002, + PointSize = 0x0004, + FontStyle = 0x0008, + Underline = 0x0010, + Shadow = 0x0020, + Emboss = 0x0040, + Outline = 0x0080 + } + + } + + /// + /// Creates the TextField control. + /// + public TextField() : this(NDalicPINVOKE.TextField_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal TextField(TextField handle) : this(NDalicPINVOKE.new_TextField__SWIG_1(TextField.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static TextField DownCast(BaseHandle handle) + { + TextField ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextField; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TextFieldSignal TextChangedSignal() + { + TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_TextChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TextFieldSignal MaxLengthReachedSignal() + { + TextFieldSignal ret = new TextFieldSignal(NDalicPINVOKE.TextField_MaxLengthReachedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t InputStyleChangedSignal() + { + SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t ret = new SWIGTYPE_p_Dali__SignalT_void_fDali__Toolkit__TextField_Dali__Toolkit__TextField__InputStyle__MaskF_t(NDalicPINVOKE.TextField_InputStyleChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal enum ExceedPolicyType + { + ExceedPolicyOriginal, + ExceedPolicyClip + } + + /// + /// TranslatableText property.
+ /// The text can be set SID value.
+ ///
+ /// + /// ResourceManager about multilingual is null + /// + public string TranslatableText + { + get + { + return textFieldTextSid; + } + set + { + if (NUIApplication.MultilingualResourceManager == null) + { + throw new ArgumentNullException("ResourceManager about multilingual is null"); + } + textFieldTextSid = value; + Text = SetTranslatable(textFieldTextSid); + } + } + /// + /// TranslatablePlaceholderText property.
+ /// The text can be set SID value.
+ ///
+ /// + /// ResourceManager about multilingual is null + /// + public string TranslatablePlaceholderText + { + get + { + return textFieldPlaceHolderTextSid; + } + set + { + if (NUIApplication.MultilingualResourceManager == null) + { + throw new ArgumentNullException("ResourceManager about multilingual is null"); + } + textFieldPlaceHolderTextSid = value; + PlaceholderText = SetTranslatable(textFieldPlaceHolderTextSid); + } + } + private string SetTranslatable(string textFieldSid) + { + string translatableText = null; + translatableText = NUIApplication.MultilingualResourceManager?.GetString(textFieldSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); + if (translatableText != null) + { + if (systemlangTextFlag == false) + { + SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; + systemlangTextFlag = true; + } + return translatableText; + } + else + { + translatableText = ""; + return translatableText; + } + } + private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) + { + if (textFieldTextSid != null) + { + Text = NUIApplication.MultilingualResourceManager?.GetString(textFieldTextSid, new CultureInfo(e.Value.Replace("_", "-"))); + } + if (textFieldPlaceHolderTextSid != null) + { + PlaceholderText = NUIApplication.MultilingualResourceManager?.GetString(textFieldPlaceHolderTextSid, new CultureInfo(e.Value.Replace("_", "-"))); + } + } + /// Text property. + ///
+ public string Text + { + get + { + string temp; + GetProperty(TextField.Property.TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PlaceholderText property. + /// + public string PlaceholderText + { + get + { + string temp; + GetProperty(TextField.Property.PLACEHOLDER_TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.PLACEHOLDER_TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PlaceholderTextFocused property. + /// + public string PlaceholderTextFocused + { + get + { + string temp; + GetProperty(TextField.Property.PLACEHOLDER_TEXT_FOCUSED).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.PLACEHOLDER_TEXT_FOCUSED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// FontFamily property. + /// + public string FontFamily + { + get + { + string temp; + GetProperty(TextField.Property.FONT_FAMILY).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// FontStyle property. + /// + public PropertyMap FontStyle + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.FONT_STYLE).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.FONT_STYLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PointSize property. + /// + public float PointSize + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.POINT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.POINT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// MaxLength property. + /// + public int MaxLength + { + get + { + int temp = 0; + GetProperty(TextField.Property.MAX_LENGTH).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.MAX_LENGTH, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ExceedPolicy property. + /// + public int ExceedPolicy + { + get + { + int temp = 0; + GetProperty(TextField.Property.EXCEED_POLICY).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.EXCEED_POLICY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// HorizontalAlignment property. + /// + public HorizontalAlignment HorizontalAlignment + { + get + { + string temp; + if (GetProperty(TextField.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("HorizontalAlignment get error!"); + } + + switch (temp) + { + case "BEGIN": + return HorizontalAlignment.Begin; + case "CENTER": + return HorizontalAlignment.Center; + case "END": + return HorizontalAlignment.End; + default: + return HorizontalAlignment.Begin; + } + } + set + { + string valueToString = ""; + switch (value) + { + case HorizontalAlignment.Begin: + { + valueToString = "BEGIN"; + break; + } + case HorizontalAlignment.Center: + { + valueToString = "CENTER"; + break; + } + case HorizontalAlignment.End: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextField.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// VerticalAlignment property. + /// + public VerticalAlignment VerticalAlignment + { + get + { + string temp; + if (GetProperty(TextField.Property.VERTICAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("VerticalAlignment get error!"); + } + + switch (temp) + { + case "TOP": + return VerticalAlignment.Top; + case "CENTER": + return VerticalAlignment.Center; + case "BOTTOM": + return VerticalAlignment.Bottom; + default: + return VerticalAlignment.Bottom; + } + } + set + { + string valueToString = ""; + switch (value) + { + case VerticalAlignment.Top: + { + valueToString = "TOP"; + break; + } + case VerticalAlignment.Center: + { + valueToString = "CENTER"; + break; + } + case VerticalAlignment.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "BOTTOM"; + break; + } + } + SetProperty(TextField.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// TextColor property. + /// + public Color TextColor + { + get + { + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.TEXT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PlaceholderTextColor property. + /// + public Vector4 PlaceholderTextColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.PLACEHOLDER_TEXT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.PLACEHOLDER_TEXT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ShadowOffset property. + /// + public Vector2 ShadowOffset + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(TextField.Property.SHADOW_OFFSET).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SHADOW_OFFSET, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ShadowColor property. + /// + public Vector4 ShadowColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.SHADOW_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SHADOW_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PrimaryCursorColor property. + /// + public Vector4 PrimaryCursorColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.PRIMARY_CURSOR_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.PRIMARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SecondaryCursorColor property. + /// + public Vector4 SecondaryCursorColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.SECONDARY_CURSOR_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SECONDARY_CURSOR_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableCursorBlink property. + /// + public bool EnableCursorBlink + { + get + { + bool temp = false; + GetProperty(TextField.Property.ENABLE_CURSOR_BLINK).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.ENABLE_CURSOR_BLINK, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorBlinkInterval property. + /// + public float CursorBlinkInterval + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.CURSOR_BLINK_INTERVAL).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.CURSOR_BLINK_INTERVAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorBlinkDuration property. + /// + public float CursorBlinkDuration + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.CURSOR_BLINK_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.CURSOR_BLINK_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// CursorWidth property. + /// + public int CursorWidth + { + get + { + int temp = 0; + GetProperty(TextField.Property.CURSOR_WIDTH).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.CURSOR_WIDTH, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// GrabHandleImage property. + /// + public string GrabHandleImage + { + get + { + string temp; + GetProperty(TextField.Property.GRAB_HANDLE_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.GRAB_HANDLE_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// GrabHandlePressedImage property. + /// + public string GrabHandlePressedImage + { + get + { + string temp; + GetProperty(TextField.Property.GRAB_HANDLE_PRESSED_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.GRAB_HANDLE_PRESSED_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ScrollThreshold property. + /// + public float ScrollThreshold + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.SCROLL_THRESHOLD).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.SCROLL_THRESHOLD, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ScrollSpeed property. + /// + public float ScrollSpeed + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.SCROLL_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.SCROLL_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleImageLeft property. + /// + public PropertyMap SelectionHandleImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleImageRight property. + /// + public PropertyMap SelectionHandleImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandlePressedImageLeft property. + /// + public PropertyMap SelectionHandlePressedImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandlePressedImageRight property. + /// + public PropertyMap SelectionHandlePressedImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleMarkerImageLeft property. + /// + public PropertyMap SelectionHandleMarkerImageLeft + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_LEFT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHandleMarkerImageRight property. + /// + public PropertyMap SelectionHandleMarkerImageRight + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HANDLE_MARKER_IMAGE_RIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// SelectionHighlightColor property. + /// + public Vector4 SelectionHighlightColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.SELECTION_HIGHLIGHT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SELECTION_HIGHLIGHT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// DecorationBoundingBox property. + /// + public Rectangle DecorationBoundingBox + { + get + { + Rectangle temp = new Rectangle(0, 0, 0, 0); + GetProperty(TextField.Property.DECORATION_BOUNDING_BOX).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.DECORATION_BOUNDING_BOX, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputMethodSettings property. + /// + public PropertyMap InputMethodSettings + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.INPUT_METHOD_SETTINGS).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_METHOD_SETTINGS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputColor property. + /// + public Vector4 InputColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextField.Property.INPUT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableMarkup property. + /// + public bool EnableMarkup + { + get + { + bool temp = false; + GetProperty(TextField.Property.ENABLE_MARKUP).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputFontFamily property. + /// + public string InputFontFamily + { + get + { + string temp; + GetProperty(TextField.Property.INPUT_FONT_FAMILY).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_FONT_FAMILY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputFontStyle property. + /// + public PropertyMap InputFontStyle + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.INPUT_FONT_STYLE).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_FONT_STYLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputPointSize property. + /// + public float InputPointSize + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.INPUT_POINT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_POINT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Underline property. + /// + public PropertyMap Underline + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.UNDERLINE).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.UNDERLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputUnderline property. + /// + public string InputUnderline + { + get + { + string temp; + GetProperty(TextField.Property.INPUT_UNDERLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_UNDERLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Shadow property. + /// + public PropertyMap Shadow + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextField.Property.SHADOW).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputShadow property. + /// + public string InputShadow + { + get + { + string temp; + GetProperty(TextField.Property.INPUT_SHADOW).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Emboss property. + /// + public string Emboss + { + get + { + string temp; + GetProperty(TextField.Property.EMBOSS).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.EMBOSS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputEmboss property. + /// + public string InputEmboss + { + get + { + string temp; + GetProperty(TextField.Property.INPUT_EMBOSS).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_EMBOSS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Outline property. + /// + public string Outline + { + get + { + string temp; + GetProperty(TextField.Property.OUTLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.OUTLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// InputOutline property. + /// + public string InputOutline + { + get + { + string temp; + GetProperty(TextField.Property.INPUT_OUTLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.INPUT_OUTLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// HiddenInputSettings property. + /// + public Tizen.NUI.PropertyMap HiddenInputSettings + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(TextField.Property.HIDDEN_INPUT_SETTINGS).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.HIDDEN_INPUT_SETTINGS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PixelSize property. + /// + public float PixelSize + { + get + { + float temp = 0.0f; + GetProperty(TextField.Property.PIXEL_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Enable selection property. + /// + public bool EnableSelection + { + get + { + bool temp = false; + GetProperty(TextField.Property.ENABLE_SELECTION).Get(out temp); + return temp; + } + set + { + SetProperty(TextField.Property.ENABLE_SELECTION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Placeholder property. + /// Gets/Sets the placeholder : text, color, font family, font style, point size, and pixel size. + /// + /// + /// The following example demonstrates how to set the placeholder property. + /// + /// PropertyMap propertyMap = new PropertyMap(); + /// propertyMap.Add("placeholderText", new PropertyValue("Setting Placeholder Text")); + /// propertyMap.Add("placeholderTextFocused", new PropertyValue("Setting Placeholder Text Focused")); + /// propertyMap.Add("placeholderColor", new PropertyValue(Color.Red)); + /// propertyMap.Add("placeholderFontFamily", new PropertyValue("Arial")); + /// propertyMap.Add("placeholderPointSize", new PropertyValue(12.0f)); + /// + /// PropertyMap fontStyleMap = new PropertyMap(); + /// fontStyleMap.Add("weight", new PropertyValue("bold")); + /// fontStyleMap.Add("width", new PropertyValue("condensed")); + /// fontStyleMap.Add("slant", new PropertyValue("italic")); + /// propertyMap.Add("placeholderFontStyle", new PropertyValue(fontStyleMap)); + /// + /// TextField field = new TextField(); + /// field.Placeholder = propertyMap; + /// + /// + public Tizen.NUI.PropertyMap Placeholder + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(TextField.Property.PLACEHOLDER).Get(temp); + return temp; + } + set + { + SetProperty(TextField.Property.PLACEHOLDER, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs new file mode 100755 index 0000000..4abad84 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/TextLabel.cs @@ -0,0 +1,835 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +extern alias TizenSystemSettings; +using TizenSystemSettings.Tizen.System; +using System; +using System.Globalization; +namespace Tizen.NUI.BaseComponents +{ + + /// + /// A control which renders a short text string.
+ /// Text labels are lightweight, non-editable and do not respond to user input.
+ ///
+ public class TextLabel : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private string textLabelSid = null; + private bool systemlangTextFlag = false; + internal TextLabel(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextLabel_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextLabel obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextLabel(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal class Property + { + internal static readonly int RENDERING_BACKEND = NDalicPINVOKE.TextLabel_Property_RENDERING_BACKEND_get(); + internal static readonly int TEXT = NDalicPINVOKE.TextLabel_Property_TEXT_get(); + internal static readonly int FONT_FAMILY = NDalicPINVOKE.TextLabel_Property_FONT_FAMILY_get(); + internal static readonly int FONT_STYLE = NDalicPINVOKE.TextLabel_Property_FONT_STYLE_get(); + internal static readonly int POINT_SIZE = NDalicPINVOKE.TextLabel_Property_POINT_SIZE_get(); + internal static readonly int MULTI_LINE = NDalicPINVOKE.TextLabel_Property_MULTI_LINE_get(); + internal static readonly int HORIZONTAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_HORIZONTAL_ALIGNMENT_get(); + internal static readonly int VERTICAL_ALIGNMENT = NDalicPINVOKE.TextLabel_Property_VERTICAL_ALIGNMENT_get(); + internal static readonly int TEXT_COLOR = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_get(); + internal static readonly int SHADOW_OFFSET = NDalicPINVOKE.TextLabel_Property_SHADOW_OFFSET_get(); + internal static readonly int SHADOW_COLOR = NDalicPINVOKE.TextLabel_Property_SHADOW_COLOR_get(); + internal static readonly int UNDERLINE_ENABLED = NDalicPINVOKE.TextLabel_Property_UNDERLINE_ENABLED_get(); + internal static readonly int UNDERLINE_COLOR = NDalicPINVOKE.TextLabel_Property_UNDERLINE_COLOR_get(); + internal static readonly int UNDERLINE_HEIGHT = NDalicPINVOKE.TextLabel_Property_UNDERLINE_HEIGHT_get(); + internal static readonly int ENABLE_MARKUP = NDalicPINVOKE.TextLabel_Property_ENABLE_MARKUP_get(); + internal static readonly int ENABLE_AUTO_SCROLL = NDalicPINVOKE.TextLabel_Property_ENABLE_AUTO_SCROLL_get(); + internal static readonly int AUTO_SCROLL_SPEED = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_SPEED_get(); + internal static readonly int AUTO_SCROLL_LOOP_COUNT = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_COUNT_get(); + internal static readonly int AUTO_SCROLL_GAP = NDalicPINVOKE.TextLabel_Property_AUTO_SCROLL_GAP_get(); + internal static readonly int LINE_SPACING = NDalicPINVOKE.TextLabel_Property_LINE_SPACING_get(); + internal static readonly int UNDERLINE = NDalicPINVOKE.TextLabel_Property_UNDERLINE_get(); + internal static readonly int SHADOW = NDalicPINVOKE.TextLabel_Property_SHADOW_get(); + internal static readonly int EMBOSS = NDalicPINVOKE.TextLabel_Property_EMBOSS_get(); + internal static readonly int OUTLINE = NDalicPINVOKE.TextLabel_Property_OUTLINE_get(); + internal static readonly int PIXEL_SIZE = NDalicManualPINVOKE.TextLabel_Property_PIXEL_SIZE_get(); + internal static readonly int ELLIPSIS = NDalicManualPINVOKE.TextLabel_Property_ELLIPSIS_get(); + internal static readonly int AUTO_SCROLL_STOP_MODE = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_STOP_MODE_get(); + internal static readonly int AUTO_SCROLL_LOOP_DELAY = NDalicManualPINVOKE.TextLabel_Property_AUTO_SCROLL_LOOP_DELAY_get(); + internal static readonly int LINE_COUNT = NDalicManualPINVOKE.TextLabel_Property_LINE_COUNT_get(); + internal static readonly int LINE_WRAP_MODE = NDalicManualPINVOKE.TextLabel_Property_LINE_WRAP_MODE_get(); + internal static readonly int TEXT_COLOR_ANIMATABLE = NDalicPINVOKE.TextLabel_Property_TEXT_COLOR_ANIMATABLE_get(); + + } + + /// + /// Creates the TextLabel control. + /// + public TextLabel() : this(NDalicPINVOKE.TextLabel_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Creates the TextLabel control. + /// + /// The text to display + public TextLabel(string text) : this(NDalicPINVOKE.TextLabel_New__SWIG_1(text), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal TextLabel(TextLabel handle) : this(NDalicPINVOKE.new_TextLabel__SWIG_1(TextLabel.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + [Obsolete("Please do not use! this will be deprecated")] + public new static TextLabel DownCast(BaseHandle handle) + { + TextLabel ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as TextLabel; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + /// + /// TranslatableText property.
+ /// The text can be set SID value.
+ ///
+ /// + /// ResourceManager about multilingual is null + /// + public string TranslatableText + { + get + { + return textLabelSid; + } + set + { + if (NUIApplication.MultilingualResourceManager == null) + { + throw new ArgumentNullException("ResourceManager about multilingual is null"); + } + string translatableText = null; + textLabelSid = value; + translatableText = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(SystemSettings.LocaleLanguage.Replace("_", "-"))); + if (translatableText != null) + { + Text = translatableText; + if (systemlangTextFlag == false) + { + SystemSettings.LocaleLanguageChanged += new WeakEventHandler(SystemSettings_LocaleLanguageChanged).Handler; + systemlangTextFlag = true; + } + } + else + { + Text = ""; + } + } + } + private void SystemSettings_LocaleLanguageChanged(object sender, LocaleLanguageChangedEventArgs e) + { + Text = NUIApplication.MultilingualResourceManager?.GetString(textLabelSid, new CultureInfo(e.Value.Replace("_", "-"))); + } + + /// + /// Text property.
+ /// The text to display in UTF-8 format.
+ ///
+ public string Text + { + get + { + string temp; + GetProperty(TextLabel.Property.TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// FontFamily property.
+ /// The requested font family to use.
+ ///
+ public string FontFamily + { + get + { + string temp; + GetProperty(TextLabel.Property.FONT_FAMILY).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.FONT_FAMILY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// FontStyle property.
+ /// The requested font style to use.
+ ///
+ public PropertyMap FontStyle + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextLabel.Property.FONT_STYLE).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.FONT_STYLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PointSize property.
+ /// The size of font in points.
+ ///
+ public float PointSize + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.POINT_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.POINT_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// MultiLine property.
+ /// The single-line or multi-line layout option.
+ ///
+ public bool MultiLine + { + get + { + bool temp = false; + GetProperty(TextLabel.Property.MULTI_LINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.MULTI_LINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// HorizontalAlignment property.
+ /// The line horizontal alignment.
+ ///
+ public HorizontalAlignment HorizontalAlignment + { + get + { + string temp; + if (GetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("HorizontalAlignment get error!"); + } + switch (temp) + { + case "BEGIN": + return HorizontalAlignment.Begin; + case "CENTER": + return HorizontalAlignment.Center; + case "END": + return HorizontalAlignment.End; + default: + return HorizontalAlignment.Begin; + } + } + set + { + string valueToString = ""; + switch (value) + { + case HorizontalAlignment.Begin: + { + valueToString = "BEGIN"; + break; + } + case HorizontalAlignment.Center: + { + valueToString = "CENTER"; + break; + } + case HorizontalAlignment.End: + { + valueToString = "END"; + break; + } + default: + { + valueToString = "BEGIN"; + break; + } + } + SetProperty(TextLabel.Property.HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// VerticalAlignment property.
+ /// The line vertical alignment.
+ ///
+ public VerticalAlignment VerticalAlignment + { + get + { + string temp; + if (GetProperty(TextLabel.Property.VERTICAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("VerticalAlignment get error!"); + } + + switch (temp) + { + case "TOP": + return VerticalAlignment.Top; + case "CENTER": + return VerticalAlignment.Center; + case "BOTTOM": + return VerticalAlignment.Bottom; + default: + return VerticalAlignment.Bottom; + } + } + set + { + string valueToString = ""; + switch (value) + { + case VerticalAlignment.Top: + { + valueToString = "TOP"; + break; + } + case VerticalAlignment.Center: + { + valueToString = "CENTER"; + break; + } + case VerticalAlignment.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "BOTTOM"; + break; + } + } + SetProperty(TextLabel.Property.VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// TextColor property.
+ /// The color of the text.
+ ///
+ public Color TextColor + { + get + { + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextLabel.Property.TEXT_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.TEXT_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ShadowOffset property.
+ /// The drop shadow offset 0 indicates no shadow.
+ ///
+ public Vector2 ShadowOffset + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(TextLabel.Property.SHADOW_OFFSET).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.SHADOW_OFFSET, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// ShadowColor property.
+ /// The color of a drop shadow.
+ ///
+ public Vector4 ShadowColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextLabel.Property.SHADOW_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.SHADOW_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// UnderlineEnabled property.
+ /// The underline enabled flag.
+ ///
+ public bool UnderlineEnabled + { + get + { + bool temp = false; + GetProperty(TextLabel.Property.UNDERLINE_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.UNDERLINE_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// UnderlineColor property.
+ /// Overrides the underline height from font metrics.
+ ///
+ public Vector4 UnderlineColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextLabel.Property.UNDERLINE_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.UNDERLINE_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// UnderlineHeight property.
+ /// Overrides the underline height from font metrics.
+ ///
+ public float UnderlineHeight + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.UNDERLINE_HEIGHT).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.UNDERLINE_HEIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableMarkup property.
+ /// Whether the mark-up processing is enabled.
+ ///
+ public bool EnableMarkup + { + get + { + bool temp = false; + GetProperty(TextLabel.Property.ENABLE_MARKUP).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.ENABLE_MARKUP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// EnableAutoScroll property.
+ /// Starts or stops auto scrolling.
+ ///
+ public bool EnableAutoScroll + { + get + { + bool temp = false; + GetProperty(TextLabel.Property.ENABLE_AUTO_SCROLL).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.ENABLE_AUTO_SCROLL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// AutoScrollSpeed property.
+ /// Sets the speed of scrolling in pixels per second.
+ ///
+ public int AutoScrollSpeed + { + get + { + int temp = 0; + GetProperty(TextLabel.Property.AUTO_SCROLL_SPEED).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.AUTO_SCROLL_SPEED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// AutoScrollLoopCount property.
+ /// Number of complete loops when scrolling enabled.
+ ///
+ public int AutoScrollLoopCount + { + get + { + int temp = 0; + GetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_COUNT).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_COUNT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// AutoScrollGap property.
+ /// Gap before scrolling wraps.
+ ///
+ public float AutoScrollGap + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.AUTO_SCROLL_GAP).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.AUTO_SCROLL_GAP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// LineSpacing property.
+ /// The default extra space between lines in points.
+ ///
+ public float LineSpacing + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.LINE_SPACING).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.LINE_SPACING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Underline property.
+ /// The default underline parameters.
+ ///
+ public PropertyMap Underline + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextLabel.Property.UNDERLINE).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.UNDERLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Shadow property.
+ /// The default shadow parameters.
+ ///
+ public PropertyMap Shadow + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(TextLabel.Property.SHADOW).Get(temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.SHADOW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Emboss property.
+ /// The default emboss parameters.
+ ///
+ public string Emboss + { + get + { + string temp; + GetProperty(TextLabel.Property.EMBOSS).Get( out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.EMBOSS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Outline property.
+ /// The default outline parameters.
+ ///
+ public string Outline + { + get + { + string temp; + GetProperty(TextLabel.Property.OUTLINE).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.OUTLINE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// PixelSize property.
+ /// The size of font in pixels.
+ ///
+ public float PixelSize + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.PIXEL_SIZE).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.PIXEL_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Ellipsis property.
+ /// Enable or disable the ellipsis.
+ ///
+ public bool Ellipsis + { + get + { + bool temp = false; + GetProperty(TextLabel.Property.ELLIPSIS).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.ELLIPSIS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// AutoScrollLoopDelay property.
+ /// do something.
+ ///
+ public float AutoScrollLoopDelay + { + get + { + float temp = 0.0f; + GetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_DELAY).Get(out temp); + return temp; + } + set + { + SetProperty(TextLabel.Property.AUTO_SCROLL_LOOP_DELAY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// AutoScrollStopMode property.
+ /// do something.
+ ///
+ public AutoScrollStopMode AutoScrollStopMode + { + get + { + string temp; + if(GetProperty(TextLabel.Property.AUTO_SCROLL_STOP_MODE).Get(out temp) == false) + { + NUILog.Error("AutoScrollStopMode get error!"); + } + switch (temp) + { + case "FINISH_LOOP": + return AutoScrollStopMode.FinishLoop; + case "IMMEDIATE": + return AutoScrollStopMode.Immediate; + default: + return AutoScrollStopMode.FinishLoop; + } + } + set + { + SetProperty(TextLabel.Property.AUTO_SCROLL_STOP_MODE, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// The line count of text. + /// + public int LineCount + { + get + { + int temp = 0; + GetProperty(TextLabel.Property.LINE_COUNT).Get(out temp); + return temp; + } + } + + /// + /// LineWrapMode property.
+ /// line wrap mode when the text lines over layout width.
+ ///
+ public LineWrapMode LineWrapMode + { + get + { + string temp; + if(GetProperty(TextLabel.Property.LINE_WRAP_MODE).Get(out temp) == false) + { + NUILog.Error("LineWrapMode get error!"); + } + switch (temp) + { + case "WORD": + return LineWrapMode.Word; + case "CHARACTER": + return LineWrapMode.Character; + default: + return LineWrapMode.Word; + } + } + set + { + string temp = ""; + switch (value) + { + case LineWrapMode.Word: + { + temp = "WRAP_MODE_WORD"; + break; + } + case LineWrapMode.Character: + { + temp = "WRAP_MODE_CHARACTER"; + break; + } + } + SetProperty(TextLabel.Property.LINE_WRAP_MODE, new Tizen.NUI.PropertyValue(temp)); + } + } + + /// TextColorAnimatable property.
+ /// The color of the text that can be animatated.
+ /// Animation framework can be used to change the color of the text when not using mark up.
+ /// Not possible when text is auto scrolling.
+ ///
+ public Color TextColorAnimatable + { + get + { + Color animatableColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE).Get(animatableColor); + return animatableColor; + } + set + { + SetProperty(TextLabel.Property.TEXT_COLOR_ANIMATABLE, new Tizen.NUI.PropertyValue(value)); + } + } + + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs new file mode 100755 index 0000000..0c8e0de --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/VideoView.cs @@ -0,0 +1,306 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.BaseComponents +{ + + using System; + using System.Runtime.InteropServices; + + /// + /// VideoView is a control for video playback and display. + /// + public class VideoView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal VideoView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VideoView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VideoView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VideoView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Event arguments that passed via Finished signal + /// + public class FinishedEventArgs : EventArgs + { + private VideoView _videoView; + + /// + /// The view for video playback and display. + /// + public VideoView VideoView + { + get + { + return _videoView; + } + set + { + _videoView = value; + } + } + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FinishedCallbackDelegate(IntPtr data); + private EventHandler _videoViewFinishedEventHandler; + private FinishedCallbackDelegate _videoViewFinishedCallbackDelegate; + + + /// + /// Event for Finished signal which can be used to subscribe/unsubscribe the event handler + /// (in the type of FinishedEventHandler-DaliEventHandler) provided by the user.
+ /// Finished signal is emitted when a video playback have finished.
+ ///
+ public event EventHandler Finished + { + add + { + if (_videoViewFinishedEventHandler == null) + { + _videoViewFinishedCallbackDelegate = (OnFinished); + FinishedSignal().Connect(_videoViewFinishedCallbackDelegate); + } + _videoViewFinishedEventHandler += value; + } + remove + { + _videoViewFinishedEventHandler -= value; + if (_videoViewFinishedEventHandler == null && FinishedSignal().Empty() == false) + { + FinishedSignal().Disconnect(_videoViewFinishedCallbackDelegate); + } + } + } + + // Callback for VideoView Finished signal + private void OnFinished(IntPtr data) + { + FinishedEventArgs e = new FinishedEventArgs(); + + // Populate all members of "e" (FinishedEventArgs) with real data + e.VideoView = Registry.GetManagedBaseHandleFromNativePtr(data) as VideoView; + + if (_videoViewFinishedEventHandler != null) + { + //here we send all data to user event handlers + _videoViewFinishedEventHandler(this, e); + } + } + + internal class Property + { + internal static readonly int VIDEO = NDalicPINVOKE.VideoView_Property_VIDEO_get(); + internal static readonly int LOOPING = NDalicPINVOKE.VideoView_Property_LOOPING_get(); + internal static readonly int MUTED = NDalicPINVOKE.VideoView_Property_MUTED_get(); + internal static readonly int VOLUME = NDalicPINVOKE.VideoView_Property_VOLUME_get(); + } + + /// + /// Creates an initialized VideoView. + /// + public VideoView() : this(NDalicPINVOKE.VideoView_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Creates an initialized VideoView.
+ /// If the string is empty, VideoView will not display anything.
+ ///
+ /// The url of the video resource to display + public VideoView(string url) : this(NDalicPINVOKE.VideoView_New__SWIG_1(url), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal VideoView(VideoView videoView) : this(NDalicPINVOKE.new_VideoView__SWIG_1(VideoView.getCPtr(videoView)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static VideoView DownCast(BaseHandle handle) + { + VideoView ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as VideoView; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Starts the video playback. + /// + public void Play() + { + NDalicPINVOKE.VideoView_Play(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Pauses the video playback. + /// + public void Pause() + { + NDalicPINVOKE.VideoView_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Stops the video playback. + /// + public void Stop() + { + NDalicPINVOKE.VideoView_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Seeks forward by the specified number of milliseconds. + /// + /// The position for forward playback + public void Forward(int millisecond) + { + NDalicPINVOKE.VideoView_Forward(swigCPtr, millisecond); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Seeks backward by the specified number of milliseconds. + /// + /// The position for backward playback + public void Backward(int millisecond) + { + NDalicPINVOKE.VideoView_Backward(swigCPtr, millisecond); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal VideoViewSignal FinishedSignal() + { + VideoViewSignal ret = new VideoViewSignal(NDalicPINVOKE.VideoView_FinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// video file url as string type or PropertyMap. + /// + public PropertyMap Video + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(VideoView.Property.VIDEO).Get(temp); + return temp; + } + set + { + SetProperty(VideoView.Property.VIDEO, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// looping status, true or false. + /// + public bool Looping + { + get + { + bool temp = false; + GetProperty(VideoView.Property.LOOPING).Get(out temp); + return temp; + } + set + { + SetProperty(VideoView.Property.LOOPING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// mute status, true or false. + /// + public bool Muted + { + get + { + bool temp = false; + GetProperty(VideoView.Property.MUTED).Get(out temp); + return temp; + } + set + { + SetProperty(VideoView.Property.MUTED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// left and right volume scalar as float type, PropertyMap with two values ( "left" and "right" ). + /// + public PropertyMap Volume + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(VideoView.Property.VOLUME).Get(temp); + return temp; + } + set + { + SetProperty(VideoView.Property.VOLUME, new PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs new file mode 100755 index 0000000..cedb4d0 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -0,0 +1,3900 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.BaseComponents +{ + + using System; + using System.Runtime.InteropServices; + + + + /// + /// View is the base class for all views. + /// + public class View : Animatable //CustomActor => Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal View(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.View_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + PositionUsesPivotPoint = false; + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(View obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + // you can override it to clean-up your own resources. + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_View(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + private EventHandler _keyInputFocusGainedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void KeyInputFocusGainedCallbackType(IntPtr control); + private KeyInputFocusGainedCallbackType _keyInputFocusGainedCallback; + + /// + /// Event for KeyInputFocusGained signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// KeyInputFocusGained signal is emitted when the control gets Key Input Focus.
+ ///
+ public event EventHandler FocusGained + { + add + { + if (_keyInputFocusGainedEventHandler == null) + { + _keyInputFocusGainedCallback = OnKeyInputFocusGained; + this.KeyInputFocusGainedSignal().Connect(_keyInputFocusGainedCallback); + } + + _keyInputFocusGainedEventHandler += value; + } + + remove + { + _keyInputFocusGainedEventHandler -= value; + + if (_keyInputFocusGainedEventHandler == null && KeyInputFocusGainedSignal().Empty() == false) + { + this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback); + } + } + } + + private void OnKeyInputFocusGained(IntPtr view) + { + if (_keyInputFocusGainedEventHandler != null) + { + _keyInputFocusGainedEventHandler(this, null); + } + } + + + private EventHandler _keyInputFocusLostEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void KeyInputFocusLostCallbackType(IntPtr control); + private KeyInputFocusLostCallbackType _keyInputFocusLostCallback; + + /// + /// Event for KeyInputFocusLost signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// KeyInputFocusLost signal is emitted when the control loses Key Input Focus.
+ ///
+ public event EventHandler FocusLost + { + add + { + if (_keyInputFocusLostEventHandler == null) + { + _keyInputFocusLostCallback = OnKeyInputFocusLost; + this.KeyInputFocusLostSignal().Connect(_keyInputFocusLostCallback); + } + + _keyInputFocusLostEventHandler += value; + } + + remove + { + _keyInputFocusLostEventHandler -= value; + + if (_keyInputFocusLostEventHandler == null && KeyInputFocusLostSignal().Empty() == false) + { + this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback); + } + } + } + + private void OnKeyInputFocusLost(IntPtr view) + { + if (_keyInputFocusLostEventHandler != null) + { + _keyInputFocusLostEventHandler(this, null); + } + } + + /// + /// Event arguments that passed via KeyEvent signal. + /// + public class KeyEventArgs : EventArgs + { + private Key _key; + + /// + /// Key - is the key sent to the View. + /// + public Key Key + { + get + { + return _key; + } + set + { + _key = value; + } + } + } + + private EventHandlerWithReturnType _keyEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool KeyCallbackType(IntPtr control, IntPtr keyEvent); + private KeyCallbackType _keyCallback; + + /// + /// Event for KeyPressed signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// KeyPressed signal is emitted when key event is received.
+ ///
+ public event EventHandlerWithReturnType KeyEvent + { + add + { + if (_keyEventHandler == null) + { + _keyCallback = OnKeyEvent; + this.KeyEventSignal().Connect(_keyCallback); + } + + _keyEventHandler += value; + } + + remove + { + _keyEventHandler -= value; + + if (_keyEventHandler == null && KeyEventSignal().Empty() == false) + { + this.KeyEventSignal().Disconnect(_keyCallback); + } + } + } + + private bool OnKeyEvent(IntPtr view, IntPtr keyEvent) + { + KeyEventArgs e = new KeyEventArgs(); + + bool result = false; + + e.Key = Tizen.NUI.Key.GetKeyFromPtr(keyEvent); + + if (_keyEventHandler != null) + { + Delegate[] delegateList = _keyEventHandler.GetInvocationList(); + + // Oring the result of each callback. + foreach ( EventHandlerWithReturnType del in delegateList ) + { + result |= del( this, e ); + } + } + + return result; + } + + private EventHandler _onRelayoutEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OnRelayoutEventCallbackType(IntPtr control); + private OnRelayoutEventCallbackType _onRelayoutEventCallback; + + /// + /// Event for OnRelayout signal which can be used to subscribe/unsubscribe the event handler.
+ /// OnRelayout signal is emitted after the size has been set on the view during relayout.
+ ///
+ public event EventHandler Relayout + { + add + { + if (_onRelayoutEventHandler == null) + { + _onRelayoutEventCallback = OnRelayout; + this.OnRelayoutSignal().Connect(_onRelayoutEventCallback); + } + + _onRelayoutEventHandler += value; + } + + remove + { + _onRelayoutEventHandler -= value; + + if (_onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false) + { + this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); + } + + } + } + + // Callback for View OnRelayout signal + private void OnRelayout(IntPtr data) + { + if (_onRelayoutEventHandler != null) + { + _onRelayoutEventHandler(this, null); + } + } + + /// + /// Event arguments that passed via Touch signal. + /// + public class TouchEventArgs : EventArgs + { + private Touch _touch; + + /// + /// Touch - contains the information of touch points + /// + public Touch Touch + { + get + { + return _touch; + } + set + { + _touch = value; + } + } + } + + private EventHandlerWithReturnType _touchDataEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool TouchDataCallbackType(IntPtr view, IntPtr touchData); + private TouchDataCallbackType _touchDataCallback; + + /// + /// Event for Touched signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// Touched signal is emitted when touch input is received.
+ ///
+ public event EventHandlerWithReturnType TouchEvent + { + add + { + if (_touchDataEventHandler == null) + { + _touchDataCallback = OnTouch; + this.TouchSignal().Connect(_touchDataCallback); + } + + _touchDataEventHandler += value; + } + + remove + { + _touchDataEventHandler -= value; + + if (_touchDataEventHandler == null && TouchSignal().Empty() == false) + { + this.TouchSignal().Disconnect(_touchDataCallback); + } + + } + } + + // Callback for View TouchSignal + private bool OnTouch(IntPtr view, IntPtr touchData) + { + TouchEventArgs e = new TouchEventArgs(); + + e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(touchData); + + if (_touchDataEventHandler != null) + { + return _touchDataEventHandler(this, e); + } + return false; + } + + + /// + /// Event arguments that passed via Hover signal. + /// + public class HoverEventArgs : EventArgs + { + private Hover _hover; + + /// + /// Hover - contains touch points that represent the points that are currently being hovered or the points where a hover has stopped. + /// + public Hover Hover + { + get + { + return _hover; + } + set + { + _hover = value; + } + } + } + + private EventHandlerWithReturnType _hoverEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool HoverEventCallbackType(IntPtr view, IntPtr hoverEvent); + private HoverEventCallbackType _hoverEventCallback; + + /// + /// Event for Hovered signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// Hovered signal is emitted when hover input is received.
+ ///
+ public event EventHandlerWithReturnType HoverEvent + { + add + { + if (_hoverEventHandler == null) + { + _hoverEventCallback = OnHoverEvent; + this.HoveredSignal().Connect(_hoverEventCallback); + } + + _hoverEventHandler += value; + } + + remove + { + _hoverEventHandler -= value; + + if (_hoverEventHandler == null && HoveredSignal().Empty() == false) + { + this.HoveredSignal().Disconnect(_hoverEventCallback); + } + + } + } + + // Callback for View Hover signal + private bool OnHoverEvent(IntPtr view, IntPtr hoverEvent) + { + HoverEventArgs e = new HoverEventArgs(); + + e.Hover = Tizen.NUI.Hover.GetHoverFromPtr(hoverEvent); + + if (_hoverEventHandler != null) + { + return _hoverEventHandler(this, e); + } + return false; + } + + + /// + /// Event arguments that passed via Wheel signal. + /// + public class WheelEventArgs : EventArgs + { + private Wheel _wheel; + + /// + /// WheelEvent - store a wheel rolling type : MOUSE_WHEEL or CUSTOM_WHEEL + /// + public Wheel Wheel + { + get + { + return _wheel; + } + set + { + _wheel = value; + } + } + } + + private EventHandlerWithReturnType _wheelEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool WheelEventCallbackType(IntPtr view, IntPtr wheelEvent); + private WheelEventCallbackType _wheelEventCallback; + + /// + /// Event for WheelMoved signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// WheelMoved signal is emitted when wheel event is received.
+ ///
+ public event EventHandlerWithReturnType WheelEvent + { + add + { + if (_wheelEventHandler == null) + { + _wheelEventCallback = OnWheelEvent; + this.WheelEventSignal().Connect(_wheelEventCallback); + } + + _wheelEventHandler += value; + } + + remove + { + _wheelEventHandler -= value; + + if (_wheelEventHandler == null && WheelEventSignal().Empty() == false) + { + this.WheelEventSignal().Disconnect(_wheelEventCallback); + } + + } + } + + // Callback for View Wheel signal + private bool OnWheelEvent(IntPtr view, IntPtr wheelEvent) + { + WheelEventArgs e = new WheelEventArgs(); + + e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(wheelEvent); + + if (_wheelEventHandler != null) + { + return _wheelEventHandler(this, e); + } + return false; + } + + + private EventHandler _onWindowEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OnWindowEventCallbackType(IntPtr control); + private OnWindowEventCallbackType _onWindowEventCallback; + + /// + /// Event for OnWindow signal which can be used to subscribe/unsubscribe the event handler.
+ /// OnWindow signal is emitted after the view has been connected to the Window.
+ ///
+ public event EventHandler AddedToWindow + { + add + { + if (_onWindowEventHandler == null) + { + _onWindowEventCallback = OnWindow; + this.OnWindowSignal().Connect(_onWindowEventCallback); + } + + _onWindowEventHandler += value; + } + + remove + { + _onWindowEventHandler -= value; + + if (_onWindowEventHandler == null && OnWindowSignal().Empty() == false) + { + this.OnWindowSignal().Disconnect(_onWindowEventCallback); + } + } + } + + // Callback for View OnWindow signal + private void OnWindow(IntPtr data) + { + if (_onWindowEventHandler != null) + { + _onWindowEventHandler(this, null); + } + } + + + private EventHandler _offWindowEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OffWindowEventCallbackType(IntPtr control); + private OffWindowEventCallbackType _offWindowEventCallback; + + /// + /// Event for OffWindow signal which can be used to subscribe/unsubscribe the event handler.
+ /// OffWindow signal is emitted after the view has been disconnected from the Window.
+ ///
+ public event EventHandler RemovedFromWindow + { + add + { + if (_offWindowEventHandler == null) + { + _offWindowEventCallback = OffWindow; + this.OffWindowSignal().Connect(_offWindowEventCallback); + } + + _offWindowEventHandler += value; + } + + remove + { + _offWindowEventHandler -= value; + + if (_offWindowEventHandler == null && OffWindowSignal().Empty() == false) + { + this.OffWindowSignal().Disconnect(_offWindowEventCallback); + } + } + } + + // Callback for View OffWindow signal + private void OffWindow(IntPtr data) + { + if (_offWindowEventHandler != null) + { + _offWindowEventHandler(this, null); + } + } + + /// + /// Event arguments of visibility changed. + /// + public class VisibilityChangedEventArgs : EventArgs + { + private View _view; + private bool _visibility; + private VisibilityChangeType _type; + + /// + /// The view, or child of view, whose visibility has changed. + /// + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + + /// + /// Whether the view is now visible or not. + /// + public bool Visibility + { + get + { + return _visibility; + } + set + { + _visibility = value; + } + } + + /// + /// Whether the view's visible property has changed or a parent's. + /// + public VisibilityChangeType Type + { + get + { + return _type; + } + set + { + _type = value; + } + } + } + + private EventHandler _visibilityChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void VisibilityChangedEventCallbackType(IntPtr data, bool visibility, VisibilityChangeType type); + private VisibilityChangedEventCallbackType _visibilityChangedEventCallback; + + /// + /// Event for visibility change which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted when the visible property of this or a parent view is changed.
+ ///
+ public event EventHandler VisibilityChanged + { + add + { + if (_visibilityChangedEventHandler == null) + { + _visibilityChangedEventCallback = OnVisibilityChanged; + VisibilityChangedSignal(this).Connect(_visibilityChangedEventCallback); + } + + _visibilityChangedEventHandler += value; + } + + remove + { + _visibilityChangedEventHandler -= value; + + if (_visibilityChangedEventHandler == null && VisibilityChangedSignal(this).Empty() == false) + { + VisibilityChangedSignal(this).Disconnect(_visibilityChangedEventCallback); + } + } + } + + // Callback for View visibility change signal + private void OnVisibilityChanged(IntPtr data, bool visibility, VisibilityChangeType type) + { + VisibilityChangedEventArgs e = new VisibilityChangedEventArgs(); + if (data != null) + { + e.View = Registry.GetManagedBaseHandleFromNativePtr(data) as View; + } + e.Visibility = visibility; + e.Type = type; + + if (_visibilityChangedEventHandler != null) + { + _visibilityChangedEventHandler(this, e); + } + } + + // Resource Ready Signal + + private EventHandler _resourcesLoadedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ResourcesLoadedCallbackType(IntPtr control); + private ResourcesLoadedCallbackType _ResourcesLoadedCallback; + + /// + /// Event for ResourcesLoadedSignal signal which can be used to subscribe/unsubscribe the event handler provided by the user.
+ /// This signal is emitted after all resources required by a View are loaded and ready.
+ ///
+ public event EventHandler ResourcesLoaded + { + add + { + if (_resourcesLoadedEventHandler == null) + { + _ResourcesLoadedCallback = OnResourcesLoaded; + this.ResourcesLoadedSignal().Connect(_ResourcesLoadedCallback); + } + + _resourcesLoadedEventHandler += value; + } + + remove + { + _resourcesLoadedEventHandler -= value; + + if (_resourcesLoadedEventHandler == null && ResourcesLoadedSignal().Empty() == false) + { + this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback); + } + } + } + + private void OnResourcesLoaded(IntPtr view) + { + if (_resourcesLoadedEventHandler != null) + { + _resourcesLoadedEventHandler(this, null); + } + } + + internal IntPtr GetPtrfromView() + { + return (IntPtr)swigCPtr; + } + + internal class Property + { + internal static readonly int TOOLTIP = NDalicManualPINVOKE.View_Property_TOOLTIP_get(); + internal static readonly int STATE = NDalicManualPINVOKE.View_Property_STATE_get(); + internal static readonly int SUB_STATE = NDalicManualPINVOKE.View_Property_SUB_STATE_get(); + internal static readonly int LEFT_FOCUSABLE_VIEW_ID = NDalicManualPINVOKE.View_Property_LEFT_FOCUSABLE_ACTOR_ID_get(); + internal static readonly int RIGHT_FOCUSABLE_VIEW_ID = NDalicManualPINVOKE.View_Property_RIGHT_FOCUSABLE_ACTOR_ID_get(); + internal static readonly int UP_FOCUSABLE_VIEW_ID = NDalicManualPINVOKE.View_Property_UP_FOCUSABLE_ACTOR_ID_get(); + internal static readonly int DOWN_FOCUSABLE_VIEW_ID = NDalicManualPINVOKE.View_Property_DOWN_FOCUSABLE_ACTOR_ID_get(); + internal static readonly int STYLE_NAME = NDalicPINVOKE.View_Property_STYLE_NAME_get(); + internal static readonly int BACKGROUND = NDalicPINVOKE.View_Property_BACKGROUND_get(); + internal static readonly int SIBLING_ORDER = NDalicManualPINVOKE.Actor_Property_SIBLING_ORDER_get(); + internal static readonly int OPACITY = NDalicManualPINVOKE.Actor_Property_OPACITY_get(); + internal static readonly int SCREEN_POSITION = NDalicManualPINVOKE.Actor_Property_SCREEN_POSITION_get(); + internal static readonly int POSITION_USES_ANCHOR_POINT = NDalicManualPINVOKE.Actor_Property_POSITION_USES_ANCHOR_POINT_get(); + internal static readonly int PARENT_ORIGIN = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_get(); + internal static readonly int PARENT_ORIGIN_X = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_X_get(); + internal static readonly int PARENT_ORIGIN_Y = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Y_get(); + internal static readonly int PARENT_ORIGIN_Z = NDalicPINVOKE.Actor_Property_PARENT_ORIGIN_Z_get(); + internal static readonly int ANCHOR_POINT = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_get(); + internal static readonly int ANCHOR_POINT_X = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_X_get(); + internal static readonly int ANCHOR_POINT_Y = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Y_get(); + internal static readonly int ANCHOR_POINT_Z = NDalicPINVOKE.Actor_Property_ANCHOR_POINT_Z_get(); + internal static readonly int SIZE = NDalicPINVOKE.Actor_Property_SIZE_get(); + internal static readonly int SIZE_WIDTH = NDalicPINVOKE.Actor_Property_SIZE_WIDTH_get(); + internal static readonly int SIZE_HEIGHT = NDalicPINVOKE.Actor_Property_SIZE_HEIGHT_get(); + internal static readonly int SIZE_DEPTH = NDalicPINVOKE.Actor_Property_SIZE_DEPTH_get(); + internal static readonly int POSITION = NDalicPINVOKE.Actor_Property_POSITION_get(); + internal static readonly int POSITION_X = NDalicPINVOKE.Actor_Property_POSITION_X_get(); + internal static readonly int POSITION_Y = NDalicPINVOKE.Actor_Property_POSITION_Y_get(); + internal static readonly int POSITION_Z = NDalicPINVOKE.Actor_Property_POSITION_Z_get(); + internal static readonly int WORLD_POSITION = NDalicPINVOKE.Actor_Property_WORLD_POSITION_get(); + internal static readonly int WORLD_POSITION_X = NDalicPINVOKE.Actor_Property_WORLD_POSITION_X_get(); + internal static readonly int WORLD_POSITION_Y = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Y_get(); + internal static readonly int WORLD_POSITION_Z = NDalicPINVOKE.Actor_Property_WORLD_POSITION_Z_get(); + internal static readonly int ORIENTATION = NDalicPINVOKE.Actor_Property_ORIENTATION_get(); + internal static readonly int WORLD_ORIENTATION = NDalicPINVOKE.Actor_Property_WORLD_ORIENTATION_get(); + internal static readonly int SCALE = NDalicPINVOKE.Actor_Property_SCALE_get(); + internal static readonly int SCALE_X = NDalicPINVOKE.Actor_Property_SCALE_X_get(); + internal static readonly int SCALE_Y = NDalicPINVOKE.Actor_Property_SCALE_Y_get(); + internal static readonly int SCALE_Z = NDalicPINVOKE.Actor_Property_SCALE_Z_get(); + internal static readonly int WORLD_SCALE = NDalicPINVOKE.Actor_Property_WORLD_SCALE_get(); + internal static readonly int VISIBLE = NDalicPINVOKE.Actor_Property_VISIBLE_get(); + internal static readonly int WORLD_COLOR = NDalicPINVOKE.Actor_Property_WORLD_COLOR_get(); + internal static readonly int WORLD_MATRIX = NDalicPINVOKE.Actor_Property_WORLD_MATRIX_get(); + internal static readonly int NAME = NDalicPINVOKE.Actor_Property_NAME_get(); + internal static readonly int SENSITIVE = NDalicPINVOKE.Actor_Property_SENSITIVE_get(); + internal static readonly int LEAVE_REQUIRED = NDalicPINVOKE.Actor_Property_LEAVE_REQUIRED_get(); + internal static readonly int INHERIT_ORIENTATION = NDalicPINVOKE.Actor_Property_INHERIT_ORIENTATION_get(); + internal static readonly int INHERIT_SCALE = NDalicPINVOKE.Actor_Property_INHERIT_SCALE_get(); + internal static readonly int DRAW_MODE = NDalicPINVOKE.Actor_Property_DRAW_MODE_get(); + internal static readonly int SIZE_MODE_FACTOR = NDalicPINVOKE.Actor_Property_SIZE_MODE_FACTOR_get(); + internal static readonly int WIDTH_RESIZE_POLICY = NDalicPINVOKE.Actor_Property_WIDTH_RESIZE_POLICY_get(); + internal static readonly int HEIGHT_RESIZE_POLICY = NDalicPINVOKE.Actor_Property_HEIGHT_RESIZE_POLICY_get(); + internal static readonly int SIZE_SCALE_POLICY = NDalicPINVOKE.Actor_Property_SIZE_SCALE_POLICY_get(); + internal static readonly int WIDTH_FOR_HEIGHT = NDalicPINVOKE.Actor_Property_WIDTH_FOR_HEIGHT_get(); + internal static readonly int HEIGHT_FOR_WIDTH = NDalicPINVOKE.Actor_Property_HEIGHT_FOR_WIDTH_get(); + internal static readonly int PADDING = NDalicPINVOKE.Actor_Property_PADDING_get(); + internal static readonly int MINIMUM_SIZE = NDalicPINVOKE.Actor_Property_MINIMUM_SIZE_get(); + internal static readonly int MAXIMUM_SIZE = NDalicPINVOKE.Actor_Property_MAXIMUM_SIZE_get(); + internal static readonly int INHERIT_POSITION = NDalicPINVOKE.Actor_Property_INHERIT_POSITION_get(); + internal static readonly int CLIPPING_MODE = NDalicPINVOKE.Actor_Property_CLIPPING_MODE_get(); + } + + /// + /// Describes the direction to move the focus towards. + /// + public enum FocusDirection + { + Left, + Right, + Up, + Down, + PageUp, + PageDown + } + + /// + /// Creates a new instance of a View. + /// + public View() : this(NDalicPINVOKE.View_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal View(View uiControl) : this(NDalicPINVOKE.new_View__SWIG_1(View.getCPtr(uiControl)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Downcasts a handle to View handle.
+ /// If handle points to a View, the downcast produces valid handle.
+ /// If not, the returned handle is left uninitialized.
+ ///
+ /// Handle to an object + /// A handle to a View or an uninitialized handle + [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")] + public new static View DownCast(BaseHandle handle) + { + View ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as View; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated, instead please use as keyword.")] + public static T DownCast(View view) where T : View + { + T ret = Registry.GetManagedBaseHandleFromNativePtr(view) as T; + if (ret != null) + { + return ret; + } + return null; + } + + private View ConvertIdToView(uint id) + { + View view = null; + + if (Parent) + { + view = Parent.FindChildById(id); + } + + if (!view) + { + view = Window.Instance.GetRootLayer().FindChildById(id); + } + + return view; + } + + internal void SetKeyInputFocus() + { + NDalicPINVOKE.View_SetKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Quries whether the view has focus. + /// + /// true if this view has focus + public bool HasFocus() + { + bool ret = NDalicPINVOKE.View_HasKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void ClearKeyInputFocus() + { + NDalicPINVOKE.View_ClearKeyInputFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PinchGestureDetector GetPinchGestureDetector() + { + PinchGestureDetector ret = new PinchGestureDetector(NDalicPINVOKE.View_GetPinchGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal PanGestureDetector GetPanGestureDetector() + { + PanGestureDetector ret = new PanGestureDetector(NDalicPINVOKE.View_GetPanGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TapGestureDetector GetTapGestureDetector() + { + TapGestureDetector ret = new TapGestureDetector(NDalicPINVOKE.View_GetTapGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal LongPressGestureDetector GetLongPressGestureDetector() + { + LongPressGestureDetector ret = new LongPressGestureDetector(NDalicPINVOKE.View_GetLongPressGestureDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the name of the style to be applied to the view. + /// + /// A string matching a style described in a stylesheet + public void SetStyleName(string styleName) + { + NDalicPINVOKE.View_SetStyleName(swigCPtr, styleName); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the name of the style to be applied to the view (if any). + /// + /// A string matching a style, or an empty string + public string GetStyleName() + { + string ret = NDalicPINVOKE.View_GetStyleName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetBackgroundColor(Vector4 color) + { + NDalicPINVOKE.View_SetBackgroundColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector4 GetBackgroundColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.View_GetBackgroundColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetBackgroundImage(Image image) + { + NDalicPINVOKE.View_SetBackgroundImage(swigCPtr, Image.getCPtr(image)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Clears the background. + /// + public void ClearBackground() + { + NDalicPINVOKE.View_ClearBackground(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ControlKeySignal KeyEventSignal() + { + ControlKeySignal ret = new ControlKeySignal(NDalicPINVOKE.View_KeyEventSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal KeyInputFocusSignal KeyInputFocusGainedSignal() + { + KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusGainedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal KeyInputFocusSignal KeyInputFocusLostSignal() + { + KeyInputFocusSignal ret = new KeyInputFocusSignal(NDalicPINVOKE.View_KeyInputFocusLostSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal View(ViewImpl implementation) : this(NDalicPINVOKE.new_View__SWIG_2(ViewImpl.getCPtr(implementation)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal enum PropertyRange + { + PROPERTY_START_INDEX = PropertyRanges.PROPERTY_REGISTRATION_START_INDEX, + CONTROL_PROPERTY_START_INDEX = PROPERTY_START_INDEX, + CONTROL_PROPERTY_END_INDEX = CONTROL_PROPERTY_START_INDEX + 1000 + } + + /// + /// styleName, type string. + /// + public string StyleName + { + get + { + string temp; + GetProperty(View.Property.STYLE_NAME).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.STYLE_NAME, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// mutually exclusive with BACKGROUND_IMAGE & BACKGROUND, type Vector4. + /// + public Color BackgroundColor + { + get + { + Color backgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + + Tizen.NUI.PropertyMap background = Background; + int visualType = 0; + background.Find(Visual.Property.Type)?.Get(out visualType); + if (visualType == (int)Visual.Type.Color) + { + background.Find(ColorVisualProperty.MixColor)?.Get(backgroundColor); + } + + return backgroundColor; + } + set + { + SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Create an Animation to animate the background color visual. If there is no + /// background visual, creates one with transparent black as it's mixColor. + /// + public Animation AnimateBackgroundColor( object destinationValue, + int startTime, + int endTime, + AlphaFunction.BuiltinFunctions? alphaFunction = null, + object initialValue = null) + { + Tizen.NUI.PropertyMap background = Background; + + if( background.Empty() ) + { + // If there is no background yet, ensure there is a transparent + // color visual + BackgroundColor = new Color(0.0f, 0.0f, 0.0f, 0.0f); + background = Background; + } + return AnimateColor( "background", destinationValue, startTime, endTime, alphaFunction, initialValue ); + } + + /// + /// Create an Animation to animate the mixColor of the named visual. + /// + public Animation AnimateColor( string targetVisual, object destinationColor, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialColor = null ) + { + Animation animation = null; + { + PropertyMap _animator = new PropertyMap(); + if( alphaFunction != null ) + { + _animator.Add("alphaFunction", new PropertyValue( AlphaFunction.BuiltinToPropertyKey(alphaFunction) ) ); + } + + PropertyMap _timePeriod = new PropertyMap(); + _timePeriod.Add( "duration", new PropertyValue((endTime-startTime)/1000.0f) ); + _timePeriod.Add( "delay", new PropertyValue( startTime/1000.0f ) ); + _animator.Add( "timePeriod", new PropertyValue( _timePeriod ) ); + + PropertyMap _transition = new PropertyMap(); + _transition.Add( "animator", new PropertyValue( _animator ) ); + _transition.Add( "target", new PropertyValue( targetVisual ) ); + _transition.Add( "property", new PropertyValue( "mixColor" ) ); + + if( initialColor != null ) + { + PropertyValue initValue = PropertyValue.CreateFromObject( initialColor ); + _transition.Add( "initialValue", initValue ); + } + + PropertyValue destValue = PropertyValue.CreateFromObject( destinationColor ); + _transition.Add( "targetValue", destValue ); + TransitionData _transitionData = new TransitionData( _transition ); + + animation = new Animation( NDalicManualPINVOKE.View_CreateTransition(swigCPtr, TransitionData.getCPtr(_transitionData)), true ); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + return animation; + } + + /// + /// mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map. + /// + public string BackgroundImage + { + get + { + string backgroundImage = ""; + + Tizen.NUI.PropertyMap background = Background; + int visualType = 0; + background.Find(Visual.Property.Type)?.Get(out visualType); + if (visualType == (int)Visual.Type.Image) + { + background.Find(ImageVisualProperty.URL)?.Get(out backgroundImage); + } + + return backgroundImage; + } + set + { + SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value)); + } + } + + public Tizen.NUI.PropertyMap Background + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty( View.Property.BACKGROUND ).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.BACKGROUND, new Tizen.NUI.PropertyValue(value)); + } + } + + + /// + /// The current state of the view. + /// + public States State + { + get + { + int temp = 0; + if (GetProperty(View.Property.STATE).Get(out temp) == false) + { + NUILog.Error("State get error!"); + } + switch (temp) + { + case 0: + { + return States.Normal; + } + case 1: + { + return States.Focused; + } + case 2: + { + return States.Disabled; + } + default: + { + return States.Normal; + } + } + } + set + { + SetProperty(View.Property.STATE, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// The current sub state of the view. + /// + public States SubState + { + get + { + string temp; + if (GetProperty(View.Property.SUB_STATE).Get(out temp) == false) + { + NUILog.Error("subState get error!"); + } + switch (temp) + { + case "NORMAL": + return States.Normal; + case "FOCUSED": + return States.Focused; + case "DISABLED": + return States.Disabled; + default: + return States.Normal; + } + } + set + { + string valueToString = ""; + switch (value) + { + case States.Normal: + { + valueToString = "NORMAL"; + break; + } + case States.Focused: + { + valueToString = "FOCUSED"; + break; + } + case States.Disabled: + { + valueToString = "DISABLED"; + break; + } + default: + { + valueToString = "NORMAL"; + break; + } + } + SetProperty(View.Property.SUB_STATE, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// Displays a tooltip + /// + public Tizen.NUI.PropertyMap Tooltip + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(View.Property.TOOLTIP).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Displays a tooltip as Text + /// + public string TooltipText + { + set + { + SetProperty(View.Property.TOOLTIP, new Tizen.NUI.PropertyValue(value)); + } + } + + private int LeftFocusableViewId + { + get + { + int temp = 0; + GetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.LEFT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value)); + } + } + + private int RightFocusableViewId + { + get + { + int temp = 0; + GetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.RIGHT_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value)); + } + } + + private int UpFocusableViewId + { + get + { + int temp = 0; + GetProperty(View.Property.UP_FOCUSABLE_VIEW_ID).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.UP_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value)); + } + } + + private int DownFocusableViewId + { + get + { + int temp = 0; + GetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.DOWN_FOCUSABLE_VIEW_ID, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Child Property of FlexContainer.
+ /// The proportion of the free space in the container the flex item will receive.
+ /// If all items in the container set this property, their sizes will be proportional to the specified flex factor.
+ ///
+ public float Flex + { + get + { + float temp = 0.0f; + GetProperty(FlexContainer.ChildProperty.FLEX).Get(out temp); + return temp; + } + set + { + SetProperty(FlexContainer.ChildProperty.FLEX, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Child Property of FlexContainer.
+ /// The alignment of the flex item along the cross axis, which, if set, overides the default alignment for all items in the container.
+ ///
+ public int AlignSelf + { + get + { + int temp = 0; + GetProperty(FlexContainer.ChildProperty.ALIGN_SELF).Get(out temp); + return temp; + } + set + { + SetProperty(FlexContainer.ChildProperty.ALIGN_SELF, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Child Property of FlexContainer.
+ /// The space around the flex item.
+ ///
+ public Vector4 FlexMargin + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(FlexContainer.ChildProperty.FLEX_MARGIN).Get(temp); + return temp; + } + set + { + SetProperty(FlexContainer.ChildProperty.FLEX_MARGIN, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The top-left cell this child occupies, if not set, the first available cell is used + /// + public Vector2 CellIndex + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(TableView.ChildProperty.CELL_INDEX).Get(temp); + return temp; + } + set + { + SetProperty(TableView.ChildProperty.CELL_INDEX, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The number of rows this child occupies, if not set, default value is 1 + /// + public float RowSpan + { + get + { + float temp = 0.0f; + GetProperty(TableView.ChildProperty.ROW_SPAN).Get(out temp); + return temp; + } + set + { + SetProperty(TableView.ChildProperty.ROW_SPAN, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The number of columns this child occupies, if not set, default value is 1 + /// + public float ColumnSpan + { + get + { + float temp = 0.0f; + GetProperty(TableView.ChildProperty.COLUMN_SPAN).Get(out temp); + return temp; + } + set + { + SetProperty(TableView.ChildProperty.COLUMN_SPAN, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The horizontal alignment of this child inside the cells, if not set, default value is 'left' + /// + public Tizen.NUI.HorizontalAlignmentType CellHorizontalAlignment + { + get + { + string temp; + if (GetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("CellHorizontalAlignment get error!"); + } + + switch (temp) + { + case "left": + return Tizen.NUI.HorizontalAlignmentType.Left; + case "center": + return Tizen.NUI.HorizontalAlignmentType.Center; + case "right": + return Tizen.NUI.HorizontalAlignmentType.Right; + default: + return Tizen.NUI.HorizontalAlignmentType.Left; + } + } + set + { + string valueToString = ""; + switch (value) + { + case Tizen.NUI.HorizontalAlignmentType.Left: + { + valueToString = "left"; + break; + } + case Tizen.NUI.HorizontalAlignmentType.Center: + { + valueToString = "center"; + break; + } + case Tizen.NUI.HorizontalAlignmentType.Right: + { + valueToString = "right"; + break; + } + default: + { + valueToString = "left"; + break; + } + } + SetProperty(TableView.ChildProperty.CELL_HORIZONTAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// The vertical alignment of this child inside the cells, if not set, default value is 'top' + /// + public Tizen.NUI.VerticalAlignmentType CellVerticalAlignment + { + get + { + string temp; + GetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT).Get(out temp); + { + NUILog.Error("CellVerticalAlignment get error!"); + } + + switch (temp) + { + case "top": + return Tizen.NUI.VerticalAlignmentType.Top; + case "center": + return Tizen.NUI.VerticalAlignmentType.Center; + case "bottom": + return Tizen.NUI.VerticalAlignmentType.Bottom; + default: + return Tizen.NUI.VerticalAlignmentType.Top; + } + } + set + { + string valueToString = ""; + switch (value) + { + case Tizen.NUI.VerticalAlignmentType.Top: + { + valueToString = "top"; + break; + } + case Tizen.NUI.VerticalAlignmentType.Center: + { + valueToString = "center"; + break; + } + case Tizen.NUI.VerticalAlignmentType.Bottom: + { + valueToString = "bottom"; + break; + } + default: + { + valueToString = "top"; + break; + } + } + SetProperty(TableView.ChildProperty.CELL_VERTICAL_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// The left focusable view.
+ /// This will return NULL if not set.
+ /// This will also return NULL if the specified left focusable view is not on Window.
+ ///
+ public View LeftFocusableView + { + // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. + get + { + if (LeftFocusableViewId >= 0) + { + return ConvertIdToView((uint)LeftFocusableViewId); + } + return null; + } + set + { + LeftFocusableViewId = (int)value.GetId(); + } + } + + /// + /// The right focusable view.
+ /// This will return NULL if not set.
+ /// This will also return NULL if the specified right focusable view is not on Window.
+ ///
+ public View RightFocusableView + { + // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. + get + { + if (RightFocusableViewId >= 0) + { + return ConvertIdToView((uint)RightFocusableViewId); + } + return null; + } + set + { + RightFocusableViewId = (int)value.GetId(); + } + } + + /// + /// The up focusable view.
+ /// This will return NULL if not set.
+ /// This will also return NULL if the specified up focusable view is not on Window.
+ ///
+ public View UpFocusableView + { + // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. + get + { + if (UpFocusableViewId >= 0) + { + return ConvertIdToView((uint)UpFocusableViewId); + } + return null; + } + set + { + UpFocusableViewId = (int)value.GetId(); + } + } + + /// + /// The down focusable view.
+ /// This will return NULL if not set.
+ /// This will also return NULL if the specified down focusable view is not on Window.
+ ///
+ public View DownFocusableView + { + // As native side will be only storing IDs so need a logic to convert View to ID and vice-versa. + get + { + if (DownFocusableViewId >= 0) + { + return ConvertIdToView((uint)DownFocusableViewId); + } + return null; + } + set + { + DownFocusableViewId = (int)value.GetId(); + } + } + + /// + /// whether the view should be focusable by keyboard navigation. + /// + public bool Focusable + { + set + { + SetKeyboardFocusable(value); + } + get + { + return IsKeyboardFocusable(); + } + } + + /// + /// Enumeration for describing the states of view. + /// + public enum States + { + /// + /// Normal state + /// + Normal, + /// + /// Focused state + /// + Focused, + /// + /// Disabled state + /// + Disabled + } + + /// + /// Retrieves the position of the View.
+ /// The coordinates are relative to the View's parent.
+ ///
+ public Position CurrentPosition + { + get + { + return GetCurrentPosition(); + } + } + + /// + /// Sets the size of an view for width and height.
+ /// Geometry can be scaled to fit within this area.
+ /// This does not interfere with the views scale factor.
+ /// The views default depth is the minimum of width & height.
+ ///
+ public Size2D Size2D + { + get + { + Size temp = new Size(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.SIZE).Get(temp); + Size2D size = new Size2D((int)temp.Width, (int)temp.Height); + return size; + } + set + { + SetProperty(View.Property.SIZE, new Tizen.NUI.PropertyValue(new Size(value))); + } + } + + /// + /// Retrieves the size of the View.
+ /// The coordinates are relative to the View's parent.
+ ///
+ public Size2D CurrentSize + { + get + { + return GetCurrentSize(); + } + } + + /// + /// Retrieves the view's parent.
+ ///
+ public View Parent + { + get + { + return GetParent(); + } + } + + [Obsolete("Please do not use! this will be deprecated. Please use Visibility instead.")] + public bool Visible + { + get + { + return IsVisible(); + } + } + + /// + /// Retrieves and sets the view's opacity.
+ ///
+ public float Opacity + { + get + { + float temp = 0.0f; + GetProperty(View.Property.OPACITY).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Sets the position of the View for X and Y.
+ /// By default, sets the position vector between the parent origin and pivot point(default).
+ /// If Position inheritance if disabled, sets the world position.
+ ///
+ public Position2D Position2D + { + get + { + Position temp = new Position(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.POSITION).Get(temp); + return new Position2D(temp); + } + set + { + SetProperty(View.Property.POSITION, new Tizen.NUI.PropertyValue(new Position(value))); + } + } + + /// + /// Retrieves screen postion of view's.
+ ///
+ public Vector2 ScreenPosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(View.Property.SCREEN_POSITION).Get(temp); + return temp; + } + } + + /// + /// Determines whether the pivot point should be used to determine the position of the view. + /// This is true by default. + /// + /// If false, then the top-left of the view is used for the position. + /// Setting this to false will allow scaling or rotation around the anchor-point without affecting the view's position. + /// + public bool PositionUsesPivotPoint + { + get + { + bool temp = false; + GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public bool PositionUsesAnchorPoint + { + get + { + bool temp = false; + GetProperty(View.Property.POSITION_USES_ANCHOR_POINT).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION_USES_ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); + } + } + + internal bool FocusState + { + get + { + return IsKeyboardFocusable(); + } + set + { + SetKeyboardFocusable(value); + } + } + + /// + /// Queries whether the view is connected to the Stage.
+ /// When an view is connected, it will be directly or indirectly parented to the root View.
+ ///
+ public bool IsOnWindow + { + get + { + return OnWindow(); + } + } + + /// + /// Gets depth in the hierarchy for the view. + /// + public int HierarchyDepth + { + get + { + return GetHierarchyDepth(); + } + } + + /// + /// Sets the sibling order of the view so depth position can be defined within the same parent. + /// + /// + /// Note The initial value is 0. + /// Raise, Lower, RaiseToTop, LowerToBottom, RaiseAbove and LowerBelow will override the sibling order. + /// The values set by this Property will likely change. + /// + public int SiblingOrder + { + get + { + int temp = 0; + GetProperty(View.Property.SIBLING_ORDER).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SIBLING_ORDER, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Returns the natural size of the view. + /// + /// + /// Deriving classes stipulate the natural size and by default a view has a ZERO natural size. + /// + [Obsolete("Please do not use! this will be deprecated, please use NaturalSize2D instead")] + public Vector3 NaturalSize + { + get + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Returns the natural size (Size2D) of the view. + /// + /// + /// Deriving classes stipulate the natural size and by default a view has a ZERO natural size. + /// + public Size2D NaturalSize2D + { + get + { + Vector3 temp = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return new Size2D((int)temp.Width, (int)temp.Height); + } + } + + /// + /// Shows the View. + /// + /// + /// This is an asynchronous method. + /// + public void Show() + { + SetVisible(true); + } + + /// + /// Hides the View. + /// + /// + /// This is an asynchronous method. + /// If an view is hidden, then the view and its children will not be rendered. + /// This is regardless of the individual visibility of the children i.e.an view will only be rendered if all of its parents are shown. + /// + public void Hide() + { + SetVisible(false); + } + + internal void Raise() + { + NDalicPINVOKE.Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Lower() + { + NDalicPINVOKE.Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Raise view above all other views. + /// + /// + /// Sibling order of views within the parent will be updated automatically. + /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. + /// + public void RaiseToTop() + { + NDalicPINVOKE.RaiseToTop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Lower view to the bottom of all views. + /// + /// + /// Sibling order of views within the parent will be updated automatically. + /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. + /// + public void LowerToBottom() + { + NDalicPINVOKE.LowerToBottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Query if all resources required by a View are loaded and ready. + /// + /// Most resources are only loaded when the control is placed on stage + /// + public bool IsResourceReady() + { + bool ret = NDalicPINVOKE.IsResourceReady(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Raise the view to above the target view. + /// + /// Sibling order of views within the parent will be updated automatically. + /// Views on the level above the target view will still be shown above this view. + /// Raising this view above views with the same sibling order as each other will raise this view above them. + /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. + /// + /// Will be raised above this view + internal void RaiseAbove(View target) + { + NDalicPINVOKE.RaiseAbove(swigCPtr, View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Lower the view to below the target view. + /// + /// Sibling order of views within the parent will be updated automatically. + /// Lowering this view below views with the same sibling order as each other will lower this view above them. + /// Once a raise or lower API is used that view will then have an exclusive sibling order independent of insertion. + /// + /// Will be lowered below this view + internal void LowerBelow(View target) + { + NDalicPINVOKE.RaiseAbove(swigCPtr, View.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal string GetName() + { + string ret = NDalicPINVOKE.Actor_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetName(string name) + { + NDalicPINVOKE.Actor_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal uint GetId() + { + uint ret = NDalicPINVOKE.Actor_GetId(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool IsRoot() + { + bool ret = NDalicPINVOKE.Actor_IsRoot(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool OnWindow() + { + bool ret = NDalicPINVOKE.Actor_OnStage(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Layer GetLayer() + { + IntPtr cPtr = NDalicPINVOKE.Actor_GetLayer(swigCPtr); + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds a child view to this View. + /// + ///
This View(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent view.
+ /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. + /// If the child already has a parent, it will be removed from old parent and reparented to this view. This may change child's position, color, scale etc as it now inherits them from this view. + /// The child + public void Add(View child) + { + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a child View from this View. If the view was not a child of this view, this is a no-op. + /// + ///
This View(the parent) has been initialized. The child view is not the same as the parent view.
+ /// The child + public void Remove(View child) + { + NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a View from its Parent View / Layer. If the View has no parent, this method does nothing. + /// + ///
The (child) View has been initialized. 
+ public void Unparent() + { + NDalicPINVOKE.Actor_Unparent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the number of children held by the view. + /// + ///
The View has been initialized.
+ /// The number of children + internal uint GetChildCount() + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves child view by index. + /// + ///
The View has been initialized.
+ /// The index of the child to retrieve + /// The view for the given index or empty handle if children not initialized + public View GetChildAt(uint index) + { + IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret ?? null; + } + + /// + /// Search through this view's hierarchy for an view with the given name. + /// The view itself is also considered in the search. + /// + ///
The View has been initialized.
+ /// The name of the view to find + /// A handle to the view if found, or an empty handle if not + public View FindChildByName(string viewName) + { + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildByName(swigCPtr, viewName); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal View FindChildById(uint id) + { + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /*internal View GetParent() + { + View ret; + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + + if(basehandle is Layer) + { + ret = new View(cPtr,false); + } + else + { + ret = basehandle as View; + } + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + }*/ + + internal View GetParent() + { + View ret; + IntPtr cPtr = NDalicPINVOKE.Actor_GetParent(swigCPtr); + + BaseHandle basehandle = Registry.GetManagedBaseHandleFromNativePtr(cPtr); + + if(basehandle is Layer) + { + View ret2 = new View(cPtr,false); + return ret2; + } + + ret = basehandle as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetParentOrigin(Vector3 origin) + { + NDalicPINVOKE.Actor_SetParentOrigin(swigCPtr, Vector3.getCPtr(origin)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector3 GetCurrentParentOrigin() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetCurrentParentOrigin(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetAnchorPoint(Vector3 anchorPoint) + { + NDalicPINVOKE.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector3 GetCurrentAnchorPoint() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetCurrentAnchorPoint(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetSize(float width, float height) + { + NDalicPINVOKE.Actor_SetSize__SWIG_0(swigCPtr, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetSize(float width, float height, float depth) + { + NDalicPINVOKE.Actor_SetSize__SWIG_1(swigCPtr, width, height, depth); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetSize(Vector2 size) + { + NDalicPINVOKE.Actor_SetSize__SWIG_2(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetSize(Vector3 size) + { + NDalicPINVOKE.Actor_SetSize__SWIG_3(swigCPtr, Vector3.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector3 GetTargetSize() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetTargetSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Size2D GetCurrentSize() + { + Size ret = new Size(NDalicPINVOKE.Actor_GetCurrentSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Size2D size = new Size2D((int)ret.Width, (int)ret.Height); + return size; + } + + internal Vector3 GetNaturalSize() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetNaturalSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetPosition(float x, float y) + { + NDalicPINVOKE.Actor_SetPosition__SWIG_0(swigCPtr, x, y); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetPosition(float x, float y, float z) + { + NDalicPINVOKE.Actor_SetPosition__SWIG_1(swigCPtr, x, y, z); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetPosition(Vector3 position) + { + NDalicPINVOKE.Actor_SetPosition__SWIG_2(swigCPtr, Vector3.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetX(float x) + { + NDalicPINVOKE.Actor_SetX(swigCPtr, x); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetY(float y) + { + NDalicPINVOKE.Actor_SetY(swigCPtr, y); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetZ(float z) + { + NDalicPINVOKE.Actor_SetZ(swigCPtr, z); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void TranslateBy(Vector3 distance) + { + NDalicPINVOKE.Actor_TranslateBy(swigCPtr, Vector3.getCPtr(distance)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Position GetCurrentPosition() + { + Position ret = new Position(NDalicPINVOKE.Actor_GetCurrentPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector3 GetCurrentWorldPosition() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetCurrentWorldPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetInheritPosition(bool inherit) + { + NDalicPINVOKE.Actor_SetInheritPosition(swigCPtr, inherit); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsPositionInherited() + { + bool ret = NDalicPINVOKE.Actor_IsPositionInherited(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetOrientation(Degree angle, Vector3 axis) + { + NDalicPINVOKE.Actor_SetOrientation__SWIG_0(swigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetOrientation(Radian angle, Vector3 axis) + { + NDalicPINVOKE.Actor_SetOrientation__SWIG_1(swigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetOrientation(Rotation orientation) + { + NDalicPINVOKE.Actor_SetOrientation__SWIG_2(swigCPtr, Rotation.getCPtr(orientation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RotateBy(Degree angle, Vector3 axis) + { + NDalicPINVOKE.Actor_RotateBy__SWIG_0(swigCPtr, Degree.getCPtr(angle), Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RotateBy(Radian angle, Vector3 axis) + { + NDalicPINVOKE.Actor_RotateBy__SWIG_1(swigCPtr, Radian.getCPtr(angle), Vector3.getCPtr(axis)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RotateBy(Rotation relativeRotation) + { + NDalicPINVOKE.Actor_RotateBy__SWIG_2(swigCPtr, Rotation.getCPtr(relativeRotation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Rotation GetCurrentOrientation() + { + Rotation ret = new Rotation(NDalicPINVOKE.Actor_GetCurrentOrientation(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetInheritOrientation(bool inherit) + { + NDalicPINVOKE.Actor_SetInheritOrientation(swigCPtr, inherit); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsOrientationInherited() + { + bool ret = NDalicPINVOKE.Actor_IsOrientationInherited(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Rotation GetCurrentWorldOrientation() + { + Rotation ret = new Rotation(NDalicPINVOKE.Actor_GetCurrentWorldOrientation(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetScale(float scale) + { + NDalicPINVOKE.Actor_SetScale__SWIG_0(swigCPtr, scale); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetScale(float scaleX, float scaleY, float scaleZ) + { + NDalicPINVOKE.Actor_SetScale__SWIG_1(swigCPtr, scaleX, scaleY, scaleZ); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetScale(Vector3 scale) + { + NDalicPINVOKE.Actor_SetScale__SWIG_2(swigCPtr, Vector3.getCPtr(scale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void ScaleBy(Vector3 relativeScale) + { + NDalicPINVOKE.Actor_ScaleBy(swigCPtr, Vector3.getCPtr(relativeScale)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector3 GetCurrentScale() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetCurrentScale(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector3 GetCurrentWorldScale() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetCurrentWorldScale(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetInheritScale(bool inherit) + { + NDalicPINVOKE.Actor_SetInheritScale(swigCPtr, inherit); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsScaleInherited() + { + bool ret = NDalicPINVOKE.Actor_IsScaleInherited(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Matrix GetCurrentWorldMatrix() + { + Matrix ret = new Matrix(NDalicPINVOKE.Actor_GetCurrentWorldMatrix(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetVisible(bool visible) + { + NDalicPINVOKE.Actor_SetVisible(swigCPtr, visible); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsVisible() + { + bool ret = NDalicPINVOKE.Actor_IsVisible(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetOpacity(float opacity) + { + NDalicPINVOKE.Actor_SetOpacity(swigCPtr, opacity); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetCurrentOpacity() + { + float ret = NDalicPINVOKE.Actor_GetCurrentOpacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetColor(Vector4 color) + { + NDalicPINVOKE.Actor_SetColor(swigCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector4 GetCurrentColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Actor_GetCurrentColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetColorMode(ColorMode colorMode) + { + NDalicPINVOKE.Actor_SetColorMode(swigCPtr, (int)colorMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ColorMode GetColorMode() + { + ColorMode ret = (ColorMode)NDalicPINVOKE.Actor_GetColorMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector4 GetCurrentWorldColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Actor_GetCurrentWorldColor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetDrawMode(DrawModeType drawMode) + { + NDalicPINVOKE.Actor_SetDrawMode(swigCPtr, (int)drawMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal DrawModeType GetDrawMode() + { + DrawModeType ret = (DrawModeType)NDalicPINVOKE.Actor_GetDrawMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Converts screen coordinates into the view's coordinate system using the default camera. + /// + ///
The View has been initialized.
+ /// The view coordinates are relative to the top-left(0.0, 0.0, 0.5) + /// On return, the X-coordinate relative to the view + /// On return, the Y-coordinate relative to the view + /// The screen X-coordinate + /// The screen Y-coordinate + /// True if the conversion succeeded + public bool ScreenToLocal(out float localX, out float localY, float screenX, float screenY) + { + bool ret = NDalicPINVOKE.Actor_ScreenToLocal(swigCPtr, out localX, out localY, screenX, screenY); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetKeyboardFocusable(bool focusable) + { + NDalicPINVOKE.Actor_SetKeyboardFocusable(swigCPtr, focusable); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsKeyboardFocusable() + { + bool ret = NDalicPINVOKE.Actor_IsKeyboardFocusable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + NDalicPINVOKE.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ResizePolicyType GetResizePolicy(DimensionType dimension) + { + ResizePolicyType ret = (ResizePolicyType)NDalicPINVOKE.Actor_GetResizePolicy(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the relative to parent size factor of the view.
+ /// This factor is only used when ResizePolicy is set to either: + /// ResizePolicy::SIZE_RELATIVE_TO_PARENT or ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT.
+ /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicy.
+ ///
+ ///
The View has been initialized.
+ /// A Vector3 representing the relative factor to be applied to each axis + public void SetSizeModeFactor(Vector3 factor) + { + NDalicPINVOKE.Actor_SetSizeModeFactor(swigCPtr, Vector3.getCPtr(factor)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector3 GetSizeModeFactor() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Actor_GetSizeModeFactor(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Calculates the height of the view given a width.
+ /// The natural size is used for default calculation.
+ /// size 0 is treated as aspect ratio 1:1.
+ ///
+ /// Width to use + /// The height based on the width + public float GetHeightForWidth(float width) + { + float ret = NDalicPINVOKE.Actor_GetHeightForWidth(swigCPtr, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Calculates the width of the view given a height.
+ /// The natural size is used for default calculation.
+ /// size 0 is treated as aspect ratio 1:1.
+ ///
+ /// Height to use + /// The width based on the height + public float GetWidthForHeight(float height) + { + float ret = NDalicPINVOKE.Actor_GetWidthForHeight(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public float GetRelayoutSize(DimensionType dimension) + { + float ret = NDalicPINVOKE.Actor_GetRelayoutSize(swigCPtr, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetPadding(PaddingType padding) + { + NDalicPINVOKE.Actor_SetPadding(swigCPtr, PaddingType.getCPtr(padding)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void GetPadding(PaddingType paddingOut) + { + NDalicPINVOKE.Actor_GetPadding(swigCPtr, PaddingType.getCPtr(paddingOut)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetMinimumSize(Vector2 size) + { + NDalicPINVOKE.Actor_SetMinimumSize(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector2 GetMinimumSize() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Actor_GetMinimumSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetMaximumSize(Vector2 size) + { + NDalicPINVOKE.Actor_SetMaximumSize(swigCPtr, Vector2.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector2 GetMaximumSize() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Actor_GetMaximumSize(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal int GetHierarchyDepth() + { + int ret = NDalicPINVOKE.Actor_GetHierarchyDepth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint AddRenderer(Renderer renderer) + { + uint ret = NDalicPINVOKE.Actor_AddRenderer(swigCPtr, Renderer.getCPtr(renderer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal uint GetRendererCount() + { + uint ret = NDalicPINVOKE.Actor_GetRendererCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Renderer GetRendererAt(uint index) + { + IntPtr cPtr = NDalicPINVOKE.Actor_GetRendererAt(swigCPtr, index); + Renderer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Renderer; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RemoveRenderer(Renderer renderer) + { + NDalicPINVOKE.Actor_RemoveRenderer__SWIG_0(swigCPtr, Renderer.getCPtr(renderer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveRenderer(uint index) + { + NDalicPINVOKE.Actor_RemoveRenderer__SWIG_1(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal TouchDataSignal TouchSignal() + { + TouchDataSignal ret = new TouchDataSignal(NDalicPINVOKE.Actor_TouchSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal HoverSignal HoveredSignal() + { + HoverSignal ret = new HoverSignal(NDalicPINVOKE.Actor_HoveredSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WheelSignal WheelEventSignal() + { + WheelSignal ret = new WheelSignal(NDalicPINVOKE.Actor_WheelEventSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewSignal OnWindowSignal() + { + ViewSignal ret = new ViewSignal(NDalicPINVOKE.Actor_OnStageSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewSignal OffWindowSignal() + { + ViewSignal ret = new ViewSignal(NDalicPINVOKE.Actor_OffStageSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewSignal OnRelayoutSignal() + { + ViewSignal ret = new ViewSignal(NDalicPINVOKE.Actor_OnRelayoutSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewVisibilityChangedSignal VisibilityChangedSignal(View view) { + ViewVisibilityChangedSignal ret = new ViewVisibilityChangedSignal(NDalicPINVOKE.VisibilityChangedSignal(View.getCPtr(view)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewSignal ResourcesLoadedSignal() + { + ViewSignal ret = new ViewSignal(NDalicPINVOKE.ResourceReadySignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets/Sets the origin of an view, within its parent's area.
+ /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the parent, and(1.0, 1.0, 0.5) is the bottom-right corner.
+ /// The default parent-origin is ParentOrigin.TopLeft (0.0, 0.0, 0.5).
+ /// An view's position is the distance between this origin, and the view's anchor-point.
+ ///
+ ///
The View has been initialized.
+ public Position ParentOrigin + { + get + { + Position temp = new Position(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.PARENT_ORIGIN).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.PARENT_ORIGIN, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float ParentOriginX + { + get + { + float temp = 0.0f; + GetProperty(View.Property.PARENT_ORIGIN_X).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.PARENT_ORIGIN_X, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float ParentOriginY + { + get + { + float temp = 0.0f; + GetProperty(View.Property.PARENT_ORIGIN_Y).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.PARENT_ORIGIN_Y, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float ParentOriginZ + { + get + { + float temp = 0.0f; + GetProperty(View.Property.PARENT_ORIGIN_Z).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.PARENT_ORIGIN_Z, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the anchor-point of an view.
+ /// This is expressed in unit coordinates, such that (0.0, 0.0, 0.5) is the top-left corner of the view, and (1.0, 1.0, 0.5) is the bottom-right corner.
+ /// The default pivot point is PivotPoint.Center (0.5, 0.5, 0.5).
+ /// An view position is the distance between its parent-origin and this anchor-point.
+ /// An view's orientation is the rotation from its default orientation, the rotation is centered around its anchor-point.
+ ///
The View has been initialized.
+ ///
+ public Position PivotPoint + { + get + { + Position temp = new Position(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.ANCHOR_POINT).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float PivotPointX + { + get + { + float temp = 0.0f; + GetProperty(View.Property.ANCHOR_POINT_X).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.ANCHOR_POINT_X, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float PivotPointY + { + get + { + float temp = 0.0f; + GetProperty(View.Property.ANCHOR_POINT_Y).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.ANCHOR_POINT_Y, new Tizen.NUI.PropertyValue(value)); + } + } + + internal float PivotPointZ + { + get + { + float temp = 0.0f; + GetProperty(View.Property.ANCHOR_POINT_Z).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.ANCHOR_POINT_Z, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the size width of an view. + /// + public float SizeWidth + { + get + { + float temp = 0.0f; + GetProperty(View.Property.SIZE_WIDTH).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SIZE_WIDTH, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the size height of an view. + /// + public float SizeHeight + { + get + { + float temp = 0.0f; + GetProperty(View.Property.SIZE_HEIGHT).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SIZE_HEIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the position of the View.
+ /// By default, sets the position vector between the parent origin and pivot point(default).
+ /// If Position inheritance if disabled, sets the world position.
+ ///
+ public Position Position + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.POSITION).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the position x of the View. + /// + public float PositionX + { + get + { + float temp = 0.0f; + GetProperty(View.Property.POSITION_X).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION_X, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the position y of the View. + /// + public float PositionY + { + get + { + float temp = 0.0f; + GetProperty(View.Property.POSITION_Y).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION_Y, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the position z of the View. + /// + public float PositionZ + { + get + { + float temp = 0.0f; + GetProperty(View.Property.POSITION_Z).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.POSITION_Z, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the world position of the View. + /// + public Vector3 WorldPosition + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.WORLD_POSITION).Get(temp); + return temp; + } + } + + internal float WorldPositionX + { + get + { + float temp = 0.0f; + GetProperty(View.Property.WORLD_POSITION_X).Get(out temp); + return temp; + } + } + + internal float WorldPositionY + { + get + { + float temp = 0.0f; + GetProperty(View.Property.WORLD_POSITION_Y).Get(out temp); + return temp; + } + } + + internal float WorldPositionZ + { + get + { + float temp = 0.0f; + GetProperty(View.Property.WORLD_POSITION_Z).Get(out temp); + return temp; + } + } + + /// + /// Gets/Sets the orientation of the View.
+ /// An view's orientation is the rotation from its default orientation, and the rotation is centered around its anchor-point.
+ ///
+ /// This is an asynchronous method. + public Rotation Orientation + { + get + { + Rotation temp = new Rotation(); + GetProperty(View.Property.ORIENTATION).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.ORIENTATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the world orientation of the View.
+ ///
+ public Rotation WorldOrientation + { + get + { + Rotation temp = new Rotation(); + GetProperty(View.Property.WORLD_ORIENTATION).Get(temp); + return temp; + } + } + + /// + /// Gets/Sets the scale factor applied to an view.
+ ///
+ public Vector3 Scale + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.SCALE).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.SCALE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the scale x factor applied to an view. + /// + public float ScaleX + { + get + { + float temp = 0.0f; + GetProperty(View.Property.SCALE_X).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SCALE_X, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the scale y factor applied to an view. + /// + public float ScaleY + { + get + { + float temp = 0.0f; + GetProperty(View.Property.SCALE_Y).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SCALE_Y, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the scale z factor applied to an view. + /// + public float ScaleZ + { + get + { + float temp = 0.0f; + GetProperty(View.Property.SCALE_Z).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SCALE_Z, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets the world scale of View. + /// + public Vector3 WorldScale + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.WORLD_SCALE).Get(temp); + return temp; + } + } + + /// + /// Retrieves the visibility flag of an view. + /// + /// + /// If an view is not visible, then the view and its children will not be rendered. + /// This is regardless of the individual visibility values of the children i.e.an view will only be rendered if all of its parents have visibility set to true. + /// + public bool Visibility + { + get + { + bool temp = false; + GetProperty(View.Property.VISIBLE).Get(out temp); + return temp; + } + } + + /// + /// Gets the view's world color. + /// + public Vector4 WorldColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(View.Property.WORLD_COLOR).Get(temp); + return temp; + } + } + + internal Matrix WorldMatrix + { + get + { + Matrix temp = new Matrix(); + GetProperty(View.Property.WORLD_MATRIX).Get(temp); + return temp; + } + } + + /// + /// Gets/Sets the View's name. + /// + public string Name + { + get + { + string temp; + GetProperty(View.Property.NAME).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.NAME, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Get the number of children held by the view. + /// + public uint ChildCount + { + get + { + return GetChildCount(); + } + } + + /// + /// Gets the View's ID. + /// Readonly + /// + public uint ID + { + get + { + return GetId(); + } + } + + /// + /// Gets/Sets the status of whether an view should emit touch or hover signals. + /// + public bool Sensitive + { + get + { + bool temp = false; + GetProperty(View.Property.SENSITIVE).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.SENSITIVE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the status of whether the view should receive a notification when touch or hover motion events leave the boundary of the view. + /// + public bool LeaveRequired + { + get + { + bool temp = false; + GetProperty(View.Property.LEAVE_REQUIRED).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.LEAVE_REQUIRED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the status of whether a child view inherits it's parent's orientation. + /// + public bool InheritOrientation + { + get + { + bool temp = false; + GetProperty(View.Property.INHERIT_ORIENTATION).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.INHERIT_ORIENTATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the status of whether a child view inherits it's parent's scale. + /// + public bool InheritScale + { + get + { + bool temp = false; + GetProperty(View.Property.INHERIT_SCALE).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.INHERIT_SCALE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the status of how the view and its children should be drawn.
+ /// Not all views are renderable, but DrawMode can be inherited from any view.
+ /// If an object is in a 3D layer, it will be depth-tested against other objects in the world i.e. it may be obscured if other objects are in front.
+ /// If DrawMode.Overlay2D is used, the view and its children will be drawn as a 2D overlay.
+ /// Overlay views are drawn in a separate pass, after all non-overlay views within the Layer.
+ /// For overlay views, the drawing order is with respect to tree levels of Views, and depth-testing will not be used.
+ ///
+ public DrawModeType DrawMode + { + get + { + string temp; + if (GetProperty(View.Property.DRAW_MODE).Get(out temp) == false) + { + NUILog.Error("DrawMode get error!"); + } + switch (temp) + { + case "NORMAL": + return DrawModeType.Normal; + case "OVERLAY_2D": + return DrawModeType.Overlay2D; + case "STENCIL": + return DrawModeType.Stencil; + default: + return DrawModeType.Normal; + } + } + set + { + SetProperty(View.Property.DRAW_MODE, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Gets/Sets the relative to parent size factor of the view.
+ /// This factor is only used when ResizePolicyType is set to either: ResizePolicyType.SizeRelativeToParent or ResizePolicyType.SizeFixedOffsetFromParent.
+ /// This view's size is set to the view's size multiplied by or added to this factor, depending on ResizePolicyType.
+ ///
+ public Vector3 SizeModeFactor + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.SIZE_MODE_FACTOR).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.SIZE_MODE_FACTOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the width resize policy to be used. + /// + public ResizePolicyType WidthResizePolicy + { + get + { + string temp; + if (GetProperty(View.Property.WIDTH_RESIZE_POLICY).Get(out temp) == false) + { + NUILog.Error("WidthResizePolicy get error!"); + } + switch (temp) + { + case "FIXED": + return ResizePolicyType.Fixed; + case "USE_NATURAL_SIZE": + return ResizePolicyType.UseNaturalSize; + case "FILL_TO_PARENT": + return ResizePolicyType.FillToParent; + case "SIZE_RELATIVE_TO_PARENT": + return ResizePolicyType.SizeRelativeToParent; + case "SIZE_FIXED_OFFSET_FROM_PARENT": + return ResizePolicyType.SizeFixedOffsetFromParent; + case "FIT_TO_CHILDREN": + return ResizePolicyType.FitToChildren; + case "DIMENSION_DEPENDENCY": + return ResizePolicyType.DimensionDependency; + case "USE_ASSIGNED_SIZE": + return ResizePolicyType.UseAssignedSize; + default: + return ResizePolicyType.Fixed; + } + } + set + { + SetProperty(View.Property.WIDTH_RESIZE_POLICY, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Gets/Sets the height resize policy to be used. + /// + public ResizePolicyType HeightResizePolicy + { + get + { + string temp; + if (GetProperty(View.Property.HEIGHT_RESIZE_POLICY).Get(out temp) == false) + { + NUILog.Error("HeightResizePolicy get error!"); + } + switch (temp) + { + case "FIXED": + return ResizePolicyType.Fixed; + case "USE_NATURAL_SIZE": + return ResizePolicyType.UseNaturalSize; + case "FILL_TO_PARENT": + return ResizePolicyType.FillToParent; + case "SIZE_RELATIVE_TO_PARENT": + return ResizePolicyType.SizeRelativeToParent; + case "SIZE_FIXED_OFFSET_FROM_PARENT": + return ResizePolicyType.SizeFixedOffsetFromParent; + case "FIT_TO_CHILDREN": + return ResizePolicyType.FitToChildren; + case "DIMENSION_DEPENDENCY": + return ResizePolicyType.DimensionDependency; + case "USE_ASSIGNED_SIZE": + return ResizePolicyType.UseAssignedSize; + default: + return ResizePolicyType.Fixed; + } + } + set + { + SetProperty(View.Property.HEIGHT_RESIZE_POLICY, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Gets/Sets the policy to use when setting size with size negotiation.
+ /// Defaults to SizeScalePolicyType.UseSizeSet.
+ ///
+ public SizeScalePolicyType SizeScalePolicy + { + get + { + string temp; + if (GetProperty(View.Property.SIZE_SCALE_POLICY).Get(out temp) == false) + { + NUILog.Error("SizeScalePolicy get error!"); + } + switch (temp) + { + case "USE_SIZE_SET": + return SizeScalePolicyType.UseSizeSet; + case "FIT_WITH_ASPECT_RATIO": + return SizeScalePolicyType.FitWithAspectRatio; + case "FILL_WITH_ASPECT_RATIO": + return SizeScalePolicyType.FillWithAspectRatio; + default: + return SizeScalePolicyType.UseSizeSet; + } + } + set + { + string valueToString = ""; + switch (value) + { + case SizeScalePolicyType.UseSizeSet: + { + valueToString = "USE_SIZE_SET"; + break; + } + case SizeScalePolicyType.FitWithAspectRatio: + { + valueToString = "FIT_WITH_ASPECT_RATIO"; + break; + } + case SizeScalePolicyType.FillWithAspectRatio: + { + valueToString = "FILL_WITH_ASPECT_RATIO"; + break; + } + default: + { + valueToString = "USE_SIZE_SET"; + break; + } + } + SetProperty(View.Property.SIZE_SCALE_POLICY, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// Gets/Sets the status of whether the width size is dependent on height size. + /// + public bool WidthForHeight + { + get + { + bool temp = false; + GetProperty(View.Property.WIDTH_FOR_HEIGHT).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.WIDTH_FOR_HEIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the status of whether the height size is dependent on width size. + /// + public bool HeightForWidth + { + get + { + bool temp = false; + GetProperty(View.Property.HEIGHT_FOR_WIDTH).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.HEIGHT_FOR_WIDTH, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the padding for use in layout. + /// + public Vector4 Padding + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(View.Property.PADDING).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the minimum size an view can be assigned in size negotiation. + /// + public Size2D MinimumSize + { + get + { + Size2D temp = new Size2D(0, 0); + GetProperty(View.Property.MINIMUM_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.MINIMUM_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the maximum size an view can be assigned in size negotiation. + /// + public Size2D MaximumSize + { + get + { + Size2D temp = new Size2D(0, 0); + GetProperty(View.Property.MAXIMUM_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.MAXIMUM_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets whether a child view inherits it's parent's position.
+ /// Default is to inherit.
+ /// Switching this off means that using Position sets the view's world position, i.e. translates from the world origin(0,0,0) to the pivot point of the view.
+ ///
+ public bool InheritPosition + { + get + { + bool temp = false; + GetProperty(View.Property.INHERIT_POSITION).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.INHERIT_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets clipping behavior(mode) of it's children. + /// + public ClippingModeType ClippingMode + { + get + { + string temp; + if (GetProperty(View.Property.CLIPPING_MODE).Get(out temp) == false) + { + NUILog.Error("ClippingMode get error!"); + } + switch (temp) + { + case "DISABLED": + return ClippingModeType.Disabled; + case "CLIP_CHILDREN": + return ClippingModeType.ClipChildren; + default: + return ClippingModeType.Disabled; + } + } + set + { + SetProperty(View.Property.CLIPPING_MODE, new Tizen.NUI.PropertyValue((int)value)); + } + } + + /// + /// Get the number of renderers held by the view. + /// + public uint RendererCount + { + get + { + return GetRendererCount(); + } + } + + + + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandlerWithReturnType Touched + { + add + { + if (_touchDataEventHandler == null) + { + _touchDataCallback = OnTouch; + this.TouchSignal().Connect(_touchDataCallback); + } + + _touchDataEventHandler += value; + } + + remove + { + _touchDataEventHandler -= value; + + if (_touchDataEventHandler == null && TouchSignal().Empty() == false) + { + this.TouchSignal().Disconnect(_touchDataCallback); + } + + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandlerWithReturnType Hovered + { + add + { + if (_hoverEventHandler == null) + { + _hoverEventCallback = OnHoverEvent; + this.HoveredSignal().Connect(_hoverEventCallback); + } + + _hoverEventHandler += value; + } + + remove + { + _hoverEventHandler -= value; + + if (_hoverEventHandler == null && HoveredSignal().Empty() == false) + { + this.HoveredSignal().Disconnect(_hoverEventCallback); + } + + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandlerWithReturnType WheelMoved + { + add + { + if (_wheelEventHandler == null) + { + _wheelEventCallback = OnWheelEvent; + this.WheelEventSignal().Connect(_wheelEventCallback); + } + + _wheelEventHandler += value; + } + + remove + { + _wheelEventHandler -= value; + + if (_wheelEventHandler == null && WheelEventSignal().Empty() == false) + { + this.WheelEventSignal().Disconnect(_wheelEventCallback); + } + + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public Position AnchorPoint + { + get + { + Position temp = new Position(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.ANCHOR_POINT).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.ANCHOR_POINT, new Tizen.NUI.PropertyValue(value)); + } + } + + [Obsolete("Please do not use! this will be deprecated, please use Size2D instead")] + public Size Size + { + get + { + Size temp = new Size(0.0f, 0.0f, 0.0f); + GetProperty(View.Property.SIZE).Get(temp); + return temp; + } + set + { + SetProperty(View.Property.SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler OnWindowEvent + { + add + { + if (_onWindowEventHandler == null) + { + _onWindowEventCallback = OnWindow; + this.OnWindowSignal().Connect(_onWindowEventCallback); + } + + _onWindowEventHandler += value; + } + + remove + { + _onWindowEventHandler -= value; + + if (_onWindowEventHandler == null && OnWindowSignal().Empty() == false) + { + this.OnWindowSignal().Disconnect(_onWindowEventCallback); + } + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler OffWindowEvent + { + add + { + if (_offWindowEventHandler == null) + { + _offWindowEventCallback = OffWindow; + this.OffWindowSignal().Connect(_offWindowEventCallback); + } + + _offWindowEventHandler += value; + } + + remove + { + _offWindowEventHandler -= value; + + if (_offWindowEventHandler == null && OffWindowSignal().Empty() == false) + { + this.OffWindowSignal().Disconnect(_offWindowEventCallback); + } + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler OnRelayoutEvent + { + add + { + if (_onRelayoutEventHandler == null) + { + _onRelayoutEventCallback = OnRelayout; + this.OnRelayoutSignal().Connect(_onRelayoutEventCallback); + } + + _onRelayoutEventHandler += value; + } + + remove + { + _onRelayoutEventHandler -= value; + + if (_onRelayoutEventHandler == null && OnRelayoutSignal().Empty() == false) + { + this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); + } + + } + } + + + + + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisibilityChangeType.cs b/src/Tizen.NUI/src/public/BaseComponents/VisibilityChangeType.cs new file mode 100755 index 0000000..4e96678 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/VisibilityChangeType.cs @@ -0,0 +1,26 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public enum VisibilityChangeType + { + SELF, + PARENT + } + +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs new file mode 100755 index 0000000..dc36895 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -0,0 +1,492 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace Tizen.NUI.BaseComponents +{ + using System; + using System.Runtime.InteropServices; + using System.Collections.Generic; + using System.Linq; + + /// + /// A visual view control for user add any visual to it. + /// + /// + /// Example: + /// + /// VisualView _visualView = new VisualView(); + /// ImageVisualMap imageVisualMap1 = new ImageVisualMap(); + /// imageVisualMap1.URL = "./NUISample/res/images/image-1.jpg"; + /// imageVisualMap1.VisualSize = new Vector2( 300.0f, 300.0f ); + /// imageVisualMap1.Offset = new Vector2( 50.0f, 50.0f ); + /// imageVisualMap1.OffsetSizeMode = new Vector4( 1.0f, 1.0f, 1.0f, 1.0f ); + /// imageVisualMap1.Origin = AlignType.TOP_BEGIN; + /// imageVisualMap1.AnchorPoint = AlignType.TOP_BEGIN; + /// _visualView.AddVisual("imageVisual1", imageVisualMap1); + /// + /// + public class VisualView : CustomView + { + //private LinkedList _visualList = null; + private Dictionary _visualDictionary = null; + private Dictionary _tranformDictionary = null; + private PropertyArray _animateArray = null; + + static CustomView CreateInstance() + { + return new VisualView(); + } + + // static constructor registers the control type (for user can add kinds of visuals to it) + static VisualView() + { + // ViewRegistry registers control type with DALi type registery + // also uses introspection to find any properties that need to be registered with type registry + CustomViewRegistry.Instance.Register(CreateInstance, typeof(VisualView)); + } + + public VisualView() : base(typeof(VisualView).Name, CustomViewBehaviour.ViewBehaviourDefault) + { + } + + /// + /// Override the parent method. + /// + public override void OnInitialize() + { + //Initialize empty + _visualDictionary = new Dictionary(); + _tranformDictionary = new Dictionary(); + _animateArray = new PropertyArray(); + } + + /// + /// Add or update a visual to visual view. + /// + /// The name of visual to add. If add a existed visual name, the visual will be replaced. + /// The property map of visual to create. + public void AddVisual(string visualName, VisualMap visualMap) + { + VisualBase visual = null; + int visualIndex = -1; + + /* If the visual had added, then replace it using RegisterVusal. */ + //visual.Name = name; + foreach (var item in _visualDictionary) + { + if (item.Value.Name == visualName) + { + /* Find a existed visual, its key also exited. */ + visualIndex = item.Key; + UnregisterVisual(visualIndex); + _visualDictionary.Remove(visualIndex); + _tranformDictionary.Remove(visualIndex); + break; + } + } + + if (visualIndex == -1) // The visual is a new one, create index for it. */ + { + visualIndex = RegisterProperty(visualName, new PropertyValue(visualName), PropertyAccessMode.ReadWrite); + } + + if (visualIndex > 0) + { + visual = VisualFactory.Instance.CreateVisual(visualMap.OutputVisualMap); // Create a visual for the new one. + visual.Name = visualName; + visual.DepthIndex = visualMap.DepthIndex; + + RegisterVisual(visualIndex, visual); + + _visualDictionary.Add(visualIndex, visual); + _tranformDictionary.Add(visualIndex, visualMap.OutputTransformMap); + + visualMap.VisualIndex = visualIndex; + visualMap.Name = visualName; + visualMap.Parent = this; + + RelayoutRequest(); + } + } + + /// + /// Remove a visual by name. + /// + /// The name of visual to remove. + public void RemoveVisual(string visualName) + { + foreach (var item in _visualDictionary) + { + if (item.Value.Name == visualName) + { + EnableVisual(item.Key, false); + UnregisterVisual(item.Key); + _tranformDictionary.Remove(item.Key); + _visualDictionary.Remove(item.Key); + + RelayoutRequest(); + break; + } + } + } + + /// + /// Get the total number of Visuals which are added by users + /// + public int NumberOfVisuals + { + get + { + return _visualDictionary.Count; + } + } + + /// + /// Remove all visuals of visual view. + /// + public void RemoveAll() + { + foreach (var item in _visualDictionary) + { + EnableVisual(item.Key, false); + UnregisterVisual(item.Key); + } + _visualDictionary.Clear(); + _tranformDictionary.Clear(); + RelayoutRequest(); + } + + /// + /// Override method of OnRelayout() for CustomView class.
+ /// Called after the size negotiation has been finished for this control.
+ /// The control is expected to assign this given size to itself/its children.
+ /// Should be overridden by derived classes if they need to layout actors differently after certain operations like add or remove actors, resize or after changing specific properties.
+ ///
+ /// As this function is called from inside the size negotiation algorithm, you cannot call RequestRelayout (the call would just be ignored) + /// The allocated size + /// The control should add actors to this container that it is not able to allocate a size for. + public override void OnRelayout(Vector2 size, RelayoutContainer container) + { + foreach (var item in _visualDictionary) + { + item.Value.SetTransformAndSize(_tranformDictionary[item.Key], size); + EnableVisual(item.Key, true); + } + } + + internal void UpdateVisual(int visualIndex, string visualName, VisualMap visualMap) + { + VisualBase visual = null; + + visual = VisualFactory.Instance.CreateVisual(visualMap.OutputVisualMap); + visual.Name = visualName; + visual.DepthIndex = visualMap.DepthIndex; + + RegisterVisual(visualIndex, visual); + + _visualDictionary[visualIndex] = visual; + _tranformDictionary[visualIndex] = visualMap.OutputTransformMap; + + RelayoutRequest(); + NUILog.Debug("UpdateVisual() name=" + visualName); + } + + /// + /// Create visual animation (transition) with the input parameters. + /// + /// The visual map to animation. + /// The property of visual to animation. + /// The destination value of property after animation. + /// The start time of visual animation. + /// The end time of visual animation. + /// The alpha function of visual animation + /// The initial property value of visual animation + /// Animation instance + public Animation AnimateVisual(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null) + { + string _alphaFunction = null; + if (alphaFunction != null) + { + switch (alphaFunction) + { + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + _alphaFunction = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + _alphaFunction = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + _alphaFunction = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + _alphaFunction = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + _alphaFunction = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + _alphaFunction = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + _alphaFunction = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + _alphaFunction = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + _alphaFunction = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + _alphaFunction = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + _alphaFunction = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + _alphaFunction = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + _alphaFunction = "EASE_OUT_BACK"; + break; + } + default: + { + _alphaFunction = "DEFAULT"; + break; + } + } + } + + foreach (var item in _visualDictionary.ToList()) + { + if (item.Value.Name == target.Name) + { + PropertyMap _animator = new PropertyMap(); + if ( _alphaFunction != null) {_animator.Add("alphaFunction", new PropertyValue(_alphaFunction));} + + PropertyMap _timePeriod = new PropertyMap(); + _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f)); + _timePeriod.Add("delay", new PropertyValue(startTime / 1000.0f)); + _animator.Add("timePeriod", new PropertyValue(_timePeriod)); + + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + if (_str == "position") {_str = "offset";} + + PropertyValue destVal = PropertyValue.CreateFromObject(destinationValue); + + PropertyMap _transition = new PropertyMap(); + _transition.Add("target", new PropertyValue(target.Name)); + _transition.Add("property", new PropertyValue(_str)); + if (initialValue != null) + { + PropertyValue initVal = PropertyValue.CreateFromObject(initialValue); + _transition.Add("initialValue", new PropertyValue(initVal)); + } + _transition.Add("targetValue", destVal); + _transition.Add("animator", new PropertyValue(_animator)); + + TransitionData _transitionData = new TransitionData(_transition); + return this.CreateTransition(_transitionData); + } + } + return null; + } + + /// + /// Add group visual animation (transition) map with the input parameters. + /// + /// The visual map to animation. + /// The property of visual to animation. + /// The destination value of property after animation. + /// The start time of visual animation. + /// The end time of visual animation. + /// The alpha function of visual animation + /// The initial property value of visual animation + public void AnimateVisualAdd(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions? alphaFunction = null, object initialValue = null) + { + string _alphaFunction = null; + if (alphaFunction != null) + { + switch (alphaFunction) + { + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + _alphaFunction = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + _alphaFunction = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + _alphaFunction = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + _alphaFunction = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + _alphaFunction = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + _alphaFunction = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + _alphaFunction = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + _alphaFunction = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + _alphaFunction = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + _alphaFunction = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + _alphaFunction = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + _alphaFunction = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + _alphaFunction = "EASE_OUT_BACK"; + break; + } + default: + { + _alphaFunction = "DEFAULT"; + break; + } + } + } + + foreach (var item in _visualDictionary.ToList()) + { + if (item.Value.Name == target.Name) + { + PropertyMap _animator = new PropertyMap(); + if ( _alphaFunction != null) {_animator.Add("alphaFunction", new PropertyValue(_alphaFunction));} + + PropertyMap _timePeriod = new PropertyMap(); + _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f)); + _timePeriod.Add("delay", new PropertyValue(startTime / 1000.0f)); + _animator.Add("timePeriod", new PropertyValue(_timePeriod)); + + string _str1 = property.Substring(0, 1); + string _str2 = property.Substring(1); + string _str = _str1.ToLower() + _str2; + if (_str == "position") {_str = "offset";} + + PropertyValue destVal = PropertyValue.CreateFromObject(destinationValue); + + PropertyMap _transition = new PropertyMap(); + _transition.Add("target", new PropertyValue(target.Name)); + _transition.Add("property", new PropertyValue(_str)); + if (initialValue != null) + { + PropertyValue initVal = PropertyValue.CreateFromObject(initialValue); + _transition.Add("initialValue", new PropertyValue(initVal)); + } + _transition.Add("targetValue", destVal); + _transition.Add("animator", new PropertyValue(_animator)); + + _animateArray.Add(new PropertyValue(_transition)); + } + } + } + + /// + /// Finish to add Visual animation (transition) map and create transition animation. + /// + /// Animation instance + public Animation AnimateVisualAddFinish() + { + if ( _animateArray == null || _animateArray.Empty()) + { + Tizen.Log.Fatal("NUI", "animate visual property array is empty!"); + return null; + } + TransitionData _transitionData = new TransitionData(_animateArray); + + return this.CreateTransition(_transitionData); + } + + + //temporary fix to pass TCT + public Animation VisualAnimate(Tizen.NUI.VisualAnimator visualMap) + { + foreach (var item in _visualDictionary.ToList()) + { + if (item.Value.Name == visualMap.Target) + { + TransitionData _transitionData = new TransitionData(visualMap.OutputVisualMap); + return this.CreateTransition(_transitionData); + } + } + return null; + } + //temporary fix to pass TCT + + } +} diff --git a/src/Tizen.NUI/src/public/BaseHandle.cs b/src/Tizen.NUI/src/public/BaseHandle.cs new file mode 100755 index 0000000..c692895 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseHandle.cs @@ -0,0 +1,343 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class BaseHandle : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + private bool _registerMe; + + internal BaseHandle(global::System.IntPtr cPtr, bool cMemoryOwn) + { + _registerMe = swigCMemOwn = cMemoryOwn; + + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + + // using copy constructor to create another native handle so Registry.Unregister works fine. + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr)); + + if (_registerMe) + { + // Register this instance of BaseHandle in the registry. + Registry.Register(this); + } + } + + internal BaseHandle(global::System.IntPtr cPtr) + { + _registerMe = swigCMemOwn = true; + + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + + // using copy constructor to create another native handle so Registry.Unregister works fine. + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.new_BaseHandle__SWIG_2(swigCPtr)); + + if (_registerMe) + { + // Register this instance of BaseHandle in the registry. + Registry.Register(this); + } + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(BaseHandle obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~BaseHandle() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + //Unreference this instance from Registry. + if (_registerMe) + { + Registry.Unregister(this); + } + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_BaseHandle(swigCPtr); + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + + + // Returns the bool value true to indicate that an operand is true and returns false otherwise. + public static bool operator true(BaseHandle handle) + { + // if the C# object is null, return false + if (BaseHandle.ReferenceEquals(handle, null)) + { + return false; + } + // returns true if the handle has a body, false otherwise + return handle.HasBody(); + } + + // Returns the bool false to indicate that an operand is false and returns true otherwise. + public static bool operator false(BaseHandle handle) + { + // if the C# object is null, return true + if (BaseHandle.ReferenceEquals(handle, null)) + { + return true; + } + return !handle.HasBody(); + } + + // Explicit conversion from Handle to bool. + public static explicit operator bool(BaseHandle handle) + { + // if the C# object is null, return false + if (BaseHandle.ReferenceEquals(handle, null)) + { + return false; + } + // returns true if the handle has a body, false otherwise + return handle.HasBody(); + } + + // Equality operator + public static bool operator ==(BaseHandle x, BaseHandle y) + { + // if the C# objects are the same return true + if (BaseHandle.ReferenceEquals(x, y)) + { + return true; + } + if (!BaseHandle.ReferenceEquals(x, null) && !BaseHandle.ReferenceEquals(y, null)) + { + // drop into native code to see if both handles point to the same body + return x.IsEqual(y); + } + + if (BaseHandle.ReferenceEquals(x, null) && !BaseHandle.ReferenceEquals(y, null)) + { + if (y.HasBody()) return false; + else return true; + } + if (!BaseHandle.ReferenceEquals(x, null) && BaseHandle.ReferenceEquals(y, null)) + { + if (x.HasBody()) return false; + else return true; + } + + return false; + } + + // Inequality operator. Returns Null if either operand is Null + public static bool operator !=(BaseHandle x, BaseHandle y) + { + return !(x == y); + } + + // Logical AND operator for && + // It's possible when doing a && this function (opBitwiseAnd) is never called due + // to short circuiting. E.g. + // If you perform x && y What actually is called is + // BaseHandle.op_False( x ) ? BaseHandle.op_True( x ) : BaseHandle.opTrue( BaseHandle.opBitwiseAnd(x,y) ) + // + public static BaseHandle operator &(BaseHandle x, BaseHandle y) + { + if (x == y) + { + return x; + } + return null; + } + + // Logical OR operator for || + // It's possible when doing a || this function (opBitwiseOr) is never called due + // to short circuiting. E.g. + // If you perform x || y What actually is called is + // BaseHandle.op_True( x ) ? BaseHandle.op_True( x ) : BaseHandle.opTrue( BaseHandle.opBitwiseOr(x,y) ) + public static BaseHandle operator |(BaseHandle x, BaseHandle y) + { + if (!BaseHandle.ReferenceEquals(x, null) || !BaseHandle.ReferenceEquals(y, null)) + { + if (x.HasBody()) + { + return x; + } + if (y.HasBody()) + { + return y; + } + return null; + } + return null; + } + + // Logical ! operator + public static bool operator !(BaseHandle x) + { + // if the C# object is null, return true + if (BaseHandle.ReferenceEquals(x, null)) + { + return true; + } + if (x.HasBody()) + { + return false; + } + return true; + } + + + public BaseHandle() : this(NDalicPINVOKE.new_BaseHandle__SWIG_1()) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public BaseHandle(BaseHandle handle) : this(NDalicPINVOKE.new_BaseHandle__SWIG_2(BaseHandle.getCPtr(handle))) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + public bool DoAction(string actionName, PropertyMap attributes) + { + bool ret = NDalicPINVOKE.BaseHandle_DoAction(swigCPtr, actionName, PropertyMap.getCPtr(attributes)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetTypeName() + { + string ret = NDalicPINVOKE.BaseHandle_GetTypeName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool GetTypeInfo(TypeInfo info) + { + bool ret = NDalicPINVOKE.BaseHandle_GetTypeInfo(swigCPtr, TypeInfo.getCPtr(info)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + public void Reset() + { + NDalicPINVOKE.BaseHandle_Reset(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool EqualTo(BaseHandle rhs) + { + bool ret = NDalicPINVOKE.BaseHandle_EqualTo(swigCPtr, BaseHandle.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool NotEqualTo(BaseHandle rhs) + { + bool ret = NDalicPINVOKE.BaseHandle_NotEqualTo(swigCPtr, BaseHandle.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal RefObject GetObjectPtr() + { + global::System.IntPtr cPtr = NDalicPINVOKE.BaseHandle_GetObjectPtr(swigCPtr); + RefObject ret = (cPtr == global::System.IntPtr.Zero) ? null : new RefObject(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool HasBody() + { + if (disposed == true) + { + return false; + } + + bool ret = NDalicPINVOKE.BaseHandle_HasBody(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool IsEqual(BaseHandle rhs) + { + if (disposed == true) + { + return false; + } + + bool ret = NDalicPINVOKE.BaseHandle_IsEqual(swigCPtr, BaseHandle.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} + diff --git a/src/Tizen.NUI/src/public/Color.cs b/src/Tizen.NUI/src/public/Color.cs new file mode 100755 index 0000000..1d3d55c --- /dev/null +++ b/src/Tizen.NUI/src/public/Color.cs @@ -0,0 +1,572 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +namespace Tizen.NUI +{ + + using System; + + /// + /// Color class. + /// + public class Color : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Color(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Color obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Color() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// To make Color instance be disposed. + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector4(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// First value + /// Second value + /// A Color containing the result of the addition + public static Color operator +(Color arg1, Color arg2) + { + Color result = arg1.Add(arg2); + ValueCheck(result); + return result; + } + + /// + /// Subtraction operator. + /// + /// First value + /// Second value + /// A Color containing the result of the subtraction + public static Color operator -(Color arg1, Color arg2) + { + Color result = arg1.Subtract(arg2); + ValueCheck(result); + return result; + } + + /// + /// Unary negation operator. + /// + /// Target Value + /// A Color containg the negation + public static Color operator -(Color arg1) + { + Color result = arg1.Subtract(); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// First Value + /// Second Value + /// A Color containing the result of the multiplication + public static Color operator *(Color arg1, Color arg2) + { + Color result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + public static Color operator*(Color arg1, float arg2) + { + Color result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// First Value + /// Second Value + /// A Color containing the result of the division + public static Color operator /(Color arg1, Color arg2) + { + Color result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + public static Color operator/(Color arg1, float arg2) + { + Color result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + /// + /// Array subscript operator overload. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Color GetColorFromPtr(global::System.IntPtr cPtr) + { + Color ret = new Color(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Default constructor + /// + public Color() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + /// + /// Constructor. + /// + /// red component + /// green component + /// blue component + /// alpha component + public Color(float r, float g, float b, float a) : this(NDalicPINVOKE.new_Vector4__SWIG_1(r, g, b, a), true) + { + ValueCheck(ref r); + ValueCheck(ref g); + ValueCheck(ref b); + ValueCheck(ref a); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from an array of four floats. + /// + /// array Array of R,G,B,A + public Color(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) + { + ValueCheck(ref array[0]); + ValueCheck(ref array[1]); + ValueCheck(ref array[2]); + ValueCheck(ref array[3]); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Color Add(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Add(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color AddAssign(Vector4 rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Subtract(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color SubtractAssign(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Multiply(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Multiply(float rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color MultiplyAssign(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color MultiplyAssign(float rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Divide(Vector4 rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Color.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Divide(float rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color DivideAssign(Color rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Color.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color DivideAssign(float rhs) + { + Color ret = new Color(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Color Subtract() + { + Color ret = new Color(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check if two Color classes are same. + /// + /// A Color to be compared + /// If two Colors are are same, then true. + public bool EqualTo(Color rhs) + { + bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Color.getCPtr(rhs)); + + if (rhs == null) return false; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check if two Color classes are different. + /// + /// A Color to be compared + /// If two Colors are are different, then true. + public bool NotEqualTo(Color rhs) + { + bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Color.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// red component. + /// + public float R + { + set + { + ValueCheck(ref value); + NDalicPINVOKE.Vector4_r_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// green component. + /// + public float G + { + set + { + ValueCheck(ref value); + NDalicPINVOKE.Vector4_g_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// blue component. + /// + public float B + { + set + { + ValueCheck(ref value); + NDalicPINVOKE.Vector4_b_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// alpha component. + /// + public float A + { + set + { + ValueCheck(ref value); + NDalicPINVOKE.Vector4_a_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Get black colored Color class. + /// + public static readonly Color Black = new Color(0.0f, 0.0f, 0.0f, 1.0f); + + /// + /// Get white colored Color class. + /// + public static readonly Color White = new Color(1.0f, 1.0f, 1.0f, 1.0f); + + /// + /// Get red colored Color class. + /// + public static readonly Color Red = new Color(1.0f, 0.0f, 0.0f, 1.0f); + + /// + /// Get green colored Color class. + /// + public static readonly Color Green = new Color(0.0f, 1.0f, 0.0f, 1.0f); + + /// + /// Get blue colored Color class. + /// + public static readonly Color Blue = new Color(0.0f, 0.0f, 1.0f, 1.0f); + + /// + /// Get yellow colored Color class. + /// + public static readonly Color Yellow = new Color(1.0f, 1.0f, 0.0f, 1.0f); + + /// + /// Get magenta colored Color class. + /// + public static readonly Color Magenta = new Color(1.0f, 0.0f, 1.0f, 1.0f); + + /// + /// Get cyan colored Color class. + /// + public static readonly Color Cyan = new Color(0.0f, 1.0f, 1.0f, 1.0f); + + /// + /// Get transparent colored Color class. + /// + public static readonly Color Transparent = new Color(0.0f, 0.0f, 0.0f, 0.0f); + + /// + /// convert Color class to Vector4 class implicitly. + /// + /// A Color to be converted to Vector4 + public static implicit operator Vector4(Color color) + { + return new Vector4(color.R, color.G, color.B, color.A); + } + + /// + /// convert Vector4 class to Color class implicitly. + /// + /// A Vector4 to be converted to Color + public static implicit operator Color(Vector4 vec) + { + return new Color(vec.R, vec.G, vec.B, vec.A); + } + + internal static void ValueCheck(Color color) + { + if (color.R < 0.0f) + { + color.R = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if (color.R > 1.0f) + { + color.R = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if (color.G < 0.0f) + { + color.G = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if (color.G > 1.0f) + { + color.G = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if (color.B < 0.0f) + { + color.B = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if (color.B > 1.0f) + { + color.B = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if (color.A < 0.0f) + { + color.A = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if (color.A > 1.0f) + { + color.A = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + } + + internal static void ValueCheck(ref float value) + { + if (value < 0.0f) + { + value = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + else if (value > 1.0f) + { + value = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + } + + } + +} + + diff --git a/src/Tizen.NUI/src/public/CustomView/Spin.cs b/src/Tizen.NUI/src/public/CustomView/Spin.cs new file mode 100755 index 0000000..cfed4a8 --- /dev/null +++ b/src/Tizen.NUI/src/public/CustomView/Spin.cs @@ -0,0 +1,389 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +using System; +using System.Runtime.InteropServices; +using Tizen.NUI; +using Tizen.NUI.UIComponents; +using Tizen.NUI.BaseComponents; + +// A spin control (for continously changing values when users can easily predict a set of values) + +namespace Tizen.NUI +{ + /// + ///Spin CustomView class + /// + public class Spin : CustomView + { + private VisualBase _arrowVisual; + private TextField _textField; + private int _arrowVisualPropertyIndex; + private string _arrowImage; + private int _currentValue; + private int _minValue; + private int _maxValue; + private int _singleStep; + private bool _wrappingEnabled; + private string _fontFamily; + private string _fontStyle; + private int _pointSize; + private Color _textColor; + private Color _textBackgroundColor; + private int _maxTextLength; + + // Called by DALi Builder if it finds a Spin control in a JSON file + static CustomView CreateInstance() + { + return new Spin(); + } + + // static constructor registers the control type (only runs once) + static Spin() + { + // ViewRegistry registers control type with DALi type registery + // also uses introspection to find any properties that need to be registered with type registry + CustomViewRegistry.Instance.Register(CreateInstance, typeof(Spin)); + } + + /// + /// Creates an initialized Spin. + /// + public Spin() : base(typeof(Spin).FullName, CustomViewBehaviour.RequiresKeyboardNavigationSupport) + { + } + + /// + /// Override method of OnInitialize() for CustomView class.
+ /// This method is called after the Control has been initialized.
+ /// Derived classes should do any second phase initialization by overriding this method.
+ ///
+ public override void OnInitialize() + { + // Initialize the propertiesControl + //_arrowImage = "/home/tengxb/Workspace/nui-debug/examples/res/images/arrow.png"; + _arrowImage = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "picture.png"; + _textBackgroundColor = new Color(0.6f, 0.6f, 0.6f, 1.0f); + _currentValue = 0; + _minValue = 0; + _maxValue = 0; + _singleStep = 1; + _maxTextLength = 0; + + // Create image visual for the arrow keys + _arrowVisualPropertyIndex = RegisterProperty("ArrowImage", new PropertyValue(_arrowImage), Tizen.NUI.PropertyAccessMode.ReadWrite); + _arrowVisual = VisualFactory.Instance.CreateVisual( + new PropertyMap().Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)) + .Add(ImageVisualProperty.URL, new PropertyValue(_arrowImage)) + .Add(ImageVisualProperty.DesiredHeight, new PropertyValue(150)) + .Add(ImageVisualProperty.DesiredWidth, new PropertyValue(150))); + RegisterVisual(_arrowVisualPropertyIndex, _arrowVisual); + + // Create a text field + _textField = new TextField(); + _textField.PivotPoint = Tizen.NUI.PivotPoint.Center; + _textField.WidthResizePolicy = ResizePolicyType.SizeRelativeToParent; + _textField.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent; + _textField.SizeModeFactor = new Vector3(1.0f, 0.45f, 1.0f); + _textField.PlaceholderText = "----"; + _textField.BackgroundColor = _textBackgroundColor; + _textField.HorizontalAlignment = HorizontalAlignment.Center; + _textField.VerticalAlignment = VerticalAlignment.Center; + _textField.Focusable = (true); + _textField.Name = "_textField"; + _textField.Position2D = new Position2D(0, 40); + + this.Add(_textField); + + _textField.FocusGained += TextFieldKeyInputFocusGained; + _textField.FocusLost += TextFieldKeyInputFocusLost; + } + + /// + /// Override method of GetNaturalSize() for CustomView class.
+ /// Return the natural size of the actor.
+ ///
+ /// Natural size of this Spin itself + public override Size2D GetNaturalSize() + { + return new Size2D(150, 150); + } + + /// + /// Event handler when the TextField in Spin gets the Key focus.
+ /// Make sure when the current spin that takes input focus also takes the keyboard focus.
+ /// For example, when you tap the spin directly.
+ ///
+ /// Sender of this event + /// Event arguments + public void TextFieldKeyInputFocusGained(object source, EventArgs e) + { + FocusManager.Instance.SetCurrentFocusView(_textField); + } + + /// + /// Event handler when the TextField in Spin looses it's Key focus + /// + /// + /// + public void TextFieldKeyInputFocusLost(object source, EventArgs e) + { + int previousValue = _currentValue; + + // If the input value is invalid, change it back to the previous valid value + if (int.TryParse(_textField.Text, out _currentValue)) + { + if (_currentValue < _minValue || _currentValue > _maxValue) + { + _currentValue = previousValue; + } + } + else + { + _currentValue = previousValue; + } + + // Otherwise take the new value + this.Value = _currentValue; + } + + /// + /// Override method of GetNextKeyboardFocusableView() for CustomView class.
+ /// Gets the next key focusable view in this View towards the given direction.
+ /// A View needs to override this function in order to support two dimensional key navigation.
+ ///
+ /// The current focused view + /// The direction to move the focus towards + /// Whether the focus movement should be looped within the control + /// The next keyboard focusable view in this control or an empty handle if no view can be focused + public override View GetNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled) + { + // Respond to Up/Down keys to change the value while keeping the current spin focused + View nextFocusedView = currentFocusedView; + if (direction == View.FocusDirection.Up) + { + this.Value += this.Step; + nextFocusedView = _textField; + } + else if (direction == View.FocusDirection.Down) + { + this.Value -= this.Step; + nextFocusedView = _textField; + } + else + { + // Return null + return null; + } + + return nextFocusedView; + } + + /// + /// Value to be set in Spin. + /// + [ScriptableProperty()] + public int Value + { + get + { + return _currentValue; + } + set + { + + Tizen.Log.Debug("NUI", "Value set to " + value); + _currentValue = value; + + // Make sure no invalid value is accepted + if (_currentValue < _minValue) + { + _currentValue = _minValue; + } + + if (_currentValue > _maxValue) + { + _currentValue = _maxValue; + } + + _textField.Text = _currentValue.ToString(); + } + } + + /// + /// Minimum Value of Spin Value. + /// + // MinValue property of type int: + [ScriptableProperty()] + public int MinValue + { + get + { + return _minValue; + } + set + { + _minValue = value; + } + } + + /// + /// Maximum Value of Spin Value. + /// + // MaxValue property of type int: + [ScriptableProperty()] + public int MaxValue + { + get + { + return _maxValue; + } + set + { + _maxValue = value; + } + } + + /// + /// Increasing, decresing step of Spin Value when Up or Down key is pressed. + /// + // Step property of type int: + [ScriptableProperty()] + public int Step + { + get + { + return _singleStep; + } + set + { + _singleStep = value; + } + } + + /// + /// Wrapping enabled status. + /// + // WrappingEnabled property of type bool: + [ScriptableProperty()] + public bool WrappingEnabled + { + get + { + return _wrappingEnabled; + } + set + { + _wrappingEnabled = value; + } + } + + /// + /// Text point size of Spin Value. + /// + // TextPointSize property of type int: + [ScriptableProperty()] + public int TextPointSize + { + get + { + return _pointSize; + } + set + { + _pointSize = value; + _textField.PointSize = _pointSize; + } + } + + /// + /// The color of Spin Value. + /// + // TextColor property of type Color: + [ScriptableProperty()] + public Color TextColor + { + get + { + return _textColor; + } + set + { + Tizen.Log.Debug("NUI", "TextColor set to " + value.R + "," + value.G + "," + value.B); + + _textColor = value; + _textField.TextColor = _textColor; + } + } + + /// + /// Maximum text lengh of Spin Value. + /// + // MaxTextLength property of type int: + [ScriptableProperty()] + public int MaxTextLength + { + get + { + return _maxTextLength; + } + set + { + _maxTextLength = value; + _textField.MaxLength = _maxTextLength; + } + } + + /// + /// Reference of TextField of Spin. + /// + public TextField SpinText + { + get + { + return _textField; + } + set + { + _textField = value; + } + } + + /// + /// Show indicator image, for example Up/Down Arrow image. + /// + // Indicator property of type string: + public string IndicatorImage + { + get + { + return _arrowImage; + } + set + { + _arrowImage = value; + _arrowVisual = VisualFactory.Instance.CreateVisual( + new PropertyMap().Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)) + .Add(ImageVisualProperty.URL, new PropertyValue(_arrowImage)) + .Add(ImageVisualProperty.DesiredHeight, new PropertyValue(150)) + .Add(ImageVisualProperty.DesiredWidth, new PropertyValue(150))); + RegisterVisual(_arrowVisualPropertyIndex, _arrowVisual); + } + } + } +} diff --git a/src/Tizen.NUI/src/public/CustomViewRegistry.cs b/src/Tizen.NUI/src/public/CustomViewRegistry.cs new file mode 100755 index 0000000..0b5cc21 --- /dev/null +++ b/src/Tizen.NUI/src/public/CustomViewRegistry.cs @@ -0,0 +1,490 @@ + +using System.Reflection; +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + /// + /// Add this attribute to any property belonging to a View (control) you want to be scriptable from JSON + /// + /// + /// Example: + /// + /// class MyView : public CustomView + /// { + /// [ScriptableProperty()] + /// public int MyProperty + /// { + /// get + /// { + /// return _myProperty; + /// } + /// set + /// { + /// _myProperty = value; + /// } + /// } + /// } + /// + /// Internally the following occurs for property registration ( this only occurs once per Type, not per Instance): + /// + /// - The controls static constructor should call ViewRegistry.Register() (only called once for the lifecycle of the app) + /// - Within Register() the code will introspect the Controls properties, looking for the ScriptableProperty() attribute + /// - For every property with the ScriptableProperty() attribute, TypeRegistration.RegisterProperty is called. + /// - TypeRegistration.RegisterProperty calls in to DALi C++ Code Dali::CSharpTypeRegistry::RegisterProperty() + /// - DALi C++ now knows the existance of the property and will try calling SetProperty, if it finds the property in a JSON file (loaded using builder). + /// + /// The DALi C# example + /// + /// class MyView : public CustomView + /// { + /// + /// [ScriptableProperty()] + /// public double Hours + /// { + /// get { return seconds / 3600; } + /// set { seconds = value * 3600; } + /// } + /// } + /// + /// Equivalent code in DALi C++: + /// in MyControl.h + /// class MyControl : public Control + /// { + /// struct Property + /// { + /// enum + /// { + /// HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1 + /// } + /// } + /// } + /// + /// in MyControl-impl.cpp + /// + /// DALI_TYPE_REGISTRATION_BEGIN( Toolkit::MyControl, Toolkit::Control, Create ); + /// DALI_PROPERTY_REGISTRATION( Toolkit, MyControl, "Hours", INTEGER, DISABLED ) + /// DALI_TYPE_REGISTRATION_END() + /// + /// + /// + public class ScriptableProperty : System.Attribute + { + public enum ScriptableType + { + Default, // Read Writable, non-animatable property, event thread only + // Animatable // Animatable property, Currently disabled, UK + } + public readonly ScriptableType type; + + public ScriptableProperty(ScriptableType type = ScriptableType.Default) + { + this.type = type; + } + } + + /// + /// View Registry singleton. + /// Used for registering controls and any scriptable properties they have ( see ScriptableProperty ) + /// + /// Internal Design from C# to C++ + /// + /// - Each custom C# view should have it's static constructor called before any JSON file is loaded. + /// Static constructors for a class will only run once ( they are run per control type, not per instance). + /// Example of running a static constructor: + /// System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (typeof(Spin).TypeHandle); + /// Inside the static constructor the control should register it's type with the ViewRegistry + /// e.g. + /// + /// static Spin() + /// { + /// ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) ); + /// } + /// + /// The control should also provide a CreateInstance function, which gets passed to the ViewRegistry + /// // Eventually it will be called if DALi Builderfinds a Spin control in a JSON file + /// static CustomView CreateInstance() + /// { + /// return new Spin(); + /// } + /// + /// + /// + /// The DALi C++ equivalent of this is + /// + /// TypeRegistration mType( typeid(Toolkit::Spin), typeid(Toolkit::Control), CreateInstance ); + /// + /// + /// + /// + public sealed class CustomViewRegistry + { + /// + /// ViewRegistry is a singleton + /// + private static CustomViewRegistry instance = null; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate IntPtr CreateControlDelegate(IntPtr cPtrControlName); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate IntPtr GetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName); + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void SetPropertyDelegate(IntPtr controlPtr, IntPtr propertyName, IntPtr propertyValue); + + private CreateControlDelegate _createCallback; + private SetPropertyDelegate _setPropertyCallback; + private GetPropertyDelegate _getPropertyCallback; + private PropertyRangeManager _propertyRangeManager; + + /// + // Maps the name of a custom view to a create instance function + /// E.g. given a string "Spin", we can get a function used to create the Spin View. + /// + private Dictionary> _constructorMap; + + /// + /// Lookup table to match C# types to DALi types, used for the automatic property registration + /// + private static readonly Dictionary _daliPropertyTypeLookup + = new Dictionary + { + { "float", PropertyType.Float }, + { "int", PropertyType.Integer }, + { "Int32", PropertyType.Integer }, + { "Boolean", PropertyType.Boolean }, + { "string", PropertyType.String }, + { "Vector2", PropertyType.Vector2 }, + { "Vector3", PropertyType.Vector3 }, + { "Vector4", PropertyType.Vector4 }, + { "Size", PropertyType.Vector2 }, + { "Position",PropertyType.Vector3 }, + { "Color", PropertyType.Vector4 }, + { "PropertyArray", PropertyType.Array }, + { "PropertyMap", PropertyType.Map }, + // { "Matrix3", PropertyType.MATRIX3 }, commented out until we need to use Matrices from JSON + // { "Matrix", PropertyType.MATRIX }, + }; + + + private CustomViewRegistry() + { + _createCallback = new CreateControlDelegate(CreateControl); + _getPropertyCallback = new GetPropertyDelegate(GetProperty); + _setPropertyCallback = new SetPropertyDelegate(SetProperty); + + _constructorMap = new Dictionary>(); + _propertyRangeManager = new PropertyRangeManager(); + } + + private Tizen.NUI.PropertyType GetDaliPropertyType(string cSharpTypeName) + { + Tizen.NUI.PropertyType daliType; + if (_daliPropertyTypeLookup.TryGetValue(cSharpTypeName, out daliType)) + { +#if DEBUG_ON + Tizen.Log.Debug("NUI", "mapped " + cSharpTypeName + " to dAli type " + daliType); +#endif + return daliType; + } + else + { +#if DEBUG_ON + Tizen.Log.Debug("NUI", "Failed to find a mapping between C# property" + cSharpTypeName + " and DALi type"); +#endif + return PropertyType.None; + } + } + + /// + /// Called directly from DALi C++ type registry to create a control (View) using no marshalling. + /// + /// Pointer to the Control (Views) handle + /// C pointer to the Control (View) name + private static IntPtr CreateControl(IntPtr cPtrControlName) + { + string controlName = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(cPtrControlName); +#if DEBUG_ON + Tizen.Log.Debug("NUI", "Create controlled called from C++ create a " + controlName); +#endif + Func controlConstructor; + + // find the control constructor + if (Instance._constructorMap.TryGetValue(controlName, out controlConstructor)) + { + // Create the control + CustomView newControl = controlConstructor(); + return newControl.GetPtrfromView(); // return pointer to handle + } + else + { + throw new global::System.InvalidOperationException("C# View not registererd with ViewRegistry" + controlName); + return IntPtr.Zero; + } + } + + private static IntPtr GetProperty(IntPtr controlPtr, IntPtr propertyName) + { + string name = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(propertyName); + return Instance.GetPropertyValue(controlPtr, name); + } + + private static void SetProperty(IntPtr controlPtr, IntPtr propertyName, IntPtr propertyValue) + { + string name = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(propertyName); +#if DEBUG_ON + Tizen.Log.Debug("NUI", "SetControlProperty called for:" + name); +#endif + Instance.SetPropertyValue(controlPtr, name, propertyValue); + + } + + public static CustomViewRegistry Instance + { + get + { + if (instance == null) + { + instance = new CustomViewRegistry(); + } + return instance; + } + } + + /// + /// Function which registers a view and all it's scriptable properties with DALi's type registry. + /// Means the View can be created / configured from a JSON script. + /// + /// The function uses introspection to scan a Views C# properties, then selects the ones with + ///[ScriptableProperty] attribute to be registered. + /// Example of a Spin view registering itself + /// static Spin() + /// { + /// ViewRegistry registers control type with DALi type registery + /// also uses introspection to find any properties that need to be registered with type registry + /// ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) ); + /// } + /// + /// + public void Register(Func createFunction, System.Type viewType) + { + // add the mapping between the view name and it's create function + _constructorMap.Add(viewType.ToString(), createFunction); + + // Call into DALi C++ to register the control with the type registry + TypeRegistration.RegisterControl(viewType.ToString(), _createCallback); + + // Cycle through each property in the class + foreach (System.Reflection.PropertyInfo propertyInfo in viewType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)) + { + if (propertyInfo.CanRead) + { + IEnumerable ie_attrs = propertyInfo.GetCustomAttributes(); + List li_attrs = new List(ie_attrs); + System.Attribute[] attrs = li_attrs.ToArray(); + + foreach (System.Attribute attr in attrs) + { + // If the Scriptable attribute exists, then register it with the type registry. + if (attr is ScriptableProperty) + { +#if DEBUG_ON + Tizen.Log.Debug("NUI", "Got a DALi JSON scriptable property = " + propertyInfo.Name + ", of type " + propertyInfo.PropertyType.Name); +#endif + // first get the attribute type, ( default, or animatable) + ScriptableProperty scriptableProp = attr as ScriptableProperty; + + // we get the start property index, based on the type and it's heirachy, e.g. DateView (70,000)-> Spin (60,000) -> View (50,000) + int propertyIndex = _propertyRangeManager.GetPropertyIndex(viewType.ToString(), viewType, scriptableProp.type); + + // get the enum for the property type... E.g. registering a string property returns Tizen.NUI.PropertyType.String + Tizen.NUI.PropertyType propertyType = GetDaliPropertyType(propertyInfo.PropertyType.Name); + + // Example RegisterProperty("spin","maxValue", 50001, FLOAT, set, get ); + // Native call to register the property + TypeRegistration.RegisterProperty(viewType.ToString(), propertyInfo.Name, propertyIndex, propertyType, _setPropertyCallback, _getPropertyCallback); + } + } +#if DEBUG_ON + Tizen.Log.Debug("NUI", "property name = " + propertyInfo.Name); +#endif + } + } + } + + /// + /// Get a property value from a View + /// + /// + private IntPtr GetPropertyValue(IntPtr refObjectPtr, string propertyName) + { + // Get the C# control that maps to the C++ control + View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View; + if (view != null) + { + // call the get property function + System.Object val = view.GetType().GetProperty(propertyName).GetAccessors()[0].Invoke(view, null); + + PropertyValue value = PropertyValue.CreateFromObject(val); + + return (IntPtr)PropertyValue.getCPtr(value); + } + else + { + return IntPtr.Zero; + } + } + + /// + /// Set a property value on a View + /// + /// + private void SetPropertyValue(IntPtr refObjectPtr, string propertyName, IntPtr propertyValuePtr) + { + // Get the C# control that maps to the C++ control +#if DEBUG_ON + Tizen.Log.Debug("NUI", "SetPropertyValue refObjectPtr = {0:X}" + refObjectPtr); +#endif + PropertyValue propValue = new PropertyValue(propertyValuePtr, false); + + // Get the C# control that maps to the C++ control + View view = Registry.GetManagedBaseHandleFromRefObject(refObjectPtr) as View; + if (view != null) + { + System.Reflection.PropertyInfo propertyInfo = view.GetType().GetProperty(propertyName); + // We know the property name, we know it's type, we just need to convert from a DALi property value to native C# type + System.Type type = propertyInfo.PropertyType; + bool ok = false; + + if (type.Equals(typeof(Int32))) + { + int value = 0; + ok = propValue.Get(out value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(bool))) + { + bool value = false; + ok = propValue.Get(out value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(float))) + { + float value = 0; + ok = propValue.Get(out value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(string))) + { + string value = ""; + ok = propValue.Get(out value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(Vector2))) + { + Vector2 value = new Vector2(); + ok = propValue.Get(value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(Vector3))) + { + Vector3 value = new Vector3(); + ok = propValue.Get(value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(Vector4))) + { + Vector4 value = new Vector4(); + ok = propValue.Get(value); + + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(Position))) + { + Position value = new Position(); + ok = propValue.Get(value); + if (ok) + { + propertyInfo.SetValue(view, value); + } + } + else if (type.Equals(typeof(Size))) + { + Size value = new Size(); + ok = propValue.Get(value); + if (ok) + { + propertyInfo.SetValue(view, new Size(value.Width, value.Height, value.Depth)); + }; + } + else if (type.Equals(typeof(Color))) + { + // Colors are stored as Vector4's in DALi + Color value = new Color(); + ok = propValue.Get(value); + if (ok) + { + propertyInfo.SetValue(view, (Color)value); + }; + } + else if (type.Equals(typeof(PropertyMap))) + { + PropertyMap map = new PropertyMap(); + ok = propValue.Get(map); + if( ok ) + { + propertyInfo.SetValue( view, map ); + } + } + else if (type.Equals(typeof(PropertyArray))) + { + PropertyArray array = new PropertyArray(); + ok = propValue.Get(array); + if( ok ) + { + propertyInfo.SetValue( view, array ); + } + } + else + { + throw new global::System.InvalidOperationException("SetPropertyValue Unimplemented type for Property Value for " + type.FullName ); + } + if (!ok) + { + throw new global::System.InvalidOperationException("SetPropertyValue propValue.Get failed"); + } + } + else + { + throw new global::System.InvalidOperationException("failed to find the control to write a property to: cptr = " + refObjectPtr); + } + + } + + } +} diff --git a/src/Tizen.NUI/src/public/Degree.cs b/src/Tizen.NUI/src/public/Degree.cs new file mode 100755 index 0000000..4524fef --- /dev/null +++ b/src/Tizen.NUI/src/public/Degree.cs @@ -0,0 +1,145 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// An angle in degrees.
+ /// This reduces ambiguity when using methods which accept angles in degrees or radians.
+ ///
+ public class Degree : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Degree(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Degree obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Degree() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Degree(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Constructor. + /// + public Degree() : this(NDalicPINVOKE.new_Degree__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an angle in degrees. + /// + /// The initial value in degrees + public Degree(float value) : this(NDalicPINVOKE.new_Degree__SWIG_1(value), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an angle in degrees from a Radian. + /// + /// The initial value in Radians + public Degree(Radian value) : this(NDalicPINVOKE.new_Degree__SWIG_2(Radian.getCPtr(value)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float Value + { + set + { + NDalicPINVOKE.Degree_degree_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Degree_degree_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/DirectionBias.cs b/src/Tizen.NUI/src/public/DirectionBias.cs new file mode 100755 index 0000000..ee7ae8f --- /dev/null +++ b/src/Tizen.NUI/src/public/DirectionBias.cs @@ -0,0 +1,27 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public enum DirectionBias + { + DirectionBiasLeft = -1, + DirectionBiasNone = 0, + DirectionBiasRight = 1 + } + +} diff --git a/src/Tizen.NUI/src/public/FilterModeType.cs b/src/Tizen.NUI/src/public/FilterModeType.cs new file mode 100755 index 0000000..7ae84d2 --- /dev/null +++ b/src/Tizen.NUI/src/public/FilterModeType.cs @@ -0,0 +1,31 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + public enum FilterModeType + { + NONE = 0, + DEFAULT, + NEAREST, + LINEAR, + NEAREST_MIPMAP_NEAREST, + LINEAR_MIPMAP_NEAREST, + NEAREST_MIPMAP_LINEAR, + LINEAR_MIPMAP_LINEAR + } + +} diff --git a/src/Tizen.NUI/src/public/FocusManager.cs b/src/Tizen.NUI/src/public/FocusManager.cs new file mode 100755 index 0000000..c528820 --- /dev/null +++ b/src/Tizen.NUI/src/public/FocusManager.cs @@ -0,0 +1,752 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// Provides the functionality of handling keyboard navigation and maintaining the two dimensional keyboard focus chain.
+ /// It provides functionality of setting the focus and moving the focus in four directions(i.e.Left, Right, Up and Down).
+ /// It also draws a highlight for the focused View and sends a event when the focus is changed.
+ ///
+ public class FocusManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private CustomAlgorithmInterfaceWrapper _customAlgorithmInterfaceWrapper; + + internal FocusManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.FocusManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FocusManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make FocusManager instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_FocusManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + /// + ///Event arguments that passed via PreFocusChange signal + /// + public class PreFocusChangeEventArgs : EventArgs + { + private View _current; + private View _proposed; + private View.FocusDirection _direction; + + public View CurrentView + { + get + { + return _current; + } + set + { + _current = value; + } + } + + public View ProposedView + { + get + { + return _proposed; + } + set + { + _proposed = value; + } + } + + public View.FocusDirection Direction + { + get + { + return _direction; + } + set + { + _direction = value; + } + } + } + + private EventHandlerWithReturnType _preFocusChangeEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr PreFocusChangeEventCallback(IntPtr current, IntPtr proposed, View.FocusDirection direction); + private PreFocusChangeEventCallback _preFocusChangeCallback; + + /// + /// PreFocusChange will be triggered before the focus is going to be changed.
+ /// FocusManager makes the best guess for which view to focus towards the given direction, but applications might want to change that.
+ /// By connecting with this event, they can check the proposed view to focus and return a different view if they wish.
+ /// This event is only triggered when the navigation key is pressed and KeyboardFocusManager tries to move the focus automatically.
+ /// It won't be emitted for focus movement by calling SetCurrentFocusView directly.
+ ///
+ public event EventHandlerWithReturnType PreFocusChange + { + add + { + if (_preFocusChangeEventHandler == null) + { +#if DEBUG_ON + Tizen.Log.Debug("NUI", "con1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty()); + Tizen.Log.Debug("NUI", "con2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount()); +#endif + _preFocusChangeCallback = OnPreFocusChange; + PreFocusChangeSignal().Connect(_preFocusChangeCallback); +#if DEBUG_ON + Tizen.Log.Debug("NUI", "con3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty()); + Tizen.Log.Debug("NUI", "con4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount()); +#endif + } + _preFocusChangeEventHandler += value; + } + remove + { + _preFocusChangeEventHandler -= value; + if (_preFocusChangeEventHandler == null && PreFocusChangeSignal().Empty() == false) + { +#if DEBUG_ON + Tizen.Log.Debug("NUI", "discon1) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty()); + Tizen.Log.Debug("NUI", "discon2) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount()); +#endif + PreFocusChangeSignal().Disconnect(_preFocusChangeCallback); +#if DEBUG_ON + Tizen.Log.Debug("NUI", "discon3) PreFocusChangeSignal().Empty = " + PreFocusChangeSignal().Empty()); + Tizen.Log.Debug("NUI", "discon4) PreFocusChangeSignal().GetConnectionCount = " + PreFocusChangeSignal().GetConnectionCount()); +#endif + } + } + } + + private IntPtr OnPreFocusChange(IntPtr current, IntPtr proposed, View.FocusDirection direction) + { + View view = null; + PreFocusChangeEventArgs e = new PreFocusChangeEventArgs(); + + if (current != global::System.IntPtr.Zero) + { + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + } + if (proposed != global::System.IntPtr.Zero) + { + e.ProposedView = Registry.GetManagedBaseHandleFromNativePtr(proposed) as View; + } + e.Direction = direction; + + if (_preFocusChangeEventHandler != null) + { + view = _preFocusChangeEventHandler(this, e); + } + + if (view) + { + return view.GetPtrfromView(); + } + else + { + //if (e.ProposedView) return proposed; + //else return current; + return current; //xb.teng + } + } + + /// + ///Event arguments that passed via FocusChanged signal. + /// + public class FocusChangedEventArgs : EventArgs + { + private View _current; + private View _next; + + public View CurrentView + { + get + { + return _current; + } + set + { + _current = value; + } + } + + public View NextView + { + get + { + return _next; + } + set + { + _next = value; + } + } + } + + private EventHandler _focusChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void FocusChangedEventCallback(IntPtr current, IntPtr next); + private FocusChangedEventCallback _focusChangedEventCallback; + + /// + /// FocusGroupChanged will be triggered after the current focused view has been changed. + /// + public event EventHandler FocusChanged + { + add + { + if (_focusChangedEventCallback == null) + { + _focusChangedEventCallback = OnFocusChanged; + FocusChangedSignal().Connect(_focusChangedEventCallback); + } + _focusChangedEventHandler += value; + } + remove + { + _focusChangedEventHandler -= value; + + if (_focusChangedEventCallback == null && FocusChangedSignal().Empty() == false) + { + FocusChangedSignal().Disconnect(_focusChangedEventCallback); + } + } + } + + private void OnFocusChanged(IntPtr current, IntPtr next) + { + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + e.NextView = Registry.GetManagedBaseHandleFromNativePtr(next) as View; + + if (_focusChangedEventHandler != null) + { + _focusChangedEventHandler(this, e); + } + } + + /// + ///Event arguments that passed via FocusGroupChanged signal. + /// + public class FocusGroupChangedEventArgs : EventArgs + { + private View _current; + private bool _forwardDirection; + + public View CurrentView + { + get + { + return _current; + } + set + { + _current = value; + } + } + + public bool ForwardDirection + { + get + { + return _forwardDirection; + } + set + { + _forwardDirection = value; + } + } + } + + private EventHandler _focusGroupChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusGroupChangedEventCallback(IntPtr current, bool forwardDirection); + private FocusGroupChangedEventCallback _focusGroupChangedEventCallback; + + /// + /// FocusGroupChanged will be triggered when the focus group has been changed.
+ /// If the current focus group has a parent layout control, FocusManager will make the best guess for the next focus group to move the focus to in the given direction (forward or backward).
+ /// If not, the application has to set the new focus.
+ ///
+ public event EventHandler FocusGroupChanged + { + add + { + if (_focusGroupChangedEventCallback == null) + { + _focusGroupChangedEventCallback = OnFocusGroupChanged; + FocusGroupChangedSignal().Connect(_focusGroupChangedEventCallback); + } + _focusGroupChangedEventHandler += value; + } + remove + { + _focusGroupChangedEventHandler -= value; + + if (_focusGroupChangedEventCallback == null && FocusGroupChangedSignal().Empty() == false) + { + FocusGroupChangedSignal().Disconnect(_focusGroupChangedEventCallback); + } + } + } + + private void OnFocusGroupChanged(IntPtr current, bool forwardDirection) + { + FocusGroupChangedEventArgs e = new FocusGroupChangedEventArgs(); + + e.CurrentView = Registry.GetManagedBaseHandleFromNativePtr(current) as View; + e.ForwardDirection = forwardDirection; + + if (_focusGroupChangedEventHandler != null) + { + _focusGroupChangedEventHandler(this, e); + } + } + + /// + ///Event arguments that passed via FocusedViewEnterKey signal + /// + public class FocusedViewActivatedEventArgs : EventArgs + { + private View _view; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + private EventHandler _focusedViewEnterKeyEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusedViewEnterKeyEventCallback(IntPtr view); + private FocusedViewEnterKeyEventCallback _focusedViewEnterKeyEventCallback; + + /// + /// FocusedViewActivated will be triggered when the current focused view has the enter key pressed on it. + /// + public event EventHandler FocusedViewActivated + { + add + { + if (_focusedViewEnterKeyEventCallback == null) + { + _focusedViewEnterKeyEventCallback = OnFocusedViewEnterKey; + FocusedViewEnterKeySignal().Connect(_focusedViewEnterKeyEventCallback); + } + _focusedViewEnterKeyEventHandler += value; + } + remove + { + _focusedViewEnterKeyEventHandler -= value; + + if (_focusedViewEnterKeyEventCallback == null && FocusedViewEnterKeySignal().Empty() == false) + { + FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback); + } + } + } + + private void OnFocusedViewEnterKey(IntPtr view) + { + FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs(); + + e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View; + + if (_focusedViewEnterKeyEventHandler != null) + { + _focusedViewEnterKeyEventHandler(this, e); + } + } + + + internal FocusManager() : this(NDalicManualPINVOKE.new_FocusManager(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static FocusManager Get() + { + FocusManager ret = new FocusManager(NDalicManualPINVOKE.FocusManager_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Moves the keyboard focus to the given View.
+ /// Only one View can be focused at the same time.
+ /// The View must be in the stage already and keyboard focusable.
+ ///
+ /// The View to be focused + /// Whether the focus is successful or not + public bool SetCurrentFocusView(View view) + { + if(view == null) + { + throw new ArgumentNullException("the target view should not be null"); + } + + bool ret = NDalicManualPINVOKE.FocusManager_SetCurrentFocusActor(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the current focused view. + /// + /// A handle to the current focused View or an empty handle if no View is focused + public View GetCurrentFocusView() + { + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetCurrentFocusActor(swigCPtr); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + return ret; + } + + /// + /// Moves the focus to the next focusable View in the focus chain in the given direction(according to the focus traversal order). + /// + /// The direction of focus movement + /// true if the movement was successful + public bool MoveFocus(View.FocusDirection direction) + { + bool ret = NDalicManualPINVOKE.FocusManager_MoveFocus(swigCPtr, (int)direction); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Clears the focus from the current focused view if any, so that no view is focused in the focus chain.
+ /// It will emit FocusChanged event without current focused View.
+ ///
+ public void ClearFocus() + { + NDalicManualPINVOKE.FocusManager_ClearFocus(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Move the focus to prev focused view. + /// + public void MoveFocusBackward() + { + NDalicManualPINVOKE.FocusManager_MoveFocusBackward(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets/Gets the status of whether the focus movement should be looped within the same focus group.
+ /// The focus movement is not looped by default.
+ ///
+ public bool FocusGroupLoop + { + set + { + SetFocusGroupLoop(value); + } + get + { + return GetFocusGroupLoop(); + } + } + + internal void SetFocusGroupLoop(bool enabled) + { + NDalicManualPINVOKE.FocusManager_SetFocusGroupLoop(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool GetFocusGroupLoop() + { + bool ret = NDalicManualPINVOKE.FocusManager_GetFocusGroupLoop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets whether an View is a focus group that can limit the scope of focus movement to its child views in the focus chain.
+ /// Layout controls set themselves as focus groups by default.
+ ///
+ /// The View to be set as a focus group + /// Whether to set the View as a focus group or not + public void SetAsFocusGroup(View view, bool isFocusGroup) + { + NDalicManualPINVOKE.FocusManager_SetAsFocusGroup(swigCPtr, View.getCPtr(view), isFocusGroup); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Checks whether the view is set as a focus group or not. + /// + /// The View to be checked + /// Whether the View is set as a focus group + public bool IsFocusGroup(View view) + { + bool ret = NDalicManualPINVOKE.FocusManager_IsFocusGroup(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the closest ancestor of the given view that is a focus group. + /// + /// The View to be checked for its focus group + /// The focus group the given view belongs to or an empty handle if the given view + public View GetFocusGroup(View view) + { + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + + /*View ret = new View(NDalicManualPINVOKE.FocusManager_GetFocusGroup(swigCPtr, View.getCPtr(view)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (ret.HasBody() == false) + { + return null; + }*/ + + return ret; + } + + /// + /// Sets/Gets the focus indicator View.
+ /// This will replace the default focus indicator view in FocusManager and will be added to the focused view as a highlight.
+ ///
+ public View FocusIndicator + { + set + { + SetFocusIndicatorView(value); + } + get + { + return GetFocusIndicatorView(); + } + } + + internal void SetFocusIndicatorView(View indicator) + { + NDalicManualPINVOKE.FocusManager_SetFocusIndicatorActor(swigCPtr, View.getCPtr(indicator)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal View GetFocusIndicatorView() + { + IntPtr cPtr = NDalicManualPINVOKE.FocusManager_GetFocusIndicatorActor(swigCPtr); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + return ret; + } + + /// + /// Provide the implementation of custom Focus algorithm interface to allow the app define the focus logic.
+ ///
+ /// The user's implementation of ICustomFocusAlgorithm + public void SetCustomAlgorithm(ICustomFocusAlgorithm arg0) + { + _customAlgorithmInterfaceWrapper = new CustomAlgorithmInterfaceWrapper(); + _customAlgorithmInterfaceWrapper.SetFocusAlgorithm(arg0); + + NDalicPINVOKE.SetCustomAlgorithm(swigCPtr, CustomAlgorithmInterface.getCPtr(_customAlgorithmInterfaceWrapper)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PreFocusChangeSignal PreFocusChangeSignal() + { + PreFocusChangeSignal ret = new PreFocusChangeSignal(NDalicManualPINVOKE.FocusManager_PreFocusChangeSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal FocusChangedSignal FocusChangedSignal() + { + FocusChangedSignal ret = new FocusChangedSignal(NDalicManualPINVOKE.FocusManager_FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal FocusGroupChangedSignal FocusGroupChangedSignal() + { + FocusGroupChangedSignal ret = new FocusGroupChangedSignal(NDalicManualPINVOKE.FocusManager_FocusGroupChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ViewSignal FocusedViewEnterKeySignal() + { + ViewSignal ret = new ViewSignal(NDalicManualPINVOKE.FocusManager_FocusedActorEnterKeySignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private static readonly FocusManager instance = FocusManager.Get(); + + /// + /// Gets the singleton of FocusManager object. + /// + public static FocusManager Instance + { + get + { + return instance; + } + } + + /// + /// ICustomFocusAlgorithm is used to provide custom keyboard focus algorithm for retrieving the next focusable view.
+ /// The application can implement the interface and override the keyboard focus behaviour.
+ /// If focus is changing within a layout container, then the layout container is queried first to provide the next focusable view.
+ /// If this does not provide a valid view, then the Keyboard FocusManager will check focusable properties to determine next focusable actor.
+ /// If focusable properties are not set, then the Keyboard FocusManager calls the GetNextFocusableView() method of this interface.
+ ///
+ public interface ICustomFocusAlgorithm + { + View GetNextFocusableView(View current, View proposed, View.FocusDirection direction); + } + + private class CustomAlgorithmInterfaceWrapper : CustomAlgorithmInterface + { + private FocusManager.ICustomFocusAlgorithm _customFocusAlgorithm; + + public CustomAlgorithmInterfaceWrapper() + { + } + + public void SetFocusAlgorithm(FocusManager.ICustomFocusAlgorithm customFocusAlgorithm) + { + _customFocusAlgorithm = customFocusAlgorithm; + } + + public override View GetNextFocusableView(View current, View proposed, View.FocusDirection direction) + { + return _customFocusAlgorithm.GetNextFocusableView(current, proposed, direction); + } + } + + + + [Obsolete("Please do not use! this will be deprecated")] + public class FocusedViewEnterKeyEventArgs : EventArgs + { + private View _view; + + public View View + { + get + { + return _view; + } + set + { + _view = value; + } + } + } + + private EventHandler _focusedViewEnterKeyEventHandler2; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void FocusedViewEnterKeyEventCallback2(IntPtr view); + private FocusedViewEnterKeyEventCallback2 _focusedViewEnterKeyEventCallback2; + + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler FocusedViewEnterKeyPressed + { + add + { + if (_focusedViewEnterKeyEventCallback2 == null) + { + _focusedViewEnterKeyEventCallback2 = OnFocusedViewEnterKey2; + FocusedViewEnterKeySignal().Connect(_focusedViewEnterKeyEventCallback2); + } + _focusedViewEnterKeyEventHandler2 += value; + } + remove + { + _focusedViewEnterKeyEventHandler2 -= value; + + if (_focusedViewEnterKeyEventCallback2 == null && FocusedViewEnterKeySignal().Empty() == false) + { + FocusedViewEnterKeySignal().Disconnect(_focusedViewEnterKeyEventCallback2); + } + } + } + + [Obsolete("Please do not use! this will be deprecated")] + private void OnFocusedViewEnterKey2(IntPtr view) + { + FocusedViewActivatedEventArgs e = new FocusedViewActivatedEventArgs(); + + e.View = Registry.GetManagedBaseHandleFromNativePtr(view) as View; + + if (_focusedViewEnterKeyEventHandler != null) + { + _focusedViewEnterKeyEventHandler(this, e); + } + } + } +} diff --git a/src/Tizen.NUI/src/public/Geometry.cs b/src/Tizen.NUI/src/public/Geometry.cs new file mode 100755 index 0000000..4752be2 --- /dev/null +++ b/src/Tizen.NUI/src/public/Geometry.cs @@ -0,0 +1,124 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Geometry : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Geometry(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Geometry_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Geometry obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Geometry(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public Geometry() : this(NDalicPINVOKE.Geometry_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public uint AddVertexBuffer(PropertyBuffer vertexBuffer) + { + uint ret = NDalicPINVOKE.Geometry_AddVertexBuffer(swigCPtr, PropertyBuffer.getCPtr(vertexBuffer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetNumberOfVertexBuffers() + { + uint ret = NDalicPINVOKE.Geometry_GetNumberOfVertexBuffers(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void RemoveVertexBuffer(uint index) + { + NDalicPINVOKE.Geometry_RemoveVertexBuffer(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetIndexBuffer(ushort[] indices, uint count) + { + NDalicPINVOKE.Geometry_SetIndexBuffer(swigCPtr, indices, count); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetType(Geometry.Type geometryType) + { + NDalicPINVOKE.Geometry_SetType(swigCPtr, (int)geometryType); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Geometry.Type GetType() + { + Geometry.Type ret = (Geometry.Type)NDalicPINVOKE.Geometry_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum Type + { + POINTS, + LINES, + LINE_LOOP, + LINE_STRIP, + TRIANGLES, + TRIANGLE_FAN, + TRIANGLE_STRIP + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Gesture.cs b/src/Tizen.NUI/src/public/Gesture.cs new file mode 100755 index 0000000..8e8d957 --- /dev/null +++ b/src/Tizen.NUI/src/public/Gesture.cs @@ -0,0 +1,218 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// Base structure for different gestures that an application can receive.
+ /// A gesture is an event that is produced from a combination of several touch events + /// in a particular order or within a certain time frame (e.g pinch).
+ ///
+ public class Gesture : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Gesture(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Gesture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Gesture() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Gesture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// The gesture type. + /// + public Gesture.GestureType Type + { + get + { + return type; + } + } + + /// + /// The gesture state. + /// + public Gesture.StateType State + { + get + { + return state; + } + } + + /// + /// The time the gesture took place. + /// + public uint Time + { + get + { + return time; + } + } + + /// + /// Copy constructor. + /// + /// A reference to the copied handle + public Gesture(Gesture rhs) : this(NDalicPINVOKE.new_Gesture(Gesture.getCPtr(rhs)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Gesture.GestureType type + { + set + { + NDalicPINVOKE.Gesture_type_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Gesture.GestureType ret = (Gesture.GestureType)NDalicPINVOKE.Gesture_type_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Gesture.StateType state + { + set + { + NDalicPINVOKE.Gesture_state_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Gesture.StateType ret = (Gesture.StateType)NDalicPINVOKE.Gesture_state_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint time + { + set + { + NDalicPINVOKE.Gesture_time_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Gesture_time_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Enumeration for type of gesture + /// + public enum GestureType + { + Pinch = 1 << 0, + Pan = 1 << 1, + Tap = 1 << 2, + LongPress = 1 << 3 + } + + /// + /// Enumeration for state of the gesture. + /// + public enum StateType + { + Clear, + Started, + Continuing, + Finished, + Cancelled, + Possible + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Hover.cs b/src/Tizen.NUI/src/public/Hover.cs new file mode 100755 index 0000000..4da86f6 --- /dev/null +++ b/src/Tizen.NUI/src/public/Hover.cs @@ -0,0 +1,269 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + /// + /// Hover events are a collection of points at a specific moment in time.
+ /// When a multi event occurs, each point represents the points that are currently being + /// hovered or the points where a hover has stopped.
+ ///
+ public class Hover : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Hover(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Hover obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Hover() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Hover(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + internal static Hover GetHoverFromPtr(global::System.IntPtr cPtr) + { + Hover ret = new Hover(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The time (in ms) that the hover event occurred. + /// + public uint Time + { + get + { + return time; + } + } + + /// + /// Returns the ID of the device used for the Point specified.
+ /// Each point has a unique device ID which specifies the device used for that + /// point. This is returned by this method.
+ ///
+ /// The point required + /// The Device ID of this poin + public int GetDeviceId(uint point) + { + if (point < points.Count) + { + return points[(int)point].DeviceId; + } + return -1; + } + + /// + /// Retrieves the State of the point specified. + /// + /// The point required + /// The state of the point specified + public PointStateType GetState(uint point) + { + if (point < points.Count) + { + return (Tizen.NUI.PointStateType)(points[(int)point].State); + } + return PointStateType.Finished; + } + + /// + /// Retrieves the view that was underneath the point specified. + /// + /// The point required + /// The view that was underneath the point specified + public View GetHitView(uint point) + { + if (point < points.Count) + { + return points[(int)point].HitView; + } + else + { + // Return a native empty handle + View view = new View(); + view.Reset(); + return view; + } + } + + /// + /// Retrieves the co-ordinates relative to the top-left of the hit-view at the point specified. + /// + /// The point required + /// The co-ordinates relative to the top-left of the hit-view of the point specified + public Vector2 GetLocalPosition(uint point) + { + if (point < points.Count) + { + return points[(int)point].Local; + } + return new Vector2(0.0f, 0.0f); + } + + /// + /// Retrieves the co-ordinates relative to the top-left of the screen of the point specified. + /// + /// The point required + /// The co-ordinates relative to the top-left of the screen of the point specified + public Vector2 GetScreenPosition(uint point) + { + if (point < points.Count) + { + return points[(int)point].Screen; + } + return new Vector2(0.0f, 0.0f); + } + + /// + /// Default constructor. + /// + public Hover() : this(NDalicPINVOKE.new_Hover__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// The time the event occurred + internal Hover(uint time) : this(NDalicPINVOKE.new_Hover__SWIG_1(time), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private TouchPointContainer points + { + set + { + NDalicPINVOKE.Hover_points_set(swigCPtr, TouchPointContainer.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Hover_points_get(swigCPtr); + TouchPointContainer ret = (cPtr == global::System.IntPtr.Zero) ? null : new TouchPointContainer(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint time + { + set + { + NDalicPINVOKE.Hover_time_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Hover_time_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Returns the total number of points. + /// + /// Total number of Points + public uint GetPointCount() + { + uint ret = NDalicPINVOKE.Hover_GetPointCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TouchPoint GetPoint(uint point) + { + TouchPoint ret = new TouchPoint(NDalicPINVOKE.Hover_GetPoint(swigCPtr, point), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/ImfManager.cs b/src/Tizen.NUI/src/public/ImfManager.cs new file mode 100755 index 0000000..16f5728 --- /dev/null +++ b/src/Tizen.NUI/src/public/ImfManager.cs @@ -0,0 +1,1624 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + /// + /// Specifically manages the ecore input method framework which enables the virtual or hardware keyboards. + /// + public class ImfManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ImfManager(IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ImfManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ImfManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// This structure is used to pass on data from the IMF regarding predictive text. + /// + public class ImfEventData : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ImfEventData(IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfEventData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ImfEventData() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// Dispose pattern + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ImfManager_ImfEventData(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero); + } + + disposed = true; + } + + internal static ImfEventData GetImfEventDataFromPtr(IntPtr cPtr) + { + ImfEventData ret = new ImfEventData(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Default Constructor + /// + public ImfEventData() : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// The name of the event from the IMF. + /// The pre-edit or commit string. + /// Start position from the current cursor position to start deleting characters. + /// The number of characters to delete from the cursorOffset. + public ImfEventData(ImfManager.ImfEvent aEventName, string aPredictiveString, int aCursorOffset, int aNumberOfChars) : this(NDalicManualPINVOKE.new_ImfManager_ImfEventData__SWIG_1((int)aEventName, aPredictiveString, aCursorOffset, aNumberOfChars), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// The pre-edit or commit string. + /// + [Obsolete("Please do not use! this will be deprecated")] + public string predictiveString + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The pre-edit or commit string. + /// + public string PredictiveString + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicManualPINVOKE.ImfManager_ImfEventData_predictiveString_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The name of the event from the IMF. + /// + [Obsolete("Please do not use! this will be deprecated")] + public ImfManager.ImfEvent eventName + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The name of the event from the IMF. + /// + public ImfManager.ImfEvent EventName + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + ImfManager.ImfEvent ret = (ImfManager.ImfEvent)NDalicManualPINVOKE.ImfManager_ImfEventData_eventName_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Start position from the current cursor position to start deleting characters. + /// + [Obsolete("Please do not use! this will be deprecated")] + public int cursorOffset + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Start position from the current cursor position to start deleting characters. + /// + public int CursorOffset + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_cursorOffset_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Number of characters to delete from the cursorOffset. + /// + [Obsolete("Please do not use! this will be deprecated")] + public int numberOfChars + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Number of characters to delete from the cursorOffset. + /// + public int NumberOfChars + { + set + { + NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfEventData_numberOfChars_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + /// + /// Data required by IMF from the callback. + /// + public class ImfCallbackData : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal IntPtr GetImfCallbackDataPtr() + { + return (IntPtr)swigCPtr; + } + + internal ImfCallbackData(IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ImfCallbackData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~ImfCallbackData() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// Dispose pattern + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ImfManager_ImfCallbackData(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, IntPtr.Zero); + } + + disposed = true; + } + + internal static ImfCallbackData GetImfCallbackDataFromPtr(IntPtr cPtr) + { + ImfCallbackData ret = new ImfCallbackData(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Default Constructor + /// + public ImfCallbackData() : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// True if cursor position needs to be updated. + /// New position of cursor. + /// Current text string. + /// Flag if preedit reset is required. + public ImfCallbackData(bool aUpdate, int aCursorPosition, string aCurrentText, bool aPreeditResetRequired) : this(NDalicManualPINVOKE.new_ImfManager_ImfCallbackData__SWIG_1(aUpdate, aCursorPosition, aCurrentText, aPreeditResetRequired), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Current text string. + /// + [Obsolete("Please do not use! this will be deprecated")] + public string currentText + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Current text string. + /// + public string CurrentText + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_currentText_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Current text string. + /// + [Obsolete("Please do not use! this will be deprecated")] + public int cursorPosition + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Current text string. + /// + public int CursorPosition + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_cursorPosition_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// If cursor position needs to be updated. + /// + [Obsolete("Please do not use! this will be deprecated")] + public bool update + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// If cursor position needs to be updated. + /// + public bool Update + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_update_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Flag if preedit reset is required. + /// + [Obsolete("Please do not use! this will be deprecated")] + public bool preeditResetRequired + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Flag if preedit reset is required. + /// + public bool PreeditResetRequired + { + set + { + NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + bool ret = NDalicManualPINVOKE.ImfManager_ImfCallbackData_preeditResetRequired_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + /// + /// Retrieve a handle to the instance of ImfManager. + /// + /// A handle to the ImfManager. + public static ImfManager Get() + { + ImfManager ret = new ImfManager(NDalicManualPINVOKE.ImfManager_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Activate the IMF.
+ /// It means that the text editing is started at somewhere.
+ /// If the H/W keyboard isn't connected then it will show the virtual keyboard. + ///
+ public void Activate() + { + NDalicManualPINVOKE.ImfManager_Activate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Deactivate the IMF.
+ /// It means that the text editing is finished at somewhere. + ///
+ public void Deactivate() + { + NDalicManualPINVOKE.ImfManager_Deactivate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Get the restoration status, which controls if the keyboard is restored after the focus lost then regained.
+ /// If true then keyboard will be restored (activated) after focus is regained. + ///
+ /// Restoration status. + public bool RestoreAfterFocusLost() + { + bool ret = NDalicManualPINVOKE.ImfManager_RestoreAfterFocusLost(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Set status whether the IMF has to restore the keyboard after losing focus. + /// + /// True means that keyboard should be restored after focus lost and regained. + public void SetRestoreAfterFocusLost(bool toggle) + { + NDalicManualPINVOKE.ImfManager_SetRestoreAfterFocusLost(swigCPtr, toggle); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Send message reset the pred-edit state / imf module. + /// + public new void Reset() + { + NDalicManualPINVOKE.ImfManager_Reset(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Notifies IMF context that the cursor position has changed, required for features like auto-capitalisation. + /// + public void NotifyCursorPosition() + { + NDalicManualPINVOKE.ImfManager_NotifyCursorPosition(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets cursor position stored in VirtualKeyboard, this is required by the IMF context. + /// + /// Position of cursor. + public void SetCursorPosition(uint cursorPosition) + { + NDalicManualPINVOKE.ImfManager_SetCursorPosition(swigCPtr, cursorPosition); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets cursor position stored in VirtualKeyboard, this is required by the IMF context. + /// + /// Current position of cursor + public uint GetCursorPosition() + { + uint ret = NDalicManualPINVOKE.ImfManager_GetCursorPosition(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Method to store the string required by the IMF, this is used to provide predictive word suggestions. + /// + /// The text string surrounding the current cursor point. + public void SetSurroundingText(string text) + { + NDalicManualPINVOKE.ImfManager_SetSurroundingText(swigCPtr, text); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets current text string set within the IMF manager, this is used to offer predictive suggestions. + /// + /// Surrounding text. + public string GetSurroundingText() + { + string ret = NDalicManualPINVOKE.ImfManager_GetSurroundingText(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Notifies IMF context that text input is set to multi line or not. + /// + /// True if multiline text input is used. + public void NotifyTextInputMultiLine(bool multiLine) + { + NDalicManualPINVOKE.ImfManager_NotifyTextInputMultiLine(swigCPtr, multiLine); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns text direction of the keyboard's current input language. + /// + /// The direction of the text. + public ImfManager.TextDirection GetTextDirection() + { + ImfManager.TextDirection ret = (ImfManager.TextDirection)NDalicManualPINVOKE.ImfManager_GetTextDirection(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Provides size and position of keyboard.
+ /// Position is relative to whether keyboard is visible or not.
+ /// If keyboard is not visible then position will be off the screen.
+ /// If keyboard is not being shown when this method is called the keyboard is partially setup (IMFContext) to get
+ /// the values then taken down. So ideally GetInputMethodArea() should be called after Show(). + ///
+ /// Rectangle which is keyboard panel x, y, width, height + public Rectangle GetInputMethodArea() + { + Rectangle ret = new Rectangle(NDalicManualPINVOKE.ImfManager_GetInputMethodArea(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void ApplyOptions(InputMethodOptions options) + { + NDalicManualPINVOKE.ImfManager_ApplyOptions(swigCPtr, InputMethodOptions.getCPtr(options)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets up the input-panel specific data. + /// + /// The specific data to be set to the input panel. + public void SetInputPanelUserData(string text) + { + NDalicManualPINVOKE.ImfManager_SetInputPanelUserData(swigCPtr, text); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the specific data of the current active input panel. + /// + /// The specific data to be got from the input panel. + public void GetInputPanelUserData(out string text) + { + NDalicManualPINVOKE.ImfManager_GetInputPanelUserData(swigCPtr, out text); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the state of the current active input panel. + /// + /// The state of the input panel. + public ImfManager.State GetInputPanelState() + { + ImfManager.State ret = (ImfManager.State)NDalicManualPINVOKE.ImfManager_GetInputPanelState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the return key on the input panel to be visible or invisible.
+ /// The default is true. + ///
+ /// True if the return key is visible(enabled), false otherwise. + public void SetReturnKeyState(bool visible) + { + NDalicManualPINVOKE.ImfManager_SetReturnKeyState(swigCPtr, visible); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Enable to show the input panel automatically when focused. + /// + /// If true, the input panel will be shown when focused. + public void AutoEnableInputPanel(bool enabled) + { + NDalicManualPINVOKE.ImfManager_AutoEnableInputPanel(swigCPtr, enabled); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Shows the input panel. + /// + public void ShowInputPanel() + { + NDalicManualPINVOKE.ImfManager_ShowInputPanel(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Hides the input panel. + /// + public void HideInputPanel() + { + NDalicManualPINVOKE.ImfManager_HideInputPanel(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the keyboard type.
+ /// The default keyboard type is SoftwareKeyboard. + ///
+ /// The keyboard type + public ImfManager.KeyboardType GetKeyboardType() + { + ImfManager.KeyboardType ret = (ImfManager.KeyboardType)NDalicManualPINVOKE.ImfManager_GetKeyboardType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the current language locale of the input panel.
+ /// Ex) en_US, en_GB, en_PH, fr_FR, ... + ///
+ /// The current language locale of the input panel. + public string GetInputPanelLocale() + { + string ret = NDalicManualPINVOKE.ImfManager_GetInputPanelLocale(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Constructor + /// + public ImfManager() : this(NDalicManualPINVOKE.new_ImfManager(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// ImfManager activated event arguments. + /// + [Obsolete("Please do not use! this will be deprecated")] + public class ImfManagerActivatedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ImfManagerActivatedEventCallbackType(global::System.IntPtr data); + private ImfManagerActivatedEventCallbackType _imfManagerActivatedEventCallback; + private event EventHandler _imfManagerActivatedEventHandler; + + /// + /// ImfManager activated event. + /// + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler ImfManagerActivated + { + add + { + if (_imfManagerActivatedEventHandler == null) + { + _imfManagerActivatedEventCallback = OnImfManagerActivated; + ActivatedSignal().Connect(_imfManagerActivatedEventCallback); + } + + _imfManagerActivatedEventHandler += value; + } + remove + { + _imfManagerActivatedEventHandler -= value; + + if (_imfManagerActivatedEventHandler == null && _imfManagerActivatedEventCallback != null) + { + ActivatedSignal().Disconnect(_imfManagerActivatedEventCallback); + } + } + } + + private void OnImfManagerActivated(global::System.IntPtr data) + { + ImfManagerActivatedEventArgs e = new ImfManagerActivatedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_imfManagerActivatedEventHandler != null) + { + _imfManagerActivatedEventHandler(this, e); + } + } + + /// + /// ImfManager activated event arguments. + /// + public class ActivatedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ActivatedEventCallbackType(IntPtr data); + private ActivatedEventCallbackType _activatedEventCallback; + private event EventHandler _activatedEventHandler; + + /// + /// ImfManager activated. + /// + public event EventHandler Activated + { + add + { + if (_activatedEventHandler == null) + { + _activatedEventCallback = OnActivated; + ActivatedSignal().Connect(_activatedEventCallback); + } + + _activatedEventHandler += value; + } + remove + { + _activatedEventHandler -= value; + + if (_activatedEventHandler == null && _activatedEventCallback != null) + { + ActivatedSignal().Disconnect(_activatedEventCallback); + } + } + } + + private void OnActivated(IntPtr data) + { + ActivatedEventArgs e = new ActivatedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_activatedEventHandler != null) + { + _activatedEventHandler(this, e); + } + } + + /// + /// ImfManager activated signal. + /// + [Obsolete("Please do not use! this will be internal")] + public ActivatedSignalType ActivatedSignal() + { + ActivatedSignalType ret = new ActivatedSignalType(NDalicManualPINVOKE.ImfManager_ActivatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImfManager event received event arguments. + /// + [Obsolete("Please do not use! this will be deprecated")] + public class ImfManagerEventReceivedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + private delegate void ImfManagerEventReceivedEventCallbackType(global::System.IntPtr data); + private ImfManagerEventReceivedEventCallbackType _imfManagerEventReceivedEventCallback; + private event EventHandler _imfManagerEventReceivedEventHandler; + + /// + /// ImfManager event received. + /// + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler ImfManagerEventReceived + { + add + { + if (_imfManagerEventReceivedEventHandler == null) + { + _imfManagerEventReceivedEventCallback = OnImfManagerEventReceived; + EventReceivedSignal().Connect(_imfManagerEventReceivedEventCallback); + } + + _imfManagerEventReceivedEventHandler += value; + } + remove + { + _imfManagerEventReceivedEventHandler -= value; + + if (_imfManagerEventReceivedEventHandler == null && _imfManagerEventReceivedEventCallback != null) + { + EventReceivedSignal().Disconnect(_imfManagerEventReceivedEventCallback); + } + } + } + + private void OnImfManagerEventReceived(global::System.IntPtr data) + { + ImfManagerEventReceivedEventArgs e = new ImfManagerEventReceivedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_imfManagerEventReceivedEventHandler != null) + { + _imfManagerEventReceivedEventHandler(this, e); + } + } + + /// + /// ImfManager event received event arguments. + /// + public class EventReceivedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + + public ImfEventData ImfEventData + { + get; + set; + } + } + + private delegate IntPtr EventReceivedEventCallbackType(IntPtr imfManager, IntPtr imfEventData); + private EventReceivedEventCallbackType _eventReceivedEventCallback; + private event EventHandlerWithReturnType _eventReceivedEventHandler; + + /// + /// ImfManager event received. + /// + public event EventHandlerWithReturnType EventReceived + { + add + { + if (_eventReceivedEventHandler == null) + { + _eventReceivedEventCallback = OnEventReceived; + EventReceivedSignal().Connect(_eventReceivedEventCallback); + } + + _eventReceivedEventHandler += value; + } + remove + { + _eventReceivedEventHandler -= value; + + if (_eventReceivedEventHandler == null && _eventReceivedEventCallback != null) + { + EventReceivedSignal().Disconnect(_eventReceivedEventCallback); + } + } + } + + private IntPtr OnEventReceived(IntPtr imfManager, IntPtr imfEventData) + { + ImfCallbackData imfCallbackData = null; + + EventReceivedEventArgs e = new EventReceivedEventArgs(); + + if (imfManager != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(imfManager) as ImfManager; + } + if (imfEventData != null) + { + e.ImfEventData = ImfEventData.GetImfEventDataFromPtr(imfEventData); + } + + if (_eventReceivedEventHandler != null) + { + imfCallbackData = _eventReceivedEventHandler(this, e); + } + if (imfCallbackData != null) + { + return imfCallbackData.GetImfCallbackDataPtr(); + } + else + { + return new ImfCallbackData().GetImfCallbackDataPtr(); + } + } + + /// + /// ImfManager event received signal. + /// + [Obsolete("Please do not use! this will be internal")] + public ImfEventSignalType EventReceivedSignal() + { + ImfEventSignalType ret = new ImfEventSignalType(NDalicManualPINVOKE.ImfManager_EventReceivedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImfManager status changed event arguments. + /// + [Obsolete("Please do not use! this will be deprecated")] + public class ImfManagerStatusChangedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + private delegate void ImfManagerStatusChangedEventCallbackType(global::System.IntPtr data); + private ImfManagerStatusChangedEventCallbackType _imfManagerStatusChangedEventCallback; + private event EventHandler _imfManagerStatusChangedEventHandler; + + /// + /// ImfManager status changed. + /// + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler ImfManagerStatusChanged + { + add + { + if (_imfManagerStatusChangedEventHandler == null) + { + _imfManagerStatusChangedEventCallback = OnImfManagerStatusChanged; + StatusChangedSignal().Connect(_imfManagerStatusChangedEventCallback); + } + + _imfManagerStatusChangedEventHandler += value; + } + remove + { + _imfManagerStatusChangedEventHandler -= value; + + if (_imfManagerStatusChangedEventHandler == null && _imfManagerStatusChangedEventCallback != null) + { + StatusChangedSignal().Disconnect(_imfManagerStatusChangedEventCallback); + } + } + } + + private void OnImfManagerStatusChanged(global::System.IntPtr data) + { + ImfManagerStatusChangedEventArgs e = new ImfManagerStatusChangedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_imfManagerStatusChangedEventHandler != null) + { + _imfManagerStatusChangedEventHandler(this, e); + } + } + + /// + /// ImfManager status changed event arguments. + /// + public class StatusChangedEventArgs : EventArgs + { + public bool StatusChanged + { + get; + set; + } + } + + private delegate void StatusChangedEventCallbackType(bool statusChanged); + private StatusChangedEventCallbackType _statusChangedEventCallback; + private event EventHandler _statusChangedEventHandler; + + /// + /// ImfManager status changed. + /// + public event EventHandler StatusChanged + { + add + { + if (_statusChangedEventHandler == null) + { + _statusChangedEventCallback = OnStatusChanged; + StatusChangedSignal().Connect(_statusChangedEventCallback); + } + + _statusChangedEventHandler += value; + } + remove + { + _statusChangedEventHandler -= value; + + if (_statusChangedEventHandler == null && _statusChangedEventCallback != null) + { + StatusChangedSignal().Disconnect(_statusChangedEventCallback); + } + } + } + + private void OnStatusChanged(bool statusChanged) + { + StatusChangedEventArgs e = new StatusChangedEventArgs(); + + e.StatusChanged = statusChanged; + + if (_statusChangedEventHandler != null) + { + _statusChangedEventHandler(this, e); + } + } + + /// + /// ImfManager status changed signal. + /// + [Obsolete("Please do not use! this will be internal")] + public StatusSignalType StatusChangedSignal() + { + StatusSignalType ret = new StatusSignalType(NDalicManualPINVOKE.ImfManager_StatusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImfManager resized event arguments. + /// + [Obsolete("Please do not use! this will be deprecated")] + public class ImfManagerResizedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + private delegate void ImfManagerResizedEventCallbackType(IntPtr data); + private ImfManagerResizedEventCallbackType _imfManagerResizedEventCallback; + private event EventHandler _imfManagerResizedEventHandler; + + /// + /// ImfManager resized event. + /// + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler ImfManagerResized + { + add + { + if (_imfManagerResizedEventHandler == null) + { + _imfManagerResizedEventCallback = OnImfManagerResized; + ResizedSignal().Connect(_imfManagerResizedEventCallback); + } + + _imfManagerResizedEventHandler += value; + } + remove + { + _imfManagerResizedEventHandler -= value; + + if (_imfManagerResizedEventHandler == null && _imfManagerResizedEventCallback != null) + { + ResizedSignal().Disconnect(_imfManagerResizedEventCallback); + } + } + } + + private void OnImfManagerResized(IntPtr data) + { + ImfManagerResizedEventArgs e = new ImfManagerResizedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_imfManagerResizedEventHandler != null) + { + _imfManagerResizedEventHandler(this, e); + } + } + + private delegate void ResizedEventCallbackType(); + private ResizedEventCallbackType _resizedEventCallback; + private event EventHandler _resizedEventHandler; + + /// + /// ImfManager resized. + /// + public event EventHandler Resized + { + add + { + if (_resizedEventHandler == null) + { + _resizedEventCallback = OnResized; + ResizedSignal().Connect(_resizedEventCallback); + } + + _resizedEventHandler += value; + } + remove + { + _resizedEventHandler -= value; + + if (_resizedEventHandler == null && _resizedEventCallback != null) + { + ResizedSignal().Disconnect(_resizedEventCallback); + } + } + } + + private void OnResized() + { + if (_resizedEventHandler != null) + { + _resizedEventHandler(this, null); + } + } + + /// + /// ImfManager resized signal. + /// + [Obsolete("Please do not use! this will be internal")] + public ImfVoidSignalType ResizedSignal() + { + ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_ResizedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImfManager language changed event arguments. + /// + [Obsolete("Please do not use! this will be deprecated")] + public class ImfManagerLanguageChangedEventArgs : EventArgs + { + public ImfManager ImfManager + { + get; + set; + } + } + + private delegate void ImfManagerLanguageChangedEventCallbackType(IntPtr data); + private ImfManagerLanguageChangedEventCallbackType _imfManagerLanguageChangedEventCallback; + private event EventHandler _imfManagerLanguageChangedEventHandler; + + /// + /// ImfManager language changed event. + /// + [Obsolete("Please do not use! this will be deprecated")] + public event EventHandler ImfManagerLanguageChanged + { + add + { + if (_imfManagerLanguageChangedEventHandler == null) + { + _imfManagerLanguageChangedEventCallback = OnImfManagerLanguageChanged; + LanguageChangedSignal().Connect(_imfManagerLanguageChangedEventCallback); + } + + _imfManagerLanguageChangedEventHandler += value; + } + remove + { + _imfManagerLanguageChangedEventHandler -= value; + + if (_imfManagerLanguageChangedEventHandler == null && _imfManagerLanguageChangedEventCallback != null) + { + LanguageChangedSignal().Disconnect(_imfManagerLanguageChangedEventCallback); + } + } + } + + private void OnImfManagerLanguageChanged(IntPtr data) + { + ImfManagerLanguageChangedEventArgs e = new ImfManagerLanguageChangedEventArgs(); + + if (data != null) + { + e.ImfManager = Registry.GetManagedBaseHandleFromNativePtr(data) as ImfManager; + } + + if (_imfManagerLanguageChangedEventHandler != null) + { + _imfManagerLanguageChangedEventHandler(this, e); + } + } + + private delegate void LanguageChangedEventCallbackType(); + private LanguageChangedEventCallbackType _languageChangedEventCallback; + private event EventHandler _languageChangedEventHandler; + + /// + /// ImfManager language changed. + /// + public event EventHandler LanguageChanged + { + add + { + if (_languageChangedEventHandler == null) + { + _languageChangedEventCallback = OnLanguageChanged; + LanguageChangedSignal().Connect(_languageChangedEventCallback); + } + + _languageChangedEventHandler += value; + } + remove + { + _languageChangedEventHandler -= value; + + if (_languageChangedEventHandler == null && _languageChangedEventCallback != null) + { + LanguageChangedSignal().Disconnect(_languageChangedEventCallback); + } + } + } + + private void OnLanguageChanged() + { + if (_languageChangedEventHandler != null) + { + _languageChangedEventHandler(this, null); + } + } + + /// + /// ImfManager language changed signal. + /// + [Obsolete("Please do not use! this will be internal")] + public ImfVoidSignalType LanguageChangedSignal() + { + ImfVoidSignalType ret = new ImfVoidSignalType(NDalicManualPINVOKE.ImfManager_LanguageChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// ImfManager keyboard type changed event arguments. + /// + public class KeyboardTypeChangedEventArgs : EventArgs + { + public KeyboardType KeyboardType + { + get; + set; + } + } + + private delegate void KeyboardTypeChangedEventCallbackType(KeyboardType type); + private KeyboardTypeChangedEventCallbackType _keyboardTypeChangedEventCallback; + private event EventHandler _keyboardTypeChangedEventHandler; + + /// + /// ImfManager keyboard type changed. + /// + public event EventHandler KeyboardTypeChanged + { + add + { + if (_keyboardTypeChangedEventHandler == null) + { + _keyboardTypeChangedEventCallback = OnKeyboardTypeChanged; + KeyboardTypeChangedSignal().Connect(_keyboardTypeChangedEventCallback); + } + + _keyboardTypeChangedEventHandler += value; + } + remove + { + _keyboardTypeChangedEventHandler -= value; + + if (_keyboardTypeChangedEventHandler == null && _keyboardTypeChangedEventCallback != null) + { + KeyboardTypeChangedSignal().Disconnect(_keyboardTypeChangedEventCallback); + } + } + } + + private void OnKeyboardTypeChanged(KeyboardType type) + { + KeyboardTypeChangedEventArgs e = new KeyboardTypeChangedEventArgs(); + + e.KeyboardType = type; + + if (_keyboardTypeChangedEventHandler != null) + { + _keyboardTypeChangedEventHandler(this, e); + } + } + + internal KeyboardTypeSignalType KeyboardTypeChangedSignal() + { + KeyboardTypeSignalType ret = new KeyboardTypeSignalType(NDalicManualPINVOKE.ImfManager_KeyboardTypeChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The direction of text. + /// + public enum TextDirection + { + /// + /// Left to right. + /// + LeftToRight, + /// + /// Right to left. + /// + RightToLeft + } + + /// + /// Events that are generated by the IMF. + /// + public enum ImfEvent + { + /// + /// No event. + /// + Void, + /// + /// Pre-Edit changed. + /// + Preedit, + /// + /// Commit recieved. + /// + Commit, + /// + /// Event to delete a range of characters from the string. + /// + DeleteSurrounding, + /// + /// Event to query string and cursor position. + /// + GetSurrounding, + /// + /// Private command sent from the input panel. + /// + PrivateCommand + } + + /// + /// Enumeration for state of the input panel. + /// + public enum State + { + /// + /// Unknown state. + /// + Default = 0, + /// + /// Input panel is shown. + /// + Show, + /// + /// Input panel is hidden. + /// + Hide, + /// + /// Input panel in process of being shown. + /// + WillShow + } + + /// + /// Enumeration for the type of Keyboard. + /// + public enum KeyboardType + { + /// + /// Software keyboard (Virtual keyboard) is default. + /// + SoftwareKeyboard, + /// + /// Hardware keyboard. + /// + HardwareKeyboard + } + } +} diff --git a/src/Tizen.NUI/src/public/InputMethod.cs b/src/Tizen.NUI/src/public/InputMethod.cs new file mode 100755 index 0000000..c8aa42c --- /dev/null +++ b/src/Tizen.NUI/src/public/InputMethod.cs @@ -0,0 +1,380 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace Tizen.NUI +{ + + /// + /// A class encapsulating the input method map. + /// + public class InputMethod + { + private PanelLayoutType? _panelLayout = null; + private ActionButtonTitleType? _actionButton = null; + private AutoCapitalType? _autoCapital = null; + private int? _variation = null; + + /// + /// Default constructor. + /// + public InputMethod() + { + } + + /// + /// Get or set panel layout. + /// + public PanelLayoutType PanelLayout + { + get + { + return _panelLayout ?? PanelLayoutType.Normal; + } + set + { + _panelLayout = value; + } + } + + /// + /// Get or set action button. + /// + public ActionButtonTitleType ActionButton + { + get + { + return _actionButton ?? ActionButtonTitleType.Default; + } + set + { + _actionButton = value; + } + } + + /// + /// Get or set auto capital. + /// + public AutoCapitalType AutoCapital + { + get + { + return _autoCapital ?? AutoCapitalType.None; + } + set + { + _autoCapital = value; + } + } + + /// + /// Get or set variation. + /// + public int Variation + { + get + { + return _variation ?? 0; + } + set + { + _variation = value; + } + } + + /// + /// Get or set variation for normal layout. + /// + public NormalLayoutType NormalVariation + { + get + { + return (NormalLayoutType) (_variation ?? 0); + } + set + { + _variation = (int)value; + } + } + + /// + /// Get or set variation for number only layout. + /// + public NumberOnlyLayoutType NumberOnlyVariation + { + get + { + return (NumberOnlyLayoutType) (_variation ?? 0); + } + set + { + _variation = (int)value; + } + } + + /// + /// Get or set variation for password layout. + /// + public PasswordLayoutType PasswordVariation + { + get + { + return (PasswordLayoutType) (_variation ?? 0); + } + set + { + _variation = (int)value; + } + } + + private PropertyMap ComposingInputMethodMap() + { + PropertyMap _outputMap = new PropertyMap(); + if (_panelLayout != null) { _outputMap.Add("PANEL_LAYOUT", new PropertyValue((int)_panelLayout)); } + if (_actionButton != null) { _outputMap.Add("ACTION_BUTTON", new PropertyValue((int)_actionButton)); } + if (_autoCapital != null) { _outputMap.Add("AUTO_CAPITALISE", new PropertyValue((int)_autoCapital)); } + if (_variation != null) { _outputMap.Add("VARIATION", new PropertyValue((int)_variation)); } + return _outputMap; + } + + /// + /// Get the input method map. + /// + public PropertyMap OutputMap + { + get + { + return ComposingInputMethodMap(); + } + } + + /// + /// SetType that can be changed in the system Input Method. + /// + public enum CategoryType + { + /// + /// Set Keyboard layout. + /// + PanelLayout, + /// + /// Set Action button title. + /// + ActionButtonTitle, + /// + /// Set Auto capitalise of input. + /// + AutoCapitalise, + /// + /// Set variation. + /// + Variation + } + + /// + /// Autocapitalization Types. + /// + public enum AutoCapitalType + { + /// + /// No auto-capitalization when typing. + /// + None, + /// + /// Autocapitalize each word typed. + /// + Word, + /// + /// Autocapitalize the start of each sentence. + /// + Sentence, + /// + /// Autocapitalize all letters. + /// + Allcharacter + } + + /// + /// Input panel (virtual keyboard) layout types.. + /// + public enum PanelLayoutType + { + /// + /// Default layout. + /// + Normal, + /// + /// Number layout. + /// + Number, + /// + /// Email layout. + /// + Email, + /// + /// URL layout. + /// + URL, + /// + /// Phone number layout. + /// + PhoneNumber, + /// + /// IP layout. + /// + IP, + /// + /// Month layout. + /// + Month, + /// + /// Number layout. + /// + NumberOnly, + /// + /// Hexadecimal layout. + /// + HEX, + /// + /// Command-line terminal layout including ESC, Alt, Ctrl key, so on (no auto-correct, no auto-capitalization). + /// + Terminal, + /// + /// Like normal, but no auto-correct, no auto-capitalization etc. + /// + Password, + /// + /// Date and time layout. + /// + Datetime, + /// + /// Emoticon layout. + /// + Emoticon + } + + /// + /// Specifies what the Input Method "action" button functionality is set to. + /// + public enum ActionButtonTitleType + { + /// + /// Default action. + /// + Default, + /// + /// Done. + /// + Done, + /// + /// Go action. + /// + Go, + /// + /// Join action. + /// + Join, + /// + /// Login action. + /// + Login, + /// + /// Next action. + /// + Next, + /// + /// Previous action. + /// + Previous, + /// + /// Search action. + /// + Search, + /// + /// Send action. + /// + Send, + /// + /// Sign in action. + /// + SignIn, + /// + /// Unspecified action. + /// + Unspecified, + /// + /// Nothing to do. + /// + None + } + + /// + /// Available variation for Normal layout. + /// + public enum NormalLayoutType + { + /// + /// The plain normal layout. + /// + Normal, + /// + /// Filename layout. sysbols such as '/' should be disabled. + /// + WithFilename, + /// + /// The name of a person. + /// + WithPersonName + } + + /// + /// Available variation for Number only layout. + /// + public enum NumberOnlyLayoutType + { + /// + /// The plain normal number layout. + /// + Normal, + /// + /// The number layout to allow a positive or negative sign at the start. + /// + WithSigned, + /// + /// The number layout to allow decimal point to provide fractional value. + /// + WithDecimal, + /// + /// The number layout to allow decimal point and negative sign. + /// + WithSignedAndDecimal + } + + /// + /// Available variation for Password layout. + /// + public enum PasswordLayoutType + { + /// + /// The normal password layout. + /// + Normal, + /// + /// The password layout to allow only number. + /// + WithNumberOnly + } + + } +} diff --git a/src/Tizen.NUI/src/public/Key.cs b/src/Tizen.NUI/src/public/Key.cs new file mode 100755 index 0000000..e17632e --- /dev/null +++ b/src/Tizen.NUI/src/public/Key.cs @@ -0,0 +1,372 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// The key structure is used to store a key press. + /// + public class Key : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Key(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Key obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Key() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Key(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + internal static Key GetKeyFromPtr(global::System.IntPtr cPtr) + { + Key ret = new Key(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string DeviceName + { + get + { + string ret = NDalicPINVOKE.GetDeviceName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Name given to the key pressed + /// + public string KeyPressedName + { + get + { + return keyPressedName; + } + set + { + keyPressedName = value; + } + } + + /* duplicated with KeyPressedName : removed + public string KeyPressed + { + get + { + return keyPressed; + } + } + */ + + /// + /// Keycode for the key pressed. + /// + public int KeyCode + { + get + { + return keyCode; + } + set + { + keyCode = value; + } + } + + /// + /// Special keys like shift, alt and control which modify the next key pressed. + /// + public int KeyModifier + { + get + { + return keyModifier; + } + set + { + keyModifier = value; + } + } + + /// + /// The time (in ms) that the key event occurred. + /// + public uint Time + { + get + { + return time; + } + set + { + time = value; + } + } + + /// + /// State of the key event. + /// + public Key.StateType State + { + get + { + return state; + } + set + { + state = value; + } + } + + public DeviceClassType DeviceClass + { + get + { + int ret = NDalicPINVOKE.GetDeviceClass(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (DeviceClassType)ret; + } + } + + + /// + /// Default Constructor. + /// + public Key() : this(NDalicPINVOKE.new_Key__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// The name of the key pressed or command from the IMF, if later then the some following parameters will be needed + /// A string of input characters or key pressed + /// The unique key code for the key pressed + /// The key modifier for special keys like shift and alt + /// The time (in ms) that the key event occurred + /// The state of the key event + internal Key(string keyName, string keyString, int keyCode, int keyModifier, uint timeStamp, Key.StateType keyState) : this(NDalicPINVOKE.new_Key__SWIG_1(keyName, keyString, keyCode, keyModifier, timeStamp, (int)keyState), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Checks to see if Shift key modifier has been supplied. + /// + /// True if shift modifier + public bool IsShiftModifier() + { + bool ret = NDalicPINVOKE.Key_IsShiftModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Checks to see if Ctrl (control) key modifier has been supplied. + /// + /// True if ctrl modifier + public bool IsCtrlModifier() + { + bool ret = NDalicPINVOKE.Key_IsCtrlModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Checks to see if Alt key modifier has been supplied. + /// + /// True if alt modifier + public bool IsAltModifier() + { + bool ret = NDalicPINVOKE.Key_IsAltModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private string keyPressedName + { + set + { + NDalicPINVOKE.Key_keyPressedName_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.Key_keyPressedName_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private string keyPressed + { + set + { + NDalicPINVOKE.Key_keyPressed_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.Key_keyPressed_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int keyCode + { + set + { + NDalicPINVOKE.Key_keyCode_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Key_keyCode_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int keyModifier + { + set + { + NDalicPINVOKE.Key_keyModifier_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Key_keyModifier_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint time + { + set + { + NDalicPINVOKE.Key_time_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Key_time_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Key.StateType state + { + set + { + NDalicPINVOKE.Key_state_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Key.StateType ret = (Key.StateType)NDalicPINVOKE.Key_state_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Enumeration for specifying the state of the key event. + /// + public enum StateType + { + Down, + Up, + Last + } + + } +} diff --git a/src/Tizen.NUI/src/public/KeyFrames.cs b/src/Tizen.NUI/src/public/KeyFrames.cs new file mode 100755 index 0000000..92abafb --- /dev/null +++ b/src/Tizen.NUI/src/public/KeyFrames.cs @@ -0,0 +1,149 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; + +namespace Tizen.NUI +{ + + /// + /// A set of key frames for a property that can be animated using Dali Animation.
+ /// This allows the generation of key frame objects from individual Property::Values.
+ ///
+ public class KeyFrames : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal KeyFrames(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.KeyFrames_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(KeyFrames obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_KeyFrames(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + /// + /// Adds a key frame. + /// + /// A progress value between 0.0 and 1.0 + /// A value + public void Add(float progress, object value) + { + PropertyValue val = PropertyValue.CreateFromObject(value); + Add(progress, val); + } + + /// + /// Adds a key frame. + /// + /// A progress value between 0.0 and 1.0 + /// A value + /// The alpha function used to blend to the next keyframe + public void Add(float progress, object value, AlphaFunction alpha) + { + PropertyValue val = PropertyValue.CreateFromObject(value); + Add(progress, val, alpha); + } + + /// + /// Creates an initialized KeyFrames handle. + /// + public KeyFrames() : this(NDalicPINVOKE.KeyFrames_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + [Obsolete("Please do not use! this will be deprecated")] + public static KeyFrames DownCast(BaseHandle handle) + { + KeyFrames ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as KeyFrames; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the type of the key frame. + /// + /// The key frame property type + public PropertyType GetType() + { + PropertyType ret = (PropertyType)NDalicPINVOKE.KeyFrames_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds a key frame. + /// + /// A progress value between 0.0 and 1.0 + /// A value + public void Add(float progress, PropertyValue value) + { + NDalicPINVOKE.KeyFrames_Add__SWIG_0(swigCPtr, progress, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Adds a key frame. + /// + /// A progress value between 0.0 and 1.0 + /// A value + /// The alpha function used to blend to the next keyframe + public void Add(float progress, PropertyValue value, AlphaFunction alpha) + { + NDalicPINVOKE.KeyFrames_Add__SWIG_1(swigCPtr, progress, PropertyValue.getCPtr(value), AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Layer.cs b/src/Tizen.NUI/src/public/Layer.cs new file mode 100755 index 0000000..17179f8 --- /dev/null +++ b/src/Tizen.NUI/src/public/Layer.cs @@ -0,0 +1,463 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using System; + using Tizen.NUI.BaseComponents; + + /// + /// Layers provide a mechanism for overlaying groups of actors on top of each other. + /// + public class Layer : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Layer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Layer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Layer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Layer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal class Property + { + internal static readonly int BEHAVIOR = NDalicPINVOKE.Layer_Property_BEHAVIOR_get(); + } + + /// + /// Creates a Layer object. + /// + public Layer() : this(NDalicPINVOKE.Layer_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if(Window.Instance != null) + { + this.SetAnchorPoint(Tizen.NUI.PivotPoint.TopLeft); + this.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.AllDimensions); + } + } + internal void SetAnchorPoint(Vector3 anchorPoint) + { + NDalicPINVOKE.Actor_SetAnchorPoint(swigCPtr, Vector3.getCPtr(anchorPoint)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + internal void SetResizePolicy(ResizePolicyType policy, DimensionType dimension) + { + NDalicPINVOKE.Actor_SetResizePolicy(swigCPtr, (int)policy, (int)dimension); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + + [Obsolete("Please do not use! this will be deprecated")] + public new static Layer DownCast(BaseHandle handle) + { + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Layer; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Search through this layer's hierarchy for an view with the given unique ID. + /// + ///
This layer(the parent) has been initialized.
+ /// The actor itself is also considered in the search. + /// The id of the child to find + /// A handle to the view if found, or an empty handle if not. + public View FindChildById(uint id) + { + IntPtr cPtr = NDalicPINVOKE.Actor_FindChildById(swigCPtr, id); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds a child view to this layer. + /// + ///
This layer(the parent) has been initialized. The child view has been initialized. The child view is not the same as the parent layer.
+ /// The child will be referenced by its parent. This means that the child will be kept alive, even if the handle passed into this method is reset or destroyed. + /// If the child already has a parent, it will be removed from old parent and reparented to this layer. This may change child's position, color, scale etc as it now inherits them from this layer. + /// The child + public void Add(View child) + { + NDalicPINVOKE.Actor_Add(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Removes a child View from this layer. If the view was not a child of this layer, this is a no-op. + /// + ///
This layer(the parent) has been initialized. The child view is not the same as the parent view.
+ /// The child + public void Remove(View child) + { + NDalicPINVOKE.Actor_Remove(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Queries the depth of the layer.
+ /// 0 is the bottom most layer, higher number is on top.
+ ///
+ public uint Depth + { + get + { + return GetDepth(); + } + } + + internal uint GetDepth() + { + uint ret = NDalicPINVOKE.Layer_GetDepth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Increments the depth of the layer. + /// + public void Raise() + { + NDalicPINVOKE.Layer_Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Decrements the depth of the layer. + /// + public void Lower() + { + NDalicPINVOKE.Layer_Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RaiseAbove(Layer target) + { + NDalicPINVOKE.Layer_RaiseAbove(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void LowerBelow(Layer target) + { + NDalicPINVOKE.Layer_LowerBelow(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Raises the layer to the top. + /// + public void RaiseToTop() + { + NDalicPINVOKE.Layer_RaiseToTop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Lowers the layer to the bottom. + /// + public void LowerToBottom() + { + NDalicPINVOKE.Layer_LowerToBottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Moves the layer directly above the given layer.
+ /// After the call, this layers depth will be immediately above target.
+ ///
+ /// Layer to get on top of + public void MoveAbove(Layer target) + { + NDalicPINVOKE.Layer_MoveAbove(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Moves the layer directly below the given layer.
+ /// After the call, this layers depth will be immediately below target.
+ ///
+ /// Layer to get below of + public void MoveBelow(Layer target) + { + NDalicPINVOKE.Layer_MoveBelow(swigCPtr, Layer.getCPtr(target)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private void SetBehavior(LayerBehavior behavior) + { + NDalicPINVOKE.Layer_SetBehavior(swigCPtr, (int)behavior); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private LayerBehavior GetBehavior() + { + Layer.LayerBehavior ret = (Layer.LayerBehavior)NDalicPINVOKE.Layer_GetBehavior(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetSortFunction(SWIGTYPE_p_f_r_q_const__Dali__Vector3__float function) + { + NDalicPINVOKE.Layer_SetSortFunction(swigCPtr, SWIGTYPE_p_f_r_q_const__Dali__Vector3__float.getCPtr(function)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetTouchConsumed(bool consume) + { + NDalicPINVOKE.Layer_SetTouchConsumed(swigCPtr, consume); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsTouchConsumed() + { + bool ret = NDalicPINVOKE.Layer_IsTouchConsumed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetHoverConsumed(bool consume) + { + NDalicPINVOKE.Layer_SetHoverConsumed(swigCPtr, consume); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal bool IsHoverConsumed() + { + bool ret = NDalicPINVOKE.Layer_IsHoverConsumed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves child view by index. + /// + ///
The View has been initialized.
+ /// The index of the child to retrieve + /// The view for the given index or empty handle if children not initialized + public View GetChildAt(uint index) + { + System.IntPtr cPtr = NDalicPINVOKE.Actor_GetChildAt(swigCPtr, index); + + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return ret ?? null; + } + + /// + /// Enumeration for the behavior of the layer. + /// + public enum LayerBehavior + { + Layer2D, + LayerUI = Layer2D, + Layer3D + } + + internal enum TreeDepthMultiplier + { + TREE_DEPTH_MULTIPLIER = 10000 + } + + /// + /// Layer Behavior, type String(Layer.LayerBehavior) + /// + public Layer.LayerBehavior Behavior + { + get + { + return GetBehavior(); + } + set + { + SetBehavior(value); + } + } + + /// + /// Internal only property to Enable/Disable Clipping, type Boolean. + /// By default this is false, i.e. the viewport of the Layer is the entire window. + /// + internal bool ClippingEnabled + { + get + { + bool ret = NDalicPINVOKE.Layer_IsClipping(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + set + { + NDalicPINVOKE.Layer_SetClipping(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Sets the Viewport (in window coordinates), type Rectangle. + /// The contents of the layer will not be visible outside this box, when ViewportEnabled is true. + /// + public Rectangle Viewport + { + get + { + if( ClippingEnabled ) + { + Rectangle ret = new Rectangle(NDalicPINVOKE.Layer_GetClippingBox(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + else + { + // Clipping not enabled so return the window size + Size2D windowSize = Window.Instance.Size; + Rectangle ret = new Rectangle(0, 0, windowSize.Width, windowSize.Height); + return ret; + } + } + set + { + NDalicPINVOKE.Layer_SetClippingBox__SWIG_1(swigCPtr, Rectangle.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + ClippingEnabled = true; + } + } + + /// + /// Retrieves and sets the Layer's opacity.
+ ///
+ public float Opacity + { + get + { + float temp = 0.0f; + GetProperty(View.Property.OPACITY).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.OPACITY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Retrieves and sets the Layer's visibility. + /// + public bool Visibility + { + get + { + bool temp = false; + GetProperty(View.Property.VISIBLE).Get(out temp); + return temp; + } + set + { + SetProperty(View.Property.VISIBLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Get the number of children held by the layer. + /// + public uint ChildCount + { + get + { + uint ret = NDalicPINVOKE.Actor_GetChildCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Gets/Sets the Layer's name. + /// + public string Name + { + get + { + return GetName(); + } + set + { + SetName(value); + } + } + + internal string GetName() + { + string ret = NDalicPINVOKE.Actor_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetName(string name) + { + NDalicPINVOKE.Actor_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/public/LongPressGesture.cs b/src/Tizen.NUI/src/public/LongPressGesture.cs new file mode 100755 index 0000000..4eecc92 --- /dev/null +++ b/src/Tizen.NUI/src/public/LongPressGesture.cs @@ -0,0 +1,172 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A LongPressGesture is emitted when the user holds the screen with the stated number of fingers.
+ /// Long press gesture finishes when all touches have been released.
+ ///
+ public class LongPressGesture : Gesture + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal LongPressGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.LongPressGesture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(LongPressGesture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_LongPressGesture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal static LongPressGesture GetLongPressGestureFromPtr(global::System.IntPtr cPtr) + { + LongPressGesture ret = new LongPressGesture(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The number of touch points in this long press gesture, i.e. the number of fingers the user had + /// on the screen to generate the long press gesture.
+ ///
+ public uint NumberOfTouches + { + get + { + return numberOfTouches; + } + } + + /// + /// This is the point, in screen coordinates, where the long press occurred.
+ /// If a multi-touch long press, then this is the centroid of all the touch points.
+ ///
+ public Vector2 ScreenPoint + { + get + { + return screenPoint; + } + } + + /// + /// This is the point, in local actor coordinates, where the long press occurred.
+ /// If a multi-touch long press, then this is the centroid of all the touch points.
+ ///
+ public Vector2 LocalPoint + { + get + { + return localPoint; + } + } + + /// + /// Constructor. + /// + /// The state of the gesture + public LongPressGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_LongPressGesture__SWIG_0((int)state), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + private uint numberOfTouches + { + set + { + NDalicPINVOKE.LongPressGesture_numberOfTouches_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.LongPressGesture_numberOfTouches_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenPoint + { + set + { + NDalicPINVOKE.LongPressGesture_screenPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.LongPressGesture_screenPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 localPoint + { + set + { + NDalicPINVOKE.LongPressGesture_localPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.LongPressGesture_localPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/NUIApplication.cs b/src/Tizen.NUI/src/public/NUIApplication.cs new file mode 100755 index 0000000..32f9950 --- /dev/null +++ b/src/Tizen.NUI/src/public/NUIApplication.cs @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using Tizen.Applications; +using Tizen.Applications.CoreBackend; +using Tizen.NUI; + +namespace Tizen.NUI +{ + + /// + /// Represents an application that have UI screen. The NUIApplication class has a default stage. + /// + public class NUIApplication : CoreApplication + { + /// + /// Occurs whenever the application is resumed. + /// + public event EventHandler Resumed; + + /// + /// Occurs whenever the application is paused. + /// + public event EventHandler Paused; + + /// + /// The instance of ResourceManager. + /// + private static System.Resources.ResourceManager resourceManager = null; + + /// + /// The default constructor. + /// + public NUIApplication() : base(new NUICoreBackend()) + { + } + + /// + /// The constructor with stylesheet. + /// + public NUIApplication(string stylesheet) : base(new NUICoreBackend(stylesheet)) + { + } + + /// + /// The constructor with stylesheet and window mode. + /// + public NUIApplication(string stylesheet, WindowMode windowMode) : base(new NUICoreBackend(stylesheet,windowMode)) + { + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLocaleChanged(LocaleChangedEventArgs e) + { + Log.Debug("NUI", "OnLocaleChanged() is called!"); + base.OnLocaleChanged(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLowBattery(LowBatteryEventArgs e) + { + Log.Debug("NUI", "OnLowBattery() is called!"); + base.OnLowBattery(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnLowMemory(LowMemoryEventArgs e) + { + Log.Debug("NUI", "OnLowMemory() is called!"); + base.OnLowMemory(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnRegionFormatChanged(RegionFormatChangedEventArgs e) + { + Log.Debug("NUI", "OnRegionFormatChanged() is called!"); + base.OnRegionFormatChanged(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnTerminate() + { + Log.Debug("NUI", "OnTerminate() is called!"); + base.OnTerminate(); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected virtual void OnPause() + { + Log.Debug("NUI", "OnPause() is called!"); + Paused?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected virtual void OnResume() + { + Log.Debug("NUI", "OnResume() is called!"); + Resumed?.Invoke(this, EventArgs.Empty); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected virtual void OnPreCreate() + { + Log.Debug("NUI", "OnPreCreate() is called!"); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnAppControlReceived(AppControlReceivedEventArgs e) + { + Log.Debug("NUI", "OnAppControlReceived() is called!"); + if (e != null) + { + Log.Debug("NUI", "OnAppControlReceived() is called! ApplicationId=" + e.ReceivedAppControl.ApplicationId); + Log.Debug("NUI", "CallerApplicationId=" + e.ReceivedAppControl.CallerApplicationId + " IsReplyRequest=" + e.ReceivedAppControl.IsReplyRequest); + } + base.OnAppControlReceived(e); + } + + /// + /// Overrides this method if want to handle behavior. + /// + protected override void OnCreate() + { + // This is also required to create DisposeQueue on main thread. + DisposeQueue disposeQ = DisposeQueue.Instance; + disposeQ.Initialize(); + Log.Debug("NUI","OnCreate() is called!"); + base.OnCreate(); + } + + /// + /// Run NUIApplication. + /// + /// Arguments from commandline. + public override void Run(string[] args) + { + Backend.AddEventHandler(EventType.PreCreated, OnPreCreate); + Backend.AddEventHandler(EventType.Resumed, OnResume); + Backend.AddEventHandler(EventType.Paused, OnPause); + base.Run(args); + } + + /// + /// Exit NUIApplication. + /// + public override void Exit() + { + base.Exit(); + } + + /// + /// Enumeration for deciding whether a NUI application window is opaque or transparent. + /// + public enum WindowMode + { + Opaque = 0, + Transparent = 1 + } + + + internal Application ApplicationHandle + { + get + { + return ((NUICoreBackend)this.Backend).ApplicationHandle; + } + } + + /// + /// ResourceManager to handle multilingual + /// + public static System.Resources.ResourceManager MultilingualResourceManager + { + get + { + return resourceManager; + } + set + { + resourceManager = value; + } + } + + /// + /// Get the window instance. + /// + [Obsolete("Please do not use! this will be deprecated")] + public Window Window + { + get + { + return Window.Instance; + } + } + } +} diff --git a/src/Tizen.NUI/src/public/NUIConstants.cs b/src/Tizen.NUI/src/public/NUIConstants.cs new file mode 100755 index 0000000..704ea52 --- /dev/null +++ b/src/Tizen.NUI/src/public/NUIConstants.cs @@ -0,0 +1,1552 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +using System; +using System.ComponentModel; + +namespace Tizen.NUI +{ + public enum ScrollModeType + { + XAxisScrollEnabled, + XAxisSnapToInterval, + XAxisScrollBoundary, + YAxisScrollEnabled, + YAxisSnapToInterval, + YAxisScrollBoundary + } + + /// + /// This specifies whether the Actor uses its own color, or inherits. + /// + public enum ColorMode + { + /// + /// Actor will use its own color. + /// + UseOwnColor, + /// + /// Actor will use its parent color. + /// + UseParentColor, + /// + /// Actor will blend its color with its parents color. + /// + UseOwnMultiplyParentColor, + /// + /// Actor will blend its alpha with its parents alpha. This means when parent fades in or out child does as well. This is the default. + /// + UseOwnMultiplyParentAlpha + } + + /// + /// This specifies the dimesion of width or heigh for size negotiation. + /// + public enum DimensionType + { + /// + /// Width dimension + /// + Width = 0x1, + /// + /// Height dimension + /// + Height = 0x2, + /// + /// Mask to cover all flags + /// + AllDimensions = 0x3 + } + + /// + /// Enumeration for the instance of how the actor and it's children will be drawn. + /// + public enum DrawModeType + { + /// + /// The default draw-mode + /// + Normal = 0, + /// + /// Draw the actor and its children as an overlay + /// + Overlay2D = 1, + /// + /// Will be replaced by separate ClippingMode enum. Draw the actor and its children into the stencil buffer + /// + Stencil = 3 + } + + /// + /// Enumeration for size negotiation resize policies. + /// + public enum ResizePolicyType + { + /// + /// Size is fixed as set by SetSize + /// + Fixed, + /// + /// Size is to use the actor's natural size + /// + /// + UseNaturalSize, + /// + /// Size is to fill up to the actor's parent's bounds. Aspect ratio is not maintained. + /// + FillToParent, + /// + /// The actors size will be ( ParentSize * SizeRelativeToParentFactor ). + /// + SizeRelativeToParent, + /// + /// The actors size will be ( ParentSize + SizeRelativeToParentFactor ). + /// + SizeFixedOffsetFromParent, + /// + /// Size will adjust to wrap around all children + /// + FitToChildren, + /// + /// One dimension is dependent on the other + /// + DimensionDependency, + /// + /// The size will be assigned to the actor + /// + UseAssignedSize + } + + /// + /// Enumeration for policies to determine how an actor should resize itself when having its size set in size negotiation. + /// + public enum SizeScalePolicyType + { + /// + /// Use the size that was set + /// + UseSizeSet, + /// + /// Fit within the size set maintaining natural size aspect ratio + /// + FitWithAspectRatio, + /// + /// Fit within the size set maintaining natural size aspect ratio + /// + FillWithAspectRatio + } + + /// + /// Enumeration for ClippingMode describing how this Actor's children will be clipped against it. + /// + public enum ClippingModeType + { + /// + /// This Actor will not clip its children. + /// + Disabled, + /// + /// This Actor will clip all children to within its boundaries (the actor will also be visible itself). + /// + ClipChildren + } + + /// + /// Enumeration for type determination of how camera operates. + /// + public enum CameraType + { + /// + /// Camera orientation is taken from CameraActor. + /// + FreeLook, + /// + /// Camera is oriented to always look at a target. + /// + LookAtTarget + } + + /// + /// Enumeration for projection modes. + /// + public enum ProjectionMode + { + /// + /// Distance causes foreshortening; objects further from the camera appear smaller. + /// + PerspectiveProjection, + /// + /// Relative distance from the camera does not affect the size of objects. + /// + OrthographicProjection + } + + /// + /// This specifies ccustomView behaviour types. + /// + public enum CustomViewBehaviour + { + /// + /// Use to provide default behaviour (size negotiation is on, event callbacks are not called) + /// + ViewBehaviourDefault = 0, + /// + /// True if control does not need size negotiation, i.e. it can be skipped in the algorithm + /// + DisableSizeNegotiation = 1 << 0, + /// + /// Use to provide key navigation support. + /// + RequiresKeyboardNavigationSupport = 1 << 5, + /// + /// Use to make style change event disabled. + /// + DisableStyleChangeSignals = 1 << 6, + [EditorBrowsable(EditorBrowsableState.Never)] + LastViewBehaviourFlag + } + + public enum DeviceClassType + { + None, + Seat, + Keyboard, + Mouse, + Touch, + Pen, + Pointer, + Gamepad + } + + /// + /// This specifies all the property types.
+ /// Enumeration for the property types supported. + ///
+ public enum PropertyType + { + /// + /// No type + /// + None, + /// + /// A boolean type + /// + Boolean, + /// + /// A float type + /// + Float, + /// + /// An integer type + /// + Integer, + /// + /// a vector array of size=2 with float precision + /// + Vector2, + /// + /// a vector array of size=3 with float precision + /// + Vector3, + /// + /// a vector array of size=4 with float precision + /// + Vector4, + /// + /// a 3x3 matrix + /// + Matrix3, + /// + /// a 4x4 matrix + /// + Matrix, + /// + /// an integer array of size=4 + /// + Rectangle, + /// + /// either a quaternion or an axis angle rotation + /// + Rotation, + /// + /// A string type + /// + String, + /// + /// an array of PropertyValue + /// + Array, + /// + /// a string key to PropertyValue mapping + /// + Map + } + + /// + /// This specifies the property access mode types.
+ /// Enumeration for the access mode for custom properties. + ///
+ public enum PropertyAccessMode + { + /// + /// if the property is read-only + /// + ReadOnly, + /// + /// If the property is read/writeable + /// + ReadWrite, + /// + /// If the property can be animated or constrained + /// + Animatable, + /// + /// The number of access modes + /// + AccessModeCount + } + + /// + /// Types of style change. Enumeration for StyleChange type. + /// + public enum StyleChangeType + { + /// + /// Denotes that the default font has changed. + /// + DefaultFontChange, + /// + /// Denotes that the default font size has changed. + /// + DefaultFontSizeChange, + /// + /// Denotes that the theme has changed. + /// + ThemeChange + } + + /// + /// Enumeration for horizontal alignment types. + /// + public enum HorizontalAlignmentType + { + /// + /// Align horizontally left + /// + Left, + /// + /// Align horizontally center + /// + Center, + /// + /// Align horizontally right + /// + Right + } + + /// + /// Enumeration for vertical alignment types. + /// + public enum VerticalAlignmentType + { + /// + /// Align vertically top + /// + Top, + /// + /// Align vertically center + /// + Center, + /// + /// Align vertically bottom + /// + Bottom + } + + /// + /// Enumeration for point state type. + /// + public enum PointStateType + { + /// + /// Touch or hover started + /// + Started, + /// + /// Touch or hover finished + /// + Finished, + /// + /// Screen touched + /// + Down = Started, + /// + /// Touch stopped + /// + Up = Finished, + /// + /// Finger dragged or hovered + /// + Motion, + /// + /// Leave the boundary of an actor + /// + Leave, + /// + /// No change from last event.
+ /// Useful when a multi-point event occurs where all points are sent but indicates that this particular point has not changed since the last time. + ///
+ Stationary, + /// + /// A system event has occurred which has interrupted the touch or hover event sequence. + /// + Interrupted + } + + /// + /// Enumeration for the text horizontal aligning. + /// + public enum HorizontalAlignment + { + /// + /// Texts place at the begin of horizontal direction. + /// + Begin, + /// + /// Texts place at the center of horizontal direction. + /// + Center, + /// + /// Texts place at the end of horizontal direction. + /// + End + } + + /// + /// Enumeration for the text horizontal aligning. + /// + public enum VerticalAlignment + { + /// + /// Texts place at the top of vertical direction. + /// + Top, + /// + /// Texts place at the center of vertical direction. + /// + Center, + /// + /// Texts place at the bottom of vertical direction. + /// + Bottom + } + + /// + /// This specifies wrap mode types
+ /// WrapModeU and WrapModeV separately decide how the texture should be sampled when the u and v coordinate exceeds the range of 0.0 to 1.0. + ///
+ public enum WrapModeType + { + /// + /// Defualt value + /// + Default = 0, + /// + /// Clamp to edge + /// + ClampToEdge, + /// + /// Repeat + /// + Repeat, + /// + /// Mirrored repeat + /// + MirroredRepeat + } + + /// + /// The type of coordinate system for certain attributes of the points in a gradient. + /// + public enum GradientVisualUnitsType + { + /// + /// Uses the normals for the start, end & center points, i.e. top-left is (-0.5, -0.5) and bottom-right is (0.5, 0.5). + /// + ObjectBoundingBox, + /// + /// Uses the user coordinates for the start, end & center points, i.e. in a 200 by 200 control, top-left is (0, 0) and bottom-right is (200, 200). + /// + UserSpace + } + + /// + /// This specifies SpreadMethod types.
+ /// SpreadMethod defines what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ ///
+ public enum GradientVisualSpreadMethodType + { + /// + /// Uses the terminal colors of the gradient to fill the remainder of the quad. + /// + Pad, + /// + /// Reflect the gradient pattern start-to-end, end-to-start, start-to-end etc. until the quad is filled. + /// + Reflect, + /// + /// Repeat the gradient pattern start-to-end, start-to-end, start-to-end etc. until the quad is filled. + /// + Repeat + } + + /// + /// The shading mode used by MeshVisual. + /// + public enum MeshVisualShadingModeValue + { + /// + /// *Simplest*. One color that is lit by ambient and diffuse lighting. + /// + TexturelessWithDiffuseLighting, + /// + /// Uses only the visual image textures provided with specular lighting in addition to ambient and diffuse lighting. + /// + TexturedWithSpecularLighting, + /// + /// Uses all textures provided including a gloss, normal and texture map along with specular, ambient and diffuse lighting. + /// + TexturedWithDetailedSpecularLighting + } + + /// + /// The primitive shape to render as a PrimitiveVisual. + /// + public enum PrimitiveVisualShapeType + { + /// + /// A perfectly round geometrical object in three-dimensional space. + /// + Sphere, + /// + /// The area bound between two circles, i.e. a cone with the tip removed. + /// + ConicalFrustrum, + /// + /// Equivalent to a conical frustrum with top radius of zero. + /// Equivalent to a conical frustrum with top radius of zero. + Cone, + /// + /// Equivalent to a conical frustrum with top radius of zero. + /// + Cylinder, + /// + /// Equivalent to a conical frustrum with equal radii for the top and bottom circles. + /// + Cube, + /// + /// Equivalent to a bevelled cube with a bevel percentage of zero. + /// + Octahedron, + /// + /// Equivalent to a bevelled cube with a bevel percentage of one. + /// + BevelledCube + } + + /// + /// This specifies fitting mode types. Fitting options, used when resizing images to fit desired dimensions.
+ /// A fitting mode controls the region of a loaded image to be mapped to the desired image rectangle.
+ /// All fitting modes preserve the aspect ratio of the image contents.
+ ///
+ public enum FittingModeType + { + /// + /// Full-screen image display: Limit loaded image resolution to device resolution using ShrinkToFit mode. + /// + ShrinkToFit, + /// + /// Thumbnail gallery grid: Limit loaded image resolution to screen tile using ScaleToFill mode. + /// + ScaleToFill, + /// + /// Image columns: Limit loaded image resolution to column width using FitWidth mode. + /// + FitWidth, + /// + /// Image rows: Limit loaded image resolution to row height using FitHeight mode. + /// + FitHeight + } + + /// + /// This specifies sampling mode types. Filtering options, used when resizing images to sample original pixels.
+ /// A SamplingMode controls how pixels in an input image are sampled and combined to generate each pixel of a destination image during a scaling.
+ /// NoFilter and Box modes do not guarantee that the output pixel array exactly matches the rectangle specified by the desired dimensions and FittingMode,
+ /// but all other filter modes do if the desired dimensions are `<=` the raw dimensions of the input image file.
+ ///
+ public enum SamplingModeType + { + /// + /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8, etc width and height and approximately the desired size.
+ /// This is the default. + ///
+ Box, + /// + /// For each output pixel, read one input pixel. + /// + Nearest, + /// + /// For each output pixel, read a quad of four input pixels and write a weighted average of them. + /// + Linear, + /// + /// Iteratively box filter to generate an image of 1/2, 1/4, 1/8 etc width and height and approximately the desired size,
+ /// then for each output pixel, read one pixel from the last level of box filtering.
+ ///
+ BoxThenNearest, + /// + /// Iteratively box filter to almost the right size, then for each output pixel, read four pixels from the last level of box filtering and write their weighted average. + /// + BoxThenLinear, + /// + /// No filtering is performed. If the SCALE_TO_FILL scaling mode is enabled, the borders of the image may be trimmed to match the aspect ratio of the desired dimensions. + /// + NoFilter, + /// + /// For caching algorithms where a client strongly prefers a cache-hit to reuse a cached image. + /// + DontCare + } + + /// + /// This specifies policy types that could be used by the transform for the offset or size. + /// + public enum VisualTransformPolicyType + { + /// + /// Relative to the control (percentage [0.0f to 1.0f] of the control). + /// + Relative = 0, + /// + /// Absolute value in world units. + /// + Absolute = 1 + } + + /// + /// This specifies all the transform property types. + /// + public enum VisualTransformPropertyType + { + /// + /// Offset of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units). + /// + Offset, + /// + /// Size of the visual, which can be either relative (percentage [0.0f to 1.0f] of the parent) or absolute (in world units). + /// + Size, + /// + /// The origin of the visual within its control area. + /// + Origin, + /// + /// The anchor-point of the visual + /// + AnchorPoint, + /// + /// Whether the x or y OFFSET values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units). + /// + OffsetPolicy, + /// + /// Whether the width or height SIZE values are relative (percentage [0.0f to 1.0f] of the control) or absolute (in world units). + /// + SizePolicy + } + + /// + /// This specifies visual types. + /// + public struct Visual + { + /// + /// The index for the visual type. + /// + public enum Type + { + /// + /// Renders a solid color as an internal border to the control's quad. + /// + Border, + /// + /// Renders a solid color to the control's quad. + /// + Color, + /// + /// Renders a smooth transition of colors to the control's quad. + /// + Gradient, + /// + /// Renders an image into the control's quad. + /// + Image, + /// + /// Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. + /// + Mesh, + /// + /// Renders a simple 3D shape, such as a cube or sphere. + /// + Primitive, + /// + /// Renders a simple wire-frame outlining a quad. + /// + Wireframe, + /// + /// Renders text. + /// + Text, + /// + /// Renders an n-patch image. + /// + NPatch, + /// + /// Renders an SVG image. + /// + SVG, + /// + /// Renders a animated image. (Animated GIF) + /// + AnimatedImage + } + + /// + /// This specifies visual properties. + /// + public struct Property + { + public static readonly int Type = NDalic.VISUAL_PROPERTY_TYPE; + public static readonly int Shader = NDalic.VISUAL_PROPERTY_SHADER; + public static readonly int Transform = NDalic.VISUAL_PROPERTY_TRANSFORM; + public static readonly int PremultipliedAlpha = NDalic.VISUAL_PROPERTY_PREMULTIPLIED_ALPHA; + public static readonly int MixColor = NDalic.VISUAL_PROPERTY_MIX_COLOR; + public static readonly int Opacity = NDalic.VISUAL_PROPERTY_MIX_COLOR + 1; + } + + /// + /// This specifies shader properties. + /// + public struct ShaderProperty + { + public static readonly int VertexShader = NDalic.VISUAL_SHADER_VERTEX; + public static readonly int FragmentShader = NDalic.VISUAL_SHADER_FRAGMENT; + public static readonly int ShaderSubdivideGridX = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_X; + public static readonly int ShaderSubdivideGridY = NDalic.VISUAL_SHADER_SUBDIVIDE_GRID_Y; + public static readonly int ShaderHints = NDalic.VISUAL_SHADER_HINTS; + } + + /// + /// This specifies Visaul align types. + /// + public enum AlignType + { + TopBegin = 0, + TopCenter, + TopEnd, + CenterBegin, + Center, + CenterEnd, + BottomBegin, + BottomCenter, + BottomEnd + } + } + + /// + /// This specifies properties of BorderVisual. + /// + public struct BorderVisualProperty + { + public static readonly int Color = NDalic.BORDER_VISUAL_COLOR; + public static readonly int Size = NDalic.BORDER_VISUAL_SIZE; + public static readonly int AntiAliasing = NDalic.BORDER_VISUAL_ANTI_ALIASING; + } + + /// + /// This specifies properties of ColorVisual. + /// + public struct ColorVisualProperty + { + public static readonly int MixColor = NDalic.COLOR_VISUAL_MIX_COLOR; + } + + /// + /// This specifies properties of GradientVisual. + /// + public struct GradientVisualProperty + { + public static readonly int StartPosition = NDalic.GRADIENT_VISUAL_START_POSITION; + public static readonly int EndPosition = NDalic.GRADIENT_VISUAL_END_POSITION; + public static readonly int Center = NDalic.GRADIENT_VISUAL_CENTER; + public static readonly int Radius = NDalic.GRADIENT_VISUAL_RADIUS; + public static readonly int StopOffset = NDalic.GRADIENT_VISUAL_STOP_OFFSET; + public static readonly int StopColor = NDalic.GRADIENT_VISUAL_STOP_COLOR; + public static readonly int Units = NDalic.GRADIENT_VISUAL_UNITS; + public static readonly int SpreadMethod = NDalic.GRADIENT_VISUAL_SPREAD_METHOD; + } + + /// + /// This specifies properties of ImageVisual. + /// + public struct ImageVisualProperty + { + public static readonly int URL = NDalic.IMAGE_VISUAL_URL; + public static readonly int AlphaMaskURL = NDalic.IMAGE_VISUAL_ALPHA_MASK_URL; + public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE; + public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE; + public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH; + public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT; + public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING; + public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY; + public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA; + public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U; + public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V; + public static readonly int Border = NDalic.IMAGE_VISUAL_BORDER; + public static readonly int MaskContentScale = NDalic.IMAGE_VISUAL_MASK_CONTENT_SCALE; + public static readonly int CropToMask = NDalic.IMAGE_VISUAL_CROP_TO_MASK; + public static readonly int BatchSize = NDalic.IMAGE_VISUAL_BATCH_SIZE; + public static readonly int CacheSize = NDalic.IMAGE_VISUAL_CACHE_SIZE; + public static readonly int FrameDelay = NDalic.IMAGE_VISUAL_FRAME_DELAY; + + } + + /// + /// This specifies properties of MeshVisual. + /// + public struct MeshVisualProperty + { + public static readonly int ObjectURL = NDalic.MESH_VISUAL_OBJECT_URL; + public static readonly int MaterialtURL = NDalic.MESH_VISUAL_MATERIAL_URL; + public static readonly int TexturesPath = NDalic.MESH_VISUAL_TEXTURES_PATH; + public static readonly int ShadingMode = NDalic.MESH_VISUAL_SHADING_MODE; + public static readonly int UseMipmapping = NDalic.MESH_VISUAL_USE_MIPMAPPING; + public static readonly int UseSoftNormals = NDalic.MESH_VISUAL_USE_SOFT_NORMALS; + public static readonly int LightPosition = NDalic.MESH_VISUAL_LIGHT_POSITION; + } + + /// + /// This specifies properties of PrimitiveVisual. + /// + public struct PrimitiveVisualProperty + { + public static readonly int Shape = NDalic.PRIMITIVE_VISUAL_SHAPE; + public static readonly int MixColor = NDalic.PRIMITIVE_VISUAL_MIX_COLOR; + public static readonly int Slices = NDalic.PRIMITIVE_VISUAL_SLICES; + public static readonly int Stacks = NDalic.PRIMITIVE_VISUAL_STACKS; + public static readonly int ScaleTopRadius = NDalic.PRIMITIVE_VISUAL_SCALE_TOP_RADIUS; + public static readonly int ScaleBottomRadius = NDalic.PRIMITIVE_VISUAL_SCALE_BOTTOM_RADIUS; + public static readonly int ScaleHeight = NDalic.PRIMITIVE_VISUAL_SCALE_HEIGHT; + public static readonly int ScaleRadius = NDalic.PRIMITIVE_VISUAL_SCALE_RADIUS; + public static readonly int ScaleDimensions = NDalic.PRIMITIVE_VISUAL_SCALE_DIMENSIONS; + public static readonly int BevelPercentage = NDalic.PRIMITIVE_VISUAL_BEVEL_PERCENTAGE; + public static readonly int BevelSmoothness = NDalic.PRIMITIVE_VISUAL_BEVEL_SMOOTHNESS; + public static readonly int LightPosition = NDalic.PRIMITIVE_VISUAL_LIGHT_POSITION; + } + + /// + /// This specifies properties of TextVisual. + /// + public struct TextVisualProperty + { + public static readonly int Text = NDalic.TEXT_VISUAL_TEXT; + public static readonly int FontFamily = NDalic.TEXT_VISUAL_FONT_FAMILY; + public static readonly int FontStyle = NDalic.TEXT_VISUAL_FONT_STYLE; + public static readonly int PointSize = NDalic.TEXT_VISUAL_POINT_SIZE; + public static readonly int MultiLine = NDalic.TEXT_VISUAL_MULTI_LINE; + public static readonly int HorizontalAlignment = NDalic.TEXT_VISUAL_HORIZONTAL_ALIGNMENT; + public static readonly int VerticalAlignment = NDalic.TEXT_VISUAL_VERTICAL_ALIGNMENT; + public static readonly int TextColor = NDalic.TEXT_VISUAL_TEXT_COLOR; + public static readonly int EnableMarkup = NDalic.TEXT_VISUAL_ENABLE_MARKUP; + } + + /// + /// This specifies properties of NpatchImageVisual. + /// + public struct NpatchImageVisualProperty + { + public static readonly int URL = NDalic.IMAGE_VISUAL_URL; + public static readonly int FittingMode = NDalic.IMAGE_VISUAL_FITTING_MODE; + public static readonly int SamplingMode = NDalic.IMAGE_VISUAL_SAMPLING_MODE; + public static readonly int DesiredWidth = NDalic.IMAGE_VISUAL_DESIRED_WIDTH; + public static readonly int DesiredHeight = NDalic.IMAGE_VISUAL_DESIRED_HEIGHT; + public static readonly int SynchronousLoading = NDalic.IMAGE_VISUAL_SYNCHRONOUS_LOADING; + public static readonly int BorderOnly = NDalic.IMAGE_VISUAL_BORDER_ONLY; + public static readonly int PixelArea = NDalic.IMAGE_VISUAL_PIXEL_AREA; + public static readonly int WrapModeU = NDalic.IMAGE_VISUAL_WRAP_MODE_U; + public static readonly int WrapModeV = NDalic.IMAGE_VISUAL_WRAP_MODE_V; + public static readonly int Border = NDalic.IMAGE_VISUAL_WRAP_MODE_V + 1; + } + + /// + /// HiddenInput Property. + /// + public struct HiddenInputProperty + { + public static readonly int Mode = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_MODE_get(); + public static readonly int SubstituteCharacter = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SUBSTITUTE_CHARACTER_get(); + public static readonly int SubstituteCount = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SUBSTITUTE_COUNT_get(); + public static readonly int ShowDuration = NDalicManualPINVOKE.HIDDENINPUT_PROPERTY_SHOW_DURATION_get(); + } + + /// + /// The type for HiddenInput mode. + /// + public enum HiddenInputModeType + { + /// + /// Don't hide text. + /// + HideNone, + /// + /// Hide all the input text. + /// + HideAll, + /// + /// Hide n characters from start. + /// + HideCount, + /// + /// Show n characters from start. + /// + ShowCount, + /// + /// Show last character for the duration(use ShowDuration property to modify duration). + /// + ShowLastCharacter + } + + /// + /// ParentOrigin constants. + /// + public struct ParentOrigin + { + public static float Top + { + get + { + float ret = NDalicPINVOKE.ParentOriginTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Bottom + { + get + { + float ret = NDalicPINVOKE.ParentOriginBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Left + { + get + { + float ret = NDalicPINVOKE.ParentOriginLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Right + { + get + { + float ret = NDalicPINVOKE.ParentOriginRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Middle + { + get + { + float ret = NDalicPINVOKE.ParentOriginMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position Center + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + } + + /// + /// PivotPoint constants. + /// + public struct PivotPoint + { + public static float Top + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Bottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Left + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Right + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Middle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position Center + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + } + /// + /// PositionAxis constants. + /// + public struct PositionAxis + { + public static Position X + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position Y + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position Z + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position NegativeX + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position NegativeY + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position NegativeZ + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + } + + /// + /// Auto scrolling stop behaviour. + /// + public enum AutoScrollStopMode + { + /// + /// Stop animation after current loop finished. + /// + FinishLoop, + /// + /// Stop animation immediatly and reset position. + /// + Immediate + } + + /// + /// An enum of screen mode. + /// + public enum ScreenMode { + /// + /// The mode which turns the screen off after a timeout. + /// + Default, + /// + /// The mode which keeps the screen turned on. + /// + AlwaysOn + } + + /// + /// An enum of notification window's priority level. + /// + public enum NotificationLevel { + /// + /// No notification level.
+ /// Default level.
+ /// This value makes the notification window place in the layer of the normal window. + ///
+ None = -1, + /// + /// Base nofitication level. + /// + Base = 10, + /// + /// Medium notification level than base. + /// + Medium = 20, + /// + /// Higher notification level than medium. + /// + High = 30, + /// + /// The highest notification level. + /// + Top = 40 + } + + /// + /// An enum of Window types. + /// + public enum WindowType { + /// + /// A default window type.
+ /// Indicates a normal, top-level window. + /// Almost every window will be created with this type. + ///
+ Normal, + /// + /// A notification window, like a warning about battery life or a new E-Mail received. + /// + Notification, + /// + /// A persistent utility window, like a toolbox or palette. + /// + Utility, + /// + /// Used for simple dialog windows. + /// + Dialog + } + + public enum DisposeTypes + { + Explicit, //Called By User + Implicit, //Called by DisposeQueue + } + + + + + [Obsolete("Please do not use! this will be deprecated")] + public struct AnchorPoint + { + public static float Top + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Bottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Left + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Right + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static float Middle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position TopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position Center + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position CenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public static Position BottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + } + + /// + /// An enum of scroll state of text eidtor. + /// + public enum ScrollState + { + /// + /// Scrolling is started. + /// + Started, + + /// + /// Scrolling is finished. + /// + Finished + } + + /// + /// An enum of line wrap mode of text controls. + /// + public enum LineWrapMode + { + /// + /// Word mode will move word to next line + /// + Word, + + /// + /// character will move character by character to next line + /// + Character + } + +} diff --git a/src/Tizen.NUI/src/public/PaddingType.cs b/src/Tizen.NUI/src/public/PaddingType.cs new file mode 100755 index 0000000..b0e3019 --- /dev/null +++ b/src/Tizen.NUI/src/public/PaddingType.cs @@ -0,0 +1,319 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class PaddingType : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PaddingType(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PaddingType obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~PaddingType() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PaddingType(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public static bool operator ==(PaddingType a, PaddingType b) + { + // If both are null, or both are same instance, return true. + if (System.Object.ReferenceEquals(a, b)) + { + return true; + } + + // If one is null, but not both, return false. + if (((object)a == null) || ((object)b == null)) + { + return false; + } + + // Return true if the fields match: + return (System.Math.Abs(a.Left - b.Left) < NDalic.GetRangedEpsilon(a.Left, b.Left)) && + (System.Math.Abs(a.Right - b.Right) < NDalic.GetRangedEpsilon(a.Right, b.Right)) && + (System.Math.Abs(a.Bottom - b.Bottom) < NDalic.GetRangedEpsilon(a.Bottom, b.Bottom)) && + (System.Math.Abs(a.Top - b.Top) < NDalic.GetRangedEpsilon(a.Top, b.Top)); + } + + public static bool operator !=(PaddingType a, PaddingType b) + { + return !(a == b); + } + + ///< The Left value + public float Left + { + set + { + left = value; + } + get + { + return left; + } + } + + ///< The Right value + public float Right + { + set + { + right = value; + } + get + { + return right; + } + } + + ///< The Bottom value + public float Bottom + { + set + { + bottom = value; + } + get + { + return bottom; + } + } + + ///< The Top value + public float Top + { + set + { + top = value; + } + get + { + return top; + } + } + + + public PaddingType() : this(NDalicPINVOKE.new_PaddingType__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public PaddingType(float x, float y, float width, float height) : this(NDalicPINVOKE.new_PaddingType__SWIG_1(x, y, width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Set(float newX, float newY, float newWidth, float newHeight) + { + NDalicPINVOKE.PaddingType_Set(swigCPtr, newX, newY, newWidth, newHeight); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private float x + { + set + { + NDalicPINVOKE.PaddingType_x_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_x_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float left + { + set + { + NDalicPINVOKE.PaddingType_left_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_left_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float y + { + set + { + NDalicPINVOKE.PaddingType_y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float right + { + set + { + NDalicPINVOKE.PaddingType_right_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_right_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float width + { + set + { + NDalicPINVOKE.PaddingType_width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float bottom + { + set + { + NDalicPINVOKE.PaddingType_bottom_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_bottom_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float height + { + set + { + NDalicPINVOKE.PaddingType_height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float top + { + set + { + NDalicPINVOKE.PaddingType_top_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PaddingType_top_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/PanGesture.cs b/src/Tizen.NUI/src/public/PanGesture.cs new file mode 100755 index 0000000..a70f3a6 --- /dev/null +++ b/src/Tizen.NUI/src/public/PanGesture.cs @@ -0,0 +1,355 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A PanGesture is emitted when the user moves one or more fingers in a particular direction.
+ /// A pan gesture will end in the following ways:
+ /// - User releases the primary finger (the first touch).
+ /// - User has more fingers on the screen than the maximum specified.
+ /// - User has less fingers on the screen than the minimum specified.
+ /// - Cancelled by the system.
+ /// A pan gesture will continue to be sent to the actor under than initial pan until it ends.
+ ///
+ public class PanGesture : Gesture + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PanGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PanGesture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PanGesture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PanGesture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal static PanGesture GetPanGestureFromPtr(global::System.IntPtr cPtr) + { + PanGesture ret = new PanGesture(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The velocity at which the user is moving their fingers.
+ /// This is represented as a Vector2 and is the pixel movement per millisecond.
+ /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.
+ /// A positive y value shows that the user is panning downwards, a negative y values means upwards.
+ ///
+ public Vector2 Velocity + { + get + { + return velocity; + } + } + + /// + /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or, + /// if the gesture has just started, then the amount panned since the user touched the screen.
+ /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.
+ /// A positive y value shows that the user is panning downwards, a negative y value means upwards.
+ ///
+ public Vector2 Displacement + { + get + { + return displacement; + } + } + + /// + /// This current touch position of the primary touch point in local actor coordinates. + /// + public Vector2 Position + { + get + { + return position; + } + } + + /// + /// The velocity at which the user is moving their fingers.
+ /// This is represented as a Vector2 and is the pixel movement per millisecond.
+ /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.
+ /// A positive y value shows that the user is panning downwards, a negative y values means upwards.
+ /// This value represents the screen coordinates.
+ ///
+ public Vector2 ScreenVelocity + { + get + { + return screenVelocity; + } + } + + /// + /// This is a Vector2 showing how much the user has panned (dragged) since the last pan gesture or, + /// if the gesture has just started, then the amount panned since the user touched the screen.
+ /// A positive x value shows that the user is panning to the right, a negative x value means the opposite.
+ /// A positive y value shows that the user is panning downwards, a negative y value means upwards.
+ /// This value is in screen coordinates.
+ ///
+ public Vector2 ScreenDisplacement + { + get + { + return screenDisplacement; + } + } + + /// + /// This current touch position of the primary touch point in screen coordinates. + /// + public Vector2 ScreenPosition + { + get + { + return screenPosition; + } + } + + /// + /// The total number of fingers touching the screen in a pan gesture. + /// + public uint NumberOfTouches + { + get + { + return numberOfTouches; + } + } + + /// + /// Default Constructor. + /// + public PanGesture() : this(NDalicPINVOKE.new_PanGesture__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// The state of the gesture + internal PanGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PanGesture__SWIG_1((int)state), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + private Vector2 velocity + { + set + { + NDalicPINVOKE.PanGesture_velocity_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_velocity_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 displacement + { + set + { + NDalicPINVOKE.PanGesture_displacement_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_displacement_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 position + { + set + { + NDalicPINVOKE.PanGesture_position_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_position_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenVelocity + { + set + { + NDalicPINVOKE.PanGesture_screenVelocity_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenVelocity_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenDisplacement + { + set + { + NDalicPINVOKE.PanGesture_screenDisplacement_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenDisplacement_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenPosition + { + set + { + NDalicPINVOKE.PanGesture_screenPosition_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PanGesture_screenPosition_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint numberOfTouches + { + set + { + NDalicPINVOKE.PanGesture_numberOfTouches_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.PanGesture_numberOfTouches_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Returns the speed at which the user is moving their fingers.
+ /// This is the pixel movement per millisecond.
+ ///
+ /// The speed of the pan (in pixels per millisecond) + public float GetSpeed() + { + float ret = NDalicPINVOKE.PanGesture_GetSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// This returns the distance the user has panned (dragged) since the last pan gesture or, + /// if the gesture has just started, then the distance moved since the user touched the screen.
+ /// This is always a positive value.
+ ///
+ /// The distance, as a float, a user's finger has panned + public float GetDistance() + { + float ret = NDalicPINVOKE.PanGesture_GetDistance(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the speed at which the user is moving their fingers relative to screen coordinates.
+ /// This is the pixel movement per millisecond.
+ ///
+ /// The speed of the pan (in pixels per millisecond) + public float GetScreenSpeed() + { + float ret = NDalicPINVOKE.PanGesture_GetScreenSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// This returns the distance the user has panned (dragged) since the last pan gesture in screen + /// coordinates or, if the gesture has just started, then the distance in screen coordinates moved + /// since the user touched the screen.
+ /// This is always a positive value.
+ ///
+ /// The distance, as a float, a user's finger has panned + public float GetScreenDistance() + { + float ret = NDalicPINVOKE.PanGesture_GetScreenDistance(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Path.cs b/src/Tizen.NUI/src/public/Path.cs new file mode 100755 index 0000000..a13eb6a --- /dev/null +++ b/src/Tizen.NUI/src/public/Path.cs @@ -0,0 +1,212 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; + +namespace Tizen.NUI +{ + + /// + /// A 3D parametric curve.
+ /// Paths can be used to animate position and orientation of actors.
+ ///
+ public class Path : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Path(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Path_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Path obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Path(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal class Property + { + internal static readonly int POINTS = NDalicPINVOKE.Path_Property_POINTS_get(); + internal static readonly int CONTROL_POINTS = NDalicPINVOKE.Path_Property_CONTROL_POINTS_get(); + } + + /// + /// Creates an initialized Path handle. + /// + public Path() : this(NDalicPINVOKE.Path_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + + [Obsolete("Please do not use! this will be deprecated")] + public new static Path DownCast(BaseHandle handle) + { + Path ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Path; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds an interpolation point. + /// + /// The new interpolation point to be added + public void AddPoint(Position point) + { + NDalicPINVOKE.Path_AddPoint(swigCPtr, Position.getCPtr(point)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Adds a control point. + /// + /// The new control point to be added + public void AddControlPoint(Vector3 point) + { + NDalicPINVOKE.Path_AddControlPoint(swigCPtr, Vector3.getCPtr(point)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Automatic generation of control points. Generated control points which result in a smooth join between the splines of each segment.
+ /// The generating algorithm is as follows:
+ /// For a given knot point K[N], find the vector that bisects K[N-1],[N] and [N],[N+1].
+ /// Calculate the tangent vector by taking the normal of this bisector.
+ /// The in control point is the length of the preceding segment back along this bisector multiplied by the curvature.
+ /// The out control point is the length of the succeeding segment forward along this bisector multiplied by the curvature.
+ ///
+ /// The curvature of the spline. 0 gives straight lines between the knots, negative values means the spline contains loops, positive values up to 0.5 result in a smooth curve, positive values between 0.5 and 1 result in looped curves where the loops are not distinct (i.e. the curve appears to be non-continuous), positive values higher than 1 result in looped curves + public void GenerateControlPoints(float curvature) + { + NDalicPINVOKE.Path_GenerateControlPoints(swigCPtr, curvature); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sample path at a given progress. Calculates position and tangent at that point of the curve. + /// + /// A floating point value between 0.0 and 1.0 + /// The interpolated position at that progress + /// The interpolated tangent at that progress + public void Sample(float progress, Vector3 position, Vector3 tangent) + { + NDalicPINVOKE.Path_Sample(swigCPtr, progress, Vector3.getCPtr(position), Vector3.getCPtr(tangent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Accessor for the interpolation points. + /// + /// The index of the interpolation point + public Vector3 GetPoint(uint index) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetPoint(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Accessor for the control points. + /// + /// The index of the control point + public Vector3 GetControlPoint(uint index) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Path_GetControlPoint(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the number of interpolation points in the path. + /// + /// The number of interpolation points in the path + public uint GetPointCount() + { + uint ret = NDalicPINVOKE.Path_GetPointCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Enumeration for Points + /// + public PropertyArray Points + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.POINTS).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.POINTS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Enumeration for ControlPoints + /// + public PropertyArray ControlPoints + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + Tizen.NUI.Object.GetProperty(swigCPtr, Path.Property.CONTROL_POINTS).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Path.Property.CONTROL_POINTS, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/PinchGesture.cs b/src/Tizen.NUI/src/public/PinchGesture.cs new file mode 100755 index 0000000..daf4173 --- /dev/null +++ b/src/Tizen.NUI/src/public/PinchGesture.cs @@ -0,0 +1,198 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A PinchGesture is emitted when the user moves two fingers towards or away from each other.
+ /// A pinch gesture will continue to be sent to the actor under the center point of the pinch until the pinch ends.
+ ///
+ public class PinchGesture : Gesture + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PinchGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PinchGesture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PinchGesture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PinchGesture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal static PinchGesture GetPinchGestureFromPtr(global::System.IntPtr cPtr) + { + PinchGesture ret = new PinchGesture(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The scale factor from the start of the pinch gesture till the latest pinch gesture.
+ /// If the user is moving their fingers away from each other, then + /// this value increases. Conversely, if the user is moving their + /// fingers towards each other, this value will decrease.
+ ///
+ public float Scale + { + get + { + return scale; + } + } + + /// + /// The speed at which the user is moving their fingers.
+ /// This is the pixel movement per second.
+ ///
+ public float Speed + { + get + { + return speed; + } + } + + /// + /// The center point of the two points that caused the pinch gesture in screen coordinates. + /// + public Vector2 ScreenCenterPoint + { + get + { + return screenCenterPoint; + } + } + + /// + /// The center point of the two points that caused the pinch gesture in local actor coordinates. + /// + public Vector2 LocalCenterPoint + { + get + { + return localCenterPoint; + } + } + + /// + /// Default Constructor. + /// + /// The state of the gesture + internal PinchGesture(Gesture.StateType state) : this(NDalicPINVOKE.new_PinchGesture__SWIG_0((int)state), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private float scale + { + set + { + NDalicPINVOKE.PinchGesture_scale_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PinchGesture_scale_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private float speed + { + set + { + NDalicPINVOKE.PinchGesture_speed_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.PinchGesture_speed_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenCenterPoint + { + set + { + NDalicPINVOKE.PinchGesture_screenCenterPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PinchGesture_screenCenterPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 localCenterPoint + { + set + { + NDalicPINVOKE.PinchGesture_localCenterPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.PinchGesture_localCenterPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/PixelData.cs b/src/Tizen.NUI/src/public/PixelData.cs new file mode 100755 index 0000000..0b8f7a8 --- /dev/null +++ b/src/Tizen.NUI/src/public/PixelData.cs @@ -0,0 +1,105 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class PixelData : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PixelData(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PixelData_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PixelData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PixelData(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + public PixelData(byte[] buffer, uint bufferSize, uint width, uint height, PixelFormat pixelFormat, PixelData.ReleaseFunction releaseFunction) : this(NDalicPINVOKE.PixelData_New(buffer, bufferSize, width, height, (int)pixelFormat, (int)releaseFunction), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + + public uint GetWidth() + { + uint ret = NDalicPINVOKE.PixelData_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetHeight() + { + uint ret = NDalicPINVOKE.PixelData_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PixelFormat GetPixelFormat() + { + PixelFormat ret = (PixelFormat)NDalicPINVOKE.PixelData_GetPixelFormat(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public enum ReleaseFunction + { + FREE, + DELETE_ARRAY + } + + } + +} diff --git a/src/Tizen.NUI/src/public/PixelFormat.cs b/src/Tizen.NUI/src/public/PixelFormat.cs new file mode 100755 index 0000000..8290e27 --- /dev/null +++ b/src/Tizen.NUI/src/public/PixelFormat.cs @@ -0,0 +1,78 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + public enum PixelFormat + { + INVALID = 0, + A8 = 1, + L8, + LA88, + RGB565, + BGR565, + RGBA4444, + BGRA4444, + RGBA5551, + BGRA5551, + RGB888, + RGB8888, + BGR8888, + RGBA8888, + BGRA8888, + COMPRESSED_R11_EAC, + COMPRESSED_SIGNED_R11_EAC, + COMPRESSED_RG11_EAC, + COMPRESSED_SIGNED_RG11_EAC, + COMPRESSED_RGB8_ETC2, + COMPRESSED_SRGB8_ETC2, + COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + COMPRESSED_RGBA8_ETC2_EAC, + COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + COMPRESSED_RGB8_ETC1, + COMPRESSED_RGB_PVRTC_4BPPV1, + COMPRESSED_RGBA_ASTC_4x4_KHR, + COMPRESSED_RGBA_ASTC_5x4_KHR, + COMPRESSED_RGBA_ASTC_5x5_KHR, + COMPRESSED_RGBA_ASTC_6x5_KHR, + COMPRESSED_RGBA_ASTC_6x6_KHR, + COMPRESSED_RGBA_ASTC_8x5_KHR, + COMPRESSED_RGBA_ASTC_8x6_KHR, + COMPRESSED_RGBA_ASTC_8x8_KHR, + COMPRESSED_RGBA_ASTC_10x5_KHR, + COMPRESSED_RGBA_ASTC_10x6_KHR, + COMPRESSED_RGBA_ASTC_10x8_KHR, + COMPRESSED_RGBA_ASTC_10x10_KHR, + COMPRESSED_RGBA_ASTC_12x10_KHR, + COMPRESSED_RGBA_ASTC_12x12_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR + } + +} diff --git a/src/Tizen.NUI/src/public/Position.cs b/src/Tizen.NUI/src/public/Position.cs new file mode 100755 index 0000000..9a9ae52 --- /dev/null +++ b/src/Tizen.NUI/src/public/Position.cs @@ -0,0 +1,1029 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; + +namespace Tizen.NUI +{ + + /// + /// Position is a three dimensional vector. + /// + public class Position : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Position(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Position() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Addition operator. + /// + /// Vector to add + /// Vector to add + /// A vector containing the result of the addition + public static Position operator +(Position arg1, Position arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// Vector to subtract + /// Vector to subtract + /// A vector containing the result of the subtraction + public static Position operator -(Position arg1, Position arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Vector to netate + /// A vector containg the negation + public static Position operator -(Position arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The vector to multiply + /// A vector containing the result of the multiplication + public static Position operator *(Position arg1, Position arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static Position operator *(Position arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The vector to divide + /// A vector containing the result of the division + public static Position operator /(Position arg1, Position arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static Position operator /(Position arg1, float arg2) + { + return arg1.Divide(arg2); + } + + + /// + /// Const array subscript operator overload. Should be 0, 1 or 2. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// + internal static Position GetPositionFromPtr(global::System.IntPtr cPtr) + { + Position ret = new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// Constructor + /// + public Position() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// x component + /// y component + /// z component + public Position(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// Position2D to create this vector from + public Position(Position2D position2d) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Position2D.getCPtr(position2d)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + + private Position Add(Position rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Add(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Subtract(Position rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Multiply(Position rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Multiply(float rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Divide(Position rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Position.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Divide(float rhs) + { + Position ret = new Position(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position Subtract() + { + Position ret = new Position(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// The vector to compare + /// Returns true if the two vectors are equal, otherwise false + public bool EqualTo(Position rhs) + { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Position.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// The vector to compare + /// Returns true if the two vectors are not equal, otherwise false + public bool NotEqualTo(Position rhs) + { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Position.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// x component + /// + public float X + { + set + { + NDalicPINVOKE.Vector3_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + NDalicPINVOKE.Vector3_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// z component + /// + public float Z + { + set + { + NDalicPINVOKE.Vector3_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants. It's 0.0. + /// + public static float ParentOriginTop + { + get + { + float ret = NDalicPINVOKE.ParentOriginTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants. It's 1.0. + /// + public static float ParentOriginBottom + { + get + { + float ret = NDalicPINVOKE.ParentOriginBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants. It's 0.0. + /// + public static float ParentOriginLeft + { + get + { + float ret = NDalicPINVOKE.ParentOriginLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants. It's 1.0. + /// + public static float ParentOriginRight + { + get + { + float ret = NDalicPINVOKE.ParentOriginRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants. It's 0.5. + /// + public static float ParentOriginMiddle + { + get + { + float ret = NDalicPINVOKE.ParentOriginMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.0, 0.0, 0.5 + /// + public static Position ParentOriginTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.5, 0.0, 0.5 + /// + public static Position ParentOriginTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 1.0, 0.0, 0.5 + /// + public static Position ParentOriginTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.0, 0.5, 0.5 + /// + public static Position ParentOriginCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.0, 0.5, 0.5 + /// + public static Position ParentOriginCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 1.0, 0.5, 0.5 + /// + public static Position ParentOriginCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.0f, 1.0f, 0.5f + /// + public static Position ParentOriginBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 0.5, 1.0, 0.5 + /// + public static Position ParentOriginBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// ParentOrigin constants: 1.0, 1.0, 0.5 + /// + public static Position ParentOriginBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ParentOriginBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0 + /// + public static float PivotPointTop + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 1.0 + /// + public static float PivotPointBottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0 + /// + public static float PivotPointLeft + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 1.0 + /// + public static float PivotPointRight + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0 + /// + public static float PivotPointMiddle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0, 0.0, 0.5 + /// + public static Position PivotPointTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.5, 0.0, 0.5 + /// + public static Position PivotPointTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 1.0, 0.0, 0.5 + /// + public static Position PivotPointTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0, 0.5, 0.5 + /// + public static Position PivotPointCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.5, 0.5, 0.5 + /// + public static Position PivotPointCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 1.0, 0.5, 0.5 + /// + public static Position PivotPointCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.0, 1.0, 0.5 + /// + public static Position PivotPointBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 0.5, 1.0, 0.5 + /// + public static Position PivotPointBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// PivotPoint constants: 1.0, 1.0, 0.5 + /// + public static Position PivotPointBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Constant ( 1.0f, 1.0f, 1.0f ) + /// + public static Position One + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ONE_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position XAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position YAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position ZAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeXAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_XAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeYAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_YAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Position NegativeZAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_ZAXIS_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Constant ( 0.0f, 0.0f, 0.0f ) + /// + public static Position Zero + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Convert a position instance to a vector3 instance. + /// + public static implicit operator Vector3(Position Position) + { + return new Vector3(Position.X, Position.Y, Position.Z); + } + + /// + /// Convert a vector3 instance to a position instance. + /// + public static implicit operator Position(Vector3 vec) + { + return new Position(vec.X, vec.Y, vec.Z); + } + + + [Obsolete("Please do not use! this will be deprecated")] + public static float AnchorPointTop + { + get + { + float ret = NDalicPINVOKE.AnchorPointTop_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static float AnchorPointBottom + { + get + { + float ret = NDalicPINVOKE.AnchorPointBottom_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static float AnchorPointLeft + { + get + { + float ret = NDalicPINVOKE.AnchorPointLeft_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static float AnchorPointRight + { + get + { + float ret = NDalicPINVOKE.AnchorPointRight_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static float AnchorPointMiddle + { + get + { + float ret = NDalicPINVOKE.AnchorPointMiddle_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointTopLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointTopCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointTopRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointTopRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointCenterLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointCenterRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointCenterRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointBottomLeft + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomLeft_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointBottomCenter + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomCenter_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public static Position AnchorPointBottomRight + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.AnchorPointBottomRight_get(); + Position ret = (cPtr == global::System.IntPtr.Zero) ? null : new Position(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } +} diff --git a/src/Tizen.NUI/src/public/Position2D.cs b/src/Tizen.NUI/src/public/Position2D.cs new file mode 100755 index 0000000..5faad48 --- /dev/null +++ b/src/Tizen.NUI/src/public/Position2D.cs @@ -0,0 +1,380 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + + /// + /// Position2D is a two dimensional vector. + /// + public class Position2D : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Position2D(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Position2D obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Position2D() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// Vector to add + /// Vector to add + /// A vector containing the result of the addition + public static Position2D operator +(Position2D arg1, Position2D arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// Vector to subtract + /// Vector to subtract + /// A vector containing the result of the subtraction + public static Position2D operator -(Position2D arg1, Position2D arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Vector to netate + /// A vector containing the negation + public static Position2D operator -(Position2D arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// Vector to multiply + /// Vector to multiply + /// A vector containing the result of the multiplication + public static Position2D operator *(Position2D arg1, Position2D arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// Vector to multiply + /// The int value to scale the vector + /// A vector containing the result of the multiplication + public static Position2D operator *(Position2D arg1, int arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// Vector to divide + /// Vector to divide + /// A vector containing the result of the division + public static Position2D operator /(Position2D arg1, Position2D arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// Vector to divide + /// The int value to scale the vector by + /// A vector containing the result of the division + public static Position2D operator /(Position2D arg1, int arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Const array subscript operator overload. Should be 0, or 1. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Position2D GetPosition2DFromPtr(global::System.IntPtr cPtr) + { + Position2D ret = new Position2D(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Constructor + /// + public Position2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// x component + /// y component + public Position2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// Position to create this vector from + public Position2D(Position position) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Position.getCPtr(position)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Position2D Add(Position2D rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Subtract(Position2D rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Position2D Multiply(Position2D rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Multiply(int rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Position2D Divide(Position2D rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Position2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Divide(int rhs) + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Position2D Subtract() + { + Position2D ret = new Position2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to. + /// + /// The vector to compare + /// Returns true if the two vectors are equal, otherwise false + public bool EqualTo(Position2D rhs) + { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Position2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to. + /// + /// The vector to compare + /// Returns true if the two vectors are not equal, otherwise false + public bool NotEqualTo(Position2D rhs) + { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Position2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private int ValueOfIndex(uint index) + { + int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// x component. + /// + public int X + { + set + { + NDalicPINVOKE.Vector2_X_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + /// + /// y component. + /// + public int Y + { + set + { + NDalicPINVOKE.Vector2_Y_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + /// + /// Convert a position2D instance to a vector2 instance. + /// + public static implicit operator Vector2(Position2D position2d) + { + return new Vector2((float)position2d.X, (float)position2d.Y); + } + + /// + /// Convert a vector2 instance to a position2D instance. + /// + public static implicit operator Position2D(Vector2 vec) + { + return new Position2D((int)vec.X, (int)vec.Y); + } + + /// + /// Convert a Position2D instance to a Uint16Pair instance. + /// + public static implicit operator Uint16Pair(Position2D position2d) + { + return new Uint16Pair((uint)position2d.X, (uint)position2d.Y); + } + + /// + /// Convert a Uint16Pair instance to a Position2D instance. + /// + public static implicit operator Position2D(Uint16Pair pair) + { + return new Position2D((int)pair.GetX(), (int)pair.GetY()); + } + + } + +} + + diff --git a/src/Tizen.NUI/src/public/Property.cs b/src/Tizen.NUI/src/public/Property.cs new file mode 100755 index 0000000..d5852e2 --- /dev/null +++ b/src/Tizen.NUI/src/public/Property.cs @@ -0,0 +1,1603 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; + +namespace Tizen.NUI +{ + + internal class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Property() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + internal static int INVALID_INDEX + { + get + { + int ret = NDalicPINVOKE.Property_INVALID_INDEX_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static int INVALID_KEY + { + get + { + int ret = NDalicPINVOKE.Property_INVALID_KEY_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static int INVALID_COMPONENT_INDEX + { + get + { + int ret = NDalicPINVOKE.Property_INVALID_COMPONENT_INDEX_get(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Constructor. Create a Property instance. + /// + /// A valid handle to the target object + /// The index of a property + public Property(Animatable arg0, int propertyIndex) : this(NDalicPINVOKE.new_Property__SWIG_0(Animatable.getCPtr(arg0), propertyIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. Create a Property instance. + /// + /// A valid handle to the target object + /// The index of a property + /// Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1) + public Property(Animatable arg0, int propertyIndex, int componentIndex) : this(NDalicPINVOKE.new_Property__SWIG_1(Animatable.getCPtr(arg0), propertyIndex, componentIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. Create a Property instance.
+ /// This performs a property index query and is therefore slower than constructing a Property directly with the index.
+ ///
+ /// A valid handle to the target object + /// The property name + public Property(Animatable arg0, string propertyName) : this(NDalicPINVOKE.new_Property__SWIG_2(Animatable.getCPtr(arg0), propertyName), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. Create a Property instance.
+ /// This performs a property index query and is therefore slower than constructing a Property directly with the index.
+ ///
+ /// A valid handle to the target object + /// The property name + /// Index to a sub component of a property, for use with Vector2, Vector3 and Vector4. -1 for main property (default is -1) + public Property(Animatable arg0, string propertyName, int componentIndex) : this(NDalicPINVOKE.new_Property__SWIG_3(Animatable.getCPtr(arg0), propertyName, componentIndex), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Animatable _object + { + set + { + NDalicPINVOKE.Property__object_set(swigCPtr, Animatable.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Animatable ret = new Animatable(NDalicPINVOKE.Property__object_get(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Gets/Sets the index of the property. + /// + public int propertyIndex + { + set + { + NDalicPINVOKE.Property_propertyIndex_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Property_propertyIndex_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Gets/Sets the componentIndex of the property. + /// + public int componentIndex + { + set + { + NDalicPINVOKE.Property_componentIndex_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Property_componentIndex_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + + /// + /// A Array of property values. + /// + public class PropertyArray : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyArray(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyArray obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~PropertyArray() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Property_Array(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Operator to access an element. + /// + /// The element index to access. No bounds checking is performed + /// The a reference to the element + public PropertyValue this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// Constructor + /// + public PropertyArray() : this(NDalicPINVOKE.new_Property_Array__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PropertyArray(PropertyArray other) : this(NDalicPINVOKE.new_Property_Array__SWIG_1(PropertyArray.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the number of elements in the array. + /// + /// The number of elements in the array + public uint Size() + { + uint ret = NDalicPINVOKE.Property_Array_Size(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the number of elements in the array. + /// + /// The number of elements in the array + public uint Count() + { + uint ret = NDalicPINVOKE.Property_Array_Count(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns whether the array is empty. + /// + /// Return true if empty, false otherwise + public bool Empty() + { + bool ret = NDalicPINVOKE.Property_Array_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Clears the array. + /// + public void Clear() + { + NDalicPINVOKE.Property_Array_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Increases the capacity of the array. + /// + /// The size to reserve + public void Reserve(uint size) + { + NDalicPINVOKE.Property_Array_Reserve(swigCPtr, size); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resizes to size. + /// + /// The size to resize + public void Resize(uint size) + { + NDalicPINVOKE.Property_Array_Resize(swigCPtr, size); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the capacity of the array. + /// + /// The allocated capacity of the array + public uint Capacity() + { + uint ret = NDalicPINVOKE.Property_Array_Capacity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Adds an element to the array. + /// + /// The value to add to the end of the array + public void PushBack(PropertyValue value) + { + NDalicPINVOKE.Property_Array_PushBack(swigCPtr, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Add an element to the array. + /// + /// The value to add to the end of the array + public PropertyArray Add(PropertyValue value) + { + PropertyArray ret = new PropertyArray(NDalicPINVOKE.Property_Array_Add(swigCPtr, PropertyValue.getCPtr(value)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Access an element. + /// + /// The element index to access. No bounds checking is performed + /// The a reference to the element + public PropertyValue GetElementAt(uint index) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Property_Array_GetElementAt__SWIG_0(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the value of elements in the array. + /// + /// The element index to retrieve. + /// The a reference to the element + private PropertyValue ValueOfIndex(uint index) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Property_Array_ValueOfIndex__SWIG_0(swigCPtr, index), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// A key type which can be either a std::string or a Property::Index + /// + public class PropertyKey : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyKey(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyKey obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~PropertyKey() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Property_Key(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// The type of the key + /// + public PropertyKey.KeyType Type + { + set + { + NDalicPINVOKE.Property_Key_type_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + PropertyKey.KeyType ret = (PropertyKey.KeyType)NDalicPINVOKE.Property_Key_type_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The index key. + /// + public int IndexKey + { + set + { + NDalicPINVOKE.Property_Key_indexKey_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Property_Key_indexKey_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The string key. + /// + public string StringKey + { + set + { + NDalicPINVOKE.Property_Key_stringKey_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + string ret = NDalicPINVOKE.Property_Key_stringKey_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Constructor + /// + /// The string key + public PropertyKey(string key) : this(NDalicPINVOKE.new_Property_Key__SWIG_0(key), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// The index key + public PropertyKey(int key) : this(NDalicPINVOKE.new_Property_Key__SWIG_1(key), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Compare if rhs is equal to + /// + /// A string key to compare against + /// Returns true if the key compares, or false if it isn't equal or of the wrong type + public bool EqualTo(string rhs) + { + bool ret = NDalicPINVOKE.Property_Key_EqualTo__SWIG_0(swigCPtr, rhs); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// A index key to compare against + /// Returns true if the key compares, or false if it isn't equal or of the wrong type + public bool EqualTo(int rhs) + { + bool ret = NDalicPINVOKE.Property_Key_EqualTo__SWIG_1(swigCPtr, rhs); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// A key to compare against + /// Returns true if the keys are of the same type and have the same value + public bool EqualTo(PropertyKey rhs) + { + bool ret = NDalicPINVOKE.Property_Key_EqualTo__SWIG_2(swigCPtr, PropertyKey.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// An index key to compare against. + /// Returns true if the key is not equal or not a string key + public bool NotEqualTo(string rhs) + { + bool ret = NDalicPINVOKE.Property_Key_NotEqualTo__SWIG_0(swigCPtr, rhs); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// An index key to compare against. + /// Returns true if the key is not equal, or not an index key + public bool NotEqualTo(int rhs) + { + bool ret = NDalicPINVOKE.Property_Key_NotEqualTo__SWIG_1(swigCPtr, rhs); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// A key to compare against. + /// Returns true if the keys are not of the same type or are not equal + public bool NotEqualTo(PropertyKey rhs) + { + bool ret = NDalicPINVOKE.Property_Key_NotEqualTo__SWIG_2(swigCPtr, PropertyKey.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The type of key + /// + public enum KeyType + { + Index, + String + } + + } + + /// + /// A Map of property values, the key type could be String or Property::Index. + /// + public class PropertyMap : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyMap(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyMap obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~PropertyMap() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Property_Map(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Operator to access the element with the specified string key.
+ /// If an element with the key does not exist, then it is created.
+ ///
+ /// The key whose value to access + /// A value for the element with the specified key + public PropertyValue this[string key] + { + get + { + return ValueOfIndex(key); + } + } + + /// + /// Operator to access the element with the specified index key.
+ /// If an element with the key does not exist, then it is created.
+ ///
+ /// The key whose value to access + /// A value for the element with the specified key + public PropertyValue this[int key] + { + get + { + return ValueOfIndex(key); + } + } + + /// + /// Constructor + /// + public PropertyMap() : this(NDalicPINVOKE.new_Property_Map__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Copy Constructor + /// + /// The Map to copy from + public PropertyMap(PropertyMap other) : this(NDalicPINVOKE.new_Property_Map__SWIG_1(PropertyMap.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the number of elements in the map. + /// + /// The number of elements in the map + public uint Count() + { + uint ret = NDalicPINVOKE.Property_Map_Count(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns whether the map is empty. + /// + /// Returns true if empty, false otherwise + public bool Empty() + { + bool ret = NDalicPINVOKE.Property_Map_Empty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Inserts the key-value pair in the Map, with the key type as string.
+ /// Does not check for duplicates.
+ ///
+ /// The key to insert + /// The value to insert + public void Insert(string key, PropertyValue value) + { + NDalicPINVOKE.Property_Map_Insert__SWIG_0(swigCPtr, key, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Inserts the key-value pair in the Map, with the key type as index.
+ /// Does not check for duplicates.
+ ///
+ /// The key to insert + /// The value to insert + public void Insert(int key, PropertyValue value) + { + NDalicPINVOKE.Property_Map_Insert__SWIG_2(swigCPtr, key, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Inserts the key-value pair in the Map, with the key type as string.
+ /// Does not check for duplicates.
+ ///
+ /// The key to insert + /// The value to insert + /// Returns a reference to this object + public PropertyMap Add(string key, PropertyValue value) + { + PropertyMap ret = new PropertyMap(NDalicPINVOKE.Property_Map_Add__SWIG_0(swigCPtr, key, PropertyValue.getCPtr(value)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Inserts the key-value pair in the Map, with the key type as string.
+ /// Does not check for duplicates.
+ ///
+ /// The key to insert + /// The value to insert + /// Returns a reference to this object + public PropertyMap Add(int key, PropertyValue value) + { + PropertyMap ret = new PropertyMap(NDalicPINVOKE.Property_Map_Add__SWIG_2(swigCPtr, key, PropertyValue.getCPtr(value)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the value at the specified position. + /// + /// The specified position + /// A reference to the value at the specified position + public PropertyValue GetValue(uint position) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Property_Map_GetValue(swigCPtr, position), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated")] + public string GetKey(uint position) + { + string ret = NDalicPINVOKE.Property_Map_GetKey(swigCPtr, position); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieve the key at the specified position. + /// + /// The specified position + /// A copy of the key at the specified position + public PropertyKey GetKeyAt(uint position) + { + PropertyKey ret = new PropertyKey(NDalicPINVOKE.Property_Map_GetKeyAt(swigCPtr, position), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated")] + public PropertyValue Find(string key) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Property_Map_Find__SWIG_0(swigCPtr, key); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Finds the value for the specified key if it exists. + /// + /// The key to find + /// The value if it exists, an empty object otherwise + public PropertyValue Find(int key) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Property_Map_Find__SWIG_2(swigCPtr, key); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Finds the value for the specified keys if either exist. + /// + /// The index key to find + /// The string key to find + /// The value if it exists, an empty object otherwise + public PropertyValue Find(int indexKey, string stringKey) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Property_Map_Find__SWIG_3(swigCPtr, indexKey, stringKey); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated")] + public PropertyValue Find(string key, PropertyType type) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Property_Map_Find__SWIG_4(swigCPtr, key, (int)type); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated")] + public PropertyValue Find(int key, PropertyType type) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Property_Map_Find__SWIG_5(swigCPtr, key, (int)type); + PropertyValue ret = (cPtr == global::System.IntPtr.Zero) ? null : new PropertyValue(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Clears the map. + /// + public void Clear() + { + NDalicPINVOKE.Property_Map_Clear(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Merges values from the map 'from' to the current.
+ /// Any values in 'from' will overwrite the values in the current map.
+ ///
+ /// The map to merge from + public void Merge(PropertyMap from) + { + NDalicPINVOKE.Property_Map_Merge(swigCPtr, PropertyMap.getCPtr(from)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves the element with the specified string key. + /// + /// The key whose value to retrieve + /// The value for the element with the specified key + internal PropertyValue ValueOfIndex(string key) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Property_Map_ValueOfIndex__SWIG_0(swigCPtr, key), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the element with the specified index key. + /// + /// The key whose value to retrieve + /// The value for the element with the specified key + internal PropertyValue ValueOfIndex(int key) + { + PropertyValue ret = new PropertyValue(NDalicPINVOKE.Property_Map_ValueOfIndex__SWIG_2(swigCPtr, key), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// A value-type representing a property value. + /// + public class PropertyValue : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal PropertyValue(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyValue obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~PropertyValue() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Property_Value(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Extension to property value class that allows us to create a + /// PropertyValue from a C# object, e.g. int, float, string.
+ ///
+ /// An object to create + /// The created value + static public PropertyValue CreateFromObject(System.Object obj) + { + System.Type type = obj.GetType(); + + PropertyValue value; + + if (type.Equals(typeof(int))) + { + value = new PropertyValue((int)obj); + } + if (type.Equals(typeof(System.Int32))) + { + value = new PropertyValue((int)obj); + } + else if (type.Equals(typeof(bool))) + { + value = new PropertyValue((bool)obj); + } + else if (type.Equals(typeof(float))) + { + value = new PropertyValue((float)obj); + } + else if (type.Equals(typeof(string))) + { + value = new PropertyValue((string)obj); + } + else if (type.Equals(typeof(Vector2))) + { + value = new PropertyValue((Vector2)obj); + } + else if (type.Equals(typeof(Vector3))) + { + value = new PropertyValue((Vector3)obj); + } + else if (type.Equals(typeof(Vector4))) + { + value = new PropertyValue((Vector4)obj); + } + else if (type.Equals(typeof(Position))) + { + value = new PropertyValue((Position)obj); + } + else if (type.Equals(typeof(Position2D))) + { + value = new PropertyValue((Position2D)obj); + } + else if (type.Equals(typeof(Size))) + { + value = new PropertyValue((Size)obj); + } + else if (type.Equals(typeof(Size2D))) + { + value = new PropertyValue((Size2D)obj); + } + else if (type.Equals(typeof(Color))) + { + value = new PropertyValue((Color)obj); + } + else if (type.Equals(typeof(Rotation))) + { + value = new PropertyValue((Rotation)obj); + } + else if (type.Equals(typeof(RelativeVector2))) + { + value = new PropertyValue((RelativeVector2)obj); + } + else if (type.Equals(typeof(RelativeVector3))) + { + value = new PropertyValue((RelativeVector3)obj); + } + else if (type.Equals(typeof(RelativeVector4))) + { + value = new PropertyValue((RelativeVector4)obj); + } + else + { + throw new global::System.InvalidOperationException("Unimplemented type for Property Value :" + type.Name); + } + NUILog.Debug(" got an property value of =" + type.Name); + return value; + } + + /// + /// Creates a Size2D property value. + /// + /// A Size2D values + public PropertyValue(Size2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Size2D.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Position2D property value. + /// + /// A Position2D values + public PropertyValue(Position2D vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Position2D.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Size property value. + /// + /// A Size values + internal PropertyValue(Size vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Size.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Position property value. + /// + /// A Position values + public PropertyValue(Position vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Position.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Color property value. + /// + /// A Color values + public PropertyValue(Color vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_6(Color.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + /// + /// Retrieves a Size2D value. + /// + /// On return, a Size2D value + public bool Get(Size2D vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Size2D.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a Position2D value. + /// + /// On return, a Position2D value + public bool Get(Position2D vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Position2D.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a Size value. + /// + /// On return, a Size value + internal bool Get(Size vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Size.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a Position value. + /// + /// On return, a Position value + public bool Get(Position vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Position.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a Color value. + /// + /// On return, a Color value + public bool Get(Color vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_7(swigCPtr, Color.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + + /// + /// Default constructor. + /// + public PropertyValue() : this(NDalicPINVOKE.new_Property_Value__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a boolean property value. + /// + /// A boolean value + public PropertyValue(bool boolValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_1(boolValue), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an integer property value. + /// + /// An integer value + public PropertyValue(int integerValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_2(integerValue), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a float property value. + /// + /// A floating-point value + public PropertyValue(float floatValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_3(floatValue), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Vector2 property value. + /// + /// A vector of 2 floating-point values + public PropertyValue(Vector2 vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_4(Vector2.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Vector3 property value. + /// + /// A vector of 3 floating-point values + public PropertyValue(Vector3 vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_5(Vector3.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Vector4 property value. + /// + /// A vector of 4 floating-point values + public PropertyValue(Vector4 vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_6(Vector4.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PropertyValue(Matrix3 matrixValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_7(Matrix3.getCPtr(matrixValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PropertyValue(Matrix matrixValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_8(Matrix.getCPtr(matrixValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Rectangle property value. + /// + /// A Rectangle values + public PropertyValue(Rectangle vectorValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_9(Rectangle.getCPtr(vectorValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal PropertyValue(AngleAxis angleAxis) : this(NDalicPINVOKE.new_Property_Value__SWIG_10(AngleAxis.getCPtr(angleAxis)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a Rotation property value. + /// + /// A Rotation values + public PropertyValue(Rotation quaternion) : this(NDalicPINVOKE.new_Property_Value__SWIG_11(Rotation.getCPtr(quaternion)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a string property value. + /// + /// A string + public PropertyValue(string stringValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_12(stringValue), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an array property value. + /// + /// An array + public PropertyValue(PropertyArray arrayValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_14(PropertyArray.getCPtr(arrayValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a map property value. + /// + /// An array + public PropertyValue(PropertyMap mapValue) : this(NDalicPINVOKE.new_Property_Value__SWIG_15(PropertyMap.getCPtr(mapValue)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a PropertyType value. + /// + /// A PropertyType values + public PropertyValue(PropertyType type) : this(NDalicPINVOKE.new_Property_Value__SWIG_16((int)type), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates a PropertyValue value. + /// + /// A PropertyValue values + public PropertyValue(PropertyValue value) : this(NDalicPINVOKE.new_Property_Value__SWIG_17(PropertyValue.getCPtr(value)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Queries the type of this property value. + /// + /// The type ID + public PropertyType GetType() + { + PropertyType ret = (PropertyType)NDalicPINVOKE.Property_Value_GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a boolean value. + /// + /// On return, a boolean value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(out bool boolValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_1(swigCPtr, out boolValue); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a floating-point value. + /// + /// On return, a floating-point value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(out float floatValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_2(swigCPtr, out floatValue); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a integer value. + /// + /// On return, a integer value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(out int integerValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_3(swigCPtr, out integerValue); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves an integer rectangle. + /// + /// On return, an integer rectangle + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(Rectangle rect) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_4(swigCPtr, Rectangle.getCPtr(rect)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a vector value. + /// + /// On return, a vector value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(Vector2 vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_5(swigCPtr, Vector2.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a vector value. + /// + /// On return, a vector value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(Vector3 vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_6(swigCPtr, Vector3.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a vector value. + /// + /// On return, a vector value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(Vector4 vectorValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_7(swigCPtr, Vector4.getCPtr(vectorValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool Get(Matrix3 matrixValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_8(swigCPtr, Matrix3.getCPtr(matrixValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool Get(Matrix matrixValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_9(swigCPtr, Matrix.getCPtr(matrixValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal bool Get(AngleAxis angleAxisValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_10(swigCPtr, AngleAxis.getCPtr(angleAxisValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a Rotation value. + /// + /// On return, a Rotation value + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(Rotation quaternionValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_11(swigCPtr, Rotation.getCPtr(quaternionValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves a string property value. + /// + /// On return, a string + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(out string stringValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_12(swigCPtr, out stringValue); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves an array property value. + /// + /// On return, the array as a vector Property Values + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(PropertyArray arrayValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_13(swigCPtr, PropertyArray.getCPtr(arrayValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves an map property value. + /// + /// On return, the map as vector of string and Property Value pairs + /// Returns true if the value is successfully retrieved, false if the type is not convertible + public bool Get(PropertyMap mapValue) + { + bool ret = NDalicPINVOKE.Property_Value_Get__SWIG_14(swigCPtr, PropertyMap.getCPtr(mapValue)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} diff --git a/src/Tizen.NUI/src/public/PropertyBuffer.cs b/src/Tizen.NUI/src/public/PropertyBuffer.cs new file mode 100755 index 0000000..bbbb2b8 --- /dev/null +++ b/src/Tizen.NUI/src/public/PropertyBuffer.cs @@ -0,0 +1,88 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class PropertyBuffer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PropertyBuffer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PropertyBuffer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PropertyBuffer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PropertyBuffer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public PropertyBuffer(PropertyMap bufferFormat) : this(NDalicPINVOKE.PropertyBuffer_New(PropertyMap.getCPtr(bufferFormat)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public void SetData(System.IntPtr data, uint size) + { + NDalicPINVOKE.PropertyBuffer_SetData(swigCPtr, data, size); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetSize() + { + uint ret = NDalicPINVOKE.PropertyBuffer_GetSize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Radian.cs b/src/Tizen.NUI/src/public/Radian.cs new file mode 100755 index 0000000..16bb897 --- /dev/null +++ b/src/Tizen.NUI/src/public/Radian.cs @@ -0,0 +1,160 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// An angle in radians. + /// + public class Radian : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Radian(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Radian obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Radian() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Radian(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Default constructor, initializes to 0. + /// + public Radian() : this(NDalicPINVOKE.new_Radian__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an angle in radians. + /// + /// The initial value in radians + public Radian(float value) : this(NDalicPINVOKE.new_Radian__SWIG_1(value), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an angle in radians from an angle in degrees. + /// + /// The initial value in degrees + public Radian(Degree degree) : this(NDalicPINVOKE.new_Radian__SWIG_2(Degree.getCPtr(degree)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion to float. + /// + /// The float value of this Radian + public float ConvertToFloat() + { + float ret = NDalicPINVOKE.Radian_ConvertToFloat(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The value in radians + /// + public float Value + { + set + { + NDalicPINVOKE.Radian_radian_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Radian_radian_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Rectangle.cs b/src/Tizen.NUI/src/public/Rectangle.cs new file mode 100755 index 0000000..c601cbb --- /dev/null +++ b/src/Tizen.NUI/src/public/Rectangle.cs @@ -0,0 +1,442 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// Rectangle class + /// + public class Rectangle : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Rectangle(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Rectangle obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Rectangle() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Rectangle(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Equality operator. + /// + /// First operand + /// Second operand + /// True if boxes are exactly same + public static bool operator ==(Rectangle a, Rectangle b) + { + // If both are null, or both are same instance, return true. + if (System.Object.ReferenceEquals(a, b)) + { + return true; + } + + // If one is null, but not both, return false. + if (((object)a == null) || ((object)b == null)) + { + return false; + } + + // Return true if the fields match: + return a.X == b.X && a.Y == b.Y && a.Width == b.Width && a.Height == b.Height; + } + + /// + /// Inequality operator. + /// + /// The first rectangle + /// The second rectangle + /// True if rectangles are not identical + public static bool operator !=(Rectangle a, Rectangle b) + { + return !(a == b); + } + + /// + /// X position of the rectangle + /// + public int X + { + set + { + x = ( value ); + } + get + { + return x; + } + } + + /// + /// Y position of the rectangle + /// + public int Y + { + set + { + y = ( value ); + } + get + { + return y; + } + } + + /// + /// Width of the rectangle + /// + public int Width + { + set + { + width = ( value ); + } + get + { + return width; + } + } + + /// + /// Height of the rectangle + /// + public int Height + { + set + { + height = ( value ); + } + get + { + return height; + } + } + + /// + /// Constructor. + /// + public Rectangle() : this(NDalicPINVOKE.new_Rectangle__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// X coordinate (or left) + /// Y coordinate (or right) + /// Width (or bottom) + /// Height (or top) + public Rectangle(int x, int y, int width, int height) : this(NDalicPINVOKE.new_Rectangle__SWIG_1(x, y, width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Assignment from individual values. + /// + /// X coordinate + /// Y coordinate + /// Width + /// Height + public void Set(int newX, int newY, int newWidth, int newHeight) + { + NDalicPINVOKE.Rectangle_Set(swigCPtr, newX, newY, newWidth, newHeight); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Determines whether or not this Rectangle is empty. + /// + /// True if width or height are zero + public bool IsEmpty() + { + bool ret = NDalicPINVOKE.Rectangle_IsEmpty(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the left of the rectangle. + /// + /// The left edge of the rectangle + public int Left() + { + int ret = NDalicPINVOKE.Rectangle_Left(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the right of the rectangle. + /// + /// The right edge of the rectangle + public int Right() + { + int ret = NDalicPINVOKE.Rectangle_Right(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the top of the rectangle. + /// + /// The top of the rectangle + public int Top() + { + int ret = NDalicPINVOKE.Rectangle_Top(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the bottom of the rectangle. + /// + /// The bottom of the rectangle + public int Bottom() + { + int ret = NDalicPINVOKE.Rectangle_Bottom(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the area of the rectangle. + /// + /// The area of the rectangle + public int Area() + { + int ret = NDalicPINVOKE.Rectangle_Area(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determines whether or not this rectangle and the specified rectangle intersect. + /// + /// The other rectangle to test against this rectangle + /// True if the rectangles intersect + public bool Intersects(Rectangle other) + { + bool ret = NDalicPINVOKE.Rectangle_Intersects(swigCPtr, Rectangle.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Determines whether or not this Rectangle contains the specified rectangle. + /// + /// The other rectangle to test against this rectangle + /// True if the specified rectangle is contained + public bool Contains(Rectangle other) + { + bool ret = NDalicPINVOKE.Rectangle_Contains(swigCPtr, Rectangle.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private int x + { + set + { + NDalicPINVOKE.Rectangle_x_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_x_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int left + { + set + { + NDalicPINVOKE.Rectangle_left_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_left_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int y + { + set + { + NDalicPINVOKE.Rectangle_y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int right + { + set + { + NDalicPINVOKE.Rectangle_right_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_right_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int width + { + set + { + NDalicPINVOKE.Rectangle_width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int bottom + { + set + { + NDalicPINVOKE.Rectangle_bottom_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_bottom_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int height + { + set + { + NDalicPINVOKE.Rectangle_height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int top + { + set + { + NDalicPINVOKE.Rectangle_top_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Rectangle_top_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/RelativeVector2.cs b/src/Tizen.NUI/src/public/RelativeVector2.cs new file mode 100755 index 0000000..de4f503 --- /dev/null +++ b/src/Tizen.NUI/src/public/RelativeVector2.cs @@ -0,0 +1,416 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + using System; + +namespace Tizen.NUI +{ + + /// + /// RelativeVector2 is a two dimensional vector. + /// Both values(x and y) should be between [0, 1]. + /// + public class RelativeVector2 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RelativeVector2(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector2 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~RelativeVector2() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Addition operator. + /// + /// Vector to add + /// Vector to add + /// A vector containing the result of the addition + public static RelativeVector2 operator +(RelativeVector2 arg1, RelativeVector2 arg2) + { + RelativeVector2 result = arg1.Add(arg2); + ValueCheck(result); + return result; + } + + /// + /// Subtraction operator. + /// + /// Vector to subtract + /// Vector to subtract + /// A vector containing the result of the subtraction + public static RelativeVector2 operator -(RelativeVector2 arg1, RelativeVector2 arg2) + { + RelativeVector2 result = arg1.Subtract(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The vector to multiply + /// A vector containing the result of the multiplication + public static RelativeVector2 operator *(RelativeVector2 arg1, RelativeVector2 arg2) + { + RelativeVector2 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static RelativeVector2 operator *(RelativeVector2 arg1, float arg2) + { + RelativeVector2 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The vector to divide + /// A vector containing the result of the division + public static RelativeVector2 operator /(RelativeVector2 arg1, RelativeVector2 arg2) + { + RelativeVector2 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static RelativeVector2 operator /(RelativeVector2 arg1, float arg2) + { + RelativeVector2 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + + /// + /// Const array subscript operator overload. Should be 0, 1. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// + internal static RelativeVector2 GetRelativeVector2FromPtr(global::System.IntPtr cPtr) + { + RelativeVector2 ret = new RelativeVector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// Constructor + /// + public RelativeVector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// x component + /// y component + public RelativeVector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true) + { + ValueCheck(x); + ValueCheck(y); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector3 to create this vector from + public RelativeVector2(RelativeVector3 relativeVector3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(RelativeVector3.getCPtr(relativeVector3)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector4 to create this vector from + public RelativeVector2(RelativeVector4 relativeVector4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(RelativeVector4.getCPtr(relativeVector4)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + private RelativeVector2 Add(RelativeVector2 rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Add(swigCPtr, RelativeVector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector2 Subtract(RelativeVector2 rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, RelativeVector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector2 Multiply(RelativeVector2 rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, RelativeVector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector2 Multiply(float rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector2 Divide(RelativeVector2 rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, RelativeVector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector2 Divide(float rhs) + { + RelativeVector2 ret = new RelativeVector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// The vector to compare + /// Returns true if the two vectors are equal, otherwise false + public bool EqualTo(RelativeVector2 rhs) + { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, RelativeVector2.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// The vector to compare + /// Returns true if the two vectors are not equal, otherwise false + public bool NotEqualTo(RelativeVector2 rhs) + { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, RelativeVector2.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// x component + /// + public float X + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector2_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector2_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// + public static implicit operator Vector2(RelativeVector2 relativeVector2) + { + return new Vector2(relativeVector2.X, relativeVector2.Y); + } + + /// + /// + public static implicit operator RelativeVector2(Vector2 vec) + { + ValueCheck(vec.X); + ValueCheck(vec.Y); + return new RelativeVector2(vec.X, vec.Y); + } + + internal static void ValueCheck(RelativeVector2 relativeVector2) + { + if(relativeVector2.X < 0.0f) + { + relativeVector2.X = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector2.X > 1.0f) + { + relativeVector2.X = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector2.Y < 0.0f) + { + relativeVector2.Y = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector2.Y > 1.0f) + { + relativeVector2.Y = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + } + + internal static void ValueCheck(float value) + { + if(value < 0.0f) + { + value = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + else if(value > 1.0f) + { + value = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + } + } + +} + + diff --git a/src/Tizen.NUI/src/public/RelativeVector3.cs b/src/Tizen.NUI/src/public/RelativeVector3.cs new file mode 100755 index 0000000..d83d7b0 --- /dev/null +++ b/src/Tizen.NUI/src/public/RelativeVector3.cs @@ -0,0 +1,448 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +namespace Tizen.NUI +{ + + /// + /// RelativeVector3 is a three dimensional vector. + /// All values(x, y, z and w) should be between [0, 1]. + /// + public class RelativeVector3 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RelativeVector3(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector3 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~RelativeVector3() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Addition operator. + /// + /// Vector to add + /// Vector to add + /// A vector containing the result of the addition + public static RelativeVector3 operator +(RelativeVector3 arg1, RelativeVector3 arg2) + { + RelativeVector3 result = arg1.Add(arg2); + ValueCheck(result); + return result; + } + + /// + /// Subtraction operator. + /// + /// Vector to subtract + /// Vector to subtract + /// A vector containing the result of the subtraction + public static RelativeVector3 operator -(RelativeVector3 arg1, RelativeVector3 arg2) + { + RelativeVector3 result = arg1.Subtract(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The vector to multiply + /// A vector containing the result of the multiplication + public static RelativeVector3 operator *(RelativeVector3 arg1, RelativeVector3 arg2) + { + RelativeVector3 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static RelativeVector3 operator *(RelativeVector3 arg1, float arg2) + { + RelativeVector3 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The vector to divide + /// A vector containing the result of the division + public static RelativeVector3 operator /(RelativeVector3 arg1, RelativeVector3 arg2) + { + RelativeVector3 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static RelativeVector3 operator /(RelativeVector3 arg1, float arg2) + { + RelativeVector3 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + + /// + /// Const array subscript operator overload. Should be 0, 1 or 2. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// + internal static RelativeVector3 GetRelativeVector3FromPtr(global::System.IntPtr cPtr) + { + RelativeVector3 ret = new RelativeVector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// Constructor + /// + public RelativeVector3() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// x component + /// y component + /// z component + public RelativeVector3(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) + { + ValueCheck(x); + ValueCheck(y); + ValueCheck(z); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector2 to create this vector from + public RelativeVector3(RelativeVector2 relativeVector2) : this(NDalicPINVOKE.new_Vector3__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector4 to create this vector from + public RelativeVector3(RelativeVector4 relativeVector4) : this(NDalicPINVOKE.new_Vector3__SWIG_4(RelativeVector4.getCPtr(relativeVector4)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + private RelativeVector3 Add(RelativeVector3 rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Add(swigCPtr, RelativeVector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector3 Subtract(RelativeVector3 rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector3 Multiply(RelativeVector3 rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector3 Multiply(float rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector3 Divide(RelativeVector3 rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, RelativeVector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector3 Divide(float rhs) + { + RelativeVector3 ret = new RelativeVector3(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// The vector to compare + /// Returns true if the two vectors are equal, otherwise false + public bool EqualTo(RelativeVector3 rhs) + { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, RelativeVector3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// The vector to compare + /// Returns true if the two vectors are not equal, otherwise false + public bool NotEqualTo(RelativeVector3 rhs) + { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, RelativeVector3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// x component + /// + public float X + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector3_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector3_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// z component + /// + public float Z + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector3_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// + public static implicit operator Vector3(RelativeVector3 relativeVector3) + { + return new Vector3(relativeVector3.X, relativeVector3.Y, relativeVector3.Z); + } + + /// + /// + public static implicit operator RelativeVector3(Vector3 vec) + { + ValueCheck(vec.X); + ValueCheck(vec.Y); + ValueCheck(vec.Z); + return new RelativeVector3(vec.X, vec.Y, vec.Z); + } + + internal static void ValueCheck(RelativeVector3 relativeVector3) + { + if(relativeVector3.X < 0.0f) + { + relativeVector3.X = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector3.X > 1.0f) + { + relativeVector3.X = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector3.Y < 0.0f) + { + relativeVector3.Y = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector3.Y > 1.0f) + { + relativeVector3.Y = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector3.Z < 0.0f) + { + relativeVector3.Z = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector3.Z > 1.0f) + { + relativeVector3.Z = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + } + + internal static void ValueCheck(float value) + { + if(value < 0.0f) + { + value = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + else if(value > 1.0f) + { + value = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + } + } + +} + + diff --git a/src/Tizen.NUI/src/public/RelativeVector4.cs b/src/Tizen.NUI/src/public/RelativeVector4.cs new file mode 100755 index 0000000..4ab3671 --- /dev/null +++ b/src/Tizen.NUI/src/public/RelativeVector4.cs @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + using System; + +namespace Tizen.NUI +{ + + /// + /// RelativeVector4 is a four dimensional vector. + /// All values(x, y, and z) should be between [0, 1]. + /// + public class RelativeVector4 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RelativeVector4(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelativeVector4 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~RelativeVector4() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector4(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + /// + /// Addition operator. + /// + /// Vector to add + /// Vector to add + /// A vector containing the result of the addition + public static RelativeVector4 operator +(RelativeVector4 arg1, RelativeVector4 arg2) + { + RelativeVector4 result = arg1.Add(arg2); + ValueCheck(result); + return result; + } + + /// + /// Subtraction operator. + /// + /// Vector to subtract + /// Vector to subtract + /// A vector containing the result of the subtraction + public static RelativeVector4 operator -(RelativeVector4 arg1, RelativeVector4 arg2) + { + RelativeVector4 result = arg1.Subtract(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The vector to multiply + /// A vector containing the result of the multiplication + public static RelativeVector4 operator *(RelativeVector4 arg1, RelativeVector4 arg2) + { + RelativeVector4 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Multiplication operator. + /// + /// The vector to multiply + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static RelativeVector4 operator *(RelativeVector4 arg1, float arg2) + { + RelativeVector4 result = arg1.Multiply(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The vector to divide + /// A vector containing the result of the division + public static RelativeVector4 operator /(RelativeVector4 arg1, RelativeVector4 arg2) + { + RelativeVector4 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + /// + /// Division operator. + /// + /// The vector to divide + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static RelativeVector4 operator /(RelativeVector4 arg1, float arg2) + { + RelativeVector4 result = arg1.Divide(arg2); + ValueCheck(result); + return result; + } + + + /// + /// Const array subscript operator overload. Should be 0, 1 3 or 3. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// + internal static RelativeVector4 GetRelativeVector4FromPtr(global::System.IntPtr cPtr) + { + RelativeVector4 ret = new RelativeVector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// Constructor + /// + public RelativeVector4() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// x component + /// y component + /// z component + /// w component + public RelativeVector4(float x, float y, float z, float w) : this(NDalicPINVOKE.new_Vector4__SWIG_1(x, y, z, w), true) + { + ValueCheck(x); + ValueCheck(y); + ValueCheck(z); + ValueCheck(W); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector2 to create this vector from + public RelativeVector4(RelativeVector2 relativeVector2) : this(NDalicPINVOKE.new_Vector4__SWIG_3(RelativeVector2.getCPtr(relativeVector2)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// RelativeVector3 to create this vector from + public RelativeVector4(RelativeVector3 relativeVector3) : this(NDalicPINVOKE.new_Vector4__SWIG_4(RelativeVector3.getCPtr(relativeVector3)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private RelativeVector4 Add(RelativeVector4 rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Add(swigCPtr, RelativeVector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector4 Subtract(RelativeVector4 rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector4 Multiply(RelativeVector4 rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector4 Multiply(float rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector4 Divide(RelativeVector4 rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, RelativeVector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private RelativeVector4 Divide(float rhs) + { + RelativeVector4 ret = new RelativeVector4(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is equal to + /// + /// The vector to compare + /// Returns true if the two vectors are equal, otherwise false + public bool EqualTo(RelativeVector4 rhs) + { + bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, RelativeVector4.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Compare if rhs is not equal to + /// + /// The vector to compare + /// Returns true if the two vectors are not equal, otherwise false + public bool NotEqualTo(RelativeVector4 rhs) + { + bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, RelativeVector4.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + /// + /// x component + /// + public float X + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector4_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector4_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// z component + /// + public float Z + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector4_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// w component + /// + public float W + { + set + { + ValueCheck(value); + NDalicPINVOKE.Vector4_W_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_W_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// + public static implicit operator Vector4(RelativeVector4 relativeVector4) + { + return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W); + } + + /// + /// + public static implicit operator RelativeVector4(Vector4 vec) + { + ValueCheck(vec.X); + ValueCheck(vec.Y); + ValueCheck(vec.Z); + ValueCheck(vec.W); + return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W); + } + + internal static void ValueCheck(RelativeVector4 relativeVector4) + { + if(relativeVector4.X < 0.0f) + { + relativeVector4.X = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector4.X > 1.0f) + { + relativeVector4.X = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector4.Y < 0.0f) + { + relativeVector4.Y = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector4.Y > 1.0f) + { + relativeVector4.Y = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector4.Z < 0.0f) + { + relativeVector4.Z = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector4.Z > 1.0f) + { + relativeVector4.Z = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + if(relativeVector4.W < 0.0f) + { + relativeVector4.W = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + else if(relativeVector4.W > 1.0f) + { + relativeVector4.W = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Result is invalid! Should be between [0, 1]."); + } + } + + internal static void ValueCheck(float value) + { + if(value < 0.0f) + { + value = 0.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + else if(value > 1.0f) + { + value = 1.0f; + Tizen.Log.Fatal("NUI", "The value of Parameters is invalid! Should be between [0, 1]."); + } + } + + } + +} + + diff --git a/src/Tizen.NUI/src/public/RelayoutContainer.cs b/src/Tizen.NUI/src/public/RelayoutContainer.cs new file mode 100755 index 0000000..dae6cc8 --- /dev/null +++ b/src/Tizen.NUI/src/public/RelayoutContainer.cs @@ -0,0 +1,121 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + /// + /// Interface to encapsulate information required for relayout. + /// + public class RelayoutContainer : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal RelayoutContainer(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RelayoutContainer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~RelayoutContainer() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// To make RelayoutContainer instance be disposed. + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RelayoutContainer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Adds relayout information to the container if it doesn't already exist. + /// + /// The view to relayout + /// The size to relayout + public virtual void Add(View view, Size2D size) + { + NDalicPINVOKE.RelayoutContainer_Add(swigCPtr, View.getCPtr(view), Size2D.getCPtr(size)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Renderer.cs b/src/Tizen.NUI/src/public/Renderer.cs new file mode 100755 index 0000000..6ff2db2 --- /dev/null +++ b/src/Tizen.NUI/src/public/Renderer.cs @@ -0,0 +1,468 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Renderer : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Renderer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Renderer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Renderer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Renderer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class Property + { + public static readonly int DEPTH_INDEX = NDalicPINVOKE.Renderer_Property_DEPTH_INDEX_get(); + public static readonly int FACE_CULLING_MODE = NDalicPINVOKE.Renderer_Property_FACE_CULLING_MODE_get(); + public static readonly int BLEND_MODE = NDalicPINVOKE.Renderer_Property_BLEND_MODE_get(); + public static readonly int BLEND_EQUATION_RGB = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_RGB_get(); + public static readonly int BLEND_EQUATION_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_EQUATION_ALPHA_get(); + public static readonly int BLEND_FACTOR_SRC_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_RGB_get(); + public static readonly int BLEND_FACTOR_DEST_RGB = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_RGB_get(); + public static readonly int BLEND_FACTOR_SRC_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_SRC_ALPHA_get(); + public static readonly int BLEND_FACTOR_DEST_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_FACTOR_DEST_ALPHA_get(); + public static readonly int BLEND_COLOR = NDalicPINVOKE.Renderer_Property_BLEND_COLOR_get(); + public static readonly int BLEND_PRE_MULTIPLIED_ALPHA = NDalicPINVOKE.Renderer_Property_BLEND_PRE_MULTIPLIED_ALPHA_get(); + public static readonly int INDEX_RANGE_FIRST = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_FIRST_get(); + public static readonly int INDEX_RANGE_COUNT = NDalicPINVOKE.Renderer_Property_INDEX_RANGE_COUNT_get(); + public static readonly int DEPTH_WRITE_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_WRITE_MODE_get(); + public static readonly int DEPTH_FUNCTION = NDalicPINVOKE.Renderer_Property_DEPTH_FUNCTION_get(); + public static readonly int DEPTH_TEST_MODE = NDalicPINVOKE.Renderer_Property_DEPTH_TEST_MODE_get(); + public static readonly int RENDER_MODE = NDalicPINVOKE.Renderer_Property_RENDER_MODE_get(); + public static readonly int STENCIL_FUNCTION = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_get(); + public static readonly int STENCIL_FUNCTION_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_MASK_get(); + public static readonly int STENCIL_FUNCTION_REFERENCE = NDalicPINVOKE.Renderer_Property_STENCIL_FUNCTION_REFERENCE_get(); + public static readonly int STENCIL_MASK = NDalicPINVOKE.Renderer_Property_STENCIL_MASK_get(); + public static readonly int STENCIL_OPERATION_ON_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_FAIL_get(); + public static readonly int STENCIL_OPERATION_ON_Z_FAIL = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_FAIL_get(); + public static readonly int STENCIL_OPERATION_ON_Z_PASS = NDalicPINVOKE.Renderer_Property_STENCIL_OPERATION_ON_Z_PASS_get(); + + } + + public Renderer(Geometry geometry, Shader shader) : this(NDalicPINVOKE.Renderer_New(Geometry.getCPtr(geometry), Shader.getCPtr(shader)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public void SetGeometry(Geometry geometry) + { + NDalicPINVOKE.Renderer_SetGeometry(swigCPtr, Geometry.getCPtr(geometry)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Geometry GetGeometry() + { + System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetGeometry(swigCPtr); + Geometry ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Geometry; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetIndexRange(int firstElement, int elementsCount) + { + NDalicPINVOKE.Renderer_SetIndexRange(swigCPtr, firstElement, elementsCount); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetTextures(TextureSet textureSet) + { + NDalicPINVOKE.Renderer_SetTextures(swigCPtr, TextureSet.getCPtr(textureSet)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TextureSet GetTextures() + { + System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetTextures(swigCPtr); + TextureSet ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as TextureSet; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetShader(Shader shader) + { + NDalicPINVOKE.Renderer_SetShader(swigCPtr, Shader.getCPtr(shader)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Shader GetShader() + { + System.IntPtr cPtr = NDalicPINVOKE.Renderer_GetShader(swigCPtr); + Shader ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Shader; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public int DepthIndex + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_INDEX, new Tizen.NUI.PropertyValue(value)); + } + } + public int FaceCullingMode + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.FACE_CULLING_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendMode + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_MODE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendEquationRgb + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_RGB, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendEquationAlpha + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_EQUATION_ALPHA, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendFactorSrcRgb + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_RGB, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendFactorDestRgb + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_RGB, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendFactorSrcAlpha + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_SRC_ALPHA, new Tizen.NUI.PropertyValue(value)); + } + } + public int BlendFactorDestAlpha + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_FACTOR_DEST_ALPHA, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector4 BlendColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_COLOR).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + public bool BlendPreMultipliedAlpha + { + get + { + bool temp = false; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.BLEND_PRE_MULTIPLIED_ALPHA, new Tizen.NUI.PropertyValue(value)); + } + } + public int IndexRangeFirst + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_FIRST, new Tizen.NUI.PropertyValue(value)); + } + } + public int IndexRangeCount + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.INDEX_RANGE_COUNT, new Tizen.NUI.PropertyValue(value)); + } + } + public int DepthWriteMode + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_WRITE_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public int DepthFunction + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_FUNCTION, new Tizen.NUI.PropertyValue(value)); + } + } + public int DepthTestMode + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.DEPTH_TEST_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public int RenderMode + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.RENDER_MODE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.RENDER_MODE, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilFunction + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilFunctionMask + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_MASK, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilFunctionReference + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_FUNCTION_REFERENCE, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilMask + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_MASK).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_MASK, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilOperationOnFail + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_FAIL, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilOperationOnZFail + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_FAIL, new Tizen.NUI.PropertyValue(value)); + } + } + public int StencilOperationOnZPass + { + get + { + int temp = 0; + Tizen.NUI.Object.GetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS).Get(out temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Renderer.Property.STENCIL_OPERATION_ON_Z_PASS, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Rotation.cs b/src/Tizen.NUI/src/public/Rotation.cs new file mode 100755 index 0000000..ff9cf98 --- /dev/null +++ b/src/Tizen.NUI/src/public/Rotation.cs @@ -0,0 +1,521 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// Rotation Class + /// + public class Rotation : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Rotation(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Rotation obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Rotation() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// To make Rotation instance be disposed. + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Rotation(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// First Rotation + /// Second Rotation + /// A Rotation containing the result of the Addition + public static Rotation operator +(Rotation arg1, Rotation arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// First Rotation + /// Second Rotation + /// A Rotation containing the result of the subtract + public static Rotation operator -(Rotation arg1, Rotation arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary Negation operator. + /// + /// First Rotation + /// A Rotation containing the negated result + public static Rotation operator -(Rotation arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// First Rotation + /// Second Rotation + /// A Rotation containing the result of the Multiplication + public static Rotation operator *(Rotation arg1, Rotation arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// Rotation + /// The vector to multiply + /// A Rotation containing the result of the multiplication + public static Vector3 operator *(Rotation arg1, Vector3 arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Scale operator. + /// + /// Rotation + /// A value to scale by + /// A Rotation containing the result of the scaling + public static Rotation operator *(Rotation arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// First Rotation + /// Second Rotation + /// A Rotation containing the result of the scaling + public static Rotation operator /(Rotation arg1, Rotation arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Scale operator. + /// + /// Rotation + /// A value to scale by + /// A Rotation containing the result of the scaling + public static Rotation operator /(Rotation arg1, float arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Default Constructor. + /// + public Rotation() : this(NDalicPINVOKE.new_Rotation__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor from an axis and angle. + /// + /// The angle around the axis + /// The vector of the axis + public Rotation(Radian angle, Vector3 axis) : this(NDalicPINVOKE.new_Rotation__SWIG_1(Radian.getCPtr(angle), Vector3.getCPtr(axis)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// (0.0f,0.0f,0.0f,1.0f) + /// + public static Rotation IDENTITY + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Rotation_IDENTITY_get(); + Rotation ret = (cPtr == global::System.IntPtr.Zero) ? null : new Rotation(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Helper to check if this is an identity quaternion. + /// + /// True if this is identity quaternion + public bool IsIdentity() + { + bool ret = NDalicPINVOKE.Rotation_IsIdentity(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Converts the quaternion to an axis/angle pair. + /// + /// the result of axis + /// the result of angle Angle in radians + /// True if converted correctly + public bool GetAxisAngle(Vector3 axis, Radian angle) + { + bool ret = NDalicPINVOKE.Rotation_GetAxisAngle(swigCPtr, Vector3.getCPtr(axis), Radian.getCPtr(angle)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Add(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Add(swigCPtr, Rotation.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Subtract(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Multiply(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Multiply(Vector3 other) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Rotation_Multiply__SWIG_1(swigCPtr, Vector3.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Divide(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_0(swigCPtr, Rotation.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Multiply(float scale) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Multiply__SWIG_2(swigCPtr, scale), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Divide(float scale) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Divide__SWIG_1(swigCPtr, scale), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation Subtract() + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation AddAssign(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_AddAssign(swigCPtr, Rotation.getCPtr(other)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation SubtractAssign(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SubtractAssign(swigCPtr, Rotation.getCPtr(other)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation MultiplyAssign(Rotation other) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_0(swigCPtr, Rotation.getCPtr(other)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation MultiplyAssign(float scale) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_MultiplyAssign__SWIG_1(swigCPtr, scale), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Rotation DivideAssign(float scale) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_DivideAssign(swigCPtr, scale), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool EqualTo(Rotation rhs) + { + bool ret = NDalicPINVOKE.Rotation_EqualTo(swigCPtr, Rotation.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool NotEqualTo(Rotation rhs) + { + bool ret = NDalicPINVOKE.Rotation_NotEqualTo(swigCPtr, Rotation.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the rotation + /// + /// The length of the rotation + public float Length() + { + float ret = NDalicPINVOKE.Rotation_Length(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the squared length of the rotation + /// + /// The squared length of the rotation + public float LengthSquared() + { + float ret = NDalicPINVOKE.Rotation_LengthSquared(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Normalizes this to unit length. + /// + public void Normalize() + { + NDalicPINVOKE.Rotation_Normalize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Normalized. + /// + /// A normalized version of this rotation + public Rotation Normalized() + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Normalized(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Conjugates this rotation. + /// + public void Conjugate() + { + NDalicPINVOKE.Rotation_Conjugate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Inverts this rotation. + /// + public void Invert() + { + NDalicPINVOKE.Rotation_Invert(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Performs the logarithm of a rotation + /// + /// A rotation representing the logarithm + public Rotation Log() + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Log(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Performs an exponent + /// + /// A rotation representing the exponent + public Rotation Exp() + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Exp(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the dot product of two rotations. + /// + /// The first rotation + /// The second rotation + /// The dot product of the two rotations + public static float Dot(Rotation q1, Rotation q2) + { + float ret = NDalicPINVOKE.Rotation_Dot(Rotation.getCPtr(q1), Rotation.getCPtr(q2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Linear Interpolation (using a straight line between the two rotations). + /// + /// The start rotation + /// The end rotation + /// A progress value between 0 and 1 + /// The interpolated rotation + public static Rotation Lerp(Rotation q1, Rotation q2, float t) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Lerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Spherical Linear Interpolation (using the shortest arc of a great circle between the two rotations). + /// + /// The start rotation + /// The end rotation + /// A progress value between 0 and 1 + /// The interpolated rotation + public static Rotation Slerp(Rotation q1, Rotation q2, float progress) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Slerp(Rotation.getCPtr(q1), Rotation.getCPtr(q2), progress), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// This version of Slerp, used by Squad, does not check for theta > 90. + /// + /// The start rotation + /// The end rotation + /// A progress value between 0 and 1 + /// The interpolated rotation + public static Rotation SlerpNoInvert(Rotation q1, Rotation q2, float t) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_SlerpNoInvert(Rotation.getCPtr(q1), Rotation.getCPtr(q2), t), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Spherical Cubic Interpolation. + /// + /// The start rotation + /// The end rotation + /// The control rotation for q1 + /// The control rotation for q2 + /// A progress value between 0 and 1 + /// The interpolated rotation + public static Rotation Squad(Rotation start, Rotation end, Rotation ctrl1, Rotation ctrl2, float t) + { + Rotation ret = new Rotation(NDalicPINVOKE.Rotation_Squad(Rotation.getCPtr(start), Rotation.getCPtr(end), Rotation.getCPtr(ctrl1), Rotation.getCPtr(ctrl2), t), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the shortest angle between two rotations in Radians. + /// + /// The first rotation + /// The second rotation + /// The angle between the two rotation + public static float AngleBetween(Rotation q1, Rotation q2) + { + float ret = NDalicPINVOKE.Rotation_AngleBetween(Rotation.getCPtr(q1), Rotation.getCPtr(q2)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Sampler.cs b/src/Tizen.NUI/src/public/Sampler.cs new file mode 100755 index 0000000..c1ed5ed --- /dev/null +++ b/src/Tizen.NUI/src/public/Sampler.cs @@ -0,0 +1,94 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Sampler : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Sampler(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Sampler_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Sampler obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Sampler(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public Sampler() : this(NDalicPINVOKE.Sampler_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public void SetFilterMode(FilterModeType minFilter, FilterModeType magFilter) + { + NDalicPINVOKE.Sampler_SetFilterMode(swigCPtr, (int)minFilter, (int)magFilter); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetWrapMode(WrapModeType uWrap, WrapModeType vWrap) + { + NDalicPINVOKE.Sampler_SetWrapMode__SWIG_0(swigCPtr, (int)uWrap, (int)vWrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetWrapMode(WrapModeType rWrap, WrapModeType sWrap, WrapModeType tWrap) + { + NDalicPINVOKE.Sampler_SetWrapMode__SWIG_1(swigCPtr, (int)rWrap, (int)sWrap, (int)tWrap); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/ScrollViewEffect.cs b/src/Tizen.NUI/src/public/ScrollViewEffect.cs new file mode 100755 index 0000000..89d9762 --- /dev/null +++ b/src/Tizen.NUI/src/public/ScrollViewEffect.cs @@ -0,0 +1,75 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class ScrollViewEffect : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ScrollViewEffect(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollViewEffect_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollViewEffect obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollViewEffect(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public ScrollViewEffect() : this(NDalicPINVOKE.new_ScrollViewEffect(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Shader.cs b/src/Tizen.NUI/src/public/Shader.cs new file mode 100755 index 0000000..317e9ce --- /dev/null +++ b/src/Tizen.NUI/src/public/Shader.cs @@ -0,0 +1,108 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Shader : Animatable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Shader(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Shader_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Shader obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Shader(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public class Hint + { + public enum Value + { + NONE = 0x00, + OUTPUT_IS_TRANSPARENT = 0x01, + MODIFIES_GEOMETRY = 0x02 + } + } + + public class Property + { + public static readonly int PROGRAM = NDalicPINVOKE.Shader_Property_PROGRAM_get(); + } + + public Shader(string vertexShader, string fragmentShader, Shader.Hint.Value hints) : this(NDalicPINVOKE.Shader_New__SWIG_0(vertexShader, fragmentShader, (int)hints), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public Shader(string vertexShader, string fragmentShader) : this(NDalicPINVOKE.Shader_New__SWIG_1(vertexShader, fragmentShader), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public Tizen.NUI.PropertyMap Program + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + Tizen.NUI.Object.GetProperty(swigCPtr, Shader.Property.PROGRAM).Get(temp); + return temp; + } + set + { + Tizen.NUI.Object.SetProperty(swigCPtr, Shader.Property.PROGRAM, new Tizen.NUI.PropertyValue(value)); + } + } + } + +} diff --git a/src/Tizen.NUI/src/public/Size2D.cs b/src/Tizen.NUI/src/public/Size2D.cs new file mode 100755 index 0000000..13006b4 --- /dev/null +++ b/src/Tizen.NUI/src/public/Size2D.cs @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +namespace Tizen.NUI +{ + + /// + /// A two dimensional size + /// + public class Size2D : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Size2D(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Size2D obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Size2D() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + /// + /// Dispose + /// + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator for A+B + /// + /// Size, A + /// Size to assign, B + /// A Size containing the result of the addition + public static Size2D operator +(Size2D arg1, Size2D arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator for A-B + /// + /// Size, A + /// Size to subtract, B + /// A Size containing the result of the subtraction + public static Size2D operator -(Size2D arg1, Size2D arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Size for unary negation + /// A Size containg the negation + public static Size2D operator -(Size2D arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// Size for multiplication + /// The Size to multipl + /// A Size containing the result of the multiplication + public static Size2D operator *(Size2D arg1, Size2D arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// Size for multiplication + /// The int value to scale the Size + /// A Size containing the result of the scaling + + public static Size2D operator *(Size2D arg1, int arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// Size for division + /// The Size to divide + /// A Size containing the result of the division> + public static Size2D operator /(Size2D arg1, Size2D arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// Size for division + /// The int value to scale the Size by + /// A Size containing the result of the scaling + public static Size2D operator /(Size2D arg1, int arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Array subscript operator. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + /// + /// Get Size from pointer. + /// + /// Pointer of the Size + /// Size + internal static Size2D GetSize2DFromPtr(global::System.IntPtr cPtr) + { + Size2D ret = new Size2D(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Constructor. + /// + public Size2D() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// x (or width) component + /// y (or height) component + public Size2D(int x, int y) : this(NDalicPINVOKE.new_Vector2__SWIG_1((float)x, (float)y), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private Size2D Add(Size2D rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Add(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Subtract(Size2D rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Size2D Multiply(Size2D rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Multiply(int rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + + private Size2D Divide(Size2D rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Size2D.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Divide(int rhs) + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, (float)rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Size2D Subtract() + { + Size2D ret = new Size2D(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check equality.
+ /// Utilizes appropriate machine epsilon values.
+ ///
+ /// The Size to test against + /// True if the Sizes are equal + public bool EqualTo(Size2D rhs) + { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Size2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Check inequality.
+ /// Utilizes appropriate machine epsilon values.
+ ///
+ /// The Size to test against + /// True if the Sizes are not equal + public bool NotEqualTo(Size2D rhs) + { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Size2D.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private int ValueOfIndex(uint index) + { + int ret = (int)NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Property for width component of Size + /// + public int Width + { + set + { + NDalicPINVOKE.Vector2_Width_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + /// + /// Property for height component of Size + /// + public int Height + { + set + { + NDalicPINVOKE.Vector2_Height_set(swigCPtr, (float)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return (int)ret; + } + } + + /// + /// Type cast operator, Size2D to Vector2. + /// + /// Object of Size2D type + public static implicit operator Vector2(Size2D size) + { + return new Vector2((float)size.Width, (float)size.Height); + } + + /// + /// Type cast operator, Vector2 to Size2D type. + /// + /// Object of Vector2 type + public static implicit operator Size2D(Vector2 vec) + { + return new Size2D((int)vec.X, (int)vec.Y); + } + + /// + /// Type cast operator, Size2D to Uint16Pair. + /// + /// Object of Size2D type + public static implicit operator Uint16Pair(Size2D size2d) + { + return new Uint16Pair((uint)size2d.Width, (uint)size2d.Height); + } + + /// + /// Type cast operator, Uint16Pair to Size2D type. + /// + /// Object of Vector2 type + public static implicit operator Size2D(Uint16Pair pair) + { + return new Size2D((int)pair.GetWidth(), (int)pair.GetWidth()); + } + + + } + +} + diff --git a/src/Tizen.NUI/src/public/StyleManager.cs b/src/Tizen.NUI/src/public/StyleManager.cs new file mode 100755 index 0000000..960b5f4 --- /dev/null +++ b/src/Tizen.NUI/src/public/StyleManager.cs @@ -0,0 +1,255 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// StyleManager informs applications of system theme change, and supports application theme change at runtime.
+ /// Applies various styles to Controls using the properties system.
+ /// On theme change, it automatically updates all controls, then raises a event to inform the application.
+ /// If the application wants to customize the theme, RequestThemeChange needs to be called.
+ /// It provides the path to the application resource root folder, from there the filename can an be specified along with any sub folders, e.g Images, Models etc.
+ ///
+ public class StyleManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal StyleManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.StyleManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(StyleManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_StyleManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Style changed event arguments + /// + public class StyleChangedEventArgs : EventArgs + { + private StyleManager _styleManager; + private StyleChangeType _styleChange; + + /// + /// StyleManager. + /// + public StyleManager StyleManager + { + get + { + return _styleManager; + } + set + { + _styleManager = value; + } + } + + /// + /// StyleChange - contains Style change information (default font changed or + /// default font size changed or theme has changed).
+ ///
+ public StyleChangeType StyleChange + { + get + { + return _styleChange; + } + set + { + _styleChange = value; + } + } + + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void StyleChangedCallbackDelegate(IntPtr styleManager, Tizen.NUI.StyleChangeType styleChange); + private EventHandler _styleManagerStyleChangedEventHandler; + private StyleChangedCallbackDelegate _styleManagerStyleChangedCallbackDelegate; + + /// + /// Event for StyleChanged signal which can be used to subscribe/unsubscribe the + /// event handler provided by the user.
+ /// StyleChanged signal is is emitted after the style (e.g. theme/font change) has changed + /// and the controls have been informed.
+ ///
+ public event EventHandler StyleChanged + { + add + { + if (_styleManagerStyleChangedEventHandler == null) + { + _styleManagerStyleChangedCallbackDelegate = (OnStyleChanged); + StyleChangedSignal().Connect(_styleManagerStyleChangedCallbackDelegate); + } + _styleManagerStyleChangedEventHandler += value; + } + remove + { + _styleManagerStyleChangedEventHandler -= value; + if (_styleManagerStyleChangedEventHandler == null && StyleChangedSignal().Empty() == false) + { + StyleChangedSignal().Disconnect(_styleManagerStyleChangedCallbackDelegate); + } + } + } + + // Callback for StyleManager StyleChangedsignal + private void OnStyleChanged(IntPtr styleManager, StyleChangeType styleChange) + { + StyleChangedEventArgs e = new StyleChangedEventArgs(); + + // Populate all members of "e" (StyleChangedEventArgs) with real data + e.StyleManager = Registry.GetManagedBaseHandleFromNativePtr(styleManager) as StyleManager; + e.StyleChange = styleChange; + + if (_styleManagerStyleChangedEventHandler != null) + { + //here we send all data to user event handlers + _styleManagerStyleChangedEventHandler(this, e); + } + } + + /// + /// Creates a StyleManager handle.
+ /// this can be initialized with StyleManager::Get().
+ ///
+ public StyleManager() : this(NDalicPINVOKE.new_StyleManager(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the singleton of StyleManager object. + /// + /// A handle to the StyleManager control + public static StyleManager Get() + { + StyleManager ret = new StyleManager(NDalicPINVOKE.StyleManager_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Applies a new theme to the application.
+ /// This will be merged on top of the default Toolkit theme.
+ /// If the application theme file doesn't style all controls that the + /// application uses, then the default Toolkit theme will be used + /// instead for those controls.
+ ///
+ /// A relative path is specified for style theme + public void ApplyTheme(string themeFile) + { + NDalicPINVOKE.StyleManager_ApplyTheme(swigCPtr, themeFile); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Applies the default Toolkit theme. + /// + public void ApplyDefaultTheme() + { + NDalicPINVOKE.StyleManager_ApplyDefaultTheme(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets a constant for use when building styles. + /// + /// The key of the constant + /// The value of the constant + public void AddConstant(string key, PropertyValue value) + { + NDalicPINVOKE.StyleManager_SetStyleConstant(swigCPtr, key, PropertyValue.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns the style constant set for a specific key. + /// + /// The key of the constant + /// The value of the constant if it exists + /// + public bool GetConstant(string key, PropertyValue valueOut) + { + bool ret = NDalicPINVOKE.StyleManager_GetStyleConstant(swigCPtr, key, PropertyValue.getCPtr(valueOut)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Applies the specified style to the control. + /// + /// The control to which to apply the style + /// The name of the JSON style file to apply + /// The name of the style within the JSON file to apply + public void ApplyStyle(View control, string jsonFileName, string styleName) + { + NDalicPINVOKE.StyleManager_ApplyStyle(swigCPtr, View.getCPtr(control), jsonFileName, styleName); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal StyleChangedSignal StyleChangedSignal() + { + StyleChangedSignal ret = new StyleChangedSignal(NDalicPINVOKE.StyleManager_StyleChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } +} diff --git a/src/Tizen.NUI/src/public/TTSPlayer.cs b/src/Tizen.NUI/src/public/TTSPlayer.cs new file mode 100755 index 0000000..ec2b788 --- /dev/null +++ b/src/Tizen.NUI/src/public/TTSPlayer.cs @@ -0,0 +1,282 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using System; + using System.Runtime.InteropServices; + + /// + /// The Text-to-speech (TTS) Player. + /// + public class TTSPlayer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TTSPlayer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.TtsPlayer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TTSPlayer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_TtsPlayer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal TTSPlayer() : this(NDalicManualPINVOKE.new_TtsPlayer__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the singleton of the TtsPlayer for the given mode. + /// + /// The mode of tts-player. + /// A handle of the Ttsplayer for the given mode. + public static TTSPlayer Get(TTSMode mode) + { + TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Get__SWIG_0((int)mode), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the singleton of the TtsPlayer for the default mode.. + /// + /// A handle of the Ttsplayer for the default mode. + public static TTSPlayer Get() + { + TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Get__SWIG_1(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TTSPlayer(TTSPlayer handle) : this(NDalicManualPINVOKE.new_TtsPlayer__SWIG_1(TTSPlayer.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal TTSPlayer Assign(TTSPlayer rhs) + { + TTSPlayer ret = new TTSPlayer(NDalicManualPINVOKE.TtsPlayer_Assign(swigCPtr, TTSPlayer.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Starts playing the audio data synthesized from the specified text. + /// + /// The text to play. + /// The TtsPlayer needs to be initialized. + public void Play(string text) + { + NDalicManualPINVOKE.TtsPlayer_Play(swigCPtr, text); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Stops playing the utterance. + /// + /// The TtsPlayer needs to be initialized. + public void Stop() + { + NDalicManualPINVOKE.TtsPlayer_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Pauses the currently playing utterance. + /// + /// The TtsPlayer needs to be initialized. + public void Pause() + { + NDalicManualPINVOKE.TtsPlayer_Pause(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Resumes the previously paused utterance. + /// + /// The TtsPlayer needs to be initialized. + public void Resume() + { + NDalicManualPINVOKE.TtsPlayer_Resume(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets the current state of the player. + /// + /// The current TTS state. + /// The TtsPlayer needs to be initialized. + public TTSState GetState() + { + TTSState ret = (TTSState)NDalicManualPINVOKE.TtsPlayer_GetState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// State changed argument. + /// + public class StateChangedEventArgs : EventArgs + { + public TTSState PrevState + { + get; + set; + } + + public TTSState NextState + { + get; + set; + } + } + + private StateChangedEventCallbackType _stateChangedEventCallback; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void StateChangedEventCallbackType(TTSState prevState, TTSState nextState); + private event EventHandler _stateChangedEventHandler; + + /// + /// State changed event. + /// + public event EventHandler StateChanged + { + add + { + if (_stateChangedEventHandler == null) + { + _stateChangedEventCallback = OnStateChanged; + StateChangedSignal().Connect(_stateChangedEventCallback); + } + + _stateChangedEventHandler += value; + } + remove + { + _stateChangedEventHandler -= value; + + if (_stateChangedEventHandler == null && StateChangedSignal().Empty() == false && _stateChangedEventCallback != null) + { + StateChangedSignal().Disconnect(_stateChangedEventCallback); + } + } + } + + private void OnStateChanged(TTSState prevState, TTSState nextState) + { + StateChangedEventArgs e = new StateChangedEventArgs(); + + e.PrevState = prevState; + e.NextState = nextState; + + if (_stateChangedEventHandler != null) + { + _stateChangedEventHandler(this, e); + } + } + + internal StateChangedSignalType StateChangedSignal() + { + StateChangedSignalType ret = new StateChangedSignalType(NDalicManualPINVOKE.TtsPlayer_StateChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Enumeration for the instance of TTS mode. + /// + public enum TTSMode + { + /// + /// Default mode for normal application. + /// + Default = 0, + /// + /// Notification mode, such as playing utterance is started or completed. + /// + Notification, + /// + /// Screen reader mode.
+ /// To help visually impaired users interact with their devices,
+ /// screen reader reads text or graphic elements on the screen using the TTS engine. + ///
+ ScreenReader, + /// + /// Number of Mode. + /// + ModeNum + } + + /// + /// Enumeration for the instance of TTS state. + /// + public enum TTSState + { + /// + /// Player is not available. + /// + Unavailable = 0, + /// + /// Player is ready to play. + /// + Ready, + /// + /// Player is playing. + /// + Playing, + /// + /// Player is paused. + /// + Paused + } + + } + +} diff --git a/src/Tizen.NUI/src/public/TapGesture.cs b/src/Tizen.NUI/src/public/TapGesture.cs new file mode 100755 index 0000000..3bcbcb8 --- /dev/null +++ b/src/Tizen.NUI/src/public/TapGesture.cs @@ -0,0 +1,201 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A TapGesture is emitted when the user taps the screen with the stated number of fingers a stated number of times. + /// + public class TapGesture : Gesture + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TapGesture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TapGesture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TapGesture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TapGesture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + /// + /// Get TapGesture from the pointer. + /// + /// The pointer to cast + /// TapGesture object + internal static TapGesture GetTapGestureFromPtr(global::System.IntPtr cPtr) + { + TapGesture ret = new TapGesture(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Number of taps property (read-only). + /// + public uint NumberOfTaps + { + get + { + return numberOfTaps; + } + } + + /// + /// Number of touches property (read-only). + /// + public uint NumberOfTouches + { + get + { + return numberOfTouches; + } + } + + /// + /// Screen point property (read-only). + /// + public Vector2 ScreenPoint + { + get + { + return screenPoint; + } + } + + /// + /// Local point property (read-only). + /// + public Vector2 LocalPoint + { + get + { + return localPoint; + } + } + + /// + /// Creates a TapGesture. + /// + public TapGesture() : this(NDalicPINVOKE.new_TapGesture__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + private uint numberOfTaps + { + set + { + NDalicPINVOKE.TapGesture_numberOfTaps_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TapGesture_numberOfTaps_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint numberOfTouches + { + set + { + NDalicPINVOKE.TapGesture_numberOfTouches_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.TapGesture_numberOfTouches_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 screenPoint + { + set + { + NDalicPINVOKE.TapGesture_screenPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TapGesture_screenPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 localPoint + { + set + { + NDalicPINVOKE.TapGesture_localPoint_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.TapGesture_localPoint_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Texture.cs b/src/Tizen.NUI/src/public/Texture.cs new file mode 100755 index 0000000..2503ca5 --- /dev/null +++ b/src/Tizen.NUI/src/public/Texture.cs @@ -0,0 +1,119 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class Texture : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Texture(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Texture_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Texture obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Texture(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public Texture(TextureType type, PixelFormat format, uint width, uint height) : this(NDalicPINVOKE.Texture_New__SWIG_0((int)type, (int)format, width, height), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal Texture(NativeImageInterface nativeImageInterface) : this(NDalicPINVOKE.Texture_New__SWIG_1(NativeImageInterface.getCPtr(nativeImageInterface)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public bool Upload(PixelData pixelData) + { + bool ret = NDalicPINVOKE.Texture_Upload__SWIG_0(swigCPtr, PixelData.getCPtr(pixelData)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool Upload(PixelData pixelData, uint layer, uint mipmap, uint xOffset, uint yOffset, uint width, uint height) + { + bool ret = NDalicPINVOKE.Texture_Upload__SWIG_1(swigCPtr, PixelData.getCPtr(pixelData), layer, mipmap, xOffset, yOffset, width, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void GenerateMipmaps() + { + NDalicPINVOKE.Texture_GenerateMipmaps(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint GetWidth() + { + uint ret = NDalicPINVOKE.Texture_GetWidth(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetHeight() + { + uint ret = NDalicPINVOKE.Texture_GetHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Texture(SWIGTYPE_p_Dali__Internal__Texture pointer) : this(NDalicPINVOKE.new_Texture__SWIG_2(SWIGTYPE_p_Dali__Internal__Texture.getCPtr(pointer)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/TextureSet.cs b/src/Tizen.NUI/src/public/TextureSet.cs new file mode 100755 index 0000000..cbb0394 --- /dev/null +++ b/src/Tizen.NUI/src/public/TextureSet.cs @@ -0,0 +1,112 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class TextureSet : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TextureSet(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TextureSet_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TextureSet obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TextureSet(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public TextureSet() : this(NDalicPINVOKE.TextureSet_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public void SetTexture(uint index, Texture texture) + { + NDalicPINVOKE.TextureSet_SetTexture(swigCPtr, index, Texture.getCPtr(texture)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Texture GetTexture(uint index) + { + System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetTexture(swigCPtr, index); + Texture ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Texture; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetSampler(uint index, Sampler sampler) + { + NDalicPINVOKE.TextureSet_SetSampler(swigCPtr, index, Sampler.getCPtr(sampler)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Sampler GetSampler(uint index) + { + System.IntPtr cPtr = NDalicPINVOKE.TextureSet_GetSampler(swigCPtr, index); + Sampler ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Sampler; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetTextureCount() + { + uint ret = NDalicPINVOKE.TextureSet_GetTextureCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/TextureType.cs b/src/Tizen.NUI/src/public/TextureType.cs new file mode 100755 index 0000000..f86151e --- /dev/null +++ b/src/Tizen.NUI/src/public/TextureType.cs @@ -0,0 +1,25 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + public enum TextureType + { + TEXTURE_2D, + TEXTURE_CUBE + } + +} diff --git a/src/Tizen.NUI/src/public/Timer.cs b/src/Tizen.NUI/src/public/Timer.cs new file mode 100755 index 0000000..41c9b7a --- /dev/null +++ b/src/Tizen.NUI/src/public/Timer.cs @@ -0,0 +1,210 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + + /// + /// Mechanism to issue simple periodic or one-shot events.
+ /// Timer is provided for application developers to be able to issue + /// simple periodic or one-shot events. Please note that timer + /// callback functions should return as soon as possible, because they + /// block the next SignalTick. Please note that timer signals are not + /// in sync with Dali's render timer.
+ /// This class is a handle class so it can be stack allocated and used + /// as a member.
+ ///
+ public class Timer : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Timer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Timer_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Timer obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Timer(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + /// + /// Event arguments that passed via Tick event. + /// + public class TickEventArgs : EventArgs + { + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool TickCallbackDelegate(IntPtr data); + private EventHandlerWithReturnType _timerTickEventHandler; + private TickCallbackDelegate _timerTickCallbackDelegate; + + /// + /// brief Event for Ticked signal which can be used to subscribe/unsubscribe the event handler + /// (in the type of TickEventHandler-DaliEventHandlerWithReturnType).
+ /// provided by the user. Ticked signal is emitted after specified time interval.
+ ///
+ public event EventHandlerWithReturnType Tick + { + add + { + if (_timerTickEventHandler == null) + { + _timerTickCallbackDelegate = (OnTick); + TickSignal().Connect(_timerTickCallbackDelegate); + } + _timerTickEventHandler += value; + } + remove + { + _timerTickEventHandler -= value; + if (_timerTickEventHandler == null && TickSignal().Empty() == false) + { + TickSignal().Disconnect(_timerTickCallbackDelegate); + } + } + } + + private bool OnTick(IntPtr data) + { + TickEventArgs e = new TickEventArgs(); + + if (_timerTickEventHandler != null) + { + //here we send all data to user event handlers + return _timerTickEventHandler(this, e); + } + return false; + } + + /// + /// Creates a tick Timer that emits periodic signal. + /// + /// Interval in milliseconds + /// A new timer + public Timer(uint milliSec) : this(NDalicPINVOKE.Timer_New(milliSec), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal Timer(Timer timer) : this(NDalicPINVOKE.new_Timer__SWIG_1(Timer.getCPtr(timer)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + [Obsolete("Please do not use! this will be deprecated")] + public static Timer DownCast(BaseHandle handle) + { + Timer ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Timer; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Starts timer.
+ /// In case a Timer is already running, its time is reset and timer is restarted.
+ ///
+ public void Start() + { + NDalicPINVOKE.Timer_Start(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Stops timer. + /// + public void Stop() + { + NDalicPINVOKE.Timer_Stop(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Sets a new interval on the timer and starts the timer.
+ /// Cancels the previous timer.
+ ///
+ /// milliSec Interval in milliseconds + internal void SetInterval(uint milliSec) + { + NDalicPINVOKE.Timer_SetInterval(swigCPtr, milliSec); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal uint GetInterval() + { + uint ret = NDalicPINVOKE.Timer_GetInterval(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Tells whether timer is running. + /// + /// Whether Timer is started or not + public bool IsRunning() + { + bool ret = NDalicPINVOKE.Timer_IsRunning(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TimerSignalType TickSignal() + { + TimerSignalType ret = new TimerSignalType(NDalicPINVOKE.Timer_TickSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Touch.cs b/src/Tizen.NUI/src/public/Touch.cs new file mode 100755 index 0000000..a181fb5 --- /dev/null +++ b/src/Tizen.NUI/src/public/Touch.cs @@ -0,0 +1,243 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + using Tizen.NUI.BaseComponents; + /// + /// Touch events are a collection of points at a specific moment in time.
+ /// When a multi-touch event occurs, each point represents the points that are currently being + /// touched or the points where a touch has stopped.
+ ///
+ public class Touch : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Touch(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Touch_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Touch obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Touch(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal static Touch GetTouchFromPtr(global::System.IntPtr cPtr) + { + Touch ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Touch; + if (ret == null) + { + ret = new Touch(cPtr, false); + } + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// An uninitialized Touch instance.
+ /// Calling member functions with an uninitialized Touch handle is not allowed.
+ ///
+ public Touch() : this(NDalicPINVOKE.new_Touch__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Touch(Touch other) : this(NDalicPINVOKE.new_Touch__SWIG_1(Touch.getCPtr(other)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns the time (in ms) that the touch event occurred. + /// + /// The time (in ms) that the touch event occurred + public uint GetTime() + { + uint ret = NDalicPINVOKE.Touch_GetTime(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the total number of points in this TouchData. + /// + /// Total number of Points + public uint GetPointCount() + { + uint ret = NDalicPINVOKE.Touch_GetPointCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the ID of the device used for the Point specified.
+ /// Each point has a unique device ID which specifies the device used for that + /// point. This is returned by this method.
+ /// If point is greater than GetPointCount() then this method will return -1.
+ ///
+ /// The point required + /// The Device ID of this point + public int GetDeviceId(uint point) + { + int ret = NDalicPINVOKE.Touch_GetDeviceId(swigCPtr, point); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the State of the point specified.
+ /// If point is greater than GetPointCount() then this method will return PointState.Finished.
+ ///
+ /// The point required + /// The state of the point specified + public PointStateType GetState(uint point) + { + PointStateType ret = (PointStateType)NDalicPINVOKE.Touch_GetState(swigCPtr, point); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the actor that was underneath the point specified.
+ /// If point is greater than GetPointCount() then this method will return an empty handle.
+ ///
+ /// The point required + /// The actor that was underneath the point specified + public View GetHitView(uint point) + { + global::System.IntPtr cPtr = NDalicPINVOKE.Touch_GetHitActor(swigCPtr, point); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the co-ordinates relative to the top-left of the hit-actor at the point specified.
+ /// The top-left of an actor is (0.0, 0.0, 0.5).
+ /// If you require the local coordinates of another actor (e.g the parent of the hit actor), + /// then you should use Actor::ScreenToLocal().
+ /// If point is greater than GetPointCount() then this method will return Vector2.Zero.
+ ///
+ /// The point required + /// The co-ordinates relative to the top-left of the hit-actor of the point specified + public Vector2 GetLocalPosition(uint point) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetLocalPosition(swigCPtr, point), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the co-ordinates relative to the top-left of the screen of the point specified.
+ /// If point is greater than GetPointCount() then this method will return Vector2.Zero.
+ ///
+ /// The point required + /// The co-ordinates relative to the top-left of the screen of the point specified + public Vector2 GetScreenPosition(uint point) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetScreenPosition(swigCPtr, point), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the radius of the press point.
+ /// This is the average of both the horizontal and vertical radii of the press point.
+ /// If point is greater than GetPointCount() then this method will return 0.0f.
+ ///
+ /// The point required + /// The radius of the press point + public float GetRadius(uint point) + { + float ret = NDalicPINVOKE.Touch_GetRadius(swigCPtr, point); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves BOTH the horizontal and the vertical radii of the press point.
+ /// If point is greater than GetPointCount() then this method will return Vector2.Zero.
+ ///
+ /// The point required + /// The horizontal and vertical radii of the press point + public Vector2 GetEllipseRadius(uint point) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Touch_GetEllipseRadius(swigCPtr, point), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Retrieves the touch pressure.
+ /// The pressure range starts at 0.0f.
+ /// Normal pressure is defined as 1.0f.
+ /// A value between 0.0f and 1.0f means light pressure has been applied.
+ /// A value greater than 1.0f means more pressure than normal has been applied.
+ /// If point is greater than GetPointCount() then this method will return 1.0f.
+ ///
+ /// point The point required + /// The touch pressure + public float GetPressure(uint point) + { + float ret = NDalicPINVOKE.Touch_GetPressure(swigCPtr, point); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Degree GetAngle(uint point) + { + Degree ret = new Degree(NDalicPINVOKE.Touch_GetAngle(swigCPtr, point), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } +} diff --git a/src/Tizen.NUI/src/public/TransitionData.cs b/src/Tizen.NUI/src/public/TransitionData.cs new file mode 100755 index 0000000..b3611a0 --- /dev/null +++ b/src/Tizen.NUI/src/public/TransitionData.cs @@ -0,0 +1,103 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class TransitionData : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TransitionData(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TransitionData_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TransitionData obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TransitionData(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public TransitionData(PropertyMap transition) : this(NDalicPINVOKE.TransitionData_New__SWIG_0(PropertyMap.getCPtr(transition)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + public TransitionData(PropertyArray transition) : this(NDalicPINVOKE.TransitionData_New__SWIG_1(PropertyArray.getCPtr(transition)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public TransitionData(TransitionData handle) : this(NDalicPINVOKE.new_TransitionData__SWIG_1(TransitionData.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public uint Count() + { + uint ret = NDalicPINVOKE.TransitionData_Count(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public PropertyMap GetAnimatorAt(uint index) + { + PropertyMap ret = new PropertyMap(NDalicPINVOKE.TransitionData_GetAnimatorAt(swigCPtr, index), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TransitionData(SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData impl) : this(NDalicPINVOKE.new_TransitionData__SWIG_2(SWIGTYPE_p_Dali__Toolkit__Internal__TransitionData.getCPtr(impl)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/TypeInfo.cs b/src/Tizen.NUI/src/public/TypeInfo.cs new file mode 100755 index 0000000..0583ffe --- /dev/null +++ b/src/Tizen.NUI/src/public/TypeInfo.cs @@ -0,0 +1,114 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + public class TypeInfo : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal TypeInfo(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.TypeInfo_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(TypeInfo obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_TypeInfo(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + public TypeInfo() : this(NDalicPINVOKE.new_TypeInfo__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public TypeInfo(TypeInfo handle) : this(NDalicPINVOKE.new_TypeInfo__SWIG_1(TypeInfo.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public string GetName() + { + string ret = NDalicPINVOKE.TypeInfo_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetBaseName() + { + string ret = NDalicPINVOKE.TypeInfo_GetBaseName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public BaseHandle CreateInstance() + { + BaseHandle ret = new BaseHandle(NDalicPINVOKE.TypeInfo_CreateInstance(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetPropertyCount() + { + uint ret = NDalicPINVOKE.TypeInfo_GetPropertyCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public string GetPropertyName(int index) + { + string ret = NDalicPINVOKE.TypeInfo_GetPropertyName(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs new file mode 100755 index 0000000..a67858d --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs @@ -0,0 +1,732 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +namespace Tizen.NUI.UIComponents +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// Button is a base class for different kinds of buttons.
+ /// This class provides the disabled property and the clicked signal.
+ /// A Clicked event handler is emitted when the button is touched and the touch point doesn't leave the boundary of the button.
+ /// When the disabled property is set to true, no signal is emitted.
+ /// 'Visual' describes not just traditional images like png, bmp but refers to whatever is used to show the button, it could be a color, gradient or some other kind of renderer.
+ /// The button's appearance can be modified by setting properties for the various visuals/images.
+ /// It is not mandatory to set all visuals. A button could be defined only by setting its background visual or by setting its background and selected visuals.
+ /// The button visual is shown over the background visual.
+ /// When pressed the unselected visuals are replaced by the selected visual.
+ /// The text label is always placed on the top of all images.
+ /// When the button is disabled, background, button and selected visuals are replaced by their disabled visuals.
+ ///
+ public class Button : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Button(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Button_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Button obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Button instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Button(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + private EventHandlerWithReturnType _clickedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ClickedCallbackType(global::System.IntPtr data); + private ClickedCallbackType _clickedCallback; + + /// + /// Clicked will be triggered when the button is touched and the touch point doesn't leave the boundary of the button. + /// + public event EventHandlerWithReturnType Clicked + { + add + { + if (_clickedEventHandler == null) + { + _clickedCallback = OnClicked; + ClickedSignal().Connect(_clickedCallback); + } + + _clickedEventHandler += value; + } + + remove + { + _clickedEventHandler -= value; + + if (_clickedEventHandler == null && ClickedSignal().Empty() == false) + { + ClickedSignal().Disconnect(_clickedCallback); + } + } + } + + + private bool OnClicked(IntPtr data) + { + if (_clickedEventHandler != null) + { + return _clickedEventHandler(this, null); + } + return false; + } + + + + private EventHandlerWithReturnType _pressedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool PressedCallbackType(global::System.IntPtr data); + private PressedCallbackType _pressedCallback; + + /// + /// Pressed will be triggered when the button is touched. + /// + public event EventHandlerWithReturnType Pressed + { + add + { + if (_pressedEventHandler == null) + { + _pressedCallback = OnPressed; + PressedSignal().Connect(_pressedCallback); + } + + _pressedEventHandler += value; + } + + remove + { + _pressedEventHandler -= value; + + if (_pressedEventHandler == null && PressedSignal().Empty() == false) + { + this.PressedSignal().Disconnect(_pressedCallback); + } + } + } + + private bool OnPressed(IntPtr data) + { + if (_pressedEventHandler != null) + { + return _pressedEventHandler(this, null); + } + return false; + } + + + + private EventHandlerWithReturnType _releasedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ReleasedCallbackType(global::System.IntPtr data); + private ReleasedCallbackType _releasedCallback; + + /// + /// Released will be triggered when the button is touched and the touch point leaves the boundary of the button. + /// + public event EventHandlerWithReturnType Released + { + add + { + if (_releasedEventHandler == null) + { + _releasedCallback = OnReleased; + ReleasedSignal().Connect(_releasedCallback); + } + _releasedEventHandler += value; + } + + remove + { + _releasedEventHandler -= value; + + if (_releasedEventHandler == null && ReleasedSignal().Empty() == false) + { + ReleasedSignal().Disconnect(_releasedCallback); + } + + } + } + + private bool OnReleased(IntPtr data) + { + if (_releasedEventHandler != null) + { + return _releasedEventHandler(this, null); + } + return false; + } + + + private EventHandlerWithReturnType _stateChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool StateChangedCallback(global::System.IntPtr data); + private StateChangedCallback _stateChangedCallback; + + /// + /// StateChanged will be triggered when the button's state is changed. + /// + public event EventHandlerWithReturnType StateChanged + { + add + { + if (_stateChangedEventHandler == null) + { + _stateChangedCallback = OnStateChanged; + StateChangedSignal().Connect(_stateChangedCallback); + } + + _stateChangedEventHandler += value; + } + + remove + { + _stateChangedEventHandler -= value; + + if (_stateChangedEventHandler == null && StateChangedSignal().Empty() == false) + { + StateChangedSignal().Disconnect(_stateChangedCallback); + } + } + } + + private bool OnStateChanged(IntPtr data) + { + if (_stateChangedEventHandler != null) + { + return _stateChangedEventHandler(this, null); + } + return false; + } + + + /// + /// Gets/Sets the unselected button foreground/icon visual + /// + public Tizen.NUI.PropertyMap UnselectedVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.UNSELECTED_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.UNSELECTED_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the selected button foreground/icon visual + /// + public Tizen.NUI.PropertyMap SelectedVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.SELECTED_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.SELECTED_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the disabled selected state foreground/icon button visual + /// + public Tizen.NUI.PropertyMap DisabledSelectedVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.DISABLED_SELECTED_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.DISABLED_SELECTED_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the disabled unselected state foreground/icon visual + /// + public Tizen.NUI.PropertyMap DisabledUnselectedVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.DISABLED_UNSELECTED_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.DISABLED_UNSELECTED_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the disabled in the unselected state background, button visual + /// + public Tizen.NUI.PropertyMap UnselectedBackgroundVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.UNSELECTED_BACKGROUND_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.UNSELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the selected background button visual + /// + public Tizen.NUI.PropertyMap SelectedBackgroundVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.SELECTED_BACKGROUND_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.SELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the disabled while unselected background button visual + /// + public Tizen.NUI.PropertyMap DisabledUnselectedBackgroundVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.DISABLED_UNSELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the disabled while selected background button visual + /// + public Tizen.NUI.PropertyMap DisabledSelectedBackgroundVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.DISABLED_SELECTED_BACKGROUND_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the position of the the label in relation to the foreground/icon if both present + /// + public Align LabelRelativeAlignment + { + get + { + string temp; + if (GetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("LabelRelativeAlignment get error!"); + } + switch (temp) + { + case "BEGIN": + return Align.Begin; + case "END": + return Align.End; + case "TOP": + return Align.Top; + case "BOTTOM": + return Align.Bottom; + default: + return Align.End; + } + } + set + { + string valueToString = ""; + switch (value) + { + case Align.Begin: + { + valueToString = "BEGIN"; + break; + } + case Align.End: + { + valueToString = "END"; + break; + } + case Align.Top: + { + valueToString = "TOP"; + break; + } + case Align.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "END"; + break; + } + } + SetProperty(Button.Property.LABEL_RELATIVE_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// Gets/Sets the padding around the text + /// + public Vector4 LabelPadding + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Button.Property.LABEL_PADDING).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets the padding around the foreground visual + /// + public Vector4 ForegroundVisualPadding + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Button.Property.FOREGROUND_VISUAL_PADDING).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.FOREGROUND_VISUAL_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + internal class Property + { + internal static readonly int UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_VISUAL_get(); + internal static readonly int SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_VISUAL_get(); + internal static readonly int DISABLED_SELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_VISUAL_get(); + internal static readonly int DISABLED_UNSELECTED_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_VISUAL_get(); + internal static readonly int UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_UNSELECTED_BACKGROUND_VISUAL_get(); + internal static readonly int SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_SELECTED_BACKGROUND_VISUAL_get(); + internal static readonly int DISABLED_UNSELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_UNSELECTED_BACKGROUND_VISUAL_get(); + internal static readonly int DISABLED_SELECTED_BACKGROUND_VISUAL = NDalicManualPINVOKE.Button_Property_DISABLED_SELECTED_BACKGROUND_VISUAL_get(); + internal static readonly int LABEL_RELATIVE_ALIGNMENT = NDalicManualPINVOKE.Button_Property_LABEL_RELATIVE_ALIGNMENT_get(); + internal static readonly int LABEL_PADDING = NDalicManualPINVOKE.Button_Property_LABEL_PADDING_get(); + internal static readonly int FOREGROUND_VISUAL_PADDING = NDalicManualPINVOKE.Button_Property_VISUAL_PADDING_get(); + internal static readonly int AUTO_REPEATING = NDalicPINVOKE.Button_Property_AUTO_REPEATING_get(); + internal static readonly int INITIAL_AUTO_REPEATING_DELAY = NDalicPINVOKE.Button_Property_INITIAL_AUTO_REPEATING_DELAY_get(); + internal static readonly int NEXT_AUTO_REPEATING_DELAY = NDalicPINVOKE.Button_Property_NEXT_AUTO_REPEATING_DELAY_get(); + internal static readonly int TOGGLABLE = NDalicPINVOKE.Button_Property_TOGGLABLE_get(); + internal static readonly int SELECTED = NDalicPINVOKE.Button_Property_SELECTED_get(); + internal static readonly int UNSELECTED_COLOR = NDalicPINVOKE.Button_Property_UNSELECTED_COLOR_get(); + internal static readonly int SELECTED_COLOR = NDalicPINVOKE.Button_Property_SELECTED_COLOR_get(); + internal static readonly int LABEL = NDalicPINVOKE.Button_Property_LABEL_get(); + } + + /// + /// Creates an uninitialized Button.
+ /// Only derived versions can be instantiated.
+ ///
+ public Button() : this(NDalicPINVOKE.new_Button__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ButtonSignal PressedSignal() + { + ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_PressedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ButtonSignal ReleasedSignal() + { + ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_ReleasedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ButtonSignal ClickedSignal() + { + ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_ClickedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ButtonSignal StateChangedSignal() + { + ButtonSignal ret = new ButtonSignal(NDalicPINVOKE.Button_StateChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// If the autorepeating property is set to true then the togglable property is set to false. + /// + public bool AutoRepeating + { + get + { + bool temp = false; + GetProperty(Button.Property.AUTO_REPEATING).Get(out temp); + return temp; + } + set + { + SetProperty(Button.Property.AUTO_REPEATING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// By default this value is set to 0.15 seconds. + /// + public float InitialAutoRepeatingDelay + { + get + { + float temp = 0.0f; + GetProperty(Button.Property.INITIAL_AUTO_REPEATING_DELAY).Get(out temp); + return temp; + } + set + { + SetProperty(Button.Property.INITIAL_AUTO_REPEATING_DELAY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// default this value is set to 0.05 seconds. + /// + public float NextAutoRepeatingDelay + { + get + { + float temp = 0.0f; + GetProperty(Button.Property.NEXT_AUTO_REPEATING_DELAY).Get(out temp); + return temp; + } + set + { + SetProperty(Button.Property.NEXT_AUTO_REPEATING_DELAY, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// If the togglable property is set to true, then the autorepeating property is set to false. + /// + public bool Togglable + { + get + { + bool temp = false; + GetProperty(Button.Property.TOGGLABLE).Get(out temp); + return temp; + } + set + { + SetProperty(Button.Property.TOGGLABLE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// /Gets/Sets the togglable button as either selected or unselected, togglable property must be set to true. + /// + public bool Selected + { + get + { + bool temp = false; + GetProperty(Button.Property.SELECTED).Get(out temp); + return temp; + } + set + { + SetProperty(Button.Property.SELECTED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets unselected color. + /// + public Color UnselectedColor + { + get + { + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Button.Property.UNSELECTED_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.UNSELECTED_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets selected color. + /// + public Color SelectedColor + { + get + { + Color temp = new Color(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Button.Property.SELECTED_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.SELECTED_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets label. + /// + public Tizen.NUI.PropertyMap Label + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(Button.Property.LABEL).Get(temp); + return temp; + } + set + { + SetProperty(Button.Property.LABEL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/Sets text of label. + /// + public string LabelText + { + get + { + Tizen.NUI.PropertyMap map = new Tizen.NUI.PropertyMap(); + GetProperty( Button.Property.LABEL).Get(map); + Tizen.NUI.PropertyValue value = map.Find( TextVisualProperty.Text, "Text"); + string str; + value.Get(out str); + return str; + } + set + { + SetProperty( Button.Property.LABEL, new Tizen.NUI.PropertyValue( value ) ); + } + } + + /// + /// Enumeration for describing the position the text label can be in relation to the control(and foreground/icon). + /// + public enum Align + { + /// + /// At the start of the control before the foreground/icon + /// + Begin, + /// + /// At the end of the control after the foreground/icon + /// + End, + /// + /// At the top of the control above the foreground/icon + /// + Top, + /// + /// At the bottom of the control below the foreground/icon + /// + Bottom + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs b/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs new file mode 100755 index 0000000..e2ef38a --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/CheckBoxButton.cs @@ -0,0 +1,90 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +// Some have been manually changed + +namespace Tizen.NUI.UIComponents +{ + + /// + /// CheckBoxButton provides a check box button which user can check or uncheck.
+ /// By default, a CheckBoxButton emits a Button.Clicked event when the button changes its state to selected or unselected.
+ /// The button's appearance could be modified by Button.UnselectedImage, Button.BackgroundImage, Button.SelectedImage, Button.SelectedBackgroundImage, Button.DisabledBackgroundImage, Button.DisabledImage, and Button.DisabledSelectedImage.
+ /// When the button is not disabled, if it's not selected it only shows the background image.
+ /// The selected image is shown over the background image when the box is selected (background image is not replaced by \e selected image).
+ /// When the button is disabled, background image and selected image are replaced by disabled images.
+ /// ///
+ public class CheckBoxButton : Button + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal CheckBoxButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.CheckBoxButton_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CheckBoxButton obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + /// + /// To make CheckBoxButton instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_CheckBoxButton(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Creates an initialized CheckBoxButton + /// + public CheckBoxButton() : this(NDalicPINVOKE.CheckBoxButton_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/Popup.cs b/src/Tizen.NUI/src/public/UIComponents/Popup.cs new file mode 100755 index 0000000..24a606d --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/Popup.cs @@ -0,0 +1,997 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.UIComponents +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// The Popup widget provides a configurable pop-up dialog with built-in layout of three main fields. + /// + public class Popup : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Popup(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Popup_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Popup obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Popup(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + + + /// + /// Event arguments that passed via OutsideTouchedEvent + /// + public class TouchedOutsideEventArgs : EventArgs + { + } + + /// + /// Event arguments that passed via ShowingEventArgs + /// + public class ShowingEventArgs : EventArgs + { + } + + /// + /// Event arguments that passed via ShownEventArgs + /// + public class ShownEventArgs : EventArgs + { + } + + /// + /// Event arguments that passed via HidingEventArgs + /// + public class HidingEventArgs : EventArgs + { + } + + /// + /// Event arguments that passed via HiddenEventArgs + /// + public class HiddenEventArgs : EventArgs + { + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void OutsideTouchedEventCallbackDelegate(); + private EventHandler _popUpOutsideTouchedEventHandler; + private OutsideTouchedEventCallbackDelegate _popUpOutsideTouchedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ShowingEventCallbackDelegate(); + private EventHandler _popUpShowingEventHandler; + private ShowingEventCallbackDelegate _popUpShowingEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ShownEventCallbackDelegate(); + private EventHandler _popUpShownEventHandler; + private ShownEventCallbackDelegate _popUpShownEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void HidingEventCallbackDelegate(); + private EventHandler _popUpHidingEventHandler; + private HidingEventCallbackDelegate _popUpHidingEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void HiddenEventCallbackDelegate(); + private EventHandler _popUpHiddenEventHandler; + private HiddenEventCallbackDelegate _popUpHiddenEventCallbackDelegate; + + /// + /// Event is sent when user has touched outside of the Dialog. + /// + public event EventHandler TouchedOutside + { + add + { + if (_popUpOutsideTouchedEventHandler == null) + { + _popUpOutsideTouchedEventCallbackDelegate = (OnOutsideTouched); + OutsideTouchedSignal().Connect(_popUpOutsideTouchedEventCallbackDelegate); + } + _popUpOutsideTouchedEventHandler += value; + } + remove + { + _popUpOutsideTouchedEventHandler -= value; + if (_popUpOutsideTouchedEventHandler == null && OutsideTouchedSignal().Empty() == false) + { + this.OutsideTouchedSignal().Disconnect(_popUpOutsideTouchedEventCallbackDelegate); + } + } + } + + // Callback for Popup OutsideTouchedSignal + private void OnOutsideTouched() + { + TouchedOutsideEventArgs e = new TouchedOutsideEventArgs(); + + if (_popUpOutsideTouchedEventHandler != null) + { + //here we send all data to user event handlers + _popUpOutsideTouchedEventHandler(this, e); + } + } + + /// + /// Event is sent when the Popup is starting to be shown. + /// + public event EventHandler Showing + { + add + { + if (_popUpShowingEventHandler == null) + { + _popUpShowingEventCallbackDelegate = (OnShowing); + ShowingSignal().Connect(_popUpShowingEventCallbackDelegate); + } + _popUpShowingEventHandler += value; + } + remove + { + _popUpShowingEventHandler -= value; + if (_popUpShowingEventHandler == null && ShowingSignal().Empty() == false) + { + ShowingSignal().Disconnect(_popUpShowingEventCallbackDelegate); + } + } + } + + // Callback for ShowingSignal + private void OnShowing() + { + ShowingEventArgs e = new ShowingEventArgs(); + + if (_popUpShowingEventHandler != null) + { + //here we send all data to user event handlers + _popUpShowingEventHandler(this, e); + } + } + + + /// + /// Event is sent when the Popup has been fully displayed. + /// + public event EventHandler Shown + { + add + { + if (_popUpShownEventHandler == null) + { + _popUpShownEventCallbackDelegate = (OnShown); + ShownSignal().Connect(_popUpShownEventCallbackDelegate); + } + _popUpShownEventHandler += value; + } + remove + { + _popUpShownEventHandler -= value; + if (_popUpShownEventHandler == null && ShownSignal().Empty() == false) + { + ShownSignal().Disconnect(_popUpShownEventCallbackDelegate); + } + } + } + + // Callback for ShownSignal + private void OnShown() + { + ShownEventArgs e = new ShownEventArgs(); + + if (_popUpShownEventHandler != null) + { + //here we send all data to user event handlers + _popUpShownEventHandler(this, e); + } + } + + /// + /// Event is sent when the Popup is starting to be hidden. + /// + public event EventHandler Hiding + { + add + { + if (_popUpHidingEventHandler == null) + { + _popUpHidingEventCallbackDelegate = (OnHiding); + HidingSignal().Connect(_popUpHidingEventCallbackDelegate); + } + _popUpHidingEventHandler += value; + } + remove + { + _popUpHidingEventHandler -= value; + if (_popUpHidingEventHandler == null && HidingSignal().Empty() == false) + { + HidingSignal().Disconnect(_popUpHidingEventCallbackDelegate); + } + } + } + + // Callback for HidingSignal + private void OnHiding() + { + HidingEventArgs e = new HidingEventArgs(); + + if (_popUpHidingEventHandler != null) + { + //here we send all data to user event handlers + _popUpHidingEventHandler(this, e); + } + } + + /// + /// Event is sent when the Popup has been completely hidden. + /// + public event EventHandler Hidden + { + add + { + if (_popUpHiddenEventHandler == null) + { + _popUpHiddenEventCallbackDelegate = (OnHidden); + HiddenSignal().Connect(_popUpHiddenEventCallbackDelegate); + } + _popUpHiddenEventHandler += value; + } + remove + { + _popUpHiddenEventHandler -= value; + if (_popUpHiddenEventHandler == null && HiddenSignal().Empty() == false) + { + HiddenSignal().Disconnect(_popUpHiddenEventCallbackDelegate); + } + } + } + + // Callback for HiddenSignal + private void OnHidden() + { + HiddenEventArgs e = new HiddenEventArgs(); + + if (_popUpHiddenEventHandler != null) + { + //here we send all data to user event handlers + _popUpHiddenEventHandler(this, e); + } + } + + internal class Property + { + internal static readonly int TITLE = NDalicPINVOKE.Popup_Property_TITLE_get(); + internal static readonly int CONTENT = NDalicPINVOKE.Popup_Property_CONTENT_get(); + internal static readonly int FOOTER = NDalicPINVOKE.Popup_Property_FOOTER_get(); + internal static readonly int DISPLAY_STATE = NDalicPINVOKE.Popup_Property_DISPLAY_STATE_get(); + internal static readonly int TOUCH_TRANSPARENT = NDalicPINVOKE.Popup_Property_TOUCH_TRANSPARENT_get(); + internal static readonly int TAIL_VISIBILITY = NDalicPINVOKE.Popup_Property_TAIL_VISIBILITY_get(); + internal static readonly int TAIL_POSITION = NDalicPINVOKE.Popup_Property_TAIL_POSITION_get(); + internal static readonly int CONTEXTUAL_MODE = NDalicPINVOKE.Popup_Property_CONTEXTUAL_MODE_get(); + internal static readonly int ANIMATION_DURATION = NDalicPINVOKE.Popup_Property_ANIMATION_DURATION_get(); + internal static readonly int ANIMATION_MODE = NDalicPINVOKE.Popup_Property_ANIMATION_MODE_get(); + internal static readonly int ENTRY_ANIMATION = NDalicPINVOKE.Popup_Property_ENTRY_ANIMATION_get(); + internal static readonly int EXIT_ANIMATION = NDalicPINVOKE.Popup_Property_EXIT_ANIMATION_get(); + internal static readonly int AUTO_HIDE_DELAY = NDalicPINVOKE.Popup_Property_AUTO_HIDE_DELAY_get(); + internal static readonly int BACKING_ENABLED = NDalicPINVOKE.Popup_Property_BACKING_ENABLED_get(); + internal static readonly int BACKING_COLOR = NDalicPINVOKE.Popup_Property_BACKING_COLOR_get(); + internal static readonly int POPUP_BACKGROUND_IMAGE = NDalicPINVOKE.Popup_Property_POPUP_BACKGROUND_IMAGE_get(); + internal static readonly int POPUP_BACKGROUND_BORDER = NDalicPINVOKE.Popup_Property_POPUP_BACKGROUND_BORDER_get(); + internal static readonly int TAIL_UP_IMAGE = NDalicPINVOKE.Popup_Property_TAIL_UP_IMAGE_get(); + internal static readonly int TAIL_DOWN_IMAGE = NDalicPINVOKE.Popup_Property_TAIL_DOWN_IMAGE_get(); + internal static readonly int TAIL_LEFT_IMAGE = NDalicPINVOKE.Popup_Property_TAIL_LEFT_IMAGE_get(); + internal static readonly int TAIL_RIGHT_IMAGE = NDalicPINVOKE.Popup_Property_TAIL_RIGHT_IMAGE_get(); + } + + /// + /// Create the Popup. + /// + public Popup() : this(NDalicPINVOKE.Popup_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static Popup DownCast(BaseHandle handle) + { + Popup ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Popup; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a title for this Popup. + /// + /// The actor to set a title + public void SetTitle(View titleView) + { + NDalicPINVOKE.Popup_SetTitle(swigCPtr, View.getCPtr(titleView)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal View GetTitle() + { + IntPtr cPtr = NDalicPINVOKE.Popup_GetTitle(swigCPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the content actor. + /// + /// The actor to use + public void SetContent(View content) + { + NDalicPINVOKE.Popup_SetContent(swigCPtr, View.getCPtr(content)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal View GetContent() + { + IntPtr cPtr = NDalicPINVOKE.Popup_GetContent(swigCPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the actor to use for a footer in this Popup. + /// + /// The footer actor to be added to this Popup + public void SetFooter(View footer) + { + NDalicPINVOKE.Popup_SetFooter(swigCPtr, View.getCPtr(footer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal View GetFooter() + { + IntPtr cPtr = NDalicPINVOKE.Popup_GetFooter(swigCPtr); + View ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as View; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the display state of Popup.
+ /// There are 4 total display states.
+ /// Only 2 can be set, but all four can be read for better inspection of the current popup state.
+ ///
+ /// The other two states are getable, but not setable and are there for consistency.
+ ///
+ /// | Value | Setting the state | Getting the state |
+ /// |----------|--------------------------------|--------------------------------|
+ /// | SHOWN | Show the popup | The popup is fully shown |
+ /// | HIDDEN | Hide the popup | The popup is fully hidden |
+ /// | SHOWING | | The popup is transitioning in |
+ /// | HIDING | | The popup is transitioning out |
+ ///
+ /// All 4 state changes cause notifications via 4 respective signals that can be connected to.
+ ///
+ /// The desired display state to change to + public void SetDisplayState(Popup.DisplayStateType displayState) + { + NDalicPINVOKE.Popup_SetDisplayState(swigCPtr, (int)displayState); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Popup.DisplayStateType GetDisplayState() + { + Popup.DisplayStateType ret = (Popup.DisplayStateType)NDalicPINVOKE.Popup_GetDisplayState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal OutsideTouchedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Popup_OutsideTouchedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal ShowingSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Popup_ShowingSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal ShownSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Popup_ShownSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal HidingSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Popup_HidingSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal HiddenSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Popup_HiddenSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The display states of the Popup. + /// + public enum DisplayStateType + { + Showing, + Shown, + Hiding, + Hidden + } + + /// + /// The animation mode within popup.
+ /// Choose from a predefined mode or "CUSTOM" to use the ANIMATION_IN and ANIMATION_OUT properties.
+ ///
+ public enum AnimationModeType + { + None, + Zoom, + Fade, + Custom + } + + /// + /// Types of contextual layout.
+ /// The Popup is positioned adjacent to it's parent in the direction specified by this mode.
+ /// NON_CONTEXTUAL disables any contextual positioning.
+ ///
+ public enum ContextualModeType + { + NonContextual, + Above, + Rright, + Below, + Left + } + + /// + /// Popup title. + /// + public PropertyMap Title + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Popup.Property.TITLE).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.TITLE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Popup content. + /// + public PropertyMap Content + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Popup.Property.CONTENT).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.CONTENT, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Popup footer. + /// + public PropertyMap Footer + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Popup.Property.FOOTER).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.FOOTER, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Popup display state. + /// + public DisplayStateType DisplayState + { + get + { + string temp; + if (GetProperty(Popup.Property.DISPLAY_STATE).Get(out temp) == false) + { + NUILog.Error("DisplayState get error!"); + } + switch (temp) + { + case "SHOWING": + return DisplayStateType.Showing; + case "SHOWN": + return DisplayStateType.Shown; + case "HIDING": + return DisplayStateType.Hiding; + case "HIDDEN": + return DisplayStateType.Hidden; + default: + return DisplayStateType.Hidden; + } + } + set + { + string valueToString = ""; + switch (value) + { + case DisplayStateType.Showing: + { + valueToString = "SHOWING"; + break; + } + case DisplayStateType.Shown: + { + valueToString = "SHOWN"; + break; + } + case DisplayStateType.Hiding: + { + valueToString = "HIDING"; + break; + } + case DisplayStateType.Hidden: + { + valueToString = "HIDDEN"; + break; + } + default: + { + valueToString = "HIDDEN"; + break; + } + } + SetProperty(Popup.Property.DISPLAY_STATE, new Tizen.NUI.PropertyValue(valueToString)); + } + } + /// + /// Touch transparent. + /// + public bool TouchTransparent + { + get + { + bool temp = false; + GetProperty(Popup.Property.TOUCH_TRANSPARENT).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TOUCH_TRANSPARENT, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Popup tail visibility. + /// + public bool TailVisibility + { + get + { + bool temp = false; + GetProperty(Popup.Property.TAIL_VISIBILITY).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_VISIBILITY, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Popup tail position. + /// + public Vector3 TailPosition + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(Popup.Property.TAIL_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Contextual mode. + /// + public ContextualModeType ContextualMode + { + get + { + string temp; + if (GetProperty(Popup.Property.CONTEXTUAL_MODE).Get(out temp) == false) + { + NUILog.Error("ContextualMode get error!"); + } + switch (temp) + { + case "NON_CONTEXTUAL": + return ContextualModeType.NonContextual; + case "ABOVE": + return ContextualModeType.Above; + case "RIGHT": + return ContextualModeType.Rright; + case "BELOW": + return ContextualModeType.Below; + case "LEFT": + return ContextualModeType.Left; + default: + return ContextualModeType.Below; + } + } + set + { + string valueToString = ""; + switch (value) + { + case ContextualModeType.NonContextual: + { + valueToString = "NON_CONTEXTUAL"; + break; + } + case ContextualModeType.Above: + { + valueToString = "ABOVE"; + break; + } + case ContextualModeType.Rright: + { + valueToString = "RIGHT"; + break; + } + case ContextualModeType.Below: + { + valueToString = "BELOW"; + break; + } + case ContextualModeType.Left: + { + valueToString = "LEFT"; + break; + } + default: + { + valueToString = "BELOW"; + break; + } + } + SetProperty(Popup.Property.CONTEXTUAL_MODE, new Tizen.NUI.PropertyValue(valueToString)); + } + } + /// + /// Animation duration. + /// + public float AnimationDuration + { + get + { + float temp = 0.0f; + GetProperty(Popup.Property.ANIMATION_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.ANIMATION_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Animation mode. + /// + public AnimationModeType AnimationMode + { + get + { + string temp; + if (GetProperty(Popup.Property.ANIMATION_MODE).Get(out temp) == false) + { + NUILog.Error("AnimationMode get error!"); + } + switch (temp) + { + case "NONE": + return AnimationModeType.None; + case "ZOOM": + return AnimationModeType.Zoom; + case "FADE": + return AnimationModeType.Fade; + case "CUSTOM": + return AnimationModeType.Custom; + default: + return AnimationModeType.Fade; + } + } + set + { + string valueToString = ""; + switch (value) + { + case AnimationModeType.None: + { + valueToString = "NONE"; + break; + } + case AnimationModeType.Zoom: + { + valueToString = "ZOOM"; + break; + } + case AnimationModeType.Fade: + { + valueToString = "FADE"; + break; + } + case AnimationModeType.Custom: + { + valueToString = "CUSTOM"; + break; + } + default: + { + valueToString = "FADE"; + break; + } + } + SetProperty(Popup.Property.ANIMATION_MODE, new Tizen.NUI.PropertyValue(valueToString)); + } + } + /// + /// Entry animation. + /// + public PropertyMap EntryAnimation + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Popup.Property.ENTRY_ANIMATION).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.ENTRY_ANIMATION, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Exit animation. + /// + public PropertyMap ExitAnimation + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Popup.Property.EXIT_ANIMATION).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.EXIT_ANIMATION, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Auto hide delay. + /// + public int AutoHideDelay + { + get + { + int temp = 0; + GetProperty(Popup.Property.AUTO_HIDE_DELAY).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.AUTO_HIDE_DELAY, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Backing enabled. + /// + public bool BackingEnabled + { + get + { + bool temp = false; + GetProperty(Popup.Property.BACKING_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.BACKING_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Backing color. + /// + public Vector4 BackingColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Popup.Property.BACKING_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.BACKING_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Background image. + /// + public string PopupBackgroundImage + { + get + { + string temp; + GetProperty(Popup.Property.POPUP_BACKGROUND_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.POPUP_BACKGROUND_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Background border. + /// + public Rectangle PopupBackgroundBorder + { + get + { + Rectangle temp = new Rectangle(0, 0, 0, 0); + GetProperty(Popup.Property.POPUP_BACKGROUND_BORDER).Get(temp); + return temp; + } + set + { + SetProperty(Popup.Property.POPUP_BACKGROUND_BORDER, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Tail up image. + /// + public string TailUpImage + { + get + { + string temp; + GetProperty(Popup.Property.TAIL_UP_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_UP_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Tail down image. + /// + public string TailDownImage + { + get + { + string temp; + GetProperty(Popup.Property.TAIL_DOWN_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_DOWN_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Tail left image. + /// + public string TailLeftImage + { + get + { + string temp; + GetProperty(Popup.Property.TAIL_LEFT_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_LEFT_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Tail right image. + /// + public string TailRightImage + { + get + { + string temp; + GetProperty(Popup.Property.TAIL_RIGHT_IMAGE).Get(out temp); + return temp; + } + set + { + SetProperty(Popup.Property.TAIL_RIGHT_IMAGE, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs new file mode 100755 index 0000000..978e777 --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/ProgressBar.cs @@ -0,0 +1,357 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.UIComponents +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// ProgressBar is a control to give the user an indication of the progress of an operation. + /// + public class ProgressBar : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ProgressBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ProgressBar_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ProgressBar obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make ProgressBar instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ProgressBar(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + /// + /// Event arguments that passed via ValueChangedEventArgs + /// + public class ValueChangedEventArgs : EventArgs + { + private ProgressBar _progressBar; + private float _progressValue; + private float _secondaryProgressValue; + + public ProgressBar ProgressBar + { + get + { + return _progressBar; + } + set + { + _progressBar = value; + } + } + + public float ProgressValue + { + get + { + return _progressValue; + } + set + { + _progressValue = value; + } + } + + public float SecondaryProgressValue + { + get + { + return _secondaryProgressValue; + } + set + { + _secondaryProgressValue = value; + } + } + + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ValueChangedCallbackDelegate(IntPtr progressBar, float progressValue, float secondaryProgressValue); + private EventHandler _progressBarValueChangedEventHandler; + private ValueChangedCallbackDelegate _progressBarValueChangedCallbackDelegate; + + /// + /// Event is sent when the ProgressBar value changes. + /// + public event EventHandler ValueChanged + { + add + { + if (_progressBarValueChangedEventHandler == null) + { + _progressBarValueChangedCallbackDelegate = (OnValueChanged); + ValueChangedSignal().Connect(_progressBarValueChangedCallbackDelegate); + } + _progressBarValueChangedEventHandler += value; + } + remove + { + _progressBarValueChangedEventHandler -= value; + if (_progressBarValueChangedEventHandler == null && ValueChangedSignal().Empty() == false) + { + ValueChangedSignal().Disconnect(_progressBarValueChangedCallbackDelegate); + } + } + } + + // Callback for ProgressBar ValueChanged signal + private void OnValueChanged(IntPtr progressBar, float progressValue, float secondaryProgressValue) + { + ValueChangedEventArgs e = new ValueChangedEventArgs(); + + // Populate all members of "e" (ValueChangedEventArgs) with real page + e.ProgressBar = Registry.GetManagedBaseHandleFromNativePtr(progressBar) as ProgressBar; + e.ProgressValue = progressValue; + e.SecondaryProgressValue = secondaryProgressValue; + + if (_progressBarValueChangedEventHandler != null) + { + _progressBarValueChangedEventHandler(this, e); + } + } + + internal class Property + { + internal static readonly int PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VALUE_get(); + internal static readonly int SECONDARY_PROGRESS_VALUE = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VALUE_get(); + internal static readonly int INDETERMINATE = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_get(); + internal static readonly int TRACK_VISUAL = NDalicPINVOKE.ProgressBar_Property_TRACK_VISUAL_get(); + internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_PROGRESS_VISUAL_get(); + internal static readonly int SECONDARY_PROGRESS_VISUAL = NDalicPINVOKE.ProgressBar_Property_SECONDARY_PROGRESS_VISUAL_get(); + internal static readonly int INDETERMINATE_VISUAL = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_get(); + internal static readonly int INDETERMINATE_VISUAL_ANIMATION = NDalicPINVOKE.ProgressBar_Property_INDETERMINATE_VISUAL_ANIMATION_get(); + internal static readonly int LABEL_VISUAL = NDalicPINVOKE.ProgressBar_Property_LABEL_VISUAL_get(); + } + + /// + /// Creates the ProgressBar. + /// + public ProgressBar() : this(NDalicPINVOKE.ProgressBar_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + internal ProgressBarValueChangedSignal ValueChangedSignal() + { + ProgressBarValueChangedSignal ret = new ProgressBarValueChangedSignal(NDalicPINVOKE.ProgressBar_ValueChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The progress value of progress bar, progress runs form 0 to 1.
+ /// If Value is set to 0, progress bar will be set to beginning.
+ /// If Value is set to 1, progress bar will be set to end.
+ /// Any Value outside of the range is ignored.
+ ///
+ public float ProgressValue + { + get + { + float temp = 0.0f; + GetProperty(ProgressBar.Property.PROGRESS_VALUE).Get(out temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The secondary progress value of progress bar, secondary progress runs form 0 to 1.
+ /// Optional. If not supplied, the default is 0.
+ /// If Value is set to 0, progress bar will be set secondary progress to beginning.
+ /// If Value is set to 1, progress bar will be set secondary progress to end.
+ /// Any Value outside of the range is ignored.
+ ///
+ public float SecondaryProgressValue + { + get + { + float temp = 0.0f; + GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE).Get(out temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VALUE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// Sets the progress-bar as \e indeterminate state. + /// + public bool Indeterminate + { + get + { + bool temp = false; + GetProperty(ProgressBar.Property.INDETERMINATE).Get(out temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.INDETERMINATE, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The track Visual value of progress bar, it's a full progress area and it's shown behind PROGRESS_VISUAL.
+ /// Optional. If not supplied, the default track visual will be shown.
+ ///
+ public Tizen.NUI.PropertyMap TrackVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(ProgressBar.Property.TRACK_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The progress Visual value of progress bar, size of the progress visual is changed based on PROGRESS_VALUE.
+ /// Optional. If not supplied, the default progress visual will be shown.
+ ///
+ public Tizen.NUI.PropertyMap ProgressVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(ProgressBar.Property.PROGRESS_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The secondary progress visual of progress bar, size of the secondary progress visual is changed based on SECONDARY_PROGRESS_VALUE.
+ /// Optional. If not supplied, the secondary progress visual will not be shown.
+ ///
+ public Tizen.NUI.PropertyMap SecondaryProgressVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.SECONDARY_PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The indeterminate visual of progress bar.
+ /// Optional. If not supplied, the default inditerminate visual will be shown.
+ ///
+ public Tizen.NUI.PropertyMap IndeterminateVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The transition data for indeterminate visual animation.
+ /// Optional. If not supplied, default animation will be played.
+ ///
+ public Tizen.NUI.PropertyArray IndeterminateVisualAnimation + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.INDETERMINATE_VISUAL_ANIMATION, new Tizen.NUI.PropertyValue(value)); + } + } + /// + /// The Label visual of progress bar. + /// + public Tizen.NUI.PropertyMap LabelVisual + { + get + { + Tizen.NUI.PropertyMap temp = new Tizen.NUI.PropertyMap(); + GetProperty(ProgressBar.Property.LABEL_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(ProgressBar.Property.LABEL_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/PushButton.cs b/src/Tizen.NUI/src/public/UIComponents/PushButton.cs new file mode 100755 index 0000000..4c8ee8e --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/PushButton.cs @@ -0,0 +1,231 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI.UIComponents +{ + + /// + /// A PushButton changes its appearance when is pressed and returns to its original when is released. + /// + public class PushButton : Button + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal PushButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.PushButton_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PushButton obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make PushButton instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_PushButton(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal class Property + { + internal static readonly int UNSELECTED_ICON = NDalicPINVOKE.PushButton_Property_UNSELECTED_ICON_get(); + internal static readonly int SELECTED_ICON = NDalicPINVOKE.PushButton_Property_SELECTED_ICON_get(); + internal static readonly int ICON_ALIGNMENT = NDalicPINVOKE.PushButton_Property_ICON_ALIGNMENT_get(); + internal static readonly int LABEL_PADDING = NDalicPINVOKE.PushButton_Property_LABEL_PADDING_get(); + internal static readonly int ICON_PADDING = NDalicPINVOKE.PushButton_Property_ICON_PADDING_get(); + } + + /// + /// Creates the PushButton. + /// + public PushButton() : this(NDalicPINVOKE.PushButton_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static PushButton DownCast(BaseHandle handle) + { + PushButton ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as PushButton; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [Obsolete("Please do not use! this will be deprecated")] + public string UnselectedIcon + { + set + { + SetProperty(PushButton.Property.UNSELECTED_ICON, new Tizen.NUI.PropertyValue(value)); + } + } + [Obsolete("Please do not use! this will be deprecated")] + public string SelectedIcon + { + set + { + SetProperty(PushButton.Property.SELECTED_ICON, new Tizen.NUI.PropertyValue(value)); + } + } + [Obsolete("Please do not use! this will be deprecated")] + public IconAlignmentType IconAlignment + { + get + { + string temp; + if (GetProperty(PushButton.Property.ICON_ALIGNMENT).Get(out temp) == false) + { + NUILog.Error("IconAlignment get error!"); + } + switch (temp) + { + case "LEFT": + return IconAlignmentType.Left; + case "RIGHT": + return IconAlignmentType.Right; + case "TOP": + return IconAlignmentType.Top; + case "BOTTOM": + return IconAlignmentType.Bottom; + default: + return IconAlignmentType.Default; + } + } + set + { + string valueToString = ""; + switch (value) + { + case IconAlignmentType.Left: + { + valueToString = "LEFT"; + break; + } + case IconAlignmentType.Right: + { + valueToString = "RIGHT"; + break; + } + case IconAlignmentType.Top: + { + valueToString = "TOP"; + break; + } + case IconAlignmentType.Bottom: + { + valueToString = "BOTTOM"; + break; + } + default: + { + valueToString = "DEFAULT"; + break; + } + } + SetProperty(PushButton.Property.ICON_ALIGNMENT, new Tizen.NUI.PropertyValue(valueToString)); + } + } + [Obsolete("Please do not use! this will be deprecated")] + public Vector4 LabelPadding + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(PushButton.Property.LABEL_PADDING).Get(temp); + return temp; + } + set + { + SetProperty(PushButton.Property.LABEL_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public Vector4 IconPadding + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(PushButton.Property.ICON_PADDING).Get(temp); + return temp; + } + set + { + SetProperty(PushButton.Property.ICON_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + [Obsolete("Please do not use! this will be deprecated")] + public enum IconAlignmentType + { + /// + /// Icon located to the left of text. + /// + Left, + /// + /// Icon located to the right of text. + /// + Right, + /// + /// Icon located to the top of text. + /// + Top, + /// + /// Icon located to the bottom of text. + /// + Bottom, + /// + /// Icon located to the right of text by default. + /// + Default = Right + } + + } +} diff --git a/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs b/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs new file mode 100755 index 0000000..d082422 --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/RadioButton.cs @@ -0,0 +1,100 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.UIComponents +{ + + /// + /// A RadioButton provides a radio button which two states \e selected or \e unselected.
+ /// Radio buttons are designed to select one of many option at the same time.
+ /// RadioButton can change its current state using Selected.
+ ///
+ /// RadioButtons can be grouped.
+ /// Two or more RadioButtons are in one group when they have this same parent.
+ /// In each groups only one RadioButton can be \e selected at a given time.
+ /// So when RadioButton is set to \e selected, other RadioButtons in its group are set to \e unselected.
+ /// When \e selected RadioButton is set to \e unselected no other RadioButtons in his group is set to \e selected.
+ ///
+ /// A StateChanged Event is emitted when the RadioButton change its state to \e selected or \e unselected.
+ ///
+ public class RadioButton : Button + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal RadioButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.RadioButton_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RadioButton obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make RadioButton instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_RadioButton(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + /// + /// Creates an uninitialized RadioButton + /// + public RadioButton() : this(NDalicPINVOKE.RadioButton_New__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + /// + /// Creates an uninitialized RadioButton with Label + /// + /// Label text + public RadioButton(string label) : this(NDalicPINVOKE.RadioButton_New__SWIG_1(label), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + } +} diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs new file mode 100755 index 0000000..51417f2 --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollBar.cs @@ -0,0 +1,578 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.UIComponents +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// ScrollBar is a UI component that can be linked to the scrollable objects + /// indicating the current scroll position of the scrollable object.
+ ///
+ public class ScrollBar : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ScrollBar(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollBar_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollBar obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make ScrollBar instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollBar(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Event arguments that passed via PanFinished event + /// + public class PanFinishedEventArgs : EventArgs + { + } + + /// + /// Event arguments that passed via ScrollPositionIntervalReached event + /// + public class ScrollIntervalEventArgs : EventArgs + { + private float _currentScrollPosition; + + /// + /// current scroll position of the scrollable content + /// + public float CurrentScrollPosition + { + get + { + return _currentScrollPosition; + } + set + { + _currentScrollPosition = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void PanFinishedEventCallbackDelegate(); + private EventHandler _scrollBarPanFinishedEventHandler; + private PanFinishedEventCallbackDelegate _scrollBarPanFinishedEventCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void ScrollPositionIntervalReachedEventCallbackDelegate(); + private EventHandler _scrollBarScrollPositionIntervalReachedEventHandler; + private ScrollPositionIntervalReachedEventCallbackDelegate _scrollBarScrollPositionIntervalReachedEventCallbackDelegate; + + /// + /// Event emitted when panning is finished on the scroll indicator. + /// + public event EventHandler PanFinished + { + add + { + if (_scrollBarPanFinishedEventHandler == null) + { + _scrollBarPanFinishedEventCallbackDelegate = (OnScrollBarPanFinished); + PanFinishedSignal().Connect(_scrollBarPanFinishedEventCallbackDelegate); + } + _scrollBarPanFinishedEventHandler += value; + } + remove + { + _scrollBarPanFinishedEventHandler -= value; + if (_scrollBarPanFinishedEventHandler == null && PanFinishedSignal().Empty() == false) + { + PanFinishedSignal().Disconnect(_scrollBarPanFinishedEventCallbackDelegate); + } + } + } + + // Callback for ScrollBar PanFinishedSignal + private void OnScrollBarPanFinished() + { + PanFinishedEventArgs e = new PanFinishedEventArgs(); + + if (_scrollBarPanFinishedEventHandler != null) + { + //here we send all data to user event handlers + _scrollBarPanFinishedEventHandler(this, e); + } + } + + + /// + /// Event emitted when the current scroll position of the scrollable content + /// + public event EventHandler ScrollInterval + { + add + { + if (_scrollBarScrollPositionIntervalReachedEventHandler == null) + { + _scrollBarScrollPositionIntervalReachedEventCallbackDelegate = (OnScrollBarScrollPositionIntervalReached); + ScrollPositionIntervalReachedSignal().Connect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate); + } + _scrollBarScrollPositionIntervalReachedEventHandler += value; + } + remove + { + _scrollBarScrollPositionIntervalReachedEventHandler -= value; + if (_scrollBarScrollPositionIntervalReachedEventHandler == null && ScrollPositionIntervalReachedSignal().Empty() == false) + { + ScrollPositionIntervalReachedSignal().Disconnect(_scrollBarScrollPositionIntervalReachedEventCallbackDelegate); + } + } + } + + // Callback for ScrollBar ScrollPositionIntervalReachedSignal + private void OnScrollBarScrollPositionIntervalReached() + { + ScrollIntervalEventArgs e = new ScrollIntervalEventArgs(); + + if (_scrollBarScrollPositionIntervalReachedEventHandler != null) + { + //here we send all data to user event handlers + _scrollBarScrollPositionIntervalReachedEventHandler(this, e); + } + } + + + internal class Property + { + internal static readonly int SCROLL_DIRECTION = NDalicPINVOKE.ScrollBar_Property_SCROLL_DIRECTION_get(); + internal static readonly int INDICATOR_HEIGHT_POLICY = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HEIGHT_POLICY_get(); + internal static readonly int INDICATOR_FIXED_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_FIXED_HEIGHT_get(); + internal static readonly int INDICATOR_SHOW_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_SHOW_DURATION_get(); + internal static readonly int INDICATOR_HIDE_DURATION = NDalicPINVOKE.ScrollBar_Property_INDICATOR_HIDE_DURATION_get(); + internal static readonly int SCROLL_POSITION_INTERVALS = NDalicPINVOKE.ScrollBar_Property_SCROLL_POSITION_INTERVALS_get(); + internal static readonly int INDICATOR_MINIMUM_HEIGHT = NDalicPINVOKE.ScrollBar_Property_INDICATOR_MINIMUM_HEIGHT_get(); + internal static readonly int INDICATOR_START_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_START_PADDING_get(); + internal static readonly int INDICATOR_END_PADDING = NDalicPINVOKE.ScrollBar_Property_INDICATOR_END_PADDING_get(); + } + + /// + /// Creates an initialized ScrollBar. + /// + /// The direction of scroll bar (either vertically or horizontally) + public ScrollBar(ScrollBar.Direction direction) : this(NDalicPINVOKE.ScrollBar_New__SWIG_0((int)direction), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Creates an uninitialized ScrollBar + /// + public ScrollBar() : this(NDalicPINVOKE.ScrollBar_New__SWIG_1(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal ScrollBar(ScrollBar scrollBar) : this(NDalicPINVOKE.new_ScrollBar__SWIG_1(ScrollBar.getCPtr(scrollBar)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public new static ScrollBar DownCast(BaseHandle handle) + { + ScrollBar ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as ScrollBar; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetScrollPropertySource(Animatable handle, int propertyScrollPosition, int propertyMinScrollPosition, int propertyMaxScrollPosition, int propertyScrollContentSize) + { + NDalicPINVOKE.ScrollBar_SetScrollPropertySource(swigCPtr, Animatable.getCPtr(handle), propertyScrollPosition, propertyMinScrollPosition, propertyMaxScrollPosition, propertyScrollContentSize); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetScrollIndicator(View indicator) + { + NDalicPINVOKE.ScrollBar_SetScrollIndicator(swigCPtr, View.getCPtr(indicator)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal View GetScrollIndicator() + { + View ret = new View(NDalicPINVOKE.ScrollBar_GetScrollIndicator(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetScrollDirection(ScrollBar.Direction direction) + { + NDalicPINVOKE.ScrollBar_SetScrollDirection(swigCPtr, (int)direction); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ScrollBar.Direction GetScrollDirection() + { + ScrollBar.Direction ret = (ScrollBar.Direction)NDalicPINVOKE.ScrollBar_GetScrollDirection(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetIndicatorHeightPolicy(ScrollBar.IndicatorHeightPolicyType policy) + { + NDalicPINVOKE.ScrollBar_SetIndicatorHeightPolicy(swigCPtr, (int)policy); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ScrollBar.IndicatorHeightPolicyType GetIndicatorHeightPolicy() + { + ScrollBar.IndicatorHeightPolicyType ret = (ScrollBar.IndicatorHeightPolicyType)NDalicPINVOKE.ScrollBar_GetIndicatorHeightPolicy(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetIndicatorFixedHeight(float height) + { + NDalicPINVOKE.ScrollBar_SetIndicatorFixedHeight(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetIndicatorFixedHeight() + { + float ret = NDalicPINVOKE.ScrollBar_GetIndicatorFixedHeight(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetIndicatorShowDuration(float durationSeconds) + { + NDalicPINVOKE.ScrollBar_SetIndicatorShowDuration(swigCPtr, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetIndicatorShowDuration() + { + float ret = NDalicPINVOKE.ScrollBar_GetIndicatorShowDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetIndicatorHideDuration(float durationSeconds) + { + NDalicPINVOKE.ScrollBar_SetIndicatorHideDuration(swigCPtr, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal float GetIndicatorHideDuration() + { + float ret = NDalicPINVOKE.ScrollBar_GetIndicatorHideDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void ShowIndicator() + { + NDalicPINVOKE.ScrollBar_ShowIndicator(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void HideIndicator() + { + NDalicPINVOKE.ScrollBar_HideIndicator(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal VoidSignal PanFinishedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.ScrollBar_PanFinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal FloatSignal ScrollPositionIntervalReachedSignal() + { + FloatSignal ret = new FloatSignal(NDalicPINVOKE.ScrollBar_ScrollPositionIntervalReachedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Direction of scroll bar + /// + public enum Direction + { + Vertical = 0, + Horizontal + } + + /// + /// Indicator height policy. + /// + public enum IndicatorHeightPolicyType + { + Variable = 0, + Fixed + } + + /// + /// Direction of scroll bar + /// + public Direction ScrollDirection + { + get + { + string temp; + if (GetProperty(ScrollBar.Property.SCROLL_DIRECTION).Get(out temp) == false) + { + NUILog.Error("ScrollDirection get error!"); + } + + switch (temp) + { + case "Vertical": + return Direction.Vertical; + case "Horizontal": + return Direction.Horizontal; + default: + return Direction.Vertical; + } + } + set + { + string valueToString = ""; + switch (value) + { + case Direction.Vertical: + { + valueToString = "Vertical"; + break; + } + case Direction.Horizontal: + { + valueToString = "Horizontal"; + break; + } + default: + { + valueToString = "Vertical"; + break; + } + } + SetProperty(ScrollBar.Property.SCROLL_DIRECTION, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// Indicator height policy. + /// + public IndicatorHeightPolicyType IndicatorHeightPolicy + { + get + { + string temp; + if (GetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY).Get(out temp) == false) + { + NUILog.Error("IndicatorHeightPolicy get error!"); + } + + switch (temp) + { + case "Variable": + return IndicatorHeightPolicyType.Variable; + case "Fixed": + return IndicatorHeightPolicyType.Fixed; + default: + return IndicatorHeightPolicyType.Variable; + } + } + set + { + string valueToString = ""; + switch (value) + { + case IndicatorHeightPolicyType.Variable: + { + valueToString = "Variable"; + break; + } + case IndicatorHeightPolicyType.Fixed: + { + valueToString = "Fixed"; + break; + } + default: + { + valueToString = "Variable"; + break; + } + } + SetProperty(ScrollBar.Property.INDICATOR_HEIGHT_POLICY, new Tizen.NUI.PropertyValue(valueToString)); + } + } + + /// + /// the fixed height of scroll indicator. + /// + public float IndicatorFixedHeight + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_FIXED_HEIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// the duration in seconds for the scroll indicator to become fully visible. + /// + public float IndicatorShowDuration + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_SHOW_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// the duration in seconds for the scroll indicator to become fully invisible. + /// + public float IndicatorHideDuration + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_HIDE_DURATION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// the list of values to get notification when the current scroll position of the scrollable object goes above or below any of these values. + /// + public Tizen.NUI.PropertyArray ScrollPositionIntervals + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS).Get(temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.SCROLL_POSITION_INTERVALS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The minimum height for a variable size indicator. + /// + public float IndicatorMinimumHeight + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_MINIMUM_HEIGHT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The padding at the start of the indicator. For example, the top if scrollDirection is Vertical. + /// + public float IndicatorStartPadding + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_START_PADDING).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_START_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// The padding at the end of the indicator. For example, the bottom if scrollDirection is Vertical. + /// + public float IndicatorEndPadding + { + get + { + float temp = 0.0f; + GetProperty(ScrollBar.Property.INDICATOR_END_PADDING).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollBar.Property.INDICATOR_END_PADDING, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs new file mode 100755 index 0000000..b9bb7ea --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/ScrollView.cs @@ -0,0 +1,919 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + public class ScrollView : Scrollable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ScrollView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ScrollView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ScrollView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /** + * @brief Event arguments that passed via SnapStarted signal + * + */ + public class SnapStartedEventArgs : EventArgs + { + private Tizen.NUI.ScrollView.SnapEvent _snapEvent; + + /** + * @brief SnapEvent - is the SnapEvent information like snap or flick (it tells the target position, scale, rotation for the snap or flick). + * + */ + public Tizen.NUI.ScrollView.SnapEvent SnapEventInfo + { + get + { + return _snapEvent; + } + set + { + _snapEvent = value; + } + } + } + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void SnapStartedCallbackDelegate(IntPtr data); + private DaliEventHandler _scrollViewSnapStartedEventHandler; + private SnapStartedCallbackDelegate _scrollViewSnapStartedCallbackDelegate; + + /** + * @brief Event for SnapStarted signal which can be used to subscribe/unsubscribe the event handler + * (in the type of SnapStartedEventHandler-DaliEventHandler) provided by the user. + * SnapStarted signal is emitted hen the ScrollView has started to snap or flick (it tells the target + * position, scale, rotation for the snap or flick). + * + */ + public event DaliEventHandler SnapStarted + { + add + { + lock (this) + { + // Restricted to only one listener + if (_scrollViewSnapStartedEventHandler == null) + { + _scrollViewSnapStartedEventHandler += value; + + _scrollViewSnapStartedCallbackDelegate = new SnapStartedCallbackDelegate(OnSnapStarted); + this.SnapStartedSignal().Connect(_scrollViewSnapStartedCallbackDelegate); + } + } + } + + remove + { + lock (this) + { + if (_scrollViewSnapStartedEventHandler != null) + { + this.SnapStartedSignal().Disconnect(_scrollViewSnapStartedCallbackDelegate); + } + + _scrollViewSnapStartedEventHandler -= value; + } + } + } + + // Callback for ScrollView SnapStarted signal + private void OnSnapStarted(IntPtr data) + { + SnapStartedEventArgs e = new SnapStartedEventArgs(); + + // Populate all members of "e" (SnapStartedEventArgs) with real data + e.SnapEventInfo = SnapEvent.GetSnapEventFromPtr(data); + + if (_scrollViewSnapStartedEventHandler != null) + { + //here we send all data to user event handlers + _scrollViewSnapStartedEventHandler(this, e); + } + } + + public class SnapEvent : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal SnapEvent(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SnapEvent obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + + ~SnapEvent() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ScrollView_SnapEvent(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + public static SnapEvent GetSnapEventFromPtr(global::System.IntPtr cPtr) + { + SnapEvent ret = new SnapEvent(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SnapType type + { + set + { + NDalicPINVOKE.ScrollView_SnapEvent_type_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + SnapType ret = (SnapType)NDalicPINVOKE.ScrollView_SnapEvent_type_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public Vector2 position + { + set + { + NDalicPINVOKE.ScrollView_SnapEvent_position_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.ScrollView_SnapEvent_position_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public float duration + { + set + { + NDalicPINVOKE.ScrollView_SnapEvent_duration_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.ScrollView_SnapEvent_duration_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public SnapEvent() : this(NDalicPINVOKE.new_ScrollView_SnapEvent(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + + public class Property + { + public static readonly int WRAP_ENABLED = NDalicPINVOKE.ScrollView_Property_WRAP_ENABLED_get(); + public static readonly int PANNING_ENABLED = NDalicPINVOKE.ScrollView_Property_PANNING_ENABLED_get(); + public static readonly int AXIS_AUTO_LOCK_ENABLED = NDalicPINVOKE.ScrollView_Property_AXIS_AUTO_LOCK_ENABLED_get(); + public static readonly int WHEEL_SCROLL_DISTANCE_STEP = NDalicPINVOKE.ScrollView_Property_WHEEL_SCROLL_DISTANCE_STEP_get(); + public static readonly int SCROLL_MODE = NDalicPINVOKE.ScrollView_Property_SCROLL_MODE_get(); + public static readonly int SCROLL_POSITION = NDalicPINVOKE.ScrollView_Property_SCROLL_POSITION_get(); + public static readonly int SCROLL_PRE_POSITION = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_get(); + public static readonly int SCROLL_PRE_POSITION_X = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_X_get(); + public static readonly int SCROLL_PRE_POSITION_Y = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_Y_get(); + public static readonly int SCROLL_PRE_POSITION_MAX = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_MAX_get(); + public static readonly int SCROLL_PRE_POSITION_MAX_X = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_MAX_X_get(); + public static readonly int SCROLL_PRE_POSITION_MAX_Y = NDalicPINVOKE.ScrollView_Property_SCROLL_PRE_POSITION_MAX_Y_get(); + public static readonly int OVERSHOOT_X = NDalicPINVOKE.ScrollView_Property_OVERSHOOT_X_get(); + public static readonly int OVERSHOOT_Y = NDalicPINVOKE.ScrollView_Property_OVERSHOOT_Y_get(); + public static readonly int SCROLL_FINAL = NDalicPINVOKE.ScrollView_Property_SCROLL_FINAL_get(); + public static readonly int SCROLL_FINAL_X = NDalicPINVOKE.ScrollView_Property_SCROLL_FINAL_X_get(); + public static readonly int SCROLL_FINAL_Y = NDalicPINVOKE.ScrollView_Property_SCROLL_FINAL_Y_get(); + public static readonly int WRAP = NDalicPINVOKE.ScrollView_Property_WRAP_get(); + public static readonly int PANNING = NDalicPINVOKE.ScrollView_Property_PANNING_get(); + public static readonly int SCROLLING = NDalicPINVOKE.ScrollView_Property_SCROLLING_get(); + public static readonly int SCROLL_DOMAIN_SIZE = NDalicPINVOKE.ScrollView_Property_SCROLL_DOMAIN_SIZE_get(); + public static readonly int SCROLL_DOMAIN_SIZE_X = NDalicPINVOKE.ScrollView_Property_SCROLL_DOMAIN_SIZE_X_get(); + public static readonly int SCROLL_DOMAIN_SIZE_Y = NDalicPINVOKE.ScrollView_Property_SCROLL_DOMAIN_SIZE_Y_get(); + public static readonly int SCROLL_DOMAIN_OFFSET = NDalicPINVOKE.ScrollView_Property_SCROLL_DOMAIN_OFFSET_get(); + public static readonly int SCROLL_POSITION_DELTA = NDalicPINVOKE.ScrollView_Property_SCROLL_POSITION_DELTA_get(); + public static readonly int START_PAGE_POSITION = NDalicPINVOKE.ScrollView_Property_START_PAGE_POSITION_get(); + + } + + public ScrollView() : this(NDalicPINVOKE.ScrollView_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public AlphaFunction GetScrollSnapAlphaFunction() + { + AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.ScrollView_GetScrollSnapAlphaFunction(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScrollSnapAlphaFunction(AlphaFunction alpha) + { + NDalicPINVOKE.ScrollView_SetScrollSnapAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public AlphaFunction GetScrollFlickAlphaFunction() + { + AlphaFunction ret = new AlphaFunction(NDalicPINVOKE.ScrollView_GetScrollFlickAlphaFunction(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScrollFlickAlphaFunction(AlphaFunction alpha) + { + NDalicPINVOKE.ScrollView_SetScrollFlickAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetScrollSnapDuration() + { + float ret = NDalicPINVOKE.ScrollView_GetScrollSnapDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScrollSnapDuration(float time) + { + NDalicPINVOKE.ScrollView_SetScrollSnapDuration(swigCPtr, time); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetScrollFlickDuration() + { + float ret = NDalicPINVOKE.ScrollView_GetScrollFlickDuration(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScrollFlickDuration(float time) + { + NDalicPINVOKE.ScrollView_SetScrollFlickDuration(swigCPtr, time); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + public void SetScrollSensitive(bool sensitive) + { + NDalicPINVOKE.ScrollView_SetScrollSensitive(swigCPtr, sensitive); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetMaxOvershoot(float overshootX, float overshootY) + { + NDalicPINVOKE.ScrollView_SetMaxOvershoot(swigCPtr, overshootX, overshootY); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetSnapOvershootAlphaFunction(AlphaFunction alpha) + { + NDalicPINVOKE.ScrollView_SetSnapOvershootAlphaFunction(swigCPtr, AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetSnapOvershootDuration(float duration) + { + NDalicPINVOKE.ScrollView_SetSnapOvershootDuration(swigCPtr, duration); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetViewAutoSnap(bool enable) + { + NDalicPINVOKE.ScrollView_SetActorAutoSnap(swigCPtr, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetWrapMode(bool enable) + { + NDalicPINVOKE.ScrollView_SetWrapMode(swigCPtr, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public int GetScrollUpdateDistance() + { + int ret = NDalicPINVOKE.ScrollView_GetScrollUpdateDistance(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetScrollUpdateDistance(int distance) + { + NDalicPINVOKE.ScrollView_SetScrollUpdateDistance(swigCPtr, distance); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool GetAxisAutoLock() + { + bool ret = NDalicPINVOKE.ScrollView_GetAxisAutoLock(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAxisAutoLock(bool enable) + { + NDalicPINVOKE.ScrollView_SetAxisAutoLock(swigCPtr, enable); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetAxisAutoLockGradient() + { + float ret = NDalicPINVOKE.ScrollView_GetAxisAutoLockGradient(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetAxisAutoLockGradient(float gradient) + { + NDalicPINVOKE.ScrollView_SetAxisAutoLockGradient(swigCPtr, gradient); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetFrictionCoefficient() + { + float ret = NDalicPINVOKE.ScrollView_GetFrictionCoefficient(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFrictionCoefficient(float friction) + { + NDalicPINVOKE.ScrollView_SetFrictionCoefficient(swigCPtr, friction); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetFlickSpeedCoefficient() + { + float ret = NDalicPINVOKE.ScrollView_GetFlickSpeedCoefficient(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetFlickSpeedCoefficient(float speed) + { + NDalicPINVOKE.ScrollView_SetFlickSpeedCoefficient(swigCPtr, speed); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 GetMinimumDistanceForFlick() + { + Vector2 ret = new Vector2(NDalicPINVOKE.ScrollView_GetMinimumDistanceForFlick(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMinimumDistanceForFlick(Vector2 distance) + { + NDalicPINVOKE.ScrollView_SetMinimumDistanceForFlick(swigCPtr, Vector2.getCPtr(distance)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetMinimumSpeedForFlick() + { + float ret = NDalicPINVOKE.ScrollView_GetMinimumSpeedForFlick(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMinimumSpeedForFlick(float speed) + { + NDalicPINVOKE.ScrollView_SetMinimumSpeedForFlick(swigCPtr, speed); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public float GetMaxFlickSpeed() + { + float ret = NDalicPINVOKE.ScrollView_GetMaxFlickSpeed(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetMaxFlickSpeed(float speed) + { + NDalicPINVOKE.ScrollView_SetMaxFlickSpeed(swigCPtr, speed); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 GetWheelScrollDistanceStep() + { + Vector2 ret = new Vector2(NDalicPINVOKE.ScrollView_GetWheelScrollDistanceStep(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void SetWheelScrollDistanceStep(Vector2 step) + { + NDalicPINVOKE.ScrollView_SetWheelScrollDistanceStep(swigCPtr, Vector2.getCPtr(step)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public Vector2 GetCurrentScrollPosition() + { + Vector2 ret = new Vector2(NDalicPINVOKE.ScrollView_GetCurrentScrollPosition(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public uint GetCurrentPage() + { + uint ret = NDalicPINVOKE.ScrollView_GetCurrentPage(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public void ScrollTo(Vector2 position) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_0(swigCPtr, Vector2.getCPtr(position)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(Vector2 position, float duration) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_1(swigCPtr, Vector2.getCPtr(position), duration); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(Vector2 position, float duration, AlphaFunction alpha) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_2(swigCPtr, Vector2.getCPtr(position), duration, AlphaFunction.getCPtr(alpha)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(Vector2 position, float duration, DirectionBias horizontalBias, DirectionBias verticalBias) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_3(swigCPtr, Vector2.getCPtr(position), duration, (int)horizontalBias, (int)verticalBias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(Vector2 position, float duration, AlphaFunction alpha, DirectionBias horizontalBias, DirectionBias verticalBias) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_4(swigCPtr, Vector2.getCPtr(position), duration, AlphaFunction.getCPtr(alpha), (int)horizontalBias, (int)verticalBias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(uint page) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_5(swigCPtr, page); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(uint page, float duration) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_6(swigCPtr, page, duration); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(uint page, float duration, DirectionBias bias) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_7(swigCPtr, page, duration, (int)bias); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(View view) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_8(swigCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ScrollTo(View view, float duration) + { + NDalicPINVOKE.ScrollView_ScrollTo__SWIG_9(swigCPtr, View.getCPtr(view), duration); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public bool ScrollToSnapPoint() + { + bool ret = NDalicPINVOKE.ScrollView_ScrollToSnapPoint(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void ApplyConstraintToChildren(SWIGTYPE_p_Dali__Constraint constraint) + { + NDalicPINVOKE.ScrollView_ApplyConstraintToChildren(swigCPtr, SWIGTYPE_p_Dali__Constraint.getCPtr(constraint)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void ApplyEffect(ScrollViewEffect effect) + { + NDalicPINVOKE.ScrollView_ApplyEffect(swigCPtr, ScrollViewEffect.getCPtr(effect)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveEffect(ScrollViewEffect effect) + { + NDalicPINVOKE.ScrollView_RemoveEffect(swigCPtr, ScrollViewEffect.getCPtr(effect)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveAllEffects() + { + NDalicPINVOKE.ScrollView_RemoveAllEffects(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void BindView(View child) + { + NDalicPINVOKE.ScrollView_BindActor(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void UnbindView(View child) + { + NDalicPINVOKE.ScrollView_UnbindActor(swigCPtr, View.getCPtr(child)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetScrollingDirection(Radian direction, Radian threshold) + { + NDalicPINVOKE.ScrollView_SetScrollingDirection__SWIG_0(swigCPtr, Radian.getCPtr(direction), Radian.getCPtr(threshold)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void SetScrollingDirection(Radian direction) + { + NDalicPINVOKE.ScrollView_SetScrollingDirection__SWIG_1(swigCPtr, Radian.getCPtr(direction)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void RemoveScrollingDirection(Radian direction) + { + NDalicPINVOKE.ScrollView_RemoveScrollingDirection(swigCPtr, Radian.getCPtr(direction)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal ScrollViewSnapStartedSignal SnapStartedSignal() + { + ScrollViewSnapStartedSignal ret = new ScrollViewSnapStartedSignal(NDalicPINVOKE.ScrollView_SnapStartedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public bool WrapEnabled + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.WRAP_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.WRAP_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + public bool PanningEnabled + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.PANNING_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.PANNING_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + public bool AxisAutoLockEnabled + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.AXIS_AUTO_LOCK_ENABLED).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.AXIS_AUTO_LOCK_ENABLED, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 WheelScrollDistanceStep + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.WHEEL_SCROLL_DISTANCE_STEP).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.WHEEL_SCROLL_DISTANCE_STEP, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPrePosition + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_PRE_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_PRE_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPrePositionMax + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_PRE_POSITION_MAX).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_PRE_POSITION_MAX, new Tizen.NUI.PropertyValue(value)); + } + } + public float OvershootX + { + get + { + float temp = 0.0f; + GetProperty(ScrollView.Property.OVERSHOOT_X).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.OVERSHOOT_X, new Tizen.NUI.PropertyValue(value)); + } + } + public float OvershootY + { + get + { + float temp = 0.0f; + GetProperty(ScrollView.Property.OVERSHOOT_Y).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.OVERSHOOT_Y, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollFinal + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_FINAL).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_FINAL, new Tizen.NUI.PropertyValue(value)); + } + } + public bool Wrap + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.WRAP).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.WRAP, new Tizen.NUI.PropertyValue(value)); + } + } + public bool Panning + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.PANNING).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.PANNING, new Tizen.NUI.PropertyValue(value)); + } + } + public bool Scrolling + { + get + { + bool temp = false; + GetProperty(ScrollView.Property.SCROLLING).Get(out temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLLING, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollDomainSize + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_DOMAIN_SIZE).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_DOMAIN_SIZE, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollDomainOffset + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_DOMAIN_OFFSET).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_DOMAIN_OFFSET, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector2 ScrollPositionDelta + { + get + { + Vector2 temp = new Vector2(0.0f, 0.0f); + GetProperty(ScrollView.Property.SCROLL_POSITION_DELTA).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.SCROLL_POSITION_DELTA, new Tizen.NUI.PropertyValue(value)); + } + } + public Vector3 StartPagePosition + { + get + { + Vector3 temp = new Vector3(0.0f, 0.0f, 0.0f); + GetProperty(ScrollView.Property.START_PAGE_POSITION).Get(temp); + return temp; + } + set + { + SetProperty(ScrollView.Property.START_PAGE_POSITION, new Tizen.NUI.PropertyValue(value)); + } + } + + public PropertyMap ScrollMode + { + get + { + PropertyValue value = GetProperty( ScrollView.Property.SCROLL_MODE ); + PropertyMap map = new PropertyMap(); + value.Get( map ); + return map; + } + set + { + SetProperty( ScrollView.Property.SCROLL_MODE, new PropertyValue( value ) ); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/Slider.cs b/src/Tizen.NUI/src/public/UIComponents/Slider.cs new file mode 100755 index 0000000..a7d6882 --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/Slider.cs @@ -0,0 +1,760 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI.UIComponents +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// Slider is a control to enable sliding an indicator between two values. + /// + public class Slider : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal Slider(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Slider_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Slider obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// Dispose + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Slider(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Value changed event arguments. + /// + public class ValueChangedEventArgs : EventArgs + { + private Slider _slider; + private float _slideValue; + + /// + /// Slider. + /// + public Slider Slider + { + get + { + return _slider; + } + set + { + _slider = value; + } + } + + /// + /// Slider value. + /// + public float SlideValue + { + get + { + return _slideValue; + } + set + { + _slideValue = value; + } + } + } + + /// + /// Sliding finished event arguments. + /// + public class SlidingFinishedEventArgs : EventArgs + { + private Slider _slider; + private float _slideValue; + + /// + /// Slider. + /// + public Slider Slider + { + get + { + return _slider; + } + set + { + _slider = value; + } + } + + /// + /// Slider value. + /// + public float SlideValue + { + get + { + return _slideValue; + } + set + { + _slideValue = value; + } + } + } + + /// + /// Mark reached event arguments. + /// + public class MarkReachedEventArgs : EventArgs + { + private Slider _slider; + private int _slideValue; + + /// + /// Slider. + /// + public Slider Slider + { + get + { + return _slider; + } + set + { + _slider = value; + } + } + + /// + /// Slider value. + /// + public int SlideValue + { + get + { + return _slideValue; + } + set + { + _slideValue = value; + } + } + } + + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool ValueChangedCallbackDelegate(IntPtr slider, float slideValue); + private EventHandlerWithReturnType _sliderValueChangedEventHandler; + private ValueChangedCallbackDelegate _sliderValueChangedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool SlidingFinishedCallbackDelegate(IntPtr slider, float slideValue); + private EventHandlerWithReturnType _sliderSlidingFinishedEventHandler; + private SlidingFinishedCallbackDelegate _sliderSlidingFinishedCallbackDelegate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate bool MarkReachedCallbackDelegate(IntPtr slider, int slideValue); + private EventHandlerWithReturnType _sliderMarkReachedEventHandler; + private MarkReachedCallbackDelegate _sliderMarkReachedCallbackDelegate; + + /// + /// Event emitted when the slider value changes. + /// + public event EventHandlerWithReturnType ValueChanged + { + add + { + if (_sliderValueChangedEventHandler == null) + { + _sliderValueChangedCallbackDelegate = (OnValueChanged); + ValueChangedSignal().Connect(_sliderValueChangedCallbackDelegate); + } + _sliderValueChangedEventHandler += value; + } + remove + { + _sliderValueChangedEventHandler -= value; + if (_sliderValueChangedEventHandler == null && ValueChangedSignal().Empty() == false) + { + ValueChangedSignal().Disconnect(_sliderValueChangedCallbackDelegate); + } + } + } + + // Callback for Slider ValueChanged signal + private bool OnValueChanged(IntPtr slider, float slideValue) + { + ValueChangedEventArgs e = new ValueChangedEventArgs(); + + // Populate all members of "e" (ValueChangedEventArgs) with real page + e.Slider = Slider.GetSliderFromPtr(slider); + e.SlideValue = slideValue; + + if (_sliderValueChangedEventHandler != null) + { + //here we send all page to user event handlers + return _sliderValueChangedEventHandler(this, e); + } + return false; + } + + /// + /// Event emitted when the sliding is finished. + /// + public event EventHandlerWithReturnType SlidingFinished + { + add + { + if (_sliderSlidingFinishedEventHandler == null) + { + _sliderSlidingFinishedCallbackDelegate = (OnSlidingFinished); + SlidingFinishedSignal().Connect(_sliderSlidingFinishedCallbackDelegate); + } + _sliderSlidingFinishedEventHandler += value; + } + remove + { + _sliderSlidingFinishedEventHandler -= value; + if (_sliderSlidingFinishedEventHandler == null && SlidingFinishedSignal().Empty() == false) + { + SlidingFinishedSignal().Disconnect(_sliderSlidingFinishedCallbackDelegate); + } + } + } + + // Callback for Slider SlidingFinished signal + private bool OnSlidingFinished(IntPtr slider, float slideValue) + { + SlidingFinishedEventArgs e = new SlidingFinishedEventArgs(); + + // Populate all members of "e" (SlidingFinishedEventArgs) with real page + e.Slider = Slider.GetSliderFromPtr(slider); + e.SlideValue = slideValue; + + if (_sliderSlidingFinishedEventHandler != null) + { + //here we send all page to user event handlers + return _sliderSlidingFinishedEventHandler(this, e); + } + return false; + } + + /// + /// Event emitted when the slider handle reaches a mark. + /// + public event EventHandlerWithReturnType MarkReached + { + add + { + if (_sliderMarkReachedEventHandler == null) + { + _sliderMarkReachedCallbackDelegate = (OnMarkReached); + MarkReachedSignal().Connect(_sliderMarkReachedCallbackDelegate); + } + _sliderMarkReachedEventHandler += value; + } + remove + { + _sliderMarkReachedEventHandler -= value; + if (_sliderMarkReachedEventHandler == null && MarkReachedSignal().Empty() == false) + { + MarkReachedSignal().Disconnect(_sliderMarkReachedCallbackDelegate); + } + } + } + + // Callback for Slider MarkReached signal + private bool OnMarkReached(IntPtr slider, int slideValue) + { + MarkReachedEventArgs e = new MarkReachedEventArgs(); + + // Populate all members of "e" (MarkReachedEventArgs) with real page + e.Slider = Slider.GetSliderFromPtr(slider); + e.SlideValue = slideValue; + + if (_sliderMarkReachedEventHandler != null) + { + //here we send all page to user event handlers + return _sliderMarkReachedEventHandler(this, e); + } + return false; + } + + /// + /// Get Slider from the pointer. + /// + /// The pointer of Slider + /// Object of Slider type + internal static Slider GetSliderFromPtr(global::System.IntPtr cPtr) + { + Slider ret = new Slider(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal class Property : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Property(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Property obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Property() + { + if (!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Slider_Property(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + disposed = true; + } + + internal Property() : this(NDalicPINVOKE.new_Slider_Property(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static readonly int LOWER_BOUND = NDalicPINVOKE.Slider_Property_LOWER_BOUND_get(); + internal static readonly int UPPER_BOUND = NDalicPINVOKE.Slider_Property_UPPER_BOUND_get(); + internal static readonly int VALUE = NDalicPINVOKE.Slider_Property_VALUE_get(); + internal static readonly int TRACK_VISUAL = NDalicPINVOKE.Slider_Property_TRACK_VISUAL_get(); + internal static readonly int HANDLE_VISUAL = NDalicPINVOKE.Slider_Property_HANDLE_VISUAL_get(); + internal static readonly int PROGRESS_VISUAL = NDalicPINVOKE.Slider_Property_PROGRESS_VISUAL_get(); + internal static readonly int POPUP_VISUAL = NDalicPINVOKE.Slider_Property_POPUP_VISUAL_get(); + internal static readonly int POPUP_ARROW_VISUAL = NDalicPINVOKE.Slider_Property_POPUP_ARROW_VISUAL_get(); + internal static readonly int DISABLED_COLOR = NDalicPINVOKE.Slider_Property_DISABLED_COLOR_get(); + internal static readonly int VALUE_PRECISION = NDalicPINVOKE.Slider_Property_VALUE_PRECISION_get(); + internal static readonly int SHOW_POPUP = NDalicPINVOKE.Slider_Property_SHOW_POPUP_get(); + internal static readonly int SHOW_VALUE = NDalicPINVOKE.Slider_Property_SHOW_VALUE_get(); + internal static readonly int MARKS = NDalicPINVOKE.Slider_Property_MARKS_get(); + internal static readonly int SNAP_TO_MARKS = NDalicPINVOKE.Slider_Property_SNAP_TO_MARKS_get(); + internal static readonly int MARK_TOLERANCE = NDalicPINVOKE.Slider_Property_MARK_TOLERANCE_get(); + + } + + /// + /// Creates the Slider control. + /// + public Slider() : this(NDalicPINVOKE.Slider_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + internal Slider(Slider handle) : this(NDalicPINVOKE.new_Slider__SWIG_1(Slider.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Slider Assign(Slider handle) + { + Slider ret = new Slider(NDalicPINVOKE.Slider_Assign(swigCPtr, Slider.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Downcasts an Object handle to Slider.
+ /// If handle points to a Slider, the downcast produces valid handle.
+ /// If not, the returned handle is left uninitialized.
+ ///
+ /// Handle to an object + /// Handle to a Slider or an uninitialized handle + public new static Slider DownCast(BaseHandle handle) + { + Slider ret = Registry.GetManagedBaseHandleFromNativePtr(handle) as Slider; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SliderValueChangedSignal ValueChangedSignal() + { + SliderValueChangedSignal ret = new SliderValueChangedSignal(NDalicPINVOKE.Slider_ValueChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SliderValueChangedSignal SlidingFinishedSignal() + { + SliderValueChangedSignal ret = new SliderValueChangedSignal(NDalicPINVOKE.Slider_SlidingFinishedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal SliderMarkReachedSignal MarkReachedSignal() + { + SliderMarkReachedSignal ret = new SliderMarkReachedSignal(NDalicPINVOKE.Slider_MarkReachedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Lower bound property + /// + public float LowerBound + { + get + { + float temp = 0.0f; + GetProperty(Slider.Property.LOWER_BOUND).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.LOWER_BOUND, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Upper bound property + /// + public float UpperBound + { + get + { + float temp = 0.0f; + GetProperty(Slider.Property.UPPER_BOUND).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.UPPER_BOUND, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Value property + /// + public float Value + { + get + { + float temp = 0.0f; + GetProperty(Slider.Property.VALUE).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.VALUE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Track visual property + /// + public PropertyMap TrackVisual + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Slider.Property.TRACK_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.TRACK_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Handle visual property + /// + public PropertyMap HandleVisual + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Slider.Property.HANDLE_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.HANDLE_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Progress visual property + /// + public PropertyMap ProgressVisual + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Slider.Property.PROGRESS_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.PROGRESS_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Popup visual property + /// + public PropertyMap PopupVisual + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Slider.Property.POPUP_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.POPUP_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Popup arrow visual property + /// + public PropertyMap PopupArrowVisual + { + get + { + PropertyMap temp = new PropertyMap(); + GetProperty(Slider.Property.POPUP_ARROW_VISUAL).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.POPUP_ARROW_VISUAL, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Disable color property + /// + public Vector4 DisabledColor + { + get + { + Vector4 temp = new Vector4(0.0f, 0.0f, 0.0f, 0.0f); + GetProperty(Slider.Property.DISABLED_COLOR).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.DISABLED_COLOR, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Value presicion property + /// + public int ValuePrecision + { + get + { + int temp = 0; + GetProperty(Slider.Property.VALUE_PRECISION).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.VALUE_PRECISION, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Show popup property + /// + public bool ShowPopup + { + get + { + bool temp = false; + GetProperty(Slider.Property.SHOW_POPUP).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.SHOW_POPUP, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Show value property + /// + public bool ShowValue + { + get + { + bool temp = false; + GetProperty(Slider.Property.SHOW_VALUE).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.SHOW_VALUE, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Marks property + /// + public Tizen.NUI.PropertyArray Marks + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(Slider.Property.MARKS).Get(temp); + return temp; + } + set + { + SetProperty(Slider.Property.MARKS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Snap to marks property + /// + public bool SnapToMarks + { + get + { + bool temp = false; + GetProperty(Slider.Property.SNAP_TO_MARKS).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.SNAP_TO_MARKS, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Mark tolerance property + /// + public float MarkTolerance + { + get + { + float temp = 0.0f; + GetProperty(Slider.Property.MARK_TOLERANCE).Get(out temp); + return temp; + } + set + { + SetProperty(Slider.Property.MARK_TOLERANCE, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs b/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs new file mode 100755 index 0000000..fe3eef4 --- /dev/null +++ b/src/Tizen.NUI/src/public/UIComponents/ToggleButton.cs @@ -0,0 +1,123 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + + public class ToggleButton : Tizen.NUI.UIComponents.Button + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal ToggleButton(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.ToggleButton_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ToggleButton obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_ToggleButton(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + public class Property + { + public static readonly int STATE_VISUALS = NDalicPINVOKE.ToggleButton_Property_STATE_VISUALS_get(); + public static readonly int TOOLTIPS = NDalicPINVOKE.ToggleButton_Property_TOOLTIPS_get(); + public static readonly int CURRENT_STATE_INDEX = NDalicPINVOKE.ToggleButton_Property_CURRENT_STATE_INDEX_get(); + } + + public ToggleButton() : this(NDalicPINVOKE.ToggleButton_New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + public Tizen.NUI.PropertyArray StateVisuals + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(ToggleButton.Property.STATE_VISUALS).Get(temp); + return temp; + } + set + { + SetProperty(ToggleButton.Property.STATE_VISUALS, new Tizen.NUI.PropertyValue(value)); + } + } + public Tizen.NUI.PropertyArray Tooltips + { + get + { + Tizen.NUI.PropertyArray temp = new Tizen.NUI.PropertyArray(); + GetProperty(ToggleButton.Property.TOOLTIPS).Get(temp); + return temp; + } + set + { + SetProperty(ToggleButton.Property.TOOLTIPS, new Tizen.NUI.PropertyValue(value)); + } + } + public int CurrentStateIndex + { + get + { + int temp = 0; + GetProperty(ToggleButton.Property.CURRENT_STATE_INDEX).Get(out temp); + return temp; + } + set + { + SetProperty(ToggleButton.Property.CURRENT_STATE_INDEX, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Vector2.cs b/src/Tizen.NUI/src/public/Vector2.cs new file mode 100755 index 0000000..b8e05da --- /dev/null +++ b/src/Tizen.NUI/src/public/Vector2.cs @@ -0,0 +1,565 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A two dimensional vector. + /// + public class Vector2 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Vector2(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector2 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Vector2() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector2(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// First value + /// Second value + /// A vector containing the result of the addition + public static Vector2 operator +(Vector2 arg1, Vector2 arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// First value + /// Second value + /// A vector containing the result of the subtraction + public static Vector2 operator -(Vector2 arg1, Vector2 arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Target Value + /// A vector containg the negation + public static Vector2 operator -(Vector2 arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the multiplication + public static Vector2 operator *(Vector2 arg1, Vector2 arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static Vector2 operator *(Vector2 arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the division + public static Vector2 operator /(Vector2 arg1, Vector2 arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static Vector2 operator /(Vector2 arg1, float arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Array subscript operator overload. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Vector2 GetVector2FromPtr(global::System.IntPtr cPtr) + { + Vector2 ret = new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Default constructor, initializes the vector to 0. + /// + public Vector2() : this(NDalicPINVOKE.new_Vector2__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// x or width component + /// y or height component + public Vector2(float x, float y) : this(NDalicPINVOKE.new_Vector2__SWIG_1(x, y), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from an array of two floats. + /// + /// Array of xy + public Vector2(float[] array) : this(NDalicPINVOKE.new_Vector2__SWIG_2(array), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// Vector3 to create this vector from + public Vector2(Vector3 vec3) : this(NDalicPINVOKE.new_Vector2__SWIG_3(Vector3.getCPtr(vec3)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// Vector4 to create this vector from + public Vector2(Vector4 vec4) : this(NDalicPINVOKE.new_Vector2__SWIG_4(Vector4.getCPtr(vec4)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// (1.0f,1.0f) + /// + public static Vector2 One + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ONE_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the X axis + /// + public static Vector2 XAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_XAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the Y axis + /// + public static Vector2 YAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_YAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the negative X axis + /// + public static Vector2 NegativeXAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_XAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the negative Y axis + /// + public static Vector2 NegativeYAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_NEGATIVE_YAXIS_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (0.0f, 0.0f) + /// + public static Vector2 Zero + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_ZERO_get(); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 Add(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Add(swigCPtr, Vector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 AddAssign(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_AddAssign(swigCPtr, Vector2.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Subtract(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 SubtractAssign(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_SubtractAssign(swigCPtr, Vector2.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Multiply(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Multiply(float rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 MultiplyAssign(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 MultiplyAssign(float rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Divide(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Divide(float rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 DivideAssign(Vector2 rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_0(swigCPtr, Vector2.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 DivideAssign(float rhs) + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_DivideAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector2 Subtract() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector2_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool EqualTo(Vector2 rhs) + { + bool ret = NDalicPINVOKE.Vector2_EqualTo(swigCPtr, Vector2.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool NotEqualTo(Vector2 rhs) + { + bool ret = NDalicPINVOKE.Vector2_NotEqualTo(swigCPtr, Vector2.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector2_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector. + /// + /// The length of the vector + public float Length() + { + float ret = NDalicPINVOKE.Vector2_Length(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector squared.
+ /// This is more efficient than Length() for threshold + /// testing as it avoids the use of a square root.
+ ///
+ /// The length of the vector squared + public float LengthSquared() + { + float ret = NDalicPINVOKE.Vector2_LengthSquared(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the vector to be unit length, whilst maintaining its direction. + /// + public void Normalize() + { + NDalicPINVOKE.Vector2_Normalize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Clamps the vector between minimum and maximum vectors. + /// + /// The minimum vector + /// The maximum vector + public void Clamp(Vector2 min, Vector2 max) + { + NDalicPINVOKE.Vector2_Clamp(swigCPtr, Vector2.getCPtr(min), Vector2.getCPtr(max)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_float AsFloat() + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector2_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// x component + /// + public float X + { + set + { + NDalicPINVOKE.Vector2_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// width + /// + public float Width + { + set + { + NDalicPINVOKE.Vector2_Width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + NDalicPINVOKE.Vector2_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// height + /// + public float Height + { + set + { + NDalicPINVOKE.Vector2_Height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector2_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Vector3.cs b/src/Tizen.NUI/src/public/Vector3.cs new file mode 100755 index 0000000..dcd16e6 --- /dev/null +++ b/src/Tizen.NUI/src/public/Vector3.cs @@ -0,0 +1,727 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A three dimensional vector. + /// + public class Vector3 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Vector3(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector3 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Vector3() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector3(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the addition + public static Vector3 operator +(Vector3 arg1, Vector3 arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the subtraction + public static Vector3 operator -(Vector3 arg1, Vector3 arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Target Value + /// A vector containg the negation + public static Vector3 operator -(Vector3 arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the multiplication + public static Vector3 operator *(Vector3 arg1, Vector3 arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static Vector3 operator *(Vector3 arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the division + public static Vector3 operator /(Vector3 arg1, Vector3 arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static Vector3 operator /(Vector3 arg1, float arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Array subscript operator overload. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Vector3 GetVector3FromPtr(global::System.IntPtr cPtr) + { + Vector3 ret = new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Constructor. + /// + public Vector3() : this(NDalicPINVOKE.new_Vector3__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Default constructor, initializes the vector to 0. + /// + /// x (or width) component + /// y (or height) component + /// z (or depth) component + public Vector3(float x, float y, float z) : this(NDalicPINVOKE.new_Vector3__SWIG_1(x, y, z), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from an array of three floats. + /// + /// Array of xyz + public Vector3(float[] array) : this(NDalicPINVOKE.new_Vector3__SWIG_2(array), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// Vector2 to create this vector from + public Vector3(Vector2 vec2) : this(NDalicPINVOKE.new_Vector3__SWIG_3(Vector2.getCPtr(vec2)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor + /// + /// Vector4 to create this vector from + public Vector3(Vector4 vec4) : this(NDalicPINVOKE.new_Vector3__SWIG_4(Vector4.getCPtr(vec4)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// (1.0f,1.0f,1.0f) + /// + public static Vector3 One + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ONE_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the X axis + /// + public static Vector3 XAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_XAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the Y axis + /// + public static Vector3 YAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_YAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the Z axis + /// + public static Vector3 ZAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the negative X axis + /// + public static Vector3 NegativeXAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_XAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the negative Y axis + /// + public static Vector3 NegativeYAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_YAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// Vector representing the negative Z axis + /// + public static Vector3 NegativeZAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_NEGATIVE_ZAXIS_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (0.0f, 0.0f, 0.0f) + /// + public static Vector3 Zero + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_ZERO_get(); + Vector3 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector3(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector3 Add(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Add(swigCPtr, Vector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 AddAssign(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_AddAssign(swigCPtr, Vector3.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Subtract(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Subtract__SWIG_0(swigCPtr, Vector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 SubtractAssign(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_SubtractAssign(swigCPtr, Vector3.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Multiply(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Multiply__SWIG_0(swigCPtr, Vector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Multiply(float rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 MultiplyAssign(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_MultiplyAssign__SWIG_0(swigCPtr, Vector3.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 MultiplyAssign(float rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 MultiplyAssign(Rotation rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_MultiplyAssign__SWIG_2(swigCPtr, Rotation.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Divide(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Divide__SWIG_0(swigCPtr, Vector3.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Divide(float rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 DivideAssign(Vector3 rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_DivideAssign__SWIG_0(swigCPtr, Vector3.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 DivideAssign(float rhs) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_DivideAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector3 Subtract() + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool EqualTo(Vector3 rhs) + { + bool ret = NDalicPINVOKE.Vector3_EqualTo(swigCPtr, Vector3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool NotEqualTo(Vector3 rhs) + { + bool ret = NDalicPINVOKE.Vector3_NotEqualTo(swigCPtr, Vector3.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector3_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Dot(Vector3 other) + { + float ret = NDalicPINVOKE.Vector3_Dot(swigCPtr, Vector3.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector3 Cross(Vector3 other) + { + Vector3 ret = new Vector3(NDalicPINVOKE.Vector3_Cross(swigCPtr, Vector3.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector. + /// + /// The length of the vector + public float Length() + { + float ret = NDalicPINVOKE.Vector3_Length(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector squared.
+ /// This is more efficient than Length() for threshold + /// testing as it avoids the use of a square root.
+ ///
+ /// The length of the vector squared + public float LengthSquared() + { + float ret = NDalicPINVOKE.Vector3_LengthSquared(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the vector to be unit length, whilst maintaining its direction. + /// + public void Normalize() + { + NDalicPINVOKE.Vector3_Normalize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Clamps the vector between minimum and maximum vectors. + /// + /// The minimum vector + /// The maximum vector + public void Clamp(Vector3 min, Vector3 max) + { + NDalicPINVOKE.Vector3_Clamp(swigCPtr, Vector3.getCPtr(min), Vector3.getCPtr(max)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_float AsFloat() + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector3_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the x & y components (or width & height, or r & g) as a Vector2. + /// + /// The partial vector contents as Vector2 (x,y) + public Vector2 GetVectorXY() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector3_GetVectorXY__SWIG_0(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the y & z components (or height & depth, or g & b) as a Vector2. + /// + /// The partial vector contents as Vector2 (y,z) + public Vector2 GetVectorYZ() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Vector3_GetVectorYZ__SWIG_0(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// x component + /// + public float X + { + set + { + NDalicPINVOKE.Vector3_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// width component + /// + public float Width + { + set + { + NDalicPINVOKE.Vector3_Width_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Width_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// red component + /// + public float R + { + set + { + NDalicPINVOKE.Vector3_r_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_r_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + NDalicPINVOKE.Vector3_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// height component + /// + public float Height + { + set + { + NDalicPINVOKE.Vector3_Height_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Height_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// green component + /// + public float G + { + set + { + NDalicPINVOKE.Vector3_g_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_g_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// z component + /// + public float Z + { + set + { + NDalicPINVOKE.Vector3_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// depth component + /// + public float Depth + { + set + { + NDalicPINVOKE.Vector3_Depth_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_Depth_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// blue component + /// + public float B + { + set + { + NDalicPINVOKE.Vector3_b_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector3_b_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Vector4.cs b/src/Tizen.NUI/src/public/Vector4.cs new file mode 100755 index 0000000..3fefc5b --- /dev/null +++ b/src/Tizen.NUI/src/public/Vector4.cs @@ -0,0 +1,726 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// A four dimensional vector. + /// + public class Vector4 : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Vector4(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Vector4 obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Vector4() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Vector4(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + /// + /// Addition operator. + /// + /// First value + /// Second value + /// A vector containing the result of the addition + public static Vector4 operator +(Vector4 arg1, Vector4 arg2) + { + return arg1.Add(arg2); + } + + /// + /// Subtraction operator. + /// + /// First value + /// Second value + /// A vector containing the result of the subtraction + public static Vector4 operator -(Vector4 arg1, Vector4 arg2) + { + return arg1.Subtract(arg2); + } + + /// + /// Unary negation operator. + /// + /// Target Value + /// A vector containg the negation + public static Vector4 operator -(Vector4 arg1) + { + return arg1.Subtract(); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the multiplication + public static Vector4 operator *(Vector4 arg1, Vector4 arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Multiplication operator. + /// + /// First Value + /// The float value to scale the vector + /// A vector containing the result of the scaling + public static Vector4 operator *(Vector4 arg1, float arg2) + { + return arg1.Multiply(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// Second Value + /// A vector containing the result of the division + public static Vector4 operator /(Vector4 arg1, Vector4 arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Division operator. + /// + /// First Value + /// The float value to scale the vector by + /// A vector containing the result of the scaling + public static Vector4 operator /(Vector4 arg1, float arg2) + { + return arg1.Divide(arg2); + } + + /// + /// Array subscript operator overload. + /// + /// Subscript index + /// The float at the given index + public float this[uint index] + { + get + { + return ValueOfIndex(index); + } + } + + internal static Vector4 GetVector4FromPtr(global::System.IntPtr cPtr) + { + Vector4 ret = new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Default constructor, initializes the vector to 0. + /// + public Vector4() : this(NDalicPINVOKE.new_Vector4__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from four floats. + /// + /// x (or r/s) component + /// y (or g/t) component + /// z (or b/p) component + /// w (or a/q) component + public Vector4(float x, float y, float z, float w) : this(NDalicPINVOKE.new_Vector4__SWIG_1(x, y, z, w), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from an array of four floats. + /// + /// array Array of either xyzw/rgba/stpq + public Vector4(float[] array) : this(NDalicPINVOKE.new_Vector4__SWIG_2(array), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from Vector2. + /// + /// Vector2 to copy from, z and w are initialized to 0 + public Vector4(Vector2 vec2) : this(NDalicPINVOKE.new_Vector4__SWIG_3(Vector2.getCPtr(vec2)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Conversion constructor from Vector3. + /// + /// Vector3 to copy from, w is initialized to 0 + public Vector4(Vector3 vec3) : this(NDalicPINVOKE.new_Vector4__SWIG_4(Vector3.getCPtr(vec3)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// (1.0f,1.0f,1.0f,1.0f) + /// + public static Vector4 One + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_ONE_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (1.0f,0.0f,0.0f,0.0f) + /// + public static Vector4 XAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_XAXIS_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (0.0f,1.0f,0.0f,0.0f) + /// + public static Vector4 YAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_YAXIS_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (0.0f,0.0f,1.0f,0.0f) + /// + public static Vector4 ZAxis + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_ZAXIS_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// (0.0f, 0.0f, 0.0f, 0.0f) + /// + public static Vector4 Zero + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_ZERO_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector4 Add(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Add(swigCPtr, Vector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 AddAssign(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_AddAssign(swigCPtr, Vector4.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Subtract(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Subtract__SWIG_0(swigCPtr, Vector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 SubtractAssign(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_SubtractAssign(swigCPtr, Vector4.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Multiply(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Multiply__SWIG_0(swigCPtr, Vector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Multiply(float rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Multiply__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 MultiplyAssign(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_0(swigCPtr, Vector4.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 MultiplyAssign(float rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_MultiplyAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Divide(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Divide__SWIG_0(swigCPtr, Vector4.getCPtr(rhs)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Divide(float rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Divide__SWIG_1(swigCPtr, rhs), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 DivideAssign(Vector4 rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_DivideAssign__SWIG_0(swigCPtr, Vector4.getCPtr(rhs)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 DivideAssign(float rhs) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_DivideAssign__SWIG_1(swigCPtr, rhs), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Vector4 Subtract() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Subtract__SWIG_1(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool EqualTo(Vector4 rhs) + { + bool ret = NDalicPINVOKE.Vector4_EqualTo(swigCPtr, Vector4.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private bool NotEqualTo(Vector4 rhs) + { + bool ret = NDalicPINVOKE.Vector4_NotEqualTo(swigCPtr, Vector4.getCPtr(rhs)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private float ValueOfIndex(uint index) + { + float ret = NDalicPINVOKE.Vector4_ValueOfIndex__SWIG_0(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Dot(Vector3 other) + { + float ret = NDalicPINVOKE.Vector4_Dot__SWIG_0(swigCPtr, Vector3.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Dot(Vector4 other) + { + float ret = NDalicPINVOKE.Vector4_Dot__SWIG_1(swigCPtr, Vector4.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal float Dot4(Vector4 other) + { + float ret = NDalicPINVOKE.Vector4_Dot4(swigCPtr, Vector4.getCPtr(other)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector4 Cross(Vector4 other) + { + Vector4 ret = new Vector4(NDalicPINVOKE.Vector4_Cross(swigCPtr, Vector4.getCPtr(other)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector. + /// + /// The length + public float Length() + { + float ret = NDalicPINVOKE.Vector4_Length(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the length of the vector squared.
+ /// This is faster than using Length() when performing + /// threshold checks as it avoids use of the square root.
+ ///
+ /// The length of the vector squared + public float LengthSquared() + { + float ret = NDalicPINVOKE.Vector4_LengthSquared(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Normalizes the vector.
+ /// Sets the vector to unit length whilst maintaining its direction.
+ ///
+ public void Normalize() + { + NDalicPINVOKE.Vector4_Normalize(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Clamps the vector between minimum and maximum vectors. + /// + /// The minimum vector + /// The maximum vector + public void Clamp(Vector4 min, Vector4 max) + { + NDalicPINVOKE.Vector4_Clamp(swigCPtr, Vector4.getCPtr(min), Vector4.getCPtr(max)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal SWIGTYPE_p_float AsFloat() + { + global::System.IntPtr cPtr = NDalicPINVOKE.Vector4_AsFloat__SWIG_0(swigCPtr); + SWIGTYPE_p_float ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_float(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// x component + /// + public float X + { + set + { + NDalicPINVOKE.Vector4_X_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_X_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// red component + /// + public float R + { + set + { + NDalicPINVOKE.Vector4_r_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_r_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// s component + /// + public float S + { + set + { + NDalicPINVOKE.Vector4_s_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_s_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// y component + /// + public float Y + { + set + { + NDalicPINVOKE.Vector4_Y_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_Y_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// green component + /// + public float G + { + set + { + NDalicPINVOKE.Vector4_g_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_g_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// t component + /// + public float T + { + set + { + NDalicPINVOKE.Vector4_t_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_t_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// z component + /// + public float Z + { + set + { + NDalicPINVOKE.Vector4_Z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_Z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// blue component + /// + public float B + { + set + { + NDalicPINVOKE.Vector4_b_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_b_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// p component + /// + public float P + { + set + { + NDalicPINVOKE.Vector4_p_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_p_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// w component + /// + public float W + { + set + { + NDalicPINVOKE.Vector4_W_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_W_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// alpha component + /// + public float A + { + set + { + NDalicPINVOKE.Vector4_a_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_a_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// q component + /// + public float Q + { + set + { + NDalicPINVOKE.Vector4_q_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + float ret = NDalicPINVOKE.Vector4_q_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/ViewWrapper.cs b/src/Tizen.NUI/src/public/ViewWrapper.cs new file mode 100755 index 0000000..f931357 --- /dev/null +++ b/src/Tizen.NUI/src/public/ViewWrapper.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using Tizen.NUI.BaseComponents; + +namespace Tizen.NUI +{ + public class ViewWrapper : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + internal ViewWrapperImpl viewWrapperImpl; + + internal ViewWrapper(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.ViewWrapper_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ViewWrapper obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_ViewWrapper(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + internal ViewWrapper(string typeName, ViewWrapperImpl implementation) : this(NDalicManualPINVOKE.ViewWrapper_New(typeName, ViewWrapperImpl.getCPtr(implementation)), true) + { + viewWrapperImpl = implementation; + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} diff --git a/src/Tizen.NUI/src/public/VisualBase.cs b/src/Tizen.NUI/src/public/VisualBase.cs new file mode 100755 index 0000000..5d68aaf --- /dev/null +++ b/src/Tizen.NUI/src/public/VisualBase.cs @@ -0,0 +1,219 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.NUI +{ + + /// + /// Sets whether the actor should be focusable by keyboard navigation.
+ /// Visuals reuse geometry, shader etc. across controls. They ensure that the renderer and texture sets exist only when control is on-window.
+ /// Each visual also responds to actor size and color change, and provides clipping at the renderer level.
+ ///
+ public class VisualBase : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal VisualBase(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VisualBase_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualBase obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VisualBase(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + /// + /// Create an empty Visual Handle + /// + public VisualBase() : this(NDalicPINVOKE.new_VisualBase__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal VisualBase(VisualBase handle) : this(NDalicPINVOKE.new_VisualBase__SWIG_1(VisualBase.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// name of the visual + /// + public string Name + { + set + { + SetName(value); + } + get + { + return GetName(); + } + } + + internal void SetName(string name) + { + NDalicPINVOKE.VisualBase_SetName(swigCPtr, name); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal string GetName() + { + string ret = NDalicPINVOKE.VisualBase_GetName(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets the transform and the control size + /// + /// A property map describing the transform + /// The size of the parent control for visuals that need to scale internally. + public void SetTransformAndSize(PropertyMap transform, Vector2 controlSize) + { + NDalicPINVOKE.VisualBase_SetTransformAndSize(swigCPtr, PropertyMap.getCPtr(transform), Vector2.getCPtr(controlSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns the height for a given width. + /// + /// Width to use. + /// The height based on the width. + public float GetHeightForWidth(float width) + { + float ret = NDalicPINVOKE.VisualBase_GetHeightForWidth(swigCPtr, width); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Returns the width for a given height. + /// + /// Height to use. + /// The width based on the height. + public float GetWidthForHeight(float height) + { + float ret = NDalicPINVOKE.VisualBase_GetWidthForHeight(swigCPtr, height); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Return the natural size of the visual.
+ /// Deriving classes stipulate the natural size and by default a visual has a ZERO natural size.
+ /// A visual may not actually have a natural size until it has been placed on window and acquired all it's resources.
+ ///
+ /// The visual's natural size + public void GetNaturalSize(Size2D naturalSize) + { + NDalicPINVOKE.VisualBase_GetNaturalSize(swigCPtr, Size2D.getCPtr(naturalSize)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// the depth index of this visual. + /// + public int DepthIndex + { + set + { + SetDepthIndex(value); + } + get + { + return GetDepthIndex(); + } + } + internal void SetDepthIndex(int index) + { + NDalicPINVOKE.VisualBase_SetDepthIndex(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal int GetDepthIndex() + { + int ret = NDalicPINVOKE.VisualBase_GetDepthIndex(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Create the property map representing this visual. + /// + [Obsolete("Please be caution! this will be readonly.")] + public PropertyMap Creation + { + set + { + CreatePropertyMap(value); + } + get + { + PropertyMap map = new PropertyMap(); + CreatePropertyMap(map); + return map; + } + } + + internal void CreatePropertyMap(PropertyMap map) + { + NDalicPINVOKE.VisualBase_CreatePropertyMap(swigCPtr, PropertyMap.getCPtr(map)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal VisualBase(SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base impl) : this(NDalicPINVOKE.new_VisualBase__SWIG_2(SWIGTYPE_p_Dali__Toolkit__Internal__Visual__Base.getCPtr(impl)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + } + +} diff --git a/src/Tizen.NUI/src/public/VisualFactory.cs b/src/Tizen.NUI/src/public/VisualFactory.cs new file mode 100755 index 0000000..b1e1d73 --- /dev/null +++ b/src/Tizen.NUI/src/public/VisualFactory.cs @@ -0,0 +1,118 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +using System; + +namespace Tizen.NUI +{ + + /// + /// VisualFactory is a singleton object that provides and shares visuals between views + /// + public class VisualFactory : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal VisualFactory(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.VisualFactory_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(VisualFactory obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_VisualFactory(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + + [Obsolete("Please do not use! this will be deprecated, please use VisualFactory.Instance instead")] + public static VisualFactory Get() + { + VisualFactory ret = new VisualFactory(NDalicPINVOKE.VisualFactory_Get(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VisualFactory() : this(NDalicPINVOKE.new_VisualFactory__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + + /// + /// Request the visual + /// + /// The map contains the properties required by the visual. The content of the map determines the type of visual that will be returned. + /// The handle to the created visual + public VisualBase CreateVisual(PropertyMap propertyMap) + { + VisualBase ret = new VisualBase(NDalicPINVOKE.VisualFactory_CreateVisual__SWIG_0(swigCPtr, PropertyMap.getCPtr(propertyMap)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VisualBase CreateVisual(Image image) + { + VisualBase ret = new VisualBase(NDalicPINVOKE.VisualFactory_CreateVisual__SWIG_1(swigCPtr, Image.getCPtr(image)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private static readonly VisualFactory instance = VisualFactory.Get(); + + /// + /// retrieve VisualFactory singleton. + /// + public static VisualFactory Instance + { + get + { + return instance; + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/VisualMaps.cs b/src/Tizen.NUI/src/public/VisualMaps.cs new file mode 100755 index 0000000..01098c3 --- /dev/null +++ b/src/Tizen.NUI/src/public/VisualMaps.cs @@ -0,0 +1,2329 @@ +// Copyright (c) 2017 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +namespace Tizen.NUI +{ + using System.Collections.Generic; + using Tizen.NUI.BaseComponents; + + /// + /// A class encapsulating the transform map of visual. + /// + public class VisualMap + { + private Vector2 _visualSize = null; + private Vector2 _visualOffset = null; + private Vector2 _visualOffsetPolicy = null; + private Vector2 _visualSizePolicy = null; + private Visual.AlignType? _visualOrigin = null; + private Visual.AlignType? _visualAnchorPoint = null; + + private PropertyMap _visualTransformMap = null; + + private int? _depthIndex = null; + protected PropertyMap _outputVisualMap = null; + + internal string Name + { + set; + get; + } + + internal int VisualIndex + { + set; + get; + } + + internal VisualView Parent + { + set; + get; + } + + public VisualMap() + { + } + + /// + /// Get or set size of the visual.
+ /// It can be either relative (percentage of the parent) + /// or absolute (in world units).
+ /// Optional. + ///
+ public Size2D Size + { + get + { + return _visualSize ?? (new Size2D(1, 1)); + } + set + { + _visualSize = value; + if (_visualSizePolicy == null) + { + _visualSizePolicy = new Vector2(0.0f, 0.0f); + } + UpdateVisual(); + } + } + + /// + /// Get or set offset of the visual.
+ /// It can be either relative (percentage of the parent) + /// or absolute (in world units).
+ /// Optional. + ///
+ public Vector2 Position + { + get + { + return _visualOffset ?? (new Vector2(0.0f, 0.0f)); + } + set + { + _visualOffset = value; + if (_visualOffsetPolicy == null) + { + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + } + UpdateVisual(); + } + } + + /// + /// Get or set relative size of the visual
+ /// (percentage [0.0f to 1.0f] of the control).
+ /// Optional. + ///
+ public RelativeVector2 RelativeSize + { + get + { + return _visualSize ?? (new RelativeVector2(1.0f, 1.0f)); + } + set + { + _visualSize = value; + _visualSizePolicy = new Vector2(0.0f, 0.0f); + UpdateVisual(); + } + } + + /// + /// Get or set relative offset of the visual
+ /// (percentage [0.0f to 1.0f] of the control).
+ /// Optional. + ///
+ public RelativeVector2 RelativePosition + { + get + { + return _visualOffset ?? (new RelativeVector2(0.0f, 0.0f)); + } + set + { + _visualOffset = value; + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + UpdateVisual(); + } + } + + /// + /// Get or set whether the x and y offset values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, both the x and the y offset is relative.
+ /// Optional. + ///
+ public VisualTransformPolicyType PositionPolicy + { + get + { + if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f + && _visualOffsetPolicy.Y == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + break; + case VisualTransformPolicyType.Absolute: + _visualOffsetPolicy = new Vector2(1.0f, 1.0f); + break; + default: + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + break; + } + UpdateVisual(); + } + } + + /// + /// Get or set whether the x offset values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, the x offset is relative.
+ /// Optional. + ///
+ public VisualTransformPolicyType PositionPolicyX + { + get + { + if (_visualOffsetPolicy != null && _visualOffsetPolicy.X == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + if (_visualOffsetPolicy == null) + { + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + } + + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualOffsetPolicy.X = 0.0f; + break; + case VisualTransformPolicyType.Absolute: + _visualOffsetPolicy.X = 1.0f; + break; + default: + _visualOffsetPolicy.X = 0.0f; + break; + } + + UpdateVisual(); + } + } + + /// + /// Get or set whether the y offset values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, the y offset is relative.
+ /// Optional. + ///
+ public VisualTransformPolicyType PositionPolicyY + { + get + { + if (_visualOffsetPolicy != null && _visualOffsetPolicy.Y == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + if (_visualOffsetPolicy == null) + { + _visualOffsetPolicy = new Vector2(0.0f, 0.0f); + } + + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualOffsetPolicy.Y = 0.0f; + break; + case VisualTransformPolicyType.Absolute: + _visualOffsetPolicy.Y = 1.0f; + break; + default: + _visualOffsetPolicy.Y = 0.0f; + break; + } + UpdateVisual(); + } + } + + /// + /// Get or set whether the width or height size values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, both the width and the height offset is relative to the control's size.
+ /// Optional. + ///
+ public VisualTransformPolicyType SizePolicy + { + get + { + if (_visualSizePolicy != null && _visualSizePolicy.X == 1.0f + && _visualSizePolicy.Y == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualSizePolicy = new Vector2(0.0f, 0.0f); + break; + case VisualTransformPolicyType.Absolute: + _visualSizePolicy = new Vector2(1.0f, 1.0f); + break; + default: + _visualSizePolicy = new Vector2(0.0f, 0.0f); + break; + } + UpdateVisual(); + } + } + + /// + /// Get or set whether the width size values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, the width value is relative to the control's width.
+ /// Optional. + ///
+ public VisualTransformPolicyType SizePolicyWidth + { + get + { + if (_visualSizePolicy != null && _visualSizePolicy.Width == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + if (_visualSizePolicy == null) + { + _visualSizePolicy = new Vector2(0.0f, 0.0f); + } + + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualSizePolicy.Width = 0.0f; + break; + case VisualTransformPolicyType.Absolute: + _visualSizePolicy.Width = 1.0f; + break; + default: + _visualSizePolicy.Width = 0.0f; + break; + } + UpdateVisual(); + } + } + + /// + /// Get or set whether the height size values are relative
+ /// (percentage [0.0f to 1.0f] of the control) or absolute (in world units).
+ /// Be default, both the height value is relative to the control's height.
+ /// Optional. + ///
+ public VisualTransformPolicyType SizePolicyHeight + { + get + { + if (_visualSizePolicy != null && _visualSizePolicy.Height == 1.0f) + { + return VisualTransformPolicyType.Absolute; + } + return VisualTransformPolicyType.Relative; + } + set + { + if (_visualSizePolicy == null) + { + _visualSizePolicy = new Vector2(0.0f, 0.0f); + } + + switch (value) + { + case VisualTransformPolicyType.Relative: + _visualSizePolicy.Height = 0.0f; + break; + case VisualTransformPolicyType.Absolute: + _visualSizePolicy.Height = 1.0f; + break; + default: + _visualSizePolicy.Height = 0.0f; + break; + } + UpdateVisual(); + } + } + + /// + /// Get or set the origin of the visual within its control area.
+ /// By default, the origin is Center.
+ /// Optional. + ///
+ public Visual.AlignType Origin + { + get + { + return _visualOrigin ?? (Visual.AlignType.Center); + } + set + { + _visualOrigin = value; + UpdateVisual(); + } + } + + /// + /// Get or set the anchor-point of the visual.
+ /// By default, the anchor point is Center.
+ /// Optional. + ///
+ public Visual.AlignType AnchorPoint + { + get + { + return _visualAnchorPoint ?? (Visual.AlignType.Center); + } + set + { + _visualAnchorPoint = value; + UpdateVisual(); + } + } + + /// + /// Get or set the depth index of the visual.
+ /// By default, the depth index is 0.
+ /// Optional. + ///
+ public int DepthIndex + { + get + { + return _depthIndex ?? (0); + } + set + { + _depthIndex = value; + } + } + + private void ComposingTransformMap() + { + _visualTransformMap = new PropertyMap(); + if (_visualSize != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Size, new PropertyValue(_visualSize)); } + if (_visualOffset != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Offset, new PropertyValue(_visualOffset)); } + if (_visualOffsetPolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.OffsetPolicy, new PropertyValue(_visualOffsetPolicy)); } + if (_visualSizePolicy != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.SizePolicy, new PropertyValue(_visualSizePolicy)); } + if (_visualOrigin != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.Origin, new PropertyValue((int)_visualOrigin)); } + if (_visualAnchorPoint != null) { _visualTransformMap.Add((int)VisualTransformPropertyType.AnchorPoint, new PropertyValue((int)_visualAnchorPoint)); } + } + + /// + /// Get the transform map used by the visual. + /// + public PropertyMap OutputTransformMap + { + get + { + ComposingTransformMap(); + return _visualTransformMap; + } + } + + protected virtual void ComposingPropertyMap() + { + _outputVisualMap = new PropertyMap(); + } + + /// + /// Get the property map to create the visual. + /// + public PropertyMap OutputVisualMap + { + get + { + ComposingPropertyMap(); + return _outputVisualMap; + } + } + + internal void UpdateVisual() + { + if (VisualIndex > 0) + { + NUILog.Debug("UpdateVisual()! VisualIndex=" + VisualIndex); + Parent.UpdateVisual(VisualIndex, Name, this); + } + else + { + NUILog.Debug("VisualIndex was not set"); + } + } + + protected PropertyMap _shader = null; + //private PropertyMap _transform = null; + protected bool? _premultipliedAlpha = null; + protected Color _mixColor = null; + protected float? _opacity = null; + protected PropertyMap _commonlyUsedMap = null; + + /// + /// The shader to use in the visual. + /// + public PropertyMap Shader + { + get + { + return _shader; + } + set + { + _shader = value; + UpdateVisual(); + } + } + + /// + /// Enables/disables premultiplied alpha.
+ /// The premultiplied alpha is false by default unless this behaviour is modified by the derived Visual type. + ///
+ public bool PremultipliedAlpha + { + get + { + return _premultipliedAlpha ?? (false); + } + set + { + _premultipliedAlpha = value; + UpdateVisual(); + } + } + + /// + /// Mix color is a blend color for any visual. + /// + public Color MixColor + { + get + { + return _mixColor; + } + set + { + _mixColor = value; + UpdateVisual(); + } + } + + /// + /// Opacity is the alpha component of the mixColor, above. + /// + public float Opacity + { + get + { + return _opacity ?? (1.0f); + } + set + { + _opacity = value; + UpdateVisual(); + } + } + + } + + /// + /// A class encapsulating the property map of a image visual. + /// + public class ImageVisual : VisualMap + { + public ImageVisual() : base() + { + } + + private string _url = null; + private string _alphaMaskUrl = null; + private FittingModeType? _fittingMode = null; + private SamplingModeType? _samplingMode = null; + private int? _desiredWidth = null; + private int? _desiredHeight = null; + private bool? _synchronousLoading = false; + private bool? _borderOnly = null; + private Vector4 _pixelArea = null; + private WrapModeType? _wrapModeU = null; + private WrapModeType? _wrapModeV = null; + private float? _maskContentScale = null; + private bool? _cropToMask = null; + + /// + /// Get or set the URL of the image.
+ /// Mandatory. + ///
+ + public string URL + { + get + { + return _url; + } + set + { + _url = value; + UpdateVisual(); + } + } + + + /// + /// Get or set the URL of the alpha mask.
+ /// Optional. + ///
+ public string AlphaMaskURL + { + get + { + return _alphaMaskUrl; + } + set + { + _alphaMaskUrl = value; + UpdateVisual(); + } + } + + /// + /// Get or set fitting options, used when resizing images to fit desired dimensions.
+ /// If not supplied, default is FittingModeType.ShrinkToFit.
+ /// For Normal Quad images only.
+ /// Optional. + ///
+ public FittingModeType FittingMode + { + get + { + return _fittingMode ?? (FittingModeType.ShrinkToFit); + } + set + { + _fittingMode = value; + UpdateVisual(); + } + } + + /// + /// Get or set filtering options, used when resizing images to sample original pixels.
+ /// If not supplied, default is SamplingModeType.Box.
+ /// For Normal Quad images only.
+ /// Optional. + ///
+ public SamplingModeType SamplingMode + { + get + { + return _samplingMode ?? (SamplingModeType.Box); + } + set + { + _samplingMode = value; + UpdateVisual(); + } + } + + /// + /// Get or set the desired image width.
+ /// If not specified, the actual image width is used.
+ /// For Normal Quad images only.
+ /// Optional. + ///
+ public int DesiredWidth + { + get + { + return _desiredWidth ?? (-1); + } + set + { + _desiredWidth = value; + UpdateVisual(); + } + } + + /// + /// Get or set the desired image height.
+ /// If not specified, the actual image height is used.
+ /// For Normal Quad images only.
+ /// Optional. + ///
+ public int DesiredHeight + { + get + { + return _desiredHeight ?? (-1); + } + set + { + _desiredHeight = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether to load the image synchronously.
+ /// If not specified, the default is false, i.e. the image is loaded asynchronously.
+ /// For Normal Quad images only.
+ /// Optional. + ///
+ public bool SynchronousLoading + { + get + { + return _synchronousLoading ?? (false); + } + set + { + _synchronousLoading = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether to draws the borders only(If true).
+ /// If not specified, the default is false.
+ /// For N-Patch images only.
+ /// Optional. + ///
+ public bool BorderOnly + { + get + { + return _borderOnly ?? (false); + } + set + { + _borderOnly = value; + UpdateVisual(); + } + } + + /// + /// Get or set the image area to be displayed.
+ /// It is a rectangular area.
+ /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
+ /// If not specified, the default value is Vector4(0.0, 0.0, 1.0, 1.0), i.e. the entire area of the image.
+ /// For For Normal QUAD image only.
+ /// Optional. + ///
+ public Vector4 PixelArea + { + get + { + return _pixelArea ?? (new Vector4(0.0f, 0.0f, 1.0f, 1.0f)); + } + set + { + _pixelArea = value; + UpdateVisual(); + } + } + + /// + /// Get or set the wrap mode for u coordinate.
+ /// It decides how the texture should be sampled when the u coordinate exceeds the range of 0.0 to 1.0.
+ /// If not specified, the default is WrapModeType.Default(CLAMP).
+ /// For Normal QUAD image only.
+ /// Optional. + ///
+ public WrapModeType WrapModeU + { + get + { + return _wrapModeU ?? (WrapModeType.Default); + } + set + { + _wrapModeU = value; + UpdateVisual(); + } + } + + /// + /// Get or set the wrap mode for v coordinate.
+ /// It decides how the texture should be sampled when the v coordinate exceeds the range of 0.0 to 1.0.
+ /// The first two elements indicate the top-left position of the area, and the last two elements are the area width and height respectively.
+ /// If not specified, the default is WrapModeType.Default(CLAMP).
+ /// For Normal QUAD image only. + /// Optional. + ///
+ public WrapModeType WrapModeV + { + get + { + return _wrapModeV ?? (WrapModeType.Default); + } + set + { + _wrapModeV = value; + UpdateVisual(); + } + } + + public float MaskContentScale + { + get + { + return _maskContentScale ?? 1.0f; + } + set + { + _maskContentScale = value; + UpdateVisual(); + } + } + + public bool CropToMask + { + get + { + return _cropToMask ?? false; + } + set + { + _cropToMask = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_url != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); + _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); + if (_alphaMaskUrl != null ) { _outputVisualMap.Add(ImageVisualProperty.AlphaMaskURL, new PropertyValue(_alphaMaskUrl)); } + if (_fittingMode != null) { _outputVisualMap.Add(ImageVisualProperty.FittingMode, new PropertyValue((int)_fittingMode)); } + if (_samplingMode != null) { _outputVisualMap.Add(ImageVisualProperty.SamplingMode, new PropertyValue((int)_samplingMode)); } + if (_desiredWidth != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredWidth, new PropertyValue((int)_desiredWidth)); } + if (_desiredHeight != null) { _outputVisualMap.Add(ImageVisualProperty.DesiredHeight, new PropertyValue((int)_desiredHeight)); } + if (_synchronousLoading != null) { _outputVisualMap.Add(ImageVisualProperty.SynchronousLoading, new PropertyValue((bool)_synchronousLoading)); } + if (_borderOnly != null) { _outputVisualMap.Add(ImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } + if (_pixelArea != null) { _outputVisualMap.Add(ImageVisualProperty.PixelArea, new PropertyValue(_pixelArea)); } + if (_wrapModeU != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeU, new PropertyValue((int)_wrapModeU)); } + if (_wrapModeV != null) { _outputVisualMap.Add(ImageVisualProperty.WrapModeV, new PropertyValue((int)_wrapModeV)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + if (_maskContentScale != null) { _outputVisualMap.Add((int)ImageVisualProperty.MaskContentScale, new PropertyValue((float)_maskContentScale)); } + if (_cropToMask != null) { _outputVisualMap.Add((int)ImageVisualProperty.CropToMask, new PropertyValue((bool)_cropToMask)); } + } + } + } + + /// + /// A class encapsulating the property map of a text visual. + /// + public class TextVisual : VisualMap + { + public TextVisual() : base() + { + } + + private string _text = null; + private string _fontFamily = null; + private PropertyMap _fontStyle = null; + private float? _pointSize = null; + private bool? _multiLine = null; + private string _horizontalAlignment = null; + private string _verticalAlignment = null; + private Color _textColor = null; + private bool? _enableMarkup = null; + + /// + /// Get or set the text to display in UTF-8 format.
+ /// Mandatory. + ///
+ public string Text + { + get + { + return _text; + } + set + { + _text = value; + UpdateVisual(); + } + } + + /// + /// Get or set the requested font family to use.
+ /// Optional. + ///
+ public string FontFamily + { + get + { + return _fontFamily; + } + set + { + _fontFamily = value; + UpdateVisual(); + } + } + + /// + /// Get or set the requested font style to use.
+ /// Optional. + ///
+ public PropertyMap FontStyle + { + get + { + return _fontStyle; + } + set + { + _fontStyle = value; + UpdateVisual(); + } + } + + /// + /// Get or set the size of font in points.
+ /// Mandatory. + ///
+ public float PointSize + { + get + { + return _pointSize ?? (0.0f); + } + set + { + _pointSize = value; + UpdateVisual(); + } + } + + /// + /// Get or set the single-line or multi-line layout option.
+ /// If not specified, the default is false.
+ /// Optional. + ///
+ public bool MultiLine + { + get + { + return _multiLine ?? (false); + } + set + { + _multiLine = value; + UpdateVisual(); + } + } + + /// + /// Get or set the line horizontal alignment.
+ /// If not specified, the default is Begin.
+ /// Optional. + ///
+ public HorizontalAlignment HorizontalAlignment + { + get + { + switch (_horizontalAlignment) + { + case "BEGIN": + return HorizontalAlignment.Begin; + case "CENTER": + return HorizontalAlignment.Center; + case "END": + return HorizontalAlignment.End; + default: + return HorizontalAlignment.Begin; + } + } + set + { + switch (value) + { + case HorizontalAlignment.Begin: + { + _horizontalAlignment = "BEGIN"; + break; + } + case HorizontalAlignment.Center: + { + _horizontalAlignment = "CENTER"; + break; + } + case HorizontalAlignment.End: + { + _horizontalAlignment = "END"; + break; + } + default: + { + _horizontalAlignment = "BEGIN"; + break; + } + } + UpdateVisual(); + } + } + + /// + /// Get or set the line vertical alignment.
+ /// If not specified, the default is Top.
+ /// Optional. + ///
+ public VerticalAlignment VerticalAlignment + { + get + { + switch (_verticalAlignment) + { + case "TOP": + return VerticalAlignment.Top; + case "CENTER": + return VerticalAlignment.Center; + case "BOTTOM": + return VerticalAlignment.Bottom; + default: + return VerticalAlignment.Top; + } + } + set + { + switch (value) + { + case VerticalAlignment.Top: + { + _verticalAlignment = "TOP"; + break; + } + case VerticalAlignment.Center: + { + _verticalAlignment = "CENTER"; + break; + } + case VerticalAlignment.Bottom: + { + _verticalAlignment = "BOTTOM"; + break; + } + default: + { + _verticalAlignment = "TOP"; + break; + } + } + UpdateVisual(); + } + } + + /// + /// Get or set the color of the text.
+ /// Optional. + ///
+ public Color TextColor + { + get + { + return _textColor; + } + set + { + _textColor = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether the mark-up processing is enabled.
+ /// Optional. + ///
+ public bool EnableMarkup + { + get + { + return _enableMarkup ?? (false); + } + set + { + _enableMarkup = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_text != null && _pointSize != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Text)); + _outputVisualMap.Add(TextVisualProperty.Text, new PropertyValue(_text)); + _outputVisualMap.Add(TextVisualProperty.PointSize, new PropertyValue((float)_pointSize)); + if (_fontFamily != null) { _outputVisualMap.Add(TextVisualProperty.FontFamily, new PropertyValue(_fontFamily)); } + if (_fontStyle != null) { _outputVisualMap.Add(TextVisualProperty.FontStyle, new PropertyValue(_fontStyle)); } + if (_multiLine != null) { _outputVisualMap.Add(TextVisualProperty.MultiLine, new PropertyValue((bool)_multiLine)); } + if (_horizontalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.HorizontalAlignment, new PropertyValue(_horizontalAlignment)); } + if (_verticalAlignment != null) { _outputVisualMap.Add(TextVisualProperty.VerticalAlignment, new PropertyValue(_verticalAlignment)); } + if (_textColor != null) { _outputVisualMap.Add(TextVisualProperty.TextColor, new PropertyValue(_textColor)); } + if (_enableMarkup != null) { _outputVisualMap.Add(TextVisualProperty.EnableMarkup, new PropertyValue((bool)_enableMarkup)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a border visual. + /// + public class BorderVisual : VisualMap + { + public BorderVisual() : base() + { + } + + private Color _color = null; + private float? _size = null; + private bool? _antiAliasing = null; + + /// + /// Get or set the color of the border.
+ /// Mandatory. + ///
+ public Color Color + { + get + { + return _color; + } + set + { + _color = value; + UpdateVisual(); + } + } + + /// + /// Get or set the width of the border (in pixels).
+ /// Mandatory. + ///
+ public float BorderSize + { + get + { + return _size ?? (-1.0f); + } + set + { + _size = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether anti-aliasing of the border is required.
+ /// If not supplied, default is false.
+ /// Optional. + ///
+ public bool AntiAliasing + { + get + { + return _antiAliasing ?? (false); + } + set + { + _antiAliasing = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_color != null && _size != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Border)); + _outputVisualMap.Add(BorderVisualProperty.Size, new PropertyValue((float)_size)); + _outputVisualMap.Add(BorderVisualProperty.Color, new PropertyValue(_color)); + if (_antiAliasing != null) { _outputVisualMap.Add(BorderVisualProperty.AntiAliasing, new PropertyValue((bool)_antiAliasing)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a color visual. + /// + public class ColorVisual : VisualMap + { + public ColorVisual() : base() + { + } + + private Color _mixColorForColorVisual = null; + + /// + /// Get or set the solid color required.
+ /// Mandatory. + ///
+ public Color Color + { + get + { + return _mixColorForColorVisual; + } + set + { + _mixColorForColorVisual = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_mixColorForColorVisual != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Color)); + _outputVisualMap.Add(ColorVisualProperty.MixColor, new PropertyValue(_mixColorForColorVisual)); + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a gradient visual. + /// + public class GradientVisual : VisualMap + { + public GradientVisual() : base() + { + } + + private Vector2 _startPosition = null; + private Vector2 _endPosition = null; + private Vector2 _center = null; + private float? _radius = null; + private PropertyArray _stopOffset = null; + private PropertyArray _stopColor = null; + private GradientVisualUnitsType? _units = null; + private GradientVisualSpreadMethodType? _spreadMethod = null; + + /// + /// Get or set the start position of a linear gradient.
+ /// Mandatory for Linear.
+ ///
+ public Vector2 StartPosition + { + get + { + return _startPosition; + } + set + { + _startPosition = value; + UpdateVisual(); + } + } + + /// + /// Get or set the end position of a linear gradient.
+ /// Mandatory for Linear.
+ ///
+ public Vector2 EndPosition + { + get + { + return _endPosition; + } + set + { + _endPosition = value; + UpdateVisual(); + } + } + + /// + /// Get or set the center point of a radial gradient.
+ /// Mandatory for Radial.
+ ///
+ public Vector2 Center + { + get + { + return _center; + } + set + { + _center = value; + UpdateVisual(); + } + } + + /// + /// Get or set the size of the radius of a radial gradient.
+ /// Mandatory for Radial.
+ ///
+ public float Radius + { + get + { + return _radius ?? (-1.0f); + } + set + { + _radius = value; + UpdateVisual(); + } + } + + /// + /// Get or set all the stop offsets.
+ /// A PropertyArray of float.
+ /// If not supplied, default is 0.0f and 1.0f.
+ /// Optional. + ///
+ public PropertyArray StopOffset + { + get + { + return _stopOffset; + } + set + { + _stopOffset = value; + UpdateVisual(); + } + } + + /// + /// Get or set the color at the stop offsets.
+ /// A PropertyArray of Color.
+ /// At least 2 values required to show a gradient.
+ /// Mandatory. + ///
+ public PropertyArray StopColor + { + get + { + return _stopColor; + } + set + { + _stopColor = value; + UpdateVisual(); + } + } + + /// + /// Get or set defines the coordinate system for certain attributes of the points in a gradient.
+ /// If not supplied, default is GradientVisualUnitsType.ObjectBoundingBox.
+ /// Optional. + ///
+ public GradientVisualUnitsType Units + { + get + { + return _units ?? (GradientVisualUnitsType.ObjectBoundingBox); + } + set + { + _units = value; + UpdateVisual(); + } + } + + /// + /// Get or set indicates what happens if the gradient starts or ends inside the bounds of the target rectangle.
+ /// If not supplied, default is GradientVisualSpreadMethodType.Pad.
+ /// Optional. + ///
+ public GradientVisualSpreadMethodType SpreadMethod + { + get + { + return _spreadMethod ?? (GradientVisualSpreadMethodType.Pad); + } + set + { + _spreadMethod = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Gradient)); + _outputVisualMap.Add(GradientVisualProperty.StopColor, new PropertyValue(_stopColor)); + if (_startPosition != null) { _outputVisualMap.Add(GradientVisualProperty.StartPosition, new PropertyValue(_startPosition)); } + if (_endPosition != null) { _outputVisualMap.Add(GradientVisualProperty.EndPosition, new PropertyValue(_endPosition)); } + if (_center != null) { _outputVisualMap.Add(GradientVisualProperty.Center, new PropertyValue(_center)); } + if (_radius != null) { _outputVisualMap.Add(GradientVisualProperty.Radius, new PropertyValue((float)_radius)); } + if (_stopOffset != null) { _outputVisualMap.Add(GradientVisualProperty.StopOffset, new PropertyValue(_stopOffset)); } + if (_units != null) { _outputVisualMap.Add(GradientVisualProperty.Units, new PropertyValue((int)_units)); } + if (_spreadMethod != null) { _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, new PropertyValue((int)_spreadMethod)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a mesh visual. + /// + public class MeshVisual : VisualMap + { + public MeshVisual() : base() + { + } + + private string _objectURL = null; + private string _materialtURL = null; + private string _texturesPath = null; + private MeshVisualShadingModeValue? _shadingMode = null; + private bool? _useMipmapping = null; + private bool? _useSoftNormals = null; + private Vector3 _lightPosition = null; + + /// + /// Get or set the location of the ".obj" file.
+ /// Mandatory. + ///
+ public string ObjectURL + { + get + { + return _objectURL; + } + set + { + _objectURL = value; + UpdateVisual(); + } + } + + /// + /// Get or set the location of the ".mtl" file.
+ /// If not specified, then a textureless object is assumed.
+ /// Optional. + ///
+ public string MaterialtURL + { + get + { + return _materialtURL; + } + set + { + _materialtURL = value; + UpdateVisual(); + } + } + + /// + /// Get or set path to the directory the textures (including gloss and normal) are stored in.
+ /// Mandatory if using material.
+ ///
+ public string TexturesPath + { + get + { + return _texturesPath; + } + set + { + _texturesPath = value; + UpdateVisual(); + } + } + + /// + /// Get or set the type of shading mode that the mesh will use.
+ /// If anything the specified shading mode requires is missing, a simpler mode that can be handled with what has been supplied will be used instead.
+ /// If not specified, it will use the best it can support (will try MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting first).
+ /// Optional. + ///
+ public MeshVisualShadingModeValue ShadingMode + { + get + { + return _shadingMode ?? (MeshVisualShadingModeValue.TexturedWithDetailedSpecularLighting); + } + set + { + _shadingMode = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether to use mipmaps for textures or not.
+ /// If not specified, the default is true.
+ /// Optional. + ///
+ public bool UseMipmapping + { + get + { + return _useMipmapping ?? (true); + } + set + { + _useMipmapping = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether to average normals at each point to smooth textures or not.
+ /// If not specified, the default is true.
+ /// Optional. + ///
+ public bool UseSoftNormals + { + get + { + return _useSoftNormals ?? (true); + } + set + { + _useSoftNormals = value; + UpdateVisual(); + } + } + + /// + /// Get or set the position, in stage space, of the point light that applies lighting to the model.
+ /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center, + /// and using all zeroes will place the light at the top left corner.
+ /// If not specified, the default is an offset outwards from the center of the screen.
+ /// Optional. + ///
+ public Vector3 LightPosition + { + get + { + return _lightPosition; + } + set + { + _lightPosition = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_objectURL != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Mesh)); + _outputVisualMap.Add(MeshVisualProperty.ObjectURL, new PropertyValue(_objectURL)); + if (_materialtURL != null) { _outputVisualMap.Add(MeshVisualProperty.MaterialtURL, new PropertyValue(_materialtURL)); } + if (_texturesPath != null) { _outputVisualMap.Add(MeshVisualProperty.TexturesPath, new PropertyValue(_texturesPath)); } + if (_shadingMode != null) { _outputVisualMap.Add(MeshVisualProperty.ShadingMode, new PropertyValue((int)_shadingMode)); } + if (_useMipmapping != null) { _outputVisualMap.Add(MeshVisualProperty.UseMipmapping, new PropertyValue((bool)_useMipmapping)); } + if (_useSoftNormals != null) { _outputVisualMap.Add(MeshVisualProperty.UseSoftNormals, new PropertyValue((bool)_useSoftNormals)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a primetive visual. + /// + public class PrimitiveVisual : VisualMap + { + public PrimitiveVisual() : base() + { + } + + private PrimitiveVisualShapeType? _shape = null; + private Color _mixColorForPrimitiveVisual = null; + private int? _slices = null; + private int? _stacks = null; + private float? _scaleTopRadius = null; + private float? _scaleBottomRadius = null; + private float? _scaleHeight = null; + private float? _scaleRadius = null; + private Vector3 _scaleDimensions = null; + private float? _bevelPercentage = null; + private float? _bevelSmoothness = null; + private Vector3 _lightPosition = null; + + /// + /// Get or set the specific shape to render.
+ /// If not specified, the default is PrimitiveVisualShapeType.Sphere.
+ /// Optional. + ///
+ public PrimitiveVisualShapeType Shape + { + get + { + return _shape ?? (PrimitiveVisualShapeType.Sphere); + } + set + { + _shape = value; + UpdateVisual(); + } + } + + /// + /// Get or set the color of the shape.
+ /// If not specified, the default is Color(0.5, 0.5, 0.5, 1.0).
+ /// Applies to ALL shapes.
+ /// Optional. + ///
+ public Color MixColor + { + get + { + return _mixColorForPrimitiveVisual ?? (new Color(0.5f, 0.5f, 0.5f, 1.0f)); + } + set + { + _mixColorForPrimitiveVisual = value; + UpdateVisual(); + } + } + + /// + /// Get or set the number of slices as you go around the shape.
+ /// For spheres and conical frustrums, this determines how many divisions there are as you go around the object.
+ /// If not specified, the default is 128.
+ /// The range is from 1 to 255.
+ /// Optional. + ///
+ public int Slices + { + get + { + return _slices ?? (128); + } + set + { + _slices = value; + UpdateVisual(); + } + } + + /// + /// Get or set the number of stacks as you go down the shape.
+ /// For spheres, 'stacks' determines how many layers there are as you go down the object.
+ /// If not specified, the default is 128.
+ /// The range is from 1 to 255.
+ /// Optional. + ///
+ public int Stacks + { + get + { + return _stacks ?? (128); + } + set + { + _stacks = value; + UpdateVisual(); + } + } + + /// + /// Get or set the scale of the radius of the top circle of a conical frustrum.
+ /// If not specified, the default is 1.0f.
+ /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum
+ /// Only values greater than or equal to 0.0f are accepted.
+ /// Optional. + ///
+ public float ScaleTopRadius + { + get + { + return _scaleTopRadius ?? (1.0f); + } + set + { + _scaleTopRadius = value; + UpdateVisual(); + } + } + + /// + /// Get or set the scale of the radius of the bottom circle of a conical frustrum.
+ /// If not specified, the default is 1.5f.
+ /// Applies to: - PrimitiveVisualShapeType.ConicalFrustrum
+ /// - PrimitiveVisualShapeType.Cone
+ /// Only values greater than or equal to 0.0f are accepted.
+ /// Optional. + ///
+ public float ScaleBottomRadius + { + get + { + return _scaleBottomRadius ?? (1.5f); + } + set + { + _scaleBottomRadius = value; + UpdateVisual(); + } + } + + /// + /// Get or set the scale of the height of a conic.
+ /// If not specified, the default is 3.0f.
+ /// Applies to:
+ /// - PrimitiveVisualShapeType.ConicalFrustrum
+ /// - PrimitiveVisualShapeType.Cone
+ /// - PrimitiveVisualShapeType.Cylinder
+ /// Only values greater than or equal to 0.0f are accepted.
+ /// Optional. + ///
+ public float ScaleHeight + { + get + { + return _scaleHeight ?? (3.0f); + } + set + { + _scaleHeight = value; + UpdateVisual(); + } + } + + /// + /// Get or set the scale of the radius of a cylinder.
+ /// If not specified, the default is 1.0f.
+ /// Applies to:
+ /// - PrimitiveVisualShapeType.Cylinder
+ /// Only values greater than or equal to 0.0f are accepted.
+ /// Optional. + ///
+ public float ScaleRadius + { + get + { + return _scaleRadius ?? (1.0f); + } + set + { + _scaleRadius = value; + UpdateVisual(); + } + } + + /// + /// Get or set the dimensions of a cuboid. Scales in the same fashion as a 9-patch image.
+ /// If not specified, the default is Vector3.One.
+ /// Applies to:
+ /// - PrimitiveVisualShapeType.Cube
+ /// - PrimitiveVisualShapeType.Octahedron
+ /// - PrimitiveVisualShapeType.BevelledCube
+ /// Each vector3 parameter should be greater than or equal to 0.0f.
+ /// Optional. + ///
+ public Vector3 ScaleDimensions + { + get + { + return _scaleDimensions ?? (Vector3.One); + } + set + { + _scaleDimensions = value; + UpdateVisual(); + } + } + + /// + /// Get or set determines how bevelled the cuboid should be, based off the smallest dimension.
+ /// Bevel percentage ranges from 0.0 to 1.0. It affects the ratio of the outer face widths to the width of the overall cube.
+ /// If not specified, the default is 0.0f (no bevel).
+ /// Applies to:
+ /// - PrimitiveVisualShapeType.BevelledCube
+ /// The range is from 0.0f to 1.0f.
+ /// Optional. + ///
+ public float BevelPercentage + { + get + { + return _bevelPercentage ?? (0.0f); + } + set + { + _bevelPercentage = value; + UpdateVisual(); + } + } + + /// + /// Get or set defines how smooth the bevelled edges should be.
+ /// If not specified, the default is 0.0f (sharp edges).
+ /// Applies to:
+ /// - PrimitiveVisualShapeType.BevelledCube
+ /// The range is from 0.0f to 1.0f.
+ /// Optional. + ///
+ public float BevelSmoothness + { + get + { + return _bevelSmoothness ?? (0.0f); + } + set + { + _bevelSmoothness = value; + UpdateVisual(); + } + } + + /// + /// Get or set the position, in stage space, of the point light that applies lighting to the model.
+ /// This is based off the stage's dimensions, so using the width and height of the stage halved will correspond to the center, + /// and using all zeroes will place the light at the top left corner.
+ /// If not specified, the default is an offset outwards from the center of the screen.
+ /// Applies to ALL shapes.
+ /// Optional. + ///
+ public Vector3 LightPosition + { + get + { + return _lightPosition; + } + set + { + _lightPosition = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + _outputVisualMap = new PropertyMap(); ; + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.Primitive)); + if (_shape != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Shape, new PropertyValue((int)_shape)); } + if (_mixColorForPrimitiveVisual != null) { _outputVisualMap.Add(PrimitiveVisualProperty.MixColor, new PropertyValue(_mixColorForPrimitiveVisual)); } + if (_slices != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Slices, new PropertyValue((int)_slices)); } + if (_stacks != null) { _outputVisualMap.Add(PrimitiveVisualProperty.Stacks, new PropertyValue((int)_stacks)); } + if (_scaleTopRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleTopRadius, new PropertyValue((float)_scaleTopRadius)); } + if (_scaleBottomRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleBottomRadius, new PropertyValue((float)_scaleBottomRadius)); } + if (_scaleHeight != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleHeight, new PropertyValue((float)_scaleHeight)); } + if (_scaleRadius != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleRadius, new PropertyValue((float)_scaleRadius)); } + if (_scaleDimensions != null) { _outputVisualMap.Add(PrimitiveVisualProperty.ScaleDimensions, new PropertyValue(_scaleDimensions)); } + if (_bevelPercentage != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelPercentage, new PropertyValue((float)_bevelPercentage)); } + if (_bevelSmoothness != null) { _outputVisualMap.Add(PrimitiveVisualProperty.BevelSmoothness, new PropertyValue((float)_bevelSmoothness)); } + if (_lightPosition != null) { _outputVisualMap.Add(PrimitiveVisualProperty.LightPosition, new PropertyValue(_lightPosition)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + + /// + /// A class encapsulating the property map of a n-patch image visual. + /// + public class NPatchVisual : VisualMap + { + public NPatchVisual() : base() + { + } + + private string _url = null; + private bool? _borderOnly = null; + private Rectangle _border = null; + + /// + /// Get or set the URL of the image.
+ /// Mandatory. + ///
+ public string URL + { + get + { + return _url; + } + set + { + _url = value; + UpdateVisual(); + } + } + + /// + /// Get or set whether to draws the borders only(If true).
+ /// If not specified, the default is false.
+ /// For N-Patch images only.
+ /// Optional. + ///
+ public bool BorderOnly + { + get + { + return _borderOnly ?? false; + } + set + { + _borderOnly = value; + UpdateVisual(); + } + } + + /// + /// The border of the image in the order: left, right, bottom, top.
+ /// For N-Patch images only.
+ /// Optional. + ///
+ public Rectangle Border + { + get + { + return _border; + } + set + { + _border = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_url != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.NPatch)); + _outputVisualMap.Add(NpatchImageVisualProperty.URL, new PropertyValue(_url)); + if (_borderOnly != null) { _outputVisualMap.Add(NpatchImageVisualProperty.BorderOnly, new PropertyValue((bool)_borderOnly)); } + if (_border != null) { _outputVisualMap.Add(NpatchImageVisualProperty.Border, new PropertyValue(_border)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a SVG visual. + /// + public class SVGVisual : VisualMap + { + public SVGVisual() : base() + { + } + + private string _url = null; + + public string URL + { + get + { + return _url; + } + set + { + _url = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_url != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.SVG)); + _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_url)); + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + /// + /// A class encapsulating the property map of a Animated Image(AGIF) visual. + /// + public class AnimatedImageVisual : VisualMap + { + public AnimatedImageVisual() : base() + { + } + + private List _urls = null; + private int? _batchSize = null; + private int? _cacheSize = null; + private float? _frameDelay = null; + + public string URL + { + get + { + if( _urls != null ) + { + return _urls[0]; + } + else + { + return null; + } + } + set + { + if( _urls == null ) + { + _urls = new List(); + _urls.Add(value); + } + else + { + _urls[0] = value; + } + UpdateVisual(); + } + } + + public List URLS + { + get + { + return _urls; + } + set + { + _urls = value; + UpdateVisual(); + } + } + + public int BatchSize + { + get + { + return _batchSize ?? 1; + } + set + { + _batchSize = value; + UpdateVisual(); + } + } + + public int CacheSize + { + get + { + return _cacheSize ?? 1; + } + set + { + _cacheSize = value; + UpdateVisual(); + } + } + public float FrameDelay + { + get + { + return _frameDelay ?? 0.1f; + } + set + { + _frameDelay = value; + UpdateVisual(); + } + } + + protected override void ComposingPropertyMap() + { + if (_urls != null) + { + _outputVisualMap = new PropertyMap(); + _outputVisualMap.Add(Visual.Property.Type, new PropertyValue((int)Visual.Type.AnimatedImage)); + if( _urls.Count == 1 ) + { + _outputVisualMap.Add(ImageVisualProperty.URL, new PropertyValue(_urls[0])); + } + else + { + var urlArray = new PropertyArray(); + foreach( var url in _urls) + { + urlArray.Add(new PropertyValue(url)); + } + _outputVisualMap.Add( ImageVisualProperty.URL, ( new PropertyValue( urlArray ) ) ); + } + if (_batchSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.BatchSize, new PropertyValue((int)_batchSize)); } + if (_cacheSize != null ) {_outputVisualMap.Add((int)ImageVisualProperty.CacheSize, new PropertyValue((int)_cacheSize)); } + if (_frameDelay != null ) {_outputVisualMap.Add((int)ImageVisualProperty.FrameDelay, new PropertyValue((float)_frameDelay)); } + if (_shader != null) { _outputVisualMap.Add((int)Visual.Property.Shader, new PropertyValue(_shader)); } + if (_premultipliedAlpha != null) { _outputVisualMap.Add((int)Visual.Property.PremultipliedAlpha, new PropertyValue((bool)_premultipliedAlpha)); } + if (_mixColor != null) { _outputVisualMap.Add((int)Visual.Property.MixColor, new PropertyValue(_mixColor)); } + if (_opacity != null) { _outputVisualMap.Add((int)Visual.Property.Opacity, new PropertyValue((float)_opacity)); } + } + } + } + + + + //temporary fix for TCT + public class VisualAnimator : VisualMap + { + public VisualAnimator() : base() + { + } + + private string _alphaFunction = null; + private int _startTime = 0; + private int _endTime = 0; + private string _target = null; + private string _propertyIndex = null; + private object _destinationValue = null; + + public AlphaFunction.BuiltinFunctions AlphaFunction + { + get + { + switch (_alphaFunction) + { + case "LINEAR": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear; + case "REVERSE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse; + case "EASE_IN_SQUARE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare; + case "EASE_OUT_SQUARE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare; + case "EASE_IN": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn; + case "EASE_OUT": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut; + case "EASE_IN_OUT": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut; + case "EASE_IN_SINE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine; + case "EASE_OUT_SINE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine; + case "EASE_IN_OUT_SINE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine; + case "BOUNCE": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce; + case "SIN": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin; + case "EASE_OUT_BACK": + return Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack; + default: + return Tizen.NUI.AlphaFunction.BuiltinFunctions.Default; + } + } + set + { + switch (value) + { + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear: + { + _alphaFunction = "LINEAR"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse: + { + _alphaFunction = "REVERSE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare: + { + _alphaFunction = "EASE_IN_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare: + { + _alphaFunction = "EASE_OUT_SQUARE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn: + { + _alphaFunction = "EASE_IN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut: + { + _alphaFunction = "EASE_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut: + { + _alphaFunction = "EASE_IN_OUT"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine: + { + _alphaFunction = "EASE_IN_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine: + { + _alphaFunction = "EASE_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine: + { + _alphaFunction = "EASE_IN_OUT_SINE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce: + { + _alphaFunction = "BOUNCE"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin: + { + _alphaFunction = "SIN"; + break; + } + case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack: + { + _alphaFunction = "EASE_OUT_BACK"; + break; + } + default: + { + _alphaFunction = "DEFAULT"; + break; + } + } + } + } + + public int StartTime + { + get + { + return _startTime; + } + set + { + _startTime = value; + } + } + + public int EndTime + { + get + { + return _endTime; + } + set + { + _endTime = value; + } + } + + public string Target + { + get + { + return _target; + } + set + { + _target = value; + } + } + + public string PropertyIndex + { + get + { + return _propertyIndex; + } + set + { + _propertyIndex = value; + } + } + + public object DestinationValue + { + get + { + return _destinationValue; + } + set + { + _destinationValue = value; + } + } + + protected override void ComposingPropertyMap() + { + PropertyMap _animator = new PropertyMap(); + _animator.Add("alphaFunction", new PropertyValue(_alphaFunction)); + + PropertyMap _timePeriod = new PropertyMap(); + _timePeriod.Add("duration", new PropertyValue((_endTime - _startTime) / 1000.0f)); + _timePeriod.Add("delay", new PropertyValue(_startTime / 1000.0f)); + _animator.Add("timePeriod", new PropertyValue(_timePeriod)); + + string _str1 = _propertyIndex.Substring(0, 1); + string _str2 = _propertyIndex.Substring(1); + string _str = _str1.ToLower() + _str2; + + PropertyValue val = PropertyValue.CreateFromObject(_destinationValue); + + PropertyMap _transition = new PropertyMap(); + _transition.Add("target", new PropertyValue(_target)); + _transition.Add("property", new PropertyValue(_str)); + _transition.Add("targetValue", val); + _transition.Add("animator", new PropertyValue(_animator)); + + _outputVisualMap = _transition; + } + } + //temporary fix for TCT + + + +} diff --git a/src/Tizen.NUI/src/public/Wheel.cs b/src/Tizen.NUI/src/public/Wheel.cs new file mode 100755 index 0000000..23c8a65 --- /dev/null +++ b/src/Tizen.NUI/src/public/Wheel.cs @@ -0,0 +1,336 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + /// + /// The wheel event structure is used to store a wheel rolling, it facilitates processing of the wheel rolling and passing to other libraries like Toolkit.
+ /// There is a key modifier which relates to keys like alt, shift and control functions are supplied to check if they have been pressed when the wheel is being rolled.
+ /// We support a mouse device and there may be another custom device that support the wheel event. The device type is specified as \e type.
+ /// The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the window.
+ ///
+ public class Wheel : global::System.IDisposable + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal Wheel(global::System.IntPtr cPtr, bool cMemoryOwn) + { + swigCMemOwn = cMemoryOwn; + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Wheel obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + //A Flag to check who called Dispose(). (By User or DisposeQueue) + private bool isDisposeQueued = false; + //A Flat to check if it is already disposed. + protected bool disposed = false; + + ~Wheel() + { + if(!isDisposeQueued) + { + isDisposeQueued = true; + DisposeQueue.Instance.Add(this); + } + } + + public void Dispose() + { + //Throw excpetion if Dispose() is called in separate thread. + if (!Window.IsInstalled()) + { + throw new System.InvalidOperationException("This API called from separate thread. This API must be called from MainThread."); + } + + if (isDisposeQueued) + { + Dispose(DisposeTypes.Implicit); + } + else + { + Dispose(DisposeTypes.Explicit); + System.GC.SuppressFinalize(this); + } + } + + protected virtual void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Wheel(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + disposed = true; + } + + + internal static Wheel GetWheelFromPtr(global::System.IntPtr cPtr) + { + Wheel ret = new Wheel(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// The type of the wheel event + /// + public Wheel.WheelType Type + { + get + { + return type; + } + } + + /// + /// he direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel) + /// + public int Direction + { + get + { + return direction; + } + } + + /// + /// Modifier keys pressed during the event (such as shift, alt and control) + /// + public uint Modifiers + { + get + { + return modifiers; + } + } + + /// + /// The co-ordinates of the cursor relative to the top-left of the screen + /// + public Vector2 Point + { + get + { + return point; + } + } + + /// + /// The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise) + /// + public int Z + { + get + { + return z; + } + } + + /// + /// The time the wheel is being rolled + /// + public uint TimeStamp + { + get + { + return timeStamp; + } + } + + /// + /// Default constructor. + /// + public Wheel() : this(NDalicPINVOKE.new_Wheel__SWIG_0(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Constructor. + /// + /// The type of the wheel event + /// The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel) + /// Modifier keys pressed during the event (such as shift, alt and control) + /// The co-ordinates of the cursor relative to the top-left of the screen + /// The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise) + /// The time the wheel is being rolled + public Wheel(Wheel.WheelType type, int direction, uint modifiers, Vector2 point, int z, uint timeStamp) : this(NDalicPINVOKE.new_Wheel__SWIG_1((int)type, direction, modifiers, Vector2.getCPtr(point), z, timeStamp), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Checks to see if Shift key modifier has been supplied. + /// + /// True if shift modifier + public bool IsShiftModifier() + { + bool ret = NDalicPINVOKE.Wheel_IsShiftModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Checks to see if Ctrl (control) key modifier has been supplied. + /// + /// True if ctrl modifier + public bool IsCtrlModifier() + { + bool ret = NDalicPINVOKE.Wheel_IsCtrlModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Checks to see if Alt key modifier has been supplied. + /// + /// True if alt modifier + public bool IsAltModifier() + { + bool ret = NDalicPINVOKE.Wheel_IsAltModifier(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private Wheel.WheelType type + { + set + { + NDalicPINVOKE.Wheel_type_set(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + Wheel.WheelType ret = (Wheel.WheelType)NDalicPINVOKE.Wheel_type_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int direction + { + set + { + NDalicPINVOKE.Wheel_direction_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Wheel_direction_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint modifiers + { + set + { + NDalicPINVOKE.Wheel_modifiers_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Wheel_modifiers_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private Vector2 point + { + set + { + NDalicPINVOKE.Wheel_point_set(swigCPtr, Vector2.getCPtr(value)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Wheel_point_get(swigCPtr); + Vector2 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector2(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private int z + { + set + { + NDalicPINVOKE.Wheel_z_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + int ret = NDalicPINVOKE.Wheel_z_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private uint timeStamp + { + set + { + NDalicPINVOKE.Wheel_timeStamp_set(swigCPtr, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + get + { + uint ret = NDalicPINVOKE.Wheel_timeStamp_get(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + /// + /// The type of the wheel event + /// + public enum WheelType + { + MouseWheel, + CustomWheel + } + + } + +} diff --git a/src/Tizen.NUI/src/public/WidgetView.cs b/src/Tizen.NUI/src/public/WidgetView.cs new file mode 100755 index 0000000..cccc109 --- /dev/null +++ b/src/Tizen.NUI/src/public/WidgetView.cs @@ -0,0 +1,671 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// WidgetView is a class for displaying the widget image and controlling the widget.
+ /// Input events that WidgetView gets are delivered to the widget. + ///
+ public class WidgetView : View + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetView_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetView obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Button instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if (disposed) + { + return; + } + + if (type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetView(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + base.Dispose(); + } + + internal class Property + { + internal static readonly int WIDGET_ID = NDalicManualPINVOKE.WidgetView_Property_WIDGET_ID_get(); + internal static readonly int INSTANCE_ID = NDalicManualPINVOKE.WidgetView_Property_INSTANCE_ID_get(); + internal static readonly int CONTENT_INFO = NDalicManualPINVOKE.WidgetView_Property_CONTENT_INFO_get(); + internal static readonly int TITLE = NDalicManualPINVOKE.WidgetView_Property_TITLE_get(); + internal static readonly int UPDATE_PERIOD = NDalicManualPINVOKE.WidgetView_Property_UPDATE_PERIOD_get(); + internal static readonly int PREVIEW = NDalicManualPINVOKE.WidgetView_Property_PREVIEW_get(); + internal static readonly int LOADING_TEXT = NDalicManualPINVOKE.WidgetView_Property_LOADING_TEXT_get(); + internal static readonly int WIDGET_STATE_FAULTED = NDalicManualPINVOKE.WidgetView_Property_WIDGET_STATE_FAULTED_get(); + internal static readonly int PERMANENT_DELETE = NDalicManualPINVOKE.WidgetView_Property_PERMANENT_DELETE_get(); + } + + /// + /// Create a new WidgetView. + /// + public WidgetView(string widgetId, string contentInfo, int width, int height, float updatePeriod) : this(NDalicManualPINVOKE.WidgetView_New(widgetId, contentInfo, width, height, updatePeriod), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + } + + internal new static WidgetView DownCast(BaseHandle handle) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetView_DownCast(BaseHandle.getCPtr(handle)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetView(WidgetView handle) : this(NDalicManualPINVOKE.new_WidgetView__SWIG_1(WidgetView.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetView Assign(WidgetView handle) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetView_Assign(swigCPtr, WidgetView.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static WidgetView GetWidgetViewFromPtr(global::System.IntPtr cPtr) + { + WidgetView ret = new WidgetView(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Event arguments of widget view. + /// + public class WidgetViewEventArgs : EventArgs + { + private WidgetView _widgetView; + + /// + /// The widet view. + /// + public WidgetView WidgetView + { + get + { + return _widgetView; + } + set + { + _widgetView = value; + } + } + } + + private EventHandler _widgetAddedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetAddedEventCallbackType(IntPtr data); + private WidgetAddedEventCallbackType _widgetAddedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetAdded + { + add + { + if (_widgetAddedEventHandler == null) + { + _widgetAddedEventCallback = OnWidgetAdded; + WidgetAddedSignal().Connect(_widgetAddedEventCallback); + } + + _widgetAddedEventHandler += value; + } + + remove + { + _widgetAddedEventHandler -= value; + + if (_widgetAddedEventHandler == null && WidgetAddedSignal().Empty() == false) + { + WidgetAddedSignal().Disconnect(_widgetAddedEventCallback); + } + } + } + + // Callback for WidgetView WidgetAdded signal + private void OnWidgetAdded(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetAddedEventHandler != null) + { + _widgetAddedEventHandler(this, e); + } + } + + private EventHandler _widgetDeletedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetDeletedEventCallbackType(IntPtr data); + private WidgetDeletedEventCallbackType _widgetDeletedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetDeleted + { + add + { + if (_widgetDeletedEventHandler == null) + { + _widgetDeletedEventCallback = OnWidgetDeleted; + WidgetDeletedSignal().Connect(_widgetDeletedEventCallback); + } + + _widgetDeletedEventHandler += value; + } + + remove + { + _widgetDeletedEventHandler -= value; + + if (_widgetDeletedEventHandler == null && WidgetDeletedSignal().Empty() == false) + { + WidgetDeletedSignal().Disconnect(_widgetDeletedEventCallback); + } + } + } + + // Callback for WidgetView WidgetDeleted signal + private void OnWidgetDeleted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetDeletedEventHandler != null) + { + _widgetDeletedEventHandler(this, e); + } + } + + private EventHandler _widgetCreationAbortedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetCreationAbortedEventCallbackType(IntPtr data); + private WidgetCreationAbortedEventCallbackType _widgetCreationAbortedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetCreationAborted + { + add + { + if (_widgetCreationAbortedEventHandler == null) + { + _widgetCreationAbortedEventCallback = OnWidgetCreationAborted; + WidgetCreationAbortedSignal().Connect(_widgetCreationAbortedEventCallback); + } + + _widgetCreationAbortedEventHandler += value; + } + + remove + { + _widgetCreationAbortedEventHandler -= value; + + if (_widgetCreationAbortedEventHandler == null && WidgetCreationAbortedSignal().Empty() == false) + { + WidgetCreationAbortedSignal().Disconnect(_widgetCreationAbortedEventCallback); + } + } + } + + // Callback for WidgetView WidgetCreationAborted signal + private void OnWidgetCreationAborted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetCreationAbortedEventHandler != null) + { + _widgetCreationAbortedEventHandler(this, e); + } + } + + private EventHandler _widgetContentUpdatedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetContentUpdatedEventCallbackType(IntPtr data); + private WidgetContentUpdatedEventCallbackType _widgetContentUpdatedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetContentUpdated + { + add + { + if (_widgetContentUpdatedEventHandler == null) + { + _widgetContentUpdatedEventCallback = OnWidgetContentUpdated; + WidgetContentUpdatedSignal().Connect(_widgetContentUpdatedEventCallback); + } + + _widgetContentUpdatedEventHandler += value; + } + + remove + { + _widgetContentUpdatedEventHandler -= value; + + if (_widgetContentUpdatedEventHandler == null && WidgetContentUpdatedSignal().Empty() == false) + { + WidgetContentUpdatedSignal().Disconnect(_widgetContentUpdatedEventCallback); + } + } + } + + // Callback for WidgetView WidgetContentUpdated signal + private void OnWidgetContentUpdated(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetContentUpdatedEventHandler != null) + { + _widgetContentUpdatedEventHandler(this, e); + } + } + + private EventHandler _widgetUpdatePeriodChangedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetUpdatePeriodChangedEventCallbackType(IntPtr data); + private WidgetUpdatePeriodChangedEventCallbackType _widgetUpdatePeriodChangedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetUpdatePeriodChanged + { + add + { + if (_widgetUpdatePeriodChangedEventHandler == null) + { + _widgetUpdatePeriodChangedEventCallback = OnWidgetUpdatePeriodChanged; + WidgetUpdatePeriodChangedSignal().Connect(_widgetUpdatePeriodChangedEventCallback); + } + + _widgetUpdatePeriodChangedEventHandler += value; + } + + remove + { + _widgetUpdatePeriodChangedEventHandler -= value; + + if (_widgetUpdatePeriodChangedEventHandler == null && WidgetUpdatePeriodChangedSignal().Empty() == false) + { + WidgetUpdatePeriodChangedSignal().Disconnect(_widgetUpdatePeriodChangedEventCallback); + } + } + } + + // Callback for WidgetView WidgetUpdatePeriodChanged signal + private void OnWidgetUpdatePeriodChanged(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetUpdatePeriodChangedEventHandler != null) + { + _widgetUpdatePeriodChangedEventHandler(this, e); + } + } + + private EventHandler _widgetFaultedEventHandler; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WidgetFaultedEventCallbackType(IntPtr data); + private WidgetFaultedEventCallbackType _widgetFaultedEventCallback; + + /// + /// Event for ResourceReady signal which can be used to subscribe/unsubscribe the event handler.
+ /// This signal is emitted after all resources required by a control are loaded and ready.
+ /// Most resources are only loaded when the control is placed on stage.
+ ///
+ public event EventHandler WidgetFaulted + { + add + { + if (_widgetFaultedEventHandler == null) + { + _widgetFaultedEventCallback = OnWidgetFaulted; + WidgetFaultedSignal().Connect(_widgetFaultedEventCallback); + } + + _widgetFaultedEventHandler += value; + } + + remove + { + _widgetFaultedEventHandler -= value; + + if (_widgetFaultedEventHandler == null && WidgetFaultedSignal().Empty() == false) + { + WidgetFaultedSignal().Disconnect(_widgetFaultedEventCallback); + } + } + } + + // Callback for WidgetView WidgetFaulted signal + private void OnWidgetFaulted(IntPtr data) + { + WidgetViewEventArgs e = new WidgetViewEventArgs(); + if(data != null) + { + e.WidgetView = WidgetView.GetWidgetViewFromPtr(data); + } + + if (_widgetFaultedEventHandler != null) + { + _widgetFaultedEventHandler(this, e); + } + } + + /// + /// Pauses a given widget. + /// + /// true on success, false otherwise. + public bool PauseWidget() + { + bool ret = NDalicManualPINVOKE.WidgetView_PauseWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Resume a given widget. + /// + /// true on success, false otherwise. + public bool ResumeWidget() + { + bool ret = NDalicManualPINVOKE.WidgetView_ResumeWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Cancels touch event procedure. + /// If you call this function after feed the touch down event, the widget will get ON_HOLD events. + /// If a widget gets ON_HOLD event, it will not do anything even if you feed touch up event. + /// + /// true on success, false otherwise. + public bool CancelTouchEvent() + { + bool ret = NDalicManualPINVOKE.WidgetView_CancelTouchEvent(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Activate a widget in faulted state. + /// A widget in faulted state MUST be activated before adding the widget. + /// + public void ActivateFaultedWidget() + { + NDalicManualPINVOKE.WidgetView_ActivateFaultedWidget(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetViewSignal WidgetAddedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetAddedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetDeletedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetDeletedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetCreationAbortedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetCreationAbortedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetContentUpdatedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetContentUpdatedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetUpdatePeriodChangedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetUpdatePeriodChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewSignal WidgetFaultedSignal() + { + WidgetViewSignal ret = new WidgetViewSignal(NDalicManualPINVOKE.WidgetView_WidgetFaultedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the id of widget. + /// + public string WidgetID + { + get + { + string temp; + GetProperty(WidgetView.Property.WIDGET_ID).Get(out temp); + return temp; + } + } + + /// + /// Gets the id of instance. + /// + public string InstanceID + { + get + { + string temp; + GetProperty(WidgetView.Property.INSTANCE_ID).Get(out temp); + return temp; + } + } + + /// + /// Gets the content info. + /// + public string ContentInfo + { + get + { + string temp; + GetProperty(WidgetView.Property.CONTENT_INFO).Get(out temp); + return temp; + } + } + + /// + /// Gets the title. + /// + public string Title + { + get + { + string temp; + GetProperty(WidgetView.Property.TITLE).Get(out temp); + return temp; + } + } + + /// + /// Gets the update peroid. + /// + public float UpdatePeriod + { + get + { + float temp; + GetProperty(WidgetView.Property.UPDATE_PERIOD).Get(out temp); + return temp; + } + } + + /// + /// Gets/sets the preview. + /// + public bool Preview + { + get + { + bool temp; + GetProperty(WidgetView.Property.PREVIEW).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.PREVIEW, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets the loading text. + /// + public bool LoadingText + { + get + { + bool temp; + GetProperty(WidgetView.Property.LOADING_TEXT).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.LOADING_TEXT, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets whether the widget state is faulted or not. + /// + public bool WidgetStateFaulted + { + get + { + bool temp; + GetProperty(WidgetView.Property.WIDGET_STATE_FAULTED).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.WIDGET_STATE_FAULTED, new Tizen.NUI.PropertyValue(value)); + } + } + + /// + /// Gets/sets whether the widget is permanent delete or not. + /// + public bool PermanentDelete + { + get + { + bool temp; + GetProperty(WidgetView.Property.PERMANENT_DELETE).Get(out temp); + return temp; + } + set + { + SetProperty(WidgetView.Property.PERMANENT_DELETE, new Tizen.NUI.PropertyValue(value)); + } + } + + } + +} diff --git a/src/Tizen.NUI/src/public/WidgetViewManager.cs b/src/Tizen.NUI/src/public/WidgetViewManager.cs new file mode 100755 index 0000000..b77dcde --- /dev/null +++ b/src/Tizen.NUI/src/public/WidgetViewManager.cs @@ -0,0 +1,122 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ +// This File has been auto-generated by SWIG and then modified using DALi Ruby Scripts +//------------------------------------------------------------------------------ +// +// +// This file was automatically generated by SWIG (http://www.swig.org). +// Version 3.0.12 +// +// Do not make changes to this file unless you know what you are doing--modify +// the SWIG interface file instead. +//------------------------------------------------------------------------------ + +namespace Tizen.NUI +{ + + /// + /// WidgetViewManager manages addition of WidgetView controls. + /// This class provides the functionality of adding the widget views and controlling the widgets. + /// + public class WidgetViewManager : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + + internal WidgetViewManager(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicManualPINVOKE.WidgetViewManager_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WidgetViewManager obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make WidgetViewManager instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicManualPINVOKE.delete_WidgetViewManager(swigCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + base.Dispose(type); + } + + public WidgetViewManager(NUIApplication nuiApplication, string appId) : this(NDalicManualPINVOKE.WidgetViewManager_New(Application.getCPtr(nuiApplication.ApplicationHandle), appId), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal static WidgetViewManager DownCast(BaseHandle handle) + { + WidgetViewManager ret = new WidgetViewManager(NDalicManualPINVOKE.WidgetViewManager_DownCast(BaseHandle.getCPtr(handle)), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WidgetViewManager(WidgetViewManager handle) : this(NDalicManualPINVOKE.new_WidgetViewManager__SWIG_1(WidgetViewManager.getCPtr(handle)), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal WidgetViewManager Assign(WidgetViewManager handle) + { + WidgetViewManager ret = new WidgetViewManager(NDalicManualPINVOKE.WidgetViewManager_Assign(swigCPtr, WidgetViewManager.getCPtr(handle)), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Creates a new widget view object. + /// + /// The widget id. + /// Contents that will be given to the widget instance. + /// The widget width. + /// The widget height. + /// The period of updating contents of the widget. + /// A handle to WidgetView. + public WidgetView AddWidget(string widgetId, string contentInfo, int width, int height, float updatePeriod) + { + WidgetView ret = new WidgetView(NDalicManualPINVOKE.WidgetViewManager_AddWidget(swigCPtr, widgetId, contentInfo, width, height, updatePeriod), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + } + +} diff --git a/src/Tizen.NUI/src/public/Window.cs b/src/Tizen.NUI/src/public/Window.cs new file mode 100755 index 0000000..8c2b91f --- /dev/null +++ b/src/Tizen.NUI/src/public/Window.cs @@ -0,0 +1,1419 @@ +/** Copyright (c) 2017 Samsung Electronics Co., Ltd. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*/ + +namespace Tizen.NUI +{ + + using System; + using System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + /// + /// The window class is used internally for drawing.
+ /// A Window has an orientation and indicator properties.
+ ///
+ public class Window : BaseHandle + { + private global::System.Runtime.InteropServices.HandleRef swigCPtr; + private global::System.Runtime.InteropServices.HandleRef stageCPtr; + private Layer _rootLayer; + + internal Window(global::System.IntPtr cPtr, bool cMemoryOwn) : base(NDalicPINVOKE.Window_SWIGUpcast(cPtr), cMemoryOwn) + { + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr); + if (NDalicPINVOKE.Stage_IsInstalled()) + { + stageCPtr = new global::System.Runtime.InteropServices.HandleRef(this, NDalicPINVOKE.Stage_GetCurrent()); + } + } + + internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Window obj) + { + return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; + } + + /// + /// To make Window instance be disposed. + /// + protected override void Dispose(DisposeTypes type) + { + if(disposed) + { + return; + } + + if(type == DisposeTypes.Explicit) + { + //Called by User + //Release your own managed resources here. + //You should release all of your own disposable objects here. + } + + //Release your own unmanaged resources here. + //You should not access any managed member here except static instance. + //because the execution order of Finalizes is non-deterministic. + + if (swigCPtr.Handle != global::System.IntPtr.Zero) + { + if (swigCMemOwn) + { + swigCMemOwn = false; + NDalicPINVOKE.delete_Window(swigCPtr); + NDalicPINVOKE.delete_Stage(stageCPtr); + } + swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); + } + + base.Dispose(type); + } + + internal static Window GetCurrent() + { + Window ret = new Window(NDalicPINVOKE.Stage_GetCurrent(), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static bool IsInstalled() + { + bool ret = NDalicPINVOKE.Stage_IsInstalled(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets whether window accepts focus or not. + /// + /// If focus is accepted or not. Default is true. + public void SetAcceptFocus(bool accept) + { + NDalicPINVOKE.SetAcceptFocus(swigCPtr, accept); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether window accepts focus or not. + /// + /// True if the window accept focus, false otherwise + public bool IsFocusAcceptable() + { + return NDalicPINVOKE.IsFocusAcceptable(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Shows the window if it is hidden. + /// + public void Show() + { + NDalicPINVOKE.Show(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Hides the window if it is showing. + /// + public void Hide() + { + NDalicPINVOKE.Hide(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Retrieves whether the window is visible or not. + /// + /// true, if the windoe is visible + public bool IsVisible() + { + bool temp = NDalicPINVOKE.IsVisible(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return temp; + } + + /// + /// Gets the count of supported auxiliary hints of the window. + /// + /// The number of supported auxiliary hints. + public uint GetSupportedAuxiliaryHintCount() { + uint ret = NDalicPINVOKE.GetSupportedAuxiliaryHintCount(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets the supported auxiliary hint string of the window. + /// + /// The index of the supported auxiliary hint lists. + /// The auxiliary hint string of the index. + public string GetSupportedAuxiliaryHint(uint index) { + string ret = NDalicPINVOKE.GetSupportedAuxiliaryHint(swigCPtr, index); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Creates an auxiliary hint of the window. + /// + /// The auxiliary hint string. + /// The value string. + /// The ID of created auxiliary hint, or 0 on failure. + public uint AddAuxiliaryHint(string hint, string value) { + uint ret = NDalicPINVOKE.AddAuxiliaryHint(swigCPtr, hint, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Removes an auxiliary hint of the window. + /// + /// The ID of the auxiliary hint. + /// True if no error occurred, false otherwise. + public bool RemoveAuxiliaryHint(uint id) { + bool ret = NDalicPINVOKE.RemoveAuxiliaryHint(swigCPtr, id); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Changes a value of the auxiliary hint. + /// + /// The auxiliary hint ID. + /// The value string to be set. + /// True if no error occurred, false otherwise. + public bool SetAuxiliaryHintValue(uint id, string value) { + bool ret = NDalicPINVOKE.SetAuxiliaryHintValue(swigCPtr, id, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets a value of the auxiliary hint. + /// + /// The auxiliary hint ID. + /// The string value of the auxiliary hint ID, or an empty string if none exists. + public string GetAuxiliaryHintValue(uint id) { + string ret = NDalicPINVOKE.GetAuxiliaryHintValue(swigCPtr, id); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets an ID of the auxiliary hint string. + /// + /// The auxiliary hint string. + /// The ID of auxiliary hint string, or 0 on failure. + public uint GetAuxiliaryHintId(string hint) { + uint ret = NDalicPINVOKE.GetAuxiliaryHintId(swigCPtr, hint); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a region to accept input events. + /// + /// The region to accept input events. + public void SetInputRegion(Rectangle inputRegion) { + NDalicPINVOKE.SetInputRegion(swigCPtr, Rectangle.getCPtr(inputRegion)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Gets/Sets a window type. + /// + public WindowType Type + { + get + { + WindowType ret = (WindowType)NDalicPINVOKE.GetType(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + set + { + NDalicPINVOKE.SetType(swigCPtr, (int)value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + /// + /// Sets a priority level for the specified notification window. + /// + /// The notification window level. + /// True if no error occurred, false otherwise. + public bool SetNotificationLevel(NotificationLevel level) { + bool ret = NDalicPINVOKE.SetNotificationLevel(swigCPtr, (int)level); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets a priority level for the specified notification window. + /// + /// The notification window level. + public NotificationLevel GetNotificationLevel() { + NotificationLevel ret = (NotificationLevel)NDalicPINVOKE.GetNotificationLevel(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a transparent window's visual state to opaque. + /// + /// Whether the window's visual state is opaque. + public void SetOpaqueState(bool opaque) { + NDalicPINVOKE.SetOpaqueState(swigCPtr, opaque); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Returns whether a transparent window's visual state is opaque or not. + /// + /// True if the window's visual state is opaque, false otherwise. + public bool IsOpaqueState() { + bool ret = NDalicPINVOKE.IsOpaqueState(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets a window's screen mode. + /// + /// The screen mode. + /// True if no error occurred, false otherwise. + public bool SetScreenMode(ScreenMode screenMode) { + bool ret = NDalicPINVOKE.SetScreenMode(swigCPtr, (int)screenMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets a screen mode of the window. + /// + /// The screen mode. + public ScreenMode GetScreenMode() { + ScreenMode ret = (ScreenMode)NDalicPINVOKE.GetScreenMode(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Sets preferred brightness of the window. + /// + /// The preferred brightness (0 to 100). + /// True if no error occurred, false otherwise. + public bool SetBrightness(int brightness) { + bool ret = NDalicPINVOKE.SetBrightness(swigCPtr, brightness); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Gets preffered brightness of the window. + /// + /// The preffered brightness. + public int GetBrightness() { + int ret = NDalicPINVOKE.GetBrightness(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public class FocusChangedEventArgs : EventArgs + { + public bool FocusGained + { + get; + set; + } + } + + private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WindowFocusChangedEventCallbackType(bool focusGained); + private event EventHandler _windowFocusChangedEventHandler; + + public event EventHandler FocusChanged + { + add + { + if (_windowFocusChangedEventHandler == null) + { + _windowFocusChangedEventCallback = OnWindowFocusedChanged; + WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback); + } + + _windowFocusChangedEventHandler += value; + } + remove + { + _windowFocusChangedEventHandler -= value; + + if (_windowFocusChangedEventHandler == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback); + } + } + } + + private void OnWindowFocusedChanged(bool focusGained) + { + FocusChangedEventArgs e = new FocusChangedEventArgs(); + + e.FocusGained = focusGained; + + if (_windowFocusChangedEventHandler != null) + { + _windowFocusChangedEventHandler(this, e); + } + } + + internal WindowFocusSignalType WindowFocusChangedSignal() + { + WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Window(Rectangle windowPosition, string name, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_0(Rectangle.getCPtr(windowPosition), name, isTransparent), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Window(Rectangle windowPosition, string name) : this(NDalicPINVOKE.Window_New__SWIG_1(Rectangle.getCPtr(windowPosition), name), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Window(Rectangle windowPosition, string name, string className, bool isTransparent) : this(NDalicPINVOKE.Window_New__SWIG_2(Rectangle.getCPtr(windowPosition), name, className, isTransparent), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Window(Rectangle windowPosition, string name, string className) : this(NDalicPINVOKE.Window_New__SWIG_3(Rectangle.getCPtr(windowPosition), name, className), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void ShowIndicator(Window.IndicatorVisibleMode visibleMode) + { + NDalicPINVOKE.Window_ShowIndicator(swigCPtr, (int)visibleMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetIndicatorBackgroundOpacity(Window.IndicatorBackgroundOpacity opacity) + { + NDalicPINVOKE.Window_SetIndicatorBgOpacity(swigCPtr, (int)opacity); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RotateIndicator(Window.WindowOrientation orientation) + { + NDalicPINVOKE.Window_RotateIndicator(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetClass(string name, string klass) + { + NDalicPINVOKE.Window_SetClass(swigCPtr, name, klass); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Raises window to the top of Window stack. + /// + public void Raise() + { + NDalicPINVOKE.Window_Raise(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Lowers window to the bottom of Window stack. + /// + public void Lower() + { + NDalicPINVOKE.Window_Lower(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Activates window to the top of Window stack even it is iconified. + /// + public void Activate() + { + NDalicPINVOKE.Window_Activate(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void AddAvailableOrientation(Window.WindowOrientation orientation) + { + NDalicPINVOKE.Window_AddAvailableOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void RemoveAvailableOrientation(Window.WindowOrientation orientation) + { + NDalicPINVOKE.Window_RemoveAvailableOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void SetPreferredOrientation(Window.WindowOrientation orientation) + { + NDalicPINVOKE.Window_SetPreferredOrientation(swigCPtr, (int)orientation); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Window.WindowOrientation GetPreferredOrientation() + { + Window.WindowOrientation ret = (Window.WindowOrientation)NDalicPINVOKE.Window_GetPreferredOrientation(swigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal DragAndDropDetector GetDragAndDropDetector() + { + DragAndDropDetector ret = new DragAndDropDetector(NDalicPINVOKE.Window_GetDragAndDropDetector(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Any GetNativeHandle() + { + Any ret = new Any(NDalicPINVOKE.Window_GetNativeHandle(swigCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal WindowFocusSignalType FocusChangedSignal() + { + WindowFocusSignalType ret = new WindowFocusSignalType(NDalicPINVOKE.FocusChangedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Get default ( root ) layer. + /// + /// The root layer + public Layer GetDefaultLayer() + { + return this.GetRootLayer(); + } + + internal void Add(Layer layer) + { + NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal void Remove(Layer layer) + { + NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Add(View view) + { + NDalicPINVOKE.Stage_Add(stageCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + public void Remove(View view) + { + NDalicPINVOKE.Stage_Remove(stageCPtr, View.getCPtr(view)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector2 GetSize() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetSize(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal RenderTaskList GetRenderTaskList() + { + RenderTaskList ret = new RenderTaskList(NDalicPINVOKE.Stage_GetRenderTaskList(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Queries the number of on-window layers. + /// + /// The number of layers. + /// Note that a default layer is always provided (count >= 1). + internal uint GetLayerCount() + { + uint ret = NDalicPINVOKE.Stage_GetLayerCount(stageCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + public Layer GetLayer(uint depth) + { + IntPtr cPtr = NDalicPINVOKE.Stage_GetLayer(stageCPtr, depth); + Layer ret = Registry.GetManagedBaseHandleFromNativePtr(cPtr) as Layer; + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Layer GetRootLayer() + { + if (_rootLayer == null) + _rootLayer = new Layer(NDalicPINVOKE.Stage_GetRootLayer(stageCPtr), true); + + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return _rootLayer; + } + + internal void SetBackgroundColor(Vector4 color) + { + NDalicPINVOKE.Stage_SetBackgroundColor(stageCPtr, Vector4.getCPtr(color)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Vector4 GetBackgroundColor() + { + Vector4 ret = new Vector4(NDalicPINVOKE.Stage_GetBackgroundColor(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal Vector2 GetDpi() + { + Vector2 ret = new Vector2(NDalicPINVOKE.Stage_GetDpi(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ObjectRegistry GetObjectRegistry() + { + ObjectRegistry ret = new ObjectRegistry(NDalicPINVOKE.Stage_GetObjectRegistry(stageCPtr), true); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Keep rendering for at least the given amount of time. + /// + /// Time to keep rendering, 0 means render at least one more frame + public void KeepRendering(float durationSeconds) + { + NDalicPINVOKE.Stage_KeepRendering(stageCPtr, durationSeconds); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal KeyEventSignal KeyEventSignal() + { + KeyEventSignal ret = new KeyEventSignal(NDalicPINVOKE.Stage_KeyEventSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal EventProcessingFinishedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_EventProcessingFinishedSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal TouchSignal TouchSignal() + { + TouchSignal ret = new TouchSignal(NDalicPINVOKE.Stage_TouchSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + private StageWheelSignal WheelEventSignal() + { + StageWheelSignal ret = new StageWheelSignal(NDalicPINVOKE.Stage_WheelEventSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal ContextLostSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextLostSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal ContextRegainedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_ContextRegainedSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal VoidSignal SceneCreatedSignal() + { + VoidSignal ret = new VoidSignal(NDalicPINVOKE.Stage_SceneCreatedSignal(stageCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal ResizedSignal ResizedSignal() + { + ResizedSignal ret = new ResizedSignal(NDalicManualPINVOKE.Window_ResizedSignal(swigCPtr), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal static Vector4 DEFAULT_BACKGROUND_COLOR + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEFAULT_BACKGROUND_COLOR_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + internal static Vector4 DEBUG_BACKGROUND_COLOR + { + get + { + global::System.IntPtr cPtr = NDalicPINVOKE.Stage_DEBUG_BACKGROUND_COLOR_get(); + Vector4 ret = (cPtr == global::System.IntPtr.Zero) ? null : new Vector4(cPtr, false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + private static readonly Window instance = Application.Instance.GetWindow(); + + /// + /// Stage instance property (read-only).
+ /// Gets the current Window.
+ ///
+ public static Window Instance + { + get + { + return instance; + } + } + + /// + /// Grabs the key specified by a key for a window only when a window is the topmost window.
+ /// This function can be used for following example scenarios:
+ /// - Mobile - Using volume up/down as zoom up/down in camera apps.
+ ///
+ /// The key code to grab + /// true if the grab succeeds + public bool GrabKeyTopmost(int DaliKey) + { + bool ret = NDalicManualPINVOKE.GrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Ungrabs the key specified by a key for a window.
+ /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.
+ ///
+ /// The key code to ungrab + /// true if the ungrab succeeds + public bool UngrabKeyTopmost(int DaliKey) + { + bool ret = NDalicManualPINVOKE.UngrabKeyTopmost(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Grabs the key specified by a key for a window in a GrabMode.
+ /// Details: This function can be used for following example scenarios:
+ /// - TV - A user might want to change the volume or channel of the background TV contents while focusing on the foregrund app.
+ /// - Mobile - When a user presses Home key, the homescreen appears regardless of current foreground app.
+ /// - Mobile - Using volume up/down as zoom up/down in camera apps.
+ ///
+ /// The key code to grab + /// The grab mode for the key + /// true if the grab succeeds + public bool GrabKey(int DaliKey, KeyGrabMode GrabMode) + { + bool ret = NDalicManualPINVOKE.GrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey, (int)GrabMode); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Ungrabs the key specified by a key for a window.
+ /// Note: If this function is called between key down and up events of a grabbed key, an application doesn't receive the key up event.
+ ///
+ /// The key code to ungrab + /// true if the ungrab succeeds + public bool UngrabKey(int DaliKey) + { + bool ret = NDalicManualPINVOKE.UngrabKey(HandleRef.ToIntPtr(this.swigCPtr), DaliKey); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal System.IntPtr GetNativeWindowHandler() + { + System.IntPtr ret = NDalicManualPINVOKE.GetNativeWindowHandler(HandleRef.ToIntPtr(this.swigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing. + /// + public enum WindowOrientation + { + Portrait = 0, + Landscape = 90, + PortraitInverse = 180, + LandscapeInverse = 270 + } + + /// + /// Enumeration for key grab mode for platform-level APIs. + /// + public enum KeyGrabMode + { + /// + /// Grab a key only when on the top of the grabbing-window stack mode. + /// + Topmost = 0, + /// + /// Grab a key together with the other client window(s) mode. + /// + Shared, + /// + /// Grab a key exclusively regardless of the grabbing-window's position on the window stack with the possibility of overriding the grab by the other client window mode. + /// + OverrideExclusive, + /// + /// Grab a key exclusively regardless of the grabbing-window's position on the window stack mode. + /// + Exclusive + }; + + /// + /// Enumeration for opacity of the indicator. + /// + internal enum IndicatorBackgroundOpacity + { + Opaque = 100, + Translucent = 50, + Transparent = 0 + } + + /// + /// Enumeration for visible mode of the indicator. + /// + internal enum IndicatorVisibleMode + { + Invisible = 0, + Visible = 1, + Auto = 2 + } + + /// + /// Touch event argument. + /// + public class TouchEventArgs : EventArgs + { + private Touch _touch; + + /// + /// Touch. + /// + public Touch Touch + { + get + { + return _touch; + } + set + { + _touch = value; + } + } + } + + private event EventHandler _stageTouchHandler; + private EventCallbackDelegateType1 _stageTouchCallbackDelegate; + + /// + /// This is emitted when the screen is touched and when the touch ends.
+ /// If there are multiple touch points, then this will be emitted when the first touch occurs and + /// then when the last finger is lifted.
+ /// An interrupted event will also be emitted (if it occurs).
+ ///
+ public event EventHandler TouchEvent + { + add + { + lock (this) + { + _stageTouchHandler += value; + _stageTouchCallbackDelegate = OnStageTouch; + this.TouchSignal().Connect(_stageTouchCallbackDelegate); + } + } + remove + { + lock (this) + { + if (_stageTouchHandler != null) + { + this.TouchSignal().Disconnect(_stageTouchCallbackDelegate); + } + _stageTouchHandler -= value; + } + } + } + + private void OnStageTouch(IntPtr data) + { + TouchEventArgs e = new TouchEventArgs(); + + if (data != null) + { + e.Touch = Tizen.NUI.Touch.GetTouchFromPtr(data); + } + + if (_stageTouchHandler != null) + { + _stageTouchHandler(this, e); + } + } + + /// + /// Wheel event arguments. + /// + public class WheelEventArgs : EventArgs + { + private Wheel _wheel; + + /// + /// Wheel. + /// + public Wheel Wheel + { + get + { + return _wheel; + } + set + { + _wheel = value; + } + } + } + + private event EventHandler _stageWheelHandler; + private EventCallbackDelegateType1 _stageWheelCallbackDelegate; + + /// + /// Event emitted when wheel event is received. + /// + public event EventHandler WheelEvent + { + add + { + if (_stageWheelHandler == null) + { + _stageWheelCallbackDelegate = OnStageWheel; + WheelEventSignal().Connect(_stageWheelCallbackDelegate); + } + _stageWheelHandler += value; + } + remove + { + _stageWheelHandler -= value; + if (_stageWheelHandler == null && WheelEventSignal().Empty() == false) + { + WheelEventSignal().Disconnect(_stageWheelCallbackDelegate); + } + } + } + + private void OnStageWheel(IntPtr data) + { + WheelEventArgs e = new WheelEventArgs(); + + if (data != null) + { + e.Wheel = Tizen.NUI.Wheel.GetWheelFromPtr(data); + } + + if (_stageWheelHandler != null) + { + _stageWheelHandler(this, e); + } + } + + /// + /// Key event arguments. + /// + public class KeyEventArgs : EventArgs + { + private Key _key; + + /// + /// Key + /// + public Key Key + { + get + { + return _key; + } + set + { + _key = value; + } + } + } + + private event EventHandler _stageKeyHandler; + private EventCallbackDelegateType1 _stageKeyCallbackDelegate; + + /// + /// Event emitted when key event is received. + /// + public event EventHandler KeyEvent + { + add + { + if (_stageKeyHandler == null) + { + _stageKeyCallbackDelegate = OnStageKey; + KeyEventSignal().Connect(_stageKeyCallbackDelegate); + } + _stageKeyHandler += value; + } + remove + { + _stageKeyHandler -= value; + if (_stageKeyHandler == null && KeyEventSignal().Empty() == false) + { + KeyEventSignal().Disconnect(_stageKeyCallbackDelegate); + } + } + } + + // Callback for Stage KeyEventsignal + private void OnStageKey(IntPtr data) + { + KeyEventArgs e = new KeyEventArgs(); + + if (data != null) + { + e.Key = Tizen.NUI.Key.GetKeyFromPtr(data); + } + + if (_stageKeyHandler != null) + { + //here we send all data to user event handlers + _stageKeyHandler(this, e); + } + } + + + private event EventHandler _stageEventProcessingFinishedEventHandler; + private EventCallbackDelegateType0 _stageEventProcessingFinishedEventCallbackDelegate; + + internal event EventHandler EventProcessingFinished + { + add + { + if (_stageEventProcessingFinishedEventHandler == null) + { + _stageEventProcessingFinishedEventCallbackDelegate = OnEventProcessingFinished; + EventProcessingFinishedSignal().Connect(_stageEventProcessingFinishedEventCallbackDelegate); + } + _stageEventProcessingFinishedEventHandler += value; + + } + remove + { + _stageEventProcessingFinishedEventHandler -= value; + if (_stageEventProcessingFinishedEventHandler == null && EventProcessingFinishedSignal().Empty() == false) + { + EventProcessingFinishedSignal().Disconnect(_stageEventProcessingFinishedEventCallbackDelegate); + } + } + } + + // Callback for Stage EventProcessingFinishedSignal + private void OnEventProcessingFinished() + { + if (_stageEventProcessingFinishedEventHandler != null) + { + _stageEventProcessingFinishedEventHandler(this, null); + } + } + + + private EventHandler _stageContextLostEventHandler; + private EventCallbackDelegateType0 _stageContextLostEventCallbackDelegate; + + internal event EventHandler ContextLost + { + add + { + if (_stageContextLostEventHandler == null) + { + _stageContextLostEventCallbackDelegate = OnContextLost; + ContextLostSignal().Connect(_stageContextLostEventCallbackDelegate); + } + _stageContextLostEventHandler += value; + } + remove + { + _stageContextLostEventHandler -= value; + if (_stageContextLostEventHandler == null && ContextLostSignal().Empty() == false) + { + ContextLostSignal().Disconnect(_stageContextLostEventCallbackDelegate); + } + } + } + + // Callback for Stage ContextLostSignal + private void OnContextLost() + { + if (_stageContextLostEventHandler != null) + { + _stageContextLostEventHandler(this, null); + } + } + + + private EventHandler _stageContextRegainedEventHandler; + private EventCallbackDelegateType0 _stageContextRegainedEventCallbackDelegate; + + internal event EventHandler ContextRegained + { + add + { + if (_stageContextRegainedEventHandler == null) + { + _stageContextRegainedEventCallbackDelegate = OnContextRegained; + ContextRegainedSignal().Connect(_stageContextRegainedEventCallbackDelegate); + } + _stageContextRegainedEventHandler += value; + } + remove + { + _stageContextRegainedEventHandler -= value; + if (_stageContextRegainedEventHandler == null && ContextRegainedSignal().Empty() == false) + { + this.ContextRegainedSignal().Disconnect(_stageContextRegainedEventCallbackDelegate); + } + } + } + + // Callback for Stage ContextRegainedSignal + private void OnContextRegained() + { + if (_stageContextRegainedEventHandler != null) + { + _stageContextRegainedEventHandler(this, null); + } + } + + + private EventHandler _stageSceneCreatedEventHandler; + private EventCallbackDelegateType0 _stageSceneCreatedEventCallbackDelegate; + + internal event EventHandler SceneCreated + { + add + { + if (_stageSceneCreatedEventHandler == null) + { + _stageSceneCreatedEventCallbackDelegate = OnSceneCreated; + SceneCreatedSignal().Connect(_stageSceneCreatedEventCallbackDelegate); + } + _stageSceneCreatedEventHandler += value; + } + remove + { + _stageSceneCreatedEventHandler -= value; + if (_stageSceneCreatedEventHandler == null && SceneCreatedSignal().Empty() == false) + { + SceneCreatedSignal().Disconnect(_stageSceneCreatedEventCallbackDelegate); + } + } + } + + // Callback for Stage SceneCreatedSignal + private void OnSceneCreated() + { + if (_stageSceneCreatedEventHandler != null) + { + _stageSceneCreatedEventHandler(this, null); + } + } + + public class ResizedEventArgs : EventArgs + { + Size2D _windowSize; + + public Size2D WindowSize + { + get + { + return _windowSize; + } + set + { + _windowSize = value; + } + } + } + + private WindowResizedEventCallbackType _windowResizedEventCallback; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WindowResizedEventCallbackType(IntPtr windowSize); + private event EventHandler _windowResizedEventHandler; + + public event EventHandler Resized + { + add + { + if (_windowResizedEventHandler == null) + { + _windowResizedEventCallback = OnResized; + ResizedSignal().Connect(_windowResizedEventCallback); + } + + _windowResizedEventHandler += value; + } + remove + { + _windowResizedEventHandler -= value; + + if (_windowResizedEventHandler == null && ResizedSignal().Empty() == false && _windowResizedEventCallback != null) + { + ResizedSignal().Disconnect(_windowResizedEventCallback); + } + } + } + + private void OnResized(IntPtr windowSize) + { + ResizedEventArgs e = new ResizedEventArgs(); + var val = new Uint16Pair(windowSize, false); + e.WindowSize = new Size2D(val.GetWidth(), val.GetHeight()); + val.Dispose(); + + if (_windowResizedEventHandler != null) + { + _windowResizedEventHandler(this, e); + } + } + + internal void SetWindowSize(Size2D size) + { + var val = new Uint16Pair((uint)size.Width, (uint)size.Height); + NDalicManualPINVOKE.SetSize(swigCPtr, Uint16Pair.getCPtr(val)); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Size2D GetWindowSize() + { + var val = new Uint16Pair(NDalicManualPINVOKE.GetSize(swigCPtr), false); + Size2D ret = new Size2D(val.GetWidth(), val.GetHeight()); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + internal void SetPosition(Position2D position) + { + var val = new Uint16Pair( (uint)position.X, (uint)position.Y ); + NDalicManualPINVOKE.SetPosition(swigCPtr, Uint16Pair.getCPtr(val)); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + internal Position2D GetPosition() + { + var val = new Uint16Pair(NDalicManualPINVOKE.GetPosition(swigCPtr), true); + Position2D ret = new Position2D(val.GetX(), val.GetY()); + + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /// + /// Window size property (read-only). + /// + public Size2D Size + { + get + { + Size2D ret = GetSize(); + return ret; + } + } + + /// + /// Background color property. + /// + public Color BackgroundColor + { + set + { + SetBackgroundColor(value); + } + get + { + Color ret = GetBackgroundColor(); + return ret; + } + } + + /// + /// Dpi property (read-only).
+ /// Retrieves the DPI of the display device to which the Window is connected.
+ ///
+ public Vector2 Dpi + { + get + { + return GetDpi(); + } + } + + /// + /// Layer count property (read-only).
+ /// Queries the number of on-Window layers.
+ ///
+ public uint LayerCount + { + get + { + return GetLayerCount(); + } + } + + + /// + /// Add layer to the Stage. + /// + /// Layer to add + public void AddLayer(Layer layer) + { + NDalicPINVOKE.Stage_Add(stageCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /// + /// Remove layer from the Stage. + /// + /// Layer to remove + public void RemoveLayer(Layer layer) + { + NDalicPINVOKE.Stage_Remove(stageCPtr, Layer.getCPtr(layer)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [Obsolete("Please do not use! this will be deprecated")] + public class WindowFocusChangedEventArgs : EventArgs + { + public bool FocusGained + { + get; + set; + } + } + + private WindowFocusChangedEventCallbackType _windowFocusChangedEventCallback2; + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + private delegate void WindowFocusChangedEventCallbackType2(bool focusGained); + private event EventHandler _windowFocusChangedEventHandler2; + + [Obsolete("Please do not use! this will be deprecated. Please use 'FocusChanged' event instead")] + public event EventHandler WindowFocusChanged + { + add + { + if (_windowFocusChangedEventHandler2 == null) + { + _windowFocusChangedEventCallback2 = OnWindowFocusedChanged2; + WindowFocusChangedSignal().Connect(_windowFocusChangedEventCallback2); + } + + _windowFocusChangedEventHandler2 += value; + } + remove + { + _windowFocusChangedEventHandler2 -= value; + + if (_windowFocusChangedEventHandler2 == null && WindowFocusChangedSignal().Empty() == false && _windowFocusChangedEventCallback2 != null) + { + WindowFocusChangedSignal().Disconnect(_windowFocusChangedEventCallback2); + } + } + } + + private void OnWindowFocusedChanged2(bool focusGained) + { + WindowFocusChangedEventArgs e = new WindowFocusChangedEventArgs(); + + e.FocusGained = focusGained; + + if (_windowFocusChangedEventHandler2 != null) + { + _windowFocusChangedEventHandler2(this, e); + } + } + + /// + /// Gets/Sets a size of the window. + /// + public Size2D WindowSize + { + get + { + return GetWindowSize(); + } + set + { + SetWindowSize(value); + } + } + + /// + /// Gets/Sets a position of the window. + /// + public Position2D WindowPosition + { + get + { + return GetPosition(); + } + set + { + SetPosition(value); + } + } + + + } +} diff --git a/src/Tizen.Network.Bluetooth/Interop/Interop.Bluetooth.cs b/src/Tizen.Network.Bluetooth/Interop/Interop.Bluetooth.cs new file mode 100755 index 0000000..87accbb --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Interop/Interop.Bluetooth.cs @@ -0,0 +1,597 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Network.Bluetooth; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Bluetooth + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(int result, int state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void NameChangedCallback(string deviceName, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VisibilityModeChangedCallback(int result, int visibility, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VisibilityDurationChangedCallback(int duration, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DiscoveryStateChangedCallback(int result, BluetoothDeviceDiscoveryState state, IntPtr deviceInfo, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool BondedDeviceCallback([MarshalAs(UnmanagedType.Struct)]ref BluetoothDeviceStruct device, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BondCreatedCallback(int result, [MarshalAs(UnmanagedType.Struct)]ref BluetoothDeviceStruct device, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void BondDestroyedCallback(int result, string deviceAddress, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AuthorizationChangedCallback(int authorization, string deviceAddress, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceSearchedCallback(int result, [MarshalAs(UnmanagedType.Struct)]ref BluetoothDeviceSdpStruct sdp, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DeviceConnectionStateChangedCallback(bool connected, [MarshalAs(UnmanagedType.Struct)]ref BluetoothDeviceConnectionStruct device, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ConnectedProfileCallback(int profile, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DataReceivedCallback([MarshalAs(UnmanagedType.Struct)]ref SocketDataStruct socketData, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SocketConnectionStateChangedCallback(int result, BluetoothSocketState connectionState, [MarshalAs(UnmanagedType.Struct)]ref SocketConnectionStruct socketConnection, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AudioConnectionStateChangedCallback(int result, bool connected, string deviceAddress, int profileType, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void HidConnectionStateChangedCallback(int result, bool connected, string deviceAddress, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TargetConnectionStateChangedCallback(bool connected, string deviceAddress, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EqualizerStateChangedCallback(int equalizer, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RepeatModeChangedCallback(int repeat, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ShuffleModeChangedCallback(int shuffle, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ScanModeChangedCallback(int scan, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ConnectionChangedCallback(int result, bool connected, string deviceAddress, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ClientCharacteristicValueChangedCallback(IntPtr characteristicHandle, string value, int len, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void GattClientRequestedCallback(int result, IntPtr handle, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GattForEachCallback(int total, int index, IntPtr handle, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_deinitialize")] + internal static extern int Deinitialize(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_name")] + internal static extern int GetName(out string name); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_name")] + internal static extern int SetName(string name); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_state")] + internal static extern int GetState(out BluetoothState isActivated); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_address")] + internal static extern int GetAddress(out string address); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_visibility")] + internal static extern int GetVisibility(out int visibility, out int duration); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_is_discovering")] + internal static extern int IsDiscovering(out bool isDiscovering); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_start_device_discovery")] + internal static extern int StartDiscovery(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_stop_device_discovery")] + internal static extern int StopDiscovery(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_foreach_bonded_device")] + internal static extern int GetBondedDevices(BondedDeviceCallback bondedDeviceCb, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_bonded_device_info")] + internal static extern int GetBondedDeviceByAddress(string deviceAddress, out IntPtr deviceInfo); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_free_device_info")] + internal static extern int FreeDeviceInfo(BluetoothDeviceStruct deviceInfo); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_is_service_used")] + internal static extern int IsServiceUsed(string serviceUuid, out bool used); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_get_local_oob_data")] + internal static extern int GetOobData(out IntPtr hash, out IntPtr randomizer, out int hashLen, out int randomizerLen); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_remote_oob_data")] + internal static extern int SetOobData(string deviceAddress, IntPtr hash, IntPtr randomizer, int hashLen, int randomizerLen); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_remove_remote_oob_data")] + internal static extern int RemoveOobData(string deviceAddress); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(StateChangedCallback stateChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_unset_state_changed_cb")] + internal static extern int UnsetStateChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_name_changed_cb")] + internal static extern int SetNameChangedCallback(NameChangedCallback nameChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_unset_name_changed_cb")] + internal static extern int UnsetNameChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_visibility_mode_changed_cb")] + internal static extern int SetVisibilityModeChangedCallback(VisibilityModeChangedCallback visibilityChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_unset_visibility_mode_changed_cb")] + internal static extern int UnsetVisibilityModeChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_visibility_duration_changed_cb")] + internal static extern int SetVisibilityDurationChangedCallback(VisibilityDurationChangedCallback durationChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_unset_visibility_duration_changed_cb")] + internal static extern int UnsetVisibilityDurationChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_set_device_discovery_state_changed_cb")] + internal static extern int SetDiscoveryStateChangedCallback(DiscoveryStateChangedCallback discoveryChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_unset_device_discovery_state_changed_cb")] + internal static extern int UnsetDiscoveryStateChangedCallback(); + + //Bluetooth Device + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_create_bond")] + internal static extern int CreateBond(string deviceAddress); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_destroy_bond")] + internal static extern int DestroyBond(string deviceAddress); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_cancel_bonding")] + internal static extern int CancelBonding(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_alias")] + internal static extern int SetAlias(string deviceAddress, string alias); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_authorization")] + internal static extern int SetAuthorization(string deviceAddress, int state); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_get_service_mask_from_uuid_list")] + internal static extern int GetMaskFromUuid([MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 1)] string[] uuids, int count, out BluetoothServiceClassType serviceMask); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_start_service_search")] + internal static extern int StartServiceSearch(string deviceAddress); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_foreach_connected_profiles")] + internal static extern int GetConnectedProfiles(string deviceAddress, ConnectedProfileCallback connectedProfileCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_is_profile_connected")] + internal static extern int IsProfileConnected(string deviceAddress, int profile, out bool connectionStatus); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_bond_created_cb")] + internal static extern int SetBondCreatedCallback(BondCreatedCallback bondCreatedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_unset_bond_created_cb")] + internal static extern int UnsetBondCreatedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_bond_destroyed_cb")] + internal static extern int SetBondDestroyedCallback(BondDestroyedCallback bondDestroyedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_unset_bond_destroyed_cb")] + internal static extern int UnsetBondDestroyedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_authorization_changed_cb")] + internal static extern int SetAuthorizationChangedCallback(AuthorizationChangedCallback authorizationChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_unset_authorization_changed_cb")] + internal static extern int UnsetAuthorizationChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_service_searched_cb")] + internal static extern int SetServiceSearchedCallback(ServiceSearchedCallback serviceSearchedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_unset_service_searched_cb")] + internal static extern int UnsetServiceSearchedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_set_connection_state_changed_cb")] + internal static extern int SetConnectionStateChangedCallback(DeviceConnectionStateChangedCallback connectionChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_device_unset_connection_state_changed_cb")] + internal static extern int UnsetConnectionStateChangedCallback(); + + // Bluetooth LE Adapter + + //Callback for event + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void AdapterLeScanResultChangedCallBack(int result, + [MarshalAs(UnmanagedType.Struct)]ref BluetoothLeScanDataStruct scanData, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void AdvertisingStateChangedCallBack(int result, IntPtr advertiserHandle, + BluetoothLeAdvertisingState advertisingState, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void GattConnectionStateChangedCallBack(int result, bool connected, + string remoteAddress, IntPtr userData); + + //Bluetooth Le Adapter Apis + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_start_scan")] + public static extern int StartScan(AdapterLeScanResultChangedCallBack callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_stop_scan")] + public static extern int StopScan(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_service_uuids")] + public static extern int GetScanResultServiceUuid(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, ref IntPtr uuids, ref int count); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_device_name")] + public static extern int GetLeScanResultDeviceName(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, out string deviceName); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_tx_power_level")] + public static extern int GetScanResultTxPowerLevel(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, out int txPowerLevel); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_service_solicitation_uuids")] + public static extern int GetScaResultSvcSolicitationUuids(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, out IntPtr uuids, out int count); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_service_data_list")] + public static extern int GetScanResultServiceDataList(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType PacketType, out IntPtr serviceDataArray, out int count); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_free_service_data_list")] + public static extern int FreeServiceDataList(IntPtr serviceData, int count); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_appearance")] + public static extern int GetScanResultAppearance(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, out int appearance); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_get_scan_result_manufacturer_data")] + public static extern int GetScanResultManufacturerData(ref BluetoothLeScanDataStruct scanData, + BluetoothLePacketType packetType, out int manufId, out IntPtr manufData, + out int manufDataLength); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_connect")] + internal static extern int GattConnect(string deviceAddress, bool autoConnect); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_disconnect")] + internal static extern int GattDisconnect(string deviceAddress); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_set_connection_state_changed_cb")] + internal static extern int SetGattConnectionStateChangedCallback( + GattConnectionStateChangedCallBack gattConnectionChangedCb, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_unset_connection_state_changed_cb")] + internal static extern int UnsetGattConnectionStateChangedCallback(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_create_advertiser")] + public static extern int CreateAdvertiser(out IntPtr advertiserHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_destroy_advertiser")] + public static extern int DestroyAdvertiser(IntPtr advertiserHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_add_advertising_service_uuid")] + public static extern int AddAdvertisingServiceUuid(IntPtr advertiserHandle, + BluetoothLePacketType PacketType, string uuid); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_add_advertising_service_solicitation_uuid")] + public static extern int AddAdvertisingServiceSolicitationUuid(IntPtr advertiserHandle, + BluetoothLePacketType PacketType, string uuid); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_add_advertising_service_data")] + public static extern int AddAdvertisingServiceData(IntPtr advertiserHandle, + BluetoothLePacketType PacketType, string uuid, IntPtr serviceData, int serviceDatalength); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_set_advertising_appearance")] + public static extern int SetAdvertisingAppearance(IntPtr advertiserHandle, + BluetoothLePacketType packetType, int appearance); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_add_advertising_manufacturer_data")] + public static extern int AddAdvertisingManufData(IntPtr advertiserHandle, BluetoothLePacketType packetType, + int manufId, IntPtr manufData, int manufacturerDataLength); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_set_advertising_device_name")] + public static extern int SetAdvertisingDeviceName(IntPtr advertiserHandle, BluetoothLePacketType packetType, + bool includeName); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_set_advertising_tx_power_level")] + public static extern int SetAdvertisingTxPowerLevel(IntPtr advertiserHandle, BluetoothLePacketType packetType, + bool includePowerLevel); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_clear_advertising_data")] + public static extern int ClearAdvertisingData(IntPtr advertiserHandle, BluetoothLePacketType packetType); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_start_advertising_new")] + public static extern int BluetoothLeStartAdvertising(IntPtr advertiserHandle, + AdvertisingStateChangedCallBack callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_stop_advertising")] + public static extern int BluetoothLeStopAdvertising(IntPtr advertiserHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_set_advertising_mode")] + public static extern int SetAdvertisingMode(IntPtr advertiserHandle, + BluetoothLeAdvertisingMode advertisingMode); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_adapter_le_set_advertising_connectable")] + public static extern int SetAdvertisingConnectable(IntPtr advertiserHandle, + bool connectable); + + //Bluetooth Socket + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_create_rfcomm")] + internal static extern int CreateServerSocket(string serviceUuid, out int socketFd); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_destroy_rfcomm")] + internal static extern int DestroyServerSocket(int socketFd); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_listen_and_accept_rfcomm")] + internal static extern int Listen(int socketFd, int pendingConnections); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_connect_rfcomm")] + internal static extern int ConnectSocket(string address, string serviceUuid); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_disconnect_rfcomm")] + internal static extern int DisconnectSocket(int socketFd); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_send_data")] + internal static extern int SendData(int socketFd, string data, int dataLength); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_set_data_received_cb")] + internal static extern int SetDataReceivedCallback(DataReceivedCallback callback, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_unset_data_received_cb")] + internal static extern int UnsetDataReceivedCallback(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_set_connection_state_changed_cb")] + internal static extern int SetConnectionStateChangedCallback(SocketConnectionStateChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_socket_unset_connection_state_changed_cb")] + internal static extern int UnsetSocketConnectionStateChangedCallback(); + + // Bluetooth Audio + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_initialize")] + internal static extern int InitializeAudio(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_deinitialize")] + internal static extern int DeinitializeAudio(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_connect")] + internal static extern int Connect(string deviceAddress, int profileType); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_disconnect")] + internal static extern int Disconnect(string deviceAddress, int profileType); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_set_connection_state_changed_cb")] + internal static extern int SetAudioConnectionStateChangedCallback(AudioConnectionStateChangedCallback audioStateChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_audio_unset_connection_state_changed_cb")] + internal static extern int UnsetAudioConnectionStateChangedCallback(); + + //Bluetooth Hid + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_hid_host_initialize")] + internal static extern int InitializeHid(HidConnectionStateChangedCallback hidConnectionChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_hid_host_deinitialize")] + internal static extern int DeinitializeHid(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_hid_host_connect")] + internal static extern int Connect(string deviceAddress); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_hid_host_disconnect")] + internal static extern int Disconnect(string deviceAddress); + + //Bluetooth Avrcp + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_initialize")] + internal static extern int InitializeAvrcp(TargetConnectionStateChangedCallback targetStateChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_deinitialize")] + internal static extern int DeinitializeAvrcp(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_equalizer_state")] + internal static extern int NotifyEqualizerState(int state); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_repeat_mode")] + internal static extern int NotifyRepeatMode(int repeat); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_shuffle_mode")] + internal static extern int NotifyShuffleMode(int shuffle); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_scan_mode")] + internal static extern int NotifyScanMode(int scan); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_player_state")] + internal static extern int NotifyPlayerState(int state); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_position")] + internal static extern int NotifyCurrentPosition(uint position); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_target_notify_track")] + internal static extern int NotifyTrack(string title, string artist, string album, string genre, uint trackNum, uint totaltracks, uint duration); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_set_equalizer_state_changed_cb")] + internal static extern int SetEqualizerStateChangedCallback(EqualizerStateChangedCallback equalizerStateChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_unset_equalizer_state_changed_cb")] + internal static extern int UnsetEqualizerStateChangedCallback(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_set_repeat_mode_changed_cb")] + internal static extern int SetRepeatModeChangedCallback(RepeatModeChangedCallback repeatModeChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_unset_repeat_mode_changed_cb")] + internal static extern int UnsetRepeatModeChangedCallback(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_set_shuffle_mode_changed_cb")] + internal static extern int SetShuffleModeChangedCallback(ShuffleModeChangedCallback shuffleModeChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_unset_shuffle_mode_changed_cb")] + internal static extern int UnsetShuffleModeChangedCallback(); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_set_scan_mode_changed_cb")] + internal static extern int SetScanModeChangedCallback(ScanModeChangedCallback scanModeChangedCb, IntPtr userData); + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_avrcp_unset_scan_mode_changed_cb")] + internal static extern int UnsetScanModeChangedCallback(); + + // Bluetooth GATT + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool BtGattForeachCallback(int total, int index, IntPtr gattHandle, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtGattServerReadValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, int offset, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtGattServerWriteValueRequestedCallback(string clientAddress, int requestId, IntPtr serverHandle, IntPtr gattHandle, int offset, bool response_needed, byte[] value, int len, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtClientCharacteristicValueChangedCallback(IntPtr characteristicHandle, byte[] value, int len, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtGattServerNotificationStateChangeCallback(bool notify, IntPtr serverHandle, IntPtr characteristicHandle, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtGattServerNotificationSentCallback(int result, string clientAddress, IntPtr serverHandle, IntPtr characteristicHandle, bool completed, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void BtGattClientRequestCompletedCallback(int result, IntPtr requestHandle, IntPtr userData); + + // Gatt Attribute + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_destroy")] + internal static extern int BtGattDestroy(IntPtr gattHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_get_uuid")] + internal static extern int BtGattGetUuid(BluetoothGattAttributeHandle gattHandle, out string uuid); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_get_value")] + internal static extern int BtGattGetValue(BluetoothGattAttributeHandle gattHandle, out IntPtr nativeValue, out int valueLength); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_set_value")] + internal static extern int BtGattSetValue(BluetoothGattAttributeHandle gattHandle, byte[] value, int valueLength); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_get_int_value")] + internal static extern int BtGattGetIntValue(BluetoothGattAttributeHandle gattHandle, int type, int offset, out int value); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_set_int_value")] + internal static extern int BtGattSetIntValue(BluetoothGattAttributeHandle gattHandle, int type, int value, int offset); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_get_float_value")] + internal static extern int BtGattGetFloatValue(BluetoothGattAttributeHandle gattHandle, int type, int offset, out float value); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_set_float_value")] + internal static extern int BtGattSetFloatValue(BluetoothGattAttributeHandle gattHandle, int type, int mantissa, int exponent, int offset); + + // GATT Descriptor + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_descriptor_create")] + internal static extern int BtGattDescriptorCreate(string uuid, int permissions, byte[] value, int valueLength, out BluetoothGattAttributeHandle descriptorHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_descriptor_get_permissions")] + internal static extern int BtGattDescriptorGetPermissions(BluetoothGattAttributeHandle descriptorHandle, out int permissions); + + // GATT Characteristic + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_create")] + internal static extern int BtGattCharacteristicCreate(string uuid, int permissions, int properties, byte[] value, int valueLength, out BluetoothGattAttributeHandle characteristicHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_get_permissions")] + internal static extern int BtGattCharacteristicGetPermissions(BluetoothGattAttributeHandle characteristicHandle, out int permissions); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_get_properties")] + internal static extern int BtGattCharacteristicGetProperties(BluetoothGattAttributeHandle characteristicHandle, out int properties); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_set_properties")] + internal static extern int BtGattCharacteristicSetProperties(BluetoothGattAttributeHandle characteristicHandle, int properties); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_get_write_type")] + internal static extern int BtGattCharacteristicGetWriteType(BluetoothGattAttributeHandle characteristicHandle, out int writeType); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_set_write_type")] + internal static extern int BtGattCharacteristicSetWriteType(BluetoothGattAttributeHandle characteristicHandle, int writeType); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_add_descriptor")] + internal static extern int BtGattCharacteristicAddDescriptor(BluetoothGattAttributeHandle characteristicHandle, BluetoothGattAttributeHandle descriptorHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_get_descriptor")] + internal static extern int BtGattCharacteristicGetDescriptor(BluetoothGattAttributeHandle characteristicHandle, string uuid, out BluetoothGattAttributeHandle descriptorHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_characteristic_foreach_descriptors")] + internal static extern int BtGattCharacteristicForeachDescriptors(BluetoothGattAttributeHandle characteristicHandle, BtGattForeachCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_set_characteristic_value_changed_cb")] + internal static extern int BtGattClientSetCharacteristicValueChangedCallback(BluetoothGattAttributeHandle characteristicHandle, BtClientCharacteristicValueChangedCallback cb, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_unset_characteristic_value_changed_cb")] + internal static extern int BtGattClientUnsetCharacteristicValueChangedCallback(BluetoothGattAttributeHandle characteristicHandle); + + // GATT Service + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_create")] + internal static extern int BtGattServiceCreate(string uuid, int type, out BluetoothGattAttributeHandle serviceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_add_characteristic")] + internal static extern int BtGattServiceAddCharacteristic(BluetoothGattAttributeHandle serviceHandle, BluetoothGattAttributeHandle characteristicHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_get_characteristic")] + internal static extern int BtGattServiceGetCharacteristic(BluetoothGattAttributeHandle serviceHandle, string uuid, out BluetoothGattAttributeHandle characteristicHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_foreach_characteristics")] + internal static extern int BtGattServiceForeachCharacteristics(BluetoothGattAttributeHandle serviceHandle, BtGattForeachCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_add_included_service")] + internal static extern int BtGattServiceAddIncludedService(BluetoothGattAttributeHandle serviceHandle, BluetoothGattAttributeHandle includedServiceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_get_included_service")] + internal static extern int BtGattServiceGetIncludedService(BluetoothGattAttributeHandle serviceHandle, string uuid, out BluetoothGattAttributeHandle includedServiceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_service_foreach_included_services")] + internal static extern int BtGattServiceForeachIncludedServices(BluetoothGattAttributeHandle serviceHandle, BtGattForeachCallback callback, IntPtr userData); + + // GATT Client + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_destroy")] + internal static extern int BtGattClientDestroy(IntPtr clientHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_create")] + internal static extern int BtGattClientCreate(string remoteAddress, out BluetoothGattClientHandle clientHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_get_remote_address")] + internal static extern int BtGattClientGetRemoteAddress(BluetoothGattClientHandle clientHandle, out string remoteAddress); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_get_service")] + internal static extern int BtGattClientGetService(BluetoothGattClientHandle clientHandle, string uuid, out BluetoothGattAttributeHandle serviceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_foreach_services")] + internal static extern int BtGattClientForeachServices(BluetoothGattClientHandle clientHandle, BtGattForeachCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_read_value")] + internal static extern int BtGattClientReadValue(BluetoothGattAttributeHandle gattHandle, BtGattClientRequestCompletedCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_client_write_value")] + internal static extern int BtGattClientWriteValue(BluetoothGattAttributeHandle gattHandle, BtGattClientRequestCompletedCallback callback, IntPtr userData); + + // GATT Server + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_destroy")] + internal static extern int BtGattServerDestroy(IntPtr serverHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_create")] + internal static extern int BtGattServerCreate(out BluetoothGattServerHandle serverHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_initialize")] + internal static extern int BtGattServerInitialize(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_deinitialize")] + internal static extern int BtGattServerDeinitialize(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_set_read_value_requested_cb")] + internal static extern int BtGattServerSetReadValueRequestedCallback(BluetoothGattAttributeHandle gattHandle, BtGattServerReadValueRequestedCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_set_write_value_requested_cb")] + internal static extern int BtGattServerSetWriteValueRequestedCallback(BluetoothGattAttributeHandle gattHandle, BtGattServerWriteValueRequestedCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_set_characteristic_notification_state_change_cb")] + internal static extern int BtGattServeSetNotificationStateChangeCallback(BluetoothGattAttributeHandle characteristicHandle, BtGattServerNotificationStateChangeCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_start")] + internal static extern int BtGattServerStart(); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_register_service")] + internal static extern int BtGattServerRegisterService(BluetoothGattServerHandle serverHandle, BluetoothGattAttributeHandle serviceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_unregister_service")] + internal static extern int BtGattServerUnregisterService(BluetoothGattServerHandle serverHandle, BluetoothGattAttributeHandle serviceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_unregister_all_services")] + internal static extern int BtGattServerUnregisterAllServices(BluetoothGattServerHandle serverHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_get_service")] + internal static extern int BtGattServerGetService(BluetoothGattServerHandle serverHandle, string uuid, out BluetoothGattAttributeHandle serviceHandle); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_foreach_services")] + internal static extern int BtGattServerForeachServices(BluetoothGattServerHandle serverHandle, BtGattForeachCallback callback, IntPtr userData); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_send_response")] + internal static extern int BtGattServerSendResponse(int requestId, int requestType, int offset, int status, byte[] value, int valueLen); + + [DllImport(Libraries.Bluetooth, EntryPoint = "bt_gatt_server_notify_characteristic_changed_value")] + internal static extern int BtGattServerNotify(BluetoothGattAttributeHandle characteristicHandle, BtGattServerNotificationSentCallback callback, string clientAddress, IntPtr userData); + } +} + + diff --git a/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs b/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs new file mode 100644 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Network.Bluetooth/Interop/Interop.Libc.cs b/src/Tizen.Network.Bluetooth/Interop/Interop.Libc.cs new file mode 100644 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Network.Bluetooth/Interop/Interop.Libraries.cs b/src/Tizen.Network.Bluetooth/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..4aa83d4 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Bluetooth = "libcapi-network-bluetooth.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.csproj b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.csproj new file mode 100644 index 0000000..b7549b0 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.sln b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.sln new file mode 100755 index 0000000..e422b9d --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Bluetooth", "Tizen.Network.Bluetooth.csproj", "{5EBC5F29-475A-48FA-982C-7E194CC37AAC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{452444AA-6282-4A0C-AFF9-39BECC6BE8FC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{039EED1A-2447-4720-8D4D-173902D41935}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{5896952E-7033-446F-8350-1FBCE1676715}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5EBC5F29-475A-48FA-982C-7E194CC37AAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EBC5F29-475A-48FA-982C-7E194CC37AAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EBC5F29-475A-48FA-982C-7E194CC37AAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EBC5F29-475A-48FA-982C-7E194CC37AAC}.Release|Any CPU.Build.0 = Release|Any CPU + {452444AA-6282-4A0C-AFF9-39BECC6BE8FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {452444AA-6282-4A0C-AFF9-39BECC6BE8FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {452444AA-6282-4A0C-AFF9-39BECC6BE8FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {452444AA-6282-4A0C-AFF9-39BECC6BE8FC}.Release|Any CPU.Build.0 = Release|Any CPU + {039EED1A-2447-4720-8D4D-173902D41935}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {039EED1A-2447-4720-8D4D-173902D41935}.Debug|Any CPU.Build.0 = Debug|Any CPU + {039EED1A-2447-4720-8D4D-173902D41935}.Release|Any CPU.ActiveCfg = Release|Any CPU + {039EED1A-2447-4720-8D4D-173902D41935}.Release|Any CPU.Build.0 = Release|Any CPU + {5896952E-7033-446F-8350-1FBCE1676715}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5896952E-7033-446F-8350-1FBCE1676715}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5896952E-7033-446F-8350-1FBCE1676715}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5896952E-7033-446F-8350-1FBCE1676715}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapter.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapter.cs new file mode 100644 index 0000000..ee9aca5 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapter.cs @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.Bluetooth +{ + /// + /// This class is used to control the Bluetooth adapter and get the list of bonded devices.
+ /// The BluetoothAdapter class is used to discover neighbouring bluetooth devices. + ///
+ /// http://tizen.org/privilege/bluetooth + static public class BluetoothAdapter + { + /// + /// A property to check whether the Bluetooth is enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public bool IsBluetoothEnabled + { + get + { + return BluetoothAdapterImpl.Instance.IsBluetoothEnabled; + } + } + + /// + /// The local adapter address. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public string Address + { + get + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.Address; + } + else + { + return null; + } + } + } + + /// + /// The name of the local adapter. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public string Name + { + get + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.Name; + } + else + { + return null; + } + } + set + { + BluetoothAdapterImpl.Instance.Name = value; + } + } + + /// + /// The visibility mode of the Bluetooth adapter. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public VisibilityMode Visibility + { + get + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.Visibility; + } + else + { + return VisibilityMode.NonDiscoverable; + } + } + } + + /// + /// A property to check whether the device discovery process is in progress. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public bool IsDiscoveryInProgress + { + get + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.IsDiscoveryInProgress; + } + else + { + return false; + } + } + } + + /// + /// The remaining time, in seconds, until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public int RemainingTimeAsVisible + { + get + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.RemainingTimeAsVisible; + } + else + { + return 0; + } + } + } + + /// + /// The StateChanged event is raised when the Bluetooth adapter state is changed. + /// + static public event EventHandler StateChanged + { + add + { + BluetoothAdapterImpl.Instance.StateChanged += value; + } + remove + { + BluetoothAdapterImpl.Instance.StateChanged -= value; + } + } + + /// + /// The NameChanged event is raised when the Bluetooth adapter name is changed. + /// + static public event EventHandler NameChanged + { + add + { + BluetoothAdapterImpl.Instance.NameChanged += value; + } + remove + { + BluetoothAdapterImpl.Instance.NameChanged -= value; + } + } + + /// + /// The VisibilityModeChanged event is raised when the Bluetooth adapter visibility mode is changed. + /// + static public event EventHandler VisibilityModeChanged + { + add + { + BluetoothAdapterImpl.Instance.VisibilityModeChanged += value; + } + remove + { + BluetoothAdapterImpl.Instance.VisibilityModeChanged -= value; + } + } + + /// + /// The VisibilityDurationChanged event is raised very second until the visibility mode is changed to NonDiscoverable. + /// + static public event EventHandler VisibilityDurationChanged + { + add + { + BluetoothAdapterImpl.Instance.VisibilityDurationChanged += value; + } + remove + { + BluetoothAdapterImpl.Instance.VisibilityDurationChanged -= value; + } + } + + /// + /// The DiscoveryStateChanged event is raised when the device discovery state is changed. + /// + static public event EventHandler DiscoveryStateChanged + { + add + { + BluetoothAdapterImpl.Instance.DiscoveryStateChanged += value; + } + remove + { + BluetoothAdapterImpl.Instance.DiscoveryStateChanged -= value; + } + } + + /// + /// This event is called when the LE scan result is obtained. + /// + static public event EventHandler ScanResultChanged + { + add + { + BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged += value; + } + remove { + BluetoothLeImplAdapter.Instance.AdapterLeScanResultChanged -= value; + } + } + + /// + /// Starts the device discovery process. + /// + /// + /// The Bluetooth must be enabled and the device discovery process can be stopped by StopDiscovery(). + /// If this succeeds, the DiscoveryStateChanged event will be invoked. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or the start discovery fails. + static public void StartDiscovery() + { + if (IsBluetoothEnabled) + { + BluetoothAdapterImpl.Instance.StartDiscovery(); + } + } + + /// + /// Stops the device discovery process. + /// + /// + /// The device discovery process must be in progress with StartDiscovery(). + /// If this succeeds, the DiscoveryStateChanged event will be invoked. + /// + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled or + /// the discovery process is not is progress. + static public void StopDiscovery() + { + if (IsDiscoveryInProgress) + { + BluetoothAdapterImpl.Instance.StopDiscovery(); + } + } + + /// + /// Retrieves the device information of all bonded devices. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The list of the bonded BluetoothDeviceInfo objects. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or reading the Bonded devices list is failed. + static public IEnumerable GetBondedDevices() + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.GetBondedDevices(); + } + else + { + return null; + } + } + + /// + /// Gets the device information of a bonded device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Information of the bonded BluetoothDeviceInfo object. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or reading the bonded device information fails. + static public BluetoothDevice GetBondedDevice(string address) + { + if (IsBluetoothEnabled) + { + return BluetoothAdapterImpl.Instance.GetBondedDevice(address); + } + else + { + return null; + } + } + + /// + /// Checks whether the UUID of service is used or not. + /// + /// true if the specified serviceUuid is used, otherwise false. + /// The UUID of Service. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + static public bool IsServiceUsed(string serviceUuid) + { + return BluetoothAdapterImpl.Instance.IsServiceUsed(serviceUuid); + } + + /// + /// Gets the hash and the randomizer value of the local OOB data object. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The BluetoothOobData object. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or the read OObData procedure is failed. + static public BluetoothOobData GetLocalOobData() + { + if (IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothAdapterImpl.Instance.GetLocalOobData(); + } + else + { + return null; + } + } + + /// + /// Sets the hash and the randmoizer value of the OOB data into the remote device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The remote device address. + /// The BluetoothOobData object. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or the set OobData procedure is failed. + static public void SetRemoteOobData(string address, BluetoothOobData oobData) + { + if (IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAdapterImpl.Instance.SetRemoteOobData(address, oobData); + } + } + + /// + /// Removes the hash and the randomizer value of the OOB data from the remote device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The remote device address. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled. + /// or if the Remove Oobdata procedure is failed. + static public void RemoveRemoteOobData(string address) + { + if (IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAdapterImpl.Instance.RemoveRemoteOobData(address); + } + } + + /// + /// Starts the Bluetooth LE scan operation to discover BLE devices + /// + /// + /// The Bluetooth must be enabled. + /// The result of the operation StartLeScan. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or the Start LE scan is failed. + static public void StartLeScan() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.StartScan (); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to in start the le scan operation, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Stops the Bluetooth LE scan operation. + /// + /// + /// The Bluetooth must be enabled. + /// The result of the operation stopLescan. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or the Stop LE scan is failed. + static public void StopLeScan() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.StopScan (); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to stop the le scan operation, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Returns the BluetoothLeAdvertiser instance. + /// + /// + /// The Bluetooth must be enabled before calling this API. + /// + /// The BluetoothLeAdvertiser instance. + static public BluetoothLeAdvertiser GetBluetoothLeAdvertiser() + { + return BluetoothLeAdvertiser.Instance; + } + + /// + /// Registers a rfcomm server socket with a specific UUID. + /// + /// + /// The Bluetooth must be enabled before calling this API. + /// + /// The BluetoothServerSocket instance. + /// The UUID of service to provide. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or the socket create error occurs. + static public BluetoothServerSocket CreateServerSocket(string serviceUuid) + { + if (IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothAdapterImpl.Instance.CreateServerSocket (serviceUuid); + } + else + { + return null; + } + } + + /// + /// Removes the rfcomm server socket which was created using CreateServerSocket(). + /// + /// + /// The socket must be created with CreateServerSocket(). The ConnectionStateChanged event is raised after this API is called. + /// + /// The server socket instance is created using CreateServerSocket(). + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or the socket destroy error occurs. + static public void DestroyServerSocket(BluetoothServerSocket socket) + { + if (IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAdapterImpl.Instance.DestroyServerSocket(socket); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs new file mode 100644 index 0000000..7adcffe --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAdapterImpl.cs @@ -0,0 +1,636 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Network.Bluetooth"; + internal static bool IsInitialize = false; + internal static bool IsAudioInitialize = false; + internal static bool IsHidInitialize = false; + } + + internal partial class BluetoothAdapterImpl : IDisposable + { + private event EventHandler _stateChanged; + private event EventHandler _nameChanged; + private event EventHandler _visibilityModeChanged; + private event EventHandler _visibilityDurationChanged; + private event EventHandler _discoveryStateChanged; + + private Interop.Bluetooth.StateChangedCallback _stateChangedCallback; + private Interop.Bluetooth.NameChangedCallback _nameChangedCallback; + private Interop.Bluetooth.VisibilityModeChangedCallback _visibilityChangedCallback; + private Interop.Bluetooth.VisibilityDurationChangedCallback _visibilitydurationChangedCallback; + private Interop.Bluetooth.DiscoveryStateChangedCallback _discoveryStateChangedCallback; + + private static readonly BluetoothAdapterImpl _instance = new BluetoothAdapterImpl(); + private bool disposed = false; + + internal event EventHandler StateChanged + { + add + { + if (_stateChanged == null) + { + RegisterStateChangedEvent(); + } + _stateChanged += value; + } + remove + { + _stateChanged -= value; + if (_stateChanged == null) + { + UnregisterStateChangedEvent(); + } + } + } + + internal event EventHandler NameChanged + { + add + { + if (_nameChanged == null) + { + RegisterNameChangedEvent(); + } + _nameChanged += value; + } + remove + { + _nameChanged -= value; + if (_nameChanged == null) + { + UnregisterNameChangedEvent(); + } + } + } + + internal event EventHandler VisibilityModeChanged + { + add + { + if (_visibilityModeChanged == null) + { + RegisterVisibilityChangedEvent(); + } + _visibilityModeChanged += value; + } + remove + { + _visibilityModeChanged -= value; + if (_visibilityModeChanged == null) + { + UnregisterVisibilityChangedEvent(); + } + } + } + + internal event EventHandler VisibilityDurationChanged + { + add + { + if (_visibilityDurationChanged == null) + { + RegisterVisibilityDurationChangedEvent(); + } + _visibilityDurationChanged += value; + } + remove + { + _visibilityDurationChanged -= value; + if (_visibilityDurationChanged == null) + { + UnregisterVisibilityDurationChangedEvent(); + } + } + } + + internal event EventHandler DiscoveryStateChanged + { + add + { + if (_discoveryStateChanged == null) + { + RegisterDiscoveryStateChangedEvent(); + } + _discoveryStateChanged+= value; + } + remove + { + _discoveryStateChanged -= value; + if (_discoveryStateChanged == null) + { + UnregisterDiscoveryStateChangedEvent(); + } + } + } + + private void RegisterStateChangedEvent() + { + _stateChangedCallback = (int result, int state, IntPtr userData) => + { + if (_stateChanged != null) + { + BluetoothState st = (BluetoothState)state; + BluetoothError res = (BluetoothError)result; + _stateChanged(null, new StateChangedEventArgs(res,st)); + } + }; + int ret = Interop.Bluetooth.SetStateChangedCallback(_stateChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set state changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset state changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterNameChangedEvent() + { + _nameChangedCallback = (string deviceName, IntPtr userData) => + { + if (_nameChanged != null) + { + _nameChanged(null, new NameChangedEventArgs(deviceName)); + } + }; + int ret = Interop.Bluetooth.SetNameChangedCallback(_nameChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set name changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterNameChangedEvent() + { + int ret = Interop.Bluetooth.UnsetNameChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset name changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterVisibilityChangedEvent() + { + _visibilityChangedCallback = (int result, int mode, IntPtr userData) => + { + if (_visibilityModeChanged != null) + { + VisibilityMode visibility = (VisibilityMode)mode; + BluetoothError res = (BluetoothError)result; + _visibilityModeChanged(null, new VisibilityModeChangedEventArgs(res,visibility)); + } + }; + int ret = Interop.Bluetooth.SetVisibilityModeChangedCallback(_visibilityChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set visibility mode changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterVisibilityChangedEvent() + { + int ret = Interop.Bluetooth.UnsetVisibilityModeChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset visibility mode changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterVisibilityDurationChangedEvent() + { + _visibilitydurationChangedCallback = (int duration, IntPtr userData) => + { + if (_visibilityDurationChanged != null) + { + _visibilityDurationChanged(null, new VisibilityDurationChangedEventArgs(duration)); + } + }; + int ret = Interop.Bluetooth.SetVisibilityDurationChangedCallback(_visibilitydurationChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set visibility duration changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterVisibilityDurationChangedEvent() + { + int ret = Interop.Bluetooth.UnsetVisibilityDurationChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset visiiblity duration changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterDiscoveryStateChangedEvent() + { + _discoveryStateChangedCallback = (int result, BluetoothDeviceDiscoveryState state, IntPtr deviceInfo, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Discovery state changed callback is called"); + if (_discoveryStateChanged != null) + { + BluetoothError res = (BluetoothError)result; + switch(state) + { + case BluetoothDeviceDiscoveryState.Started: + _discoveryStateChanged(null, new DiscoveryStateChangedEventArgs(res,state)); + break; + case BluetoothDeviceDiscoveryState.Finished: + { + _discoveryStateChanged(null, new DiscoveryStateChangedEventArgs(res,state)); + break; + } + case BluetoothDeviceDiscoveryState.Found: + { + BluetoothDiscoveredDeviceStruct info = (BluetoothDiscoveredDeviceStruct)Marshal.PtrToStructure(deviceInfo, typeof(BluetoothDiscoveredDeviceStruct)); + _discoveryStateChanged(null, new DiscoveryStateChangedEventArgs(res,state,BluetoothUtils.ConvertStructToDiscoveredDevice(info))); + break; + } + default: + break; + } + } + }; + int ret = Interop.Bluetooth.SetDiscoveryStateChangedCallback(_discoveryStateChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set discovery state changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterDiscoveryStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetDiscoveryStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset discovery state changed callback, Error - " + (BluetoothError)ret); + } + } + + internal bool IsBluetoothEnabled + { + get + { + BluetoothState active; + int ret = Interop.Bluetooth.GetState(out active); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get state, Error - " + (BluetoothError)ret); + } + if (active == BluetoothState.Enabled) + return true; + else + return false; + } + } + internal string Address + { + get + { + string address; + int ret = Interop.Bluetooth.GetAddress(out address); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get address, Error - " + (BluetoothError)ret); + return ""; + } + return address; + } + } + + internal VisibilityMode Visibility + { + get + { + int visibilityMode; + int time; + int ret = Interop.Bluetooth.GetVisibility(out visibilityMode, out time); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get visibility mode, Error - " + (BluetoothError)ret); + return VisibilityMode.NonDiscoverable; + } + return (VisibilityMode)visibilityMode; + } + } + + internal bool IsDiscoveryInProgress + { + get + { + bool isDiscovering; + int ret = Interop.Bluetooth.IsDiscovering(out isDiscovering); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get discovery progress state, Error - " + (BluetoothError)ret); + } + return isDiscovering; + } + } + + internal int RemainingTimeAsVisible + { + get + { + int duration = 0; + int visibilityMode; + int ret = Interop.Bluetooth.GetVisibility(out visibilityMode, out duration); + if ((ret != (int)BluetoothError.None) || ((VisibilityMode)visibilityMode != VisibilityMode.TimeLimitedDiscoverable)) + { + Log.Error(Globals.LogTag, "Failed to get remaining visible time, Error - " + (BluetoothError)ret); + } + return duration; + } + } + + internal string Name + { + get + { + string name; + int ret = Interop.Bluetooth.GetName(out name); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get adapter name, Error - " + (BluetoothError)ret); + return ""; + } + return name; + } + set + { + int ret = Interop.Bluetooth.SetName(value.ToString()); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set adapter name, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + internal void StartDiscovery() + { + int ret = Interop.Bluetooth.StartDiscovery(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to start discovery, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void StopDiscovery() + { + int ret = Interop.Bluetooth.StopDiscovery(); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to stop discovery, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal IEnumerable GetBondedDevices() + { + List deviceList = new List(); + Interop.Bluetooth.BondedDeviceCallback callback = (ref BluetoothDeviceStruct deviceInfo, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Bonded devices cb is called"); + if(!deviceInfo.Equals(null)) + { + deviceList.Add(BluetoothUtils.ConvertStructToDeviceClass(deviceInfo)); + } + return true; + }; + int ret = Interop.Bluetooth.GetBondedDevices(callback, IntPtr.Zero); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get bonded devices, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return deviceList; + } + + internal BluetoothDevice GetBondedDevice(string address) + { + IntPtr deviceInfo; + int ret = Interop.Bluetooth.GetBondedDeviceByAddress(address, out deviceInfo); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get bonded device by address, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + BluetoothDeviceStruct device = (BluetoothDeviceStruct)Marshal.PtrToStructure(deviceInfo, typeof(BluetoothDeviceStruct)); + + return BluetoothUtils.ConvertStructToDeviceClass(device); + } + + internal bool IsServiceUsed(string serviceUuid) + { + bool isUsed; + int ret = Interop.Bluetooth.IsServiceUsed(serviceUuid, out isUsed); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to check the usage of service, Error - " + (BluetoothError)ret); + } + return isUsed; + } + + internal BluetoothOobData GetLocalOobData() + { + BluetoothOobData oobData = new BluetoothOobData(); + IntPtr hash; + IntPtr randomizer; + int hashLength; + int randomizerLength; + int ret = Interop.Bluetooth.GetOobData(out hash, out randomizer, out hashLength, out randomizerLength); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get the local oob data, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + + byte[] hashArr = new byte[hashLength]; + Marshal.Copy(hash, hashArr, 0, hashLength); + byte[] randomizerArr = new byte[randomizerLength]; + Marshal.Copy(randomizer, randomizerArr, 0, randomizerLength); + + oobData.HashValue = hashArr; + oobData.RandomizerValue = randomizerArr; + return oobData; + } + + internal void SetRemoteOobData(string deviceAddress, BluetoothOobData oobData) + { + byte[] hash = oobData.HashValue; + byte[] randomizer = oobData.RandomizerValue; + int hashLength = hash.Length; + int randomizerLength = randomizer.Length; + + IntPtr hashPtr = Marshal.AllocHGlobal(hashLength); + Marshal.Copy(hash, 0, hashPtr, hashLength); + IntPtr randomizerPtr = Marshal.AllocHGlobal(randomizerLength); + Marshal.Copy(randomizer, 0, randomizerPtr, randomizerLength); + + int ret = Interop.Bluetooth.SetOobData(deviceAddress, hashPtr, randomizerPtr, hashLength, randomizerLength); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set the remote oob data, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void RemoveRemoteOobData(string deviceAddress) + { + int ret = Interop.Bluetooth.RemoveOobData(deviceAddress); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to remove the remote oob data, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal BluetoothServerSocket CreateServerSocket(string serviceUuid) + { + int socketFd; + int ret = Interop.Bluetooth.CreateServerSocket(serviceUuid, out socketFd); + if(ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to create server socket, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + Log.Info (Globals.LogTag, "Created socketfd: "+ socketFd); + return new BluetoothServerSocket(socketFd); + } + + internal void DestroyServerSocket(BluetoothServerSocket socket) + { + int ret = Interop.Bluetooth.DestroyServerSocket(socket.socketFd); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy socket, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal static BluetoothAdapterImpl Instance + { + get + { + return _instance; + } + } + + private BluetoothAdapterImpl() + { + initialize(); + } + + ~BluetoothAdapterImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + RemoveAllRegisteredEvent(); + deinitialize(); + disposed = true; + } + + private void initialize() + { + int ret = Interop.Bluetooth.Initialize(); + if (ret != (int)BluetoothError.None) + { + Log.Error (Globals.LogTag, "Failed to initialize bluetooth, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + else + { + Globals.IsInitialize = true; + } + } + + private void deinitialize() + { + int ret = Interop.Bluetooth.Deinitialize(); + if (ret != (int)BluetoothError.None) + { + Log.Error (Globals.LogTag, "Failed to deinitialize bluetooth, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + else + { + Globals.IsInitialize = false; + } + } + + private void RemoveAllRegisteredEvent() + { + //unregister all remaining events when this object is released. + if (_stateChanged != null) + { + UnregisterStateChangedEvent(); + } + + if (_nameChanged != null) + { + UnregisterNameChangedEvent(); + } + + if (_visibilityDurationChanged != null) + { + UnregisterVisibilityDurationChangedEvent(); + } + + if (_visibilityModeChanged != null) + { + UnregisterVisibilityChangedEvent(); + } + + if (_discoveryStateChanged != null) + { + UnregisterDiscoveryStateChangedEvent(); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudio.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudio.cs new file mode 100644 index 0000000..614607f --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudio.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + /// + /// This class is used to handle the connection with other Bluetooth audio devices + /// like headset, hands-free, and headphone. + /// + /// http://tizen.org/privilege/bluetooth + public class BluetoothAudio : BluetoothProfile + { + internal BluetoothAudio() + { + } + + /// + /// The AudioConnectionStateChanged event is called when the audio connection state is changed. + /// + public event EventHandler AudioConnectionStateChanged + { + add + { + BluetoothAudioImpl.Instance.AudioConnectionStateChanged += value; + } + remove + { + BluetoothAudioImpl.Instance.AudioConnectionStateChanged -= value; + } + } + + /// + /// Connects the remote device with the given audio profile. + /// + /// + /// The device must be bonded with the remote device by CreateBond(). If connection request succeeds, the AudioConnectionStateChanged event will be invoked. + /// If audio profile type is All and this request succeeds, then the AudioConnectionStateChanged event will be called twice when HspHfp
+ /// and AdvancedAudioDistribution is connected. + ///
+ /// The type of the audio profile. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when the connection attempt fails. + public void Connect(BluetoothAudioProfileType profileType) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothAudioImpl.Instance.Connect(RemoteAddress, profileType); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to Connect - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Disconnects the remote device with the given audio profile. + /// + /// + /// The device must be connected by Connect(). If the disconnection request succeeds, the AudioConnectionStateChanged event will be invoked. + /// If audio profile type is All and this request succeeds, then the AudioConnectionStateChanged event will be called twice when HspHfp
+ /// and AdvancedAudioDistribution is disconnected. + ///
+ /// The type of the audio profile. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when Disconnection attempt fails. + public void Disconnect(BluetoothAudioProfileType type) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothAudioImpl.Instance.Disconnect(RemoteAddress, type); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to Disconnect - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudioImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudioImpl.cs new file mode 100644 index 0000000..6570dc9 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAudioImpl.cs @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + internal class BluetoothAudioImpl : IDisposable + { + private event EventHandler _audioConnectionChanged; + private Interop.Bluetooth.AudioConnectionStateChangedCallback _audioConnectionChangedCallback; + + private static readonly BluetoothAudioImpl _instance = new BluetoothAudioImpl(); + private bool disposed = false; + + internal event EventHandler AudioConnectionStateChanged + { + add + { + if (_audioConnectionChanged == null) + { + RegisterAudioConnectionChangedEvent(); + } + _audioConnectionChanged += value; + } + remove + { + _audioConnectionChanged -= value; + if (_audioConnectionChanged == null) + { + UnregisterAudioConnectionChangedEvent(); + } + } + } + + private void RegisterAudioConnectionChangedEvent() + { + _audioConnectionChangedCallback = (int result, bool connected, string deviceAddress, int profileType, IntPtr userData) => + { + if (_audioConnectionChanged != null) + { + _audioConnectionChanged(null, new AudioConnectionStateChangedEventArgs(result, connected, deviceAddress, (BluetoothAudioProfileType)profileType)); + } + }; + int ret = Interop.Bluetooth.SetAudioConnectionStateChangedCallback(_audioConnectionChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set audio connection changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterAudioConnectionChangedEvent() + { + int ret = Interop.Bluetooth.UnsetAudioConnectionStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset audio connection changed callback, Error - " + (BluetoothError)ret); + } + } + + internal int Connect(string deviceAddress, BluetoothAudioProfileType type) + { + int ret = Interop.Bluetooth.Connect(deviceAddress, (int)type); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to connect device with the given profile type, Error - " + (BluetoothError)ret); + } + return ret; + } + + internal int Disconnect(string deviceAddress, BluetoothAudioProfileType type) + { + int ret = Interop.Bluetooth.Disconnect(deviceAddress, (int)type); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect device with the given profile type, Error - " + (BluetoothError)ret); + } + return ret; + } + + internal static BluetoothAudioImpl Instance + { + get + { + return _instance; + } + } + + private BluetoothAudioImpl () + { + Log.Info(Globals.LogTag, "Initializing audio"); + initialize(); + } + + ~BluetoothAudioImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + deinitialize(); + RemoveAllRegisteredEvent(); + disposed = true; + } + + private void initialize() + { + if (Globals.IsInitialize) + { + int ret = Interop.Bluetooth.InitializeAudio (); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to initialize bluetoothaudio, Error - " + (BluetoothError)ret); + Globals.IsAudioInitialize = false; + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + else + { + Globals.IsAudioInitialize = true; + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotInitialized); + } + } + + private void deinitialize() + { + if (Globals.IsAudioInitialize) { + int ret = Interop.Bluetooth.DeinitializeAudio (); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to deinitialize bluetoothaudio, Error - " + (BluetoothError)ret); + } + } + } + + private void RemoveAllRegisteredEvent() + { + if (_audioConnectionChanged != null) + { + UnregisterAudioConnectionChangedEvent(); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcp.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcp.cs new file mode 100644 index 0000000..ac814ee --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcp.cs @@ -0,0 +1,262 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + /// + /// This class is used to notify changes of the target device (For example, media player) to the control device (For example, headset). + /// + /// http://tizen.org/privilege/bluetooth + public class BluetoothAvrcp : BluetoothProfile + { + internal BluetoothAvrcp() + { + } + + /// + /// The TargetConnectionStateChanged event is invoked when the connection state is changed. + /// + public event EventHandler TargetConnectionStateChanged + { + add + { + BluetoothAvrcpImpl.Instance.TargetConnectionStateChanged += value; + } + remove + { + BluetoothAvrcpImpl.Instance.TargetConnectionStateChanged -= value; + } + } + + /// + /// The EqualizerStateChanged event is invoked when the equalizer state is changed by the remote control device. + /// + public event EventHandler EqualizerStateChanged + { + add + { + BluetoothAvrcpImpl.Instance.EqualizerStateChanged += value; + } + remove + { + BluetoothAvrcpImpl.Instance.EqualizerStateChanged -= value; + } + } + + /// + /// The RepeatModeChanged event is invoked when the repeat mode is changed by the remote control device. + /// + public event EventHandler RepeatModeChanged + { + add + { + BluetoothAvrcpImpl.Instance.RepeatModeChanged += value; + } + remove + { + BluetoothAvrcpImpl.Instance.RepeatModeChanged -= value; + } + } + + /// + /// The ShuffleModeChanged event is invoked when the shuffle mode is changed by the remote control device. + /// + public event EventHandler ShuffleModeChanged + { + add + { + BluetoothAvrcpImpl.Instance.ShuffleModeChanged += value; + } + remove + { + BluetoothAvrcpImpl.Instance.ShuffleModeChanged -= value; + } + } + + /// + /// The ScanModeChanged event is invoked when the scan mode is changed by the remote control device. + /// + public event EventHandler ScanModeChanged + { + add + { + BluetoothAvrcpImpl.Instance.ScanModeChanged += value; + } + remove + { + BluetoothAvrcpImpl.Instance.ScanModeChanged -= value; + } + } + + /// + /// Notifies the equalize state to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The equalizer state. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the equalizer state to the remote device fails. + public void NotifyEqualizerState(EqualizerState state) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyEqualizeState(state); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the repeat mode to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The repeat mode. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the repeat mode state to the remote device fails. + /// + public void NotifyRepeatMode(RepeatMode mode) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyRepeatMode(mode); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the shuffle mode to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The shuffle mode. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the shuffle mode state to the remote device fails. + public void NotifyShuffleMode(ShuffleMode mode) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyShuffleMode(mode); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the scan mode to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The scan mode. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the scan mode state to the remote device fails. + public void NotifyScanMode(ScanMode mode) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyScanMode(mode); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the player state to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The player state. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the player state to the remote device fails. + public void NotifyPlayerState(PlayerState state) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyPlayerState(state); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the current position of the song to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The current position in milliseconds. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the current position state to the remote device fails. + public void NotifyCurrentPosition(uint position) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyCurrentPosition(position); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Notifies the track to the remote device. + /// + /// + /// The remote device must be connected. + /// + /// The data of the track. + /// Thrown when the Bluetooth is not supported. + /// Thrown when the Bluetooth is not enabled + /// or when notifying the shuffle track state to the remote device fails. + public void NotifyTrack(Track trackData) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothAvrcpImpl.Instance.NotifyTrack(trackData); + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } +} + diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcpImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcpImpl.cs new file mode 100644 index 0000000..28abda8 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothAvrcpImpl.cs @@ -0,0 +1,419 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + internal class BluetoothAvrcpImpl : IDisposable + { + private event EventHandler _targetConnectionChanged; + private event EventHandler _equalizerStateChanged; + private event EventHandler _repeatModeChanged; + private event EventHandler _scanModeChanged; + private event EventHandler _shuffleModeChanged; + + private Interop.Bluetooth.TargetConnectionStateChangedCallback _targetConnectionChangedCallback; + private Interop.Bluetooth.EqualizerStateChangedCallback _equalizerStateChangedCallback; + private Interop.Bluetooth.RepeatModeChangedCallback _repeatModeChangedCallback; + private Interop.Bluetooth.ShuffleModeChangedCallback _shuffleModeChangedCallback; + private Interop.Bluetooth.ScanModeChangedCallback _scanModeChangedCallback; + + private static BluetoothAvrcpImpl _instance = new BluetoothAvrcpImpl(); + private bool disposed = false; + + internal event EventHandler TargetConnectionStateChanged + { + add + { + _targetConnectionChanged += value; + } + remove + { + _targetConnectionChanged -= value; + } + } + + internal event EventHandler EqualizerStateChanged + { + add + { + if (_equalizerStateChanged == null) + { + RegisterEqualizerStateChangedEvent(); + } + _equalizerStateChanged += value; + } + remove + { + _equalizerStateChanged -= value; + if (_equalizerStateChanged == null) + { + UnregisterEqualizerStateChangedEvent(); + } + } + } + + internal event EventHandler RepeatModeChanged + { + add + { + if (_repeatModeChanged == null) + { + RegisterRepeatModeChangedEvent(); + } + _repeatModeChanged += value; + } + remove + { + _repeatModeChanged -= value; + if (_repeatModeChanged == null) + { + UnregisterRepeatModeChangedEvent(); + } + } + } + + internal event EventHandler ShuffleModeChanged + { + add + { + if (_shuffleModeChanged == null) + { + RegisterShuffleModeChangedEvent(); + } + _shuffleModeChanged += value; + } + remove + { + _shuffleModeChanged -= value; + if (_shuffleModeChanged == null) + { + UnregisterShuffleModeChangedEvent(); + } + } + } + + internal event EventHandler ScanModeChanged + { + add + { + if (_scanModeChanged == null) + { + RegisterScanModeChangedEvent(); + } + _scanModeChanged += value; + } + remove + { + _scanModeChanged -= value; + if (_scanModeChanged == null) + { + UnregisterScanModeChangedEvent(); + } + } + } + + private void RegisterEqualizerStateChangedEvent() + { + _equalizerStateChangedCallback = (int equalizer, IntPtr userData) => + { + if (_equalizerStateChanged != null) + { + EqualizerState state = (EqualizerState) equalizer; + _equalizerStateChanged(null, new EqualizerStateChangedEventArgs(state)); + } + }; + int ret = Interop.Bluetooth.SetEqualizerStateChangedCallback(_equalizerStateChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set equalizer state changed callback, Error - " + (BluetoothError)ret); + } + } + private void UnregisterEqualizerStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetEqualizerStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset equalizer state changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterRepeatModeChangedEvent() + { + _repeatModeChangedCallback = (int repeat, IntPtr userData) => + { + if (_repeatModeChanged != null) + { + RepeatMode mode = (RepeatMode)repeat; + _repeatModeChanged(null, new RepeatModeChangedEventArgs(mode)); + } + }; + int ret = Interop.Bluetooth.SetRepeatModeChangedCallback(_repeatModeChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set repeat mode changed callback, Error - " + (BluetoothError)ret); + } + } + private void UnregisterRepeatModeChangedEvent() + { + int ret = Interop.Bluetooth.UnsetRepeatModeChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset repeat mode changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterShuffleModeChangedEvent() + { + Log.Debug (Globals.LogTag, "inside RegisterShuffleModeChangedEvent"); + _shuffleModeChangedCallback = (int shuffle, IntPtr userData) => + { + Log.Debug (Globals.LogTag, "inside RegisterShuffleModeChangedEvent callback"); + if (_shuffleModeChanged != null) + { + ShuffleMode mode = (ShuffleMode) shuffle; + _shuffleModeChanged(null, new ShuffleModeChangedeventArgs(mode)); + } + }; + int ret = Interop.Bluetooth.SetShuffleModeChangedCallback(_shuffleModeChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Debug (Globals.LogTag, "failed inside RegisterShuffleModeChangedEvent"); + Log.Error(Globals.LogTag, "Failed to set shuffle mode changed callback, Error - " + (BluetoothError)ret); + } + } + private void UnregisterShuffleModeChangedEvent() + { + int ret = Interop.Bluetooth.UnsetShuffleModeChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset shuffle mode changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterScanModeChangedEvent() + { + _scanModeChangedCallback = (int scan, IntPtr userData) => + { + if (_scanModeChanged != null) + { + ScanMode mode = (ScanMode) scan; + _scanModeChanged(null, new ScanModeChangedEventArgs(mode)); + } + }; + int ret = Interop.Bluetooth.SetScanModeChangedCallback(_scanModeChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set scan mode changed callback, Error - " + (BluetoothError)ret); + } + } + private void UnregisterScanModeChangedEvent() + { + int ret = Interop.Bluetooth.UnsetScanModeChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset scan mode changed callback, Error - " + (BluetoothError)ret); + } + } + + private void targetInitialize() + { + if (Globals.IsInitialize) + { + _targetConnectionChangedCallback = (bool connected, string deviceAddress, IntPtr userData) => + { + if (_targetConnectionChanged != null) + { + _targetConnectionChanged(null, new TargetConnectionStateChangedEventArgs(connected, deviceAddress)); + } + }; + + int ret = Interop.Bluetooth.InitializeAvrcp(_targetConnectionChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error (Globals.LogTag, "Failed to initialize bluetooth avrcp, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + else + { + Globals.IsAudioInitialize = true; + } + } + else + { + Log.Error(Globals.LogTag, "Failed to initialize Avrcp, BT not initialized"); + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotInitialized); + } + } + + private void targetDeinitialize() + { + if (Globals.IsAudioInitialize) + { + int ret = Interop.Bluetooth.DeinitializeAvrcp(); + if (ret != (int)BluetoothError.None) + { + Log.Error (Globals.LogTag, "Failed to deinitialize bluetooth avrcp, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + else + { + Globals.IsAudioInitialize = false; + } + } + } + + internal void NotifyEqualizeState(EqualizerState state) + { + int ret = Interop.Bluetooth.NotifyEqualizerState((int)state); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify equalizer state to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyRepeatMode(RepeatMode repeat) + { + int ret = Interop.Bluetooth.NotifyRepeatMode((int)repeat); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify repeat mode to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyShuffleMode(ShuffleMode shuffle) + { + int ret = Interop.Bluetooth.NotifyShuffleMode((int)shuffle); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify shuffle mode to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyScanMode(ScanMode scan) + { + int ret = Interop.Bluetooth.NotifyScanMode((int)scan); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify scan mode to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyPlayerState(PlayerState state) + { + int ret = Interop.Bluetooth.NotifyPlayerState((int)state); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify player state to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyCurrentPosition(uint position) + { + int ret = Interop.Bluetooth.NotifyCurrentPosition(position); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify position to remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal void NotifyTrack(Track trackData) + { + string title = trackData.Title; + string artist = trackData.Artist; + string album = trackData.Album; + string genre = trackData.Genre; + uint trackNum = trackData.TrackNum; + uint totalTracks = trackData.TotalTracks; + uint duration = trackData.Duration; + + int ret = Interop.Bluetooth.NotifyTrack(title, artist, album, genre, trackNum, totalTracks, duration); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to notify track data to the remote device, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal static BluetoothAvrcpImpl Instance + { + get + { + return _instance; + } + } + + private BluetoothAvrcpImpl() + { + targetInitialize(); + } + + ~BluetoothAvrcpImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + targetDeinitialize(); + RemoveAllRegisteredEvent(); + disposed = true; + } + + private void RemoveAllRegisteredEvent() + { + //unregister all remaining events when this object is released. + if (_equalizerStateChanged != null) + { + UnregisterEqualizerStateChangedEvent(); + } + if (_repeatModeChanged != null) + { + UnregisterRepeatModeChangedEvent(); + } + if (_scanModeChanged != null) + { + UnregisterScanModeChangedEvent(); + } + if (_shuffleModeChanged != null) + { + UnregisterShuffleModeChangedEvent(); + } + } + } +} + diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothData.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothData.cs new file mode 100644 index 0000000..cf386c5 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothData.cs @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.Collections.Specialized; + +namespace Tizen.Network.Bluetooth +{ + /// + /// This class is used to handle the device class types and the service. + /// + public class BluetoothClass + { + internal BluetoothMajorDeviceClassType MajorType; + internal BluetoothMinorDeviceClassType MinorType; + internal int Mask; + + internal BluetoothClass() + { + } + + /// + /// The type of the major device class. + /// + public BluetoothMajorDeviceClassType MajorDeviceClassType + { + get + { + return MajorType; + } + } + /// + /// The type of the minor device class. + /// + public BluetoothMinorDeviceClassType MinorDeviceClassType + { + get + { + return MinorType; + } + } + /// + /// The major service class mask. + /// + public int MajorServiceClassMask + { + get + { + return Mask; + } + } + } + + /// + /// This class contains the information of the Bluetooth OOB data. + /// + public class BluetoothOobData + { + /// + /// The default constructor. Initializes an object of the BluetoothOobData. + /// + public BluetoothOobData() + { + } + + /// + /// The hash value. + /// + public byte[] HashValue + { + get; + set; + } + /// + /// The randomizer value. + /// + public byte[] RandomizerValue + { + get; + set; + } + } + + /// + /// This class contains the information of the Bluetooth device SDP data. + /// + public class BluetoothDeviceSdpData + { + internal string Address; + internal Collection Uuid; + + internal BluetoothDeviceSdpData() + { + } + + /// + /// The device address. + /// + public string DeviceAddress + { + get + { + return Address; + } + } + /// + /// The service UUID. + /// + public IEnumerable ServiceUuid + { + get + { + return Uuid; + } + } + } + + /// + /// This class contains the information of the Bluetooth device connection data. + /// + public class BluetoothDeviceConnectionData + { + internal string RemoteAddress; + internal BluetoothConnectionLinkType Link; + internal BluetoothDisconnectReason Reason; + + internal BluetoothDeviceConnectionData() + { + } + + /// + /// The device address. + /// + public string Address + { + get + { + return RemoteAddress; + } + } + /// + /// The type of the connection link. + /// + public BluetoothConnectionLinkType LinkType + { + get + { + return Link; + } + } + /// + /// The disconnect reason. + /// + public BluetoothDisconnectReason DisconnectReason + { + get + { + return Reason; + } + } + } + + /// + /// This class contains the information of the track data. + /// + public class Track + { + /// + /// The default constructor. Initializes an object of the track. + /// + public Track() + { + } + + /// + /// The title of the track. + /// + public string Title + { + get; + set; + } + /// + /// The artist of the track. + /// + public string Artist + { + get; + set; + } + /// + /// The album of the track. + /// + public string Album + { + get; + set; + } + /// + /// The genre of the track. + /// + public string Genre + { + get; + set; + } + /// + /// The track number. + /// + public uint TrackNum + { + get; + set; + } + /// + /// The number of all tracks. + /// + public uint TotalTracks + { + get; + set; + } + /// + /// The duration of the track in milliseconds. + /// + public uint Duration + { + get; + set; + } + } + + /// + /// This class contains the information of the manufacturer data. + /// + public class ManufacturerData + { + /// + /// The default Constructor. Initializes an object of the ManufacturerData. + /// + public ManufacturerData() + { + } + + /// + /// The manufacturer ID. + /// + public int Id + { + get; + set; + } + /// + /// The length of the manufacturer data. + /// + public int DataLength + { + get; + set; + } + /// + /// The manufacturer data. + /// + public byte[] Data + { + get; + set; + } + } + + internal class BluetoothLeScanData + { + internal string RemoteAddress + { + get; + set; + } + internal BluetoothLeDeviceAddressType AddressType + { + get; + set; + } + internal int Rssi + { + get; + set; + } + internal int AdvDataLength + { + get; + set; + } + internal byte[] AdvData + { + get; + set; + } + internal int ScanDataLength + { + get; + set; + } + internal byte[] ScanData + { + get; + set; + } + } + + /// + /// This class contains the information of the Bluetooth service data. + /// + public class BluetoothServiceData + { + /// + /// The default constructor. Initializes an object of the BluetoothServiceData. + /// + public BluetoothServiceData() + { + } + + /// + /// The UUID of the service. + /// + public string Uuid + { + get; + set; + } + /// + /// The data length of the service data. + /// + public int DataLength + { + get; + set; + } + /// + /// The service data. + /// + public byte[] Data + { + get; + set; + } + } + + /// + /// This class contains the service data information. + /// + public class BluetoothLeServiceData + { + internal string Uuid; + internal byte[] Data; + internal int Length; + + internal BluetoothLeServiceData() + { + } + + /// + /// The Bluetooth LE service UUID. + /// + public string ServiceUuid + { + get + { + return Uuid; + } + } + /// + /// The Bluetooth LE service data. + /// + public byte[] ServiceData + { + get + { + return Data; + } + } + /// + /// The length of the service data. + /// + public int ServiceDataLength + { + get + { + return Length; + } + } + } + + /// + /// This class contains the information of the socket data. + /// + public class SocketData + { + internal string RecvData; + internal int Size; + internal int Fd; + + internal SocketData() + { + } + + /// + /// The socket FD. + /// + public int SocketFd + { + get + { + return Fd; + } + } + /// + /// The length of the received data. + /// + public int DataSize + { + get + { + return Size; + } + } + /// + /// The received data. + /// + public string Data + { + get + { + return RecvData; + } + } + } + + /// + /// This class contains the information of the socket connection. + /// + public class SocketConnection + { + internal string Uuid; + internal string RemoteAddress; + internal int Fd; + + internal SocketConnection() + { + } + + /// + /// The connected socket FD. + /// + public int SocketFd + { + get + { + return Fd; + } + } + /// + /// The remote device address. + /// + public string Address + { + get + { + return RemoteAddress; + } + } + /// + /// The service UUID. + /// + public string ServiceUuid + { + get + { + return Uuid; + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothDevice.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothDevice.cs new file mode 100644 index 0000000..b0debee --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothDevice.cs @@ -0,0 +1,695 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.Collections.Specialized; + +namespace Tizen.Network.Bluetooth +{ + /// + /// This class is used to handle the connection with other devices and set authorization of other devices.
+ /// The BluetoothDevice class is used to search for services available on remote devices. + ///
+ /// http://tizen.org/privilege/bluetooth + public class BluetoothDevice + { + private event EventHandler _bondCreated; + private event EventHandler _bondDestroyed; + private event EventHandler _authorizationChanged; + private event EventHandler _serviceSearched; + private event EventHandler _connectionChanged; + + private Interop.Bluetooth.BondCreatedCallback _bondCreatedCallback; + private Interop.Bluetooth.BondDestroyedCallback _bondDestroyedCallback; + private Interop.Bluetooth.AuthorizationChangedCallback _authorizationChangedCallback; + private Interop.Bluetooth.ServiceSearchedCallback _serviceSearchedCallback; + private Interop.Bluetooth.DeviceConnectionStateChangedCallback _connectionChangedCallback; + + internal string RemoteDeviceAddress; + internal string RemoteDeviceName; + internal int RemoteDeviceRssi; + internal BluetoothClass RemoteDeviceClass; + internal Collection RemoteDeviceService; + internal int RemoteDeviceCount; + internal bool RemotePaired; + internal bool RemoteAuthorized; + internal bool RemoteConnected; + internal BluetoothAppearanceType RemoteAppearance; + internal int RemoteManufLength; + internal string RemoteManufData; + + internal BluetoothDevice() + { + } + + /// + /// The address of the device. + /// + public string Address + { + get + { + return RemoteDeviceAddress; + } + } + /// + /// The name of the device. + /// + public string Name + { + get + { + return RemoteDeviceName; + } + } + /// + /// The strength indicator of received signal of the device. + /// + public int Rssi + { + get + { + return RemoteDeviceRssi; + } + } + /// + /// The class of the device. + /// + public BluetoothClass Class + { + get + { + return RemoteDeviceClass; + } + } + /// + /// The service UUID list of the device. + /// + public IEnumerable ServiceUuidList + { + get + { + return RemoteDeviceService; + } + } + /// + /// The number of services. + /// + public int ServiceCount + { + get + { + return RemoteDeviceCount; + } + } + /// + /// The paired state of the device. + /// + public bool IsPaired + { + get + { + return RemotePaired; + } + } + /// + /// The connection state of the device. + /// + public bool IsConnected + { + get + { + return RemoteConnected; + } + } + /// + /// The authorization state of the device. + /// + public bool IsAuthorized + { + get + { + return RemoteAuthorized; + } + } + /// + /// The Bluetooth appearance. + /// + public BluetoothAppearanceType AppearanceType + { + get + { + return RemoteAppearance; + } + } + + /// + /// The length of the manufacturer data. + /// + public int ManufacturerDataLength + { + get + { + return RemoteManufLength; + } + } + /// + /// The manufacturer data. + /// + public string ManufacturerData + { + get + { + return RemoteManufData; + } + } + + /// + /// The BondCreated event is raised when the process of creating the bond is finished. + /// + public event EventHandler BondCreated + { + add + { + if (_bondCreated == null) + { + RegisterBondCreatedEvent(); + } + _bondCreated += value; + } + remove + { + _bondCreated -= value; + if (_bondCreated == null) + { + UnregisterBondCreatedEvent(); + } + } + } + + /// + /// The BondDestroyed event is raised when the bond is destroyed. + /// + public event EventHandler BondDestroyed + { + add + { + if (_bondDestroyed == null) + { + RegisterBondDestroyedEvent(); + } + _bondDestroyed += value; + } + remove + { + _bondDestroyed -= value; + if (_bondDestroyed == null) + { + UnregisterBondDestroyedEvent(); + } + } + } + + /// + /// The AuthorizationChanged event is raised when the authorization of the device is changed. + /// + public event EventHandler AuthorizationChanged + { + add + { + if (_authorizationChanged == null) + { + RegisterAuthorizationChangedEvent(); + } + _authorizationChanged += value; + } + remove + { + _authorizationChanged -= value; + if (_authorizationChanged == null) + { + UnregisterAuthorizationChangedEvent(); + } + } + } + + /// + /// The ServiceSearched event is raised when the process of service searched is finished. + /// + public event EventHandler ServiceSearched + { + add + { + if (_serviceSearched == null) + { + RegisterServiceSearchedEvent(); + } + _serviceSearched += value; + } + remove + { + _serviceSearched -= value; + if (_serviceSearched == null) + { + UnregisterServiceSearchedEvent(); + } + } + } + + /// + /// The ConnectionStateChanged event is raised when the connection state is changed. + /// + public event EventHandler ConnectionStateChanged + { + add + { + if (_connectionChanged == null) + { + RegisterConnectionChangedEvent(); + } + _connectionChanged += value; + } + remove + { + _connectionChanged -= value; + if (_connectionChanged == null) + { + UnregisterConnectionChangedEvent(); + } + } + } + + private void RegisterBondCreatedEvent() + { + _bondCreatedCallback = (int result, ref BluetoothDeviceStruct device, IntPtr userData) => + { + if (_bondCreated != null) + { + BluetoothError res = (BluetoothError)result; + _bondCreated(null, new BondCreatedEventArgs(res, BluetoothUtils.ConvertStructToDeviceClass(device))); + } + }; + int ret = Interop.Bluetooth.SetBondCreatedCallback(_bondCreatedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set bond created callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterBondCreatedEvent() + { + int ret = Interop.Bluetooth.UnsetBondCreatedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset bond created callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterBondDestroyedEvent() + { + _bondDestroyedCallback = (int result, string deviceAddress, IntPtr userData) => + { + if (_bondDestroyed != null) + { + BluetoothError res = (BluetoothError)result; + _bondDestroyed(null, new BondDestroyedEventArgs(res, deviceAddress)); + } + }; + int ret = Interop.Bluetooth.SetBondDestroyedCallback(_bondDestroyedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set bond destroyed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterBondDestroyedEvent() + { + int ret = Interop.Bluetooth.UnsetBondDestroyedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset bond destroyed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterServiceSearchedEvent() + { + _serviceSearchedCallback = (int result, ref BluetoothDeviceSdpStruct sdp, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Servicesearched cb is called"); + if (_serviceSearched != null) + { + BluetoothError res = (BluetoothError)result; + _serviceSearched(null, new ServiceSearchedEventArgs(res, BluetoothUtils.ConvertStructToSdpData(sdp))); + } + }; + int ret = Interop.Bluetooth.SetServiceSearchedCallback(_serviceSearchedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set service searched callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterServiceSearchedEvent() + { + int ret = Interop.Bluetooth.UnsetServiceSearchedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset service searched callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterAuthorizationChangedEvent() + { + _authorizationChangedCallback = (int authorization, string deviceAddress, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Authorization changed cb is called"); + if (_authorizationChanged != null) + { + BluetoothAuthorizationType auth = (BluetoothAuthorizationType)authorization; + _authorizationChanged(null, new AuthorizationChangedEventArgs(auth, deviceAddress)); + } + }; + int ret = Interop.Bluetooth.SetAuthorizationChangedCallback(_authorizationChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set authroization changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterAuthorizationChangedEvent() + { + int ret = Interop.Bluetooth.UnsetAuthorizationChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset authroization changed callback, Error - " + (BluetoothError)ret); + } + } + + private void RegisterConnectionChangedEvent() + { + _connectionChangedCallback = (bool connected, ref BluetoothDeviceConnectionStruct device, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Connection state changed cb is called"); + if (_connectionChanged != null) + { + _connectionChanged(null, new DeviceConnectionStateChangedEventArgs(connected, BluetoothUtils.ConvertStructToConnectionData(device))); + } + }; + + int ret = Interop.Bluetooth.SetConnectionStateChangedCallback(_connectionChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set connection state changed callback, Error - " + (BluetoothError)ret); + } + } + + private void UnregisterConnectionChangedEvent() + { + int ret = Interop.Bluetooth.UnsetConnectionStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset connection state changed callback, Error - " + (BluetoothError)ret); + } + } + + /// + /// Creates a bond with the remote Bluetooth device. + /// + /// + /// The Bluetooth must be enabled and the remote device must be discoverable by StartDiscovery(). The bond can be destroyed by DestroyBond(). + /// The bonding request can be cancelled by CancelBonding(). If this succeeds, the BondCreated event will be invoked. + /// + /// Thrown when the BT/BTLE is not enabled + /// or when the create bonding process to the remote device fails. + public void CreateBond() + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + int ret = Interop.Bluetooth.CreateBond(RemoteDeviceAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to create bond, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + /// + /// Cancels the bonding process. + /// + /// + /// Bonding must be in progress by CreateBond(). + /// + /// Thrown when the BT/BTLE is not enabled + /// or when the cancel bonding procedure to remote device fails. + public void CancelBonding() + { + int ret = Interop.Bluetooth.CancelBonding(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to cancel bonding process, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + /// + /// Destroys the bond. + /// + /// + /// The Bluetooth must be enabled and the bond must be created by CreateBond(). + /// If this succeeds, the BondDestroyed event will be invoked. + /// + /// Thrown when the BT/BTLE is not enabled + /// or when the destroy bonding procedure fails. + public void DestroyBond() + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + int ret = Interop.Bluetooth.DestroyBond(RemoteDeviceAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy bond, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + /// + /// Sets an alias for the bonded device. + /// + /// + /// The Bluetooth must be enabled and the bond must be created by CreateBond(). + /// + /// The alias name of the remote device. + /// Thrown when the BT/BTLE is not enabled + /// or when the set alias name to remote device fails. + public void SetAlias(string aliasName) + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + int ret = Interop.Bluetooth.SetAlias(RemoteDeviceAddress, aliasName); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set alias name, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + /// + /// Sets the authorization of a bonded device. + /// + /// + /// The Bluetooth must be enabled and the bond must be created by CreateBond(). + /// If this succeeds, the AuthorizationChanged event will be invoked. + /// + /// The authorization state. + /// Thrown when the BT/BTLE is not enabled + /// or when the set authorization to remote device fails. + public void SetAuthorization(BluetoothAuthorizationType authorizationState) + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + int ret = Interop.Bluetooth.SetAuthorization(RemoteDeviceAddress, (int)authorizationState); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set authroization state, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + /// + /// Gets the mask from the UUID. + /// + /// The service mask list converted from the given UUID list. + /// The UUID list of the device. + /// Thrown when the BT/BTLE is not enabled + /// or when the get Mask from UUID fails. + public BluetoothServiceClassType GetMaskFromUuid(string[] uuids) + { + BluetoothServiceClassType serviceMask; + + int ret = Interop.Bluetooth.GetMaskFromUuid(uuids, uuids.Length, out serviceMask); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get service mask, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return serviceMask; + } + + /// + /// Starts the search for services supported by the specified device. + /// + /// + /// The Bluetooth must be enabled and remote device must be discoverable by StartDiscovery(). The bond must be created by CreateBond(). + /// If this succeeds, the ServiceSearched event will be invoked. + /// + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device service search fails. + public void StartServiceSearch() + { + Log.Info(Globals.LogTag, "startservicesearch entry"); + if (BluetoothAdapter.IsBluetoothEnabled) + { + int ret = Interop.Bluetooth.StartServiceSearch(RemoteDeviceAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to start service search, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + + /// + /// Gets the connected profiles. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The connected Bluetooth profiles. + /// Thrown when the BT/BTLE is not enabled + /// or when there is no BT connection. + public IEnumerable GetConnectedProfiles() + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + List profileList = new List(); + Interop.Bluetooth.ConnectedProfileCallback callback = (int profile, IntPtr userData) => + { + if (!profile.Equals(null)) + { + profileList.Add((BluetoothProfileType)profile); + } + return true; + }; + int ret = Interop.Bluetooth.GetConnectedProfiles(RemoteDeviceAddress, callback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get connected profiles, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return profileList; + } + else + { + return null; + } + } + + /// + /// Determines if profile is connected to the specified remote device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// true if profile is connected, otherwise false. + /// The Bluetooth profile type. + /// Thrown when the BT/BTLE is not enabled + /// or when there is no BT connection. + public bool IsProfileConnected(BluetoothProfileType profileType) + { + if (BluetoothAdapter.IsBluetoothEnabled) + { + bool isConnected; + int ret = Interop.Bluetooth.IsProfileConnected(RemoteDeviceAddress, (int)profileType, out isConnected); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get profile connected state, Error - " + (BluetoothError)ret); + } + return isConnected; + } + else + { + return false; + } + } + + /// + /// Returns the instance of the Bluetooth profile type. + /// + /// + /// The Bluetooth must be enabled. + /// + public T GetProfile() where T : BluetoothProfile + { + /* + * FIXME: Find a proper way for dynamic allocation. + */ + T profile = null; + String type = typeof(T).ToString(); + if (type.Equals("Tizen.Network.Bluetooth.BluetoothAudio")) + { + BluetoothAudio audio = new BluetoothAudio(); + profile = (audio as T); + } + else if (type.Equals("Tizen.Network.Bluetooth.BluetoothAvrcp")) + { + BluetoothAvrcp avrcp = new BluetoothAvrcp(); + profile = (avrcp as T); + } + else if (type.Equals("Tizen.Network.Bluetooth.BluetoothHid")) + { + BluetoothHid hid = new BluetoothHid(); + profile = (hid as T); + } + + if (profile != null) + { + profile.RemoteAddress = RemoteDeviceAddress; + } + return profile; + } + + /// + /// Creates the client socket. + /// + /// The IBluetoothClientSocket instance. + /// The UUID of the service. + public IBluetoothClientSocket CreateSocket(string serviceUuid) + { + BluetoothSocket clientSocket = new BluetoothSocket(); + clientSocket.remoteAddress = this.Address; + clientSocket.serviceUuid = serviceUuid; + return (IBluetoothClientSocket)clientSocket; + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEnumerations.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEnumerations.cs new file mode 100644 index 0000000..1842de9 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEnumerations.cs @@ -0,0 +1,1202 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.Bluetooth +{ + /// + /// Enumeration for the Bluetooth states. + /// + public enum BluetoothState + { + /// + /// The disabled state. + /// + Disabled = 0, + /// + /// The enabled state. + /// + Enabled + } + + /// + /// Enumeration for the Bluetooth errors. + /// + public enum BluetoothError + { + /// + /// Successful. + /// + None = ErrorCode.None, + /// + /// Operation canceled. + /// + Cancelled = ErrorCode.Canceled, + /// + /// Invalid parameter. + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Out of memory. + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// Device or resource busy. + /// + ResourceBusy = ErrorCode.ResourceBusy, + /// + /// Timeout error. + /// + TimedOut = ErrorCode.TimedOut, + /// + /// Operation now in progress. + /// + NowInProgress = ErrorCode.NowInProgress, + /// + /// Bluetooth is not supported. + /// + NotSupported = ErrorCode.NotSupported, + /// + /// Permission denied. + /// + PermissionDenied = ErrorCode.PermissionDenied, + /// + /// Quota exceeded. + /// + QuotaExceeded = ErrorCode.QuotaExceeded, + /// + /// No data available. + /// + NoData = ErrorCode.NoData, + /// + /// Local adapter not initialized. + /// + NotInitialized = -0x01C00000 | 0x0101, + /// + /// Local adapter not enabled. + /// + NotEnabled = -0x01C00000 | 0x0102, + /// + /// Operation already done. + /// + AlreadyDone = -0x01C00000 | 0x0103, + /// + /// Operation failed. + /// + OperationFailed = -0x01C00000 | 0x0104, + /// + /// Operation not in progress. + /// + NotInProgress = -0x01C00000 | 0x0105, + /// + /// Remote device not bonded. + /// + RemoteDeviceNotBonded = -0x01C00000 | 0x0106, + /// + /// Authentication rejected. + /// + AuthRejected = -0x01C00000 | 0x0107, + /// + /// Authentication failed. + /// + AuthFailed = -0x01C00000 | 0x0108, + /// + /// Remote device not found. + /// + RemoteDeviceNotFound = -0x01C00000 | 0x0109, + /// + /// Service search failed. + /// + ServiceSearchFailed = -0x01C00000 | 0x010A, + /// + /// Remote device is not connected. + /// + RemoteDeviceNotConnected = -0x01C00000 | 0x010B, + /// + /// Resource temporarily unavailable. + /// + ResourceUnavailable = -0x01C00000 | 0x010C, + /// + /// Service Not Found. + /// + ServiceNotFound = -0x01C00000 | 0x010D + } + + /// + /// Enumeration for the Bluetooth visibility modes. + /// + public enum VisibilityMode + { + /// + /// The non-discoverable mode. + /// + NonDiscoverable = 0, + /// + /// The discoverable mode. + /// + Discoverable = 1, + /// + /// The discoverable mode with limited time. + /// + TimeLimitedDiscoverable = 2 + } + + /// + /// Enumeration for the Bluetooth major device class types. + /// + public enum BluetoothMajorDeviceClassType + { + /// + /// The miscellaneous major class type. + /// + Misc = 0x00, + /// + /// The computer major class type. + /// + Computer = 0x01, + /// + /// The phone major class type. + /// + Phone = 0x02, + /// + /// The LAN/Network access point major class type. + /// + LanNetworkAccessPoint = 0x03, + /// + /// The audio/video major class type. + /// + AudioVideo = 0x04, + /// + /// The peripheral major class type. + /// + Peripheral = 0x05, + /// + /// The imaging major class type. + /// + Imaging = 0x06, + /// + /// The wearable major class type. + /// + Wearable = 0x07, + /// + /// The toy major class type. + /// + Toy = 0x08, + /// + /// The health major class type. + /// + Health = 0x09, + /// + /// The uncategorized major class type. + /// + Uncategorized = 0x1F + } + + /// + /// Enumeration for the Bluetooth minor device class types. + /// + public enum BluetoothMinorDeviceClassType + { + /// + /// The uncategorized computer minor class type. + /// + ComputerUncategorized = 0x00, + /// + /// The desktop workstation computer minor class type. + /// + ComputerDesktopWorkstation = 0x04, + /// + /// The server computer minor class type. + /// + ComputerServer = 0x08, + /// + /// The laptop computer minor class type. + /// + ComputerLaptop = 0x0C, + /// + /// The handheld PC/PDA computer minor class type. + /// + ComputerHandheldPcOrPda = 0x10, + /// + /// The palm sized PC/PDA computer minor class type. + /// + ComputerPalmSizedPcOrPda = 0x14, + /// + /// The wearable computer minor class type. + /// + ComputerWearableComputer = 0x18, + + /// + /// The unclassified phone minor class type. + /// + PhoneUncategorized = 0x00, + /// + /// The cellular phone minor class type. + /// + PhoneCellular = 0x04, + /// + /// The cordless phone minor class type. + /// + PhoneCordless = 0x08, + /// + /// The smartphone phone minor class type. + /// + PhoneSmartPhone = 0x0C, + /// + /// The wired modem or voice gateway phone minor class type. + /// + PhoneWiredModemOrVoiceGateway = 0x10, + /// + /// The ISDN phone minor class type. + /// + PhoneCommonIsdnAccess = 0x14, + + /// + /// Fully available LAN/Network access point minor class type. + /// + LanNetworkAccessPointFullyAvailable = 0x04, + /// + /// 1-17% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint1To17PercentUtilized = 0x20, + /// + /// 17-33% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint17To33PercentUtilized = 0x40, + /// + /// 33-50% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint33To50PercentUtilized = 0x60, + /// + /// 50-67% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint50To67PercentUtilized = 0x80, + /// + /// 67-83% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint67To83PercentUtilized = 0xA0, + /// + /// 83-99% utilized LAN/Network access point minor class type. + /// + LanNetworkAccessPoint83To99PercentUtilized = 0xC0, + /// + /// No service available LAN/Network access point minor class type. + /// + LanNetworkAccessPointNoServiceAvailable = 0xE0, + + /// + /// The uncategorized audio/video minor class type. + /// + AudioVideoUncategorized = 0x00, + /// + /// The wearable headset audio/video minor class type. + /// + AudioVideoWearableHeadset = 0x04, + /// + /// The hands free audio/video minor class type. + /// + AudioVideoHandsFree = 0x08, + /// + /// The microphone audio/video minor class type. + /// + AudioVideoMicrophone = 0x10, + /// + /// The loudspeaker audio/video minor class type. + /// + AudioVideoLoudspeaker = 0x14, + /// + /// The headphones audio/video minor class type. + /// + AudioVideoHeadphones = 0x18, + /// + /// The portable audio audio/video minor class type. + /// + AudioVideoPortableAudio = 0x1C, + /// + /// The car audio audio/video minor class type. + /// + AudioVideoCarAudio = 0x20, + /// + /// The SetTopbox audio/video minor class type. + /// + AudioVideoSetTopBox = 0x24, + /// + /// The Hi-Fi audio/video minor class type. + /// + AudioVideoHifiAudioDevice = 0x28, + /// + /// The VCR audio/video minor class type. + /// + AudioVideoVcr = 0x2C, + /// + /// The video camera audio/video minor class type. + /// + AudioVideoVideoCamera = 0x30, + /// + /// Camcorder audio/video minor class type. + /// + AudioVideoCamcorder = 0x34, + /// + /// The video monitor audio/video minor class type. + /// + AudioVideoVideoMonitor = 0x38, + /// + /// The video display and loudspeaker audio/video minor class type. + /// + AudioVideoVideoDisplayLoudspeaker = 0x3C, + /// + /// The video conferencing audio/video minor class type. + /// + AudioVideoVideoConferencing = 0x40, + /// + /// The gaming/toy audio/video minor class type. + /// + AudioVideoGamingToy = 0x48, + + /// + /// The uncategorized peripheral minor class type. + /// + PeripheralUncategorized = 0x00, + /// + /// The keyboard peripheral minor class type. + /// + PeripheralKeyBoard = 0x40, + /// + /// The pointing device peripheral minor class type. + /// + PeripheralPointingDevice = 0x80, + /// + /// The combo keyboard peripheral minor class type. + /// + PeripheralComboKeyboardPointingDevice = 0xC0, + /// + /// The joystick peripheral minor class type. + /// + PeripheralJoystick = 0x04, + /// + /// The game pad peripheral minor class type. + /// + PeripheralGamePad = 0x08, + /// + /// The remote control peripheral minor class type. + /// + PeripheralRemoteControl = 0x0C, + /// + /// The sensing device peripheral minor class type. + /// + PeripheralSensingDevice = 0x10, + /// + /// The digitizer peripheral minor class type. + /// + PeripheralDigitizerTablet = 0x14, + /// + /// The card reader peripheral minor class type. + /// + PeripheralCardReader = 0x18, + /// + /// The digital pen peripheral minor class type. + /// + PeripheralDigitalPen = 0x1C, + /// + /// The handheld scanner peripheral minor class type. + /// + PeripheralHandheldScanner = 0x20, + /// + /// The handheld gestural input computer minor class type. + /// + PeripheralHandheldGesturalInputDevice = 0x24, + + /// + /// The display imaging minor class type. + /// + ImagingDisplay = 0x10, + /// + /// The camera imaging minor class type. + /// + ImagingCamera = 0x20, + /// + /// The scanner imaging minor class type. + /// + ImagingScanner = 0x40, + /// + /// The printer imaging minor class type. + /// + ImagingPrinter = 0x80, + + /// + /// The wrist watch wearable minor class type. + /// + WearableWristWatch = 0x04, + /// + /// The pager wearable minor class type. + /// + WearablePager = 0x08, + /// + /// The jacket wearable minor class type. + /// + WearableJacket = 0x0C, + /// + /// The helmet wearable minor class type. + /// + WearableHelmet = 0x10, + /// + /// The glasses wearable minor class type. + /// + WearableGlasses = 0x14, + + /// + /// The robot toy minor class type. + /// + ToyRobot = 0x04, + /// + /// The vehicle toy minor class type. + /// + ToyVehicle = 0x08, + /// + /// The doll toy minor class type. + /// + ToyDollAction = 0x0C, + /// + /// The controller toy minor class type. + /// + ToyController = 0x10, + /// + /// The game toy minor class type. + /// + ToyGame = 0x14, + + /// + /// The uncategorized health minor class type. + /// + HealthUncategorized = 0x00, + /// + /// The BP monitor health minor class type. + /// + HealthBloodPressureMonitor = 0x04, + /// + /// The thermometer health minor class type. + /// + HealthThermometer = 0x08, + /// + /// The scale health minor class type. + /// + HealthWeighingScale = 0x0C, + /// + /// The glucose meter health minor class type. + /// + HealthGlucoseMeter= 0x10, + /// + /// The pulse oximeter health minor class type. + /// + HealthPulseOximeter = 0x14, + /// + /// The heart/pulse rate monitor health minor class type. + /// + HealthHeartPulseRateMonitor = 0x18, + /// + /// The display health minor class type. + /// + HealthDataDisplay = 0x1C, + /// + /// The step counter health minor class type. + /// + HealthStepCounter = 0x20, + /// + /// The body composition analyzer health minor class type. + /// + HealthBodyCompositionAnalyzer = 0x24, + /// + /// The peak flow monitor health minor class type. + /// + HealthPeakFlowMonitor = 0x28, + /// + /// The medication monitor health minor class type. + /// + HealthMedicationMonitor = 0x2C, + /// + /// The knee prosthesis health minor class type. + /// + HealthKneeProsthesis = 0x30, + /// + /// The ankle prosthesis health minor class type. + /// + HealthAnkleProsthesis = 0x34 + } + + /// + /// Enumeration for the Bluetooth device discovery states. + /// + public enum BluetoothDeviceDiscoveryState + { + /// + /// The device discovery is started. + /// + Started = 0, + /// + /// The device discovery is finished. + /// + Finished, + /// + /// The remote device is found. + /// + Found + } + + /// + /// Enumeration for the Bluetooth appearance types. + /// + public enum BluetoothAppearanceType + { + /// + /// Unknown. + /// + Unknown = 0, + /// + /// Generic phone. + /// + GenericPhone = 1, + /// + /// Generic computer. + /// + GenericComputer = 2, + /// + /// Generic watch. + /// + GenericWatch = 3 + } + + /// + /// Enumeration for the Bluetooth audio profile types. + /// + public enum BluetoothAudioProfileType + { + /// + /// All supported profiles of audio. + /// + All = 0, + /// + /// The Headset and Hands-Free profile. + /// + HspHfp, + /// + /// The Advanced Audio Distribution profile. + /// + AdvancedAudioDistribution, + /// + /// The Audio Gateway profile. + /// + AudioGateway, + /// + /// The Advanced Audio Distribution profile sink role. + /// + AdvancedAudioDistributionSink + } + + /// + /// Enumeration for the Bluetooth service class types. + /// + public enum BluetoothServiceClassType + { + /// + /// No service class. + /// + None = 0, + /// + /// The RES service class. + /// + Res = 0x00000001, + /// + /// The SPP service class. + /// + Spp = 0x00000002, + /// + /// The DUN service class. + /// + Dun = 0x00000004, + /// + /// The FAX service class. + /// + Fax = 0x00000008, + /// + /// The LAP service class. + /// + Lap = 0x00000010, + /// + /// The HSP service class. + /// + Hsp = 0x00000020, + /// + /// The HFPservice class. + /// + Hfp = 0x00000040, + /// + /// The OPP service class. + /// + Opp = 0x00000080, + /// + /// The FTP service class. + /// + Ftp = 0x00000100, + /// + /// The CTP service class. + /// + Ctp = 0x00000200, + /// + /// The ICP service class. + /// + Icp = 0x00000400, + /// + /// The Sync service class. + /// + Sync = 0x00000800, + /// + /// The BPP service class. + /// + Bpp = 0x00001000, + /// + /// The BIP service class. + /// + Bip = 0x00002000, + /// + /// The PANU service class. + /// + Panu = 0x00004000, + /// + /// The NAP service class. + /// + Nap = 0x00008000, + /// + /// The GN service class. + /// + Gn = 0x00010000, + /// + /// The SAP service class. + /// + Sap = 0x00020000, + /// + /// The A2DP service class. + /// + A2dp = 0x00040000, + /// + /// The AVRCP service class. + /// + Avrcp = 0x00080000, + /// + /// The PBAP service class. + /// + Pbap = 0x00100000, + /// + /// The HID service class. + /// + Hid = 0x00200000, + /// + /// The A2DP Source service class. + /// + A2dpSource = 0x00400000, + /// + /// All service class. + /// + All = 0x00FFFFFF, + /// + /// The Max service class. + /// + Max + } + + /// + /// Enumeration for the Bluetooth profile types. + /// + public enum BluetoothProfileType + { + /// + /// The RFCOMM profile. + /// + Rfcomm = 0, + /// + /// The Advanced Audio Distribution Profile Source role. + /// + AdvancedAudioDistribution, + /// + /// The Headset profile. + /// + Headset, + /// + /// The Human Interface Device profile. + /// + HumanInterfaceDevice, + /// + /// The Network Access Point profile. + /// + NetworkAccessPoint, + /// + /// The Audio Gateway profile. + /// + AudioGateway, + /// + /// The Generic Attribute profile. + /// + GenericAttribute, + /// + /// The NAP Server profile. + /// + NapServer, + /// + /// The advanced Audio Distribution profile sink role. + /// + AdvancedAudioDistributionSink + } + + /// + /// Enumeration for the Bluetooth authorization types. + /// + public enum BluetoothAuthorizationType + { + /// + /// The authorized type. + /// + Authorized = 0, + /// + /// The unauthorized type. + /// + Unauthorized + } + + /// + /// Enumeration for the Bluetooth connection link types. + /// + public enum BluetoothConnectionLinkType + { + /// + /// The BR/EDR link. + /// + BrEdr = 0, + /// + /// The LE link. + /// + Le, + /// + /// The default connection type. + /// + Default + } + + /// + /// Enumeration for the Bluetooth disconnect reason. + /// + public enum BluetoothDisconnectReason + { + /// + /// The disconnected by unknown reason. + /// + Unknown = 0, + /// + /// The disconnected by timeout. + /// + Timeout, + /// + /// The disconnected by local host. + /// + LocalHost, + /// + /// The disconnected by remote. + /// + Remote + } + + /// + /// Enumeration for the connected Bluetooth device event roles. + /// + public enum BluetoothSocketRole + { + /// + /// Unknown role. + /// + Unknown, + /// + /// The server role. + /// + Server, + /// + /// The client role. + /// + Client + } + + /// + /// Enumeration for the Bluetooth socket connection states. + /// + public enum BluetoothSocketState + { + /// + /// The RFCOMM is connected. + /// + Connected, + /// + /// The RFCOMM is disconnected. + /// + Disconnected + } + + /// + /// Enumeration for the equalizer states. + /// + public enum EqualizerState + { + /// + /// Equalizer Off. + /// + Off = 0, + /// + /// Equalizer On. + /// + On + } + + /// + /// Enumeration for the repeat modes. + /// + public enum RepeatMode + { + /// + /// Repeat off. + /// + Off = 0, + /// + /// Single track repeat. + /// + SingleTrack, + /// + /// All track repeat. + /// + AllTrack, + /// + /// Group repeat. + /// + Group + } + + /// + /// Enumeration for the shuffle modes. + /// + public enum ShuffleMode + { + /// + /// Shuffle off. + /// + Off = 0, + /// + /// All tracks shuffle. + /// + AllTrack, + /// + /// Group shuffle. + /// + Group + } + + /// + /// Enumeration for the scan modes. + /// + public enum ScanMode + { + /// + /// Scan off. + /// + Off = 0, + /// + /// All tracks scan. + /// + AllTrack, + /// + /// Group scan. + /// + Group + } + + /// + /// Enumeration for the player states. + /// + public enum PlayerState + { + /// + /// The stopped state. + /// + Stopped = 0, + /// + /// The playing state. + /// + Playing, + /// + /// The paused state. + /// + Paused, + /// + /// The seek forward state. + /// + SeekForward, + /// + /// The seek rewind state. + /// + SeekRewind + } + + /// + /// Enumeration for the Bluetooth LE device address types. + /// + public enum BluetoothLeDeviceAddressType + { + /// + /// The Buetooth LE public address. + /// + BluetoothLePublicAddress, + /// + /// The Bluetooth LE private address. + /// + BluetoothLePrivateAddress + } + + /// + /// Enumeration for the Bluetooth LePacket types. + /// + public enum BluetoothLePacketType + { + /// + /// The Bluetooth LE advertising packet. + /// + BluetoothLeAdvertisingPacket, + /// + /// The Bluetooth LE scan response packet. + /// + BluetoothLeScanResponsePacket + } + + /// + /// Enumeration for the Bluetooth LE data types. + /// + public enum BluetoothLeDataType + { + /// + /// The Bluetooth LE packet data list 16 bit service uuid. + /// + BluetoothLePacketDataList16BitServiceUuid, + /// + /// The Bluetooth LE packet manufacturer data. + /// + BluetoothLePacketManufacturerData + } + + /// + /// Enumeration for the Bluetooth LE advertising mode types. + /// + public enum BluetoothLeAdvertisingMode + { + /// + /// The Bluetooth LE advertising balanced mode. + /// + BluetoothLeAdvertisingBalancedMode, + /// + /// The Bluetooth LE advertising low latency mode. + /// + BluetoothLeAdvertisingLowLatencyMode, + /// + /// The Bluetooth LE advertising low energy mode. + /// + BluetoothLeAdvertisingLowEnergyMode + } + + /// + /// Enumeration for the Bluetooth LE advertising mode type. + /// + public enum BluetoothLeAdvertisingState + { + /// + /// The Bluetooth LE advertising stopped. + /// + BluetoothLeAdvertisingStopped, + /// + /// The Bluetooth LE advertising started. + /// + BluetoothLeAdvertisingStarted + } + + /// + /// Enumeration for the integer type for GATT handle's values. + /// + public enum IntDataType + { + /// + /// The 8-bit signed integer type. + /// + SignedInt8, + /// + /// The 16-bit signed integer type. + /// + SignedInt16, + /// + /// The 32-bit signed integer type. + /// + SignedInt32, + /// + /// The 8-bit unsigned integer type. + /// + UnsignedInt8, + /// + /// The 16-bit unsigned integer type. + /// + UnsignedInt16, + /// + /// The 32-bit unsigned integer type. + /// + UnsignedInt32 + } + + /// + /// Enumerations of the float type for GATT handle's values. + /// + public enum FloatDataType + { + /// + /// The 32-bit float type. + /// + Float, + /// + /// The 16-bit float type. + /// + SFloat, + } + + /// + /// Enumeration for the GATT handle's types. + /// + public enum GattHandleType + { + /// + /// The GATT service type. + /// + Service, + /// + /// The GATT characteristic type. + /// + Characteristic, + /// + /// The GATT descriptor type. + /// + Descriptor + } + + /// + /// Enumeration for the service types. + /// + public enum BluetoothGattServiceType + { + /// + /// The GATT primary service type. + /// + Primary, + /// + /// The GATT secondary service type. + /// + Secondary + } + + /// + /// Enumeration for the characteristic's property. + /// + [Flags] + public enum BluetoothGattProperty + { + /// + /// The broadcast property. + /// + Broadcast = 1, + /// + /// The read property. + /// + Read = 2, + /// + /// The write without response property. + /// + WriteWithoutResponse = 4, + /// + /// The write property. + /// + Write = 8, + /// + /// The notify property. + /// + Notify = 16, + /// + /// The indicate property. + /// + Indicate = 32, + /// + /// The authenticated signed writes property. + /// + AuthenticatedSignedWrites = 64, + /// + /// The extended properties. + /// + ExtendedProperties = 128, + } + + /// + /// Enumeration for the Bluetooth GATT permission types. + /// + [Flags] + public enum BluetoothGattPermission + { + /// + /// Read permission. + /// + Read = 1, + /// + /// Write permission. + /// + Write = 2, + } + + /// + /// Enumeration for the write types. + /// + public enum BluetoothGattWriteType + { + /// + /// The write without response. + /// + NoResponse, + /// + /// The write with response. + /// + WriteWithResponse + } + + /// + /// Enumeration for the remote device request types for attributes. + /// + public enum BluetoothGattRequestType + { + /// + /// Read requested. + /// + Read = 0, + /// + /// Write requested. + /// + Write = 1, + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs new file mode 100644 index 0000000..9f418e3 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothError.cs @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + static internal class BluetoothErrorFactory + { + static internal void ThrowBluetoothException(int exception) + { + BluetoothError error = (BluetoothError)exception; + switch (error) + { + case BluetoothError.InvalidParameter: + throw new InvalidOperationException("Invalid parameter"); + + case BluetoothError.Cancelled: + throw new InvalidOperationException("Operation cancelled"); + + case BluetoothError.AlreadyDone: + throw new InvalidOperationException("Operation already done"); + + case BluetoothError.TimedOut: + throw new InvalidOperationException("Timeout error"); + + case BluetoothError.AuthFailed: + throw new InvalidOperationException("Authentication failed"); + + case BluetoothError.AuthRejected: + throw new InvalidOperationException("Authentication rejected"); + + case BluetoothError.NoData: + throw new InvalidOperationException("No data available"); + + case BluetoothError.NotEnabled: + throw new InvalidOperationException("Local adapter not enabled"); + + case BluetoothError.NotInitialized: + throw new InvalidOperationException("Local adapter not initialized"); + + case BluetoothError.NowInProgress: + throw new InvalidOperationException("Operation now in progress"); + + case BluetoothError.NotInProgress: + throw new InvalidOperationException("Operation not in progress"); + + case BluetoothError.NotSupported: + throw new NotSupportedException("Bluetooth is not supported"); + + case BluetoothError.OperationFailed: + throw new InvalidOperationException("Operation failed"); + + case BluetoothError.OutOfMemory: + throw new InvalidOperationException("Out of memory"); + + case BluetoothError.PermissionDenied: + throw new InvalidOperationException("Permission denied"); + + case BluetoothError.QuotaExceeded: + throw new InvalidOperationException("Quota exceeded"); + + case BluetoothError.RemoteDeviceNotBonded: + throw new InvalidOperationException("Remote device not bonded"); + + case BluetoothError.RemoteDeviceNotConnected: + throw new InvalidOperationException("Remote device not connected"); + + case BluetoothError.RemoteDeviceNotFound: + throw new InvalidOperationException("Remote device not found"); + + case BluetoothError.ResourceBusy: + throw new InvalidOperationException("Device or resource busy"); + + case BluetoothError.ResourceUnavailable: + throw new InvalidOperationException("Resource temporarily unavailable"); + + case BluetoothError.ServiceNotFound: + throw new InvalidOperationException("Service Not Found"); + + case BluetoothError.ServiceSearchFailed: + throw new InvalidOperationException("Service search failed"); + + default: + throw new InvalidOperationException("Unknown exception"); + } + } + } +} + diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEventArgs.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEventArgs.cs new file mode 100644 index 0000000..c7e6740 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothEventArgs.cs @@ -0,0 +1,1044 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.Bluetooth +{ + /// + /// An extended EventArgs class contains the changed Bluetooth state. + /// + public class StateChangedEventArgs : EventArgs + { + private BluetoothState _type; + private BluetoothError _result; + + internal StateChangedEventArgs(BluetoothError result, BluetoothState type) + { + _type = type; + _result = result; + } + + /// + /// The state of Bluetooth. + /// + public BluetoothState BTState + { + get + { + return _type; + } + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth name. + /// + public class NameChangedEventArgs : EventArgs + { + private string _name; + + internal NameChangedEventArgs(string name) + { + _name = name; + } + + /// + /// The name of the device. + /// + public string DeviceName + { + get + { + return _name; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth visibility mode. + /// + public class VisibilityModeChangedEventArgs : EventArgs + { + private VisibilityMode _mode; + private BluetoothError _result; + + internal VisibilityModeChangedEventArgs(BluetoothError result, VisibilityMode mode) + { + _result = result; + _mode = mode; + } + + /// + /// The visibility mode. + /// + public VisibilityMode Visibility + { + get + { + return _mode; + } + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + } + + /// + /// An extended EventArgs class contains the duration until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable. + /// + public class VisibilityDurationChangedEventArgs : EventArgs + { + private int _duration; + + internal VisibilityDurationChangedEventArgs(int duration) + { + _duration = duration; + } + + /// + /// The duration. + /// + public int Duration + { + get + { + return _duration; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth device discovery state and the discovered device information. + /// + public class DiscoveryStateChangedEventArgs : EventArgs + { + private BluetoothError _result; + private BluetoothDeviceDiscoveryState _state; + private BluetoothDevice _device; + + internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state) + { + _result = result; + _state = state; + } + + internal DiscoveryStateChangedEventArgs(BluetoothError result, BluetoothDeviceDiscoveryState state, BluetoothDevice device) + { + _result = result; + _state = state; + _device = device; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The state of the discovery. + /// + public BluetoothDeviceDiscoveryState DiscoveryState + { + get + { + return _state; + } + } + + /// + /// The remote device found. + /// + public BluetoothDevice DeviceFound + { + get + { + return _device; + } + } + } + + /// + /// An extended EventArgs class contains the bonded device information. + /// + public class BondCreatedEventArgs : EventArgs + { + private BluetoothError _result; + private BluetoothDevice _device; + + internal BondCreatedEventArgs(BluetoothError result, BluetoothDevice device) + { + _result = result; + _device = device; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The remote device. + /// + public BluetoothDevice Device + { + get + { + return _device; + } + } + } + + /// + /// An extended EventArgs class contains the address of the remote Bluetooth device to destroy bond with. + /// + public class BondDestroyedEventArgs : EventArgs + { + private BluetoothError _result; + private string _address; + + internal BondDestroyedEventArgs(BluetoothError result, string address) + { + _result = result; + _address = address; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The remote device address. + /// + /// The device address. + public string DeviceAddress + { + get + { + return _address; + } + } + } + + /// + /// An extended EventArgs class contains the authorization state and the address of the remote Bluetooth device. + /// + public class AuthorizationChangedEventArgs : EventArgs + { + private BluetoothAuthorizationType _authType; + private string _address; + + internal AuthorizationChangedEventArgs(BluetoothAuthorizationType authType, string address) + { + _authType = authType; + _address = address; + } + + /// + /// The authorization. + /// + public BluetoothAuthorizationType Authorization + { + get + { + return _authType; + } + } + + /// + /// The device address. + /// + public string DeviceAddress + { + get + { + return _address; + } + } + + } + + /// + /// An extended EventArgs class contains the service lists found on the remote Bluetooth device. + /// + public class ServiceSearchedEventArgs : EventArgs + { + private BluetoothDeviceSdpData _sdpData; + private BluetoothError _result; + + internal ServiceSearchedEventArgs(BluetoothError result, BluetoothDeviceSdpData sdpData) + { + _result = result; + _sdpData = sdpData; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + /// + /// The sdp data. + /// + public BluetoothDeviceSdpData SdpData + { + get + { + return _sdpData; + } + } + } + + /// + /// An extended EventArgs class contains the connection state and the connection information of the remote device. + /// + public class DeviceConnectionStateChangedEventArgs : EventArgs + { + private bool _isConnected; + private BluetoothDeviceConnectionData _connectionData; + + internal DeviceConnectionStateChangedEventArgs(bool isConnected, BluetoothDeviceConnectionData connectionData) + { + _isConnected = isConnected; + _connectionData = connectionData; + } + + /// + /// A value indicating whether the device is connected. + /// + public bool IsConnected + { + get + { + return _isConnected; + } + } + + /// + /// The device connection data. + /// + public BluetoothDeviceConnectionData ConnectionData + { + get + { + return _connectionData; + } + } + } + + /// + /// An extended EventArgs class contains the data received information. + /// + public class SocketDataReceivedEventArgs : EventArgs + { + private SocketData _data; + + internal SocketDataReceivedEventArgs(SocketData data) + { + _data = data; + } + + /// + /// The socket data. + /// + public SocketData Data + { + get + { + return _data; + } + } + } + + /// + /// An extended EventArgs class contains the changed connection state. + /// + public class SocketConnectionStateChangedEventArgs : EventArgs + { + private BluetoothError _result; + private BluetoothSocketState _state; + private SocketConnection _connection; + + internal SocketConnectionStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection) + { + _result = result; + _state = state; + _connection = connection; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The socket state. + /// + public BluetoothSocketState State + { + get + { + return _state; + } + } + + /// + /// The socket connection. + /// + public SocketConnection Connection + { + get + { + return _connection; + } + } + } + + public class AcceptStateChangedEventArgs : EventArgs + { + private BluetoothError _result; + private BluetoothSocketState _state; + private SocketConnection _connection; + private IBluetoothServerSocket _server; + + internal AcceptStateChangedEventArgs(BluetoothError result, BluetoothSocketState state, SocketConnection connection, BluetoothSocket server) + { + _result = result; + _state = state; + _connection = connection; + _server = (IBluetoothServerSocket)server; + } + + /// + /// The BluetoothError result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The socket state. + /// + public BluetoothSocketState State + { + get + { + return _state; + } + } + + /// + /// The socket connection. + /// + public SocketConnection Connection + { + get + { + return _connection; + } + } + + /// + /// The server socket instance. + /// + public IBluetoothServerSocket Server + { + get + { + return _server; + } + } + } + + /// + /// An extended EventArgs class contains the connection state, remote address, and the type of audio profile. + /// + public class AudioConnectionStateChangedEventArgs : EventArgs + { + private int _result; + private bool _isConnected; + private string _address; + private BluetoothAudioProfileType _type; + + internal AudioConnectionStateChangedEventArgs(int result, bool isConnected, string address, BluetoothAudioProfileType type) + { + _result = result; + _type = type; + _isConnected = isConnected; + _address = address; + } + + /// + /// The result. + /// + public int Result + { + get + { + return _result; + } + } + + /// + /// A value indicating whether this instance is connected. + /// + public bool IsConnected + { + get + { + return _isConnected; + } + } + + /// + /// The address. + /// + public string Address + { + get + { + return _address; + } + } + + /// + /// The type of the audio profile. + /// + public BluetoothAudioProfileType ProfileType + { + get + { + return _type; + } + } + } + + /// + /// An extended EventArgs class contains the connection state and the address of the remote Bluetooth device. + /// + public class HidConnectionStateChangedEventArgs : EventArgs + { + private int _result; + private bool _isConnected; + private string _address; + + internal HidConnectionStateChangedEventArgs(int result, bool isConnected, string address) + { + _result = result; + _isConnected = isConnected; + _address = address; + } + + /// + /// The result. + /// + public int Result + { + get + { + return _result; + } + } + + /// + /// A value indicating whether this instance is connected. + /// + public bool IsConnected + { + get + { + return _isConnected; + } + } + + /// + /// The address. + /// + public string Address + { + get + { + return _address; + } + } + } + + /// + /// An extended EventArgs class contains the changed equalizer state. + /// + public class EqualizerStateChangedEventArgs : EventArgs + { + private EqualizerState _state; + + internal EqualizerStateChangedEventArgs(EqualizerState state) + { + _state = state; + } + + /// + /// The state of the equalizer. + /// + public EqualizerState State + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class contains the changed repeat mode. + /// + public class RepeatModeChangedEventArgs : EventArgs + { + private RepeatMode _mode; + + internal RepeatModeChangedEventArgs(RepeatMode mode) + { + _mode = mode; + } + + /// + /// The repeat mode. + /// + public RepeatMode Mode + { + get + { + return _mode; + } + } + } + + /// + /// An extended EventArgs class contains the changed shuffle mode. + /// + public class ShuffleModeChangedeventArgs : EventArgs + { + private ShuffleMode _mode; + + internal ShuffleModeChangedeventArgs(ShuffleMode mode) + { + _mode = mode; + } + + /// + /// The shuffle mode. + /// + public ShuffleMode Mode + { + get + { + return _mode; + } + } + } + + /// + /// An extended EventArgs class contains the changed scan mode. + /// + public class ScanModeChangedEventArgs : EventArgs + { + private ScanMode _mode; + + internal ScanModeChangedEventArgs(ScanMode mode) + { + _mode = mode; + } + + /// + /// The scan mode. + /// + public ScanMode Mode + { + get + { + return _mode; + } + } + } + + /// + /// An extended EventArgs class contains the connection state and the remote device address. + /// + public class TargetConnectionStateChangedEventArgs : EventArgs + { + private bool _isConnected; + private string _address; + + internal TargetConnectionStateChangedEventArgs(bool isConnected, string address) + { + _isConnected = isConnected; + _address = address; + } + + /// + /// A value indicating whether this instance is connected. + /// + public bool IsConnected + { + get + { + return _isConnected; + } + } + + /// + /// The address. + /// + public string Address + { + get + { + return _address; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth LE advertising state changed information. + /// + public class AdvertisingStateChangedEventArgs : EventArgs + { + private BluetoothLeAdvertisingState _state; + private int _result; + private IntPtr _advertiserHandle; + + //TODO : Add conversion code from IntPtr to BluetoothLeAdvertiser class later + internal AdvertisingStateChangedEventArgs(int result, IntPtr advertiserHandle, + BluetoothLeAdvertisingState state) + { + _result = result; + _advertiserHandle = advertiserHandle; + _state = state; + } + + /// + /// The result. + /// + public int Result + { + get + { + return _result; + } + } + + /// + /// The advertiser handle. + /// + public IntPtr AdvertiserHandle + { + get + { + return _advertiserHandle; + } + } + + /// + /// The LE advertising state. + /// + public BluetoothLeAdvertisingState State + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth LE scan result information. + /// + public class AdapterLeScanResultChangedEventArgs : EventArgs + { + private BluetoothLeDevice _deviceData; + private BluetoothError _result; + + internal AdapterLeScanResultChangedEventArgs(BluetoothError result, BluetoothLeDevice deviceData) + { + _deviceData = deviceData; + _result = result; + } + + /// + /// The result. + /// + public BluetoothError Result + { + get + { + return _result; + } + } + + /// + /// The LE device data. + /// + public BluetoothLeDevice DeviceData + { + get + { + return _deviceData; + } + } + } + + /// + /// An extended EventArgs class contains the changed Bluetooth LE GATT connection state. + /// + public class GattConnectionStateChangedEventArgs : EventArgs + { + private bool _isConnected; + private int _result; + private string _remoteAddress; + + internal GattConnectionStateChangedEventArgs(int result, bool connected, string remoteAddress) + { + _isConnected = connected; + _result = result; + _remoteAddress = remoteAddress; + } + + /// + /// The result. + /// + public int Result + { + get + { + return _result; + } + } + + /// + /// A value indicating whether this instance is connected. + /// + public bool IsConnected + { + get + { + return _isConnected; + } + } + + /// + /// The remote address. + /// + public string RemoteAddress + { + get + { + return _remoteAddress; + } + } + } + + /// + /// An extended EventArgs class contains the changed attribute value. + /// + public class ValueChangedEventArgs : EventArgs + { + internal ValueChangedEventArgs(byte[] value) + { + Value = value; + } + + /// + /// The attribute value. + /// + public byte[] Value { get; } + } + + /// + /// An extended EventArgs class contains the read value request data. + /// + public class ReadRequestedEventArgs : EventArgs + { + internal ReadRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, int offset) + { + Server = server; + ClientAddress = clientAddress; + RequestId = requestId; + Offset = offset; + } + + /// + /// The GATT server instance. + /// + public BluetoothGattServer Server { get; } + /// + /// The client address. + /// + public string ClientAddress { get; } + /// + /// The request identifier. + /// + public int RequestId { get; } + /// + /// The offset. + /// + public int Offset { get; } + } + + /// + /// An extended EventArgs class contains the read value request data. + /// + public class WriteRequestedEventArgs : EventArgs + { + internal WriteRequestedEventArgs(BluetoothGattServer server, string clientAddress, int requestId, byte[] value, int offset, bool response_needed) + { + Server = server; + ClientAddress = clientAddress; + RequestId = requestId; + Value = value; + Offset = offset; + Response_needed = response_needed; + } + + /// + /// The GATT server instance. + /// + public BluetoothGattServer Server { get; } + /// + /// The client address. + /// + public string ClientAddress { get; } + /// + /// The request identifier. + /// + public int RequestId { get; } + /// + /// The read value. + /// + public byte[] Value { get; } + /// + /// The offset. + /// + public int Offset { get; } + /// + /// Indicates whether a response is required by the remote device. + /// + public bool Response_needed { get; } + } + + /// + /// An extended EventArgs class contains the client preference to enable or disable the Notification/Indication. + /// + public class NotificationStateChangedEventArg : EventArgs + { + internal NotificationStateChangedEventArg(BluetoothGattServer server, bool value) + { + Server = server; + Value = value; + } + + /// + /// The GATT server instance. + /// + public BluetoothGattServer Server { get; } + /// + /// A value indicating whether the notification is enabled. + /// + public bool Value { get; } + } + + /// + /// An extended EventArgs class contains the read value request data. + /// + public class NotificationSentEventArg : EventArgs + { + internal NotificationSentEventArg(BluetoothGattServer server, string clientAddress, int result, bool completed) + { + Result = result; + ClientAddress = clientAddress; + Server = server; + Completed = completed; + } + + /// + /// The GATT server instance. + /// + public BluetoothGattServer Server { get; } + /// + /// The client address. + /// + public string ClientAddress { get; } + /// + /// The result. + /// + public int Result { get; } + /// + /// Gets a value indicating whether the notification sent is completed. + /// + public bool Completed { get; } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGatt.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGatt.cs new file mode 100644 index 0000000..923f99c --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGatt.cs @@ -0,0 +1,966 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Network.Bluetooth +{ + /// + /// The Bluetooth GATT server. + /// + public class BluetoothGattServer + { + private static BluetoothGattServer _instance; + private BluetoothGattServerImpl _impl; + private BluetoothGattServer() + { + _impl = new BluetoothGattServerImpl(); + } + + /// + /// (event) This event is called when the indication acknowledgement is received for each notified client. + /// + public event EventHandler NotificationSent + { + add + { + _impl._notificationSent += value; + } + remove + { + _impl._notificationSent -= value; + } + } + + /// + /// Creates the Bluetooth GATT server. + /// + /// + /// Thrown when the BT/BTLE is not supported. + /// Thrown when the create GATT server fails. + public static BluetoothGattServer CreateServer() + { + if (_instance == null) + { + BluetoothGattServer server = new BluetoothGattServer(); + if (server.IsValid()) + { + _instance = server; + } + } + return _instance; + } + + /// + /// Registers the server along with the GATT services of the application it is hosting. + /// + /// Thrown when the BT/BTLE is not supported. + /// Thrown when the register server application fails. + public void Start() + { + _impl.Start(); + } + + /// + /// Registers a specified service to this server. + /// + /// The service, which needs to be registered with this server. + /// Thrown when the BT/BTLE is not supported. + /// Thrown when the register service fails. + public void RegisterGattService(BluetoothGattService service) + { + if (service.IsRegistered()) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter); + } + _impl.RegisterGattService(this, service); + } + + /// + /// Unregisters a specified service from this server. + /// + /// The service, which needs to be unregistered from this server. + /// + /// Once unregistered, the service object will become invalid and should not be used to access sevices or any children attribute's methods/members. + /// + /// Thrown when the BT/BTLE is not supported. + /// Thrown when the unregister service fails. + public void UnregisterGattService(BluetoothGattService service) + { + if (service.GetGattServer() != this) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter); + } + + _impl.UnregisterGattService(service); + } + + /// + /// Unregisters all services from this server. + /// + /// + /// Once unregistered, servicees will become invalid and should not be used to access sevices or any children attribute's methods/members. + /// + /// Thrown when the BT/BTLE is not supported. + /// Thrown when the unregister all services fail. + public void UnregisterGattServices() + { + _impl.UnregisterAllGattServices(this); + } + + /// + /// Gets service with given UUID that belongs to this server. + /// + /// The UUID for the service to get. + /// The Service with the given UUID if it exists, null otherwise. + public BluetoothGattService GetService(string uuid) + { + return _impl.GetService(this, uuid); + } + + /// + /// Gets the list of services that belongs to this server. + /// + /// The list of services that belongs to this server. + public IEnumerable GetServices() + { + return _impl.GetServices(this); + } + + /// + /// Sends indication for the value change of the characteristic to the remote devices. + /// + /// The characteristic whose the value is changed. + /// The remote device address to send, notify, or indicate and if set to NULL, then notify/indicate all is enabled. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when service is not registered, or when the CCCD is not enabled. + public async Task SendIndicationAsync(BluetoothGattCharacteristic characteristic, string clientAddress) + { + return await _impl.SendIndicationAsync(this, characteristic, clientAddress); + } + + /// + /// Sends the notification for the value change of the characteristic to the remote devices. + /// + /// The characteristic, which has a changed value. + /// The remote device address to send, notify, or indicate and if set to NULL, then notify/indicate all is enabled. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when service is not registered, or when the CCCD is not enabled. + public void SendNotification(BluetoothGattCharacteristic characteristic, string clientAddress) + { + _impl.SendNotification(characteristic, clientAddress); + } + + /// + /// Sends a response to the remote device as a result of a read/write request. + /// + /// The identification of a read/write request. + /// The request type for read/write. + /// The error value in case of failure, 0 for success. + /// The value to be sent. + /// The offset from where the value is read. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or the send response procedure fails. + public void SendResponse(int requestId, BluetoothGattRequestType type, int status, byte[] value, int offset) + { + _impl.SendResponse(requestId, (int)type, status, value, offset); + } + + internal bool IsValid() + { + return _impl.GetHandle().IsInvalid == false; + } + } + + /// + /// The Bluetooth GATT client. + /// + public class BluetoothGattClient + { + private BluetoothGattClientImpl _impl; + private string _remoteAddress = string.Empty; + + internal BluetoothGattClient(string remoteAddress) + { + _impl = new BluetoothGattClientImpl(remoteAddress); + _remoteAddress = remoteAddress; + } + + internal static BluetoothGattClient CreateClient(string remoteAddress) + { + BluetoothGattClient client = new BluetoothGattClient(remoteAddress); + return client.Isvalid() ? client : null; + } + + public void DestroyClient() + { + _impl.GetHandle().Dispose(); + } + + /// + /// The address of the remote device. + /// + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected. + public string RemoteAddress + { + get + { + if (string.IsNullOrEmpty(_remoteAddress)) + { + _remoteAddress = _impl.GetRemoteAddress(); + } + return _remoteAddress; + } + } + + /// + /// Gets the service with the given UUID that belongs to the remote device. + /// + /// The UUID for the service to get. + /// The service with the given UUID if it exists, null otherwise. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when the get service fails. + public BluetoothGattService GetService(string uuid) + { + return _impl.GetService(this, uuid); + } + + /// + /// Gets list of services that belongs to the remote device. + /// + /// The list of services that belongs to the remote device. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when the get service fails. + public IEnumerable GetServices() + { + return _impl.GetServices(this); + } + + /// + /// Reads the value of a given characteristic from the remote device asynchronously. + /// + /// The characteristic to be read. + /// true on success, false otherwise. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when the read attribute value fails. + public async Task ReadValueAsync(BluetoothGattCharacteristic characteristic) + { + return await _impl.ReadValueAsyncTask(characteristic.GetHandle()); + } + + /// + /// Reads the value of the given descriptor from the remote device asynchronously. + /// + /// The descriptor to be read. + /// true on success, false otherwise. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when the read attribute value fails. + public async Task ReadValueAsync(BluetoothGattDescriptor descriptor) + { + return await _impl.ReadValueAsyncTask(descriptor.GetHandle()); + } + + /// + /// Writes the value of a given characteristic to the remote device asynchronously. + /// + /// The characteristic to be written. + /// true on success, false otherwise. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected or when the write attribute value fails. + public async Task WriteValueAsync(BluetoothGattCharacteristic characteristic) + { + return await _impl.WriteValueAsyncTask(characteristic.GetHandle()); + } + + /// + /// Writes the value of the given descriptor to the remote device asynchronously. + /// + /// The descriptor to be written. + /// true on success, false otherwise. + /// Thrown when the BT/BTLE is not enabled + /// or when the remote device is disconnected, or when the write attribute value fails. + public async Task WriteValueAsync(BluetoothGattDescriptor descriptor) + { + return await _impl.WriteValueAsyncTask(descriptor.GetHandle()); + } + + internal bool Isvalid() + { + return _impl.GetHandle().IsInvalid == false; + } + } + + /// + /// The Bluetooth GATT service. + /// + public class BluetoothGattService + { + private BluetoothGattServiceImpl _impl; + private BluetoothGattClient _parentClient = null; + private BluetoothGattServer _parentServer = null; + private BluetoothGattService _parentService = null; + + /// + /// The constructor. + /// + /// The UUID of the service. + /// The type of service. + /// Thrown when the create GATT service procedure fails. + public BluetoothGattService(string uuid, BluetoothGattServiceType type) + { + Uuid = uuid; + _impl = new BluetoothGattServiceImpl(uuid, type); + } + + internal BluetoothGattService(BluetoothGattServiceImpl impl, string uuid) + { + Uuid = uuid; + _impl = impl; + } + + /// + /// Specification name from the UUID. + /// + public string Uuid { get; } + + /// + /// Adds a characteristic to this service. + /// + /// The characteristic to be added. + /// true on success, false otherwise. + /// Thrown when the add GATT characteristic procedure fails. + public void AddCharacteristic(BluetoothGattCharacteristic characteristic) + { + if (GetGattClient() != null) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotSupported); + } + + if (characteristic.GetService() != null) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter); + } + + _impl.AddCharacteristic(characteristic); + characteristic.SetParent(this); + } + + /// + /// Gets the characteristic with the given UUID that belongs to this service. + /// + /// The UUID for the characteristic to get. + /// The characteristic with a given UUID if it exists, null otherwise. + public BluetoothGattCharacteristic GetCharacteristic(string uuid) + { + return _impl.GetCharacteristic(this, uuid); + } + + /// + /// Gets list of the characteristic that belongs to this service. + /// + /// The list of the characteristic that belongs to this service. + public IEnumerable GetCharacteristics() + { + return _impl.GetCharacteristics(this); + } + + /// + /// Includes a service to this service. + /// + /// The service to be included. + /// true on success, false otherwise + /// Thrown when the add GATT service procedure fails./// + public void AddService(BluetoothGattService service) + { + if (GetGattClient() != null) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotSupported); + } + + if (service.IsRegistered()) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter); + } + + _impl.AddIncludeService(service); + service.SetParent(this); + } + + /// + /// Gets the included service. + /// + /// The UUID for the service to get. + /// The service with a given UUID if it exists, null otherwise. + public BluetoothGattService GetIncludeService(string uuid) + { + return _impl.GetIncludeService(this, uuid); + } + + /// + /// Gets the included service list of this service. + /// + /// The included service list of this service. + public IEnumerable GetIncludeServices() + { + return _impl.GetIncludeServices(this); + } + + /// + /// Gets the server instance which the specified service belongs to. + /// + /// The server instance which the specified service belongs to. + public BluetoothGattServer GetGattServer() + { + return _parentServer; + } + + /// + /// Gets the client instance which the specified service belongs to. + /// + /// The client instance which the specified service belongs to. + public BluetoothGattClient GetGattClient() + { + return _parentClient; + } + + internal BluetoothGattAttributeHandle GetHandle() + { + return _impl.GetHandle(); + } + + internal void SetParent(BluetoothGattService parent) + { + if (!IsRegistered()) + { + _parentService = parent; + _impl.ReleaseHandleOwnership(); + } + } + + internal void SetParent(BluetoothGattClient parent) + { + if (!IsRegistered()) + { + _parentClient = parent; + _impl.ReleaseHandleOwnership(); + } + } + + internal void SetParent(BluetoothGattServer parent) + { + if (!IsRegistered()) + { + _parentServer = parent; + _impl.ReleaseHandleOwnership(); + } + } + + internal void UnregisterService() + { + _parentServer = null; + _parentClient = null; + _parentService = null; + } + + internal bool IsRegistered() + { + return _parentClient != null || _parentServer != null || _parentService != null; + } + } + + /// + /// The Bluetooth GATT characteristic. + /// + public class BluetoothGattCharacteristic : BluetoothGattAttribute + { + private BluetoothGattCharacteristicImpl _impl; + private BluetoothGattService _parent = null; + + private Interop.Bluetooth.BtClientCharacteristicValueChangedCallback _characteristicValueChangedCallback; + private Interop.Bluetooth.BtGattServerNotificationStateChangeCallback _notificationStateChangedCallback; + + private EventHandler _characteristicValueChanged; + internal EventHandler _notificationStateChanged; + + /// + /// The constructor. + /// + /// The UUID of the characterstic.param> + /// Permissions for the characterstic. + /// Properties set for the characterstic. + /// The value associated with the characterstic. + /// throws in case of internal error. + /// Thrown when the create GATT characteristics procedure fails. + public BluetoothGattCharacteristic(string uuid, BluetoothGattPermission permissions, BluetoothGattProperty properties, byte[] value) : base(uuid, permissions) + { + _impl = new BluetoothGattCharacteristicImpl(uuid, permissions, properties, value); + } + + internal BluetoothGattCharacteristic(BluetoothGattCharacteristicImpl impl, string uuid, BluetoothGattPermission permission) : base(uuid, permission) + { + _impl = impl; + } + + /// + /// The CharacteristicValueChanged event is raised when the server notifies for change in this characteristic value. + /// + /// + /// Adding the event handle on characteristic on the server side will not have any effect. + /// + public event EventHandler ValueChanged + { + add + { + if (Client != null) + { + if (_characteristicValueChanged == null) + { + _characteristicValueChangedCallback = (gattHandle, characteristicValue, len, userData) => + { + _characteristicValueChanged?.Invoke(this, new ValueChangedEventArgs(characteristicValue)); + }; + + _impl.SetCharacteristicValueChangedEvent(_characteristicValueChangedCallback); + } + _characteristicValueChanged = value; + } + } + remove + { + if (Client != null) + { + _characteristicValueChanged = null; + if (_characteristicValueChanged == null) + { + _impl.UnsetCharacteristicValueChangedEvent(); + } + + } + } + } + + /// + /// The NotificationStateChanged event is called when the client enables or disables the Notification/Indication for particular characteristics. + /// + /// + /// Adding event handle on the characteristic on the client side will not have any effect. + /// + public event EventHandler NotificationStateChanged + { + add + { + if (Server != null) + { + if (_notificationStateChangedCallback == null) + { + _notificationStateChangedCallback = (notify, serverHandle, characteristicHandle, userData) => + { + _notificationStateChanged?.Invoke(this, new NotificationStateChangedEventArg(Server, notify)); + }; + + _impl.SetNotificationStateChangedEvent(_notificationStateChangedCallback); + } + + _notificationStateChanged = value; + } + } + remove + { + if (Server != null) + { + _notificationStateChanged = null; + // CAPI does not allow unsetting ReadValueRequestedEventCallback. + } + } + } + + /// + /// The property for this characteristic. + /// + public BluetoothGattProperty Properties + { + get + { + return _impl.GetProperties(); + } + set + { + if (Server != null) + { + _impl.SetProperties(value); + } + } + } + + /// + /// The write type to be used for write operations. + /// + public BluetoothGattWriteType WriteType + { + get + { + return _impl.GetWriteType(); + } + set + { + _impl.SetWriteType(value); + } + } + + internal override BluetoothGattClient Client + { + get + { + return _parent?.GetGattClient(); + } + } + + internal override BluetoothGattServer Server + { + get + { + return _parent?.GetGattServer(); + } + } + + internal override BluetoothGattAttributeImpl Impl + { + get + { + return _impl; + } + } + + /// + /// Adds a descriptor to this characteristic. + /// + /// The descriptor to be added. + /// true on success, false otherwise. + /// Thrown when the add GATT descriptor procedure fails. + public void AddDescriptor(BluetoothGattDescriptor descriptor) + { + if (Client != null) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotSupported); + } + + if (descriptor.GetCharacteristic() != null) + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter); + } + + _impl.AddDescriptor(descriptor); + descriptor.SetParent(this); + } + + /// + /// Gets the descriptor with the given UUID that belongs to this characteristic. + /// + /// The UUID for the descriptor to get. + /// The descriptor with a given UUID if it exists, null otherwise. + public BluetoothGattDescriptor GetDescriptor(string uuid) + { + return _impl.GetDescriptor(this, uuid); + } + + /// + /// Gets the list of descriptors that belongs to this characteristic. + /// + /// The list of descriptors that belongs to this characteristic. + public IEnumerable GetDescriptors() + { + return _impl.GetDescriptors(this); + } + + /// + /// Gets the service instance, which the specified characterstic belongs to. + /// + /// The characteristic instance, the specified characterstic belongs to. + public BluetoothGattService GetService() + { + return _parent; + } + + internal void SetParent(BluetoothGattService parent) + { + if (_parent == null) + { + _parent = parent; + ReleaseHandleOwnership(); + } + } + } + + /// + /// The Bluetooth GATT descriptor. + /// + public class BluetoothGattDescriptor : BluetoothGattAttribute + { + private BluetoothGattCharacteristic _parent = null; + private BluetoothGattDescriptorImpl _impl; + + /// + /// The constructor. + /// + /// The UUID of the descriptor. + /// Permissions for the descriptor. + /// The value associated with the descriptor. + /// throws in case of internal error. + /// Thrown when the create GATT descriptor procedure fails. + public BluetoothGattDescriptor(string uuid, BluetoothGattPermission permisions, byte[] value) : base (uuid, permisions) + { + _impl = new BluetoothGattDescriptorImpl(uuid, permisions, value); + } + + internal BluetoothGattDescriptor(BluetoothGattDescriptorImpl impl, string uuid, BluetoothGattPermission permission) : base(uuid, permission) + { + _impl = impl; + } + + internal override BluetoothGattClient Client + { + get + { + return _parent?.Client; + } + } + + internal override BluetoothGattServer Server + { + get + { + return _parent?.Server; + } + } + + internal override BluetoothGattAttributeImpl Impl + { + get + { + return _impl; + } + } + + /// + /// Gets the characteristic instance, which the specified descriptor belongs to. + /// + /// The characteristic instance, the specified descriptor belongs to. + public BluetoothGattCharacteristic GetCharacteristic() + { + return _parent; + } + + internal void SetParent(BluetoothGattCharacteristic parent) + { + if (_parent == null) + { + _parent = parent; + ReleaseHandleOwnership(); + } + } + } + + /// + /// The Bluetooth GATT attribute. + /// + public abstract class BluetoothGattAttribute + { + private Interop.Bluetooth.BtGattServerReadValueRequestedCallback _readValueRequestedCallback; + private Interop.Bluetooth.BtGattServerWriteValueRequestedCallback _writeValueRequestedCallback; + + private EventHandler _readValueRequested; + private EventHandler _writeValueRequested; + + public BluetoothGattAttribute(string uuid, BluetoothGattPermission permission) + { + Uuid = uuid; + Permissions = permission; + } + + // Events + + /// + /// This event is called when the client request to read the value of a characteristic or a descriptor. + /// + /// Thrown when the set read value requested callback procedure fails. + public event EventHandler ReadRequested + { + add + { + if (Server == null) return; + if (_readValueRequestedCallback == null) + { + _readValueRequestedCallback = (clientAddress, requestId, serverHandle, gattHandle, offset, userData) => + { + _readValueRequested?.Invoke(this, new ReadRequestedEventArgs(Server, clientAddress, requestId, offset)); + }; + Impl.SetReadValueRequestedEventCallback(_readValueRequestedCallback); + } + _readValueRequested = value; + } + remove + { + if (Server == null) return; + _readValueRequested = null; + // CAPI does not allow unsetting ReadValueRequestedEventCallback. + } + } + + /// + /// This event is called when a value of a characteristic or a descriptor has been changed by a client. + /// + /// Thrown when the set write value requested callback procedure fails. + public event EventHandler WriteRequested + { + add + { + if (Server == null) return; + if (_writeValueRequested == null) + { + _writeValueRequestedCallback = (clientAddress, requestId, serverHandle, gattHandle, offset, response_needed, valueToWrite, len, userData) => + { + _writeValueRequested?.Invoke(this, new WriteRequestedEventArgs(Server, clientAddress, requestId, valueToWrite, offset, response_needed)); + }; + Impl.SetWriteValueRequestedEventCallback(_writeValueRequestedCallback); + } + _writeValueRequested = value; + } + remove + { + if (Server == null) return; + _writeValueRequested = null; + // CAPI does not allow unsetting ReadValueRequestedEventCallback. + } + } + + /// + /// The attribute's UUID. + /// + public string Uuid { get; } + + /// + /// Permissions for this attribute. + /// + public BluetoothGattPermission Permissions { get; } + + /// + /// The value of this descriptor. + /// + public byte[] Value + { + get + { + return Impl.GetValue(); + } + set + { + Impl.SetValue(value); + } + } + + internal abstract BluetoothGattClient Client { get; } + internal abstract BluetoothGattServer Server { get; } + internal abstract BluetoothGattAttributeImpl Impl { get; } + + /// + /// Returns a string value at the specified offset. + /// + /// + /// The string value at specified offset. + public string GetValue(int offset) + { + return Impl.GetValue(offset); + } + + /// + /// Sets the string value as a specified offset. + /// + /// value to set + /// Throws exception if the value is null. + public void SetValue(string value) + { + if (string.IsNullOrEmpty(value)) + GattUtil.ThrowForError((int)BluetoothError.InvalidParameter, "value should not be null"); + + byte[] val = Encoding.UTF8.GetBytes(value); + Impl.SetValue(val); + } + + /// + /// Returns a value at specified offset as the int value of the specified type. + /// + /// The type of the int value. + /// An offset in the attribute value buffer. + /// The int value at given offset. + /// Throws exception if (offset + size of int value) is greater than the length of the value buffer. + public int GetValue(IntDataType type, int offset) + { + return Impl.GetValue(type, offset); + } + + /// + /// Updates a value at the specified offset by the int value of the specified type. + /// + /// The type of the int value. + /// The value to set. + /// An offset in the attribute value buffer. + /// Throws exception if (offset + size of int value) is greater than the length of the value buffer. + public void SetValue(IntDataType type, int value, int offset) + { + Impl.SetValue(type, value, offset); + } + + /// + /// Returns a value at the specified offset as the float value of the specified type. + /// + /// The type of the float value. + /// An offset in the attribute value buffer. + /// The float value at given offset. + /// Throws exception if (offset + size of float value) is greater than the length of the value buffer. + public float GetValue(FloatDataType type, int offset) + { + return Impl.GetValue(type, offset); + } + + /// + /// Updates the value at the specified offset by the float value of the specified type. + /// + /// The type of the float value. + /// The mantissa of the float value. + /// An exponent of the float value. + /// An offset in the attribute value buffer. + /// Throws exception if (offset + size of float value) is greater than the length of the value buffer. + public void SetValue(FloatDataType type, int mantissa, int exponent, int offset) + { + Impl.SetValue(type, mantissa, exponent, offset); + } + + internal void ReleaseHandleOwnership() + { + Impl.ReleaseHandleOwnership(); + } + + internal BluetoothGattAttributeHandle GetHandle() + { + return Impl.GetHandle(); + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGattImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGattImpl.cs new file mode 100644 index 0000000..39530db --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothGattImpl.cs @@ -0,0 +1,707 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Network.Bluetooth +{ + internal class BluetoothGattServerImpl + { + private BluetoothGattServerHandle _handle; + internal event EventHandler _notificationSent; + + internal BluetoothGattServerImpl() + { + int err = Interop.Bluetooth.BtGattServerInitialize(); + GattUtil.ThrowForError(err, "Failed to initialize server"); + + err = Interop.Bluetooth.BtGattServerCreate(out _handle); + GattUtil.ThrowForError(err, "Failed to create server"); + } + + internal void Start() + { + int err = Interop.Bluetooth.BtGattServerStart(); + GattUtil.ThrowForError(err, "Failed to start server"); + } + + internal void RegisterGattService(BluetoothGattServer server, BluetoothGattService service) + { + int err = Interop.Bluetooth.BtGattServerRegisterService(_handle, service.GetHandle()); + GattUtil.ThrowForError(err, "Failed to Register service"); + + service.SetParent(server); + } + + internal void UnregisterGattService(BluetoothGattService service) + { + int err = Interop.Bluetooth.BtGattServerUnregisterService(_handle, service.GetHandle()); + GattUtil.ThrowForError(err, "Failed to Unregister service"); + + service.UnregisterService(); + } + + internal void UnregisterAllGattServices(BluetoothGattServer server) + { + int err = Interop.Bluetooth.BtGattServerUnregisterAllServices(_handle); + GattUtil.ThrowForError(err, "Failed to Unregister all services"); + } + + internal BluetoothGattService GetService(BluetoothGattServer server, string uuid) + { + BluetoothGattAttributeHandle serviceHandle; + int err = Interop.Bluetooth.BtGattServerGetService(_handle, uuid, out serviceHandle); + if (err.IsFailed()) + { + GattUtil.Error(err, string.Format("Failed to get service with UUID ({0})", uuid)); + return null; + } + + BluetoothGattService service = new BluetoothGattService(new BluetoothGattServiceImpl(serviceHandle), uuid); ; + service.SetParent(server); + return service; + } + + internal IEnumerable GetServices(BluetoothGattServer server) + { + List attribututeList = new List(); + Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => + { + BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); + BluetoothGattService service = BluetoothGattServiceImpl.CreateBluetoothGattService(handle, ""); ; + if (service != null) + { + service.SetParent(server); + attribututeList.Add(service); + } + return true; + }; + + int err = Interop.Bluetooth.BtGattServerForeachServices(_handle, cb, IntPtr.Zero); + GattUtil.Error(err, "Failed to get all services"); + + return attribututeList; + } + + internal void SendResponse(int requestId, int request_type, int status, byte[] value, int offset) + { + int err = Interop.Bluetooth.BtGattServerSendResponse(requestId, request_type, offset, status, value, value.Length); + GattUtil.ThrowForError(err, string.Format("Failed to send response for request Id {0}", requestId)); + } + + internal void SendNotification(BluetoothGattCharacteristic characteristic, string clientAddress) + { + int err = Interop.Bluetooth.BtGattServerNotify(characteristic.GetHandle(), null, clientAddress, IntPtr.Zero); + GattUtil.ThrowForError(err, string.Format("Failed to send value changed notification for characteristic uuid {0}", characteristic.Uuid)); + } + + internal Task SendIndicationAsync(BluetoothGattServer server, BluetoothGattCharacteristic characteristic, string clientAddress) + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.Bluetooth.BtGattServerNotificationSentCallback cb = (result, address, serverHandle, characteristicHandle, completed, userData) => + { + _notificationSent?.Invoke(characteristic, new NotificationSentEventArg(server, address, result, completed)); + if (completed) + { + tcs.SetResult(true); + } + }; + + int err = Interop.Bluetooth.BtGattServerNotify(characteristic.GetHandle(), cb, clientAddress, IntPtr.Zero); + GattUtil.ThrowForError(err, string.Format("Failed to send value changed indication for characteristic uuid {0}", characteristic.Uuid)); + + return tcs.Task; + } + + internal BluetoothGattServerHandle GetHandle() + { + return _handle; + } + } + + internal class BluetoothGattClientImpl + { + private BluetoothGattClientHandle _handle; + + internal BluetoothGattClientImpl(string remoteAddress) + { + int err = Interop.Bluetooth.BtGattClientCreate(remoteAddress, out _handle); + GattUtil.ThrowForError(err, "Failed to get native client handle"); + } + + internal string GetRemoteAddress() + { + string remoteAddress; + int err = Interop.Bluetooth.BtGattClientGetRemoteAddress(_handle, out remoteAddress); + GattUtil.ThrowForError(err, "Failed to get remote address for this client"); + + return remoteAddress; + } + + internal BluetoothGattService GetService(BluetoothGattClient client, string uuid) + { + BluetoothGattAttributeHandle serviceHandle; + int err = Interop.Bluetooth.BtGattClientGetService(_handle, uuid, out serviceHandle); + if (err.IsFailed()) + { + GattUtil.Error(err, string.Format("Failed to get service with UUID ({0})", uuid)); + return null; + } + + BluetoothGattService service = new BluetoothGattService(new BluetoothGattServiceImpl(serviceHandle), uuid); ; + service.SetParent(client); + return service; + } + + internal IEnumerable GetServices(BluetoothGattClient client) + { + List attribututeList = new List(); + Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => + { + BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); + BluetoothGattService service = BluetoothGattServiceImpl.CreateBluetoothGattService(handle, ""); + if (service != null) + { + service.SetParent(client); + attribututeList.Add(service); + } + return true; + }; + + int err = Interop.Bluetooth.BtGattClientForeachServices(_handle, cb, IntPtr.Zero); + GattUtil.Error(err, "Failed to get all services"); + + return attribututeList; + } + + internal Task ReadValueAsyncTask(BluetoothGattAttributeHandle handle) + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.Bluetooth.BtGattClientRequestCompletedCallback cb = (result, requestHandle, userData) => + { + if (result == (int)BluetoothError.None) + tcs.SetResult(true); + else + tcs.SetResult(false); + }; + + int err = Interop.Bluetooth.BtGattClientReadValue(handle, cb, IntPtr.Zero); + if (err.IsFailed()) + { + GattUtil.Error(err, "Failed to read value from remote device"); + tcs.SetResult(false); + BluetoothErrorFactory.ThrowBluetoothException(err); + } + return tcs.Task; + } + + internal Task WriteValueAsyncTask(BluetoothGattAttributeHandle handle) + { + TaskCompletionSource tcs = new TaskCompletionSource(); + Interop.Bluetooth.BtGattClientRequestCompletedCallback cb = (result, requestHandle, userData) => + { + if (result == (int)BluetoothError.None) + tcs.SetResult(true); + else + tcs.SetResult(false); + }; + + int err = Interop.Bluetooth.BtGattClientWriteValue(handle, cb, IntPtr.Zero); + if (err.IsFailed()) + { + GattUtil.Error(err, "Failed to write value to remote device"); + tcs.SetResult(false); + BluetoothErrorFactory.ThrowBluetoothException(err); + } + return tcs.Task; + } + + internal BluetoothGattClientHandle GetHandle() + { + return _handle; + } + } + + internal class BluetoothGattServiceImpl : BluetoothGattAttributeImpl + { + internal BluetoothGattServiceImpl(string uuid, BluetoothGattServiceType type) + { + int err = Interop.Bluetooth.BtGattServiceCreate(uuid, (int)type, out _handle); + GattUtil.ThrowForError(err, "Failed to get native service handle"); + } + + internal BluetoothGattServiceImpl(BluetoothGattAttributeHandle handle) + { + _handle = handle; + } + + internal static BluetoothGattService CreateBluetoothGattService(BluetoothGattAttributeHandle handle, string uuid) + { + if (uuid == "") + { + int err = Interop.Bluetooth.BtGattGetUuid(handle, out uuid); + GattUtil.ThrowForError(err, "Failed to get UUID"); + } + + BluetoothGattServiceImpl impl = new BluetoothGattServiceImpl(handle); + return new BluetoothGattService(impl, uuid); + } + + internal void AddCharacteristic(BluetoothGattCharacteristic characteristic) + { + int err = Interop.Bluetooth.BtGattServiceAddCharacteristic(_handle, characteristic.GetHandle()); + GattUtil.ThrowForError(err, string.Format("Failed to add characteristic with UUID ({0})", characteristic.Uuid)); + } + + internal BluetoothGattCharacteristic GetCharacteristic(BluetoothGattService service, string uuid) + { + BluetoothGattAttributeHandle attributeHandle; + int err = Interop.Bluetooth.BtGattServiceGetCharacteristic(_handle, uuid, out attributeHandle); + if (err.IsFailed()) + { + GattUtil.Error(err, string.Format("Failed to get Characteristic with UUID ({0})", uuid)); + return null; + } + + BluetoothGattCharacteristic Characteristic = BluetoothGattCharacteristicImpl.CreateBluetoothGattGattCharacteristic(attributeHandle, uuid); + Characteristic.SetParent(service); + return Characteristic; + } + + internal IEnumerable GetCharacteristics(BluetoothGattService service) + { + List attribututeList = new List(); + Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => + { + BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); + BluetoothGattCharacteristic Characteristic = BluetoothGattCharacteristicImpl.CreateBluetoothGattGattCharacteristic(handle, ""); + if (Characteristic != null) + { + Characteristic.SetParent(service); + attribututeList.Add(Characteristic); + } + return true; + }; + + int err = Interop.Bluetooth.BtGattServiceForeachCharacteristics(service.GetHandle(), cb, IntPtr.Zero); + GattUtil.Error(err, "Failed to get all Characteristic"); + + return attribututeList; + } + + internal void AddIncludeService(BluetoothGattService includedService) + { + int err = Interop.Bluetooth.BtGattServiceAddIncludedService(_handle, includedService.GetHandle()); + GattUtil.ThrowForError(err, string.Format("Failed to add service with UUID ({0})", includedService.Uuid)); + } + + internal BluetoothGattService GetIncludeService(BluetoothGattService parentService, string uuid) + { + BluetoothGattAttributeHandle attributeHandle; + int err = Interop.Bluetooth.BtGattServiceGetIncludedService(_handle, uuid, out attributeHandle); + if (err.IsFailed()) + { + GattUtil.Error(err, string.Format("Failed to get included service with UUID ({0})", uuid)); + return null; + } + + BluetoothGattService service = new BluetoothGattService(new BluetoothGattServiceImpl(attributeHandle), uuid); + service.SetParent(parentService); + return service; + } + + internal IEnumerable GetIncludeServices(BluetoothGattService parentService) + { + List attribututeList = new List(); + Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => + { + BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); + BluetoothGattService service = BluetoothGattServiceImpl.CreateBluetoothGattService(handle, ""); + if (service != null) + { + service.SetParent(parentService); + attribututeList.Add(service); + } + return true; + }; + + int err = Interop.Bluetooth.BtGattServiceForeachIncludedServices(parentService.GetHandle(), cb, IntPtr.Zero); + GattUtil.Error(err, "Failed to get all services"); + + return attribututeList; + } + } + + internal class BluetoothGattCharacteristicImpl : BluetoothGattAttributeImpl + { + internal BluetoothGattCharacteristicImpl(string uuid, BluetoothGattPermission permission, BluetoothGattProperty property, byte[] value) + { + int err = Interop.Bluetooth.BtGattCharacteristicCreate(uuid, (int)permission, (int)property, value, value.Length, out _handle); + GattUtil.ThrowForError(err, "Failed to get native characteristic handle"); + } + + internal BluetoothGattCharacteristicImpl(BluetoothGattAttributeHandle handle) + { + _handle = handle; + } + + internal static BluetoothGattCharacteristic CreateBluetoothGattGattCharacteristic(BluetoothGattAttributeHandle handle, string uuid) + { + int permission; + int err = Interop.Bluetooth.BtGattCharacteristicGetPermissions(handle, out permission); + GattUtil.ThrowForError(err, "Failed to get permissions"); + + if (uuid == "") + { + err = Interop.Bluetooth.BtGattGetUuid(handle, out uuid); + GattUtil.ThrowForError(err, "Failed to get UUID"); + } + + BluetoothGattCharacteristicImpl impl = new BluetoothGattCharacteristicImpl(handle); + return new BluetoothGattCharacteristic(impl, uuid, (BluetoothGattPermission)permission); + } + + internal void SetCharacteristicValueChangedEvent(Interop.Bluetooth.BtClientCharacteristicValueChangedCallback callback) + { + int err = Interop.Bluetooth.BtGattClientSetCharacteristicValueChangedCallback(_handle, callback, IntPtr.Zero); + GattUtil.Error(err, "Failed to set client characteristic value changed callback"); + } + + internal void UnsetCharacteristicValueChangedEvent() + { + int err = Interop.Bluetooth.BtGattClientUnsetCharacteristicValueChangedCallback(_handle); + GattUtil.Error(err, "Failed to unset client characteristic value changed callback"); + } + + internal void SetNotificationStateChangedEvent(Interop.Bluetooth.BtGattServerNotificationStateChangeCallback callback) + { + int err = Interop.Bluetooth.BtGattServeSetNotificationStateChangeCallback(_handle, callback, IntPtr.Zero); + GattUtil.Error(err, "Failed to set characteristic notification state changed callback"); + } + + internal BluetoothGattProperty GetProperties() + { + int properties = 0 ; + int err = Interop.Bluetooth.BtGattCharacteristicGetProperties(_handle, out properties); + GattUtil.Error(err, "Failed to get characteristic properties"); + return (BluetoothGattProperty)properties; + } + + internal void SetProperties(BluetoothGattProperty perperties) + { + int err = Interop.Bluetooth.BtGattCharacteristicSetProperties(_handle, (int)perperties); + GattUtil.Error(err, "Failed to set characteristic properties"); + } + + internal BluetoothGattWriteType GetWriteType() + { + int writeType; + int err = Interop.Bluetooth.BtGattCharacteristicGetWriteType(_handle, out writeType); + GattUtil.Error(err, "Failed to get characteristic writetype"); + return (BluetoothGattWriteType) writeType; + } + + internal void SetWriteType(BluetoothGattWriteType writeType) + { + int err = Interop.Bluetooth.BtGattCharacteristicSetWriteType(_handle, (int)writeType); + GattUtil.Error(err, "Failed to get characteristic writetype"); + } + + internal void AddDescriptor(BluetoothGattDescriptor descriptor) + { + int err = Interop.Bluetooth.BtGattCharacteristicAddDescriptor(_handle, descriptor.GetHandle()); + GattUtil.ThrowForError(err, string.Format("Failed to add descriptor with UUID ({0})", descriptor.Uuid)); + } + + internal BluetoothGattDescriptor GetDescriptor(BluetoothGattCharacteristic characteristic, string uuid) + { + BluetoothGattAttributeHandle handle; + int err = Interop.Bluetooth.BtGattCharacteristicGetDescriptor(_handle, uuid, out handle); + if (err.IsFailed()) + { + GattUtil.Error(err, string.Format("Failed to get descriptor with UUID ({0})", uuid)); + return null; + } + BluetoothGattDescriptor descriptor = BluetoothGattDescriptorImpl.CreateBluetoothGattDescriptor(handle, uuid); + descriptor.SetParent(characteristic); + return descriptor; + } + + internal IEnumerable GetDescriptors(BluetoothGattCharacteristic characteristic) + { + List attribututeList = new List(); + Interop.Bluetooth.BtGattForeachCallback cb = (total, index, attributeHandle, userData) => + { + BluetoothGattAttributeHandle handle = new BluetoothGattAttributeHandle(attributeHandle, false); + BluetoothGattDescriptor descriptor = BluetoothGattDescriptorImpl.CreateBluetoothGattDescriptor(handle, ""); + if (descriptor != null) + { + descriptor.SetParent(characteristic); + attribututeList.Add(descriptor); + } + return true; + }; + + int err = Interop.Bluetooth.BtGattCharacteristicForeachDescriptors(characteristic.GetHandle(), cb, IntPtr.Zero); + GattUtil.Error(err, "Failed to get all descriptor"); + + return attribututeList; + } + } + + internal class BluetoothGattDescriptorImpl : BluetoothGattAttributeImpl + { + internal BluetoothGattDescriptorImpl(string uuid, BluetoothGattPermission permission, byte[] value) + { + int err = Interop.Bluetooth.BtGattDescriptorCreate(uuid, (int)permission, value, value.Length, out _handle); + GattUtil.ThrowForError(err, "Failed to get native descriptor handle"); + } + + internal BluetoothGattDescriptorImpl(BluetoothGattAttributeHandle handle) + { + _handle = handle; + } + + internal static BluetoothGattDescriptor CreateBluetoothGattDescriptor(BluetoothGattAttributeHandle handle, string uuid) + { + int permission; + int err = Interop.Bluetooth.BtGattDescriptorGetPermissions(handle, out permission); + GattUtil.ThrowForError(err, string.Format("Failed to get permissions with UUID ({0})", uuid)); + + if (uuid == "") + { + int ret = Interop.Bluetooth.BtGattGetUuid(handle, out uuid); + GattUtil.ThrowForError(ret, "Failed to get UUID"); + } + + BluetoothGattDescriptorImpl impl = new BluetoothGattDescriptorImpl(handle); + return new BluetoothGattDescriptor(impl, uuid, (BluetoothGattPermission)permission); + } + } + + internal abstract class BluetoothGattAttributeImpl + { + protected BluetoothGattAttributeHandle _handle; + + internal string GetUuid() + { + string uuid; + int err = Interop.Bluetooth.BtGattGetUuid(_handle, out uuid); + GattUtil.Error(err, "Failed to get attribute uuid"); + + return uuid; + } + + internal byte[] GetValue() + { + IntPtr nativeValue; + int nativeValueLength; + int err = Interop.Bluetooth.BtGattGetValue(_handle, out nativeValue, out nativeValueLength); + GattUtil.Error(err, "Failed to get attribute value"); + + return GattUtil.IntPtrToByteArray(nativeValue, nativeValueLength); + } + + internal void SetValue(byte[] value) + { + int err = Interop.Bluetooth.BtGattSetValue(_handle, value, value.Length); + GattUtil.ThrowForError(err, "Failed to set attribute value"); + } + + internal string GetValue(int offset) + { + byte[] value = GetValue(); + + int nullPos = value.Length - offset; + for (int i = offset; i < value.Length; ++i) + { + if (value[i] == '\0') + { + nullPos = i; + break; + } + } + + string strValue = ""; + strValue = Encoding.UTF8.GetString(value, offset, nullPos - offset); + return strValue; + } + + internal int GetValue(IntDataType type, int offset) + { + int value; + int err = Interop.Bluetooth.BtGattGetIntValue(_handle, (int)type, offset, out value); + GattUtil.Error(err, "Failed to get attribute int value at offset"); + return value; + } + + internal void SetValue(IntDataType type, int value, int offset) + { + int err = Interop.Bluetooth.BtGattSetIntValue(_handle, (int)type, value, offset); + GattUtil.ThrowForError(err, "Failed to set attribute int value at offset"); + } + + internal float GetValue(FloatDataType type, int offset) + { + float value; + int err = Interop.Bluetooth.BtGattGetFloatValue(_handle, (int)type, offset, out value); + GattUtil.Error(err, "Failed to get attribute float value at offset"); + return value; + } + + internal void SetValue(FloatDataType type, int mantissa, int exponent, int offset) + { + int err = Interop.Bluetooth.BtGattSetFloatValue(_handle, (int)type, mantissa, exponent, offset); + GattUtil.ThrowForError(err, "Failed to set attribute float value at offset"); + } + + internal void SetReadValueRequestedEventCallback(Interop.Bluetooth.BtGattServerReadValueRequestedCallback callback) + { + int err = Interop.Bluetooth.BtGattServerSetReadValueRequestedCallback(_handle, callback, IntPtr.Zero); + GattUtil.ThrowForError(err, "Failed to set attribute read value requested callback"); + } + + internal void SetWriteValueRequestedEventCallback(Interop.Bluetooth.BtGattServerWriteValueRequestedCallback callback) + { + int err = Interop.Bluetooth.BtGattServerSetWriteValueRequestedCallback(_handle, callback, IntPtr.Zero); + GattUtil.ThrowForError(err, "Failed to set attribute write value requested callback"); + } + + internal BluetoothGattAttributeHandle GetHandle() + { + return _handle; + } + + internal void ReleaseHandleOwnership() + { + _handle.ReleaseOwnership(); + } + } + + + internal class BluetoothGattAttributeHandle : BluetoothGattHandle + { + public BluetoothGattAttributeHandle(IntPtr nativeHandle, bool hasOwnership) : base(nativeHandle, hasOwnership) + { + } + + public BluetoothGattAttributeHandle() + { + } + + protected override bool ReleaseHandle() + { + if (_hasOwnership == true) + { + Interop.Bluetooth.BtGattDestroy(handle); + } + SetHandle(IntPtr.Zero); + return true; + } + } + + internal class BluetoothGattClientHandle : BluetoothGattHandle + { + protected override bool ReleaseHandle() + { + if (_hasOwnership == true) + { + Interop.Bluetooth.BtGattClientDestroy(handle); + } + SetHandle(IntPtr.Zero); + return true; + } + } + + internal class BluetoothGattServerHandle : BluetoothGattHandle + { + protected override bool ReleaseHandle() + { + if (_hasOwnership == true) + { + Interop.Bluetooth.BtGattServerDeinitialize(); + Interop.Bluetooth.BtGattServerDestroy(handle); + } + SetHandle(IntPtr.Zero); + return true; + } + } + + internal abstract class BluetoothGattHandle : SafeHandle + { + protected bool _hasOwnership; + + public BluetoothGattHandle() : base(IntPtr.Zero, true) + { + _hasOwnership = true; + } + + public BluetoothGattHandle(IntPtr nativeHandle, bool hasOwnership) : base(nativeHandle, true) + { + _hasOwnership = hasOwnership; + } + + public override bool IsInvalid + { + get { return handle == IntPtr.Zero; } + } + + public void ReleaseOwnership() + { + _hasOwnership = false; + } + } + + internal static class GattUtil + { + internal static byte[] IntPtrToByteArray(IntPtr nativeValue, int lenght) + { + byte[] value = new byte[lenght]; + if (nativeValue != IntPtr.Zero) + { + Marshal.Copy(nativeValue, value, 0, lenght); + } + return value; + } + + internal static void Error(int err, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Error(Globals.LogTag, string.Format("{0}, err: {1}", message, (BluetoothError)err), file, func, line); + } + } + + internal static void ThrowForError(int err, string message, [CallerFilePath] string file = "", [CallerMemberName] string func = "", [CallerLineNumber] int line = 0) + { + if (err.IsFailed()) + { + Log.Error(Globals.LogTag, string.Format("{0}, err: {1}", message, (BluetoothError)err), file, func, line); + BluetoothErrorFactory.ThrowBluetoothException(err); + } + } + + internal static bool IsFailed(this int err) + { + return err != (int)BluetoothError.None; + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHid.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHid.cs new file mode 100644 index 0000000..c35a963 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHid.cs @@ -0,0 +1,79 @@ +using System; + +namespace Tizen.Network.Bluetooth +{ + /// + /// A class which is used to handle the connection to Bluetooth HID like keyboards and mouse. + /// + /// http://tizen.org/privilege/bluetooth + public class BluetoothHid : BluetoothProfile + { + internal BluetoothHid() + { + } + + /// + /// The HidConnectionStateChanged event is called when the HID host connection state is changed. + /// + public event EventHandler HidConnectionStateChanged + { + add + { + BluetoothHidImpl.Instance.HidConnectionStateChanged += value; + } + remove + { + BluetoothHidImpl.Instance.HidConnectionStateChanged -= value; + } + } + + /// + /// Connects the remote device with the HID service. + /// + /// + /// The device must be bonded with the remote device by CreateBond(). + /// If connection request succeeds, the HidConnectionStateChanged event will be invoked. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the connection attempt to the remote device fails. + public void Connect() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothHidImpl.Instance.Connect(RemoteAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to Connect - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Disconnects the remote device with the HID service. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the disconnection attempt to the remote device fails. + public void Disconnect() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothHidImpl.Instance.Disconnect(RemoteAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to Disconnect - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } +} + diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHidImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHidImpl.cs new file mode 100644 index 0000000..6a1401e --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothHidImpl.cs @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Bluetooth +{ + internal class BluetoothHidImpl : IDisposable + { + private event EventHandler _hidConnectionChanged; + private Interop.Bluetooth.HidConnectionStateChangedCallback _hidConnectionChangedCallback; + + private static readonly BluetoothHidImpl _instance = new BluetoothHidImpl(); + private bool disposed = false; + + internal event EventHandler HidConnectionStateChanged + { + add + { + _hidConnectionChanged += value; + } + remove + { + //nothing to be done + } + } + + internal int Connect(string deviceAddress) + { + if (Globals.IsHidInitialize) + { + int ret = Interop.Bluetooth.Connect (deviceAddress); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to connect device with the hid service, Error - " + (BluetoothError)ret); + } + return ret; + } + return (int)BluetoothError.NotInitialized; + } + + internal int Disconnect(string deviceAddress) + { + if (Globals.IsHidInitialize) + { + int ret = Interop.Bluetooth.Disconnect (deviceAddress); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to disconnect device with the hid service, Error - " + (BluetoothError)ret); + } + return ret; + } + return (int)BluetoothError.NotInitialized; + } + + internal static BluetoothHidImpl Instance + { + get + { + return _instance; + } + } + private BluetoothHidImpl () + { + initialize(); + } + ~BluetoothHidImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + deinitialize(); + disposed = true; + } + + private void initialize() + { + if (Globals.IsInitialize) + { + _hidConnectionChangedCallback = (int result, bool connected, string deviceAddress, IntPtr userData) => + { + if (_hidConnectionChanged != null) + { + _hidConnectionChanged(null, new HidConnectionStateChangedEventArgs(result, connected, deviceAddress)); + } + }; + + int ret = Interop.Bluetooth.InitializeHid (_hidConnectionChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to initialize bluetooth hid, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + else + { + Globals.IsHidInitialize = true; + } + } + else + { + Log.Error(Globals.LogTag, "Failed to initialize HID, BT not initialized"); + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotInitialized); + } + } + + private void deinitialize() + { + if (Globals.IsHidInitialize) + { + int ret = Interop.Bluetooth.DeinitializeHid (); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to deinitialize bluetooth hid, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } else { + Globals.IsHidInitialize = false; + } + } + } + } +} + diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapter.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapter.cs new file mode 100644 index 0000000..a700c44 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapter.cs @@ -0,0 +1,831 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth { + + /// + /// This is the BluetoothLeAdvertiser class. It handles the LE advertising operation amd callback. + /// + public class BluetoothLeAdvertiser + { + private static readonly BluetoothLeAdvertiser _instance = new BluetoothLeAdvertiser(); + + internal static BluetoothLeAdvertiser Instance + { + get + { + return _instance; + } + } + + private BluetoothLeAdvertiser() + { + } + + /// + /// This event is called when the LE advertising state changes. + /// + public event EventHandler AdvertisingStateChanged + { + add + { + BluetoothLeImplAdapter.Instance.AdapterLeAdvertisingStateChanged += value; + } + remove + { + BluetoothLeImplAdapter.Instance.AdapterLeAdvertisingStateChanged -= value; + } + } + /// + /// Starts advertising using the advertise data object. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The advertiser object carrying information of the advertising. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public void StartAdvertising(BluetoothLeAdvertiseData advertiseData) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.StartAdvertising (advertiseData.GetHandle ()); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to start advertising- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Stops the advertising. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The advertiser object carrying information of the advertising. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public void StopAdvertising(BluetoothLeAdvertiseData advertiseData) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.StopAdvertising (advertiseData.GetHandle ()); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to stop advertising operation- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } + + /// + /// This is the BluetoothLeDevice class. + /// It handles the LE device operations like getting data from the scan result information. + /// + public class BluetoothLeDevice + { + //properties of Bluetoothlesacandata + private string _remoteAddress; + private BluetoothLeDeviceAddressType _addressType; + private int _rssi; + private byte[] _advDataValue; + private byte[] _scanDataValue; + private BluetoothLePacketType _packetType; + private BluetoothLeScanData _scanData; + + /// + /// This event is called when the GATT client connects/disconnects with the server. + /// + public event EventHandler GattConnectionStateChanged + { + add + { + BluetoothLeImplAdapter.Instance.LeGattConnectionStateChanged += value; + } + remove + { + BluetoothLeImplAdapter.Instance.LeGattConnectionStateChanged -= value; + } + } + + internal BluetoothLeDevice(BluetoothLeScanData scanData) + { + _scanData = new BluetoothLeScanData (); + _scanData = scanData; + + Log.Info (Globals.LogTag, "Rssi" + _scanData.Rssi); + _rssi = scanData.Rssi; + Log.Info (Globals.LogTag, "RemoteAddress" + _scanData.RemoteAddress); + if (scanData.RemoteAddress != null) + _remoteAddress = scanData.RemoteAddress; + Log.Info (Globals.LogTag, "AddressType" + _scanData.AddressType); + _addressType = scanData.AddressType; + + Log.Info (Globals.LogTag, "AdvDataLength" + _scanData.AdvDataLength); + if (_scanData.AdvDataLength > 0) + { + _advDataValue = new byte[_scanData.AdvDataLength]; + scanData.AdvData.CopyTo(_advDataValue, 0); + } + + Log.Info(Globals.LogTag, "ScanDataLength" + _scanData.ScanDataLength); + // Check length before copying + if (_scanData.ScanDataLength > 0) + { + _scanDataValue = new byte[_scanData.ScanDataLength]; + scanData.ScanData.CopyTo(_scanDataValue, 0); + } + } + + ~BluetoothLeDevice() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + BluetoothLeImplAdapter.Instance.FreeServiceDataList(); + } + } + + /// + /// The remote address. + /// + public string RemoteAddress + { + get + { + return _remoteAddress; + } + } + + /// + /// The type of the address. + /// + public BluetoothLeDeviceAddressType AddressType + { + get + { + return _addressType; + } + } + + /// + /// The rssi value. + /// + public int Rssi + { + get + { + return _rssi; + } + } + + /// + /// The advertsing data information. + /// + public byte[] AdvertsingDataInformation + { + get + { + return _advDataValue; + } + } + + /// + /// The scan data information. + /// + public byte[] ScanDataInformation + { + get + { + return _scanDataValue; + } + } + + /// + /// The type of the packet. + /// + public BluetoothLePacketType PacketType + { + get + { + return _packetType; + } + set + { + _packetType = value; + } + } + + /// + /// Gets the service UUIDs list from the LE scan result information. + /// + /// Gets the list of the string service UUIDs. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public IEnumerable ServiceUuid + { + get + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + Log.Info(Globals.LogTag, "Retrieving Service uuid- "); + return BluetoothLeImplAdapter.Instance.GetLeScanResultServiceUuids(_scanData, _packetType); + } + return null; + } + } + + /// + /// Gets the device name from the LE scan result information. + /// + /// Gets the device name. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public string DeviceName + { + get + { + Log.Info(Globals.LogTag, "Retrieving device name- "); + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetLeScanResultDeviceName(_scanData, _packetType); + } + return null; + } + } + /// + /// Gets the transmission power level from the LE scan result information. + /// + /// Gets the transmission power level in dB. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public int TxPowerLevel + { + get + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetScanResultTxPowerLevel(_scanData, _packetType); + } + return -1; + } + } + + /// + /// Gets the service solicitation UUID list from the scan result information. + /// + /// Gets the list of the service solicitation UUIDs. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public IEnumerable ServiceSolictationUuid + { + get + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetScanResultSvcSolicitationUuids(_scanData, _packetType); + } + return null; + } + } + /// + /// Gets the manufacturer data from the scan result information. + /// + /// Gets the appearance value. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public int Appearance + { + get + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetScanResultAppearance(_scanData, _packetType); + } + return -1; + } + } + /// + /// Gets the manufacturer data from the scan result information. + /// + /// Gets the manufacturer data containing the manucturer data and ID information. + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled./// + public ManufacturerData ManufacturerData + { + get + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetScanResultManufacturerData(_scanData, _packetType); + } + return null; + } + } + + /// + /// Gets the service data list from the scan result information. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Returns the service data list. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled. + public IEnumerable GetServiceDataList() + { + int serviceCount = 0; + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + return BluetoothLeImplAdapter.Instance.GetScanResultServiceDataList(_scanData, + _packetType, out serviceCount); + } + return null; + } + + + /// + /// Creates a GATT connection with the remote device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The auto connect flag. + /// client instance + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the gatt connection attempt to remote device fails. + public BluetoothGattClient GattConnect(bool autoConnect) + { + BluetoothGattClient client = null; + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.GattConnect (_remoteAddress, autoConnect); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to create GATT Connection with remote device- " + (BluetoothError)ret); + } + else + { + client = BluetoothGattClient.CreateClient(_remoteAddress); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + return client; + } + + /// + /// Disconnects a GATT connection with the remote device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the GATT disconnection attempt to remote device fails. + public void GattDisconnect() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = BluetoothLeImplAdapter.Instance.GattDisconnect (_remoteAddress); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to disconnect GATT connection with remote device- " + (BluetoothError)ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } + + /// + /// Bluetooth LE advertise data. Handles the data advertising. + /// + public class BluetoothLeAdvertiseData:IDisposable + { + private IntPtr _handle = IntPtr.Zero; + private BluetoothLeAdvertisingMode _mode; + private bool _advertisingConnectable; + private BluetoothLePacketType _packetType; + private int _appearance; + private bool _includePowerLevel; + private bool _includeDeviceName; + + /// + /// The default constructor initializes an object of the BluetoothLeAdvertiseData. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when create advertiser fails. + public BluetoothLeAdvertiseData() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + Log.Debug(Globals.LogTag, " Creating LeAdvertiser()"); + int ret = Interop.Bluetooth.CreateAdvertiser(out _handle); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to create advertiser object- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + ~BluetoothLeAdvertiseData() + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + //clean-up + ClearAdvertisingData (BluetoothLePacketType.BluetoothLeAdvertisingPacket); + ClearAdvertisingData (BluetoothLePacketType.BluetoothLeScanResponsePacket); + BluetoothLeImplAdapter.Instance.DestroyAdvertiser (_handle); + } + Dispose(false); + } + + internal IntPtr GetHandle() + { + return _handle; + } + + /// + /// The advertising mode to control the advertising power and latency. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the set advertising mode fails. + public BluetoothLeAdvertisingMode AdvertisingMode + { + get + { + return _mode; + } + set + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + _mode = value; + int ret = Interop.Bluetooth.SetAdvertisingMode (GetHandle (), _mode); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to set advertising mode- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + } + } + } + + /// + /// The advertising connectable type. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the set advertising connectable mode fails. + public bool AdvertisingConnectable + { + get + { + return _advertisingConnectable; + } + set + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + _advertisingConnectable = value; + int ret = Interop.Bluetooth.SetAdvertisingConnectable (GetHandle (), _advertisingConnectable); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to set advertising connectable value- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + } + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + //todo... + } + + /// + /// The type of the packet. + /// + public BluetoothLePacketType PacketType + { + get + { + return _packetType; + } + set + { + _packetType = value; + } + } + /// + /// Sets the external appearance of this device to the advertise or the scan response data. + /// Please refer to the adopted Bluetooth specification for the appearance. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the set appearance fails. + public int Appearance + { + get + { + return _appearance; + } + set + { + _appearance = value; + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) { + int ret = Interop.Bluetooth.SetAdvertisingAppearance (GetHandle (), _packetType, _appearance); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to add appearance value to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + } + /// + /// Sets whether the device name has to be included in the advertise or the scan response data. + /// The maximum advertised or responded data size is 31 bytes including the data type and the system wide data. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the set advertising device name fails. + public bool IncludeDeviceName + { + get + { + return _includeDeviceName; + } + set + { + _includeDeviceName = value; + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = Interop.Bluetooth.SetAdvertisingDeviceName(GetHandle(), _packetType, _includeDeviceName); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to add device name to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + } + } + + + /// + /// Sets whether the transmission power level should be included in the advertise or the scan response data. + /// The maximum advertised or responded data size is 31 bytes including the data type and the system wide data. + /// + /// + /// The Bluetooth must be enabled. + /// + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the set advertising TC power level fails. + public bool IncludeTxPowerLevel + { + get + { + return _includePowerLevel; + } + set + { + _includePowerLevel = value; + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = Interop.Bluetooth.SetAdvertisingTxPowerLevel(GetHandle(), _packetType, _includePowerLevel); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to add advertising service solicitation uuid- " + (BluetoothError)ret); + } + } + } + } + /// + /// Adds a service UUID to the advertise or the scan response data. + /// The maximum advertised or responded data size is 31 bytes + /// including the data type and the system wide data. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The packet type. + /// The service UUID to add to advertise data. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the add advertising service UUID procedure fails. + public void AddAdvertisingServiceUuid(BluetoothLePacketType packetType, string serviceUuid) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = Interop.Bluetooth.AddAdvertisingServiceUuid (GetHandle (), packetType, serviceUuid); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to add service uuid to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Adds a service solicitation UUID to advertise or scan the response data. + /// The maximum advertised or responded data size is 31 bytes + /// including the data type and the system wide data. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The packet type. + /// The service solicitation UUID to add to advertise data. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the add advertising service solicitation UUID procedure fails. + public void AddAdvertisingServiceSolicitationUuid(BluetoothLePacketType packetType, + string serviceSolicitationUuid) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = Interop.Bluetooth.AddAdvertisingServiceSolicitationUuid(GetHandle(), packetType, + serviceSolicitationUuid); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to add service solicitation uuid to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Adds a service data to the advertise or the scan response data. + /// The maximum advertised or responded data size is 31 bytes + /// including data type and system wide data. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The packet type. + /// The service data to be added to advertising. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the add advertising data procedure fails. + public void AddAdvertisingServiceData(BluetoothLePacketType packetType, BluetoothServiceData data) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + IntPtr serviceDataPtr; + serviceDataPtr = Marshal.AllocHGlobal(data.DataLength); + Marshal.Copy(data.Data, 0, serviceDataPtr, data.DataLength); + + for (int i = 0; i < 3; i++) + Log.Error (Globals.LogTag, " service data is " + data.Data [i]); + int ret = Interop.Bluetooth.AddAdvertisingServiceData(GetHandle(), packetType, + data.Uuid, serviceDataPtr, data.DataLength); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to add service data to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Adds the manufacturer specific data to the advertise or the scan response data. + /// Please refer to the adopted Bluetooth specification for the the appearance. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The packet type. + /// The manufacturer specific data. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the add advertising manufacturer data procedure fails. + public void AddAdvertisingManufacturerData(BluetoothLePacketType packetType, + ManufacturerData manufacturerData) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + IntPtr manufDataPtr; + manufDataPtr = Marshal.AllocHGlobal(manufacturerData.DataLength); + Marshal.Copy(manufacturerData.Data, 0, manufDataPtr, manufacturerData.DataLength); + + int ret = Interop.Bluetooth.AddAdvertisingManufData(GetHandle(), packetType, + manufacturerData.Id, manufDataPtr, manufacturerData.DataLength); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to add service solicitation uuid to advertising data- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + + /// + /// Clears all data to be advertised or responded to the scan request from the LE scanning device. + /// + /// + /// The Bluetooth must be enabled. + /// + /// The packet type to be cleared. + /// Thrown when the Bluetooth LE is not supported. + /// Thrown when the Bluetooth LE is not enabled + /// or when the clear advertising data procedure fails. + internal void ClearAdvertisingData(BluetoothLePacketType packetType) + { + if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize) + { + int ret = Interop.Bluetooth.ClearAdvertisingData (GetHandle (), packetType); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to Clear Advertising Data- " + (BluetoothError)ret); + } + } + else + { + BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs new file mode 100644 index 0000000..1fb02de --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothLeAdapterImpl.cs @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth +{ + internal class BluetoothLeImplAdapter : IDisposable + { + private static readonly BluetoothLeImplAdapter _instance = new BluetoothLeImplAdapter(); + + private bool disposed = false; + + private event EventHandler _adapterLeScanResultChanged = null; + private Interop.Bluetooth.AdapterLeScanResultChangedCallBack _adapterLeScanResultChangedCallback; + + private event EventHandler _advertisingStateChanged = null; + private Interop.Bluetooth.AdvertisingStateChangedCallBack _advertisingStateChangedCallback; + + private event EventHandler _gattConnectionStateChanged = null; + private Interop.Bluetooth.GattConnectionStateChangedCallBack _gattConnectionStateChangedCallback; + + private int _serviceListCount = 0; + private IList _list = new List(); + private bool _scanStarted; + + internal static BluetoothLeImplAdapter Instance + { + get + { + return _instance; + } + } + + private BluetoothLeImplAdapter() + { + } + + ~BluetoothLeImplAdapter() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + if (_gattConnectionStateChanged != null) + { + UnRegisterGattConnectionStateChangedEvent(); + } + + //stop scan operation in progress + StopScan (); + + disposed = true; + } + + internal event EventHandler AdapterLeScanResultChanged + { + add + { + _adapterLeScanResultChanged += value; + } + remove { + _adapterLeScanResultChanged -= value; + } + } + + internal event EventHandler AdapterLeAdvertisingStateChanged + { + add + { + _advertisingStateChanged += value; + } + remove + { + _advertisingStateChanged -= value; + } + } + + internal event EventHandler LeGattConnectionStateChanged + { + add + { + if (_gattConnectionStateChanged == null) + { + RegisterGattConnectionStateChangedEvent(); + } + _gattConnectionStateChanged += value; + } + remove + { + _gattConnectionStateChanged -= value; + if (_gattConnectionStateChanged == null) + { + UnRegisterGattConnectionStateChangedEvent(); + } + } + } + + internal void RegisterGattConnectionStateChangedEvent() + { + _gattConnectionStateChangedCallback = (int result, bool connected, + string remoteDeviceAddress, IntPtr userData) => + { + if (_gattConnectionStateChanged != null) + { + Log.Info(Globals.LogTag, "Setting gatt connection state changed callback" ); + GattConnectionStateChangedEventArgs e = new GattConnectionStateChangedEventArgs (result, + connected, remoteDeviceAddress); + + _gattConnectionStateChanged(null, e); + } + }; + + int ret = Interop.Bluetooth.SetGattConnectionStateChangedCallback( + _gattConnectionStateChangedCallback, IntPtr.Zero); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set gatt connection state changed callback, Error - " + (BluetoothError)ret); + } + } + + internal void UnRegisterGattConnectionStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetGattConnectionStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset gatt connection state changed callback, Error - " + (BluetoothError)ret); + } + } + + internal int StartScan() + { + _adapterLeScanResultChangedCallback = (int result, ref BluetoothLeScanDataStruct scanData, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Inside Le scan callback " ); + BluetoothLeScanData scanDataInfo = BluetoothUtils.ConvertStructToLeScanData(scanData); + + BluetoothLeDevice device = new BluetoothLeDevice(scanDataInfo); + BluetoothError res = (BluetoothError)result; + + AdapterLeScanResultChangedEventArgs e = new AdapterLeScanResultChangedEventArgs (res, + device); + _adapterLeScanResultChanged (null, e); + }; + + IntPtr data = IntPtr.Zero; + int ret = Interop.Bluetooth.StartScan(_adapterLeScanResultChangedCallback, data); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to start BLE scan - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + _scanStarted = true; + return ret; + } + + internal int StopScan() + { + int ret = (int)BluetoothError.None; + + if (_scanStarted) + { + ret = Interop.Bluetooth.StopScan (); + if (ret != (int)BluetoothError.None) { + Log.Error (Globals.LogTag, "Failed to stop BLE scan - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException (ret); + } + } + return ret; + } + + internal IList GetLeScanResultServiceUuids(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + IntPtr uuidListArray = IntPtr.Zero; + int count = -1; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData); + + int ret = Interop.Bluetooth.GetScanResultServiceUuid(ref scanDataStruct, packetType, + ref uuidListArray, ref count); + if (ret != (int)BluetoothError.None) + { + Log.Info(Globals.LogTag, "Failed to service uuids list- " + (BluetoothError)ret); + return null; + } + + Log.Info(Globals.LogTag, "count of uuids : " + count); + + IntPtr[] uuidList = new IntPtr[count]; + Marshal.Copy(uuidListArray, uuidList, 0, count); + IList list = new List(); + foreach(IntPtr uuids in uuidList) + { + list.Add(Marshal.PtrToStringAnsi(uuids)); + Interop.Libc.Free(uuids); + } + + Interop.Libc.Free(uuidListArray); + return list; + } + + internal string GetLeScanResultDeviceName(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + string deviceName; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData); + + int ret = Interop.Bluetooth.GetLeScanResultDeviceName(ref scanDataStruct, packetType, out deviceName); + if (ret != (int)BluetoothError.None) { + Log.Error(Globals.LogTag, "Failed to get Device name- " + (BluetoothError)ret); + return null; + } + Log.Info (Globals.LogTag, "Device name " + deviceName); + return deviceName; + } + + internal int GetScanResultTxPowerLevel(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + int powerLevel = -1; + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData); + + int ret = Interop.Bluetooth.GetScanResultTxPowerLevel(ref scanDataStruct, packetType, out powerLevel); + if (ret != (int)BluetoothError.None) { + Log.Error(Globals.LogTag, "Failed to get tx power level- " + (BluetoothError)ret); + } + Log.Info (Globals.LogTag, "TxPowerLevel is --- " + powerLevel); + return powerLevel; + } + + internal IList GetScanResultSvcSolicitationUuids(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + IntPtr uuidListArray; + int count; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct(scanData); + + int ret = Interop.Bluetooth.GetScaResultSvcSolicitationUuids(ref scanDataStruct, packetType, out uuidListArray, out count); + if (ret != (int)BluetoothError.None) { + Log.Error(Globals.LogTag, "Failed to get service solicitation uuids " + (BluetoothError)ret); + return null; + } + + IntPtr[] uuidList = new IntPtr[count]; + Marshal.Copy(uuidListArray, uuidList, 0, count); + IList list = new List(); + foreach(IntPtr uuids in uuidList) + { + list.Add(Marshal.PtrToStringAnsi(uuids)); + Interop.Libc.Free(uuids); + } + + Interop.Libc.Free(uuidListArray); + return list; + } + + internal IList GetScanResultServiceDataList(BluetoothLeScanData scanData, + BluetoothLePacketType packetType, out int serviceCount) + { + int ret = 0; + IntPtr serviceListArray; + _serviceListCount = 0; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData); + + ret = Interop.Bluetooth.GetScanResultServiceDataList(ref scanDataStruct, packetType, out serviceListArray, out _serviceListCount); + Log.Info(Globals.LogTag, "ServiceListCount : " + _serviceListCount + " PacketType : " + packetType + " Error: " + (BluetoothError)ret); + if (ret != (int)BluetoothError.None) + { + Log.Info(Globals.LogTag, "Failed to get Service Data List, Error - " + (BluetoothError)ret); + serviceCount = 0; + Marshal.FreeHGlobal(serviceListArray); + Marshal.FreeHGlobal(scanDataStruct.AdvData); + Marshal.FreeHGlobal(scanDataStruct.ScanData); + return null; + } + + BluetoothLeServiceDataStruct[] svcList = new BluetoothLeServiceDataStruct[_serviceListCount]; + int sizePointerToABC = Marshal.SizeOf(new BluetoothLeServiceDataStruct()); + for (int i = 0; i < _serviceListCount; i++) + { + svcList[i] = (BluetoothLeServiceDataStruct)Marshal.PtrToStructure(new IntPtr(serviceListArray.ToInt32() + (i * sizePointerToABC)), typeof(BluetoothLeServiceDataStruct)); + Log.Info(Globals.LogTag, " Uuid : " + svcList[i].ServiceUuid + "length : " + svcList[i].ServiceDataLength); + + _list.Add(BluetoothUtils.ConvertStructToLeServiceData(svcList[i])); + } + + serviceCount = _serviceListCount; + + Interop.Libc.Free(serviceListArray); + Marshal.FreeHGlobal(scanDataStruct.AdvData); + Marshal.FreeHGlobal(scanDataStruct.ScanData); + return _list; + } + + internal int FreeServiceDataList() + { + if (_list.Count > 0) + { + int iServiceDataSize = Marshal.SizeOf(typeof(BluetoothLeServiceData)); + IntPtr structServiceData = Marshal.AllocHGlobal(iServiceDataSize); + Marshal.StructureToPtr(_list, structServiceData, false); + + int ret = Interop.Bluetooth.FreeServiceDataList(structServiceData, _serviceListCount); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to free Service Data List, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + + Marshal.FreeHGlobal(structServiceData); + } + return 0; + } + + internal int GetScanResultAppearance(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + int appearance; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData); + + int ret = Interop.Bluetooth.GetScanResultAppearance(ref scanDataStruct, packetType, out appearance); + if (ret != (int)BluetoothError.None) { + Log.Error(Globals.LogTag, "Failed to get Appearance value- " + (BluetoothError)ret); + } + return appearance; + } + + internal ManufacturerData GetScanResultManufacturerData(BluetoothLeScanData scanData, BluetoothLePacketType packetType) + { + int dataId = 0; + int dataLength = 0; + IntPtr manufData; + + BluetoothLeScanDataStruct scanDataStruct = BluetoothUtils.ConvertLeScanDataToStruct (scanData); + ManufacturerData data = new ManufacturerData(); + + int ret = Interop.Bluetooth.GetScanResultManufacturerData(ref scanDataStruct, packetType, out dataId, + out manufData, out dataLength); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to get Manufacturer data - " + (BluetoothError)ret); + return null; + } + + data.Id = dataId; + data.DataLength = dataLength; + if (data.DataLength > 0) + { + data.Data = new byte[data.DataLength]; + Marshal.Copy(manufData, data.Data, 0, data.DataLength); + } + + return data; + } + + internal int GattConnect(string remoteAddress, bool autoConnect) + { + int ret = Interop.Bluetooth.GattConnect (remoteAddress, autoConnect); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to establish GATT connection - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return ret; + } + + internal int GattDisconnect(string remoteAddress) + { + int ret = Interop.Bluetooth.GattDisconnect (remoteAddress); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect GATT connection - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return ret; + } + + internal int CreateAdvertiser(out IntPtr advertiserHandle) + { + return Interop.Bluetooth.CreateAdvertiser (out advertiserHandle); + } + + internal int DestroyAdvertiser(IntPtr advertiserHandle) + { + int ret = Interop.Bluetooth.DestroyAdvertiser (advertiserHandle); + if (ret != (int)BluetoothError.None) { + Log.Error(Globals.LogTag, "Failed to destroy the Advertiser- " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return ret; + } + + internal int StartAdvertising(IntPtr advertisingHandle) + { + _advertisingStateChangedCallback = (int result, IntPtr advertiserHandle, + BluetoothLeAdvertisingState state, IntPtr userData) => + { + Log.Info(Globals.LogTag, "Setting advertising state changed callback !! " ); + AdvertisingStateChangedEventArgs e = new AdvertisingStateChangedEventArgs(result, advertiserHandle, state); + _advertisingStateChanged(null, e); + }; + + IntPtr uData = IntPtr.Zero; + int ret = Interop.Bluetooth.BluetoothLeStartAdvertising (advertisingHandle, + _advertisingStateChangedCallback, uData ); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to start BLE advertising - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return ret; + } + + + internal int StopAdvertising(IntPtr advertisingHandle) + { + return Interop.Bluetooth.BluetoothLeStopAdvertising (advertisingHandle); + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothProfile.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothProfile.cs new file mode 100644 index 0000000..6be950a --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothProfile.cs @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Network.Bluetooth +{ + /// + /// This generic class represents all Bluetooth profiles.
+ /// Any common properties/functions can be added in this class in future. + ///
+ /// http://tizen.org/privilege/bluetooth + public abstract class BluetoothProfile + { + internal string RemoteAddress { get; set; } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothServerSocket.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothServerSocket.cs new file mode 100644 index 0000000..3d4509b --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothServerSocket.cs @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth +{ + /// + /// The BluetoothSocket provides functions for managing connections to other devices and exchanging data. + /// + public class BluetoothServerSocket : IDisposable + { + private event EventHandler _acceptStateChanged; + private Interop.Bluetooth.SocketConnectionStateChangedCallback _connectionStateChangedCallback; + internal int socketFd; + private bool disposed = false; + + /// + /// The AcceptStateChanged event is raised when the socket connection state is changed. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the register accpet state changed callback fails. + public event EventHandler AcceptStateChanged + { + add + { + if (_acceptStateChanged == null) + { + RegisterAcceptStateChangedEvent(); + } + _acceptStateChanged += value; + } + remove + { + _acceptStateChanged -= value; + if (_acceptStateChanged == null) + { + UnregisterAcceptStateChangedEvent(); + } + } + } + + private void RegisterAcceptStateChangedEvent() + { + _connectionStateChangedCallback = (int result, BluetoothSocketState connectionState, ref SocketConnectionStruct socketConnection, IntPtr userData) => + { + Log.Info(Globals.LogTag, "AcceptStateChanged cb is called"); + if (_acceptStateChanged != null) + { + BluetoothSocket socket = new BluetoothSocket(); + socket.connectedSocket = socketConnection.SocketFd; + GCHandle handle2 = (GCHandle) userData; + _acceptStateChanged(handle2.Target as BluetoothServerSocket, new AcceptStateChangedEventArgs((BluetoothError)result, connectionState, BluetoothUtils.ConvertStructToSocketConnection(socketConnection), socket)); + } + }; + GCHandle handle1 = GCHandle.Alloc(this); + IntPtr data = (IntPtr) handle1; + int ret = Interop.Bluetooth.SetConnectionStateChangedCallback(_connectionStateChangedCallback, data); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set accept state changed callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + private void UnregisterAcceptStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetSocketConnectionStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset accept state changed callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + internal BluetoothServerSocket(int socketFd) + { + Log.Info (Globals.LogTag, "Constructing server socket"); + this.socketFd = socketFd; + } + + /// + /// Starts listening on the passed RFCOMM socket and accepts connection requests. + /// + /// + /// The socket must be created with CreateServerSocket(). This API invokes the ConnectionStateChanged event. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the listen on socket procedure fails. + public void Listen() + { + int ret = Interop.Bluetooth.Listen(socketFd, 1); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to accept connection, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + ~BluetoothServerSocket() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + RemoveRegisteredEvents(); + disposed = true; + } + + private void RemoveRegisteredEvents() + { + //unregister all remaining events when this object is released. + if (_acceptStateChanged != null) + { + UnregisterAcceptStateChangedEvent(); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothSocket.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothSocket.cs new file mode 100644 index 0000000..5639cc2 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothSocket.cs @@ -0,0 +1,265 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth +{ + /// + /// The IBluetoothServerSocket interface handles the server socket operations. + /// + public interface IBluetoothServerSocket + { + event EventHandler DataReceived; + event EventHandler ConnectionStateChanged; + int SendData(string data); + } + + /// + /// The IBluetoothClientSocket interface handles the client socket operations. + /// + public interface IBluetoothClientSocket : IBluetoothServerSocket + { + void Connect(); + void Disconnect(); + } + + internal class BluetoothSocket : IBluetoothClientSocket, IDisposable + { + private event EventHandler _dataReceived; + private event EventHandler _connectionStateChanged; + private Interop.Bluetooth.DataReceivedCallback _dataReceivedCallback; + private Interop.Bluetooth.SocketConnectionStateChangedCallback _connectionStateChangedCallback; + private bool disposed = false; + internal int connectedSocket; + internal string remoteAddress; + internal string serviceUuid; + + /// + /// This event occurs when the socket server receives data from the client. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the register data received callback fails. + public event EventHandler DataReceived + { + add + { + if (_dataReceived == null) + { + RegisterDataReceivedEvent(); + } + _dataReceived += value; + } + remove + { + _dataReceived -= value; + if (_dataReceived == null) + { + UnregisterDataReceivedEvent(); + } + } + } + + /// + /// This event occurs when the connection state between two devices is changed. + /// + /// Thrown when the Bluetooth is not enabled + /// or when the register connection changed callback fails. + public event EventHandler ConnectionStateChanged + { + add + { + if (_connectionStateChanged == null) + { + RegisterConnectionStateChangedEvent(); + } + _connectionStateChanged += value; + } + remove + { + _connectionStateChanged -= value; + if (_connectionStateChanged == null) + { + UnregisterConnectionStateChangedEvent(); + } + } + } + + private void RegisterDataReceivedEvent() + { + _dataReceivedCallback = (ref SocketDataStruct socketData, IntPtr userData) => + { + Log.Info(Globals.LogTag, "DataReceivedCallback is called"); + if (_dataReceived != null) + { + GCHandle handle2 = (GCHandle) userData; + _dataReceived(handle2.Target as IBluetoothServerSocket, new SocketDataReceivedEventArgs(BluetoothUtils.ConvertStructToSocketData(socketData))); + } + }; + GCHandle handle1 = GCHandle.Alloc (this); + IntPtr uData = (IntPtr) handle1; + int ret = Interop.Bluetooth.SetDataReceivedCallback(_dataReceivedCallback, uData); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set data received callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + private void UnregisterDataReceivedEvent() + { + int ret = Interop.Bluetooth.UnsetDataReceivedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset data received callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + private void RegisterConnectionStateChangedEvent() + { + _connectionStateChangedCallback = (int result, BluetoothSocketState connectionState, ref SocketConnectionStruct socketConnection, IntPtr userData) => + { + Log.Info(Globals.LogTag, "ConnectionStateChangedCallback is called"); + if (_connectionStateChanged != null) + { + connectedSocket = socketConnection.SocketFd; + GCHandle handle2 = (GCHandle) userData; + _connectionStateChanged(handle2.Target as IBluetoothServerSocket, new SocketConnectionStateChangedEventArgs((BluetoothError)result, connectionState, BluetoothUtils.ConvertStructToSocketConnection(socketConnection))); + } + }; + GCHandle handle1 = GCHandle.Alloc(this); + IntPtr data = (IntPtr) handle1; + int ret = Interop.Bluetooth.SetConnectionStateChangedCallback(_connectionStateChangedCallback, data); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to set connection state changed callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + private void UnregisterConnectionStateChangedEvent() + { + int ret = Interop.Bluetooth.UnsetSocketConnectionStateChangedCallback(); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to unset connection state changed callback, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + /// + /// Connects to a specific RFCOMM based service on a remote Bluetooth device UUID. + /// + /// + /// The bluetooth must be enabled, discoverable with StartDiscovery(), and bonded with the remote device using CreateBond(). The ConnectionStateChanged event is raised once this API is called. + /// + /// The address of the remote Bluetooth device. + /// The UUID of the service provided by the remote Bluetooth device. + /// Thrown when the Bluetooth is not enabled + /// or when the connect socket attempt to remote device fails, or when the service UUID is not supported by the remote device. + void IBluetoothClientSocket.Connect() + { + int ret = Interop.Bluetooth.ConnectSocket(remoteAddress, serviceUuid); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to connect to socket, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + /// + /// Disconnects the RFCOMM connection with the given file descriptor of the conneted socket. + /// + /// + /// The connection must be established. + /// + /// The file descriptor of the socket to close. + /// Thrown when the Bluetooth is not enabled + /// or when the socket disconnect to remote device fails. + void IBluetoothClientSocket.Disconnect() + { + int ret = Interop.Bluetooth.DisconnectSocket(connectedSocket); + if (ret != (int)BluetoothError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect socket, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + } + + /// + /// Sends data to the connected device. + /// + /// The number of bytes written (zero indicates nothing was written). + /// + /// The connection must be established. + /// + /// The file descriptor of the connected socket. + /// The data to be sent. + /// Thrown when the Bluetooth is not enabled + /// or when the remote device is not connected, or the send data procedure fails. + public int SendData(string data) + { + int ret = Interop.Bluetooth.SendData(connectedSocket, data, data.Length); + if (ret < 0) + { + Log.Error(Globals.LogTag, "Failed to send data, Error - " + (BluetoothError)ret); + BluetoothErrorFactory.ThrowBluetoothException(ret); + } + return ret; + } + + ~BluetoothSocket() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + RemoveRegisteredEvents(); + disposed = true; + } + + private void RemoveRegisteredEvents() + { + //unregister all remaining events when this object is released. + if (_dataReceived != null) + { + UnregisterDataReceivedEvent(); + } + if (_connectionStateChanged != null) + { + UnregisterConnectionStateChangedEvent(); + } + } + } +} diff --git a/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs new file mode 100644 index 0000000..dcd53a2 --- /dev/null +++ b/src/Tizen.Network.Bluetooth/Tizen.Network.Bluetooth/BluetoothStructs.cs @@ -0,0 +1,390 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Reflection; +using System.Linq; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Bluetooth +{ + /// + /// The structure of the device class type and service. + /// + [StructLayout(LayoutKind.Sequential)] + internal struct BluetoothClassStruct + { + /// + /// The type of the major device class. + /// + internal BluetoothMajorDeviceClassType MajorDeviceClassType; + /// + /// The type of the minor device class. + /// + internal BluetoothMinorDeviceClassType MinorDeviceClassType; + /// + /// The major service class mask. + /// + internal int MajorServiceClassMask; + } + + /// + /// This structure contains the information of the Bluetooth device. + /// + [StructLayout(LayoutKind.Sequential)] + internal struct BluetoothDeviceStruct + { + /// + /// The address of the device. + /// + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string Address; + + /// + /// The name of the device. + /// + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string Name; + + /// + /// The class of the device. + /// + internal BluetoothClassStruct Class; + + /// + /// The service UUID list of the device. + /// + internal IntPtr ServiceUuidList; + + /// + /// The service count of the device. + /// + internal int ServiceCount; + + /// + /// The paired state of the device. + /// + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool IsPaired; + + /// + /// The connection state of the device. + /// + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool IsConnected; + + /// + /// The authorization state of the device. + /// + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool IsAuthorized; + + /// + /// The length of the manufacturer the data. + /// + internal int ManufacturerDataLength; + + /// + /// The manufacturer data. + /// + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string ManufacturerData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct BluetoothDiscoveredDeviceStruct + { + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string Address; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string Name; + + internal BluetoothClassStruct Class; + + internal int Rssi; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool IsPaired; + + internal IntPtr ServiceUuidList; + + internal int ServiceCount; + + internal BluetoothAppearanceType AppearanceType; + + internal int ManufacturerDataLength; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string ManufacturerData; + } + + internal struct BluetoothDeviceSdpStruct + { + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string DeviceAddress; + internal IntPtr ServiceUuid; + internal int ServiceCount; + } + + internal struct BluetoothDeviceConnectionStruct + { + internal string Address; + internal BluetoothConnectionLinkType LinkType; + internal BluetoothDisconnectReason DisconnectReason; + } + + internal struct SocketDataStruct + { + internal int SocketFd; + internal int DataSize; + internal IntPtr Data; + } + + internal struct SocketConnectionStruct + { + internal int SocketFd; + internal int ServerFd; + internal BluetoothSocketRole LocalRole; + internal string Address; + internal string ServiceUuid; + } + + ///
+ [StructLayout(LayoutKind.Sequential)] + internal struct BluetoothLeScanDataStruct + { + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string RemoteAddress; + + internal BluetoothLeDeviceAddressType AddressType; + + internal int Rssi; + + internal int AdvDataLength; + + internal IntPtr AdvData; + + internal int ScanDataLength; + + internal IntPtr ScanData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct BluetoothLeServiceDataStruct + { + /// + /// The Bluetooth LE service UUID. + /// + [MarshalAs(UnmanagedType.LPStr)] + internal string ServiceUuid; + /// + /// The Bluetooth LE service data. + /// + internal IntPtr ServiceData; + + internal int ServiceDataLength; + } + + internal static class BluetoothUtils + { + internal static BluetoothDevice ConvertStructToDeviceClass(BluetoothDeviceStruct device) + { + BluetoothDevice resultDevice = new BluetoothDevice(); + Collection uuidList = null; + + if (device.ServiceCount > 0) + { + IntPtr[] extensionList = new IntPtr[device.ServiceCount]; + Marshal.Copy (device.ServiceUuidList, extensionList, 0, device.ServiceCount); + uuidList = new Collection (); + foreach (IntPtr extension in extensionList) { + string uuid = Marshal.PtrToStringAnsi (extension); + uuidList.Add (uuid); + } + } + + resultDevice.RemoteDeviceAddress = device.Address; + resultDevice.RemoteDeviceName = device.Name; + resultDevice.RemoteDeviceClass = new BluetoothClass(); + resultDevice.Class.MajorType = device.Class.MajorDeviceClassType; + resultDevice.Class.MinorType = device.Class.MinorDeviceClassType; + resultDevice.Class.Mask = device.Class.MajorServiceClassMask; + resultDevice.RemotePaired = device.IsPaired; + resultDevice.RemoteConnected = device.IsConnected; + resultDevice.RemoteAuthorized = device.IsAuthorized; + resultDevice.RemoteDeviceService = uuidList; + resultDevice.RemoteDeviceCount = device.ServiceCount; + resultDevice.RemoteManufLength = device.ManufacturerDataLength; + resultDevice.RemoteManufData = device.ManufacturerData; + + return resultDevice; + } + + internal static BluetoothDevice ConvertStructToDiscoveredDevice(BluetoothDiscoveredDeviceStruct structDevice) + { + BluetoothDevice resultDevice = new BluetoothDevice(); + Collection uuidList = null; + + if (structDevice.ServiceCount > 0) { + IntPtr[] extensionList = new IntPtr[structDevice.ServiceCount]; + Marshal.Copy (structDevice.ServiceUuidList, extensionList, 0, structDevice.ServiceCount); + uuidList = new Collection (); + foreach (IntPtr extension in extensionList) { + string uuid = Marshal.PtrToStringAnsi (extension); + uuidList.Add (uuid); + } + } + + resultDevice.RemoteDeviceAddress = structDevice.Address; + resultDevice.RemoteDeviceName = structDevice.Name; + + resultDevice.RemoteDeviceClass = new BluetoothClass(); + resultDevice.Class.MajorType = structDevice.Class.MajorDeviceClassType; + resultDevice.Class.MinorType = structDevice.Class.MinorDeviceClassType; + resultDevice.Class.Mask = structDevice.Class.MajorServiceClassMask; + + resultDevice.RemoteDeviceRssi = structDevice.Rssi; + resultDevice.RemoteAppearance = structDevice.AppearanceType; + + if (structDevice.ServiceCount > 0) { + resultDevice.RemoteDeviceService = uuidList; + resultDevice.RemoteDeviceCount = structDevice.ServiceCount; + } + + resultDevice.RemotePaired = structDevice.IsPaired; + resultDevice.RemoteManufData = structDevice.ManufacturerData; + resultDevice.RemoteManufLength = structDevice.ManufacturerDataLength; + return resultDevice; + } + + internal static BluetoothDeviceSdpData ConvertStructToSdpData(BluetoothDeviceSdpStruct structData) + { + BluetoothDeviceSdpData resultData = new BluetoothDeviceSdpData(); + Collection uuidList = null; + + if (structData.ServiceCount > 0) { + IntPtr[] extensionList = new IntPtr[structData.ServiceCount]; + Marshal.Copy (structData.ServiceUuid, extensionList, 0, structData.ServiceCount); + uuidList = new Collection (); + foreach (IntPtr extension in extensionList) { + string uuid = Marshal.PtrToStringAnsi (extension); + uuidList.Add (uuid); + } + } + + resultData.Uuid = uuidList; + resultData.Address = structData.DeviceAddress; + + return resultData; + } + + internal static BluetoothDeviceConnectionData ConvertStructToConnectionData(BluetoothDeviceConnectionStruct structInfo) + { + BluetoothDeviceConnectionData resultData = new BluetoothDeviceConnectionData(); + resultData.RemoteAddress = structInfo.Address; + resultData.Link = structInfo.LinkType; + resultData.Reason = structInfo.DisconnectReason; + return resultData; + } + + internal static BluetoothLeScanData ConvertStructToLeScanData(BluetoothLeScanDataStruct structScanData) + { + BluetoothLeScanData scanData = new BluetoothLeScanData(); + + scanData.RemoteAddress = structScanData.RemoteAddress; + scanData.AddressType = structScanData.AddressType; + scanData.Rssi = structScanData.Rssi; + + if (structScanData.AdvDataLength > 0) + { + scanData.AdvDataLength = structScanData.AdvDataLength; + scanData.AdvData = new byte[scanData.AdvDataLength]; + Marshal.Copy (structScanData.AdvData, scanData.AdvData, 0, scanData.AdvDataLength); + } + + if (structScanData.ScanDataLength > 0) + { + scanData.ScanDataLength = structScanData.ScanDataLength; + scanData.ScanData = new byte[scanData.ScanDataLength]; + Marshal.Copy (structScanData.ScanData, scanData.ScanData, 0, scanData.ScanDataLength); + } + return scanData; + } + + internal static BluetoothLeScanDataStruct ConvertLeScanDataToStruct(BluetoothLeScanData scanData) + { + BluetoothLeScanDataStruct scanDataStruct = new BluetoothLeScanDataStruct(); + + scanDataStruct.RemoteAddress = scanData.RemoteAddress; + scanDataStruct.AddressType = scanData.AddressType; + scanDataStruct.Rssi = scanData.Rssi; + + if (scanData.AdvDataLength > 0) + { + scanDataStruct.AdvDataLength = scanData.AdvDataLength; + scanDataStruct.AdvData = Marshal.AllocHGlobal(scanData.AdvDataLength); + Marshal.Copy (scanData.AdvData, 0, scanDataStruct.AdvData, scanData.AdvDataLength); + } + + if (scanData.ScanDataLength > 0) + { + scanDataStruct.ScanDataLength = scanData.ScanDataLength; + scanDataStruct.ScanData = Marshal.AllocHGlobal(scanData.ScanDataLength); + Marshal.Copy (scanData.ScanData, 0, scanDataStruct.ScanData, scanData.ScanDataLength); + } + + return scanDataStruct; + } + + internal static BluetoothLeServiceData ConvertStructToLeServiceData(BluetoothLeServiceDataStruct structServiceData) + { + BluetoothLeServiceData serviceData = new BluetoothLeServiceData(); + Log.Info(Globals.LogTag, "ServiceDataLength" + structServiceData.ServiceDataLength); + + if (structServiceData.ServiceDataLength > 0) + { + serviceData.Uuid = structServiceData.ServiceUuid; + serviceData.Length = structServiceData.ServiceDataLength; + serviceData.Data = new byte[serviceData.Length]; + Marshal.Copy(structServiceData.ServiceData, serviceData.Data, 0, serviceData.Length); + } + return serviceData; + } + + internal static SocketData ConvertStructToSocketData(SocketDataStruct structInfo) + { + SocketData data = new SocketData(); + data.Fd = structInfo.SocketFd; + data.Size = structInfo.DataSize; + data.RecvData = Marshal.PtrToStringAnsi(structInfo.Data); + return data; + } + + internal static SocketConnection ConvertStructToSocketConnection(SocketConnectionStruct structInfo) + { + SocketConnection connectionInfo = new SocketConnection(); + connectionInfo.Fd = structInfo.SocketFd; + connectionInfo.RemoteAddress = structInfo.Address; + connectionInfo.Uuid = structInfo.ServiceUuid; + return connectionInfo; + } + } +} + diff --git a/src/Tizen.Network.Connection/Interop/Interop.Connection.cs b/src/Tizen.Network.Connection/Interop/Interop.Connection.cs new file mode 100755 index 0000000..89011c8 --- /dev/null +++ b/src/Tizen.Network.Connection/Interop/Interop.Connection.cs @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Network.Connection; + +internal static partial class Interop +{ + internal static partial class Connection + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ConnectionTypeChangedCallback(ConnectionType type, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ConnectionAddressChangedCallback(IntPtr ipv4, IntPtr ipv6, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ConnectionCallback(ConnectionError result, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool IPv6AddressCallback(IntPtr ipv6, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_create")] + public static extern int Create(out IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_destroy")] + public static extern int Destroy(IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_type")] + public static extern int GetType(IntPtr handle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_ip_address")] + public static extern int GetIPAddress(IntPtr handle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_foreach_ipv6_address")] + public static extern int GetAllIPv6Addresses(IntPtr handle, int type, IPv6AddressCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_proxy")] + public static extern int GetProxy(IntPtr handle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_mac_address")] + public static extern int GetMacAddress(IntPtr handle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_wifi_state")] + public static extern int GetWiFiState(IntPtr handle, out int state); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_cellular_state")] + public static extern int GetCellularState(IntPtr handle, out int state); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_state")] + public static extern int GetEthernetState(IntPtr handle, out int state); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_ethernet_cable_state")] + public static extern int GetEthernetCableState(IntPtr handle, out int state); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_bt_state")] + public static extern int GetBtState(IntPtr handle, out int state); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_statistics")] + public static extern int GetStatistics(IntPtr handle, int connectionType, int statisticsType, out long size); + + [DllImport(Libraries.Connection, EntryPoint = "connection_reset_statistics")] + public static extern int ResetStatistics(IntPtr handle, int connectionType, int statisticsType); + + [DllImport(Libraries.Connection, EntryPoint = "connection_add_route_entry")] + public static extern int AddRoute(IntPtr handle, AddressFamily family, string interfaceName, string address, string gateway); + + [DllImport(Libraries.Connection, EntryPoint = "connection_remove_route_entry")] + public static extern int RemoveRoute(IntPtr handle, AddressFamily family, string interfaceName, string address, string gateway); + + [DllImport(Libraries.Connection, EntryPoint = "connection_set_type_changed_cb")] + public static extern int SetTypeChangedCallback(IntPtr handle, ConnectionTypeChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_set_ip_address_changed_cb")] + public static extern int SetIPAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_set_ethernet_cable_state_chaged_cb")] + public static extern int SetEthernetCableStateChagedCallback(IntPtr handle, EthernetCableStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_set_proxy_address_changed_cb")] + public static extern int SetProxyAddressChangedCallback(IntPtr handle, ConnectionAddressChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_unset_type_changed_cb")] + public static extern int UnsetTypeChangedCallback(IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ip_address_changed_cb")] + public static extern int UnsetIPAddressChangedCallback(IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_unset_ethernet_cable_state_chaged_cb")] + public static extern int UnsetEthernetCableStateChagedCallback(IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_unset_proxy_address_changed_cb")] + public static extern int UnsetProxyAddressChangedCallback(IntPtr handle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_add_profile")] + public static extern int AddProfile(IntPtr handle, IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_remove_profile")] + public static extern int RemoveProfile(IntPtr handle, IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_update_profile")] + public static extern int UpdateProfile(IntPtr handle, IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_default_cellular_service_profile")] + public static extern int GetDefaultCellularServiceProfile(IntPtr handle, int type, out IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_current_profile")] + public static extern int GetCurrentProfile(IntPtr handle, out IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_open_profile")] + public static extern int OpenProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_close_profile")] + public static extern int CloseProfile(IntPtr handle, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_reset_profile")] + public static extern int ResetProfile(IntPtr handle, int Option, int Id, ConnectionCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_set_default_cellular_service_profile_async")] + public static extern int SetDefaultCellularServiceProfileAsync(IntPtr handle, int Type, IntPtr profileHandle, ConnectionCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_get_profile_iterator")] + public static extern int GetProfileIterator(IntPtr handle, int type, out IntPtr iterHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_next")] + public static extern int GetNextProfileIterator(IntPtr iterHandle, out IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_iterator_has_next")] + public static extern bool HasNextProfileIterator(IntPtr iterHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_destroy_profile_iterator")] + public static extern int DestroyProfileIterator(IntPtr iterHandle); + } + + internal static partial class ConnectionProfile + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate void ProfileStateChangedCallback(ProfileState type, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_create")] + public static extern int Create(int ProfileType, string Keyword, out IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_clone")] + public static extern int Clone(out IntPtr cloneHandle, IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_destroy")] + public static extern int Destroy(IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_id")] + public static extern int GetId(IntPtr profileHandle, out IntPtr profileId); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_name")] + public static extern int GetName(IntPtr profileHandle, out IntPtr name); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_type")] + public static extern int GetType(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_network_interface_name")] + public static extern int GetNetworkInterfaceName(IntPtr profileHandle, out IntPtr interfaceName); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_state")] + public static extern int GetState(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ipv6_state")] + public static extern int GetIPv6State(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_config_type")] + public static extern int GetIPConfigType(IntPtr profileHandle, int family, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_type")] + public static extern int GetProxyType(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_ip_address")] + public static extern int GetIPAddress(IntPtr profileHandle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_subnet_mask")] + public static extern int GetSubnetMask(IntPtr profileHandle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_gateway_address")] + public static extern int GetGatewayAddress(IntPtr profileHandle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dns_address")] + public static extern int GetDnsAddress(IntPtr profileHandle, int order, int Family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_proxy_address")] + public static extern int GetProxyAddress(IntPtr profileHandle, int family, out IntPtr address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_prefix_length")] + public static extern int GetPrefixLength(IntPtr profileHandle, int family, out int length); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dns_config_type")] + public static extern int GetDnsConfigType(IntPtr profileHandle, int family, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_dhcp_server_address")] + public static extern int GetDhcpServerAddress(IntPtr profileHandle, AddressFamily family, out string dhcpServerAddress); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_refresh")] + public static extern int Refresh(IntPtr profileHandle); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_config_type")] + public static extern int SetIPConfigType(IntPtr profileHandle, int family, int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_type")] + public static extern int SetProxyType(IntPtr profileHandle, int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_ip_address")] + public static extern int SetIPAddress(IntPtr profileHandle, int family, string address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_subnet_mask")] + public static extern int SetSubnetMask(IntPtr profileHandle, int family, string address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_gateway_address")] + public static extern int SetGatewayAddress(IntPtr profileHandle, int family, string address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_dns_address")] + public static extern int SetDnsAddress(IntPtr profileHandle, int order, int family, string address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_proxy_address")] + public static extern int SetProxyAddress(IntPtr profileHandle, int family, string address); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_prefix_length")] + public static extern int SetPrefixLength(IntPtr profileHandle, int family, int length); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_dns_config_type")] + public static extern int SetDnsConfigType(IntPtr profileHandle, int family, int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_state_changed_cb")] + public static extern int SetStateChangeCallback(IntPtr profileHandle, ProfileStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_unset_state_changed_cb")] + public static extern int UnsetStateChangeCallback(IntPtr profileHandle); + } + + internal static partial class ConnectionCellularProfile + { + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_service_type")] + public static extern int GetServiceType(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_apn")] + public static extern int GetApn(IntPtr profileHandle, out IntPtr apn); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_auth_info")] + public static extern int GetAuthInfo(IntPtr profileHandle, out int authType, out string name, out string password); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_home_url")] + public static extern int GetHomeUrl(IntPtr profileHandle, out IntPtr homeUrl); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_pdn_type")] + public static extern int GetPdnType(IntPtr profileHandle, out int pdnType); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_cellular_roam_pdn_type")] + public static extern int GetRoamingPdnType(IntPtr profileHandle, out int roamPdnType); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_roaming")] + public static extern int IsRoaming(IntPtr profileHandle, out bool roaming); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_hidden")] + public static extern int IsHidden(IntPtr profileHandle, out bool hidden); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_editable")] + public static extern int IsEditable(IntPtr profileHandle, out bool editable); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_cellular_default")] + public static extern int IsDefault(IntPtr profileHandle, out bool isDefault); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_service_type")] + public static extern int SetServiceType(IntPtr profileHandle, int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_apn")] + public static extern int SetApn(IntPtr profileHandle, string apn); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_auth_info")] + public static extern int SetAuthInfo(IntPtr profileHandle, int authType, string name, string password); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_home_url")] + public static extern int SetHomeUrl(IntPtr profileHandle, string homeUrl); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_pdn_type")] + public static extern int SetPdnType(IntPtr profileHandle, int pdnType); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_cellular_roam_pdn_type")] + public static extern int SetRoamingPdnType(IntPtr profileHandle, int roamPdnType); + } + + internal static partial class ConnectionWiFiProfile + { + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_essid")] + public static extern int GetEssid(IntPtr profileHandle, out IntPtr essid); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_bssid")] + public static extern int GetBssid(IntPtr profileHandle, out IntPtr bssid); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_rssi")] + public static extern int GetRssi(IntPtr profileHandle, out int rssi); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_frequency")] + public static extern int GetFrequency(IntPtr profileHandle, out int frequency); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_max_speed")] + public static extern int GetMaxSpeed(IntPtr profileHandle, out int maxSpeed); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_security_type")] + public static extern int GetSecurityType(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_get_wifi_encryption_type")] + public static extern int GetEncryptionType(IntPtr profileHandle, out int type); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_passphrase_required")] + public static extern int IsRequiredPassphrase(IntPtr profileHandle, out bool required); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_set_wifi_passphrase")] + public static extern int SetPassphrase(IntPtr profileHandle, string passphrase); + + [DllImport(Libraries.Connection, EntryPoint = "connection_profile_is_wifi_wps_supported")] + public static extern int IsSupportedWps(IntPtr profileHandle, out bool supported); + } + + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr userData); + + } +} diff --git a/src/Tizen.Network.Connection/Interop/Interop.Libraries.cs b/src/Tizen.Network.Connection/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..03ee0cd --- /dev/null +++ b/src/Tizen.Network.Connection/Interop/Interop.Libraries.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Connection = "libcapi-network-connection.so.1"; + public const string WiFi = "libcapi-network-wifi.so.1"; + public const string Bluetooth = "libcapi-network-bluetooth.so.0"; + public const string Smartcard = "libcapi-network-smartcard.so.0"; + public const string Nfc = "libcapi-network-nfc.so.0"; + public const string WiFiDirect = "libwifi-direct.so.1"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection.csproj b/src/Tizen.Network.Connection/Tizen.Network.Connection.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection.sln b/src/Tizen.Network.Connection/Tizen.Network.Connection.sln new file mode 100755 index 0000000..4a0a69e --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Connection", "Tizen.Network.Connection.csproj", "{95B09375-DBE2-48E2-8E23-F7EAAB2F8FE7}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{D8E4C8E2-9D12-4E1E-934B-11865FED39AF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{F850EB87-EF9C-445B-B1F1-3945DF82842E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {95B09375-DBE2-48E2-8E23-F7EAAB2F8FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95B09375-DBE2-48E2-8E23-F7EAAB2F8FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95B09375-DBE2-48E2-8E23-F7EAAB2F8FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95B09375-DBE2-48E2-8E23-F7EAAB2F8FE7}.Release|Any CPU.Build.0 = Release|Any CPU + {D8E4C8E2-9D12-4E1E-934B-11865FED39AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8E4C8E2-9D12-4E1E-934B-11865FED39AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8E4C8E2-9D12-4E1E-934B-11865FED39AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8E4C8E2-9D12-4E1E-934B-11865FED39AF}.Release|Any CPU.Build.0 = Release|Any CPU + {F850EB87-EF9C-445B-B1F1-3945DF82842E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F850EB87-EF9C-445B-B1F1-3945DF82842E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F850EB87-EF9C-445B-B1F1-3945DF82842E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F850EB87-EF9C-445B-B1F1-3945DF82842E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs new file mode 100755 index 0000000..86658a2 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/CellularProfile.cs @@ -0,0 +1,402 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Connection +{ + /// + /// This Class is CellularProfile. It provides functions to manage the cellular profile. + /// + /// 3 + public class CellularProfile : ConnectionProfile + { + internal CellularProfile(IntPtr handle): base(handle) + { + } + + private CellularAuthInformation _cellularAuthInfo = null; + + ~CellularProfile() + { + } + + /// + /// The APN (access point name). + /// + /// 3 + /// Cellular access point name. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when value is null. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public string Apn + { + get + { + Log.Debug(Globals.LogTag, "Get Apn"); + IntPtr Value; + int ret = Interop.ConnectionCellularProfile.GetApn(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get apn, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + } + + set + { + Log.Debug(Globals.LogTag, "Set Apn"); + CheckDisposed(); + if (value != null) + { + int ret = Interop.ConnectionCellularProfile.SetApn(ProfileHandle, value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set apn, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Value of Apn is null"); + } + } + } + + /// + /// The home URL. + /// + /// 3 + /// Cellular home URL. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when value is null. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public string HomeUri + { + get + { + Log.Debug(Globals.LogTag, "Get HomeUri"); + IntPtr Value; + int ret = Interop.ConnectionCellularProfile.GetHomeUrl(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get home url, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + } + + set + { + Log.Debug(Globals.LogTag, "Set HomeUri"); + CheckDisposed(); + if (value != null) + { + int ret = Interop.ConnectionCellularProfile.SetHomeUrl(ProfileHandle, value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set home url, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Value of HomeUri is null"); + } + } + } + + /// + /// The service type. + /// + /// 3 + /// Cellular service type. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public CellularServiceType ServiceType + { + get + { + Log.Debug(Globals.LogTag, "Get ServiceType"); + int value; + int ret = Interop.ConnectionCellularProfile.GetServiceType(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get service type, " + (ConnectionError)ret); + } + return (CellularServiceType)value; + } + + set + { + Log.Debug(Globals.LogTag, "Set ServiceType"); + CheckDisposed(); + int ret = Interop.ConnectionCellularProfile.SetServiceType(ProfileHandle, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set service type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + /// + /// The cellular pdn type. + /// + /// 3 + /// Cellular pdn type. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public CellularPdnType PdnType + { + get + { + Log.Debug(Globals.LogTag, "Get PdnType"); + int value; + int ret = Interop.ConnectionCellularProfile.GetPdnType(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get pdn type, " + (ConnectionError)ret); + } + return (CellularPdnType)value; + } + + set + { + Log.Debug(Globals.LogTag, "Set PdnType"); + CheckDisposed(); + int ret = Interop.ConnectionCellularProfile.SetPdnType(ProfileHandle, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set pdn type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + /// + /// The cellular roaming pdn type. + /// + /// 3 + /// Cellular roaming pdn type. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public CellularPdnType RoamingPdnType + { + get + { + Log.Debug(Globals.LogTag, "Get RoamingPdnType"); + int value; + int ret = Interop.ConnectionCellularProfile.GetRoamingPdnType(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get roam pdn type, " + (ConnectionError)ret); + } + return (CellularPdnType)value; + } + + set + { + Log.Debug(Globals.LogTag, "Set RoamingPdnType"); + CheckDisposed(); + int ret = Interop.ConnectionCellularProfile.SetRoamingPdnType(ProfileHandle, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set roam pdn type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + /// + /// Cellular Authentication Information. + /// + /// 3 + /// Instance of CellularAuthInformation. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when value is null. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public CellularAuthInformation CellularAuthInfo + { + get + { + int type; + string name; + string password; + int ret = Interop.ConnectionCellularProfile.GetAuthInfo(ProfileHandle, out type, out name, out password); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get cellular authentication information, " + (ConnectionError)ret); + return null; + } + + if (_cellularAuthInfo == null) + _cellularAuthInfo = new CellularAuthInformation(); + _cellularAuthInfo.AuthType = (CellularAuthType)type; + _cellularAuthInfo.UserName = name; + _cellularAuthInfo.Password = password; + return _cellularAuthInfo; + } + + set + { + CheckDisposed(); + if (value != null) + { + _cellularAuthInfo = value; + int type = (int)_cellularAuthInfo.AuthType; + string name = _cellularAuthInfo.UserName; + string password = _cellularAuthInfo.Password; + int ret = Interop.ConnectionCellularProfile.SetAuthInfo(ProfileHandle, type, name, password); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set auth information, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("CellularAuthInformation value is null"); + } + } + } + + /// + /// Checks whether the profile is hidden. + /// + /// 3 + /// True if the cellular profile is hidden, otherwise false. + public bool Hidden + { + get + { + bool value; + int ret = Interop.ConnectionCellularProfile.IsHidden(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get hidden value, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// Checks whether the profile is editable. + /// + /// 3 + /// True if the cellular profile is editable, otherwise false. + public bool Editable + { + get + { + bool value; + int ret = Interop.ConnectionCellularProfile.IsEditable(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get editable value, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// Checks whether the profile is default. + /// + /// 3 + /// True if the cellular profile is default, otherwise false. + public bool IsDefault + { + get + { + bool value; + int ret = Interop.ConnectionCellularProfile.IsDefault(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get IsDefault value, " + (ConnectionError)ret); + } + return value; + } + } + } + + /// + /// This Class is CellularAuthInformation. It provides the properties to get and set the cellular authentication information. + /// + /// 3 + public class CellularAuthInformation + { + /// + /// Default Constructor.Initializes an object of CellularAuthInformation. + /// + public CellularAuthInformation() + { + } + + /// + /// The user name. + /// 3 + /// + /// Cellular user name. + public string UserName { get; set;} + /// + /// The password + /// + /// 3 + /// Cellular password. + public string Password { get; set; } + + /// + /// The authentication type + /// + /// 3 + /// Cellular authentication type. + public CellularAuthType AuthType { get; set; } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs new file mode 100755 index 0000000..9e8d587 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionError.cs @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Network.Connection +{ + internal static class ConnectionErrorFactory + { + internal static void CheckFeatureUnsupportedException(int err, string message) + { + if ((ConnectionError)err == ConnectionError.NotSupported) + { + ThrowConnectionException(err, message); + } + } + + internal static void CheckPermissionDeniedException(int err, string message) + { + if ((ConnectionError)err == ConnectionError.PermissionDenied) + { + ThrowConnectionException(err, message); + } + } + + internal static void CheckHandleNullException(int err, bool isHandleInvalid, string message) + { + if ((ConnectionError)err == ConnectionError.InvalidParameter) + { + if (isHandleInvalid) + { + ThrowConnectionException((int)ConnectionError.InvalidOperation, message); + } + } + } + + internal static void ThrowConnectionException(int errno , string message = "") + { + ConnectionError _error = (ConnectionError)errno; + Log.Debug(Globals.LogTag, "ThrowConnectionException " + _error); + switch (_error) + { + case ConnectionError.AddressFamilyNotSupported: + throw new InvalidOperationException("Address Family Not Supported"); + case ConnectionError.AlreadyExists: + throw new InvalidOperationException("Already Exists"); + case ConnectionError.DhcpFailed: + throw new InvalidOperationException("DHCP Failed"); + case ConnectionError.EndOfIteration: + throw new InvalidOperationException("End Of Iteration"); + case ConnectionError.InvalidKey: + throw new InvalidOperationException("Invalid Key"); + case ConnectionError.InvalidOperation: + throw new InvalidOperationException("Invalid Operation " + message); + case ConnectionError.InvalidParameter: + throw new ArgumentException("Invalid Parameter"); + case ConnectionError.NoConnection: + throw new InvalidOperationException("No Connection"); + case ConnectionError.NoReply: + throw new InvalidOperationException("No Reply"); + case ConnectionError.NotSupported: + throw new NotSupportedException("Unsupported feature " + message); + case ConnectionError.NowInProgress: + throw new InvalidOperationException("Now In Progress"); + case ConnectionError.OperationAborted: + throw new InvalidOperationException("Operation Aborted"); + case ConnectionError.OperationFailed: + throw new InvalidOperationException("Operation Failed"); + case ConnectionError.OutOfMemoryError: + throw new OutOfMemoryException("Out Of Memory Error"); + case ConnectionError.PermissionDenied: + throw new UnauthorizedAccessException("Permission Denied " + message); + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs new file mode 100755 index 0000000..cad51a7 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionInternalManager.cs @@ -0,0 +1,945 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections; +using System.Threading; + +namespace Tizen.Network.Connection +{ + class HandleHolder : IDisposable + { + private IntPtr Handle; + private bool disposed = false; + + public HandleHolder() + { + Log.Debug(Globals.LogTag, "Handle: " + Handle); + int ret = Interop.Connection.Create(out Handle); + if(ret != (int)ConnectionError.None) + { + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + ~HandleHolder() + { + Dispose(false); + } + + internal IntPtr GetHandle() + { + Log.Debug(Globals.LogTag, "handleholder handle = " + Handle); + return Handle; + } + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + Log.Debug(Globals.LogTag, ">>> HandleHolder Dispose with " + disposing); + Log.Debug(Globals.LogTag, ">>> Handle: " + Handle); + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + Destroy(); + } + disposed = true; + } + + private void Destroy() + { + Interop.Connection.Destroy(Handle); + if (Handle != IntPtr.Zero) + { + Handle = IntPtr.Zero; + } + } + } + + internal class ConnectionInternalManager + { + private bool disposed = false; + private static ConnectionInternalManager s_instance = null; + + private EventHandler _ConnectionTypeChanged = null; + private EventHandler _IPAddressChanged = null; + private EventHandler _EthernetCableStateChanged = null; + private EventHandler _ProxyAddressChanged = null; + + private Interop.Connection.ConnectionAddressChangedCallback _connectionAddressChangedCallback; + private Interop.Connection.ConnectionTypeChangedCallback _connectionTypeChangedCallback; + private Interop.Connection.ConnectionAddressChangedCallback _proxyAddressChangedCallback; + + internal static ConnectionInternalManager Instance + { + get + { + if (s_instance == null) + { + s_instance = new ConnectionInternalManager(); + } + + return s_instance; + } + } + + private static ThreadLocal s_threadName = new ThreadLocal(() => + { + Log.Info(Globals.LogTag, "In threadlocal delegate"); + return new HandleHolder(); + }); + + private ConnectionInternalManager() + { + + } + + ~ConnectionInternalManager() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + Log.Debug(Globals.LogTag, ">>> ConnectionInternalManager Dispose with disposing " + disposing + ", disposed " + disposed); + Log.Debug(Globals.LogTag, ">>> Handle: " + GetHandle()); + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + + UnregisterEvents(); + disposed = true; + } + + internal IntPtr GetHandle() + { + return s_threadName.Value.GetHandle(); + } + + internal event EventHandler ConnectionTypeChanged + { + add + { + if (_ConnectionTypeChanged == null) + { + ConnectionTypeChangedStart(); + } + + _ConnectionTypeChanged += value; + } + remove + { + _ConnectionTypeChanged -= value; + if (_ConnectionTypeChanged == null) + { + ConnectionTypeChangedStop(); + } + } + } + + private void ConnectionTypeChangedStart() + { + _connectionTypeChangedCallback = (ConnectionType type, IntPtr user_data) => + { + if (_ConnectionTypeChanged != null) + { + _ConnectionTypeChanged(null, new ConnectionTypeEventArgs(type)); + } + }; + + int ret = Interop.Connection.SetTypeChangedCallback(GetHandle(), _connectionTypeChangedCallback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to register connection type changed callback, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + private void ConnectionTypeChangedStop() + { + int ret = Interop.Connection.UnsetTypeChangedCallback(GetHandle()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to unregister connection type changed callback, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + internal event EventHandler EthernetCableStateChanged + { + add + { + if (_EthernetCableStateChanged == null) + { + EthernetCableStateChangedStart(); + } + _EthernetCableStateChanged += value; + } + remove + { + _EthernetCableStateChanged -= value; + if (_EthernetCableStateChanged == null) + { + EthernetCableStateChangedStop(); + } + } + } + + private void EthernetCableStateChangedStart() + { + int ret = Interop.Connection.SetEthernetCableStateChagedCallback(GetHandle(), EthernetCableStateChangedCallback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to register ethernet cable state changed callback, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + private void EthernetCableStateChangedStop() + { + int ret = Interop.Connection.UnsetEthernetCableStateChagedCallback(GetHandle()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to unregister ethernet cable state changed callback, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + private void EthernetCableStateChangedCallback(EthernetCableState state, IntPtr user_data) + { + if (_EthernetCableStateChanged != null) + { + _EthernetCableStateChanged(null, new EthernetCableStateEventArgs(state)); + } + } + + internal event EventHandler IPAddressChanged + { + add + { + if (_IPAddressChanged == null) + { + IPAddressChangedStart(); + } + _IPAddressChanged += value; + } + + remove + { + _IPAddressChanged -= value; + if (_IPAddressChanged == null) + { + IPAddressChangedStop(); + } + } + } + + private void IPAddressChangedStart() + { + _connectionAddressChangedCallback = (IntPtr IPv4, IntPtr IPv6, IntPtr UserData) => + { + if (_IPAddressChanged != null) + { + string ipv4 = Marshal.PtrToStringAnsi(IPv4); + string ipv6 = Marshal.PtrToStringAnsi(IPv6); + + if ((string.IsNullOrEmpty(ipv4) == false) || (string.IsNullOrEmpty(ipv6) == false)) + { + _IPAddressChanged(null, new AddressEventArgs(ipv4, ipv6)); + } + } + }; + + int ret = Interop.Connection.SetIPAddressChangedCallback(GetHandle(), _connectionAddressChangedCallback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to register callback for changing IP address, " + (ConnectionError)ret); + } + } + + private void IPAddressChangedStop() + { + int ret = Interop.Connection.UnsetIPAddressChangedCallback(GetHandle()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to unregister callback for changing IP address, " + (ConnectionError)ret); + } + } + + internal event EventHandler ProxyAddressChanged + { + add + { + //Console.WriteLine("ProxyAddressChanged Add **"); + if (_ProxyAddressChanged == null) + { + ProxyAddressChangedStart(); + } + + _ProxyAddressChanged += value; + } + remove + { + //Console.WriteLine("ProxyAddressChanged Remove"); + _ProxyAddressChanged -= value; + if (_ProxyAddressChanged == null) + { + ProxyAddressChangedStop(); + } + } + } + + private void ProxyAddressChangedStart() + { + _proxyAddressChangedCallback = (IntPtr IPv4, IntPtr IPv6, IntPtr UserData) => + { + if (_ProxyAddressChanged != null) + { + string ipv4 = Marshal.PtrToStringAnsi(IPv4); + string ipv6 = Marshal.PtrToStringAnsi(IPv6); + + if ((string.IsNullOrEmpty(ipv4) == false) || (string.IsNullOrEmpty(ipv6) == false)) + { + _ProxyAddressChanged(null, new AddressEventArgs(ipv4, ipv6)); + } + } + }; + + int ret = Interop.Connection.SetProxyAddressChangedCallback(GetHandle(), _proxyAddressChangedCallback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to register callback for changing proxy address, " + (ConnectionError)ret); + } + } + + private void ProxyAddressChangedStop() + { + int ret = Interop.Connection.UnsetProxyAddressChangedCallback(GetHandle()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to unregister callback for changing proxy address, " + (ConnectionError)ret); + } + } + + private void UnregisterEvents() + { + if (_ConnectionTypeChanged != null) + { + ConnectionTypeChangedStop(); + } + if (_IPAddressChanged != null) + { + IPAddressChangedStop(); + } + if (_EthernetCableStateChanged != null) + { + EthernetCableStateChangedStop(); + } + if (_ProxyAddressChanged != null) + { + ProxyAddressChangedStop(); + } + } + + internal int GetProfileIterator(ProfileListType type, out IntPtr iterator) + { + return Interop.Connection.GetProfileIterator(GetHandle(), (int)type, out iterator); + } + + internal bool HasNext(IntPtr iterator) + { + return Interop.Connection.HasNextProfileIterator(iterator); + } + + internal int NextProfileIterator(IntPtr iterator, out IntPtr profileHandle) + { + return Interop.Connection.GetNextProfileIterator(iterator, out profileHandle); + } + + internal int DestoryProfileIterator(IntPtr iterator) + { + return Interop.Connection.DestroyProfileIterator(iterator); + } + + internal System.Net.IPAddress GetIPAddress(AddressFamily family) + { + Log.Debug(Globals.LogTag, "GetIPAddress " + family); + IntPtr ip; + int ret = Interop.Connection.GetIPAddress(GetHandle(), (int)family, out ip); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get IP address, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + string result = Marshal.PtrToStringAnsi(ip); + Interop.Libc.Free(ip); + return System.Net.IPAddress.Parse(result);; + } + + internal IEnumerable GetAllIPv6Addresses(ConnectionType type) + { + Log.Debug(Globals.LogTag, "GetAllIPv6Addresses"); + List ipList = new List(); + Interop.Connection.IPv6AddressCallback callback = (IntPtr ipv6Address, IntPtr userData) => + { + if (ipv6Address != IntPtr.Zero) + { + string ipv6 = Marshal.PtrToStringAnsi(ipv6Address); + ipList.Add(System.Net.IPAddress.Parse(ipv6)); + return true; + } + return false; + }; + + int ret = Interop.Connection.GetAllIPv6Addresses(GetHandle(), (int)type, callback, IntPtr.Zero); + if (ret != (int)ConnectionError.None) + { + Log.Error(Globals.LogTag, "Failed to get all IPv6 addresses, Error - " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return ipList; + } + + internal string GetProxy(AddressFamily family) + { + Log.Debug(Globals.LogTag, "GetProxy " + family); + IntPtr ip; + int ret = Interop.Connection.GetProxy(GetHandle(), (int)family, out ip); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get proxy, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + string result = Marshal.PtrToStringAnsi(ip); + Interop.Libc.Free(ip); + return result; + } + + internal string GetMacAddress(ConnectionType type) + { + Log.Debug(Globals.LogTag, "GetMacAddress " + type); + IntPtr mac; + int ret = Interop.Connection.GetMacAddress(GetHandle(), (int)type, out mac); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get mac address, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + string result = Marshal.PtrToStringAnsi(mac); + Interop.Libc.Free(mac); + return result; + } + + internal long GetStatistics(ConnectionType connectionType, StatisticsType statisticsType) + { + Log.Debug(Globals.LogTag, "GetStatistics " + connectionType + ", " + statisticsType); + long size; + int ret = Interop.Connection.GetStatistics(GetHandle(), (int)connectionType, + (int)statisticsType, out size); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get statistics, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return size; + } + + internal void ResetStatistics(ConnectionType connectionType, StatisticsType statisticsType) + { + Log.Debug(Globals.LogTag, "ResetStatistics " + connectionType + ", " + statisticsType); + int ret = Interop.Connection.ResetStatistics(GetHandle(), (int)connectionType, + (int)statisticsType); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to reset statistics, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + internal void AddRoute(AddressFamily family, string interfaceName, System.Net.IPAddress address, System.Net.IPAddress gateway) + { + if (interfaceName != null && address != null && gateway != null) + { + Log.Debug(Globals.LogTag, "AddRoute " + family + ", " + interfaceName + ", " + address + ", " + gateway); + int ret = Interop.Connection.AddRoute(GetHandle(), family, interfaceName, address.ToString(), gateway.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to add route to the routing table, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Arguments are null"); + } + } + + internal void RemoveRoute(AddressFamily family, string interfaceName, System.Net.IPAddress address, System.Net.IPAddress gateway) + { + if (interfaceName != null && address != null && gateway != null) + { + Log.Debug(Globals.LogTag, "RemoveRoute " + family + ", " + interfaceName + ", " + address + ", " + gateway); + int ret = Interop.Connection.RemoveRoute(GetHandle(), family, interfaceName, address.ToString(), gateway.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to remove route from the routing table, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Arguments are null"); + } + } + + internal ConnectionType ConnectionType + { + get + { + Log.Debug(Globals.LogTag, "get ConnectionType"); + int type = 0; + int ret = Interop.Connection.GetType(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get connection type, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (ConnectionType)type; + } + } + + internal CellularState CellularState + { + get + { + Log.Debug(Globals.LogTag, "get CellularState"); + int type = 0; + int ret = Interop.Connection.GetCellularState(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get cellular state, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (CellularState)type; + } + } + + internal ConnectionState WiFiState + { + get + { + Log.Debug(Globals.LogTag, "get WiFiState"); + int type = 0; + int ret = Interop.Connection.GetWiFiState(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get wifi state, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (ConnectionState)type; + } + } + + internal ConnectionState BluetoothState + { + get + { + Log.Debug(Globals.LogTag, "get BluetoothState"); + int type = 0; + int ret = Interop.Connection.GetBtState(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get bluetooth state, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (ConnectionState)type; + } + } + + internal ConnectionState EthernetState + { + get + { + Log.Debug(Globals.LogTag, "get ConnectionType"); + int type = 0; + int ret = Interop.Connection.GetEthernetState(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get ethernet state, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (ConnectionState)type; + } + } + + internal EthernetCableState EthernetCableState + { + get + { + Log.Debug(Globals.LogTag, "get EthernetCableState"); + int type = 0; + int ret = Interop.Connection.GetEthernetCableState(GetHandle(), out type); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get ethernet cable state, " + (ConnectionError)ret); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + return (EthernetCableState)type; + } + } + + internal IntPtr CreateCellularProfile(ConnectionProfileType type, string keyword) + { + Log.Debug(Globals.LogTag, "CreateCellularProfile, " + type + ", " + keyword); + if (keyword != null) + { + IntPtr handle = IntPtr.Zero; + int ret = Interop.ConnectionProfile.Create((int)type, keyword, out handle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to Create profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return handle; + } + + else + { + throw new ArgumentNullException("Keyword is null"); + } + } + + internal void AddCellularProfile(CellularProfile profile) + { + + Log.Debug(Globals.LogTag, "AddCellularProfile"); + if (profile != null) + { + if (profile.Type == ConnectionProfileType.Cellular) + { + int ret = Interop.Connection.AddProfile(GetHandle(), profile.ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "Failed to add cellular profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.profile)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentException("Profile type is not cellular"); + } + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + + internal void RemoveProfile(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "RemoveProfile"); + if (profile != null) + { + int ret = Interop.Connection.RemoveProfile(GetHandle(), profile.ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to remove profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + + internal void UpdateProfile(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "UpdateProfile"); + if (profile != null) + { + int ret = Interop.Connection.UpdateProfile(GetHandle(), profile.ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to update profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + + internal ConnectionProfile GetCurrentProfile() + { + Log.Debug(Globals.LogTag, "GetCurrentProfile"); + IntPtr ProfileHandle; + int ret = Interop.Connection.GetCurrentProfile(GetHandle(), out ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get current profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + ConnectionProfile Profile = new ConnectionProfile(ProfileHandle); + return Profile; + } + + internal ConnectionProfile GetDefaultCellularProfile(CellularServiceType type) + { + Log.Debug(Globals.LogTag, "GetDefaultCellularProfile"); + IntPtr ProfileHandle; + int ret = Interop.Connection.GetDefaultCellularServiceProfile(GetHandle(), (int)type, out ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "Error: " + ret); + Log.Error(Globals.LogTag, "It failed to get default cellular profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + CellularProfile Profile = new CellularProfile(ProfileHandle); + return Profile; + } + + internal Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "SetDefaultCellularProfile"); + if (profile != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) => + { + if (Result != ConnectionError.None) + { + Log.Error(Globals.LogTag, "Error occurs during set default cellular profile, " + Result); + task.SetException(new InvalidOperationException("Error occurs during set default cellular profile, " + Result)); + } + + task.SetResult(true); + }; + + int ret = Interop.Connection.SetDefaultCellularServiceProfileAsync(GetHandle(), (int)type, profile.ProfileHandle, Callback, (IntPtr)0); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set default cellular profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + + + internal Task> GetProfileListAsync(ProfileListType type) + { + Log.Debug(Globals.LogTag, "GetProfileListAsync"); + var task = new TaskCompletionSource>(); + + List Result = new List(); + IntPtr iterator; + int ret = Interop.Connection.GetProfileIterator(GetHandle(), (int)type, out iterator); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get profile iterator, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero), "Connection Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + while (Interop.Connection.HasNextProfileIterator(iterator)) + { + IntPtr nextH; + IntPtr profileH; + Interop.Connection.GetNextProfileIterator(iterator, out nextH); + Interop.ConnectionProfile.Clone(out profileH, nextH); + + int profileType; + Interop.ConnectionProfile.GetType(profileH, out profileType); + + if ((ConnectionProfileType)profileType == ConnectionProfileType.WiFi) + { + WiFiProfile cur = new WiFiProfile(profileH); + Result.Add(cur); + } + else if ((ConnectionProfileType)profileType == ConnectionProfileType.Cellular) + { + CellularProfile cur = new CellularProfile(profileH); + Result.Add(cur); + } + else { + ConnectionProfile cur = new ConnectionProfile(profileH); + Result.Add(cur); + } + } + Interop.Connection.DestroyProfileIterator(iterator); + task.SetResult(Result); + return task.Task; + } + + internal Task OpenProfileAsync(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "OpenProfileAsync"); + if (profile != null) + { + Log.Debug(Globals.LogTag, "OpenProfileAsync " + profile.Name); + TaskCompletionSource task = new TaskCompletionSource(); + Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) => + { + Log.Debug(Globals.LogTag, "Connected " + profile.Name); + if (Result != ConnectionError.None) + { + Log.Error(Globals.LogTag, "Error occurs during connecting profile, " + Result); + task.SetException(new InvalidOperationException("Error occurs during connecting profile, " + Result)); + } + + task.SetResult(true); + }; + + int ret = Interop.Connection.OpenProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to connect profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + + internal Task CloseProfileAsync(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "CloseProfileAsync"); + if (profile != null) + { + Log.Debug(Globals.LogTag, "CloseProfileAsync " + profile.Name); + TaskCompletionSource task = new TaskCompletionSource(); + Interop.Connection.ConnectionCallback Callback = (ConnectionError Result, IntPtr Data) => + { + if (Result != ConnectionError.None) + { + Log.Error(Globals.LogTag, "Error occurs during disconnecting profile, " + Result); + task.SetException(new InvalidOperationException("Error occurs during disconnecting profile, " + Result)); + } + + task.SetResult(true); + }; + + int ret = Interop.Connection.CloseProfile(GetHandle(), profile.ProfileHandle, Callback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to disconnect profile, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.set)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (GetHandle() == IntPtr.Zero || profile.ProfileHandle == IntPtr.Zero), "Connection or Profile Handle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("Profile is null"); + } + } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs new file mode 100755 index 0000000..0b574b5 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionManager.cs @@ -0,0 +1,628 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +/// +/// The Connection API provides functions, enumerations to get the status of network and current profile and manage profiles. +/// +namespace Tizen.Network.Connection +{ + /// + /// This class manages the connection handle resources. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class SafeConnectionHandle : SafeHandle + { + internal SafeConnectionHandle(IntPtr handle) : base(handle, true) + { + } + + /// + /// Checks whether the handle value is valid or not. + /// + /// True if the handle is invalid, otherwise false. + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + /// + /// Frees the handle. + /// + /// True if the handle is released successfully, otherwise false. + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } + + /// + /// This class is ConnectionManager. It provides functions to manage data connections. + /// + /// 3 + public static class ConnectionManager + { + private static ConnectionItem _currentConnection = null; + + /// + /// Event that is called when the type of the current connection is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + public static event EventHandler ConnectionTypeChanged + { + add + { + ConnectionInternalManager.Instance.ConnectionTypeChanged += value; + } + + remove + { + ConnectionInternalManager.Instance.ConnectionTypeChanged -= value; + } + } + + /// + /// Event for ethernet cable is plugged [in/out] event. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + public static event EventHandler EthernetCableStateChanged + { + add + { + ConnectionInternalManager.Instance.EthernetCableStateChanged += value; + } + + remove + { + ConnectionInternalManager.Instance.EthernetCableStateChanged -= value; + } + } + + /// + /// Event that is called when the IP address is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + public static event EventHandler IPAddressChanged + { + add + { + ConnectionInternalManager.Instance.IPAddressChanged += value; + } + + remove + { + ConnectionInternalManager.Instance.IPAddressChanged -= value; + } + } + + /// + /// Event that is called when the proxy address is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + public static event EventHandler ProxyAddressChanged + { + add + { + ConnectionInternalManager.Instance.ProxyAddressChanged += value; + } + + remove + { + ConnectionInternalManager.Instance.ProxyAddressChanged -= value; + } + } + + /// + /// Gets the connection handle. + /// + /// 3 + /// Instance of SafeConnectionHandle + [EditorBrowsable(EditorBrowsableState.Never)] + public static SafeConnectionHandle GetConnectionHandle() + { + IntPtr handle = ConnectionInternalManager.Instance.GetHandle(); + return new SafeConnectionHandle(handle); + } + + /// + /// Gets the IP address of the current connection. + /// + /// 3 + /// The address family + /// IP address of the connection (global address in case of IPv6). + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static System.Net.IPAddress GetIPAddress(AddressFamily family) + { + return ConnectionInternalManager.Instance.GetIPAddress(family); + } + + /// + /// Gets the all IPv6 addresses of the current connection. + /// + /// 3 + /// The type of current network connection + /// A list of IPv6 addresses of the connection. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static IEnumerable GetAllIPv6Addresses(ConnectionType type) + { + return ConnectionInternalManager.Instance.GetAllIPv6Addresses(type); + } + + /// + /// Gets the proxy address of the current connection. + /// + /// 3 + /// The address family + /// Proxy address of the connection. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static string GetProxy(AddressFamily family) + { + return ConnectionInternalManager.Instance.GetProxy(family); + } + + /// + /// Gets the MAC address of the Wi-Fi or ethernet. + /// + /// 3 + /// The type of current network connection + /// MAC address of the Wi-Fi or ethernet. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static string GetMacAddress(ConnectionType type) + { + return ConnectionInternalManager.Instance.GetMacAddress(type); + } + + /// + /// Gets the statistics information. + /// + /// 3 + /// The type of connection (only WiFi and Cellular are supported) + /// The type of statistics + /// The statistics information associated with statisticsType + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static long GetStatistics(ConnectionType connectionType, StatisticsType statisticsType) + { + return ConnectionInternalManager.Instance.GetStatistics(connectionType, statisticsType); + } + + /// + /// Resets the statistics information. + /// + /// 3 + /// The type of connection (only WiFi and Cellular are supported) + /// The type of statistics + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.set + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static void ResetStatistics(ConnectionType connectionType, StatisticsType statisticsType) + { + ConnectionInternalManager.Instance.ResetStatistics(connectionType, statisticsType); + } + + /// + /// Adds a route to the routing table. + /// + /// The address family + /// The name of network interface + /// The IP address of the host + /// The gateway address + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.set + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when interfaceName or hostAddress or gateway is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static void AddRoute(AddressFamily family, string interfaceName, System.Net.IPAddress hostAddress, System.Net.IPAddress gateway) + { + ConnectionInternalManager.Instance.AddRoute(family, interfaceName, hostAddress, gateway); + } + + /// + /// Removes a route from the routing table. + /// + /// The address family + /// The name of network interface + /// The IP address of the host + /// The gateway address + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.set + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when interfaceName or hostAddress or gateway is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation. + public static void RemoveRoute(AddressFamily family, string interfaceName, System.Net.IPAddress hostAddress, System.Net.IPAddress gateway) + { + ConnectionInternalManager.Instance.RemoveRoute(family, interfaceName, hostAddress, gateway); + } + + /// + /// Type and state of the current profile for data connection + /// + /// 3 + /// Instance of ConnectionItem + public static ConnectionItem CurrentConnection + { + get + { + if (_currentConnection == null) + { + _currentConnection = new ConnectionItem(); + } + + return _currentConnection; + } + } + + /// + /// Creates a cellular profile handle. + /// + /// 3 + /// The type of profile. Cellular profile type is supported. + /// The keyword included in profile name. + /// CellularProfile object + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when keyword value is null. + /// Thrown when method failed due to invalid operation. + public static CellularProfile CreateCellularProfile(ConnectionProfileType type, string keyword) + { + IntPtr profileHandle = IntPtr.Zero; + if (type == ConnectionProfileType.Cellular) + { + profileHandle = ConnectionInternalManager.Instance.CreateCellularProfile(type, keyword); + } + + else + { + Log.Error(Globals.LogTag, "ConnectionProfile Type is not supported"); + ConnectionErrorFactory.ThrowConnectionException((int)ConnectionError.InvalidParameter); + } + + return new CellularProfile(profileHandle); + } + + /// + /// The state of cellular connection. + /// + /// 3 + /// Cellular network state. + /// http://tizen.org/privilege/network.get + public static CellularState CellularState + { + get + { + return ConnectionInternalManager.Instance.CellularState; + } + } + + /// + /// The state of the Wi-Fi. + /// + /// 3 + /// WiFi connection state. + /// http://tizen.org/privilege/network.get + public static ConnectionState WiFiState + { + get + { + return ConnectionInternalManager.Instance.WiFiState; + } + } + + /// + /// The state of the Bluetooth. + /// + /// 3 + /// Bluetooth connection state. + /// http://tizen.org/privilege/network.get + public static ConnectionState BluetoothState + { + get + { + return ConnectionInternalManager.Instance.BluetoothState; + } + } + + /// + /// The Ethernet connection state. + /// + /// 3 + /// Ethernet connection state. + /// http://tizen.org/privilege/network.get + public static ConnectionState EthernetState + { + get + { + return ConnectionInternalManager.Instance.EthernetState; + } + } + + /// + /// Checks for ethernet cable is attached or not. + /// + /// 3 + /// Ethernet cable state. + /// http://tizen.org/privilege/network.get + public static EthernetCableState EthernetCableState + { + get + { + return ConnectionInternalManager.Instance.EthernetCableState; + } + } + + } // class ConnectionManager + + /// + /// This class contains connection information such as connection type and state. + /// + /// 3 + public class ConnectionItem + { + internal ConnectionItem() + { + } + + /// + /// The type of the current profile for data connection. + /// + /// 3 + /// Data connection current profile. + /// http://tizen.org/privilege/network.get + public ConnectionType Type + { + get + { + return ConnectionInternalManager.Instance.ConnectionType; + } + } + + /// + /// The state of the current profile for data connection. + /// + /// 3 + /// Connection state of the current connection type. + /// http://tizen.org/privilege/network.get + public ConnectionState State + { + get + { + if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Cellular) + { + if (ConnectionInternalManager.Instance.CellularState == CellularState.Connected) + { + return ConnectionState.Connected; + } + else if (ConnectionInternalManager.Instance.CellularState == CellularState.Available) + { + return ConnectionState.Disconnected; + } + else { + return ConnectionState.Deactivated; + } + } + else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Bluetooth) + { + return ConnectionInternalManager.Instance.BluetoothState; + } + else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.WiFi) + { + return ConnectionInternalManager.Instance.WiFiState; + } + else if (ConnectionInternalManager.Instance.ConnectionType == ConnectionType.Ethernet) + { + return ConnectionInternalManager.Instance.EthernetState; + } + else { // TO DO : Add Net Proxy + return ConnectionState.Disconnected; + } + } + } + } // class ConnectionItem + + /// + /// An extended EventArgs class which contains changed connection type. + /// + /// 3 + public class ConnectionTypeEventArgs : EventArgs + { + private ConnectionType Type = ConnectionType.Disconnected; + + internal ConnectionTypeEventArgs(ConnectionType type) + { + Type = type; + } + + /// + /// The connection type. + /// + /// 3 + /// Type of the connection. + public ConnectionType ConnectionType + { + get + { + return Type; + } + } + } + + /// + /// An extended EventArgs class which contains changed ethernet cable state. + /// + /// 3 + public class EthernetCableStateEventArgs : EventArgs + { + private EthernetCableState State; + + internal EthernetCableStateEventArgs(EthernetCableState state) + { + State = state; + } + + /// + /// The ethernet cable state. + /// + /// 3 + /// Attached or detached state of the ethernet cable. + public EthernetCableState EthernetCableState + { + get + { + return State; + } + } + } + + /// + /// An extended EventArgs class which contains changed address. + /// + /// 3 + public class AddressEventArgs : EventArgs + { + private string IPv4 = ""; + private string IPv6 = ""; + + internal AddressEventArgs(string ipv4, string ipv6) + { + IPv4 = ipv4; + IPv6 = ipv6; + } + + /// + /// The IPV4 address. + /// + /// 3 + /// IP address in the format of IPV4 syntax. + public string IPv4Address + { + get + { + return IPv4; + } + } + + /// + /// The IPV6 address. + /// + /// 3 + /// IP address in the format of IPV6 syntax. + public string IPv6Address + { + get + { + return IPv6; + } + } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs new file mode 100755 index 0000000..87fc8a2 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfile.cs @@ -0,0 +1,450 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Connection +{ + /// + /// This Class is ConnectionProfile. It provides event and propeties of the connection profile. + /// + /// 3 + public class ConnectionProfile : IDisposable + { + internal IntPtr ProfileHandle = IntPtr.Zero; + private IAddressInformation IPv4; + private IAddressInformation IPv6; + private bool disposed = false; + private EventHandler _ProfileStateChanged = null; + + private Interop.ConnectionProfile.ProfileStateChangedCallback _profileChangedCallback; + + internal IntPtr GetHandle() + { + return ProfileHandle; + } + + /// + /// The event that is called when the state of profile is changed. + /// + /// 3 + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + public event EventHandler ProfileStateChanged + { + add + { + Log.Debug(Globals.LogTag, "ProfileStateChanged add"); + if (_ProfileStateChanged == null) + { + ProfileStateChangedStart(); + } + _ProfileStateChanged += value; + } + remove + { + Log.Debug(Globals.LogTag, "ProfileStateChanged remove"); + _ProfileStateChanged -= value; + if (_ProfileStateChanged == null) + { + ProfileStateChangedStop(); + } + } + } + + private void ProfileStateChangedStart() + { + _profileChangedCallback = (ProfileState state, IntPtr userData) => + { + if (_ProfileStateChanged != null) + { + _ProfileStateChanged(null, new ProfileStateEventArgs(state)); + } + }; + + Log.Debug(Globals.LogTag, "ProfileStateChangedStart"); + int ret = Interop.ConnectionProfile.SetStateChangeCallback(ProfileHandle, _profileChangedCallback, IntPtr.Zero); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to register callback for changing profile state, " + (ConnectionError)ret); + } + } + + private void ProfileStateChangedStop() + { + Log.Debug(Globals.LogTag, "ProfileStateChangedStop"); + int ret = Interop.ConnectionProfile.UnsetStateChangeCallback(ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to unregister callback for changing profile state, " + (ConnectionError)ret); + } + } + + internal ConnectionProfile(IntPtr handle) + { + ProfileHandle = handle; + IPv4 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.IPv4); + IPv6 = new ConnectionAddressInformation(ProfileHandle, AddressFamily.IPv6); + } + + ~ConnectionProfile() + { + Dispose(false); + } + + /// + /// Disposes the memory allocated to unmanaged resources. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + Log.Debug(Globals.LogTag, ">>> ConnectionProfile Dispose with " + disposing); + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + UnregisterEvents(); + Destroy(); + } + disposed = true; + } + + private void UnregisterEvents() + { + if (_ProfileStateChanged != null) + { + ProfileStateChangedStop(); + } + } + + private void Destroy() + { + Interop.ConnectionProfile.Destroy(ProfileHandle); + ProfileHandle = IntPtr.Zero; + } + + internal void CheckDisposed() + { + if (disposed) + { + throw new ObjectDisposedException(GetType().FullName); + } + } + + /// + /// The profile ID. + /// + /// 3 + /// Unique ID of the profile. + public string Id + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetId(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get id of connection profile, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + } + } + + /// + /// The profile name. + /// + /// 3 + /// User friendly name of the profile. + public string Name + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetName(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get name of connection profile, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + } + } + + /// + /// The network type. + /// + /// 3 + /// Profile type of the network connection. + public ConnectionProfileType Type + { + get + { + int Value; + int ret = Interop.ConnectionProfile.GetType(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get type of connection profile, " + (ConnectionError)ret); + } + return (ConnectionProfileType)Value; + } + } + + /// + /// The name of the network interface. + /// + /// 3 + /// Network interface name, e.g. eth0 and pdp0. + public string InterfaceName + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetNetworkInterfaceName(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get network interface name, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + } + } + + /// + /// Refreshes the profile information. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when profile instance is invalid or when method failed due to invalid operation + /// Thrown when operation is performed on a disposed object. + public void Refresh() + { + CheckDisposed(); + int ret = Interop.ConnectionProfile.Refresh(ProfileHandle); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get network interface name, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckPermissionDeniedException(ret, "(http://tizen.org/privilege/network.get)"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + /// + /// Get the network state. + /// + /// 3 + /// The address family + /// The network state. + /// http://tizen.org/feature/network.ethernet + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when value is invalid parameter. + /// Thrown when profile instance is invalid or when method failed due to invalid operation + /// Thrown when operation is performed on a disposed object. + public ProfileState GetState(AddressFamily family) + { + CheckDisposed(); + int Value; + int ret = (int)ConnectionError.None; + if (family == AddressFamily.IPv4) + { + ret = Interop.ConnectionProfile.GetState(ProfileHandle, out Value); + } + + else + { + ret = Interop.ConnectionProfile.GetIPv6State(ProfileHandle, out Value); + } + + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get profile state, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + + return (ProfileState)Value; + } + + /// + /// The Proxy type. + /// + /// 3 + /// Proxy type of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown during set when operation is performed on a disposed object. + public ProxyType ProxyType + { + get + { + int Value; + int ret = Interop.ConnectionProfile.GetProxyType(ProfileHandle, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get proxy type, " + (ConnectionError)ret); + } + return (ProxyType)Value; + + } + + set + { + CheckDisposed(); + int ret = Interop.ConnectionProfile.SetProxyType(ProfileHandle, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set proxy type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + /// + /// The proxy address. + /// + /// 3 + /// Proxy address of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when value is null. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public string ProxyAddress + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetProxyAddress(ProfileHandle, (int)AddressFamily.IPv4, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get proxy address, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + return result; + + } + + set + { + CheckDisposed(); + if (value != null) + { + int ret = Interop.ConnectionProfile.SetProxyAddress(ProfileHandle, (int)AddressFamily.IPv4, value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set proxy address, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("ProxyAddress is null"); + } + } + } + + /// + /// The address information (IPv4) + /// + /// 3 + /// Instance of IAddressInformation with IPV4 address. + public IAddressInformation IPv4Settings + { + get + { + return IPv4; + + } + } + + /// + /// The address information (IPv6) + /// + /// 3 + /// Instance of IAddressInformation with IPV6 address. + public IAddressInformation IPv6Settings + { + get + { + return IPv6; + } + } + } + + /// + /// An extended EventArgs class which contains changed profile state. + /// + /// 3 + public class ProfileStateEventArgs : EventArgs + { + private ProfileState _State = ProfileState.Disconnected; + + internal ProfileStateEventArgs(ProfileState state) + { + _State = state; + } + + /// + /// The profile state. + /// + /// 3 + /// State type of the connection profile. + public ProfileState State + { + get + { + return _State; + } + } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs new file mode 100755 index 0000000..5049686 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionProfileManager.cs @@ -0,0 +1,268 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Collections; + +namespace Tizen.Network.Connection +{ + /// + /// This class is ConnectionProfileManager. It provides functions to add, get, connect or modify the connection profile. + /// + /// 3 + public static class ConnectionProfileManager + { + /// + /// Adds a new profile + /// + /// 3 + /// The cellular profile object + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static void AddCellularProfile(CellularProfile profile) + { + Log.Debug(Globals.LogTag, "AddCellularProfile"); + ConnectionInternalManager.Instance.AddCellularProfile(profile); + } + + /// + /// Gets the list of profile with profile list type + /// + /// 3 + /// The type of profile + /// List of connection profile objects. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance has been disposed. + public static Task> GetProfileListAsync(ProfileListType type) + { + Log.Debug(Globals.LogTag, "GetProfileListAsync"); + return ConnectionInternalManager.Instance.GetProfileListAsync(type); + } + + /// + /// Opens a connection of profile, asynchronously. + /// + /// 3 + /// The connection profile object + /// A task indicates whether the ConnectProfileAsync method is done successfully or not. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.set + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static Task ConnectProfileAsync(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "ConnectProfile"); + return ConnectionInternalManager.Instance.OpenProfileAsync(profile); + } + + /// + /// Closes a connection of profile. + /// + /// 3 + /// The connection profile object + /// A task indicates whether the DisconnectProfileAsync method is done successfully or not. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.set + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static Task DisconnectProfileAsync(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "DisconnectProfileAsync"); + return ConnectionInternalManager.Instance.CloseProfileAsync(profile); + } + + /// + /// Removes an existing profile. + /// + /// 3 + /// The connection profile object + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static void RemoveProfile(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "RemoveProfile. Id: " + profile.Id + ", Name: " + profile.Name + ", Type: " + profile.Type); + ConnectionInternalManager.Instance.RemoveProfile(profile); + } + + /// + /// Updates an existing profile. + /// When a profile is changed, these changes will be not applied to the ConnectionProfileManager immediately. + /// When you call this function, your changes affect the ConnectionProfileManager and the existing profile is updated. + /// + /// 3 + /// The connection profile object + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static void UpdateProfile(ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "UpdateProfile"); + ConnectionInternalManager.Instance.UpdateProfile(profile); + } + + /// + /// Gets the name of the default profile. + /// + /// 3 + /// Connection profile object. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation + public static ConnectionProfile GetCurrentProfile() + { + Log.Debug(Globals.LogTag, "GetCurrentProfile"); + return ConnectionInternalManager.Instance.GetCurrentProfile(); + } + + /// + /// Gets the default profile which provides the given cellular service. + /// + /// 3 + /// The cellular service type + /// Connection profile object. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection instance is invalid or when method failed due to invalid operation + public static ConnectionProfile GetDefaultCellularProfile(CellularServiceType type) + { + Log.Debug(Globals.LogTag, "GetDefaultCurrentProfile"); + return ConnectionInternalManager.Instance.GetDefaultCellularProfile(type); + } + + /// + /// Sets the default profile which provides the given cellular service. + /// + /// 3 + /// The cellular service type + /// The connection profile object + /// A task indicates whether the SetDefaultCellularProfile method is done successfully or not. + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/feature/network.tethering.bluetooth + /// http://tizen.org/feature/network.ethernet + /// Thrown when feature is not supported. + /// Thrown when permission is denied. + /// Thrown when value is invalid parameter. + /// Thrown when value is null. + /// Thrown when memory is not enough to continue execution. + /// Thrown when connection or profile instance is invalid or when method failed due to invalid operation + public static Task SetDefaultCellularProfile(CellularServiceType type, ConnectionProfile profile) + { + Log.Debug(Globals.LogTag, "SetDefaultCellularProfile"); + return ConnectionInternalManager.Instance.SetDefaultCellularProfile(type, profile); + } + } + + /// + /// An extended EventArgs class which contains the state of changed connection profile. + /// + /// 3 + public class ConnectionProfileStateEventArgs : EventArgs + { + private ConnectionProfileState State; + + internal ConnectionProfileStateEventArgs(ConnectionProfileState state) + { + State = state; + } + + /// + /// The connection profile state. + /// + /// 3 + /// State of the connection profile. + public ConnectionProfileState ConnectionProfileState + { + get + { + return State; + } + } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionTypes.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionTypes.cs new file mode 100755 index 0000000..6c206ff --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/ConnectionTypes.cs @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Tizen.Internals.Errors; + + +namespace Tizen.Network.Connection +{ + /// + /// Enumeration for connection type. + /// + /// 3 + public enum ConnectionType + { + Disconnected = 0, /**< Disconnected */ + WiFi = 1, /**< Wi-Fi type */ + Cellular = 2, /**< Cellular type */ + Ethernet = 3, /**< Ethernet type */ + Bluetooth = 4, /**< Bluetooth type */ + NetProxy = 5 /**< Proxy type for internet connection */ + } + + /// + /// Enumeration for address family. + /// + /// 3 + public enum AddressFamily + { + IPv4 = 0, /**< IPv4 Address */ + IPv6 = 1 /**< IPv6 Address */ + } + + /// + /// Enumeration for cellular network state. + /// + /// 3 + public enum CellularState + { + OutOfService = 0, /**< Out of service */ + FlightMode = 1, /**< Flight mode */ + RoamingOff = 2, /**< Roaming is turned off */ + CallOnlyAvailable = 3, /**< Call is only available */ + Available = 4, /**< Available but not connected yet */ + Connected = 5, /**< Connected */ + } + + /// + /// Enumeration for connection state. + /// + /// 3 + public enum ConnectionState + { + Deactivated = 0, /**< Deactivated */ + Disconnected = 1, /**< Disconnected */ + Connected = 2, /**< Connected */ + } + + /// + /// This enumeration defines the attached or detached state of ethernet cable. + /// + /// 3 + public enum EthernetCableState + { + Detached = 0, /**< Ethernet cable is detached */ + Attached = 1, /**< Ethernet cable is attached */ + } + + /// + /// Enumeration for statistics type. + /// + /// 3 + public enum StatisticsType + { + LastReceivedData = 0, /**< Last received data */ + LastSentData = 1, /**< Last sent data */ + TotalReceivedData = 2, /**< Total received data */ + TotalSentData = 3, /**< Total sent data */ + } + + /// + /// Enumeration for network connection type. + /// + /// 3 + public enum ConnectionProfileType + { + Cellular = 0, /**< Cellular type */ + WiFi = 1, /**< Wi-Fi type */ + Ethernet = 2, /**< Ethernet type */ + Bt = 3, /**< Bluetooth type */ + } + + /// + /// Enumeration for profile state type. + /// + /// 3 + public enum ProfileState + { + Disconnected = 0, /**< Disconnected state */ + Association = 1, /**< Association state */ + Configuration = 2, /**< Configuration state */ + Connected = 3, /**< Connected state */ + } + + /// + /// Enumeration for proxy method type. + /// + /// 3 + public enum ProxyType + { + Direct = 0, /**< Direct connection */ + Auto = 1, /**< Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried */ + Manual = 2, /**< Manual configuration */ + } + + /// + /// Enumeration for IP configuration type. + /// + /// 3 + public enum IPConfigType + { + None = 0, /**< Not defined */ + Static = 1, /**< Manual IP configuration */ + Dynamic = 2, /**< Config IP using DHCP client*/ + Auto = 3, /**< Config IP from Auto IP pool (169.254/16). Later with DHCP client, if available */ + Fixed = 4, /**< Indicates an IP address that can not be modified */ + } + + /// + /// Enumeration for cellular service type. + /// + /// 3 + public enum CellularServiceType + { + Unknown = 0, /**< Unknown */ + Internet = 1, /**< Internet */ + MMS = 2, /**< MMS */ + PrepaidInternet = 3, /**< Prepaid internet */ + PrepaidMMS = 4, /**< Prepaid MMS */ + Tethering = 5, /**< Tethering */ + Application = 6, /**< Specific application */ + } + + /// + /// Enumeration for cellular pdn type. + /// + /// 3 + public enum CellularPdnType + { + Unknown = 0, /**< Unknown */ + IPv4 = 1, /**< IPv4 */ + IPv6 = 2, /**< IPv6 */ + IPv4_IPv6 = 3, /**< Both IPv4 and IPv6 */ + } + + /// + /// Enumeration for DNS configuration type. + /// + /// 3 + public enum DnsConfigType + { + None = 0, /**< Not defined */ + Static = 1, /**< Manual DNS configuration */ + Dynamic = 2, /**< Config DNS using DHCP client */ + } + + static internal class ConnectionErrorValue + { + internal const int Base = -0x01C10000; + } + + + /// + /// Enumeration for connection errors. + /// + /// 3 + // To do : have to assign valid error code + public enum ConnectionError + { + None = ErrorCode.None, /**< Successful */ + InvalidParameter = ErrorCode.InvalidParameter, /**< Invalid parameter */ + OutOfMemoryError = ErrorCode.OutOfMemory, /**< Out of memory error */ + InvalidOperation = ErrorCode.InvalidOperation, /**< Invalid Operation */ + AddressFamilyNotSupported = ErrorCode.AddressFamilyNotSupported, /**< Address family not supported */ + OperationFailed = ConnectionErrorValue.Base | 0x0401, /**< Operation failed */ + EndOfIteration = ConnectionErrorValue.Base | 0x0402, /**< End of iteration */ + NoConnection = ConnectionErrorValue.Base | 0x0403, /**< There is no connection */ + NowInProgress = ErrorCode.NowInProgress, /** Now in progress */ + AlreadyExists = ConnectionErrorValue.Base | 0x0404, /**< Already exists */ + OperationAborted = ConnectionErrorValue.Base | 0x0405, /**< Operation is aborted */ + DhcpFailed = ConnectionErrorValue.Base | 0x0406, /**< DHCP failed */ + InvalidKey = ConnectionErrorValue.Base | 0x0407, /**< Invalid key */ + NoReply = ConnectionErrorValue.Base | 0x0408, /**< No reply */ + PermissionDenied = ErrorCode.PermissionDenied, /**< Permission denied */ + NotSupported = ErrorCode.NotSupported /**< Not Supported */ + } + + /// + /// Enumeration for profile list type. + /// + /// 3 + public enum ProfileListType + { + Registered = 0, /**< The iterator of the registered profile */ + Connected = 1, /**< The iterator of the connected profile */ + Default = 2, /**< The iterator of the default profile */ + } + + /// + /// Enumeration for security type of Wi-Fi. + /// + /// 3 + public enum WiFiSecurityType + { + None = 0, /**< Security disabled */ + Wep = 1, /**< WEP */ + WpaPsk = 2, /**< WPA-PSK */ + Wpa2Psk = 3, /**< WPA2-PSK */ + Eap = 4, /**< EAP */ + } + + /// + /// Enumeration for encryption modes. + /// + /// 3 + public enum WiFiEncryptionType + { + None = 0, /**< Encryption disabled */ + Wep = 1, /**< WEP */ + Tkip = 2, /**< TKIP */ + Aes = 3, /**< AES */ + TkipAesMixed = 4, /**< TKIP and AES are both supported */ + } + + /// + /// Enumeration for connection profile state. + /// + /// 3 + public enum ConnectionProfileState + { + Disconnected = 0, /**< Disconnected state */ + Association = 1, /**< Association state */ + Configuration = 2, /**< Configuration state */ + Connected = 3, /**< Connected state */ + } + + /// + /// Enumeration for cellular authentication type. + /// + /// 3 + public enum CellularAuthType + { + None = 0, /**< No authentication */ + Pap = 1, /**< PAP authentication */ + Chap = 2, /**< CHAP authentication */ + } + + public enum AddressInformationType + { + Connection = 0, + WiFi = 1 + } + + static internal class Globals + { + internal const string LogTag = "Tizen.Network.Connection"; + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs new file mode 100755 index 0000000..5185186 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/IAddressInformation.cs @@ -0,0 +1,383 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Collections; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Connection +{ + /// + /// This interface provides properties to manage address information of the connection. + /// + /// 3 + public interface IAddressInformation + { + /// + /// The DNS address. + /// + /// 3 + /// First DNS address of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + System.Net.IPAddress Dns1 { get; set; } + + /// + /// The DNS address. + /// + /// 3 + /// Second DNS address of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + System.Net.IPAddress Dns2 { get; set; } + + /// + /// The gateway address. + /// + /// 3 + /// Gateway address of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + System.Net.IPAddress Gateway { get; set; } + + /// + /// The subnet mask address. + /// + /// 3 + /// Subnet mask of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + System.Net.IPAddress SubnetMask { get; set; } + + /// + /// The IP address. + /// + /// 3 + /// IP address of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + System.Net.IPAddress IP { get; set; } + + /// + /// The type of IP config. + /// + /// 3 + /// IP config type of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + IPConfigType IPConfigType { get; set; } + + /// + /// The prefix length. + /// + /// 3 + /// Prefix length of the connection. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + int PrefixLength { get; set; } + + /// + /// The DNS config type. + /// + /// 3 + /// Config type of the DNS. + /// Thrown during set when feature is not supported. + /// Thrown during set when value is invalid parameter. + /// Thrown during set when profile instance is invalid or when method failed due to invalid operation. + DnsConfigType DnsConfigType { get; set; } + + /// + /// The DHCP server address. It is only supported for IPV4 address family. + /// + /// Server address of the DHCP. + System.Net.IPAddress DhcpServerAddress { get; } + } + + internal class ConnectionAddressInformation : IAddressInformation + { + private IntPtr _profileHandle; + private AddressFamily _family; + + internal ConnectionAddressInformation(IntPtr handle, AddressFamily family) + { + _profileHandle = handle; + _family = family; + } + + public System.Net.IPAddress Dns1 + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetDnsAddress(_profileHandle, 1, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get dns1 address, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + if (result == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(result); + } + + set + { + int ret = Interop.ConnectionProfile.SetDnsAddress(_profileHandle, 1, (int)_family, value.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set dns1 address, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + public System.Net.IPAddress Dns2 + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetDnsAddress(_profileHandle, 2, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get dns2 address, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + if (result == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(result); + } + + set + { + int ret = Interop.ConnectionProfile.SetDnsAddress(_profileHandle, 2, (int)_family, value.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set dns2 address, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + public System.Net.IPAddress Gateway + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetGatewayAddress(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get gateway, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + if (result == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(result); + } + + set + { + int ret = Interop.ConnectionProfile.SetGatewayAddress(_profileHandle, (int)_family, value.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set gateway, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + + public System.Net.IPAddress SubnetMask + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetSubnetMask(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get subnet mask, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + if (result == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(result); + } + + set + { + int ret = Interop.ConnectionProfile.SetSubnetMask(_profileHandle, (int)_family, value.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set subnet mask, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + + public System.Net.IPAddress IP + { + get + { + IntPtr Value; + int ret = Interop.ConnectionProfile.GetIPAddress(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get ip, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(Value); + Interop.Libc.Free(Value); + if (result == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(result); + } + + set + { + int ret = Interop.ConnectionProfile.SetIPAddress(_profileHandle, (int)_family, value.ToString()); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set ip, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + public IPConfigType IPConfigType + { + get + { + int Value; + int ret = Interop.ConnectionProfile.GetIPConfigType(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get ip config type, " + (ConnectionError)ret); + } + return (IPConfigType)Value; + } + + set + { + int ret = Interop.ConnectionProfile.SetIPConfigType(_profileHandle, (int)_family, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set ip config type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + public int PrefixLength + { + get + { + int Value; + int ret = Interop.ConnectionProfile.GetPrefixLength(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get prefix length, " + (ConnectionError)ret); + } + return Value; + } + + set + { + int ret = Interop.ConnectionProfile.SetPrefixLength(_profileHandle, (int)_family, value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set prefix length, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + public DnsConfigType DnsConfigType + { + get + { + int Value; + int ret = Interop.ConnectionProfile.GetDnsConfigType(_profileHandle, (int)_family, out Value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get DNS config type, " + (ConnectionError)ret); + } + return (DnsConfigType)Value; + } + + set + { + int ret = Interop.ConnectionProfile.SetDnsConfigType(_profileHandle, (int)_family, (int)value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set DNS config type, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.telephony " + "http://tizen.org/feature/network.wifi " + "http://tizen.org/feature/network.tethering.bluetooth " + "http://tizen.org/feature/network.ethernet"); + ConnectionErrorFactory.CheckHandleNullException(ret, (_profileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + } + + public System.Net.IPAddress DhcpServerAddress + { + get + { + string dhcpServer; + int ret = Interop.ConnectionProfile.GetDhcpServerAddress(_profileHandle, _family, out dhcpServer); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get the DHCP server address, " + (ConnectionError)ret); + } + + if (dhcpServer == null) + { + return System.Net.IPAddress.Parse("0.0.0.0"); + } + + else + { + return System.Net.IPAddress.Parse(dhcpServer); + } + } + } + } +} diff --git a/src/Tizen.Network.Connection/Tizen.Network.Connection/WiFiProfile.cs b/src/Tizen.Network.Connection/Tizen.Network.Connection/WiFiProfile.cs new file mode 100755 index 0000000..8ac6234 --- /dev/null +++ b/src/Tizen.Network.Connection/Tizen.Network.Connection/WiFiProfile.cs @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.InteropServices; + +namespace Tizen.Network.Connection +{ + /// + /// This Class is WiFiProfile. It provides functions to manage the WiFi profile. + /// + /// 3 + public class WiFiProfile : ConnectionProfile + { + internal WiFiProfile(IntPtr Handle) : base(Handle) + { + } + + ~WiFiProfile() + { + } + + /// + /// The ESSID (Extended Service Set Identifier). + /// + /// 3 + /// ESSID of the WiFi. + public string Essid + { + get + { + IntPtr value; + int ret = Interop.ConnectionWiFiProfile.GetEssid(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to create profile handle, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(value); + Interop.Libc.Free(value); + return result; + } + } + + /// + /// The BSSID (Basic Service Set Identifier). + /// + /// 3 + /// BSSID of the WiFi. + public string Bssid + { + get + { + IntPtr value; + int ret = Interop.ConnectionWiFiProfile.GetBssid(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get bssid, " + (ConnectionError)ret); + } + string result = Marshal.PtrToStringAnsi(value); + Interop.Libc.Free(value); + return result; + } + } + + /// + /// The RSSI. + /// + /// 3 + /// RSSI of the WiFi. + public int Rssi + { + get + { + int value; + int ret = Interop.ConnectionWiFiProfile.GetRssi(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get rssi, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// The frequency (MHz). + /// + /// 3 + /// Frequency of the WiFi. + public int Frequency + { + get + { + int value; + int ret = Interop.ConnectionWiFiProfile.GetFrequency(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get frequency, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// The max speed (Mbps). + /// + /// 3 + /// Maximum speed of the WiFi. + public int MaxSpeed + { + get + { + int value; + int ret = Interop.ConnectionWiFiProfile.GetMaxSpeed(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get max speed, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// The security type of WiFi. + /// + /// 3 + /// Security type of the WiFi. + public WiFiSecurityType SecurityType + { + get + { + int value; + int ret = Interop.ConnectionWiFiProfile.GetSecurityType(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get security type, " + (ConnectionError)ret); + } + return (WiFiSecurityType)value; + } + } + + /// + /// The encryption type of WiFi. + /// + /// 3 + /// Encryption mode of the WiFi. + public WiFiEncryptionType EncryptionType + { + get + { + int value; + int ret = Interop.ConnectionWiFiProfile.GetEncryptionType(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get encryption type, " + (ConnectionError)ret); + } + return (WiFiEncryptionType)value; + } + } + + /// + /// Checks whether passphrase is required. + /// + /// 3 + /// True if a passphrase is required, otherwise false. + /// This property is not valid if WiFiSecurityType is Eap. + public bool PassphraseRequired + { + get + { + bool value; + int ret = Interop.ConnectionWiFiProfile.IsRequiredPassphrase(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get PassphraseRequired, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// Checks whether the WPS (Wi-Fi Protected Setup) is supported. + /// + /// 3 + /// True if WPS is supported, otherwise false. + public bool WpsSupported + { + get + { + bool value; + int ret = Interop.ConnectionWiFiProfile.IsSupportedWps(ProfileHandle, out value); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to get IsSupportedWps, " + (ConnectionError)ret); + } + return value; + } + } + + /// + /// Sets the passphrase of the Wi-Fi WPA. + /// + /// 3 + /// The passphrase of Wi-Fi security + /// http://tizen.org/feature/network.wifi + /// Thrown when feature is not supported. + /// Thrown when value is invalid parameter. + /// Thrown when passphrase is null. + /// Thrown when profile instance is invalid or when method failed due to invalid operation. + /// Thrown when operation is performed on a disposed object. + public void SetPassphrase(string passphrase) + { + CheckDisposed(); + if (passphrase != null) + { + int ret = Interop.ConnectionWiFiProfile.SetPassphrase(ProfileHandle, passphrase); + if ((ConnectionError)ret != ConnectionError.None) + { + Log.Error(Globals.LogTag, "It failed to set passphrase, " + (ConnectionError)ret); + ConnectionErrorFactory.CheckFeatureUnsupportedException(ret, "http://tizen.org/feature/network.wifi"); + ConnectionErrorFactory.CheckHandleNullException(ret, (ProfileHandle == IntPtr.Zero), "ProfileHandle may have been disposed or released"); + ConnectionErrorFactory.ThrowConnectionException(ret); + } + } + + else + { + throw new ArgumentNullException("Value of passphrase is null"); + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Client.cs b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Client.cs new file mode 100755 index 0000000..f1d4ace --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Client.cs @@ -0,0 +1,244 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class IoTConnectivity + { + internal static partial class Client + { + internal static partial class DeviceInformation + { + internal delegate bool DeviceInformationCallback(IntPtr deviceInfoHandle, int result, IntPtr userData); + + internal enum Property + { + Name = 0, + SpecVersion, + Id, + DataModelVersion, + } + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_find_device_info")] + internal static extern int Find(string hostAddress, int connectivityType, IntPtr query, DeviceInformationCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_device_info_get_property")] + internal static extern int GetProperty(IntPtr deviceInfoHandle, int property, out IntPtr value); + } + + internal static partial class PlatformInformation + { + internal delegate bool PlatformInformationCallback(IntPtr platformInfoHandle, int result, IntPtr userData); + + internal enum Propery + { + Id = 0, + MfgName, + MfgUrl, + ModelNumber, + DateOfMfg, + PlatformVer, + OsVer, + HardwareVer, + FirmwareVer, + SupportUrl, + SystemTime + } + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_find_platform_info")] + internal static extern int Find(string hostAddress, int connectivityType, IntPtr query, PlatformInformationCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_platform_info_get_property")] + internal static extern int GetProperty(IntPtr platformInfoHandle, int property, out IntPtr value); + } + + internal static partial class RemoteResource + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ResponseCallback(IntPtr resource, int err, int requestType, IntPtr response, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ObserveCallback(IntPtr resource, int err, int sequenceNumber, IntPtr response, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CachedRepresentationChangedCallback(IntPtr resource, IntPtr representation, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(IntPtr resource, int state, IntPtr userData); + + internal enum ConnectivityType + { + None = -1, + All, + Ip, + Ipv4, + Ipv6 + } + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_create")] + internal static extern int Create(string hostAddress, int connectivityType, string uriPath, int properties, IntPtr resourceTypes, IntPtr resourceInterfaces, out IntPtr remoteResource); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_destroy")] + internal static extern void Destroy(IntPtr resource); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_observe_register")] + internal static extern int RegisterObserve(IntPtr resource, int observePolicy, IntPtr query, ObserveCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_observe_deregister")] + internal static extern int DeregisterObserve(IntPtr resource); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get")] + internal static extern int Get(IntPtr resource, IntPtr query, ResponseCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_put")] + internal static extern int Put(IntPtr resource, IntPtr repr, IntPtr query, ResponseCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_post")] + internal static extern int Post(IntPtr resource, IntPtr repr, IntPtr query, ResponseCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_delete")] + internal static extern int Delete(IntPtr resource, ResponseCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_start_caching")] + internal static extern int StartCaching(IntPtr resource, CachedRepresentationChangedCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_stop_caching")] + internal static extern int StopCaching(IntPtr resource); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_start_monitoring")] + internal static extern int StartMonitoring(IntPtr resource, StateChangedCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_stop_monitoring")] + internal static extern int StopMonitoring(IntPtr resource); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_uri_path")] + internal static extern int GetUriPath(IntPtr resource, out IntPtr uriPath); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_connectivity_type")] + internal static extern int GetConnectivityType(IntPtr resource, out int connectivityType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_host_address")] + internal static extern int GetHostAddress(IntPtr resource, out IntPtr hostAddress); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_device_id")] + internal static extern int GetDeviceId(IntPtr resource, out IntPtr deviceId); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_types")] + internal static extern int GetTypes(IntPtr resource, out IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_interfaces")] + internal static extern int GetInterfaces(IntPtr resource, out IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_policies")] + internal static extern int GetPolicies(IntPtr resource, out int properties); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_options")] + internal static extern int GetOptions(IntPtr resource, out IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_set_options")] + internal static extern int SetOptions(IntPtr resource, IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_cached_representation")] + internal static extern int GetCachedRepresentation(IntPtr resource, out IntPtr representation); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_get_checking_interval")] + internal static extern int GetTimeInterval(IntPtr resource, out int timeInterval); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remote_resource_set_checking_interval")] + internal static extern int SetTimeInterval(IntPtr resource, int timeInterval); + } + + internal static partial class IoTCon + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_initialize")] + internal static extern int Initialize(string filePath); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_deinitialize")] + internal static extern void Deinitialize(); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_get_timeout")] + internal static extern int GetTimeout(out int timeoutSeconds); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_set_timeout")] + internal static extern int SetTimeout(int timeoutSeconds); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_polling_get_interval")] + internal static extern int GetPollingInterval(out int interval); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_polling_set_interval")] + internal static extern int SetPollingInterval(int interval); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_polling_invoke")] + internal static extern int InvokePolling(); + } + + internal static partial class ResourceFinder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool FoundResourceCallback(IntPtr remoteResourceHandle, int result, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_find_resource")] + internal static extern int AddResourceFoundCb(string hostAddress, int connectivityType, IntPtr query, FoundResourceCallback cb, IntPtr userData); + } + + internal static partial class Presence + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PresenceCallback(IntPtr presenceResponseHandle, int err, IntPtr response, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_add_presence_cb")] + internal static extern int AddPresenceCb(string hostAddress, int connectivityType, string resourceType, PresenceCallback cb, IntPtr userData, out IntPtr presenceHandle); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_remove_presence_cb")] + internal static extern int RemovePresenceCb(IntPtr presenceHandle); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_get_host_address")] + internal static extern int GetHostAddress(IntPtr presence, out IntPtr hostAddress); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_get_connectivity_type")] + internal static extern int GetConnectivityType(IntPtr presence, out int connectivityType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_get_resource_type")] + internal static extern int GetResourceType(IntPtr presence, out IntPtr resourceType); + } + + internal static partial class PresenceResponse + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_response_get_result")] + internal static extern int GetResult(IntPtr response, out int result); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_response_get_trigger")] + internal static extern int GetTrigger(IntPtr response, out int trigger); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_response_get_host_address")] + internal static extern int GetHostAddress(IntPtr response, out IntPtr hostAddress); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_response_get_connectivity_type")] + internal static extern int GetConnectivityType(IntPtr response, out int connectivityType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_presence_response_get_resource_type")] + internal static extern int GetResourceType(IntPtr response, out IntPtr resourceType); + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Common.cs b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Common.cs new file mode 100755 index 0000000..9b4fa48 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Common.cs @@ -0,0 +1,368 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class IoTConnectivity + { + internal static partial class Common + { + internal enum DataType + { + None = 0, + Int, + Bool, + Double, + String, + ByteStr, + Null, + List, + Attributes + } + + internal static partial class ResourceTypes + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ForeachCallback(string type, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_create")] + internal static extern int Create(out IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_destroy")] + internal static extern void Destroy(IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_add")] + internal static extern int Add(IntPtr types, string type); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_remove")] + internal static extern int Remove(IntPtr types, string type); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_foreach")] + internal static extern int Foreach(IntPtr types, ForeachCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_types_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + } + + internal static partial class ResourceInterfaces + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ForeachCallback(string iface, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_create")] + internal static extern int Create(out IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_destroy")] + internal static extern void Destroy(IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_add")] + internal static extern int Add(IntPtr ifaces, string iface); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_remove")] + internal static extern int Remove(IntPtr ifaces, string iface); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_foreach")] + internal static extern int Foreach(IntPtr ifaces, ForeachCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_interfaces_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + } + + internal static partial class Attributes + { + internal delegate bool AttributesCallback(IntPtr attributes, string key, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_create")] + internal static extern int Create(out IntPtr attributes); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_destroy")] + internal static extern void Destroy(IntPtr attributes); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_clone")] + internal static extern int Clone(IntPtr attributes, out IntPtr attributes_clone); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_int")] + internal static extern int AddInt(IntPtr attributes, string key, int val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_bool")] + internal static extern int AddBool(IntPtr attributes, string key, bool val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_double")] + internal static extern int AddDouble(IntPtr attributes, string key, double val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_str")] + internal static extern int AddStr(IntPtr attributes, string key, string val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_byte_str")] + internal static extern int AddByteStr(IntPtr attributes, string key, byte[] val, int len); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_list")] + internal static extern int AddList(IntPtr attributes, string key, IntPtr list); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_attributes")] + internal static extern int AddAttributes(IntPtr dest, string key, IntPtr src); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_add_null")] + internal static extern int AddNull(IntPtr attributes, string key); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_int")] + internal static extern int GetInt(IntPtr attributes, string key, out int val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_bool")] + internal static extern int GetBool(IntPtr attributes, string key, out bool val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_double")] + internal static extern int GetDouble(IntPtr attributes, string key, out double val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_str")] + internal static extern int GetStr(IntPtr attributes, string key, out IntPtr val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_byte_str")] + internal static extern int GetByteStr(IntPtr attributes, string key, out IntPtr value, out int size); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_list")] + internal static extern int GetList(IntPtr attributes, string key, out IntPtr list); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_attributes")] + internal static extern int GetAttributes(IntPtr src, string key, out IntPtr dest); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_is_null")] + internal static extern int IsNull(IntPtr attributes, string key, out bool isNull); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_remove")] + internal static extern int Remove(IntPtr attributes, string key); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_type")] + internal static extern int GetType(IntPtr attributes, string key, out DataType type); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_foreach")] + internal static extern int Foreach(IntPtr attributes, AttributesCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_attributes_get_keys_count")] + internal static extern int GetKeysCount(IntPtr attributes, out int count); + } + + internal static partial class Query + { + internal delegate bool QueryCallback(string key, string value, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_create")] + internal static extern int Create(out IntPtr query); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_destroy")] + internal static extern void Destroy(IntPtr query); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_get_resource_type")] + internal static extern int GetResourceType(IntPtr query, out IntPtr resourceType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_get_interface")] + internal static extern int GetInterface(IntPtr query, out IntPtr resourceInterface); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_set_resource_type")] + internal static extern int SetResourceType(IntPtr query, string resourceType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_set_interface")] + internal static extern int SetInterface(IntPtr query, string resourceInterface); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_add")] + internal static extern int Add(IntPtr query, string key, string value); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_remove")] + internal static extern int Remove(IntPtr query, string key); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_lookup")] + internal static extern int Lookup(IntPtr query, string key, out IntPtr data); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_query_foreach")] + internal static extern int Foreach(IntPtr query, QueryCallback cb, IntPtr userData); + } + + internal static partial class Representation + { + internal delegate bool RepresentationChildrenCallback(IntPtr child, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_create")] + internal static extern int Create(out IntPtr repr); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_destroy")] + internal static extern void Destroy(IntPtr repr); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_clone")] + internal static extern int Clone(IntPtr src, out IntPtr dest); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_set_uri_path")] + internal static extern int SetUriPath(IntPtr repr, string uriPath); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_uri_path")] + internal static extern int GetUriPath(IntPtr repr, out IntPtr uriPath); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_set_resource_types")] + internal static extern int SetResourceTypes(IntPtr repr, IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_resource_types")] + internal static extern int GetResourceTypes(IntPtr repr, out IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_set_resource_interfaces")] + internal static extern int SetResourceInterfaces(IntPtr repr, IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_resource_interfaces")] + internal static extern int GetResourceInterfaces(IntPtr repr, out IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_set_attributes")] + internal static extern int SetAttributes(IntPtr repr, IntPtr attribs); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_attributes")] + internal static extern int GetAttributes(IntPtr repr, out IntPtr attribs); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_add_child")] + internal static extern int AddChild(IntPtr parent, IntPtr child); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_remove_child")] + internal static extern int RemoveChild(IntPtr parent, IntPtr child); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_foreach_children")] + internal static extern int ForeachChildren(IntPtr parent, RepresentationChildrenCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_children_count")] + internal static extern int GetChildrenCount(IntPtr parent, out int count); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_representation_get_nth_child")] + internal static extern int GetNthChild(IntPtr parent, int pos, out IntPtr child); + } + + internal static partial class Options + { + internal delegate bool OptionsCallback(ushort id, string data, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_create")] + internal static extern int Create(out IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_destroy")] + internal static extern void Destroy(IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_add")] + internal static extern int Add(IntPtr options, ushort id, string data); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_remove")] + internal static extern int Remove(IntPtr options, ushort id); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_lookup")] + internal static extern int Lookup(IntPtr options, ushort id, out IntPtr data); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_options_foreach")] + internal static extern int ForEach(IntPtr options, OptionsCallback cb, IntPtr userData); + } + + internal static partial class List + { + internal delegate bool IntCallback(int pos, int value, IntPtr userData); + + internal delegate bool BoolCallback(int pos, bool value, IntPtr userData); + + internal delegate bool DoubleCallback(int pos, double value, IntPtr userData); + + internal delegate bool ByteStrCallback(int pos, byte[] value, int len, IntPtr userData); + + internal delegate bool StrCallback(int pos, string value, IntPtr userData); + + internal delegate bool ListCallback(int pos, IntPtr value, IntPtr userData); + + internal delegate bool AttribsCallback(int pos, IntPtr value, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_create")] + internal static extern int Create(DataType type, out IntPtr list); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_destroy")] + internal static extern void Destroy(IntPtr list); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_int")] + internal static extern int AddInt(IntPtr list, int val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_bool")] + internal static extern int AddBool(IntPtr list, bool val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_double")] + internal static extern int AddDouble(IntPtr list, double val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_str")] + internal static extern int AddStr(IntPtr list, string val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_byte_str")] + internal static extern int AddByteStr(IntPtr list, byte[] val, int len, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_list")] + internal static extern int AddList(IntPtr list, IntPtr val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_add_attributes")] + internal static extern int AddAttributes(IntPtr list, IntPtr val, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_int")] + internal static extern int GetNthInt(IntPtr list, int pos, out int val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_bool")] + internal static extern int GetNthBool(IntPtr list, int pos, out bool val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_double")] + internal static extern int GetNthDouble(IntPtr list, int pos, out double val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_str")] + internal static extern int GetNthStr(IntPtr list, int pos, out IntPtr val); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_byte_str")] + internal static extern int GetNthByteStr(IntPtr list, int pos, out IntPtr val, out int len); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_list")] + internal static extern int GetNthList(IntPtr src, int pos, out IntPtr dest); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_nth_attributes")] + internal static extern int GetNthAttributes(IntPtr list, int pos, out IntPtr attribs); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_remove_nth")] + internal static extern int RemoveNth(IntPtr list, int pos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_type")] + internal static extern int GetType(IntPtr list, out int type); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_get_length")] + internal static extern int GetLength(IntPtr list, out int length); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_int")] + internal static extern int ForeachInt(IntPtr list, IntCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_bool")] + internal static extern int ForeachBool(IntPtr list, BoolCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_double")] + internal static extern int ForeachDouble(IntPtr list, DoubleCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_byte_str")] + internal static extern int ForeachByteStr(IntPtr list, ByteStrCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_str")] + internal static extern int ForeachStr(IntPtr list, StrCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_list")] + internal static extern int ForeachList(IntPtr list, ListCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_list_foreach_attributes")] + internal static extern int ForeachAttributes(IntPtr list, AttribsCallback cb, IntPtr userData); + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Server.cs b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Server.cs new file mode 100755 index 0000000..59b9355 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Interop/Interop.IoTConnectivity.Server.cs @@ -0,0 +1,169 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class IoTConnectivity + { + internal static partial class Server + { + internal enum RequestType + { + Unknown = 0, + Get = 1, + Put = 2, + Post = 3, + Delete = 4, + } + + internal static partial class IoTCon + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_start_presence")] + internal static extern int StartPresence(uint time); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_stop_presence")] + internal static extern int StopPresence(); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_set_device_name")] + internal static extern int SetDeviceName(string deviceName); + } + + internal static partial class Resource + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RequestHandlerCallback(IntPtr resource, IntPtr request, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_create")] + internal static extern int Create(string uriPath, IntPtr resTypes, IntPtr ifaces, int properties, RequestHandlerCallback cb, IntPtr userData, out IntPtr resourceHandle); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_destroy")] + internal static extern int Destroy(IntPtr resourceHandle); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_interface")] + internal static extern int BindInterface(IntPtr resource, string iface); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_type")] + internal static extern int BindType(IntPtr resourceHandle, string resourceType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_set_request_handler")] + internal static extern int SetRequestHandler(IntPtr resource, RequestHandlerCallback cb, IntPtr userData); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_bind_child_resource")] + internal static extern int BindChildResource(IntPtr parent, IntPtr child); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_unbind_child_resource")] + internal static extern int UnbindChildResource(IntPtr parent, IntPtr child); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_notify")] + internal static extern int Notify(IntPtr resource, IntPtr repr, IntPtr observers, int qos); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_number_of_children")] + internal static extern int GetNumberOfChildren(IntPtr resource, out int number); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_nth_child")] + internal static extern int GetNthChild(IntPtr parent, int index, out IntPtr child); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_uri_path")] + internal static extern int GetUriPath(IntPtr resource, out IntPtr uriPath); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_types")] + internal static extern int GetTypes(IntPtr resource, out IntPtr types); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_interfaces")] + internal static extern int GetInterfaces(IntPtr resource, out IntPtr ifaces); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_resource_get_properties")] + internal static extern int GetProperties(IntPtr resource, out int properties); + } + + internal static partial class Request + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_host_address")] + internal static extern int GetHostAddress(IntPtr request, out IntPtr hostAddress); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_connectivity_type")] + internal static extern int GetConnectivityType(IntPtr request, out int connectivityType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_representation")] + internal static extern int GetRepresentation(IntPtr request, out IntPtr repr); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_request_type")] + internal static extern int GetRequestType(IntPtr request, out int type); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_options")] + internal static extern int GetOptions(IntPtr request, out IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_query")] + internal static extern int GetQuery(IntPtr request, out IntPtr query); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_type")] + internal static extern int GetObserveType(IntPtr request, out int observeType); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_request_get_observe_id")] + internal static extern int GetObserveId(IntPtr request, out int observeId); + } + + internal static partial class Response + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_create")] + internal static extern int Create(IntPtr request, out IntPtr response); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_destroy")] + internal static extern void Destroy(IntPtr resp); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_options")] + internal static extern int GetOptions(IntPtr resp, out IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_representation")] + internal static extern int GetRepresentation(IntPtr resp, out IntPtr repr); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_get_result")] + internal static extern int GetResult(IntPtr resp, out int result); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_result")] + internal static extern int SetResult(IntPtr resp, int result); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_representation")] + internal static extern int SetRepresentation(IntPtr resp, IntPtr repr); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_set_options")] + internal static extern int SetOptions(IntPtr resp, IntPtr options); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_response_send")] + internal static extern int Send(IntPtr resp); + } + + internal static partial class Observers + { + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_create")] + internal static extern int Create(out IntPtr observers); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_destroy")] + internal static extern void Destroy(IntPtr observers); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_add")] + internal static extern int Add(IntPtr observers, int observeId); + + [DllImport(Libraries.IoTCon, EntryPoint = "iotcon_observers_remove")] + internal static extern int Remove(IntPtr observers, int observeId); + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Interop/Interop.Libraries.cs b/src/Tizen.Network.IoTConnectivity/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..b918618 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string IoTCon = "libiotcon.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.csproj b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.sln b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.sln new file mode 100755 index 0000000..e6bd49f --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.IoTConnectivity", "Tizen.Network.IoTConnectivity.csproj", "{3582989E-9C6D-4E1B-9C5A-F985F9B6F346}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{49F93528-1A8C-45E5-A9DF-0D6E90C950AE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{D3E401EB-8E0C-43C9-98B9-D29B8D4A92E2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3582989E-9C6D-4E1B-9C5A-F985F9B6F346}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3582989E-9C6D-4E1B-9C5A-F985F9B6F346}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3582989E-9C6D-4E1B-9C5A-F985F9B6F346}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3582989E-9C6D-4E1B-9C5A-F985F9B6F346}.Release|Any CPU.Build.0 = Release|Any CPU + {49F93528-1A8C-45E5-A9DF-0D6E90C950AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {49F93528-1A8C-45E5-A9DF-0D6E90C950AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {49F93528-1A8C-45E5-A9DF-0D6E90C950AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {49F93528-1A8C-45E5-A9DF-0D6E90C950AE}.Release|Any CPU.Build.0 = Release|Any CPU + {D3E401EB-8E0C-43C9-98B9-D29B8D4A92E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3E401EB-8E0C-43C9-98B9-D29B8D4A92E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3E401EB-8E0C-43C9-98B9-D29B8D4A92E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3E401EB-8E0C-43C9-98B9-D29B8D4A92E2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs new file mode 100755 index 0000000..6dd18a8 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Attributes.cs @@ -0,0 +1,860 @@ +/// Copyright 2016 by Samsung Electronics, Inc., +/// + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents current attributes of a resource. + /// It provides API to manage attributes. + /// This class is accessed by using a constructor to create a new instance of this object. + /// + /// 3 + public class Attributes : IDictionary, IDisposable + { + internal IntPtr _resourceAttributesHandle = IntPtr.Zero; + private readonly IDictionary _attributes = new Dictionary(); + private bool _disposed = false; + + /// + /// The Attributes constructor. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); + /// + public Attributes() + { + int ret = Interop.IoTConnectivity.Common.Attributes.Create(out _resourceAttributesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create attributes handle"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + internal Attributes(IntPtr attributesHandleToClone) + { + int ret = Interop.IoTConnectivity.Common.Attributes.Clone(attributesHandleToClone, out _resourceAttributesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create attributes handle"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + SetAttributes(_resourceAttributesHandle); + } + + /// + /// Destructor of the Attributes class. + /// + ~Attributes() + { + Dispose(false); + } + + /// + /// Gets the number of keys. + /// + /// 3 + /// The number of keys. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// attributes.Add("brightness", 50); + /// var count = attributes.Count; + /// Console.WriteLine("There are {0} keys in the attribute object", count); + /// + public int Count + { + get + { + return _attributes.Count; + } + } + + /// + /// Represents whether an attribute is readonly. + /// + /// 3 + /// Whether an attribute is readonly. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// if (attributes.IsReadOnly) + /// Console.WriteLine("Read only attribute"); + /// + public bool IsReadOnly + { + get + { + return _attributes.IsReadOnly; + } + } + + /// + /// Contains all the attribute keys. + /// + /// 3 + /// All the attribute keys. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// var keys = attributes.Keys; + /// Console.WriteLine("Attribute contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1)); + /// + public ICollection Keys + { + get + { + return _attributes.Keys; + } + } + + /// + /// Contains all the attribute values. + /// + /// 3 + /// All the attribute values. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// var values = attributes.Values; + /// Console.WriteLine("Attribute contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1)); + /// + public ICollection Values + { + get + { + return _attributes.Values; + } + } + + /// + /// Gets or sets the attribute with the specified key. + /// + /// 3 + /// The attribute with the specified key. + /// The key of the attribute to get or set. + /// The element with the specified key. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); + /// attributes["state"] = "ON"; + /// Console.WriteLine("Attribute value for key 'state' : {0}", attributes["state"]); + /// + public object this[string key] + { + get + { + if (_attributes.ContainsKey(key)) + return _attributes[key]; + else + return null; + } + + set + { + Add(key, value); + } + } + + /// + /// Adds the attribute key and a value as a key value pair. + /// + /// 3 + /// The key value pair to add. + /// http://tizen.org/feature/iot.ocf + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); + /// attributes.Add(new KeyValuePair ("state", "ON")); + /// + public void Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + /// + /// Adds an attribute. + /// + /// 3 + /// The key representing the attribute. + /// The value representing the attribute. + /// http://tizen.org/feature/iot.ocf + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); + /// attributes.Add("brightness", 50); + /// + public void Add(string key, object value) + { + int ret = 0; + if (value is int) + { + ret = Interop.IoTConnectivity.Common.Attributes.AddInt(_resourceAttributesHandle, key, (int)value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add int"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is Attributes) + { + Attributes attribs = (Attributes)value; + ret = Interop.IoTConnectivity.Common.Attributes.AddAttributes(_resourceAttributesHandle, key, attribs._resourceAttributesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is string) + { + ret = Interop.IoTConnectivity.Common.Attributes.AddStr(_resourceAttributesHandle, key, (string)value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add string"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is double) + { + ret = Interop.IoTConnectivity.Common.Attributes.AddDouble(_resourceAttributesHandle, key, (double)value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add double"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is bool) + { + ret = Interop.IoTConnectivity.Common.Attributes.AddBool(_resourceAttributesHandle, key, (bool)value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add bool"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is byte[]) + { + byte[] val = value as byte[]; + if (val == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get byte[] val"); + throw new ArgumentException("Invalid Parameter"); + } + ret = Interop.IoTConnectivity.Common.Attributes.AddByteStr(_resourceAttributesHandle, key, val, val.Length); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add bool"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else if (value is IEnumerable) + { + IntPtr listHandle = List.GetListHandle(value); + ret = Interop.IoTConnectivity.Common.Attributes.AddList(_resourceAttributesHandle, key, listHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add list"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Add"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + _attributes.Add(key, value); + } + + /// + /// Clears attributes collection. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported + /// Thrown when the operation is invalid + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes(); + /// attributes.Add("brightness", 50); + /// attributes.Clear(); + /// + public void Clear() + { + foreach (string key in _attributes.Keys) + { + int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to clear attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + _attributes.Clear(); + } + + /// + /// Checks whether the given key value pair exists in attributes collection. + /// + /// 3 + /// The status key value pair. + /// true if exists. Otherwise, false. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// if (attributes.Contains(new KeyValuePair ("dim", 10)) + /// Console.WriteLine("Attribute conatins pair ('dim', 10)"); + /// + public bool Contains(KeyValuePair item) + { + return _attributes.Contains(item); + } + + /// + /// Checks whether the given key exists in attributes collection. + /// + /// 3 + /// The status key to look for. + /// true if exists. Otherwise, false. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// if (attributes.ContainsKey("dim")) + /// Console.WriteLine("Attribute conatins key : dim"); + /// + public bool ContainsKey(string key) + { + return _attributes.ContainsKey(key); + } + + /// + /// Copies the elements of the attributes to an array, starting at a particular index. + /// + /// 3 + /// The destination array. + /// The zero-based index in an array at which copying begins. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// KeyValuePair[] dest = new KeyValuePair[attributes.Count]; + /// int index = 0; + /// attributes.CopyTo(dest, index); + /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value); + /// + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + _attributes.CopyTo(array, arrayIndex); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// 3 + /// An enumerator that can be used to iterate through the collection. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// foreach (KeyValuePair pair in attributes) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + public IEnumerator> GetEnumerator() + { + return _attributes.GetEnumerator(); + } + + /// + /// Removes an attribute from collection. + /// + /// 3 + /// The attributes element to remove. + /// true if operation is successful, otherwise, false. + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported + /// Thrown when there is an invalid parameter + /// Thrown when the operation is invalid + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// if (attributes.Remove(new KeyValuePair("dim", 10))) + /// Console.WriteLine("Remove was successful"); + /// + public bool Remove(KeyValuePair item) + { + return Remove(item.Key); + } + + /// + /// Removes an attribute from collection using a key. + /// + /// 3 + /// The attributes element to remove. + /// true if operation is successful, otherwise, false. + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported + /// Thrown when there is an invalid parameter + /// Thrown when the operation is invalid + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// if (attributes.Remove("state")) + /// Console.WriteLine("Remove was successful"); + /// + public bool Remove(string key) + { + int ret = Interop.IoTConnectivity.Common.Attributes.Remove(_resourceAttributesHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + bool isRemoved = _attributes.Remove(key); + + return isRemoved; + } + + /// + /// Gets the value associated with the specified key. + /// + /// 3 + /// The key whose value to get. + /// The value associated with the specified key. + /// true if the attributes collection contains an element with the specified key, otherwise, false. + /// + /// Tizen.Network.IoTConnectivity.Attributes attributes = new Tizen.Network.IoTConnectivity.Attributes() { + /// { "state", "ON" } + /// }; + /// object value; + /// var isPresent = attributes.TryGetValue("state", out value); + /// if (isPresent) + /// Console.WriteLine("value : {0}", value); + /// + public bool TryGetValue(string key, out object value) + { + return _attributes.TryGetValue(key, out value); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// 3 + IEnumerator IEnumerable.GetEnumerator() + { + return _attributes.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Common.Attributes.Destroy(_resourceAttributesHandle); + _disposed = true; + } + + private void SetAttributes(IntPtr attributesHandle) + { + Interop.IoTConnectivity.Common.Attributes.AttributesCallback cb = (IntPtr attributes, string key, IntPtr userData) => + { + Interop.IoTConnectivity.Common.DataType dataType; + int ret = Interop.IoTConnectivity.Common.Attributes.GetType(attributes, key, out dataType); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + switch ((Interop.IoTConnectivity.Common.DataType)dataType) + { + case Interop.IoTConnectivity.Common.DataType.Int: + { + int value; + ret = Interop.IoTConnectivity.Common.Attributes.GetInt(attributes, key, out value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _attributes.Add(key, value); + break; + } + case Interop.IoTConnectivity.Common.DataType.Bool: + { + bool value; + ret = Interop.IoTConnectivity.Common.Attributes.GetBool(attributes, key, out value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _attributes.Add(key, value); + break; + } + case Interop.IoTConnectivity.Common.DataType.Double: + { + double value; + ret = Interop.IoTConnectivity.Common.Attributes.GetDouble(attributes, key, out value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _attributes.Add(key, value); + break; + } + case Interop.IoTConnectivity.Common.DataType.String: + { + IntPtr value; + string Str; + ret = Interop.IoTConnectivity.Common.Attributes.GetStr(attributes, key, out value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + Str = (value != IntPtr.Zero) ? Marshal.PtrToStringAnsi(value) : string.Empty; + _attributes.Add(key, Str); + break; + } + case Interop.IoTConnectivity.Common.DataType.ByteStr: + { + IntPtr byteStrPtr; + int byteStrSize; + ret = Interop.IoTConnectivity.Common.Attributes.GetByteStr(attributes, key, out byteStrPtr, out byteStrSize); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + byte[] byteStr = new byte[byteStrSize]; + Marshal.Copy(byteStrPtr, byteStr, 0, byteStrSize); + _attributes.Add(key, byteStr); + break; + } + case Interop.IoTConnectivity.Common.DataType.Null: + { + _attributes.Add(key, null); + break; + } + case Interop.IoTConnectivity.Common.DataType.List: + { + IntPtr listHandle; + ret = Interop.IoTConnectivity.Common.Attributes.GetList(attributes, key, out listHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _attributes.Add(key, List.GetList(listHandle)); + break; + } + case Interop.IoTConnectivity.Common.DataType.Attributes: + { + IntPtr attribsHandle; + ret = Interop.IoTConnectivity.Common.Attributes.GetAttributes(attributes, key, out attribsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _attributes.Add(key, new Attributes(attribsHandle)); + break; + } + default: + break; + } + + return true; + }; + + int res = Interop.IoTConnectivity.Common.Attributes.Foreach(attributesHandle, cb, IntPtr.Zero); + if (res != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove attributes"); + throw IoTConnectivityErrorFactory.GetException(res); + } + } + } + + internal static class List + { + internal static IntPtr GetListHandle(object list) + { + IntPtr listHandle = IntPtr.Zero; + int ret; + int pos = 0; + + if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.List, out listHandle); + pos = 0; + foreach (IEnumerable val in (IEnumerable)list) + { + IntPtr childList = GetListHandle(val); + ret = Interop.IoTConnectivity.Common.List.AddList(listHandle, childList, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add attributes"); + Interop.IoTConnectivity.Common.List.Destroy(childList); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.Int, out listHandle); + pos = 0; + foreach (int val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddInt(listHandle, val, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.String, out listHandle); + pos = 0; + foreach (string val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddStr(listHandle, val, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add str"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.Double, out listHandle); + pos = 0; + foreach (double val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddDouble(listHandle, val, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add double"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.Bool, out listHandle); + pos = 0; + foreach (bool val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddBool(listHandle, val, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add bool"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.Attributes, out listHandle); + pos = 0; + foreach (Attributes val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddAttributes(listHandle, val._resourceAttributesHandle, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (list is IEnumerable) + { + ret = Interop.IoTConnectivity.Common.List.Create(Interop.IoTConnectivity.Common.DataType.ByteStr, out listHandle); + pos = 0; + foreach (byte[] val in (IEnumerable)list) + { + ret = Interop.IoTConnectivity.Common.List.AddByteStr(listHandle, val, val.Length, pos++); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add byte[]"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to GetListHandle"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + return listHandle; + } + + internal static object GetList(IntPtr listHandle) + { + IList list = null; + int type; + int ret = Interop.IoTConnectivity.Common.List.GetType(listHandle, out type); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + switch ((Interop.IoTConnectivity.Common.DataType)type) + { + case Interop.IoTConnectivity.Common.DataType.Int: + { + list = new List(); + Interop.IoTConnectivity.Common.List.IntCallback cb = (int pos, int value, IntPtr userData) => + { + list.Add(value); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachInt(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.Bool: + { + list = new List(); + Interop.IoTConnectivity.Common.List.BoolCallback cb = (int pos, bool value, IntPtr userData) => + { + list.Add(value); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachBool(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.Double: + { + list = new List(); + Interop.IoTConnectivity.Common.List.DoubleCallback cb = (int pos, double value, IntPtr userData) => + { + list.Add(value); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachDouble(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.String: + { + list = new List(); + Interop.IoTConnectivity.Common.List.StrCallback cb = (int pos, string value, IntPtr userData) => + { + list.Add(value); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachStr(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.Attributes: + { + list = new List(); + Interop.IoTConnectivity.Common.List.AttribsCallback cb = (int pos, IntPtr value, IntPtr userData) => + { + list.Add(new Attributes(value)); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachAttributes(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.ByteStr: + { + list = new List(); + Interop.IoTConnectivity.Common.List.ByteStrCallback cb = (int pos, byte[] value, int len, IntPtr userData) => + { + list.Add(value); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachByteStr(listHandle, cb, IntPtr.Zero); + break; + } + case Interop.IoTConnectivity.Common.DataType.List: + { + list = new List>(); + Interop.IoTConnectivity.Common.List.ListCallback cb = (int pos, IntPtr value, IntPtr userData) => + { + object childList = GetList(value); + if (childList != null) + list.Add(childList); + return true; + }; + ret = Interop.IoTConnectivity.Common.List.ForeachList(listHandle, cb, IntPtr.Zero); + break; + } + default: + break; + } + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + return list; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/CacheUpdatedEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/CacheUpdatedEventArgs.cs new file mode 100755 index 0000000..7ca278e --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/CacheUpdatedEventArgs.cs @@ -0,0 +1,37 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the CacheUpdated event. + /// + /// 3 + public class CacheUpdatedEventArgs : EventArgs + { + internal CacheUpdatedEventArgs() { } + + /// + /// Indicates the updated representation of the resource. + /// + /// 3 + /// The updated representation of the resource. + public Representation Representation { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/DeviceInformationFoundEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/DeviceInformationFoundEventArgs.cs new file mode 100755 index 0000000..605fc03 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/DeviceInformationFoundEventArgs.cs @@ -0,0 +1,70 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the DeviceInformationFound event. + /// + /// 3 + public class DeviceInformationFoundEventArgs + { + internal DeviceInformationFoundEventArgs() { } + + /// + /// The request ID. + /// + /// 3 + /// The request ID. + public int RequestId { get; internal set; } + + /// + /// Indicates to continuously receive the event for finding device information. + /// + /// 3 + /// Continuously receive the event for finding device information. + public bool EventContinue { get; set; } + + /// + /// Indicates the human friendly name for device. + /// + /// 3 + /// Human friendly name for device. + public string Name { get; internal set; } + + /// + /// Indicates the spec version of the core specification. + /// + /// 3 + /// Spec version of the core specification. + public string SpecVersion { get; internal set; } + + /// + /// Indicates an unique identifier for the OIC device. + /// + /// 3 + /// Unique identifier for OIC device. + public string DeviceId { get; internal set; } + + /// + /// Indicates version of the specs this device data model is implemented to. + /// + /// 3 + /// Version of the specs this device data model is implemented to. + public string DataModelVersion { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingError.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingError.cs new file mode 100755 index 0000000..eec4fbe --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingError.cs @@ -0,0 +1,74 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for resource found errors. + /// + internal enum FindingError + { + /// + /// I/O error. + /// + Io = 1, + /// + /// Out of memory. + /// + OutOfMemory, + /// + /// Permission denied. + /// + PermissionDenied, + /// + /// Not supported. + /// + NotSupported, + /// + /// Invalid parameter. + /// + InvalidParameter, + /// + /// No data available. + /// + NoData, + /// + /// Time out. + /// + TimeOut, + /// + /// IoTivity errors. + /// + Iotivity, + /// + /// Representation errors. + /// + Representation, + /// + /// Invalid type. + /// + InvalidType, + /// + /// Already. + /// + Already, + /// + /// System errors. + /// + System + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingErrorOccurredEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingErrorOccurredEventArgs.cs new file mode 100755 index 0000000..bc28027 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/FindingErrorOccurredEventArgs.cs @@ -0,0 +1,44 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the FindingErrorOccurred event. + /// + /// 3 + public class FindingErrorOccurredEventArgs : EventArgs + { + internal FindingErrorOccurredEventArgs() { } + + /// + /// The request ID of the operation, which caused this error. + /// + /// 3 + /// The request ID of the operation, which caused this error. + public int RequestId { get; internal set; } + + /// + /// Contains error details. + /// + /// 3 + /// Error details. + public Exception Error { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs new file mode 100755 index 0000000..9da873d --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityClientManager.cs @@ -0,0 +1,966 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// IoT connectivity client manager consists of client side APIs. + /// + /// 3 + public static class IoTConnectivityClientManager + { + /// + /// The IP Address for multicast. + /// + /// 3 + public const string MulticastAddress = null; + + private static int s_presenceListenerId = 1; + private static Dictionary s_presenceCallbacksMap = new Dictionary(); + private static Dictionary s_presenceHandlesMap = new Dictionary(); + + private static int s_requestId = 1; + private static Dictionary s_resourceFoundCallbacksMap = new Dictionary(); + private static Dictionary s_deviceInformationCallbacksMap = new Dictionary(); + private static Dictionary s_platformInformationCallbacksMap = new Dictionary(); + + /// + /// PresenceReceived event. This event occurs when server starts sending presence of a resource. + /// + /// 3 + public static event EventHandler PresenceReceived; + + /// + /// ResourceFound event. This event occurs when a resource is found from the remote server + /// after sending request using API StartFindingResource(). + /// + /// 3 + public static event EventHandler ResourceFound; + + /// + /// PlatformInformationFound event. This event occurs when platform information is found + /// after sending request using API StartFindingPlatformInformation(). + /// + /// 3 + public static event EventHandler PlatformInformationFound; + + /// + /// DeviceInformationFound event. This event occurs when device information is found + /// after sending request using API StartFindingDeviceInformation(). + /// + /// 3 + public static event EventHandler DeviceInformationFound; + + /// + /// FindingError event. This event occurs when an error is found. + /// + /// 3 + public static event EventHandler FindingErrorOccurred; + + /// + /// Timeout in seconds. + /// + /// 3 + /// + /// Value to be set must be in range from 1 to 3600. Default timeout interval value is 30.\n + /// Sets/gets the timeout of StartFindingResource(), StartFindingDeviceInformation(), StartFindingPlatformInformation(), + /// RemoteResource.GetAsync(), RemoteResource.PutAsync(), RemoteResource.PostAsync() and RemoteResource.DeleteAsync() APIs.\n + /// Setter can throw exception. + /// + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// IoTConnectivityClientManager.Initialize(); + /// IoTConnectivityClientManager.TimeOut = 120; + /// + public static int TimeOut + { + get + { + int timeout; + int ret = Interop.IoTConnectivity.Client.IoTCon.GetTimeout(out timeout); + if (ret != (int)IoTConnectivityError.None) + { + Log.Warn(IoTConnectivityErrorFactory.LogTag, "Failed to get timeout"); + return 0; + } + return timeout; + } + set + { + int ret = Interop.IoTConnectivity.Client.IoTCon.SetTimeout(value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set timeout"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// Polling interval of IoTConnectivity. + /// + /// 3 + /// + /// Sets/Gets the polling inerval(milliseconds) of IoTCon. Default value is 100 milliseconds. + /// Value to be set must be in range from 1 to 999. The closer to 0, the faster it operates. + /// Setter is invoked immediately for changing the interval. + /// If you want the faster operation, we recommend you set 10 milliseconds for polling interval. + /// Setter can throw exception. + /// + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// IoTConnectivityClientManager.Initialize(); + /// IoTConnectivityClientManager.PollingInterval = 100; + /// + public static int PollingInterval + { + get + { + int interval; + int ret = Interop.IoTConnectivity.Client.IoTCon.GetPollingInterval(out interval); + if (ret != (int)IoTConnectivityError.None) + { + Log.Warn(IoTConnectivityErrorFactory.LogTag, "Failed to get polling interval"); + return 0; + } + return interval; + } + set + { + int ret = Interop.IoTConnectivity.Client.IoTCon.SetPollingInterval(value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set polling interval"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// Initializes IoTCon. + /// Call this function to start IoTCon. + /// + /// 3 + /// + /// @a filePath point to a file for handling secure virtual resources. + /// The file that is CBOR(Concise Binary Object Representation)-format must already exist + /// in @a filePath. We recommend to use application-local file for @a filePath. + /// + /// + /// http://tizen.org/privilege/network.get \n + /// http://tizen.org/privilege/internet + /// + /// public + /// The file path to point to storage for handling secure virtual resources. + /// http://tizen.org/feature/iot.ocf + /// + /// You must call Deinitialize() if IoTCon API is no longer needed. + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when an application does not have privilege to access. + /// + /// string filePath = "../../res/iotcon-test-svr-db-client.dat"; + /// IoTConnectivityClientManager.Initialize(filePath); + /// + public static void Initialize(string filePath) + { + int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize(filePath); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to initialize"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Deinitializes IoTCon. + /// + /// 3 + /// + /// This API must be called if IoTCon API is no longer needed. + /// + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// IoTConnectivityClientManager.Deinitialize(); + /// + public static void Deinitialize() + { + s_presenceListenerId = 1; + s_presenceCallbacksMap.Clear(); + s_presenceHandlesMap.Clear(); + + s_requestId = 1; + s_resourceFoundCallbacksMap.Clear(); + s_deviceInformationCallbacksMap.Clear(); + s_platformInformationCallbacksMap.Clear(); + + PresenceReceived = delegate{}; + ResourceFound = delegate{}; + PlatformInformationFound = delegate{}; + DeviceInformationFound = delegate{}; + FindingErrorOccurred = delegate{}; + + Interop.IoTConnectivity.Client.IoTCon.Deinitialize(); + } + + /// + /// Invokes a next message from a queue for receiving messages from others, immediately. + /// + /// 3 + /// + /// This API invokes a next message from a queue for receiving messages from others, immediately. + /// After calling the API, it continues the polling with existing interval. + /// + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// Thrown when the iotcon is not supported. + /// + /// IoTConnectivityClientManager.InvokePolling(); + /// + public static void InvokePolling() + { + int ret = Interop.IoTConnectivity.Client.IoTCon.InvokePolling(); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to invoke polling"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Starts receiving presence events. + /// + /// 3 + /// + /// Sends request to receive presence to an interested server's resource with resourceType. + /// If succeeded, event handler will be triggered when the server sends presence. + /// A server sends presence events when adds / removes / alters a resource or start / stop presence.\n + /// @a hostAddress could be for IPv4 multicast. + /// The length of @ resourceType should be less than or equal to 61. The @ resourceType must start with a lowercase alphabetic character, followed by a sequence + /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The address or addressable name of the server. + /// A resource type that a client is interested in. + /// PresenceId - An identifier for this request. + /// http://tizen.org/feature/iot.ocf + ///
Initialize() should be called to initialize.
+ /// + /// When the resource receive presence, event handler will be invoked.\n + /// You must destroy presence by calling StopReceivingPresence() if presence event is no longer needed. + /// + /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + /// + /// EventHandler handler = (sender, e) => { + /// Console.Log("PresenceReceived, presence id :" + e.PresenceId); + /// } + /// EventHandler errorHandler = (sender, e) => { + /// Console.Log("Found error :" + e.Error.Message); + /// } + /// IoTConnectivityClientManager.PresenceReceived += handler; + /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler; + /// // Do not forget to remove these event handlers when they are not required any more. + /// int id = IoTConnectivityClientManager.StartReceivingPresence(IoTConnectivityClientManager.MulticastAddress, "oic.iot.door"); + /// + public static int StartReceivingPresence(string hostAddress, string resourceType) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ip; + + if (resourceType != null && !ResourceTypes.IsValid(resourceType)) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Invalid type"); + throw new ArgumentException("Invalid type"); + } + + IntPtr id = IntPtr.Zero; + lock (s_presenceCallbacksMap) + { + id = (IntPtr)s_presenceListenerId++; + } + s_presenceCallbacksMap[id] = (IntPtr presence, int result, IntPtr presenceResponseHandle, IntPtr userData) => + { + int presenceId = (int)userData; + if (result == (int)IoTConnectivityError.None) + { + if (presenceResponseHandle != IntPtr.Zero) + { + PresenceReceivedEventArgs e = GetPresenceReceivedEventArgs(presenceId, presenceResponseHandle); + if (e == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't get PresenceReceivedEventArgs"); + return; + } + PresenceReceived?.Invoke(null, e); + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null"); + return; + } + } + else + { + FindingErrorOccurredEventArgs e = GetFindingErrorOccurredEventArgs(presenceId, result); + FindingErrorOccurred?.Invoke(null, e); + } + }; + + IntPtr presenceHandle; + int errorCode = Interop.IoTConnectivity.Client.Presence.AddPresenceCb(hostAddress, (int)connectivityType, resourceType, s_presenceCallbacksMap[id], id, out presenceHandle); + if (errorCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to register presence event handler"); + lock (s_presenceCallbacksMap) + { + s_presenceCallbacksMap.Remove(id); + } + throw IoTConnectivityErrorFactory.GetException(errorCode); + } + + lock (s_presenceHandlesMap) + { + s_presenceHandlesMap[id] = presenceHandle; + } + return (int)id; + } + + /// + /// Stops receiving presence events. + /// + /// 3 + /// + /// Sends request to not to receive server's presence any more. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The start presence request identifier. + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + /// + /// EventHandler handler = (sender, e) => { + /// Console.Log("PresenceReceived, presence id :" + e.PresenceId); + /// } + /// EventHandler errorHandler = (sender, e) => { + /// Console.Log("Found error :" + e.Error.Message); + /// } + /// IoTConnectivityClientManager.PresenceReceived += handler; + /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler; + /// int id = IoTConnectivityClientManager.StartReceivingPresence(IoTConnectivityClientManager.MulticastAddress, "oic.iot.door"); + /// await Task.Delay(5000); // Do other things here + /// // Call StopReceivingPresence() when receiving presence is not required any more + /// IoTConnectivityClientManager.PresenceReceived -= handler; + /// IoTConnectivityClientManager.FindingErrorOccurred -= errorHandler; + /// IoTConnectivityClientManager.StopReceivingPresence(id); + /// + public static void StopReceivingPresence(int presenceId) + { + if (!s_presenceHandlesMap.ContainsKey((IntPtr)presenceId)) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "this presenceId does not exist"); + throw new ArgumentException("this presenceId does not exist"); + } + + if (s_presenceHandlesMap.ContainsKey((IntPtr)presenceId)) + { + IntPtr presenceHandle = s_presenceHandlesMap[(IntPtr)presenceId]; + int ret = Interop.IoTConnectivity.Client.Presence.RemovePresenceCb(presenceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to deregister presence event handler"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + lock (s_presenceHandlesMap) + { + s_presenceHandlesMap.Remove((IntPtr)presenceId); + } + } + + if (s_presenceCallbacksMap.ContainsKey((IntPtr)presenceId)) + { + lock (s_presenceCallbacksMap) + { + s_presenceCallbacksMap.Remove((IntPtr)presenceId); + } + } + } + + /// + /// Starts finding resources. + /// + /// 3 + /// + /// Sends request to find a resource of @a hostAddress server with @a resourceType. + /// If succeeded, event handler will be triggered with information of the resource.\n + /// @a hostAddress could be for the IPv4 multicast. + /// The length of @a resourceType should be less than or equal to 61. The @ resourceType must start with a lowercase alphabetic character, followed by a sequence + /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The address or addressable name of the server. The address includes a protocol like coaps://. + /// The query specified as a filter for founding resources. + /// RequestId - An identifier for this request. + /// http://tizen.org/feature/iot.ocf + ///
Initialize() should be called to initialize.
+ /// + /// When the resource is found, event handler will be invoked. + /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + /// + /// EventHandler handler = (sender, e) => { + /// Console.Log("Found resource at host address :" + e.Resource.HostAddress + ", uri :" + e.Resource.UriPath); + /// } + /// EventHandler errorHandler = (sender, e) => { + /// Console.Log("Found error :" + e.Error.Message); + /// } + /// IoTConnectivityClientManager.ResourceFound += handler; + /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler; + /// ResourceQuery query = new ResourceQuery(); + /// query.Type = "oic.iot.door"; + /// // Do not forget to remove these event handlers when they are not required any more. + /// int id = IoTConnectivityClientManager.StartFindingResource(null, query); + /// + public static int StartFindingResource(string hostAddress, ResourceQuery query = null) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ip; + + IntPtr id = IntPtr.Zero; + lock (s_resourceFoundCallbacksMap) + { + id = (IntPtr)s_requestId++; + } + s_resourceFoundCallbacksMap[id] = (IntPtr remoteResourceHandle, int result, IntPtr userData) => + { + if (ResourceFound == null) + return false; + + int requestId = (int)userData; + if (result == (int)IoTConnectivityError.None) + { + if (remoteResourceHandle != IntPtr.Zero) + { + RemoteResource resource = null; + try + { + resource = new RemoteResource(remoteResourceHandle); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't clone RemoteResource's handle: " + exp.Message); + return true; + } + ResourceFoundEventArgs e = new ResourceFoundEventArgs() + { + RequestId = requestId, + Resource = resource + }; + ResourceFound?.Invoke(null, e); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.EventContinue : " + e.EventContinue); + return e.EventContinue; + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null"); + } + } + else + { + FindingErrorOccurredEventArgs e = GetFindingErrorOccurredEventArgs(requestId, result); + FindingErrorOccurred?.Invoke(null, e); + + lock (s_resourceFoundCallbacksMap) + { + s_resourceFoundCallbacksMap.Remove(id); + } + } + return true; + }; + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errorCode = Interop.IoTConnectivity.Client.ResourceFinder.AddResourceFoundCb(hostAddress, (int)connectivityType, queryHandle, s_resourceFoundCallbacksMap[id], id); + if (errorCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to register resource found event handler"); + lock (s_resourceFoundCallbacksMap) + { + s_resourceFoundCallbacksMap.Remove(id); + } + throw IoTConnectivityErrorFactory.GetException(errorCode); + } + return (int)id; + } + + /// + /// Starts finding the device information of remote server. + /// + /// 3 + /// + /// Requests server for device information. + /// If succeeded, event handler will be triggered with information of the device.\n + /// @a hostAddress could be for the IPv4 multicast. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The host address of the remote server. + /// The query specified as a filter for founding resources. + /// RequestId - An identifier for this request. + /// http://tizen.org/feature/iot.ocf + ///
Initialize() should be called to initialize.
+ /// + /// event handler will be invoked. + /// + /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + /// + /// EventHandler handler = (sender, e) => { + /// Console.Log("Device information found, id : " + e.RequestId + ", name : " + e.Name); + /// } + /// EventHandler errorHandler = (sender, e) => { + /// Console.Log("Found error :" + e.Error.Message); + /// } + /// IoTConnectivityClientManager.DeviceInformationFound += handler; + /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler; + /// // Do not forget to remove these event handlers when they are not required any more. + /// int id = IoTConnectivityClientManager.StartFindingDeviceInformation(IoTConnectivityClientManager.MulticastAddress); + /// + public static int StartFindingDeviceInformation(string hostAddress, ResourceQuery query = null) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ip; + + IntPtr id = IntPtr.Zero; + lock (s_deviceInformationCallbacksMap) + { + id = (IntPtr)s_requestId++; + } + s_deviceInformationCallbacksMap[id] = (IntPtr deviceInfoHandle, int result, IntPtr userData) => + { + if (DeviceInformationFound == null) + return false; + + int requestId = (int)userData; + if (result == (int)IoTConnectivityError.None) + { + if (deviceInfoHandle != IntPtr.Zero) + { + DeviceInformationFoundEventArgs e = GetDeviceInformationFoundEventArgs(requestId, deviceInfoHandle); + if (e == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't get DeviceInformationFoundEventArgs"); + return true; + } + DeviceInformationFound?.Invoke(null, e); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.EventContinue : " + e.EventContinue); + return e.EventContinue; + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null"); + } + } + else + { + FindingErrorOccurredEventArgs e = GetFindingErrorOccurredEventArgs(requestId, result); + FindingErrorOccurred?.Invoke(null, e); + + lock (s_deviceInformationCallbacksMap) + { + s_deviceInformationCallbacksMap.Remove(id); + } + } + return true; + }; + + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errorCode = Interop.IoTConnectivity.Client.DeviceInformation.Find(hostAddress, (int)connectivityType, queryHandle, s_deviceInformationCallbacksMap[id], id); + if (errorCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get device information"); + lock (s_deviceInformationCallbacksMap) + { + s_deviceInformationCallbacksMap.Remove(id); + } + throw IoTConnectivityErrorFactory.GetException(errorCode); + } + + return (int)id; + } + + /// + /// Starts finding the platform information of remote server. + /// + /// 3 + /// + /// Requests server for platform information. + /// If succeeded, event handler will be triggered with information of the platform.\n + /// @a hostAddress could be for IPv4 multicast. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The host address of remote server. + /// The query specified as a filter for founding resources. + /// RequestId - An identifier for this request. + /// http://tizen.org/feature/iot.ocf + ///
Initialize() should be called to initialize.
+ /// + /// event handler will be invoked. + /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + /// + /// EventHandler handler = (sender, e) => { + /// Console.Log("PlatformInformationFound :" + e.RequestId); + /// } + /// EventHandler errorHandler = (sender, e) => { + /// Console.Log("Found error :" + e.Error.Message); + /// } + /// IoTConnectivityClientManager.PlatformInformationFound += handler; + /// IoTConnectivityClientManager.FindingErrorOccurred += errorHandler; + /// // Do not forget to remove these event handlers when they are not required any more. + /// int id = IoTConnectivityClientManager.StartFindingPlatformInformation(IoTConnectivityClientManager.MulticastAddress); + /// + public static int StartFindingPlatformInformation(string hostAddress, ResourceQuery query = null) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ip; + + IntPtr id = IntPtr.Zero; + lock (s_platformInformationCallbacksMap) + { + id = (IntPtr)s_requestId++; + } + s_platformInformationCallbacksMap[id] = (IntPtr platformInfoHandle, int result, IntPtr userData) => + { + if (PlatformInformationFound == null) + return false; + + int requestId = (int)userData; + if (result == (int)IoTConnectivityError.None) + { + if (platformInfoHandle != IntPtr.Zero) + { + PlatformInformationFoundEventArgs e = GetPlatformInformationFoundEventArgs(requestId, platformInfoHandle); + if (e == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Can't get PlatformInformationFoundEventArgs"); + return true; + } + PlatformInformationFound?.Invoke(null, e); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.EventContinue : " + e.EventContinue); + return e.EventContinue; + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Handle is null"); + } + } + else + { + FindingErrorOccurredEventArgs e = GetFindingErrorOccurredEventArgs(requestId, result); + FindingErrorOccurred?.Invoke(null, e); + + lock (s_platformInformationCallbacksMap) + { + s_platformInformationCallbacksMap.Remove(id); + } + } + return true; + }; + + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errorCode = Interop.IoTConnectivity.Client.PlatformInformation.Find(hostAddress, (int)connectivityType, queryHandle, s_platformInformationCallbacksMap[id], id); + if (errorCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get platform information"); + lock (s_platformInformationCallbacksMap) + { + s_platformInformationCallbacksMap.Remove(id); + } + throw IoTConnectivityErrorFactory.GetException(errorCode); + } + + return (int)id; + } + + // Private methods + private static PresenceReceivedEventArgs GetPresenceReceivedEventArgs(int presenceId, IntPtr presenceResponseHandle) + { + int trigger; + IntPtr host, type; + + int ret = Interop.IoTConnectivity.Client.PresenceResponse.GetHostAddress(presenceResponseHandle, out host); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get host address"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PresenceResponse.GetResourceType(presenceResponseHandle, out type); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get resource type"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PresenceResponse.GetTrigger(presenceResponseHandle, out trigger); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get event type"); + return null; + } + + PresenceReceivedEventArgs e = new PresenceReceivedEventArgs() + { + PresenceId = presenceId, + HostAddress = (host != IntPtr.Zero) ? Marshal.PtrToStringAnsi(host) : string.Empty, + Type = (type != IntPtr.Zero) ? Marshal.PtrToStringAnsi(type) : string.Empty, + EventType = (PresenceEventType)trigger + }; + + return e; + } + + private static DeviceInformationFoundEventArgs GetDeviceInformationFoundEventArgs(int requestId, IntPtr deviceInfoHandle) + { + IntPtr name, specVersion, deviceId, dataModelVersion; + + int ret = Interop.IoTConnectivity.Client.DeviceInformation.GetProperty(deviceInfoHandle, (int)Interop.IoTConnectivity.Client.DeviceInformation.Property.Name, out name); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get name"); + return null; + } + + ret = Interop.IoTConnectivity.Client.DeviceInformation.GetProperty(deviceInfoHandle, (int)Interop.IoTConnectivity.Client.DeviceInformation.Property.SpecVersion, out specVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get spec version"); + return null; + } + + ret = Interop.IoTConnectivity.Client.DeviceInformation.GetProperty(deviceInfoHandle, (int)Interop.IoTConnectivity.Client.DeviceInformation.Property.Id, out deviceId); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get device id"); + return null; + } + + ret = Interop.IoTConnectivity.Client.DeviceInformation.GetProperty(deviceInfoHandle, (int)Interop.IoTConnectivity.Client.DeviceInformation.Property.DataModelVersion, out dataModelVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get data model version"); + return null; + } + + DeviceInformationFoundEventArgs e = new DeviceInformationFoundEventArgs() + { + RequestId = requestId, + EventContinue = true, + Name = (name != IntPtr.Zero) ? Marshal.PtrToStringAnsi(name) : string.Empty, + SpecVersion = (specVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(specVersion) : string.Empty, + DeviceId = (deviceId != IntPtr.Zero) ? Marshal.PtrToStringAnsi(deviceId) : string.Empty, + DataModelVersion = (dataModelVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(dataModelVersion) : string.Empty + }; + + return e; + } + + private static PlatformInformationFoundEventArgs GetPlatformInformationFoundEventArgs(int requestId, IntPtr platformInfoHandle) + { + IntPtr platformId, manufacturerName, manufacturerUrl, modelNumber, dateOfManufacture, platformVersion, osVersion, hardwareVersion, firmwareVersion, supportUrl, systemTime; + + int ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.Id, out platformId); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get platform id"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.MfgName, out manufacturerName); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get manufacturer name"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.MfgUrl, out manufacturerUrl); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get manufacturer url"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.ModelNumber, out modelNumber); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get model number"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.DateOfMfg, out dateOfManufacture); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get date of manufacture"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.PlatformVer, out platformVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get platform version"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.OsVer, out osVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to os version"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.HardwareVer, out hardwareVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to hardware version"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.FirmwareVer, out firmwareVersion); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get firmware version"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.SupportUrl, out supportUrl); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get support url"); + return null; + } + + ret = Interop.IoTConnectivity.Client.PlatformInformation.GetProperty(platformInfoHandle, (int)Interop.IoTConnectivity.Client.PlatformInformation.Propery.SystemTime, out systemTime); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get system time"); + return null; + } + + PlatformInformationFoundEventArgs e = new PlatformInformationFoundEventArgs() + { + RequestId = requestId, + PlatformId = (platformId != IntPtr.Zero) ? Marshal.PtrToStringAnsi(platformId) : string.Empty, + ManufacturerName = (manufacturerName != IntPtr.Zero) ? Marshal.PtrToStringAnsi(manufacturerName) : string.Empty, + ManufacturerURL = (manufacturerUrl != IntPtr.Zero) ? Marshal.PtrToStringAnsi(manufacturerUrl) : string.Empty, + DateOfManufacture = (dateOfManufacture != IntPtr.Zero) ? Marshal.PtrToStringAnsi(dateOfManufacture) : string.Empty, + ModelNumber = (modelNumber != IntPtr.Zero) ? Marshal.PtrToStringAnsi(modelNumber) : string.Empty, + PlatformVersion = (platformVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(platformVersion) : string.Empty, + OsVersion = (osVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(osVersion) : string.Empty, + HardwareVersion = (hardwareVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(hardwareVersion) : string.Empty, + FirmwareVersion = (firmwareVersion != IntPtr.Zero) ? Marshal.PtrToStringAnsi(firmwareVersion) : string.Empty, + SupportUrl = (supportUrl != IntPtr.Zero) ? Marshal.PtrToStringAnsi(supportUrl) : string.Empty, + SystemTime = (systemTime != IntPtr.Zero) ? Marshal.PtrToStringAnsi(systemTime) : string.Empty + }; + + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.RequestId is " + e.RequestId); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.PlatformId is " + e.PlatformId); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.ManufacturerName is " + e.ManufacturerName); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.ManufacturerURL is " + e.ManufacturerURL); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.DateOfManufacture is " + e.DateOfManufacture); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.ModelNumber is " + e.ModelNumber); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.PlatformVersion is " + e.PlatformVersion); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.OsVersion is " + e.OsVersion); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.HardwareVersion is " + e.HardwareVersion); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.FirmwareVersion is " + e.FirmwareVersion); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.SupportUrl is " + e.SupportUrl); + Log.Info(IoTConnectivityErrorFactory.LogTag, "e.SystemTime is " + e.SystemTime); + + return e; + } + + private static FindingErrorOccurredEventArgs GetFindingErrorOccurredEventArgs(int requestId, int err) + { + FindingErrorOccurredEventArgs e = new FindingErrorOccurredEventArgs() + { + RequestId = requestId, + Error = IoTConnectivityErrorFactory.GetException(err) + }; + return e; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityErrorFactory.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityErrorFactory.cs new file mode 100755 index 0000000..338a093 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityErrorFactory.cs @@ -0,0 +1,103 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.IO; +using Tizen.Internals.Errors; + +namespace Tizen.Network.IoTConnectivity +{ + internal enum IoTConnectivityError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + Io = ErrorCode.IoError, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoData = ErrorCode.NoData, + TimedOut = ErrorCode.TimedOut, + Iotivity = -0x01C80000 | 0x01, + Representation = -0x01C80000 | 0x02, + InvalidType = -0x01C80000 | 0x03, + Already = -0x01C80000 | 0x04, + System = -0x01C80000 | 0x06, + } + + internal static class IoTConnectivityErrorFactory + { + internal const string LogTag = "Tizen.Network.IoTConnectivity"; + + internal static void ThrowException(int err) + { + throw GetException(err); + } + + internal static Exception GetException(int err) + { + IoTConnectivityError error = (IoTConnectivityError)err; + if (error == IoTConnectivityError.OutOfMemory) + { + return new OutOfMemoryException("Out of memory"); + } + else if (error == IoTConnectivityError.InvalidParameter) + { + return new ArgumentException("Invalid parameter"); + } + else if (error == IoTConnectivityError.Io) + { + return new IOException("I/O Error"); + } + else if (error == IoTConnectivityError.NoData) + { + return new InvalidOperationException("No data found"); + } + else if (error == IoTConnectivityError.TimedOut) + { + return new TimeoutException("timed out"); + } + else if (error == IoTConnectivityError.PermissionDenied) + { + return new UnauthorizedAccessException("Permission denied"); + } + else if (error == IoTConnectivityError.NotSupported) + { + return new NotSupportedException("Not supported"); + } + else if (error == IoTConnectivityError.Representation) + { + return new InvalidOperationException("Representation error"); + } + else if (error == IoTConnectivityError.InvalidType) + { + return new ArgumentException("Invalid type"); + } + else if (error == IoTConnectivityError.Already) + { + return new InvalidOperationException("Duplicate"); + } + else if (error == IoTConnectivityError.System) + { + return new InvalidOperationException("System error"); + } + else + { + return new InvalidOperationException("Invalid operation"); + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs new file mode 100755 index 0000000..1a89430 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/IoTConnectivityServerManager.cs @@ -0,0 +1,315 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// IoT connectivity server manager consists of server side APIs. + /// + /// 3 + public static class IoTConnectivityServerManager + { + private static int s_requestId = 1; + private static Dictionary s_RequestHandlerCallbackMap = new Dictionary(); + + /// + /// Initializes IoTCon. Calls this API to start IoTCon. + /// + /// 3 + /// + /// @a filePath point to a file for handling secure virtual resources. + /// The file that is CBOR(Concise Binary Object Representation)-format must already exist + /// in @a filePath. We recommend to use application-local file for @a filePath. + /// + /// + /// http://tizen.org/privilege/network.get \n + /// http://tizen.org/privilege/internet + /// + /// public + /// The file path to point to storage for handling secure virtual resources. + /// http://tizen.org/feature/iot.ocf + /// + /// You must call Deinitialize() if IoTCon API is no longer needed. + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when an application does not have privilege to access + /// + /// string filePath = "../../res/iotcon-test-svr-db-server.dat"; + /// IoTConnectivityServerManager.Initialize(filePath); + /// + public static void Initialize(string filePath) + { + int ret = Interop.IoTConnectivity.Client.IoTCon.Initialize(filePath); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to initialize"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Deinitializes IoTCon. + /// + /// 3 + /// + /// This API must be called if IoTCon API is no longer needed. + /// + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// IoTConnectivityServerManager.Deinitialize(); + /// + public static void Deinitialize() + { + _resources.Clear(); + s_requestId = 1; + s_RequestHandlerCallbackMap.Clear(); + + Interop.IoTConnectivity.Client.IoTCon.Deinitialize(); + } + + /// + /// Registers a resource in IoTCon server. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The resource to register. + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// Thrown when there is not enough memory. + /// Thrown when an application does not have privilege to access. + /// + /// ResourceTypes types = new ResourceTypes(new List(){ "org.tizen.light" }); + /// Attributes attributes = new Attributes { { "state", "ON" }}; + /// Resource res = new LiteResource("/room/1", types, ResourcePolicy.Discoverable, attributes); + /// try { + /// IoTConnectivityServerManager.RegisterResource(res); + /// } catch(Exception ex) { + /// Console.Log("Exception caught : " + ex.Message); + /// } + /// + public static void RegisterResource(Resource resource) + { + Log.Info(IoTConnectivityErrorFactory.LogTag, "..."); + + IntPtr id = IntPtr.Zero; + lock (s_RequestHandlerCallbackMap) + { + id = (IntPtr)s_requestId++; + } + + s_RequestHandlerCallbackMap[id] = (IntPtr r_resource, IntPtr request, IntPtr userData) => + { + int requestId = (int)userData; + + Log.Info(IoTConnectivityErrorFactory.LogTag, "Received s_RequestHandlerCallbackMap : " + requestId); + + if (request == IntPtr.Zero) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "request is IntPtr.Zero"); + return; + } + resource.OnRequest(r_resource, request, userData); + }; + + IntPtr handle = IntPtr.Zero; + int errorCode = Interop.IoTConnectivity.Server.Resource.Create(resource.UriPath, resource.Types._resourceTypeHandle, resource.Interfaces.ResourceInterfacesHandle, (int)resource.Policy, s_RequestHandlerCallbackMap[id], id, out handle); + if (errorCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed create resource"); + lock (s_RequestHandlerCallbackMap) + { + s_RequestHandlerCallbackMap.Remove(id); + } + throw IoTConnectivityErrorFactory.GetException(errorCode); + } + else + { + resource.ResourceHandle = handle; + } + _resources.Add(resource); + } + + /// + /// Unregisters a resource in IoTCon server. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The resource to unregister. + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when an application does not have privilege to access. + /// + /// ResourceTypes types = new ResourceTypes(new List(){ "org.tizen.light" }); + /// Attributes attributes = new Attributes { { "state", "ON" }}; + /// Resource res = new LiteResource("/room/1", types, ResourcePolicy.Discoverable, attributes); + /// IoTConnectivityServerManager.RegisterResource(res); + /// try { + /// IoTConnectivityServerManager.UnregisterResource(res); + /// } catch(Exception ex) { + /// Console.Log("Exception caught : " + ex.Message); + /// } + /// + public static void UnregisterResource(Resource resource) + { + if (resource != null) + { + if (resource.ResourceHandle != IntPtr.Zero) + { + Interop.IoTConnectivity.Server.Resource.Destroy(resource.ResourceHandle); + resource.ResourceHandle = IntPtr.Zero; + } + + _resources.Remove(resource); + } + } + + /// + /// Starts presence of a server. + /// + /// 3 + /// + /// Use this API to send server's announcements to clients. + /// Server can call this API when online for the first time or come back from offline to online.\n + /// If @a time is 0, server will set default value as 60 seconds.\n + /// If @a time is very big, server will set maximum value as (60 * 60 * 24) seconds, (24 hours). + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The interval of announcing presence in seconds. + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// + /// try { + /// IoTConnectivityServerManager.StartSendingPresence(120); + /// } catch(Exception ex) { + /// Console.Log("Exception caught : " + ex.Message); + /// } + /// + public static void StartSendingPresence(uint time) + { + int ret = Interop.IoTConnectivity.Server.IoTCon.StartPresence(time); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to start presence"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Stops presence of a server. + /// + /// 3 + /// + /// Use this API to stop sending server's announcements to clients. + /// Server can call this API when terminating, entering to offline or out of network. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// http://tizen.org/feature/iot.ocf + ///
+        /// Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// + /// IoTConnectivityServerManager.StopSendingPresence(); + /// + public static void StopSendingPresence() + { + int ret = Interop.IoTConnectivity.Server.IoTCon.StopPresence(); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed cancel presence"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Sets the device name. + /// + /// 3 + /// + /// This API sets the name of the local device (the device calling the API).\n + /// If the device name is set, clients can get the name using . + /// + /// The device name. + /// http://tizen.org/feature/iot.ocf + /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// + /// IoTConnectivityServerManager.SetDeviceName("my-tizen"); + /// + public static void SetDeviceName(string deviceName) + { + int ret = Interop.IoTConnectivity.Server.IoTCon.SetDeviceName(deviceName); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed set device name"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + private static List _resources = new List(); + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/LiteResource.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/LiteResource.cs new file mode 100755 index 0000000..b7b4801 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/LiteResource.cs @@ -0,0 +1,179 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents a lite resource. + /// It provides APIs to encapsulate resources. + /// This class is accessed by using a constructor to create a new instance of this object. + /// + /// 3 + public class LiteResource : Resource + { + /// + /// The LiteResource constructor. + /// + /// 3 + /// + /// Creates a lite resource, which can then be registered in server using .\n + /// When client requests some operations, it sends a response to client automatically.\n + /// @a uri length must be less than 128. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The uri path of the lite resource. + /// The type of the resource. + /// Policy of the resource. + /// Optional attributes of the resource. + /// http://tizen.org/feature/iot.ocf + ///
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// + /// List list = new List() { "org.tizen.light" }; + /// Attributes attributes = new Attributes() { + /// { "state", "ON" } + /// }; + /// LiteResource res = new LiteResource("/light/1", new ResourceTypes(list), ResourcePolicy.Discoverable, attributes); + /// + public LiteResource(string uri, ResourceTypes types, ResourcePolicy policy, Attributes attribs = null) + : base(uri, types, new ResourceInterfaces(new string[] { ResourceInterfaces.DefaultInterface }), policy) + { + Attributes = attribs; + } + + /// + /// Gets or sets the attributes of the lite resource. + /// + /// 3 + /// The attributes of the lite resource. + /// + /// List list = new List() { "org.tizen.light" }; + /// LiteResource res = new LiteResource("/light/1", new ResourceTypes(list), ResourcePolicy.Discoverable); + /// Attributes attributes = new Attributes() { + /// { "state", "ON" } + /// }; + /// res.Attributes = newAttributes; + /// foreach (KeyValuePair pair in res.Attributes) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + public Attributes Attributes { get; set; } + + /// + /// Decides whether to accept or reject a post request. + /// + /// 3 + /// + /// Child classes of this class can override this method to accept or reject post request. + /// + /// The new attributes of the lite resource. + /// true to accept post request, false to reject it. + /// + /// public class MyLightResource : LiteResource + /// { + /// protected override bool OnPost(Attributes attributes) + /// { + /// object newAttributes; + /// attributes.TryGetValue("LIGHT_ATTRIBUTE", out newAttributes); + /// if((int)newAttributes == 1) + /// return true; + /// return false; + /// } + /// } + /// + protected virtual bool OnPost(Attributes attribs) + { + return true; + } + + // The code block untill @endcond should not appear in doxygen spec. + /// @cond + protected sealed override Response OnGet(Request request) + { + Representation representation = new Representation() + { + UriPath = UriPath, + Interface = Interfaces, + Type = Types, + Attributes = Attributes + }; + + Response response = new Response() + { + Representation = representation, + Result = ResponseCode.Ok + }; + + return response; + } + + protected sealed override Response OnPut(Request request) + { + Response response = new Response(); + response.Result = ResponseCode.Forbidden; + return response; + } + + protected sealed override Response OnPost(Request request) + { + if (OnPost(request.Representation.Attributes)) + { + Attributes = request.Representation.Attributes; + Representation representation = new Representation() { + UriPath = UriPath, + Interface = Interfaces, + Type = Types, + Attributes = Attributes + }; + + Response response = new Response() { + Representation = representation, + Result = ResponseCode.Ok + }; + + Notify(representation, QualityOfService.High); + return response; + } + + return new Response() + { + Result = ResponseCode.Error + }; + } + + protected sealed override Response OnDelete(Request request) + { + Response response = new Response(); + response.Result = ResponseCode.Forbidden; + return response; + } + + protected sealed override bool OnObserving(Request request, ObserveType observeType, int observeId) + { + return true; + } + /// @endcond + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/NamespaceDoc.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/NamespaceDoc.cs new file mode 100755 index 0000000..6c4b38f --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/NamespaceDoc.cs @@ -0,0 +1,12 @@ +/** + +The Tizen.Network.IoTConnectivity namespace provides classes to manage +Resource, RemoteResource, Request, Response and so on which are based on IoTivity project. + + +The Tizen.Network.IoTConnectivity namespace provides classes to manage +Resource, RemoteResource, Request, Response and so on which are based on IoTivity project. + +*/ +namespace Tizen.Network.IoTConnectivity {} + diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObservePolicy.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObservePolicy.cs new file mode 100755 index 0000000..b70b841 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObservePolicy.cs @@ -0,0 +1,37 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for the policy of observation. + /// + /// 3 + public enum ObservePolicy + { + /// + /// Indicates the observation request for the most up-to-date notifications only. + /// + /// 3 + IgnoreOutOfOrder = 0, + /// + /// Indicates the observation request for all notifications including state notifications. + /// + /// 3 + AcceptOutOfOrder + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserveType.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserveType.cs new file mode 100755 index 0000000..6329bef --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserveType.cs @@ -0,0 +1,45 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for the type of observation. + /// + /// 3 + public enum ObserveType + { + /// + /// No observe action. + /// + /// 3 + NoType = 0, + + /// + /// Indicates an action of the registering observation. + /// + /// 3 + Register = 1, + + /// + /// Indicates an action of unregistering observation. + /// + /// 3 + Deregister = 2, + } +} + diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserverNotifiedEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserverNotifiedEventArgs.cs new file mode 100755 index 0000000..1e7c6ab --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ObserverNotifiedEventArgs.cs @@ -0,0 +1,44 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the ObserverNotified event. + /// + /// 3 + public class ObserverNotifiedEventArgs : EventArgs + { + internal ObserverNotifiedEventArgs() { } + + /// + /// Result of the observe response. + /// + /// 3 + /// Result of the observe response. + public ResponseCode Result { get; internal set; } + + /// + /// Representation of the resource being observed. + /// + /// 3 + /// Representation of the resource being observed. + public Representation Representation { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PlatformInformationFoundEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PlatformInformationFoundEventArgs.cs new file mode 100755 index 0000000..d7279e9 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PlatformInformationFoundEventArgs.cs @@ -0,0 +1,119 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the PlatformInformationFound event. + /// + /// 3 + public class PlatformInformationFoundEventArgs + { + internal PlatformInformationFoundEventArgs() { } + + /// + /// Indicates the request ID. + /// + /// 3 + /// The request ID. + public int RequestId { get; internal set; } + + /// + /// Indicates to continuously receive the event for finding the platform information. + /// + /// 3 + /// Continuously receive the event for finding the platform information. + public bool EventContinue { get; set; } + + /// + /// Indicates the platform identifier. + /// + /// 3 + /// The platform identifier. + public string PlatformId { get; internal set; } + + /// + /// Indicates the name of the manufacturer. + /// + /// 3 + /// The name of the manufacturer. + public string ManufacturerName { get; internal set; } + + /// + /// Indicates the URL of the manufacturer. + /// + /// 3 + /// The URL of the manufacturer. + public string ManufacturerURL { get; internal set; } + + /// + /// Indicates the model number as designated by the manufacturer. + /// + /// 3 + /// The model number as designated by the manufacturer. + public string ModelNumber { get; internal set; } + + /// + /// Indicates the manufacturing date of the device. + /// + /// 3 + /// The manufacturing date of the device. + public string DateOfManufacture { get; internal set; } + + /// + /// Indicates the version of the platfrom defined by the manufacturer. + /// + /// 3 + /// The version of platfrom defined by manufacturer. + public string PlatformVersion { get; internal set; } + + /// + /// Indicates the version of the platfrom resident OS. + /// + /// 3 + /// The version of the platfrom resident OS. + public string OsVersion { get; internal set; } + + /// + /// Indicates the version of the platform Hardware. + /// + /// 3 + /// The version of the platform Hardware. + public string HardwareVersion { get; internal set; } + + /// + /// Indicates the version of the device firmware. + /// + /// 3 + /// The version of the device firmware. + public string FirmwareVersion { get; internal set; } + + /// + /// Indicates the URL that points to support information from the manufacturer. + /// + /// 3 + /// The URL that points to support information from the manufacturer. + public string SupportUrl { get; internal set; } + + /// + /// Indicates the reference time of the device. + /// + /// 3 + /// The reference time of the device. + public string SystemTime { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceEventType.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceEventType.cs new file mode 100755 index 0000000..5c7b58f --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceEventType.cs @@ -0,0 +1,42 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for operation of presence response. + /// + /// 3 + public enum PresenceEventType + { + /// + /// Indicates the resource creation operation of the server. + /// + /// 3 + ResourceCreated = 0, + /// + /// Indicates the resource updation operation of the server. + /// + /// 3 + ResourceUpdated, + /// + /// Indicates the resource destruction operation of the server. + /// + /// 3 + ResourceDestroyed + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceReceivedEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceReceivedEventArgs.cs new file mode 100755 index 0000000..4fc0238 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/PresenceReceivedEventArgs.cs @@ -0,0 +1,58 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the PresenceReceived event. + /// + /// 3 + public class PresenceReceivedEventArgs : EventArgs + { + internal PresenceReceivedEventArgs() { } + + /// + /// Indicates the request ID of the presence event. + /// + /// 3 + /// The request ID of the presence event. + public int PresenceId { get; internal set; } + + /// + /// Indicates the event type. + /// + /// 3 + /// The event type. + public PresenceEventType EventType { get; internal set; } + + /// + /// Indicates the host address of resource. + /// + /// 3 + /// The host address of resource. + public string HostAddress { get; internal set; } + + /// + /// Indicates the type of the resource. + /// + /// 3 + /// The type of the resource. + public string Type { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/QualityOfService.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/QualityOfService.cs new file mode 100755 index 0000000..54eed08 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/QualityOfService.cs @@ -0,0 +1,37 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for states of remote resource. + /// + /// 3 + public enum QualityOfService + { + /// + /// Indicates the low quality of service. + /// + /// 3 + Low = 0, + /// + /// Indicates the high quality of service. + /// + /// 3 + High + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs new file mode 100755 index 0000000..af90596 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResource.cs @@ -0,0 +1,893 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; +using System.Net; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents a remote resource. + /// It provides APIs to manage remote resource. + /// + /// 3 + public class RemoteResource : IDisposable + { + internal const int TimeOutMax = 3600; + internal IntPtr _remoteResourceHandle = IntPtr.Zero; + + private bool _disposed = false; + private bool _cacheEnabled = false; + private ResourceOptions _options; + + private int _responseCallbackId = 1; + private static Dictionary _responseCallbacksMap = new Dictionary(); + + private Interop.IoTConnectivity.Client.RemoteResource.CachedRepresentationChangedCallback _cacheUpdatedCallback; + private Interop.IoTConnectivity.Client.RemoteResource.StateChangedCallback _stateChangedCallback; + private Interop.IoTConnectivity.Client.RemoteResource.ObserveCallback _observeCallback; + + private EventHandler _stateChangedEventHandler; + + /// + /// Creates a remote resource instance. + /// + /// 3 + /// + /// To use this API, you should provide all the details required to correctly contact and + /// observe the object.\n + /// If not, you should discover the resource object manually.\n + /// The @a policy can contain multiple policies like ResourcePolicy.Discoverable | ResourcePolicy.Observable. + /// + /// The host address of the resource. + /// The URI path of the resource. + /// The policies of the resource. + /// The resource types of the resource. + /// The resource interfaces of the resource. + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// Thrown when there is an invalid parameter. + public RemoteResource(string hostAddress, string uriPath, ResourcePolicy policy, ResourceTypes resourceTypes, ResourceInterfaces resourceInterfaces) + { + if (hostAddress == null || uriPath == null || resourceTypes == null || resourceInterfaces == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Invalid parameters"); + throw new ArgumentException("Invalid parameter"); + } + + HostAddress = hostAddress; + UriPath = uriPath; + Policy = policy; + Types = new List(resourceTypes); + Interfaces = new List(resourceInterfaces); + DeviceId = null; + + CreateRemoteResource(resourceTypes._resourceTypeHandle, resourceInterfaces.ResourceInterfacesHandle); + } + + internal RemoteResource(IntPtr handleToClone) + { + int ret = Interop.IoTConnectivity.Client.RemoteResource.Clone(handleToClone, out _remoteResourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Faled to clone"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + SetRemoteResource(); + } + + /// + /// Destructor of the RemoteResource class. + /// + ~RemoteResource() + { + Dispose(false); + } + + /// + /// The event is invoked with cached resource attributes. + /// + /// 3 + public event EventHandler CacheUpdated; + + /// + /// Observe an event on the resource sent by the server. + /// + /// 3 + public event EventHandler ObserverNotified; + + /// + /// The event is called when remote resource's state are changed. + /// + /// 3 + public event EventHandler StateChanged + { + add + { + if (_stateChangedEventHandler == null) + { + RegisterStateChangedEvent(); + } + _stateChangedEventHandler += value; + } + remove + { + _stateChangedEventHandler -= value; + if (_stateChangedEventHandler == null) + { + UnregisterStateChangedEvent(); + } + } + } + + /// + /// The host address of the resource. + /// + /// 3 + /// The host address of the resource. + public string HostAddress { get; private set; } + + /// + /// The URI path of the resource. + /// + /// 3 + /// The URI path of the resource. + public string UriPath { get; private set; } + + /// + /// The resource types of the remote resource. + /// + /// 3 + /// The resource types of the remote resource. + public IEnumerable Types { get; private set; } + + /// + /// The interfaces of the resource. + /// + /// 3 + /// The interfaces of the resource. + public IEnumerable Interfaces { get; private set; } + + /// + /// The policy of the resource. + /// + /// 3 + /// The policy of the resource. + public ResourcePolicy Policy { get; private set; } + + /// + /// The header options of the resource. + /// + /// 3 + /// The header options of the resource. + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + public ResourceOptions Options + { + get + { + return _options; + } + set + { + _options = value; + if (value != null) + { + int ret = Interop.IoTConnectivity.Client.RemoteResource.SetOptions(_remoteResourceHandle, value._resourceOptionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set options"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + } + + /// + /// Indicates the CacheEnabled status of the remote resource. + /// + /// 3 + /// + /// Client can start caching only when this is set true. Set it to false to stop caching the resource attributes. + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + public bool CacheEnabled + { + get + { + return _cacheEnabled; + } + set + { + if (_cacheEnabled != value) + { + _cacheEnabled = value; + HandleCachePolicyChanged(); + } + } + } + + /// + /// Time interval of monitoring and caching API. + /// + /// 3 + /// + /// Default time interval is 10 seconds. + /// Seconds for time interval (must be in range from 1 to 3600). + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + public int TimeInterval + { + get + { + int interval; + int ret = Interop.IoTConnectivity.Client.RemoteResource.GetTimeInterval(_remoteResourceHandle, out interval); + if (ret != (int)IoTConnectivityError.None) + { + Log.Warn(IoTConnectivityErrorFactory.LogTag, "Failed to get time interval"); + return 0; + } + return interval; + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (value <= TimeOutMax && value > 0) + { + ret = Interop.IoTConnectivity.Client.RemoteResource.SetTimeInterval(_remoteResourceHandle, value); + } + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set time interval"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// The device ID of the resource. + /// + /// 3 + /// The device ID of the resource. + public string DeviceId { get; private set; } + + /// + /// Gets cached representation from the remote resource. + /// + /// 3 + /// cached representation from the remote resource. + /// http://tizen.org/feature/iot.ocf + public Representation CachedRepresentation() + { + IntPtr handle; + int ret = Interop.IoTConnectivity.Client.RemoteResource.GetCachedRepresentation(_remoteResourceHandle, out handle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Warn(IoTConnectivityErrorFactory.LogTag, "Failed to get CachedRepresentation"); + return null; + } + + Representation representation = new Representation(handle); + return representation; + } + + /// + /// Starts observing on the resource. + /// + /// 3 + /// + /// When server sends notification message, will be called. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The type to specify how client wants to observe. + /// The query to send to server. + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + /// Thrown when there is not enough memory. + public void StartObserving(ObservePolicy policy, ResourceQuery query = null) + { + _observeCallback = (IntPtr resource, int err, int sequenceNumber, IntPtr response, IntPtr userData) => + { + int result; + IntPtr representationHandle; + int ret = Interop.IoTConnectivity.Server.Response.GetResult(response, out result); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get result"); + return; + } + + ret = Interop.IoTConnectivity.Server.Response.GetRepresentation(response, out representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get representation"); + return; + } + + Representation repr = null; + try + { + repr = new Representation(representationHandle); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to new representation: " + exp.Message); + return; + } + + ObserverNotifiedEventArgs e = new ObserverNotifiedEventArgs() + { + Representation = repr, + Result = (ResponseCode)result + }; + ObserverNotified?.Invoke(this, e); + }; + + IntPtr queryHandle = IntPtr.Zero; + if (query != null) + { + queryHandle = query._resourceQueryHandle; + } + + int errCode = Interop.IoTConnectivity.Client.RemoteResource.RegisterObserve(_remoteResourceHandle, (int)policy, queryHandle, _observeCallback, IntPtr.Zero); + if (errCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to register observe callbacks"); + throw IoTConnectivityErrorFactory.GetException(errCode); + } + } + + /// + /// Stops observing on the resource. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when an application does not have privilege to access. + public void StopObserving() + { + int ret = Interop.IoTConnectivity.Client.RemoteResource.DeregisterObserve(_remoteResourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to deregister observe callbacks"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Gets the attributes of a resource asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The ResourceQuery to send to server. + /// Remote response with result and representation. + /// http://tizen.org/feature/iot.ocf + public async Task GetAsync(ResourceQuery query = null) + { + TaskCompletionSource tcsRemoteResponse = new TaskCompletionSource(); + + IntPtr id = IntPtr.Zero; + lock (_responseCallbacksMap) + { + id = (IntPtr)_responseCallbackId++; + } + _responseCallbacksMap[id] = (IntPtr resource, int err, int requestType, IntPtr responseHandle, IntPtr userData) => + { + IntPtr responseCallbackId = userData; + lock(_responseCallbacksMap) + { + _responseCallbacksMap.Remove(responseCallbackId); + } + + if (responseHandle != IntPtr.Zero) + { + try + { + tcsRemoteResponse.TrySetResult(GetRemoteResponse(responseHandle)); + } + catch(Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get RemoteResponse: ", exp.Message); + tcsRemoteResponse.TrySetException(exp); + } + } + else + { + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.System)); + } + }; + + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errCode = Interop.IoTConnectivity.Client.RemoteResource.Get(_remoteResourceHandle, queryHandle, _responseCallbacksMap[id], id); + if (errCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get resource attributes"); + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException(errCode)); + } + return await tcsRemoteResponse.Task; + } + + /// + /// Puts the representation of a resource asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// Resource representation to put. + /// The ResourceQuery to send to server. + /// Remote response with result and representation. + /// http://tizen.org/feature/iot.ocf + public async Task PutAsync(Representation representation, ResourceQuery query = null) + { + TaskCompletionSource tcsRemoteResponse = new TaskCompletionSource(); + + IntPtr id = IntPtr.Zero; + lock (_responseCallbacksMap) + { + id = (IntPtr)_responseCallbackId++; + } + _responseCallbacksMap[id] = (IntPtr resource, int err, int requestType, IntPtr responseHandle, IntPtr userData) => + { + IntPtr responseCallbackId = userData; + lock (_responseCallbacksMap) + { + _responseCallbacksMap.Remove(responseCallbackId); + } + if (err == (int)(IoTConnectivityError.Iotivity)) + { + RemoteResponse response = new RemoteResponse(); + response.Result = ResponseCode.Forbidden; + response.Representation = null; + tcsRemoteResponse.TrySetResult(response); + } + else if (responseHandle != IntPtr.Zero) + { + try + { + tcsRemoteResponse.TrySetResult(GetRemoteResponse(responseHandle)); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get RemoteResponse: ", exp.Message); + tcsRemoteResponse.TrySetException(exp); + } + } + else + { + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.System)); + } + }; + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errCode = Interop.IoTConnectivity.Client.RemoteResource.Put(_remoteResourceHandle, representation._representationHandle, queryHandle, _responseCallbacksMap[id], id); + if (errCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to put resource representation"); + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException(errCode)); + } + return await tcsRemoteResponse.Task; + } + + /// + /// Posts request on a resource asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// Resource representation of request. + /// The ResourceQuery to send to server. + /// Remote response with result and representation. + /// http://tizen.org/feature/iot.ocf + public async Task PostAsync(Representation representation, ResourceQuery query = null) + { + TaskCompletionSource tcsRemoteResponse = new TaskCompletionSource(); + + IntPtr id = IntPtr.Zero; + lock (_responseCallbacksMap) + { + id = (IntPtr)_responseCallbackId++; + } + _responseCallbacksMap[id] = (IntPtr resource, int err, int requestType, IntPtr responseHandle, IntPtr userData) => + { + IntPtr responseCallbackId = userData; + lock (_responseCallbacksMap) + { + _responseCallbacksMap.Remove(responseCallbackId); + } + if (responseHandle != IntPtr.Zero) + { + try + { + tcsRemoteResponse.TrySetResult(GetRemoteResponse(responseHandle)); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get RemoteResponse: ", exp.Message); + tcsRemoteResponse.TrySetException(exp); + } + } + else + { + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.System)); + } + }; + IntPtr queryHandle = (query == null) ? IntPtr.Zero : query._resourceQueryHandle; + int errCode = Interop.IoTConnectivity.Client.RemoteResource.Post(_remoteResourceHandle, representation._representationHandle, queryHandle, _responseCallbacksMap[id], id); + if (errCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to post request"); + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException(errCode)); + } + return await tcsRemoteResponse.Task; + } + + /// + /// Deletes the resource asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// Remote response with result and representation. + /// http://tizen.org/feature/iot.ocf + public async Task DeleteAsync() + { + TaskCompletionSource tcsRemoteResponse = new TaskCompletionSource(); + + IntPtr id = IntPtr.Zero; + lock (_responseCallbacksMap) + { + id = (IntPtr)_responseCallbackId++; + } + _responseCallbacksMap[id] = (IntPtr resource, int err, int requestType, IntPtr responseHandle, IntPtr userData) => + { + IntPtr responseCallbackId = userData; + lock (_responseCallbacksMap) + { + _responseCallbacksMap.Remove(responseCallbackId); + } + if (err == (int)(IoTConnectivityError.Iotivity)) + { + RemoteResponse response = new RemoteResponse(); + response.Result = ResponseCode.Forbidden; + response.Representation = null; + tcsRemoteResponse.TrySetResult(response); + } + else if (responseHandle != IntPtr.Zero) + { + try + { + tcsRemoteResponse.TrySetResult(GetRemoteResponse(responseHandle)); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get RemoteResponse: ", exp.Message); + tcsRemoteResponse.TrySetException(exp); + } + } + else + { + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.System)); + } + }; + + int errCode = Interop.IoTConnectivity.Client.RemoteResource.Delete(_remoteResourceHandle, _responseCallbacksMap[id], id); + if (errCode != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to delete"); + tcsRemoteResponse.TrySetException(IoTConnectivityErrorFactory.GetException(errCode)); + } + return await tcsRemoteResponse.Task; + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal static Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType GetConnectivityType(string hostAddress) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType type = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.None; + + Log.Info(IoTConnectivityErrorFactory.LogTag, hostAddress); + + if (hostAddress == IoTConnectivityClientManager.MulticastAddress) + { + type = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ipv4; + } + else + { + IPAddress address; + string hostName = hostAddress; + if (hostAddress.Contains(":")) + { + string[] hostParts = hostAddress.Split(':'); + if (hostParts.Length == 2) + { + hostName = hostParts[0]; + } + } + if (hostAddress.Contains("%")) + { + string[] hostParts = hostAddress.Split('%'); + if (hostParts.Length == 2) + { + hostName = hostParts[0]; + } + } + if (hostName.Contains("[")) + { + string[] hostParts = hostName.Split('['); + if (hostParts.Length == 2) + { + hostName = hostParts[1]; + } + } + Log.Info(IoTConnectivityErrorFactory.LogTag, hostName); + if (IPAddress.TryParse(hostName, out address)) + { + switch (address.AddressFamily) + { + case System.Net.Sockets.AddressFamily.InterNetwork: + type = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ipv4; + break; + case System.Net.Sockets.AddressFamily.InterNetworkV6: + type = Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.Ipv6; + break; + default: + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to parse for Ipv4 or Ipv6"); + break; + } + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to parse hostname " + hostName); + } + } + return type; + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Client.RemoteResource.Destroy(_remoteResourceHandle); + _disposed = true; + } + + private void HandleCachePolicyChanged() + { + if (_cacheEnabled) + { + _cacheUpdatedCallback = (IntPtr resource, IntPtr representation, IntPtr userData) => + { + if (CacheEnabled) + { + Representation repr = null; + try + { + repr = new Representation(representation); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to new Representation: " + exp.Message); + return; + } + + CacheUpdatedEventArgs e = new CacheUpdatedEventArgs() + { + Representation = repr + }; + CacheUpdated?.Invoke(this, e); + } + }; + + int ret = Interop.IoTConnectivity.Client.RemoteResource.StartCaching(_remoteResourceHandle, _cacheUpdatedCallback, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add cache updated event handler"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else + { + int ret = Interop.IoTConnectivity.Client.RemoteResource.StopCaching(_remoteResourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove cache updated event handler"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + private void RegisterStateChangedEvent() + { + _stateChangedCallback = (IntPtr resource, int state, IntPtr userData) => + { + StateChangedEventArgs e = new StateChangedEventArgs() + { + State = (ResourceState)state + }; + _stateChangedEventHandler?.Invoke(null, e); + }; + + int ret = Interop.IoTConnectivity.Client.RemoteResource.StartMonitoring(_remoteResourceHandle, _stateChangedCallback, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add state changed event handler"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + private void UnregisterStateChangedEvent() + { + int ret = Interop.IoTConnectivity.Client.RemoteResource.StopMonitoring(_remoteResourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove state changed event handler"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + private void CreateRemoteResource(IntPtr resourceTypeHandle, IntPtr resourceInterfaceHandle) + { + Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType connectivityType = GetConnectivityType(HostAddress); + if (connectivityType == Interop.IoTConnectivity.Client.RemoteResource.ConnectivityType.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Unable to parse host address"); + throw new ArgumentException("Unable to parse host address"); + } + int ret = Interop.IoTConnectivity.Client.RemoteResource.Create(HostAddress, (int)connectivityType, UriPath, (int)Policy, resourceTypeHandle, resourceInterfaceHandle, out _remoteResourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get remote resource"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + private void SetRemoteResource() + { + IntPtr hostAddressPtr, uriPathPtr; + int ret = Interop.IoTConnectivity.Client.RemoteResource.GetHostAddress(_remoteResourceHandle, out hostAddressPtr); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Faled to get host address"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + ret = Interop.IoTConnectivity.Client.RemoteResource.GetUriPath(_remoteResourceHandle, out uriPathPtr); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Faled to get uri path"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + int policy = (int)ResourcePolicy.NoProperty; + ret = Interop.IoTConnectivity.Client.RemoteResource.GetPolicies(_remoteResourceHandle, out policy); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Faled to get uri path"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + IntPtr typesHandle, interfacesHandle; + ret = Interop.IoTConnectivity.Client.RemoteResource.GetTypes(_remoteResourceHandle, out typesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get resource types"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + ret = Interop.IoTConnectivity.Client.RemoteResource.GetInterfaces(_remoteResourceHandle, out interfacesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get resource interfaces"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + IntPtr deviceIdPtr; + ret = Interop.IoTConnectivity.Client.RemoteResource.GetDeviceId(_remoteResourceHandle, out deviceIdPtr); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get device id"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + DeviceId = (deviceIdPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(deviceIdPtr) : string.Empty; + HostAddress = (hostAddressPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(hostAddressPtr) : string.Empty; + UriPath = (uriPathPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(uriPathPtr) : string.Empty; + Types = new ResourceTypes(typesHandle); + Interfaces = new ResourceInterfaces(interfacesHandle); + Policy = (ResourcePolicy)policy; + } + + private RemoteResponse GetRemoteResponse(IntPtr response) + { + int result; + IntPtr representationHandle, optionsHandle; + int ret = Interop.IoTConnectivity.Server.Response.GetResult(response, out result); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get result"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + ret = Interop.IoTConnectivity.Server.Response.GetRepresentation(response, out representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get representation"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + ret = Interop.IoTConnectivity.Server.Response.GetOptions(response, out optionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get options"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + return new RemoteResponse() + { + Result = (ResponseCode)result, + Representation = new Representation(representationHandle), + Options = (optionsHandle == IntPtr.Zero)? null : new ResourceOptions(optionsHandle) + }; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResponse.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResponse.cs new file mode 100755 index 0000000..cff7d44 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/RemoteResponse.cs @@ -0,0 +1,50 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents a remote response. + /// It represents the response of all CRUD operations. + /// + /// 3 + public class RemoteResponse + { + internal RemoteResponse() { } + + /// + /// Indicates the result of the response. + /// + /// 3 + /// The result of the response. + public ResponseCode Result { get; internal set; } + + /// + /// Indicates representation of the response. + /// + /// 3 + /// Representation of the response. + public Representation Representation { get; internal set; } + + /// + /// Indicates header options of the response. + /// + /// 3 + /// Header options of the response. + public ResourceOptions Options { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs new file mode 100755 index 0000000..8281a55 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Representation.cs @@ -0,0 +1,362 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class provides APIs to manage representation. + /// A representation is a payload of a request or a response. + /// + /// 3 + public class Representation : IDisposable + { + internal IntPtr _representationHandle = IntPtr.Zero; + + private bool _disposed = false; + private ObservableCollection _children = new ObservableCollection(); + + /// + /// The Representation constructor. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// Thrown when there is an invalid parameter. + /// + /// Representation repr = new Representation(); + /// + public Representation() + { + int ret = Interop.IoTConnectivity.Common.Representation.Create(out _representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create representation"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + _children.CollectionChanged += ChildrenCollectionChanged; + } + + // Constructor for cloning native representation object + internal Representation(IntPtr handleToClone) + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (handleToClone != IntPtr.Zero) + { + ret = Interop.IoTConnectivity.Common.Representation.Clone(handleToClone, out _representationHandle); + } + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create representation"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + _children.CollectionChanged += ChildrenCollectionChanged; + } + + /// + /// Destructor of the Representation class. + /// + ~Representation() + { + Dispose(false); + } + + /// + /// The URI path of resource. + /// + /// 3 + /// + /// The URI path of resource. + /// Setter can throw exceptions. + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// Representation repr = new Representation(); + /// repr.UriPath = "/a/light"; + /// Console.WriteLine("URI is {0}", repr.UriPath); //Getter + /// + public string UriPath + { + get + { + IntPtr path; + int ret = Interop.IoTConnectivity.Common.Representation.GetUriPath(_representationHandle, out path); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get uri"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + return (path != IntPtr.Zero) ? Marshal.PtrToStringAnsi(path) : string.Empty; + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (value != null) + ret = Interop.IoTConnectivity.Common.Representation.SetUriPath(_representationHandle, value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set uri"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// The type of resource. + /// + /// 3 + /// The type of resource. + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// Representation repr = new Representation(); + /// ResourceTypes types = new ResourceTypes (new List(){ "org.tizen.light" }); + /// repr.Type = types; + /// var type = repr.Type; // Getter + /// foreach (string item in type) + /// { + /// Console.WriteLine("Type is {0}", item); + /// } + /// + public ResourceTypes Type + { + get + { + IntPtr typeHandle; + int ret = Interop.IoTConnectivity.Common.Representation.GetResourceTypes(_representationHandle, out typeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type"); + return null; + } + return (typeHandle == IntPtr.Zero) ? null : new ResourceTypes(typeHandle); + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (value != null) + ret = Interop.IoTConnectivity.Common.Representation.SetResourceTypes(_representationHandle, value._resourceTypeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// The interface of the resource. + /// + /// 3 + /// The interface of the resource. + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// Representation repr = new Representation(); + /// ResourceInterfaces ifaces = new ResourceInterfaces (new List(){ ResourceInterfaces.DefaultInterface }); + /// repr.Interface = ifaces; + /// var iface = repr.Interface; // Getter + /// foreach (string item in iface) + /// { + /// Console.WriteLine("Interface is {0}", iface); + /// } + /// + public ResourceInterfaces Interface + { + get + { + IntPtr interfaceHandle; + int ret = Interop.IoTConnectivity.Common.Representation.GetResourceInterfaces(_representationHandle, out interfaceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get interface"); + return null; + } + return (interfaceHandle == IntPtr.Zero) ? null : new ResourceInterfaces(interfaceHandle); + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (value != null) + ret = Interop.IoTConnectivity.Common.Representation.SetResourceInterfaces(_representationHandle, value.ResourceInterfacesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// Current attributes of the resource. + /// + /// 3 + /// Current attributes of the resource. + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// Representation repr = new Representation(); + /// Attributes attributes = new Attributes() { + /// { "state", "ON" }, + /// { "dim", 10 } + /// }; + /// repr.Attributes = attributes; + /// var newAttributes = repr.Attributes; // Getter + /// string strval = newAttributes["state"] as string; + /// int intval = (int)newAttributes["dim"]; + /// Console.WriteLine("attributes are {0} and {1}", strval, intval); + /// + public Attributes Attributes + { + get + { + IntPtr attributeHandle; + int ret = Interop.IoTConnectivity.Common.Representation.GetAttributes(_representationHandle, out attributeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + return (attributeHandle == IntPtr.Zero) ? null : new Attributes(attributeHandle); + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (value != null) + { + ret = Interop.IoTConnectivity.Common.Representation.SetAttributes(_representationHandle, value._resourceAttributesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set attributes"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + } + + /// + /// List of Child resource representation. + /// + /// 3 + /// List of Child resource representation. + /// + /// Representation repr = new Representation(); + /// Representation child1 = new Representation(); + /// ResourceTypes types1 = new ResourceTypes(new List() { "org.tizen.light" }); + /// child1.Type = types1; + /// ResourceInterfaces ifaces1 = new ResourceInterfaces(new List() { ResourceInterfaces.DefaultInterface }); + /// child1.Interface = ifaces1; + /// try + /// { + /// repr.Children.Add(child1); + /// Console.WriteLine("Number of children : {0}", repr.Children.Count); + /// Representation firstChild = repr.Children.ElementAt(0); + /// } catch(Exception ex) + /// { + /// Console.WriteLine("Exception caught : " + ex.Message); + /// } + /// + public ICollection Children + { + get + { + return _children; + } + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + Type?.Dispose(); + Interface?.Dispose(); + Attributes?.Dispose(); + foreach(var child in Children) + { + child.Dispose(); + } + } + + Interop.IoTConnectivity.Common.Representation.Destroy(_representationHandle); + _disposed = true; + } + + private void ChildrenCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) + { + foreach (Representation r in e.NewItems) + { + int ret = Interop.IoTConnectivity.Common.Representation.AddChild(_representationHandle, r._representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add child"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) + { + foreach (Representation r in e.NewItems) + { + int ret = Interop.IoTConnectivity.Common.Representation.RemoveChild(_representationHandle, r._representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove child"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Request.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Request.cs new file mode 100755 index 0000000..bbaeae5 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Request.cs @@ -0,0 +1,103 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Class respresenting request to a resource. + /// It provides APIs to manage client's request. + /// + /// 3 + public class Request : IDisposable + { + private bool _disposed = false; + + internal Request() + { + } + + /// + /// Destructor of the Request class. + /// + ~Request() + { + Dispose(false); + } + + /// + /// The host address of the request. + /// + /// 3 + /// The host address of the request. + public string HostAddress { get; internal set; } + + /// + /// The representation of the request. + /// + /// 3 + /// The representation of the request. + public Representation Representation { get; internal set; } + + /// + /// The query of the request. + /// + /// 3 + /// The query of the request. + public ResourceQuery Query { get; internal set; } + + /// + /// The options related to the request. + /// + /// 3 + /// The options related to the request. + public ResourceOptions Options { get; internal set; } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + Representation?.Dispose(); + Query?.Dispose(); + Options?.Dispose(); + } + + _disposed = true; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs new file mode 100755 index 0000000..deb277c --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Resource.cs @@ -0,0 +1,510 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.InteropServices; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Abstract class respresenting a resource. + /// All resources need to inherit from this class. + /// + /// 3 + public abstract class Resource : IDisposable + { + private IntPtr _resourceHandle = IntPtr.Zero; + private bool _disposed = false; + private ObservableCollection _children = new ObservableCollection(); + private IntPtr _observerHandle = IntPtr.Zero; + + /// + /// The constructor. + /// + /// 3 + /// + /// @a uri format would be relative URI path like '/a/light' + /// and its length must be less than 128. + /// + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// The URI path of the resource. + /// Resource types. + /// Resource interfaces. + /// The policies of the resoruce. + /// http://tizen.org/feature/iot.ocf + ///
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// // Create a class which inherits from Resource + /// public class DoorResource : Resource + /// { + /// public DoorResource(string uri, ResourceTypes types, ResourceInterfaces interfaces, ResourcePolicy policy) + /// : base(uri, types, interfaces, policy) { + /// } + /// protected override Response OnDelete(Request request) { + /// // Do something + /// } + /// protected override Response OnGet(Request request) { + /// // Do something + /// } + /// // Override other abstract methods of Resource class + /// } + /// + /// // Use it like below + /// ResourceInterfaces ifaces = new ResourceInterfaces(new List(){ ResourceInterfaces.DefaultInterface }); + /// ResourceTypes types = new ResourceTypes(new List(){ "oic.iot.door.new" }); + /// Resource resource = new DoorResource("/door/uri1", types, ifaces, ResourcePolicy.Discoverable | ResourcePolicy.Observable); + /// + protected Resource(string uri, ResourceTypes types, ResourceInterfaces interfaces, ResourcePolicy policy) + { + UriPath = uri; + Types = types; + Interfaces = interfaces; + Policy = policy; + + _children.CollectionChanged += ChildrenCollectionChanged; + + int ret = Interop.IoTConnectivity.Server.Observers.Create(out _observerHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create obsever handle"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the Resource class. + /// + ~Resource() + { + Dispose(false); + } + + /// + /// Type details of the resource. + /// + /// 3 + /// Type details of the resource. + public ResourceTypes Types { get; internal set; } + + /// + /// Interface details of the resource. + /// + /// 3 + /// Interface details of the resource. + public ResourceInterfaces Interfaces { get; internal set; } + + /// + /// The policies of the resource. + /// + /// 3 + /// The policies of the resource. + public ResourcePolicy Policy { get; internal set; } + + /// + /// URI path of the resource. + /// + /// 3 + /// URI path of the resource. + public string UriPath { get; internal set; } + + /// + /// List of Child resources. + /// + /// 3 + /// List of Child resources. + public ICollection Children + { + get + { + return _children; + } + } + + internal IntPtr ResourceHandle + { + get + { + return _resourceHandle; + } + set + { + _resourceHandle = value; + } + } + + /// + /// Notify the specified representation and qos. + /// + /// 3 + /// + /// http://tizen.org/privilege/internet + /// + /// public + /// Representation. + /// The quality of service for message transfer. + /// http://tizen.org/feature/iot.ocf + ///
+        /// IoTConnectivityServerManager.Initialize() should be called to initialize.
+        /// 
+ /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when an application does not have privilege to access. + /// Thrown when the operation is invalid. + /// + /// ResourceInterfaces ifaces = new ResourceInterfaces(new List(){ ResourceInterfaces.DefaultInterface }); + /// ResourceTypes types = new ResourceTypes(new List(){ "oic.iot.door.new.notify" }); + /// Resource resource = new DoorResource("/door/uri/new/notify", types, ifaces, ResourcePolicy.Discoverable | ResourcePolicy.Observable); + /// IoTConnectivityServerManager.RegisterResource(resource); + /// + /// Representation repr = new Representation(); + /// repr.UriPath = "/door/uri/new/notify"; + /// repr.Type = new ResourceTypes(new List(){ "oic.iot.door.new.notify" }); + /// repr.Attributes = new Attributes() { + /// _attribute, 1 } + /// }; + /// resource.Notify(repr, QualityOfService.High); + /// + public void Notify(Representation representation, QualityOfService qos) + { + int ret = (int)IoTConnectivityError.None; + ret = Interop.IoTConnectivity.Server.Resource.Notify(_resourceHandle, representation._representationHandle, _observerHandle, (int)qos); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send notification"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// This is called when the client performs get operation on this resource. + /// + /// 3 + /// A request from client. + /// A response having the representation and the result. + protected abstract Response OnGet(Request request); + + /// + /// This is called when the client performs put operation on this resource. + /// + /// 3 + /// A request from client. + /// A response. + protected abstract Response OnPut(Request request); + + /// + /// This is called when the client performs post operation on this resource. + /// + /// 3 + /// A request from client. + /// A response having the representation and the result. + protected abstract Response OnPost(Request request); + + /// + /// This is called when the client performs delete operation on this resource. + /// + /// 3 + /// A request from client. + /// A response. + protected abstract Response OnDelete(Request request); + + /// + /// Called on the observing event. + /// + /// 3 + /// A request from client. + /// Observer type. + /// Observe identifier. + /// Returns true if it wants to be observed, else false. + protected abstract bool OnObserving(Request request, ObserveType type, int observeId); + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + Types?.Dispose(); + Interfaces?.Dispose(); + } + + if (_resourceHandle != IntPtr.Zero) + Interop.IoTConnectivity.Server.Resource.Destroy(_resourceHandle); + if (_observerHandle != IntPtr.Zero) + Interop.IoTConnectivity.Server.Observers.Destroy(_observerHandle); + _disposed = true; + } + + // This method is used as callback for Resource + internal void OnRequest(IntPtr resourceHandle, IntPtr requestHandle, IntPtr userData) + { + Request request = GetRequest(requestHandle); + Response response = null; + + if (request == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get Request"); + return; + } + + try + { + int observeType; + int ret = Interop.IoTConnectivity.Server.Request.GetObserveType(requestHandle, out observeType); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get observe type"); + return; + } + if ((ObserveType)observeType != ObserveType.NoType) + { + int observeId; + ret = Interop.IoTConnectivity.Server.Request.GetObserveId(requestHandle, out observeId); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get observe id"); + return; + } + switch ((ObserveType)observeType) + { + case ObserveType.Register: + { + if (OnObserving(request, ObserveType.Register, observeId)) + { + ret = Interop.IoTConnectivity.Server.Observers.Add(_observerHandle, observeId); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add observer id"); + return; + } + break; + } + else + { + // If OnObserving for ObserveType.Register returns false, do not operate for Get operation after Observe operation. + return; + } + } + case ObserveType.Deregister: + { + if (OnObserving(request, ObserveType.Deregister, observeId)) + { + ret = Interop.IoTConnectivity.Server.Observers.Remove(_observerHandle, observeId); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove observer id"); + return; + } + break; + } + else + { + // If OnObserving for ObserveType.Deregister returns false, do not operate for Get operation after Observe operation. + return; + } + } + } + } + int requestType; + ret = Interop.IoTConnectivity.Server.Request.GetRequestType(requestHandle, out requestType); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get request type"); + return; + } + switch ((Interop.IoTConnectivity.Server.RequestType)requestType) + { + case Interop.IoTConnectivity.Server.RequestType.Put: + { + response = OnPut(request); + break; + } + case Interop.IoTConnectivity.Server.RequestType.Get: + { + response = OnGet(request); + break; + } + case Interop.IoTConnectivity.Server.RequestType.Post: + { + response = OnPost(request); + break; + } + case Interop.IoTConnectivity.Server.RequestType.Delete: + { + response = OnDelete(request); + break; + } + default: + break; + } + if (response == null) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send Response"); + return; + } + + if (!response.Send(requestHandle)) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send Response"); + return; + } + } + finally + { + request?.Dispose(); + response?.Dispose(); + } + } + + private Request GetRequest(IntPtr requestHandle) + { + IntPtr hostAddressPtr; + int ret = Interop.IoTConnectivity.Server.Request.GetHostAddress(requestHandle, out hostAddressPtr); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get host address"); + return null; + } + + IntPtr optionsHandle = IntPtr.Zero; + ret = Interop.IoTConnectivity.Server.Request.GetOptions(requestHandle, out optionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get options"); + return null; + } + + IntPtr queryHandle = IntPtr.Zero; + ret = Interop.IoTConnectivity.Server.Request.GetQuery(requestHandle, out queryHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get Query"); + return null; + } + + IntPtr representationHandle = IntPtr.Zero; + ret = Interop.IoTConnectivity.Server.Request.GetRepresentation(requestHandle, out representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to Get representation"); + return null; + } + + ResourceOptions opts = null; + ResourceQuery query = null; + Representation representation = null; + try + { + opts = (optionsHandle == IntPtr.Zero) ? null : new ResourceOptions(optionsHandle); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to new ResourceOptions: " + exp.Message); + return null; + } + + try + { + query = (queryHandle == IntPtr.Zero) ? null : new ResourceQuery(queryHandle); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to new ResourceQuery: " + exp.Message); + opts?.Dispose(); + return null; + } + + try + { + representation = (representationHandle == IntPtr.Zero) ? null : new Representation(representationHandle); + } + catch (Exception exp) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to new Representation: " + exp.Message); + opts?.Dispose(); + query?.Dispose(); + return null; + } + + return new Request() + { + HostAddress = (hostAddressPtr != IntPtr.Zero) ? Marshal.PtrToStringAnsi(hostAddressPtr) : string.Empty, + Options = opts, + Query = query, + Representation = representation + }; + } + + private void ChildrenCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs eventArgs) + { + if (eventArgs.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add) + { + foreach (Resource r in eventArgs.NewItems) + { + int ret = Interop.IoTConnectivity.Server.Resource.BindChildResource(_resourceHandle, r._resourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to bind resource "); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + else if (eventArgs.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove) + { + foreach (Resource r in eventArgs.NewItems) + { + int ret = Interop.IoTConnectivity.Server.Resource.UnbindChildResource(_resourceHandle, r._resourceHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to unbind resource"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceFoundEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceFoundEventArgs.cs new file mode 100755 index 0000000..6673d7f --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceFoundEventArgs.cs @@ -0,0 +1,54 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the ResourceFound event. + /// + /// 3 + public class ResourceFoundEventArgs : EventArgs + { + internal ResourceFoundEventArgs() { } + + /// + /// Indicates the request ID. + /// This is the same request ID returned by the API. + /// + /// 3 + /// The request ID. + public int RequestId { get; internal set; } + + /// + /// Indicates to continuously receive the event for finding resource. + /// + /// 3 + /// Continuously receive the event for finding resource. + public bool EventContinue { get; set; } + + /// + /// Remote resource, which is found after . + /// + /// 3 + /// Remote resource which is found after . + /// + /// + public RemoteResource Resource { get; internal set; } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs new file mode 100755 index 0000000..fbdf220 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceInterfaces.cs @@ -0,0 +1,312 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class contains resource interfaces and provides APIs to manage, add, or remove those interfaces. + /// A resource interface indicates a class or category of resources. + /// + /// 3 + public class ResourceInterfaces : IEnumerable, IDisposable + { + /// + /// Default Interface. + /// + /// 3 + public const string DefaultInterface = "oic.if.baseline"; + + /// + /// List Links Interface, which is used to list the references to other resources contained in a resource. + /// + /// 3 + public const string LinkInterface = "oic.if.ll"; + + /// + /// Batch Interface, which is used to manipulate (GET, PUT, POST, DELETE) on other resource contained in a resource. + /// + /// 3 + public const string BatchInterface = "oic.if.b"; + + /// + /// Group Interface, which is used to manipulate (GET, PUT, POST) a group of remote resources. + /// + /// 3 + public const string GroupInterface = "oic.mi.grp"; + + /// + /// Read-Only Interface, which is used to limit the methods that can be applied to a resource to GET only. + /// + /// 3 + public const string ReadonlyInterface = "oic.if.r"; + + private readonly IntPtr _resourceInterfacesHandle = IntPtr.Zero; + private const int MaxLength = 61; + private readonly HashSet _resourceInterfaces = new HashSet(); + private bool _disposed = false; + + /// + /// Constructor of ResourceInterfaces. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(); + /// + public ResourceInterfaces() + { + int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Create(out _resourceInterfacesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Constructor of ResourceInterfaces using list of interfaces. + /// + /// 3 + /// List of resource interfaces. + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// Thrown when there is an invalid parameter. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List() + /// { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface }); + /// + public ResourceInterfaces(IEnumerable ifaces) + { + int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Create(out _resourceInterfacesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + foreach (string iface in ifaces) + { + Add(iface); + } + } + + internal ResourceInterfaces(IntPtr ifacesHandleToClone) + { + int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Clone(ifacesHandleToClone, out _resourceInterfacesHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + Interop.IoTConnectivity.Common.ResourceInterfaces.ForeachCallback cb = (string iface, IntPtr data) => + { + _resourceInterfaces.Add(iface); + return true; + }; + + ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Foreach(ifacesHandleToClone, cb, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the ResourceInterfaces class. + /// + ~ResourceInterfaces() + { + Dispose(false); + } + + internal IntPtr ResourceInterfacesHandle + { + get + { + return _resourceInterfacesHandle; + } + } + + /// + /// Indicates count of interfaces in the list + /// + /// 3 + /// Count of interfaces in the list. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List() + /// { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface }); + /// Console.WriteLine("There are {0} interfaces", resourceInterfaces.Count); + /// + public int Count + { + get + { + return _resourceInterfaces.Count; + } + } + + /// + /// Adds a resource interface into the list. + /// + /// 3 + /// + /// @a item could be a value, such as . + /// + /// The string data to insert into the resource interfaces. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// Thrown when there is an invalid parameter. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(); + /// resourceInterfaces.Add(ResourceInterfaces.BatchInterface); + /// + public void Add(string item) + { + if (IsValid(item)) + { + int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Add(_resourceInterfacesHandle, item); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _resourceInterfaces.Add(item); + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Invalid interface"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + } + + /// + /// Removes a resource interface from the list. + /// + /// 3 + /// The string data to delete from the resource ifaces. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List(){ ResourceInterfaces.BatchInterface }); + /// resourceInterfaces.Add(ResourceInterfaces.BatchInterface); + /// + public void Remove(string item) + { + bool isRemoved = _resourceInterfaces.Remove(item); + if (isRemoved) + { + int ret = Interop.IoTConnectivity.Common.ResourceInterfaces.Remove(_resourceInterfacesHandle, item); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + else + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + + /// + /// Returns enumerator for the list of interfaces. + /// + /// 3 + /// The enumerator. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List() + /// { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface }); + /// foreach(string item in resourceInterfaces) + /// { + /// Console.WriteLine("Interface : {0}", item); + /// } + /// + public IEnumerator GetEnumerator() + { + return _resourceInterfaces.GetEnumerator(); + } + + /// + /// Returns enumerator for the list of interfaces. + /// + /// 3 + /// The enumerator. + /// + /// ResourceInterfaces resourceInterfaces = new ResourceInterfaces(new List() + /// { ResourceInterfaces.LinkInterface, ResourceInterfaces.ReadonlyInterface }); + /// foreach(string item in resourceInterfaces) + /// { + /// Console.WriteLine("Interface : {0}", item); + /// } + /// + IEnumerator IEnumerable.GetEnumerator() + { + return _resourceInterfaces.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal static bool IsValid(string type) + { + Regex r = new Regex("^[a-zA-Z0-9.-]+$"); + return (type.Length <= MaxLength && type.Length > 0 && char.IsLower(type[0]) && r.IsMatch(type)); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Common.ResourceInterfaces.Destroy(_resourceInterfacesHandle); + _disposed = true; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs new file mode 100755 index 0000000..d54001e --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceOptions.cs @@ -0,0 +1,474 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents resource options. It provides APIs to manage them.\n + /// The iotcon options API provides methods for managing vendor specific options of coap packet.\n + /// See more about coap packet in http://tools.ietf.org/html/rfc7252. + /// + /// 3 + public class ResourceOptions : IDictionary, IDisposable + { + internal const int MaxSize = 2; + internal const int IdMin = 2048; + internal const int IdMax = 3000; + internal const int DataMax = 15; + + internal IntPtr _resourceOptionsHandle = IntPtr.Zero; + private readonly IDictionary _options = new Dictionary(); + private bool _disposed = false; + + /// + /// The resource options constructor. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// ResourceOptions options = new ResourceOptions(); + /// + public ResourceOptions() + { + int ret = Interop.IoTConnectivity.Common.Options.Create(out _resourceOptionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create options"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + // internal constructor + internal ResourceOptions(IntPtr handleToClone) + { + int ret = Interop.IoTConnectivity.Common.Options.Create(out _resourceOptionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create options"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + Interop.IoTConnectivity.Common.Options.OptionsCallback forEachCallback = (ushort id, string value, IntPtr userData) => + { + Add(id, value); + return true; + }; + + ret = Interop.IoTConnectivity.Common.Options.ForEach(handleToClone, forEachCallback, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to iterate options"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the ResourceOptions class. + /// + ~ResourceOptions() + { + Dispose(false); + } + + /// + /// Contains all the Option keys. + /// + /// 3 + /// All the Option keys. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "sample-data"); + /// options.Add(2055, "sample value"); + /// var keys = options.Keys; + /// Console.WriteLine("Resource options contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1)); + /// + public ICollection Keys + { + get + { + return _options.Keys; + } + } + + /// + /// Contains all the Option values. + /// + /// 3 + /// All the Option values. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "sample-data"); + /// options.Add(2055, "sample value"); + /// var values = options.Values; + /// Console.WriteLine("Resource options contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1)); + /// + public ICollection Values + { + get + { + return _options.Values; + } + } + + /// + /// Gets the number of options. + /// + /// 3 + /// The number of options. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "sample-data"); + /// options.Add(2055, "sample value"); + /// var count = options.Count; + /// Console.WriteLine("There are {0} keys in the options object", count); + /// + public int Count + { + get + { + return _options.Count; + } + } + + /// + /// Represents whether the collection is readonly. + /// + /// 3 + /// Whether the collection is readonly. + /// + /// ResourceOptions options = new ResourceOptions(); + /// if (options.IsReadOnly) + /// Console.WriteLine("Read only options"); + /// + public bool IsReadOnly + { + get + { + return _options.IsReadOnly; + } + } + + /// + /// Gets or sets the option data. + /// + /// 3 + /// The option data. + /// The option ID to get or set. + /// The option with the specified ID. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options[2055] = "sample-data"; + /// Console.WriteLine("Option has : {0}", options[2055]); + /// + public string this[ushort key] + { + get + { + return _options[key]; + } + set + { + Add(key, value); + } + } + + /// + /// Checks whether the given key exists in Options collection. + /// + /// 3 + /// The key to look for. + /// true if exists. Otherwise, false. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "sample-data"); + /// if (options.ContainsKey(2050)) + /// Console.WriteLine("options conatins key : 2050"); + /// + public bool ContainsKey(ushort key) + { + return _options.ContainsKey(key); + } + + /// + /// Adds a new ID and a correspoding data into the options. + /// + /// 3 + /// + /// ResourceOptions can have up to 2 options. \n + /// key is always situated between 2048 and 3000. \n + /// Length of option data is less than or equal to 15. + /// + /// The ID of the option to insert. + /// The string data to insert into the options. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "sample-data"); + /// + public void Add(ushort key, string value) + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (IsValid(key, value)) + { + ret = Interop.IoTConnectivity.Common.Options.Add(_resourceOptionsHandle, key, value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add option"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _options.Add(key, value); + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Invalid options"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + } + + /// + /// Removes the ID and its associated data from the options. + /// + /// 3 + /// The ID of the option to delete. + /// True if operation is successful. Otherwise, false. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "12345"); + /// var result = options.Remove(2050); + /// + public bool Remove(ushort key) + { + int ret = Interop.IoTConnectivity.Common.Options.Remove(_resourceOptionsHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove option"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + bool isRemoved = _options.Remove(key); + + return isRemoved; + } + + /// + /// Gets the value associated with the specified key. + /// + /// 3 + /// The option ID. + /// Value corresponding to option ID. + /// True if the key exists, false otherwise. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "12345"); + /// string value; + /// var isPresent = options.TryGetValue(2050, out value); + /// if (isPresent) + /// Console.WriteLine("value : {0}", value); + /// + public bool TryGetValue(ushort key, out string value) + { + return _options.TryGetValue(key, out value); + } + + /// + /// Adds options key and value as a key value pair. + /// + /// 3 + /// The key value pair. + /// http://tizen.org/feature/iot.ocf + /// + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "12345")); + /// + public void Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + /// + /// Clears the Options collection. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(2050, "12345"); + /// options.Add(2055, "sample"); + /// options.Clear(); + /// + public void Clear() + { + foreach (ushort key in Keys) + { + int ret = Interop.IoTConnectivity.Common.Options.Remove(_resourceOptionsHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove option"); + throw IoTConnectivityErrorFactory.GetException(ret); + }; + } + _options.Clear(); + } + + /// + /// Checks if the given option pair exists. + /// + /// 3 + /// The key value pair. + /// True if exists. Otherwise, false. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "12345")); + /// var isPresent = options.Contains(new KeyValuePair(2050, "12345")); + /// if (isPresent) + /// Console.WriteLine("Key value pair is present"); + /// + public bool Contains(KeyValuePair item) + { + return _options.Contains(item); + } + + /// + /// Copies the elements of the options collection to an array, starting at a particular index. + /// + /// 3 + /// The destination array. + /// Index parameter. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "12345")); + /// KeyValuePair[] dest = new KeyValuePair[options.Count]; + /// options.CopyTo(dest, 0); + /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value); + /// + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + _options.CopyTo(array, arrayIndex); + } + + /// + /// Removes the given key value pair from the options. + /// + /// 3 + /// The key value pair to remove + /// True if operation is successful. Otherwise, false + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when there is an invalid parameter + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "12345")); + /// var result = options.Remove(new KeyValuePair(2050, "12345")); + /// + public bool Remove(KeyValuePair item) + { + return Remove(item.Key); + } + + /// + /// Get the enumerator to options collection. + /// + /// 3 + /// Enumerator to option pairs. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "sample1")); + /// options.Add(new KeyValuePair(2055, "sample2")); + /// foreach (KeyValuePair pair in options) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + public IEnumerator> GetEnumerator() + { + return _options.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Gets the enumerator to options collection. + /// + /// 3 + /// Enumerator to option pairs. + /// + /// ResourceOptions options = new ResourceOptions(); + /// options.Add(new KeyValuePair(2050, "sample1")); + /// options.Add(new KeyValuePair(2055, "sample2")); + /// foreach (KeyValuePair pair in options) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + IEnumerator IEnumerable.GetEnumerator() + { + return _options.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Common.Options.Destroy(_resourceOptionsHandle); + _disposed = true; + } + + private bool IsValid(ushort key, string value) + { + return (key > IdMin && key < IdMax && value.Length <= DataMax && _options.Count() < MaxSize); + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourcePolicy.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourcePolicy.cs new file mode 100755 index 0000000..0edfb3b --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourcePolicy.cs @@ -0,0 +1,64 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for the policy, which can be held in a resource. + /// + /// 3 + public enum ResourcePolicy + { + /// + /// Indicates resource uninitialized. + /// + /// 3 + NoProperty = 0, + /// + /// Indicates resource that is allowed to be discovered. + /// + /// 3 + Discoverable = (1 << 0), + /// + /// Indicates resource that is allowed to be observed. + /// + /// 3 + Observable = (1 << 1), + /// + /// Indicates resource initialized and activated. + /// + /// 3 + Active = (1 << 2), + /// + /// Indicates resource, which takes some delay to respond. + /// + /// 3 + Slow = (1 << 3), + /// + /// Indicates secure resource. + /// + /// 3 + Secure = (1 << 4), + /// + /// When this bit is set, the resource is allowed to be discovered only if discovery request contains an explicit querystring. + /// + /// 3 + ExplicitDiscoverable = (1 << 5), + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs new file mode 100755 index 0000000..4583dc5 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceQuery.cs @@ -0,0 +1,563 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class provides APIs to manage the query of request. + /// + /// 3 + public class ResourceQuery : IDictionary, IDisposable + { + internal const int QueryMaxLenth = 64; + internal IntPtr _resourceQueryHandle = IntPtr.Zero; + private readonly IDictionary _query = new Dictionary(); + private bool _disposed = false; + + /// + /// The resource query constructor. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// ResourceQuery query = new ResourceQuery(); + /// + public ResourceQuery() + { + int ret = Interop.IoTConnectivity.Common.Query.Create(out _resourceQueryHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + internal ResourceQuery(IntPtr resourceQueryHandleToClone) + { + int ret = Interop.IoTConnectivity.Common.Query.Create(out _resourceQueryHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + Interop.IoTConnectivity.Common.Query.QueryCallback forEachCallback = (string key, string value, IntPtr userData) => + { + Add(key, value); + return true; + }; + + ret = Interop.IoTConnectivity.Common.Query.Foreach(resourceQueryHandleToClone, forEachCallback, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to iterate query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the ResourceQuery class. + /// + ~ResourceQuery() + { + Dispose(false); + } + + /// + /// Gets and sets the resource type of the query. + /// + /// 3 + /// The resource type of the query. + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Type = "org.tizen.light"; + /// Console.WriteLine("Type of query : {0}", query.Type); + /// + public string Type + { + get + { + IntPtr type; + int ret = Interop.IoTConnectivity.Common.Query.GetResourceType(_resourceQueryHandle, out type); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get type"); + return ""; + } + return (type != IntPtr.Zero) ? Marshal.PtrToStringAnsi(type) : string.Empty; + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (ResourceTypes.IsValid(value)) + ret = Interop.IoTConnectivity.Common.Query.SetResourceType(_resourceQueryHandle, value); + + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// Gets and sets the resource interface of the query. + /// + /// 3 + /// + /// The resource interface of the query. + /// Setter value could be a value, such as . + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Interface = ResourceInterfaces.LinkInterface; + /// + public string Interface + { + get + { + IntPtr iface; + int ret = Interop.IoTConnectivity.Common.Query.GetInterface(_resourceQueryHandle, out iface); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to get interface"); + return ""; + } + return (iface != IntPtr.Zero) ? Marshal.PtrToStringAnsi(iface) : string.Empty; + } + set + { + int ret = (int)IoTConnectivityError.InvalidParameter; + if (ResourceInterfaces.IsValid(value)) + ret = Interop.IoTConnectivity.Common.Query.SetInterface(_resourceQueryHandle, value); + + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to set interface"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + } + + /// + /// Contains all the query keys. + /// + /// 3 + /// All the query keys. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key", "value"); + /// query.Add("newKey", "sample value"); + /// var keys = query.Keys; + /// Console.WriteLine("Resource query contains keys {0} and {1}", keys.ElementAt(0), keys.ElementAt(1)); + /// + public ICollection Keys + { + get + { + return _query.Keys; + } + } + + /// + /// Contains all the query values. + /// + /// 3 + /// All the query values. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key", "value"); + /// query.Add("newKey", "sample value"); + /// var values = query.Values; + /// Console.WriteLine("Resource query contains values {0} and {1}", values.ElementAt(0), values.ElementAt(1)); + /// + public ICollection Values + { + get + { + return _query.Values; + } + } + + /// + /// Gets the number of query elements. + /// + /// 3 + /// The number of query elements. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key", "value"); + /// query.Add("newKey", "sample value"); + /// var count = query.Count; + /// Console.WriteLine("There are {0} keys in the query object", count); + /// + public int Count + { + get + { + return _query.Count; + } + } + + /// + /// Represents whether the collection is readonly. + /// + /// 3 + /// Whether the collection is readonly. + /// + /// ResourceQuery query = new ResourceQuery(); + /// if (query.IsReadOnly) + /// Console.WriteLine("Read only query"); + /// + public bool IsReadOnly + { + get + { + return _query.IsReadOnly; + } + } + + /// + /// Gets or sets the query data. + /// + /// 3 + /// The query data. + /// The query key to get or set. + /// The query with the specified key. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query["key1"] = "sample-data"; + /// Console.WriteLine("query has : {0}", query["key1"]); + /// + public string this[string key] + { + get + { + return _query[key]; + } + + set + { + Add(key, value); + } + } + + /// + /// Checks whether the given key exists in the query collection. + /// + /// 3 + /// The key to look for. + /// true if exists. Otherwise, false. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key1", "value1"); + /// if (query.ContainsKey("key1")) + /// Console.WriteLine("query conatins key : key1"); + /// + public bool ContainsKey(string key) + { + return _query.ContainsKey(key); + } + + /// + /// Adds a new key and correspoding value into the query. + /// + /// 3 + /// + /// The full length of query should be less than or equal to 64. + /// + /// The key of the query to insert. + /// The string data to insert into the query. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key1", "value1"); + /// + public void Add(string key, string value) + { + if (CanAddQuery(key, value)) + { + int ret = Interop.IoTConnectivity.Common.Query.Add(_resourceQueryHandle, key, value); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _query.Add(key, value); + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Query cannot be added"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + } + + /// + /// Removes the key and its associated value from the query. + /// + /// 3 + /// The ID of the query to delete. + /// True if operation is successful. Otherwise, false. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key1", "value1"); + /// var result = query.Remove("key1"); + /// + public bool Remove(string key) + { + int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + bool isRemoved = _query.Remove(key); + + return isRemoved; + } + + /// + /// Gets the value associated with the specified key. + /// + /// 3 + /// The query key. + /// Value corresponding to query key. + /// True if the key exists, false otherwise. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key1", "value1"); + /// string value; + /// var isPresent = query.TryGetValue("key1", out value); + /// if (isPresent) + /// Console.WriteLine("value : {0}", value); + /// + public bool TryGetValue(string key, out string value) + { + return _query.TryGetValue(key, out value); + } + + /// + /// Adds a query key and a value as a key value pair. + /// + /// 3 + /// The key value pair. + /// http://tizen.org/feature/iot.ocf + /// + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// + public void Add(KeyValuePair item) + { + Add(item.Key, item.Value); + } + + /// + /// Clears the query collection. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// Thrown when the iotcon is not supported. + /// Thrown when the operation is invalid. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add("key1", "value1"); + /// query.Add("key2", "value2"); + /// query.Clear(); + /// + public void Clear() + { + foreach (string key in _query.Keys) + { + int ret = Interop.IoTConnectivity.Common.Query.Remove(_resourceQueryHandle, key); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to clear query"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + _query.Clear(); + } + + /// + /// Checks if the given query pair exists. + /// + /// 3 + /// The key value pair. + /// True if exists. Otherwise, false. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// var isPresent = query.Contains(new KeyValuePair("key1", "value1")); + /// if (isPresent) + /// Console.WriteLine("Key value pair is present"); + /// + public bool Contains(KeyValuePair item) + { + return _query.Contains(item); + } + + /// + /// Copies the elements of the query collection to an array, starting at a particular index. + /// + /// 3 + /// The destination array. + /// Index parameter. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// KeyValuePair[] dest = new KeyValuePair[query.Count]; + /// query.CopyTo(dest, 0); + /// Console.WriteLine("Dest conatins ({0}, {1})", dest[0].Key, dest[0].Value); + /// + public void CopyTo(KeyValuePair[] array, int arrayIndex) + { + _query.CopyTo(array, arrayIndex); + } + + /// + /// Removes the given key value pair from the query. + /// + /// 3 + /// The key value pair to remove. + /// True if operation is successful. Otherwise, false. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when there is an invalid parameter. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// var result = query.Remove(new KeyValuePair("key1", "value1")); + /// + public bool Remove(KeyValuePair item) + { + return Remove(item.Key); + } + + /// + /// Gets the enumerator to the query collection. + /// + /// 3 + /// Enumerator to query pairs. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// query.Add(new KeyValuePair("key2", "value2")); + /// foreach (KeyValuePair pair in query) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + public IEnumerator> GetEnumerator() + { + return _query.GetEnumerator(); + } + + /// + /// Gets the enumerator to the query collection. + /// + /// 3 + /// The enumerator to the query pairs. + /// + /// ResourceQuery query = new ResourceQuery(); + /// query.Add(new KeyValuePair("key1", "value1")); + /// query.Add(new KeyValuePair("key2", "value2")); + /// foreach (KeyValuePair pair in query) + /// { + /// Console.WriteLine("key : {0}, value : {1}", pair.Key, pair.Value); + /// } + /// + IEnumerator IEnumerable.GetEnumerator() + { + return _query.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Common.Query.Destroy(_resourceQueryHandle); + _disposed = true; + } + + private bool CanAddQuery(string newKey, string newValue) + { + int queryLenth = 0; + foreach (string key in Keys) + { + queryLenth += key.Length + 2; + } + foreach (string value in Values) + { + queryLenth += value.Length; + } + + if ((newKey.Length + newValue.Length + queryLenth + 2) < QueryMaxLenth) + return true; + + return false; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceState.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceState.cs new file mode 100755 index 0000000..e093b0a --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceState.cs @@ -0,0 +1,37 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for states of the remote resource. + /// + /// 3 + public enum ResourceState + { + /// + /// Indicates remote resource is alive. + /// + /// 3 + Alive = 0, + /// + /// Indicates remote resource is lost. + /// + /// 3 + LostSignal + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs new file mode 100755 index 0000000..b2c82a7 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResourceTypes.cs @@ -0,0 +1,268 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text.RegularExpressions; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class contains resource types and provides APIs to manage, add, or remove those types. + /// A resource type indicates a class or a category of resources. + /// + /// 3 + public class ResourceTypes : IEnumerable, IDisposable + { + internal const int MaxLength = 61; + internal IntPtr _resourceTypeHandle = IntPtr.Zero; + private readonly HashSet _resourceTypes = new HashSet(); + private bool _disposed = false; + + /// + /// Constructor of ResourceTypes. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + /// + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is not enough memory. + /// + /// ResourceTypes types = new ResourceTypes(); + /// + public ResourceTypes() + { + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Create(out _resourceTypeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Constructor of ResourceTypes using list of types. + /// + /// 3 + /// List of resource types. + /// http://tizen.org/feature/iot.ocf + /// Thrown when there is an invalid parameter. + /// + /// ResourceTypes types = new ResourceTypes(new List() { "org.tizen.light", "oic.if.room" }); + /// + public ResourceTypes(IEnumerable types) + { + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Create(out _resourceTypeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + foreach (string type in types) + { + Add(type); + } + } + + internal ResourceTypes(IntPtr typesHandleToClone) + { + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Clone(typesHandleToClone, out _resourceTypeHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + Interop.IoTConnectivity.Common.ResourceTypes.ForeachCallback cb = (string type, IntPtr data) => + { + _resourceTypes.Add(type); + return true; + }; + + ret = Interop.IoTConnectivity.Common.ResourceTypes.Foreach(typesHandleToClone, cb, IntPtr.Zero); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to create type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + } + + /// + /// Destructor of the ResourceTypes class. + /// + ~ResourceTypes() + { + Dispose(false); + } + + /// + /// Indicates count of types in the list. + /// + /// 3 + /// Count of types in the list. + /// + /// ResourceTypes types = new ResourceTypes(new List() { "org.tizen.light", "oic.if.room" }); + /// Console.WriteLine("There are {0} items", types.Count); + /// + public int Count + { + get + { + return _resourceTypes.Count; + } + } + + /// + /// Adds a resource type into the list. + /// + /// 3 + /// + /// The length of @a item should be less than or equal to 61.\n + /// The @a item must start with a lowercase alphabetic character, followed by a sequence + /// of lowercase alphabetic, numeric, ".", or "-" characters, and contains no white space.\n + /// Duplicate strings are not allowed. + /// + /// The string data to insert into the resource types. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceTypes resourceTypes = new ResourceTypes(); + /// resourceTypes.Add("org.tizen.light"); + /// + public void Add(string item) + { + if (IsValid(item)) + { + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Add(_resourceTypeHandle, item); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to add type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + _resourceTypes.Add(item); + } + else + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Invalid type"); + throw IoTConnectivityErrorFactory.GetException((int)IoTConnectivityError.InvalidParameter); + } + } + + /// + /// Removes a resource type from the list. + /// + /// 3 + /// The string data to delete from the resource types. + /// http://tizen.org/feature/iot.ocf + /// + /// Thrown when the iotcon is not supported. + /// Thrown when there is an invalid parameter. + /// Thrown when the operation is invalid. + /// + /// ResourceTypes resourceTypes = new ResourceTypes(new List() { "org.tizen.light", "oic.if.room" }); + /// resourceTypes.Remove("oic.if.room"); + /// + public void Remove(string item) + { + int ret = Interop.IoTConnectivity.Common.ResourceTypes.Remove(_resourceTypeHandle, item); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to remove type"); + throw IoTConnectivityErrorFactory.GetException(ret); + } + + _resourceTypes.Remove(item); + } + + /// + /// Returns an enumerator for the list of types. + /// + /// 3 + /// The enumerator. + /// + /// ResourceTypes resourceTypes = new ResourceTypes(new List() { "org.tizen.light", "oic.if.room" }); + /// foreach(string item in resourceTypes) + /// { + /// Console.WriteLine("Type : {0}", item); + /// } + /// + public IEnumerator GetEnumerator() + { + return _resourceTypes.GetEnumerator(); + } + + /// + /// Returns an enumerator for the list of types. + /// + /// 3 + /// The enumerator. + /// + /// ResourceTypes resourceTypes = new ResourceTypes(new List() { "org.tizen.light", "oic.if.room" }); + /// foreach(string item in resourceTypes) + /// { + /// Console.WriteLine("Type : {0}", item); + /// } + /// + IEnumerator IEnumerable.GetEnumerator() + { + return _resourceTypes.GetEnumerator(); + } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + /// http://tizen.org/feature/iot.ocf + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal static bool IsValid(string type) + { + Regex r = new Regex("^[a-zA-Z0-9.-]+$"); + return (type.Length <= MaxLength && type.Length > 0 && char.IsLower(type[0]) && r.IsMatch(type)); + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + /// http://tizen.org/feature/iot.ocf + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + // Free managed objects + } + + Interop.IoTConnectivity.Common.ResourceTypes.Destroy(_resourceTypeHandle); + _disposed = true; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Response.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Response.cs new file mode 100755 index 0000000..ce8306e --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/Response.cs @@ -0,0 +1,148 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents response from a resource. + /// It provides APIs to manage response. + /// + /// 3 + public class Response : IDisposable + { + private bool _disposed = false; + + /// + /// Constructor of Response. + /// + /// 3 + /// + /// Response response = new Response(); + /// + public Response() { } + + /// + /// Destructor of the Response class. + /// + ~Response() + { + Dispose(false); + } + + /// + /// Gets or sets the result from/into the response. + /// + /// 3 + /// The result from/into the response. + public ResponseCode Result { get; set; } + + /// + /// Gets or sets the representation from/into the response. + /// + /// 3 + /// The representation from/into the response. + public Representation Representation { get; set; } + + /// + /// Gets or sets the options from/into the response. + /// + /// 3 + /// The options from/into the response. + public ResourceOptions Options { get; set; } + + /// + /// Releases any unmanaged resources used by this object. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + internal bool Send(IntPtr requestHandle) + { + IntPtr responseHandle = IntPtr.Zero; + int ret = Interop.IoTConnectivity.Server.Response.Create(requestHandle, out responseHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response"); + return false; + } + + ret = Interop.IoTConnectivity.Server.Response.SetResult(responseHandle, (int)Result); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response"); + Interop.IoTConnectivity.Server.Response.Destroy(responseHandle); + return false; + } + + if (Representation != null) + { + ret = Interop.IoTConnectivity.Server.Response.SetRepresentation(responseHandle, Representation._representationHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response"); + Interop.IoTConnectivity.Server.Response.Destroy(responseHandle); + return false; + } + } + + if (Options != null) + { + ret = Interop.IoTConnectivity.Server.Response.SetOptions(responseHandle, Options._resourceOptionsHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response"); + Interop.IoTConnectivity.Server.Response.Destroy(responseHandle); + return false; + } + } + + ret = Interop.IoTConnectivity.Server.Response.Send(responseHandle); + if (ret != (int)IoTConnectivityError.None) + { + Log.Error(IoTConnectivityErrorFactory.LogTag, "Failed to send response"); + Interop.IoTConnectivity.Server.Response.Destroy(responseHandle); + return false; + } + + Interop.IoTConnectivity.Server.Response.Destroy(responseHandle); + return true; + } + + /// + /// Releases any unmanaged resources used by this object. Can also dispose any other disposable objects. + /// + /// 3 + /// If true, disposes any disposable objects. If false, does not dispose disposable objects. + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + } + + _disposed = true; + } + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResponseCode.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResponseCode.cs new file mode 100755 index 0000000..0792b00 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/ResponseCode.cs @@ -0,0 +1,62 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// Enumeration for the result of response. + /// + /// 3 + public enum ResponseCode + { + /// + /// Indicates the result of response for success. + /// + /// 3 + Ok = 0, + /// + /// Indicates the result of response for some error. + /// + /// 3 + Error, + /// + /// Indicates the result of response for created resource. + /// + /// 3 + Created, + /// + /// Indicates the result of response for deleted resource. + /// + /// 3 + Deleted, + /// + /// Indicates the result of response for changed resource. + /// + /// 3 + Changed, + /// + /// Indicates the result of response for slow resource. + /// + /// 3 + Slow, + /// + /// Indicates the result of response for accessing unauthorized resource. + /// + /// 3 + Forbidden + } +} diff --git a/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/StateChangedEventArgs.cs b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/StateChangedEventArgs.cs new file mode 100755 index 0000000..0078a93 --- /dev/null +++ b/src/Tizen.Network.IoTConnectivity/Tizen.Network.IoTConnectivity/StateChangedEventArgs.cs @@ -0,0 +1,37 @@ + /* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +using System; + +namespace Tizen.Network.IoTConnectivity +{ + /// + /// This class represents event arguments of the StateChanged event. + /// + /// 3 + public class StateChangedEventArgs : EventArgs + { + internal StateChangedEventArgs() { } + + /// + /// Indicates the new state of the resource. + /// + /// 3 + /// The new state of the resource. + public ResourceState State { get; internal set; } + } +} diff --git a/src/Tizen.Network.Mtp/Interop/Interop.Glib.cs b/src/Tizen.Network.Mtp/Interop/Interop.Glib.cs new file mode 100644 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Network.Mtp/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Network.Mtp/Interop/Interop.Libc.cs b/src/Tizen.Network.Mtp/Interop/Interop.Libc.cs new file mode 100644 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Network.Mtp/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Network.Mtp/Interop/Interop.Libraries.cs b/src/Tizen.Network.Mtp/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..ae75b1a --- /dev/null +++ b/src/Tizen.Network.Mtp/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Mtp = "libcapi-network-mtp.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Mtp/Interop/Interop.Mtp.cs b/src/Tizen.Network.Mtp/Interop/Interop.Mtp.cs new file mode 100644 index 0000000..bd50253 --- /dev/null +++ b/src/Tizen.Network.Mtp/Interop/Interop.Mtp.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Mtp + { + //Callback for event + //mtp_event_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void MptStateChangedCallback(int eventType, int eventParameter, IntPtr userData); + + //capi-network-mtp-1.3.16-2.3.armv7l.rpm + ////Mtp Manager + [DllImport(Libraries.Mtp, EntryPoint = "mtp_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_deinitialize")] + internal static extern int Deinitialize(); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_get_devices")] + internal static extern int GetDevices(out IntPtr devices, out int count); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_get_storages")] + internal static extern int GetStorages(int device, out IntPtr storages, out int count); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_get_object_handles")] + internal static extern int GetObjectHandles(int device, int storage, int fileType, int parentHandle, out IntPtr objectHandle, out int count); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_get_object")] + internal static extern bool GetObject(int device, int objectHandle, string fileDestinationPath); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_get_thumbnail")] + internal static extern int getThumbnail(int device, int objectHandle, string fileDestinationPath); + + [DllImport(Libraries.Mtp, EntryPoint = "mtp_add_mtp_event_cb")] + internal static extern int AddMtpStateChangedCallback(MptStateChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_remove_mtp_event_cb")] + internal static extern int RemoveMtpStateChangedCallback(MptStateChangedCallback callback); + + internal static class DeviceInfomation + { + [DllImport(Libraries.Mtp, EntryPoint = "mtp_deviceinfo_get_manufacturer_name")] + internal static extern int GetManufacturerName(int device, out IntPtr manufacturerName); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_deviceinfo_get_model_name")] + internal static extern int GetModelName(int device, out IntPtr modelName); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_deviceinfo_get_serial_number")] + internal static extern int GetSerialNumber(int device, out IntPtr serialNumber); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_deviceinfo_get_device_version")] + internal static extern int GetDeviceVersion(int device, out IntPtr deviceVersion); + } + + internal static class StorageInformation + { + [DllImport(Libraries.Mtp, EntryPoint = "mtp_storageinfo_get_description")] + internal static extern int GetDescription(int device, int storage, out IntPtr description); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_storageinfo_get_free_space")] + internal static extern int GetFreeSpace(int device, int storage, out UInt64 freeSpace); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_storageinfo_get_max_capacity")] + internal static extern int GetMaxCapacity(int device, int storage, out UInt64 maxCapacity); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_storageinfo_get_storage_type")] + internal static extern int GetStorageType(int device, int storage, out int storageType); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_storageinfo_get_volume_identifier")] + internal static extern int GetVolumeIdentifier(int device, int storage, out IntPtr volumeIdentifier); + } + + internal static class ObjectInformation + { + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_file_name")] + internal static extern int GetFileName(int device, int objectHandle, out IntPtr fileName); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_keywords")] + internal static extern int GetKeywords(int device, int objectHandle, out IntPtr keyWords); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_association_desc")] + internal static extern int GetAssociationDescription(int device, int objectHandle, out int associationDescription); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_association_type")] + internal static extern int GetAssociationType(int device, int objectHandle, out int associationType); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_size")] + internal static extern int GetSize(int device, int objectHandle, out int size); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_parent_object_handle")] + internal static extern int GetParentObjectHandle(int device, int objectHandle, out int parentObjectHandle); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_storage")] + internal static extern int GetStorage(int device, int objectHandle, out int stroage); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_date_created")] + internal static extern int GetDateCreated(int device, int objectHandle, out int dateCreated); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_date_modified")] + internal static extern int GetDateModified(int device, int objectHandle, out int dateModified); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_file_type")] + internal static extern int GetFileType(int device, int objectHandle, out int fileType); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_image_bit_depth")] + internal static extern int GetImageBitDepth(int device, int objectHandle, out int depth); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_image_pix_width")] + internal static extern int GetImagePixWidth(int device, int objectHandle, out int width); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_image_pix_height")] + internal static extern int GetImagePixHeight(int device, int objectHandle, out int height); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_thumbnail_size")] + internal static extern int GetThumbnailSize(int device, int objectHandle, out int size); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_thumbnail_file_type")] + internal static extern int GetThumbnailFileType(int device, int objectHandle, out int fileType); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_thumbnail_pix_height")] + internal static extern int GetThumbnailPixHeight(int device, int objectHandle, out int height); + [DllImport(Libraries.Mtp, EntryPoint = "mtp_objectinfo_get_thumbnail_pix_width")] + internal static extern int GetThumbnailPixWidth(int device, int objectHandle, out int width); + } + + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj b/src/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp.sln b/src/Tizen.Network.Mtp/Tizen.Network.Mtp.sln new file mode 100755 index 0000000..a010f46 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Mtp", "Tizen.Network.Mtp.csproj", "{66896B73-D51B-4E1D-9A7A-B5D66FDE6E97}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{82B9BB77-6809-4DA0-9BCE-DAC24C7A7669}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{AD803503-C70D-4CE7-A1F1-9DF0B890A42F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {66896B73-D51B-4E1D-9A7A-B5D66FDE6E97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66896B73-D51B-4E1D-9A7A-B5D66FDE6E97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66896B73-D51B-4E1D-9A7A-B5D66FDE6E97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66896B73-D51B-4E1D-9A7A-B5D66FDE6E97}.Release|Any CPU.Build.0 = Release|Any CPU + {82B9BB77-6809-4DA0-9BCE-DAC24C7A7669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82B9BB77-6809-4DA0-9BCE-DAC24C7A7669}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82B9BB77-6809-4DA0-9BCE-DAC24C7A7669}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82B9BB77-6809-4DA0-9BCE-DAC24C7A7669}.Release|Any CPU.Build.0 = Release|Any CPU + {AD803503-C70D-4CE7-A1F1-9DF0B890A42F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD803503-C70D-4CE7-A1F1-9DF0B890A42F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD803503-C70D-4CE7-A1F1-9DF0B890A42F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD803503-C70D-4CE7-A1F1-9DF0B890A42F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpDevice.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpDevice.cs new file mode 100644 index 0000000..7780694 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpDevice.cs @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Mtp +{ + /// + /// A class for Mtp Device information. It allows applications to handle device information. + /// + /// 5 + public class MtpDevice : IDisposable + { + private int _deviceHandle = -1; + private bool disposed = false; + private List _storageList = new List(); + + /// + /// Gets the manufacturer name of the device information. + /// + /// Manufacture name of device. + /// 5 + public string ManufacturerName + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.DeviceInfomation.GetManufacturerName(_deviceHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get manufacturer name, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the model name of the device information. + /// + /// Model name of device. + /// 5 + public string ModelName + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.DeviceInfomation.GetModelName(_deviceHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get model name, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the serial number of the device information. + /// + /// Serial number of device. + /// 5 + public string SerialNumber + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.DeviceInfomation.GetSerialNumber(_deviceHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get serial number, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the device version of the device information. + /// + /// Version number of device. + /// 5 + public string DeviceVersion + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.DeviceInfomation.GetDeviceVersion(_deviceHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get device version, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + internal MtpDevice(int handle) + { + _deviceHandle = handle; + } + + ~MtpDevice() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + foreach (MtpStorage storage in _storageList) + { + storage.Dispose(); + _storageList.Remove(storage); + } + } + //Free unmanaged objects + disposed = true; + } + + internal int GetHandle() + { + return _deviceHandle; + } + + /// + /// Gets the list of storages. + /// + /// List of storage objects. + /// http://tizen.org/feature/network.mtp + /// Thrown when Mtp is not supported. + /// Thrown when the method failed due to invalid operation. + /// 5 + public IEnumerable GetStorages() + { + IntPtr storagePtr; + int count = 0; + + int ret = Interop.Mtp.GetStorages(_deviceHandle, out storagePtr, out count); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get storage list, Error - " + (MtpError)ret); + MtpErrorFactory.ThrowMtpException(ret); + } + + for (int i = 0; i < count; i++) + { + int storageID = Marshal.ReadInt32(storagePtr); + + MtpStorage storageItem = new MtpStorage(_deviceHandle, storageID); + _storageList.Add(storageItem); + storagePtr += sizeof(int); + } + + return _storageList; + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEnumerations.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEnumerations.cs new file mode 100644 index 0000000..17e0ae0 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEnumerations.cs @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Mtp +{ + /// + /// Enumeration for Mtp storage type. + /// + /// 5 + public enum MtpStorageType + { + /// + /// Undefined + /// + Undefined = 0, + /// + /// fixed ROM + /// + FixedRom = 1, + /// + /// removable ROM + /// + RemovableRom = 2, + /// + /// fixed RAM + /// + FixedRam = 3, + /// + /// removable RAM + /// + RemovableRam = 4 + } + + /// + /// Enumeration for Mtp file type. + /// + /// 5 + public enum MtpFileType + { + /// + /// Folder + /// + Folder = 0, + /// + /// Wav + /// + Wav = 1, + /// + /// Mp3 + /// + Mp3 = 2, + /// + /// Wma + /// + Wma = 3, + /// + /// Ogg + /// + Ogg = 4, + /// + /// Audible + /// + Audible = 5, + /// + /// Mp4 + /// + Mp4 = 6, + /// + /// UndefAudio + /// + UndefAudio = 7, + /// + /// Wmv + /// + Wmv = 8, + /// + /// Avi + /// + Avi = 9, + /// + /// Mpeg + /// + Mpeg = 10, + /// + /// Asf + /// + Asf = 11, + /// + /// Qt + /// + Qt = 12, + /// + /// UndefVideo + /// + UndefVideo = 13, + /// + /// Jpeg + /// + Jpeg = 14, + /// + /// Jfif + /// + Jfif = 15, + /// + /// Tiff + /// + Tiff = 16, + /// + /// Bmp + /// + Bmp = 17, + /// + /// Gif + /// + Gif = 18, + /// + /// Pict + /// + Pict = 19, + /// + /// Png + /// + Png = 20, + /// + /// Vcalendar1 + /// + Vcalendar1 = 21, + /// + /// Vcalendar2 + /// + Vcalendar2 = 22, + /// + /// Vcard2 + /// + Vcard2 = 23, + /// + /// Vcard3 + /// + Vcard3 = 24, + /// + /// WindowsImageFormat + /// + WindowsImageFormat = 25, + /// + /// WinExec + /// + WinExec = 26, + /// + /// Text + /// + Text = 27, + /// + /// Html + /// + Html = 28, + /// + /// Firmware + /// + Firmware = 29, + /// + /// Aac + /// + Aac = 30, + /// + /// Mediacard + /// + Mediacard = 31, + /// + /// Flac + /// + Flac = 32, + /// + /// Mp2 + /// + Mp2 = 33, + /// + /// M4a + /// + M4a = 34, + /// + /// Doc + /// + Doc = 35, + /// + /// Xml + /// + Xml = 36, + /// + /// Xls + /// + Xls = 37, + /// + /// Ppt + /// + Ppt = 38, + /// + /// Mht + /// + Mht = 39, + /// + /// Jp2 + /// + Jp2 = 40, + /// + /// Jpx + /// + Jpx = 41, + /// + /// Album + /// + Album = 42, + /// + /// Playlist + /// + Playlist = 43, + /// + /// Unknown + /// + Unknown = 44, + /// + /// All (Helper type) + /// + All = 45, + /// + /// All Image (Helper type) + /// + AllImage = 46 + } + + /// + /// Enumeration for Mtp Event type. + /// + /// 5 + public enum MtpEventType + { + /// + /// Unknown + /// + Unknown, + /// + /// Storage Added + /// + StorageAdded, + /// + /// Storage Removed + /// + StorageRemoved, + /// + /// Object Added + /// + ObjectAdded, + /// + /// Object Removed + /// + ObjectRemoved, + /// + /// Device Added + /// + DeviceAdded, + /// + /// Device Removed + /// + DeviceRemoved, + /// + /// Turned Off + /// + TurnedOff + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpErrorFactory.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpErrorFactory.cs new file mode 100644 index 0000000..5362b1e --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpErrorFactory.cs @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.Mtp +{ + static internal class MtpErrorValue + { + internal const int Base = -0x01CC0000; + } + + /// + /// Enumeration for Mtp Error. + /// + /// 5 + public enum MtpError + { + None = ErrorCode.None, + IoError = ErrorCode.IoError, + InvalidParameterError = ErrorCode.InvalidParameter, + OutOfMemoryError = ErrorCode.OutOfMemory, + PermissionDeniedError = ErrorCode.PermissionDenied, + NotSupportedError = ErrorCode.NotSupported, + + CommunicationError = MtpErrorValue.Base | 0x01, + ControllerError = MtpErrorValue.Base | 0x02, + NoDeviceError = MtpErrorValue.Base | 0x03, + NotInitializedError = MtpErrorValue.Base | 0x04, + NotActivatedError = MtpErrorValue.Base | 0x05, + NotActivatedCommunicationError = MtpErrorValue.Base | 0x06, + PluginFailError = MtpErrorValue.Base | 0x07 + } + + internal static class MtpErrorFactory + { + static internal void ThrowMtpException(int e) + { + ThrowException(e, false); + } + + static internal void ThrowMtpException(int e, int handle) + { + ThrowException(e, (handle < 0)); + } + + static private void ThrowException(int e, bool isHandleNull) + { + MtpError err = (MtpError)e; + + if (isHandleNull) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + + if (err == MtpError.InvalidParameterError) + { + throw new ArgumentException(err.ToString()); + } + else if (err == MtpError.NotSupportedError) + { + throw new NotSupportedException(); + } + else + { + throw new InvalidOperationException(err.ToString()); + } + } + + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEventArgs.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEventArgs.cs new file mode 100644 index 0000000..e6e7245 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpEventArgs.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.Mtp +{ + /// + /// An extended EventArgs class which contains Mtp event. + /// + /// 5 + public class MtpStateChangedEventArgs : EventArgs + { + private MtpEventType _type = MtpEventType.Unknown; + private int _eventParameter; + + internal MtpStateChangedEventArgs(MtpEventType type, int eventParameter) + { + _type = type; + _eventParameter = eventParameter; + } + + /// + /// The Mtp event type. + /// + /// 5 + public MtpEventType Type + { + get + { + return _type; + } + } + + /// + /// The event parameter. + /// + /// 5 + public int EventParameter + { + get + { + return _eventParameter; + } + } + } + +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManager.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManager.cs new file mode 100644 index 0000000..f202f4b --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManager.cs @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Network.Mtp +{ + /// + /// A class for MTP management. It allows applications to use MTP service. + /// + /// + /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// + /// 5 + static public class MtpManager + { + /// + /// Gets the list of MTP devices. + /// + /// List of MtpDevice objects. + /// http://tizen.org/feature/network.mtp + /// Thrown when Mtp is not supported. + /// Thrown when the method failed due to invalid operation. + /// 5 + static public IEnumerable GetDevices() + { + try + { + return MtpManagerImpl.Instance.GetDevices(); + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + + /// + /// MtpStateChanged is raised when the Mtp device state is changed. + /// + /// 5 + static public event EventHandler MtpStateChanged + { + add + { + try + { + MtpManagerImpl.Instance.MtpStateChanged += value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + remove + { + try + { + MtpManagerImpl.Instance.MtpStateChanged -= value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerEvent.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerEvent.cs new file mode 100644 index 0000000..7b23311 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerEvent.cs @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Network.Mtp +{ + internal static class EventHandlerExtension + { + internal static void SafeInvoke(this EventHandler evt, object sender, EventArgs e) + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + internal static void SafeInvoke(this EventHandler evt, object sender, T e) where T : EventArgs + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + } + + internal partial class MtpManagerImpl + { + private event EventHandler _mtpStateChanged; + + private Interop.Mtp.MptStateChangedCallback _mtpStateChangedCallback; + + internal event EventHandler MtpStateChanged + { + add + { + if (_mtpStateChanged == null) + { + RegisterMtpStateChangedEvent(); + } + _mtpStateChanged += value; + } + remove + { + _mtpStateChanged -= value; + if (_mtpStateChanged == null) + { + UnregisterMtpStateChangedEvent(); + } + } + } + + private void RegisterMtpStateChangedEvent() + { + _mtpStateChangedCallback = (int eventType, int eventParameter, IntPtr userData) => + { + MtpEventType _eventType = (MtpEventType)eventType; + int _eventParameter = eventParameter; + MtpStateChangedEventArgs e = new MtpStateChangedEventArgs(_eventType, _eventParameter); + _mtpStateChanged.SafeInvoke(null, e); + }; + + int ret = Interop.Mtp.AddMtpStateChangedCallback(_mtpStateChangedCallback, IntPtr.Zero); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to add mtp state changed callback, Error - " + (MtpError)ret); + } + } + + private void UnregisterMtpStateChangedEvent() + { + int ret = Interop.Mtp.RemoveMtpStateChangedCallback(_mtpStateChangedCallback); + + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to remove mtp state changed callback, Error - " + (MtpError)ret); + } + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerImpl.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerImpl.cs new file mode 100644 index 0000000..111bdb0 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpManagerImpl.cs @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Network.Mtp +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Network.Mtp"; + } + + internal partial class MtpManagerImpl : IDisposable + { + private static readonly MtpManagerImpl _instance = new MtpManagerImpl(); + private List _deviceList = new List(); + private bool disposed = false; + + internal static MtpManagerImpl Instance + { + get + { + return _instance; + } + } + + private MtpManagerImpl() + { + Initialize(); + } + + ~MtpManagerImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + Deinitialize(); + disposed = true; + } + + private void Initialize() + { + int ret = Interop.Mtp.Initialize(); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to Initialize Mtp, Error - " + (MtpError)ret); + MtpErrorFactory.ThrowMtpException(ret); + } + } + + private void Deinitialize() + { + int ret = Interop.Mtp.Deinitialize(); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to Deinitialize Mtp, Error - " + (MtpError)ret); + } + } + + internal IEnumerable GetDevices() + { + IntPtr devicePtr; + int count = 0; + + int ret = Interop.Mtp.GetDevices(out devicePtr, out count); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get device list, Error - " + (MtpError)ret); + MtpErrorFactory.ThrowMtpException(ret); + } + + for (int i = 0; i < count; i++) + { + int deviceID = Marshal.ReadInt32(devicePtr); + + MtpDevice deviceItem = new MtpDevice(deviceID); + _deviceList.Add(deviceItem); + devicePtr += sizeof(int); + } + + return _deviceList; + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs new file mode 100644 index 0000000..6607e13 --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpObject.cs @@ -0,0 +1,393 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Mtp +{ + /// + /// A class for Mtp Object information. It allows applications to handle object information. + /// + /// 5 + public class MtpObject : IDisposable + { + private int _deviceHandle = -1; + private int _objectHandle = -1; + private bool disposed = false; + + /// + /// Gets the filename of the object information. + /// + /// File name of object. + /// 5 + public string FileName + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.ObjectInformation.GetFileName(_deviceHandle, _objectHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get file name, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the keywords of the object information. + /// + /// Keywords of object. + /// 5 + public string Keywords + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.ObjectInformation.GetKeywords(_deviceHandle, _objectHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get keywords, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the association description of the object information. + /// + /// Association description of object. + /// 5 + public int AssociationDescription + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetAssociationDescription(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get association decription, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the association type of the object information. + /// + /// Association type of object. + /// 5 + public int AssociationType + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetAssociationType(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get association type, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the size of the object information. + /// + /// Size of object. + /// 5 + public int Size + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetSize(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get size, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the parent object handle of the object information. + /// + /// Handle of Parent object. + /// 5 + public int ParentObjectHandle + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetParentObjectHandle(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get parent object handle, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the mtp storage of the object information. + /// + /// Storage of object. + /// 5 + public int Storage + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetStorage(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get storage, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the object created time of the object information. + /// + /// Date created of object. + /// 5 + public int DateCreated + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetDateCreated(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get date created, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the object modified time of the object information. + /// + /// Date modified of object. + /// 5 + public int DateModified + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetDateModified(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get date modified, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the file type of the object information. + /// + /// File type of object. + /// 5 + public MtpFileType FileType + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetStorage(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get file type, Error - " + (MtpError)ret); + } + return (MtpFileType)value; + } + } + + /// + /// Gets the image bit depth of the object information. + /// + /// Bit depth of image. + /// 5 + public int ImageBitDepth + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetImageBitDepth(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get image bit depth, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the image pixel width of the object information. + /// + /// Pixel width of image. + /// 5 + public int ImagePixelWidth + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetImagePixWidth(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get image pixel width, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the image pixel height of the object information. + /// + /// Pixel height of image. + /// 5 + public int ImagePixelHeight + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetImagePixHeight(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get image pixel height, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the thumbnail size of the object information. + /// + /// Size of thumbnail. + /// 5 + public int ThumbnailSize + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetThumbnailSize(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get thumbnail size, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the thumbnail file type of the object information. + /// + /// File type of thumbnail. + /// 5 + public int ThumbnailFileType + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetThumbnailFileType(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get thumbnail file type, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the thumbnail pixel width of the object information. + /// + /// Pixel width of thumbnail. + /// 5 + public int ThumbnailPixelWidth + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetThumbnailPixWidth(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get thumbnail pixel width, Error - " + (MtpError)ret); + } + return value; + } + } + + /// + /// Gets the thumbnail pixel height of the object information. + /// + /// Pixel height of thumbnail. + /// 5 + public int ThumbnailPixelHeight + { + get + { + int value; + int ret = Interop.Mtp.ObjectInformation.GetThumbnailPixHeight(_deviceHandle, _objectHandle, out value); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get thumbnail pixel height, Error - " + (MtpError)ret); + } + return value; + } + } + + internal MtpObject(int deviceHandle, int objectHandle) + { + _deviceHandle = deviceHandle; + _objectHandle = objectHandle; + } + + ~MtpObject() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + internal int GetHandle() + { + return _objectHandle; + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs new file mode 100644 index 0000000..1e44f1f --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/MtpStorage.cs @@ -0,0 +1,230 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Mtp +{ + /// + /// A class for Mtp Storage information. It allows applications to handle storage information. + /// + /// 5 + public class MtpStorage : IDisposable + { + private int _deviceHandle = -1; + private int _storageHandle = -1; + private bool disposed = false; + private List _objectHandleList = new List(); + private List _objectList = new List(); + private MtpObject _rootObject; + + /// + /// Gets the description of the storage information. + /// + /// Description of storage. + /// 5 + public string Description + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.StorageInformation.GetDescription(_deviceHandle, _storageHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get description, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// Gets the free space of the storage information in bytes. + /// + /// Free space of storage(bytes). + /// 5 + public UInt64 FreeSpace + { + get + { + UInt64 freeSpace; + int ret = Interop.Mtp.StorageInformation.GetFreeSpace(_deviceHandle, _storageHandle, out freeSpace); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get free space, Error - " + (MtpError)ret); + } + return freeSpace; + } + } + + /// + /// Gets the max capacity of the storage information in bytes. + /// + /// Max capacity of storage(bytes). + /// 5 + public UInt64 MaxCapacity + { + get + { + UInt64 maxCapacity; + int ret = Interop.Mtp.StorageInformation.GetMaxCapacity(_deviceHandle, _storageHandle, out maxCapacity); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get free space, Error - " + (MtpError)ret); + } + return maxCapacity; + } + } + + /// + /// Gets the storage type of the storage information. + /// + /// Type of storage. + /// 5 + public MtpStorageType StorageType + { + get + { + int storageType; + int ret = Interop.Mtp.StorageInformation.GetStorageType(_deviceHandle, _storageHandle, out storageType); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get free space, Error - " + (MtpError)ret); + } + return (MtpStorageType)storageType; + } + } + + /// + /// Gets the volume identifier of the storage information. + /// + /// Volume identifier of stroage. + /// 5 + public string VolumeIdentifier + { + get + { + IntPtr strPtr; + int ret = Interop.Mtp.StorageInformation.GetVolumeIdentifier(_deviceHandle, _storageHandle, out strPtr); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get volume identifier, Error - " + (MtpError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + internal MtpStorage(int deviceHandle, int storageHandle) + { + _deviceHandle = deviceHandle; + _storageHandle = storageHandle; + } + + ~MtpStorage() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + foreach (MtpObject mtpObject in _objectList) + { + mtpObject.Dispose(); + _objectList.Remove(mtpObject); + } + + //Free unmanaged objects + disposed = true; + } + } + + internal int GetHandle() + { + return _storageHandle; + } + + /// + /// Gets the root folder object. + /// + /// List of storage objects. + /// http://tizen.org/feature/network.mtp + /// + /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// + /// 5 + public MtpObject GetRootObject() + { + _rootObject = new MtpObject(_deviceHandle, 0); + + return _rootObject; + } + + /// + /// Gets the list of objects. + /// + /// The parent object handle. If parentHandle is 0, it means "root folder" of mtp storage. + /// The file type what you want. + /// List of objects. + /// http://tizen.org/feature/network.mtp + /// + /// http://tizen.org/privilege/mediastorage is needed if input or output path are relevant to media storage. + /// http://tizen.org/privilege/externalstorage is needed if input or output path are relevant to external storage. + /// + /// Thrown when Mtp is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + /// 5 + public IEnumerable GetObjectList(MtpObject parentObject, MtpFileType fileType) + { + IntPtr objectPtr; + int count = 0; + + int ret = Interop.Mtp.GetObjectHandles(_deviceHandle, _storageHandle, parentObject.GetHandle(), (int)fileType, out objectPtr, out count); + if (ret != (int)MtpError.None) + { + Log.Error(Globals.LogTag, "Failed to get object handle lists, Error - " + (MtpError)ret); + MtpErrorFactory.ThrowMtpException(ret); + } + + for (int i = 0; i < count; i++) + { + int objectID = Marshal.ReadInt32(objectPtr); + + MtpObject objectItem = new MtpObject(_deviceHandle, objectID); + _objectList.Add(objectItem); + objectPtr += sizeof(int); + } + + return _objectList; + } + } +} diff --git a/src/Tizen.Network.Mtp/Tizen.Network.Mtp/NamespaceDoc.cs b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/NamespaceDoc.cs new file mode 100644 index 0000000..c8c3c3a --- /dev/null +++ b/src/Tizen.Network.Mtp/Tizen.Network.Mtp/NamespaceDoc.cs @@ -0,0 +1,44 @@ +/** + +The Tizen.Network.Mtp namespace provides classes to manage the MTP(Media Transfer Protocol) initiator. + + + + +

Overview

+ +MTP API provides functions for support PTP(Picture Transfer Protocol) subset of MTP(Media Transfer Protocol). + + + +

Manager

+Provide functions to establish connection to access MTP responder device, and to Get/Delete files. +
+ + +

Device

+Provide functions to gets the device information of MTP responder device. +
+ + +

Storage

+Provide functions to gets the storage information of MTP responder storage. +
+ + +

Object

+Provide functions to gets the object information of certain file in MTP responder. +
+ +

Related Features

+ +To guarantee that if input or output path are relevant to internal and external storage, +declare the following feature requirements in the config file:
+http://tizen.org/privilege/mediastorage +http://tizen.org/privilege/externalstorage +
+ +
+*/ + +namespace Tizen.Network.Mtp { } \ No newline at end of file diff --git a/src/Tizen.Network.Nfc/Interop/Interop.Glib.cs b/src/Tizen.Network.Nfc/Interop/Interop.Glib.cs new file mode 100644 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Network.Nfc/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Network.Nfc/Interop/Interop.Libc.cs b/src/Tizen.Network.Nfc/Interop/Interop.Libc.cs new file mode 100644 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Network.Nfc/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Network.Nfc/Interop/Interop.Libraries.cs b/src/Tizen.Network.Nfc/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..8984d71 --- /dev/null +++ b/src/Tizen.Network.Nfc/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Nfc = "libcapi-network-nfc.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Nfc/Interop/Interop.Nfc.cs b/src/Tizen.Network.Nfc/Interop/Interop.Nfc.cs new file mode 100644 index 0000000..d6ad84a --- /dev/null +++ b/src/Tizen.Network.Nfc/Interop/Interop.Nfc.cs @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Nfc + { + //Callback for async method + //nfc_activation_completed_cb + //nfc_tag_write_completed_cb + //nfc_tag_format_completed_cb + //nfc_mifare_authenticate_with_keyA_completed_cb + //nfc_mifare_authenticate_with_keyB_completed_cb + //nfc_mifare_write_block_completed_cb + //nfc_mifare_write_page_completed_cb + //nfc_mifare_increment_completed_cb + //nfc_mifare_decrement_completed_cb + //nfc_mifare_transfer_completed_cb + //nfc_mifare_restore_completed_cb + //nfc_p2p_send_completed_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VoidCallback(int result, IntPtr userData); + //nfc_tag_information_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool TagInformationCallback(IntPtr key, IntPtr value, int valueSize, IntPtr userData); + //nfc_tag_transceive_completed_cb + //nfc_mifare_read_block_completed_cb + //nfc_mifare_read_page_completed_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TagTransceiveCompletedCallback(int result, IntPtr value, int bufferSize, IntPtr userData); + //nfc_tag_read_completed_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool TagReadCompletedCallback(int result, IntPtr message, IntPtr userData); + //nfc_snep_event_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SnepEventCallback(IntPtr handle, int snepEvent, int result, IntPtr message, IntPtr userData); + //nfc_se_registered_aid_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SecureElementRegisteredAidCallback(int seType, IntPtr aid, bool readOnly, IntPtr userData); + + + //Callback for event + //nfc_activation_changed_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ActivationChangedCallback(bool activated, IntPtr userData); + //nfc_tag_discovered_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TagDiscoveredCallback(int type, IntPtr tag, IntPtr userData); + //nfc_p2p_target_discovered_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void P2pTargetDiscoveredCallback(int type, IntPtr p2pTaget, IntPtr userData); + //nfc_ndef_discovered_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void NdefMessageDiscoveredCallback(IntPtr message, IntPtr userData); + //nfc_se_event_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SecureElementEventCallback(int eventType, IntPtr userData); + //nfc_se_transaction_event_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SecureElementTransactionEventCallback(int type, IntPtr aid, int aidSize, IntPtr param, int paramSize, IntPtr userData); + //nfc_p2p_data_received_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void P2pDataReceivedCallback(IntPtr target, IntPtr message, IntPtr userData); + //nfc_hce_event_cb + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void HostCardEmulationEventCallback(IntPtr handle, int eventType, IntPtr apdu, uint apduLen, IntPtr userData); + + //capi-network-nfc-0.2.5-6.1.armv7l + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_deinitialize")] + internal static extern int Deinitialize(); + + ////Nfc Manager + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_is_supported")] + internal static extern bool IsSupported(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_activation")] + internal static extern int SetActivation(bool activation, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_is_activated")] + internal static extern bool IsActivated(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_activation_changed_cb")] + internal static extern int SetActivationChangedCallback(ActivationChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_activation_changed_cb")] + internal static extern void UnsetActivationChangedCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_tag_discovered_cb")] + internal static extern int SetTagDiscoveredCallback(TagDiscoveredCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_tag_discovered_cb")] + internal static extern void UnsetTagDiscoveredCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_ndef_discovered_cb")] + internal static extern int SetNdefDiscoveredCallback(NdefMessageDiscoveredCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_ndef_discovered_cb")] + internal static extern void UnsetNdefDiscoveredCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_p2p_target_discovered_cb")] + internal static extern int SetP2pTargetDiscoveredCallback(P2pTargetDiscoveredCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_p2p_target_discovered_cb")] + internal static extern void UnsetP2pTargetDiscoveredCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_se_event_cb")] + internal static extern int SetSecureElementEventCallback(SecureElementEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_se_event_cb")] + internal static extern void UnsetSecureElementEventCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_se_transaction_event_cb")] + internal static extern int SetSecureElementTransactionEventCallback(int setype, SecureElementTransactionEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_se_transaction_event_cb")] + internal static extern int UnsetSecureElementTransactionEventCallback(int setype); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_hce_event_cb")] + internal static extern int SetHostCardEmulationEventCallback(HostCardEmulationEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_unset_hce_event_cb")] + internal static extern void UnsetHostCardEmulationEventCallback(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_enable_transaction_fg_dispatch")] + internal static extern int EnableTransactionForegroundDispatch(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_disable_transaction_fg_dispatch")] + internal static extern int DisableTransactionForegroundDispatch(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_get_cached_message")] + internal static extern int GetCachedMessage(out IntPtr ndefMessage); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_tag_filter")] + internal static extern void SetTagFilter(int filter); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_get_tag_filter")] + internal static extern int GetTagFilter(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_get_connected_tag")] + internal static extern int GetConnectedTag(out IntPtr tag); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_get_connected_target")] + internal static extern int GetConnectedTarget(out IntPtr target); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_system_handler_enable")] + internal static extern int SetSystemHandlerEnable(bool enable); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_is_system_handler_enabled")] + internal static extern bool IsSystemHandlerEnabled(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_set_se_type")] + internal static extern int SetSecureElementType(int type); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_manager_get_se_type")] + internal static extern int GetSecureElementType(out int type); + + ////NDEF - NFC Data Exchange Format, TNF - Type Name Format + internal static class NdefRecord + { + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_create")] + internal static extern int Create(out IntPtr record, int tnf, byte[] type, int typeSize, byte[] id, int idSize, byte[] payload, uint payloadSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_create_text")] + internal static extern int CreateText(out IntPtr record, string text, string languageCode, int encode); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_create_uri")] + internal static extern int CreateUri(out IntPtr record, string uri); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_create_mime")] + internal static extern int CreateMime(out IntPtr record, string mimeType, byte[] data, uint dataSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_destroy")] + internal static extern int Destroy(IntPtr record); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_set_id")] + internal static extern int SetId(IntPtr record, byte[] id, int idSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_id")] + internal static extern int GetId(IntPtr record, out IntPtr id, out int size); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_payload")] + internal static extern int GetPayload(IntPtr record, out IntPtr payload, out uint size); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_type")] + internal static extern int GetType(IntPtr record, out IntPtr type, out int size); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_tnf")] + internal static extern int GetTnf(IntPtr record, out int tnf); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_text")] + internal static extern int GetText(IntPtr record, out string text); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_langcode")] + internal static extern int GetLanguageCode(IntPtr record, out string languageCode); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_encode_type")] + internal static extern int GetEncodeType(IntPtr record, out int encode); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_uri")] + internal static extern int GetUri(IntPtr record, out string uri); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_record_get_mime_type")] + internal static extern int GetMimeType(IntPtr record, out string mimeType); + } + + internal static class NdefMessage + { + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_create")] + internal static extern int Create(out IntPtr ndefMessage); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_create_from_rawdata")] + internal static extern int CreateRawData(out IntPtr ndefMessage, byte[] rawData, uint rawDataSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_destroy")] + internal static extern int Destroy(IntPtr ndefMessage); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_get_record_count")] + internal static extern int GetRecordCount(IntPtr ndefMessage, out int count); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_get_rawdata")] + internal static extern int GetRawData(IntPtr ndefMessage, out IntPtr rawData, out uint rawDataSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_append_record")] + internal static extern int AppendRecord(IntPtr ndefMessage, IntPtr record); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_insert_record")] + internal static extern int InsertRecord(IntPtr ndefMessage, int index, IntPtr record); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_remove_record")] + internal static extern int RemoveRecord(IntPtr ndefMessage, int index); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_ndef_message_get_record")] + internal static extern int GetRecord(IntPtr ndefMessage, int index, out IntPtr record); + } + + internal static class Tag + { + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_get_type")] + internal static extern int GetType(IntPtr tag, out int type); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_is_support_ndef")] + internal static extern int IsSupportNdef(IntPtr tag, out bool isSupported); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_get_maximum_ndef_size")] + internal static extern int GetMaximumNdefSize(IntPtr tag, out uint maximunNdefBytesSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_get_ndef_size")] + internal static extern int GetNdefSize(IntPtr tag, out uint ndefBytesSize); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_foreach_information")] + internal static extern int ForeachInformation(IntPtr tag, TagInformationCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_transceive")] + internal static extern int Transceive(IntPtr tag, byte[] buffer, int bufferSize, TagTransceiveCompletedCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_read_ndef")] + internal static extern int ReadNdef(IntPtr tag, TagReadCompletedCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_write_ndef")] + internal static extern int WriteNdef(IntPtr tag, IntPtr ndefMessage, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_tag_format_ndef")] + internal static extern int FormatNdef(IntPtr tag, byte[] key, int kyeSize, VoidCallback callback, IntPtr userData); + + ////Mifare + } + + ////SNEP - Simple NDEF Exchange Protocol + internal static class P2p + { + [DllImport(Libraries.Nfc, EntryPoint = "nfc_p2p_set_data_received_cb")] + internal static extern int SetDataReceivedCallback(IntPtr target, P2pDataReceivedCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_p2p_unset_data_received_cb")] + internal static extern int UnsetDataReceivedCallback(IntPtr target); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_p2p_send")] + internal static extern int Send(IntPtr target, IntPtr ndefMessage, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_start_server")] + internal static extern int SnepStartServer(IntPtr target, string san, int sap, SnepEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_start_client")] + internal static extern int SnepStartClient(IntPtr target, string san, int sap, SnepEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_send_client_request")] + internal static extern int SnepSendClientRequest(IntPtr snepHandle, int type, IntPtr ndefMessage, SnepEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_stop_service")] + internal static extern int SnepStopService(IntPtr target, IntPtr snepHandle); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_register_server")] + internal static extern int SnepRegisterServer(string san, int sap, SnepEventCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_snep_unregister_server")] + internal static extern int SnepUnregisterServer(string sam, int sap); + } + + ////SE - Secure Element, HCE - Host Card Emulation, APDU - Application Protocol Data Unit, AID - Application Identifier + internal static class CardEmulation + { + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_enable_card_emulation")] + internal static extern int EnableCardEmulation(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_disable_card_emulation")] + internal static extern int DisableCardEmulatiion(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_get_card_emulation_mode")] + internal static extern int GetCardEmulationMode(out int type); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_hce_send_apdu_response")] + internal static extern int HceSendApduRespondse(IntPtr seHandle, byte[] response, uint responseLength); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_set_default_route")] + internal static extern int SetDefaultRoute(int poweredOnStatus, int poweredOffStatus, int lowBatteryStatus); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_is_activated_handler_for_aid")] + internal static extern int IsActivatedHandlerForAid(int seType, string aid, out bool isActivatedHandler); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_is_activated_handler_for_category")] + internal static extern int IsActivatedHandlerForCategory(int seType, int category, out bool isActivatedHandler); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_register_aid")] + internal static extern int RegisterAid(int seType, int category, string aid); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_unregister_aid")] + internal static extern int UnregisterAid(int seType, int category, string aid); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_foreach_registered_aids")] + internal static extern int ForeachRegisterdAids(int seType, int category, SecureElementRegisteredAidCallback callback, IntPtr userData); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_set_preferred_handler")] + internal static extern int SetPreferredHandler(); + [DllImport(Libraries.Nfc, EntryPoint = "nfc_se_unset_preferred_handler")] + internal static extern int UnsetPreferredHandler(); + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc.csproj b/src/Tizen.Network.Nfc/Tizen.Network.Nfc.csproj new file mode 100644 index 0000000..aac4c62 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc.sln b/src/Tizen.Network.Nfc/Tizen.Network.Nfc.sln new file mode 100755 index 0000000..b63abbb --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Nfc", "Tizen.Network.Nfc.csproj", "{4B797D35-8204-4A77-89B8-3E483487F7A6}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{DD28E89E-A7AF-41F3-A43A-3694EC14D806}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{26B43A98-DA33-447B-861C-B74A1004A092}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{399874C4-6B32-41B6-B05C-835BEA98024C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4B797D35-8204-4A77-89B8-3E483487F7A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B797D35-8204-4A77-89B8-3E483487F7A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B797D35-8204-4A77-89B8-3E483487F7A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B797D35-8204-4A77-89B8-3E483487F7A6}.Release|Any CPU.Build.0 = Release|Any CPU + {DD28E89E-A7AF-41F3-A43A-3694EC14D806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD28E89E-A7AF-41F3-A43A-3694EC14D806}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD28E89E-A7AF-41F3-A43A-3694EC14D806}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD28E89E-A7AF-41F3-A43A-3694EC14D806}.Release|Any CPU.Build.0 = Release|Any CPU + {26B43A98-DA33-447B-861C-B74A1004A092}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26B43A98-DA33-447B-861C-B74A1004A092}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26B43A98-DA33-447B-861C-B74A1004A092}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26B43A98-DA33-447B-861C-B74A1004A092}.Release|Any CPU.Build.0 = Release|Any CPU + {399874C4-6B32-41B6-B05C-835BEA98024C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {399874C4-6B32-41B6-B05C-835BEA98024C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {399874C4-6B32-41B6-B05C-835BEA98024C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {399874C4-6B32-41B6-B05C-835BEA98024C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs new file mode 100755 index 0000000..ba7c595 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCallbackData.cs @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// Structure containing the information of Tag data. + /// + /// 3 + public class NfcTagInformation + { + private string _key; + private byte[] _informationValue; + + internal NfcTagInformation(string key, byte[] informationValue) + { + _key = key; + _informationValue = informationValue; + } + + /// + /// Key value. + /// + /// 3 + public string Key + { + get + { + return _key; + } + } + /// + /// Information value. + /// + /// 3 + public byte[] InformationValue + { + get + { + return _informationValue; + } + } + } + + /// + /// Structure containing the information of Secure element Aid(Application Identifier). + /// + /// 3 + public class NfcRegisteredAidInformation + { + private NfcSecureElementType _seType; + private string _aid; + private bool _readOnly; + + internal NfcRegisteredAidInformation(NfcSecureElementType seType, string aid, bool readOnly) + { + _seType = seType; + _aid = aid; + _readOnly = readOnly; + } + + /// + /// Secure Element Type value. + /// + /// 3 + public NfcSecureElementType SeType + { + get + { + return _seType; + } + } + + /// + /// The targeted Aid (Application Identifier) value. + /// + /// 3 + public string Aid + { + get + { + return _aid; + } + } + + /// + /// Read-only value. If this value is false, there are restrictions to the operation on this Aid. + /// + /// 3 + public bool ReadOnly + { + get + { + return _readOnly; + } + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs new file mode 100755 index 0000000..a8d00dc --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcCardEmulationAdapter.cs @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for NFC CardEmulation mode. It allows applications to handle Card Emulation informations. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + public class NfcCardEmulationAdapter : IDisposable + { + private bool disposed = false; + + private event EventHandler _secureElementEvent; + private event EventHandler _secureElementTransactionEvent; + private event EventHandler _hostCardEmulationEvent; + + private Interop.Nfc.SecureElementEventCallback _secureElementEventCallback; + private Interop.Nfc.SecureElementTransactionEventCallback _secureElementTransactionEventCallback; + private Interop.Nfc.HostCardEmulationEventCallback _hostCardEmulationEventCallback; + + /// + /// Event that is called when receiving Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + public event EventHandler SecureElementEvent + { + add + { + if (_secureElementEvent == null) + { + RegisterSecureElementEvent(); + } + _secureElementEvent += value; + } + remove + { + _secureElementEvent -= value; + if (_secureElementEvent == null) + { + UnregisterSecureElementEvent(); + } + } + } + + /// + /// Event that is called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event for 'ESE(SmartMX)' type. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + public event EventHandler EseSecureElementTransactionEvent + { + add + { + if (_secureElementTransactionEvent == null) + { + RegisterSecureElementTransactionEvent(NfcSecureElementType.EmbeddedSE); + } + _secureElementTransactionEvent += value; + } + remove + { + _secureElementTransactionEvent -= value; + if (_secureElementTransactionEvent == null) + { + UnregisterSecureElementTransactionEvent(NfcSecureElementType.EmbeddedSE); + } + } + } + + /// + /// Event that is called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event for 'UICC' type. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + public event EventHandler UiccSecureElementTransactionEvent + { + add + { + if (_secureElementTransactionEvent == null) + { + RegisterSecureElementTransactionEvent(NfcSecureElementType.Uicc); + } + _secureElementTransactionEvent += value; + } + remove + { + _secureElementTransactionEvent -= value; + if (_secureElementTransactionEvent == null) + { + UnregisterSecureElementTransactionEvent(NfcSecureElementType.Uicc); + } + } + } + + /// + /// Event that is called when when receiving HCE(Host Card Emulation) event. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + public event EventHandler HostCardEmulationEvent + { + add + { + if (_hostCardEmulationEvent == null) + { + RegisterHostCardEmulationEvent(); + } + _hostCardEmulationEvent += value; + } + remove + { + _hostCardEmulationEvent -= value; + if (_hostCardEmulationEvent == null) + { + UnregisterHostCardEmulationEvent(); + } + } + } + + internal NfcCardEmulationAdapter() + { + } + + ~NfcCardEmulationAdapter() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Enable card emulation mode. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void EnableCardEmulation() + { + int ret = Interop.Nfc.CardEmulation.EnableCardEmulation(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to enable card emulation mode, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Disable card emulation mode. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void DisableCardEmulation() + { + int ret = Interop.Nfc.CardEmulation.DisableCardEmulatiion(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to disable card emulation mode, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Get the current card emulation mode. + /// + /// 3 + /// Enumeration value of NfcSecureElementCardEmulationMode. + /// http://tizen.org/privilege/nfc.cardemulation + public NfcSecureElementCardEmulationMode GetCardEmulationMode() + { + int mode = 0; + int ret = Interop.Nfc.CardEmulation.GetCardEmulationMode(out mode); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get card emulation mode, Error - " + (NfcError)ret); + } + + return (NfcSecureElementCardEmulationMode)mode; + } + + /// + /// Give the priority to the foreground application when dispatching transaction event. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void EnableTransactionForegroundDispatch() + { + int ret = Interop.Nfc.EnableTransactionForegroundDispatch(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to enable foreground dispatch, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Disable foreground dispatch for "EVT_TRANSACTION" to the givin application. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void DisableTransactionForegroundDispatch() + { + int ret = Interop.Nfc.DisableTransactionForegroundDispatch(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to disable foreground dispatch, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Gets the state whether an application to call this api is currently the activated handler for specific AID. + /// + /// 3 + /// 'True' when application is currently the activated handler, otherwise 'False'. + /// The type of Secure Element. + /// Application Id, specified in ISO/IEC 7816-4. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public bool IsActivatedHandlerForAid(NfcSecureElementType seType, string aid) + { + bool isActivatedHandle = false; + int ret = Interop.Nfc.CardEmulation.IsActivatedHandlerForAid((int)seType, aid, out isActivatedHandle); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to check activated handle for aid, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return isActivatedHandle; + } + + /// + /// Gets the state whether an application to call this api is currently the activated handler for category. + /// + /// 3 + /// 'True' when application is currently the activated handler, otherwise 'False'. + /// The type of Secure Element. + /// Enumeration value of category. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public bool IsActivatedHandlerForCategory(NfcSecureElementType seType, NfcCardEmulationCategoryType category) + { + bool isActivatedHandle = false; + int ret = Interop.Nfc.CardEmulation.IsActivatedHandlerForCategory((int)seType, (int)category, out isActivatedHandle); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to check activated handle for category, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return isActivatedHandle; + } + + /// + /// Registers a AID for a specific category. + /// + /// 3 + /// The type of Secure Element. + /// Enumeration value of category. + /// Application Id, specified in ISO/IEC 7816-4. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void RegisterAid(NfcSecureElementType seType, NfcCardEmulationCategoryType category, string aid) + { + int ret = Interop.Nfc.CardEmulation.RegisterAid((int)seType, (int)category, aid); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to register aid, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Unregisters a previously registered AID for the specified category. + /// + /// 3 + /// The type of Secure Element. + /// Enumeration value of category. + /// Application Id, specified in ISO/IEC 7816-4. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void UnregisterAid(NfcSecureElementType seType, NfcCardEmulationCategoryType category, string aid) + { + int ret = Interop.Nfc.CardEmulation.UnregisterAid((int)seType, (int)category, aid); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to unregister aid, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Sets the application as a preferred handler. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void SetPreferredApplication() + { + int ret = Interop.Nfc.CardEmulation.SetPreferredHandler(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set preferred handler, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Unsets the application as a preferred handler. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public void UnsetPreferredApplication() + { + int ret = Interop.Nfc.CardEmulation.UnsetPreferredHandler(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to unset preferred handler, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Retrieves all registered AID. + /// + /// 3 + /// List of NfcRegisteredAidInformation objects. + /// The type of Secure Element. + /// Enumeration value of category. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public IEnumerable GetRegisteredAidInformation(NfcSecureElementType seType, NfcCardEmulationCategoryType category) + { + List infoList = new List(); + Interop.Nfc.SecureElementRegisteredAidCallback callback = (int type, IntPtr aid, bool readOnly, IntPtr userData) => + { + if (aid != IntPtr.Zero) + { + NfcRegisteredAidInformation aidInfo = new NfcRegisteredAidInformation((NfcSecureElementType)type, Marshal.PtrToStringAnsi(aid), readOnly); + + infoList.Add(aidInfo); + } + }; + + int ret = Interop.Nfc.CardEmulation.ForeachRegisterdAids((int)seType, (int)category, callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get all registerd aid informations, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return infoList; + } + + private void RegisterSecureElementEvent() + { + _secureElementEventCallback = (int eventType, IntPtr userData) => + { + NfcSecureElementEvent _eventType = (NfcSecureElementEvent)eventType; + SecureElementEventArgs e = new SecureElementEventArgs(_eventType); + _secureElementEvent.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetSecureElementEventCallback(_secureElementEventCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set secure element event callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterSecureElementEvent() + { + Interop.Nfc.UnsetSecureElementEventCallback(); + } + + private void RegisterSecureElementTransactionEvent(NfcSecureElementType seType) + { + _secureElementTransactionEventCallback = (int type, IntPtr aid, int aidSize, IntPtr param, int paramSize, IntPtr userData) => + { + NfcSecureElementType _secureElementType = (NfcSecureElementType)type; + byte[] _aid = NfcConvertUtil.IntLengthIntPtrToByteArray(aid, aidSize); + byte[] _param = NfcConvertUtil.IntLengthIntPtrToByteArray(param, paramSize); + SecureElementTranscationEventArgs e = new SecureElementTranscationEventArgs(_secureElementType, _aid, _param); + _secureElementTransactionEvent.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetSecureElementTransactionEventCallback((int)seType, _secureElementTransactionEventCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set secure element transaction event callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterSecureElementTransactionEvent(NfcSecureElementType seType) + { + Interop.Nfc.UnsetSecureElementTransactionEventCallback((int)seType); + } + + private void RegisterHostCardEmulationEvent() + { + _hostCardEmulationEventCallback = (IntPtr handle, int eventType, IntPtr apdu, uint apduLen, IntPtr userData) => + { + IntPtr _seHandle = handle; + NfcHceEvent _hcdEventType = (NfcHceEvent)eventType; + byte[] _apdu = NfcConvertUtil.UintLengthIntPtrToByteArray(apdu, apduLen); + HostCardEmulationEventArgs e = new HostCardEmulationEventArgs(_seHandle, _hcdEventType, _apdu); + _hostCardEmulationEvent.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetHostCardEmulationEventCallback(_hostCardEmulationEventCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set host card emulation event callback, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + private void UnregisterHostCardEmulationEvent() + { + Interop.Nfc.UnsetHostCardEmulationEventCallback(); + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEnumerations.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEnumerations.cs new file mode 100644 index 0000000..6a35053 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEnumerations.cs @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nfc +{ + /// + /// Enumeration for Nfc record TNF (Type Name Format). + /// + /// 3 + public enum NfcRecordTypeNameFormat + { + /// + /// Empty + /// + /// 3 + Empty = 0, + /// + /// RTD(Record Type Definition) type format [NFC RTD] + /// + /// 3 + WellKnown = 1, + /// + /// MIME Media types in RFC 2046 [RFC 2046] + /// + /// 3 + MimeMedia = 2, + /// + /// Absolute URI as defined in RFC 3986 [RFC 3986] + /// + /// 3 + Uri = 3, + /// + /// NFC Forum external type [NFC RTD] + /// + /// 3 + ExternalRtd = 4, + /// + /// The payload type is unknown + /// + /// 3 + Unknown = 5, + /// + /// final chunk of a chunked NDEF Record + /// + /// 3 + UnChanged = 6 + } + + /// + /// Enumeration for Nfc Encode type. + /// + /// 3 + public enum NfcEncodeType + { + /// + /// UTF-8 + /// + /// 3 + Utf8 = 0, + /// + /// UTF-16 + /// + /// 3 + Utf16 = 1 + } + /// + /// Enumeration for Nfc Tag type. + /// + /// 3 + public enum NfcTagType + { + /// + /// Unknown target + /// + /// 3 + UnknownTarget = 0x00, + /// + /// Generic PICC + /// + /// 3 + GenericPicc, + /// + /// ISO14443 A PICC + /// + /// 3 + Iso14443APicc, + /// + /// ISO14443 4A PICC + /// + /// 3 + Iso144434APicc, + /// + /// ISO14443 4A PICC + /// + /// 3 + Iso144433APicc, + /// + /// Mifare Mini PICC + /// + /// 3 + MifareMiniPicc, + /// + /// Mifare 1k PICC + /// + /// 3 + Mifare1kPicc, + /// + /// Mifare 4k PICC + /// + /// 3 + Mifare4kPicc, + /// + /// Mifare Ultra PICC + /// + /// 3 + MifareUltraPicc, + /// + /// Mifare Desfire PICC + /// + /// 3 + MifareDesfirePicc, + /// + /// Iso14443 B PICC + /// + /// 3 + Iso14443BPicc, + /// + /// Iso14443 4B PICC + /// + /// 3 + Iso144434BPicc, + /// + /// ISO14443 B Prime PICC + /// + /// 3 + Iso14443BPrimePicc, + /// + /// Felica PICC + /// + /// 3 + FelicaPicc, + /// + /// Jewel PICC + /// + /// 3 + JewelPicc, + /// + /// ISO15693 PICC + /// + /// 3 + Iso15693Picc, + /// + /// Barcode 128 PICC + /// + /// 3 + Barcode128Picc, + /// + /// Barcode 256 PICC + /// + /// 3 + Barcode256Picc, + /// + /// NFCIP1 Target + /// + /// 3 + NfcIp1Target, + /// + /// NFCIP1 Initiator + /// + /// 3 + NfcIp1Initiator + } + /// + /// Enumeration for Nfc Tag Filter type. + /// + /// 3 + public enum NfcTagFilterType + { + /// + /// All disable + /// + /// 3 + AllDisable = 0x0000, + /// + /// ISO14443A enable + /// + /// 3 + Iso14443AEnable = 0x0001, + /// + /// ISO14443B enable + /// + /// 3 + Iso14443BEnable = 0x0002, + /// + /// ISO15693 enable + /// + /// 3 + Iso15693Enable = 0x0004, + /// + /// FELICA enable + /// + /// 3 + FelicaEnable = 0x0008, + /// + /// JEWEL enable + /// + /// 3 + JewelEnable = 0x0010, + /// + /// IP enable + /// + /// 3 + IpEnable = 0x0020, + /// + /// All enable + /// + /// 3 + AllEnable = ~0 + } + /// + /// Enumeration for Nfc discovered type. + /// + /// 3 + public enum NfcDiscoveredType + { + /// + /// Attached, discovered, activated event + /// + /// 3 + Attached, + /// + /// Detached, disappeared, deactivated event + /// + /// 3 + Detached + } + /// + /// Enumeration for Nfc Secure Element event. + /// + /// 3 + public enum NfcSecureElementEvent + { + /// + /// Start transaction + /// + /// 3 + StartTransaction, + /// + /// End transaction + /// + /// 3 + EndTransaction, + /// + /// Ready signal + /// + /// 3 + Connectivity, + /// + /// CLF(Contactless Front-end) detects a RF field + /// + /// 3 + FieldOn, + /// + /// CLF(Contactless Front-end) detects that the RF field is off + /// + /// 3 + FieldOff, + /// + /// External reader trys to access secure element + /// + /// 3 + Transaction, + /// + /// Changing the emulated secure element type + /// + /// 3 + TypeChanged, + /// + /// Changing the card emulation mode + /// + /// 3 + CardEmulationChanged + } + /// + /// Enumeration for Nfc Filter type. + /// + /// 3 + public enum NfcSecureElementType + { + /// + /// Disable card emulation + /// + /// 3 + Disable = 0x00, + /// + /// SmartMX type card emulation (Embedded Secure Element) + /// + /// 3 + EmbeddedSE = 0x01, + /// + /// UICC type card emulation (Universal IC Card) + /// + /// 3 + Uicc = 0x02, + /// + /// SDCARD card emulation + /// + /// 3 + Sdcard = 0x03, + /// + /// Host based card emulation + /// + /// 3 + Hce = 0x04 + } + /// + /// Enumeration for Nfc discovered type. + /// + /// 3 + public enum NfcSecureElementCardEmulationMode + { + /// + /// Card Emulation mode OFF + /// + /// 3 + Off = 0x00, + /// + /// Card Emulation mode ON + /// + /// 3 + On = 0x01 + } + /// + /// Enumeration for SNEP(Simple NDEF Exchange Protocol) event. + /// + /// 3 + public enum NfcSnepEvent + { + /// + /// server or client stopped + /// + /// 3 + Stop = 0x00, + /// + /// server started or client connected + /// + /// 3 + Start = 0x01, + /// + /// server received get request + /// + /// 3 + Get = 0x02, + /// + /// server received put request + /// + /// 3 + Put = 0x03, + /// + /// service registered + /// + /// 3 + Register = 0x04, + /// + /// service unregistered + /// + /// 3 + Unregister = 0x05 + } + /// + /// Enumeration for SNEP request type. + /// + /// 3 + public enum NfcSnepRequestType + { + /// + /// get request + /// + /// 3 + Get = 0x01, + /// + /// put request + /// + /// 3 + Put = 0x02 + } + /// + /// Enumeration for NFC Card Emulation Category type. + /// + /// 3 + public enum NfcCardEmulationCategoryType + { + /// + /// NFC payment services + /// + /// 3 + Payment = 0x01, + /// + /// all other card emulation services + /// + /// 3 + Other = 0x02 + } + /// + /// Enumeration for NFC Card Emulation HCE(Host Card Emulation) event type. + /// + /// 3 + public enum NfcHceEvent + { + /// + /// HCE deactivated + /// + /// 3 + Deactivated = 0x00, + /// + /// HCE activated + /// + /// 3 + Activated = 0x01, + /// + /// HCE APDU(Application Protocol Data Unit) Received + /// + /// 3 + ApduReceived = 0x02 + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcErrorFactory.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcErrorFactory.cs new file mode 100644 index 0000000..7af0af5 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcErrorFactory.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.Nfc +{ + /// + /// Enumeration for Nfc Error. + /// + /// 3 + public enum NfcError + { + None = ErrorCode.None, + IoError = ErrorCode.IoError, + InvalidParameterError = ErrorCode.InvalidParameter, + OutOfMemoryError = ErrorCode.OutOfMemory, + TimedOutError = ErrorCode.TimedOut, + DeviceBusyError = ErrorCode.ResourceBusy, + NotSupportedError = ErrorCode.NotSupported, + PermissionDeniedError = ErrorCode.PermissionDenied, + OperationFailedError = -0x01C20000 | 0x01, + InvalidNdefMessageError = -0x01C20000 | 0x02, + InvalidRecordTypeError = -0x01C20000 | 0x03, + NoDeviceError = -0x01C20000 | 0x04, + NotActivatedError = -0x01C20000 | 0x05, + AlreadyActivatedError = -0x01C20000 | 0x06, + AlreadyDeactivatedError = -0x01C20000 | 0x07, + ReadOnlyNdefError = -0x01C20000 | 0x08, + NoSpaceOnNdefError = -0x01C20000 | 0x09, + NoNdefMessageError = -0x01C20000 | 0x0a, + NotNdefFormatError = -0x01C20000 | 0x0b, + SecurityRestrictedError = -0x01C20000 | 0x0c, + IllegalStateError = -0x01C20000 | 0x0d, + NotInitializedError = -0x01C20000 | 0x0e, + TagNotSupportedError = -0x01C20000 | 0x0f, + AidAlreadyRegisteredError = -0x01C20000 | 0x10 + } + + internal static class NfcErrorFactory + { + static internal void ThrowNfcException(int e) + { + ThrowException(e, false); + } + + static internal void ThrowNfcException(int e, int handle) + { + ThrowException(e, (handle < 0)); + } + + static private void ThrowException(int e, bool isHandleNull) + { + NfcError err = (NfcError)e; + + if (isHandleNull) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + + if (err == NfcError.InvalidParameterError) + { + throw new ArgumentException(err.ToString()); + } + else if (err == NfcError.NotSupportedError) + { + throw new NotSupportedException(); + } + else + { + throw new InvalidOperationException(err.ToString()); + } + } + + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEventArgs.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEventArgs.cs new file mode 100644 index 0000000..37195ab --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcEventArgs.cs @@ -0,0 +1,320 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// An extended EventArgs class which contains changed Nfc activation state. + /// + /// 3 + public class ActivationChangedEventArgs : EventArgs + { + private bool _activated = false; + + internal ActivationChangedEventArgs(bool activated) + { + _activated = activated; + } + + /// + /// The Nfc activation state. + /// + /// 3 + public bool Activated + { + get + { + return _activated; + } + } + } + + /// + /// An extended EventArgs class which contains changed Nfc tag discovered. + /// + /// 3 + public class TagDiscoveredEventArgs : EventArgs + { + private NfcDiscoveredType _type = NfcDiscoveredType.Detached; + private NfcTag _tag; + + internal TagDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr tagHandle) + { + _tag = new NfcTag(tagHandle); + } + + /// + /// The tag type. + /// + /// 3 + public NfcDiscoveredType Type + { + get + { + return _type; + } + } + + /// + /// Tag object + /// + /// 3 + public NfcTag Tag + { + get + { + return _tag; + } + } + } + + /// + /// An extended EventArgs class which contains changed Nfc p2p target discovered. + /// + /// 3 + public class P2pTargetDiscoveredEventArgs : EventArgs + { + private NfcDiscoveredType _type = NfcDiscoveredType.Detached; + private NfcP2p _p2pTarget; + + internal P2pTargetDiscoveredEventArgs(NfcDiscoveredType _type, IntPtr p2pTargetHandle) + { + _p2pTarget = new NfcP2p(p2pTargetHandle); + } + + /// + /// The p2p target type. + /// + /// 3 + public NfcDiscoveredType Type + { + get + { + return _type; + } + } + + /// + /// P2p object + /// + /// 3 + public NfcP2p P2pTarget + { + get + { + return _p2pTarget; + } + } + } + + /// + /// An extended EventArgs class which contains changed Nfc ndef discovered. + /// + /// 3 + public class NdefMessageDiscoveredEventArgs : EventArgs + { + private NfcNdefMessage _ndef; + + internal NdefMessageDiscoveredEventArgs(IntPtr messageHandle) + { + _ndef = new NfcNdefMessage(messageHandle); + } + + /// + /// The NdefMessage object that is most recently received via NFC p2p mode or tag mode + /// + /// 3 + public NfcNdefMessage NdefMessage + { + get + { + return _ndef; + } + } + } + + /// + /// An extended EventArgs class which contains changed Secure element event. + /// + /// 3 + public class SecureElementEventArgs : EventArgs + { + private NfcSecureElementEvent _eventType = NfcSecureElementEvent.StartTransaction; + + internal SecureElementEventArgs(NfcSecureElementEvent eventType) + { + _eventType = eventType; + } + + /// + /// The Nfc secure element event. + /// + /// 3 + public NfcSecureElementEvent EventType + { + get + { + return _eventType; + } + } + } + + /// + /// An extended EventArgs class which contains changed Secure element trasaction event. + /// + /// 3 + public class SecureElementTranscationEventArgs : EventArgs + { + private NfcSecureElementType _secureElementType = NfcSecureElementType.Disable; + byte[] _aid; + byte[] _param; + + internal SecureElementTranscationEventArgs(NfcSecureElementType secureElementType, byte[] aid, byte[] param) + { + _secureElementType = secureElementType; + _aid = aid; + _param = param; + } + + /// + /// The Nfc secure element type. + /// + /// 3 + public NfcSecureElementType SecureElementType + { + get + { + return _secureElementType; + } + } + /// + /// The Nfc secure element aid. + /// + /// 3 + public byte[] ApplicationID + { + get + { + return _aid; + } + } + /// + /// The Nfc secure element param. + /// + /// 3 + public byte[] Param + { + get + { + return _param; + } + } + } + + /// + /// An extended EventArgs class which contains changed HCE(Host Card Emulation) event. + /// + /// 3 + public class HostCardEmulationEventArgs : EventArgs + { + private NfcSecureElement _se; + private NfcHceEvent _hceEvent = NfcHceEvent.Deactivated; + private byte[] _apdu; + + internal HostCardEmulationEventArgs(IntPtr seHandle, NfcHceEvent hcdEvent, byte[] apdu) + { + _se = new NfcSecureElement(seHandle); + _hceEvent = hcdEvent; + _apdu = apdu; + } + + /// + /// The Nfc secure element. + /// + /// 3 + public NfcSecureElement SecureElement + { + get + { + return _se; + } + } + /// + /// The Nfc hce event. + /// + /// 3 + public NfcHceEvent HceEvent + { + get + { + return _hceEvent; + } + } + /// + /// The Nfc apdu(Application Protocol Data Unit) + /// + /// 3 + public byte[] Apdu + { + get + { + return _apdu; + } + } + } + + /// + /// An extended EventArgs class which contains changed HCE(Host Card Emulation) event. + /// + /// 3 + public class P2pDataReceivedEventArgs : EventArgs + { + private NfcP2p _p2pTarget; + private NfcNdefMessage _ndefMessage; + + internal P2pDataReceivedEventArgs(IntPtr p2pHandle, IntPtr ndefHandle) + { + _p2pTarget = new NfcP2p(p2pHandle); + _ndefMessage = new NfcNdefMessage(ndefHandle); + } + + /// + /// The Nfc p2p target. + /// + /// 3 + public NfcP2p P2pTarget + { + get + { + return _p2pTarget; + } + } + /// + /// The Nfc ndef message. + /// + /// 3 + public NfcNdefMessage NdefMessage + { + get + { + return _ndefMessage; + } + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs new file mode 100755 index 0000000..c8ad62e --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManager.cs @@ -0,0 +1,432 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Tizen.System; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for NFC management. It allows applications to use NFC service. + /// + /// 3 + /// http://tizen.org/privilege/nfc + static public class NfcManager + { + /// + /// Whether NFC is supported. + /// + /// 3 + static public bool IsSupported + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.IsSupported; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// NFC Activation state. + /// + /// 3 + static public bool IsActivated + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.IsActivated; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// The Tag Filter type. + /// + /// 3 + static public NfcTagFilterType TagFilterType + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported); + + if (!isNfcSupported || !isTagSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.TagFilterType; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + set + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported); + + if (!isNfcSupported || !isTagSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.TagFilterType = value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// The Secure Element type. + /// + /// 3 + /// http://tizen.org/privilege/nfc.cardemulation + static public NfcSecureElementType SecureElementType + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isCeSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported); + + if (!isNfcSupported || !isCeSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.SecureElementType; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + set + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isCeSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported); + + if (!isNfcSupported || !isCeSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.SecureElementType = value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// Enable or disable the system handling for tag and target discovered event. + /// + /// 3 + /// http://tizen.org/privilege/nfc + static public bool SystemHandlerEnabled + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.SystemHandlerEnabled; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + set + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.SystemHandlerEnabled = value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// The cached Ndef Message. + /// + /// 3 + static public NfcNdefMessage CachedNdefMessage + { + get + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.CachedNdefMessage; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// Gets Tag adapter object. + /// + /// 3 + static public NfcTagAdapter GetTagAdapter() + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isTagSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.tag", out isTagSupported); + + if (!isNfcSupported || !isTagSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.TagAdapter; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + + /// + /// Gets P2p adapter object. + /// + /// 3 + static public NfcP2pAdapter GetP2pAdapter() + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isP2pSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.p2p", out isP2pSupported); + + if (!isNfcSupported || !isP2pSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.P2pAdapter; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + + /// + /// Gets Card Emulation adepter object. + /// + /// 3 + static public NfcCardEmulationAdapter GetCardEmulationAdapter() + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + bool isCeSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc.cardemulation", out isCeSupported); + + if (!isNfcSupported || !isCeSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.CardEmulationAdapter; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + + /// + /// Activates Nfc asynchronously. + /// + /// 3 + /// A task indicates whether the Activate method is done or not. + /// http://tizen.org/privilege/nfc.admin + static public Task SetActivationAsync(bool activation) + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + return NfcManagerImpl.Instance.SetActivationAsync(activation); + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + + /// + /// The Activation changed event. + /// + /// 3 + static public event EventHandler ActivationChanged + { + add + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.ActivationChanged += value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + remove + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.ActivationChanged -= value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + + /// + /// The Ndef discovered event. + /// + /// 3 + static public event EventHandler NdefMessageDiscovered + { + add + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.NdefMessageDiscovered += value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + remove + { + bool isNfcSupported = SystemInfo.TryGetValue("http://tizen.org/feature/network.nfc", out isNfcSupported); + + if (!isNfcSupported) + { + throw new NotSupportedException(); + } + + try + { + NfcManagerImpl.Instance.NdefMessageDiscovered -= value; + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerEvent.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerEvent.cs new file mode 100644 index 0000000..7150daa --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerEvent.cs @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Network.Nfc +{ + internal static class EventHandlerExtension + { + internal static void SafeInvoke(this EventHandler evt, object sender, EventArgs e) + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + internal static void SafeInvoke(this EventHandler evt, object sender, T e) where T : EventArgs + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + } + + internal partial class NfcManagerImpl + { + private event EventHandler _activationChanged; + private event EventHandler _ndefMessageDiscovered; + + private Interop.Nfc.ActivationChangedCallback _activationChangedCallback; + private Interop.Nfc.NdefMessageDiscoveredCallback _ndefMessageDiscoveredCallback; + + internal event EventHandler ActivationChanged + { + add + { + if (_activationChanged == null) + { + RegisterActivationChangedEvent(); + } + _activationChanged += value; + } + remove + { + _activationChanged -= value; + if (_activationChanged == null) + { + UnregisterActivationChangedEvent(); + } + } + } + + internal event EventHandler NdefMessageDiscovered + { + add + { + if (_ndefMessageDiscovered == null) + { + RegisterNdefMessageDiscoveredEvent(); + } + _ndefMessageDiscovered += value; + } + remove + { + _ndefMessageDiscovered -= value; + if (_ndefMessageDiscovered == null) + { + UnregisterNdefMessageDiscoveredEvent(); + } + } + } + + internal void RemoveAllRegisteredEvent() + { + //unregister all remaining events when this object is released. + if (_activationChanged != null) + { + UnregisterActivationChangedEvent(); + } + } + + private void RegisterActivationChangedEvent() + { + _activationChangedCallback = (bool activated, IntPtr userData) => + { + bool isActivated = activated; + ActivationChangedEventArgs e = new ActivationChangedEventArgs(isActivated); + _activationChanged.SafeInvoke(null, e); + }; + int ret = Interop.Nfc.SetActivationChangedCallback(_activationChangedCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set activation changed callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterActivationChangedEvent() + { + Interop.Nfc.UnsetActivationChangedCallback(); + } + + private void RegisterNdefMessageDiscoveredEvent() + { + _ndefMessageDiscoveredCallback = (IntPtr ndefMessageHandle, IntPtr userData) => + { + NdefMessageDiscoveredEventArgs e = new NdefMessageDiscoveredEventArgs(ndefMessageHandle); + _ndefMessageDiscovered.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetNdefDiscoveredCallback(_ndefMessageDiscoveredCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set ndef message discovered callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterNdefMessageDiscoveredEvent() + { + Interop.Nfc.UnsetNdefDiscoveredCallback(); + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerImpl.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerImpl.cs new file mode 100755 index 0000000..702f1b2 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcManagerImpl.cs @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Network.Nfc +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Network.Nfc"; + } + + internal static class NfcConvertUtil + { + internal static byte[] IntLengthIntPtrToByteArray(IntPtr nativeValue, int length) + { + byte[] value = new byte[length]; + if (nativeValue != IntPtr.Zero) + { + Marshal.Copy(nativeValue, value, 0, length); + } + return value; + } + + internal static byte[] UintLengthIntPtrToByteArray(IntPtr nativeValue, uint length) + { + byte[] value = new byte[length]; + + if (nativeValue != IntPtr.Zero) + { + for (int i = 0; i < length; i++) + { + value[i] = Marshal.ReadByte(nativeValue); + nativeValue += sizeof(byte); + } + } + return value; + } + } + + internal partial class NfcManagerImpl : IDisposable + { + private static readonly NfcManagerImpl _instance = new NfcManagerImpl(); + private static readonly NfcTagAdapter _instanceTagAdapter = new NfcTagAdapter(); + private static readonly NfcP2pAdapter _instanceP2pAdapter = new NfcP2pAdapter(); + private static readonly NfcCardEmulationAdapter _instanceCardEmulationAdapter = new NfcCardEmulationAdapter(); + + private Dictionary _callback_map = new Dictionary(); + private int _requestId = 0; + private bool disposed = false; + + internal static NfcManagerImpl Instance + { + get + { + return _instance; + } + } + + internal NfcTagAdapter TagAdapter + { + get + { + return _instanceTagAdapter; + } + } + + internal NfcP2pAdapter P2pAdapter + { + get + { + return _instanceP2pAdapter; + } + } + + internal NfcCardEmulationAdapter CardEmulationAdapter + { + get + { + return _instanceCardEmulationAdapter; + } + } + + internal bool IsSupported + { + get + { + bool support = Interop.Nfc.IsSupported(); + + return support; + } + } + + internal bool IsActivated + { + get + { + bool active = Interop.Nfc.IsActivated(); + + return active; + } + } + + internal NfcNdefMessage CachedNdefMessage + { + get + { + IntPtr ndef = IntPtr.Zero; ; + int ret = Interop.Nfc.GetCachedMessage(out ndef); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get cached ndef message, Error - " + (NfcError)ret); + } + + NfcNdefMessage ndefMessage = new NfcNdefMessage(ndef); + return ndefMessage; + } + } + + internal NfcTagFilterType TagFilterType + { + get + { + int type = Interop.Nfc.GetTagFilter(); + + return (NfcTagFilterType)type; + } + set + { + Interop.Nfc.SetTagFilter((int)value); + } + } + + internal NfcSecureElementType SecureElementType + { + get + { + int type; + int ret = Interop.Nfc.GetSecureElementType(out type); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get secure element type, Error - " + (NfcError)ret); + } + return (NfcSecureElementType)type; + } + set + { + int ret = Interop.Nfc.SetSecureElementType((int)value); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set secure element type, Error - " + (NfcError)ret); + } + } + } + + internal bool SystemHandlerEnabled + { + get + { + bool systemhandler = Interop.Nfc.IsSystemHandlerEnabled(); + + return systemhandler; + } + set + { + int ret = Interop.Nfc.SetSystemHandlerEnable(value); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to enable system handler, Error - " + (NfcError)ret); + } + } + } + + private NfcManagerImpl() + { + Initialize(); + } + + ~NfcManagerImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + Deinitialize(); + disposed = true; + } + + private void Initialize() + { + int ret = Interop.Nfc.Initialize(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to Initialize Nfc, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + private void Deinitialize() + { + int ret = Interop.Nfc.Deinitialize(); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to Deinitialize Nfc, Error - " + (NfcError)ret); + } + } + + internal Task SetActivationAsync(bool activation) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = IntPtr.Zero; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "nfc activated"); + if (error != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Error occurs during Nfc activating, " + (NfcError)error); + task.SetException(new InvalidOperationException("Error occurs during Nfc activating, " + (NfcError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + + int ret = Interop.Nfc.SetActivation(activation, _callback_map[id], id); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to activate nfc, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + return task.Task; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefMessage.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefMessage.cs new file mode 100755 index 0000000..80d1574 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefMessage.cs @@ -0,0 +1,207 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for Ndef Message information. It allows applications to use Ndef Message information. + /// + /// 3 + public class NfcNdefMessage : IDisposable + { + private bool disposed = false; + private IntPtr _messageHandle = IntPtr.Zero; + private List _recordList = new List(); + + /// + /// The number of record in NDEF message. + /// + /// 3 + public int RecordCount + { + get + { + int recordCount; + int ret = Interop.Nfc.NdefMessage.GetRecordCount(_messageHandle, out recordCount); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get record count, Error - " + (NfcError)ret); + } + return recordCount; + } + } + + /// + /// Creates a object for the access point. + /// + /// 3 + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public NfcNdefMessage() + { + int ret = Interop.Nfc.NdefMessage.Create(out _messageHandle); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to create Ndef message, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + internal NfcNdefMessage(IntPtr messageHandle) + { + _messageHandle = messageHandle; + } + + ~NfcNdefMessage() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + int ret = Interop.Nfc.NdefMessage.Destroy(_messageHandle); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy ndef message, Error - " + (NfcError)ret); + } + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Appends a record into NDEF message. + /// + /// 3 + /// Whether appending the record succeeded. + /// The NfcNdefRecord object that will be appended into NDEF message. + public bool AppendRecord(NfcNdefRecord record) + { + bool isSuccess = true; + + int ret = Interop.Nfc.NdefMessage.AppendRecord(_messageHandle, record.GetHandle()); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to append record, Error - " + (NfcError)ret); + isSuccess = false; + } + else + { + _recordList.Add(record); + } + + return isSuccess; + } + + /// + /// Inserts a record at index into NDEF message. + /// + /// 3 + /// Whether insterting the record succeeded. + /// The index of record ( starts from 0 ). + /// The NfcNdefRecord object that will be appended into NDEF message. + public bool InsertRecord(int index, NfcNdefRecord record) + { + bool isSuccess = true; + + int ret = Interop.Nfc.NdefMessage.InsertRecord(_messageHandle, index, record.GetHandle()); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to insert record, Error - " + (NfcError)ret); + isSuccess = false; + } + else + { + _recordList.Add(record); + } + + return isSuccess; + } + + /// + /// Inserts a record at index into NDEF message. + /// + /// 3 + /// Whether removing the record succeeded. + /// The index of record ( starts from 0 ). + public bool RemoveRecord(int index) + { + bool isSuccess = true; + + int ret = Interop.Nfc.NdefMessage.RemoveRecord(_messageHandle, index); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to remove record, Error - " + (NfcError)ret); + isSuccess = false; + } + + return isSuccess; + } + + /// + /// Gets record by index. + /// + /// 3 + /// The NfcNdefRecord object. + /// The index of record ( starts from 0 ). + public NfcNdefRecord GetRecord(int index) + { + IntPtr recordHandle; + NfcNdefRecord recordObject = null; + + int ret = Interop.Nfc.NdefMessage.GetRecord(_messageHandle, index, out recordHandle); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to remove record, Error - " + (NfcError)ret); + } + + foreach (NfcNdefRecord recordElement in _recordList) + { + if(recordElement.GetHandle() == recordHandle) + { + Log.Debug(Globals.LogTag, "Find record handle"); + recordObject = recordElement; + break; + } + } + + return recordObject; + } + + internal IntPtr GetHandle() + { + return _messageHandle; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefRecord.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefRecord.cs new file mode 100755 index 0000000..6387c79 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcNdefRecord.cs @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for Ndef Record information. It allows applications to use Ndef Record information. + /// + /// 3 + public class NfcNdefRecord : IDisposable + { + private bool disposed = false; + private IntPtr _recordHandle = IntPtr.Zero; + + /// + /// The record ID. + /// + /// 3 + public byte[] Id + { + get + { + IntPtr id; + int idLength; + int ret = Interop.Nfc.NdefRecord.GetId(_recordHandle, out id, out idLength); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get id, Error - " + (NfcError)ret); + return null; + } + + return NfcConvertUtil.IntLengthIntPtrToByteArray(id, idLength); + } + } + + /// + /// The record payload. + /// + /// 3 + public byte[] Payload + { + get + { + IntPtr payload; + uint payloadLength; + int ret = Interop.Nfc.NdefRecord.GetPayload(_recordHandle, out payload, out payloadLength); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get payload, Error - " + (NfcError)ret); + return null; + } + + return NfcConvertUtil.UintLengthIntPtrToByteArray(payload, payloadLength); + } + } + + /// + /// The record type. + /// + /// 3 + public byte[] Type + { + get + { + IntPtr type; + int typeSize; + int ret = Interop.Nfc.NdefRecord.GetType(_recordHandle, out type, out typeSize); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get payload, Error - " + (NfcError)ret); + return null; + } + + return NfcConvertUtil.IntLengthIntPtrToByteArray(type, typeSize); + } + } + + /// + /// The record TNF(Type Name Format) value. + /// + /// 3 + public NfcRecordTypeNameFormat Tnf + { + get + { + int tnf; + int ret = Interop.Nfc.NdefRecord.GetTnf(_recordHandle, out tnf); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get tnf, Error - " + (NfcError)ret); + } + return (NfcRecordTypeNameFormat)tnf; + } + } + + /// + /// The text of text type Ndef record. + /// + /// 3 + public string Text + { + get + { + string text; + int ret = Interop.Nfc.NdefRecord.GetText(_recordHandle, out text); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get text, Error - " + (NfcError)ret); + } + return text; + } + } + + /// + /// The language code of text type Ndef record. + /// + /// 3 + public string LanguageCode + { + get + { + string languageCode; + int ret = Interop.Nfc.NdefRecord.GetLanguageCode(_recordHandle, out languageCode); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get language code, Error - " + (NfcError)ret); + } + return languageCode; + } + } + + /// + /// The encoding type of text type Ndef record. + /// + /// 3 + public NfcEncodeType EncodeType + { + get + { + int encodeType; + int ret = Interop.Nfc.NdefRecord.GetEncodeType(_recordHandle, out encodeType); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get encode type, Error - " + (NfcError)ret); + } + return (NfcEncodeType)encodeType; + } + } + + /// + /// The URI of uri type Ndef record. + /// + /// 3 + public string Uri + { + get + { + string uri; + int ret = Interop.Nfc.NdefRecord.GetUri(_recordHandle, out uri); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get uri, Error - " + (NfcError)ret); + } + return uri; + } + } + + /// + /// The mime type of mime type Ndef record. + /// + /// 3 + public string MimeType + { + get + { + string mimeType; + int ret = Interop.Nfc.NdefRecord.GetMimeType(_recordHandle, out mimeType); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get mime type, Error - " + (NfcError)ret); + } + return mimeType; + } + } + + /// + /// Creates a record with given parameter value. + /// + /// 3 + /// The type name format. + /// The specified type name. + /// The record ID. + /// The payload of this record. + /// The byte size of payload. + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public NfcNdefRecord(NfcRecordTypeNameFormat format, byte[] type, byte[] id, byte[] payload, uint paloadLength) + { + int ret = Interop.Nfc.NdefRecord.Create(out _recordHandle, (int)format, type, type.Length, id, id.Length, payload, paloadLength); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to create Ndef record, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Creates a record with text type payload. + /// + /// 3 + /// The encoded text. + /// The language code string value followed by IANA[RFC 3066] (ex: en-US, ko-KR). + /// The encoding type. + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public NfcNdefRecord(string text, string languageCode, NfcEncodeType encode) + { + int ret = Interop.Nfc.NdefRecord.CreateText(out _recordHandle, text, languageCode, (int)encode); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to create ndef Text record, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Creates a record with text type payload. + /// + /// 3 + /// The URI string that will be stored in the payload. + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public NfcNdefRecord(string uri) + { + int ret = Interop.Nfc.NdefRecord.CreateUri(out _recordHandle, uri); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to create ndef Uri record, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + /// + /// Creates a record with text type payload. + /// + /// 3 + /// The mime type [RFC 2046] (ex. text/plain, image/jpeg ) This value is stored in type field. + /// The data in form of bytes array. + /// The size of data. + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public NfcNdefRecord(string mimeType, byte[] data, uint dataSize) + { + int ret = Interop.Nfc.NdefRecord.CreateMime(out _recordHandle, mimeType, data, dataSize); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to create ndef Mime record, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + ~NfcNdefRecord() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + int ret = Interop.Nfc.NdefRecord.Destroy(_recordHandle); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy ndef record, Error - " + (NfcError)ret); + } + } + //Free unmanaged objects + disposed = true; + } + + internal IntPtr GetHandle() + { + return _recordHandle; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2p.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2p.cs new file mode 100755 index 0000000..90a1c4f --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2p.cs @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for managing the p2p target information. + /// + /// 3 + public class NfcP2p : IDisposable + { + private IntPtr _p2pTargetHandle = IntPtr.Zero; + private bool disposed = false; + + private event EventHandler _p2pDataReceived; + + private Interop.Nfc.P2pDataReceivedCallback _p2pDataReceivedCallback; + + /// + /// The event for receiving data from NFC peer-to-peer target. + /// + /// 3 + public event EventHandler P2pDataReceived + { + add + { + _p2pDataReceived += value; + } + remove + { + _p2pDataReceived -= value; + } + } + + internal NfcP2p(IntPtr handle) + { + _p2pTargetHandle = handle; + RegisterP2pDataReceivedEvent(); + } + + ~NfcP2p() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + UnregisterP2pDataReceivedEvent(); + } + //Free unmanaged objects + disposed = true; + } + + internal IntPtr GetHandle() + { + return _p2pTargetHandle; + } + + /// + /// Sends data to NFC peer-to-peer target. + /// + /// 3 + /// NfcNdefMessage object. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task SendNdefMessageAsync(NfcNdefMessage ndefMessage) + { + var task = new TaskCompletionSource(); + + Interop.Nfc.VoidCallback callback = (int result, IntPtr userData) => + { + task.SetResult((NfcError)result); + return; + }; + + int ret = Interop.Nfc.P2p.Send(_p2pTargetHandle, ndefMessage.GetHandle(), callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to write ndef message, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return task.Task; + } + + private void RegisterP2pDataReceivedEvent() + { + _p2pDataReceivedCallback = (IntPtr p2pTargetHandle, IntPtr ndefMessageHandle, IntPtr userData) => + { + P2pDataReceivedEventArgs e = new P2pDataReceivedEventArgs(p2pTargetHandle, ndefMessageHandle); + _p2pDataReceived.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.P2p.SetDataReceivedCallback(_p2pTargetHandle, _p2pDataReceivedCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set p2p target discovered callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterP2pDataReceivedEvent() + { + Interop.Nfc.P2p.UnsetDataReceivedCallback(_p2pTargetHandle); + } + } + + /// + /// A class for managing the snep(Simple NDEF Exchange Protocol) information. + /// + /// 3 + public class NfcSnep : IDisposable + { + private IntPtr _snepHandle = IntPtr.Zero; + private bool disposed = false; + + internal NfcSnep(IntPtr handle) + { + _snepHandle = handle; + } + + ~NfcSnep() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + internal IntPtr GetHandle() + { + return _snepHandle; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2pAdapter.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2pAdapter.cs new file mode 100755 index 0000000..0c9945b --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcP2pAdapter.cs @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for NFC P2P(Peer to Peer) mode. It allows applications to handle P2P informations. + /// + /// 3 + /// http://tizen.org/privilege/nfc + public class NfcP2pAdapter : IDisposable + { + private NfcP2p _p2pTarget; + private bool disposed = false; + + private event EventHandler _p2pTargetDiscovered; + + private Interop.Nfc.P2pTargetDiscoveredCallback _p2pTargetDiscoveredCallback; + + /// + /// The event for receiving NFC peer-to-peer target discovered notification. + /// + /// 3 + public event EventHandler P2pTargetDiscovered + { + add + { + _p2pTargetDiscovered += value; + } + remove + { + _p2pTargetDiscovered -= value; + } + } + + internal NfcP2pAdapter() + { + RegisterP2pTargetDiscoveredEvent(); + } + + ~NfcP2pAdapter() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + UnregisterP2pTargetDiscoveredEvent(); + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Gets current connected p2p target. + /// + /// 3 + /// NfcP2p object. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public NfcP2p GetConnectedTarget() + { + IntPtr targetHandle = IntPtr.Zero; + int ret = Interop.Nfc.GetConnectedTarget(out targetHandle); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get connected p2p target, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + _p2pTarget = new NfcP2p(targetHandle); + + return _p2pTarget; + } + + private void RegisterP2pTargetDiscoveredEvent() + { + _p2pTargetDiscoveredCallback = (int type, IntPtr p2pTargetHandle, IntPtr userData) => + { + NfcDiscoveredType tagType = (NfcDiscoveredType)type; + P2pTargetDiscoveredEventArgs e = new P2pTargetDiscoveredEventArgs(tagType, p2pTargetHandle); + _p2pTargetDiscovered.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetP2pTargetDiscoveredCallback(_p2pTargetDiscoveredCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set p2p target discovered callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterP2pTargetDiscoveredEvent() + { + Interop.Nfc.UnsetP2pTargetDiscoveredCallback(); + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcSecureElement.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcSecureElement.cs new file mode 100755 index 0000000..0baa11a --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcSecureElement.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for managing the Secure Element information. + /// + /// 3 + public class NfcSecureElement : IDisposable + { + private IntPtr _secureElementHandle = IntPtr.Zero; + private bool disposed = false; + + internal NfcSecureElement(IntPtr handle) + { + _secureElementHandle = handle; + } + + ~NfcSecureElement() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Send APDU(Application Protocol Data Unit) response to CLF(Contactless Front-end). + /// + /// 3 + /// The bytes array of response data. + /// The size of response bytes array. + /// http://tizen.org/privilege/nfc.cardemulation + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void HceSendApduResponse(byte[] response, uint responseLength) + { + int ret = Interop.Nfc.CardEmulation.HceSendApduRespondse(_secureElementHandle, response, responseLength); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to hcd send apdu response, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + } + + internal IntPtr GetHandle() + { + return _secureElementHandle; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs new file mode 100755 index 0000000..c0008c8 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTag.cs @@ -0,0 +1,298 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for managing the Tag information. + /// + /// 3 + public class NfcTag : IDisposable + { + private bool disposed = false; + private IntPtr _tagHandle = IntPtr.Zero; + + /// + /// The type of NFC tag. + /// + /// 3 + public NfcTagType Type + { + get + { + int type; + int ret = Interop.Nfc.Tag.GetType(_tagHandle, out type); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get tag type, Error - " + (NfcError)ret); + } + return (NfcTagType)type; + } + } + + /// + /// Whether the given NFC tag supports NDEF messages. + /// + /// 3 + public bool IsSupportNdef + { + get + { + bool isSupport; + int ret = Interop.Nfc.Tag.IsSupportNdef(_tagHandle, out isSupport); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get support state, Error - " + (NfcError)ret); + } + return isSupport; + + } + } + + /// + /// The maximum NDEF message size that can be stored in NFC tag. + /// + /// 3 + public uint MaximumNdefSize + { + get + { + uint maxSize; + int ret = Interop.Nfc.Tag.GetMaximumNdefSize(_tagHandle, out maxSize); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get max ndef size, Error - " + (NfcError)ret); + } + return maxSize; + } + } + + /// + /// The size of NDEF message that stored in the tag. + /// + /// 3 + public uint NdefSize + { + get + { + uint ndefSize; + int ret = Interop.Nfc.Tag.GetNdefSize(_tagHandle, out ndefSize); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get ndef size, Error - " + (NfcError)ret); + } + return ndefSize; + } + } + + internal NfcTag(IntPtr handle) + { + _tagHandle = handle; + } + + ~NfcTag() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Retrieves all tag information. + /// + /// 3 + /// List of NfcTagInformation objects. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public IEnumerable ForeachInformation() + { + List infoList = new List(); + Interop.Nfc.TagInformationCallback callback = (IntPtr key, IntPtr infoValue, int valueSize, IntPtr userData) => + { + if (key != IntPtr.Zero && infoValue != IntPtr.Zero) + { + NfcTagInformation tagInfo = new NfcTagInformation(Marshal.PtrToStringAnsi(key), new byte[valueSize]); + + Marshal.Copy(infoValue, tagInfo.InformationValue, 0, valueSize); + + infoList.Add(tagInfo); + + return true; + } + return false; + }; + + int ret = Interop.Nfc.Tag.ForeachInformation(_tagHandle, callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get all Tag information, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return infoList; + } + + /// + /// Transceives the data of the raw format card. + /// + /// 3 + /// The binary data for parameter or additional commands. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task TransceiveAsync(byte[] buffer) + { + var task = new TaskCompletionSource(); + + byte[] resultBuffer = null; + Interop.Nfc.TagTransceiveCompletedCallback callback = (int result, IntPtr resultData, int dataSize, IntPtr userData) => + { + if (result == (int)NfcError.None) + { + resultBuffer = new byte[dataSize]; + Marshal.Copy(resultData, resultBuffer, 0, dataSize); + task.SetResult(resultBuffer); + } + return; + }; + + int ret = Interop.Nfc.Tag.Transceive(_tagHandle, buffer, buffer.Length, callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to transceive data, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return task.Task; + } + + /// + /// Reads NDEF formatted data from NFC tag. + /// + /// 3 + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public Task ReadNdefMessageAsync() + { + var task = new TaskCompletionSource(); + + NfcNdefMessage ndefMsg = null; + Interop.Nfc.TagReadCompletedCallback callback = (int result, IntPtr ndefMessage, IntPtr userData) => + { + if (result == (int)NfcError.None) + { + ndefMsg = new NfcNdefMessage(ndefMessage); + task.SetResult(ndefMsg); + + return true; + } + return false; + }; + + int ret = Interop.Nfc.Tag.ReadNdef(_tagHandle, callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to read ndef message, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return task.Task; + } + + /// + /// Writes NDEF formatted data. + /// + /// 3 + /// The NfcNdefMessage object. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task WriteNdefMessageAsync(NfcNdefMessage ndefMessage) + { + var task = new TaskCompletionSource(); + + Interop.Nfc.VoidCallback callback = (int result, IntPtr userData) => + { + task.SetResult((NfcError)result); + return; + }; + + int ret = Interop.Nfc.Tag.WriteNdef(_tagHandle, ndefMessage.GetHandle(), callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to write ndef message, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return task.Task; + } + + /// + /// Formats the detected tag that can store NDEF message. + /// + /// 3 + /// The key value that may need to format the tag. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task FormatNdefMessageAsync(byte[] keyValue) + { + var task = new TaskCompletionSource(); + + Interop.Nfc.VoidCallback callback = (int result, IntPtr userData) => + { + task.SetResult((NfcError)result); + return; + }; + + int ret = Interop.Nfc.Tag.FormatNdef(_tagHandle, keyValue, keyValue.Length, callback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to format ndef message, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + + return task.Task; + } + } +} diff --git a/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTagAdapter.cs b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTagAdapter.cs new file mode 100755 index 0000000..9a36264 --- /dev/null +++ b/src/Tizen.Network.Nfc/Tizen.Network.Nfc/NfcTagAdapter.cs @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Nfc +{ + /// + /// A class for NFC Tag mode. It allows applications to handle Tag informations. + /// + /// 3 + /// http://tizen.org/privilege/nfc + public class NfcTagAdapter : IDisposable + { + private NfcTag _tag; + private bool disposed = false; + + private event EventHandler _tagDiscovered; + + private Interop.Nfc.TagDiscoveredCallback _tagDiscoveredCallback; + + /// + /// The event for receiving tag discovered notification. + /// + /// 3 + public event EventHandler TagDiscovered + { + add + { + _tagDiscovered += value; + } + remove + { + _tagDiscovered -= value; + } + } + + internal NfcTagAdapter() + { + RegisterTagDiscoveredEvent(); + } + + ~NfcTagAdapter() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + UnregisterTagDiscoveredEvent(); + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Gets current connected tag. + /// + /// 3 + /// NfcTag object. + /// http://tizen.org/privilege/nfc + /// Thrown when Nfc is not supported. + /// Thrown when the method failed due to invalid operation. + public NfcTag GetConnectedTag() + { + IntPtr tagHandle = IntPtr.Zero; + int ret = Interop.Nfc.GetConnectedTag(out tagHandle); + + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to get connected tag, Error - " + (NfcError)ret); + NfcErrorFactory.ThrowNfcException(ret); + } + _tag = new NfcTag(tagHandle); + + return _tag; + } + + private void RegisterTagDiscoveredEvent() + { + _tagDiscoveredCallback = (int type, IntPtr tagHandle, IntPtr userData) => + { + NfcDiscoveredType tagType = (NfcDiscoveredType)type; + TagDiscoveredEventArgs e = new TagDiscoveredEventArgs(tagType, tagHandle); + _tagDiscovered.SafeInvoke(null, e); + }; + + int ret = Interop.Nfc.SetTagDiscoveredCallback(_tagDiscoveredCallback, IntPtr.Zero); + if (ret != (int)NfcError.None) + { + Log.Error(Globals.LogTag, "Failed to set tag discovered callback, Error - " + (NfcError)ret); + } + } + + private void UnregisterTagDiscoveredEvent() + { + Interop.Nfc.UnsetTagDiscoveredCallback(); + } + } +} diff --git a/src/Tizen.Network.Nsd/Interop/Interop.Libraries.cs b/src/Tizen.Network.Nsd/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..dd08041 --- /dev/null +++ b/src/Tizen.Network.Nsd/Interop/Interop.Libraries.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Dnssd = "libnsd-dns-sd.so.0"; + public const string Ssdp = "libnsd-ssdp.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Nsd/Interop/Interop.Nsd.cs b/src/Tizen.Network.Nsd/Interop/Interop.Nsd.cs new file mode 100755 index 0000000..5979c1d --- /dev/null +++ b/src/Tizen.Network.Nsd/Interop/Interop.Nsd.cs @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Network.Nsd; + +/// +/// Interop class for Nsd +/// +internal static partial class Interop +{ + /// + /// Nsd Native Apis + /// + internal static partial class Nsd + { + internal static class Dnssd + { + //Callback for event + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceRegisteredCallback(DnssdError result, uint service, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceFoundCallback(DnssdServiceState state, uint service, IntPtr userData); + + //Dns-sd + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_deinitialize")] + internal static extern int Deinitialize(); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_create_local_service")] + internal static extern int CreateService(string type, out uint service); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_destroy_local_service")] + internal static extern int DestroyService(uint service); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_name")] + internal static extern int SetName(uint service, string name); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_port")] + internal static extern int SetPort(uint service, int port); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_add_txt_record")] + internal static extern int AddTxtRecord(uint service, string key, ushort length, byte[] value); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_remove_txt_record")] + internal static extern int RemoveTxtRecord(uint service, string key); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_set_record")] + internal static extern int SetRecord(uint service, ushort type, ushort length, byte[] data); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_unset_record")] + internal static extern int UnsetRecord(uint service, ushort type); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_register_local_service")] + internal static extern int RegisterService(uint service, ServiceRegisteredCallback callback, IntPtr userData); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_deregister_local_service")] + internal static extern int DeregisterService(uint service); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_start_browsing_service")] + internal static extern int StartBrowsing(string type, out uint browser, ServiceFoundCallback callback, IntPtr userData); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_stop_browsing_service")] + internal static extern int StopBrowsing(uint browser); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_type")] + internal static extern int GetType(uint service, out string type); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_name")] + internal static extern int GetName(uint service, out string name); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_ip")] + internal static extern int GetIP(uint service, out string ipV4, out string ipV6); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_port")] + internal static extern int GetPort(uint service, out int port); + [DllImport(Libraries.Dnssd, EntryPoint = "dnssd_service_get_all_txt_record")] + internal static extern int GetAllTxtRecord(uint service, out ushort length, out byte[] value); + } + + internal static class Ssdp + { + //Callback for event + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceRegisteredCallback(SsdpError result, uint service, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceFoundCallback(SsdpServiceState state, uint service, IntPtr userData); + + //Ssdp + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_deinitialize")] + internal static extern int Deinitialize(); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_create_local_service")] + internal static extern int CreateService(string target, out uint service); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_destroy_local_service")] + internal static extern int DestroyService(uint service); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_set_usn")] + internal static extern int SetUsn(uint service, string usn); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_set_url")] + internal static extern int SetUrl(uint service, string url); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_target")] + internal static extern int GetTarget(uint service, out string target); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_usn")] + internal static extern int GetUsn(uint service, out string usn); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_service_get_url")] + internal static extern int GetUrl(uint service, out string url); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_register_local_service")] + internal static extern int RegisterService(uint service, ServiceRegisteredCallback callback, IntPtr userData); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_deregister_local_service")] + internal static extern int DeregisterService(uint service); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_start_browsing_service")] + internal static extern int StartBrowsing(string target, out uint browser, ServiceFoundCallback callback, IntPtr userData); + [DllImport(Libraries.Ssdp, EntryPoint = "ssdp_stop_browsing_service")] + internal static extern int StopBrowsing(uint browser); + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd.csproj b/src/Tizen.Network.Nsd/Tizen.Network.Nsd.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd.sln b/src/Tizen.Network.Nsd/Tizen.Network.Nsd.sln new file mode 100755 index 0000000..931427d --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Nsd", "Tizen.Network.Nsd.csproj", "{7AA86C38-3C2A-4701-91CF-4B298D0235A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{41BF88B5-6B3D-4DCA-887D-4EAEF94B4CE1}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{C216D010-4253-42FC-8630-28E0A612BCD6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7AA86C38-3C2A-4701-91CF-4B298D0235A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AA86C38-3C2A-4701-91CF-4B298D0235A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AA86C38-3C2A-4701-91CF-4B298D0235A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AA86C38-3C2A-4701-91CF-4B298D0235A3}.Release|Any CPU.Build.0 = Release|Any CPU + {41BF88B5-6B3D-4DCA-887D-4EAEF94B4CE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41BF88B5-6B3D-4DCA-887D-4EAEF94B4CE1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41BF88B5-6B3D-4DCA-887D-4EAEF94B4CE1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {41BF88B5-6B3D-4DCA-887D-4EAEF94B4CE1}.Release|Any CPU.Build.0 = Release|Any CPU + {C216D010-4253-42FC-8630-28E0A612BCD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C216D010-4253-42FC-8630-28E0A612BCD6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C216D010-4253-42FC-8630-28E0A612BCD6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C216D010-4253-42FC-8630-28E0A612BCD6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs new file mode 100755 index 0000000..d9e9bef --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdBrowser.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nsd +{ + /// + /// This class is used for managing network service discovery using DNSSD. + /// + /// 4 + public class DnssdBrowser : INsdBrowser + { + private string _serviceType; + private uint _browserHandle; + private event EventHandler _serviceFound; + private Interop.Nsd.Dnssd.ServiceFoundCallback _serviceFoundCallback; + + /// + /// This event is raised when a DNSSD service is found during service discovery. + /// + /// 4 + public event EventHandler ServiceFound + { + add + { + _serviceFound += value; + } + + remove + { + _serviceFound -= value; + } + } + + /// + /// A public constructor for DnssdBrowser class to create a DnssdBrowser instance for the given service type. + /// + /// The DNSSD service type + /// 4 + /// http://tizen.org/feature/network.dnssd + /// Thrown when serviceType is null. + /// Thrown when DNSSD is not supported. + public DnssdBrowser(string serviceType) + { + DnssdInitializer dnssdInit = Globals.s_threadDns.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + dnssdInit); + if(serviceType == null) + { + Log.Debug(Globals.LogTag, "serviceType is null"); + NsdErrorFactory.ThrowDnssdException((int)DnssdError.InvalidParameter); + } + + _serviceType = serviceType; + } + + /// + /// Starts browsing the DNSSD remote service. + /// + /// + /// If there are any services available, ServiceFound event will be invoked. + /// Application will keep browsing for available/unavailable services until it calls StopDiscovery(). + /// + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.dnssd + /// Thrown when any other error occurred. + /// Thrown when DNSSD is not supported. + /// Thrown when permission is denied. + public void StartDiscovery() + { + DnssdInitializer dnssdInit = Globals.s_threadDns.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + dnssdInit); + + _serviceFoundCallback = (DnssdServiceState state, uint service, IntPtr userData) => + { + if (_serviceFound != null) + { + Log.Info(Globals.LogTag, "Inside Service found callback"); + DnssdService dnsService = new DnssdService(service); + _serviceFound(null, new DnssdServiceFoundEventArgs(state, dnsService)); + } + }; + + int ret = Interop.Nsd.Dnssd.StartBrowsing(_serviceType, out _browserHandle, _serviceFoundCallback, IntPtr.Zero); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to discover Dnssd remote service, Error - " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + /// + /// Stops browsing the DNSSD remote service. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// Thrown when any other error occurred. + /// Thrown when DNSSD is not supported. + public void StopDiscovery() + { + int ret = Interop.Nsd.Dnssd.StopBrowsing(_browserHandle); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to stop discovery of Dnssd remote service, Error - " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs new file mode 100755 index 0000000..803c6b8 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/DnssdService.cs @@ -0,0 +1,438 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Text; +using System.Threading; +using System.Net; + +namespace Tizen.Network.Nsd +{ + internal class DnssdInitializer + { + internal DnssdInitializer() + { + Globals.DnssdInitialize(); + } + + ~DnssdInitializer() + { + int ret = Interop.Nsd.Dnssd.Deinitialize(); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to deinitialize Dnssd, Error - " + (DnssdError)ret); + } + } + } + /// + /// This class is used for managing local service registration and its properties using DNSSD. + /// + /// 4 + public class DnssdService : INsdService + { + private uint _serviceHandle; + private string _serviceType; + private ushort _dnsRecordtype = 16; + private Interop.Nsd.Dnssd.ServiceRegisteredCallback _serviceRegisteredCallback; + + /// + /// Constructor to create DnssdService instance that sets the serviceType to a given value. + /// + /// 4 + /// The DNSSD service type. It is expressed as type followed by protocol, separated by a dot(e.g. "_ftp._tcp"). + /// It must begin with an underscore, followed by 1-15 characters which may be letters, digits or hyphens. + /// + /// http://tizen.org/feature/network.dnssd + /// Thrown while setting this property when DNSSD is not supported. + /// Thrown when serviceType is set to null. + public DnssdService(string serviceType) + { + _serviceType = serviceType; + DnssdInitializeCreateService(); + } + + internal DnssdService(uint service) + { + _serviceHandle = service; + } + + internal void DnssdInitializeCreateService() + { + DnssdInitializer dnssdInit = Globals.s_threadDns.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + dnssdInit); + int ret = Interop.Nsd.Dnssd.CreateService(_serviceType, out _serviceHandle); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to create a local Dnssd service handle, Error - " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + /// + /// Name of DNSSD service. + /// + /// + /// Set Name for only unregistered service created locally. + /// It may be up to 63 bytes. + /// In case of error, null will be returned during get and exception will be thrown during set. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// Thrown while setting this property when DNSSD is not supported. + /// Thrown when Name value is set to null. + /// Thrown while setting this property when any other error occurred. + public string Name + { + get + { + string name; + int ret = Interop.Nsd.Dnssd.GetName(_serviceHandle, out name); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to get name of service, Error: " + (DnssdError)ret); + return null; + } + + return name; + } + + set + { + if (!Globals.s_threadDns.IsValueCreated) + { + DnssdInitializeCreateService(); + } + + int ret = Interop.Nsd.Dnssd.SetName(_serviceHandle, value); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to set name of service, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + } + + /// + /// Type of DNSSD local/remote service. + /// + /// + /// It is expressed as type followed by protocol, separated by a dot(e.g. "_ftp._tcp"). + /// It must begin with an underscore, followed by 1-15 characters which may be letters, digits or hyphens. + /// In case of error, null will be returned. + /// + /// 4 + public string Type + { + get + { + string type; + int ret = Interop.Nsd.Dnssd.GetType(_serviceHandle, out type); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to get type of service, Error: " + (DnssdError)ret); + return null; + } + + return type; + } + } + + /// + /// Port number of DNSSD local/remote service. + /// + /// + /// Set Port for only unregistered service created locally. The default value of Port is 0. + /// In case of error, -1 will be returned during get and exception will be thrown during set. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// Thrown while setting this property when DNSSD is not supported. + /// Thrown if value of Port is set to less than 0 or more than 65535. + /// Thrown while setting this property when any other error occurred. + public int Port + { + get + { + int port; + int ret = Interop.Nsd.Dnssd.GetPort(_serviceHandle, out port); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to get port number of Dnssd service, Error: " + (DnssdError)ret); + return -1; + } + + return port; + } + + set + { + if (!Globals.s_threadDns.IsValueCreated) + { + DnssdInitializeCreateService(); + } + + int ret = Interop.Nsd.Dnssd.SetPort(_serviceHandle, value); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to set port number of Dnssd service, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + } + + /// + /// IP address of DNSSD remote service. + /// + /// + /// If the remote service has no IPv4 Address, then IPv4Address would contain null and if it has no IPv6 Address, then IPv6Address would contain null. + /// In case of error, null object will be returned. + /// + /// 4 + public IPAddressInformation IP + { + get + { + string IPv4, IPv6; + int ret = Interop.Nsd.Dnssd.GetIP(_serviceHandle, out IPv4, out IPv6); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to get the IP of Dnssd remote service, Error: " + (DnssdError)ret); + return null; + } + + IPAddressInformation IPAddressInstance = new IPAddressInformation(IPv4, IPv6); + return IPAddressInstance; + } + } + + private void GetTxtRecord(out ushort length, out byte[] value) + { + int ret = Interop.Nsd.Dnssd.GetAllTxtRecord(_serviceHandle, out length, out value); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to get the TXT record, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + /// + /// Adds the TXT record. + /// + /// + /// TXT record should be added after registering local service using RegisterService(). + /// + /// 4 + /// The key of the TXT record. It must be a null-terminated string with 9 characters or fewer excluding null. It is case insensitive. + /// The value of the TXT record.If null, then "key" will be added with no value. If non-null but value_length is zero, then "key=" will be added with empty value. + /// http://tizen.org/feature/network.dnssd + /// Thrown when DNSSD is not supported. + /// Thrown when value of key is null. + /// Thrown when any other error occurred. + public void AddTXTRecord(string key, string value) + { + byte[] byteValue = Encoding.UTF8.GetBytes(value); + ushort length = Convert.ToUInt16(byteValue.Length); + int ret = Interop.Nsd.Dnssd.AddTxtRecord(_serviceHandle, key, length, byteValue); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to add the TXT record, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + + byte[] txtValue; + ushort txtLength; + GetTxtRecord(out txtLength, out txtValue); + + ret = Interop.Nsd.Dnssd.SetRecord(_serviceHandle, _dnsRecordtype, txtLength, txtValue); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to set the DNS resource record, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + /// + /// Removes the TXT record. + /// + /// 4 + /// The key of the TXT record to be removed. + /// http://tizen.org/feature/network.dnssd + /// Thrown when DNSSD is not supported. + /// Thrown when value of key is null. + /// Thrown when any other error occurred. + public void RemoveTXTRecord(string key) + { + int ret = Interop.Nsd.Dnssd.RemoveTxtRecord(_serviceHandle, key); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to remove the TXT record, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + + byte[] txtValue; + ushort txtLength; + GetTxtRecord(out txtLength, out txtValue); + if (txtLength == 0) + { + ret = Interop.Nsd.Dnssd.UnsetRecord(_serviceHandle, _dnsRecordtype); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to unset the DNS resource record, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + } + + /// + /// Registers the DNSSD local service for publishing. + /// + /// Name of the service must be set. + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.dnssd + /// Thrown when any other error occurred. + /// Thrown when DNSSD is not supported. + /// Thrown when permission is denied. + public void RegisterService() + { + if (!Globals.s_threadDns.IsValueCreated) + { + DnssdInitializeCreateService(); + } + + _serviceRegisteredCallback = (DnssdError result, uint service, IntPtr userData) => + { + if (result != DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to finish the registration of Dnssd local service, Error: " + result); + NsdErrorFactory.ThrowDnssdException((int)result); + } + }; + + int ret = Interop.Nsd.Dnssd.RegisterService(_serviceHandle, _serviceRegisteredCallback, IntPtr.Zero); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to register the Dnssd local service, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + /// + /// Deregisters the DNSSD local service. + /// + /// + /// A local service registered using RegisterService() must be passed. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// Thrown when any other error occurred. + /// Thrown when DNSSD is not supported. + public void DeregisterService() + { + int ret = Interop.Nsd.Dnssd.DeregisterService(_serviceHandle); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to deregister the Dnssd local service, Error: " + (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + #region IDisposable Support + private bool _disposedValue = false; // To detect redundant calls + + private void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + if (_serviceHandle != 0) + { + int ret = Interop.Nsd.Dnssd.DestroyService(_serviceHandle); + if (ret != (int)DnssdError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy the local Dnssd service handle, Error - " + (DnssdError)ret); + } + } + } + + _disposedValue = true; + } + } + + ~DnssdService() + { + Dispose(false); + } + + /// + /// Disposes the memory allocated to unmanaged resources. + /// + /// 4 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } + + /// + /// This class manages the IP address properties of DNSSD service. + /// + /// 4 + public class IPAddressInformation + { + private string _ipv4, _ipv6; + internal IPAddressInformation() + { + } + + internal IPAddressInformation(string ipv4, string ipv6) + { + _ipv4 = ipv4; + _ipv6 = ipv6; + } + + /// + /// The IP version 4 address of DNSSD service. + /// + /// 4 + public IPAddress IPv4Address + { + get + { + if (_ipv4 == null) + return IPAddress.Parse("0.0.0.0"); + return IPAddress.Parse(_ipv4); + } + } + + /// + /// The IP version 6 address of DNSSD service. + /// + /// 4 + public IPAddress IPv6Address + { + get + { + if (_ipv6 == null) + return IPAddress.Parse("0:0:0:0:0:0:0:0"); + return IPAddress.Parse(_ipv6); + } + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/Globals.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/Globals.cs new file mode 100755 index 0000000..d1abff4 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/Globals.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; + +namespace Tizen.Network.Nsd +{ + internal static class Globals + { + internal const string LogTag = "Tizen.Network.Nsd"; + + internal static void DnssdInitialize() + { + int ret = Interop.Nsd.Dnssd.Initialize(); + if(ret!=(int)DnssdError.None) + { + Log.Error(LogTag, "Failed to initialize Dnssd, Error - "+ (DnssdError)ret); + NsdErrorFactory.ThrowDnssdException(ret); + } + } + + internal static void SsdpInitialize() + { + int ret = Interop.Nsd.Ssdp.Initialize(); + if (ret != (int)SsdpError.None) + { + Log.Error(LogTag, "Failed to initialize Ssdp, Error - " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + + internal static ThreadLocal s_threadDns = new ThreadLocal(() => + { + Log.Info(LogTag, "Inside Dnssd ThreadLocal delegate"); + return new DnssdInitializer(); + }); + + internal static ThreadLocal s_threadSsd = new ThreadLocal(() => + { + Log.Info(LogTag, "Inside Ssdp ThreadLocal delegate"); + return new SsdpInitializer(); + }); + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs new file mode 100755 index 0000000..524f921 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdBrowser.cs @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Network.Nsd +{ + /// + /// This interface is used for managing network service discovery using DNSSD/SSDP. + /// + public interface INsdBrowser + { + /// + /// Starts browsing the DNSSD/SSDP remote service. + /// + /// + /// If there are any services available, ServiceFound event will be invoked. + /// Application will keep browsing for available/unavailable services until it calls StopDiscovery(). + /// + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occured. + /// Thrown when DNSSD/SSDP is not supported. + /// Thrown when permission is denied. + void StartDiscovery(); + + /// + /// Stops browsing the DNSSD/SSDP remote service. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occured. + /// Thrown when DNSSD/SSDP is not supported. + void StopDiscovery(); + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs new file mode 100755 index 0000000..594fbf0 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/INsdService.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nsd +{ + /// + /// This interface is used for managing local service registration using DNSSD/SSDP. + /// + public interface INsdService : IDisposable + { + /// + /// Registers the DNSSD/SSDP local service for publishing. + /// + /// + /// A service created locally must be passed. + /// + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occurred. + /// Thrown when DNSSD/SSDP is not supported. + /// Thrown when permission is denied. + void RegisterService(); + + /// + /// Deregisters the DNSSD/SSDP local service. + /// + /// + /// A local service registered using RegisterService() must be passed. + /// + /// 4 + /// http://tizen.org/feature/network.dnssd + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occurred. + /// Thrown when DNSSD/SSDP is not supported. + void DeregisterService(); + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs new file mode 100644 index 0000000..1ec8bba --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NamespaceDoc.cs @@ -0,0 +1,30 @@ +/** + +The Tizen.Network.Nsd namespace provides classes to manage the network service discovery protocols. + + +

Overview

+The Nsd API handles two network service discovery protocols: DNS-SD (DNS Service Discovery) and SSDP (Simple Service Discovery Protocol). They allows application to announce local services and search for remote services on a network. + +

Related Features

+To use DNS-SD, declare the following feature requirements in the config file:
+http://tizen.org/feature/network.dnssd +
+To use SSDP, declare the following feature requirements in the config file:
+http://tizen.org/feature/network.ssdp +
+ +
+ + +The following example demonstrates how to register a DNS-SD local service. + +DnssdService service = new DnssdService("_http._tcp"); +service.Name = "TestService"; +service.Port = "1234"; +service.RegisterService(); + + + +*/ +namespace Tizen.Network.Nsd {} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEnumerations.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEnumerations.cs new file mode 100755 index 0000000..ce98b1e --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEnumerations.cs @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using Tizen.Internals.Errors; + +namespace Tizen.Network.Nsd +{ + /// + /// Enumeration for DNS-SD service state. + /// + /// 4 + public enum DnssdServiceState + { + /// + /// Available DNS-SD service found. + /// + Available, + /// + /// DNS-SD service not available. + /// + Unavailable, + /// + /// Lookup failure for service name. + /// + ServiceNameLookupFailed, + /// + /// Lookup failure for host name and port number. + /// + HostNameLookupFailed, + /// + /// Lookup failure for IP address. + /// + AddressLookupFailed + } + + /// + /// Enumeration for SSDP service state. + /// + /// 4 + public enum SsdpServiceState + { + /// + /// Available SSDP service found. + /// + Available, + /// + /// SSDP service not available. + /// + Unavailable + } + + internal enum DnssdError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + PermissionDenied = ErrorCode.PermissionDenied, + InvalidOperation = ErrorCode.InvalidOperation, + InvalidParameter = ErrorCode.InvalidParameter, + NotSupported = ErrorCode.NotSupported, + NotInitialized = -0x01CA0000 | 0x01, + AlreadyRegistered = -0x01CA0000 | 0x02, + NameConflict = -0x01CA0000 | 0x03, + ServiceNotRunning = -0x01CA0000 | 0x04, + ServiceNotFound = -0x01CA0000 | 0x05, + OperationFailed = -0x01CA0000 | 0x06 + } + + internal enum SsdpError + { + None = ErrorCode.None, + OutOfMemory = ErrorCode.OutOfMemory, + PermissionDenied = ErrorCode.PermissionDenied, + InvalidParameter = ErrorCode.InvalidParameter, + NotSupported = ErrorCode.NotSupported, + NotInitialized = -0x01C90000 | 0x01, + OperationFailed = -0x01C90000 | 0x04, + ServiceNotFound = -0x01C90000 | 0x05, + ServiceAlreadyRegistered = -0x01C90000 | 0x06 + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdError.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdError.cs new file mode 100755 index 0000000..3eda757 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdError.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nsd +{ + internal static class NsdErrorFactory + { + internal static void ThrowDnssdException(int exception) + { + DnssdError _error = (DnssdError)exception; + switch (_error) + { + case DnssdError.OutOfMemory: + throw new InvalidOperationException("Out of memory"); + case DnssdError.PermissionDenied: + throw new UnauthorizedAccessException("Permission Denied"); + case DnssdError.InvalidOperation: + throw new InvalidOperationException("Invalid operation"); + case DnssdError.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + case DnssdError.NotSupported: + throw new NotSupportedException("Not supported"); + case DnssdError.NotInitialized: + throw new InvalidOperationException("Not initialized"); + case DnssdError.AlreadyRegistered: + throw new InvalidOperationException("Already registered"); + case DnssdError.NameConflict: + throw new InvalidOperationException("Name conflict"); + case DnssdError.ServiceNotRunning: + throw new InvalidOperationException("Service not running"); + case DnssdError.ServiceNotFound: + throw new InvalidOperationException("Service not found"); + case DnssdError.OperationFailed: + throw new InvalidOperationException("Operation failed"); + } + } + + internal static void ThrowSsdpException(int exception) + { + SsdpError _error = (SsdpError)exception; + switch (_error) + { + case SsdpError.OutOfMemory: + throw new InvalidOperationException("Out of memory"); + case SsdpError.PermissionDenied: + throw new UnauthorizedAccessException("Permission Denied"); + case SsdpError.InvalidParameter: + throw new ArgumentException("Invalid parameter"); + case SsdpError.NotSupported: + throw new NotSupportedException("Not supported"); + case SsdpError.NotInitialized: + throw new InvalidOperationException("Not initialized"); + case SsdpError.OperationFailed: + throw new InvalidOperationException("Operation failed"); + case SsdpError.ServiceNotFound: + throw new InvalidOperationException("Service not found"); + case SsdpError.ServiceAlreadyRegistered: + throw new InvalidOperationException("Service already registered"); + } + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEventArgs.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEventArgs.cs new file mode 100755 index 0000000..b68edc5 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/NsdEventArgs.cs @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nsd +{ + /// + /// An extended EventArgs class which contains changed service state during service discovery using DNSSD. + /// + /// 4 + public class DnssdServiceFoundEventArgs : EventArgs + { + private DnssdServiceState _state; + private DnssdService _service; + + internal DnssdServiceFoundEventArgs(DnssdServiceState state, DnssdService service) + { + _state = state; + _service = service; + } + + /// + /// DNSSD service state. + /// + /// 4 + public DnssdServiceState State + { + get + { + return _state; + } + } + + /// + /// DNSSD service instance. + /// + /// 4 + public DnssdService Service + { + get + { + return _service; + } + } + } + + /// + /// An extended EventArgs class which contains changed service state during service discovery using SSDP. + /// + /// 4 + public class SsdpServiceFoundEventArgs : EventArgs + { + private SsdpServiceState _state; + private SsdpService _service; + + internal SsdpServiceFoundEventArgs(SsdpServiceState state, SsdpService service) + { + _state = state; + _service = service; + } + + /// + /// SSDP service state. + /// + /// 4 + public SsdpServiceState State + { + get + { + return _state; + } + } + + /// + /// SSDP service instance. + /// + /// 4 + public SsdpService Service + { + get + { + return _service; + } + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs new file mode 100755 index 0000000..2dfb586 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpBrowser.cs @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.Nsd +{ + /// + /// This class is used for managing network service discovery using SSDP. + /// + /// 4 + public class SsdpBrowser : INsdBrowser + { + private string _target; + private uint _browserHandle; + private event EventHandler _serviceFound; + private Interop.Nsd.Ssdp.ServiceFoundCallback _serviceFoundCallback; + + /// + /// This event is raised when service has become available or unavailable during service discovery using SSDP. + /// + /// 4 + public event EventHandler ServiceFound + { + add + { + _serviceFound += value; + } + + remove + { + _serviceFound -= value; + } + } + + /// + /// A public constructor for SsdpBrowser class to create a SsdpBrowser instance for the given target. + /// + /// 4 + /// The target to browse for the service. + /// http://tizen.org/feature/network.ssdp + /// Thrown when target is null. + /// Thrown when SSDP is not supported. + public SsdpBrowser(string target) + { + SsdpInitializer ssdpInit = Globals.s_threadSsd.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + ssdpInit); + if (target == null) + { + Log.Debug(Globals.LogTag, "target is null"); + NsdErrorFactory.ThrowSsdpException((int)SsdpError.InvalidParameter); + } + + _target = target; + } + + /// + /// Starts browsing the SSDP remote service. + /// + /// + /// If there are any services available, ServiceFound event will be invoked. + /// Application will keep browsing for available/unavailable services until it calls StopDiscovery(). + /// + /// 4 + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occured. + /// Thrown when SSDP is not supported. + public void StartDiscovery() + { + SsdpInitializer ssdpInit = Globals.s_threadSsd.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + ssdpInit); + + _serviceFoundCallback = (SsdpServiceState state, uint service, IntPtr userData) => + { + if (_serviceFound != null) + { + Log.Info(Globals.LogTag, "Inside Service found callback"); + SsdpService ssdpService = new SsdpService(service); + _serviceFound(null, new SsdpServiceFoundEventArgs(state, ssdpService)); + } + }; + + int ret = Interop.Nsd.Ssdp.StartBrowsing(_target, out _browserHandle, _serviceFoundCallback, IntPtr.Zero); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to discover Ssdp remote service, Error - " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + + /// + /// Stops browsing the SSDP remote service. + /// + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occured. + /// Thrown when SSDP is not supported. + /// Thrown when permission is denied. + public void StopDiscovery() + { + int ret = Interop.Nsd.Ssdp.StopBrowsing(_browserHandle); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to stop discovery of Ssdp remote service, Error - " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + } +} diff --git a/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs new file mode 100755 index 0000000..25cc8f3 --- /dev/null +++ b/src/Tizen.Network.Nsd/Tizen.Network.Nsd/SsdpService.cs @@ -0,0 +1,281 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading; + +namespace Tizen.Network.Nsd +{ + internal class SsdpInitializer + { + internal SsdpInitializer() + { + Globals.SsdpInitialize(); + } + + ~SsdpInitializer() + { + int ret = Interop.Nsd.Ssdp.Deinitialize(); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to deinitialize Ssdp, Error - " + (SsdpError)ret); + } + } + } + + /// + /// This class is used for managing local service registration and its properties using SSDP. + /// + /// 4 + public class SsdpService : INsdService + { + private uint _serviceHandle; + private string _target; + private Interop.Nsd.Ssdp.ServiceRegisteredCallback _serviceRegisteredCallback; + + /// + /// Constructor to create SsdpService instance that sets the target to a given value. + /// + /// 4 + /// The SSDP local service's target. It may be a device type or a service type. + /// http://tizen.org/feature/network.ssdp + /// Thrown while setting this property when SSDP is not supported. + /// Thrown when target is set to null. + public SsdpService(string target) + { + _target = target; + SsdpInitializeCreateService(); + } + + internal SsdpService(uint service) + { + _serviceHandle = service; + } + + internal void SsdpInitializeCreateService() + { + SsdpInitializer ssdpInit = Globals.s_threadSsd.Value; + Log.Info(Globals.LogTag, "Initialize ThreadLocal instance = " + ssdpInit); + int ret = Interop.Nsd.Ssdp.CreateService(_target, out _serviceHandle); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to create a local Ssdp service handle, Error - " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + + /// + /// Unique Service Name of SSDP service. + /// + /// + /// Set Usn for only unregistered service created locally. If service is already registered, Usn will not be set. + /// In case of error, null will be returned during get and exception will be thrown during set. + /// + /// 4 + /// http://tizen.org/feature/network.ssdp + /// Thrown while setting this property when SSDP is not supported. + /// Thrown when Usn value is set to null. + /// Thrown while setting this property when any other error occurred. + public string Usn + { + get + { + string usn; + int ret = Interop.Nsd.Ssdp.GetUsn(_serviceHandle, out usn); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to get usn of service, Error: " + (SsdpError)ret); + return null; + } + + return usn; + } + + set + { + if (!Globals.s_threadSsd.IsValueCreated) + { + SsdpInitializeCreateService(); + } + + int ret = Interop.Nsd.Ssdp.SetUsn(_serviceHandle, value); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to set usn of service, Error: " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + } + + /// + /// Target of SSDP service. + /// + /// + /// It may be a device type or a service type specified in UPnP forum (http://upnp.org). + /// In case of error, null will be returned. + /// + /// 4 + public string Target + { + get + { + string target; + int ret = Interop.Nsd.Ssdp.GetTarget(_serviceHandle, out target); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to get target of service, Error: " + (SsdpError)ret); + return null; + } + + return target; + } + } + + /// + /// URL of SSDP service. + /// + /// + /// Set Url for only unregistered service created locally. If service is already registered, Url will not be set. + /// In case of error, null will be returned during get and exception will be thrown during set. + /// + /// 4 + /// http://tizen.org/feature/network.ssdp + /// Thrown while setting this property when SSDP is not supported. + /// Thrown when Url value is set to null. + /// Thrown while setting this property when any other error occurred. + public string Url + { + get + { + string url; + int ret = Interop.Nsd.Ssdp.GetUrl(_serviceHandle, out url); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to get url of Ssdp service, Error: " + (SsdpError)ret); + return null; + } + + return url; + } + + set + { + if (!Globals.s_threadSsd.IsValueCreated) + { + SsdpInitializeCreateService(); + } + + int ret = Interop.Nsd.Ssdp.SetUrl(_serviceHandle, value); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to set url of Ssdp service, Error: " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + } + + /// + /// Registers the SSDP local service for publishing. + /// + /// + /// A service created locally must be passed. + /// Url and Usn of the service must be set before RegisterService is called. + /// + /// 4 + /// http://tizen.org/privilege/internet + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occurred. + /// Thrown when SSDP is not supported. + /// Thrown when permission is denied. + public void RegisterService() + { + if (!Globals.s_threadSsd.IsValueCreated) + { + SsdpInitializeCreateService(); + } + + _serviceRegisteredCallback = (SsdpError result, uint service, IntPtr userData) => + { + }; + + int ret = Interop.Nsd.Ssdp.RegisterService(_serviceHandle, _serviceRegisteredCallback, IntPtr.Zero); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to register the Ssdp local service, Error: " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + + /// + /// Deregisters the SSDP local service. + /// + /// + /// A local service registered using RegisterService() must be passed. + /// + /// 4 + /// http://tizen.org/feature/network.ssdp + /// Thrown when any other error occurred. + /// Thrown when SSDP is not supported. + public void DeregisterService() + { + int ret = Interop.Nsd.Ssdp.DeregisterService(_serviceHandle); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to deregister the Ssdp local service, Error: " + (SsdpError)ret); + NsdErrorFactory.ThrowSsdpException(ret); + } + } + + #region IDisposable Support + private bool _disposedValue = false; // To detect redundant calls + + private void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (disposing) + { + if (_serviceHandle != 0) + { + int ret = Interop.Nsd.Ssdp.DestroyService(_serviceHandle); + if (ret != (int)SsdpError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy the local Ssdp service handle, Error - " + (SsdpError)ret); + } + } + } + + _disposedValue = true; + } + } + + ~SsdpService() + { + Dispose(false); + } + + /// + /// Disposes the memory allocated to unmanaged resources. + /// + /// 4 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + #endregion + } +} diff --git a/src/Tizen.Network.Smartcard/Interop/Interop.Glib.cs b/src/Tizen.Network.Smartcard/Interop/Interop.Glib.cs new file mode 100644 index 0000000..576a6e2 --- /dev/null +++ b/src/Tizen.Network.Smartcard/Interop/Interop.Glib.cs @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Glib + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool GSourceFunc(IntPtr userData); + + [DllImport(Libraries.Glib, EntryPoint = "g_idle_add", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint IdleAdd(GSourceFunc d, IntPtr data); + } +} diff --git a/src/Tizen.Network.Smartcard/Interop/Interop.Libc.cs b/src/Tizen.Network.Smartcard/Interop/Interop.Libc.cs new file mode 100644 index 0000000..825599e --- /dev/null +++ b/src/Tizen.Network.Smartcard/Interop/Interop.Libc.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } +} diff --git a/src/Tizen.Network.Smartcard/Interop/Interop.Libraries.cs b/src/Tizen.Network.Smartcard/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..f231ed1 --- /dev/null +++ b/src/Tizen.Network.Smartcard/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Smartcard = "libcapi-network-smartcard.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.Smartcard/Interop/Interop.Smartcard.cs b/src/Tizen.Network.Smartcard/Interop/Interop.Smartcard.cs new file mode 100644 index 0000000..234de80 --- /dev/null +++ b/src/Tizen.Network.Smartcard/Interop/Interop.Smartcard.cs @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Smartcard + { + //capi-network-smartcard-0.0.6-2.1.armv7l.rpm + //Smartcard Manager + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_deinitialize")] + internal static extern int Deinitialize(); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_get_readers")] + internal static extern int GetReaders(out IntPtr readers, out int len); + + internal static class Reader + { + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_reader_get_name")] + internal static extern int ReaderGetName(int reader, out IntPtr readerName); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_reader_is_secure_element_present")] + internal static extern int ReaderIsSecureElementPresent(int reader, out bool present); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_reader_open_session")] + internal static extern int ReaderOpenSession(int reader, out int session); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_reader_close_sessions")] + internal static extern int ReaderCloseSessions(int reader); + } + + internal static class Session + { + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_get_reader")] + internal static extern int SessionGetReader(int session, out int reader); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_get_atr")] + internal static extern int SessionGetAtr(int session, out IntPtr atr, out int len); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_close")] + internal static extern int SessionClose(int session); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_is_closed")] + internal static extern int SessionIsClosed(int session, out bool closed); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_close_channels")] + internal static extern int SessionCloseChannels(int session); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_open_basic_channel")] + internal static extern int SessionOpenBasicChannel(int session, byte[] aid, int aidLen, byte p2, out int channel); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_session_open_logical_channel")] + internal static extern int SessionOpenLogicalChannel(int session, byte[] aid, int aidLen, byte p2, out int channel); + } + + internal static class Channel + { + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_close")] + internal static extern int ChannelClose(int channel); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_is_basic_channel")] + internal static extern int ChannelIsBasicChannel(int channel, out bool basicChannel); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_is_closed")] + internal static extern int ChannelIsClosed(int channel, out bool closed); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_get_select_response")] + internal static extern int ChannelGetSelectResponse(int channel, out IntPtr selectResp, out int len); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_get_session")] + internal static extern int ChannelGetSession(int channel, out int session); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_transmit")] + internal static extern int ChannelTransmit(int channel, byte[] cmd, int cmdLen, out IntPtr resp, out int len); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_transmit_retrieve_response")] + internal static extern int ChannelTransmitRetrieveResponse(int channel, out IntPtr name, out int len); + [DllImport(Libraries.Smartcard, EntryPoint = "smartcard_channel_select_next")] + internal static extern int ChannelSelectNext(int channel, out bool success); + } + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.csproj b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.sln b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.sln new file mode 100755 index 0000000..1b4824d --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Smartcard", "Tizen.Network.Smartcard.csproj", "{BBA19170-876D-46F6-81BA-F3EDA3B4D816}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{D454EADE-814E-46A3-820B-8634CBB81131}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B4EDF5AD-A918-46C4-BF29-DFC41495AB67}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BBA19170-876D-46F6-81BA-F3EDA3B4D816}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BBA19170-876D-46F6-81BA-F3EDA3B4D816}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BBA19170-876D-46F6-81BA-F3EDA3B4D816}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BBA19170-876D-46F6-81BA-F3EDA3B4D816}.Release|Any CPU.Build.0 = Release|Any CPU + {D454EADE-814E-46A3-820B-8634CBB81131}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D454EADE-814E-46A3-820B-8634CBB81131}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D454EADE-814E-46A3-820B-8634CBB81131}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D454EADE-814E-46A3-820B-8634CBB81131}.Release|Any CPU.Build.0 = Release|Any CPU + {B4EDF5AD-A918-46C4-BF29-DFC41495AB67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B4EDF5AD-A918-46C4-BF29-DFC41495AB67}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B4EDF5AD-A918-46C4-BF29-DFC41495AB67}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B4EDF5AD-A918-46C4-BF29-DFC41495AB67}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardChannel.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardChannel.cs new file mode 100644 index 0000000..f77df6e --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardChannel.cs @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Smartcard +{ + /// + /// A class for Smartcard channel informations. It allows applications to handle channel informations. + /// + /// 3 + /// http://tizen.org/privilege/secureelement + public class SmartcardChannel : IDisposable + { + private int _channelHandle = -1; + private bool disposed = false; + private SmartcardSession _sessionObject; + + /// + /// Whether the kind of channel is basic. + /// + /// 3 + public bool IsBasicChannel + { + get + { + bool isBasicChannel; + int ret = Interop.Smartcard.Channel.ChannelIsBasicChannel(_channelHandle, out isBasicChannel); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get basic channel, Error - " + (SmartcardError)ret); + } + return isBasicChannel; + } + } + + /// + /// Whether the kind of channel is logical. + /// + /// 3 + public bool IsLogicalChannel + { + get + { + bool isBasicChannel; + int ret = Interop.Smartcard.Channel.ChannelIsBasicChannel(_channelHandle, out isBasicChannel); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get logical channel, Error - " + (SmartcardError)ret); + } + return !isBasicChannel; + } + } + + /// + /// Whether the channel is closed. + /// + /// 3 + public bool IsClosed + { + get + { + bool isClosed; + int ret = Interop.Smartcard.Channel.ChannelIsClosed(_channelHandle, out isClosed); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get closed, Error - " + (SmartcardError)ret); + } + return isClosed; + } + } + + /// + /// The session that has opened the given channel. + /// + /// 3 + public SmartcardSession Session + { + get + { + int session; + int ret = Interop.Smartcard.Channel.ChannelGetSession(_channelHandle, out session); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get session, Error - " + (SmartcardError)ret); + } + + if (_sessionObject.GetHandle() != session) + { + Log.Error(Globals.LogTag, "Does not correspond with session, Error - " + _sessionObject.GetHandle() + " " + session); + } + + return _sessionObject; + } + } + + internal SmartcardChannel(SmartcardSession sessionHandle, int channelHandle) + { + _sessionObject = sessionHandle; + _channelHandle = channelHandle; + } + + ~SmartcardChannel() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + } + //Free unmanaged objects + disposed = true; + } + + /// + /// Closes the given channel to the Secure Element. + /// + /// 3 + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public void Close() + { + int ret = Interop.Smartcard.Channel.ChannelClose(_channelHandle); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to channel close, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + Dispose(true); + } + + /// + /// Gets the response to the select command. + /// + /// 3 + /// Byte array to retrieve the SELECT response. + public byte[] GetSelectedResponse() + { + byte[] respList; + IntPtr strAtr; + int len; + int ret = Interop.Smartcard.Channel.ChannelGetSelectResponse(_channelHandle, out strAtr, out len); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get select response, Error - " + (SmartcardError)ret); + } + + respList = new byte[len]; + for (int i = 0; i < len; i++) + { + respList[i] = Marshal.ReadByte(strAtr); + strAtr += sizeof(byte); + } + return respList; + } + + /// + /// Transmits an APDU command (as per ISO/IEC 7816-4) to the Secure Element. + /// + /// 3 + /// Byte array for the response APDU plus status words. + /// Command APDU to be send to the secure element. + public byte[] Transmit(byte[] cmd) + { + byte[] atrList; + IntPtr strAtr; + int len; + int ret = Interop.Smartcard.Channel.ChannelTransmit(_channelHandle, cmd, cmd.Length, out strAtr, out len); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to transmit, Error - " + (SmartcardError)ret); + } + + atrList = new byte[len]; + for (int i = 0; i < len; i++) + { + atrList[i] = Marshal.ReadByte(strAtr); + strAtr += sizeof(byte); + } + + return atrList; + } + + /// + /// Helper function to retrieves the response APDU of the previous transmit() call. + /// + /// 3 + /// Byte array for the response APDU plus status words. + public byte[] GetTransmittedResponse() + { + byte[] respList; + IntPtr strAtr; + int len; + int ret = Interop.Smartcard.Channel.ChannelTransmitRetrieveResponse(_channelHandle, out strAtr, out len); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get trasmit retrieve response, Error - " + (SmartcardError)ret); + } + + respList = new byte[len]; + for (int i = 0; i < len; i++) + { + respList[i] = Marshal.ReadByte(strAtr); + strAtr += sizeof(byte); + } + return respList; + } + + /// + /// Performs a selection of the next Applet on the given channel that matches to the partial Application ID(AID). + /// + /// 3 + /// True or false depending whether another applet with the partial Application ID(AID). + public bool SelectNext() + { + bool selectNext; + int ret = Interop.Smartcard.Channel.ChannelSelectNext(_channelHandle, out selectNext); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to select next, Error - " + (SmartcardError)ret); + } + return selectNext; + } + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardErrorFactory.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardErrorFactory.cs new file mode 100644 index 0000000..a562a2f --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardErrorFactory.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.Smartcard +{ + internal enum SmartcardError + { + None = ErrorCode.None, + IoError = ErrorCode.IoError, + InvalidParameterError = ErrorCode.InvalidParameter, + PermissionDeniedError = ErrorCode.PermissionDenied, + NotSupportedError = ErrorCode.NotSupported, + GeneralError = -0x01C70000 | 0x01, + NoSuchElementError = -0x01C70000 | 0x02, + IllegalStateError = -0x01C70000 | 0x03, + IllegalReferenceError = -0x01C70000 | 0x04, + OperationNotSupportError = -0x01C70000 | 0x05, + ChannelNotAvailableError = -0x01C70000 | 0x06, + NotInitializedError = -0x01C70000 | 0x07 + } + + internal static class SmartcardErrorFactory + { + static internal void ThrowSmartcardException(int e) + { + ThrowException(e, false); + } + + static internal void ThrowSmartcardException(int e, int handle) + { + ThrowException(e, (handle < 0)); + } + + static private void ThrowException(int e, bool isHandleNull) + { + SmartcardError err = (SmartcardError)e; + + if (isHandleNull) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + + if (err == SmartcardError.InvalidParameterError) + { + throw new ArgumentException(err.ToString()); + } + else if (err == SmartcardError.NotSupportedError) + { + throw new NotSupportedException(err.ToString()); + } + else + { + throw new InvalidOperationException(err.ToString()); + } + } + + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManager.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManager.cs new file mode 100755 index 0000000..7edf663 --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManager.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Network.Smartcard +{ + /// + /// A class for Smartcard management. It allows applications to use Smartcard service. + /// + /// 3 + /// http://tizen.org/privilege/secureelement + static public class SmartcardManager + { + /// + /// Gets the list of available Secure Element readers. + /// + /// 3 + /// List of SmartcardReader objects. + static public IEnumerable GetReaders() + { + try + { + return SmartcardManagerImpl.Instance.GetReaders(); + } + catch (TypeInitializationException e) + { + throw e.InnerException; + } + } + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManagerImpl.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManagerImpl.cs new file mode 100755 index 0000000..5e4db7f --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardManagerImpl.cs @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Network.Smartcard +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Network.Smartcard"; + } + + internal class SmartcardManagerImpl : IDisposable + { + private static readonly SmartcardManagerImpl _instance = new SmartcardManagerImpl(); + private List _readerList = new List(); + private bool disposed = false; + + internal static SmartcardManagerImpl Instance + { + get + { + return _instance; + } + } + + private SmartcardManagerImpl() + { + initialize(); + } + + ~SmartcardManagerImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + foreach (SmartcardReader reader in _readerList) + { + reader.Dispose(); + _readerList.Remove(reader); + } + } + //Free unmanaged objects + deinitialize(); + disposed = true; + } + + private void initialize() + { + int ret = Interop.Smartcard.Initialize(); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to initialize smartcard, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + } + + private void deinitialize() + { + int ret = Interop.Smartcard.Deinitialize(); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to deinitialize smartcard, Error - " + (SmartcardError)ret); + } + } + + internal IEnumerable GetReaders() + { + IntPtr readerPtr; + int len = 0; + + int ret = Interop.Smartcard.GetReaders(out readerPtr, out len); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to remove with AP, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + + for (int i = 0; i < len; i++) + { + int readerID = Marshal.ReadInt32(readerPtr); + + SmartcardReader readerItem = new SmartcardReader(readerID); + _readerList.Add(readerItem); + readerPtr += sizeof(int); + } + + return _readerList; + } + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardReader.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardReader.cs new file mode 100644 index 0000000..2aa6f07 --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardReader.cs @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Smartcard +{ + /// + /// A class for Smartcard reader informations. It allows applications to handle reader informations. + /// + /// 3 + /// http://tizen.org/privilege/secureelement + public class SmartcardReader : IDisposable + { + private int _readerHandle = -1; + private int _session; + private bool disposed = false; + private List _sessionList = new List(); + + /// + /// The name of reader. + /// + /// 3 + public string Name + { + get + { + IntPtr strPtr; + int ret = Interop.Smartcard.Reader.ReaderGetName(_readerHandle, out strPtr); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get reader name, Error - " + (SmartcardError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// The existence of secure element. + /// + /// 3 + public bool IsSecureElementPresent + { + get + { + bool isPresent; + int ret = Interop.Smartcard.Reader.ReaderIsSecureElementPresent(_readerHandle, out isPresent); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get present, Error - " + (SmartcardError)ret); + } + return isPresent; + } + } + + internal SmartcardReader(int handle) + { + _readerHandle = handle; + } + + ~SmartcardReader() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + foreach (SmartcardSession session in _sessionList) + { + session.Dispose(); + _sessionList.Remove(session); + } + } + //Free unmanaged objects + disposed = true; + } + + internal int GetHandle() + { + return _readerHandle; + } + + internal int GetSession() + { + return _session; + } + + /// + /// Connects to a Secure Element in the given reader. + /// + /// 3 + /// The SmartcardSession object. + public SmartcardSession OpenSession() + { + int ret = Interop.Smartcard.Reader.ReaderOpenSession(_readerHandle, out _session); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get session handle, Error - " + (SmartcardError)ret); + } + + SmartcardSession session = new SmartcardSession(this, _session); + _sessionList.Add(session); + return session; + } + + /// + /// Closes all the sessions opened on the given reader. + /// + /// 3 + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public void CloseSessions() + { + int ret = Interop.Smartcard.Reader.ReaderCloseSessions(_readerHandle); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to close sessions, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + + foreach (SmartcardSession session in _sessionList) + { + session.Close(); + } + } + } +} diff --git a/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardSession.cs b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardSession.cs new file mode 100644 index 0000000..107181e --- /dev/null +++ b/src/Tizen.Network.Smartcard/Tizen.Network.Smartcard/SmartcardSession.cs @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Network.Smartcard +{ + /// + /// A class for Smartcard session informations. It allows applications to handle session informations. + /// + /// 3 + /// http://tizen.org/privilege/secureelement + public class SmartcardSession : IDisposable + { + private int _sessionHandle = -1; + private bool disposed = false; + private List _basicChannelList = new List(); + private List _logicalChannelList = new List(); + private SmartcardReader _readerObject; + private int _basicChannel = 0; + private int _logicalChannel = 0; + + /// + /// The reader object that provides the given session. + /// + /// 3 + public SmartcardReader Reader + { + get + { + int reader; + int ret = Interop.Smartcard.Session.SessionGetReader(_sessionHandle, out reader); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get reader, Error - " + (SmartcardError)ret); + } + + if (_readerObject.GetHandle() != reader) + { + Log.Error(Globals.LogTag, "Does not correspond with reader, Error - " + _readerObject.GetHandle() + " " + reader); + } + + return _readerObject; + } + } + + /// + /// The Answer to Reset(ATR) of this Secure Element. + /// + /// 3 + public byte[] Atr + { + get + { + byte[] atrList; + IntPtr strAtr; + int len; + int ret = Interop.Smartcard.Session.SessionGetAtr(_sessionHandle, out strAtr, out len); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get atr, Error - " + (SmartcardError)ret); + } + + atrList = new byte[len]; + for (int i = 0; i < len; i++) + { + atrList[i] = Marshal.ReadByte(strAtr); + strAtr += sizeof(byte); + } + return atrList; + } + } + + /// + /// Whether the session is closed. + /// + /// 3 + public bool IsClosed + { + get + { + bool isClosed; + int ret = Interop.Smartcard.Session.SessionIsClosed(_sessionHandle, out isClosed); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to get present, Error - " + (SmartcardError)ret); + } + return isClosed; + } + } + + internal SmartcardSession(SmartcardReader readerHandle, int sessionHandle) + { + _readerObject = readerHandle; + _sessionHandle = sessionHandle; + } + + ~SmartcardSession() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + if (disposing) + { + // Free managed objects. + foreach (SmartcardChannel channel in _basicChannelList) + { + channel.Dispose(); + _basicChannelList.Remove(channel); + } + + foreach (SmartcardChannel channel in _logicalChannelList) + { + channel.Dispose(); + _logicalChannelList.Remove(channel); + } + } + //Free unmanaged objects + disposed = true; + } + + internal int GetHandle() + { + return _sessionHandle; + } + + /// + /// Closes the connection with the Secure Element. + /// + /// 3 + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public void Close() + { + int ret = Interop.Smartcard.Session.SessionClose(_sessionHandle); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to close, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + Dispose(true); + } + + /// + /// Closes any channel opened on the given session. + /// + /// 3 + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public void CloseChannels() + { + int ret = Interop.Smartcard.Session.SessionCloseChannels(_sessionHandle); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to close, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + + foreach (SmartcardChannel channel in _basicChannelList) + { + channel.Close(); + } + + foreach (SmartcardChannel channel in _logicalChannelList) + { + channel.Close(); + } + } + + /// + /// Gets an access to the basic channel, as defined in the ISO/IEC 7816-4 specification (the one that has number 0). + /// + /// 3 + /// The SmartcardChannel object for basic channel. + /// Byte array containing the Application ID(AID) to be selected on the given channel. + /// P2 byte of the SELECT command if executed. + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public SmartcardChannel OpenBasicChannel(byte[] aid, byte p2) + { + int ret = Interop.Smartcard.Session.SessionOpenBasicChannel(_sessionHandle, aid, aid.Length, p2, out _basicChannel); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to open basic channel, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + SmartcardChannel basicChannel = new SmartcardChannel(this, _basicChannel); + _basicChannelList.Add(basicChannel); + + return basicChannel; + } + + /// + /// Open a logical channel with the Secure Element, selecting the Applet represented by the given Application ID(AID). + /// + /// 3 + /// The SmartcardChannel object for logical channel. + /// Byte array containing the Application ID(AID) to be selected on the given channel. + /// P2 byte of the SELECT command if executed. + /// Thrown when Smartcard is not supported. + /// Thrown when the method failed due to invalid operation. + public SmartcardChannel OpenLogicalChannel(byte[] aid, byte p2) + { + int ret = Interop.Smartcard.Session.SessionOpenLogicalChannel(_sessionHandle, aid, aid.Length, p2, out _logicalChannel); + if (ret != (int)SmartcardError.None) + { + Log.Error(Globals.LogTag, "Failed to open logical channel, Error - " + (SmartcardError)ret); + SmartcardErrorFactory.ThrowSmartcardException(ret); + } + SmartcardChannel logicalChannel = new SmartcardChannel(this, _logicalChannel); + _logicalChannelList.Add(logicalChannel); + + return logicalChannel; + } + } +} diff --git a/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs b/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..d966df6 --- /dev/null +++ b/src/Tizen.Network.WiFi/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string WiFi = "libcapi-network-wifi-manager.so.1"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs b/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs new file mode 100755 index 0000000..3d01a60 --- /dev/null +++ b/src/Tizen.Network.WiFi/Interop/Interop.WiFi.cs @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Network.WiFi; +using Tizen.Network.Connection; + +internal static partial class Interop +{ + internal static partial class WiFi + { + //Callback for async method + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VoidCallback(int result, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool HandleCallback(IntPtr handle, IntPtr userData); + + //Callback for event + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DeviceStateChangedCallback(int deviceState, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ConnectionStateChangedCallback(int connectionState, IntPtr ap, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RssiLevelChangedCallback(int level, IntPtr userData); + + //capi-network-wifi-1.0.65-19.23.armv7l + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_initialize")] + internal static extern int Initialize(out SafeWiFiManagerHandle wifi); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_deinitialize")] + internal static extern int Deinitialize(IntPtr wifi); + + ////Wi-Fi Manager + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_activate")] + internal static extern int Activate(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_activate_with_wifi_picker_tested")] + internal static extern int ActivateWithWiFiPickerTested(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_deactivate")] + internal static extern int Deactivate(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_is_activated")] + internal static extern int IsActive(SafeWiFiManagerHandle wifi, out bool activated); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_get_mac_address")] + internal static extern int GetMacAddress(SafeWiFiManagerHandle wifi, out string macAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_get_network_interface_name")] + internal static extern int GetNetworkInterfaceName(SafeWiFiManagerHandle wifi, out string interfaceName); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_scan")] + internal static extern int Scan(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_scan_specific_ap")] + internal static extern int ScanSpecificAP(SafeWiFiManagerHandle wifi, string essid, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_get_connected_ap")] + internal static extern int GetConnectedAP(SafeWiFiManagerHandle wifi, out IntPtr ap); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_foreach_found_ap")] + internal static extern int GetForeachFoundAPs(SafeWiFiManagerHandle wifi, HandleCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_foreach_found_specific_ap")] + internal static extern int GetForeachFoundSpecificAPs(SafeWiFiManagerHandle wifi, HandleCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_connect")] + internal static extern int Connect(SafeWiFiManagerHandle wifi, IntPtr ap, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_disconnect")] + internal static extern int Disconnect(SafeWiFiManagerHandle wifi, IntPtr ap, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_connect_by_wps_pbc")] + internal static extern int ConnectByWpsPbc(SafeWiFiManagerHandle wifi, IntPtr ap, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_connect_by_wps_pin")] + internal static extern int ConnectByWpsPin(SafeWiFiManagerHandle wifi, IntPtr ap, string pin, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_connect_by_wps_pbc_without_ssid")] + internal static extern int ConnectByWpsPbcWithoutSsid(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_connect_by_wps_pin_without_ssid")] + internal static extern int ConnectByWpsPinWithoutSsid(SafeWiFiManagerHandle wifi, string pin, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_forget_ap")] + internal static extern int RemoveAP(SafeWiFiManagerHandle wifi, IntPtr ap); + + //Wi-Fi Monitor + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_get_connection_state")] + internal static extern int GetConnectionState(SafeWiFiManagerHandle wifi, out int connectionState); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_set_device_state_changed_cb")] + internal static extern int SetDeviceStateChangedCallback(SafeWiFiManagerHandle wifi, DeviceStateChangedCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_unset_device_state_changed_cb")] + internal static extern int UnsetDeviceStateChangedCallback(SafeWiFiManagerHandle wifi); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_set_background_scan_cb")] + internal static extern int SetBackgroundScanCallback(SafeWiFiManagerHandle wifi, VoidCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_unset_background_scan_cb")] + internal static extern int UnsetBackgroundScanCallback(SafeWiFiManagerHandle wifi); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_set_connection_state_changed_cb")] + internal static extern int SetConnectionStateChangedCallback(SafeWiFiManagerHandle wifi, ConnectionStateChangedCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_unset_connection_state_changed_cb")] + internal static extern int UnsetConnectionStateChangedCallback(SafeWiFiManagerHandle wifi); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_set_rssi_level_changed_cb")] + internal static extern int SetRssiLevelchangedCallback(SafeWiFiManagerHandle wifi, RssiLevelChangedCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_unset_rssi_level_changed_cb")] + internal static extern int UnsetRssiLevelchangedCallback(SafeWiFiManagerHandle wifi); + + internal static class AP + { + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_create")] + internal static extern int Create(SafeWiFiManagerHandle wifi, string essid, out IntPtr ap); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_hidden_create")] + internal static extern int CreateHiddenAP(SafeWiFiManagerHandle wifi, string essid, out IntPtr ap); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_destroy")] + internal static extern int Destroy(IntPtr ap); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_clone")] + internal static extern int Clone(out IntPtr cloned, IntPtr original); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_refresh")] + internal static extern int Refresh(IntPtr ap); + + ////Network Information + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_essid")] + internal static extern int GetEssid(SafeWiFiAPHandle ap, out IntPtr essid); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_bssid")] + internal static extern int GetBssid(SafeWiFiAPHandle ap, out IntPtr bssid); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_rssi")] + internal static extern int GetRssi(SafeWiFiAPHandle ap, out int rssi); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_frequency")] + internal static extern int GetFrequency(SafeWiFiAPHandle ap, out int frequency); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_max_speed")] + internal static extern int GetMaxSpeed(SafeWiFiAPHandle ap, out int maxSpeed); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_is_favorite")] + internal static extern int IsFavorite(SafeWiFiAPHandle ap, out bool isFavorite); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_is_passpoint")] + internal static extern int IsPasspoint(SafeWiFiAPHandle ap, out bool isPasspoint); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_connection_state")] + internal static extern int GetConnectionState(SafeWiFiAPHandle ap, out int connectionState); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_ip_config_type")] + internal static extern int GetIPConfigType(SafeWiFiAPHandle ap, int addressFamily, out int ipConfigType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_ip_config_type")] + internal static extern int SetIPConfigType(SafeWiFiAPHandle ap, int addressFamily, int ipConfigType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_ip_address")] + internal static extern int GetIPAddress(SafeWiFiAPHandle ap, int addressFamily, out IntPtr ipAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_foreach_ipv6_address")] + internal static extern int GetAllIPv6Addresses(SafeWiFiAPHandle ap, HandleCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_ip_address")] + internal static extern int SetIPAddress(SafeWiFiAPHandle ap, int addressFamily, string ipAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_subnet_mask")] + internal static extern int GetSubnetMask(SafeWiFiAPHandle ap, int addressFamily, out IntPtr subnetMask); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_subnet_mask")] + internal static extern int SetSubnetMask(SafeWiFiAPHandle ap, int addressFamily, string subnetMask); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_gateway_address")] + internal static extern int GetGatewayAddress(SafeWiFiAPHandle ap, int addressFamily, out IntPtr gatewayAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_gateway_address")] + internal static extern int SetGatewayAddress(SafeWiFiAPHandle ap, int addressFamily, string gatewayAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_dhcp_server_address")] + internal static extern int GetDhcpServerAddress(SafeWiFiAPHandle ap, AddressFamily addressFamily, out string dhcpServer); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_proxy_address")] + internal static extern int GetProxyAddress(SafeWiFiAPHandle ap, int addressFamily, out IntPtr proxyAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_proxy_address")] + internal static extern int SetProxyAddress(SafeWiFiAPHandle ap, int addressFamily, string proxyAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_proxy_type")] + internal static extern int GetProxyType(SafeWiFiAPHandle ap, out int proxyType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_proxy_type")] + internal static extern int SetProxyType(SafeWiFiAPHandle ap, int proxyType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_dns_address")] + internal static extern int GetDnsAddress(SafeWiFiAPHandle ap, int order, int addressFamily, out IntPtr dnsAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_dns_address")] + internal static extern int SetDnsAddress(SafeWiFiAPHandle ap, int order, int addressFamily, string dnsAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_prefix_length")] + internal static extern int GetPrefixLength(SafeWiFiAPHandle ap, int addressFamily, out int length); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_prefix_length")] + internal static extern int SetPrefixLength(SafeWiFiAPHandle ap, int addressFamily, int length); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_dns_config_type")] + internal static extern int GetDnsConfigType(SafeWiFiAPHandle ap, int addressFamily, out int type); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_dns_config_type")] + internal static extern int SetDnsConfigType(SafeWiFiAPHandle ap, int addressFamily, int type); + + ////Security Information + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_security_type")] + internal static extern int GetSecurityType(SafeWiFiAPHandle ap, out int securityType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_security_type")] + internal static extern int SetSecurityType(SafeWiFiAPHandle ap, int securityType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_encryption_type")] + internal static extern int GetEncryptionType(SafeWiFiAPHandle ap, out int encryptionType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_encryption_type")] + internal static extern int SetEncryptionType(SafeWiFiAPHandle ap, int encryptionType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_is_passphrase_required")] + internal static extern int IsPassphraseRequired(SafeWiFiAPHandle ap, out bool required); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_passphrase")] + internal static extern int SetPassphrase(SafeWiFiAPHandle ap, string passphrase); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_is_wps_supported")] + internal static extern int IsWpsSupported(SafeWiFiAPHandle ap, out bool supported); + + ////EAP + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_passphrase")] + internal static extern int SetEapPassphrase(SafeWiFiAPHandle ap, string userName, string password); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_passphrase")] + internal static extern int GetEapPassphrase(SafeWiFiAPHandle ap, out IntPtr userName, out bool isPasswordSet); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_ca_cert_file")] + internal static extern int GetEapCaCertFile(SafeWiFiAPHandle ap, out IntPtr file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_ca_cert_file")] + internal static extern int SetEapCaCertFile(SafeWiFiAPHandle ap, string file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_client_cert_file")] + internal static extern int GetEapClientCertFile(SafeWiFiAPHandle ap, out IntPtr file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_client_cert_file")] + internal static extern int SetEapClientCertFile(SafeWiFiAPHandle ap, string file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_private_key_file")] + internal static extern int GetEapPrivateKeyFile(SafeWiFiAPHandle ap, out IntPtr file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_private_key_info")] + internal static extern int SetEapPrivateKeyFile(SafeWiFiAPHandle ap, string file, string password); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_type")] + internal static extern int GetEapType(SafeWiFiAPHandle ap, out int eapType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_type")] + internal static extern int SetEapType(SafeWiFiAPHandle ap, int eapType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_get_eap_auth_type")] + internal static extern int GetEapAuthType(SafeWiFiAPHandle ap, out int file); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_ap_set_eap_auth_type")] + internal static extern int SetEapAuthType(SafeWiFiAPHandle ap, int file); + } + + internal static class Config + { + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_create")] + internal static extern int Create(SafeWiFiManagerHandle wifi, string name, string passPhrase, int securityType, out IntPtr config); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_clone")] + internal static extern int Clone(IntPtr origin, out IntPtr cloned); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_destroy")] + internal static extern int Destroy(IntPtr config); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_save")] + internal static extern int SaveConfiguration(SafeWiFiManagerHandle wifi, IntPtr config); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_foreach_configuration")] + internal static extern int GetForeachConfiguration(SafeWiFiManagerHandle wifi, HandleCallback callback, IntPtr userData); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_name")] + internal static extern int GetName(IntPtr config, out IntPtr name); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_security_type")] + internal static extern int GetSecurityType(IntPtr config, out int securityType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_proxy_address")] + internal static extern int SetProxyAddress(IntPtr config, int addressFamily, string proxyAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_proxy_address")] + internal static extern int GetProxyAddress(IntPtr config, out int addressFamily, out IntPtr proxyAddress); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_hidden_ap_property")] + internal static extern int SetHiddenAPProperty(IntPtr config, bool isHidden); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_hidden_ap_property")] + internal static extern int GetHiddenAPProperty(IntPtr config, out bool isHidden); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_anonymous_identity")] + internal static extern int GetEapAnonymousIdentity(SafeWiFiConfigHandle config, out IntPtr anonymousIdentify); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_anonymous_identity")] + internal static extern int SetEapAnonymousIdentity(SafeWiFiConfigHandle config, string anonymousIdentify); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_ca_cert_file")] + internal static extern int GetEapCaCertFile(SafeWiFiConfigHandle config, out IntPtr caCert); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_ca_cert_file")] + internal static extern int SetEapCaCertFile(SafeWiFiConfigHandle config, string caCert); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_client_cert_file")] + internal static extern int GetEapClientCertFile(SafeWiFiConfigHandle config, out IntPtr clientCert); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_client_cert_file")] + internal static extern int SetEapClientCertFile(SafeWiFiConfigHandle config, string privateKey, string clientCert); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_identity")] + internal static extern int GetEapIdentity(SafeWiFiConfigHandle config, out IntPtr identify); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_identity")] + internal static extern int SetEapIdentity(SafeWiFiConfigHandle config, string identify); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_type")] + internal static extern int GetEapType(SafeWiFiConfigHandle config, out int eapType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_type")] + internal static extern int SetEapType(SafeWiFiConfigHandle config, int eapType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_auth_type")] + internal static extern int GetEapAuthType(SafeWiFiConfigHandle config, out int eapAuthType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_auth_type")] + internal static extern int SetEapAuthType(SafeWiFiConfigHandle config, int eapAuthType); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_get_eap_subject_match")] + internal static extern int GetEapSubjectMatch(SafeWiFiConfigHandle config, out IntPtr subjectMatch); + [DllImport(Libraries.WiFi, EntryPoint = "wifi_manager_config_set_eap_subject_match")] + internal static extern int SetEapSubjectMatch(SafeWiFiConfigHandle config, string subjectMatch); + } + + internal sealed class SafeWiFiAPHandle : SafeHandle + { + public SafeWiFiAPHandle() : base(IntPtr.Zero, true) + { + } + + public SafeWiFiAPHandle(IntPtr handle) : base(handle, true) + { + } + + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + this.SetHandle(IntPtr.Zero); + return true; + } + } + + internal sealed class SafeWiFiConfigHandle : SafeHandle + { + public SafeWiFiConfigHandle() : base(IntPtr.Zero, true) + { + } + + public SafeWiFiConfigHandle(IntPtr handle) : base(handle, true) + { + } + + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + WiFi.Config.Destroy(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + } + + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free")] + public static extern void Free(IntPtr userData); + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj b/src/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj new file mode 100644 index 0000000..1caeeef --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi.sln b/src/Tizen.Network.WiFi/Tizen.Network.WiFi.sln new file mode 100755 index 0000000..c0c5959 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.WiFi", "Tizen.Network.WiFi.csproj", "{41E3B96D-1767-45B6-9F44-6CB228962E45}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.Connection", "..\Tizen.Network.Connection\Tizen.Network.Connection.csproj", "{F0F314F7-D441-4A46-BEBF-B82BC6041C73}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{6B1572A2-8970-45DF-82E4-34F20AF01A73}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{CABE3AEF-18CD-47D9-9B6F-5EA7950C6A69}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {41E3B96D-1767-45B6-9F44-6CB228962E45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {41E3B96D-1767-45B6-9F44-6CB228962E45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {41E3B96D-1767-45B6-9F44-6CB228962E45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {41E3B96D-1767-45B6-9F44-6CB228962E45}.Release|Any CPU.Build.0 = Release|Any CPU + {F0F314F7-D441-4A46-BEBF-B82BC6041C73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0F314F7-D441-4A46-BEBF-B82BC6041C73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0F314F7-D441-4A46-BEBF-B82BC6041C73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0F314F7-D441-4A46-BEBF-B82BC6041C73}.Release|Any CPU.Build.0 = Release|Any CPU + {6B1572A2-8970-45DF-82E4-34F20AF01A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B1572A2-8970-45DF-82E4-34F20AF01A73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B1572A2-8970-45DF-82E4-34F20AF01A73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B1572A2-8970-45DF-82E4-34F20AF01A73}.Release|Any CPU.Build.0 = Release|Any CPU + {CABE3AEF-18CD-47D9-9B6F-5EA7950C6A69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CABE3AEF-18CD-47D9-9B6F-5EA7950C6A69}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CABE3AEF-18CD-47D9-9B6F-5EA7950C6A69}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CABE3AEF-18CD-47D9-9B6F-5EA7950C6A69}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs new file mode 100755 index 0000000..352a777 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/ConnectionStateChangedEventArgs.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFi +{ + /// + /// An extended EventArgs class which contains changed connection state. + /// + /// 3 + public class ConnectionStateChangedEventArgs : EventArgs + { + private WiFiConnectionState _state = WiFiConnectionState.Disconnected; + private WiFiAP _ap; + + internal ConnectionStateChangedEventArgs(WiFiConnectionState s, IntPtr apHandle) + { + _state = s; + _ap = new WiFiAP(apHandle); + } + + /// + /// The wifi connection state. + /// + /// 3 + public WiFiConnectionState State + { + get + { + return _state; + } + } + + /// + /// The access point + /// + /// 3 + public WiFiAP AP + { + get + { + return _ap; + } + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs new file mode 100644 index 0000000..f3e45ba --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/DeviceStateChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFi +{ + /// + /// An extended EventArgs class which contains changed device state. + /// + /// 3 + public class DeviceStateChangedEventArgs : EventArgs + { + private WiFiDeviceState _state = WiFiDeviceState.Deactivated; + + internal DeviceStateChangedEventArgs(WiFiDeviceState s) + { + _state = s; + } + + /// + /// The wifi device state. + /// + /// 3 + public WiFiDeviceState State + { + get + { + return _state; + } + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs new file mode 100755 index 0000000..1a12f74 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/IWiFiEap.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFi +{ + /// + /// An abstract class for WiFi EAP information. + /// + /// 3 + internal interface IWiFiEap + { + /// + /// The file path of CA Certificate of EAP. + /// + /// 3 + string CaCertificationFile { get; set; } + + /// + /// The EAP type of wifi. + /// + /// 3 + WiFiEapType EapType { get; set; } + + /// + /// The type of EAP phase2 authentication of Wi-Fi. + /// + /// 3 + WiFiAuthenticationType AuthenticationType { get; set; } + } //WiFiEap +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs new file mode 100755 index 0000000..374c9c8 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/RssiLevelChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFi +{ + /// + /// An extended EventArgs class which contains changed RSSI level. + /// + /// 3 + public class RssiLevelChangedEventArgs : EventArgs + { + private WiFiRssiLevel _level = WiFiRssiLevel.Level0; + + internal RssiLevelChangedEventArgs(WiFiRssiLevel l) + { + _level = l; + } + + /// + /// The wifi RSSI level. + /// + /// 3 + public WiFiRssiLevel Level + { + get + { + return _level; + } + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs new file mode 100755 index 0000000..6877e75 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAP.cs @@ -0,0 +1,524 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the network information of the access point(AP). + /// + /// 3 + public class WiFiAP : IDisposable + { + private IntPtr _apHandle = IntPtr.Zero; + private Dictionary _callback_map = new Dictionary(); + private static Dictionary s_callbackMap = new Dictionary(); + private int _requestId = 0; + private static int s_requestId = 0; + private WiFiNetwork _network; + private WiFiSecurity _security; + private bool _disposed = false; + + /// + /// The network information of the access point(AP). + /// + /// 3 + /// WiFiNetwork instance containing network information of AP. + public WiFiNetwork NetworkInformation + { + get + { + return _network; + } + } + + /// + /// The security information of the access point(AP). + /// + /// 3 + /// WiFiSecurity instance containing security information of AP. + public WiFiSecurity SecurityInformation + { + get + { + return _security; + } + } + + internal WiFiAP(IntPtr handle) + { + Log.Debug(Globals.LogTag, "New WiFiAP. Handle: " + handle); + _apHandle = handle; + Initialize(); + } + + /// + /// Creates an object for the access point. + /// + /// 3 + /// The Extended Service Set Identifier of the access point. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when Essid is passed as null. + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when the system is out of memory. + /// Thrown when it is failed due to invalid operation. + public WiFiAP(string essid) + { + Log.Debug(Globals.LogTag, "New WiFiAP. Essid: " + essid); + createHandle(essid, true); + Initialize(); + } + + /// + /// Creates an object for the hidden access point. + /// + /// 3 + /// The Extended Service Set Identifier of the access point. + /// The value to set hidden AP + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when Essid is passed as null. + /// Thrown when it is failed due to an invalid parameter. + /// Thrown when the system is out of memory. + /// Thrown when it is failed due to invalid operation. + public WiFiAP(string essid, bool hidden) + { + createHandle(essid, hidden); + Initialize(); + } + + ~WiFiAP() + { + Dispose(false); + } + + /// + /// A method to destroy the managed WiFiAP objects. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + Interop.WiFi.AP.Destroy(_apHandle); + _apHandle = IntPtr.Zero; + } + _disposed = true; + } + + private void createHandle(string id, bool hidden) + { + int ret = -1; + if (id == null) + { + throw new ArgumentNullException("Essid is null"); + } + + if (hidden) + { + ret = Interop.WiFi.AP.CreateHiddenAP(WiFiManagerImpl.Instance.GetSafeHandle(), id, out _apHandle); + } + + else + { + ret = Interop.WiFi.AP.Create(WiFiManagerImpl.Instance.GetSafeHandle(), id, out _apHandle); + } + + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to create handle, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle()); + } + } + + private void Initialize() + { + Interop.WiFi.SafeWiFiAPHandle apHandle = new Interop.WiFi.SafeWiFiAPHandle(_apHandle); + _network = new WiFiNetwork(apHandle); + _security = new WiFiSecurity(apHandle); + } + + /// + /// Refreshes the access point information. + /// + /// 3 + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when object instance is disposed or released. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void Refresh() + { + Log.Debug(Globals.LogTag, "Refresh"); + if (_disposed) + { + throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)"); + } + int ret = Interop.WiFi.AP.Refresh(_apHandle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to refresh ap handle, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle, "http://tizen.org/privilege/network.get"); + } + } + + /// + /// Connects the access point asynchronously. + /// + /// 3 + /// A task indicating whether the Connect method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when object instance is disposed or released. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task ConnectAsync() + { + Log.Debug(Globals.LogTag, "ConnectAsync"); + if (_disposed) + { + throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)"); + } + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Connecting finished : " + (WiFiError)error); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + + int ret = Interop.WiFi.Connect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle); + } + + return task.Task; + } + + /// + /// Connects the access point with WPS asynchronously. + /// + /// 3 + /// A WpsInfo instance which is of type WpsPbcInfo or WpsPinInfo. + /// A task indicating whether the ConnectWps method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when object instance is disposed or released. + /// Thrown when WpsPinInfo object is constructed with null pin. + /// Thrown when WpsPinInfo object is constructed with pin which is an empty string or more than 7 characters. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task ConnectWpsAsync(WpsInfo info) + { + Log.Debug(Globals.LogTag, "ConnectWpsAsync"); + if (_disposed) + { + throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)"); + } + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Connecting by WPS finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + + int ret = -1; + if (info.GetType() == typeof(WpsPbcInfo)) + { + ret = Interop.WiFi.ConnectByWpsPbc(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id); + } + + else if (info.GetType() == typeof(WpsPinInfo)) + { + WpsPinInfo pinInfo = (WpsPinInfo)info; + if (pinInfo.GetWpsPin() == null) + { + throw new ArgumentNullException("Wps pin should not be null"); + } + + if (pinInfo.GetWpsPin().Length == 0 || pinInfo.GetWpsPin().Length > 8) + { + throw new ArgumentOutOfRangeException("Wps pin should not be empty or more than 7 characters"); + } + + ret = Interop.WiFi.ConnectByWpsPin(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, pinInfo.GetWpsPin(), _callback_map[id], id); + } + + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle); + } + + return task.Task; + } + + /// + /// Connects the access point with WPS without ssid asynchronously. + /// + /// 3 + /// A WpsInfo instance which is of type WpsPbcInfo or WpsPinInfo. + /// A task which contains Connected access point information. + /// + /// If WpsPinInfo is used, its object has to be constructed with a pin which must be 4 or 8 characters long. + /// + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// http://tizen.org/privilege/network.profile + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when WpsPinInfo object is constructed with null pin. + /// Thrown when WpsPinInfo object is constructed with pin which is not of 4 or 8 characters long. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public static Task ConnectWpsWithoutSsidAsync(WpsInfo info) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (s_callbackMap) + { + id = (IntPtr)s_requestId++; + s_callbackMap[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Connecting by WPS finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi connecting, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi connecting, " + (WiFiError)error)); + } + WiFiAP ap = WiFiManagerImpl.Instance.GetConnectedAP(); + task.SetResult(ap); + lock (s_callbackMap) + { + s_callbackMap.Remove(key); + } + }; + } + + int ret = -1; + if (info.GetType() == typeof(WpsPbcInfo)) + { + ret = Interop.WiFi.ConnectByWpsPbcWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), s_callbackMap[id], id); + } + + else if (info.GetType() == typeof(WpsPinInfo)) + { + WpsPinInfo pinInfo = (WpsPinInfo)info; + if (pinInfo.GetWpsPin() == null) + { + throw new ArgumentNullException("Wps pin should not be null"); + } + + if (pinInfo.GetWpsPin().Length != 4 && pinInfo.GetWpsPin().Length != 8) + { + throw new ArgumentOutOfRangeException("Wps pin should be of 4 or 8 characters long"); + } + + ret = Interop.WiFi.ConnectByWpsPinWithoutSsid(WiFiManagerImpl.Instance.GetSafeHandle(), pinInfo.GetWpsPin(), s_callbackMap[id], id); + } + + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to connect wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle()); + } + + return task.Task; + } + + /// + /// Disconnects the access point asynchronously. + /// + /// 3 + /// A task indicating whether the Disconnect method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when object instance is disposed or released. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public Task DisconnectAsync() + { + Log.Debug(Globals.LogTag, "DisconnectAsync"); + if (_disposed) + { + throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)"); + } + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Disconnecting finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi disconnecting, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi disconnecting, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.Disconnect(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle, _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle); + } + return task.Task; + } + + /// + /// Deletes the information of stored access point and disconnects it when it is connected.
+ /// If an AP is connected, then connection information will be stored. This information is used when a connection to that AP is established automatically. + ///
+ /// 3 + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.profile + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when object instance is disposed or released. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void ForgetAP() + { + Log.Debug(Globals.LogTag, "ForgetAP"); + if (_disposed) + { + throw new ObjectDisposedException("Invalid AP instance (Object may have been disposed or released)"); + } + int ret = Interop.WiFi.RemoveAP(WiFiManagerImpl.Instance.GetSafeHandle(), _apHandle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to forget AP, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle(), _apHandle); + } + } + } + + /// + /// An abstract class which is used to represent WPS information of access point. + /// + /// 3 + public abstract class WpsInfo + { + } + + /// + /// A class which is used to represent WPS PBC information of access point. + /// + public class WpsPbcInfo : WpsInfo + { + } + + /// + /// A class which is used to represent WPS PIN information of access point. + /// + public class WpsPinInfo : WpsInfo + { + private string _pin; + + private WpsPinInfo() + { + } + + /// + /// A public constructor which instantiates WpsPinInfo class with the given pin. + /// + /// 3 + /// WPS Pin of the access point. + /// + /// Pin should not be null or empty. It should be of less than 8 characters. + /// + public WpsPinInfo(string pin) + { + _pin = pin; + } + + internal string GetWpsPin() + { + return _pin; + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs new file mode 100755 index 0000000..03e8d37 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiAddressInformation.cs @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Net; +using Tizen.Network.Connection; + +namespace Tizen.Network.WiFi +{ + internal class WiFiAddressInformation : IAddressInformation + { + private Interop.WiFi.SafeWiFiAPHandle _handle; + private AddressFamily _family; + + internal WiFiAddressInformation(Interop.WiFi.SafeWiFiAPHandle handle, AddressFamily family) + { + _handle = handle; + _family = family; + } + + public System.Net.IPAddress Dns1 + { + get + { + IntPtr addrPtr; + int ret = Interop.WiFi.AP.GetDnsAddress(_handle, 1, (int)_family, out addrPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get first dns address, Error - " + (WiFiError)ret); + return System.Net.IPAddress.Parse("0.0.0.0"); + } + string addrStr = Marshal.PtrToStringAnsi(addrPtr); + Interop.Libc.Free(addrPtr); + if (addrStr == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(addrStr); + } + set + { + int ret = Interop.WiFi.AP.SetDnsAddress(_handle, 1, (int)_family, value.ToString()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set first dns address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public System.Net.IPAddress Dns2 + { + get + { + IntPtr addrPtr; + int ret = Interop.WiFi.AP.GetDnsAddress(_handle, 2, (int)_family, out addrPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get second dns address, Error - " + (WiFiError)ret); + return System.Net.IPAddress.Parse("0.0.0.0"); + } + string addrStr = Marshal.PtrToStringAnsi(addrPtr); + Interop.Libc.Free(addrPtr); + if (addrStr == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(addrStr); + } + set + { + int ret = Interop.WiFi.AP.SetDnsAddress(_handle, 2, (int)_family, value.ToString()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set second dns address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public System.Net.IPAddress Gateway + { + get + { + IntPtr addrPtr; + int ret = Interop.WiFi.AP.GetGatewayAddress(_handle, (int)_family, out addrPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get gateway address, Error - " + (WiFiError)ret); + return System.Net.IPAddress.Parse("0.0.0.0"); + } + string addrStr = Marshal.PtrToStringAnsi(addrPtr); + Interop.Libc.Free(addrPtr); + if (addrStr == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(addrStr); + } + set + { + int ret = Interop.WiFi.AP.SetGatewayAddress(_handle, (int)_family, value.ToString()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set gateway address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public System.Net.IPAddress SubnetMask + { + get + { + IntPtr addrPtr; + int ret = Interop.WiFi.AP.GetSubnetMask(_handle, (int)_family, out addrPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get subnet mask, Error - " + (WiFiError)ret); + return System.Net.IPAddress.Parse("0.0.0.0"); + } + string addrStr = Marshal.PtrToStringAnsi(addrPtr); + Interop.Libc.Free(addrPtr); + if (addrStr == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(addrStr); + } + set + { + int ret = Interop.WiFi.AP.SetSubnetMask(_handle, (int)_family, value.ToString()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set subnet mask, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public System.Net.IPAddress IP + { + get + { + IntPtr addrPtr; + int ret = Interop.WiFi.AP.GetIPAddress(_handle, (int)_family, out addrPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get ip address, Error - " + (WiFiError)ret); + return System.Net.IPAddress.Parse("0.0.0.0"); + } + string addrStr = Marshal.PtrToStringAnsi(addrPtr); + Interop.Libc.Free(addrPtr); + if (addrStr == null) + return System.Net.IPAddress.Parse("0.0.0.0"); + return System.Net.IPAddress.Parse(addrStr); + } + set + { + int ret = Interop.WiFi.AP.SetIPAddress(_handle, (int)_family, value.ToString()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set ip address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public IPConfigType IPConfigType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetIPConfigType(_handle, (int)_family, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get ip config type, Error - " + (WiFiError)ret); + } + return (IPConfigType)type; + } + set + { + int ret = Interop.WiFi.AP.SetIPConfigType(_handle, (int)_family, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set ip config type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public int PrefixLength + { + get + { + int Value; + int ret = Interop.WiFi.AP.GetPrefixLength(_handle, (int)_family, out Value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "It failed to get prefix length, " + (WiFiError)ret); + return -1; + } + return Value; + } + + set + { + int ret = Interop.WiFi.AP.SetPrefixLength(_handle, (int)_family, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "It failed to set prefix length, " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + public DnsConfigType DnsConfigType + { + get + { + int Value; + int ret = Interop.WiFi.AP.GetDnsConfigType(_handle, (int)_family, out Value); + if ((WiFiError)ret != WiFiError.None) + { + Log.Error(Globals.LogTag, "It failed to get DNS config type, " + (WiFiError)ret); + } + return (DnsConfigType)Value; + } + set + { + int ret = Interop.WiFi.AP.SetDnsConfigType(_handle, (int)_family, (int)value); + if ((WiFiError)ret != WiFiError.None) + { + Log.Error(Globals.LogTag, "It failed to set DNS config type, " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _handle.DangerousGetHandle()); + } + } + } + + /// + /// DHCP server address. It is only supported for IPv4 address family. + /// + /// Represents DHCP server address. + public System.Net.IPAddress DhcpServerAddress + { + get + { + string dhcpServer; + int ret = Interop.WiFi.AP.GetDhcpServerAddress(_handle, AddressFamily.IPv4, out dhcpServer); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get DHCP server address, Error - " + (WiFiError)ret); + } + + if (dhcpServer == null) + { + return IPAddress.Parse("0.0.0.0"); + } + + return IPAddress.Parse(dhcpServer); + } + } + + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs new file mode 100755 index 0000000..dabfb31 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiConfiguration.cs @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Net; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using Tizen.Network.Connection; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the configuration of Wi-Fi. + /// + /// 3 + public class WiFiConfiguration : IDisposable + { + private IntPtr _configHandle = IntPtr.Zero; + private bool _disposed = false; + private WiFiEapConfiguration _eapConfig; + + /// + /// The name of access point(AP). + /// + /// 3 + /// Name assigned to AP in WiFi configuration. + public string Name + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetName(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get name, Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// The security type of access point(AP). + /// + /// 3 + /// Security type of AP in WiFi configuration. + public WiFiSecurityType SecurityType + { + get + { + int type; + int ret = Interop.WiFi.Config.GetSecurityType(_configHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret); + } + return (WiFiSecurityType)type; + } + } + + /// + /// The proxy address. + /// + /// 3 + /// Proxy address of the access point. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string ProxyAddress + { + get + { + IntPtr strPtr; + int addressFamily; + int ret = Interop.WiFi.Config.GetProxyAddress(_configHandle, out addressFamily, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get proxy address, Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + if (_disposed) + { + throw new ObjectDisposedException("Invalid WiFiConfiguration instance (Object may have been disposed or released)"); + } + int ret = Interop.WiFi.Config.SetProxyAddress(_configHandle, (int)AddressFamily.IPv4, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle); + } + } + } + + /// + /// A property check whether the access point(AP) is hidden or not. + /// + /// 3 + /// Boolean value indicating whether AP is hidden or not. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public bool IsHidden + { + get + { + bool hidden; + int ret = Interop.WiFi.Config.GetHiddenAPProperty(_configHandle, out hidden); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get isHidden, Error - " + (WiFiError)ret); + } + return hidden; + } + set + { + if (_disposed) + { + throw new ObjectDisposedException("Invalid WiFiConfiguration instance (Object may have been disposed or released)"); + } + int ret = Interop.WiFi.Config.SetHiddenAPProperty(_configHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set IsHidden, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle); + } + } + } + + /// + /// The EAP Configuration. + /// + /// 3 + /// EAP configuration assigned to WiFi. + public WiFiEapConfiguration EapConfiguration + { + get + { + return _eapConfig; + } + } + + internal WiFiConfiguration(IntPtr handle) + { + _configHandle = handle; + Interop.WiFi.SafeWiFiConfigHandle configHandle = new Interop.WiFi.SafeWiFiConfigHandle(handle); + _eapConfig = new WiFiEapConfiguration(configHandle); + } + + /// + /// Creates a WiFiConfiguration object with the given name, passphrase and securetype. + /// + /// 3 + /// Name of the WiFi. + /// Password to access the WiFi. + /// Security type of the WiFi. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when the object is constructed with name as null. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when it is failed due to invalid operation. + public WiFiConfiguration(string name, string passPhrase, WiFiSecurityType type) + { + if (name == null) + { + throw new ArgumentNullException("Name of the WiFi is null"); + } + + int ret = Interop.WiFi.Config.Create(WiFiManagerImpl.Instance.GetSafeHandle(), name, passPhrase, (int)type, out _configHandle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to create config handle, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, WiFiManagerImpl.Instance.GetSafeHandle().DangerousGetHandle()); + } + + Interop.WiFi.SafeWiFiConfigHandle configHandle = new Interop.WiFi.SafeWiFiConfigHandle(_configHandle); + _eapConfig = new WiFiEapConfiguration(configHandle); + } + + ~WiFiConfiguration() + { + Dispose(false); + } + + /// + /// A method to destroy the managed objects in WiFiConfiguration. + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + return; + + if (disposing) + { + Interop.WiFi.Config.Destroy(_configHandle); + _configHandle = IntPtr.Zero; + } + _disposed = true; + } + + internal IntPtr GetHandle() + { + return _configHandle; + } + } //WiFiNetworkConfiguratin +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs new file mode 100755 index 0000000..dd89ccd --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEap.cs @@ -0,0 +1,325 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the EAP information of access point(AP). + /// + /// 3 + public class WiFiEap : IWiFiEap + { + private Interop.WiFi.SafeWiFiAPHandle _apHandle; + + /// + /// The file path of CA Certificate of EAP. + /// + /// 3 + /// CA certification file of EAP. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this value when file value is null. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string CaCertificationFile + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetEapCaCertFile(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get caCertFile, Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + if (value == null) + { + throw new ArgumentNullException("File value is null"); + } + int ret = Interop.WiFi.AP.SetEapCaCertFile(_apHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set caCertFile, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The EAP type of wifi. + /// + /// 3 + /// Type of EAP. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiEapType EapType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetEapType(_apHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get eap type, Error - " + (WiFiError)ret); + } + return (WiFiEapType)type; + } + set + { + int ret = Interop.WiFi.AP.SetEapType(_apHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set eap type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The type of EAP phase2 authentication of Wi-Fi. + /// + /// 3 + /// Authentication type of WiFi. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiAuthenticationType AuthenticationType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetEapAuthType(_apHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get auth type, Error - " + (WiFiError)ret); + } + return (WiFiAuthenticationType)type; + } + set + { + int ret = Interop.WiFi.AP.SetEapAuthType(_apHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set eap auth type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + internal WiFiEap(Interop.WiFi.SafeWiFiAPHandle apHandle) + { + _apHandle = apHandle; + } + + /// + /// Gets the private key file of EAP. + /// + /// 3 + /// The file path of private key. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public string GetPrivateKeyFile() + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetEapPrivateKeyFile(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get private key file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + return Marshal.PtrToStringAnsi(strPtr); + } + + /// + /// Sets the private key information of EAP. + /// + /// 3 + /// The file path of private key. + /// The password. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when file path of private key is null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void SetPrivateKeyFile(string privateKeyFile, string password) + { + if (privateKeyFile == null) + { + throw new ArgumentNullException("File path of private key is null"); + } + int ret = Interop.WiFi.AP.SetEapPrivateKeyFile(_apHandle, privateKeyFile, password); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set private key file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + + /// + /// Gets the Client Certificate of EAP. + /// + /// 3 + /// The file path of Client Certificate. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public string GetClientCertFile() + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetEapClientCertFile(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get client cert file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + return Marshal.PtrToStringAnsi(strPtr); + } + + /// + /// Sets the CA Certificate of EAP. + /// + /// 3 + /// The file path of Client Certificate. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when file path of Client Certificate is null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void SetClientCertFile(string clientCertFile) + { + if (clientCertFile == null) + { + throw new ArgumentNullException("File path of Client certificate is null"); + } + int ret = Interop.WiFi.AP.SetEapClientCertFile(_apHandle, clientCertFile); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set client cert file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + + /// + /// Gets the username of EAP passphrase. + /// + /// 3 + /// The user name + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public string GetUserName() + { + IntPtr strptr; + bool passwordSet; + int ret = Interop.WiFi.AP.GetEapPassphrase(_apHandle, out strptr, out passwordSet); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get user name in eap passphrase, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + return Marshal.PtrToStringAnsi(strptr); + } + + /// + /// Returns whether the password is set or not. + /// + /// 3 + /// True if password is set, false if password is not set. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public bool IsPasswordSet() + { + IntPtr strptr; + bool passwordSet; + int ret = Interop.WiFi.AP.GetEapPassphrase(_apHandle, out strptr, out passwordSet); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get IsPasswordSet in passphrase, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + return passwordSet; + } + + /// + /// Sets the user name of EAP. + /// + /// 3 + /// The user name + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the user name is passed as null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void SetUserName(string userName) + { + if (userName == null) + { + throw new ArgumentNullException("User name is null"); + } + int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, userName, null); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set username, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + + /// + /// Sets the password of EAP. + /// + /// 3 + /// The password + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when the password is passed as null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + public void SetPassword(string password) + { + if (password == null) + { + throw new ArgumentNullException("Password is null"); + } + int ret = Interop.WiFi.AP.SetEapPassphrase(_apHandle, null, password); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set password, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } //WiFiEapInformation +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs new file mode 100755 index 0000000..387bb23 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEapConfiguration.cs @@ -0,0 +1,266 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the EAP configuration. + /// + /// 3 + public class WiFiEapConfiguration : IWiFiEap + { + private Interop.WiFi.SafeWiFiConfigHandle _configHandle; + + /// + /// The file path of CA Certificate of EAP. + /// + /// 3 + /// CA certification file of EAP. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string CaCertificationFile + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetEapCaCertFile(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get caCertFile Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + int ret = Interop.WiFi.Config.SetEapCaCertFile(_configHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set caCertFile, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + /// + /// The EAP type of wifi. + /// + /// 3 + /// Type of EAP. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiEapType EapType + { + get + { + int type; + int ret = Interop.WiFi.Config.GetEapType(_configHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to eap type Error - " + (WiFiError)ret); + } + return (WiFiEapType)type; + } + set + { + int ret = Interop.WiFi.Config.SetEapType(_configHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set eap type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + /// + /// The type of EAP phase2 authentication of Wi-Fi. + /// + /// 3 + /// Authentication type of WiFi. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiAuthenticationType AuthenticationType + { + get + { + int type; + int ret = Interop.WiFi.Config.GetEapAuthType(_configHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get auth type Error - " + (WiFiError)ret); + } + return (WiFiAuthenticationType)type; + } + set + { + int ret = Interop.WiFi.Config.SetEapAuthType(_configHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set eap auth type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + /// + /// The anonymous identity of access point(AP). + /// + /// 3 + /// Represents the anonymous identity of the access point. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string AnonymousIdentify + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetEapAnonymousIdentity(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get anonymous identify Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + int ret = Interop.WiFi.Config.SetEapAnonymousIdentity(_configHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set anonymous identify, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + /// + /// The identity of access point(AP). + /// + /// 3 + /// Represents the identity of the access point. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string Identity + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetEapIdentity(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get identify Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + int ret = Interop.WiFi.Config.SetEapIdentity(_configHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set identify, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + /// + /// The subject match of access point(AP). + /// + /// 3 + /// Represents the subject match of AP. + /// Thrown while setting this value when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string SubjectMatch + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetEapSubjectMatch(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get subject match Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + int ret = Interop.WiFi.Config.SetEapSubjectMatch(_configHandle, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set subject match, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } + + internal WiFiEapConfiguration(Interop.WiFi.SafeWiFiConfigHandle handle) + { + _configHandle = handle; + } + + /// + /// Gets access point client cert file from configuration. + /// + /// 3 + /// The certification authority(CA) certificates file of access point. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when method failed due to invalid operation. + public string GetClientCertFile() + { + IntPtr strPtr; + int ret = Interop.WiFi.Config.GetEapClientCertFile(_configHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get client cert file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + return Marshal.PtrToStringAnsi(strPtr); + } + + /// + /// Sets access point client cert file to configuration. + /// + /// 3 + /// The private key file. + /// The certification authority(CA) certificates file of access point. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when method failed due to invalid operation. + public void SetClientCertFile(string privateKey, string clientCert) + { + int ret = Interop.WiFi.Config.SetEapClientCertFile(_configHandle, privateKey, clientCert); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set client cert file, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _configHandle.DangerousGetHandle()); + } + } + } //WiFiEapConfiguration +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs new file mode 100755 index 0000000..8627d03 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiEnumerations.cs @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFi +{ + /// + /// Enumeration for Wi-Fi EAP type. + /// + /// 3 + public enum WiFiEapType + { + /// + /// EAP PEAP type + /// + /// 3 + Peap = 0, + /// + /// EAP TLS type + /// + /// 3 + Tls = 1, + /// + /// EAP TTLS type + /// + /// 3 + Ttls = 2, + /// + /// EAP SIM type + /// + /// 3 + Sim = 3, + /// + /// EAP AKA type + /// + /// 3 + Aka = 4 + } + + /// + /// Enumeration for Wi-Fi RSSI level. + /// + /// 3 + public enum WiFiRssiLevel + { + /// + /// Level 0 + /// + /// 3 + Level0 = 0, + /// + /// Level 1 + /// + /// 3 + Level1 = 1, + /// + /// Level 2 + /// + /// 3 + Level2 = 2, + /// + /// Level 3 + /// + /// 3 + Level3 = 3, + /// + /// Level 4 + /// + /// 3 + Level4 = 4 + } + + /// + /// Enumeration for Wi-Fi connection state. + /// + /// 3 + public enum WiFiConnectionState + { + /// + /// Connection failed state + /// + /// 3 + Failure = -1, + /// + /// Disconnected state + /// + /// 3 + Disconnected = 0, + /// + /// Association state + /// + /// 3 + Association = 1, + /// + /// Configuration state + /// + /// 3 + Congfiguration = 2, + /// + /// Connected state + /// + /// 3 + Connected = 3 + } + + /// + /// Enumeration for Wi-Fi device state. + /// + /// 3 + public enum WiFiDeviceState + { + /// + /// Wi-Fi is Deactivated + /// + /// 3 + Deactivated = 0, + /// + /// Wi-Fi is activated + /// + /// 3 + Activated = 1 + } + + /// + /// Enumeration for Wi-Fi proxy type. + /// + /// 3 + public enum WiFiProxyType + { + /// + /// Direct connection + /// + /// 3 + Direct = 0, + /// + /// Auto configuration(Use PAC file). If URL property is not set, DHCP/WPAD auto-discover will be tried + /// + /// 3 + Auto = 1, + /// + /// Manual configuration + /// + /// 3 + Manual = 2 + } + + /// + /// Enumeration for Wi-Fi authentication type. + /// + /// 3 + public enum WiFiAuthenticationType + { + /// + /// EAP phase2 authentication none + /// + /// 3 + None = 0, + /// + /// EAP phase2 authentication PAP + /// + /// 3 + Pap = 1, + /// + /// EAP phase2 authentication MSCHAP + /// + /// 3 + Mschap = 2, + /// + /// EAP phase2 authentication MSCHAPv2 + /// + /// 3 + Mschapv2 = 3, + /// + /// EAP phase2 authentication GTC + /// + /// 3 + Gtc = 4, + /// + /// EAP phase2 authentication MD5 + /// + /// 3 + Md5 = 5 + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs new file mode 100755 index 0000000..1b43a1d --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiErrorFactory.cs @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.WiFi +{ + internal enum WiFiError + { + None = ErrorCode.None, + InvalidParameterError = ErrorCode.InvalidParameter, + OutOfMemoryError = ErrorCode.OutOfMemory, + InvalidOperationError = ErrorCode.InvalidOperation, + AddressFamilyNotSupportedError = ErrorCode.AddressFamilyNotSupported, + OperationFailedError = -0x01C50000 | 0x0301, + NoConnectionError = -0x01C50000 | 0x0302, + NowInProgressError = ErrorCode.NowInProgress, + AlreadyExistsError = -0x01C50000 | 0x0303, + OperationAbortedError = -0x01C50000 | 0x0304, + DhcpFailedError = -0x01C50000 | 0x0306, + InvalidKeyError = -0x01C50000 | 0x0307, + NoReplyError = -0x01C50000 | 0x0308, + SecurityRestrictedError = -0x01C50000 | 0x0309, + PermissionDeniedError = ErrorCode.PermissionDenied, + NotSupportedError = ErrorCode.NotSupported + } + + internal static class WiFiErrorFactory + { + static internal void ThrowWiFiException(int e, IntPtr handle) + { + ThrowExcption(e, (handle == IntPtr.Zero), false, ""); + } + + static internal void ThrowWiFiException(int e, IntPtr handle1, IntPtr handle2) + { + ThrowExcption(e, (handle1 == IntPtr.Zero), (handle2 == IntPtr.Zero), ""); + } + + static internal void ThrowWiFiException(int e, string message) + { + ThrowExcption(e, false, false, message); + } + + static internal void ThrowWiFiException(int e, IntPtr handle, string message) + { + ThrowExcption(e, (handle == IntPtr.Zero), false, message); + } + + static internal void ThrowWiFiException(int e, IntPtr handle1, IntPtr handle2, string message) + { + ThrowExcption(e, (handle1 == IntPtr.Zero), (handle2 == IntPtr.Zero), message); + } + + static private void ThrowExcption(int e, bool isHandle1Null, bool isHandle2Null, string message) + { + WiFiError err = (WiFiError)e; + if (err == WiFiError.NotSupportedError) + { + throw new NotSupportedException("Unsupported feature http://tizen.org/feature/network.wifi"); + } + + if (err == WiFiError.PermissionDeniedError) + { + throw new UnauthorizedAccessException("Permission denied " + message); + } + + if (err == WiFiError.OutOfMemoryError) + { + throw new OutOfMemoryException("Out of memory"); + } + + if (err == WiFiError.InvalidParameterError || err == WiFiError.InvalidKeyError) + { + if (isHandle1Null || isHandle2Null) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + + throw new ArgumentException("Invalid parameter"); + } + + throw new InvalidOperationException(err.ToString()); + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs new file mode 100755 index 0000000..ed06c62 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManager.cs @@ -0,0 +1,378 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; +using System.ComponentModel; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing WiFiManager handle. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public sealed class SafeWiFiManagerHandle : SafeHandle + { + internal SafeWiFiManagerHandle() : base(IntPtr.Zero, true) + { + } + + /// + /// Checks the validity of the handle. + /// + /// Represents the validity of the handle. + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() + { + Interop.WiFi.Deinitialize(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + /// + /// A manager class which allows applications to connect to a Wireless Local Area Network (WLAN) and to transfer data over the network.
+ /// The Wi-Fi Manager enables your application to activate and deactivate a local Wi-Fi device, and to connect to a WLAN network in the infrastructure mode. + ///
+ /// 3 + static public class WiFiManager + { + /// + /// The local MAC address. + /// + /// 3 + /// Represents the mac address of the WiFi. + /// http://tizen.org/privilege/network.get + static public string MacAddress + { + get + { + return WiFiManagerImpl.Instance.MacAddress; + } + } + + /// + /// The name of the network interface. + /// + /// 3 + /// Interface name of WiFi. + /// http://tizen.org/privilege/network.get + static public string InterfaceName + { + get + { + return WiFiManagerImpl.Instance.InterfaceName; + } + } + + /// + /// The network connection state. + /// + /// 3 + /// Represents the connection state of WiFi. + /// http://tizen.org/privilege/network.get + static public WiFiConnectionState ConnectionState + { + get + { + return WiFiManagerImpl.Instance.ConnectionState; + } + } + + /// + /// A property to Check whether Wi-Fi is activated. + /// + /// 3 + /// Boolean value to check whether WiFi is activated or not. + /// http://tizen.org/privilege/network.get + static public bool IsActive + { + get + { + return WiFiManagerImpl.Instance.IsActive; + } + } + + /// + /// DeviceStateChanged is raised when the device state is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.wifi + static public event EventHandler DeviceStateChanged + { + add + { + WiFiManagerImpl.Instance.DeviceStateChanged += value; + } + remove + { + WiFiManagerImpl.Instance.DeviceStateChanged -= value; + } + } + + /// + /// ConnectionStateChanged is raised when the connection state is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.wifi + static public event EventHandler ConnectionStateChanged + { + add + { + WiFiManagerImpl.Instance.ConnectionStateChanged += value; + } + remove + { + WiFiManagerImpl.Instance.ConnectionStateChanged -= value; + } + } + + /// + /// RssiLevelChanged is raised when the RSSI of connected Wi-Fi is changed. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.wifi + static public event EventHandler RssiLevelChanged + { + add + { + WiFiManagerImpl.Instance.RssiLevelChanged += value; + } + remove + { + WiFiManagerImpl.Instance.RssiLevelChanged -= value; + } + } + + /// + /// BackgroundScanFinished is raised when the background scan is finished. + /// The background scan starts automatically when wifi is activated. The callback will be invoked periodically. + /// + /// 3 + /// http://tizen.org/privilege/network.get + /// http://tizen.org/feature/network.wifi + static public event EventHandler BackgroundScanFinished + { + add + { + WiFiManagerImpl.Instance.BackgroundScanFinished += value; + } + remove + { + WiFiManagerImpl.Instance.BackgroundScanFinished -= value; + } + } + + /// + /// Gets the WiFi safe handle. + /// + /// 3 + /// The instance of SafeWiFiManagerHandle + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when the system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + [EditorBrowsable(EditorBrowsableState.Never)] + public static SafeWiFiManagerHandle GetWiFiHandle() + { + return WiFiManagerImpl.Instance.GetSafeHandle(); + } + + /// + /// Gets the result of the scan. + /// + /// 3 + /// A list of WiFiAP objects. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public IEnumerable GetFoundAPs() + { + return WiFiManagerImpl.Instance.GetFoundAPs(); + } + + /// + /// Gets the result of specific AP scan. + /// + /// 3 + /// A list contains the WiFiAP objects. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public IEnumerable GetFoundSpecificAPs() + { + return WiFiManagerImpl.Instance.GetFoundSpecificAPs(); + } + + /// + /// Gets the list of wifi configurations. + /// + /// 3 + /// A list contains the WiFiConfiguration objects. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.profile + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public IEnumerable GetWiFiConfigurations() + { + return WiFiManagerImpl.Instance.GetWiFiConfigurations(); + } + + /// + /// Saves Wi-Fi configuration of access point. + /// + /// 3 + /// The configuration to be stored + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.profile + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when WiFiConfiguration is passed as null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public void SaveWiFiConfiguration(WiFiConfiguration configuration) + { + WiFiManagerImpl.Instance.SaveWiFiNetworkConfiguration(configuration); + } + + /// + /// Gets the object of the connected WiFiAP. + /// + /// 3 + /// The connected wifi access point(AP) information. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when system is out of memory. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public WiFiAP GetConnectedAP() + { + return WiFiManagerImpl.Instance.GetConnectedAP(); + } + + /// + /// Activates Wi-Fi asynchronously. + /// + /// 3 + /// A task indicating whether the Activate method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public Task ActivateAsync() + { + return WiFiManagerImpl.Instance.ActivateAsync(); + } + + /// + /// Activates Wi-Fi asynchronously and displays Wi-Fi picker (popup) when Wi-Fi is not automatically connected. + /// + /// 3 + /// A task indicating whether the ActivateWithPicker method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public Task ActivateWithPickerAsync() + { + return WiFiManagerImpl.Instance.ActivateWithWiFiPickerTestedAsync(); + } + + /// + /// Deactivates Wi-Fi asynchronously. + /// + /// 3 + /// A task indicating whether the Deactivate method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public Task DeactivateAsync() + { + return WiFiManagerImpl.Instance.DeactivateAsync(); + } + + /// + /// Starts scan asynchronously. + /// + /// 3 + /// A task indicating whether the Scan method is done or not. + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public Task ScanAsync() + { + return WiFiManagerImpl.Instance.ScanAsync(); + } + + /// + /// Starts specific access point scan, asynchronously. + /// + /// 3 + /// A task indicating whether the ScanSpecificAP method is done or not. + /// The essid of hidden ap + /// http://tizen.org/feature/network.wifi + /// http://tizen.org/privilege/network.set + /// http://tizen.org/privilege/network.get + /// Thrown when WiFi is not supported. + /// Thrown when permission is denied. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when the method failed due to invalid operation. + static public Task ScanSpecificAPAsync(string essid) + { + return WiFiManagerImpl.Instance.ScanSpecificAPAsync(essid); + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs new file mode 100755 index 0000000..10865c4 --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiManagerImpl.cs @@ -0,0 +1,434 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.InteropServices; + +namespace Tizen.Network.WiFi +{ + static internal class Globals + { + internal const string LogTag = "Tizen.Network.WiFi"; + } + + internal class HandleHolder + { + private SafeWiFiManagerHandle _handle; + + internal HandleHolder() + { + _handle = WiFiManagerImpl.Instance.Initialize(); + Log.Debug(Globals.LogTag, "Handle: " + _handle); + } + + internal SafeWiFiManagerHandle GetSafeHandle() + { + Log.Debug(Globals.LogTag, "Handleholder safehandle = " + _handle); + return _handle; + } + } + + internal partial class WiFiManagerImpl + { + private static WiFiManagerImpl _instance = null; + private Dictionary _callback_map = new Dictionary(); + private int _requestId = 0; + private string _macAddress; + + internal string MacAddress + { + get + { + if (String.IsNullOrEmpty(_macAddress)) + { + string address; + int ret = Interop.WiFi.GetMacAddress(GetSafeHandle(), out address); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiError)ret); + _macAddress = ""; + } + else + { + _macAddress = address; + } + } + return _macAddress; + } + } + + internal string InterfaceName + { + get + { + string name; + int ret = Interop.WiFi.GetNetworkInterfaceName(GetSafeHandle(), out name); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get interface name, Error - " + (WiFiError)ret); + return ""; + } + return name; + } + } + + internal WiFiConnectionState ConnectionState + { + get + { + int state; + int ret = Interop.WiFi.GetConnectionState(GetSafeHandle(), out state); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get connection state, Error - " + (WiFiError)ret); + return WiFiConnectionState.Failure; + } + return (WiFiConnectionState)state; + } + } + + internal bool IsActive + { + get + { + bool active; + int ret = Interop.WiFi.IsActive(GetSafeHandle(), out active); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get isActive, Error - " + (WiFiError)ret); + } + return active; + } + } + + internal static WiFiManagerImpl Instance + { + get + { + if (_instance == null) + { + Log.Debug(Globals.LogTag, "Instance is null"); + _instance = new WiFiManagerImpl(); + } + + return _instance; + } + } + + private static ThreadLocal s_threadName = new ThreadLocal(() => + { + Log.Info(Globals.LogTag, "In threadlocal delegate"); + return new HandleHolder(); + }); + + private WiFiManagerImpl() + { + } + + internal SafeWiFiManagerHandle GetSafeHandle() + { + return s_threadName.Value.GetSafeHandle(); + } + + internal SafeWiFiManagerHandle Initialize() + { + SafeWiFiManagerHandle handle; + int ret = Interop.WiFi.Initialize(out handle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to initialize wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, "http://tizen.org/privilege/network.get"); + } + return handle; + } + + internal IEnumerable GetFoundAPs() + { + Log.Debug(Globals.LogTag, "GetFoundAPs"); + List apList = new List(); + Interop.WiFi.HandleCallback callback = (IntPtr apHandle, IntPtr userData) => + { + if (apHandle != IntPtr.Zero) + { + IntPtr clonedHandle; + Interop.WiFi.AP.Clone(out clonedHandle, apHandle); + WiFiAP apItem = new WiFiAP(clonedHandle); + apList.Add(apItem); + return true; + } + return false; + }; + + int ret = Interop.WiFi.GetForeachFoundAPs(GetSafeHandle(), callback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get all APs, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get"); + } + + return apList; + } + + internal IEnumerable GetFoundSpecificAPs() + { + Log.Debug(Globals.LogTag, "GetFoundSpecificAPs"); + List apList = new List(); + Interop.WiFi.HandleCallback callback = (IntPtr apHandle, IntPtr userData) => + { + if (apHandle != IntPtr.Zero) + { + IntPtr clonedHandle; + Interop.WiFi.AP.Clone(out clonedHandle, apHandle); + WiFiAP apItem = new WiFiAP(clonedHandle); + apList.Add(apItem); + return true; + } + return false; + + }; + + int ret = Interop.WiFi.GetForeachFoundSpecificAPs(GetSafeHandle(), callback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get specific APs, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get"); + } + + return apList; + } + + internal IEnumerable GetWiFiConfigurations() + { + Log.Debug(Globals.LogTag, "GetWiFiConfigurations"); + List configList = new List(); + Interop.WiFi.HandleCallback callback = (IntPtr configHandle, IntPtr userData) => + { + if (configHandle != IntPtr.Zero) + { + IntPtr clonedConfig; + Interop.WiFi.Config.Clone(configHandle, out clonedConfig); + WiFiConfiguration configItem = new WiFiConfiguration(clonedConfig); + configList.Add(configItem); + return true; + } + return false; + }; + + int ret = Interop.WiFi.Config.GetForeachConfiguration(GetSafeHandle(), callback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get configurations, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.profile"); + } + + return configList; + } + + internal void SaveWiFiNetworkConfiguration(WiFiConfiguration config) + { + Log.Debug(Globals.LogTag, "SaveWiFiNetworkConfiguration"); + if (config == null) + { + throw new ArgumentNullException("WiFi configuration is null"); + } + + IntPtr configHandle = config.GetHandle(); + int ret = Interop.WiFi.Config.SaveConfiguration(GetSafeHandle(), configHandle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to save configuration, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.profile"); + } + } + + internal WiFiAP GetConnectedAP() + { + Log.Debug(Globals.LogTag, "GetConnectedAP"); + IntPtr apHandle; + int ret = Interop.WiFi.GetConnectedAP(GetSafeHandle(), out apHandle); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to connect with AP, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle(), "http://tizen.org/privilege/network.get"); + } + WiFiAP ap = new WiFiAP(apHandle); + return ap; + } + + internal Task ActivateAsync() + { + Log.Debug(Globals.LogTag, "ActivateAsync"); + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "wifi activated"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi activating, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi activating, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.Activate(GetSafeHandle(), _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle()); + } + return task.Task; + } + + internal Task ActivateWithWiFiPickerTestedAsync() + { + Log.Debug(Globals.LogTag, "ActivateWithWiFiPickerTestedAsync"); + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Activation finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi activating, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi activating, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.ActivateWithWiFiPickerTested(GetSafeHandle(), _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to activate wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle()); + } + return task.Task; + } + + internal Task DeactivateAsync() + { + Log.Debug(Globals.LogTag, "DeactivateAsync"); + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Deactivation finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi deactivating, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi deactivating, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.Deactivate(GetSafeHandle(), _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to deactivate wifi, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle()); + } + return task.Task; + } + + internal Task ScanAsync() + { + Log.Debug(Globals.LogTag, "ScanAsync"); + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Scanning finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi scanning, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi scanning, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.Scan(GetSafeHandle(), _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to scan all AP, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle()); + } + return task.Task; + } + + internal Task ScanSpecificAPAsync(string essid) + { + Log.Debug(Globals.LogTag, "ScanSpecificAPAsync " + essid); + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + lock (_callback_map) + { + id = (IntPtr)_requestId++; + _callback_map[id] = (error, key) => + { + Log.Debug(Globals.LogTag, "Scanning with specific AP finished"); + if (error != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Error occurs during WiFi scanning, " + (WiFiError)error); + task.SetException(new InvalidOperationException("Error occurs during WiFi scanning, " + (WiFiError)error)); + } + task.SetResult(true); + lock (_callback_map) + { + _callback_map.Remove(key); + } + }; + } + int ret = Interop.WiFi.ScanSpecificAP(GetSafeHandle(), essid, _callback_map[id], id); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to scan with specific AP, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, GetSafeHandle().DangerousGetHandle()); + } + return task.Task; + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs new file mode 100755 index 0000000..e192fea --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetwork.cs @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Net; +using System.Runtime.InteropServices; +using Tizen.Network.Connection; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the Wi-Fi network information. + /// + /// 3 + public class WiFiNetwork + { + private Interop.WiFi.SafeWiFiAPHandle _apHandle; + private IAddressInformation _ipv4; + private IAddressInformation _ipv6; + private string _essid; + + /// + /// The Extended Service Set Identifier(ESSID). + /// + /// 3 + /// Essid of the WiFi. + public string Essid + { + get + { + if (string.IsNullOrEmpty(_essid)) + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetEssid(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get essid, Error - " + (WiFiError)ret); + _essid = ""; + } + else + { + _essid = Marshal.PtrToStringAnsi(strPtr); + } + } + return _essid; + } + } + + /// + /// The Basic Service Set Identifier(BSSID). + /// + /// 3 + /// Bssid of the WiFi. + public string Bssid + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetBssid(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get bssid, Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + } + + /// + /// The address informaiton for IPv4. + /// + /// 3 + /// IP address information for IPv4 type. + public IAddressInformation IPv4Setting + { + get + { + return _ipv4; + } + } + + /// + /// The address information for IPv6. + /// + /// 3 + /// IP address information for IPv6 type. + public IAddressInformation IPv6Setting + { + get + { + return _ipv6; + } + } + + /// + /// The proxy address. + /// + /// 3 + /// Represents proxy address of WiFi. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public string ProxyAddress + { + get + { + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetProxyAddress(_apHandle, (int)AddressFamily.IPv4, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get proxy address, Error - " + (WiFiError)ret); + return ""; + } + return Marshal.PtrToStringAnsi(strPtr); + } + set + { + int ret = Interop.WiFi.AP.SetProxyAddress(_apHandle, (int)AddressFamily.IPv4, value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set proxy address, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The proxy type(IPv6). + /// + /// 3 + /// Represents proxy type of WiFi. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiProxyType ProxyType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetProxyType(_apHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get proxy type, Error - " + (WiFiError)ret); + } + return (WiFiProxyType)type; + } + set + { + int ret = Interop.WiFi.AP.SetProxyType(_apHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set proxy type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The frequency band(MHz). + /// + /// 3 + /// Represents the frequency band value. + public int Frequency + { + get + { + int freq; + int ret = Interop.WiFi.AP.GetFrequency(_apHandle, out freq); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get frequency, Error - " + (WiFiError)ret); + } + return freq; + } + } + + /// + /// The Received signal strength indication(RSSI). + /// + /// 3 + /// Represents Rssi of WiFi(dbm). + public int Rssi + { + get + { + int rssi; + int ret = Interop.WiFi.AP.GetRssi(_apHandle, out rssi); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get rssi, Error - " + (WiFiError)ret); + } + return rssi; + } + } + + /// + /// The max speed (Mbps). + /// + /// 3 + /// Represents max speed value. + public int MaxSpeed + { + get + { + int maxSpeed; + int ret = Interop.WiFi.AP.GetMaxSpeed(_apHandle, out maxSpeed); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get max speed, Error - " + (WiFiError)ret); + } + return maxSpeed; + } + } + + /// + /// A property to check whether the access point is favorite or not. + /// + /// 3 + /// Boolean value to check if the access point is favorite or not. + public bool IsFavorite + { + get + { + bool isFavorite; + int ret = Interop.WiFi.AP.IsFavorite(_apHandle, out isFavorite); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get favorite, Error - " + (WiFiError)ret); + } + return isFavorite; + } + } + + /// + /// A property to check whether the access point is passpoint or not. + /// + /// 3 + /// Boolean value to check if the access point is passpoint or not. + public bool IsPasspoint + { + get + { + bool isPasspoint; + Log.Debug(Globals.LogTag, "Handle: " + _apHandle); + int ret = Interop.WiFi.AP.IsPasspoint(_apHandle, out isPasspoint); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get isPassport, Error - " + (WiFiError)ret); + } + return isPasspoint; + } + } + + /// + /// The connection state. + /// + /// 3 + /// Represents the connection state of WiFi. + public WiFiConnectionState ConnectionState + { + get + { + int state; + int ret = Interop.WiFi.AP.GetConnectionState(_apHandle, out state); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get connection state, Error - " + (WiFiError)ret); + } + return (WiFiConnectionState)state; + } + } + + /// + /// Gets the all IPv6 addresses of the access point + /// + /// 3 + /// A list of IPv6 addresses of the access point. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when method failed due to invalid operation. + public IEnumerable GetAllIPv6Addresses() + { + Log.Debug(Globals.LogTag, "GetAllIPv6Addresses"); + List ipList = new List(); + Interop.WiFi.HandleCallback callback = (IntPtr ipv6Address, IntPtr userData) => + { + if (ipv6Address != IntPtr.Zero) + { + string ipv6 = Marshal.PtrToStringAnsi(ipv6Address); + ipList.Add(System.Net.IPAddress.Parse(ipv6)); + return true; + } + return false; + }; + + int ret = Interop.WiFi.AP.GetAllIPv6Addresses(_apHandle, callback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get all IPv6 addresses, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + + return ipList; + } + + internal WiFiNetwork(Interop.WiFi.SafeWiFiAPHandle apHandle) + { + _apHandle = apHandle; + _ipv4 = new WiFiAddressInformation(apHandle, AddressFamily.IPv4); + _ipv6 = new WiFiAddressInformation(apHandle, AddressFamily.IPv6); + + IntPtr strPtr; + int ret = Interop.WiFi.AP.GetEssid(_apHandle, out strPtr); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get essid, Error - " + (WiFiError)ret); + } + _essid = Marshal.PtrToStringAnsi(strPtr); + } + } //WiFiNetworkInformation +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs new file mode 100755 index 0000000..ac1eabf --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiNetworkChange.cs @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; + +namespace Tizen.Network.WiFi +{ + internal static class EventHandlerExtension + { + internal static void SafeInvoke(this EventHandler evt, object sender, EventArgs e) + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + + internal static void SafeInvoke(this EventHandler evt, object sender, T e) where T : EventArgs + { + var handler = evt; + if (handler != null) + { + handler(sender, e); + } + } + } + + internal partial class WiFiManagerImpl + { + private event EventHandler _deviceStateChanged; + private event EventHandler _connectionStateChanged; + private event EventHandler _rssiLevelChanged; + private event EventHandler _backgroundScanFinished; + + private Interop.WiFi.DeviceStateChangedCallback _deviceChangedCallback; + private Interop.WiFi.ConnectionStateChangedCallback _connectionChangedCallback; + private Interop.WiFi.RssiLevelChangedCallback _rssiChangedCallback; + private Interop.WiFi.VoidCallback _backgroundScanFinishedCallback; + + internal event EventHandler DeviceStateChanged + { + add + { + if (_deviceStateChanged == null) + { + RegisterDeviceStateChangedEvent(); + } + _deviceStateChanged += value; + } + remove + { + _deviceStateChanged -= value; + if (_deviceStateChanged == null) + { + UnregisterDeviceStateChangedEvent(); + } + } + } + + internal event EventHandler ConnectionStateChanged + { + add + { + if (_connectionStateChanged == null) + { + RegisterConnectionStateChangedEvent(); + } + _connectionStateChanged += value; + } + remove + { + _connectionStateChanged -= value; + if (_connectionStateChanged == null) + { + UnregisterConnectionStateChangedEvent(); + } + } + } + + internal event EventHandler RssiLevelChanged + { + add + { + if (_rssiLevelChanged == null) + { + RegisterRssiLevelChangedEvent(); + } + _rssiLevelChanged += value; + } + remove + { + _rssiLevelChanged -= value; + if (_rssiLevelChanged == null) + { + UnregisterRssiLevelChangedEvent(); + } + } + } + + internal event EventHandler BackgroundScanFinished + { + add + { + if (_backgroundScanFinished == null) + { + RegisterBackgroundScanFinishedEvent(); + } + _backgroundScanFinished += value; + } + remove + { + _backgroundScanFinished -= value; + if (_backgroundScanFinished == null) + { + UnregisterBackgroundScanFinishedEvent(); + } + } + } + + private void RegisterDeviceStateChangedEvent() + { + _deviceChangedCallback = (int deviceState, IntPtr userDate) => + { + WiFiDeviceState state = (WiFiDeviceState)deviceState; + DeviceStateChangedEventArgs e = new DeviceStateChangedEventArgs(state); + _deviceStateChanged.SafeInvoke(null, e); + }; + int ret = Interop.WiFi.SetDeviceStateChangedCallback(GetSafeHandle(), _deviceChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set device state changed callback, Error - " + (WiFiError)ret); + } + } + + private void UnregisterDeviceStateChangedEvent() + { + int ret = Interop.WiFi.UnsetDeviceStateChangedCallback(GetSafeHandle()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to unset device state changed callback, Error - " + (WiFiError)ret); + } + } + + private void RegisterConnectionStateChangedEvent() + { + _connectionChangedCallback = (int connectionState, IntPtr ap, IntPtr userData) => + { + if (ap != IntPtr.Zero) + { + WiFiConnectionState state = (WiFiConnectionState)connectionState; + ConnectionStateChangedEventArgs e = new ConnectionStateChangedEventArgs(state, ap); + _connectionStateChanged.SafeInvoke(null, e); + } + }; + int ret = Interop.WiFi.SetConnectionStateChangedCallback(GetSafeHandle(), _connectionChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set copnnection state changed callback, Error - " + (WiFiError)ret); + } + } + + private void UnregisterConnectionStateChangedEvent() + { + int ret = Interop.WiFi.UnsetConnectionStateChangedCallback(GetSafeHandle()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to unset device state changed callback, Error - " + (WiFiError)ret); + } + } + + private void RegisterRssiLevelChangedEvent() + { + + _rssiChangedCallback = (int rssiLevel, IntPtr userDate) => + { + WiFiRssiLevel level = (WiFiRssiLevel)rssiLevel; + RssiLevelChangedEventArgs e = new RssiLevelChangedEventArgs(level); + _rssiLevelChanged.SafeInvoke(null, e); + }; + int ret = Interop.WiFi.SetRssiLevelchangedCallback(GetSafeHandle(), _rssiChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set rssi level changed callback, Error - " + (WiFiError)ret); + } + } + + private void UnregisterRssiLevelChangedEvent() + { + int ret = Interop.WiFi.UnsetRssiLevelchangedCallback(GetSafeHandle()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to unset rssi level changed callback, Error - " + (WiFiError)ret); + } + } + + private void RegisterBackgroundScanFinishedEvent() + { + _backgroundScanFinishedCallback = (int result, IntPtr userDate) => + { + EventArgs e = new EventArgs(); + _backgroundScanFinished.SafeInvoke(null, e); + }; + int ret = Interop.WiFi.SetBackgroundScanCallback(GetSafeHandle(), _backgroundScanFinishedCallback, IntPtr.Zero); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set background scan callback, Error - " + (WiFiError)ret); + } + } + + private void UnregisterBackgroundScanFinishedEvent() + { + int ret = Interop.WiFi.UnsetBackgroundScanCallback(GetSafeHandle()); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to unset background scan callback, Error - " + (WiFiError)ret); + } + } + } +} diff --git a/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs new file mode 100755 index 0000000..9f3451c --- /dev/null +++ b/src/Tizen.Network.WiFi/Tizen.Network.WiFi/WiFiSecurity.cs @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Network.Connection; + +namespace Tizen.Network.WiFi +{ + /// + /// A class for managing the WiFi security information. + /// + /// 3 + public class WiFiSecurity + { + private Interop.WiFi.SafeWiFiAPHandle _apHandle; + private WiFiEap _eap; + + /// + /// The type of Wi-Fi security. + /// + /// 3 + /// Represents the security type of WiFi. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiSecurityType SecurityType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetSecurityType(_apHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get security type, Error - " + (WiFiError)ret); + } + return (WiFiSecurityType)type; + } + set + { + int ret = Interop.WiFi.AP.SetSecurityType(_apHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set security type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The type of Wi-Fi encryption + /// + /// 3 + /// Represents the encryption type of WiFi. + /// Thrown while setting this property when WiFi is not supported. + /// Thrown while setting this property due to an invalid parameter. + /// Thrown while setting this value due to invalid operation. + public WiFiEncryptionType EncryptionType + { + get + { + int type; + int ret = Interop.WiFi.AP.GetEncryptionType(_apHandle, out type); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get encryption type, Error - " + (WiFiError)ret); + } + return (WiFiEncryptionType)type; + } + set + { + int ret = Interop.WiFi.AP.SetEncryptionType(_apHandle, (int)value); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set encryption type, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } + + /// + /// The EAP information + /// + /// 3 + /// Eap information of WiFi. + public WiFiEap EapInformation + { + get + { + return _eap; + } + } + + /// + /// A property to check whether the passphrase is required or not. + /// + /// 3 + /// Boolean value to check if passphrase is required or not. + public bool IsPassphraseRequired + { + get + { + bool required; + int ret = Interop.WiFi.AP.IsPassphraseRequired(_apHandle, out required); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get isPassportRequired, Error - " + (WiFiError)ret); + } + return required; + } + } + + /// + /// A property to check whether the Wi-Fi Protected Setup(WPS) is supported or not. + /// + /// 3 + /// Boolean value to check if wps is supported or not. + public bool IsWpsSupported + { + get + { + bool supported; + int ret = Interop.WiFi.AP.IsWpsSupported(_apHandle, out supported); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to get isWapSupported, Error - " + (WiFiError)ret); + } + return supported; + } + } + + internal WiFiSecurity(Interop.WiFi.SafeWiFiAPHandle apHandle) + { + _apHandle = apHandle; + _eap = new WiFiEap(apHandle); + } + + /// + /// Sets the passphrase. + /// + /// 3 + /// The passphrase of the access point. + /// http://tizen.org/feature/network.wifi + /// Thrown when WiFi is not supported. + /// Thrown when passphrase is passed as null. + /// Thrown when method is failed due to an invalid parameter. + /// Thrown when method failed due to invalid operation. + public void SetPassphrase(string passphrase) + { + if (passphrase == null) + { + throw new ArgumentNullException("Passphrase is null"); + } + int ret = Interop.WiFi.AP.SetPassphrase(_apHandle, passphrase); + if (ret != (int)WiFiError.None) + { + Log.Error(Globals.LogTag, "Failed to set passphrase, Error - " + (WiFiError)ret); + WiFiErrorFactory.ThrowWiFiException(ret, _apHandle.DangerousGetHandle()); + } + } + } //WiFiSecurityInformation +} diff --git a/src/Tizen.Network.WiFiDirect/Interop/Interop.Libraries.cs b/src/Tizen.Network.WiFiDirect/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..c036d47 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string WiFiDirect = "libwifi-direct.so.1"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Network.WiFiDirect/Interop/Interop.WiFiDirect.cs b/src/Tizen.Network.WiFiDirect/Interop/Interop.WiFiDirect.cs new file mode 100644 index 0000000..3f68798 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Interop/Interop.WiFiDirect.cs @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Network.WiFiDirect; +using System.Runtime.InteropServices; + +/// +/// Interop class for Wi-Fi Direct +/// +internal static partial class Interop +{ + /// + /// Wi-Fi Direct Native Apis + /// + internal static partial class WiFiDirect + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DiscoveryStateChangedCallback(int result, WiFiDirectDiscoveryState state, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void PeerFoundCallback(int result, WiFiDirectDiscoveryState state, string address, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DeviceStateChangedCallback(int result, WiFiDirectDeviceState state, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ConnectionStateChangedCallback(int result, WiFiDirectConnectionState state, string address, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ClientIpAddressAssignedCallback(string macAddress, string ipAddress, string interfaceAddress, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ServiceStateChangedCallback(int result, WiFiDirectServiceDiscoveryState state, WiFiDirectServiceType type, IntPtr responseData, string address, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(WiFiDirectState state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool DiscoveredPeerCallback(ref DiscoveredPeerStruct peer, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ConnectedPeerCallback(ref ConnectedPeerStruct peer, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool WpsTypeCallback(WiFiDirectWpsType type, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool PersistentGroupCallback(string address, string ssid, IntPtr userData); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_state_changed_cb")] + internal static extern int SetStateChangedCallback(StateChangedCallback stateChangedCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_state_changed_cb")] + internal static extern int UnsetStateChangedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_device_state_changed_cb")] + internal static extern int SetDeviceStateChangedCallback(DeviceStateChangedCallback deviceChangedCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_device_state_changed_cb")] + internal static extern int UnsetDeviceStateChangedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_discovery_state_changed_cb")] + internal static extern int SetDiscoveryStateChangedCallback(DiscoveryStateChangedCallback discoveryStateChangedCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_discovery_state_changed_cb")] + internal static extern int UnsetDiscoveryStateChangedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_peer_found_cb")] + internal static extern int SetPeerFoundCallback(PeerFoundCallback peerFoundCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_peer_found_cb")] + internal static extern int UnsetPeerFoundCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_connection_state_changed_cb")] + internal static extern int SetConnectionChangedCallback(ConnectionStateChangedCallback connectionCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_connection_state_changed_cb")] + internal static extern int UnsetConnectionChangedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_client_ip_address_assigned_cb")] + internal static extern int SetIpAddressAssignedCallback(ClientIpAddressAssignedCallback callback, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_client_ip_address_assigned_cb")] + internal static extern int UnsetIpAddressAssignedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_service_state_changed_cb")] + internal static extern int SetServiceStateChangedCallback(ServiceStateChangedCallback serviceStateChangedCb, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_unset_service_state_changed_cb")] + internal static extern int UnsetServiceStateChangedCallback(); + + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_initialize")] + internal static extern int Initialize(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_deinitialize")] + internal static extern int Deinitialize(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_activate")] + internal static extern int Activate(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_deactivate")] + internal static extern int Deactivate(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_start_discovery_specific_channel")] + internal static extern int StartDiscoveryInChannel(bool listenOnly, int timeout, WiFiDirectDiscoveryChannel channel); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_cancel_discovery")] + internal static extern int StopDiscovery(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_foreach_discovered_peers")] + internal static extern int GetDiscoveredPeers(DiscoveredPeerCallback callback, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_connect")] + internal static extern int Connect(string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_cancel_connection")] + internal static extern int CancelConnection(string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_disconnect_all")] + internal static extern int DisconnectAll(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_disconnect")] + internal static extern int Disconnect(string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_foreach_connected_peers")] + internal static extern int GetConnectedPeers(ConnectedPeerCallback callback, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_create_group")] + internal static extern int CreateGroup(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_destroy_group")] + internal static extern int DestroyGroup(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_group_owner")] + internal static extern int IsGroupOwner(out bool isGroupOwner); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_autonomous_group")] + internal static extern int IsAutonomousGroup(out bool isAutonomous); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_device_name")] + internal static extern int SetName(string name); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_device_name")] + internal static extern int GetName(out string name); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_ssid")] + internal static extern int GetSsid(out string ssid); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_network_interface_name")] + internal static extern int GetInterfaceName(out string name); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_ip_address")] + internal static extern int GetIpAddress(out string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_subnet_mask")] + internal static extern int GetSubnetMask(out string mask); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_gateway_address")] + internal static extern int GetGatewayAddress(out string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_mac_address")] + internal static extern int GetMacAddress(out string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_state")] + internal static extern int GetState(out WiFiDirectState state); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_discoverable")] + internal static extern int IsDiscoverable(out bool isDiscoverable); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_listening_only")] + internal static extern int IsListeningOnly(out bool listenOnly); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_primary_device_type")] + internal static extern int GetPrimaryType(out WiFiDirectPrimaryDeviceType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_secondary_device_type")] + internal static extern int GetSecondaryType(out WiFiDirectSecondaryDeviceType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_activate_pushbutton")] + internal static extern int ActivatePushButton(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_wps_pin")] + internal static extern int SetWpsPin(string pin); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_wps_pin")] + internal static extern int GetWpsPin(out string pin); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_supported_wps_mode")] + internal static extern int GetWpsMode(out int mode); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_foreach_supported_wps_types")] + internal static extern int GetWpsTypes(WpsTypeCallback callback, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_local_wps_type")] + internal static extern int GetLocalWpsType(out WiFiDirectWpsType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_req_wps_type")] + internal static extern int SetReqWpsType(WiFiDirectWpsType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_req_wps_type")] + internal static extern int GetReqWpsType(out WiFiDirectWpsType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_group_owner_intent")] + internal static extern int SetIntent(int intent); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_group_owner_intent")] + internal static extern int GetIntent(out int intent); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_max_clients")] + internal static extern int SetMaxClients(int max); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_max_clients")] + internal static extern int GetMaxClients(out int max); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_passphrase")] + internal static extern int SetPassPhrase(string passphrase); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_passphrase")] + internal static extern int GetPassPhrase(out string passphrase); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_operating_channel")] + internal static extern int GetChannel(out int channel); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_autoconnection_mode")] + internal static extern int SetAutoConnectionMode(bool mode); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_autoconnection_mode")] + internal static extern int GetAutoConnectionMode(out bool mode); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_autoconnection_peer")] + internal static extern int SetAutoConnectionPeer(string address); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_persistent_group_enabled")] + internal static extern int SetPersistentGroupState(bool enabled); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_is_persistent_group_enabled")] + internal static extern int GetPersistentGroupState(out bool enabled); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_foreach_persistent_groups")] + internal static extern int GetPersistentGroups(PersistentGroupCallback callback, IntPtr userData); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_remove_persistent_group")] + internal static extern int RemovePersistentGroup(string address, string ssid); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_start_service_discovery")] + internal static extern int StartServiceDiscovery(string address, WiFiDirectServiceType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_cancel_service_discovery")] + internal static extern int StopServiceDiscovery(string address, WiFiDirectServiceType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_register_service")] + internal static extern int RegisterService(WiFiDirectServiceType type, string info1, string info2, out uint serviceId); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_deregister_service")] + internal static extern int DeregisterService(uint serviceId); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_init_miracast")] + internal static extern int InitMiracast(bool enable); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_info")] + internal static extern int GetDiscoveredPeerInfo(string address, out IntPtr peer); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_init_display")] + internal static extern int InitDisplay(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_deinit_display")] + internal static extern int DeinitDisplay(); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_display")] + internal static extern int SetDisplay(WiFiDirectDisplayType type, int port, int hdcp); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_display_availability")] + internal static extern int SetDisplayAvailability(bool availability); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_display_type")] + internal static extern int GetDisplayType(string address, out WiFiDirectDisplayType type); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_display_availability")] + internal static extern int GetDisplayAvailability(string address, out bool availability); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_display_hdcp")] + internal static extern int GetDisplayHdcp(string address, out int hdcp); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_display_port")] + internal static extern int GetDisplayPort(string address, out int port); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_display_throughput")] + internal static extern int GetDisplayThroughput(string address, out int throughput); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_peer_rssi")] + internal static extern int GetRssi(string address, out int rssi); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_get_session_timer")] + internal static extern int GetSessionTimer(out int seconds); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_session_timer")] + internal static extern int SetSessionTimer(int seconds); + [DllImport(Libraries.WiFiDirect,EntryPoint = "wifi_direct_set_auto_group_removal")] + internal static extern int SetAutoGroupRemoval(bool enable); + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.csproj b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.csproj new file mode 100644 index 0000000..04e4d6e --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.csproj @@ -0,0 +1,18 @@ + + + + + netstandard1.6 + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.sln b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.sln new file mode 100755 index 0000000..d005b55 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Network.WiFiDirect", "Tizen.Network.WiFiDirect.csproj", "{5DC9DD9A-CBBE-4530-8981-1D536BCE61A8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{B67770FC-C563-4BB5-B0A0-0B0A8B546D55}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{565F2935-FA76-4D11-B79D-C7F19FA498C8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5DC9DD9A-CBBE-4530-8981-1D536BCE61A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DC9DD9A-CBBE-4530-8981-1D536BCE61A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DC9DD9A-CBBE-4530-8981-1D536BCE61A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DC9DD9A-CBBE-4530-8981-1D536BCE61A8}.Release|Any CPU.Build.0 = Release|Any CPU + {B67770FC-C563-4BB5-B0A0-0B0A8B546D55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B67770FC-C563-4BB5-B0A0-0B0A8B546D55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B67770FC-C563-4BB5-B0A0-0B0A8B546D55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B67770FC-C563-4BB5-B0A0-0B0A8B546D55}.Release|Any CPU.Build.0 = Release|Any CPU + {565F2935-FA76-4D11-B79D-C7F19FA498C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {565F2935-FA76-4D11-B79D-C7F19FA498C8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {565F2935-FA76-4D11-B79D-C7F19FA498C8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {565F2935-FA76-4D11-B79D-C7F19FA498C8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/NamespaceDoc.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/NamespaceDoc.cs new file mode 100644 index 0000000..3052502 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/NamespaceDoc.cs @@ -0,0 +1,7 @@ +/** + +The Tizen.Network.WiFiDirect namespace provides classes to manage the settings of Wi-Fi Direct. +In addition, this namespace provides classes to connect and disconnect remote devices using Wi-Fi Direct. + +*/ +namespace Tizen.Network.WiFiDirect {} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectData.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectData.cs new file mode 100644 index 0000000..a40a808 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectData.cs @@ -0,0 +1,160 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.ObjectModel; + +namespace Tizen.Network.WiFiDirect +{ + [StructLayout(LayoutKind.Sequential)] + internal struct DiscoveredPeerStruct + { + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _name; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _macAddress; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _interfaceAddress; + + internal int _channel; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isConnected; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isGroupOwner; + + internal WiFiDirectPrimaryDeviceType _primaryType; + + internal WiFiDirectSecondaryDeviceType _secondaryType; + + internal int _wpsTypes; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isP2PInvitationSupported; + + internal uint _serviceCount; + + internal IntPtr _serviceList; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isMiracast; + } + [StructLayout(LayoutKind.Sequential)] + internal struct ConnectedPeerStruct + { + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _name; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _ipAddress; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _macAddress; + + [MarshalAsAttribute(UnmanagedType.LPStr)] + internal string _interfaceAddress; + + internal int _channel; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isP2PSupport; + + internal WiFiDirectPrimaryDeviceType _primaryType; + + internal WiFiDirectSecondaryDeviceType _secondaryType; + + internal uint _serviceCount; + + internal IntPtr _serviceList; + + [MarshalAsAttribute(UnmanagedType.I1)] + internal bool _isMiracast; + } + + internal static class WiFiDirectUtils + { + internal static WiFiDirectPeer ConvertStructToDiscoveredPeer(DiscoveredPeerStruct peer) + { + WiFiDirectPeer resultPeer = new WiFiDirectPeer(); + resultPeer._peerDeviceName = peer._name; + resultPeer._peerMacAddress = peer._macAddress; + resultPeer._peerInterfaceAddress = peer._interfaceAddress; + resultPeer._peerChannel = peer._channel; + resultPeer._isPeerConnected = peer._isConnected; + resultPeer._isPeerGroupOwner = peer._isGroupOwner; + resultPeer._peerPrimaryType = peer._primaryType; + resultPeer._peerSecondaryType = peer._secondaryType; + resultPeer._peerWpsTypes = peer._wpsTypes; + resultPeer._p2PInvitationSupported = peer._isP2PInvitationSupported; + Collection uuidList = null; + + if (peer._serviceCount > 0) + { + IntPtr[] serviceList = new IntPtr[peer._serviceCount]; + Marshal.Copy(peer._serviceList, serviceList, 0, (int)peer._serviceCount); + uuidList = new Collection(); + foreach (IntPtr service in serviceList) + { + string registeredService = Marshal.PtrToStringAnsi(service); + uuidList.Add(registeredService); + } + + resultPeer._peerServiceCount = peer._serviceCount; + resultPeer._peerServiceList = uuidList; + } + + resultPeer._isPeerMiracastDevice = peer._isMiracast; + return resultPeer; + } + + internal static WiFiDirectPeer ConvertStructToConnectedPeer(ConnectedPeerStruct peer) + { + WiFiDirectPeer resultPeer = new WiFiDirectPeer(); + resultPeer._peerDeviceName = peer._name; + resultPeer._peerIpAddress = peer._ipAddress; + resultPeer._peerMacAddress = peer._macAddress; + resultPeer._peerInterfaceAddress = peer._interfaceAddress; + resultPeer._peerChannel = peer._channel; + resultPeer._peerP2PSupport = peer._isP2PSupport; + resultPeer._peerPrimaryType = peer._primaryType; + resultPeer._peerSecondaryType = peer._secondaryType; + Collection uuidList = null; + + if (peer._serviceCount > 0) + { + IntPtr[] serviceList = new IntPtr[peer._serviceCount]; + Marshal.Copy(peer._serviceList, serviceList, 0, (int)peer._serviceCount); + uuidList = new Collection(); + foreach (IntPtr service in serviceList) + { + string registeredService = Marshal.PtrToStringAnsi(service); + uuidList.Add(registeredService); + } + + resultPeer._peerServiceCount = peer._serviceCount; + resultPeer._peerServiceList = uuidList; + } + + resultPeer._isPeerMiracastDevice = peer._isMiracast; + return resultPeer; + } + } + +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEnumerations.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEnumerations.cs new file mode 100644 index 0000000..12461d2 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEnumerations.cs @@ -0,0 +1,649 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Network.WiFiDirect +{ + /// + /// Enumeration for Wi-Fi Direct discovery state. + /// + public enum WiFiDirectDiscoveryState + { + /// + /// Only listen has started. + /// + OnlyListenStarted = 0, + /// + /// Discovery started. + /// + Started, + /// + /// A remote peer is found. + /// + Found, + /// + /// Discovery finished. + /// + Finished, + /// + /// A remote peer is lost. + /// + Lost + } + + /// + /// Enumeration for Wi-Fi Direct display device type. + /// + public enum WiFiDirectDisplayType + { + /// + /// Configure as WFD source. + /// + Source = 0, + /// + /// Configure as WFD primary sink. + /// + Prisink, + /// + /// Configure as WFD secondary sink. + /// + Secsink, + /// + /// Configure as WFD dual role. + /// + Dual + } + + /// + /// Enumeration for Wi-Fi Discovery channel. + /// + public enum WiFiDirectDiscoveryChannel + { + /// + /// Scan full channel. + /// + FullScan = 0, + /// + /// The social channel. + /// + SocialChannel = 1611, + /// + /// Scan channel 1. + /// + Channel1 = 1, + /// + /// Scan channel 6. + /// + Channel6 = 6, + /// + /// Scan channel 11. + /// + Channel11 = 11 + } + + /// + /// Enumeration for Wi-Fi Direct connection state. + /// + public enum WiFiDirectConnectionState + { + /// + /// Connection is requested. + /// + ConnectionRequest, + /// + /// Wps is requested. + /// + ConnectionWpsRequest, + /// + /// Connection in progress. + /// + ConnectionInProgress, + /// + /// Connected . + /// + ConnectionRsp, + /// + /// Disconnected by remote group client. + /// + DisassociationInd, + /// + /// Disconnected by local device. + /// + DisconnectRsp, + /// + /// Disconnected by remote group owner. + /// + DisconnectInd, + /// + /// Group is created. + /// + GroupCreated, + /// + /// Group is destroyed. + /// + GroupDestroyed + } + + /// + /// Enumeration for Wi-Fi Direct primary device type. + /// + public enum WiFiDirectPrimaryDeviceType + { + /// + /// Computer. + /// + Computer = 1, + /// + /// Input device. + /// + InputDevice = 2, + /// + /// Printer. + /// + Printer = 3, + /// + /// Camera. + /// + Camera = 4, + /// + /// Storage. + /// + Storage = 5, + /// + /// Network Infrastructure. + /// + NetworkInfrastructure = 6, + /// + /// Display. + /// + Display = 7, + /// + /// Multimedia device. + /// + MultimediaDevice = 8, + /// + /// Game device. + /// + GameDevice = 9, + /// + /// Telephone. + /// + Telephone = 10, + /// + /// Audio. + /// + Audio = 11, + /// + /// Others. + /// + Other = 255 + } + + /// + /// Enumeration for Wi-Fi Direct secondary device type. + /// + public enum WiFiDirectSecondaryDeviceType + { + /// + /// Computer PC. + /// + ComputerPc = 1, + /// + /// Computer server. + /// + ComputerServer = 2, + /// + /// Computer media center. + /// + ComputerMediaCenter = 3, + /// + /// Computer UMPC. + /// + ComputerUmpc = 4, + /// + /// Computer notebook. + /// + ComputerNotebook = 5, + /// + /// Computer desktop + /// + ComputerDesktop = 6, + /// + /// Computer MID. + /// + ComputerMid = 7, + /// + /// Computer netbook. + /// + ComputerNetbook = 8, + /// + /// Input keyboard. + /// + InputKeyboard = 1, + /// + /// Input mouse. + /// + InputMouse = 2, + /// + /// Input joystick. + /// + InputJoystick = 3, + /// + /// Input trackball. + /// + InputTrackball = 4, + /// + /// Input controller. + /// + InputController = 5, + /// + /// Inpute remote. + /// + InputRemote = 6, + /// + /// Input touch screen. + /// + InputTouchScreen = 7, + /// + /// Input biometric reader. + /// + InputBiometricReader = 8, + /// + /// Input barcode reader. + /// + InputBarcodeReader = 9, + /// + /// Printer. + /// + Printer = 1, + /// + /// Printer scanner. + /// + PrinterScanner = 2, + /// + /// Printer fax. + /// + PrinterFax = 3, + /// + /// Printer copier. + /// + PrinterCopier = 4, + /// + /// Printer all-in-one. + /// + PrinterAllInOne = 5, + /// + /// Digital still camera. + /// + CameraDigital = 1, + /// + /// Video camera. + /// + CameraVideo = 2, + /// + /// Webcam. + /// + CameraWebcam = 3, + /// + /// Security camera. + /// + CameraSecurity = 4, + /// + /// Storage NAS. + /// + StorageNas = 1, + /// + /// Network ap. + /// + NetworkAp = 1, + /// + /// Network router. + /// + NetworkRouter = 2, + /// + /// Network switch. + /// + NetworkSwitch = 3, + /// + /// Network gateway. + /// + NetworkGateway = 4, + /// + /// Display tv. + /// + DisplayTv = 1, + /// + /// Display picture frame. + /// + DisplayPicFrame = 2, + /// + /// Display projector. + /// + DisplayProjector = 3, + /// + /// Display monitor. + /// + DisplayMonitor = 4, + /// + /// Multimedia DAR. + /// + MultimediaDar = 1, + /// + /// Multimedia PVR. + /// + MultimediaPvr = 2, + /// + /// Multimedia MCX. + /// + MultimediaMcx = 3, + /// + /// Multimedia set-top box. + /// + MultimediaStb = 4, + /// + /// Media Server / Media Adapter / Media Extender. + /// + MultimediaMsMaMe = 5, + /// + /// Multimedia portable video player. + /// + MultimediaPvp = 6, + /// + /// Game xbox. + /// + GameXbox = 1, + /// + /// The game xbox 360. + /// + GameXbox360, + /// + /// Game play station. + /// + GamePlayStation = 2, + /// + /// Game console. + /// + GameConsole = 3, + /// + /// Game portable. + /// + GamePortable = 4, + /// + /// Windows mobile. + /// + TelephoneWindowsMobile = 1, + /// + /// Phone - single mode. + /// + TelephonePhoneSingle = 2, + /// + /// Phone - dual mode. + /// + TelephonePhoneDual = 3, + /// + /// Smart Phone - single mode. + /// + TelephoneSmartphoneSingle = 4, + /// + /// Smart Phone - dual mode. + /// + TelephoneSmartphoneDual = 5, + /// + /// Audio tuner. + /// + AudioTuner = 1, + /// + /// Audio speaker. + /// + AudioSpeaker = 2, + /// + /// Audio pmp. + /// + AudioPmp = 3, + /// + /// Audio headset. + /// + AudioHeadset = 4, + /// + /// Audio headphone. + /// + AudioHeadphone = 5, + /// + /// Audio microphone. + /// + AudioMic = 6 + } + + /// + /// Enumeration for Wi-Fi Direct link status. + /// + public enum WiFiDirectState + { + /// + /// Deactivated. + /// + Deactivated = 0, + /// + /// Deactivating. + /// + Deactivating, + /// + /// Activating. + /// + Activating, + /// + /// Activated. + /// + Activated, + /// + /// Discovering. + /// + Discovering, + /// + /// Connecting. + /// + Connecting, + /// + /// Disconnecting. + /// + Disconnecting, + /// + /// Connected. + /// + Connected, + /// + /// Group owner. + /// + GroupOwner + } + + /// + /// Enumeration for Wi-Fi WPS type. + /// + public enum WiFiDirectWpsType + { + /// + /// No WPS type. + /// + None = 0x00, + /// + /// Push button configuration. + /// + Pbc = 0x01, + /// + /// Display pin code. + /// + PinDisplay = 0x02, + /// + /// Provide the keypad to input the pin. + /// + PinKeypad = 0x04 + } + + /// + /// Enumeration for Service Discovery type. + /// + public enum WiFiDirectServiceType + { + /// + /// Service discovery Type all. + /// + All, + /// + /// Service discovery Type bonjour. + /// + Bonjour, + /// + /// Service discovery Type UPNP. + /// + Upnp, + /// + /// Service discovery Type ws discovery. + /// + WsDiscovery, + /// + /// Service discovery Type wifi-display. + /// + WiFiDisplay, + /// + /// Service discovery Type bt address. + /// + BtAddress, + /// + /// Service discovery Type contact info. + /// + ContactInfo, + /// + /// Service discovery Type vendor-specific. + /// + Vendor + } + + /// + /// Enumeration for Wi-Fi Direct service Discovery state. + /// + public enum WiFiDirectServiceDiscoveryState + { + /// + /// Service discovery started. + /// + Started, + /// + /// Service discovery found. + /// + Found, + /// + /// Service discovery finished. + /// + Finished + } + + /// + /// Enumeration for Wi-Fi Direct device state. + /// + public enum WiFiDirectDeviceState + { + /// + /// Activated. + /// + Activated, + /// + /// Deactivated. + /// + Deactivated + } + + /// + /// Enumeration for Wi-Fi Direct error code. + /// + public enum WiFiDirectError + { + /// + /// Successful. + /// + None = ErrorCode.None, + /// + /// Operation not permitted. + /// + NotPermitted = ErrorCode.NotPermitted, + /// + /// Out of memory. + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// Permission denied. + /// + PermissionDenied = ErrorCode.PermissionDenied, + /// + /// Device or resource busy. + /// + ResourceBusy = ErrorCode.ResourceBusy, + /// + /// Invalid function parameter. + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Connection timed out. + /// + ConnectionTimeOut = ErrorCode.ConnectionTimeout, + /// + /// Not supported. + /// + NotSupported = ErrorCode.NotSupported, + /// + /// Not initialized. + /// + NotInitialized = -0x01C60000 | 0x01, + /// + /// I/O error. + /// + CommunicationFailed = -0x01C60000 | 0x02, + /// + /// WiFi is being used. + /// + WiFiUsed = -0x01C60000 | 0x03, + /// + /// Mobile AP is being used. + /// + MobileApUsed = -0x01C60000 | 0x04, + /// + /// Connection failed. + /// + ConnectionFailed = -0x01C60000 | 0x05, + /// + /// Authentication failed. + /// + AuthFailed = -0x01C60000 | 0x06, + /// + /// Operation failed. + /// + OperationFailed = -0x01C60000 | 0x07, + /// + /// Too many client. + /// + TooManyClient = -0x01C60000 | 0x08, + /// + /// Already initialized client. + /// + AlreadyInitialized = -0x01C60000 | 0x09, + /// + /// Connection cancelled by local device. + /// + ConnectionCancelled = -0x01C60000 | 0x10 + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectError.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectError.cs new file mode 100644 index 0000000..80e929e --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectError.cs @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFiDirect +{ + internal static class WiFiDirectErrorFactory + { + internal static void ThrowWiFiDirectException(int exception) + { + WiFiDirectError _error = (WiFiDirectError)exception; + switch (_error) + { + case WiFiDirectError.InvalidParameter: + throw new InvalidOperationException("Invalid parameter"); + case WiFiDirectError.AlreadyInitialized: + throw new InvalidOperationException("Already initialized"); + case WiFiDirectError.AuthFailed: + throw new InvalidOperationException("Authentication failed"); + case WiFiDirectError.CommunicationFailed: + throw new InvalidOperationException("Communication failed"); + case WiFiDirectError.ConnectionCancelled: + throw new InvalidOperationException("Connection cancelled"); + case WiFiDirectError.ConnectionFailed: + throw new InvalidOperationException("Connection failed"); + case WiFiDirectError.ConnectionTimeOut: + throw new InvalidOperationException("Connection timed out"); + case WiFiDirectError.MobileApUsed: + throw new InvalidOperationException("Mobile Ap is being used"); + case WiFiDirectError.NotInitialized: + throw new InvalidOperationException("Not initialized"); + case WiFiDirectError.NotPermitted: + throw new InvalidOperationException("Not permitted"); + case WiFiDirectError.NotSupported: + throw new NotSupportedException("Not supported"); + case WiFiDirectError.OperationFailed: + throw new InvalidOperationException("Operation failed"); + case WiFiDirectError.OutOfMemory: + throw new InvalidOperationException("Out of memory"); + case WiFiDirectError.PermissionDenied: + throw new UnauthorizedAccessException("Permission denied (http://tizen.org/privilege/wifidirect)"); + case WiFiDirectError.ResourceBusy: + throw new InvalidOperationException("Resource is busy"); + case WiFiDirectError.TooManyClient: + throw new InvalidOperationException("Too many client"); + case WiFiDirectError.WiFiUsed: + throw new InvalidOperationException("Wi-fi is being used"); + } + } + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEventArgs.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEventArgs.cs new file mode 100644 index 0000000..b87af3b --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectEventArgs.cs @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Network.WiFiDirect +{ + /// + /// An extended EventArgs class which contains changed connection state during connecting or disconnecting peer device. + /// + public class ConnectionStateChangedEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectConnectionState _state; + private string _macAddress; + + internal ConnectionStateChangedEventArgs(WiFiDirectError error, WiFiDirectConnectionState state, string macAddress) + { + _error = error; + _state = state; + _macAddress = macAddress; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// Wi-Fi Direct connection state of peer. + /// + public WiFiDirectConnectionState State + { + get + { + return _state; + } + } + + /// + /// MacAddress of peer. + /// + public string MacAddress + { + get + { + return _macAddress; + } + } + } + + /// + /// An extended EventArgs class which contains address properties of the peer when it connects to a group owner. + /// + public class IpAddressAssignedEventArgs : EventArgs + { + private string _macAddress; + private string _ipAddress; + private string _interfaceAddress; + + internal IpAddressAssignedEventArgs(string macAddress, string ipAddress, string interfaceAddress) + { + _macAddress = macAddress; + _ipAddress = ipAddress; + _interfaceAddress = interfaceAddress; + } + + /// + /// MacAddress of connected peer. + /// + public string MacAddress + { + get + { + return _macAddress; + } + } + + /// + /// IpAddress of connected peer. + /// + public string IpAddress + { + get + { + return _ipAddress; + } + } + + /// + /// InterfaceAddress of connected peer. + /// + public string InterfaceAddress + { + get + { + return _interfaceAddress; + } + } + } + + /// + /// An extended EventArgs class which contains changed Wi-Fi Direct state of local device. + /// + public class StateChangedEventArgs : EventArgs + { + private WiFiDirectState _state; + + internal StateChangedEventArgs(WiFiDirectState state) + { + _state = state; + } + + /// + /// Wi-Fi Direct state. + /// + public WiFiDirectState State + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class which contains changed Wi-Fi Direct discovery state during Wi-Fi Direct scan operation. + /// + public class DiscoveryStateChangedEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectDiscoveryState _state; + + internal DiscoveryStateChangedEventArgs(WiFiDirectError error, WiFiDirectDiscoveryState state) + { + _error = error; + _state = state; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// Wi-Fi Direct Discovery state. + /// + public WiFiDirectDiscoveryState DiscoveryState + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class which contains found peer information during Wi-Fi Direct scan operation. + /// + public class PeerFoundEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectDiscoveryState _state; + private WiFiDirectPeer _peer; + + internal PeerFoundEventArgs(WiFiDirectError error, WiFiDirectDiscoveryState state, WiFiDirectPeer peer) + { + _error = error; + _state = state; + _peer = peer; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// Wi-Fi Direct Discovery state. + /// + public WiFiDirectDiscoveryState DiscoveryState + { + get + { + return _state; + } + } + + /// + /// Found peer. + /// + public WiFiDirectPeer Peer + { + get + { + return _peer; + } + } + } + + /// + /// An extended EventArgs class which contains changed device state during activation or deactivation. + /// + public class DeviceStateChangedEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectDeviceState _state; + + internal DeviceStateChangedEventArgs(WiFiDirectError error, WiFiDirectDeviceState state) + { + _error = error; + _state = state; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// State of the device. + /// + public WiFiDirectDeviceState DeviceState + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class which contains changed service information during service discovery. + /// + public class ServiceStateChangedEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectServiceDiscoveryState _state; + private WiFiDirectServiceType _type; + private string _response; + private WiFiDirectPeer _peer; + + internal ServiceStateChangedEventArgs(WiFiDirectError error, WiFiDirectServiceDiscoveryState state, WiFiDirectServiceType type, string response, WiFiDirectPeer peer) + { + _error = error; + _state = state; + _type = type; + _response = response; + _peer = peer; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// Service discovery state. + /// + public WiFiDirectServiceDiscoveryState ServiceDiscoveryState + { + get + { + return _state; + } + } + + /// + /// Types of service. + /// + public WiFiDirectServiceType ServiceType + { + get + { + return _type; + } + } + + /// + /// Received response. + /// + public string Response + { + get + { + return _response; + } + } + + /// + /// Peer servicing device. + /// + public WiFiDirectPeer Peer + { + get + { + return _peer; + } + } + } + + /// + /// An extended EventArgs class which contains changed connection state during disconnect all peers or group related operations. + /// + public class ConnectionStatusChangedEventArgs : EventArgs + { + private WiFiDirectError _error; + private WiFiDirectConnectionState _state; + + internal ConnectionStatusChangedEventArgs(WiFiDirectError error, WiFiDirectConnectionState state) + { + _error = error; + _state = state; + } + + /// + /// Wi-Fi Direct result. + /// + public WiFiDirectError Error + { + get + { + return _error; + } + } + + /// + /// Connection state. + /// + public WiFiDirectConnectionState ConnectionState + { + get + { + return _state; + } + } + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManager.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManager.cs new file mode 100644 index 0000000..2a1bf99 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManager.cs @@ -0,0 +1,1628 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.ComponentModel; +using System.Collections.Generic; + +namespace Tizen.Network.WiFiDirect +{ + /// + /// A class which is used to manage settings of Wi-Fi Direct.
+ /// This class is used to discover peer devices and manage settings of Wi-Fi Direct. + ///
+ public static class WiFiDirectManager + { + /// + /// Gets the IsInitialized. + /// + /// + /// A property to check whether the Wifidirect is initialized or not. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If it is not initialized, false will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + [EditorBrowsable(EditorBrowsableState.Never)] + public static bool IsInitialized + { + get + { + return WiFiDirectManagerImpl.Instance.IsInitialize; + } + } + /// + /// Gets the IsGroupOwner. + /// + /// + /// A property to check whether the device is group owner or not. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, false will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool IsGroupOwner + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.IsGroupOwner; + } + + else + { + return false; + } + } + } + + /// + /// Gets the IsAutonomousGroup. + /// + /// + /// A property to check whether the current group is the autonomous group or not. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, false will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool IsAutonomousGroup + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.IsAutonomousGroup; + } + + else + { + return false; + } + } + } + + /// + /// Gets the Ssid. + /// + /// + /// SSID of local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string Ssid + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.Ssid; + } + + else + { + return null; + } + } + } + + /// + /// Gets the NetworkInterface. + /// + /// + /// Name of network interface. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string NetworkInterface + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.NetworkInterface; + } + + else + { + return null; + } + } + } + + /// + /// Gets the IpAddress. + /// + /// + /// IP address of a local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string IpAddress + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.IpAddress; + } + + else + { + return null; + } + } + } + + /// + /// Gets the SubnetMask. + /// + /// + /// Subnet mask. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string SubnetMask + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.SubnetMask; + } + + else + { + return null; + } + } + } + + /// + /// Gets the GatewayAddress. + /// + /// + /// Gateway address. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string GatewayAddress + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.GatewayAddress; + } + + else + { + return null; + } + } + } + + /// + /// Gets the MacAddress. + /// + /// + /// Mac address of a local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, null will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string MacAddress + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.MacAddress; + } + + else + { + return null; + } + } + } + + /// + /// Gets the State. + /// + /// + /// State of Wi-Fi direct service. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static WiFiDirectState State + { + get + { + return WiFiDirectManagerImpl.Instance.State; + } + } + + /// + /// A property to check whether the device is discoverable or not by P2P discovery. + /// + /// + /// + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool IsDiscoverable + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.IsDiscoverable; + } + + else + { + return false; + } + } + } + + /// + /// Gets the IsListenOnly. + /// + /// + /// A property to check whether the local device is listening only. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, false will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool IsListenOnly + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.IsListenOnly; + } + + else + { + return false; + } + } + } + + /// + /// Gets the PrimaryType. + /// + /// + /// Primary device type of local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, 0 will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static WiFiDirectPrimaryDeviceType PrimaryType + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.PrimaryType; + } + + else + { + return default(WiFiDirectPrimaryDeviceType); + } + } + } + + /// + /// Gets the SecondaryType. + /// + /// + /// Secondary device type of local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, 0 will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static WiFiDirectSecondaryDeviceType SecondaryType + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.SecondaryType; + } + + else + { + return default(WiFiDirectSecondaryDeviceType); + } + } + } + + /// + /// Gets the WpsMode. + /// + /// + /// Supported WPS (Wi-Fi Protected Setup) types at local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, -1 will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static int WpsMode + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.WpsMode; + } + + else + { + return -1; + } + } + } + + /// + /// Gets the Wps. + /// + /// + /// WPS (Wi-Fi Protected Setup) type. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static WiFiDirectWpsType Wps + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.WpsType; + } + + else + { + return default(WiFiDirectWpsType); + } + } + } + + /// + /// Gets the OperatingChannel. + /// + /// + /// Channel number on which the P2P Device is operating as the P2P Group. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// If there is any error, -1 will be returned. + /// + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static int OperatingChannel + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.OperatingChannel; + } + + else + { + return -1; + } + } + } + + /// + /// Gets and sets the PersistentGroupEnabled. + /// + /// + /// A property to check whether persistent group is enabled. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool PersistentGroupEnabled + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.PersistentGroupEnabled; + } + + else + { + return false; + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.PersistentGroupEnabled = value; + } + } + } + + /// + /// Gets and sets the AutoConnect. + /// + /// + /// Autoconnection mode status. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static bool AutoConnect + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.AutoConnect; + } + + else + { + return false; + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.AutoConnect = value; + } + } + } + + /// + /// Gets and sets the WpsPin. + /// + /// + /// WPS PIN number. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string WpsPin + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.WpsPin; + } + + else + { + return null; + } + } + + set + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.WpsPin = value; + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + } + + /// + /// Gets and sets the Name. + /// + /// + /// Name of local device. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string Name + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.Name; + } + + else + { + return null; + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.Name = value; + } + } + } + + /// + /// Gets and sets the RequestedWps. + /// + /// + /// Requested WPS (Wi-Fi Protected Setup) type. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static WiFiDirectWpsType RequestedWps + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.RequestedWps; + } + + else + { + return default(WiFiDirectWpsType); + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.RequestedWps = value; + } + } + } + + /// + /// Gets and sets the GroupOwnerIntent. + /// + /// + /// Intent of the group owner. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static int GroupOwnerIntent + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.GroupOwnerIntent; + } + + else + { + return -1; + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.GroupOwnerIntent = value; + } + } + } + + /// + /// Gets and sets the MaxClients. + /// + /// + /// Max number of clients. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static int MaxClients + { + get + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.MaxClients; + } + + else + { + return -1; + } + } + + set + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.MaxClients = value; + } + } + } + + /// + /// Gets and sets the Passphrase. + /// It is used during Wi-Fi Direct Group creation. + /// + /// + /// Wi-Fi Protected Access (WPA) password. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, null will be returned during get and Not permitted exception message will be returned during set. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static string Passphrase + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.Passphrase; + } + + else + { + return null; + } + } + + set + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.Passphrase = value; + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + } + + /// + /// Gets and sets the SessionTimer. + /// + /// + /// Connection session timer value in second. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If it is deactivated, -1 will be returned during get and Not permitted exception message will be returned during set. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static int SessionTimer + { + get + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.SessionTimer; + } + + else + { + return -1; + } + } + + set + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.SessionTimer = value; + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + } + + /// + /// (event) StateChanged is raised when Wi-Fi Direct state is changed. + /// + public static event EventHandler StateChanged + { + add + { + WiFiDirectManagerImpl.Instance.StateChanged += value; + } + + remove + { + WiFiDirectManagerImpl.Instance.StateChanged -= value; + } + } + + /// + /// (event) DiscoveryStateChanged is raised when Wi-Fi Direct discovery state is changed. + /// + public static event EventHandler DiscoveryStateChanged + { + add + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.DiscoveryStateChanged += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.DiscoveryStateChanged -= value; + } + } + } + + /// + /// (event) DeviceStateChanged is raised when device state is changed. + /// + public static event EventHandler DeviceStateChanged + { + add + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.DeviceStateChanged += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.DeviceStateChanged -= value; + } + } + } + + /// + /// (event) PeerFound is raised when peer is found. + /// + public static event EventHandler PeerFound + { + add + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.PeerFound += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.PeerFound -= value; + } + } + } + + /// + /// (event) ConnectionStatusChanged is raised when status of connection is changed. + /// + public static event EventHandler ConnectionStatusChanged + { + add + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.ConnectionStatusChanged += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.ConnectionStatusChanged -= value; + } + } + } + + /// + /// Activates the Wi-Fi Direct service. + /// + /// + /// If this succeeds, DeviceStateChanged event will be invoked. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void Activate() + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.Activate(); + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct is not initialized"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized); + } + } + + /// + /// Deactivates the Wi-Fi Direct service. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, DeviceStateChanged event will be invoked. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void Deactivate() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.Deactivate(); + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Starts discovery to find all P2P capable devices. + /// + /// Listen status.If False, then cycle between Scan and Listen.If True, then skip the initial 802.11 Scan and enter Listen state. + /// Duration of discovery period, in seconds. + /// Discovery channel.It is optional, default enum value FullScan is assigned. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void StartDiscovery(bool listenOnly, int duration, WiFiDirectDiscoveryChannel channel = WiFiDirectDiscoveryChannel.FullScan) + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.StartDiscovery(listenOnly, duration, channel); + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Cancels discovery process. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Discovery must be started by StartDiscovery. + /// If this succeeds, DiscoveryStateChanged and PeerFound event will be invoked. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void CancelDiscovery() + { + if (WiFiDirectManager.State == WiFiDirectState.Discovering) + { + WiFiDirectManagerImpl.Instance.CancelDiscovery(); + } + + else + { + Log.Error(Globals.LogTag, "Wi-Fi direct discovery is not started"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Gets the information of discovered peers. + /// + /// List of discovered peer objects. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static IEnumerable GetDiscoveredPeers() + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.GetDiscoveredPeers(); + } + + else + { + return null; + } + } + + /// + /// Gets the information of connected peers. + /// + /// List of connected peer objects. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static IEnumerable GetConnectedPeers() + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.GetConnectedPeers(); + } + + else + { + return null; + } + } + + /// + /// Disconnects all connected links to peers. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ConnectionStatusChanged event will be invoked. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void DisconnectAll() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.DisconnectAll(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Creates a Wi-Fi Direct group and sets up device as the group owner. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupCreated. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void CreateGroup() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.CreateGroup(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Destroys the Wi-Fi Direct group owned by a local device.If creating a group is in progress, this API cancels that process. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ConnectionStatusChanged event will be invoked with GroupDestroyed. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void DestroyGroup() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.DestroyGroup(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Set the WPS config PBC as preferred method for connection. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void ActivatePushButton() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.ActivatePushButton(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Gets the supported WPS types. + /// + /// The list of supported wps types. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static IEnumerable GetSupportedWpsTypes() + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.GetSupportedWpsTypes(); + } + + else + { + return null; + } + } + + /// + /// Gets the persistent groups. + /// + /// List of the persistent group objects. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static IEnumerable GetPersistentGroups() + { + if (Globals.IsInitialize) + { + return WiFiDirectManagerImpl.Instance.GetPersistentGroups(); + } + + else + { + return null; + } + } + + /// + /// Removes a persistent group. + /// + /// Persistent group owner. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void RemovePersistentGroup(WiFiDirectPersistentGroup group) + { + if (Globals.IsInitialize) + { + WiFiDirectManagerImpl.Instance.RemovePersistentGroup(group); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotInitialized); + } + } + + /// + /// Initializes or Deintializes the WiFi-Direct Display(MIRACAST) service. + /// + /// Enables/Disables service. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.display + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect display feature is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void InitMiracast(bool enable) + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.InitMiracast(enable); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Enables Wi-Fi Display functionality. + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.display + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect display feature is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void InitDisplay() + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.InitDisplay(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Disable Wi-Fi Display(WFD) functionality and disable the support of WFD Information Element(IE). + /// + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.display + /// + /// + /// Wi-Fi Direct must be activated and WFD must be enabled. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect display feature is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void DeinitDisplay() + { + if (Globals.IsActivated && Globals.s_isDisplay) + { + WiFiDirectManagerImpl.Instance.DeinitDisplay(); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Sets the Wi-Fi Display parameters for the WFD IE of local device. + /// + /// WFD Device Type: define the Role of WFD device like source or sink. + /// Specifies Session Management Control Port number. It should be 2 bytes(0~65535). + /// CP support bit: (1 = enable the hdcp support, 0 = disable the hdcp support). + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.display + /// + /// + /// Wi-Fi Direct must be activated and WFD must be enabled. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect display feature is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void SetDisplay(WiFiDirectDisplayType type, int port, int hdcp) + { + if (Globals.IsActivated && Globals.s_isDisplay) + { + WiFiDirectManagerImpl.Instance.SetDisplay(type, port, hdcp); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Sets the Wi-Fi Display session availability. + /// + /// Wi-Fi Display session availability. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.display + /// + /// + /// Wi-Fi Direct must be activated and WFD must be enabled. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect display feature is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void SetDisplayAvailability(bool availability) + { + if (Globals.IsActivated && Globals.s_isDisplay) + { + WiFiDirectManagerImpl.Instance.SetDisplayAvailability(availability); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated and/or Wi-Fi display is not enabled"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Sets the automatic group removal feature when all peers are disconnected. + /// + /// Enables/Disables group removal feature. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// + /// + /// Wi-Fi Direct must be activated. + /// ConnectionStatusChanged event will be invoked with GroupDestroyed when this feature is enabled and there's no connected group client and if device is group owner. + /// + /// The object is in invalid state. + /// The required feature is not supported. + /// Thrown when application does not have privilege to access this method. + public static void SetAutoGroupRemove(bool enable) + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.SetAutoGroupRemove(enable); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Registers the service. + /// + /// The service Id of service getting registered. + /// Type of Wi-Fi Direct Service. + /// Service specific information. + /// Service information. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.service_discovery + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error while registering service, 0 will be returned. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect service discovery is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static uint RegisterService(WiFiDirectServiceType type, string info, string serviceInfo) + { + if (Globals.IsActivated) + { + return WiFiDirectManagerImpl.Instance.RegisterService(type, info, serviceInfo); + } + + else + { + return 0; + } + } + + /// + /// Deregisters for a service used for WiFi Direct Service Discovery. + /// + /// Service ID for which service has to be deregistered. + /// + /// http://tizen.org/privilege/wifidirect + /// + /// + /// http://tizen.org/feature/network.wifidirect + /// http://tizen.org/feature/network.wifi.direct.service_discovery + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect service discovery is not supported + /// + /// The object is in invalid state. + /// Thrown when application does not have privilege to access this method. + public static void DeregisterService(uint serviceId) + { + if (Globals.IsActivated) + { + WiFiDirectManagerImpl.Instance.DeregisterService(serviceId); + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManagerImpl.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManagerImpl.cs new file mode 100644 index 0000000..9c06edc --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectManagerImpl.cs @@ -0,0 +1,1248 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading; + +namespace Tizen.Network.WiFiDirect +{ + internal class WiFiDirectThreadLocal + { + private int _threadId; + internal WiFiDirectThreadLocal(int id) + { + _threadId = id; + } + + public int ThreadId + { + get + { + return _threadId; + } + } + + ~WiFiDirectThreadLocal() + { + Log.Info(Globals.LogTag, "Deinitializing Wi-Fi direct"); + int ret = Interop.WiFiDirect.Deinitialize(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to deinitialize Wi-Fi direct, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + else + { + Globals.s_isInitialize = false; + } + } + } + + internal static class Globals + { + internal const string LogTag = "Tizen.Network.WiFiDirect"; + internal static bool s_isInitialize = false; + internal static bool s_isDisplay = false; + private static ThreadLocal s_threadName = new ThreadLocal(() => + { + Log.Info(Globals.LogTag, "In threadlocal delegate"); + return new WiFiDirectThreadLocal(Thread.CurrentThread.ManagedThreadId); + }); + internal static bool IsActivated + { + get + { + WiFiDirectState _state = WiFiDirectManager.State; + if (IsInitialize) + { + if (_state == WiFiDirectState.Deactivated || _state == WiFiDirectState.Deactivating) + { + return false; + } + + else + { + return true; + } + } + + else + { + return false; + } + } + } + + private static bool IsUniqueThread() + { + if (s_threadName.IsValueCreated) + { + Log.Info(Globals.LogTag, "This thread is old"); + return false; + } + + else + { + WiFiDirectThreadLocal obj = s_threadName.Value; + Log.Info(Globals.LogTag, "This thread is new , Id = " + obj.ThreadId); + return true; + } + } + + internal static bool IsInitialize + { + get + { + if(Globals.IsUniqueThread() || !Globals.s_isInitialize) + { + WiFiDirectManagerImpl.Instance.Initialize(); + } + + return (Globals.s_isInitialize); + } + } + } + + /// + /// Implementation of Wi-Fi Direct Apis + /// + internal partial class WiFiDirectManagerImpl : IDisposable + { + private event EventHandler _stateChanged; + private event EventHandler _discoveryStateChanged; + private event EventHandler _peerFound; + private event EventHandler _deviceStateChanged; + private event EventHandler _connectionStatusChanged; + + private Interop.WiFiDirect.StateChangedCallback _stateChangedCallback; + private Interop.WiFiDirect.DiscoveryStateChangedCallback _discoveryStateChangedCallback; + private Interop.WiFiDirect.PeerFoundCallback _peerFoundCallback; + private Interop.WiFiDirect.DeviceStateChangedCallback _deviceStateChangedCallback; + private Interop.WiFiDirect.ConnectionStateChangedCallback _connectionChangedCallback; + + internal event EventHandler StateChanged + { + add + { + if (_stateChanged == null) + { + RegisterStateChangedEvent(); + } + + _stateChanged += value; + } + + remove + { + _stateChanged -= value; + if (_stateChanged == null) + { + UnregisterStateChangedEvent(); + } + } + } + + internal event EventHandler DiscoveryStateChanged + { + add + { + if (_discoveryStateChanged == null) + { + RegisterDiscoveryStateChangedEvent(); + } + + _discoveryStateChanged += value; + } + + remove + { + _discoveryStateChanged -= value; + if (_discoveryStateChanged == null) + { + UnregisterDiscoveryStateChangedEvent(); + } + } + } + + internal event EventHandler PeerFound + { + add + { + if (_peerFound == null) + { + RegisterPeerFoundEvent(); + } + + _peerFound += value; + } + + remove + { + _peerFound -= value; + if (_peerFound == null) + { + UnregisterPeerFoundEvent(); + } + } + } + + internal event EventHandler DeviceStateChanged + { + add + { + if (_deviceStateChanged == null) + { + RegisterDeviceStateChangedEvent(); + } + + _deviceStateChanged += value; + } + + remove + { + _deviceStateChanged -= value; + if (_deviceStateChanged == null) + { + UnregisterDeviceStateChangedEvent(); + } + } + } + + internal event EventHandler ConnectionStatusChanged + { + add + { + if (_connectionStatusChanged == null) + { + RegisterConnectionStatusChangedEvent(); + } + + _connectionStatusChanged += value; + } + + remove + { + _connectionStatusChanged -= value; + if (_connectionStatusChanged == null) + { + UnregisterConnectionStatusChangedEvent(); + } + } + } + + private bool _disposed = false; + private static WiFiDirectManagerImpl _instance; + + private void RegisterStateChangedEvent() + { + _stateChangedCallback = (WiFiDirectState stateInfo, IntPtr userData) => + { + if (_stateChanged != null) + { + WiFiDirectState state = stateInfo; + _stateChanged(null, new StateChangedEventArgs(state)); + } + }; + int ret = Interop.WiFiDirect.SetStateChangedCallback(_stateChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set Wi-Fi Direct state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterStateChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetStateChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset Wi-Fi Direct state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterDiscoveryStateChangedEvent() + { + _discoveryStateChangedCallback = (int result, WiFiDirectDiscoveryState stateInfo, IntPtr userData) => + { + if (_discoveryStateChanged != null) + { + WiFiDirectError error = (WiFiDirectError)result; + WiFiDirectDiscoveryState state = stateInfo; + _discoveryStateChanged(null, new DiscoveryStateChangedEventArgs(error, state)); + } + }; + int ret = Interop.WiFiDirect.SetDiscoveryStateChangedCallback(_discoveryStateChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set Wi-Fi Direct discovery state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterDiscoveryStateChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetDiscoveryStateChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset Wi-Fi Direct discovery state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterPeerFoundEvent() + { + _peerFoundCallback = (int result, WiFiDirectDiscoveryState stateInfo, string address, IntPtr userData) => + { + if (_peerFound != null) + { + WiFiDirectError error = (WiFiDirectError)result; + WiFiDirectDiscoveryState state = stateInfo; + IntPtr peer; + Interop.WiFiDirect.GetDiscoveredPeerInfo(address, out peer); + DiscoveredPeerStruct peerStruct = (DiscoveredPeerStruct)Marshal.PtrToStructure(peer, typeof(DiscoveredPeerStruct)); + _peerFound(null, new PeerFoundEventArgs(error, state, WiFiDirectUtils.ConvertStructToDiscoveredPeer(peerStruct))); + } + }; + int ret = Interop.WiFiDirect.SetPeerFoundCallback(_peerFoundCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set Wi-Fi Direct discovery state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterPeerFoundEvent() + { + int ret = Interop.WiFiDirect.UnsetPeerFoundCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset Wi-Fi Direct discovery state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterDeviceStateChangedEvent() + { + _deviceStateChangedCallback = (int result, WiFiDirectDeviceState stateInfo, IntPtr userData) => + { + if (_deviceStateChanged != null) + { + WiFiDirectError error = (WiFiDirectError)result; + WiFiDirectDeviceState state = stateInfo; + _deviceStateChanged(null, new DeviceStateChangedEventArgs(error, state)); + } + }; + int ret = Interop.WiFiDirect.SetDeviceStateChangedCallback(_deviceStateChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set device state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterDeviceStateChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetDeviceStateChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset device state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterConnectionStatusChangedEvent() + { + _connectionChangedCallback = (int result, WiFiDirectConnectionState stateInfo, string address, IntPtr userData) => + { + if (_connectionStatusChanged != null) + { + WiFiDirectError error = (WiFiDirectError)result; + WiFiDirectConnectionState state = stateInfo; + + _connectionStatusChanged(null, new ConnectionStatusChangedEventArgs(error, state)); + } + }; + int ret = Interop.WiFiDirect.SetConnectionChangedCallback(_connectionChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set connection status changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterConnectionStatusChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetConnectionChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset connection status changed callback, Error - " + (WiFiDirectError)ret); + } + } + + internal bool IsInitialize + { + get + { + return Globals.IsInitialize; + } + } + internal bool IsGroupOwner + { + get + { + bool isGroupOwner; + int ret = Interop.WiFiDirect.IsGroupOwner(out isGroupOwner); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get whether this device is the group owner or not, Error - " + (WiFiDirectError)ret); + } + + return isGroupOwner; + } + } + + internal bool IsAutonomousGroup + { + get + { + bool isAutonomousGroup; + int ret = Interop.WiFiDirect.IsAutonomousGroup(out isAutonomousGroup); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to check whether the current group is autonomous or not, Error - " + (WiFiDirectError)ret); + } + + return isAutonomousGroup; + } + } + + internal string Ssid + { + get + { + string ssid; + int ret = Interop.WiFiDirect.GetSsid(out ssid); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get SSID of local device, Error - " + (WiFiDirectError)ret); + return null; + } + + return ssid; + } + } + + internal string NetworkInterface + { + get + { + string networkInterface; + int ret = Interop.WiFiDirect.GetInterfaceName(out networkInterface); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get name of network interface, Error - " + (WiFiDirectError)ret); + return ""; + } + + return networkInterface; + } + } + + internal string IpAddress + { + get + { + string ipAddress; + int ret = Interop.WiFiDirect.GetIpAddress(out ipAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get IP address of local device, Error - " + (WiFiDirectError)ret); + return ""; + } + + return ipAddress; + } + } + + internal string SubnetMask + { + get + { + string subnetMask; + int ret = Interop.WiFiDirect.GetSubnetMask(out subnetMask); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get subnet mask, Error - " + (WiFiDirectError)ret); + return ""; + } + + return subnetMask; + } + } + + internal string GatewayAddress + { + get + { + string gatewayAddress; + int ret = Interop.WiFiDirect.GetGatewayAddress(out gatewayAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get gateway address, Error - " + (WiFiDirectError)ret); + return ""; + } + + return gatewayAddress; + } + } + + internal string MacAddress + { + get + { + string macAddress; + int ret = Interop.WiFiDirect.GetMacAddress(out macAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get mac address, Error - " + (WiFiDirectError)ret); + return null; + } + + return macAddress; + } + } + + internal WiFiDirectState State + { + get + { + WiFiDirectState state; + int ret = Interop.WiFiDirect.GetState(out state); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get state of Wi-Fi direct service, Error - " + (WiFiDirectError)ret); + } + + return state; + } + } + + internal bool IsDiscoverable + { + get + { + bool isDiscoverable; + int ret = Interop.WiFiDirect.IsDiscoverable(out isDiscoverable); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to check whether the device is discoverable, Error - " + (WiFiDirectError)ret); + } + + return isDiscoverable; + } + } + + internal bool IsListenOnly + { + get + { + bool isListenOnly; + int ret = Interop.WiFiDirect.IsListeningOnly(out isListenOnly); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to check whether the local device is listening only, Error - " + (WiFiDirectError)ret); + } + + return isListenOnly; + } + } + + internal WiFiDirectPrimaryDeviceType PrimaryType + { + get + { + WiFiDirectPrimaryDeviceType primaryType; + int ret = Interop.WiFiDirect.GetPrimaryType(out primaryType); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the primary device type of local device, Error - " + (WiFiDirectError)ret); + } + + return primaryType; + } + } + + internal WiFiDirectSecondaryDeviceType SecondaryType + { + get + { + WiFiDirectSecondaryDeviceType secondaryType; + int ret = Interop.WiFiDirect.GetSecondaryType(out secondaryType); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the secondary device type of local device, Error - " + (WiFiDirectError)ret); + } + + return secondaryType; + } + } + + internal int WpsMode + { + get + { + int mode; + int ret = Interop.WiFiDirect.GetWpsMode(out mode); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get supproted wps modes at local device, Error - " + (WiFiDirectError)ret); + return -1; + } + + return mode; + } + } + + internal WiFiDirectWpsType WpsType + { + get + { + WiFiDirectWpsType wpsType; + int ret = Interop.WiFiDirect.GetLocalWpsType(out wpsType); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the WPS type, Error - " + (WiFiDirectError)ret); + } + + return wpsType; + } + } + + internal int OperatingChannel + { + get + { + int channel; + int ret = Interop.WiFiDirect.GetChannel(out channel); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get operating channel, Error - " + (WiFiDirectError)ret); + return -1; + } + + return channel; + } + } + + internal bool PersistentGroupEnabled + { + get + { + bool isEnabled; + int ret = Interop.WiFiDirect.GetPersistentGroupState(out isEnabled); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to check persistent group state, Error - " + (WiFiDirectError)ret); + } + + return isEnabled; + } + + set + { + int ret = Interop.WiFiDirect.SetPersistentGroupState(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the persistent group state, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal bool AutoConnect + { + get + { + bool isAutoConnect; + int ret = Interop.WiFiDirect.GetAutoConnectionMode(out isAutoConnect); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get autoconnection mode status, Error - " + (WiFiDirectError)ret); + } + + return isAutoConnect; + } + + set + { + int ret = Interop.WiFiDirect.SetAutoConnectionMode(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the autoconnection mode, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal string WpsPin + { + get + { + string pin; + int ret = Interop.WiFiDirect.GetWpsPin(out pin); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get WPS pin, Error - " + (WiFiDirectError)ret); + } + + return pin; + } + + set + { + int ret = Interop.WiFiDirect.SetWpsPin(value.ToString()); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set or update WPS pin, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal string Name + { + get + { + string name; + int ret = Interop.WiFiDirect.GetName(out name); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get name of local device, Error - " + (WiFiDirectError)ret); + return null; + } + + return name; + } + + set + { + int ret = Interop.WiFiDirect.SetName(value.ToString()); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set name of local device, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal WiFiDirectWpsType RequestedWps + { + get + { + WiFiDirectWpsType wpsType; + int ret = Interop.WiFiDirect.GetReqWpsType(out wpsType); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the requested WPS type, Error - " + (WiFiDirectError)ret); + } + + return wpsType; + } + + set + { + int ret = Interop.WiFiDirect.SetReqWpsType(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the requested WPS type, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal int GroupOwnerIntent + { + get + { + int intent; + int ret = Interop.WiFiDirect.GetIntent(out intent); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the intent of the group owner, Error - " + (WiFiDirectError)ret); + } + + return intent; + } + + set + { + int ret = Interop.WiFiDirect.SetIntent(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the intent of the group owner, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal int MaxClients + { + get + { + int maxClients; + int ret = Interop.WiFiDirect.GetMaxClients(out maxClients); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the max number of clients, Error - " + (WiFiDirectError)ret); + } + + return maxClients; + } + + set + { + int ret = Interop.WiFiDirect.SetMaxClients(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the max number of clients, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal string Passphrase + { + get + { + string passphrase; + int ret = Interop.WiFiDirect.GetPassPhrase(out passphrase); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get Wi-Fi Protected Access password, Error - " + (WiFiDirectError)ret); + return ""; + } + + return passphrase; + } + + set + { + int ret = Interop.WiFiDirect.SetPassPhrase(value.ToString()); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set or update Wi-Fi Protected Access password, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal int SessionTimer + { + get + { + int sessionTimer; + int ret = Interop.WiFiDirect.GetSessionTimer(out sessionTimer); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the timer used to expire the connection session, Error - " + (WiFiDirectError)ret); + } + + return sessionTimer; + } + + set + { + int ret = Interop.WiFiDirect.SetSessionTimer(value); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the timer used to expire the connection session, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + } + + internal void Activate() + { + int ret = Interop.WiFiDirect.Activate(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to activate Wi-Fi direct service, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void Deactivate() + { + int ret = Interop.WiFiDirect.Deactivate(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to deactivate Wi-Fi direct service, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void StartDiscovery(bool listenOnly, int duration, WiFiDirectDiscoveryChannel channel = WiFiDirectDiscoveryChannel.FullScan) + { + int ret = Interop.WiFiDirect.StartDiscoveryInChannel(listenOnly, duration, channel); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to start discovery, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void CancelDiscovery() + { + int ret = Interop.WiFiDirect.StopDiscovery(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to cancel discovery, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal IEnumerable GetDiscoveredPeers() + { + List discoveredPeerList = new List(); + Interop.WiFiDirect.DiscoveredPeerCallback callback = (ref DiscoveredPeerStruct peer, IntPtr userData) => + { + if (!peer.Equals(null)) + { + discoveredPeerList.Add(WiFiDirectUtils.ConvertStructToDiscoveredPeer(peer)); + } + + return true; + }; + int ret = Interop.WiFiDirect.GetDiscoveredPeers(callback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get information of discovered peers, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + return discoveredPeerList; + } + + internal IEnumerable GetConnectedPeers() + { + List connectedPeerList = new List(); + Interop.WiFiDirect.ConnectedPeerCallback callback = (ref ConnectedPeerStruct peer, IntPtr userData) => + { + if (!peer.Equals(null)) + { + connectedPeerList.Add(WiFiDirectUtils.ConvertStructToConnectedPeer(peer)); + } + + return true; + }; + int ret = Interop.WiFiDirect.GetConnectedPeers(callback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get information of connected peers, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + return connectedPeerList; + } + + internal void DisconnectAll() + { + int ret = Interop.WiFiDirect.DisconnectAll(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect all connected links, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void CreateGroup() + { + int ret = Interop.WiFiDirect.CreateGroup(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to create a WiFi-Direct group, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void DestroyGroup() + { + int ret = Interop.WiFiDirect.DestroyGroup(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to destroy the WiFi-Direct group, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void ActivatePushButton() + { + int ret = Interop.WiFiDirect.ActivatePushButton(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the Wps config PBC, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal IEnumerable GetSupportedWpsTypes() + { + List wpsList = new List(); + Interop.WiFiDirect.WpsTypeCallback callback = (WiFiDirectWpsType type, IntPtr userData) => + { + if (!type.Equals(null)) + { + wpsList.Add(type); + } + + return true; + }; + int ret = Interop.WiFiDirect.GetWpsTypes(callback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the supported WPS types, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + return wpsList; + } + + internal IEnumerable GetPersistentGroups() + { + List persistentGroupList = new List(); + Interop.WiFiDirect.PersistentGroupCallback callback = (string address, string ssid, IntPtr userData) => + { + if (address != null && ssid != null) + { + persistentGroupList.Add(new WiFiDirectPersistentGroup(address, ssid)); + } + + return true; + }; + int ret = Interop.WiFiDirect.GetPersistentGroups(callback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the persistent groups, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + return persistentGroupList; + } + + internal void RemovePersistentGroup(WiFiDirectPersistentGroup group) + { + int ret = Interop.WiFiDirect.RemovePersistentGroup(group.MacAddress, group.Ssid); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to remove a persistent group, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void InitMiracast(bool enable) + { + int ret = Interop.WiFiDirect.InitMiracast(enable); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the WiFi-Direct Display(MIRACAST) service, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void InitDisplay() + { + int ret = Interop.WiFiDirect.InitDisplay(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to enable Wi-Fi Display functionality, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + else + { + Globals.s_isDisplay = true; + } + } + + internal void DeinitDisplay() + { + int ret = Interop.WiFiDirect.DeinitDisplay(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to disable Wi-Fi Display functionality, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + else + { + Globals.s_isDisplay = false; + } + } + + internal void SetDisplay(WiFiDirectDisplayType type, int port, int hdcp) + { + int ret = Interop.WiFiDirect.SetDisplay(type, port, hdcp); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the Wi-Fi Display parameters, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void SetDisplayAvailability(bool availability) + { + int ret = Interop.WiFiDirect.SetDisplayAvailability(availability); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set the Wi-Fi Display session availability, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal void SetAutoGroupRemove(bool enable) + { + int ret = Interop.WiFiDirect.SetAutoGroupRemoval(enable); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set automatic group removal feature when all peers are disconnected, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal uint RegisterService(WiFiDirectServiceType type, string info, string serviceInfo) + { + uint serviceId; + int ret = Interop.WiFiDirect.RegisterService(type, info, serviceInfo, out serviceId); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to register for service, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + return serviceId; + } + + internal void DeregisterService(uint serviceId) + { + int ret = Interop.WiFiDirect.DeregisterService(serviceId); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to deregister service, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + internal static WiFiDirectManagerImpl Instance + { + get + { + if (_instance == null) + { + _instance = new WiFiDirectManagerImpl(); + } + + return _instance; + } + } + + private WiFiDirectManagerImpl() + { + } + + internal void Initialize() + { + int ret = Interop.WiFiDirect.Initialize(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to initialize Wi-Fi direct, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + else + { + Globals.s_isInitialize = true; + } + } + + ~WiFiDirectManagerImpl() + { + Dispose(false); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (_disposed) + { + return; + } + + if (disposing) + { + // Free managed objects. + } + + //Free unmanaged objects + RemoveAllRegisteredEvent(); + Deinitialize(); + _disposed = true; + } + + private void Deinitialize() + { + int ret = Interop.WiFiDirect.Deinitialize(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to deinitialize Wi-Fi direct, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + + else + { + Globals.s_isInitialize = false; + } + } + + private void RemoveAllRegisteredEvent() + { + //unregister all remaining events when this object is released. + if (_stateChanged != null) + { + UnregisterStateChangedEvent(); + } + + if (_discoveryStateChanged != null) + { + UnregisterDiscoveryStateChangedEvent(); + } + + if (_peerFound != null) + { + UnregisterPeerFoundEvent(); + } + + if (_deviceStateChanged != null) + { + UnregisterDeviceStateChangedEvent(); + } + + if (_connectionStatusChanged != null) + { + UnregisterConnectionStatusChangedEvent(); + } + } + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPeer.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPeer.cs new file mode 100644 index 0000000..aebf2a6 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPeer.cs @@ -0,0 +1,754 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Collections.Concurrent; +using System.Collections.ObjectModel; +using System.Collections.Specialized; + +namespace Tizen.Network.WiFiDirect +{ + /// + /// WiFiDirectPeer class is used to handle the connection with remote devices using WiFi Direct. + /// + /// http://tizen.org/privilege/wifidirect + public class WiFiDirectPeer + { + private event EventHandler _connectionStateChanged; + private event EventHandler _ipAddressAssigned; + private event EventHandler _serviceStateChanged; + + private Interop.WiFiDirect.ConnectionStateChangedCallback _connectionStateChangedCallback; + private Interop.WiFiDirect.ClientIpAddressAssignedCallback _ipAddressAssignedCallback; + private Interop.WiFiDirect.ServiceStateChangedCallback _serviceStateChangedCallback; + + internal string _peerDeviceName; + internal string _peerIpAddress; + internal string _peerMacAddress; + internal string _peerInterfaceAddress; + internal int _peerChannel; + internal bool _isPeerConnected; + internal bool _isPeerGroupOwner; + internal bool _peerP2PSupport; + internal WiFiDirectPrimaryDeviceType _peerPrimaryType; + internal WiFiDirectSecondaryDeviceType _peerSecondaryType; + internal int _peerWpsTypes; + internal bool _p2PInvitationSupported; + internal uint _peerServiceCount; + internal IEnumerable _peerServiceList; + internal bool _isPeerMiracastDevice; + + internal WiFiDirectPeer() + { + } + + /// + /// Name of Peer device. + /// + public string Name + { + get + { + return _peerDeviceName; + } + } + + /// + /// Ip address of the peer device. + /// + public string IpAddress + { + get + { + return _peerIpAddress; + } + } + + /// + /// Mac address of the peer device. + /// + public string MacAddress + { + get + { + return _peerMacAddress; + } + } + + /// + /// Interface address of the peer device. + /// + public string InterfaceAddress + { + get + { + return _peerInterfaceAddress; + } + } + + /// + /// Listening channel of the peer device. + /// + public int Channel + { + get + { + return _peerChannel; + } + } + + /// + /// Connected state of the peer device. + /// + public bool IsConnected + { + get + { + return _isPeerConnected; + } + } + + /// + /// P2P group state of the peer device. + /// + public bool IsGroupOwner + { + get + { + return _isPeerGroupOwner; + } + } + + /// + /// P2P state of the peer device. + /// + public bool P2PSupport + { + get + { + return _peerP2PSupport; + } + } + + /// + /// Primary catagory of the peer device. + /// + public WiFiDirectPrimaryDeviceType PrimaryType + { + get + { + return _peerPrimaryType; + } + } + + /// + /// Sub category of the peer device. + /// + public WiFiDirectSecondaryDeviceType SecondaryType + { + get + { + return _peerSecondaryType; + } + } + + /// + /// List of supported WPS type of the peer device. + /// + public int WpsTypes + { + get + { + return _peerWpsTypes; + } + } + + /// + /// P2P invitation state of the peer device. + /// + public bool IsP2PInvitationSupported + { + get + { + return _p2PInvitationSupported; + } + } + + /// + /// Number of registered services of the peer device. + /// + public uint ServiceCount + { + get + { + return _peerServiceCount; + } + } + + /// + /// List of registered services of the peer device. + /// + public IEnumerable ServiceList + { + get + { + return _peerServiceList; + } + } + + /// + /// Checks if peer device is a wifi display device. + /// + public bool IsMiracastDevice + { + get + { + return _isPeerMiracastDevice; + } + } + + /// + /// Wi-Fi Display device type of the peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, default value of WiFiDirectDisplayType will be returned. + /// + public WiFiDirectDisplayType Display + { + get + { + if (Globals.IsActivated) + { + WiFiDirectDisplayType displayType; + int ret = Interop.WiFiDirect.GetDisplayType(_peerMacAddress, out displayType); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer display type, Error - " + (WiFiDirectError)ret); + } + + return displayType; + } + + else + { + return default(WiFiDirectDisplayType); + } + } + } + + /// + /// Wi-Fi Display Session Availability of the peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, false will be returned. + /// + public bool DisplayAvailability + { + get + { + if (Globals.IsActivated) + { + bool displayAvailability; + int ret = Interop.WiFiDirect.GetDisplayAvailability(_peerMacAddress, out displayAvailability); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer display availability, Error - " + (WiFiDirectError)ret); + } + + return displayAvailability; + } + + else + { + return false; + } + } + } + + /// + /// Hdcp information of the peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, -1 will be returned. + /// + public int Hdcp + { + get + { + if (Globals.IsActivated) + { + int hdcpSupport; + int ret = Interop.WiFiDirect.GetDisplayHdcp(_peerMacAddress, out hdcpSupport); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer display hdcp support, Error - " + (WiFiDirectError)ret); + return -1; + } + + return hdcpSupport; + } + + else + { + return -1; + } + } + } + + /// + /// Port of the connected peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, -1 will be returned. + /// + public int Port + { + get + { + if (Globals.IsActivated) + { + int displayPort; + int ret = Interop.WiFiDirect.GetDisplayPort(_peerMacAddress, out displayPort); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer display port, Error - " + (WiFiDirectError)ret); + return -1; + } + + return displayPort; + } + + else + { + return -1; + } + } + } + + /// + /// WiFi Display max throughput of the peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, -1 will be returned. + /// + public int Throughput + { + get + { + if (Globals.IsActivated) + { + int displayThroughput; + int ret = Interop.WiFiDirect.GetDisplayThroughput(_peerMacAddress, out displayThroughput); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer display max throughput, Error - " + (WiFiDirectError)ret); + return -1; + } + + return displayThroughput; + } + + else + { + return -1; + } + } + } + + /// + /// WiFi RSSI value of the peer device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If there is any error, -1 will be returned. + /// + public int Rssi + { + get + { + if (Globals.IsActivated) + { + int rssi; + int ret = Interop.WiFiDirect.GetRssi(_peerMacAddress, out rssi); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to get the peer RSSI, Error - " + (WiFiDirectError)ret); + return -1; + } + + return rssi; + } + + else + { + return -1; + } + } + } + /// + /// (event) ConnectionStateChanged event is raised when the connection state of the peer device changes. + /// + public event EventHandler ConnectionStateChanged + { + add + { + if (Globals.IsInitialize) + { + if (_connectionStateChanged == null) + { + RegisterConnectionStateChangedEvent(); + } + + _connectionStateChanged += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + _connectionStateChanged -= value; + if (_connectionStateChanged == null) + { + UnregisterConnectionStateChangedEvent(); + } + } + } + } + + /// + /// (event) IpAddressAssigned event is raised when ip address of the peer device is assigned. + /// + public event EventHandler IpAddressAssigned + { + add + { + if (Globals.IsInitialize) + { + if (_ipAddressAssigned == null) + { + RegisterIpAddressAssignedEvent(); + } + + _ipAddressAssigned += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + _ipAddressAssigned -= value; + if (_ipAddressAssigned == null) + { + UnregisterIpAddressAssignedEvent(); + } + } + } + } + + /// + /// (event) ServiceStateChanged is raised when state of service discovery is changed. + /// + public event EventHandler ServiceStateChanged + { + add + { + if (Globals.IsInitialize) + { + if (_serviceStateChanged == null) + { + RegisterServiceStateChangedEvent(); + } + + _serviceStateChanged += value; + } + } + + remove + { + if (Globals.IsInitialize) + { + _serviceStateChanged -= value; + if (_serviceStateChanged == null) + { + UnregisterServiceStateChangedEvent(); + } + } + } + } + + private void RegisterConnectionStateChangedEvent() + { + _connectionStateChangedCallback = (int result, WiFiDirectConnectionState state, string address, IntPtr userData) => + { + if (_connectionStateChanged != null) + { + WiFiDirectError res = (WiFiDirectError)result; + _connectionStateChanged(null, new ConnectionStateChangedEventArgs(res, state, address)); + } + }; + int ret = Interop.WiFiDirect.SetConnectionChangedCallback(_connectionStateChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set connection state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterConnectionStateChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetConnectionChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset connection state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterIpAddressAssignedEvent() + { + _ipAddressAssignedCallback = (string macAddress, string ipAddress, string interfaceAddress, IntPtr userData) => + { + if (_ipAddressAssigned != null) + { + _ipAddressAssigned(null, new IpAddressAssignedEventArgs(macAddress, ipAddress, interfaceAddress)); + } + }; + int ret = Interop.WiFiDirect.SetIpAddressAssignedCallback(_ipAddressAssignedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set ip address assigned callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterIpAddressAssignedEvent() + { + int ret = Interop.WiFiDirect.UnsetIpAddressAssignedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset ip address assigned callback, Error - " + (WiFiDirectError)ret); + } + } + + private void RegisterServiceStateChangedEvent() + { + _serviceStateChangedCallback = (int result, WiFiDirectServiceDiscoveryState stateInfo, WiFiDirectServiceType typeInfo, IntPtr responseData, string address, IntPtr userData) => + { + if (_serviceStateChanged != null) + { + WiFiDirectError error = (WiFiDirectError)result; + WiFiDirectServiceDiscoveryState state = stateInfo; + WiFiDirectServiceType type = typeInfo; + string response = Marshal.PtrToStringAnsi(responseData); + IntPtr peer; + Interop.WiFiDirect.GetDiscoveredPeerInfo(address, out peer); + DiscoveredPeerStruct peerStruct = (DiscoveredPeerStruct)Marshal.PtrToStructure(peer, typeof(DiscoveredPeerStruct)); + + _serviceStateChanged(null, new ServiceStateChangedEventArgs(error, state, type, response, WiFiDirectUtils.ConvertStructToDiscoveredPeer(peerStruct))); + } + }; + int ret = Interop.WiFiDirect.SetServiceStateChangedCallback(_serviceStateChangedCallback, IntPtr.Zero); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set service state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + private void UnregisterServiceStateChangedEvent() + { + int ret = Interop.WiFiDirect.UnsetServiceStateChangedCallback(); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to unset service state changed callback, Error - " + (WiFiDirectError)ret); + } + } + + /// + /// Connects to a specified remote device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ConnectionStateChanged event will be invoked. + /// + /// Thrown when the wifidirect is not supported + public void Connect() + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.Connect(_peerMacAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to connect, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Cancels the connection now in progress. + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// Thrown when the wifidirect is not supported + public void CancelConnection() + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.CancelConnection(_peerMacAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to cancel the connection, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Disconnects the specified remote device. + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ConnectionStateChanged event will be invoked. + /// + /// Thrown when the wifidirect is not supported + public void Disconnect() + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.Disconnect(_peerMacAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to disconnect, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Allows a device to connect automatically. + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// Thrown when the wifidirect is not supported + public void SetAutoConnect() + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.SetAutoConnectionPeer(_peerMacAddress); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to set auto connection, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Starts the Wi-Fi Direct service discovery. + /// + /// + /// Wi-Fi Direct must be activated. + /// If this succeeds, ServiceStateChanged event will be invoked. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect service discovery is not supported + /// + /// Type of service. + public void StartServiceDiscovery(WiFiDirectServiceType type) + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.StartServiceDiscovery(_peerMacAddress, type); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to start Wi-Fi Direct service discovery, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + + /// + /// Stops the Wi-Fi Direct service discovery. + /// + /// + /// Wi-Fi Direct must be activated. + /// + /// + /// Thrown during one of the following cases : + /// 1. When the wifidirect is not supported + /// 2. When the wifidirect service discovery is not supported + /// + /// Type of service. + public void CancelServiceDiscovery(WiFiDirectServiceType type) + { + if (Globals.IsActivated) + { + int ret = Interop.WiFiDirect.StopServiceDiscovery(_peerMacAddress, type); + if (ret != (int)WiFiDirectError.None) + { + Log.Error(Globals.LogTag, "Failed to stop Wi-Fi Direct service discovery, Error - " + (WiFiDirectError)ret); + WiFiDirectErrorFactory.ThrowWiFiDirectException(ret); + } + } + + else + { + Log.Error(Globals.LogTag, "Wifi-direct is not activated"); + WiFiDirectErrorFactory.ThrowWiFiDirectException((int)WiFiDirectError.NotPermitted); + } + } + } +} diff --git a/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPersistentGroup.cs b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPersistentGroup.cs new file mode 100644 index 0000000..10274c9 --- /dev/null +++ b/src/Tizen.Network.WiFiDirect/Tizen.Network.WiFiDirect/WiFiDirectPersistentGroup.cs @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Network.WiFiDirect +{ + /// + /// A class to handle persistent groups. + /// + public class WiFiDirectPersistentGroup + { + private string _address; + private string _ssid; + + internal WiFiDirectPersistentGroup(string address, string id) + { + _address = address; + _ssid = id; + } + + /// + /// MAC address of the persistent group owner. + /// + public string MacAddress + { + get + { + return _address; + } + } + + /// + /// SSID (Service Set Identifier) of the persistent group owner. + /// + public string Ssid + { + get + { + return _ssid; + } + } + } +} diff --git a/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs b/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..82c7dc1 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string PhonenumberUtils = "libphonenumber-utils.so.0"; + } +} diff --git a/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs b/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs new file mode 100755 index 0000000..614b41a --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Interop/Interop.PhonenumberUtils.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class PhonenumberUtils + { + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_connect")] + internal static extern int Connect(); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_disconnect")] + internal static extern int Disconnect(); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_location_from_number")] + internal static extern int GetLocationFromNumber(string number, int region, int language, out string location); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_formatted_number")] + internal static extern int GetFormmatedNumber(string number, int region, out string normalizedNumber); + + [DllImport(Libraries.PhonenumberUtils, EntryPoint = "phone_number_get_normalized_number")] + internal static extern int GetNormailizedNumber(string number, out string normalizedNumber); + } +} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln new file mode 100755 index 0000000..5975f96 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.PhonenumberUtils", "Tizen.PhonenumberUtils.csproj", "{EF7F0E1F-57D3-405D-A4D4-9F6B64A3D274}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{187B346D-47A5-4A25-81B3-C58BA724A1AF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{38BB464B-8315-4688-9023-8EB97A779355}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EF7F0E1F-57D3-405D-A4D4-9F6B64A3D274}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF7F0E1F-57D3-405D-A4D4-9F6B64A3D274}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF7F0E1F-57D3-405D-A4D4-9F6B64A3D274}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF7F0E1F-57D3-405D-A4D4-9F6B64A3D274}.Release|Any CPU.Build.0 = Release|Any CPU + {187B346D-47A5-4A25-81B3-C58BA724A1AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {187B346D-47A5-4A25-81B3-C58BA724A1AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {187B346D-47A5-4A25-81B3-C58BA724A1AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {187B346D-47A5-4A25-81B3-C58BA724A1AF}.Release|Any CPU.Build.0 = Release|Any CPU + {38BB464B-8315-4688-9023-8EB97A779355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {38BB464B-8315-4688-9023-8EB97A779355}.Debug|Any CPU.Build.0 = Debug|Any CPU + {38BB464B-8315-4688-9023-8EB97A779355}.Release|Any CPU.ActiveCfg = Release|Any CPU + {38BB464B-8315-4688-9023-8EB97A779355}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/NamespaceDoc.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/NamespaceDoc.cs new file mode 100644 index 0000000..42e91c1 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/NamespaceDoc.cs @@ -0,0 +1,7 @@ +/// +/// The Tizen.PhonenumberUtils namespace provides a class for parsing, formatting and normalizing phone numbers. +/// +/// +/// The Tizen.PhonenumberUtils namespace provides a class for parsing, formatting and normalizing phone numbers. +/// +namespace Tizen.PhonenumberUtils {} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs new file mode 100644 index 0000000..c410568 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtils.cs @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.PhonenumberUtils +{ + /// + /// The PhonenumberUtils class provides methods for parsing, formatting and normalizing phone numbers. + /// + public class PhonenumberUtils : IDisposable + { + private bool disposed = false; + + public PhonenumberUtils() + { + int ret; + + ret = Interop.PhonenumberUtils.Connect(); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to connect, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + } + + ~PhonenumberUtils() + { + Dispose(false); + } + + /// + /// Releases all resources used by the PhonenumberUtils. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposed) + return; + + // Free unmanaged objects + int ret; + + ret = Interop.PhonenumberUtils.Disconnect(); + if (ret != (int)PhonenumberUtilsError.None) + Log.Error(Globals.LogTag, "Failed to disconnect, Error - " + (PhonenumberUtilsError)ret); + + disposed = true; + } + + /// + /// Gets the location string from number, region, and language. + /// + /// The number + /// The region of number + /// The language of location + /// The location string + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + public string GetLocationFromNumber(string number, Region region, Language language) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetLocationFromNumber(number, (int)region, (int)language, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get location, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + + /// + /// Gets the formatted number. + /// + /// The number + /// The region of number + /// The formatted number string + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + public string GetFormattedNumber(string number, Region region) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetFormmatedNumber(number, (int)region, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get formatted number, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + + /// + /// Gets the normalized number. + /// + /// The number + /// The normalized number + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when method failed due to invalid operation + /// Thrown when phonenumber-utils is not supported + /// Thrown when input coordinates are invalid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + /// + /// Normalized number starts with plus('+') and country code, and excludes the separators such as dash or space. + /// It is a format of E.164 standard including the country code based on current network. + /// + public string GetNormalizedNumber(string number) + { + int ret; + string result; + + ret = Interop.PhonenumberUtils.GetNormailizedNumber(number, out result); + if (ret != (int)PhonenumberUtilsError.None) + { + Log.Error(Globals.LogTag, "Failed to get normalized number, Error - " + (PhonenumberUtilsError)ret); + PhonenumberUtilsErrorFactory.ThrowPhonenumberUtilsException(ret); + } + + return result; + } + } +} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs new file mode 100644 index 0000000..8710866 --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsEnumerations.cs @@ -0,0 +1,1138 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.PhonenumberUtils +{ + /// + /// Enumeration for language type. + /// + public enum Language + { + /// + /// Amharic + /// + Amharic, + /// + /// Arabic + /// + Arabic, + /// + /// Belarusian + /// + Belarusian, + /// + /// Bulgarian + /// + Bulgarian, + /// + /// Chinese + /// + Chinese, + /// + /// Chinese (Traditional) + /// + ChineseTraditional, + /// + /// Czech + /// + Czech, + /// + /// Dutch + /// + Dutch, + /// + /// English + /// + English, + /// + /// Finnish + /// + Finnish, + /// + /// French + /// + French, + /// + /// German + /// + German, + /// + /// Greek + /// + Greek, + /// + /// Hungarian + /// + Hungarian, + /// + /// Indonesian + /// + Indonesian, + /// + /// Italian + /// + Italian, + /// + /// Japanese + /// + Japanese, + /// + /// Korean + /// + Korean, + /// + /// Nothern Sami + /// + NorthernSami, + /// + /// Persian + /// + Persian, + /// + /// Polish + /// + Polish, + /// + /// Portuguese + /// + Portuguese, + /// + /// Romanian + /// + Romanian, + /// + /// Russian + /// + Russian, + /// + /// Serbian + /// + Serbian, + /// + /// Spanish + /// + Spanish, + /// + /// Swedish + /// + Swedish, + /// + /// Thai + /// + Thai, + /// + /// Turkish + /// + Turkish, + /// + /// Vietnamese + /// + Vietnamese, + /// + /// Current System Value + /// + System, + Max + } + + /// + /// Enumeration for region type. + /// + public enum Region + { + /// + /// Aland Islands + /// + AlandIslands, + /// + /// Albania + /// + Albania, + /// + /// Algeria + /// + Algeria, + /// + /// American Samoa + /// + AmericanSamoa, + /// + /// Angola + /// + Angola, + /// + /// Anguilla + /// + Anguilla, + /// + /// Argentina + /// + Argentina, + /// + /// Armenia + /// + Armenia, + /// + /// Ascension Island + /// + AscensionIsland, + /// + /// Antigua and Barbuda + /// + AntiguaAndBarbuda, + /// + /// Austria + /// + Austria, + /// + /// Bahamas + /// + Bahamas, + /// + /// Barbados + /// + Barbados, + /// + /// Belarus + /// + Belarus, + /// + /// Belgium + /// + Belgium, + /// + /// Benin + /// + Benin, + /// + /// Bermuda + /// + Bermuda, + /// + /// Bonaire, Sint Eustatius and Saba + /// + BonaireSintEustatiusAndSaba, + /// + /// Botswana + /// + Botswana, + /// + /// Brazil + /// + Brazil, + /// + /// Bulgaria + /// + Bulgaria, + /// + /// Burkina Faso + /// + BurkinaFaso, + /// + /// Burundi + /// + Burundi, + /// + /// Cape Verde (Cabo Verde) + /// + CapeVerde, + /// + /// Cameroon + /// + Cameroon, + /// + /// Canada + /// + Canada, + /// + /// Cayman Island + /// + CaymanIsland, + /// + /// Chile + /// + Chile, + /// + /// China + /// + China, + /// + /// Colombia + /// + Colombia, + /// + /// Comoros + /// + Comoros, + /// + /// Congo + /// + Congo, + /// + /// Ivory Coast (Cote d'Ivoire) + /// + IvoryCoast, + /// + /// Cuba + /// + Cuba, + /// + /// Curacao + /// + Curacao, + /// + /// Czech Republic + /// + CzechRepublic, + /// + /// Congo, Democratic Republic of the + /// + DemocraticRepublicOfTheCongo, + /// + /// Dominica + /// + Dominica, + /// + /// Dominican Republic + /// + DominicanRepublic, + /// + /// Egypt + /// + Egypt, + /// + /// Estonia + /// + Estonia, + /// + /// Ethiopia + /// + Ethiopia, + /// + /// Finland + /// + Finland, + /// + /// France + /// + France, + /// + /// Gabon + /// + Gabon, + /// + /// Gambia + /// + Gambia, + /// + /// Germany + /// + Germany, + /// + /// Ghana + /// + Ghana, + /// + /// Greece + /// + Greece, + /// + /// Greenland + /// + Greenland, + /// + /// Grenada + /// + Grenada, + /// + /// Guam + /// + Guam, + /// + /// Guernsey + /// + Guernsey, + /// + /// Guinea + /// + Guinea, + /// + /// Guinea-Bissau + /// + GuineaBissau, + /// + /// Hungary + /// + Hungary, + /// + /// Iceland + /// + Iceland, + /// + /// India + /// + India, + /// + /// Indonesia + /// + Indonesia, + /// + /// Ireland + /// + Ireland, + /// + /// Iran, Islamic Republic of + /// + Iran, + /// + /// Isle of Man + /// + IsleOfMan, + /// + /// Italy + /// + Italy, + /// + /// Jamaica + /// + Jamaica, + /// + /// Japan + /// + Japan, + /// + /// Jersey + /// + Jersey, + /// + /// Jordan + /// + Jordan, + /// + /// Kazakhstan + /// + Kazakhstan, + /// + /// Kenya + /// + Kenya, + /// + /// Kiribati + /// + Kiribati, + /// + /// Latvia + /// + Latvia, + /// + /// Lesotho + /// + Lesotho, + /// + /// Lithuania + /// + Lithuania, + /// + /// Luxembourg + /// + Luxembourg, + /// + /// Madagascar + /// + Madagascar, + /// + /// Mauritania + /// + Mauritania, + /// + /// Mauritius + /// + Mauritius, + /// + /// Montserrat + /// + Montserrat, + /// + /// Morocco + /// + Morocco, + /// + /// Mozambique + /// + Mozambique, + /// + /// Namibia + /// + Namibia, + /// + /// Netherlands + /// + Netherlands, + /// + /// Nigeria + /// + Nigeria, + /// + /// Northern Mariana Islands + /// + NorthernMarianaIslands, + /// + /// Norway + /// + Norway, + /// + /// Peru + /// + Peru, + /// + /// Poland + /// + Poland, + /// + /// Portugal + /// + Portugal, + /// + /// Puerto Rico + /// + PuertoRico, + /// + /// Korea (Republic of) + /// + Korea, + /// + /// Moldova (Republic of) + /// + Moldova, + /// + /// Romania + /// + Romania, + /// + /// Russian Federation + /// + RussianFederation, + /// + /// Saint Helena, Ascension and Tristan da Cunha + /// + SaintHelena, + /// + /// Saint Kitts and Nevis + /// + SaintKittsAndNevis, + /// + /// Saint Lucia + /// + SaintLucia, + /// + /// Saint Vincent and the Grenadines + /// + SaintVicentAndTheGrenadines, + /// + /// Saint Thomas And Principe (Sao Tome and Principe) + /// + SaintThomasAndPrincipe, + /// + /// Saudi Arabia + /// + SaudiArabia, + /// + /// Senegal + /// + Senegal, + /// + /// Serbia + /// + Serbia, + /// + /// Sierra Leone + /// + SierraLeone, + /// + /// Saint Martin (Sint Maarten), Dutch part + /// + SintMaarten, + /// + /// Slovakia + /// + Slovakia, + /// + /// Somalia + /// + Somalia, + /// + /// South Africa + /// + SouthAfrica, + /// + /// Spain + /// + Spain, + /// + /// Sri Lanka + /// + SriLanka, + /// + /// Sudan + /// + Sudan, + /// + /// Svalbard and Jan Mayen + /// + SvalbardAndJanMayen, + /// + /// Swaziland + /// + Swaziland, + /// + /// Sweden + /// + Sweden, + /// + /// Switzerland + /// + Switzerland, + /// + /// Taiwan, Province of China + /// + Taiwan, + /// + /// Thailand + /// + Thailand, + /// + /// Macedonia (the Former Yugoslav Republic of) + /// + Macedonia, + /// + /// Togo + /// + Togo, + /// + /// Trinidad and Tobago + /// + TrinidadAndTobago, + /// + /// Tristan da Cunha + /// + TristanDaCunha, + /// + /// Tunisia + /// + Tunisia, + /// + /// Turkey + /// + Turkey, + /// + /// Turks and Caicos Islands + /// + TurksAndCaicosIslands, + /// + /// Uganda + /// + Uganda, + /// + /// United Kingdom + /// + UnitedKingdom, + /// + /// United States of America + /// + UnitedStatesOfAmerica, + /// + /// Venezuela + /// + Venezuela, + /// + /// Viet Nam + /// + VietNam, + /// + /// Virgin Island (British) + /// + VirginIslandBritish, + /// + /// Virgin Island (U.S.) + /// + VirginIslandUs, + /// + /// Western Sahara + /// + WesternSahara, + /// + /// Zambia + /// + Zambia, + /// + /// Zimbabwe + /// + Zimbabwe, + /// + /// Andorra + /// + Andorra, + /// + /// United Arab Emirates + /// + UnitedArabEmirates, + /// + /// Afghanistan + /// + Afghanistan, + /// + /// Australia + /// + Australia, + /// + /// Aruba + /// + Aruba, + /// + /// Azerbaijan + /// + Azerbaijan, + /// + /// Bosnia and Herzegovina + /// + BosniaAndHerzegovina, + /// + /// Bangladesh + /// + Bangladesh, + /// + /// Bahrain + /// + Bahrain, + /// + /// Saint Barthelemy, French Antilles + /// + SaintBarthelemy, + /// + /// Brunei Darussalam + /// + BruneiDarussalam, + /// + /// Bolivia + /// + Bolivia, + /// + /// Bhutan + /// + Bhutan, + /// + /// Belize + /// + Belize, + /// + /// Cocos Islands + /// + CocosIslands, + /// + /// Central African Republic + /// + CentralAfricanRepublic, + /// + /// Cook Islands + /// + CookIslands, + /// + /// Costa Rica + /// + CostaRica, + /// + /// Christmas Islands + /// + ChristmasIslands, + /// + /// Cyprus + /// + Cyprus, + /// + /// Djibouti + /// + Djibouti, + /// + /// Denmark + /// + Denmark, + /// + /// Ecuador + /// + Ecuador, + /// + /// Eritrea + /// + Eritrea, + /// + /// Fiji + /// + Fiji, + /// + /// Falkland Islands + /// + FalklandIslands, + /// + /// Micronesia, Federated States of + /// + Micronesia, + /// + /// Faroe Islands + /// + FaroeIslands, + /// + /// Georgia + /// + Georgia, + /// + /// French Guiana + /// + FrenchGuiana, + /// + /// Gibraltar + /// + Gibraltar, + /// + /// Guadeloupe + /// + Guadeloupe, + /// + /// Equatorial Guinea + /// + EquatorialGuinea, + /// + /// Guatemala + /// + Guatemala, + /// + /// Guyana + /// + Guyana, + /// + /// Hong Kong + /// + HongKong, + /// + /// Honduras + /// + Honduras, + /// + /// Croatia + /// + Croatia, + /// + /// Haiti + /// + Haiti, + /// + /// Israel + /// + Israel, + /// + /// British Indian Ocean Territory / Diego Garcia + /// + DiegoGarcia, + /// + /// Iraq + /// + Iraq, + /// + /// Kyrgyzstan + /// + Kyrgyzstan, + /// + /// Cambodia + /// + Cambodia, + /// + /// Korea, Dem. People's Rep. of + /// + NorthKorea, + /// + /// Kuwait + /// + Kuwait, + /// + /// Lao People's Dem. Rep. + /// + Laos, + /// + /// Lebanon + /// + Lebanon, + /// + /// Liechtenstein + /// + Liechtenstein, + /// + /// Liberia + /// + Liberia, + /// + /// Libya (Soc. People's Libyan Arab Jamahiriva) + /// + Libya, + /// + /// Monaco + /// + Monaco, + /// + /// Montenegro + /// + Montenegro, + /// + /// Saint Martin, French part + /// + SaintMartin, + /// + /// Marshall Islands + /// + MarshallIslands, + /// + /// Mali + /// + Mali, + /// + /// Myanmar + /// + Myanmar, + /// + /// Mongolia + /// + Mongolia, + /// + /// Macao, China + /// + Macao, + /// + /// Martinique (French Dept. of) + /// + Martinique, + /// + /// Malta + /// + Malta, + /// + /// Maldives + /// + Maldives, + /// + /// Malawi + /// + Malawi, + /// + /// Mexico + /// + Mexico, + /// + /// Malaysia + /// + Malaysia, + /// + /// New Caledonia + /// + NewCaledonia, + /// + /// Niger + /// + Niger, + /// + /// Norfolk Island + /// + NorfolkIsland, + /// + /// Nicaragua + /// + Nicaragua, + /// + /// Nepal + /// + Nepal, + /// + /// Nauru + /// + Nauru, + /// + /// Niue + /// + Niue, + /// + /// New Zealand + /// + NewZealand, + /// + /// Oman + /// + Oman, + /// + /// Panama + /// + Panama, + /// + /// French Polynesia + /// + FrenchPolynesia, + /// + /// Papua New Guinea + /// + PapuaNewGuinea, + /// + /// Philippines + /// + Philippines, + /// + /// Pakistan + /// + Pakistan, + /// + /// Saint Pierre and Miquelon + /// + SaintPierreAndMiquelon, + /// + /// Palestine + /// + Palestine, + /// + /// Palau + /// + Palau, + /// + /// Paraguay + /// + Paraguay, + /// + /// Qatar + /// + Qatar, + /// + /// Reunion + /// + Reunion, + /// + /// Rwanda + /// + Rwanda, + /// + /// Solomon Islands + /// + SolomonIslands, + /// + /// Seychelles + /// + Seychelles, + /// + /// Singapore + /// + Singapore, + /// + /// Slovenia + /// + Slovenia, + /// + /// San Marino + /// + SanMarino, + /// + /// Suriname + /// + Suriname, + /// + /// South Sudan + /// + SouthSudan, + /// + /// El Salvador + /// + ElSalvador, + /// + /// Syrian Arab Republic + /// + SyrianArabRepublic, + /// + /// Chad + /// + Chad, + /// + /// Tajikistan + /// + Tajikistan, + /// + /// Tokelau + /// + Tokelau, + /// + /// Timor-Leste (East Timor) + /// + TimorLeste, + /// + /// Turkmenistan + /// + Turkmenistan, + /// + /// Tonga + /// + Tonga, + /// + /// Tuvalu + /// + Tuvalu, + /// + /// Tanzania + /// + Tanzania, + /// + /// Ukraine + /// + Ukraine, + /// + /// Uruguay + /// + Uruguay, + /// + /// Uzbekistan + /// + Uzbekistan, + /// + /// Vatican City + /// + VaticanCity, + /// + /// Vanuatu + /// + Vanuatu, + /// + /// Wallis and Futuna + /// + WallisAndFutuna, + /// + /// Samoa + /// + Samoa, + /// + /// Yemen + /// + Yemen, + /// + /// Mayotte + /// + Mayotte, + /// + /// Current System Value + /// + System, + Max + } +} diff --git a/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs new file mode 100644 index 0000000..afac3ef --- /dev/null +++ b/src/Tizen.PhonenumberUtils/Tizen.PhonenumberUtils/PhonenumberUtilsErrorFactory.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.PhonenumberUtils +{ + internal enum PhonenumberUtilsError + { + None = ErrorCode.None, + IoError = ErrorCode.IoError, + OutOfMemory = ErrorCode.OutOfMemory, + InvalidParameter = ErrorCode.InvalidParameter, + FileNoSpaceOnDevice = ErrorCode.FileNoSpaceOnDevice, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoData = ErrorCode.NoData, + System = -0x02020000 | 0xEF, + } + + static internal class Globals + { + internal const string LogTag = "Tizen.PhonenumberUtils"; + } + + internal static class PhonenumberUtilsErrorFactory + { + static internal void ThrowPhonenumberUtilsException(int e) + { + PhonenumberUtilsError err = (PhonenumberUtilsError)e; + + switch (err) + { + case PhonenumberUtilsError.InvalidParameter: + throw new ArgumentException(err.ToString()); + case PhonenumberUtilsError.NotSupported: + throw new NotSupportedException(err.ToString()); + case PhonenumberUtilsError.PermissionDenied: + throw new UnauthorizedAccessException(err.ToString()); + case PhonenumberUtilsError.OutOfMemory: + throw new OutOfMemoryException(err.ToString()); + default: + throw new InvalidOperationException(err.ToString()); + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Database.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Database.cs new file mode 100644 index 0000000..8183fe6 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Database.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Database + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DBChangedCallback(string uri, IntPtr userData); + + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_record")] + internal static extern int Insert(IntPtr recordHandle, out int recordId); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_record")] + internal static extern int Get(string uri, int recordId, out IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_record")] + internal static extern int Update(IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_record")] + internal static extern int Delete(string uri, int recordId); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_all_records")] + internal static extern int GetAllRecords(string uri, int offset, int limit, out IntPtr recordListHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_records_with_query")] + internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr recordListHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count")] + internal static extern int GetCount(string uri, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_count_with_query")] + internal static extern int GetCountWithQuery(IntPtr queryHandle, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_records")] + internal static extern int InsertRecords(IntPtr recordListHandle, out IntPtr recordIds, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_update_records")] + internal static extern int UpdateRecords(IntPtr recordListHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_delete_records")] + internal static extern int DeleteRecords(string uri, int[] ids, int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_current_version")] + internal static extern int GetCurrentVersion(out int version); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_add_changed_cb")] + internal static extern int AddChangedCallback(string uri, DBChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_remove_changed_cb")] + internal static extern int RemoveChangedCallback(string uri, DBChangedCallback callback, IntPtr userData); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_by_version")] + internal static extern int GetChangesByVersion(string uri, int bookId, int dbVersion, out IntPtr recordListHandle, out int currentDBVersion); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_insert_vcalendars")] + internal static extern int InsertVcalendars(string stream, out IntPtr recordIds, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_vcalendars")] + internal static extern int ReplaceVcalendars(string stream, int[] ids, int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_record")] + internal static extern int Replace(IntPtr recordHandle, int recordId); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_replace_records")] + internal static extern int ReplaceRecords(IntPtr recordListHandle, int[] ids, int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_last_change_version")] + internal static extern int GetLastChangeVersion(out int lastChangeVersion); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_get_changes_exception_by_version")] + internal static extern int GetChangesException(string uri, int eventId, int dbVersion, out IntPtr recordListHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_clean_after_sync")] + internal static extern int Clean(int bookId, int dbVersion); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_link_record")] + internal static extern int LinkRecord(int baseId, int recordId); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_unlink_record")] + internal static extern int UnlinkRecord(int recordId); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Filter.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Filter.cs new file mode 100644 index 0000000..43f9577 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Filter.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Pims.Calendar; +using static Tizen.Pims.Calendar.CalendarFilter; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Filter + { + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_create")] + internal static extern int Create(string uri, out IntPtr filterHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_destroy")] + internal static extern int Destroy(IntPtr filterHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_str")] + internal static extern int AddString(IntPtr filterHandle, uint propertyId, StringMatchType match, string value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_int")] + internal static extern int AddInteger(IntPtr filterHandle, uint propertyId, IntegerMatchType match, int value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_double")] + internal static extern int AddDouble(IntPtr filterHandle, uint propertyId, IntegerMatchType match, double value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_lli")] + internal static extern int AddLong(IntPtr filterHandle, uint propertyId, IntegerMatchType match, long value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_caltime")] + internal static extern int AddCalendarTime(IntPtr filterHandle, uint propertyId, IntegerMatchType match, Interop.Calendar.Record.DateTime value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_filter")] + internal static extern int AddFilter(IntPtr parentFilterHandle, IntPtr childFilterHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_filter_add_operator")] + internal static extern int AddOperator(IntPtr filterHandle, LogicalOperator type); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Libraries.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Libraries.cs new file mode 100644 index 0000000..ffb5218 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Calendar = "libcalendar-service2.so.0"; + } +} + diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.List.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.List.cs new file mode 100644 index 0000000..31010c8 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.List.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class List + { + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_create")] + internal static extern int Create(out IntPtr listHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_destroy")] + internal static extern int Destroy(IntPtr listHandle, bool delete); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_get_count")] + internal static extern int GetCount(IntPtr listHandle, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_add")] + internal static extern int Add(IntPtr listHandle, IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_remove")] + internal static extern int Remove(IntPtr listHandle, IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_get_current_record_p")] + internal static extern int GetCurrentRecordP(IntPtr listHandle, out IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_prev")] + internal static extern int Prev(IntPtr listHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_next")] + internal static extern int Next(IntPtr listHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_first")] + internal static extern int First(IntPtr listHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_list_last")] + internal static extern int Last(IntPtr listHandle); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Query.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Query.cs new file mode 100644 index 0000000..c570495 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Query.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Query + { + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_create")] + internal static extern int Create(string uri, out IntPtr queryHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_destroy")] + internal static extern int Destroy(IntPtr queryHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_projection")] + internal static extern int SetProjection(IntPtr queryHandle, uint[] propertyIdArray, int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_distinct")] + internal static extern int SetDistinct(IntPtr queryHandle, bool set); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_filter")] + internal static extern int SetFilter(IntPtr queryHandle, IntPtr filterHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_query_set_sort")] + internal static extern int SetSort(IntPtr queryHandle, uint propertyId, bool isAscending); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Record.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Record.cs new file mode 100644 index 0000000..befe4d9 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Record.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Pims.Calendar; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Record + { + [StructLayout(LayoutKind.Sequential)] + internal struct DateTime + { + internal int type; + internal long utime; + internal int year; + internal int month; + internal int mday; + internal int hour; + internal int minute; + internal int second; + }; + + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_create")] + internal static extern int Create(string uri, out IntPtr recordHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_destroy")] + internal static extern int Destroy(IntPtr recordHandle, bool isDeleteChild); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_clone")] + internal static extern int Clone(IntPtr recordHandle, out IntPtr cloneHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_uri_p")] + internal static extern int GetUriPointer(IntPtr recordHandle, out IntPtr uri); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_str")] + internal static extern int GetString(IntPtr recordHandle, uint propertyId, out string str); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_str_p")] + internal static extern int GetStringPointer(IntPtr recordHandle, uint propertyId, out string str); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_int")] + internal static extern int GetInteger(IntPtr recordHandle, uint propertyId, out int value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_double")] + internal static extern int GetDouble(IntPtr recordHandle, uint propertyId, out double value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_lli")] + internal static extern int GetLli(IntPtr recordHandle, uint propertyId, out long value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_caltime")] + internal static extern int GetCalendarTime(IntPtr recordHandle, uint propertyId, out DateTime value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_set_str")] + internal static extern int SetString(IntPtr recordHandle, uint propertyId, string str); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_set_int")] + internal static extern int SetInteger(IntPtr recordHandle, uint propertyId, int value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_set_double")] + internal static extern int SetDouble(IntPtr recordHandle, uint propertyId, double value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_set_lli")] + internal static extern int SetLli(IntPtr recordHandle, uint propertyId, long value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_set_caltime")] + internal static extern int SetCalendarTime(IntPtr recordHandle, uint propertyId, DateTime value); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_add_child_record")] + internal static extern int AddChildRecord(IntPtr recordHandle, uint propertyId, IntPtr childHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_remove_child_record")] + internal static extern int RemoveChildRecord(IntPtr recordHandle, uint propertyId, IntPtr childHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_child_record_count")] + internal static extern int GetChildRecordCount(IntPtr recordHandle, uint propertyId, out int count); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_get_child_record_at_p")] + internal static extern int GetChildRecordPointer(IntPtr recordHandle, uint propertyId, int index, out IntPtr childHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_record_clone_child_record_list")] + internal static extern int CloneChildRecordList(IntPtr childRecordHandle, uint propertyId, out IntPtr listHandle); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Reminder.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Reminder.cs new file mode 100644 index 0000000..a737208 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Reminder.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Reminder + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ReminderAlertedCallback(string param, IntPtr userData); + + [DllImport(Libraries.Calendar, EntryPoint = "calendar_reminder_add_cb")] + internal static extern int Add(ReminderAlertedCallback callback, IntPtr userData); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_db_remove_changed_cb")] + internal static extern int Remove(ReminderAlertedCallback callback, IntPtr userData); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Service.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Service.cs new file mode 100644 index 0000000..adb132b --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Service.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Service + { + [DllImport(Libraries.Calendar, EntryPoint = "calendar_connect")] + internal static extern int Connect(); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_disconnect")] + internal static extern int Disconnect(); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_connect_on_thread")] + internal static extern int ConnectOnThread(); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_disconnect_on_thread")] + internal static extern int DisconnectOnThread(); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_connect_with_flags")] + internal static extern int ConnectWithFlags(uint flags); + } + } +} + diff --git a/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Vcalendar.cs b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Vcalendar.cs new file mode 100644 index 0000000..0b0d6a4 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Interop/Interop.Calendar.Vcalendar.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Calendar + { + internal static partial class Vcalendar + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ParseCallback(IntPtr recordHandle, IntPtr userData); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_make_from_records")] + internal static extern int Compose(IntPtr listHandle, out string stream); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_parse_to_calendar")] + internal static extern int Parse(string stream, out IntPtr listHandle); + [DllImport(Libraries.Calendar, EntryPoint = "calendar_vcalendar_parse_to_calendar_foreach")] + internal static extern int ParseForEach(string filePath, ParseCallback parseCb, IntPtr userData); + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.csproj b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.sln b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.sln new file mode 100755 index 0000000..342a80f --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Pims.Calendar", "Tizen.Pims.Calendar.csproj", "{9B929385-6459-48A7-B393-B554FBDD8BE2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{3E7535C3-30BE-4367-ABCE-AB81BD23C685}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{9D3D6DBC-8951-48B8-95D9-34EB1F248F5A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9B929385-6459-48A7-B393-B554FBDD8BE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B929385-6459-48A7-B393-B554FBDD8BE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B929385-6459-48A7-B393-B554FBDD8BE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B929385-6459-48A7-B393-B554FBDD8BE2}.Release|Any CPU.Build.0 = Release|Any CPU + {3E7535C3-30BE-4367-ABCE-AB81BD23C685}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E7535C3-30BE-4367-ABCE-AB81BD23C685}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E7535C3-30BE-4367-ABCE-AB81BD23C685}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E7535C3-30BE-4367-ABCE-AB81BD23C685}.Release|Any CPU.Build.0 = Release|Any CPU + {9D3D6DBC-8951-48B8-95D9-34EB1F248F5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9D3D6DBC-8951-48B8-95D9-34EB1F248F5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9D3D6DBC-8951-48B8-95D9-34EB1F248F5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9D3D6DBC-8951-48B8-95D9-34EB1F248F5A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs new file mode 100644 index 0000000..2cbb6bf --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarDatabase.cs @@ -0,0 +1,563 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +/// +/// The Calendar Service API provides functions, enumerations used in the entire Content Service. +/// +/// +/// The Calendar Service API provides functions and ienumerations used in the entire Content Service. +/// The Information about calendar items i.e. book, event, todo, alarm, attendee and extended are managed in the database +/// and operations that involve database requires an active connection with the calendar service. +/// + +namespace Tizen.Pims.Calendar +{ + /// + /// CalendarDatabase provides methods to manage calendar information from/to the database. + /// + /// + /// This class allows usre to access/create/update db operations for calendar information. + /// + public class CalendarDatabase + { + /// + /// Delegete for detecting the calendar database changes. + /// + /// The record uri + /// + /// The delegate must be registered using AddDBChangedDelegate. + /// It's invoked when the designated view changes. + /// + /// + public delegate void CalendarDBChangedDelegate(string uri); + + private Object thisLock = new Object(); + private Dictionary _callbackMap = new Dictionary(); + private Dictionary _delegateMap = new Dictionary(); + private Interop.Calendar.Database.DBChangedCallback _dbChangedDelegate; + + internal CalendarDatabase() + { + ///To be created in CalendarManager only + } + + /// + /// The calendar database version. + /// + public int Version + { + get + { + int version = -1; + int error = Interop.Calendar.Database.GetCurrentVersion(out version); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Version Failed with error " + error); + } + return version; + } + } + + /// + /// Gets last successful changed calendar database version on the current connection. + /// + /// The last successful changed calendar database version on the current connection + /// http://tizen.org/privilege/calendar.read + /// Thrown when method failed due to invalid operation + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public int LastChangeVersion + { + get + { + int version = -1; + int error = Interop.Calendar.Database.GetLastChangeVersion(out version); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "LastChangeVersion Failed with error " + error); + } + return version; + } + } + + /// + /// Inserts a record into the calendar database. + /// + /// The record to be inserted + /// The ID of inserted record + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public int Insert(CalendarRecord record) + { + int id = -1; + int error = Interop.Calendar.Database.Insert(record._recordHandle, out id); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Insert Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return id; + } + + /// + /// Gets a record from the calendar database. + /// + /// The view URI of a record + /// The record ID + /// + /// The record associated with the record ID + /// + /// http://tizen.org/privilege/calendar.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public CalendarRecord Get(string viewUri, int recordId) + { + IntPtr handle; + int error = Interop.Calendar.Database.Get(viewUri, recordId, out handle); + if (CalendarError.None != (CalendarError)error) + { + if (CalendarError.DBNotFound == (CalendarError)error) + { + Log.Error(Globals.LogTag, "No data" + error); + return null; + } + Log.Error(Globals.LogTag, "Get Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarRecord(handle); + } + + /// + /// Updates a record in the calendar database. + /// + /// The record to be updated + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Update(CalendarRecord record) + { + int error = Interop.Calendar.Database.Update(record._recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Update Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Deletes a record from the calendar database with related child records. + /// + /// The view URI of a record + /// The record ID to be deleted + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Delete(string viewUri, int recordId) + { + int error = Interop.Calendar.Database.Delete(viewUri, recordId); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Delete Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Replaces a record in the calendar database. + /// + /// The record to be replaced + /// the record id + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Replace(CalendarRecord record, int id) + { + int error = Interop.Calendar.Database.Replace(record._recordHandle, id); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Replace Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Retrieves all records as a list. + /// + /// The view URI to get records from + /// The index from which results are received + /// The maximum number of results(value 0 is used for all records) + /// + /// The record list + /// + /// http://tizen.org/privilege/calendar.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public CalendarList GetAll(string viewUri, int offset, int limit) + { + IntPtr handle; + int error = Interop.Calendar.Database.GetAllRecords(viewUri, offset, limit, out handle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetAll Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarList(handle); + } + + /// + /// Retrieves records using a query. + /// + /// The query used to filter results + /// The index from which results are received + /// The maximum number of results(value 0 is used for all records) + /// + /// CalendarList + /// + /// http://tizen.org/privilege/calendar.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public CalendarList GetRecordsWithQuery(CalendarQuery query, int offset, int limit) + { + IntPtr handle; + int error = Interop.Calendar.Database.GetRecords(query._queryHandle, offset, limit, out handle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetAllWithQuery Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarList(handle); + } + + /// + /// Inserts multiple records into the calendar database as a batch operation. + /// + /// The record list + /// + /// The inserted record id array + /// + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public int[] Insert(CalendarList list) + { + IntPtr ids; + int count; + int error = Interop.Calendar.Database.InsertRecords(list._listHandle, out ids, out count); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Insert Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + int[] idArr = new int[count]; + Marshal.Copy(ids, idArr, 0, count); + + return idArr; + } + + /// + /// Updates multiple records into the calendar database as a batch operation. + /// + /// The record list + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Update(CalendarList list) + { + int error = Interop.Calendar.Database.UpdateRecords(list._listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Update Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Deletes multiple records with related child records from the calendar database as a batch operation. + /// + /// The view URI of the records to delete + /// The record IDs to delete + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Delete(string viewUri, int[] idArray) + { + int error = Interop.Calendar.Database.DeleteRecords(viewUri, idArray, idArray.Length); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Delete Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Deletes multiple records with related child records from the calendar database as a batch operation. + /// + /// The record list + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Delete(CalendarList list) + { + CalendarRecord record = null; + if (list.Count <= 0) + return; + + int[] ids = new int[list.Count]; + int i; + uint propertyId = 0; + list.MoveFirst(); + for (i = 0; i < list.Count; i++) + { + record = list.GetCurrentRecord(); + if (0 == propertyId) + { + if (0 == String.Compare(CalendarViews.Book.Uri, record.Uri)) + propertyId = CalendarViews.Book.Id; + else if (0 == String.Compare(CalendarViews.Event.Uri, record.Uri)) + propertyId = CalendarViews.Event.Id; + else if (0 == String.Compare(CalendarViews.Todo.Uri, record.Uri)) + propertyId = CalendarViews.Todo.Id; + else if (0 == String.Compare(CalendarViews.Timezone.Uri, record.Uri)) + propertyId = CalendarViews.Timezone.Id; + else if (0 == String.Compare(CalendarViews.Extended.Uri, record.Uri)) + propertyId = CalendarViews.Extended.Id; + else + { + Log.Error(Globals.LogTag, "Invalid uri [" + record.Uri + "]"); + continue; + } + } + ids[i] = record.Get(propertyId); + list.MoveNext(); + } + Delete(record.Uri, ids); + } + + /// + /// Replaces multiple records in the calendar database as a batch operation. + /// + /// The record list + /// The record IDs + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Replace(CalendarList list, int[] idArray) + { + int error = Interop.Calendar.Database.ReplaceRecords(list._listHandle, idArray, idArray.Length); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Replace Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Retrieves records with the given calendar database version. + /// + /// The view URI to get records from + /// The calendar book ID to filter + /// The calendar database version + /// + /// + /// The record list + /// + /// http://tizen.org/privilege/calendar.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public CalendarList GetChangesByVersion(string viewUri, int BookId, int calendarDBVersion, out int currentDBVersion) + { + IntPtr recordList; + int error = Interop.Calendar.Database.GetChangesByVersion(viewUri, BookId, calendarDBVersion, out recordList, out currentDBVersion); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetChangesByVersion Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarList(recordList); + } + + /// + /// Gets the record count of a specific view. + /// + /// The view URI to get records from + /// + /// The count of records + /// + /// http://tizen.org/privilege/calendar.read + public int GetCount(string viewUri) + { + int count = -1; + int error = Interop.Calendar.Database.GetCount(viewUri, out count); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetCount Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return count; + } + + /// + /// Gets the record count with a query. + /// + /// The query used for filtering the results + /// + /// The count of records + /// + /// http://tizen.org/privilege/calendar.read + public int GetCount(CalendarQuery query) + { + int count = -1; + int error = Interop.Calendar.Database.GetCountWithQuery(query._queryHandle, out count); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetCount Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return count; + } + + /// + /// Registers a callback function to be invoked when a record changes. + /// + /// The view URI of the record to subscribe for change notifications + /// The callback function to register + /// http://tizen.org/privilege/calendar.read + public void AddDBChangedDelegate(string viewUri, CalendarDBChangedDelegate callback) + { + Log.Debug(Globals.LogTag, "AddDBChangedDelegate"); + + _dbChangedDelegate = (string uri, IntPtr userData) => + { + _callbackMap[uri](uri); + }; + int error = Interop.Calendar.Database.AddChangedCallback(viewUri, _dbChangedDelegate, IntPtr.Zero); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _callbackMap[viewUri] = callback; + _delegateMap[viewUri] = _dbChangedDelegate; + } + + /// + /// Unregisters a callback function. + /// + /// The view URI of the record to subscribe for change notifications + /// The callback function to register + /// http://tizen.org/privilege/calendar.read + public void RemoveDBChangedDelegate(string viewUri, CalendarDBChangedDelegate callback) + { + Log.Debug(Globals.LogTag, "RemoveDBChangedDelegate"); + + int error = Interop.Calendar.Database.RemoveChangedCallback(viewUri, _delegateMap[viewUri], IntPtr.Zero); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _callbackMap.Remove(viewUri); + _delegateMap.Remove(viewUri); + } + + /// + /// Link a record to another record. + /// + /// The base record ID + /// The record ID to link to + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void LinkRecord(int baseId, int recordId) + { + Log.Debug(Globals.LogTag, "LinkRecord"); + int error = Interop.Calendar.Database.LinkRecord(baseId, recordId); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "LinkRecor Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Unlink a record from base record. + /// + /// The record ID to unlink + /// http://tizen.org/privilege/calendar.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void UnlinkRecord(int recordId) + { + Log.Debug(Globals.LogTag, "UnlinkRecord"); + int error = Interop.Calendar.Database.UnlinkRecord(recordId); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "UnlinkRecor Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarErrorFactory.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarErrorFactory.cs new file mode 100644 index 0000000..6918f88 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarErrorFactory.cs @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Pims.Calendar +{ + internal enum CalendarError + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory (-12) */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter (-22) */ + FileNoSpace = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice, /** + /// A filter includes the conditions for the search. + /// + public class CalendarFilter:IDisposable + { + internal IntPtr _filterHandle; + + /// + /// Creates a filter with a condition for a string type. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarFilter(string viewUri, uint propertyId, StringMatchType matchType, string matchValue) + { + int error = 0; + error = Interop.Calendar.Filter.Create(viewUri, out _filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddString(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Creates a filter with a condition for an integer type. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, int matchValue) + { + int error = 0; + error = Interop.Calendar.Filter.Create(viewUri, out _filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddInteger(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Creates a filter with a condition for long type. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, long matchValue) + { + int error = 0; + error = Interop.Calendar.Filter.Create(viewUri, out _filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddLong(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Creates a filter with a condition for double type. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, double matchValue) + { + int error = 0; + error = Interop.Calendar.Filter.Create(viewUri, out _filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddDouble(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Creates a filter with a condition for CalendarTime type. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarFilter(string viewUri, uint propertyId, IntegerMatchType matchType, CalendarTime matchValue) + { + int error = 0; + error = Interop.Calendar.Filter.Create(viewUri, out _filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + Interop.Calendar.Record.DateTime time = CalendarRecord.ConvertCalendarTimeToStruct(matchValue); + error = Interop.Calendar.Filter.AddCalendarTime(_filterHandle, propertyId, matchType, time); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + ~CalendarFilter() + { + Dispose(false); + } + + /// + /// Enumeration for the filter match type of a string. + /// + public enum StringMatchType + { + /// + /// Full string, case-sensitive + /// + Exactly, + /// + /// Full string, case-insensitive + /// + Fullstring, + /// + /// Sub string, case-insensitive + /// + Contains, + /// + /// Start with, case-insensitive + /// + Startswith, + /// + /// End with, case-insensitive + /// + Endswith, + /// + /// IS NOT NUL + /// + Exists, + } + + /// + /// Enumeration for the filter match type of an integer. + /// + public enum IntegerMatchType + { + /// + /// '=' + /// + Equal, + /// + /// '>' + /// + GreaterThan, + /// + /// '>=' + /// + GreaterThanOrEqual, + /// + /// < + /// + LessThan, + /// + /// <= + /// + LessThanOrEqual, + /// + /// <>, this flag can yield poor performance + /// + NotEqual, + /// + /// IS NULL + /// + None, + } + + /// + /// Enumeration for a filter operator. + /// + public enum LogicalOperator + { + /// + /// AND + /// + And, + /// + /// OR + /// + Or, + } + +#region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + Log.Debug(Globals.LogTag, "Dispose :" + disposing); + + int error = Interop.Calendar.Filter.Destroy(_filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Destroy Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + disposedValue = true; + } + } + + /// + /// Releases all resources used by the CalendarFilter. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + /// + /// Adds a condition for the string type. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match valu + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, StringMatchType matchType, string matchValue) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddString(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Adds a condition for the integer type. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match valu + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, int matchValue) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddInteger(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Adds a condition for the long type. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match valu + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, long matchValue) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddLong(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Adds a condition for the double type. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match valu + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, double matchValue) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddDouble(_filterHandle, propertyId, matchType, matchValue); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Adds a condition for the CalendarTime type. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match valu + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, CalendarTime matchValue) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + Interop.Calendar.Record.DateTime time = CalendarRecord.ConvertCalendarTimeToStruct(matchValue); + error = Interop.Calendar.Filter.AddCalendarTime(_filterHandle, propertyId, matchType, time); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Adds a child filter to a parent filter. + /// + /// The operator type + /// The child filter + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddFilter(LogicalOperator logicalOperator, CalendarFilter filter) + { + int error = Interop.Calendar.Filter.AddOperator(_filterHandle, logicalOperator); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + + error = Interop.Calendar.Filter.AddFilter(_filterHandle, filter._filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs new file mode 100644 index 0000000..fdcf2a9 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarList.cs @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Tizen.Pims.Calendar +{ + /// + /// A list of records with the same type. + /// + public class CalendarList:IDisposable + { + private Int64 _memoryPressure = 20; + internal int _count = -1; + internal IntPtr _listHandle; + + internal CalendarList(IntPtr handle) + { + _listHandle = handle; + + _memoryPressure += this.Count * CalendarViews.AverageSizeOfRecord; + GC.AddMemoryPressure(_memoryPressure); + } + + /// + /// Creates a calendar list. + /// + /// Thrown when an invoked method is not supported + /// Thrown when failed due to out of memory + public CalendarList() + { + int error = Interop.Calendar.List.Create(out _listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarList Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + GC.AddMemoryPressure(_memoryPressure); + } + + ~CalendarList() + { + Dispose(false); + } + + /// + /// The count of the calendar entity. + /// + public int Count + { + get + { + if (_count == -1) + { + int count = -1; + int error = Interop.Calendar.List.GetCount(_listHandle, out count); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetCount Failed with error " + error); + } + _count = count; + } + return _count; + } + } + +#region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + Log.Debug(Globals.LogTag, "Dispose :" + disposing); + + int error = Interop.Calendar.List.Destroy(_listHandle, true); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Destroy Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + disposedValue = true; + GC.RemoveMemoryPressure(_memoryPressure); + } + } + + /// + /// Releases all resources used by the CalendarList. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + /// + /// Adds a record to the calendar list. + /// + /// The record to be added + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddRecord(CalendarRecord record) + { + int error = Interop.Calendar.List.Add(_listHandle, record._recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddRecord Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + record._disposedValue = true; + _count = -1; + _memoryPressure += CalendarViews.AverageSizeOfRecord; + } + + /// + /// Removes a record from the calendar list. + /// + /// The record to be removed + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void RemoveRecord(CalendarRecord record) + { + int error = Interop.Calendar.List.Remove(_listHandle, record._recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "RemoveRecord Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + record._disposedValue = false; + _count = -1; + _memoryPressure -= CalendarViews.AverageSizeOfRecord; + } + + /// + /// Retrieves a record from the calendar list. + /// + /// + /// calendar record + /// + public CalendarRecord GetCurrentRecord() + { + IntPtr handle; + int error = Interop.Calendar.List.GetCurrentRecordP(_listHandle, out handle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetCurrentRecord Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarRecord(handle, true); + } + + /// + /// Moves a calendar list to the previous position. + /// + /// + /// if cursor is moved to the end, it returns false. + /// + public bool MovePrevious() + { + int error = Interop.Calendar.List.Prev(_listHandle); + if (CalendarError.None == (CalendarError)error) + { + return true; + } + else if (this.Count > 0 && CalendarError.NoData == (CalendarError)error) + { + Log.Debug(Globals.LogTag, "Nodata MovePrevious " + error); + return false; + } + else + { + Log.Error(Globals.LogTag, "MovePrevious Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Moves a calendar list to the next position. + /// + /// + /// if cursor is moved to the end, it returns false. + /// + public bool MoveNext() + { + int error = Interop.Calendar.List.Next(_listHandle); + if (CalendarError.None == (CalendarError)error) + { + return true; + } + else if (this.Count > 0 && CalendarError.NoData == (CalendarError)error) + { + Log.Debug(Globals.LogTag, "Nodata MoveNext" + error); + return false; + } + else + { + Log.Error(Globals.LogTag, "MoveNext Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Moves a calendar list to the first position. + /// + public void MoveFirst() + { + int error = Interop.Calendar.List.First(_listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "MoveFirst Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Moves a calendar list to the last position. + /// + public void MoveLast() + { + int error = Interop.Calendar.List.Last(_listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "MoveLast Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs new file mode 100644 index 0000000..af6ef04 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarManager.cs @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using static Interop.Calendar.Service; + +namespace Tizen.Pims.Calendar +{ + /// + /// A class for managing calendar information. It allows applications to use calendar service. + /// + public class CalendarManager : IDisposable + { + private CalendarDatabase _db = null; + + /// + /// Create a manager. + /// + /// Thrown when method failed due to invalid operation + public CalendarManager() + { + int error = Interop.Calendar.Service.Connect(); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Connect Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _db = new CalendarDatabase(); + } + + ~CalendarManager() + { + Dispose(false); + } + +#region IDisposable Support + /// To detect redundant calls + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + Log.Debug(Globals.LogTag, "Dispose :" + disposing); + + int error = Interop.Calendar.Service.Disconnect(); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Disconnect Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + disposedValue = true; + } + } + + /// + /// Releases all resources used by the CalendarManager. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + /// + /// Get database. + /// + public CalendarDatabase Database + { + get + { + return _db; + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs new file mode 100644 index 0000000..941699a --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarQuery.cs @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Calendar.Query; + +namespace Tizen.Pims.Calendar +{ + /// A query is used to retrieve data which satisfies given criteria. + /// + /// + /// A query is used to retrieve calendar data which satisfies a given criteria, + /// such as an integer property being greater than a given value, + /// or a string property containing a given substring. + /// A query needs a filter which can set the conditions for the search. + /// + public class CalendarQuery : IDisposable + { + internal IntPtr _queryHandle; + + /// + /// Creates a query. + /// + /// The view URI of a query + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarQuery(string viewUri) + { + int error = Interop.Calendar.Query.Create(viewUri, out _queryHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarQuery Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + internal CalendarQuery(IntPtr handle) + { + _queryHandle = handle; + } + + ~CalendarQuery() + { + Dispose(false); + } + +#region IDisposable Support + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + Log.Debug(Globals.LogTag, "Dispose :" + disposing); + + int error = Interop.Calendar.Query.Destroy(_queryHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarQueryDestroy Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + disposedValue = true; + } + } + + /// + /// Releases all resources used by the CalendarQuery. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + /// + /// Adds property IDs for projection. + /// + /// The property ID array + /// Thrown when one of the arguments provided to a method is not valid + public void SetProjection(uint[] propertyIdArray) + { + int error = Interop.Calendar.Query.SetProjection(_queryHandle, propertyIdArray, propertyIdArray.Length); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "SetProjection Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Sets the "distinct" option for projection. + /// + /// If true it is set, otherwise if false it is unset + /// Thrown when one of the arguments provided to a method is not valid + public void SetDistinct(bool set) + { + int error = Interop.Calendar.Query.SetDistinct(_queryHandle, set); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "SetDistinct Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Sets the filter for a query. + /// + /// The filter + /// Thrown when one of the arguments provided to a method is not valid + public void SetFilter(CalendarFilter filter) + { + int error = Interop.Calendar.Query.SetFilter(_queryHandle, filter._filterHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "SetFilter Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + + /// + /// Sets the sort mode for a query. + /// + /// The property ID to sort + /// If true it sorts in the ascending order, otherwise if false it sorts in the descending order + /// Thrown when one of the arguments provided to a method is not valid + public void SetSort(uint propertyId, bool isAscending) + { + int error = Interop.Calendar.Query.SetSort(_queryHandle, propertyId, isAscending); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "SetSort Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs new file mode 100644 index 0000000..224ff4e --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarRecord.cs @@ -0,0 +1,452 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Pims.Calendar +{ + /// + /// A record represents an actual record in the database + /// + /// + /// A record represents an actual record in the database, + /// but you can also consider it a piece of information, such as an alarm, attendee and extended. + /// A record can be a complex set of data, containing other data. + /// For example, a calendar record contains the alarm property, which is a reference to an alarm record. + /// An alarm record could belong to a event record, + /// and its alarm id property is set to the identifier of the corresponding event. + /// In this case, the alarm is the child record of the event and the event is the parent record. + /// + public class CalendarRecord : IDisposable + { + internal string _uri; + internal uint _id; + private Int64 _memoryPressure = CalendarViews.AverageSizeOfRecord; + internal IntPtr _recordHandle; + + internal CalendarRecord(IntPtr handle) + { + _recordHandle = handle; + + IntPtr viewUri; + int error = Interop.Calendar.Record.GetUriPointer(handle, out viewUri); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetUriPointer Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _uri = Marshal.PtrToStringAnsi(viewUri); + GC.AddMemoryPressure(_memoryPressure); + } + + internal CalendarRecord(IntPtr handle, bool disposedValue) + { + _recordHandle = handle; + _disposedValue = disposedValue; + + IntPtr viewUri; + int error = Interop.Calendar.Record.GetUriPointer(handle, out viewUri); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetUriPointer Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _uri = Marshal.PtrToStringAnsi(viewUri); + if (!_disposedValue) + GC.AddMemoryPressure(_memoryPressure); + } + + internal CalendarRecord(IntPtr handle, int id) + { + _recordHandle = handle; + _id = (uint)id; + + IntPtr viewUri; + int error = Interop.Calendar.Record.GetUriPointer(handle, out viewUri); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetUriPointer Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _uri = Marshal.PtrToStringAnsi(viewUri); + GC.AddMemoryPressure(_memoryPressure); + } + + /// + /// Creates a record. + /// + /// The view URI + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarRecord(string viewUri) + { + int error = 0; + error = Interop.Calendar.Record.Create(viewUri, out _recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CalendarRecord Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _uri = viewUri; + GC.AddMemoryPressure(_memoryPressure); + } + + ~CalendarRecord() + { + Dispose(false); + } + +#region IDisposable Support + /// To detect redundant calls + internal bool _disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + Log.Debug(Globals.LogTag, "Dispose :" + disposing); + + int error = Interop.Calendar.Record.Destroy(_recordHandle, false); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Destroy Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + _disposedValue = true; + GC.RemoveMemoryPressure(_memoryPressure); + } + } + + /// + /// Releases all resources used by the CalendarRecord. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + internal static Interop.Calendar.Record.DateTime ConvertCalendarTimeToStruct(CalendarTime value) + { + Interop.Calendar.Record.DateTime time = new Interop.Calendar.Record.DateTime(); + time.type = value._type; + + if ((int)CalendarTime.Type.Utc == value._type) + { + DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0); + time.utime = (value.UtcTime.Ticks - epoch.Ticks) / 10000000; + } + else + { + time.year = value.LocalTime.Year; + time.month = value.LocalTime.Month; + time.mday = value.LocalTime.Day; + time.hour = value.LocalTime.Hour; + time.minute = value.LocalTime.Minute; + time.second = value.LocalTime.Second; + } + return time; + } + + internal static CalendarTime ConvertIntPtrToCalendarTime(Interop.Calendar.Record.DateTime time) + { + CalendarTime value; + if ((int)CalendarTime.Type.Utc == time.type) + { + DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0); + value = new CalendarTime(time.utime * 10000000 + epoch.Ticks); + } + else + { + value = new CalendarTime(time.year, time.month, time.mday, time.hour, time.minute, time.second); + } + value._type = time.type; + return value; + } + + /// + /// Makes a clone of a record. + /// + /// + /// A cloned record + /// + /// Thrown when failed due to out of memory + public CalendarRecord Clone() + { + IntPtr _clonedRecordHandle; + int error = Interop.Calendar.Record.Clone(_recordHandle, out _clonedRecordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Clone Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarRecord(_clonedRecordHandle, (int)_id); + } + + /// + /// The URI of the record + /// + public string Uri + { + get + { + return _uri; + } + } + + /// + /// Gets a object from a record. + /// + /// The property ID + /// + /// The value of the property corresponding to property id. + /// + /// Thrown when one of the arguments provided to a method is not valid + public T Get(uint propertyId) + { + object parsedValue = null; + if (typeof(T) == typeof(string)) + { + string val; + int error = Interop.Calendar.Record.GetString(_recordHandle, propertyId, out val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Get String Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(int)) + { + int val; + int error = Interop.Calendar.Record.GetInteger(_recordHandle, propertyId, out val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Get Intger Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(long)) + { + long val; + int error = Interop.Calendar.Record.GetLli(_recordHandle, propertyId, out val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Get Long Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(double)) + { + double val; + int error = Interop.Calendar.Record.GetDouble(_recordHandle, propertyId, out val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Get Double Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(CalendarTime)) + { + Interop.Calendar.Record.DateTime time; + int error = Interop.Calendar.Record.GetCalendarTime(_recordHandle, propertyId, out time); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Get CalendarTime Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + CalendarTime val = ConvertIntPtrToCalendarTime(time); + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else + { + Log.Error(Globals.LogTag, "Not supported Data T/ype"); + throw CalendarErrorFactory.GetException((int)CalendarError.NotSupported); + } + return (T)parsedValue; + } + + /// + /// Sets a value of the property to a record. + /// + /// The property ID + /// value + /// Thrown when one of the arguments provided to a method is not valid + public void Set(uint propertyId, T value) + { + if (typeof(T) == typeof(string)) + { + string val = Convert.ToString(value); + int error = Interop.Calendar.Record.SetString(_recordHandle, propertyId, val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Set String Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + } + else if (typeof(T) == typeof(int)) + { + int val = Convert.ToInt32(value); + int error = Interop.Calendar.Record.SetInteger(_recordHandle, propertyId, val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Set Integer Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + } + else if (typeof(T) == typeof(long)) + { + long val = Convert.ToInt64(value); + int error = Interop.Calendar.Record.SetLli(_recordHandle, propertyId, val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Set Long Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + } + else if (typeof(T) == typeof(double)) + { + double val = Convert.ToDouble(value); + int error = Interop.Calendar.Record.SetDouble(_recordHandle, propertyId, val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Set Double Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + } + else if (typeof(T) == typeof(CalendarTime)) + { + CalendarTime time = (CalendarTime)Convert.ChangeType(value, typeof(CalendarTime)); + Interop.Calendar.Record.DateTime val = ConvertCalendarTimeToStruct(time); + int error = Interop.Calendar.Record.SetCalendarTime(_recordHandle, propertyId, val); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Set CalendarTime Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + } + else + { + Log.Error(Globals.LogTag, "Not supported Data T/ype"); + throw CalendarErrorFactory.GetException((int)CalendarError.NotSupported); + } + } + + /// + /// Adds a child record to the parent record. + /// + /// The property ID + /// The child record + /// Thrown when one of the arguments provided to a method is not valid + public void AddChildRecord(uint propertyId, CalendarRecord childRecord) + { + int error = Interop.Calendar.Record.AddChildRecord(_recordHandle, propertyId, childRecord._recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "AddChildRecord Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + childRecord._disposedValue = true; + } + + /// + /// Removes a child record from the parent record. + /// + /// The property ID + /// The child record + /// Thrown when one of the arguments provided to a method is not valid + public void RemoveChildRecord(uint propertyId, CalendarRecord childRecord) + { + int error = Interop.Calendar.Record.RemoveChildRecord(_recordHandle, propertyId, childRecord._recordHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "RemoveChildRecord Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + childRecord._disposedValue = false; + } + + /// + /// Gets a child record from the parent record + /// + /// The property ID + /// + /// The number of child records corresponding to property ID + /// + /// Thrown when one of the arguments provided to a method is not valid + public int GetChildRecordCount(uint propertyId) + { + int count = 0; + int error = Interop.Calendar.Record.GetChildRecordCount(_recordHandle, propertyId, out count); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetChildRecordCount Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + return count; + } + + /// + /// Gets a child record from the parent record + /// + /// The property ID + /// The child record index + /// + /// The record + /// + /// Thrown when one of the arguments provided to a method is not valid + public CalendarRecord GetChildRecord(uint propertyId, int index) + { + IntPtr handle; + + int error = Interop.Calendar.Record.GetChildRecordPointer(_recordHandle, propertyId, index, out handle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "GetChildRecord Failed [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarRecord(handle, true); + } + + /// + /// Clones a child record list corresponding to property ID + /// + /// The property ID + /// + /// the record list + /// + /// Thrown when one of the arguments provided to a method is not valid + public CalendarList CloneChildRecordList(uint propertyId) + { + IntPtr listHandle; + int error = Interop.Calendar.Record.CloneChildRecordList(_recordHandle, propertyId, out listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "CloneChildRecordList Failed with [" + error + "]" + String.Format("{0:X}", propertyId)); + throw CalendarErrorFactory.GetException(error); + } + CalendarList list = new CalendarList(listHandle); + return list; + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs new file mode 100644 index 0000000..f1193ef --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarReminder.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Calendar.Reminder; + +namespace Tizen.Pims.Calendar +{ + /// + /// A class for reminder for event. + /// + /// + /// The client who wants to be alerted at specific time should register MIME("application/x-tizen.calendar.reminder") type in manifest.xml file. + /// + public class CalendarReminder : IDisposable + { +#region IDisposable Support + private bool disposedValue = false; + + internal CalendarReminder() + { + } + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + disposedValue = true; + } + } + + /// + /// Releases all resources used by the CalendarReminder. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } +#endregion + + private static readonly Interop.Calendar.Reminder.ReminderAlertedCallback _reminderAlertedCallback = (string param, IntPtr userData) => + { + ReminderAlertedEventArgs args = new ReminderAlertedEventArgs(param); + s_reminderAlerted?.Invoke(null, args); + }; + + private static event EventHandler s_reminderAlerted; + + /// + /// Reminder event is triggered when the alarm is alerted. + /// + public static event EventHandler ReminderAlerted + { + add + { + Log.Debug(Globals.LogTag, "Add Reminder"); + + if (s_reminderAlerted == null) + { + int error = Interop.Calendar.Reminder.Add(_reminderAlertedCallback, IntPtr.Zero); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Add reminder Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + s_reminderAlerted += value; + } + + remove + { + Log.Debug(Globals.LogTag, "Remove Reminder"); + + s_reminderAlerted -= value; + if (s_reminderAlerted == null) + { + /// _reminderAlertedCallback is removed by .Net Core + int error = Interop.Calendar.Reminder.Remove(_reminderAlertedCallback, IntPtr.Zero); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Remove reminder Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + } + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs new file mode 100644 index 0000000..3ac883c --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarStructs.cs @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Pims.Calendar +{ + /// + /// A class for time to set, get or calcurate. + /// + public class CalendarTime : IComparable + { + internal int _type; + internal const int milliseconds = 10000000; + + /// + /// Enumeration for the time type. + /// + public enum Type + { + /// + /// UTC time + /// + Utc, + /// + /// Local time + /// + Local + } + + /// + /// Create UTC CalendarTime + /// + /// UTC epoch time. 0 is 1971/01/01 + public CalendarTime(long utcTime) + { + _type = (int)Type.Utc; + utcTime -= utcTime % milliseconds; /* delete millisecond */ + UtcTime = new DateTime(utcTime); + } + + /// + /// Create Local CalendarTime + /// + /// year + /// month + /// day + /// hour + /// minute + /// second + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public CalendarTime(int year, int month, int day, int hour, int minute, int second) + { + _type = (int)Type.Local; + LocalTime = new DateTime(year, month, day, hour, minute, second); + } + + /// + /// Get utcTime + /// + public DateTime UtcTime + { + get; + } + + /// + /// Get localTime + /// + public DateTime LocalTime + { + get; + } + + /// + /// Compare CalendarTime + /// + /// The CalendarTime to be compared + /// + /// A 32-bit signed integer that indicates the relative order of the objects being compared. + /// + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public int CompareTo(CalendarTime t) + { + if (_type != t._type) + { + Log.Error(Globals.LogTag, "Not to compare with different type"); + throw CalendarErrorFactory.GetException((int)CalendarError.InvalidParameter); + } + + if (_type == (int)Type.Utc) + return UtcTime.CompareTo(t.UtcTime); + else + return LocalTime.CompareTo(t.LocalTime); + } + } +} + diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs new file mode 100644 index 0000000..560e898 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarTypes.cs @@ -0,0 +1,458 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections; +using System.Collections.Generic; + +/// +/// +/// +/// +namespace Tizen.Pims.Calendar +{ + /// + /// + public static class CalendarTypes + { + /// + /// Enumeration for Default book + /// + public enum DefaultBook + { + /// + /// Default event calendar book. + /// + Event, + /// + /// Default Todo calendar book. + /// + Todo, + /// + /// Default Birthday calendar book. + /// + Birthday, + } + + /// + /// Enumeration for Store type + /// + public enum StoreType + { + /// + /// Book type + /// + Book, + /// + /// Event type + /// + Event, + /// + /// Todo type + /// + Todo, + } + + /// + /// Enumeration for the book mode. + /// + public enum BookMode + { + /// + /// All modules can read and write records of this calendar_book + /// + Default, + /// + /// All modules can only read records of this calendar book + /// + ReadOnly, + } + + /// + /// Enumeration for the event status. + /// + public enum EventStatus + { + /// + /// No status + /// + None = 0x01, + /// + /// The event is tentative + /// + Tentative = 0x02, + /// + /// The event is confirmed + /// + Confirmed = 0x04, + /// + /// The event is canceled + /// + Cancelled = 0x08, + } + + /// + /// Enumeration for for the status of a to-do. + /// + public enum TodoStatus + { + /// + /// No status + /// + None = 0x0100, + /// + /// Needs action status + /// + NeedAction = 0x0200, + /// + /// Completed status + /// + Completed = 0x0400, + /// + /// Work in process status + /// + InProcess = 0x0800, + /// + /// Canceled status + /// + Canceled = 0x1000, + } + + /// + /// Enumeration for the busy status of an event. + /// + public enum BusyStatus + { + /// + /// The free status + /// + Free, + /// + /// The busy status + /// + Busy, + /// + /// The unavailable status + /// + Unavailable, + /// + /// The tentative status + /// + Tentative, + } + + /// + /// Enumeration for the calendar sensitivity type. + /// + public enum Sensitivity + { + /// + /// Public Sensitivity + /// + Public, + /// + /// Private Sensitivity + /// + Private, + /// + /// Confidential Sensitivity + /// + Confidential, + } + + /// + /// Enumeration for the meeting status. + /// + public enum MeetingStatus + { + /// + /// No meeting + /// + Notmeeting, + /// + /// Meeting exists + /// + Meeting, + /// + /// Meeting received + /// + Received, + /// + /// Meeting canceled + /// + Canceled, + } + + /// + /// Enumeration for the calendar event item's priority + /// + public enum Priority + { + /// + /// No priority + /// + None = 0x01, + /// + /// Low priority + /// + High = 0x02, + /// + /// Normal priority + /// + Normal = 0x04, + /// + /// High priority + /// + Low = 0x08, + } + + /// + /// Enumeration for the frequency of an event's recurrence. + /// + public enum Recurrence + { + /// + /// No recurrence event + /// + None, + /// + /// An event occurs every day + /// + Daily, + /// + /// An event occurs on the same day of every week. According to the week flag, the event will recur every day of the week + /// + Weekly, + /// + /// An event occurs on the same day of every month + /// + Monthly, + /// + /// An event occurs on the same day of every year + /// + Yearly, + } + + /// + /// Enumeration for the range type. + /// + public enum RangeType + { + /// + /// Range until + /// + Until, + /// + /// Range count + /// + Count, + /// + /// No range + /// + None, + } + + /// + /// Enumeration for the system type. + /// + public enum SystemType + { + /// + /// Locale's default calendar + /// + Default, + /// + /// Locale's default calendar + /// + Gregorian, + /// + /// East asian lunisolar calendar + /// + Lunisolar, + } + + /// + /// Enumeration for the alarm time unit type of an event, such as minutes, hours, days, and so on. + /// + public enum TickUnit + { + /// + /// No reminder set + /// + None = -1, + /// + /// Specific in seconds + /// + Specific = 1, + /// + /// Alarm time unit in minutes + /// + Minute = 60, + /// + /// Alarm time unit in hours + /// + Hour = 3600, + /// + /// Alarm time unit in days + /// + Day = 86400, + /// + /// Alarm time unit in weeks + /// + Week = 604800, + } + + /// + /// Enumeration for weekdays. + /// + public enum WeekDay + { + /// + /// Sunday + /// + Sunday = 1, + /// + /// Monday + /// + Monday, + /// + /// Tuesday + /// + Thuesday, + /// + /// Wednesday + /// + Wednesday, + /// + /// Thursday + /// + Thurday, + /// + /// Friday + /// + Friday, + /// + /// Saturday + /// + Saterday, + } + + /// + /// Enumeration for the attendee cutype. + /// + public enum Cutype + { + /// + /// Individual cutype + /// + Individual, + /// + /// Group cutype + /// + Group, + /// + /// Resource cutype + /// + Recource, + /// + /// Room cutype + /// + Room, + /// + /// Unknown cutype + /// + Unknown, + } + + /// + /// Enumeration for the attendee role. + /// + public enum AttendeeRole + { + /// + /// Participation is required + /// + ReqParticipant, + /// + /// Accepted status + /// + OptParticipant, + /// + /// Non-Participant + /// + NonParticipant, + /// + /// Chairperson + /// + Chair, + } + + /// + /// Enumeration for the attendee status. + /// + public enum AttendeeStatus + { + /// + /// Pending status + /// + Pending, + /// + /// Accepted status + /// + Accepted, + /// + /// Declined status + /// + Declined, + /// + /// Tentative status + /// + Tentative, + /// + /// Delegated status + /// + Delegated, + /// + /// Completed status + /// + Completed, + /// + /// In process status + /// + InProcess, + } + + /// + /// Enumeration for the alarm action. + /// + public enum Action + { + /// + /// Audio action + /// + Audio, + /// + /// Display action + /// + Display, + /// + /// Email action + /// + Email, + } + } +} + diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs new file mode 100644 index 0000000..1a7a3a8 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarVcalendar.cs @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Tizen.Pims.Calendar +{ + /// + /// A class for parsing and composing vCalendar. + /// + /// + /// It's based on the vCalendar v2.0 specification + /// + public class CalendarVcalendar + { + internal CalendarVcalendar() + { + } + + public delegate bool ParseDelegate(CalendarRecord record); + + /// + /// Retrieves a vcalendar stream from a calendar list. + /// + /// The calendar list + /// + /// The composed stream. + /// + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static string Compose(CalendarList list) + { + string stream; + int error = Interop.Calendar.Vcalendar.Compose(list._listHandle, out stream); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "MakeVcalendar Failed with error " + error); + throw CalendarErrorFactory.GetException(error); + } + return stream; + } + + /// + /// Retrieves all calendars from a vcalendar stream. + /// + /// The vcalendar stream + /// + /// the record list + /// + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static CalendarList Parse(string stream) + { + int error = 0; + IntPtr _listHandle; + error = Interop.Calendar.Vcalendar.Parse(stream, out _listHandle); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Parse Vcalendar Failed [" + error + "]"); + throw CalendarErrorFactory.GetException(error); + } + return new CalendarList(_listHandle); + } + + /// + /// Parse vcalendar file with foreach + /// + /// The file path of the vCalendar stream file + /// he callback function to invoke + /// Thrown when method failed due to invalid operation + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static void ParseForEach(string path, ParseDelegate callback) + { + int error = 0; + + Interop.Calendar.Vcalendar.ParseCallback cb = (IntPtr handle, IntPtr data) => + { + return callback(new CalendarRecord(handle, true)); + }; + + error = Interop.Calendar.Vcalendar.ParseForEach(path, cb, IntPtr.Zero); + if (CalendarError.None != (CalendarError)error) + { + Log.Error(Globals.LogTag, "Parse foreach Vcalendar Failed [" + error + "]"); + throw CalendarErrorFactory.GetException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs new file mode 100644 index 0000000..b4ddd17 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/CalendarViews.cs @@ -0,0 +1,1448 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Tizen.Pims.Calendar +{ + /// + /// This class provides information about views with properties. + /// + /// + /// A view is a class which describes properties of a record. + /// A record can have basic properties of five types: integer, string, long, double, CalendarTime. + /// + public static class CalendarViews + { + /// data type mask 0x0FF00000 + private const uint ViewMask = 0xFF000000; + private const uint ViewBook = 0x01000000; + private const uint ViewEvent = 0x02000000; + private const uint ViewTodo = 0x03000000; + private const uint ViewTimezone = 0x04000000; + private const uint ViewAttendee = 0x05000000; + private const uint ViewAlarm = 0x06000000; + private const uint ViewInstanceUtimeBook = 0x07000000; + private const uint ViewInstanceLocaltimeBook = 0x08000000; + private const uint ViewUpdateInfo = 0x09000000; + private const uint ViewExtended = 0x0A000000; + private const uint ViewInstanceUtimeBookExtended = 0x0B000000; + private const uint ViewInstanceLocaltimeBookExtended = 0x0C000000; + + private const uint DataTypeMask = 0x000FF000; + private const uint DataTypeInteger = 0x00001000; + private const uint DataTypeString = 0x00002000; + private const uint DataTypeDouble = 0x00003000; + private const uint DataTypeLong = 0x00004000; + private const uint DataTypeCaltime = 0x00005000; + private const uint DataTypeRecord = 0x00006000; + + /// property : mask 0x0000F000 + private const uint PropertyMask = 0x00F00000; + private const uint PropertyFilter = 0x00100000; + private const uint PropertyProjection = 0x00200000; + private const uint PropertyReadOnly = 0x00300000; + + private enum PropertyIds : uint + { + /// book + BookId = (ViewBook|DataTypeInteger|PropertyReadOnly), + BookUid = (ViewBook|DataTypeString) + 1, + BookName = (ViewBook|DataTypeString) + 2, + BookDescription = (ViewBook|DataTypeString) + 3, + BookColor = (ViewBook|DataTypeString) + 4, + BookLocation = (ViewBook|DataTypeString) + 5, + BookVisibility = (ViewBook|DataTypeInteger) + 6, + BookSyncEvent = (ViewBook|DataTypeInteger) + 7, + BookAccountId = (ViewBook|DataTypeInteger) + 8, + BookStoreType = (ViewBook|DataTypeInteger) + 9, + BookSyncData1 = (ViewBook|DataTypeString) + 10, + BookSyncData2 = (ViewBook|DataTypeString) + 11, + BookSyncData3 = (ViewBook|DataTypeString) + 12, + BookSyncData4 = (ViewBook|DataTypeString) + 13, + BookMode = (ViewBook|DataTypeInteger) + 14, + + /// Event + EventId = (ViewEvent|DataTypeInteger|PropertyReadOnly), + EventBookId = (ViewEvent|DataTypeInteger) + 1, + EventSummary = (ViewEvent|DataTypeString) + 2, + EventDescription = (ViewEvent|DataTypeString) + 3, + EventLocation = (ViewEvent|DataTypeString) + 4, + EventCategories = (ViewEvent|DataTypeString) + 5, + EventExdate = (ViewEvent|DataTypeString) + 6, + EventEventStatus = (ViewEvent|DataTypeInteger) + 7, + EventPriority = (ViewEvent|DataTypeInteger) + 8, + EventTimezone = (ViewEvent|DataTypeInteger) + 9, + EventContactId = (ViewEvent|DataTypeInteger) + 10, + EventBusyStatus = (ViewEvent|DataTypeInteger) + 11, + EventSensitivity = (ViewEvent|DataTypeInteger) + 12, + EventUid = (ViewEvent|DataTypeString) + 13, + EventOrganizerName = (ViewEvent|DataTypeString) + 14, + EventOrganizerEmail = (ViewEvent|DataTypeString) + 15, + EventMeetingStatus = (ViewEvent|DataTypeInteger) + 16, + EventOriginalEventId = (ViewEvent|DataTypeInteger) + 17, + EventLatitude = (ViewEvent|DataTypeDouble) + 18, + EventLongitude = (ViewEvent|DataTypeDouble) + 19, + EventEmailId = (ViewEvent|DataTypeInteger) + 20, + EventCreatedTime = (ViewEvent|DataTypeLong) + 21, + EventLastModifiedTime = (ViewEvent|DataTypeLong|PropertyReadOnly) + 22, + EventIsDeleted = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 23, + EventFreq = (ViewEvent|DataTypeInteger) + 24, + EventRangeType = (ViewEvent|DataTypeInteger) + 25, + EventUntil = (ViewEvent|DataTypeCaltime) + 26, + EventCount = (ViewEvent|DataTypeInteger) + 27, + EventInterval = (ViewEvent|DataTypeInteger) + 28, + EventBysecond = (ViewEvent|DataTypeString) + 29, + EventByminute = (ViewEvent|DataTypeString) + 30, + EventByhour = (ViewEvent|DataTypeString) + 31, + EventByday = (ViewEvent|DataTypeString) + 32, + EventBymonthday = (ViewEvent|DataTypeString) + 33, + EventByyearday = (ViewEvent|DataTypeString) + 34, + EventByweekno = (ViewEvent|DataTypeString) + 35, + EventBymonth = (ViewEvent|DataTypeString) + 36, + EventBysetpos = (ViewEvent|DataTypeString) + 37, + EventWkst = (ViewEvent|DataTypeInteger) + 38, + EventRecurrenceId = (ViewEvent|DataTypeString) + 39, + EventRdate = (ViewEvent|DataTypeString) + 40, + EventHasAttendee = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 41, + EventHasAlarm = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 42, + EventSyncData1 = (ViewEvent|DataTypeString) + 43, + EventSyncData2 = (ViewEvent|DataTypeString) + 44, + EventSyncData3 = (ViewEvent|DataTypeString) + 45, + EventSyncData4 = (ViewEvent|DataTypeString) + 46, + EventStart = (ViewEvent|DataTypeCaltime) + 47, + EventEnd = (ViewEvent|DataTypeCaltime) + 48, + EventAlarm = (ViewEvent|DataTypeRecord) + 49, + EventAttendee = (ViewEvent|DataTypeRecord) + 50, + EventCalendarSystemType = (ViewEvent|DataTypeInteger) + 51, + EventStartTzid = (ViewEvent|DataTypeString) + 52, + EventEndTzid = (ViewEvent|DataTypeString) + 53, + EventException = (ViewEvent|DataTypeRecord) + 54, + EventExtended = (ViewEvent|DataTypeRecord) + 55, + EventIsAllday = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 56, + EventLinkCount = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 57, + EventLinkBaseId = (ViewEvent|DataTypeInteger|PropertyReadOnly) + 58, + + /// Todo + TodoId = (ViewTodo|DataTypeInteger|PropertyReadOnly), + TodoBookId = (ViewTodo|DataTypeInteger) + 1, + TodoSummary = (ViewTodo|DataTypeString) + 2, + TodoDescription = (ViewTodo|DataTypeString) + 3, + TodoLocation = (ViewTodo|DataTypeString) + 4, + TodoCategories = (ViewTodo|DataTypeString) + 5, + TodoStatus = (ViewTodo|DataTypeInteger) + 6, + TodoPriority = (ViewTodo|DataTypeInteger) + 7, + TodoSensitivity = (ViewTodo|DataTypeInteger) + 8, + TodoUid = (ViewTodo|DataTypeString) + 9, + TodoLatitude = (ViewTodo|DataTypeDouble) + 10, + TodoLongitude = (ViewTodo|DataTypeDouble) + 11, + TodoProgress = (ViewTodo|DataTypeInteger) + 12, + TodoCreatedTime = (ViewTodo|DataTypeLong) + 13, + TodoLastModifiedTime = (ViewTodo|DataTypeLong|PropertyReadOnly) + 14, + TodoCompletedTime = (ViewTodo|DataTypeLong) + 15, + TodoIsDeleted = (ViewTodo|DataTypeInteger|PropertyReadOnly) + 16, + TodoFreq = (ViewTodo|DataTypeInteger) + 17, + TodoRangeType = (ViewTodo|DataTypeInteger) + 18, + TodoUntil = (ViewTodo|DataTypeCaltime) + 19, + TodoCount = (ViewTodo|DataTypeInteger) + 20, + TodoIntegererval = (ViewTodo|DataTypeInteger) + 21, + TodoBysecond = (ViewTodo|DataTypeString) + 22, + TodoByminute = (ViewTodo|DataTypeString) + 23, + TodoByhour = (ViewTodo|DataTypeString) + 24, + TodoByday = (ViewTodo|DataTypeString) + 25, + TodoBymonthday = (ViewTodo|DataTypeString) + 26, + TodoByyearday = (ViewTodo|DataTypeString) + 27, + TodoByweekno = (ViewTodo|DataTypeString) + 28, + TodoBymonth = (ViewTodo|DataTypeString) + 29, + TodoBysetpos = (ViewTodo|DataTypeString) + 30, + TodoWkst = (ViewTodo|DataTypeInteger) + 31, + TodoHasAlarm = (ViewTodo|DataTypeInteger|PropertyReadOnly) + 32, + TodoSyncData1 = (ViewTodo|DataTypeString) + 33, + TodoSyncData2 = (ViewTodo|DataTypeString) + 34, + TodoSyncData3 = (ViewTodo|DataTypeString) + 35, + TodoSyncData4 = (ViewTodo|DataTypeString) + 36, + TodoStart = (ViewTodo|DataTypeCaltime) + 37, + TodoDue = (ViewTodo|DataTypeCaltime) + 38, + TodoAlarm = (ViewTodo|DataTypeRecord) + 39, + TodoStartTzid = (ViewTodo|DataTypeString) + 40, + TodoDueTzid = (ViewTodo|DataTypeString) + 41, + TodoOrganizerName = (ViewTodo|DataTypeString) + 42, + TodoOrganizerEmail = (ViewTodo|DataTypeString) + 43, + TodoHasAttendee = (ViewTodo|DataTypeInteger|PropertyReadOnly) + 44, + TodoAttendee = (ViewTodo|DataTypeRecord) + 45, + TodoExtended = (ViewTodo|DataTypeRecord) + 46, + TodoIsAllday = (ViewTodo|DataTypeInteger|PropertyReadOnly) + 47, + + /// Timezone + TimezoneId = (ViewTimezone|DataTypeInteger|PropertyReadOnly), + TimezoneTzOffsetFromGmt = (ViewTimezone|DataTypeInteger) + 1, + TimezoneStandardName = (ViewTimezone|DataTypeString) + 2, + TimezoneStdStartMonth = (ViewTimezone|DataTypeInteger) + 3, + TimezoneStdStartPositionOfWeek = (ViewTimezone|DataTypeInteger) + 4, + TimezoneStdStartDay = (ViewTimezone|DataTypeInteger) + 5, + TimezoneStdStartHour = (ViewTimezone|DataTypeInteger) + 6, + TimezoneStandardBias = (ViewTimezone|DataTypeInteger) + 7, + TimezoneDayLightName = (ViewTimezone|DataTypeString) + 8, + TimezoneDayLightStartMonth = (ViewTimezone|DataTypeInteger) + 9, + TimezoneDayLightStartPositionOfWeek = (ViewTimezone|DataTypeInteger) + 10, + TimezoneDayLightStartDay = (ViewTimezone|DataTypeInteger) + 11, + TimezoneDayLightStartHour = (ViewTimezone|DataTypeInteger) + 12, + TimezoneDayLightBias = (ViewTimezone|DataTypeInteger) + 13, + TimezoneCalendarId = (ViewTimezone|DataTypeInteger) + 14, + + AttendeeNumber = (ViewAttendee|DataTypeString), + AttendeeCutype = (ViewAttendee|DataTypeInteger) + 1, + AttendeeCtIndex = (ViewAttendee|DataTypeInteger) + 2, + AttendeeUid = (ViewAttendee|DataTypeString) + 3, + AttendeeGroup = (ViewAttendee|DataTypeString) + 4, + AttendeeEmail = (ViewAttendee|DataTypeString) + 5, + AttendeeRole = (ViewAttendee|DataTypeInteger) + 6, + AttendeeStatus = (ViewAttendee|DataTypeInteger) + 7, + AttendeeRsvp = (ViewAttendee|DataTypeInteger) + 8, + AttendeeDelegateeUri = (ViewAttendee|DataTypeString) + 9, + AttendeeDelegatorUri = (ViewAttendee|DataTypeString) + 10, + AttendeeName = (ViewAttendee|DataTypeString) + 11, + AttendeeMember = (ViewAttendee|DataTypeString) + 12, + AttendeeParentId = (ViewAttendee|DataTypeInteger|PropertyReadOnly) + 13, + + AlarmTick = (ViewAlarm|DataTypeInteger), + AlarmTickUnit = (ViewAlarm|DataTypeInteger) + 1, + AlarmDescription = (ViewAlarm|DataTypeString) + 2, + AlarmParentId = (ViewAlarm|DataTypeInteger|PropertyReadOnly) + 3, + AlarmSummary = (ViewAlarm|DataTypeString) + 4, + AlarmAction = (ViewAlarm|DataTypeInteger) + 5, + AlarmAttach = (ViewAlarm|DataTypeString) + 6, + AlarmAlarm = (ViewAlarm|DataTypeCaltime) + 7, + + InstanceUtimeBookEventId = (ViewInstanceUtimeBook|DataTypeInteger), + InstanceUtimeBookStart = (ViewInstanceUtimeBook|DataTypeCaltime) + 1, + InstanceUtimeBookEnd = (ViewInstanceUtimeBook|DataTypeCaltime) + 2, + InstanceUtimeBookSummary = (ViewInstanceUtimeBook|DataTypeString) + 3, + InstanceUtimeBookLocation = (ViewInstanceUtimeBook|DataTypeString) + 4, + InstanceUtimeBookBookId = (ViewInstanceUtimeBook|DataTypeInteger) + 5, + InstanceUtimeBookDescription = (ViewInstanceUtimeBook|DataTypeString) + 6, + InstanceUtimeBookBusyStatus = (ViewInstanceUtimeBook|DataTypeInteger) + 7, + InstanceUtimeBookEventStatus = (ViewInstanceUtimeBook|DataTypeInteger) + 8, + InstanceUtimeBookPriority = (ViewInstanceUtimeBook|DataTypeInteger) + 9, + InstanceUtimeBookSensitivity = (ViewInstanceUtimeBook|DataTypeInteger) + 10, + InstanceUtimeBookHasRrule = (ViewInstanceUtimeBook|DataTypeInteger) + 11, + InstanceUtimeBookLatitude = (ViewInstanceUtimeBook|DataTypeDouble) + 12, + InstanceUtimeBookLongitude = (ViewInstanceUtimeBook|DataTypeDouble) + 13, + InstanceUtimeBookHasAlarm = (ViewInstanceUtimeBook|DataTypeInteger) + 14, + InstanceUtimeBookOriginalEventId = (ViewInstanceUtimeBook|DataTypeInteger) + 15, + InstanceUtimeBookLastModifiedtime = (ViewInstanceUtimeBook|DataTypeLong) + 16, + InstanceUtimeBookSyncData1 = (ViewInstanceUtimeBook|DataTypeString) + 17, + + InstanceLocaltimeBookEventId = (ViewInstanceLocaltimeBook|DataTypeInteger), + InstanceLocaltimeBookStart = (ViewInstanceLocaltimeBook|DataTypeCaltime) + 1, + InstanceLocaltimeBookEnd = (ViewInstanceLocaltimeBook|DataTypeCaltime) + 2, + InstanceLocaltimeBookSummary = (ViewInstanceLocaltimeBook|DataTypeString) + 3, + InstanceLocaltimeBookLocation = (ViewInstanceLocaltimeBook|DataTypeString) + 4, + InstanceLocaltimeBookBookId = (ViewInstanceLocaltimeBook|DataTypeInteger) + 5, + InstanceLocaltimeBookDescription = (ViewInstanceLocaltimeBook|DataTypeString) + 6, + InstanceLocaltimeBookBusyStatus = (ViewInstanceLocaltimeBook|DataTypeInteger) + 7, + InstanceLocaltimeBookEventStatus = (ViewInstanceLocaltimeBook|DataTypeInteger) + 8, + InstanceLocaltimeBookPriority = (ViewInstanceLocaltimeBook|DataTypeInteger) + 9, + InstanceLocaltimeBookSensitivity = (ViewInstanceLocaltimeBook|DataTypeInteger) + 10, + InstanceLocaltimeBookHasRrule = (ViewInstanceLocaltimeBook|DataTypeInteger) + 11, + InstanceLocaltimeBookLatitude = (ViewInstanceLocaltimeBook|DataTypeDouble) + 12, + InstanceLocaltimeBookLongitude = (ViewInstanceLocaltimeBook|DataTypeDouble) + 13, + InstanceLocaltimeBookHasAlarm = (ViewInstanceLocaltimeBook|DataTypeInteger) + 14, + InstanceLocaltimeBookOriginalEventId = (ViewInstanceLocaltimeBook|DataTypeInteger) + 15, + InstanceLocaltimeBookLastModifiedTime = (ViewInstanceLocaltimeBook|DataTypeLong) + 16, + InstanceLocaltimeBookSyncData1 = (ViewInstanceLocaltimeBook|DataTypeString) + 17, + InstanceLocaltimeBookIsAllday = (ViewInstanceLocaltimeBook|DataTypeInteger|PropertyReadOnly) + 18, + + InstanceUtimeBookExtendedEventId = (ViewInstanceUtimeBookExtended|DataTypeInteger), + InstanceUtimeBookExtendedStart = (ViewInstanceUtimeBookExtended|DataTypeCaltime) + 1, + InstanceUtimeBookExtendedEnd = (ViewInstanceUtimeBookExtended|DataTypeCaltime) + 2, + InstanceUtimeBookExtendedSummary = (ViewInstanceUtimeBookExtended|DataTypeString) + 3, + InstanceUtimeBookExtendedLocation = (ViewInstanceUtimeBookExtended|DataTypeString) + 4, + InstanceUtimeBookExtendedBookId = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 5, + InstanceUtimeBookExtendedDescription = (ViewInstanceUtimeBookExtended|DataTypeString) + 6, + InstanceUtimeBookExtendedBusyStatus = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 7, + InstanceUtimeBookExtendedEventStatus = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 8, + InstanceUtimeBookExtendedPriority = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 9, + InstanceUtimeBookExtendedSensitivity = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 10, + InstanceUtimeBookExtendedHasRrule = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 11, + InstanceUtimeBookExtendedLatitude = (ViewInstanceUtimeBookExtended|DataTypeDouble) + 12, + InstanceUtimeBookExtendedLongitude = (ViewInstanceUtimeBookExtended|DataTypeDouble) + 13, + InstanceUtimeBookExtendedHasAlarm = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 14, + InstanceUtimeBookExtendedOriginalEventId = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 15, + InstanceUtimeBookExtendedLastModifiedTime = (ViewInstanceUtimeBookExtended|DataTypeLong) + 16, + InstanceUtimeBookExtendedSyncData1 = (ViewInstanceUtimeBookExtended|DataTypeString) + 17, + InstanceUtimeBookExtendedOrganizerName = (ViewInstanceUtimeBookExtended|DataTypeString) + 18, + InstanceUtimeBookExtendedCategories = (ViewInstanceUtimeBookExtended|DataTypeString) + 19, + InstanceUtimeBookExtendedHasAttendee = (ViewInstanceUtimeBookExtended|DataTypeInteger) + 20, + InstanceUtimeBookExtendedSyncData2 = (ViewInstanceUtimeBookExtended|DataTypeString) + 21, + InstanceUtimeBookExtendedSyncData3 = (ViewInstanceUtimeBookExtended|DataTypeString) + 22, + InstanceUtimeBookExtendedSyncData4 = (ViewInstanceUtimeBookExtended|DataTypeString) + 23, + + InstanceLocaltimeBookExtendedEventId = (ViewInstanceLocaltimeBookExtended|DataTypeInteger), + InstanceLocaltimeBookExtendedStart = (ViewInstanceLocaltimeBookExtended|DataTypeCaltime) + 1, + InstanceLocaltimeBookExtendedEnd = (ViewInstanceLocaltimeBookExtended|DataTypeCaltime) + 2, + InstanceLocaltimeBookExtendedSummary = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 3, + InstanceLocaltimeBookExtendedLocation = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 4, + InstanceLocaltimeBookExtendedBookId = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 5, + InstanceLocaltimeBookExtendedDescription = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 6, + InstanceLocaltimeBookExtendedBusyStatus = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 7, + InstanceLocaltimeBookExtendedEventStatus = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 8, + InstanceLocaltimeBookExtendedPriority = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 9, + InstanceLocaltimeBookExtendedSensitivity = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 10, + InstanceLocaltimeBookExtendedHasRrule = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 11, + InstanceLocaltimeBookExtendedLatitude = (ViewInstanceLocaltimeBookExtended|DataTypeDouble) + 12, + InstanceLocaltimeBookExtendedLongitude = (ViewInstanceLocaltimeBookExtended|DataTypeDouble) + 13, + InstanceLocaltimeBookExtendedHasAlarm = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 14, + InstanceLocaltimeBookExtendedOriginalEventId = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 15, + InstanceLocaltimeBookExtendedLastModifiedTime = (ViewInstanceLocaltimeBookExtended|DataTypeLong) + 16, + InstanceLocaltimeBookExtendedSyncData1 = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 17, + InstanceLocaltimeBookExtendedOrganizerName = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 18, + InstanceLocaltimeBookExtendedCategories = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 19, + InstanceLocaltimeBookExtendedHasAttendee = (ViewInstanceLocaltimeBookExtended|DataTypeInteger) + 20, + InstanceLocaltimeBookExtendedSyncData2 = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 21, + InstanceLocaltimeBookExtendedSyncData3 = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 22, + InstanceLocaltimeBookExtendedSyncData4 = (ViewInstanceLocaltimeBookExtended|DataTypeString) + 23, + InstanceLocaltimeBookExtendedIsAllday = (ViewInstanceLocaltimeBookExtended|DataTypeInteger|PropertyReadOnly) + 24, + + UpdateInfoId = (ViewUpdateInfo|DataTypeInteger), + UpdateInfoCalendarId = (ViewUpdateInfo|DataTypeInteger) + 1, + UpdateInfoType = (ViewUpdateInfo|DataTypeInteger) + 2, + UpdateInfoVersion = (ViewUpdateInfo|DataTypeInteger) + 3, + + ExtendedId = (ViewExtended|DataTypeInteger|PropertyReadOnly), + ExtendedRecordId = (ViewExtended|DataTypeInteger) + 1, + ExtendedRecordType = (ViewExtended|DataTypeInteger) + 2, + ExtendedKey = (ViewExtended|DataTypeString) + 3, + ExtendedValue = (ViewExtended|DataTypeString) + 4, + } + + ///average size + internal const uint AverageSizeOfRecord = 56; + + public static class Book + { + /// + /// Identifier of this calendar book view + /// + public const string Uri = "tizen.calendar_view.book"; + /// + /// DB record ID of the calendar book + /// + public const uint Id = (uint)PropertyIds.BookId; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.BookUid; + /// + /// Calendar book name + /// + public const uint Name = (uint)PropertyIds.BookName; + /// + /// Calendar book description + /// + public const uint Description = (uint)PropertyIds.BookDescription; + /// + /// Calendar book color for UX + /// + public const uint Color = (uint)PropertyIds.BookColor; + /// + /// Location of the event + /// + public const uint Location = (uint)PropertyIds.BookLocation; + /// + /// Visibility of the calendar book for UX + /// + public const uint Visibility = (uint)PropertyIds.BookVisibility; + /// + /// Currently NOT Used + /// + public const uint SyncEvent = (uint)PropertyIds.BookSyncEvent; + /// + /// Account for this calendar + /// + public const uint AccountId = (uint)PropertyIds.BookAccountId; + /// + /// Type of calendar contents(refer to the CalendarTypes.StoreType) + /// + public const uint StoreType = (uint)PropertyIds.BookStoreType; + /// + /// Generic data for use by syncing + /// + public const uint SyncData1 = (uint)PropertyIds.BookSyncData1; + /// + /// Generic data for use by syncing + /// + public const uint SyncData2 = (uint)PropertyIds.BookSyncData2; + /// + /// Generic data for use by syncing + /// + public const uint SyncData3 = (uint)PropertyIds.BookSyncData3; + /// + /// Generic data for use by syncing + /// + public const uint SyncData4 = (uint)PropertyIds.BookSyncData4; + /// + /// Calendar book mode(refer to the CalendarTypes.BookMode) + /// + public const uint Mode = (uint)PropertyIds.BookMode; + } + + public static class Event + { + /// + /// Identifier of this event view + /// + public const string Uri = "tizen.calendar_view.event"; + /// + /// DB record ID of the event + /// + public const uint Id = (uint)PropertyIds.EventId; + /// + /// ID of the calendar book to which the event belongs + /// + public const uint BookId = (uint)PropertyIds.EventBookId; + /// + /// The short description of the event + /// + public const uint Summary = (uint)PropertyIds.EventSummary; + /// + /// The description of the event + /// + public const uint Description = (uint)PropertyIds.EventDescription; + /// + /// The location of the event + /// + public const uint Location = (uint)PropertyIds.EventLocation; + /// + /// The category of the event. For example APPOINTMENT, BIRTHDAY + /// + public const uint Categories = (uint)PropertyIds.EventCategories; + /// + /// The exception list of the event. If this event has a recurrence rule, the instance of the exdate is removed. Format is "YYYYMMDD"(allday event) or "YYYYMMDDTHHMMSS". Multiple exceptions can be included with a comma + /// + public const uint Exdate = (uint)PropertyIds.EventExdate; + /// + /// The status of event(refer to the CalendarTypes.EventStatus). + /// + public const uint EventStatus = (uint)PropertyIds.EventEventStatus; + /// + /// The priority of event(refer to the CalendarTypes.Priority). + /// + public const uint Priority = (uint)PropertyIds.EventPriority; + /// + /// The timezone_id of the event if it exists. + /// + public const uint Timezone = (uint)PropertyIds.EventTimezone; + /// + /// The person_id of the event if the event is a birthday. Refer to the contacts-service + /// + public const uint ContactId = (uint)PropertyIds.EventContactId; + /// + /// The busy status of event(refer to the CalendarTypes.BusyStatus). + /// + public const uint BusyStatus = (uint)PropertyIds.EventBusyStatus; + /// + /// The Sensitivity of event(refer to the CalendarTypes.Sensitivity). + /// + public const uint Sensitivity = (uint)PropertyIds.EventSensitivity; + /// + /// The unique ID of the event + /// + public const uint Uid = (uint)PropertyIds.EventUid; + /// + /// The name of organizer of the event + /// + public const uint OrganizerName = (uint)PropertyIds.EventOrganizerName; + /// + /// The email address of the organizer of the event + /// + public const uint OrganizerEmail = (uint)PropertyIds.EventOrganizerEmail; + /// + /// The meeting status of event(refer to the CalendarTypes.MeetingStatus). + /// + public const uint MeetingStatus = (uint)PropertyIds.EventMeetingStatus; + /// + /// The ID of the original event if the event is an exception. + /// + public const uint OriginalEventId = (uint)PropertyIds.EventOriginalEventId; + /// + /// The latitude of the location of the event + /// + public const uint Latitude = (uint)PropertyIds.EventLatitude; + /// + /// The longitude of the location of the event + /// + public const uint Longitude = (uint)PropertyIds.EventLongitude; + /// + /// ID of the email_id. Refer to the email-service. + /// + public const uint EmailId = (uint)PropertyIds.EventEmailId; + /// + /// The time when the event is created + /// + public const uint CreatedTime = (uint)PropertyIds.EventCreatedTime; + /// + /// The time when the event is updated + /// + public const uint LastModifiedTime = (uint)PropertyIds.EventLastModifiedTime; + /// + /// Whether or not the event is deleted + /// + public const uint IsDeleted = (uint)PropertyIds.EventIsDeleted; + /// + /// The frequent type of event recurrence(refer to the CalendarTypes.Recurrence). + /// + public const uint Freq = (uint)PropertyIds.EventFreq; + /// + /// The range type of event recurrence(refer to the CalendarTypes.RangeType). + /// + public const uint RangeType = (uint)PropertyIds.EventRangeType; + /// + /// The end time of the event recurrence. Only if this is used with RangeType.Until. + /// + public const uint Until = (uint)PropertyIds.EventUntil; + /// + /// The count of the event recurrence. Only if this is used with RangeType.Count. + /// + public const uint Count = (uint)PropertyIds.EventCount; + /// + /// The interval of the event recurrence + /// + public const uint Interval = (uint)PropertyIds.EventInterval; + /// + /// The second list of the event recurrence. The value can be from 0 to 59. The list is separated by comma + /// + public const uint Bysecond = (uint)PropertyIds.EventBysecond; + /// + /// The minute list of the event recurrence. The value can be from 0 to 59. The list is separated by commas + /// + public const uint Byminute = (uint)PropertyIds.EventByminute; + /// + /// The hour list of the event recurrence. The value can be from 0 to 23. The list is separated by commas + /// + public const uint Byhour = (uint)PropertyIds.EventByhour; + /// + /// The day list of the event recurrence. The value can be SU, MO, TU, WE, TH, FR, SA. The list is separated by commas. + /// + public const uint Byday = (uint)PropertyIds.EventByday; + /// + /// The month day list of the event recurrence. The value can be from 1 to 31 and from -31 to -1. The list is separated by commas. + /// + public const uint Bymonthday = (uint)PropertyIds.EventBymonthday; + /// + /// The year day list of the event recurrence. The value can be from 1 to 366 and from -366 to -1. The list is separated by commas + /// + public const uint Byyearday = (uint)PropertyIds.EventByyearday; + /// + /// The week number list of the event recurrence. The value can be from 1 to 53 and from -53 to -1. The list is separated by commas + /// + public const uint Byweekno = (uint)PropertyIds.EventByweekno; + /// + /// The month list of the event recurrence. The value can be from 1 to 12. The list is separated by commas + /// + public const uint Bymonth = (uint)PropertyIds.EventBymonth; + /// + /// The position list of the event recurrence. The value can be from 1 to 366 and from -366 to -1. The list is separated by commas + /// + public const uint Bysetpos = (uint)PropertyIds.EventBysetpos; + /// + /// The start day of the week(refer to the CalendarTypes.WeekDay). + /// + public const uint Wkst = (uint)PropertyIds.EventWkst; + /// + /// RECURRENCE-ID of RFC #2445 + /// + public const uint RecurrenceId = (uint)PropertyIds.EventRecurrenceId; + /// + /// RDATE of RFC #2445 + /// + public const uint Rdate = (uint)PropertyIds.EventRdate; + /// + /// Whether or not the event has an attendee list + /// + public const uint HasAttendee = (uint)PropertyIds.EventHasAttendee; + /// + /// Whether or not the event has an alarm list + /// + public const uint HasAlarm = (uint)PropertyIds.EventHasAlarm; + /// + /// The sync data of the event. If developer need to save some information related to the event, they can use this property + /// + public const uint SyncData1 = (uint)PropertyIds.EventSyncData1; + /// + /// The sync data of the event. If developer need to save some information related to the event, they can use this property + /// + public const uint SyncData2 = (uint)PropertyIds.EventSyncData2; + /// + /// The sync data of the event. If developer need to save some information related to the event, they can use this property + /// + public const uint SyncData3 = (uint)PropertyIds.EventSyncData3; + /// + /// The sync data of the event. If developer need to save some information related to the event, they can use this property + /// + public const uint SyncData4 = (uint)PropertyIds.EventSyncData4; + /// + /// The start time of the event + /// + public const uint Start = (uint)PropertyIds.EventStart; + /// + /// The end time of the event + /// + public const uint End = (uint)PropertyIds.EventEnd; + /// + /// The alarm list of the event. + /// + public const uint Alarm = (uint)PropertyIds.EventAlarm; + /// + /// The attendee list of the event. + /// + public const uint Attendee = (uint)PropertyIds.EventAttendee; + /// + /// The Calendar system type(refer to the CalendarTypes.SystemType). + /// + public const uint CalendarSystemType = (uint)PropertyIds.EventCalendarSystemType; + /// + /// The timezone of the start_time + /// + public const uint StartTzid = (uint)PropertyIds.EventStartTzid; + /// + /// The timezone of the end_time + /// + public const uint EndTzid = (uint)PropertyIds.EventEndTzid; + /// + /// The exception mod event list of the event + /// + public const uint Exception = (uint)PropertyIds.EventException; + /// + /// The extended property list of the event. + /// + public const uint Extended = (uint)PropertyIds.EventExtended; + /// + /// The event is an allday event or not + /// + public const uint IsAllday = (uint)PropertyIds.EventIsAllday; + /// + /// The linked event count + /// + public const uint LinkCount = (uint)PropertyIds.EventLinkCount; + /// + /// The event is an base linked event + /// + public const uint LinkBaseId = (uint)PropertyIds.EventLinkBaseId; + } + + public static class Todo + { + /// + /// Identifier of this todo view + /// + public const string Uri = "tizen.calendar_view.todo"; + /// + /// DB record ID of the todo + /// + public const uint Id = (uint)PropertyIds.TodoId; + /// + /// ID of the calendar book to which the todo belongs + /// + public const uint BookId = (uint)PropertyIds.TodoBookId; + /// + /// The short description of the todo + /// + public const uint Summary = (uint)PropertyIds.TodoSummary; + /// + /// The description of the todo + /// + public const uint Description = (uint)PropertyIds.TodoDescription; + /// + /// The location of the todo + /// + public const uint Location = (uint)PropertyIds.TodoLocation; + /// + /// The category of the todo. i.g. APPOINTMENT, BIRTHDAY + /// + public const uint Categories = (uint)PropertyIds.TodoCategories; + /// + /// The status of todo(refer to the CalendarTypes.TodoStatus). + /// + public const uint TodoStatus = (uint)PropertyIds.TodoStatus; + /// + /// The Priority of todo(refer to the CalendarTypes.Priority). + /// + public const uint Priority = (uint)PropertyIds.TodoPriority; + /// + /// The Sensitivity of todo(refer to the CalendarTypes.Sensitivity). + /// + public const uint Sensitivity = (uint)PropertyIds.TodoSensitivity; + /// + /// The unique ID of the todo + /// + public const uint Uid = (uint)PropertyIds.TodoUid; + /// + /// The latitude of the location of the todo + /// + public const uint Latitude = (uint)PropertyIds.TodoLatitude; + /// + /// The longitude of the location of the todo + /// + public const uint Longitude = (uint)PropertyIds.TodoLongitude; + /// + /// The progression of the todo. The value can be from 0 to 100 + /// + public const uint Progress = (uint)PropertyIds.TodoProgress; + /// + /// The time when the todo is create + /// + public const uint CreatedTime = (uint)PropertyIds.TodoCreatedTime; + /// + /// The time when the todo is updated + /// + public const uint LastModifiedTime = (uint)PropertyIds.TodoLastModifiedTime; + /// + /// The time when the todo is completed + /// + public const uint CompletedTime = (uint)PropertyIds.TodoCompletedTime; + /// + /// Whether or not the todo is deleted + /// + public const uint IsDeleted = (uint)PropertyIds.TodoIsDeleted; + /// + /// The frequent type of todo recurrence(refer to the CalendarTypes.Recurrence). + /// + public const uint Freq = (uint)PropertyIds.TodoFreq; + /// + /// The range type of todo recurrence(refer to the CalendarTypes.RangeType). + /// + public const uint RangeType = (uint)PropertyIds.TodoRangeType; + /// + /// The end time of the todo recurrence. Only if this is used with RangeType.Until. + /// + public const uint Until = (uint)PropertyIds.TodoUntil; + /// + /// The count of the todo recurrence. Only if this is used with RangeType.Count. + /// + public const uint Count = (uint)PropertyIds.TodoCount; + /// + /// The interval of the todo recurrence + /// + public const uint Integererval = (uint)PropertyIds.TodoIntegererval; + /// + /// The second list of the todo recurrence. The value can be from 0 to 59. The list is separated by commas + /// + public const uint Bysecond = (uint)PropertyIds.TodoBysecond; + /// + /// The minute list of the todo recurrence. The value can be from 0 to 59. The list is separated by commas + /// + public const uint Byminute = (uint)PropertyIds.TodoByminute; + /// + /// The hour list of the todo recurrence. The value can be from 0 to 23. The list is separated by commas + /// + public const uint Byhour = (uint)PropertyIds.TodoByhour; + /// + /// The day list of the todo recurrence. The value can be SU, MO, TU, WE, TH, FR, SA. The list is separated by commas + /// + public const uint Byday = (uint)PropertyIds.TodoByday; + /// + /// The month day list of the todo recurrence. The value can be from 1 to 31 and from -31 to -1. The list is separated by commas + /// + public const uint Bymonthday = (uint)PropertyIds.TodoBymonthday; + /// + /// The year day list of the todo recurrence. The value can be from 1 to 366 and from -366 to -1. The list is separated by commas + /// + public const uint Byyearday = (uint)PropertyIds.TodoByyearday; + /// + /// The week number list of the todo recurrence. The value can be from 1 to 53 and from -53 to -1. The list is separated by commas + /// + public const uint Byweekno = (uint)PropertyIds.TodoByweekno; + /// + /// The month list of the todo recurrence. The value can be from 1 to 12. The list is separated by commas + /// + public const uint Bymonth = (uint)PropertyIds.TodoBymonth; + /// + /// The position list of the todo recurrence. The value can be from 1 to 366 and from -366 to -1. The list is separated by commas + /// + public const uint Bysetpos = (uint)PropertyIds.TodoBysetpos; + /// + /// The start day of the week(refer to the CalendarTypes.WeekDay). + /// + public const uint Wkst = (uint)PropertyIds.TodoWkst; + /// + /// Whether or not the todo has an alarm list + /// + public const uint HasAlarm = (uint)PropertyIds.TodoHasAlarm; + /// + /// The sync data of the todo. If developers need to save some information related to the todo, they can use this property + /// + public const uint SyncData1 = (uint)PropertyIds.TodoSyncData1; + /// + /// The sync data of the todo. If developers need to save some information related to the todo, they can use this property + /// + public const uint SyncData2 = (uint)PropertyIds.TodoSyncData2; + /// + /// The sync data of the todo. If developers need to save some information related to the todo, they can use this property + /// + public const uint SyncData3 = (uint)PropertyIds.TodoSyncData3; + /// + /// The sync data of the todo. If developers need to save some information related to the todo, they can use this property + /// + public const uint SyncData4 = (uint)PropertyIds.TodoSyncData4; + /// + /// The start time of the todo + /// + public const uint Start = (uint)PropertyIds.TodoStart; + /// + /// The due time of the todo + /// + public const uint Due = (uint)PropertyIds.TodoDue; + /// + /// The alarm list of the todo. + /// + public const uint Alarm = (uint)PropertyIds.TodoAlarm; + /// + /// The timezone of the start_time + /// + public const uint StartTzid = (uint)PropertyIds.TodoStartTzid; + /// + /// The timezone of the due_time + /// + public const uint DueTzid = (uint)PropertyIds.TodoDueTzid; + /// + /// The name of the organizer of the event + /// + public const uint OrganizerName = (uint)PropertyIds.TodoOrganizerName; + /// + /// The email address of the organizer of the todo + /// + public const uint OrganizerEmail = (uint)PropertyIds.TodoOrganizerEmail; + /// + /// Whether or not the todo has an attendee list + /// + public const uint HasAttendee = (uint)PropertyIds.TodoHasAttendee; + /// + /// The attendee list of the todo. + /// + public const uint Attendee = (uint)PropertyIds.TodoAttendee; + /// + /// The extended property list of the todo. + /// + public const uint Extended = (uint)PropertyIds.TodoExtended; + /// + /// The todo is an allday event or not + /// + public const uint IsAllday = (uint)PropertyIds.TodoIsAllday; + } + + public static class Timezone + { + /// + /// Identifier of this timezone view + /// + public const string Uri = "tizen.calendar_view.timezone"; + /// + /// DB record ID of the timezone + /// + public const uint Id = (uint)PropertyIds.TimezoneId; + /// + /// UTC offset which is in use when the onset of this time zone observance begins. Valid values are -720(-12:00) to 840(+14:00) + /// + public const uint TzOffsetFromGmt = (uint)PropertyIds.TimezoneTzOffsetFromGmt; + /// + /// Name of the Standard Time + /// + public const uint StandardName = (uint)PropertyIds.TimezoneStandardName; + /// + /// Starting month of the Standard Time. Month is 0-based. eg, 0 for January + /// + public const uint StdStartMonth = (uint)PropertyIds.TimezoneStdStartMonth; + /// + /// Starting day-of-week-in-month of the Standard Time. Day is 1-based + /// + public const uint StdStartPositionOfWeek = (uint)PropertyIds.TimezoneStdStartPositionOfWeek; + /// + /// Starting day-of-week of the Standard Time. Valid values are 1(SUNDAY) to 7(SATURDAY) + /// + public const uint StdStartDay = (uint)PropertyIds.TimezoneStdStartDay; + /// + /// Starting hour of the Standard Time. Valid values are 0 to 23 + /// + public const uint StdStartHour = (uint)PropertyIds.TimezoneStdStartHour; + /// + /// The number of minutes added during the Standard Time + /// + public const uint StandardBias = (uint)PropertyIds.TimezoneStandardBias; + /// + /// Name of Daylight + /// + public const uint DayLightName = (uint)PropertyIds.TimezoneDayLightName; + /// + /// Starting month of Daylight. Month is 0-based. eg, 0 for January + /// + public const uint DayLightStartMonth = (uint)PropertyIds.TimezoneDayLightStartMonth; + /// + /// Starting day-of-week-in-month of Daylight. Day is 1-based + /// + public const uint DayLightStartPositionOfWeek = (uint)PropertyIds.TimezoneDayLightStartPositionOfWeek; + /// + /// Starting day-of-week of Daylight. Valid values are 1(SUNDAY) to 7(SATURDAY) + /// + public const uint DayLightStartDay = (uint)PropertyIds.TimezoneDayLightStartDay; + /// + /// Starting hour of Daylight. Valid values are 0 to 23 + /// + public const uint DayLightStartHour = (uint)PropertyIds.TimezoneDayLightStartHour; + /// + /// The number of minutes added during Daylight Time + /// + public const uint DayLightBias = (uint)PropertyIds.TimezoneDayLightBias; + /// + /// DB record ID of a related calendar book + /// + public const uint CalendarId = (uint)PropertyIds.TimezoneCalendarId; + } + + public static class Attendee + { + /// + /// Identifier of this calendar attendee view + /// + public const string Uri = "tizen.calendar_view.attendee"; + /// + /// The number of the attendee + /// + public const uint Number = (uint)PropertyIds.AttendeeNumber; + /// + /// The type of attendee(refer to the CalendarTypes.Cutype). + /// + public const uint Cutype = (uint)PropertyIds.AttendeeCutype; + /// + /// + /// + public const uint CtIndex = (uint)PropertyIds.AttendeeCtIndex; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.AttendeeUid; + /// + /// + /// + public const uint Group = (uint)PropertyIds.AttendeeGroup; + /// + /// The email address of the attendee + /// + public const uint Email = (uint)PropertyIds.AttendeeEmail; + /// + /// Attendee role(refer to the CalendarTypes.AttendeeRole). + /// + public const uint Role = (uint)PropertyIds.AttendeeRole; + /// + /// Attendee status(refer to the CalendarTypes.AttendeeStatus). + /// + public const uint Status = (uint)PropertyIds.AttendeeStatus; + /// + /// RSVP invitation reply (one of true, false) + /// + public const uint Rsvp = (uint)PropertyIds.AttendeeRsvp; + /// + /// Delegatee (DELEGATED-TO) + /// + public const uint DelegateeUri = (uint)PropertyIds.AttendeeDelegateeUri; + /// + /// Delegator (DELEGATED-FROM) + /// + public const uint DelegatorUri = (uint)PropertyIds.AttendeeDelegatorUri; + /// + /// Attendee name + /// + public const uint Name = (uint)PropertyIds.AttendeeName; + /// + /// Group that the attendee belongs to + /// + public const uint Member = (uint)PropertyIds.AttendeeMember; + /// + /// Event/TODO that the attendee belongs to + /// + public const uint ParentId = (uint)PropertyIds.AttendeeParentId; + } + + public static class Alarm + { + /// + /// Identifier of this calendar alarm view + /// + public const string Uri = "tizen.calendar_view.alarm"; + /// + /// The number of unit before start time. This MUST be used with one of TickUnit. + /// + public const uint Tick = (uint)PropertyIds.AlarmTick; + /// + /// Reminder tick time unit(refer to the CalendarTypes.TickUnit). + /// + public const uint TickUnit = (uint)PropertyIds.AlarmTickUnit; + /// + /// Alarm description + /// + public const uint Description = (uint)PropertyIds.AlarmDescription; + /// + /// Event that the alarm belongs to + /// + public const uint ParentId = (uint)PropertyIds.AlarmParentId; + /// + /// Alarm summary + /// + public const uint Summary = (uint)PropertyIds.AlarmSummary; + /// + /// Action of alarm(refer to the CalendarTypes.Action). + /// + public const uint Action = (uint)PropertyIds.AlarmAction; + /// + /// Alarm tone path + /// + public const uint Attach = (uint)PropertyIds.AlarmAttach; + /// + /// The alarm time + /// + public const uint AlarmTime = (uint)PropertyIds.AlarmAlarm; + } + + public static class InstanceUtimeBook + { + /// + /// Identifier of this instance utime book + /// + public const string Uri = "tizen.calendar_view.instance_utime/book"; + /// + /// Event id + /// + public const uint EventId = (uint)PropertyIds.InstanceUtimeBookEventId; + /// + /// Start time + /// + public const uint Start = (uint)PropertyIds.InstanceUtimeBookStart; + /// + /// End time + /// + public const uint End = (uint)PropertyIds.InstanceUtimeBookEnd; + /// + /// Summary + /// + public const uint Summary = (uint)PropertyIds.InstanceUtimeBookSummary; + /// + /// Location + /// + public const uint Location = (uint)PropertyIds.InstanceUtimeBookLocation; + /// + /// Book id + /// + public const uint BookId = (uint)PropertyIds.InstanceUtimeBookBookId; + /// + /// Description + /// + public const uint Description = (uint)PropertyIds.InstanceUtimeBookDescription; + /// + /// BusyStatus + /// + public const uint BusyStatus = (uint)PropertyIds.InstanceUtimeBookBusyStatus; + /// + /// EventStatus + /// + public const uint EventStatus = (uint)PropertyIds.InstanceUtimeBookEventStatus; + /// + /// Priority + /// + public const uint Priority = (uint)PropertyIds.InstanceUtimeBookPriority; + /// + /// Sensitivity + /// + public const uint Sensitivity = (uint)PropertyIds.InstanceUtimeBookSensitivity; + /// + /// HasRrule + /// + public const uint HasRrule = (uint)PropertyIds.InstanceUtimeBookHasRrule; + /// + /// Latitude + /// + public const uint Latitude = (uint)PropertyIds.InstanceUtimeBookLatitude; + /// + /// Longitude + /// + public const uint Longitude = (uint)PropertyIds.InstanceUtimeBookLongitude; + /// + /// HasAlarm + /// + public const uint HasAlarm = (uint)PropertyIds.InstanceUtimeBookHasAlarm; + /// + /// OriginalEventId + /// + public const uint OriginalEventId = (uint)PropertyIds.InstanceUtimeBookOriginalEventId; + /// + /// LastModifiedtime + /// + public const uint LastModifiedtime = (uint)PropertyIds.InstanceUtimeBookLastModifiedtime; + /// + /// SyncData1 + /// + public const uint SyncData1 = (uint)PropertyIds.InstanceUtimeBookSyncData1; + } + + public static class InstanceLocaltimeBook + { + /// + /// Uri + /// + public const string Uri = "tizen.calendar_view.instance_localtime/book"; + /// + /// EventId + /// + public const uint EventId = (uint)PropertyIds.InstanceLocaltimeBookEventId; + /// + /// Start + /// + public const uint Start = (uint)PropertyIds.InstanceLocaltimeBookStart; + /// + /// End + /// + public const uint End = (uint)PropertyIds.InstanceLocaltimeBookEnd; + /// + /// Summary + /// + public const uint Summary = (uint)PropertyIds.InstanceLocaltimeBookSummary; + /// + /// Location + /// + public const uint Location = (uint)PropertyIds.InstanceLocaltimeBookLocation; + /// + /// BookId + /// + public const uint BookId = (uint)PropertyIds.InstanceLocaltimeBookBookId; + /// + /// Description + /// + public const uint Description = (uint)PropertyIds.InstanceLocaltimeBookDescription; + /// + /// BusyStatus + /// + public const uint BusyStatus = (uint)PropertyIds.InstanceLocaltimeBookBusyStatus; + /// + /// EventStatus + /// + public const uint EventStatus = (uint)PropertyIds.InstanceLocaltimeBookEventStatus; + /// + /// Priority + /// + public const uint Priority = (uint)PropertyIds.InstanceLocaltimeBookPriority; + /// + /// Sensitivity + /// + public const uint Sensitivity = (uint)PropertyIds.InstanceLocaltimeBookSensitivity; + /// + /// HasRrule + /// + public const uint HasRrule = (uint)PropertyIds.InstanceLocaltimeBookHasRrule; + /// + /// Latitude + /// + public const uint Latitude = (uint)PropertyIds.InstanceLocaltimeBookLatitude; + /// + /// Longitude + /// + public const uint Longitude = (uint)PropertyIds.InstanceLocaltimeBookLongitude; + /// + /// HasAlarm + /// + public const uint HasAlarm = (uint)PropertyIds.InstanceLocaltimeBookHasAlarm; + /// + /// OriginalEventId + /// + public const uint OriginalEventId = (uint)PropertyIds.InstanceLocaltimeBookOriginalEventId; + /// + /// LastModifiedTime + /// + public const uint LastModifiedTime = (uint)PropertyIds.InstanceLocaltimeBookLastModifiedTime; + /// + /// SyncData1 + /// + public const uint SyncData1 = (uint)PropertyIds.InstanceLocaltimeBookSyncData1; + /// + /// IsAllday + /// + public const uint IsAllday = (uint)PropertyIds.InstanceLocaltimeBookIsAllday; + } + + public static class InstanceUtimeBookExtended + { + /// + /// Uri + /// + public const string Uri = "tizen.calendar_view.extended/instance_utime/book"; + /// + /// EventId + /// + public const uint EventId = (uint)PropertyIds.InstanceUtimeBookExtendedEventId; + /// + /// Start + /// + public const uint Start = (uint)PropertyIds.InstanceUtimeBookExtendedStart; + /// + /// End + /// + public const uint End = (uint)PropertyIds.InstanceUtimeBookExtendedEnd; + /// + /// Summary + /// + public const uint Summary = (uint)PropertyIds.InstanceUtimeBookExtendedSummary; + /// + /// Location + /// + public const uint Location = (uint)PropertyIds.InstanceUtimeBookExtendedLocation; + /// + /// BookId + /// + public const uint BookId = (uint)PropertyIds.InstanceUtimeBookExtendedBookId; + /// + /// Description + /// + public const uint Description = (uint)PropertyIds.InstanceUtimeBookExtendedDescription; + /// + /// BusyStatus + /// + public const uint BusyStatus = (uint)PropertyIds.InstanceUtimeBookExtendedBusyStatus; + /// + /// EventStatus + /// + public const uint EventStatus = (uint)PropertyIds.InstanceUtimeBookExtendedEventStatus; + /// + /// Priority + /// + public const uint Priority = (uint)PropertyIds.InstanceUtimeBookExtendedPriority; + /// + /// Sensitivity + /// + public const uint Sensitivity = (uint)PropertyIds.InstanceUtimeBookExtendedSensitivity; + /// + /// HasRrule + /// + public const uint HasRrule = (uint)PropertyIds.InstanceUtimeBookExtendedHasRrule; + /// + /// Latitude + /// + public const uint Latitude = (uint)PropertyIds.InstanceUtimeBookExtendedLatitude; + /// + /// Longitude + /// + public const uint Longitude = (uint)PropertyIds.InstanceUtimeBookExtendedLongitude; + /// + /// HasAlarm + /// + public const uint HasAlarm = (uint)PropertyIds.InstanceUtimeBookExtendedHasAlarm; + /// + /// OriginalEventId + /// + public const uint OriginalEventId = (uint)PropertyIds.InstanceUtimeBookExtendedOriginalEventId; + /// + /// LastModifiedTime + /// + public const uint LastModifiedTime = (uint)PropertyIds.InstanceUtimeBookExtendedLastModifiedTime; + /// + /// SyncData1 + /// + public const uint SyncData1 = (uint)PropertyIds.InstanceUtimeBookExtendedSyncData1; + /// + /// OrganizerName + /// + public const uint OrganizerName = (uint)PropertyIds.InstanceUtimeBookExtendedOrganizerName; + /// + /// Categories + /// + public const uint Categories = (uint)PropertyIds.InstanceUtimeBookExtendedCategories; + /// + /// HasAttendee + /// + public const uint HasAttendee = (uint)PropertyIds.InstanceUtimeBookExtendedHasAttendee; + /// + /// SyncData2 + /// + public const uint SyncData2 = (uint)PropertyIds.InstanceUtimeBookExtendedSyncData2; + /// + /// SyncData3 + /// + public const uint SyncData3 = (uint)PropertyIds.InstanceUtimeBookExtendedSyncData3; + /// + /// SyncData4 + /// + public const uint SyncData4 = (uint)PropertyIds.InstanceUtimeBookExtendedSyncData4; + } + + public static class InstanceLocaltimeBookExtended + { + /// + /// Uri + /// + public const string Uri = "tizen.calendar_view.extended/instance_localtime/book"; + /// + /// EventId + /// + public const uint EventId = (uint)PropertyIds.InstanceLocaltimeBookExtendedEventId; + /// + /// Start + /// + public const uint Start = (uint)PropertyIds.InstanceLocaltimeBookExtendedStart; + /// + /// End + /// + public const uint End = (uint)PropertyIds.InstanceLocaltimeBookExtendedEnd; + /// + /// Summary + /// + public const uint Summary = (uint)PropertyIds.InstanceLocaltimeBookExtendedSummary; + /// + /// Location + /// + public const uint Location = (uint)PropertyIds.InstanceLocaltimeBookExtendedLocation; + /// + /// BookId + /// + public const uint BookId = (uint)PropertyIds.InstanceLocaltimeBookExtendedBookId; + /// + /// + public const uint Description = (uint)PropertyIds.InstanceLocaltimeBookExtendedDescription; + /// + /// + public const uint BusyStatus = (uint)PropertyIds.InstanceLocaltimeBookExtendedBusyStatus; + /// + /// EventStatus + /// + public const uint EventStatus = (uint)PropertyIds.InstanceLocaltimeBookExtendedEventStatus; + /// + /// Priority + /// + public const uint Priority = (uint)PropertyIds.InstanceLocaltimeBookExtendedPriority; + /// + /// Sensitivity + /// + public const uint Sensitivity = (uint)PropertyIds.InstanceLocaltimeBookExtendedSensitivity; + /// + /// HasRrule + /// + public const uint HasRrule = (uint)PropertyIds.InstanceLocaltimeBookExtendedHasRrule; + /// + /// Latitude + /// + public const uint Latitude = (uint)PropertyIds.InstanceLocaltimeBookExtendedLatitude; + /// + /// Longitude + /// + public const uint Longitude = (uint)PropertyIds.InstanceLocaltimeBookExtendedLongitude; + /// + /// HasAlarm + /// + public const uint HasAlarm = (uint)PropertyIds.InstanceLocaltimeBookExtendedHasAlarm; + /// + /// OriginalEventId + /// + public const uint OriginalEventId = (uint)PropertyIds.InstanceLocaltimeBookExtendedOriginalEventId; + /// + /// LastModifiedTime + /// + public const uint LastModifiedTime = (uint)PropertyIds.InstanceLocaltimeBookExtendedLastModifiedTime; + /// + /// SyncData1 + /// + public const uint SyncData1 = (uint)PropertyIds.InstanceLocaltimeBookExtendedSyncData1; + /// + /// OrganizerName + /// + public const uint OrganizerName = (uint)PropertyIds.InstanceLocaltimeBookExtendedOrganizerName; + /// + /// Categories + /// + public const uint Categories = (uint)PropertyIds.InstanceLocaltimeBookExtendedCategories; + /// + /// HasAttendee + /// + public const uint HasAttendee = (uint)PropertyIds.InstanceLocaltimeBookExtendedHasAttendee; + /// + /// SyncData2 + /// + public const uint SyncData2 = (uint)PropertyIds.InstanceLocaltimeBookExtendedSyncData2; + /// + /// SyncData3 + /// + public const uint SyncData3 = (uint)PropertyIds.InstanceLocaltimeBookExtendedSyncData3; + /// + /// SyncData4 + /// + public const uint SyncData4 = (uint)PropertyIds.InstanceLocaltimeBookExtendedSyncData4; + /// + /// IsAllday + /// + public const uint IsAllday = (uint)PropertyIds.InstanceLocaltimeBookExtendedIsAllday; + } + + public static class UpdatedInfo + { + /// + /// Identifier of this updatedInfo view + /// + public const string Uri = "tizen.calendar_view.updated_info"; + /// + /// Modified event(or todo) record ID + /// + public const uint Id = (uint)PropertyIds.UpdateInfoId; + /// + /// Calendar book ID of the modified event(or todo) record + /// + public const uint CalendarId = (uint)PropertyIds.UpdateInfoCalendarId; + /// + /// Enumeration value of the modified status. + /// + public const uint Type = (uint)PropertyIds.UpdateInfoType; + /// + /// Version after change + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + } + + public static class Extended + { + /// + /// Identifier of this extended_property view + /// + public const string Uri = "tizen.calendar_view.extended_property"; + /// + /// DB record ID of the extended_property + /// + public const uint Id = (uint)PropertyIds.ExtendedId; + /// + /// Related record ID + /// + public const uint RecordId = (uint)PropertyIds.ExtendedRecordId; + /// + /// Enumeration value of the record type. + /// + public const uint RecordType = (uint)PropertyIds.ExtendedRecordType; + /// + /// The key of the property + /// + public const uint Key = (uint)PropertyIds.ExtendedKey; + /// + /// The value of the property + /// + public const uint Value = (uint)PropertyIds.ExtendedValue; + } + } +} + diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/NamespaceDoc.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/NamespaceDoc.cs new file mode 100644 index 0000000..2d090bd --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/NamespaceDoc.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// The Tizen.Pims.Calendar namespace provides classes for managing calendar information for schedule. +/// +/// +/// The Tizen.Pims.Calendar namespace provides classes for managing calendar information for schedule. +/// +namespace Tizen.Pims.Calendar {} + diff --git a/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs new file mode 100644 index 0000000..678a093 --- /dev/null +++ b/src/Tizen.Pims.Calendar/Tizen.Pims.Calendar/ReminderEventArgs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Pims.Calendar +{ + /// + /// Event arguments passed when alarm is alerted. + /// + public class ReminderAlertedEventArgs : EventArgs + { + internal ReminderAlertedEventArgs(string param) + { + Param = param; + Log.Debug(Globals.LogTag, "[TEST]" + param); + } + + /// + /// The paramter which data is combinded(Value string like id=value&time=value&tick=value&unit=value&type=value) + /// + public string Param + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Activity.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Activity.cs new file mode 100755 index 0000000..ccff505 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Activity.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + internal static class Activity + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_activity_delete_by_contact_id")] + internal static extern int DeleteByContactId(int contactId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_activity_delete_by_account_id")] + internal static extern int DeleteByAccountId(int accountId); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Contacts.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Contacts.cs new file mode 100755 index 0000000..7efa40f --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Contacts.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Contacts Interop Class + /// + internal static class Contacts + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_connect")] + internal static extern int Connect(); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_disconnect")] + internal static extern int Disconnect(); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_connect_on_thread")] + internal static extern int OnThreadConnect(); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_disconnect_on_thread")] + internal static extern int OnThreadDisconnect(); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_connect_with_flags")] + internal static extern int DisconnectWithFlags(uint flags); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Database.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Database.cs new file mode 100644 index 0000000..787baaa --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Database.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum ContactsChanged + { + Inserted, + Updated, + Deleted + } + + internal static partial class Database + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_insert_record")] + internal static extern int Insert(IntPtr recordHandle, out int recordId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_record")] + internal static extern int Get(string uri, int recordId, out IntPtr recordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_update_record")] + internal static extern int Update(IntPtr recordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_delete_record")] + internal static extern int Delete(string uri, int recordId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_replace_record")] + internal static extern int Replace(IntPtr recordHandle, int recordId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_all_records")] + internal static extern int GetRecords(string uri, int offset, int limit, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_records_with_query")] + internal static extern int GetRecords(IntPtr queryHandle, int offset, int limit, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_insert_records")] + internal static extern int InsertRecords(IntPtr listHandle, out IntPtr ids, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_update_records")] + internal static extern int UpdateRecords(IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_delete_records")] + internal static extern int DeleteRecords(string uri, int[] recordIdArray, int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_replace_records")] + internal static extern int ReplaceRecords(IntPtr listHandle, int[] recordIdArray, int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_current_version")] + internal static extern int GetVersion(out int contactsDBVersion); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_add_changed_cb")] + internal static extern int AddChangedCb(string uri, ContactsDBChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_remove_changed_cb")] + internal static extern int RemoveChangedCb(string uri, ContactsDBChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_changes_by_version")] + internal static extern int GetChangesByVersion(string uri, int addressBookId, int contactsDBVersion, out IntPtr changeRecordList, out int currentContactsDBVersion); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records")] + internal static extern int Search(string uri, string keyword, int offset, int limit, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_query")] + internal static extern int Search(IntPtr queryHandle, string keyword, int offset, int limit, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_range")] + internal static extern int Search(string uri, string keyword, int offset, int limit, int range, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_for_snippet")] + internal static extern int Search(string uri, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_query_for_snippet")] + internal static extern int Search(IntPtr queryHandle, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_search_records_with_range_for_snippet")] + internal static extern int Search(string uri, string keyword, int offset, int limit, int range, string startMatch, string endMatch, int tokenNumber, out IntPtr listHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_count")] + internal static extern int GetCount(string uri, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_count_with_query")] + internal static extern int GetCount(IntPtr queryHandle, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_last_change_version")] + internal static extern int GetLastChangeVersion(out int version); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_get_status")] + internal static extern int GetStatus(out Tizen.Pims.Contacts.ContactsDatabase.DBStatus status); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_add_changed_cb")] + internal static extern int AddStatusChangedCb(ContactsDBStatusChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_db_remove_changed_cb")] + internal static extern int RemoveStatusChangedCb(ContactsDBStatusChangedCallback callback, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ContactsDBChangedCallback(string uri, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ContactsDBStatusChangedCallback(Tizen.Pims.Contacts.ContactsDatabase.DBStatus status, IntPtr userData); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Filter.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Filter.cs new file mode 100644 index 0000000..8435ef8 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Filter.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using static Tizen.Pims.Contacts.ContactsFilter; + +internal static partial class Interop +{ + internal static partial class Filter + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_create")] + internal static extern int ContactsFilterCreate(string uri, out IntPtr filterHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_destroy")] + internal static extern int ContactsFilterDestroy(IntPtr filterHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_str")] + internal static extern int ContactsFilterAddStr(IntPtr filterHandle, uint propertyId, StringMatchType match, string matchValue); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_int")] + internal static extern int ContactsFilterAddInt(IntPtr filterHandle, uint propertyId, IntegerMatchType match, int matchValue); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_lli")] + internal static extern int ContactsFilterAddLli(IntPtr filterHandle, uint propertyId, IntegerMatchType match, long matchValue); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_double")] + internal static extern int ContactsFilterAddDouble(IntPtr filterHandle, uint propertyId, IntegerMatchType match, double matchValue); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_bool")] + internal static extern int ContactsFilterAddBool(IntPtr filterHandle, uint propertyId, bool matchValue); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_operator")] + internal static extern int ContactsFilterAddOperator(IntPtr filterHandle, LogicalOperator operatorType); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_filter_add_filter")] + internal static extern int ContactsFilterAddFilter(IntPtr parentFilter, IntPtr childFilter); + + + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Group.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Group.cs new file mode 100755 index 0000000..a028fb5 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Group.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Contacts Interop Class + /// + internal static class Group + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_group_add_contact")] + internal static extern int AddContact(int groupId, int contactId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_group_remove_contact")] + internal static extern int RemoveContact(int groupId, int contactId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_group_set_group_order")] + internal static extern int SetGroupOrder(int groupId, int previousGroupId, int nextGroupId); + } +} \ No newline at end of file diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Libraries.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..b916131 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Libraries.cs @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Contacts = "libcontacts-service2.so.0"; + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.List.cs b/src/Tizen.Pims.Contacts/Interop/Interop.List.cs new file mode 100755 index 0000000..67454cb --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.List.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class List + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_create")] + internal static extern int ContactsListCreate(out IntPtr contactsList); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_destroy")] + internal static extern int ContactsListDestroy(IntPtr contactsList, bool deleteChild); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_get_count")] + internal static extern int ContactsListGetCount(IntPtr contactsList, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_add")] + internal static extern int ContactsListAdd(IntPtr contactsList, IntPtr recordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_remove")] + internal static extern int ContactsListRemove(IntPtr contactsList, IntPtr recordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_get_current_record_p")] + internal static extern int ContactsListGetCurrentRecordP(IntPtr contactsList, out IntPtr recordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_prev")] + internal static extern int ContactsListPrev(IntPtr contactsList); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_next")] + internal static extern int ContactsListNext(IntPtr contactsList); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_first")] + internal static extern int ContactsListFirst(IntPtr contactsList); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_list_last")] + internal static extern int ContactsListLast(IntPtr contactsList); + + + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Person.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Person.cs new file mode 100755 index 0000000..7dd177f --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Person.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal enum ContactsPersonProperty + { + NameContact, // Default contacts record + Number, // Default number record + Email, // Default Email record + Image // Default image record + }; + + internal enum ContactsUsageType + { + None, /**< None */ + OutgoingCall, /**< Outgoing Call */ + OutgoingMsg, /**< Outgoing message */ + OutgoingEmail, /**< Outgoing Email (Since 3.0) */ + IncomingCall, /**< Incoming Call (Since 3.0) */ + IncomingMsg, /**< Incoming message (Since 3.0) */ + IncomingEmail,/**< Incoming Email (Since 3.0) */ + MissedCall, /**< Missed Call (Since 3.0) */ + RejectedCall, /**< Rejected Call (Since 3.0) */ + BlockedCall, /**< Blocked Call (Since 3.0) */ + BlockedMsg /**< Blocked message (Since 3.0) */ + }; + + internal static partial class Person + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_link_person")] + internal static extern int ContactsPersonLinkPerson(int basePersonId, int personId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_unlink_contact")] + internal static extern int ContactsPersonUnlinkContact(int personId, int contactId, out int unlinkedPersonId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_reset_usage")] + internal static extern int ContactsPersonResetUsage(int personId, ContactsUsageType type); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_set_favorite_order")] + internal static extern int ContactsPersonSetFavoriteOrder(int personId, int previousPersonId, int nextPersonId); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_set_default_property")] + internal static extern int ContactsPersonSetDefaultProperty(ContactsPersonProperty property, int personId, int id); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_get_default_property")] + internal static extern int ContactsPersonGetDefaultProperty(ContactsPersonProperty property, int personId, out int id); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_person_get_aggregation_suggestions")] + internal static extern int ContactsPersonGetAggregationSuggestions(int personId, int limit, out IntPtr listHandle); + + + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.PhoneLog.cs b/src/Tizen.Pims.Contacts/Interop/Interop.PhoneLog.cs new file mode 100755 index 0000000..f530c5f --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.PhoneLog.cs @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + internal static class PhoneLog + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_phone_log_reset_statistics")] + internal static extern int resetStatistics(); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_phone_log_reset_statistics_by_sim")] + internal static extern int resetStatisticsBySim(int simSlotNo); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Query.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Query.cs new file mode 100755 index 0000000..7c23038 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Query.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Query + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_create")] + internal static extern int ContactsQueryCreate(string uri, out IntPtr queryHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_destroy")] + internal static extern int ContactsQueryDestroy(IntPtr queryHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_set_projection")] + internal static extern int ContactsQuerySetProjection(IntPtr queryHandle, uint[] propertyIdArray, int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_set_distinct")] + internal static extern int ContactsQuerySetDistinct(IntPtr queryHandle, bool set); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_set_filter")] + internal static extern int ContactsQuerySetFilter(IntPtr queryHandle, IntPtr filterHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_query_set_sort")] + internal static extern int ContactsQuerySetSort(IntPtr queryHandle, uint propertyId, bool isAscending); + + + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Record.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Record.cs new file mode 100644 index 0000000..82f67a1 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Record.cs @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Record + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_create")] + internal static extern int Create(string uri, out IntPtr recordIdHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_destroy")] + internal static extern int Destroy(IntPtr recordHandle, bool deleteChild); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_clone")] + internal static extern int Clone(IntPtr recordHandle, out IntPtr clonedRecordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_str")] + internal static extern int GetStr(IntPtr recordHandle, uint propertyId, out string value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_str_p")] + internal static extern int GetStrP(IntPtr recordHandle, uint propertyId, out string value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_set_str")] + internal static extern int SetStr(IntPtr recordHandle, uint propertyId, string value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_int")] + internal static extern int GetInt(IntPtr recordHandle, uint propertyId, out int value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_set_int")] + internal static extern int SetInt(IntPtr recordHandle, uint propertyId, int value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_lli")] + internal static extern int GetLli(IntPtr recordHandle, uint propertyId, out long value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_set_lli")] + internal static extern int SetLli(IntPtr recordHandle, uint propertyId, long value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_bool")] + internal static extern int GetBool(IntPtr recordHandle, uint propertyId, out bool value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_set_bool")] + internal static extern int SetBool(IntPtr recordHandle, uint propertyId, bool value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_double")] + internal static extern int GetDouble(IntPtr recordHandle, uint propertyId, out double value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_set_double")] + internal static extern int SetDouble(IntPtr recordHandle, uint propertyId, double value); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_add_child_record")] + internal static extern int AddChildRecord(IntPtr recordHandle, uint propertyId, IntPtr childRecordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_remove_child_record")] + internal static extern int RemoveChildRecord(IntPtr recordHandle, uint propertyId, IntPtr childRecordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_child_record_count")] + internal static extern int GetChildRecordCount(IntPtr recordHandle, uint propertyId, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_child_record_at_p")] + internal static extern int GetChildRecordAtP(IntPtr recordHandle, uint propertyId, int index, out IntPtr childRecordHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_clone_child_record_list")] + internal static extern int CloneChildRecordList(IntPtr recordHandle, uint propertyId, out IntPtr clonedListHandle); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_record_get_uri_p")] + internal static extern int GetUriP(IntPtr recordHandle, out IntPtr uri); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Setting.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Setting.cs new file mode 100755 index 0000000..902d7e3 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Setting.cs @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Pims.Contacts; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + internal static class Setting + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_get_name_display_order")] + internal static extern int GetNameDisplayOrder(out ContactDisplayOrder nameDisplayOrder); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_set_name_display_order")] + internal static extern int SetNameDisplayOrder(ContactDisplayOrder nameDisplayOrder); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_get_name_sorting_order")] + internal static extern int GetNameSortingOrder(out ContactSortingOrder nameSortingOrder); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_set_name_sorting_order")] + internal static extern int SetNameSortingOrder(ContactSortingOrder nameSortingOrder); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_add_name_display_order_changed_cb")] + internal static extern int AddNameDisplayOrderChangedCB(DisplayOrderChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_remove_name_display_order_changed_cb")] + internal static extern int RemoveNameDisplayOrderChangedCB(DisplayOrderChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_add_name_sorting_order_changed_cb")] + internal static extern int AddNameSortingOrderChangedCB(SortingOrderChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_setting_remove_name_sorting_order_changed_cb")] + internal static extern int RemoveNameSortingOrderChangedCB(SortingOrderChangedCallback callback, IntPtr userData); + + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void DisplayOrderChangedCallback(ContactDisplayOrder nameDisplayOrder, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void SortingOrderChangedCallback(ContactSortingOrder nameSortingOrder, IntPtr userData); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Sim.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Sim.cs new file mode 100755 index 0000000..488a5f6 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Sim.cs @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + internal static class Sim + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_sim_import_all_contacts_by_sim_slot_no")] + internal static extern int ImportAllContactsBySimSlotNo(int sim_slot_no, ContactsSimImportProgressCallback callback, IntPtr userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_sim_get_initialization_status_by_sim_slot_no")] + internal static extern int GetInitializatOnStatusBySimSlotNo(int sim_slot_no, out bool completed); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void ContactsSimImportProgressCallback(string uri, IntPtr userData); + } +} diff --git a/src/Tizen.Pims.Contacts/Interop/Interop.Vcard.cs b/src/Tizen.Pims.Contacts/Interop/Interop.Vcard.cs new file mode 100755 index 0000000..47f135b --- /dev/null +++ b/src/Tizen.Pims.Contacts/Interop/Interop.Vcard.cs @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Vcard + { + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_parse_to_contact_foreach")] + internal static extern int ContactsVcardParseToContactForeach(string vcardFilePath, ContactsVcardParseCallback callback, IntPtr /* void */ userData); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_parse_to_contacts")] + internal static extern int ContactsVcardParseToContacts(string vcardStream, out IntPtr contactsList); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_make_from_contact")] + internal static extern int ContactsVcardMakeFromContact(IntPtr contact, out string vcardStream); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_make_from_my_profile")] + internal static extern int ContactsVcardMakeFromMyProfile(IntPtr myProfile, out string vcardStream); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_make_from_person")] + internal static extern int ContactsVcardMakeFromPerson(IntPtr person, out string vcardStream); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_get_entity_count")] + internal static extern int ContactsVcardGetEntityCount(string vcardFilePath, out int count); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_get_limit_size_of_photo")] + internal static extern int ContactsVcardGetLimitSizeOfPhoto(out uint limitSize); + + [DllImport(Libraries.Contacts, EntryPoint = "contacts_vcard_set_limit_size_of_photo")] + internal static extern int ContactsVcardSetLimitSizeOfPhoto(uint limitSize); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool ContactsVcardParseCallback(IntPtr recordHandle, IntPtr /* void */ userData); + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.csproj b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln new file mode 100755 index 0000000..03602e2 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Pims.Contacts", "Tizen.Pims.Contacts.csproj", "{5B40ACBE-A9D5-492B-AB98-11DD8581941E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{03465933-6740-4C5D-AAD7-1BD28DE3531F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{7EF15371-8CDA-480D-BE0E-78177DD16ADB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B40ACBE-A9D5-492B-AB98-11DD8581941E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B40ACBE-A9D5-492B-AB98-11DD8581941E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B40ACBE-A9D5-492B-AB98-11DD8581941E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B40ACBE-A9D5-492B-AB98-11DD8581941E}.Release|Any CPU.Build.0 = Release|Any CPU + {03465933-6740-4C5D-AAD7-1BD28DE3531F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {03465933-6740-4C5D-AAD7-1BD28DE3531F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {03465933-6740-4C5D-AAD7-1BD28DE3531F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {03465933-6740-4C5D-AAD7-1BD28DE3531F}.Release|Any CPU.Build.0 = Release|Any CPU + {7EF15371-8CDA-480D-BE0E-78177DD16ADB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7EF15371-8CDA-480D-BE0E-78177DD16ADB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7EF15371-8CDA-480D-BE0E-78177DD16ADB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7EF15371-8CDA-480D-BE0E-78177DD16ADB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs new file mode 100644 index 0000000..bae4710 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsDatabase.cs @@ -0,0 +1,709 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Pims.Contacts +{ + /// + /// ContactsDatabase provides methods to manage contacts information from/to the database. + /// + /// + /// This class allows user to access/create/update db operations for contacts information. + /// + public class ContactsDatabase + { + private Object thisLock = new Object(); + private Interop.Database.ContactsDBStatusChangedCallback _contactsDBStatusChangedCallback; + private event EventHandler _dbStatusChanged; + private Dictionary _callbackMap = new Dictionary(); + private Dictionary _delegateMap = new Dictionary(); + private Interop.Database.ContactsDBChangedCallback _dbChangedDelegate; + /// + /// Delegete for detecting the contacts database changes + /// + /// The contacts view URI + /// + /// The delegate must be registered using AddDBChangedDelegate. + /// It's invoked when the designated view changes. + /// + /// + public delegate void ContactsDBChangedDelegate(string uri); + + internal ContactsDatabase() + { + ///To be created in ContactsManager only. + } + + /// + /// Enumeration for contacts database status. + /// + public enum DBStatus + { + /// + /// Normal + /// + Normal, + /// + /// Changing collation. + /// + ChangingCollation + } + + /// + /// Enumeration for Contacts search range. + /// + public enum SearchRange + { + /// + /// Search record from name + /// + Name = 0x00000001, + /// + /// Search record from number + /// + Number = 0x00000002, + /// + /// Search record from data + /// + Data = 0x00000004, + /// + /// Search record from email. Now, support only PersonEmail view + /// + Email = 0x00000008, + } + + /// + /// Occurs when contacts database status is changed. + /// + public event EventHandler DBStatusChanged + { + add + { + lock (thisLock) + { + _contactsDBStatusChangedCallback = (DBStatus status, IntPtr userData) => + { + DBStatusChangedEventArgs args = new DBStatusChangedEventArgs(status); + _dbStatusChanged?.Invoke(this, args); + }; + + int error = Interop.Database.AddStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Add StatusChanged Failed with error " + error); + } + else + { + _dbStatusChanged += value; + } + } + + } + + remove + { + lock (thisLock) + { + int error = Interop.Database.RemoveStatusChangedCb(_contactsDBStatusChangedCallback, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Remove StatusChanged Failed with error " + error); + } + + _dbStatusChanged -= value; + } + } + + } + + /// + /// The current contacts database version. + /// + public int Version + { + get + { + int version = -1; + int error = Interop.Database.GetVersion(out version); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Version Failed with error " + error); + } + return version; + } + } + + /// + /// The last successful changed contacts database version on the current connection. + /// + public int LastChangeVersion + { + get + { + int version = -1; + int error = Interop.Database.GetLastChangeVersion(out version); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "LastChangeVersion Failed with error " + error); + } + return version; + } + } + + /// + /// The contacts database status. + /// + public DBStatus Status + { + get + { + DBStatus status = DBStatus.Normal; + int error = Interop.Database.GetStatus(out status); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetStatus Failed with error " + error); + } + return status; + } + } + + /// + /// Inserts a record into the contacts database. + /// + /// The record to insert + /// The ID of inserted record + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public int Insert(ContactsRecord record) + { + int id = -1; + int error = Interop.Database.Insert(record._recordHandle, out id); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Insert Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return id; + } + + /// + /// Inserts multiple records into the contacts database as a batch operation. + /// + /// The record list + /// The inserted record ID array + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public int[] Insert(ContactsList list) + { + IntPtr ids; + int count; + int error = Interop.Database.InsertRecords(list._listHandle, out ids, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Insert Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + int[] idArr = new int[count]; + Marshal.Copy(ids, idArr, 0, count); + + return idArr; + } + + /// + /// Gets a record from the contacts database. + /// + /// The view URI of a record + /// The record ID + /// The record associated with the record ID + /// http://tizen.org/privilege/contact.read + /// http://tizen.org/privilege/callhistory.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public ContactsRecord Get(string viewUri, int recordId) + { + IntPtr handle; + int error = Interop.Database.Get(viewUri, recordId, out handle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsRecord(handle); + } + + /// + /// Updates a record in the contacts database. + /// + /// The record to update + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Update(ContactsRecord record) + { + int error = Interop.Database.Update(record._recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Update Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Updates multiple records in the contacts database as a batch operation. + /// + /// The record list + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Update(ContactsList list) + { + int error = Interop.Database.UpdateRecords(list._listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Update Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Deletes a record from the contacts database with related child records. + /// + /// The view URI of a record + /// The record ID to delete + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Delete(string viewUri, int recordId) + { + int error = Interop.Database.Delete(viewUri, recordId); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Delete Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Deletes multiple records with related child records from the contacts database as a batch operation. + /// + /// The view URI of the records to delete + /// The record IDs to delete + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Delete(string viewUri, int[] idArray) + { + int error = Interop.Database.DeleteRecords(viewUri, idArray, idArray.Length); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Delete Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Replaces a record in the contacts database. + /// + /// The record to replace + /// the record ID to be replaced + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Replace(ContactsRecord record, int recordId) + { + int error = Interop.Database.Replace(record._recordHandle, recordId); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Replace Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Replaces multiple records in the contacts database as a batch operation. + /// + /// The record list to replace + /// The record IDs to be replaced + /// http://tizen.org/privilege/contact.write + /// http://tizen.org/privilege/callhistory.write + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public void Replace(ContactsList list, int[] idArray) + { + int error = Interop.Database.ReplaceRecords(list._listHandle, idArray, idArray.Length); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Replace Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Retrieves all records as a list. + /// + /// The view URI to get records + /// The index from which results + /// The number to limit results(value 0 is used for all records) + /// + /// The record list + /// + /// http://tizen.org/privilege/contact.read + /// http://tizen.org/privilege/callhistory.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public ContactsList GetAll(string viewUri, int offset, int limit) + { + IntPtr handle; + int error = Interop.Database.GetRecords(viewUri, offset, limit, out handle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetAll Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(handle); + } + + /// + /// Retrieves records using a query. + /// + /// The query to filter the results + /// The index from which to get results + /// The number to limit results(value 0 is used for get all records) + /// + /// The record list + /// + /// http://tizen.org/privilege/contact.read + /// http://tizen.org/privilege/callhistory.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public ContactsList GetRecordsWithQuery(ContactsQuery query, int offset, int limit) + { + IntPtr handle; + int error = Interop.Database.GetRecords(query._queryHandle, offset, limit, out handle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetAllWithQuery Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(handle); + } + + /// + /// Retrieves records changes since the given database version. + /// + /// The view URI to get records + /// The address book ID to filter + /// The contacts database version + /// The current contacts database version + /// + /// The record list + /// + /// http://tizen.org/privilege/contact.read + /// Thrown when method failed due to invalid operation + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + /// Thrown when application does not have proper privileges + public ContactsList GetChangesByVersion(string viewUri, int addressbookId, int contactsDBVersion, out int currentDBVersion) + { + IntPtr recordList; + int error = Interop.Database.GetChangesByVersion(viewUri, addressbookId, contactsDBVersion, out recordList,out currentDBVersion); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetChangesByVersion Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on a given keyword. + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned and PersonGroupNotAssigned. + /// + /// The view URI to find records + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 is used for get all records) + /// + /// http://tizen.org/privilege/contact.read + public ContactsList Search(string viewUri, string keyword, int offset, int limit) + { + IntPtr recordList; + int error = Interop.Database.Search(viewUri, keyword, offset, limit, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on given query and keyword. + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned and PersonGroupNotAssigned. + /// + /// The query to filter + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 used for get all records) + /// The record list + public ContactsList Search(ContactsQuery query, string keyword, int offset, int limit) + { + IntPtr recordList; + int error = Interop.Database.Search(query._queryHandle, keyword, offset, limit, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on a keyword and range. + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned, PersonGroupNotAssigned, PersonNumber and PersonEmail + /// + /// The view URI + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 is used for get all records) + /// The search range, it should be a element of SearchRange or bitwise OR operation of them + /// The record list + public ContactsList Search(string viewUri, string keyword, int offset, int limit, int range) + { + IntPtr recordList; + int error = Interop.Database.Search(viewUri, keyword, offset, limit, range, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on a given keyword for snippet + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned and PersonGroupNotAssigned. + /// Because start match and end match are needed to be composed with keyword, this API performance is lower than Search(string viewUri, string keyword, int offset, int limit). + /// + /// The view URI to find records + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 used for get all records) + /// The text which is inserted into the fragment before the keyword(If NULL, default is "[") + /// The text which is inserted into the fragment after the keyword(If NULL, default is "]") + /// The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home") + /// The record list + public ContactsList Search(string viewUri, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber) + { + IntPtr recordList; + int error = Interop.Database.Search(viewUri, keyword, offset, limit, startMatch, endMatch, tokenNumber, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on given query and keyword for snippet. + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned and PersonGroupNotAssigned. + /// Because start match and end match are needed to be composed with keyword, this API performance is lower than Search(ContactsQuery query, string keyword, int offset, int limit). + /// + /// The query to filter + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 used for get all records) + /// The text which is inserted into the fragment before the keyword(If NULL, default is "[") + /// The text which is inserted into the fragment after the keyword(If NULL, default is "]") + /// The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home") + /// The record list + public ContactsList Search(ContactsQuery query, string keyword, int offset, int limit, string startMatch, string endMatch, int tokenNumber) + { + IntPtr recordList; + int error = Interop.Database.Search(query._queryHandle, keyword, offset, limit, startMatch, endMatch, tokenNumber, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Finds records based on a keyword and range for snippet. + /// + /// + /// This API works only for the Views below. + /// Person, PersonContact, PersonGroupRelation, PersonGroupAssigned, PersonGroupNotAssigned, PersonNumber and PersonEmail + /// Because start match and end match are needed to be composed with keyword, this API performance is lower than Search(string viewUri, string keyword, int offset, int limit, int range). + /// + /// The view URI + /// The keyword + /// The index from which to get results + /// The number to limit results(value 0 is used for get all records) + /// The search range, it should be a element of SearchRange or bitwise OR operation of them + /// The text which is inserted into the fragment before the keyword(If NULL, default is "[") + /// The text which is inserted into the fragment after the keyword(If NULL, default is "]") + /// The one side extra number of tokens near keyword(If negative value, full sentence is printed. e.g. if token number is 3 with 'abc' keyword, "my name is [abc]de and my home") + /// The record list + public ContactsList Search(string viewUri, string keyword, int offset, int limit, int range, string startMatch, string endMatch, int tokenNumber) + { + IntPtr recordList; + int error = Interop.Database.Search(viewUri, keyword, offset, limit, range, startMatch, endMatch, tokenNumber, out recordList); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Search Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsList(recordList); + } + + /// + /// Gets the number of records in a specific view + /// + /// The view URI + /// The count of records + public int GetCount(string viewUri) + { + int count = -1; + int error = Interop.Database.GetCount(viewUri, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetCount Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return count; + } + + /// + /// Gets the number of records matching a query. + /// + /// The query used for filtering the results + /// The count of records + public int GetCount(ContactsQuery query) + { + int count = -1; + int error = Interop.Database.GetCount(query._queryHandle, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetCount Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return count; + } + + /// + /// Registers a callback function to be invoked when a record changes. + /// + /// The view URI of records whose changes are monitored + /// The callback function to register + public void AddDBChangedDelegate(string viewUri, ContactsDBChangedDelegate callback) + { + _dbChangedDelegate = (string uri, IntPtr userData) => + { + _callbackMap[uri](uri); + }; + int error = Interop.Database.AddChangedCb(viewUri, _dbChangedDelegate, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddDBChangedDelegate Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _callbackMap[viewUri] = callback; + _delegateMap[viewUri] = _dbChangedDelegate; + } + + /// + /// Unregisters a callback function. + /// + /// The view URI of records whose changes are monitored + /// The callback function to register + public void RemoveDBChangedDelegate(string viewUri, ContactsDBChangedDelegate callback) + { + int error = Interop.Database.RemoveChangedCb(viewUri, _delegateMap[viewUri], IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "RemoveDBChangedDelegate Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _callbackMap.Remove(viewUri); + _delegateMap.Remove(viewUri); + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsErrorFactory.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsErrorFactory.cs new file mode 100644 index 0000000..b542c57 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsErrorFactory.cs @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Pims.Contacts +{ + internal enum ContactsError + { + None = (int)ErrorCode.None, + InvalidParameter = (int)ErrorCode.InvalidParameter, + NotSupported = (int)ErrorCode.NotSupported, + PermissionDenied = (int)ErrorCode.PermissionDenied, + OutOfMemory = (int)ErrorCode.OutOfMemory, + FileNoSpaceOnDevice = (int)ErrorCode.FileNoSpaceOnDevice, + NoData = (int)ErrorCode.NoData, + + DatabaseLocked = -0x02010000 | 0x81, + Database = -0x02010000 | 0x9F, + IpcNotAvaliable = -0x02010000 | 0xB1, + Ipc = -0x02010000 | 0xBF, + System = -0x02010000 | 0xEF + } + + internal static class Globals + { + internal const string LogTag = "Tizen.Pims.Contacts"; + } + + internal static class ContactsErrorFactory + { + static internal Exception CheckAndCreateException(int error) + { + ContactsError e = (ContactsError)error; + switch (e) + { + case ContactsError.None: + return null; + case ContactsError.InvalidParameter: + return new ArgumentException("Invalid Parameters Provided"); + case ContactsError.NotSupported: + return new NotSupportedException("Not Supported"); + case ContactsError.PermissionDenied: + return new UnauthorizedAccessException("Permission Denied"); + case ContactsError.OutOfMemory: + return new OutOfMemoryException("Out of Memory"); + case ContactsError.FileNoSpaceOnDevice: + return new InvalidOperationException("File System is Full"); + case ContactsError.NoData: + return new InvalidOperationException("No Data"); + case ContactsError.DatabaseLocked: + return new InvalidOperationException("Database Locked"); + case ContactsError.Database: + return new InvalidOperationException("Database Failed"); + case ContactsError.IpcNotAvaliable: + return new InvalidOperationException("IPC Not Avaliable"); + case ContactsError.Ipc: + return new InvalidOperationException("IPC failed"); + case ContactsError.System: + return new InvalidOperationException("Internal system error"); + default: + return new InvalidOperationException("Unknown Error Code"); + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsFilter.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsFilter.cs new file mode 100644 index 0000000..18880ac --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsFilter.cs @@ -0,0 +1,424 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using static Interop.Contacts; + +namespace Tizen.Pims.Contacts +{ + /// + /// A filter includes the conditions for the search + /// + public class ContactsFilter:IDisposable + { + internal IntPtr _filterHandle; + + /// + /// Creates a filter with a condition for a string type property. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsFilter(string viewUri, uint propertyId, StringMatchType matchType, string matchValue) + { + int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddStr(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Creates a filter with a condition for an integer type property. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, int matchValue) + { + int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddInt(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Creates a filter with a condition for a long type property. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, long matchValue) + { + int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddLli(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Creates a filter with a condition for a double type property. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsFilter(string viewUri, uint propertyId, IntegerMatchType matchType, double matchValue) + { + int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddDouble(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Creates a filter with a condition for a boolean type property. + /// + /// The view URI of a filter + /// The property ID to add a condition + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsFilter(string viewUri, uint propertyId, bool matchValue) + { + int error = Interop.Filter.ContactsFilterCreate(viewUri, out _filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddBool(_filterHandle, propertyId, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + ~ContactsFilter() + { + Dispose(false); + } + + /// + /// Enumeration for the filter match type of a string. + /// + public enum StringMatchType + { + /// + /// Full string, case-sensitive + /// + Exactly, + /// + /// Full string, case-insensitive + /// + FullString, + /// + /// Sub string, case-insensitive + /// + Contains, + /// + /// Start with, case-insensitive + /// + StartsWith, + /// + /// End with, case-insensitive + /// + EndsWith, + /// + /// IS NOT NUL + /// + Exists, + } + + /// + /// Enumeration for the filter match type of an integer. + /// + public enum IntegerMatchType + { + /// + /// = + /// + Equal, + /// + /// > + /// + GreaterThan, + /// + /// >= + /// + GreaterThanOrEqual, + /// + /// < + /// + LessThan, + /// + /// <= + /// + LessThanOrEqual, + /// + /// <>, this flag can yield poor performance + /// + NotEqual, + /// + /// IS NULL + /// + None, + } + + /// + /// Enumeration for a filter operator. + /// + public enum LogicalOperator + { + And, + Or, + } + + #region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + int error = Interop.Filter.ContactsFilterDestroy(_filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsFilterDestroy Failed with error " + error); + } + + disposedValue = true; + } + } + + /// + /// Releases all resources used by the ContactsFilter. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + + /// + /// Adds a condition for a string type property. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, StringMatchType matchType, string matchValue) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddStr(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Adds a condition for a integer type property. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, int matchValue) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddInt(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Adds a condition for a long type property. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, long matchValue) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddLli(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Adds a condition for a double type property. + /// + /// The operator type + /// The property ID to add a condition + /// The match flag + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, IntegerMatchType matchType, double matchValue) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddDouble(_filterHandle, propertyId, matchType, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Adds a condition for a boolean type property. + /// + /// The operator type + /// The property ID to add a condition + /// The match value + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddCondition(LogicalOperator logicalOperator, uint propertyId, bool matchValue) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddBool(_filterHandle, propertyId, matchValue); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddCondition Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Adds a child filter to a parent filter. + /// + /// The operator type + /// The child filter + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddFilter(LogicalOperator logicalOperator, ContactsFilter filter) + { + int error = Interop.Filter.ContactsFilterAddOperator(_filterHandle, logicalOperator); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + error = Interop.Filter.ContactsFilterAddFilter(_filterHandle, filter._filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsList.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsList.cs new file mode 100644 index 0000000..d0965eb --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsList.cs @@ -0,0 +1,241 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Pims.Contacts +{ + /// + /// A list of records with the same type + /// + public class ContactsList:IDisposable + { + private Int64 _memoryPressure = 20; + internal IntPtr _listHandle; + internal ContactsList(IntPtr handle) + { + int count; + + _listHandle = handle; + int error = Interop.List.ContactsListGetCount(_listHandle, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsList Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _memoryPressure += count * ContactsViews.AverageSizeOfRecord; + GC.AddMemoryPressure(_memoryPressure); + } + + /// + /// Creates a contacts record list. + /// + /// Thrown when an invoked method is not supported + /// Thrown when failed due to out of memory + public ContactsList() + { + int error = Interop.List.ContactsListCreate(out _listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsList Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + GC.AddMemoryPressure(_memoryPressure); + } + + ~ContactsList() + { + Dispose(false); + } + + /// + /// The count of contact entity. + /// + public int Count + { + get + { + int count = -1; + int error = Interop.List.ContactsListGetCount(_listHandle, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsList Count Failed with error " + error); + } + return count; + } + } + + #region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + int error = Interop.List.ContactsListDestroy(_listHandle, true); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsListDestroy Failed with error " + error); + } + + disposedValue = true; + GC.RemoveMemoryPressure(_memoryPressure); + } + } + + /// + /// Releases all resources used by the ContactsList. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + + /// + /// Adds a record to the contacts list. + /// + /// The record to add + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void AddRecord(ContactsRecord record) + { + int error = Interop.List.ContactsListAdd(_listHandle, record._recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + record._disposedValue = true; + _memoryPressure += ContactsViews.AverageSizeOfRecord; + } + + /// + /// Removes a record from the contacts list. + /// + /// The record to remove + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + public void RemoveRecord(ContactsRecord record) + { + int error = Interop.List.ContactsListRemove(_listHandle, record._recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "RemoveRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + record._disposedValue = false; + _memoryPressure -= ContactsViews.AverageSizeOfRecord; + } + + /// + /// Retrieves a record from the contacts list. + /// + /// + /// contacts record + /// + public ContactsRecord GetCurrentRecord() + { + IntPtr handle; + int error = Interop.List.ContactsListGetCurrentRecordP(_listHandle, out handle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetCurrentRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsRecord(handle, true); + } + + /// + /// Moves a contacts list to the previous position. + /// + /// + /// When the cursor is already at the first position, it returns false. + /// + public bool MovePrevious() + { + int error = Interop.List.ContactsListPrev(_listHandle); + + if ((int)ContactsError.None == error) + { + return true; + } + else if (Count > 0 && (int)ContactsError.NoData == error) + { + Log.Debug(Globals.LogTag, "Nodata MovePrevious" + error); + return false; + } + else + { + Log.Error(Globals.LogTag, "MovePrevious Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Moves a contacts list to the next position. + /// + /// + /// When the cursor is already at the last position, it returns false. + /// + public bool MoveNext() + { + int error = Interop.List.ContactsListNext(_listHandle); + + if ((int)ContactsError.None == error) + { + return true; + } + else if (Count > 0 && (int)ContactsError.NoData == error) + { + Log.Debug(Globals.LogTag, "Nodata MoveNext" + error); + return false; + } + else + { + Log.Error(Globals.LogTag, "MoveNext Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Moves a contacts list to the first position. + /// + public void MoveFirst() + { + int error = Interop.List.ContactsListFirst(_listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "MoveFirst Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Moves a contacts list to the last position. + /// + public void MoveLast() + { + int error = Interop.List.ContactsListLast(_listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "MoveFirst Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsManager.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsManager.cs new file mode 100644 index 0000000..cde2fff --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsManager.cs @@ -0,0 +1,284 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using static Interop.Contacts; + +namespace Tizen.Pims.Contacts +{ + /// + /// Enumeration for name display order. + /// + public enum ContactDisplayOrder + { + /// + /// First name comes at the first + /// + FirstLast, + /// + /// First name comes at the last + /// + LastFirst + }; + + /// + /// Enumeration for name sorting order. + /// + public enum ContactSortingOrder + { + /// + /// Contacts are first sorted based on the first name + /// + FirstLast, + /// + /// Contacts are first sorted based on the last name + /// + LastFirst + }; + + /// + /// A class for managing contact information. It allows applications to access contacts database. + /// + public class ContactsManager : IDisposable + { + private ContactsDatabase _db = null; + private Object thisLock = new Object(); + private Interop.Setting.DisplayOrderChangedCallback _displayOrderDelegate; + private Interop.Setting.SortingOrderChangedCallback _sortingOrderDelegate; + + /// + /// Creates a ContactsManager. + /// + /// Thrown when method failed due to invalid operation + public ContactsManager() + { + int error = Interop.Contacts.Connect(); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Connect Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _db = new ContactsDatabase(); + } + + ~ContactsManager() + { + Dispose(false); + } + + #region IDisposable Support + private bool disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + int error = Interop.Contacts.Disconnect(); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Disconnect Failed with error " + error); + } + + disposedValue = true; + } + } + + /// + /// Releases all resources used by the ContactsManager. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + + private event EventHandler _nameDisplayOrderChanged; + private event EventHandler _nameSortingOrderChanged; + + /// + /// (event) NameDisplayOrderChanged is raised when changing setting value of contacts name display order + /// + /// http://tizen.org/privilege/contact.read + public event EventHandler NameDisplayOrderChanged + { + add + { + lock (thisLock) + { + if (_displayOrderDelegate == null) + { + _displayOrderDelegate = (ContactDisplayOrder nameDisplayOrder, IntPtr userData) => + { + NameDisplayOrderChangedEventArgs args = new NameDisplayOrderChangedEventArgs(nameDisplayOrder); + _nameDisplayOrderChanged?.Invoke(this, args); + }; + } + + if (_nameDisplayOrderChanged == null) + { + int error = Interop.Setting.AddNameDisplayOrderChangedCB(_displayOrderDelegate, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Add NameDisplayOrderChangedCB Failed with error " + error); + } + } + + _nameDisplayOrderChanged += value; + } + } + + remove + { + lock (thisLock) + { + _nameDisplayOrderChanged -= value; + + if (_nameDisplayOrderChanged == null) + { + int error = Interop.Setting.RemoveNameDisplayOrderChangedCB(_displayOrderDelegate, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Remove StateChanged Failed with error " + error); + } + } + } + } + } + + /// + /// (event) NameSortingOrderChanged is raised when changing setting value of contacts name sorting order + /// + /// http://tizen.org/privilege/contact.read + public event EventHandler NameSortingOrderChanged + { + add + { + lock (thisLock) + { + if (_sortingOrderDelegate == null) + { + _sortingOrderDelegate = (ContactSortingOrder nameSortingOrder, IntPtr userData) => + { + NameSortingOrderChangedEventArgs args = new NameSortingOrderChangedEventArgs(nameSortingOrder); + _nameSortingOrderChanged?.Invoke(this, args); + }; + } + + if (_nameSortingOrderChanged == null) + { + int error = Interop.Setting.AddNameSortingOrderChangedCB(_sortingOrderDelegate, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Add NameSortingOrderChangedCB Failed with error " + error); + } + } + + _nameSortingOrderChanged += value; + } + } + + remove + { + lock (thisLock) + { + _nameSortingOrderChanged -= value; + + if (_nameSortingOrderChanged == null) + { + int error = Interop.Setting.RemoveNameSortingOrderChangedCB(_sortingOrderDelegate, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Remove StateChanged Failed with error " + error); + } + } + } + } + } + + /// + /// A ContactsDatabase + /// + public ContactsDatabase Database + { + get + { + return _db; + } + } + + /// + /// A setting value of contacts name display order + /// + /// + /// DisplayName of contacts returned from database are determined by this property + /// + /// http://tizen.org/privilege/contact.read + /// http://tizen.org/privilege/contact.write + public ContactDisplayOrder NameDisplayOrder + { + get + { + ContactDisplayOrder contactDisplayOrder; + int error = Interop.Setting.GetNameDisplayOrder(out contactDisplayOrder); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get NameDisplayOrder Failed with error " + error); + } + return contactDisplayOrder; + } + set + { + int error = Interop.Setting.SetNameDisplayOrder(value); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set NameDisplayOrder Failed with error " + error); + } + } + } + + /// + /// A setting value of contacts name sorting order + /// + /// + /// Contacts returned from database are first sorted based on the first name or last name by this property + /// + /// http://tizen.org/privilege/contact.read + /// http://tizen.org/privilege/contact.write + public ContactSortingOrder NameSortingOrder + { + get + { + ContactSortingOrder contactsSortingOrder; + int error = Interop.Setting.GetNameSortingOrder(out contactsSortingOrder); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get NameSortingOrder Failed with error " + error); + } + return contactsSortingOrder; + } + set + { + int error = Interop.Setting.SetNameSortingOrder(value); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set NameSortingOrder Failed with error " + error); + } + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsQuery.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsQuery.cs new file mode 100644 index 0000000..6754700 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsQuery.cs @@ -0,0 +1,147 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.Contacts; + +namespace Tizen.Pims.Contacts +{ + /// + /// A query is used to retrieve data which satisfies given criteria + /// + /// + /// A query is used to retrieve person, group, speed dial, and log data which satisfies a given criteria, such as an integer property being greater than a given value, or a string property containing a given substring. + /// A query needs a filter which can set the conditions for the search. + /// + public class ContactsQuery : IDisposable + { + internal IntPtr _queryHandle; + + /// + /// Creates a query. + /// + /// The view URI of a query + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsQuery(string viewUri) + { + int error = Interop.Query.ContactsQueryCreate(viewUri, out _queryHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsQuery Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + internal ContactsQuery(IntPtr handle) + { + _queryHandle = handle; + } + + ~ContactsQuery() + { + Dispose(false); + } + #region IDisposable Support + private bool disposedValue = false; + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + int error = Interop.Query.ContactsQueryDestroy(_queryHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsQueryDestroy Failed with error " + error); + } + + disposedValue = true; + } + } + + /// + /// Releases all resources used by the ContactsQuery. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + + /// + /// Adds property IDs for projection. + /// + /// The property ID array + /// Thrown when one of the arguments provided to a method is not valid + public void SetProjection(uint[] propertyIdArray) + { + int error = Interop.Query.ContactsQuerySetProjection(_queryHandle, propertyIdArray, propertyIdArray.Length); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "SetProjection Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Sets the "distinct" option for projection. + /// + /// If true it is set, otherwise if false it is unset + /// Thrown when one of the arguments provided to a method is not valid + public void SetDistinct(bool set) + { + int error = Interop.Query.ContactsQuerySetDistinct(_queryHandle, set); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "SetDistinct Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Sets the filter for a query. + /// + /// The filter + /// Thrown when one of the arguments provided to a method is not valid + public void SetFilter(ContactsFilter filter) + { + int error = Interop.Query.ContactsQuerySetFilter(_queryHandle, filter._filterHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "SetFilter Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + + /// + /// Sets the sort mode for a query. + /// + /// The property ID to sort + /// If true it sorts in the ascending order, otherwise if false it sorts in the descending order + /// Thrown when one of the arguments provided to a method is not valid + public void SetSort(uint propertyId, bool isAscending) + { + int error = Interop.Query.ContactsQuerySetSort(_queryHandle, propertyId, isAscending); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "SetSort Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsRecord.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsRecord.cs new file mode 100644 index 0000000..dd8c592 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsRecord.cs @@ -0,0 +1,396 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Pims.Contacts +{ + /// + /// A record represents an actual record in the database + /// + /// + /// A record represents an actual record in the database, but you can also consider it a piece of information, such as an address, a phone number, or a group of contacts. + /// A record can be a complex set of data, containing other data. For example, a contact record contains the address property, which is a reference to an address record. + /// An address record belongs to a contact record, and its ContactId property is set to the identifier of the corresponding contact. In this case, the address is the child record of the contact and the contact is the parent record. + /// + public class ContactsRecord : IDisposable + { + private string _uri = null; + private uint _id; + private Int64 _memoryPressure = ContactsViews.AverageSizeOfRecord; + internal IntPtr _recordHandle; + + internal ContactsRecord(IntPtr handle) + { + _recordHandle = handle; + IntPtr viewUri; + int error = Interop.Record.GetUriP(handle, out viewUri); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + GC.AddMemoryPressure(_memoryPressure); + _uri = Marshal.PtrToStringAnsi(viewUri); + } + + internal ContactsRecord(IntPtr handle, bool disposedValue) + { + _recordHandle = handle; + _disposedValue = disposedValue; + IntPtr viewUri; + int error = Interop.Record.GetUriP(handle, out viewUri); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + if (!_disposedValue) + GC.AddMemoryPressure(_memoryPressure); + _uri = Marshal.PtrToStringAnsi(viewUri); + } + + internal ContactsRecord(IntPtr handle, int id) + { + _recordHandle = handle; + _id = (uint)id; + IntPtr viewUri; + int error = Interop.Record.GetUriP(handle, out viewUri); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _uri = Marshal.PtrToStringAnsi(viewUri); + GC.AddMemoryPressure(_memoryPressure); + } + + /// + /// Creates a record. + /// + /// The view URI + /// Thrown when an invoked method is not supported + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public ContactsRecord(string viewUri) + { + int error = Interop.Record.Create(viewUri, out _recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ContactsRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + _uri = viewUri; + GC.AddMemoryPressure(_memoryPressure); + } + + ~ContactsRecord() + { + Dispose(false); + } + + /// + /// The URI of the record + /// + public string Uri + { + get + { + return _uri; + } + } + + #region IDisposable Support + internal bool _disposedValue = false; // To detect redundant calls + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + int error = Interop.Record.Destroy(_recordHandle, true); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Dispose Failed with error " + error); + } + _disposedValue = true; + GC.RemoveMemoryPressure(_memoryPressure); + } + } + + /// + /// Releases all resources used by the ContactsRecord. + /// It should be called after finished using of the object. + /// + public void Dispose() + { + Dispose(true); + } + #endregion + + /// + /// Makes a clone of a record. + /// + /// A cloned record + /// Thrown when failed due to out of memory + public ContactsRecord Clone() + { + IntPtr _clonedRecordHandle; + int error = Interop.Record.Clone(_recordHandle, out _clonedRecordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Clone Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsRecord(_clonedRecordHandle, (int)_id); + } + + /// + /// Gets a value of the property from a record. + /// + /// The property ID + /// + /// The value of the property corresponding to property id. + /// + /// Thrown when one of the arguments provided to a method is not valid + public T Get(uint propertyId) + { + object parsedValue = null; + if (typeof(T) == typeof(string)) + { + string val; + int error = Interop.Record.GetStr(_recordHandle, propertyId, out val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get String Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(int)) + { + int val; + int error = Interop.Record.GetInt(_recordHandle, propertyId, out val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Int Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(bool)) + { + bool val; + int error = Interop.Record.GetBool(_recordHandle, propertyId, out val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Bool Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(long)) + { + long val; + int error = Interop.Record.GetLli(_recordHandle, propertyId, out val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Long Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else if (typeof(T) == typeof(double)) + { + double val; + int error = Interop.Record.GetDouble(_recordHandle, propertyId, out val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Long Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + parsedValue = Convert.ChangeType(val, typeof(T)); + } + else + { + Log.Error(Globals.LogTag, "Not Supported Data Type"); + throw ContactsErrorFactory.CheckAndCreateException((int)ContactsError.NotSupported); + } + return (T)parsedValue; + } + + /// + /// Sets a value of the property to a record. + /// + /// The property ID + /// The value to set + /// Thrown when one of the arguments provided to a method is not valid + public void Set(uint propertyId, T value) + { + if (typeof(T) == typeof(string)) + { + string val = Convert.ToString(value); + int error = Interop.Record.SetStr(_recordHandle, propertyId, val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set String Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + else if (typeof(T) == typeof(int)) + { + int val = Convert.ToInt32(value); + int error = Interop.Record.SetInt(_recordHandle, propertyId, val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set Int Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + else if (typeof(T) == typeof(bool)) + { + bool val = Convert.ToBoolean(value); + int error = Interop.Record.SetBool(_recordHandle, propertyId, val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set Bool Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + else if (typeof(T) == typeof(long)) + { + long val = Convert.ToInt64(value); + int error = Interop.Record.SetLli(_recordHandle, propertyId, val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Set Long Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + else if (typeof(T) == typeof(double)) + { + double val = Convert.ToDouble(value); + int error = Interop.Record.SetDouble(_recordHandle, propertyId, val); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Get Long Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + else + { + Log.Error(Globals.LogTag, "Not Supported Data Type"); + throw ContactsErrorFactory.CheckAndCreateException((int)ContactsError.NotSupported); + } + } + + /// + /// Adds a child record to the parent record. + /// + /// The property ID + /// The child record to add to parent record + /// Thrown when one of the arguments provided to a method is not valid + public void AddChildRecord(uint propertyId, ContactsRecord childRecord) + { + int error = Interop.Record.AddChildRecord(_recordHandle, propertyId, childRecord._recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "AddChildRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + childRecord._disposedValue = true; + } + + /// + /// Removes a child record from the parent record. + /// + /// The property ID + /// The child record to remove from parent record + /// Thrown when one of the arguments provided to a method is not valid + public void RemoveChildRecord(uint propertyId, ContactsRecord childRecord) + { + int error = Interop.Record.RemoveChildRecord(_recordHandle, propertyId, childRecord._recordHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "RemoveChildRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + childRecord._disposedValue = false; + } + + /// + /// Gets the number of child records of a parent record. + /// + /// The property ID + /// The number of child records corresponding to property ID + /// Thrown when one of the arguments provided to a method is not valid + public int GetChildRecordCount(uint propertyId) + { + int count = 0; + int error = Interop.Record.GetChildRecordCount(_recordHandle, propertyId, out count); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetChildRecordCount Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return count; + } + + /// + /// Gets a child record from the parent record + /// + /// The property ID + /// The index of child record + /// The record + /// Thrown when one of the arguments provided to a method is not valid + public ContactsRecord GetChildRecord(uint propertyId, int index) + { + IntPtr handle; + + int error = Interop.Record.GetChildRecordAtP(_recordHandle, propertyId, index, out handle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "GetChildRecord Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + return new ContactsRecord(handle, true); + } + + /// + /// Clones a child record list corresponding to property ID + /// + /// The property ID + /// + /// The record list + /// + /// Thrown when one of the arguments provided to a method is not valid + public ContactsList CloneChildRecordList(uint propertyId) + { + IntPtr listHandle; + + int error = Interop.Record.CloneChildRecordList(_recordHandle, propertyId, out listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "CloneChildRecordList Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + ContactsList list = new ContactsList(listHandle); + return list; + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsVcard.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsVcard.cs new file mode 100644 index 0000000..c02cc4f --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsVcard.cs @@ -0,0 +1,121 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using static Interop.Contacts; + +namespace Tizen.Pims.Contacts +{ + using static ContactsViews; + /// + /// A class for parsing and making vCards. + /// + /// + /// It's based on the vCard v3.0 specification + /// + public static class ContactsVcard + { + public delegate bool ParseDelegate(ContactsRecord record); + + /// + /// Retrieves the vCard stream from a contacts record. + /// + /// The contacts record + /// + /// The vCard stream. + /// + /// http://tizen.org/privilege/contact.read + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static string Compose(ContactsRecord record) + { + int error = 0; + string stream = null; + + if (record.Uri.Equals(Person.Uri)) + { + error = Interop.Vcard.ContactsVcardMakeFromPerson(record._recordHandle, out stream); + } + else if (record.Uri.Equals(Contact.Uri)) + { + error = Interop.Vcard.ContactsVcardMakeFromContact(record._recordHandle, out stream); + } + else if (record.Uri.Equals(MyProfile.Uri)) + { + error = Interop.Vcard.ContactsVcardMakeFromMyProfile(record._recordHandle, out stream); + } + else + { + throw new ArgumentException("Invalid Parameters Provided"); + } + + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Compose Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + return stream; + } + + /// + /// Retrieves all contacts with a contacts list from a vCard stream + /// + /// The vCard stream + /// + /// The contacts list + /// + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static ContactsList Parse(string stream) + { + IntPtr listHandle; + + int error = Interop.Vcard.ContactsVcardParseToContacts(stream, out listHandle); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "Parse Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + + return new ContactsList(listHandle); + } + + /// + /// Retrieves all contacts with a record from a vCard file. + /// + /// The file path of vCard stream file + /// The callback function to invoke + /// Thrown when method failed due to invalid operation + /// Thrown when one of the arguments provided to a method is not valid + /// Thrown when failed due to out of memory + public static void ParseForEach(string path, ParseDelegate callback) + { + Interop.Vcard.ContactsVcardParseCallback cb = (IntPtr handle, IntPtr data) => + { + return callback(new ContactsRecord(handle, true)); + }; + + int error = Interop.Vcard.ContactsVcardParseToContactForeach(path, cb, IntPtr.Zero); + if ((int)ContactsError.None != error) + { + Log.Error(Globals.LogTag, "ParseForEach Failed with error " + error); + throw ContactsErrorFactory.CheckAndCreateException(error); + } + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsViews.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsViews.cs new file mode 100644 index 0000000..82ed5fe --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/ContactsViews.cs @@ -0,0 +1,3236 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; + +namespace Tizen.Pims.Contacts +{ + /// + /// This class provides information about views with properties. + /// + /// + /// Views are provided to access and handle entities. A view is a structure, which has property elements. + /// A view is almost the same as a database "VIEW", which limits access and guarantees performance. + /// A "record" represents a single row of the views. + /// A record can have basic properties of five types: integer, string, boolean, long, double. + /// + public static class ContactsViews + { + private const uint PropertyAddressBook = 0x00100000; + private const uint PropertyGroup = 0x00200000; + private const uint PropertyPerson = 0x00300000; + private const uint PropertyData = 0x00600000; + private const uint PropertySpeedDial = 0x00700000; + private const uint PropertyPhonelog = 0x00800000; + private const uint PropertyUpdateInfo = 0x00900000; + private const uint PropertyPhonelogStat = 0x00B00000; + + private const uint PropertyContact = 0x01000000; + private const uint PropertyName = 0x01100000; + private const uint PropertyNumber = 0x01200000; + private const uint PropertyEmail = 0x01300000; + private const uint PropertyAddress = 0x01400000; + private const uint PropertyUrl = 0x01500000; + private const uint PropertyEvent = 0x01600000; + private const uint PropertyGroupRelation = 0x01700000; + private const uint PropertyRelationship = 0x01800000; + private const uint PropertyCompany = 0x01900000; + private const uint PropertyNickname = 0x01A00000; + private const uint PropertyMessenger = 0x01B00000; + private const uint PropertyNote = 0x01C00000; + private const uint PropertyProfile = 0x01D00000; + private const uint PropertyImage = 0x01E00000; + private const uint PropertyExtension = 0x01F00000; + private const uint PropertyMyProfile = 0x02000000; + private const uint PropertyActivityPhoto = 0x02100000; + private const uint PropertySip = 0x02200000; + + /* data_type mask 0x000FF000 */ + private const uint DataTypeBool = 0x00010000; + private const uint DataTypeInt = 0x00020000; + private const uint DataTypeLong = 0x00030000; + private const uint DataTypeString = 0x00040000; + private const uint DataTypeDouble = 0x00050000; + private const uint DataTypeRecord = 0x00060000; + + private const uint ReadOnly = 0x00001000; + + private enum PropertyIds : uint + { + /* addressbook */ + AddressbookId = (PropertyAddressBook | DataTypeInt | ReadOnly), + AddressbookAccountId = (PropertyAddressBook | DataTypeInt) + 1, + AddressbookName = (PropertyAddressBook | DataTypeString) + 2, + AddressbookMode = (PropertyAddressBook | DataTypeInt) + 3, + + /* group */ + GroupId = (PropertyGroup | DataTypeInt | ReadOnly), + GroupAddressbookId = (PropertyGroup | DataTypeInt) + 1, + GroupName = (PropertyGroup | DataTypeString) + 2, + GroupRingtone = (PropertyGroup | DataTypeString) + 3, + GroupImage = (PropertyGroup | DataTypeString) + 4, + GroupVibration = (PropertyGroup | DataTypeString) + 5, + GroupExtraData = (PropertyGroup | DataTypeString) + 6, + GroupIsReadOnly = (PropertyGroup | DataTypeBool) + 7, + GroupMessageAlert = (PropertyGroup | DataTypeString) + 8, + + /* person */ + PersonId = (PropertyPerson | DataTypeInt | ReadOnly), + PersonDisplayName = (PropertyPerson | DataTypeString | ReadOnly) + 1, + PersonDisplayContactId = (PropertyPerson | DataTypeInt) + 2, + PersonRingtone = (PropertyPerson | DataTypeString) + 3, + PersonThumbnail = (PropertyPerson | DataTypeString | ReadOnly) + 4, + PersonVibration = (PropertyPerson | DataTypeString) + 5, + PersonIsFavorite = (PropertyPerson | DataTypeBool) + 6, + PersonFavoritePriority = (PropertyPerson | DataTypeDouble | ReadOnly) + 7, + PersonLinkCount = (PropertyPerson | DataTypeInt | ReadOnly) + 8, + PersonAddressbookIds = (PropertyPerson | DataTypeString | ReadOnly) + 9, + PersonHasPhoneNumber = (PropertyPerson | DataTypeBool | ReadOnly) + 10, + PersonHasEmail = (PropertyPerson | DataTypeBool | ReadOnly) + 11, + PersonDisplayNameIndex = (PropertyPerson | DataTypeString | ReadOnly) + 12, + PersonStatus = (PropertyPerson | DataTypeString | ReadOnly) + 13, + PersonMessageAlert = (PropertyPerson | DataTypeString) + 14, + PersonSnippetType = (PropertyPerson | DataTypeInt | ReadOnly) + 15, + PersonSnippetString = (PropertyPerson | DataTypeString | ReadOnly) + 16, + + /* person-stat */ + PersonUsageType = (PropertyPerson | DataTypeInt) + 100, + PersonTimesUsed = (PropertyPerson | DataTypeInt) + 101, + + /* simple contact : read only */ + /* contact */ + ContactId = (PropertyContact | DataTypeInt | ReadOnly), + ContactDisplayName = (PropertyContact | DataTypeString | ReadOnly) + 1, + ContactDisplaySourceDataId = (PropertyContact | DataTypeInt | ReadOnly) + 2, + ContactAddressbookId = (PropertyContact | DataTypeInt) + 3, + ContactRingtone = (PropertyContact | DataTypeString) + 4, + ContactImage = (PropertyContact | DataTypeRecord) + 5, + ContactThumbnail = (PropertyContact | DataTypeString | ReadOnly) + 6, + ContactIsFavorite = (PropertyContact | DataTypeBool) + 7, + ContactHasPhoneNumber = (PropertyContact | DataTypeBool | ReadOnly) + 8, + ContactHasEmail = (PropertyContact | DataTypeBool | ReadOnly) + 9, + ContactPersonId = (PropertyContact | DataTypeInt) + 10, + ContactUid = (PropertyContact | DataTypeString) + 11, + ContactVibration = (PropertyContact | DataTypeString) + 12, + ContactChangedTime = (PropertyContact | DataTypeInt | ReadOnly) + 13, + ContactName = (PropertyContact | DataTypeRecord) + 14, + ContactCompany = (PropertyContact | DataTypeRecord) + 15, + ContactNote = (PropertyContact | DataTypeRecord) + 16, + ContactNumber = (PropertyContact | DataTypeRecord) + 17, + ContactEmail = (PropertyContact | DataTypeRecord) + 18, + ContactEvent = (PropertyContact | DataTypeRecord) + 19, + ContactMessenger = (PropertyContact | DataTypeRecord) + 20, + ContactAddress = (PropertyContact | DataTypeRecord) + 21, + ContactUrl = (PropertyContact | DataTypeRecord) + 22, + ContactNickname = (PropertyContact | DataTypeRecord) + 23, + ContactProfile = (PropertyContact | DataTypeRecord) + 24, + ContactRelationship = (PropertyContact | DataTypeRecord) + 25, + ContactGroupRelation = (PropertyContact | DataTypeRecord) + 26, + ContactExtension = (PropertyContact | DataTypeRecord) + 27, + ContactLinkMode = (PropertyContact | DataTypeInt) + 28, + ContactMessageAlert = (PropertyContact | DataTypeString) + 29, + ContactSip = (PropertyContact | DataTypeRecord) + 30, + + /* my_profile */ + MyProfileId = (PropertyMyProfile | DataTypeInt | ReadOnly), + MyProfileDisplayName = (PropertyMyProfile | DataTypeString | ReadOnly) + 1, + MyProfileAddressbookId = (PropertyMyProfile | DataTypeInt) + 2, + MyProfileImage = (PropertyMyProfile | DataTypeRecord) + 3, + MyProfileThumbnail = (PropertyMyProfile | DataTypeString | ReadOnly) + 4, + MyProfileUid = (PropertyMyProfile | DataTypeString) + 5, + MyProfileChangedTime = (PropertyMyProfile | DataTypeInt) + 6, + MyProfileName = (PropertyMyProfile | DataTypeRecord) + 7, + MyProfileCompany = (PropertyMyProfile | DataTypeRecord) + 8, + MyProfileNote = (PropertyMyProfile | DataTypeRecord) + 9, + MyProfileNumber = (PropertyMyProfile | DataTypeRecord) + 10, + MyProfileEmail = (PropertyMyProfile | DataTypeRecord) + 11, + MyProfileEvent = (PropertyMyProfile | DataTypeRecord) + 12, + MyProfileMessenger = (PropertyMyProfile | DataTypeRecord) + 13, + MyProfileAddress = (PropertyMyProfile | DataTypeRecord) + 14, + MyProfileUrl = (PropertyMyProfile | DataTypeRecord) + 15, + MyProfileNickname = (PropertyMyProfile | DataTypeRecord) + 16, + MyProfileProfile = (PropertyMyProfile | DataTypeRecord) + 17, + MyProfileRelationship = (PropertyMyProfile | DataTypeRecord) + 18, + MyProfileExtension = (PropertyMyProfile | DataTypeRecord) + 19, + MyProfileSip = (PropertyMyProfile | DataTypeRecord) + 20, + + /* data */ + DataId = (PropertyData | DataTypeInt), + DataContactId = (PropertyData | DataTypeInt) + 1, + DataType = (PropertyData | DataTypeInt) + 2, + DataIsPrimaryDefault = (PropertyData | DataTypeBool) + 3, + DataIsDefault = (PropertyData | DataTypeBool) + 4, + DataData1 = (PropertyData | DataTypeInt) + 5, + DataData2 = (PropertyData | DataTypeString) + 6, + DataData3 = (PropertyData | DataTypeString) + 7, + DataData4 = (PropertyData | DataTypeString) + 8, + DataData5 = (PropertyData | DataTypeString) + 9, + DataData6 = (PropertyData | DataTypeString) + 10, + DataData7 = (PropertyData | DataTypeString) + 11, + DataData8 = (PropertyData | DataTypeString) + 12, + DataData9 = (PropertyData | DataTypeString) + 13, + DataData10 = (PropertyData | DataTypeString) + 14, + + /* contact_name */ + NameId = (PropertyName | DataTypeInt | ReadOnly), + NameContactId = (PropertyName | DataTypeInt) + 1, + NameFirst = (PropertyName | DataTypeString) + 2, + NameLast = (PropertyName | DataTypeString) + 3, + NameAddition = (PropertyName | DataTypeString) + 4, + NameSuffix = (PropertyName | DataTypeString) + 5, + NamePrefix = (PropertyName | DataTypeString) + 6, + NamePhoneticFirst = (PropertyName | DataTypeString) + 7, + NamePhoneticMiddle = (PropertyName | DataTypeString) + 8, + NamePhoneticLast = (PropertyName | DataTypeString) + 9, + + /* contact_number */ + NumberId = (PropertyNumber | DataTypeInt | ReadOnly), + NumberContactId = (PropertyNumber | DataTypeInt) + 1, + NumberType = (PropertyNumber | DataTypeInt) + 2, + NumberLabel = (PropertyNumber | DataTypeString) + 3, + NumberIsDefault = (PropertyNumber | DataTypeBool) + 4, + NumberNumber = (PropertyNumber | DataTypeString) + 5, + NumberNumberFilter = (PropertyNumber | DataTypeString) + 6, + NumberNormalizedNumber = (PropertyNumber | DataTypeString | ReadOnly) + 7, + NumberCleanedNumber = (PropertyNumber | DataTypeString | ReadOnly) + 8, + + /* contact_email */ + EmailId = (PropertyEmail | DataTypeInt | ReadOnly), + EmailContactId = (PropertyEmail | DataTypeInt) + 1, + EmailType = (PropertyEmail | DataTypeInt) + 2, + EmailLabel = (PropertyEmail | DataTypeString) + 3, + EmailIsDefault = (PropertyEmail | DataTypeBool) + 4, + EmailEmail = (PropertyEmail | DataTypeString) + 5, + + /* contact_address */ + AddressId = (PropertyAddress | DataTypeInt | ReadOnly), + AddressContactId = (PropertyAddress | DataTypeInt) + 1, + AddressType = (PropertyAddress | DataTypeInt) + 2, + AddressLabel = (PropertyAddress | DataTypeString) + 3, + AddressPostbox = (PropertyAddress | DataTypeString) + 4, + AddressPostalCode = (PropertyAddress | DataTypeString) + 5, + AddressRegion = (PropertyAddress | DataTypeString) + 6, + AddressLocality = (PropertyAddress | DataTypeString) + 7, + AddressStreet = (PropertyAddress | DataTypeString) + 8, + AddressCountry = (PropertyAddress | DataTypeString) + 9, + AddressExtended = (PropertyAddress | DataTypeString) + 10, + AddressIsDefault = (PropertyAddress | DataTypeBool) + 11, + + /* contact_url */ + UrlId = (PropertyUrl | DataTypeInt | ReadOnly), + UrlContactId = (PropertyUrl | DataTypeInt) + 1, + UrlType = (PropertyUrl | DataTypeInt) + 2, + UrlLabel = (PropertyUrl | DataTypeString) + 3, + UrlUrl = (PropertyUrl | DataTypeString) + 4, + + /* contact_event */ + EventId = (PropertyEvent | DataTypeInt | ReadOnly), + EventContactId = (PropertyEvent | DataTypeInt) + 1, + EventType = (PropertyEvent | DataTypeInt) + 2, + EventLabel = (PropertyEvent | DataTypeString) + 3, + EventDate = (PropertyEvent | DataTypeInt) + 4, + EventCalendarType = (PropertyEvent | DataTypeInt) + 5, + EventIsLeapMonth = (PropertyEvent | DataTypeBool) + 6, + + /* contact_grouprelation */ + GroupRelationId = (PropertyGroupRelation | DataTypeInt | ReadOnly), + GroupRelationGroupId = (PropertyGroupRelation | DataTypeInt) + 1, + GroupRelationContactId = (PropertyGroupRelation | DataTypeInt) + 2, + GroupRelationGroupName = (PropertyGroupRelation | DataTypeString) + 3, + + /* contact_relationship */ + RelationshipId = (PropertyRelationship | DataTypeInt | ReadOnly), + RelationshipContactId = (PropertyRelationship | DataTypeInt) + 1, + RelationshipType = (PropertyRelationship | DataTypeInt) + 2, + RelationshipLabel = (PropertyRelationship | DataTypeString) + 3, + RelationshipName = (PropertyRelationship | DataTypeString) + 4, + + /* contact_image */ + ImageId = (PropertyImage | DataTypeInt | ReadOnly), + ImageContactId = (PropertyImage | DataTypeInt) + 1, + ImageType = (PropertyImage | DataTypeInt) + 2, + ImageLabel = (PropertyImage | DataTypeString) + 3, + ImagePath = (PropertyImage | DataTypeString) + 4, + ImageIsDefault = (PropertyImage | DataTypeBool) + 5, + + /* contact_company */ + CompanyId = (PropertyCompany | DataTypeInt | ReadOnly), + CompanyContactId = (PropertyCompany | DataTypeInt) + 1, + CompanyType = (PropertyCompany | DataTypeInt) + 2, + CompanyLabel = (PropertyCompany | DataTypeString) + 3, + CompanyName = (PropertyCompany | DataTypeString) + 4, + CompanyDepartment = (PropertyCompany | DataTypeString) + 5, + CompanyJobTitle = (PropertyCompany | DataTypeString) + 6, + CompanyRole = (PropertyCompany | DataTypeString) + 7, + CompanyAssistantName = (PropertyCompany | DataTypeString) + 8, + CompanyLogo = (PropertyCompany | DataTypeString) + 9, + CompanyLocation = (PropertyCompany | DataTypeString) + 10, + CompanyDescription = (PropertyCompany | DataTypeString) + 11, + CompanyPhoneticName = (PropertyCompany | DataTypeString) + 12, + + /* contact_nickname */ + NicknameId = (PropertyNickname | DataTypeInt | ReadOnly), + NicknameContactId = (PropertyNickname | DataTypeInt) + 1, + NicknameName = (PropertyNickname | DataTypeString) + 2, + + /* contact_messenger */ + MessengerId = (PropertyMessenger | DataTypeInt | ReadOnly), + MessengerContactId = (PropertyMessenger | DataTypeInt) + 1, + MessengerType = (PropertyMessenger | DataTypeInt) + 2, + MessengerLabel = (PropertyMessenger | DataTypeString) + 3, + MessengerIMId = (PropertyMessenger | DataTypeString) + 4, + + /* contact_note */ + NoteId = (PropertyNote | DataTypeInt | ReadOnly), + NoteContactId = (PropertyNote | DataTypeInt) + 1, + NoteNote = (PropertyNote | DataTypeString) + 2, + + /* contact sip */ + SipId = (PropertySip | DataTypeInt | ReadOnly), + SipContactId = (PropertySip | DataTypeInt) + 1, + SipAddress = (PropertySip | DataTypeString) + 2, + SipType = (PropertySip | DataTypeInt) + 3, + SipLabel = (PropertySip | DataTypeString) + 4, + + /* contact_profile */ + ProfileId = (PropertyProfile | DataTypeInt | ReadOnly), + ProfileContactId = (PropertyProfile | DataTypeInt) + 1, + ProfileUid = (PropertyProfile | DataTypeString) + 2, + ProfileText = (PropertyProfile | DataTypeString) + 3, + ProfileOrder = (PropertyProfile | DataTypeInt) + 4, + ProfileServiceOperation = (PropertyProfile | DataTypeString) + 5, + ProfileMIME = (PropertyProfile | DataTypeString) + 6, + ProfileAppId = (PropertyProfile | DataTypeString) + 7, + ProfileUri = (PropertyProfile | DataTypeString) + 8, + ProfileCategory = (PropertyProfile | DataTypeString) + 9, + ProfileExtraData = (PropertyProfile | DataTypeString) + 10, + + ExtensionId = (PropertyExtension | DataTypeInt | ReadOnly), + ExtensionContactId = (PropertyExtension | DataTypeInt) +1, + ExtensionData1 = (PropertyExtension | DataTypeInt) +2, + ExtensionData2 = (PropertyExtension | DataTypeString) +3, + ExtensionData3 = (PropertyExtension | DataTypeString) +4, + ExtensionData4 = (PropertyExtension | DataTypeString) +5, + ExtensionData5 = (PropertyExtension | DataTypeString) +6, + ExtensionData6 = (PropertyExtension | DataTypeString) +7, + ExtensionData7 = (PropertyExtension | DataTypeString) +8, + ExtensionData8 = (PropertyExtension | DataTypeString) +9, + ExtensionData9 = (PropertyExtension | DataTypeString) +10, + ExtensionData10 = (PropertyExtension | DataTypeString) +11, + ExtensionData11 = (PropertyExtension | DataTypeString) +12, + ExtensionData12 = (PropertyExtension | DataTypeString) +13, + + /* speeddial */ + SpeedDialDialNumber = (PropertySpeedDial | DataTypeInt), + SpeedDialNumberId = (PropertySpeedDial | DataTypeInt) +1, + SpeedDialNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +2, + SpeedDialNumberLabel = (PropertySpeedDial | DataTypeString | ReadOnly) +3, + SpeedDialNumberType = (PropertySpeedDial | DataTypeInt | ReadOnly) +4, + SpeedDialPersonId = (PropertySpeedDial | DataTypeInt | ReadOnly) +5, + SpeedDialDisplayName = (PropertySpeedDial | DataTypeString | ReadOnly) +6, + SpeedDialThumbnail = (PropertySpeedDial | DataTypeString | ReadOnly) +7, + SpeedDialNormalizedNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +8, + SpeedDialCleanedNumber = (PropertySpeedDial | DataTypeString | ReadOnly) +9, + SpeedDialNumberFilter = (PropertySpeedDial | DataTypeString | ReadOnly) +10, + + /* phonelog */ + PhonelogId = (PropertyPhonelog | DataTypeInt | ReadOnly), + PhonelogPersonId = (PropertyPhonelog | DataTypeInt) + 1, + PhonelogAddress = (PropertyPhonelog | DataTypeString) + 2, + PhonelogLogTime = (PropertyPhonelog | DataTypeInt) + 3, + PhonelogLogType = (PropertyPhonelog | DataTypeInt) + 4, + PhonelogExtraData1 = (PropertyPhonelog | DataTypeInt) + 5, /* duration, message_id, email_id */ + PhonelogExtraData2 = (PropertyPhonelog | DataTypeString) + 6, /* short message, subject */ + PhonelogNormalizedAddress = (PropertyPhonelog | DataTypeString | ReadOnly) + 7, /* for search by calllog number */ + PhonelogCleanedAddress = (PropertyPhonelog | DataTypeString | ReadOnly) + 8, /* for search by calllog number */ + PhonelogAddressFilter = (PropertyPhonelog | DataTypeString | ReadOnly) + 9, /* for search by calllog number */ + PhonelogSIMSlotNo = (PropertyPhonelog | DataTypeInt) + 10, + + /* phonelog_stat */ + PhonelogStatLogCount = (PropertyPhonelogStat | DataTypeInt | ReadOnly), + PhonelogStatLogType = (PropertyPhonelogStat | DataTypeInt | ReadOnly) + 1, + PhonelogStatSIMSlotNo = (PropertyPhonelogStat | DataTypeInt | ReadOnly) + 2, + + /* updated_info : read only */ + UpdateInfoId = (PropertyUpdateInfo | DataTypeInt), + UpdateInfoAddressbookId = (PropertyUpdateInfo | DataTypeInt) +1, + UpdateInfoType = (PropertyUpdateInfo | DataTypeInt) +2, + UpdateInfoVersion = (PropertyUpdateInfo | DataTypeInt) +3, + UpdateInfoImageChanged = (PropertyUpdateInfo | DataTypeBool) +4, + UpdateInfoLastChangedType = (PropertyUpdateInfo | DataTypeInt)+5, /* now, it is used for _contacts_my_profile_updated_info */ + } + + /// + /// Enumeration for contact change state. + /// + public enum ChangeTypes + { + /// + /// Inserted + /// + Inserted, + /// + /// Updated + /// + Updated, + /// + /// Deleted + /// + Deleted, + } + + internal const uint AverageSizeOfRecord = 120; /* average size of person record */ + + /// + /// Describes properies of a Address book record. + /// + public static class Addressbook + { + /// + /// Identifier of this contacts addressbook view + /// + public const string Uri = "tizen.contacts_view.addressbook"; + /// + /// integer, read only, DB record ID of the addressbook + /// + public const uint Id = (uint)PropertyIds.AddressbookId; + /// + /// integer, read/write once, Account ID that the addressbook belongs to + /// + public const uint AccountId = (uint)PropertyIds.AddressbookAccountId; + /// + /// string, read/write, It cannot be NULL. Duplicate names are not allowed. + /// + public const uint Name = (uint)PropertyIds.AddressbookName; + /// + /// integer, read/write, Addressbook mode, refer to the Modes + /// + public const uint Mode = (uint)PropertyIds.AddressbookMode; + + /// + /// Enumeration for Address book mode. + /// + public enum Modes + { + /// + /// All module can read and write contacts of this address_book + /// + None, + /// + /// All module can only read contacts of this address_book + /// + ReadOnly, + } + } + + /// + /// Describes properies of a Group record. + /// + public static class Group + { + /// + /// Identifier of this contacts group view + /// + public const string Uri = "tizen.contacts_view.group"; + /// + /// DB record ID of the group + /// + public const uint Id = (uint)PropertyIds.GroupId; + /// + /// Addressbook ID that the group belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.GroupAddressbookId; + /// + /// Group name + /// + public const uint Name = (uint)PropertyIds.GroupName; + /// + /// Ringtone path of the group + /// + public const uint RingtonePath = (uint)PropertyIds.GroupRingtone; + /// + /// Image path of the group + /// + public const uint ImagePath = (uint)PropertyIds.GroupImage; + /// + /// Vibration path of the group + /// + public const uint Vibration = (uint)PropertyIds.GroupVibration; + /// + /// Extra data for default group name + /// + public const uint ExtraData = (uint)PropertyIds.GroupExtraData; + /// + /// The group is read only or not + /// + public const uint IsReadOnly = (uint)PropertyIds.GroupIsReadOnly; + /// + /// Message alert path of the group + /// + public const uint MessageAlert = (uint)PropertyIds.GroupMessageAlert; + } + + /// + /// Describes properies of a Person record. + /// + public static class Person + { + /// + /// Identifier of this contacts person view + /// + public const string Uri = "tizen.contacts_view.person"; + /// + /// DB record ID of the person + /// + public const uint Id = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// Status of social account + /// + public const uint Status = (uint)PropertyIds.PersonStatus; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The priority of favorite contacts. it can be used as sorting key + /// + public const uint FavoritePriority = (uint)PropertyIds.PersonFavoritePriority; + /// + /// Link count of contact records (projection) + /// + public const uint LinkCount = (uint)PropertyIds.PersonLinkCount; + /// + /// Addressbook IDs that the person belongs to (projection) + /// + public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// kerword matched data type + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + } + + /// + /// Describes properies of a Contact record. + /// + public static class Contact + { + /// + /// Identifier of this contact view + /// + public const string Uri = "tizen.contacts_view.contact"; + /// + /// DB record ID of the contact + /// + public const uint Id = (uint)PropertyIds.ContactId; + /// + /// Display name of the contact + /// + public const uint DisplayName = (uint)PropertyIds.ContactDisplayName; + /// + /// The source type of display name, refer to the DisplayNameSourceTypes + /// + public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId; + /// + /// Addressbook ID that the contact belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Ringtone path of the contact + /// + public const uint RingtonePath = (uint)PropertyIds.ContactRingtone; + /// + /// Image thumbnail path of the contact + /// + public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail; + /// + /// The contact is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.ContactIsFavorite; + /// + /// The contact has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.ContactHasPhoneNumber; + /// + /// The contact has email or not + /// + public const uint HasEmail = (uint)PropertyIds.ContactHasEmail; + /// + /// Person ID that the contact belongs to. If set when inserting, a contact will be linked to person + /// + public const uint PersonId = (uint)PropertyIds.ContactPersonId; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.ContactUid; + /// + /// Vibration path of the contact + /// + public const uint Vibration = (uint)PropertyIds.ContactVibration; + /// + /// Message alert path of the contact + /// + public const uint MessageAlert = (uint)PropertyIds.ContactMessageAlert; + /// + /// Last changed contact time + /// + public const uint ChangedTime = (uint)PropertyIds.ContactChangedTime; + /// + /// The link mode, refer to the LinkModes. If the person_id was set, this value will be ignored + /// + public const uint LinkMode = (uint)PropertyIds.ContactLinkMode; + /// + /// Name child record (single) + /// + public const uint Name = (uint)PropertyIds.ContactName; + /// + /// Company child record (multiple) + /// + public const uint Company = (uint)PropertyIds.ContactCompany; + /// + /// Note child record (multiple) + /// + public const uint Note = (uint)PropertyIds.ContactNote; + /// + /// Number child record (multiple) + /// + public const uint Number = (uint)PropertyIds.ContactNumber; + /// + /// Email child record (multiple) + /// + public const uint Email = (uint)PropertyIds.ContactEmail; + /// + /// Event child record (multiple) + /// + public const uint Event = (uint)PropertyIds.ContactEvent; + /// + /// Messenger child record (multiple) + /// + public const uint Messenger = (uint)PropertyIds.ContactMessenger; + /// + /// Address child record (multiple) + /// + public const uint Address = (uint)PropertyIds.ContactAddress; + /// + /// Url child record (multiple) + /// + public const uint Url = (uint)PropertyIds.ContactUrl; + /// + /// Nickname child record (multiple) + /// + public const uint Nickname = (uint)PropertyIds.ContactNickname; + /// + /// Profile child record (multiple) + /// + public const uint Profile = (uint)PropertyIds.ContactProfile; + /// + /// Relationship child record (multiple) + /// + public const uint Relationship = (uint)PropertyIds.ContactRelationship; + /// + /// Image child record (multiple) + /// + public const uint Image = (uint)PropertyIds.ContactImage; + /// + /// GroupRelation child record (multiple) + /// + public const uint GroupRelation = (uint)PropertyIds.ContactGroupRelation; + /// + /// Extension child record (multiple) + /// + public const uint Extension = (uint)PropertyIds.ContactExtension; + /// + /// Sip child record (multiple) + /// + public const uint Sip = (uint)PropertyIds.ContactSip; + + /// + /// Enumeration for link mode when inserting contact. + /// + public enum LinkModes + { + /// + /// Auto link immediately + /// + Auto, + /// + /// Do not auto link when the contact is inserted + /// + None + } + + /// + /// Enumeration for Contact display name source type. + /// + public enum DisplayNameSourceTypes + { + /// + /// Invalid source of display name + /// + Invalid, + /// + /// Produced display name from email record + /// + Email, + /// + /// Produced display name from number record + /// + Number, + /// + /// Produced display name from nickname record + /// + Nickname, + /// + /// Produced display name from company record + /// + Company, + /// + /// Produced display name from name record + /// + Name, + } + + /// + /// Enumeration for contacts data type. + /// + public enum DataTypes + { + Name = 1, + Address = 2, + Messenger = 3, + Url = 4, + Event = 5, + Company = 6, + Nickname = 7, + Number = 8, + Email = 9, + Profile = 10, + Relationsip = 11, + Note = 12, + Image = 13, + Sip = 14, + Extension = 100 + } + } + + /// + /// Describes properies of a Simple contact record. + /// + public static class SimpleContact + { + /// + /// Identifier of this simple contact view + /// + public const string Uri = "tizen.contacts_view.simple_contact"; + /// + /// DB record ID of the contact + /// + public const uint Id = (uint)PropertyIds.ContactId; + /// + /// Display name of the contact + /// + public const uint DisplayName = (uint)PropertyIds.ContactDisplayName; + /// + /// The source type of display name, refer to the Contact.DisplayNameSourceTypes + /// + public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId; + /// + /// Addressbook that the contact belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Ringtone path of the contact + /// + public const uint RingtonePath = (uint)PropertyIds.ContactRingtone; + /// + /// Image thumbnail path of the contact + /// + public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail; + /// + /// The contact is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.ContactIsFavorite; + /// + /// The contact has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.ContactHasPhoneNumber; + /// + /// The contact has email or not + /// + public const uint HasEmail = (uint)PropertyIds.ContactHasEmail; + /// + /// Person ID that the contact belongs to + /// + public const uint PersonId = (uint)PropertyIds.ContactPersonId; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.ContactUid; + /// + /// Vibration path of the contact + /// + public const uint Vibration = (uint)PropertyIds.ContactVibration; + /// + /// Message alert path of the contact + /// + public const uint MessageAlert = (uint)PropertyIds.ContactMessageAlert; + /// + /// Last changed contact time + /// + public const uint ChangedTime = (uint)PropertyIds.ContactChangedTime; + } + + /// + /// Describes properies of a My profile record. + /// + public static class MyProfile + { + /// + /// Identifier of this my profile view + /// + public const string Uri = "tizen.contacts_view.my_profile"; + /// + /// DB record ID of the my profile + /// + public const uint Id = (uint)PropertyIds.MyProfileId; + /// + /// Display name of the profile + /// + public const uint DisplayName = (uint)PropertyIds.MyProfileDisplayName; + /// + /// Addressbook ID that the profile belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.MyProfileAddressbookId; + /// + /// Image thumbnail path of the profile + /// + public const uint ThumbnailPath = (uint)PropertyIds.MyProfileThumbnail; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.MyProfileUid; + /// + /// Last changed profile time + /// + public const uint ChangedTime = (uint)PropertyIds.MyProfileChangedTime; + /// + /// Name child record (single) + /// + public const uint Name = (uint)PropertyIds.MyProfileName; + /// + /// Company child record (multiple) + /// + public const uint Company = (uint)PropertyIds.MyProfileCompany; + /// + /// Note child record (multiple) + /// + public const uint Note = (uint)PropertyIds.MyProfileNote; + /// + /// Number child record (multiple) + /// + public const uint Number = (uint)PropertyIds.MyProfileNumber; + /// + /// Email child record (multiple) + /// + public const uint Email = (uint)PropertyIds.MyProfileEmail; + /// + /// Event child record (multiple) + /// + public const uint Event = (uint)PropertyIds.MyProfileEvent; + /// + /// Messenger child record (multiple) + /// + public const uint Messenger = (uint)PropertyIds.MyProfileMessenger; + /// + /// Address child record (multiple) + /// + public const uint Address = (uint)PropertyIds.MyProfileAddress; + /// + /// Url child record (multiple) + /// + public const uint Url = (uint)PropertyIds.MyProfileUrl; + /// + /// Nickname child record (multiple) + /// + public const uint Nickname = (uint)PropertyIds.MyProfileNickname; + /// + /// Profile child record (multiple) + /// + public const uint Profile = (uint)PropertyIds.MyProfileProfile; + /// + /// Relationship child record (multiple) + /// + public const uint Relationship = (uint)PropertyIds.MyProfileRelationship; + /// + /// Image child record (multiple) + /// + public const uint Image = (uint)PropertyIds.MyProfileImage; + /// + /// Extension child record (multiple) + /// + public const uint Extension = (uint)PropertyIds.MyProfileExtension; + /// + /// Sip child record (multiple) + /// + public const uint Sip = (uint)PropertyIds.MyProfileSip; + } + + /// + /// Describes properies of a Name record. + /// + public static class Name + { + /// + /// Identifier of this contacts name view + /// + public const string Uri = "tizen.contacts_view.name"; + /// + /// DB record ID of the name + /// + public const uint Id = (uint)PropertyIds.NameId; + /// + /// Contacts ID that the name record belongs to + /// + public const uint ContactId = (uint)PropertyIds.NameContactId; + /// + /// First name + /// + public const uint First = (uint)PropertyIds.NameFirst; + /// + /// Last name + /// + public const uint Last = (uint)PropertyIds.NameLast; + /// + /// Middle name + /// + public const uint Addition = (uint)PropertyIds.NameAddition; + /// + /// Suffix + /// + public const uint Suffix = (uint)PropertyIds.NameSuffix; + /// + /// Prefix + /// + public const uint Prefix = (uint)PropertyIds.NamePrefix; + /// + /// Pronounce the first name + /// + public const uint PhoneticFirst = (uint)PropertyIds.NamePhoneticFirst; + /// + /// Pronounce the middle name + /// + public const uint PhoneticMiddle = (uint)PropertyIds.NamePhoneticMiddle; + /// + /// Pronounce the last name + /// + public const uint PhoneticLast = (uint)PropertyIds.NamePhoneticLast; + } + + /// + /// Describes properies of a Number record. + /// + public static class Number + { + /// + /// Identifier of this contacts number view + /// + public const string Uri = "tizen.contacts_view.number"; + /// + /// DB record ID of the number + /// + public const uint Id = (uint)PropertyIds.NumberId; + /// + /// Contact ID that the number belongs to + /// + public const uint ContactId = (uint)PropertyIds.NumberContactId; + /// + /// Number type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.NumberType; + /// + /// Custom number type label, when the number type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.NumberLabel; + /// + /// The number is default number or not + /// + public const uint IsDefault = (uint)PropertyIds.NumberIsDefault; + /// + /// Number + /// + public const uint NumberData = (uint)PropertyIds.NumberNumber; + /// + /// You can only use this property for search filter. + /// + public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber; + /// + /// You can only use this property for search filter. + /// + public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber; + /// + /// You can only use this property for search filter. + /// + public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter; + + /// + /// Enumeration for number type. + /// + public enum Types + { + /// + /// Other number type + /// + Other = 0, + /// + /// Custom number type + /// + Custom = 1 << 0, + /// + /// A telephone number associated with a residence + /// + Home = 1 << 1, + /// + /// A telephone number associated with a place of work + /// + Work = 1 << 2, + /// + /// A voice telephone number + /// + Voice = 1 << 3, + /// + /// A facsimile telephone number + /// + Fax = 1 << 4, + /// + /// The telephone number has voice messaging support + /// + Message = 1 << 5, + /// + /// A cellular telephone number + /// + Cell = 1 << 6, + /// + /// A paging device telephone number + /// + Pager = 1 << 7, + /// + /// A bulletin board system telephone number + /// + BBS = 1 << 8, + /// + /// A MODEM connected telephone number + /// + Modem = 1 << 9, + /// + /// A car-phone telephone number + /// + Car = 1 << 10, + /// + /// An ISDN service telephone number + /// + ISDN = 1 << 11, + /// + /// A video conferencing telephone number + /// + Video = 1 << 12, + /// + /// A personal communication services telephone number + /// + PCS = 1 << 13, + /// + /// A company main number + /// + Company = 1 << 14, + /// + /// A radio phone number + /// + Radio = 1 << 15, + /// + /// An additional type for main + /// + Main = 1 << 29, + /// + /// An additional type for assistant + /// + Assistant = 1 << 30, + } + } + + /// + /// Describes properies of a Email record. + /// + public static class Email + { + /// + /// Identifier of this contacts email view + /// + public const string Uri = "tizen.contacts_view.email"; + /// + /// DB record ID of the email + /// + public const uint Id = (uint)PropertyIds.EmailId; + /// + /// Contact ID that the email belongs to + /// + public const uint ContactId = (uint)PropertyIds.EmailContactId; + /// + /// Email type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.EmailType; + /// + /// Custom mail type label, when the email type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.EmailLabel; + /// + /// The email is default email or not + /// + public const uint IsDefault = (uint)PropertyIds.EmailIsDefault; + /// + /// Email address + /// + public const uint Address = (uint)PropertyIds.EmailEmail; + + /// + /// Enumeration for Contact email type. + /// + public enum Types + { + /// + /// Other email type + /// + Other = 0, + /// + /// Custom email type + /// + Custom = 1 << 0, + /// + /// An email address associated with a residence + /// + Home = 1 << 1, + /// + /// An email address associated with a place of work + /// + Work = 1 << 2, + /// + /// A mobile email address + /// + Mobile = 1 << 3, + } + } + + /// + /// Describes properies of a Address record. + /// + public static class Address + { + /// + /// Identifier of this contacts address view + /// + public const string Uri = "tizen.contacts_view.address"; + /// + /// DB record ID of the address + /// + public const uint Id = (uint)PropertyIds.AddressId; + /// + /// Contact ID that the address belongs to + /// + public const uint ContactId = (uint)PropertyIds.AddressContactId; + /// + /// Address type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.AddressType; + /// + /// Address type label, when the address type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.AddressLabel; + /// + /// Post office box + /// + public const uint Postbox = (uint)PropertyIds.AddressPostbox; + /// + /// Postal code + /// + public const uint PostalCode = (uint)PropertyIds.AddressPostalCode; + /// + /// Region + /// + public const uint Region = (uint)PropertyIds.AddressRegion; + /// + /// Locality + /// + public const uint Locality = (uint)PropertyIds.AddressLocality; + /// + /// Street + /// + public const uint Street = (uint)PropertyIds.AddressStreet; + /// + /// Country + /// + public const uint Country = (uint)PropertyIds.AddressCountry; + /// + /// Extended address + /// + public const uint Extended = (uint)PropertyIds.AddressExtended; + /// + /// The address is default or not + /// + public const uint IsDefault = (uint)PropertyIds.AddressIsDefault; + + /// + /// Enumeration for Contact address type. + /// + public enum Types + { + /// + /// Other address type + /// + Other = 0, + /// + /// Custom address type + /// + Custom = 1 << 0, + /// + /// A delivery address for a residence + /// + Home = 1 << 1, + /// + /// A delivery address for a place of work + /// + Work = 1 << 2, + /// + /// A domestic delivery address + /// + Domestic = 1 << 3, + /// + /// An international delivery address + /// + International = 1 << 4, + /// + /// A postal delivery address + /// + Postal = 1 << 5, + /// + /// A parcel delivery address + /// + Parcel = 1 << 6, + } + } + + /// + /// Describes properies of a Note record. + /// + public static class Note + { + /// + /// Identifier of this contacts note view + /// + public const string Uri = "tizen.contacts_view.note"; + /// + /// DB record ID of the note + /// + public const uint Id = (uint)PropertyIds.NoteId; + /// + /// Contact ID that the note belongs to + /// + public const uint ContactId = (uint)PropertyIds.NoteContactId; + /// + /// Note contents + /// + public const uint Contents = (uint)PropertyIds.NoteNote; + } + + /// + /// Describes properies of a Url record. + /// + public static class Url + { + /// + /// Identifier of this contacts URL view + /// + public const string Uri = "tizen.contacts_view.url"; + /// + /// DB record ID of the URL + /// + public const uint Id = (uint)PropertyIds.UrlId; + /// + /// Contact ID that the URL belongs to + /// + public const uint ContactId = (uint)PropertyIds.UrlContactId; + /// + /// URL type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.UrlType; + /// + /// Custom URL type label, when the URL type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.UrlLabel; + /// + /// URL + /// + public const uint UrlData = (uint)PropertyIds.UrlUrl; + + /// + /// Enumeration for Contact URL type. + /// + public enum Types + { + /// + /// Other URL type + /// + Other, + /// + /// Custom URL type + /// + Custom, + /// + /// Home URL type + /// + Home, + /// + /// Work URL type + /// + Work, + } + } + + /// + /// Describes properies of a Event record. + /// + public static class Event + { + /// + /// Identifier of this contacts event view + /// + public const string Uri = "tizen.contacts_view.event"; + /// + /// DB record ID of the event + /// + public const uint Id = (uint)PropertyIds.EventId; + /// + /// Contact ID that the event belongs to + /// + public const uint ContactId = (uint)PropertyIds.EventContactId; + /// + /// Event type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.EventType; + /// + /// Custom event type label, when the event type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.EventLabel; + /// + /// Event date(YYYYMMDD). e.g. 2014/1/1 : 20140101. Even if the calendar_type is set as CONTACTS_EVENT_CALENDAR_TYPE_CHINESE, you SHOULD set Gregorian date + /// + public const uint Date = (uint)PropertyIds.EventDate; + /// + /// Calendar type, refer to the CalendarTypes + /// + public const uint IsLeapMonth = (uint)PropertyIds.EventIsLeapMonth; + + /// + /// Enumeration for Contact event type. + /// + public enum Types + { + /// + /// Other event type + /// + Other, + /// + /// Custom event type + /// + Custom, + /// + /// Birthday event type + /// + Birthday, + /// + /// Anniversary event type + /// + Anniversary + } + + /// + /// Enumeration for Contact event calendar type. + /// + public enum CalendarTypes + { + /// + /// Gregorian calendar + /// + Gregorian, + /// + /// Chinese calenadr + /// + Chinese + } + } + + /// + /// Describes properies of a Relationship record. + /// + public static class Relationship + { + /// + /// Identifier of this relationship view + /// + public const string Uri = "tizen.contacts_view.relationship"; + /// + /// DB record ID of the relationship + /// + public const uint Id = (uint)PropertyIds.RelationshipId; + /// + /// Contact ID that the relationship belongs to + /// + public const uint ContactId = (uint)PropertyIds.RelationshipContactId; + /// + /// Relationship type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.RelationshipType; + /// + /// Custom relationship type label, when the relationship type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.RelationshipLabel; + /// + /// Selected contact name that the relationship belongs to + /// + public const uint Name = (uint)PropertyIds.RelationshipName; + + /// + /// Enumeration for Contact relationship type. + /// + public enum Types + { + /// + /// Other relationship type + /// + Other, + /// + /// Assistant type + /// + Assistant, + /// + /// Brother type + /// + Brother, + /// + /// Child type + /// + Child, + /// + /// Domestic Partner type + /// + DomesticPartner, + /// + /// Father type + /// + Father, + /// + /// Friend type + /// + Friend, + /// + /// Manager type + /// + Manager, + /// + /// Mother type + /// + Mother, + /// + /// Parent type + /// + Parent, + /// + /// Partner type + /// + Partner, + /// + /// Referred by type + /// + ReferredBy, + /// + /// Relative type + /// + Relative, + /// + /// Sister type + /// + Sister, + /// + /// Spouse type + /// + Spouse, + /// + /// Custom type + /// + Custom, + } + } + + /// + /// Describes properies of a Image record. + /// + public static class Image + { + /// + /// Identifier of this contacts image view + /// + public const string Uri = "tizen.contacts_view.image"; + /// + /// DB record ID of the image + /// + public const uint Id = (uint)PropertyIds.ImageId; + /// + /// Contact ID that the image belongs to + /// + public const uint ContactId = (uint)PropertyIds.ImageContactId; + /// + /// Image type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.ImageType; + /// + /// Custom image type label, when the image type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.ImageLabel; + /// + /// Image thumbnail path + /// + public const uint Path = (uint)PropertyIds.ImagePath; + /// + /// The Image is default or not + /// + public const uint IsDefault = (uint)PropertyIds.ImageIsDefault; + + /// + /// Enumeration for Contact image type. + /// + public enum Types + { + /// + /// Other type + /// + Other, + /// + /// Custom type + /// + Custom, + } + } + + /// + /// Describes properies of a Company record. + /// + public static class Company + { + /// + /// Identifier of this contacts company view + /// + public const string Uri = "tizen.contacts_view.company"; + /// + /// DB record ID of the company + /// + public const uint Id = (uint)PropertyIds.CompanyId; + /// + /// Contact ID that the company belongs to + /// + public const uint ContactId = (uint)PropertyIds.CompanyContactId; + /// + /// Company type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.CompanyType; + /// + /// Custom company type label, when the company type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.CompanyLabel; + /// + /// Company name + /// + public const uint Name = (uint)PropertyIds.CompanyName; + /// + /// Department + /// + public const uint Department = (uint)PropertyIds.CompanyDepartment; + /// + /// Job title + /// + public const uint JobTitle = (uint)PropertyIds.CompanyJobTitle; + /// + /// Assistant name + /// + public const uint AssistantName = (uint)PropertyIds.CompanyAssistantName; + /// + /// Role + /// + public const uint Role = (uint)PropertyIds.CompanyRole; + /// + /// Company logo image file path + /// + public const uint Logo = (uint)PropertyIds.CompanyLogo; + /// + /// Company location + /// + public const uint Location = (uint)PropertyIds.CompanyLocation; + /// + /// Description + /// + public const uint Description = (uint)PropertyIds.CompanyDescription; + /// + /// Pronounce the company name + /// + public const uint PhoneticName = (uint)PropertyIds.CompanyPhoneticName; + + /// + /// Enumeration for Contact company type. + /// + public enum Types + { + Other = 0, /**< Other company type */ + Custom = 1 << 0, /**< Custom company type */ + Work = 1 << 1, /**< Work company type */ + } + } + + /// + /// Describes properies of a Nickname record. + /// + public static class Nickname + { + /// + /// Identifier of this contacts nickname view + /// + public const string Uri = "tizen.contacts_view.nickname"; + /// + /// DB record ID of the nickname + /// + public const uint Id = (uint)PropertyIds.NicknameId; + /// + /// Contact ID that the nickname belongs to + /// + public const uint ContactId = (uint)PropertyIds.NicknameContactId; + /// + /// Nickname + /// + public const uint Name = (uint)PropertyIds.NicknameName; + } + + /// + /// Describes properies of a Messenger record. + /// + public static class Messenger + { + /// + /// Identifier of this contacts messenger view + /// + public const string Uri = "tizen.contacts_view.messenger"; + /// + /// DB record ID of the messenger + /// + public const uint Id = (uint)PropertyIds.MessengerId; + /// + /// Contact ID that the messenger belongs to + /// + public const uint ContactId = (uint)PropertyIds.MessengerContactId; + /// + /// Messenger type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.MessengerType; + /// + /// Custom messenger type label, when the messenger type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.MessengerLabel; + /// + /// Messenger ID (email address or email ID...) + /// + public const uint IMId = (uint)PropertyIds.MessengerIMId; + + /// + /// Enumeration for Contact messenger type. + /// + public enum Types + { + /// + /// Other messenger type + /// + Other, + /// + /// Custom messenger type + /// + Custom, + /// + /// Google messenger type + /// + Google, + /// + /// Windows live messenger type + /// + WindowsLive, + /// + /// Yahoo messenger type + /// + Yahoo, + /// + /// Facebook messenger type + /// + Facebook, + /// + /// ICQ type + /// + ICQ, + /// + /// AOL instance messenger type + /// + AOL, + /// + /// QQ type + /// + QQ, + /// + /// Jabber type + /// + Jabber, + /// + /// Skype type + /// + Skype, + /// + /// IRC type + /// + IRC, + } + } + + /// + /// Describes properies of a Profile record. + /// + public static class Profile + { + /// + /// Identifier of this contacts profile view + /// + public const string Uri = "tizen.contacts_view.profile"; + /// + /// DB record ID of profile + /// + public const uint Id = (uint)PropertyIds.ProfileId; + /// + /// Contacts ID that the profile belongs to + /// + public const uint ContactId = (uint)PropertyIds.ProfileContactId; + /// + /// Unique identifier + /// + public const uint Uid = (uint)PropertyIds.ProfileUid; + /// + /// Profile contents + /// + public const uint Text = (uint)PropertyIds.ProfileText; + /// + /// Priority to display the profile + /// + public const uint Order = (uint)PropertyIds.ProfileOrder; + /// + /// Data for app_control_set_operation + /// + public const uint ServiceOperation = (uint)PropertyIds.ProfileServiceOperation; + /// + /// Data for app_control_set_mime + /// + public const uint Mime = (uint)PropertyIds.ProfileMIME; + /// + /// Data for app_control_set_app_id + /// + public const uint AppId = (uint)PropertyIds.ProfileAppId; + /// + /// Data for app_control_set_uri + /// + public const uint ProfileUri = (uint)PropertyIds.ProfileUri; + /// + /// Data for app_control_set_category + /// + public const uint Category = (uint)PropertyIds.ProfileCategory; + /// + /// It includes "key:value,key:value," pairs. You should parse it. And you must base64 encode each key and value + /// + public const uint ExtraData = (uint)PropertyIds.ProfileExtraData; + } + + /// + /// Describes properies of a Sip record. + /// + public static class Sip + { + /// + /// Identifier of this contacts sip view + /// + public const string Uri = "tizen.contacts_view.sip"; + /// + /// DB record ID of the sip + /// + public const uint Id = (uint)PropertyIds.SipId; + /// + /// Contact ID that the sip belongs to + /// + public const uint ContactId = (uint)PropertyIds.SipContactId; + /// + /// SIP address + /// + public const uint Address = (uint)PropertyIds.SipAddress; + /// + /// sip type, refer to the Types + /// + public const uint Type = (uint)PropertyIds.SipType; + /// + /// Custom sip type label, when the sip type is Types.Custom + /// + public const uint Label = (uint)PropertyIds.SipLabel; + + /// + /// Enumeration for Contact SIP type. + /// + public enum Types + { + /// + /// Other SIP type + /// + Other, + /// + /// Custom SIP type + /// + Custom, + /// + /// Home SIP type + /// + Home, + /// + /// Work SIP type + /// + Work, + } + } + + /// + /// Describes properies of a Extension record. + /// + public static class Extension + { + /// + /// Identifier of this contacts extension view + /// + public const string Uri = "tizen.contacts_view.extension"; + /// + /// DB record ID of the contact extension + /// + public const uint Id = (uint)PropertyIds.ExtensionId; + /// + /// Contact ID that the contact extension belongs to + /// + public const uint ContactId = (uint)PropertyIds.ExtensionContactId; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data1 = (uint)PropertyIds.ExtensionData1; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data2 = (uint)PropertyIds.ExtensionData2; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data3 = (uint)PropertyIds.ExtensionData3; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data4 = (uint)PropertyIds.ExtensionData4; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data5 = (uint)PropertyIds.ExtensionData5; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data6 = (uint)PropertyIds.ExtensionData6; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data7 = (uint)PropertyIds.ExtensionData7; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data8 = (uint)PropertyIds.ExtensionData8; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data9 = (uint)PropertyIds.ExtensionData9; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data10 = (uint)PropertyIds.ExtensionData10; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data11 = (uint)PropertyIds.ExtensionData11; + /// + /// The extra child record format for non-provided from contacts-service + /// + public const uint Data12 = (uint)PropertyIds.ExtensionData12; + } + + /// + /// Describes properies of a Group relation record. + /// + public static class GroupRelation + { + /// + /// Identifier of this relationship view + /// + public const string Uri = "tizen.contacts_view.group_relation"; + /// + /// DB record ID of the group relation (can not be used as filter) + /// + public const uint Id = (uint)PropertyIds.GroupRelationId; + /// + /// DB record ID of the group + /// + public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId; + /// + /// DB record ID of the contact + /// + public const uint ContactId = (uint)PropertyIds.GroupRelationContactId; + /// + /// Group name + /// + public const uint Name = (uint)PropertyIds.GroupRelationGroupName; + } + + /// + /// Describes properies of a Speed dial record. + /// + public static class SpeedDial + { + /// + /// Identifier of this contact speed dial view + /// + public const string Uri = "tizen.contacts_view.speeddial"; + /// + /// Stored speed dial number + /// + public const uint SpeedDialNumber = (uint)PropertyIds.SpeedDialDialNumber; + /// + /// Number ID that the speed dial belongs to + /// + public const uint NumberId = (uint)PropertyIds.SpeedDialNumberId; + /// + /// Contact number of specified speed dial + /// + public const uint Number = (uint)PropertyIds.SpeedDialNumber; + /// + /// Contact number label of specified speed dial, when the number type is Number.Types.Custom + /// + public const uint NumberLabel = (uint)PropertyIds.SpeedDialNumberLabel; + /// + /// Contact number type, refer to the Number.Types + /// + public const uint NumberType = (uint)PropertyIds.SpeedDialNumberType; + /// + /// Person ID that the speed dial belongs to + /// + public const uint PersonId = (uint)PropertyIds.SpeedDialPersonId; + /// + /// Display name that the speed dial belongs to + /// + public const uint DisplayName = (uint)PropertyIds.SpeedDialDisplayName; + /// + /// Image thumbnail path that the speed dial belongs to + /// + public const uint ThumbnailPath = (uint)PropertyIds.SpeedDialThumbnail; + /// + /// You can only use this property for search filter + /// + public const uint NormalizedNumber = (uint)PropertyIds.SpeedDialNormalizedNumber; + /// + /// You can only use this property for search filter + /// + public const uint CleanedNumber = (uint)PropertyIds.SpeedDialCleanedNumber; + /// + /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly + /// + public const uint NumberFilter = (uint)PropertyIds.SpeedDialNumberFilter; + } + + /// + /// Describes properies of a Phone log record. + /// + public static class PhoneLog + { + /// + /// Identifier of this phone log view + /// + public const string Uri = "tizen.contacts_view.phonelog"; + /// + /// DB record ID of phone log + /// + public const uint Id = (uint)PropertyIds.PhonelogId; + /// + /// Person ID that the phone log belongs to + /// + public const uint PersonId = (uint)PropertyIds.PhonelogPersonId; + /// + /// Number or Email that the phone log displays + /// + public const uint Address = (uint)PropertyIds.PhonelogAddress; + /// + /// Call end time. The value means number of seconds since 1970-01-01 00:00:00 (UTC) + /// + public const uint LogTime = (uint)PropertyIds.PhonelogLogTime; + /// + /// Log type, refer to the Types + /// + public const uint LogType = (uint)PropertyIds.PhonelogLogType; + /// + /// You can set the related integer data (e.g. message_id, email_id or duration(seconds) of call) + /// + public const uint ExtraData1 = (uint)PropertyIds.PhonelogExtraData1; + /// + /// You can set the related string data (e.g. short message, subject) + /// + public const uint ExtraData2 = (uint)PropertyIds.PhonelogExtraData2; + /// + /// You can only use this property for search filter + /// + public const uint NormalizedAddress = (uint)PropertyIds.PhonelogNormalizedAddress; + /// + /// You can only use this property for search filter + /// + public const uint CleanedAddress = (uint)PropertyIds.PhonelogCleanedAddress; + /// + /// You can only use this property for search filter + /// + public const uint AddressFilter = (uint)PropertyIds.PhonelogAddressFilter; + /// + /// You can set the related SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init() + /// + public const uint SimSlotNo = (uint)PropertyIds.PhonelogSIMSlotNo; + + /// + /// Enumeration for Phone log type. + /// + public enum Types + { + /// + /// None + /// + None, + /// + /// Incoming call + /// + VoiceIncoming = 1, + /// + /// Outgoing call + /// + VoiceOutgoing = 2, + /// + /// Incoming video call + /// + VideoIncoming = 3, + /// + /// Outgoing video call + /// + VideoOutgoing = 4, + /// + /// Not confirmed missed call + /// + VoiceMissedUnseen = 5, + /// + /// Confirmed missed call + /// + VoiceMissedSeen = 6, + /// + /// Not confirmed missed video call + /// + VideoMissedUnseen = 7, + /// + /// Confirmed missed video call + /// + VidoeMissedSeen = 8, + /// + /// Rejected call + /// + VoiceRejected = 9, + /// + /// Rejected video call + /// + VideoRejected = 10, + /// + /// Blocked call + /// + VoiceBlocked = 11, + /// + /// Blocked video call + /// + VideoBlocked = 12, + /// + /// Incoming MMS + /// + MmsIncoming = 101, + /// + /// Outgoing MMS + /// + MmsOutgoing = 102, + /// + /// Incoming SMS + /// + SmsIncoming = 103, + /// + /// Outgoing SMS + /// + SmsOutgoing = 104, + /// + /// Blocked SMS + /// + SmsBlocked = 105, + /// + /// Blocked MMS + /// + MmsBlocked = 106, + /// + /// Received email + /// + EmailReceived = 201, + /// + /// Sent email + /// + EmailSent = 202, + + } + } + + /// + /// Describes properies of a Contact updated information record. + /// + /// Read only view + public static class ContactUpdatedInfo + { + /// + /// Identifier of this contact updated info view + /// + public const string Uri = "tizen.contacts_view.contacts_updated_info"; + /// + /// Updated contact ID + /// + public const uint ContactId = (uint)PropertyIds.UpdateInfoId; + /// + /// Addressbook ID that the updated contact belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId; + /// + /// Contact change type, refer to the ContactsViews.ChangeTypes + /// + public const uint Type = (uint)PropertyIds.UpdateInfoType; + /// + /// Updated version + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + /// + /// Contact image is changed or not + /// + public const uint ImageChanged = (uint)PropertyIds.UpdateInfoImageChanged; + } + + /// + /// Describes properies of a My profile updated information record. + /// + /// Read only view + public static class MyProfileUpdatedInfo + { + /// + /// Identifier of this my profile updated info view + /// + public const string Uri = "tizen.contacts_view.my_profile_updated_info"; + /// + /// Address book ID that the updated my profile belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId; + /// + /// MyProfile change type, refer to the ContactsViews.ChangeTypes + /// + public const uint LastChangedType = (uint)PropertyIds.UpdateInfoLastChangedType; + /// + /// Updated version + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + } + + /// + /// Describes properies of a Group updated information record. + /// + /// Read only view + public static class GroupUpdatedInfo + { + /// + /// Identifier of this group updated info view + /// + public const string Uri = "tizen.contacts_view.groups_updated_info"; + /// + /// Updated group ID + /// + public const uint GroupId = (uint)PropertyIds.UpdateInfoId; + /// + /// Address book ID that the updated group belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId; + /// + /// Group change type, refer to the ContactsViews.ChangeTypes + /// + public const uint Type = (uint)PropertyIds.UpdateInfoType; + /// + /// Updated version + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + } + + /// + /// Describes properies of a Group Member updated information record. + /// + /// Read only view + public static class GroupMemberUpdatedInfo + { + /// + /// Identifier of this group member updated info view + /// + public const string Uri = "tizen.contacts_view.groups_member_updated_info"; + /// + /// Updated group ID + /// + public const uint GroupId = (uint)PropertyIds.UpdateInfoId; + /// + /// Address book ID that the updated group belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.UpdateInfoAddressbookId; + /// + /// Updated version + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + } + + /// + /// Describes properies of a Relation updated information record. + /// + /// Read only view + public static class GroupRelationUpdatedInfo + { + /// + /// Identifier of this group relation updated info view + /// + public const string Uri = "tizen.contacts_view.group_relations_updated_info"; + /// + /// Group ID of group relation + /// + public const uint GroupId = (uint)PropertyIds.GroupId; + /// + /// Contact ID of the updated group relation + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// Address book ID of contact that the updated group relation + /// + public const uint AddressbookId = (uint)PropertyIds.AddressbookId; + /// + /// Group relation change type, refer to the ContactsViews.ChangeTypes + /// + public const uint Type = (uint)PropertyIds.UpdateInfoType; + /// + /// Updated version + /// + public const uint Version = (uint)PropertyIds.UpdateInfoVersion; + } + + /// + /// Describes properies of a Person & Contact record. + /// + /// Read only view + public static class PersonContact + { + /// + /// Identifier of this person contact view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// Status of social account (projection) + /// + public const uint Status = (uint)PropertyIds.PersonStatus; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// Link count of contact records (projection) + /// + public const uint LinkCount = (uint)PropertyIds.PersonLinkCount; + /// + /// Contact ID that the person belongs to + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// Addressbook IDs that the person belongs to (projection) + /// + public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Addressbook ID that the person belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Addressbook mode, refer to the Addressbook.Modes + /// + public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode; + /// + /// Addressbook name that the person belongs to + /// + public const uint AddressbookName = (uint)PropertyIds.AddressbookName; + /// + /// kerword matched data type, refer to the Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Number record. + /// + /// Read only view + public static class PersonNumber + { + /// + /// Identifier of this person number view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/number"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Number ID that the person belongs to + /// + public const uint NumberId = (uint)PropertyIds.NumberId; + /// + /// Number type, refer to the Number.Types (projection) + /// + public const uint Type = (uint)PropertyIds.NumberType; + /// + /// Custom number type label, when the number type is Number.Types.Custom (projection) + /// + public const uint Label = (uint)PropertyIds.NumberLabel; + /// + /// The number is default number or not + /// + public const uint IsPrimaryDefault = (uint)PropertyIds.DataIsPrimaryDefault; + /// + /// Number + /// + public const uint Number = (uint)PropertyIds.NumberNumber; + /// + /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly. + /// + public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter; + /// + /// You can only use this property for search filter + /// + public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber; + /// + /// You can only use this property for search filter + /// + public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber; + /// + /// kerword matched data type, refer to they Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Email record. + /// + /// Read only view + public static class PersonEmail + { + /// + /// Identifier of this person email view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/email"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Email ID that the person belongs to + /// + public const uint EmailId = (uint)PropertyIds.EmailId; + /// + /// Email type, refer to the Email.Types (projection) + /// + public const uint Type = (uint)PropertyIds.EmailType; + /// + /// Custom mail type label, when the email type is Email.Types.Custom (projection) + /// + public const uint Label = (uint)PropertyIds.EmailLabel; + /// + /// The email is default email or not + /// + public const uint IsPrimaryDefault = (uint)PropertyIds.DataIsPrimaryDefault; + /// + /// Email address + /// + public const uint Email = (uint)PropertyIds.EmailEmail; + /// + /// kerword matched data type, refer to they Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Group Relation record. + /// + /// Read only view + public static class PersonGroupRelation + { + /// + /// Identifier of this person group relation view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/group"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// Status of social account (projection) + /// + public const uint Status = (uint)PropertyIds.PersonStatus; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Link count of contat records (projection) + /// + public const uint LinkCount = (uint)PropertyIds.PersonLinkCount; + /// + /// Addressbook IDs that the person belongs to (projection) + /// + public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds; + /// + /// Addressbook ID that the person belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Addressbook name that the person belongs to + /// + public const uint AddressbookName = (uint)PropertyIds.AddressbookName; + /// + /// Addressbook mode, refer to the Addressbook.Modes + /// + public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode; + /// + /// Group ID that the person belongs to + /// + public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId; + /// + /// Contact ID that the person belongs to (projection) + /// + public const uint ContactId = (uint)PropertyIds.GroupRelationContactId; + /// + /// kerword matched data type, refer to they Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Group Assigned record. + /// + /// Read only view + public static class PersonGroupAssigned + { + /// + /// Identifier of this person group assigned view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/group_assigned"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// Status of social account (projection) + /// + public const uint Status = (uint)PropertyIds.PersonStatus; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Link count of contact records (projection) + /// + public const uint LinkCount = (uint)PropertyIds.PersonLinkCount; + /// + /// Addressbook IDs that the linked person belongs to (projection) + /// + public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds; + /// + /// Addressbook ID that the person belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Addressbook mode, refer to the Addressbook.Modes + /// + public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode; + /// + /// Group ID that the person belongs to + /// + public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId; + /// + /// Contact ID that the person belongs to (projection) + /// + public const uint ContactId = (uint)PropertyIds.GroupRelationContactId; + /// + /// kerword matched data type, refer to they Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Group Not Assigned record. + /// + /// Read only view + public static class PersonGroupNotAssigned + { + /// + /// Identifier of this person group not assigned view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/group_not_assigned"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// Status of social account (projection) + /// + public const uint Status = (uint)PropertyIds.PersonStatus; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Link count of contact records (projection) + /// + public const uint LinkCount = (uint)PropertyIds.PersonLinkCount; + /// + /// Addressbook IDs that the linked person belongs to (projection) + /// + public const uint AddressbookIds = (uint)PropertyIds.PersonAddressbookIds; + /// + /// Addressbook ID that the person belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Addressbook mode, refer to the Addressbook.Modes + /// + public const uint AddressbookMode = (uint)PropertyIds.AddressbookMode; + /// + /// Contact ID that the person belongs to (projection) + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// kerword matched data type, refer to they Contact.DataTypes + /// + public const uint SnippetType = (uint)PropertyIds.PersonSnippetType; + /// + /// keyword matched data string + /// + public const uint SnippetString = (uint)PropertyIds.PersonSnippetString; + }; + + /// + /// Describes properies of a Person & Phone Log record. + /// + /// Read only view + public static class PersonPhonelog + { + /// + /// Identifier of this phone log view + /// + public const string Uri = "tizen.contacts_view.person/simple_contact/phonelog"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// DB record ID of phone log + /// + public const uint LogId = (uint)PropertyIds.PhonelogId; + /// + /// Number or Email that the phone log displays + /// + public const uint Address = (uint)PropertyIds.PhonelogAddress; + /// + /// Number or Email type (projection) + /// + public const uint AddressType = (uint)PropertyIds.DataData1; + /// + /// Call end time. The value means number of seconds since 1970-01-01 00:00:00 (UTC) + /// + public const uint LogTime = (uint)PropertyIds.PhonelogLogTime; + /// + /// Log type, refer to the PhoneLog.Types + /// + public const uint LogType = (uint)PropertyIds.PhonelogLogType; + /// + /// You can set the related integer data (e.g. message_id, email_id or duration(seconds) of call) (projection) + /// + public const uint ExtraData1 = (uint)PropertyIds.PhonelogExtraData1; + /// + /// You can set the related string data (e.g. short message, subject) (projection) + /// + public const uint ExtraData2 = (uint)PropertyIds.PhonelogExtraData2; + /// + /// You can only use this property for search filter + /// + public const uint NormalizedAddress = (uint)PropertyIds.PhonelogNormalizedAddress; + /// + /// You can only use this property for search filter + /// + public const uint CleanedAddress = (uint)PropertyIds.PhonelogCleanedAddress; + /// + /// You can only use this property for search filter + /// + public const uint AddressFilter = (uint)PropertyIds.PhonelogAddressFilter; + /// + /// It is related to the SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init() + /// + public const uint SIMSlotNo = (uint)PropertyIds.PhonelogSIMSlotNo; + }; + + /// + /// Describes properies of a Person Usage record. + /// + /// Read only view + public static class PersonUsage + { + /// + /// Identifier of this person usage view + /// + public const string Uri = "tizen.contacts_view.person/usag"; + /// + /// DB record ID of the person + /// + public const uint PersonId = (uint)PropertyIds.PersonId; + /// + /// Display name of the person + /// + public const uint DisplayName = (uint)PropertyIds.PersonDisplayName; + /// + /// The first character of first string for grouping. This is normalized using icu (projection) + /// + public const uint DisplayNameIndex = (uint)PropertyIds.PersonDisplayNameIndex; + /// + /// Display contact ID that the person belongs to (projection) + /// + public const uint DisplayContactId = (uint)PropertyIds.PersonDisplayContactId; + /// + /// Ringtone path of the person (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.PersonRingtone; + /// + /// Image thumbnail path of the person (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.PersonThumbnail; + /// + /// Vibration path of the person (projection) + /// + public const uint Vibration = (uint)PropertyIds.PersonVibration; + /// + /// Message alert path of the person (projection) + /// + public const uint MessageAlert = (uint)PropertyIds.PersonMessageAlert; + /// + /// The person is favorite or not + /// + public const uint IsFavorite = (uint)PropertyIds.PersonIsFavorite; + /// + /// The person has phone number or not + /// + public const uint HasPhoneNumber = (uint)PropertyIds.PersonHasPhoneNumber; + /// + /// The person has email or not + /// + public const uint HasEmail = (uint)PropertyIds.PersonHasEmail; + /// + /// Usage type, refer to the UsageTypes + /// + public const uint UsageType = (uint)PropertyIds.PersonUsageType; + /// + /// Usage number of person + /// + public const uint TimesUsed = (uint)PropertyIds.PersonTimesUsed; + + /// + /// Enumeration for Person usage type. + /// + public enum Types + { + /// + /// None + /// + None, + /// + /// Outgoing call + /// + OutgoingCall, + /// + /// Outgoing message + /// + OutgoingMessage, + /// + /// Outgoing email + /// + OutgoingEmail, + /// + /// Incoming call + /// + IncomingCall, + /// + /// Incoming message + /// + IncomingMessage, + /// + /// Incoming email + /// + IncomingEmail, + /// + /// Missed call + /// + MissedCall, + /// + /// Rejected call + /// + RejectedCall, + /// + /// Blocked call + /// + BlockedCall, + /// + /// Blocked message + /// + BlockedMessage + } + }; + + /// + /// Describes properies of a Contact & Number record. + /// + /// Read only view + public static class ContactNumber + { + /// + /// Identifier of this contacts number view + /// + public const string Uri = "tizen.contacts_view.simple_contact/number"; + /// + /// Contact ID that the number belongs to + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// Display name of contact that the number belongs to + /// + public const uint DisplayName = (uint)PropertyIds.ContactDisplayName; + /// + /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection) + /// + public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId; + /// + /// Addressbook ID that the number belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Person ID that the number belongs to + /// + public const uint PersonId = (uint)PropertyIds.ContactPersonId; + /// + /// Ringtone path that the number belongs to (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.ContactRingtone; + /// + /// Image thumbnail path that the number belongs to (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail; + /// + /// DB record ID of the number + /// + public const uint NumberId = (uint)PropertyIds.NumberId; + /// + /// Number type, refer to the Number.Types (projection) + /// + public const uint Type = (uint)PropertyIds.NumberType; + /// + /// Custom number type label, when the number type is Number.Types.Custom (projection) + /// + public const uint Label = (uint)PropertyIds.NumberLabel; + /// + /// The number is default number or not + /// + public const uint IsDefault = (uint)PropertyIds.NumberIsDefault; + /// + /// Number + /// + public const uint Number = (uint)PropertyIds.NumberNumber; + /// + /// If you add filter with this property, the string will be normalized as minmatch length internally and the match rule will be applied ContactsFilter.StringMatchType.Exactly + /// + public const uint NumberFilter = (uint)PropertyIds.NumberNumberFilter; + /// + /// You can only use this property for search filter + /// + public const uint NormalizedNumber = (uint)PropertyIds.NumberNormalizedNumber; + /// + /// You can only use this property for search filter + /// + public const uint CleanedNumber = (uint)PropertyIds.NumberCleanedNumber; + }; + + /// + /// Describes properies of a Contact & Email record. + /// + /// Read only view + public static class ContactEmail + { + /// + /// Identifier of this contacts email view + /// + public const string Uri = "tizen.contacts_view.simple_contact/email"; + /// + /// Contact ID that the number belongs to + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// Display name of contact that the number belongs to + /// + public const uint DisplayName = (uint)PropertyIds.ContactDisplayName; + /// + /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection) + /// + public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId; + /// + /// Addressbook ID that the number belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Person ID that the number belongs to + /// + public const uint PersonId = (uint)PropertyIds.ContactPersonId; + /// + /// Ringtone path that the number belongs to (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.ContactRingtone; + /// + /// Image thumbnail path that the number belongs to (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail; + /// + /// DB record ID of the email + /// + public const uint EmailId = (uint)PropertyIds.EmailId; + /// + /// Email type, refer to the Email.Types (projection) + /// + public const uint Type = (uint)PropertyIds.EmailType; + /// + /// Custom mail type label, when the email type is Email.Types.Custom (projection) + /// + public const uint Label = (uint)PropertyIds.EmailLabel; + /// + /// Email is default email or not + /// + public const uint IsDefault = (uint)PropertyIds.EmailIsDefault; + /// + /// Email address + /// + public const uint Email = (uint)PropertyIds.EmailEmail; + }; + + /// + /// Describes properies of a Contact & Group Relation record. + /// + /// Read only view + public static class ContactGroupRelation + { + /// + /// Identifier of this contact grouprel view + /// + public const string Uri = "tizen.contacts_view.simple_contact/group"; + /// + /// Contact ID that the number belongs to + /// + public const uint ContactId = (uint)PropertyIds.ContactId; + /// + /// Display name of contact that the number belongs to + /// + public const uint DisplayName = (uint)PropertyIds.ContactDisplayName; + /// + /// The source type of display name, refer to the Contact.DisplayNameSourceTypes (projection) + /// + public const uint DisplaySourceType = (uint)PropertyIds.ContactDisplaySourceDataId; + /// + /// Addressbook ID that the number belongs to + /// + public const uint AddressbookId = (uint)PropertyIds.ContactAddressbookId; + /// + /// Person ID that the number belongs to + /// + public const uint PersonId = (uint)PropertyIds.ContactPersonId; + /// + /// Ringtone path that the number belongs to (projection) + /// + public const uint RingtonePath = (uint)PropertyIds.ContactRingtone; + /// + /// Image thumbnail path that the number belongs to (projection) + /// + public const uint ThumbnailPath = (uint)PropertyIds.ContactThumbnail; + /// + /// DB record ID of the group relation + /// + public const uint GroupId = (uint)PropertyIds.GroupRelationGroupId; + /// + /// Group name (projection) + /// + public const uint GroupName = (uint)PropertyIds.GroupRelationGroupName; + }; + + /// + /// Describes properies of a Phone Log Statistics record. + /// + /// Read only view + public static class PhonelogStatistics + { + /// + /// Identifier of this log statistics view + /// + public const string Uri = "tizen.contacts_view.phonelog_stat"; + /// + /// Log count (projection) + /// + public const uint LogCount = (uint)PropertyIds.PhonelogStatLogCount; + /// + /// Log type, see the contacts_phone_log_type_e + /// + public const uint LogType = (uint)PropertyIds.PhonelogStatLogType; + /// + /// It is related to the SIM slot number. sim_slot_no 0 means first SIM card, sim_slot_no 1 means second SIM. It is same with handle index of telephony handle list. Refer to the telephony_init() + /// + public const uint SIMSlotNo = (uint)PropertyIds.PhonelogStatSIMSlotNo; + }; + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/DBStatusChangedEventArgs.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/DBStatusChangedEventArgs.cs new file mode 100644 index 0000000..4029e35 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/DBStatusChangedEventArgs.cs @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using static Tizen.Pims.Contacts.ContactsDatabase; + +namespace Tizen.Pims.Contacts +{ + /// + /// Event arguments passed when contacts database status is changed + /// + public class DBStatusChangedEventArgs + { + internal DBStatusChangedEventArgs(DBStatus status) + { + this.Status = status; + } + + public DBStatus Status + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameDisplayOrderChangedEventArgs.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameDisplayOrderChangedEventArgs.cs new file mode 100644 index 0000000..71ce4d3 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameDisplayOrderChangedEventArgs.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Pims.Contacts +{ + /// + /// Event arguments passed when setting value of contacts name display order is changed + /// + public class NameDisplayOrderChangedEventArgs + { + internal NameDisplayOrderChangedEventArgs(ContactDisplayOrder displayOrder) + { + this.NameDisplayOrder = displayOrder; + } + + public ContactDisplayOrder NameDisplayOrder + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameSortingOrderChangedEventArgs.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameSortingOrderChangedEventArgs.cs new file mode 100644 index 0000000..1f9b663 --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NameSortingOrderChangedEventArgs.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Pims.Contacts +{ + /// + /// Event arguments passed when setting value of contacts name sorting order is changed + /// + public class NameSortingOrderChangedEventArgs + { + internal NameSortingOrderChangedEventArgs(ContactSortingOrder SortingOrder) + { + this.NameSortingOrder = SortingOrder; + } + + public ContactSortingOrder NameSortingOrder + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NamespaceDoc.cs b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NamespaceDoc.cs new file mode 100644 index 0000000..487113c --- /dev/null +++ b/src/Tizen.Pims.Contacts/Tizen.Pims.Contacts/NamespaceDoc.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// The Tizen.Pims.Contacts namespace provides classes for managing contact information for people. +/// +/// +/// The Tizen.Pims.Contacts namespace provides classes for managing contact information for people. +/// +namespace Tizen.Pims.Contacts {} diff --git a/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcErrors.cs b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcErrors.cs new file mode 100644 index 0000000..3e12547 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcErrors.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using Tizen.Internals.Errors; + +internal static partial class Interop +{ + private const int TizenErrorKeyManager = -0x01E10000; + private const string LogTag = "Tizen.Security.SecureRepository"; + + internal enum KeyManagerError : int + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + VerificationFailed = TizenErrorKeyManager | 0x0D // CKMC_ERROR_VERIFICATION_FAILED + }; + + internal static void CheckNThrowException(int err, string msg) + { + switch (err) + { + case (int)KeyManagerError.None: + return; + case (int)KeyManagerError.InvalidParameter: + throw new ArgumentException(string.Format("[{0}] {1}, error={2}", + LogTag, msg, ErrorFacts.GetErrorMessage(err))); + default: + throw new InvalidOperationException(string.Format("[{0}] {1}, error={2}", + LogTag, msg, ErrorFacts.GetErrorMessage(err))); + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcManager.cs b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcManager.cs new file mode 100644 index 0000000..51141d0 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcManager.cs @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class CkmcManager + { + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_save_key", CallingConvention = CallingConvention.Cdecl)] + public static extern int SaveKey(string alias, CkmcKey key, CkmcPolicy policy); + // int ckmc_save_key(const char *alias, const ckmc_key_s key, const ckmc_policy_s policy); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_key", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetKey(string alias, string password, out IntPtr key); + // int ckmc_get_key(const char *alias, const char *password, ckmc_key_s **ppkey); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_key_alias_list", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetKeyAliasList(out IntPtr aliases); + // int ckmc_get_key_alias_list(ckmc_alias_list_s **ppalias_list); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_save_cert", CallingConvention = CallingConvention.Cdecl)] + public static extern int SaveCert(string alias, CkmcCert cert, CkmcPolicy policy); + // int ckmc_save_cert(const char *alias, const ckmc_cert_s cert, const ckmc_policy_s policy); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_cert", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetCert(string alias, string password, out IntPtr data); + // int ckmc_get_cert(const char *alias, const char *password, ckmc_cert_s** ppcert); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_cert_alias_list", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetCertAliasList(out IntPtr aliases); + // int ckmc_get_cert_alias_list(ckmc_alias_list_s **ppalias_list); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_save_data", CallingConvention = CallingConvention.Cdecl)] + public static extern int SaveData(string alias, CkmcRawBuffer data, CkmcPolicy policy); + // int ckmc_save_data(const char *alias, ckmc_raw_buffer_s data, const ckmc_policy_s policy); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_data", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetData(string alias, string password, out IntPtr data); + // int ckmc_get_data(const char* alias, const char* password, ckmc_raw_buffer_s **ppdata); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_data_alias_list", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetDataAliasList(out IntPtr aliases); + // int ckmc_get_data_alias_list(ckmc_alias_list_s **ppalias_list); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_remove_alias", CallingConvention = CallingConvention.Cdecl)] + public static extern int RemoveAlias(string alias); + // int ckmc_remove_alias(const char *alias); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_save_pkcs12", CallingConvention = CallingConvention.Cdecl)] + public static extern int SavePkcs12(string alias, IntPtr p12, CkmcPolicy keyPolicy, CkmcPolicy certPolicy); + // int ckmc_save_pkcs12(const char *alias, const ckmc_pkcs12_s* pkcs, const ckmc_policy_s key_policy, const ckmc_policy_s cert_policy); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_pkcs12", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetPkcs12(string alias, string keyPassword, string certPassword, out IntPtr pkcs12); + // int ckmc_get_pkcs12(const char *alias, const char *key_password, const char* cert_password, ckmc_pkcs12_s **pkcs12); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_set_permission", CallingConvention = CallingConvention.Cdecl)] + public static extern int SetPermission(string alias, string accessor, int permissions); + // int ckmc_set_permission(const char *alias, const char *accessor, int permissions); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_create_key_pair_rsa", CallingConvention = CallingConvention.Cdecl)] + public static extern int CreateKeyPairRsa(UIntPtr size, string privateKeyAlias, string publicKeyAlias, + CkmcPolicy privateKeyPolicy, CkmcPolicy publicKeyPolicy); + // int ckmc_create_key_pair_rsa(const size_t size, const char* private_key_alias, const char* public_key_alias, + // const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_create_key_pair_dsa", CallingConvention = CallingConvention.Cdecl)] + public static extern int CreateKeyPairDsa(UIntPtr size, string privateKeyAlias, string publicKeyAlias, + CkmcPolicy privateKeyPolicy, CkmcPolicy publicKeyPolicy); + // int ckmc_create_key_pair_dsa(const size_t size, const char* private_key_alias, const char* public_key_alias, + // const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_create_key_pair_ecdsa", CallingConvention = CallingConvention.Cdecl)] + public static extern int CreateKeyPairEcdsa(int ecType, string privateKeyAlias, string publicKeyAlias, + CkmcPolicy privateKeyPolicy, CkmcPolicy publicKeyPolicy); + // int ckmc_create_key_pair_ecdsa(const ckmc_ec_type_e type, const char* private_key_alias, const char* public_key_alias, + // const ckmc_policy_s policy_private_key, const ckmc_policy_s policy_public_key); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_create_key_aes", CallingConvention = CallingConvention.Cdecl)] + public static extern int CreateKeyAes(UIntPtr size, string ceyAlias, CkmcPolicy keyPolicy); + // int ckmc_create_key_aes(size_t size, const char* key_alias, ckmc_policy_s key_policy); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_create_signature", CallingConvention = CallingConvention.Cdecl)] + public static extern int CreateSignature(string privateKeyAlias, string password, CkmcRawBuffer message, + int hashAlgorithm, int paddingAlgorithm, out IntPtr signature); + // int ckmc_create_signature(const char *private_key_alias, const char* password, const ckmc_raw_buffer_s message, + // const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding, ckmc_raw_buffer_s **ppsignature); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_verify_signature", CallingConvention = CallingConvention.Cdecl)] + public static extern int VerifySignature(string publicKeyAlias, string password, CkmcRawBuffer message, + CkmcRawBuffer signature, int hashAlgorithm, int paddingAlgorithm); + // int ckmc_verify_signature(const char *public_key_alias, const char* password, const ckmc_raw_buffer_s message, + // const ckmc_raw_buffer_s signature, const ckmc_hash_algo_e hash, const ckmc_rsa_padding_algo_e padding); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_encrypt_data", CallingConvention = CallingConvention.Cdecl)] + public static extern int EncryptData(IntPtr parameters, string keyAlias, string password, CkmcRawBuffer plainText, out IntPtr cipherText); + // int ckmc_encrypt_data(ckmc_param_list_h params, const char* key_alias, const char* password, + // const ckmc_raw_buffer_s decrypted, ckmc_raw_buffer_s **ppencrypted); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_decrypt_data", CallingConvention = CallingConvention.Cdecl)] + public static extern int DecryptData(IntPtr parameters, string keyAlias, string password, CkmcRawBuffer cipherText, out IntPtr plainText); + // int ckmc_decrypt_data(ckmc_param_list_h params, const char* key_alias, const char* password, + // const ckmc_raw_buffer_s encrypted, ckmc_raw_buffer_s **ppdecrypted); + + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_cert_chain", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetCertChain(IntPtr cert, IntPtr untrustedCerts, out IntPtr certChain); + // int ckmc_get_cert_chain(const ckmc_cert_s *cert, const ckmc_cert_list_s* untrustedcerts, ckmc_cert_list_s **ppcert_chain_list); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_get_cert_chain_with_trustedcert", CallingConvention = CallingConvention.Cdecl)] + public static extern int GetCertChainWithTrustedCerts(IntPtr cert, IntPtr untrustedCerts, IntPtr trustedCerts, + bool useTrustedSystemCerts, out IntPtr certChain); + // int ckmc_get_cert_chain_with_trustedcert(const ckmc_cert_s *cert, const ckmc_cert_list_s* untrustedcerts, + // const ckmc_cert_list_s* trustedcerts, const bool use_trustedsystemcerts, ckmc_cert_list_s **ppcert_chain_list); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_ocsp_check", CallingConvention = CallingConvention.Cdecl)] + public static extern int OcspCheck(IntPtr certChain, ref int ocspStatus); + // int ckmc_ocsp_check(const ckmc_cert_list_s *pcert_chain_list, ckmc_ocsp_status_e* ocsp_status); + } +} diff --git a/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcTypes.cs b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcTypes.cs new file mode 100644 index 0000000..6482a35 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Interop/Interop.CkmcTypes.cs @@ -0,0 +1,214 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcPolicy + { + public CkmcPolicy(string password, bool extractable) + { + this.password = password; + this.extractable = extractable; + } + [MarshalAs(UnmanagedType.LPStr)] + public readonly string password; + [MarshalAs(UnmanagedType.Bool)] + public readonly bool extractable; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcKey + { + public CkmcKey(IntPtr binary, int keySize, int keyType, string password) + { + this.rawKey = binary; + this.size = (UIntPtr)keySize; + this.keyType = keyType; + this.password = password; + } + public readonly IntPtr rawKey; + public readonly UIntPtr size; + public readonly int keyType; + [MarshalAs(UnmanagedType.LPStr)] + public readonly string password; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcCert + { + public CkmcCert(IntPtr binary, int size, int dataFormat) + { + this.rawCert = binary; + this.size = (UIntPtr)size; + this.dataFormat = dataFormat; + } + public readonly IntPtr rawCert; + public readonly UIntPtr size; + public readonly int dataFormat; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcRawBuffer + { + public CkmcRawBuffer(IntPtr binary, int size) + { + this.data = binary; + this.size = (UIntPtr)size; + } + public readonly IntPtr data; + public readonly UIntPtr size; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcAliasList + { + public readonly IntPtr alias; + public readonly IntPtr next; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcCertList + { + public CkmcCertList(IntPtr cert, IntPtr next) + { + this.cert = cert; + this.next = next; + } + public readonly IntPtr cert; + public readonly IntPtr next; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CkmcPkcs12 + { + public CkmcPkcs12(IntPtr privateKey, IntPtr certificate, IntPtr caChain) + { + this.privateKey = privateKey; + this.certificate = certificate; + this.caChain = caChain; + } + public readonly IntPtr privateKey; + public readonly IntPtr certificate; + public readonly IntPtr caChain; + } + + internal static partial class CkmcTypes + { + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_key_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int KeyNew(byte[] rawKey, UIntPtr size, int keyType, string password, out IntPtr cert); + // int ckmc_key_new(unsigned char *raw_key, size_t key_size, ckmc_key_type_e key_type, char *password, ckmc_key_s **ppkey); + // + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_key_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void KeyFree(IntPtr buffer); + // void ckmc_key_free(ckmc_key_s *key); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_buffer_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int BufferNew(byte[] data, UIntPtr size, out IntPtr buffer); + // int ckmc_buffer_new(unsigned char *data, size_t size, ckmc_raw_buffer_s** ppbuffer); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_buffer_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void BufferFree(IntPtr buffer); + // void ckmc_buffer_free(ckmc_raw_buffer_s* buffer); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int CertNew(byte[] rawCert, UIntPtr size, int dataFormat, out IntPtr cert); + // int ckmc_cert_new(unsigned char *raw_cert, size_t cert_size, ckmc_data_format_e data_format, ckmc_cert_s** ppcert); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void CertFree(IntPtr buffer); + // void ckmc_cert_free(ckmc_cert_s *cert); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_load_cert_from_file", CallingConvention = CallingConvention.Cdecl)] + public static extern int LoadCertFromFile(string filePath, out IntPtr cert); + // int ckmc_load_cert_from_file(const char *file_path, ckmc_cert_s **cert); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_pkcs12_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int Pkcs12New(IntPtr key, IntPtr cert, IntPtr caCerts, out IntPtr p12_bundle); + // int ckmc_pkcs12_new(ckmc_key_s *private_key, ckmc_cert_s* cert, ckmc_cert_list_s *ca_cert_list, ckmc_pkcs12_s** pkcs12_bundle); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_pkcs12_load", CallingConvention = CallingConvention.Cdecl)] + public static extern int Pkcs12Load(string filePath, string password, out IntPtr pkcs12); + // int ckmc_pkcs12_load(const char *file_path, const char* passphrase, ckmc_pkcs12_s **pkcs12_bundle); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_pkcs12_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void Pkcs12Free(IntPtr pkcs12); + // void ckmc_pkcs12_free(ckmc_pkcs12_s *pkcs12); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_alias_list_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int AliasListNew(string alias, out IntPtr aliasList); + // int ckmc_alias_list_new(char *alias, ckmc_alias_list_s **ppalias_list); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_alias_list_add", CallingConvention = CallingConvention.Cdecl)] + public static extern int AliasListAdd(IntPtr previous, string alias, out IntPtr aliasList); + // int ckmc_alias_list_add(ckmc_alias_list_s *previous, char* alias, ckmc_alias_list_s **pplast); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_alias_list_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void AliasListFree(IntPtr first); + // void ckmc_alias_list_free(ckmc_alias_list_s* first); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_alias_list_all_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void AliasListAllFree(IntPtr first); + // void ckmc_alias_list_all_free(ckmc_alias_list_s* first); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_list_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int CertListNew(IntPtr cert, out IntPtr certList); + // int ckmc_cert_list_new(ckmc_cert_s *cert, ckmc_cert_list_s **ppcert_list); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_list_add", CallingConvention = CallingConvention.Cdecl)] + public static extern int CertListAdd(IntPtr previous, IntPtr cert, out IntPtr certList); + // int ckmc_cert_list_add(ckmc_cert_list_s *previous, ckmc_cert_s *cert, ckmc_cert_list_s** pplast); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_list_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void CertListFree(IntPtr first); + // void ckmc_cert_list_free(ckmc_cert_list_s *first); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_cert_list_all_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void CertListAllFree(IntPtr first); + // void ckmc_cert_list_all_free(ckmc_cert_list_s *first); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_new", CallingConvention = CallingConvention.Cdecl)] + public static extern int ParamListNew(out IntPtr paramList); + // int ckmc_param_list_new(ckmc_param_list_h *pparams); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_set_integer", CallingConvention = CallingConvention.Cdecl)] + public static extern int ParamListSetInteger(IntPtr paramList, int name, long value); + // int ckmc_param_list_set_integer(ckmc_param_list_h params, ckmc_param_name_e name, uint64_t value); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_set_buffer", CallingConvention = CallingConvention.Cdecl)] + public static extern int ParamListSetBuffer(IntPtr paramList, int name, IntPtr buffer); + // int ckmc_param_list_set_buffer(ckmc_param_list_h params, ckmc_param_name_e name, const ckmc_raw_buffer_s* buffer); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_get_integer", CallingConvention = CallingConvention.Cdecl)] + public static extern int ParamListGetInteger(IntPtr paramList, int name, out long value); + // int ckmc_param_list_get_integer(ckmc_param_list_h params, ckmc_param_name_e name, uint64_t *pvalue); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_get_buffer", CallingConvention = CallingConvention.Cdecl)] + public static extern int ParamListGetBuffer(IntPtr paramList, int name, out IntPtr buffer); + // int ckmc_param_list_get_buffer(ckmc_param_list_h params, ckmc_param_name_e name, ckmc_raw_buffer_s **ppbuffer); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_param_list_free", CallingConvention = CallingConvention.Cdecl)] + public static extern void ParamListFree(IntPtr first); + // void ckmc_param_list_free(ckmc_param_list_h params); + + [DllImport(Libraries.KeyManager, EntryPoint = "ckmc_generate_new_params", CallingConvention = CallingConvention.Cdecl)] + public static extern int GenerateNewParam(int algoType, out IntPtr paramList); + // int ckmc_generate_new_params(ckmc_algo_type_e type, ckmc_param_list_h *pparams); + } +} diff --git a/src/Tizen.Security.SecureRepository/Interop/Interop.Libraries.cs b/src/Tizen.Security.SecureRepository/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..d982269 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string KeyManager = "libkey-manager-client.so.1"; + } +} diff --git a/src/Tizen.Security.SecureRepository/NamespaceDoc.cs b/src/Tizen.Security.SecureRepository/NamespaceDoc.cs new file mode 100644 index 0000000..c14b195 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/NamespaceDoc.cs @@ -0,0 +1,41 @@ +/** + +Secure Repository function is provided by key-manager module in Tizen. The key manager provides a secure repository for keys, certificates, and sensitive data related to users and their password-protected APPs. Additionally, it provides secure cryptographic operations for non-exportable keys without revealing the key values to clients. + + + +

Overview

+ +Secure Repository stores keys, certificates, and sensitive user data in a central secure repository. The central secure repository is protected by a password. + + + +Data Store Policy +A client can specify simple access rules when storing data in the key manager: + Extractable or non-extractable + - Only for data tagged as extractable, the key manager returns the raw value of the data. + - If data is tagged as non-extractable, the key manager does not return its raw value. In that case, the key manager provides secure cryptographic operations for non-exportable keys without revealing the key values to the clients. + Per key password + - All data in the key manager is protected by a user password. + - A client can encrypt its data using their own password additionally. + - If a client provides a password when storing data, the data is encrypted with the password. This password must be provided when getting the data from the key manager. + + + +Data Access Control + By default, only the owner of a data can access to the data. + If the owner grants the access to other applications, those applications can read or delete the data from key-manager DB. + When an application is deleted, the data and access control information granted by the application are also removed. + + + +Alias Format + The format of alias is "package_id name" and the name should not contain any white space characters. + If package_id is not provided by a client, the key-manager will add the package_id of the client to the name internally. + The client can specify only its own pacakge id in the alias when storing a key, certificate, or data. + A client should specify the pacakge id of the owner in the alias to retrieve a a key, certificate, or data shared by other applications. + Aliases are returned from the key-manager as the format of package_id name. + +
+*/ +namespace Tizen.Security.SecureRepository {} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.csproj b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.sln b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.sln new file mode 100755 index 0000000..9301848 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Security.SecureRepository", "Tizen.Security.SecureRepository.csproj", "{FDDA7B1F-E516-419B-BCFD-30E036E7F5AE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{B8B1271F-D61B-42C3-8BE5-F08180CE800F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{F38CD986-E81B-4C82-B6CA-F7EC96B2297D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FDDA7B1F-E516-419B-BCFD-30E036E7F5AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FDDA7B1F-E516-419B-BCFD-30E036E7F5AE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FDDA7B1F-E516-419B-BCFD-30E036E7F5AE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FDDA7B1F-E516-419B-BCFD-30E036E7F5AE}.Release|Any CPU.Build.0 = Release|Any CPU + {B8B1271F-D61B-42C3-8BE5-F08180CE800F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8B1271F-D61B-42C3-8BE5-F08180CE800F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8B1271F-D61B-42C3-8BE5-F08180CE800F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8B1271F-D61B-42C3-8BE5-F08180CE800F}.Release|Any CPU.Build.0 = Release|Any CPU + {F38CD986-E81B-4C82-B6CA-F7EC96B2297D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F38CD986-E81B-4C82-B6CA-F7EC96B2297D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F38CD986-E81B-4C82-B6CA-F7EC96B2297D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F38CD986-E81B-4C82-B6CA-F7EC96B2297D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Certificate.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Certificate.cs new file mode 100644 index 0000000..401a554 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Certificate.cs @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// Class that represents a certificate. + /// + /// 3 + public class Certificate + { + /// + /// Load Certificate from the given file path. + /// + /// 3 + /// The path of certificate file to be loaded. + /// Loaded certificate class instance. + /// + /// filePath should not be null + /// + /// + /// Invalid certificate file format. Provided file path does not exist or + /// cannot be accessed. + /// + static public Certificate Load(string filePath) + { + if (filePath == null) + throw new ArgumentNullException("filepath should not be null"); + + IntPtr ptr = IntPtr.Zero; + + Interop.CheckNThrowException( + CkmcTypes.LoadCertFromFile(filePath, out ptr), + "Failed to load Certificate: " + filePath); + + return new Certificate(ptr); + } + + /// + /// A constructor of Certificate that takes the binary and its format. + /// + /// 3 + /// The binary data of a certificate. + /// The format of the binary data. + public Certificate(byte[] binary, DataFormat format) + { + this.Binary = binary; + this.Format = format; + } + + internal Certificate(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new ArgumentNullException("Returned ptr from CAPI cannot be null"); + + var ckmcCert = Marshal.PtrToStructure(ptr); + this.Binary = new byte[(int)ckmcCert.size]; + Marshal.Copy(ckmcCert.rawCert, this.Binary, 0, this.Binary.Length); + this.Format = (DataFormat)ckmcCert.dataFormat; + } + + // Refresh handle(IntPtr) always. Because C# layer + // properties(Binary, Format) could be changed. + internal IntPtr GetHandle() + { + IntPtr ptr = IntPtr.Zero; + try + { + CheckNThrowException( + CkmcTypes.CertNew( + this.Binary, (UIntPtr)this.Binary.Length, (int)this.Format, + out ptr), + "Failed to create cert"); + + return ptr; + } + catch + { + if (ptr != IntPtr.Zero) + CkmcTypes.CertFree(ptr); + + throw; + } + } + + /// + /// The binary value of a certificate. + /// + /// 3 + public byte[] Binary + { + get; set; + } + + /// + /// The format of the binary value. + /// + /// 3 + public DataFormat Format + { + get; set; + } + + internal CkmcCert ToCkmcCert() + { + return new Interop.CkmcCert( + (Binary == null) ? IntPtr.Zero : new PinnedObject(this.Binary), + (Binary == null) ? 0 : this.Binary.Length, + (int)Format); + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/CertificateManager.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/CertificateManager.cs new file mode 100644 index 0000000..c034267 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/CertificateManager.cs @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// This class provides the methods handling certificates. + /// + /// 3 + public class CertificateManager : Manager + { + /// + /// Gets a certificate from secure repository. + /// + /// 3 + /// The name of a certificate to retrieve. + /// + /// The password used in decrypting a certificate value. If password of + /// policy is provided in SaveCertificate(), the same password should be + /// provided. + /// + /// A certificate specified by alias. + /// + /// Alias argument is null + /// + /// + /// Alias argument is invalid format. + /// + /// + /// Certificate does not exist with the alias or certificate-protecting + /// password isn't matched. + /// + static public Certificate Get(string alias, string password) + { + if (alias == null) + throw new ArgumentNullException("alias cannot be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetCert(alias, password, out ptr), + "Failed to get certificate. alias=" + alias); + return new Certificate(ptr); + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.CertFree(ptr); + } + } + + /// + /// Gets all alias of certificates which the client can access. + /// + /// 3 + /// All alias of certificates which the client can access. + /// No alias to get. + static public IEnumerable GetAliases() + { + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetCertAliasList(out ptr), + "Failed to get certificate aliases."); + return new SafeAliasListHandle(ptr).Aliases; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.AliasListAllFree(ptr); + } + } + + /// + /// Stores a certificate inside secure repository based on the provided policy. + /// + /// 3 + /// The name of a certificate to be stored. + /// The certificate's binary value to be stored. + /// + /// The policy about how to store a certificate securely. + /// + /// + /// Any of argument is null. + /// + /// + /// Alias argument is invalid format. cert argument is invalid format. + /// + /// + /// Certificate with alias does already exist. + /// + static public void Save(string alias, Certificate cert, Policy policy) + { + if (alias == null || cert == null || policy == null) + throw new ArgumentNullException("More than one of argument is null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.SaveCert( + alias, cert.ToCkmcCert(), policy.ToCkmcPolicy()), + "Failed to save certificate. alias=" + alias); + } + + /// + /// Verifies a certificate chain and returns that chain. + /// + /// 3 + /// The certificate to be verified. + /// + /// The untrusted CA certificates to be used in verifying a certificate chain. + /// + /// A newly created certificate chain. + /// + /// certificate argument is null. + /// + /// + /// Some of certificate in arguments is invalid. + /// + /// + /// Some of certificate in arguments is expired or not valid yet. + /// Certificate cannot build chain. + /// Root certificate is not in trusted system certificate store. + /// + /// + /// The trusted root certificate of the chain should exist in the system's + /// certificate storage. + /// + /// + /// The trusted root certificate of the chain in system's certificate storage + /// is added to the certificate chain. + /// + static public IEnumerable GetCertificateChain( + Certificate certificate, IEnumerable untrustedCertificates) + { + if (certificate == null) + throw new ArgumentNullException("Certificate is null"); + + IntPtr ptrCertChain = IntPtr.Zero; + IntPtr certPtr = IntPtr.Zero; + IntPtr untrustedPtr = IntPtr.Zero; + + try + { + var untrusted = new SafeCertificateListHandle(untrustedCertificates); + + certPtr = certificate.GetHandle(); + untrustedPtr = untrusted.GetHandle(); + + Interop.CheckNThrowException( + Interop.CkmcManager.GetCertChain( + certPtr, untrustedPtr, + out ptrCertChain), + "Failed to get certificate chain"); + + return new SafeCertificateListHandle(ptrCertChain).Certificates; + } + finally + { + if (certPtr != IntPtr.Zero) + Interop.CkmcTypes.CertFree(certPtr); + if (untrustedPtr != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(untrustedPtr); + } + } + + /// + /// Verifies a certificate chain and returns that chain using user entered + /// trusted and untrusted CA certificates. + /// + /// 3 + /// The certificate to be verified. + /// + /// The untrusted CA certificates to be used in verifying a certificate chain. + /// + /// + /// The trusted CA certificates to be used in verifying a certificate chain. + /// + /// + /// The flag indicating the use of the trusted root certificates in the + /// system's certificate storage. + /// + /// A newly created certificate chain. + /// + /// certificate argument is null. + /// + /// + /// Some of certificate in arguments is invalid. + /// + /// + /// Some of certificate in arguments is expired or not valid yet. + /// Certificate cannot build chain. + /// Root certificate is not in trusted system certificate store. + /// + /// + /// The trusted root certificate of the chain in system's certificate storage + /// is added to the certificate chain. + /// + static public IEnumerable GetCertificateChain( + Certificate certificate, IEnumerable untrustedCertificates, + IEnumerable trustedCertificates, + bool useTrustedSystemCertificates) + { + if (certificate == null) + throw new ArgumentNullException("Certificate is null"); + + IntPtr certPtr = IntPtr.Zero; + IntPtr untrustedPtr = IntPtr.Zero; + IntPtr trustedPtr = IntPtr.Zero; + IntPtr ptrCertChain = IntPtr.Zero; + + try + { + var untrusted = new SafeCertificateListHandle(untrustedCertificates); + var trusted = new SafeCertificateListHandle(trustedCertificates); + + certPtr = certificate.GetHandle(); + untrustedPtr = untrusted.GetHandle(); + trustedPtr = trusted.GetHandle(); + + Interop.CheckNThrowException( + Interop.CkmcManager.GetCertChainWithTrustedCerts( + certPtr, untrustedPtr, trustedPtr, + useTrustedSystemCertificates, out ptrCertChain), + "Failed to get certificate chain with trusted certificates"); + return new SafeCertificateListHandle(ptrCertChain).Certificates; + } + finally + { + if (certPtr != IntPtr.Zero) + Interop.CkmcTypes.CertFree(certPtr); + if (untrustedPtr != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(untrustedPtr); + if (trustedPtr != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(trustedPtr); + } + } + + /// + /// Perform OCSP which checks certificate is whether revoked or not. + /// + /// 3 + /// + /// Valid certificate chain to perform OCSP check. + /// + /// A status result of OCSP check. + /// + /// certificateChain argument is null. + /// + /// + /// certificateChain is not valid chain or certificate. + /// + /// + /// some of certificate in chain is expired or not valid yet. + /// + static public OcspStatus CheckOcsp(IEnumerable certificateChain) + { + if (certificateChain == null) + throw new ArgumentNullException("Certificate chain is null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + int ocspStatus = (int)OcspStatus.Good; + var certChain = new SafeCertificateListHandle(certificateChain); + + ptr = certChain.GetHandle(); + + Interop.CheckNThrowException( + Interop.CkmcManager.OcspCheck(ptr, ref ocspStatus), + "Failed to get certificate chain with trusted certificates"); + return (OcspStatus)ocspStatus; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(ptr); + } + } + + // to be static class safely + internal CertificateManager() + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCbcCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCbcCipherParameters.cs new file mode 100644 index 0000000..36e8902 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCbcCipherParameters.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for AES algorithm with CBC mode. + /// + /// 3 + public class AesCbcCipherParameters : AesCipherParameters + { + /// + /// A default constructor + /// + /// 3 + /// The CipherAlgorithmType in CipherParameters is set to CipherAlgorithmType.AesCbc. + public AesCbcCipherParameters() : base(CipherAlgorithmType.AesCbc) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCfbCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCfbCipherParameters.cs new file mode 100644 index 0000000..6bb35af --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCfbCipherParameters.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for AES algorithm with CFB mode. + /// + /// 3 + public class AesCfbCipherParameters : AesCipherParameters + { + /// + /// A default constructor + /// + /// 3 + /// The CipherAlgorithmType in CipherParameters is set to CipherAlgorithmType.AesCfb. + public AesCfbCipherParameters() : base(CipherAlgorithmType.AesCfb) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCipherParameters.cs new file mode 100644 index 0000000..095f9ae --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCipherParameters.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A abstract class holding parameters for AES algorithm. + /// + /// 3 + public abstract class AesCipherParameters : CipherParameters + { + /// + /// An initialization vector. + /// + /// 3 + public byte[] IV + { + get { return this.GetBuffer(CipherParameterName.IV); } + set { this.Add(CipherParameterName.IV, value); } + } + + // for inherited in internal only + internal AesCipherParameters() + { + } + + internal AesCipherParameters(CipherAlgorithmType algorithm) : base(algorithm) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCtrCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCtrCipherParameters.cs new file mode 100644 index 0000000..731254f --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesCtrCipherParameters.cs @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for AES algorithm with counter mode. + /// + /// 3 + public class AesCtrCipherParameters : AesCipherParameters + { + /// + /// A default constructor + /// + /// 3 + /// The CipherAlgorithmType in CipherParameters is set to CipherAlgorithmType.AesCtr. + public AesCtrCipherParameters() : base(CipherAlgorithmType.AesCtr) + { + } + + /// + /// Length of counter block in bits. + /// + /// 3 + /// Optional, only 128b is supported at the moment. + /// value should be positive. + public long CounterLength + { + get + { + return GetInteger(CipherParameterName.CounterLength); + } + set + { + if (value < 0) + throw new ArgumentOutOfRangeException( + string.Format("invalid value{0} on CounterLength", value)); + Add(CipherParameterName.CounterLength, value); + } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesGcmCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesGcmCipherParameters.cs new file mode 100644 index 0000000..cab0ccc --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/AesGcmCipherParameters.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for AES algorithm with GCM mode. + /// + /// 3 + public class AesGcmCipherParameters : AesCipherParameters + { + /// + /// A default constructor + /// + /// 3 + /// The CipherAlgorithmType in CipherParameters is set to CipherAlgorithmType.AesGcm. + public AesGcmCipherParameters() : base(CipherAlgorithmType.AesGcm) + { + } + + /// + /// GCM tag length in bits. + /// + /// 3 + /// One of {32, 64, 96, 104, 112, 120, 128} (optional, if not present the length 128 is used. + /// TagLength should be one of {32, 64, 96, 104, 112, 120, 128} + public long TagLength + { + get + { + return GetInteger(CipherParameterName.TagLength); + } + set + { + if (value != 32 && value != 64 && value != 96 && value != 104 && + value != 112 && value != 120 && value != 128) + { + throw new ArgumentOutOfRangeException( + string.Format("invalid value{0} on TagLength", value)); + } + else + { + Add(CipherParameterName.TagLength, value); + } + } + } + + /// + /// Additional authentication data(optional) + /// + /// 3 + public byte[] AAD + { + get { return GetBuffer(CipherParameterName.AAD); } + set { Add(CipherParameterName.AAD, value); } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Cipher.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Cipher.cs new file mode 100644 index 0000000..e84c070 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Cipher.cs @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// This class provides the methods encrypting and decrypting data. + /// + /// 3 + public class Cipher + { + private readonly CipherParameters _parameters; + + /// + /// A constructor of Cipher that takes the algorithm specific parameters. + /// + /// 3 + /// The algorithm specific parameters. + public Cipher(CipherParameters parameters) + { + _parameters = parameters; + } + + /// + /// The algorithm specific parameters. + /// + /// 3 + public CipherParameters Parameters + { + get { return _parameters; } + } + + /// + /// Decrypts data using selected key and algorithm. + /// + /// 3 + /// Alias of the key to be used for decryption. + /// + /// The password used in decrypting a key value. If password of policy is + /// provided in SaveKey(), the same password should be provided + /// + /// + /// Data to be decrypted (some algorithms may require additional information + /// embedded in encrypted data.AES GCM is an example). + /// + /// Decrypted data. + /// + /// keyAlias or cipherText is null. + /// + /// + /// Mandatory algorithm parameter is missing or invalid. + /// Optional algorithm parameter is invalid. + /// + /// + /// Key-protecting password isn't matched. + /// Key does not exist with keyAlias. + /// + /// + /// The key type specified by keyAlias should be compatible with the algorithm + /// specified in Parameters. + /// + public byte[] Decrypt(string keyAlias, string password, byte[] cipherText) + { + if (keyAlias == null || cipherText == null) + throw new ArgumentNullException("alias and ciphertxt should not be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.DecryptData( + Parameters.Ptr, keyAlias, password, + new Interop.CkmcRawBuffer( + new PinnedObject(cipherText), cipherText.Length), + out ptr), + "Failed to decrypt data"); + return new SafeRawBufferHandle(ptr).Data; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + } + } + + /// + /// Encrypts data using selected key and algorithm. + /// + /// 3 + /// Alias of the key to be used for encryption. + /// + /// The password used in decrypting a key value. If password of policy is + /// provided in SaveKey(), the same password should be provided. + /// + /// + /// Data to be encrypted. In case of AES algorithm there are no restrictions on + /// the size of data. For RSA the size must be smaller or equal to (key_size_in + /// bytes - 42). Example: for 1024 RSA key the maximum data size is + /// 1024/8 - 42 = 86. + /// + /// Encrypted data. + /// + /// keyAlias or plainText is null. + /// + /// + /// Mandatory algorithm parameter is missing or invalid. + /// Optional algorithm parameter is invalid. + /// + /// + /// Key-protecting password isn't matched. + /// Key does not exist with keyAlias. + /// + /// + /// The key type specified by keyAlias should be compatible with the algorithm + /// specified in Parameters. + /// + public byte[] Encrypt(string keyAlias, string password, byte[] plainText) + { + if (keyAlias == null || plainText == null) + throw new ArgumentNullException("alias or plaintxt should not be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.EncryptData( + Parameters.Ptr, keyAlias, password, + new Interop.CkmcRawBuffer( + new PinnedObject(plainText), plainText.Length), + out ptr), + "Failed to encrypt data"); + return new SafeRawBufferHandle(ptr).Data; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherAlgorithmType.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherAlgorithmType.cs new file mode 100644 index 0000000..7487ebc --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherAlgorithmType.cs @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for crypto cipher algorithm types. + /// + /// 3 + public enum CipherAlgorithmType : int + { + /// + /// AES-CTR algorithm + /// Supported parameters: + /// - ParameterName.AlgorithmType = AesCtr(mandatory), + /// - ParameterName.IV = 16 - byte initialization vector(mandatory) + /// - ParameterName.CounterLength = length of counter block in bits + /// (optional, only 128b is supported at the moment) + /// + AesCtr = 0x01, + /// + /// AES-CBC algorithm + /// Supported parameters: + /// - ParameterName.AlgorithmType = AesCbc(mandatory), + /// - ParameterName.IV = 16-byte initialization vector(mandatory) + /// + AesCbc, + /// + /// AES-GCM algorithm + /// Supported parameters: + /// - ParameterName.AlgorithmType = AesGcm(mandatory), + /// - ParameterName.IV = initialization vector(mandatory) + /// - ParameterName.TagLength = GCM tag length in bits. One of + /// {32, 64, 96, 104, 112, 120, 128} (optional, if not present the length 128 is used) + /// - CKMC_PARAM_ED_AAD = additional authentication data(optional) + /// + AesGcm, + /// + /// AES-CFB algorithm + /// Supported parameters: + /// - ParameterName.AlgorithmType = AesCfb(mandatory), + /// - ParameterName.IV = 16-byte initialization vector(mandatory) + /// + AesCfb, + /// + /// RSA-OAEP algorithm + /// Supported parameters: + /// - ParameterName.AlgorithmType = RsaOaep(required), + /// - ParameterName.Label = label to be associated with the message + /// (optional, not supported at the moment) + /// + RsaOaep + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameterName.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameterName.cs new file mode 100644 index 0000000..be3801e --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameterName.cs @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for cipher algorithm parameters. + /// + /// 3 + public enum CipherParameterName : int + { + /// + /// Algorithm Type + /// + AlgorithmType = 0x01, + /// + /// Initial Vector, 16B buffer (up to 2^64-1 bytes long in case of AES GCM) + /// + IV = 101, + /// + /// Integer - ctr length in bits + /// + CounterLength = 102, + /// + /// Additional authenticated data(AAD) + /// + AAD = 103, + /// + /// Tag Length + /// + TagLength = 104, + /// + /// Label + /// + Label = 105 + } + +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameters.cs new file mode 100644 index 0000000..450b159 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/CipherParameters.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A abstract class holding parameters for encryption and decryption. + /// + /// 3 + abstract public class CipherParameters + { + private SafeCipherParametersHandle _handle; + + /// + /// Cipher algorithm type. + /// + /// 3 + public CipherAlgorithmType Algorithm + { + get + { + return (CipherAlgorithmType)GetInteger( + CipherParameterName.AlgorithmType); + } + } + + // for inherited in internal only + internal CipherParameters() + { + } + + internal CipherParameters(CipherAlgorithmType algorithm) + { + this._handle = new SafeCipherParametersHandle(algorithm); + } + + internal void Add(CipherParameterName name, long value) + { + this._handle.SetInteger(name, value); + } + + internal void Add(CipherParameterName name, byte[] value) + { + this._handle.SetBuffer(name, value); + } + + internal long GetInteger(CipherParameterName name) + { + return this._handle.GetInteger(name); + } + + internal byte[] GetBuffer(CipherParameterName name) + { + return this._handle.GetBuffer(name); + } + + internal IntPtr Ptr + { + get { return this._handle.Ptr; } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/DsaSignatureParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/DsaSignatureParameters.cs new file mode 100644 index 0000000..2c58255 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/DsaSignatureParameters.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for DSA signature algorithm. + /// + /// 3 + public class DsaSignatureParameters : SignatureParameters + { + /// + /// A default constructor + /// + /// 3 + public DsaSignatureParameters() : base(SignatureAlgorithmType.Dsa) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/EcdsaSignatureParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/EcdsaSignatureParameters.cs new file mode 100644 index 0000000..3cd6e65 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/EcdsaSignatureParameters.cs @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for ECDSA signature algorithm. + /// + /// 3 + public class EcdsaSignatureParameters : SignatureParameters + { + /// + /// A default constructor + /// + /// 3 + public EcdsaSignatureParameters() : base(SignatureAlgorithmType.Ecdsa) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/HashAlgorithm.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/HashAlgorithm.cs new file mode 100644 index 0000000..66c6491 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/HashAlgorithm.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for hash algorithm + /// + /// 3 + public enum HashAlgorithm : int + { + /// + /// No Hash Algorithm + /// + None = 0, + /// + /// Hash Algorithm SHA1 + /// + Sha1, + /// + /// Hash Algorithm SHA256 + /// + Sha256, + /// + /// Hash Algorithm SHA384 + /// + Sha384, + /// + /// Hash Algorithm SHA512 + /// + Sha512 + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaOaepCipherParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaOaepCipherParameters.cs new file mode 100644 index 0000000..f0fbe9f --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaOaepCipherParameters.cs @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for RSA algorithm with OAEP mode. + /// + /// 3 + public class RsaOaepCipherParameters : CipherParameters + { + /// + /// A default constructor + /// + /// 3 + /// The CipherAlgorithmType in CipherParameters is set to CipherAlgorithmType.RsaOaep. + public RsaOaepCipherParameters() : base(CipherAlgorithmType.RsaOaep) + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaPaddingAlgorithm.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaPaddingAlgorithm.cs new file mode 100644 index 0000000..5da20f6 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaPaddingAlgorithm.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for RSA padding algorithm + /// + /// 3 + public enum RsaPaddingAlgorithm : int + { + /// + /// No Padding + /// + None = 0, + /// + /// PKCS#1 Padding + /// + Pkcs1, + /// + /// X9.31 padding + /// + X931 + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaSignatureParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaSignatureParameters.cs new file mode 100644 index 0000000..b1dfe7b --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/RsaSignatureParameters.cs @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A class holding parameters for RSA signature algorithm. + /// + /// 3 + public class RsaSignatureParameters : SignatureParameters + { + /// + /// A default constructor + /// + /// 3 + /// The RsaPadding is set to RsaPaddingAlgorithm.None. + public RsaSignatureParameters() : base(SignatureAlgorithmType.Rsa) + { + } + + /// + /// RSA padding algorithm + /// + /// 3 + public RsaPaddingAlgorithm RsaPadding + { + get { return (RsaPaddingAlgorithm)Get(SignatureParameterName.RsaPaddingAlgorithm); } + set { Add(SignatureParameterName.RsaPaddingAlgorithm, (int)value); } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SafeCipherParametersHandle.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SafeCipherParametersHandle.cs new file mode 100644 index 0000000..8d7e8cf --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SafeCipherParametersHandle.cs @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Security.SecureRepository.Crypto +{ + internal class SafeCipherParametersHandle : SafeHandle + { + internal SafeCipherParametersHandle(CipherAlgorithmType algorithm) : + base(IntPtr.Zero, true) + { + IntPtr ptr = IntPtr.Zero; + Interop.CkmcTypes.GenerateNewParam((int)algorithm, out ptr); + this.SetHandle(ptr); + } + + internal void SetInteger(CipherParameterName name, long value) + { + Interop.CheckNThrowException( + Interop.CkmcTypes.ParamListSetInteger( + Ptr, (int)name, value), + "Failed to add parameter."); + } + + internal void SetBuffer(CipherParameterName name, byte[] value) + { + var rawBuff = new Interop.CkmcRawBuffer(new PinnedObject(value), value.Length); + IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(rawBuff)); + try + { + Marshal.StructureToPtr(rawBuff, ptr, false); + Interop.CheckNThrowException( + Interop.CkmcTypes.ParamListSetBuffer( + Ptr, (int)name, ptr), + "Failed to add parameter."); + } + finally + { + Marshal.FreeHGlobal(ptr); + } + } + + internal long GetInteger(CipherParameterName name) + { + long value = 0; + Interop.CheckNThrowException( + Interop.CkmcTypes.ParamListGetInteger( + Ptr, (int)name, out value), + "Failed to get parameter."); + return value; + } + + internal byte[] GetBuffer(CipherParameterName name) + { + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcTypes.ParamListGetBuffer( + Ptr, (int)name, out ptr), + "Failed to get parameter."); + return new SafeRawBufferHandle(ptr).Data; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + } + } + + internal CipherAlgorithmType Algorithm + { + get + { + return (CipherAlgorithmType)GetInteger( + CipherParameterName.AlgorithmType); + } + } + + internal IntPtr Ptr + { + get { return this.handle; } + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + Interop.CkmcTypes.ParamListFree(this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Signature.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Signature.cs new file mode 100644 index 0000000..3e34ce7 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/Signature.cs @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// This class provides the methods creating and verifying a signature. + /// + /// 3 + public class Signature + { + private SignatureParameters _parameters; + + /// + /// A constructor of Signature that takes the algorithm specific parameters. + /// + /// 3 + /// The algorithm specific parameters. + public Signature(SignatureParameters parameters) + { + _parameters = parameters; + } + + /// + /// The algorithm specific parameters. + /// + /// 3 + public SignatureParameters Parameters + { + get { return _parameters; } + } + + /// + /// Creates a signature on a given message using a private key and returns + /// the signature. + /// + /// 3 + /// The name of private key. + /// + /// The password used in decrypting a private key value. + /// + /// The message that is signed with a private key. + /// A newly created signature. + /// + /// privateKeyAlias or message is null. + /// + /// + /// privateKeyAlias is invalid format. + /// + /// + /// Key-protecting password isn't matched. + /// Key does not exist with privateKeyAlias. + /// + /// + /// The key type specified by privateKeyAlias should be compatible with the + /// algorithm specified in Parameters. + /// + /// + /// If password of policy is provided during storing a key, the same password + /// should be provided. + /// + public byte[] Sign(string privateKeyAlias, string password, byte[] message) + { + if (privateKeyAlias == null || message == null) + throw new ArgumentNullException("alias and message should not be null"); + + int hash = (int)HashAlgorithm.None; + try + { + hash = (int)Parameters.Get(SignatureParameterName.HashAlgorithm); + } + catch {} + + int rsaPadding = (int)RsaPaddingAlgorithm.None; + try + { + rsaPadding = (int)Parameters.Get(SignatureParameterName.RsaPaddingAlgorithm); + } + catch {} + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.CreateSignature( + privateKeyAlias, password, + new Interop.CkmcRawBuffer( + new PinnedObject(message), message.Length), + hash, rsaPadding, out ptr), + "Failed to generate signature"); + return new SafeRawBufferHandle(ptr).Data; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + } + } + + /// + /// Verifies a given signature on a given message using a public key and returns + /// the signature status. + /// + /// 3 + /// The name of public key. + /// + /// The password used in decrypting a public key value. + /// + /// The input on which the signature is created. + /// The signature that is verified with public key. + /// + /// The signature status. True is returned when the signature is valid. + /// + /// + /// publicKeyAlias, message or signature is null. + /// + /// + /// publicKeyAlias is invalid format. + /// + /// + /// Key-protecting password isn't matched. + /// Key does not exist with publicKeyAlias. + /// + /// + /// The key type specified by publicKeyAlias should be compatible with the + /// algorithm specified in Parameters. + /// + /// + /// If password of policy is provided during storing a key, the same password + /// should be provided. + /// + public bool Verify( + string publicKeyAlias, string password, byte[] message, byte[] signature) + { + if (publicKeyAlias == null || message == null || signature == null) + throw new ArgumentNullException("mandatory arg should not be null"); + + int hash = (int)HashAlgorithm.None; + try + { + hash = (int)Parameters.Get(SignatureParameterName.HashAlgorithm); + } + catch {} + + int rsaPadding = (int)RsaPaddingAlgorithm.None; + try + { + rsaPadding = (int)Parameters.Get(SignatureParameterName.RsaPaddingAlgorithm); + } + catch {} + + + int ret = Interop.CkmcManager.VerifySignature( + publicKeyAlias, + password, + new Interop.CkmcRawBuffer(new PinnedObject(message), message.Length), + new Interop.CkmcRawBuffer(new PinnedObject(signature), signature.Length), + hash, + rsaPadding); + + if (ret == (int)Interop.KeyManagerError.VerificationFailed) + return false; + Interop.CheckNThrowException(ret, "Failed to verify signature"); + + return true; + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureAlgorithmType.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureAlgorithmType.cs new file mode 100644 index 0000000..68b5ba1 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureAlgorithmType.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for signature algorithm types. + /// + /// 3 + public enum SignatureAlgorithmType : int + { + /// + /// RSA signature algorithm + /// + Rsa = 0x01, + /// + /// DSA signature algorithm + /// + Dsa, + /// + /// ECDSA signature algorithm + /// + Ecdsa + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameterName.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameterName.cs new file mode 100644 index 0000000..1662ad1 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameterName.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// Enumeration for signature algorithm parameters. + /// + /// 3 + internal enum SignatureParameterName : int + { + /// + /// Signaturea Algorithm Type + /// + AlgorithmType = 0x01, + /// + /// Hash Algorithm Type + /// + HashAlgorithm, + /// + /// RSA Padding Algorithm Type + /// + RsaPaddingAlgorithm + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameters.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameters.cs new file mode 100644 index 0000000..bccf4cc --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Crypto/SignatureParameters.cs @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Security.SecureRepository.Crypto +{ + /// + /// A abstract class holding parameters for signing and verification. + /// + /// 3 + abstract public class SignatureParameters + { + private Dictionary _parameters; + + /// + /// Signature algorithm type. + /// + /// 3 + public SignatureAlgorithmType SignatureAlgorithm + { + get { return (SignatureAlgorithmType)Get(SignatureParameterName.AlgorithmType); } + } + + /// + /// Hash algorithm used in signing anve verification. + /// + /// 3 + public HashAlgorithm HashAlgorithm + { + get { return (HashAlgorithm)Get(SignatureParameterName.HashAlgorithm); } + set { Add(SignatureParameterName.HashAlgorithm, (int)value); } + } + + // for inherited in internal only + internal SignatureParameters() + { + } + + internal SignatureParameters(SignatureAlgorithmType algorithm) + { + _parameters = new Dictionary(); + Add(SignatureParameterName.AlgorithmType, (int)algorithm); + } + + internal void Add(SignatureParameterName name, int value) + { + _parameters.Add(name, value); + } + + internal int Get(SignatureParameterName name) + { + if (_parameters.ContainsKey(name)) + return _parameters[name]; + else + throw new ArgumentException("No parameter for a given SignatureParameterName "); + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataFormat.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataFormat.cs new file mode 100644 index 0000000..cd96acf --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataFormat.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository +{ + /// + /// Enumeration for data format + /// + /// 3 + public enum DataFormat : int + { + /// + /// DER format base64 encoded data + /// + DerBase64 = 0, + /// + /// DER encoded data + /// + Der, + /// + /// PEM encoded data. It consists of the DER format base64 encoded + /// with additional header and footer lines. + /// + Pem + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataManager.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataManager.cs new file mode 100644 index 0000000..38fd661 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/DataManager.cs @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// This class provides the methods storing and retrieving data. + /// + /// 3 + public class DataManager : Manager + { + /// + /// Gets data from secure repository. + /// + /// 3 + /// The name of a certificate to retrieve. + /// + /// The password used in decrypting a data value. + /// If password of policy is provided in SaveData(), the same password should + /// be provided. + /// + /// Data specified by alias. + /// + /// Alias argument is null. + /// + /// + /// Alias argument is invalid format. + /// + /// + /// Data does not exist with the alias or data-protecting password isn't matched. + /// + static public byte[] Get(string alias, string password) + { + if (alias == null) + throw new ArgumentNullException("alias cannot be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetData(alias, password, out ptr), + "Failed to get certificate. alias=" + alias); + return new SafeRawBufferHandle(ptr).Data; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + } + } + + /// + /// Gets all alias of data which the client can access. + /// + /// 3 + /// All alias of data which the client can access. + /// No alias to get. + static public IEnumerable GetAliases() + { + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetDataAliasList(out ptr), + "Failed to get data aliases"); + return new SafeAliasListHandle(ptr).Aliases; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.AliasListAllFree(ptr); + } + } + + /// + /// Stores data inside secure repository based on the provided policy. + /// + /// 3 + /// The name of data to be stored. + /// The binary value to be stored. + /// The policy about how to store data securely. + /// + /// Any of argument is null. + /// + /// + /// Alias argument is invalid format. Data policy cannot be unextractable. + /// + /// + /// Data with alias does already exist. + /// + static public void Save(string alias, byte[] data, Policy policy) + { + if (alias == null || data == null || policy == null) + throw new ArgumentNullException("alias and policy should be null"); + else if (policy.Extractable == false) + throw new ArgumentException("Data should be extractable"); + + Interop.CheckNThrowException( + Interop.CkmcManager.SaveData( + alias, + new Interop.CkmcRawBuffer(new PinnedObject(data), data.Length), + policy.ToCkmcPolicy()), + "Failed to save data. alias=" + alias); + } + + // to be static class safely + internal DataManager() + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/EllipticCurveType.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/EllipticCurveType.cs new file mode 100644 index 0000000..6e52871 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/EllipticCurveType.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository +{ + /// + /// Enumeration for elliptic curve + /// + /// 3 + public enum EllipticCurveType : int + { + /// + /// Elliptic curve domain "secp192r1" listed in "SEC 2" recommended elliptic curve domain + /// + Prime192V1 = 0, + /// + /// "SEC 2" recommended elliptic curve domain - secp256r1 + /// + Prime256V1, + /// + /// NIST curve P-384(covers "secp384r1", the elliptic curve domain listed in See SEC 2 + /// + Secp384R1 + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Key.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Key.cs new file mode 100644 index 0000000..e175f55 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Key.cs @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// Class that represents a key. + /// + /// 3 + public class Key + { + /// + /// A constructor of Key that takes the binary, its type, and optional password + /// of binary. + /// + /// 3 + /// + /// The binary value of a key. This binary may be encrypted with binaryPassword. + /// + /// The key's type. + /// + /// The password used to decrypt binary when binary is encrypted. + /// + public Key(byte[] binary, KeyType type, string binaryPassword) + { + this.Binary = binary; + this.Type = type; + this.BinaryPassword = binaryPassword; + } + + internal Key(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new ArgumentNullException("Returned ptr from CAPI cannot be null"); + + var ckmcKey = Marshal.PtrToStructure(ptr); + this.Binary = new byte[(int)ckmcKey.size]; + Marshal.Copy(ckmcKey.rawKey, this.Binary, 0, this.Binary.Length); + this.Type = (KeyType)ckmcKey.keyType; + this.BinaryPassword = ckmcKey.password; + } + + // Refresh handle(IntPtr) always. Because C# layer + // properties(Binary, Type, BinaryPassword) could be changed. + internal IntPtr GetHandle() + { + IntPtr ptr = IntPtr.Zero; + try + { + CheckNThrowException( + Interop.CkmcTypes.KeyNew( + this.Binary, (UIntPtr)this.Binary.Length, (int)this.Type, + this.BinaryPassword, out ptr), + "Failed to create key"); + + return ptr; + } + catch + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.KeyFree(ptr); + + throw; + } + } + + /// + /// The binary value of a key. + /// + /// 3 + public byte[] Binary + { + get; set; + } + + /// + /// The key's type. + /// + /// 3 + public KeyType Type + { + get; set; + } + + /// + /// The password used to decrypt binary when binary is encrypted. It's optional. + /// + /// 3 + public string BinaryPassword + { + get; set; + } + + internal CkmcKey ToCkmcKey() + { + return new Interop.CkmcKey( + (Binary == null) ? IntPtr.Zero : new PinnedObject(this.Binary), + (Binary == null) ? 0 : this.Binary.Length, + (int)this.Type, + this.BinaryPassword); + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyManager.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyManager.cs new file mode 100644 index 0000000..cb2395f --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyManager.cs @@ -0,0 +1,304 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Security.SecureRepository +{ + /// + /// This class provides the methods storing, retrieving, and creating keys. + /// + /// 3 + public class KeyManager : Manager + { + /// + /// Gets a key from secure repository. + /// + /// 3 + /// The name of a key to retrieve. + /// + /// The password used in decrypting a key value. + /// If password of policy is provided in SaveKey(), the same password should + /// be provided. + /// + /// A key specified by alias. + /// + /// Alias argument is null. + /// + /// + /// Alias argument is invalid format. + /// + /// + /// Key does not exist with the alias or key-protecting password isn't matched. + /// + static public Key Get(string alias, string password) + { + if (alias == null) + throw new ArgumentNullException("alias cannot be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetKey(alias, password, out ptr), + "Failed to get key. alias=" + alias); + return new Key(ptr); + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.KeyFree(ptr); + } + } + + /// + /// Gets all alias of keys which the client can access. + /// + /// 3 + /// All alias of keys which the client can access. + /// No alias to get. + static public IEnumerable GetAliases() + { + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetKeyAliasList(out ptr), + "Failed to get key aliases."); + return new SafeAliasListHandle(ptr).Aliases; + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.AliasListAllFree(ptr); + } + } + + /// + /// Stores a key inside secure repository based on the provided policy. + /// + /// 3 + /// The name of a key to be stored. + /// The key's binary value to be stored. + /// The policy about how to store a key securely. + /// + /// Any of argument is null. + /// + /// + /// Alias argument is invalid format. key argument is invalid format. + /// + /// + /// Key with alias does already exist. + /// + /// + /// Type in key may be set to KeyType.None as an input. + /// Type is determined inside secure reposioty during storing keys. + /// + /// + /// If password in policy is provided, the key is additionally encrypted with + /// the password in policy. + /// + static public void Save(string alias, Key key, Policy policy) + { + if (alias == null || key == null || policy == null) + throw new ArgumentNullException("More than one of argument is null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.SaveKey( + alias, key.ToCkmcKey(), policy.ToCkmcPolicy()), + "Failed to save Key. alias=" + alias); + } + + /// + /// Creates RSA private/public key pair and stores them inside secure repository + /// based on each policy. + /// + /// 3 + /// + /// The size of key strength to be created. 1024, 2048, and 4096 are supported. + /// + /// The name of private key to be stored. + /// The name of public key to be stored. + /// + /// The policy about how to store a private key securely. + /// + /// + /// The policy about how to store a public key securely. + /// + /// + /// Any of argument is null. + /// + /// + /// size is invalid. privateKeyAlias or publicKeyAlias is invalid format. + /// + /// + /// Key with privateKeyAlias or publicKeyAlias does already exist. + /// + /// + /// If password in policy is provided, the key is additionally encrypted with the + /// password in policy. + /// + static public void CreateRsaKeyPair( + int size, string privateKeyAlias, string publicKeyAlias, + Policy privateKeyPolicy, Policy publicKeyPolicy) + { + if (size != 1024 && size != 2048 && size != 4096) + throw new ArgumentException(string.Format("Invalid key size({0})", size)); + else if (privateKeyAlias == null || publicKeyAlias == null || + privateKeyPolicy == null || publicKeyPolicy == null) + throw new ArgumentNullException("alias and policy should not be null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.CreateKeyPairRsa( + (UIntPtr)size, privateKeyAlias, publicKeyAlias, + privateKeyPolicy.ToCkmcPolicy(), publicKeyPolicy.ToCkmcPolicy()), + "Failed to Create RSA Key Pair"); + } + + /// + /// Creates DSA private/public key pair and stores them inside secure repository + /// based on each policy. + /// + /// 3 + /// + /// The size of key strength to be created. 1024, 2048, 3072, and 4096 are + /// supported. + /// + /// The name of private key to be stored. + /// The name of public key to be stored. + /// + /// The policy about how to store a private key securely. + /// + /// + /// The policy about how to store a public key securely. + /// + /// + /// Any of argument is null. + /// + /// + /// size is invalid. privateKeyAlias or publicKeyAlias is invalid format. + /// + /// + /// Key with privateKeyAlias or publicKeyAlias does already exist. + /// + /// + /// If password in policy is provided, the key is additionally encrypted with + /// the password in policy. + /// + static public void CreateDsaKeyPair( + int size, string privateKeyAlias, string publicKeyAlias, + Policy privateKeyPolicy, Policy publicKeyPolicy) + { + if (size != 1024 && size != 2048 && size != 3072 && size != 4096) + throw new ArgumentException(string.Format("Invalid key size({0})", size)); + else if (privateKeyAlias == null || publicKeyAlias == null || + privateKeyPolicy == null || publicKeyPolicy == null) + throw new ArgumentNullException("alias and policy should not be null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.CreateKeyPairDsa( + (UIntPtr)size, privateKeyAlias, publicKeyAlias, + privateKeyPolicy.ToCkmcPolicy(), publicKeyPolicy.ToCkmcPolicy()), + "Failed to Create DSA Key Pair"); + } + + /// + /// Creates ECDSA private/public key pair and stores them inside secure repository + /// based on each policy. + /// + /// 3 + /// The type of elliptic curve of ECDSA. + /// The name of private key to be stored. + /// The name of public key to be stored. + /// + /// The policy about how to store a private key securely. + /// + /// + /// The policy about how to store a public key securely. + /// + /// + /// Any of argument is null. + /// + /// + /// Elliptic curve type is invalid. privateKeyAlias or publicKeyAlias is + /// invalid format. + /// + /// + /// Key with privateKeyAlias or publicKeyAlias does already exist. + /// + /// + /// If password in policy is provided, the key is additionally encrypted with + /// the password in policy. + /// + static public void CreateEcdsaKeyPair( + EllipticCurveType type, string privateKeyAlias, string publicKeyAlias, + Policy privateKeyPolicy, Policy publicKeyPolicy) + { + if (privateKeyAlias == null || publicKeyAlias == null || + privateKeyPolicy == null || publicKeyPolicy == null) + throw new ArgumentNullException("alias and policy should not be null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.CreateKeyPairEcdsa( + (int)type, privateKeyAlias, publicKeyAlias, + privateKeyPolicy.ToCkmcPolicy(), publicKeyPolicy.ToCkmcPolicy()), + "Failed to Create ECDSA Key Pair"); + } + + /// + /// Creates AES key and stores it inside secure repository based on each policy. + /// + /// 3 + /// + /// The size of key strength to be created. 128, 192 and 256 are supported. + /// + /// The name of key to be stored. + /// The policy about how to store the key securely. + /// + /// keyAlias or policy is null. + /// + /// + /// Key size is invalid. keyAlias is invalid format. + /// + /// + /// Key with privateKeyAlias or publicKeyAlias does already exist. + /// + /// + /// If password in policy is provided, the key is additionally encrypted with + /// the password in policy. + /// + static public void CreateAesKey(int size, string keyAlias, Policy policy) + { + if (size != 128 && size != 192 && size != 256) + throw new ArgumentException(string.Format("Invalid key size({0})", size)); + else if (keyAlias == null || policy == null) + throw new ArgumentNullException("alias and policy should not be null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.CreateKeyAes( + (UIntPtr)size, keyAlias, policy.ToCkmcPolicy()), + "Failed to AES Key"); + } + + // to be static class safely + internal KeyManager() + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyType.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyType.cs new file mode 100644 index 0000000..483af31 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/KeyType.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository +{ + /// + /// Enumeration for key types of key manager. + /// + /// 3 + public enum KeyType : int + { + /// + /// Key type not specified + /// + None = 0, + /// + /// RSA public key + /// + RsaPublic, + /// + /// RSA private key + /// + RsaPrivate, + /// + /// ECDSA public key + /// + EcdsaPublic, + /// + /// ECDSA private key + /// + EcdsaPrivate, + /// + /// DSA public key + /// + DsaPublic, + /// + /// DSA private key + /// + DsaPrivate, + /// + /// AES key + /// + Aes + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Manager.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Manager.cs new file mode 100644 index 0000000..035eb8e --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Manager.cs @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; + +namespace Tizen.Security.SecureRepository +{ + /// + /// This class is a base class of XxxManager classes. It provides the common methods + /// for all sub classes. + /// + /// 3 + public class Manager + { + /// + /// Creates a new full alias which is concatenation of owner id and alias. + /// + /// 3 + /// Data owner's id. This should be package id if data + /// owner is application. If you want to access data stored by system services, + /// use CreateFullSystemAlias() instead. + /// Data alias. + static public string CreateFullAlias(string ownerId, string alias) + { + return ownerId + Manager.OwnerIdSeperator + alias; + } + + /// + /// Creates a new full alias which is concatenation of system service's + /// owner id and alias. + /// + /// 3 + /// Data alias which is owned by system service. + static public string CreateFullSystemAlias(string alias) + { + return Manager.CreateFullAlias(Manager.SystemOwnerId, alias); + } + + /// + /// Removes a an entry (no matter of type) from the key manager. + /// + /// 3 + /// Item alias to be removed. + /// alias is null. + /// alias is invalid format. + /// alias does not exist. + /// + /// To remove item, client must have remove permission to the specified item. + /// + /// The item owner can remove by default. + static public void RemoveAlias(string alias) + { + if (alias == null) + throw new ArgumentNullException("alias should not be null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.RemoveAlias(alias), + "Failed to remove alias. alias=" + alias); + } + + /// + /// Allows another application to access client's application data. + /// + /// 3 + /// Item alias for which access will be granted. + /// + /// Package id of the application that will gain access rights. + /// + /// + /// Mask of permissions(Permission enum) granted for an application with + /// otherPackageId. + /// + /// + /// alias or otherPackageId is null. + /// + /// + /// alias or otherPackageId is invalid format. + /// + /// alias does not exist. + /// Data identified by alias should exist. + /// The item owner can set permissions. + static public void SetPermission( + string alias, string otherPackageId, int permissions) + { + if (alias == null || otherPackageId == null) + throw new ArgumentNullException("alias or otherPackageId is null"); + + Interop.CheckNThrowException( + Interop.CkmcManager.SetPermission(alias, otherPackageId, permissions), + "Failed to set permission. alias=" + alias); + } + + // to being static base class + internal Manager() + { + } + + private const string OwnerIdSeperator = " "; + private const string SystemOwnerId = "/System"; + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/OcspStatus.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/OcspStatus.cs new file mode 100644 index 0000000..b6517e8 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/OcspStatus.cs @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Security.SecureRepository +{ + /// + /// Enumeration for OCSP status. + /// + /// 3 + public enum OcspStatus : int + { + /// + /// OCSP status is good + /// + Good = 0x00, + /// + /// The certificate is revoked + /// + Revoked = 0x01, + /// + /// Unknown error + /// + Unknown = 0x02, + /// + /// The certificate does not provide OCSP extension + /// + Unsupported = 0x03, + /// + /// The invalid URL in certificate OCSP extension + /// + InvalidUrl = 0x04, + /// + /// The invalid response from OCSP server + /// + InvalidResponse = 0x05, + /// + /// OCSP remote server error + /// + RemoteError = 0x06, + /// + /// Network connection error + /// + NetworkError = 0x07, + /// + /// Internal error + /// + InternalError = 0x08 + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Permission.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Permission.cs new file mode 100644 index 0000000..9dc4bda --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Permission.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +namespace Tizen.Security.SecureRepository +{ + + /// + /// Enumeration for permissions to access/modify alias. + /// + /// 3 + public enum Permission : int + { + /// + /// Clear permissions + /// + None = 0x00, + /// + /// Eead allowed + /// + Read = 0x01, + /// + /// Remove allowed + /// + Remove = 0x02 + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/PinnedObject.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/PinnedObject.cs new file mode 100644 index 0000000..83d3e4d --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/PinnedObject.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Security.SecureRepository +{ + internal class PinnedObject : IDisposable + { + private bool _disposed = false; + private GCHandle _pinnedObj; + + public PinnedObject(Object obj) + { + _pinnedObj = GCHandle.Alloc(obj, GCHandleType.Pinned); + } + + ~PinnedObject() + { + Dispose(false); + } + + public static implicit operator IntPtr(PinnedObject pinned) + { + return pinned._pinnedObj.AddrOfPinnedObject(); + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + _pinnedObj.Free(); + _disposed = true; + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12.cs new file mode 100644 index 0000000..fea73f9 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12.cs @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// Class that represents a PKCS#12 contents. + /// It has a private key or its certificate or all the members of a chain of trust. + /// + /// 3 + public class Pkcs12 + { + private SafeCertificateListHandle _certChainHandle = null; + + /// + /// Load Pkcs12 from the given PKCS#12 file path. + /// + /// 3 + /// The path of PKCS12 file to be loaded. + /// The passphrase used to decrypt the PCKS12 file. + /// If PKCS12 file is not encrypted, passphrase can be null. + /// filePath is null. + /// + /// No file on filePath. + /// No permission to access file. + /// File is invalid PKCS12 format. + /// File cannot be extracted with provided filePassword. + /// + static public Pkcs12 Load(string filePath, string filePassword) + { + if (filePath == null) + throw new ArgumentNullException("filePath should not be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcTypes.Pkcs12Load(filePath, filePassword, out ptr), + "Failed to load PKCS12. file=" + filePath); + return new Pkcs12(ptr); + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.Pkcs12Free(ptr); + } + } + + /// + /// A constructor of Key that takes a private key. + /// + /// 3 + /// A private key. + public Pkcs12(Key privateKey) + { + this.PrivateKey = privateKey; + this.Certificate = null; + this.CaChain = null; + } + + /// + /// A constructor of Key that takes a private key, its corresponding certicate, + /// and CA's certificate chain. + /// + /// 3 + /// A private key. + /// A certificate corresponding the private key + /// + /// A certificate chain of CA(Certificate Authority) that issued the certificate. + /// + public Pkcs12(Key privateKey, + Certificate certificate, + IEnumerable caChain) + { + this.PrivateKey = privateKey; + this.Certificate = certificate; + this.CaChain = caChain; + } + + internal Pkcs12(IntPtr ptr) + { + var ckmcPkcs12 = Marshal.PtrToStructure(ptr); + + this.PrivateKey = new Key(ckmcPkcs12.privateKey); + if (ckmcPkcs12.certificate != IntPtr.Zero) + this.Certificate = new Certificate(ckmcPkcs12.certificate); + if (ckmcPkcs12.caChain != IntPtr.Zero) + this._certChainHandle = new SafeCertificateListHandle(ckmcPkcs12.caChain); + } + + internal IntPtr GetHandle() + { + IntPtr keyPtr = IntPtr.Zero; + IntPtr certPtr = IntPtr.Zero; + IntPtr cacertPtr = IntPtr.Zero; + IntPtr p12Ptr = IntPtr.Zero; + try + { + keyPtr = this.PrivateKey.GetHandle(); + + if (this.Certificate != null) + certPtr = this.Certificate.GetHandle(); + + if (this._certChainHandle != null) + cacertPtr = this._certChainHandle.GetHandle(); + + Interop.CheckNThrowException( + Interop.CkmcTypes.Pkcs12New(keyPtr, certPtr, cacertPtr, out p12Ptr), + "Failed to create pkcs12"); + + return p12Ptr; + } + catch + { + if (p12Ptr != IntPtr.Zero) + { + Interop.CkmcTypes.Pkcs12Free(p12Ptr); + } + else + { + if (keyPtr != IntPtr.Zero) + Interop.CkmcTypes.KeyFree(keyPtr); + if (certPtr != IntPtr.Zero) + Interop.CkmcTypes.CertFree(certPtr); + if (cacertPtr != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(cacertPtr); + } + + throw; + } + } + + /// + /// A private key. + /// + /// 3 + public Key PrivateKey + { + get; set; + } + + /// + /// A certificate corresponding the private key. + /// + /// 3 + public Certificate Certificate + { + get; set; + } + + /// + /// A certificate chain of CA(Certificate Authority) that issued the certificate. + /// + /// 3 + public IEnumerable CaChain + { + get + { + if (this._certChainHandle == null) + return null; + else + return this._certChainHandle.Certificates; + } + set + { + if (value == null) + this._certChainHandle = null; + else + this._certChainHandle = new SafeCertificateListHandle(value); + } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12Manager.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12Manager.cs new file mode 100644 index 0000000..661db40 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Pkcs12Manager.cs @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// This class provides the methods storing, retrieving Pkcs12 contents. + /// + /// 3 + public class Pkcs12Manager : Manager + { + /// + /// Gets Pkcs12 contents from secure repository. + /// + /// 3 + /// The name of data to retrieve. + /// + /// The password used in decrypting a private key value. If password of + /// keyPolicy is provided in SavePkcs12(), the same password should be provided + /// + /// + /// The password used in decrypting a certificate value. If password of + /// certificatePolicy is provided in SavePkcs12(), the same password should be + /// provided + /// + /// A Pkcs12 data specified by alias. + /// Alias argument is null. + /// + /// Alias argument is invalid format. + /// + /// + /// Pkcs12 does not exist with the alias. + /// Optional password of key in Pkcs12 isn't matched. + /// Optional password of certificate in Pkcs12 isn't matched. + /// + static public Pkcs12 Get( + string alias, string keyPassword, string cerificatePassword) + { + if (alias == null) + throw new ArgumentNullException("alias should not be null"); + + IntPtr ptr = IntPtr.Zero; + + try + { + Interop.CheckNThrowException( + Interop.CkmcManager.GetPkcs12( + alias, keyPassword, cerificatePassword, out ptr), + "Failed to get PKCS12. alias=" + alias); + return new Pkcs12(ptr); + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.Pkcs12Free(ptr); + } + } + + /// + /// Stores PKCS12's contents inside key manager based on the provided policies. + /// All items from the PKCS12 will use the same alias. + /// + /// 3 + /// The name of a data to be stored. + /// The pkcs12 data to be stored. + /// + /// The policy about how to store pkcs's private key. + /// + /// + /// The policy about how to store pkcs's certificate. + /// + /// Any of argument is null. + /// + /// Alias argument is invalid format. Pkcs12 argument is invalid format. + /// + /// + /// Pkcs12 with alias does already exist. + /// + static public void Save( + string alias, Pkcs12 pkcs12, Policy keyPolicy, Policy certificatePolicy) + { + if (alias == null || pkcs12 == null || keyPolicy == null || + certificatePolicy == null) + throw new ArgumentNullException("any of argument is null"); + + IntPtr ptr = IntPtr.Zero; + try + { + ptr = pkcs12.GetHandle(); + + Interop.CheckNThrowException( + Interop.CkmcManager.SavePkcs12( + alias, ptr, keyPolicy.ToCkmcPolicy(), + certificatePolicy.ToCkmcPolicy()), + "Failed to save PKCS12. alias=" + alias); + } + finally + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.Pkcs12Free(ptr); + } + } + + // to be static class safely + internal Pkcs12Manager() + { + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Policy.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Policy.cs new file mode 100644 index 0000000..56fac91 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/Policy.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + /// + /// A class for a policy for storing key, certificate, and binary data. + /// + /// 3 + public class Policy + { + /// + /// A default constructor of Policy with default policy. + /// + /// 3 + /// The default value for Password is null and the default value for Extractabl is false. + public Policy() + { + Password = null; + Extractable = true; + } + + /// + /// A constructor of Key that takes the password and the flag for extractable. + /// + /// 3 + /// Used to encrypt data secure repository. + /// If true key may be extracted from secure repository. + public Policy(String password, bool extractable) + { + Password = password; + Extractable = extractable; + } + + /// + /// Used to encrypt data secure repository. If it is not null, the data + /// (or key, or certificate) is stored encrypted with this password inside secure repository + /// + /// 3 + public String Password + { + get; set; + } + + /// + /// If true key may be extracted from secure repository. + /// + /// 3 + public bool Extractable + { + get; set; + } + + internal CkmcPolicy ToCkmcPolicy() + { + return new Interop.CkmcPolicy(Password, Extractable); + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeAliasListHandle.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeAliasListHandle.cs new file mode 100644 index 0000000..13c15d6 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeAliasListHandle.cs @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + internal class SafeAliasListHandle + { + public SafeAliasListHandle(IntPtr ptr) + { + var cur = ptr; + var aliases = new List(); + while (cur != IntPtr.Zero) + { + var ckmcAliasList = Marshal.PtrToStructure(cur); + aliases.Add(Marshal.PtrToStringAnsi(ckmcAliasList.alias)); + cur = ckmcAliasList.next; + } + + this.Aliases = aliases; + } + + public List Aliases + { + get; set; + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeCertificateListHandle.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeCertificateListHandle.cs new file mode 100644 index 0000000..7b1f75a --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeCertificateListHandle.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + internal class SafeCertificateListHandle + { + private IEnumerable _certificates; + + public SafeCertificateListHandle(IEnumerable certs) + { + _certificates = certs; + } + + public SafeCertificateListHandle(IntPtr ptr) + { + var cur = ptr; + var certs = new List(); + while (cur != IntPtr.Zero) + { + var ckmcCertList = Marshal.PtrToStructure(cur); + certs.Add(new Certificate(ckmcCertList.cert)); + cur = ckmcCertList.next; + } + + this._certificates = certs; + } + + public IEnumerable Certificates + { + get { return _certificates; } + } + + internal IntPtr GetHandle() + { + if (_certificates == null) + return IntPtr.Zero; + + IntPtr first = IntPtr.Zero; + IntPtr previous = IntPtr.Zero; + IntPtr certPtr = IntPtr.Zero; + + try + { + foreach (var cert in this._certificates) + { + // initialize local variables to release memory safely for + // in case of exception occured + certPtr = IntPtr.Zero; + + certPtr = cert.GetHandle(); + + IntPtr outCertList; + if (previous == IntPtr.Zero) + { + Interop.CheckNThrowException( + Interop.CkmcTypes.CertListNew(certPtr, out outCertList), + "Failed to create new CertificateList."); + first = outCertList; + } + else + { + Interop.CheckNThrowException( + Interop.CkmcTypes.CertListAdd(previous, certPtr, + out outCertList), + "Failed to add Certificate to CertificateList."); + } + previous = outCertList; + } + + return first; + } + catch + { + if (first != IntPtr.Zero) + Interop.CkmcTypes.CertListAllFree(first); + if (certPtr != IntPtr.Zero) + Interop.CkmcTypes.CertFree(certPtr); + + throw; + } + } + } +} diff --git a/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeRawBufferHandle.cs b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeRawBufferHandle.cs new file mode 100644 index 0000000..04c0db6 --- /dev/null +++ b/src/Tizen.Security.SecureRepository/Tizen.Security.SecureRepository/SafeRawBufferHandle.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; +using static Interop; + +namespace Tizen.Security.SecureRepository +{ + internal class SafeRawBufferHandle + { + public SafeRawBufferHandle(IntPtr ptr) + { + if (ptr == IntPtr.Zero) + throw new ArgumentNullException("Returned ptr from CAPI cannot be null"); + + var ckmcBuf = Marshal.PtrToStructure(ptr); + byte[] data = new byte[(int)ckmcBuf.size]; + Marshal.Copy(ckmcBuf.data, data, 0, data.Length); + this.Data = data; + } + + internal IntPtr GetHandle() + { + IntPtr ptr = IntPtr.Zero; + try + { + CheckNThrowException( + Interop.CkmcTypes.BufferNew( + this.Data, (UIntPtr)this.Data.Length, out ptr), + "Failed to create buf"); + + return ptr; + } + catch + { + if (ptr != IntPtr.Zero) + Interop.CkmcTypes.BufferFree(ptr); + + throw; + } + } + + public byte[] Data + { + get; set; + } + } +} diff --git a/src/Tizen.Security.TEEC/.gitignore b/src/Tizen.Security.TEEC/.gitignore new file mode 100644 index 0000000..a6c57f5 --- /dev/null +++ b/src/Tizen.Security.TEEC/.gitignore @@ -0,0 +1 @@ +*.json diff --git a/src/Tizen.Security.TEEC/Interop/Interop.Errors.cs b/src/Tizen.Security.TEEC/Interop/Interop.Errors.cs new file mode 100644 index 0000000..eb86422 --- /dev/null +++ b/src/Tizen.Security.TEEC/Interop/Interop.Errors.cs @@ -0,0 +1,39 @@ +/* + * Interop.Errors.cs + * + * Created on: Apr 4, 2017 + * Author: k.dynowski + */ + +using System; + +internal static partial class Interop +{ + + private const string LogTag = "Tizen.Security.Libteec"; + internal enum LibteecError : uint + { + None = 0, + NotImplemented = 0xFFFF0009, + CommunicationFailed = 0xFFFF000E, + }; + + internal static void CheckNThrowException(int err, string msg) + { + switch ((uint)err) + { + case (uint)LibteecError.None: + return ; + case (uint)LibteecError.NotImplemented: + throw new NotSupportedException(string.Format("[{0}] {1} error=0x{2}", + LogTag, msg, err.ToString("X"))); + case (uint)LibteecError.CommunicationFailed: + throw new Exception(string.Format("[{0}] {1} error=0x{2}", + LogTag, msg, err.ToString("X"))); + default: + throw new InvalidOperationException(string.Format("[{0}] {1}, error=0x{2}", + LogTag, msg, err.ToString("X"))); + + } + } +} diff --git a/src/Tizen.Security.TEEC/Interop/Interop.Libraries.cs b/src/Tizen.Security.TEEC/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..25c903e --- /dev/null +++ b/src/Tizen.Security.TEEC/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Libteec = "libteec.so"; + } +} diff --git a/src/Tizen.Security.TEEC/Interop/Interop.Libteec.cs b/src/Tizen.Security.TEEC/Interop/Interop.Libteec.cs new file mode 100644 index 0000000..1c1f969 --- /dev/null +++ b/src/Tizen.Security.TEEC/Interop/Interop.Libteec.cs @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; +//using Interop.Liibteec.Types; + +internal static partial class Interop +{ + internal static partial class Libteec + { + /// + /// This function initializes a new TEE Context, forming a connection between this Client Application and the + /// TEE identified by the string identifier name. + /// The Client Application MAY pass name with a value of NULL, which means that the Implementation MUST + /// select a default TEE to connect to. The supported name strings, the mapping of these names to a specific + /// TEE, and the nature of the default TEE are implementation-defined. + /// + //TEEC_Result TEEC_InitializeContext(const char *name, TEEC_Context *context); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_InitializeContext", CallingConvention = CallingConvention.Cdecl)] + static public extern int InitializeContext(string name, ref TEEC_Context context); + + /// + /// This function destroys an initialized TEE Context, closing the connection between the Client Application + /// and the TEE. The Client Application MUST only call this function when all Sessions inside this TEE + /// Context have been closed and all Shared Memory blocks have been released. + /// The implementation of this function MUST NOT be able to fail; after this function returns the Client + /// Application must be able to consider that the Context has been closed. + /// The function implementation MUST do nothing if the value of the context pointer is NULL. + /// + //void TEEC_FinalizeContext(TEEC_Context *context); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_FinalizeContext", CallingConvention = CallingConvention.Cdecl)] + static public extern void FinalizeContext(ref TEEC_Context context); + + /// + /// This function registers a block of existing Client Application memory as a block of Shared Memory within + /// the scope of the specified TEE Context, in accordance with the parameters which have been set by the + /// Client Application inside the sharedMem structure. + /// The input context MUST point to an initialized TEE Context. + /// The input sharedMem MUST point to the Shared Memory structure defining the memory region to register + /// + //EEC_Result TEEC_RegisterSharedMemory(TEEC_Context *context, TEEC_SharedMemory *sharedMem); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_RegisterSharedMemory", CallingConvention = CallingConvention.Cdecl)] + static public extern int RegisterSharedMemory(ref TEEC_Context context, ref TEEC_SharedMemory sharedMem); + + /// + /// This function allocates a new block of memory as a block of Shared Memory within the scope of the + /// specified TEE Context, in accordance with the parameters which have been set by the Client Application + /// inside the sharedMem structure. + /// The input context MUST point to an initialized TEE Context. + /// The input sharedMem MUST point to the Shared Memory structure defining the region to allocate. + /// + //TEEC_Result TEEC_AllocateSharedMemory(TEEC_Context *context, TEEC_SharedMemory *sharedMem); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_AllocateSharedMemory", CallingConvention = CallingConvention.Cdecl)] + static public extern int AllocateSharedMemory(ref TEEC_Context context, ref TEEC_SharedMemory sharedMem); + + /// + /// This function deregisters or deallocates a previously initialized block of Shared Memory. + /// For a memory buffer allocated using AllocateSharedMemory the Implementation MUST free the + /// underlying memory and the Client Application MUST NOT access this region after this function has been + /// called. In this case the Implementation MUST set the buffer and size fields of the sharedMem + /// structure to NULL and 0 respectively before returning. + /// For memory registered using RegisterSharedMemory the implementation MUST deregister the + /// underlying memory from the TEE, but the memory region will stay available to the Client Application for + /// other purposes as the memory is owned by it. + /// The implementation MUST do nothing if the value of the sharedMem parameter is NULL. + /// + //void TEEC_ReleaseSharedMemory(TEEC_SharedMemory *sharedMem); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_ReleaseSharedMemory", CallingConvention = CallingConvention.Cdecl)] + static public extern void ReleaseSharedMemory(ref TEEC_SharedMemory sharedMem); + + /// + /// This function opens a new Session between the Client Application and the specified Trusted Application. + /// The Implementation MUST assume that all fields of this session structure are in an undefined state. + /// When this function returns TEEC_SUCCESS the Implementation MUST have populated this structure with + /// any information necessary for subsequent operations within the Session. + /// The target Trusted Application is identified by a UUID passed in the parameter destination. + /// + //TEEC_Result TEEC_OpenSession(TEEC_Context *context, TEEC_Session *session, const TEEC_UUID *destination, uint connectionMethod, const void *connectionData, TEEC_Operation *operation, uint *returnOrigin); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_OpenSession", CallingConvention = CallingConvention.Cdecl)] + static public extern int OpenSession(ref TEEC_Context context, ref TEEC_Session session, TEEC_UUID destination, uint connectionMethod, byte[] connectionData, ref TEEC_Operation operation, out uint returnOrigin); + + /// + /// This function closes a Session which has been opened with a Trusted Application. + /// All Commands within the Session MUST have completed before this function can be called. + /// The Implementation MUST do nothing if the input session parameter is NULL. + /// The implementation of this function MUST NOT be able to fail; after this function returns the Client + /// Application must be able to consider that the Session has been closed. + /// + //void TEEC_CloseSession(TEEC_Session *session); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_CloseSession", CallingConvention = CallingConvention.Cdecl)] + static public extern void CloseSession(ref TEEC_Session session); + + /// + /// This function invokes a Command within the specified Session. + /// The parameter session MUST point to a valid open Session. + /// The parameter commandID is an identifier that is used to indicate which of the exposed Trusted + /// Application functions should be invoked. The supported command identifier values are defined by the + /// Trusted Application‟s protocol. + /// + //TEEC_Result TEEC_InvokeCommand(TEEC_Session *session, uint commandID, TEEC_Operation *operation, uint *returnOrigin); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_InvokeCommand", CallingConvention = CallingConvention.Cdecl)] + static public extern int InvokeCommand(ref TEEC_Session session, uint commandID, ref TEEC_Operation operation, out uint returnOrigin); + + /// + /// This function requests the cancellation of a pending open Session operation or a Command invocation + /// operation. As this is a synchronous API, this function must be called from a thread other than the one + /// executing the OpenSession or InvokeCommand function. + /// This function just sends a cancellation signal to the TEE and returns immediately; the operation is not + /// guaranteed to have been cancelled when this function returns. In addition, the cancellation request is just + /// a hint; the TEE or the Trusted Application MAY ignore the cancellation request. + /// + //void TEEC_RequestCancellation(TEEC_Operation *operation); + [DllImport(Libraries.Libteec, EntryPoint = "TEEC_RequestCancellation", CallingConvention = CallingConvention.Cdecl)] + static public extern void RequestCancellation(ref TEEC_Operation operation); + } +} diff --git a/src/Tizen.Security.TEEC/Interop/Interop.Types.cs b/src/Tizen.Security.TEEC/Interop/Interop.Types.cs new file mode 100644 index 0000000..75955d1 --- /dev/null +++ b/src/Tizen.Security.TEEC/Interop/Interop.Types.cs @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_Context + { + public readonly IntPtr imp; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_Session + { + public readonly IntPtr imp; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_UUID + { + public UInt32 timeLow; + public UInt16 timeMid; + public UInt16 timeHiAndVersion; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] + public byte[] clockSeqAndNode; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct sTEEC_SharedMemoryImp + { + public IntPtr context; + public IntPtr context_imp; + public UInt32 flags; + public UInt32 memid; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_SharedMemory + { + public IntPtr buffer; + public UInt32 size; + public UInt32 flags; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_Parameter + { + public UInt32 a; + public UInt32 b; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct TEEC_Operation + { + public UInt32 started; + public UInt32 paramTypes; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] + public TEEC_Parameter[] paramlist; + public IntPtr imp; + } +} + diff --git a/src/Tizen.Security.TEEC/Tizen.Security.TEEC.csproj b/src/Tizen.Security.TEEC/Tizen.Security.TEEC.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Security.TEEC/Tizen.Security.TEEC.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Security.TEEC/Tizen.Security.TEEC.sln b/src/Tizen.Security.TEEC/Tizen.Security.TEEC.sln new file mode 100755 index 0000000..3d3a879 --- /dev/null +++ b/src/Tizen.Security.TEEC/Tizen.Security.TEEC.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Security.TEEC", "Tizen.Security.TEEC.csproj", "{97FA66C9-A286-42FF-ADDC-80DC8CC9E446}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{6E871A27-B671-400B-A05D-58A6B3CBDAED}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E8348A68-09CD-427F-A0E3-0A36E37B949D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {97FA66C9-A286-42FF-ADDC-80DC8CC9E446}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97FA66C9-A286-42FF-ADDC-80DC8CC9E446}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97FA66C9-A286-42FF-ADDC-80DC8CC9E446}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97FA66C9-A286-42FF-ADDC-80DC8CC9E446}.Release|Any CPU.Build.0 = Release|Any CPU + {6E871A27-B671-400B-A05D-58A6B3CBDAED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6E871A27-B671-400B-A05D-58A6B3CBDAED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6E871A27-B671-400B-A05D-58A6B3CBDAED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6E871A27-B671-400B-A05D-58A6B3CBDAED}.Release|Any CPU.Build.0 = Release|Any CPU + {E8348A68-09CD-427F-A0E3-0A36E37B949D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8348A68-09CD-427F-A0E3-0A36E37B949D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8348A68-09CD-427F-A0E3-0A36E37B949D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8348A68-09CD-427F-A0E3-0A36E37B949D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs new file mode 100644 index 0000000..5393400 --- /dev/null +++ b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/Libteec.cs @@ -0,0 +1,608 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Tizen.Security.TEEC +{ + /// + /// This type denotes Session Login Method used in OpenSession + /// + /// 3 + public class LoginMethod + { + /// No login data is provided. + public const uint Public = 0x00000000; + /// Login data about the user running the Client Application process is provided. + public const uint User = 0x00000001; + /// Login data about the group running the Client Application process is provided. + public const uint Group = 0x00000002; + /// Login data about the running Client Application itself is provided. + public const uint Application = 0x00000003; + } + + /// + /// This type denotes Value parameter + /// + /// 3 + public enum TEFValueType : UInt32 + { + /// The Parameter is a ValueType tagged as input. + Input = 0x00000001, + /// The Parameter is a ValueType tagged as output. + Output = 0x00000002, + /// The Parameter is a ValueType tagged as both as input and output. + InOut = 0x00000003, + } + + /// + /// This type denotes TempMemoryReference parameter + /// describing a region of memory which needs to be temporarily registered for the duration of the operation. + /// + /// 3 + public enum TEFTempMemoryType : UInt32 + { + /// The Parameter is a TempMemoryType and is tagged as input. + Input = 0x00000005, + /// Same as Input, but the Memory Reference is tagged as output. + Output = 0x00000006, + /// A Temporary Memory Reference tagged as both input and output. + InOut = 0x00000007, + } + + /// + /// This type denotes SharedMemoryReference parameter + /// + /// 3 + public enum TEFRegisteredMemoryType : UInt32 + { + /// The Parameter is a Registered Memory Reference that refers to the entirety of its parent Shared Memory block. + Whole = 0x0000000C, + /// A Registered Memory Reference structure that refers to a partial region of its parent Shared Memory block and is tagged as input. + PartialInput = 0x0000000D, + /// A Registered Memory Reference structure that refers to a partial region of its parent Shared Memory block and is tagged as output. + PartialOutput = 0x0000000E, + /// A Registered Memory Reference structure that refers to a partial region of its parent Shared Memory block and is tagged as both input and output. + PartialInOut = 0x0000000F, + } + + /// + /// This type denotes SharedMemory access direction + /// + /// 3 + [Flags] + public enum SharedMemoryFlags : UInt32 + { + /// A flag indicates Shared Memory can be read. + Input = 0x00000001, + /// A flag indicates Shared Memory can be written. + Output = 0x00000002, + /// A flag indicates Shared Memory can be read and written. + InOut = Input | Output, + } + + /// + /// This type denotes a Shared Memory block which has either been registered + /// with the implementation or allocated by it. + /// + /// 3 + public sealed class SharedMemory + { + internal Interop.TEEC_SharedMemory shm; + internal SharedMemory(Interop.TEEC_SharedMemory shm) + { + this.shm=shm; + } + /// + /// This property represents shared memory size in bytes. + /// + /// 3 + public UInt32 Size + { + get { return shm.size; } + } + /// + /// This property represents start address of shared memory block. + /// + /// 3 + public IntPtr Address + { + get { return shm.buffer; } + } + + /// + /// This function makes a copy and is designed for convenient operations on small buffers. + /// For large buffers direct address should be used. + /// + /// 3 + /// Source data buffer to copy data from + /// Starting offset in destination shared memory + /// The operation is invalid. + public void SetData(byte[] data, int dstOffs) + { + if ((shm.flags & (uint)SharedMemoryFlags.Output) == 0) throw new InvalidOperationException("No write access"); + //TODO copy data into shared memory starting at given offset + } + /// + /// This function makes a copy and is designed for convenient operations on small buffers. + /// For large buffers direct address should be used. + /// + /// 3 + /// Destination data buffer to copy data into + /// Starting offset in source shared memory + /// The operation is invalid. + public void GetData(byte[] data, int srcOffs) + { + if ((shm.flags & (uint)SharedMemoryFlags.Input) == 0) throw new InvalidOperationException("No read access"); + //TODO copy data from shared memory starting at given offset + } + }; + + /// + /// This type defines the payload of either an open Session operation or an invoke Command operation. It is + /// also used for cancellation of operations, which may be desirable even if no payload is passed. + /// Parameters are used to exchange data between CA and TA + /// + /// 3 + public abstract class Parameter + { + internal Parameter(uint t) + { + this.NativeType = t; + } + internal uint NativeType { get; } + }; + + /// + /// This type defines a template for parameter types. + /// + /// 3 + public abstract class BaseParameter : Parameter where TEnum : struct, IComparable, IFormattable, IConvertible // as close to Enum as possible + { + internal BaseParameter(TEnum t) : base((uint)(object)t) + { + Type = t; + } + + /// + /// This property represents access type to this parameter. + /// + /// 3 + public TEnum Type { get; } + } + + /// + /// This type defines a temporary memory reference. + /// + /// 3 + public sealed class TempMemoryReference : BaseParameter + { + /// + /// Constructs Prameter object which holds info about temporary memory copied to/from TA + /// + /// 3 + /// Address of allocated memory buffer + /// Size of the buffer + /// Kind of access allowed for TA + public TempMemoryReference(IntPtr buffer, uint size, TEFTempMemoryType type) : + base(type) + { + this.Buffer = buffer; + this.Size = size; + } + /// + /// This property represents memory address of buffer. + /// + /// 3 + public IntPtr Buffer { get; } + /// + /// This property represents size of buffer. + /// + /// 3 + public uint Size { get; } + }; + + /// + /// This type defines a memory reference that uses a pre-registered or pre-allocated Shared Memory block. + /// + /// 3 + public sealed class RegisteredMemoryReference : BaseParameter + { + /// + /// Constructs Prameter object which holds info about registered memory shared with TA + /// + /// 3 + /// Shared memory - registered or allocated + /// Size of the buffer part + /// Offset of buffer in shared memory + /// Kind of access allowed for TA + public RegisteredMemoryReference(SharedMemory parent, uint size, uint offset, TEFRegisteredMemoryType type) : + base(type) + { + this.Parent = parent; + this.Size = size; + this.Offset = offset; + } + /// + /// This property represents SharedMemory that is referred to. + /// + /// 3 + public SharedMemory Parent { get; } + /// + /// This property represents size (in bytes) of SharedMemory. + /// + /// 3 + public uint Size { get; } + /// + /// This property represents offset (in bytes) from the begin of SharedMemory. + /// + /// 3 + public uint Offset { get; } + }; + + /// + /// This type defines a parameter that is not referencing shared memory, but carries instead small raw data + /// passed by value. + /// + /// 3 + public sealed class Value : BaseParameter + { + /// + /// Constructs Prameter object which holds info about int values copied to/from TA + /// + /// 3 + /// User paramter A + /// User paramter B + /// Kind of access allowed for TA + public Value(uint a, uint b, TEFValueType type) : + base(type) + { + this.A = a; + this.B = b; + } + /// + /// This property represents unsigned integer A. + /// + /// 3 + public uint A { get; } + /// + /// This property represents unsigned integer B. + /// + /// 3 + public uint B { get; } + }; + + + /// + /// This type denotes a TEE Session, the logical container linking a Client Application with a particular Trusted Application. + /// + /// 3 + public sealed class Session + { + private Interop.TEEC_Context context; + private Interop.TEEC_Session session; + + internal Session(Interop.TEEC_Context context) { + this.context = context; + this.session = new Interop.TEEC_Session(); + } + + ~Session() + { + Close(); + } + + internal void Open(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist) + { + Interop.TEEC_UUID uuid = new Interop.TEEC_UUID(); + Interop.TEEC_Operation op = new Interop.TEEC_Operation(); + uint ro; + + int ret = Interop.Libteec.OpenSession(ref context, ref session, uuid, loginMethod, connectionData, ref op, out ro); + //MAYBE map origin of return code to specyfic Exception + Interop.CheckNThrowException(ret, string.Format("OpenSession('{0}')", destination)); + } + + /// + /// This function closes a Session which has been opened with a Trusted Application. + /// All Commands within the Session MUST have completed before this function can be called. + /// + /// 3 + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + public void Close() { + Interop.Libteec.CloseSession(ref session); + //session = null; + } + + /// + /// This function invokes a Command within the specified Session. + /// The parameter commandID is an identifier that is used to indicate which of the exposed Trusted + /// Application functions should be invoked. The supported command identifier values are defined by the + /// Trusted Application's protocol. + /// There can be up to four Parameter objects given in the array + /// + /// 3 + /// The command + /// The array of parameters + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// The argument is wrong + public void InvokeCommand(uint commandID, Parameter[] paramlist) + { + Interop.TEEC_Operation op = new Interop.TEEC_Operation(); + op.started=0; + op.paramTypes=0; + + for (int i=0; i < 4; ++i) { + Parameter p = paramlist[i]; + //TODO fill TEEC_Operation struct + } + + uint ro; + int ret = Interop.Libteec.InvokeCommand(ref session, commandID, ref op, out ro); + //MAYBE map origin of return code to specific Exception + Interop.CheckNThrowException(ret, string.Format("InvokeCommand({0})", commandID)); + } + + /// + /// Asynchronous version of InvokeCommand + /// + /// 3 + /// The command + /// The array of parameters + /// The token for task manipulation + /// Returns Task executing invoke command in backgroung + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// One of arguments is wrong + public async Task InvokeCommandAsync(uint commandID, Parameter[] paramlist, CancellationToken token = default(CancellationToken)) + { + await Task.Factory.StartNew(() => InvokeCommand(commandID, paramlist)); + } + + }; + + /// + /// This type denotes a TEE Context, the main logical container linking a Client Application with a particular TEE. + /// + /// 3 + public sealed class Context : IDisposable + { + private Interop.TEEC_Context context; + + /// + /// This function (constructor) initializes a new TEE Context, forming a connection between this Client Application and the + /// TEE identified by the string identifier name (empty or null name denotes default TEE). + /// + /// 3 + /// The TEE name + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + public Context(string name) + { + context = new Interop.TEEC_Context(); + int ret = Interop.Libteec.InitializeContext(name, ref context); + Interop.CheckNThrowException(ret, string.Format("InititalizeContext('{0}')", name)); + } + + ~Context() + { + Dispose(); + } + + /// + /// This function implements IDisposable interface + /// + /// 3 + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + public void Dispose() { + Interop.Libteec.FinalizeContext(ref context); + //context.imp = null; + } + + /// + /// This function opens a new Session between the Client Application and the specified Trusted Application. + /// The target Trusted Application is identified by a UUID passed in the parameter destination. + /// There can be up to four Parameter objects given in the array + /// + /// 3 + /// The UUID of destination TA + /// The authentication algorithm + /// The data to be verified by given login method + /// The parameters to be passed to TA open-session-callback + /// Returns opened session + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// One of arguments is wrong + public Session OpenSession(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist) + { + Session ses = new Session(context); + ses.Open(destination, loginMethod, connectionData, paramlist); + return ses; + } + /// + /// @see OpenSession(Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token) + /// + /// 3 + /// The UUID of destination TA + /// Returns opened session + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + public Session OpenSession(Guid destination) + { + Session ses = new Session(context); + ses.Open(destination, LoginMethod.Public, null, null); + return ses; + } + + /// + /// Asynchronous version of OpenSession + /// @see OpenSession(Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token) + /// + /// 3 + /// The UUID of destination TA + /// The authentication algorithm + /// The data to be verified by given login method + /// The parameters to be passed to TA open-session-callback + /// The token for task manipulation + /// Returns Task executing session open in backgroung + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// One of arguments is wrong + public async Task OpenSessionAsync(Guid destination, uint loginMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token = default(CancellationToken)) + { + Task task = Task.Factory.StartNew(() => + { + return OpenSession(destination, loginMethod, connectionData, paramlist); + }); + return await task; + } + /// + /// Asynchronous version of OpenSession + /// @see OpenSession(Guid destination, uint connectionMethod, byte[] connectionData, Parameter[] paramlist, CancellationToken token) + /// + /// 3 + /// The UUID of destination TA + /// The token for task manipulation + /// Returns Task executing session open in backgroung + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + public async Task OpenSessionAsync(Guid destination, CancellationToken token = default(CancellationToken)) + { + Task task = Task.Factory.StartNew(() => + { + return OpenSession(destination); + }); + return await task; + } + + /// + /// This function registers a block of existing Client Application memory as a block of Shared Memory within + /// the scope of the specified Context, in accordance with the parameters. + /// The input MUST point to the shared memory region to register + /// + /// 3 + /// The address of shared memory + /// The size of shared memory + /// The flags describing access modes (Input and/or Output) + /// Returns SharedMemory handler + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// The argument is wrong + public SharedMemory RegisterSharedMemory(IntPtr memaddr, UInt32 size, SharedMemoryFlags flags) + { + Interop.TEEC_SharedMemory shm = new Interop.TEEC_SharedMemory(); + shm.buffer = memaddr; + shm.size = size; + shm.flags = (UInt32)flags; + int ret = Interop.Libteec.RegisterSharedMemory(ref context, ref shm); + Interop.CheckNThrowException(ret, "RegisterSharedMemory"); + return new SharedMemory(shm); + } + + /// + /// This function allocates a new block of memory as a block of Shared Memory within the scope of the + /// specified Context, in accordance with the parameters. + /// + /// 3 + /// The size of shared memory + /// The flags describing access modes (Input and/or Output) + /// Returns SharedMemory handler + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + public SharedMemory AllocateSharedMemory(UInt32 size, SharedMemoryFlags flags) + { + Interop.TEEC_SharedMemory shm = new Interop.TEEC_SharedMemory(); + shm.size = size; + shm.flags = (UInt32)flags; + int ret = Interop.Libteec.AllocateSharedMemory(ref context, ref shm); + Interop.CheckNThrowException(ret, "AllocateSharedMemory"); + return new SharedMemory(shm); + } + + /// + /// This function deregisters or deallocates a previously initialized block of Shared Memory. + /// + /// + /// For a memory buffer allocated using AllocateSharedMemory the Implementation MUST free the + /// underlying memory and the Client Application MUST NOT access this region after this function has been + /// called. In this case the Implementation MUST clear the buffer and size fields of the sharedMem + /// structure before returning. + /// For memory registered using RegisterSharedMemory the implementation MUST deregister the + /// underlying memory from the TEE, but the memory region will stay available to the Client Application for + /// other purposes as the memory is owned by it. + /// + /// 3 + /// The shared memory object returned by RegisterSharedMemory or AllocateSharedMemory + /// http://tizen.org/privilege/tee.client + /// partner + /// http://tizen.org/feature/security.tee + /// Thrown when application does not have privilege to access this method. + /// The required feature is not supported. + /// The operation is invalid. + /// The argument is wrong + public void ReleaseSharedMemory(SharedMemory shm) + { + Interop.Libteec.ReleaseSharedMemory(ref shm.shm); + } + }; +} diff --git a/src/Tizen.Security.TEEC/Tizen.Security.TEEC/NamespaceDoc.cs b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/NamespaceDoc.cs new file mode 100644 index 0000000..36e1b15 --- /dev/null +++ b/src/Tizen.Security.TEEC/Tizen.Security.TEEC/NamespaceDoc.cs @@ -0,0 +1,78 @@ +/** + +The communication API for connecting Client Applications running in a rich operating environment +with security related Trusted Applications running inside a Trusted Execution Environment (TEE). + + + +

Overview

+ +A TEE provides an execution environment with security capabilities, which are either available to Trusted Applications +running inside the TEE or exposed externally to Client Applications. +The TEE Client API concentrates on the interface to enable efficient communications between +a Client Application and a Trusted Application running inside the TEE. +Higher level standards and protocol layers may be built on top of the foundation +provided by the TEE Client API – for example, to cover common tasks such as secure storage, +cryptography, and run-time installation of new Trusted Applications. +The separation between the rich environment and the TEE is guaranted. + + +The key design principles of the TEE Client API are: + + + Client-side memory allocations + + Where possible the design of the TEE Client API has placed the responsibility for memory + allocation on the calling Client Application code. This gives the Client developer choice of + memory allocation locations, enabling simple optimizations such as stack-based allocation + or enhanced flexibility using placements in static global memory or thread-local storage.
+ This design choice is evident in the API by the use of pointers to structures rather than + opaque handles to represent any manipulated objects. +
+
+ + Aim for zero-copy data transfer + + The features of the TEE Client API are chosen to maximize the possibility of zero-copy + data transfer between the Client Application and the Trusted Application.
+ However, short messages can also be passed by copy, which avoids the overhead of + sharing memory. +
+
+ + Support memory sharing by pointers + + The TEE Client API will be used to implement higher-level APIs, such as cryptography or + secure storage, where the caller will often provide memory buffers for input or output data + using simple C pointers. The TEE Client API must allow efficient sharing of this type of + memory, and as such does not rely on the Client Application being able to use bulk + memory buffers allocated by the TEE Client API. + + + + Specify only communication mechanisms + + This API focuses on defining the underlying communications channel. It does not define + the format of the messages which pass over the channel, or the protocols used by specific + Trusted Applications. + + + +
+
+
+ + +The following example demonstrates how to invoke command on Trused Application. + + Guid ta_uuid = new Guid("TA-guid-put-here"); + Context ctx = new Context(null); + Session ses = ctx.OpenSession(ta_uuid); + Parameter[] p = { new Value(1,2,TEFValueType.In) }; + ses.InvokeCommand(1, p); + ses.Close(); + ctx.Dispose(); + + +*/ +namespace Tizen.Security.TEEC {} diff --git a/src/Tizen.Security/Interop/Interop.Libraries.cs b/src/Tizen.Security/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..7188262 --- /dev/null +++ b/src/Tizen.Security/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Privilege = "libprivilege-info.so.1"; + } +} diff --git a/src/Tizen.Security/Interop/Interop.Privilege.cs b/src/Tizen.Security/Interop/Interop.Privilege.cs new file mode 100755 index 0000000..8b921e8 --- /dev/null +++ b/src/Tizen.Security/Interop/Interop.Privilege.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; + +using Tizen.Security; + +internal static partial class Interop +{ + internal static partial class Privilege + { + internal static string LogTag = "Tizen.Security.Privilege"; + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_display_name")] + internal static extern int GetDisplayName(string apiVersion, string privilege, out string displayName); + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_description")] + internal static extern int GetDescription(string apiVersion, string privilege, out string description); + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_display_name_by_pkgtype")] + internal static extern int GetDisplayNameByPkgtype(string packageType, string apiVersion, string privilege, out string displayName); + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_description_by_pkgtype")] + internal static extern int GetDescriptionByPkgtype(string packageType, string apiVersion, string privilege, out string description); + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_privacy_display_name")] + internal static extern int GetPrivacyDisplayName(string privilege, out string displayName); + + [DllImport(Libraries.Privilege, EntryPoint = "privilege_info_get_privacy_privilege_status")] + internal static extern int GetPrivacyPrivilegeStatus(string privilege, out bool status); + } +} diff --git a/src/Tizen.Security/Tizen.Security.csproj b/src/Tizen.Security/Tizen.Security.csproj new file mode 100644 index 0000000..050d44c --- /dev/null +++ b/src/Tizen.Security/Tizen.Security.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Security/Tizen.Security.sln b/src/Tizen.Security/Tizen.Security.sln new file mode 100755 index 0000000..3c2346a --- /dev/null +++ b/src/Tizen.Security/Tizen.Security.sln @@ -0,0 +1,46 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Security", "Tizen.Security.csproj", "{6A821E85-59E5-42E6-9AC9-B4764B24119E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{E62A797A-D04B-49ED-AEA0-A7AC99583944}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{65691173-8279-4E5A-98FE-566A69865837}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.Common", "..\Tizen.Applications.Common\Tizen.Applications.Common.csproj", "{55E14C3C-6D5F-42A0-A79C-C17A10090189}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Applications.PackageManager", "..\Tizen.Applications.PackageManager\Tizen.Applications.PackageManager.csproj", "{F6B24357-F790-463D-BB16-CDF228742C20}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6A821E85-59E5-42E6-9AC9-B4764B24119E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A821E85-59E5-42E6-9AC9-B4764B24119E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A821E85-59E5-42E6-9AC9-B4764B24119E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A821E85-59E5-42E6-9AC9-B4764B24119E}.Release|Any CPU.Build.0 = Release|Any CPU + {E62A797A-D04B-49ED-AEA0-A7AC99583944}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E62A797A-D04B-49ED-AEA0-A7AC99583944}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E62A797A-D04B-49ED-AEA0-A7AC99583944}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E62A797A-D04B-49ED-AEA0-A7AC99583944}.Release|Any CPU.Build.0 = Release|Any CPU + {65691173-8279-4E5A-98FE-566A69865837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {65691173-8279-4E5A-98FE-566A69865837}.Debug|Any CPU.Build.0 = Debug|Any CPU + {65691173-8279-4E5A-98FE-566A69865837}.Release|Any CPU.ActiveCfg = Release|Any CPU + {65691173-8279-4E5A-98FE-566A69865837}.Release|Any CPU.Build.0 = Release|Any CPU + {55E14C3C-6D5F-42A0-A79C-C17A10090189}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55E14C3C-6D5F-42A0-A79C-C17A10090189}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55E14C3C-6D5F-42A0-A79C-C17A10090189}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55E14C3C-6D5F-42A0-A79C-C17A10090189}.Release|Any CPU.Build.0 = Release|Any CPU + {F6B24357-F790-463D-BB16-CDF228742C20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6B24357-F790-463D-BB16-CDF228742C20}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6B24357-F790-463D-BB16-CDF228742C20}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6B24357-F790-463D-BB16-CDF228742C20}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Security/Tizen.Security/Privilege.cs b/src/Tizen.Security/Tizen.Security/Privilege.cs new file mode 100755 index 0000000..8c62607 --- /dev/null +++ b/src/Tizen.Security/Tizen.Security/Privilege.cs @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Internals.Errors; +using Tizen.Applications; + +namespace Tizen.Security +{ + /// + /// The class provides the information of the given privilege and API version. + /// + /// 3 + public static class Privilege + { + internal static readonly string PackageTypeTpk = "PRVINFO_PACKAGE_TYPE_NATIVE"; + internal static readonly string PackageTypeWgt = "PRVINFO_PACKAGE_TYPE_WEB"; + internal static string ToPackageTypeString(PackageType type) + { + if (type == PackageType.TPK) + { + return PackageTypeTpk; + } + else if (type == PackageType.WGT) + { + return PackageTypeWgt; + } + else + { + Tizen.Log.Error(Interop.Privilege.LogTag, "Invalid Parameter: PackageType doesn't include TPK or WGT"); + throw new ArgumentException(); + } + } + + /// + /// Gets the display name of the given privilege. + /// + /// 3 + /// If there's no matching privilege then it returns last token of given privilege. + /// The api version + /// The privilege + /// The display name of given privilege at given api version + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static string GetDisplayName(string apiVersion, string privilege) + { + string displayName; + if (apiVersion == null || privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "apiVersion and privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetDisplayName(apiVersion, privilege, out displayName), + "Failed to Get Privilege's Display Name."); + return displayName; + } + + /// + /// Gets the display name of the given privilege. + /// + /// 3 + /// If there's no matching privilege then it returns last token of given privilege. + /// The api version + /// The privilege + /// The type of application package + /// The display name of given privilege at given api version and the package type + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static string GetDisplayName(string apiVersion, string privilege, PackageType packageType) + { + string displayName; + if (apiVersion == null || privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "apiVersion and privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetDisplayNameByPkgtype(ToPackageTypeString(packageType), apiVersion, privilege, out displayName), + "Failed to Get Privilege's Display Name."); + return displayName; + } + + /// + /// Gets the description of the given privilege. + /// + /// 3 + /// If there's no matching privilege then it returns description string for undefined privilege. + /// The api version + /// The privilege + /// The description of given privilege at given api version + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static string GetDescription(string apiVersion, string privilege) + { + string description; + if (apiVersion == null || privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "apiVersion and privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetDescription(apiVersion, privilege, out description), + "Failed to Get Privilege's Description."); + return description; + } + + /// + /// Gets the description of the given privilege. + /// + /// 3 + /// If there's no matching privilege then it returns description string for undefined privilege. + /// The api version + /// The privilege + /// The type of application package + /// The description of given privilege at given api version and the package type + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static string GetDescription(string apiVersion, string privilege, PackageType packageType) + { + string description; + if (apiVersion == null || privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "apiVersion and privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetDescriptionByPkgtype(ToPackageTypeString(packageType),apiVersion, privilege, out description), + "Failed to Get Privilege's Description."); + return description; + } + + /// + /// Gets the display name of the privacy group in which the given privilege is included. + /// + /// 3 + /// The privilege + /// The privilege must be privacy related. + /// The privacy group's display name that the given privilege is included in + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static string GetPrivacyDisplayName(string privilege) + { + string displayName; + if (privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetPrivacyDisplayName(privilege, out displayName), + "Failed to Get Privacy's Display Name in Which the Given Privilege is included."); + return displayName; + } + + /// + /// Gets the status of the given privacy related privilege. + /// + /// 3 + /// The privilege + /// The privilege must be privacy related. + /// status true if the privilege is on and false if the privilege is off. + /// Thrown when there is a null parameter. + /// Thrown when there is an invalid parameter. + /// Thrown when out of memory occurs + /// Thrown when internal error occurs. + public static bool GetPrivacyPrivilegeStatus(string privilege) + { + bool status; + if (privilege == null) + PrivilegeErrorFactory.ThrowException(new ArgumentNullException(), "privilege should not be null."); + PrivilegeErrorFactory.CheckNThrowException( + Interop.Privilege.GetPrivacyPrivilegeStatus(privilege, out status), + "Failed to Get Privacy Privilege's Status."); + return status; + } + } + + internal static class PrivilegeErrorFactory + { + internal static void ThrowException(Exception e, string msg) + { + Tizen.Log.Error(Interop.Privilege.LogTag, "[" + e.ToString() + "] " + msg); + throw e; + } + internal static void CheckNThrowException(int err, string msg) + { + if (err == (int)ErrorCode.None) + return; + string errorMessage = string.Format("[{0}] {1}", ErrorFacts.GetErrorMessage(err), msg); + Tizen.Log.Error(Interop.Privilege.LogTag, errorMessage); + switch (err) + { + case (int)ErrorCode.InvalidParameter: + throw new ArgumentException(); + case (int)ErrorCode.OutOfMemory: + throw new OutOfMemoryException(); + default: + throw new InvalidOperationException(); + } + } + } +} diff --git a/src/Tizen.Sensor/Interop/Interop.Libraries.cs b/src/Tizen.Sensor/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..4c856be --- /dev/null +++ b/src/Tizen.Sensor/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Sensor = "libcapi-system-sensor.so.0"; + public const string Libc = "libc.so.6"; + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Interop/Interop.Sensor.cs b/src/Tizen.Sensor/Interop/Interop.Sensor.cs new file mode 100644 index 0000000..58a6b1e --- /dev/null +++ b/src/Tizen.Sensor/Interop/Interop.Sensor.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Sensor; + +internal static partial class Interop +{ + internal static class Sensor + { + //Sensor Hardware CAPI + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_name")] + internal static extern int GetName(IntPtr sensorhandle, out String name); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_vendor")] + internal static extern int GetVendor(IntPtr sensorHandle, out String vendor); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_type")] + internal static extern int GetType(IntPtr sensorHandle, out SensorType type); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_range")] + internal static extern int GetMinRange(IntPtr sensorHandle, out float minRange); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_range")] + internal static extern int GetMaxRange(IntPtr sensorHandle, out float maxRange); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_resolution")] + internal static extern int GetResolution(IntPtr sensorHandle, out float resolution); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_min_interval")] + internal static extern int GetMinInterval(IntPtr sensorHandle, out int minInterval); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_fifo_count")] + internal static extern int GetFifoCount(IntPtr sensorHandle, out int fifoCount); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_max_batch_count")] + internal static extern int GetMaxBatchCount(IntPtr sensorHandle, out int maxBatchCount); + } + internal static class SensorListener + { + //Sensor Listener CAPI + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SensorEventCallback(IntPtr sensorHandle, IntPtr eventData, IntPtr data); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SensorAccuracyCallback(IntPtr sensorHandle, ulong timestamp, SensorDataAccuracy accuracy, IntPtr data); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_create_listener")] + internal static extern int CreateListener(IntPtr sensorHandle, out IntPtr listenerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_destroy_listener")] + internal static extern int DestroyListener(IntPtr listenerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_start")] + internal static extern int StartListener(IntPtr listenerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_stop")] + internal static extern int StopListener(IntPtr listenerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_event_cb")] + internal static extern int SetEventCallback(IntPtr listenerHandle, uint intervalMs, SensorEventCallback callback, IntPtr data); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_event_cb")] + internal static extern int UnsetEventCallback(IntPtr listernerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_accuracy_cb")] + internal static extern int SetAccuracyCallback(IntPtr listenerHandle, SensorAccuracyCallback callback, IntPtr data); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_unset_accuracy_cb")] + internal static extern int UnsetAccuracyCallback(IntPtr listernerHandle); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_interval")] + internal static extern int SetInterval(IntPtr listenerHandle, uint intervalMs); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_max_batch_latency")] + internal static extern int SetMaxBatchLatency(IntPtr listenerHandle, uint maxBatchLatency); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_listener_set_attribute_int")] + internal static extern int SetAttribute(IntPtr listenerHandle, SensorAttribute sensorAttribute, int option); + } + + internal static class SensorManager + { + //Sensor Manager CAPI + [DllImport(Libraries.Sensor, EntryPoint = "sensor_is_supported")] + internal static extern int SensorIsSupported(SensorType type, out bool supported); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_default_sensor")] + internal static extern int GetDefaultSensor(SensorType type, out IntPtr sensor); + + [DllImport(Libraries.Sensor, EntryPoint = "sensor_get_sensor_list")] + internal static extern int GetSensorList(SensorType type, out IntPtr list, out int sensor_count); + } + + internal static partial class Libc + { + [DllImport(Libraries.Libc, EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Free(IntPtr ptr); + } + + [StructLayout(LayoutKind.Sequential, Pack = 0)] + internal struct SensorEventStruct + { + internal SensorDataAccuracy accuracy; + internal UInt64 timestamp; + internal int value_count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] + internal float[] values; + } + + internal static IntPtr[] IntPtrToIntPtrArray(IntPtr unmanagedArray, int size) + { + IntPtr[] managedArray = new IntPtr[size]; + Marshal.Copy(unmanagedArray, managedArray, 0, size); + return managedArray; + } + + internal static SensorEventStruct IntPtrToEventStruct(IntPtr unmanagedVariable) + { + SensorEventStruct outStruct = (SensorEventStruct)Marshal.PtrToStructure(unmanagedVariable, typeof(SensorEventStruct)); + return outStruct; + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor.csproj b/src/Tizen.Sensor/Tizen.Sensor.csproj new file mode 100644 index 0000000..b7549b0 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor.sln b/src/Tizen.Sensor/Tizen.Sensor.sln new file mode 100755 index 0000000..e261c3e --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Sensor", "Tizen.Sensor.csproj", "{91E5DA56-23A7-4828-B425-EB6C40E1A3C5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{E4BF60C5-0708-492F-91D9-84F34F5E3355}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F6DEA95B-9E6F-4EF1-BD11-40BCA7BEB5EB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{94DB8186-F970-4298-A321-6FFD12F47DBA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {91E5DA56-23A7-4828-B425-EB6C40E1A3C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91E5DA56-23A7-4828-B425-EB6C40E1A3C5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91E5DA56-23A7-4828-B425-EB6C40E1A3C5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91E5DA56-23A7-4828-B425-EB6C40E1A3C5}.Release|Any CPU.Build.0 = Release|Any CPU + {E4BF60C5-0708-492F-91D9-84F34F5E3355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E4BF60C5-0708-492F-91D9-84F34F5E3355}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E4BF60C5-0708-492F-91D9-84F34F5E3355}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E4BF60C5-0708-492F-91D9-84F34F5E3355}.Release|Any CPU.Build.0 = Release|Any CPU + {F6DEA95B-9E6F-4EF1-BD11-40BCA7BEB5EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6DEA95B-9E6F-4EF1-BD11-40BCA7BEB5EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6DEA95B-9E6F-4EF1-BD11-40BCA7BEB5EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6DEA95B-9E6F-4EF1-BD11-40BCA7BEB5EB}.Release|Any CPU.Build.0 = Release|Any CPU + {94DB8186-F970-4298-A321-6FFD12F47DBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {94DB8186-F970-4298-A321-6FFD12F47DBA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {94DB8186-F970-4298-A321-6FFD12F47DBA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {94DB8186-F970-4298-A321-6FFD12F47DBA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AccelerometerDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AccelerometerDataUpdatedEventArgs.cs new file mode 100755 index 0000000..f87f24e --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/AccelerometerDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Accelerometer changed event arguments. Class for storing the data returned by accelerometer + /// + public class AccelerometerDataUpdatedEventArgs : EventArgs + { + internal AccelerometerDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + } + + /// + /// Gets the X component of the acceleration. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/FaceDownGestureDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/FaceDownGestureDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..b92bb6f --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/FaceDownGestureDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// FaceDownGestureDetector changed event arguments. Class for storing the data returned by face down gesture detector. + /// + public class FaceDownGestureDetectorDataUpdatedEventArgs : EventArgs + { + internal FaceDownGestureDetectorDataUpdatedEventArgs(float state) + { + FaceDown = (DetectorState) state; + } + + /// + /// Gets the face down state. + /// + /// 3 + /// Face down state + public DetectorState FaceDown { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GravitySensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GravitySensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..b7812a9 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GravitySensorDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// GravitySensor changed event arguments. Class for storing the data returned by gravity sensor + /// + public class GravitySensorDataUpdatedEventArgs : EventArgs + { + internal GravitySensorDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + } + + /// + /// Gets the X component of the gravity. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the gravity. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the gravity. + /// + /// 3 + /// Z + public float Z { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeDataUpdatedEventArgs.cs new file mode 100755 index 0000000..58724c1 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Gyroscope changed event arguments. Class for storing the data returned by gyroscope + /// + public class GyroscopeDataUpdatedEventArgs : EventArgs + { + internal GyroscopeDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + } + + /// + /// Gets the X component of the gyroscope data. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the gyroscope data. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the gyroscope data. + /// + /// 3 + /// Z + public float Z { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..48c0238 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/GyroscopeRotationVectorSensorDataUpdatedEventArgs.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// GyroscopeRotationVectorSensor changed event arguments. Class for storing the data returned by gyroscope rotation vector sensor + /// + public class GyroscopeRotationVectorSensorDataUpdatedEventArgs : EventArgs + { + internal GyroscopeRotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + W = values[3]; + Accuracy = accuracy; + } + + /// + /// Gets the X component of the gyroscope rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the gyroscope rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the gyroscope rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } + + /// + /// Gets the W component of the gyroscope rotation vector. + /// + /// 3 + /// W + public float W { get; private set; } + + /// + /// Gets the accuracy of the gyroscope rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HeartRateMonitorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HeartRateMonitorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..68b9fe7 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HeartRateMonitorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// HeartRateMonitor changed event arguments. Class for storing the data returned by heart rate monitor + /// + public class HeartRateMonitorDataUpdatedEventArgs : EventArgs + { + internal HeartRateMonitorDataUpdatedEventArgs(int heartRate) + { + HeartRate = heartRate; + } + + /// + /// Gets the value of the heartRate. + /// + /// 3 + /// Heart rate + public int HeartRate { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HumiditySensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HumiditySensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..c8e7c32 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/HumiditySensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// HumiditySensor changed event arguments. Class for storing the data returned by humidity sensor + /// + public class HumiditySensorDataUpdatedEventArgs : EventArgs + { + internal HumiditySensorDataUpdatedEventArgs(float humidity) + { + Humidity = humidity; + } + + /// + /// Gets the value of the humidity. + /// + /// 3 + /// Humidity + public float Humidity { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/InVehicleActivityDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/InVehicleActivityDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..4e6e8f0 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/InVehicleActivityDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// InVehicleActivityDetector changed event arguments. Class for storing the data returned by in-vehicle activity detector + /// + public class InVehicleActivityDetectorDataUpdatedEventArgs : EventArgs + { + internal InVehicleActivityDetectorDataUpdatedEventArgs(float state) + { + InVehicle = (DetectorState) state; + } + + /// + /// Gets the in-vehicle state. + /// + /// 3 + /// In-vehicle state + public DetectorState InVehicle { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LightSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LightSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..dfcc8de --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LightSensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// LightSensor changed event arguments. Class for storing the data returned by light sensor + /// + public class LightSensorDataUpdatedEventArgs : EventArgs + { + internal LightSensorDataUpdatedEventArgs(float level) + { + Level = level; + } + + /// + /// Gets the level of the light. + /// + /// 3 + /// Light level + public float Level { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LinearAccelerationSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LinearAccelerationSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..273c0a2 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/LinearAccelerationSensorDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// LinearAccelerationSensor changed event arguments. Class for storing the data returned by linear acceleration sensor + /// + public class LinearAccelerationSensorDataUpdatedEventArgs : EventArgs + { + internal LinearAccelerationSensorDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + } + + /// + /// Gets the X component of the linear acceleration. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the linear acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the linear acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerDataUpdatedEventArgs.cs new file mode 100755 index 0000000..eb1803d --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Magnetometer changed event arguments. Class for storing the data returned by magnetometer sensor + /// + public class MagnetometerDataUpdatedEventArgs : EventArgs + { + internal MagnetometerDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + } + + /// + /// Gets the X component of the magnetometer. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the magnetometer. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the magnetometer. + /// + /// 3 + /// Z + public float Z { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..7ac6ba3 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/MagnetometerRotationVectorSensorDataUpdatedEventArgs.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// MagnetometerRotationVectorSensor changed event arguments. Class for storing the data returned by magnetometer rotation vector sensor + /// + public class MagnetometerRotationVectorSensorDataUpdatedEventArgs : EventArgs + { + internal MagnetometerRotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + W = values[3]; + Accuracy = accuracy; + } + + /// + /// Gets the X component of the magnetometer rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the magnetometer rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the magnetometer rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } + + /// + /// Gets the W component of the magnetometer rotation vector. + /// + /// 3 + /// W + public float W { get; private set; } + + /// + /// Gets the accuracy of the magnetometer rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/OrientationSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/OrientationSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..4fc4b6a --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/OrientationSensorDataUpdatedEventArgs.cs @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// OrientationSensor changed event arguments. Class for storing the data returned by orientation sensor + /// + public class OrientationSensorDataUpdatedEventArgs : EventArgs + { + internal OrientationSensorDataUpdatedEventArgs(float[] values) + { + Azimuth = values[0]; + Pitch = values[1]; + Roll = values[2]; + } + + /// + /// Gets the azimuth component of the orientation. + /// + /// 3 + /// Azimuth + public float Azimuth { get; private set; } + + /// + /// Gets the pitch component of the orientation. + /// + /// 3 + /// Pitch + public float Pitch { get; private set; } + + /// + /// Gets the roll component of the orientation. + /// + /// 3 + /// Roll + public float Roll { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PedometerDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PedometerDataUpdatedEventArgs.cs new file mode 100755 index 0000000..f4865ac --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PedometerDataUpdatedEventArgs.cs @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Pedometer changed event arguments. Class for storing the data returned by pedometer + /// + public class PedometerDataUpdatedEventArgs : EventArgs + { + internal PedometerDataUpdatedEventArgs(float[] values) + { + StepCount = (uint) values[0]; + WalkStepCount = (uint) values[1]; + RunStepCount = (uint) values[2]; + MovingDistance = values[3]; + CalorieBurned = values[4]; + LastSpeed = values[5]; + LastSteppingFrequency = values[6]; + LastStepStatus = (PedometerState) values[7]; + } + + /// + /// Gets the step count + /// + /// 3 + /// Step count + public uint StepCount { get; private set; } + + /// + /// Gets the walking step count + /// + /// 3 + /// Walk step count + public uint WalkStepCount { get; private set; } + + /// + /// Gets the running step count + /// + /// 3 + /// Run step count + public uint RunStepCount { get; private set; } + + /// + /// Gets the moving distance + /// + /// 3 + /// Moving distance + public float MovingDistance { get; private set; } + + /// + /// Gets the calorie burned + /// + /// 3 + /// Calorie burned + public float CalorieBurned { get; private set; } + + /// + /// Gets the last speed + /// + /// 3 + /// Last speed + public float LastSpeed { get; private set; } + + /// + /// Gets the last stepping frequency + /// + /// 3 + /// Last stepping frequency + public float LastSteppingFrequency { get; private set; } + + /// + /// Gets the last step status + /// + /// 3 + /// Last stepping status + public PedometerState LastStepStatus { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PickUpGestureDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PickUpGestureDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..a5fee58 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PickUpGestureDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// PickUpGestureDetector changed event arguments. Class for storing the data returned by pick up gesture detector + /// + public class PickUpGestureDetectorDataUpdatedEventArgs : EventArgs + { + internal PickUpGestureDetectorDataUpdatedEventArgs(float state) + { + PickUp = (DetectorState) state; + } + + /// + /// Gets the pick up state. + /// + /// 3 + /// Pick up state + public DetectorState PickUp { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PressureSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PressureSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..0cf7b73 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/PressureSensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// PressureSensor changed event arguments. Class for storing the data returned by pressure sensor + /// + public class PressureSensorDataUpdatedEventArgs : EventArgs + { + internal PressureSensorDataUpdatedEventArgs(float pressure) + { + Pressure = pressure; + } + + /// + /// Gets the value of the pressure. + /// + /// 3 + /// Pressure + public float Pressure { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/ProximitySensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/ProximitySensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..2dc8847 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/ProximitySensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// ProximitySensor changed event arguments. Class for storing the data returned by proximity sensor + /// + public class ProximitySensorDataUpdatedEventArgs : EventArgs + { + internal ProximitySensorDataUpdatedEventArgs(float proximity) + { + Proximity = (ProximitySensorState) proximity; + } + + /// + /// Gets the proximity state. + /// + /// 3 + /// Proximity state + public ProximitySensorState Proximity { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RotationVectorSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RotationVectorSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..29ddccd --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RotationVectorSensorDataUpdatedEventArgs.cs @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// RotationVectorSensor changed event arguments. Class for storing the data returned by rotation vector sensor + /// + public class RotationVectorSensorDataUpdatedEventArgs : EventArgs + { + internal RotationVectorSensorDataUpdatedEventArgs(float[] values, SensorDataAccuracy accuracy) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + W = values[3]; + Accuracy = accuracy; + } + + /// + /// Gets the X component of the rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } + + /// + /// Gets the W component of the rotation vector. + /// + /// 3 + /// W + public float W { get; private set;} + + /// + /// Gets the accuracy of the rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RunningActivityDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RunningActivityDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..309ad7d --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/RunningActivityDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// RunningActivityDetector changed event arguments. Class for storing the data returned by running activity detector + /// + public class RunningActivityDetectorDataUpdatedEventArgs : EventArgs + { + internal RunningActivityDetectorDataUpdatedEventArgs(float state) + { + Running = (DetectorState) state; + } + + /// + /// Gets the running state. + /// + /// 3 + /// Running state + public DetectorState Running { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SensorAccuracyChangedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SensorAccuracyChangedEventArgs.cs new file mode 100755 index 0000000..8479600 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SensorAccuracyChangedEventArgs.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Sensor accuracy changed event arguments Class. Contains the parameters to be returned through accuracy callback + /// + public class SensorAccuracyChangedEventArgs : EventArgs + { + internal SensorAccuracyChangedEventArgs(TimeSpan timespan, SensorDataAccuracy accuracy) + { + TimeSpan = timespan; + Accuracy = accuracy; + } + + /// + /// Gets the time stamp. + /// + /// 3 + /// Time span + public TimeSpan TimeSpan { get; private set; } + + /// + /// Gets the accuracy. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SleepMonitorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SleepMonitorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..fe631ed --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/SleepMonitorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// SleepMonitor changed event arguments. Class for storing the data returned by sleep monitor + /// + public class SleepMonitorDataUpdatedEventArgs : EventArgs + { + internal SleepMonitorDataUpdatedEventArgs(int sleepState) + { + SleepState = (SleepMonitorState) sleepState; + } + + /// + /// Gets the value of the sleep state. + /// + /// 3 + /// Sleep state + public SleepMonitorState SleepState { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/StationaryActivityDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/StationaryActivityDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..2ad9a1d --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/StationaryActivityDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// StationaryActivityDetector changed event arguments. Class for storing the data returned by stationary activity detector + /// + public class StationaryActivityDetectorDataUpdatedEventArgs : EventArgs + { + internal StationaryActivityDetectorDataUpdatedEventArgs(float state) + { + Stationary = (DetectorState) state; + } + + /// + /// Gets the stationary state. + /// + /// 3 + /// Stationary state + public DetectorState Stationary { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/TemperatureSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/TemperatureSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..127c725 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/TemperatureSensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// TemperatureSensor changed event arguments. Class for storing the data returned by temperature sensor + /// + public class TemperatureSensorDataUpdatedEventArgs : EventArgs + { + internal TemperatureSensorDataUpdatedEventArgs(float temperature) + { + Temperature = temperature; + } + + /// + /// Gets the value of the temperature. + /// + /// 3 + /// Temperature + public float Temperature { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UltravioletSensorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UltravioletSensorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..1a025f9 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UltravioletSensorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UltravioletSensor changed event arguments. Class for storing the data returned by ultraviolet sensor + /// + public class UltravioletSensorDataUpdatedEventArgs : EventArgs + { + internal UltravioletSensorDataUpdatedEventArgs(float ultravioletIndex) + { + UltravioletIndex = ultravioletIndex; + } + + /// + /// Gets the value of the ultraviolet index. + /// + /// 3 + /// Ultraviolet index + public float UltravioletIndex { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedGyroscopeDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedGyroscopeDataUpdatedEventArgs.cs new file mode 100755 index 0000000..9475bc0 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedGyroscopeDataUpdatedEventArgs.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UncalibratedGyroscope changed event arguments. Class for storing the data returned by uncalibrated gyroscope + /// + public class UncalibratedGyroscopeDataUpdatedEventArgs : EventArgs + { + internal UncalibratedGyroscopeDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + BiasX = values[3]; + BiasY = values[4]; + BiasZ = values[5]; + } + + /// + /// Gets the X component of the uncalibrated gyroscope data. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the uncalibrated gyroscope data. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the uncalibrated gyroscope data. + /// + /// 3 + /// Z + public float Z { get; private set; } + + /// + /// Gets the BiasX component of the uncalibrated gyroscope data. + /// + /// 3 + /// X bias + public float BiasX { get; private set; } + + /// + /// Gets the BiasY component of the uncalibrated gyroscope data. + /// + /// 3 + /// Y bias + public float BiasY { get; private set; } + + /// + /// Gets the BiasZ component of the uncalibrated gyroscope data. + /// + /// 3 + /// Z bias + public float BiasZ { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedMagnetometerDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedMagnetometerDataUpdatedEventArgs.cs new file mode 100755 index 0000000..b9cfc9c --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/UncalibratedMagnetometerDataUpdatedEventArgs.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UncalibratedMagnetometer changed event arguments. Class for storing the data returned by uncalibrated magnetometer + /// + public class UncalibratedMagnetometerDataUpdatedEventArgs : EventArgs + { + internal UncalibratedMagnetometerDataUpdatedEventArgs(float[] values) + { + X = values[0]; + Y = values[1]; + Z = values[2]; + BiasX = values[3]; + BiasY = values[4]; + BiasZ = values[5]; + } + + /// + /// Gets the X component of the uncalibrated magnetometer data. + /// + /// 3 + /// X + public float X { get; private set; } + + /// + /// Gets the Y component of the uncalibrated magnetometer data. + /// + /// 3 + /// Y + public float Y { get; private set; } + + /// + /// Gets the Z component of the uncalibrated magnetometer data. + /// + /// 3 + /// Z + public float Z { get; private set; } + + /// + /// Gets the BiasX component of the uncalibrated magnetometer data. + /// + /// 3 + /// X bias + public float BiasX { get; private set; } + + /// + /// Gets the BiasY component of the uncalibrated magnetometer data. + /// + /// 3 + /// Y bias + public float BiasY { get; private set; } + + /// + /// Gets the BiasZ component of the uncalibrated magnetometer data. + /// + /// 3 + /// Z bias + public float BiasZ { get; private set; } + } +} \ No newline at end of file diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WalkingActivityDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WalkingActivityDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..0de9fc7 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WalkingActivityDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// WalkingActivityDetector changed event arguments. Class for storing the data returned by walking activity detector + /// + public class WalkingActivityDetectorDataUpdatedEventArgs : EventArgs + { + internal WalkingActivityDetectorDataUpdatedEventArgs(float state) + { + Walking = (DetectorState) state; + } + + /// + /// Gets the walking state. + /// + /// 3 + /// Walking state + public DetectorState Walking { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WristUpGestureDetectorDataUpdatedEventArgs.cs b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WristUpGestureDetectorDataUpdatedEventArgs.cs new file mode 100755 index 0000000..811862f --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/EventArgs/WristUpGestureDetectorDataUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// WristUpGestureDetector changed event arguments. Class for storing the data returned by wrist up gesture detector + /// + public class WristUpGestureDetectorDataUpdatedEventArgs : EventArgs + { + internal WristUpGestureDetectorDataUpdatedEventArgs(float state) + { + WristUp = (DetectorState) state; + } + + /// + /// Gets the wrist up state. + /// + /// 3 + /// Wrist up state + public DetectorState WristUp { get; private set; } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/Accelerometer.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Accelerometer.cs new file mode 100755 index 0000000..1651eb2 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Accelerometer.cs @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Accelerometer Sensor Class. Used for registering callbacks for accelerometer and getting accelerometer data + /// + public sealed class Accelerometer : Sensor + { + private static string AccelerometerKey = "http://tizen.org/feature/sensor.accelerometer"; + /// + /// Gets the X component of the acceleration. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether accelerometer sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the Accelerometer sensor is supported"); + return CheckIfSupported(SensorType.Accelerometer, AccelerometerKey); + } + } + + /// + /// Returns the number of accelerometer sensors available on the device. + /// + /// 3 + /// The count of accelerometer sensors + /// Thrown when the operation is invalid for the current state + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of accelerometer sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.accelerometer + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular accelerometer sensor in case of multiple sensors + /// + public Accelerometer(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating Accelerometer object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.Accelerometer; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in accelerometer sensor data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.Accelerometer, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for accelerometer"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + + DataUpdated?.Invoke(this, new AccelerometerDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for accelerometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for accelerometer"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for accelerometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for accelerometer"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/ActivityDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/ActivityDetector.cs new file mode 100755 index 0000000..e9eff3b --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/ActivityDetector.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Activity Detector class for storing common activity information + /// + public abstract class ActivityDetector : Sensor + { + protected const int ActivityAttribute = (((int)SensorType.InVehicleActivityDetector << 8) | 0x80 | 0x1); + + protected enum ActivityType + { + Unknown = 1, + Stationary = 2, + Walking = 4, + Running = 8, + InVehicle = 16, + OnBicycle = 32, + }; + + /// + /// Gets the activity accuracy of activity detector + /// + /// 3 + /// Activity accuracy + public SensorDataAccuracy ActivityAccuracy { get; protected set; } + + internal ActivityDetector(uint index) : base(index) + { + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/FaceDownGestureDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/FaceDownGestureDetector.cs new file mode 100755 index 0000000..40362d2 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/FaceDownGestureDetector.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// FaceDownGestureDetector Class. Used for registering callbacks for face down gesture detector and getting the face down state + /// + public sealed class FaceDownGestureDetector : Sensor + { + private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition"; + + /// + /// Gets the state of the face down gesture. + /// + /// 3 + /// Face down state + public DetectorState FaceDown { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether face down gesture detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the face down gesture detector is supported"); + return CheckIfSupported(SensorType.FaceDownGestureDetector, GestureDetectorKey); + } + } + + /// + /// Returns the number of face down gesture detectors available on the device. + /// + /// 3 + /// The count of face down gesture detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of face down gesture detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gesture_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular face down gesture detector in case of multiple sensors. + /// + public FaceDownGestureDetector(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating face down gesture detector object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.FaceDownGestureDetector; + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.FaceDownGestureDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for face down gesture detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in face down gesture detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + FaceDown = (DetectorState) sensorData.values[0]; + + DataUpdated?.Invoke(this, new FaceDownGestureDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for face down gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for face down gesture detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for face down gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for face down gesture detector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/GravitySensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/GravitySensor.cs new file mode 100755 index 0000000..c2a38c0 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/GravitySensor.cs @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// GravitySensor Class. Used for registering callbacks for gravity sensor and getting gravity data + /// + public sealed class GravitySensor : Sensor + { + private const string GravitySensorKey = "http://tizen.org/feature/sensor.gravity"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the gravity. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the gravity. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the gravity. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether gravity sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the GravitySensor is supported"); + return CheckIfSupported(SensorType.GravitySensor, GravitySensorKey); + } + } + + /// + /// Returns the number of gravity sensors available on the device. + /// + /// 3 + /// The count of gravity sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of gravity sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gravity + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular gravity sensor in case of multiple sensors + /// + public GravitySensor (uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating GravitySensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.GravitySensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in gravity sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.GravitySensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for gravity"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + + DataUpdated?.Invoke(this, new GravitySensorDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for gravity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gravity"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for gravity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gravity"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for gravity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for gravity"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for gravity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for gravity"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/Gyroscope.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Gyroscope.cs new file mode 100755 index 0000000..192f076 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Gyroscope.cs @@ -0,0 +1,153 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Gyroscope Sensor Class. Used for registering callbacks for gyroscope and getting gyroscope data + /// + public sealed class Gyroscope : Sensor + { + private const string GyroscopeKey = "http://tizen.org/feature/sensor.gyroscope"; + + /// + /// Gets the X component of the acceleration. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether gyroscope sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the Gyroscope sensor is supported"); + return CheckIfSupported(SensorType.Gyroscope, GyroscopeKey); + } + } + + /// + /// Returns the number of gyroscope sensors available on the device. + /// + /// 3 + /// The count of gyroscope sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of gyroscope sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gyroscope + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular gyroscope sensor in case of multiple sensors + /// + public Gyroscope(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating Gyroscope object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.Gyroscope; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in gyroscope sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.Gyroscope, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for gyroscope"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + + DataUpdated?.Invoke(this, new GyroscopeDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for gyroscope sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gyroscope"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for gyroscope sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gyroscope"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/GyroscopeRotationVectorSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/GyroscopeRotationVectorSensor.cs new file mode 100755 index 0000000..2f52a1d --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/GyroscopeRotationVectorSensor.cs @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// GyroscopeRotationVectorSensor Class. Used for registering callbacks for gyroscope rotation vector sensor and getting gyroscope rotation vector data + /// + public sealed class GyroscopeRotationVectorSensor : Sensor + { + private const string GyroscopeRVKey = "http://tizen.org/feature/sensor.gyroscope_rotation_vector"; + + /// + /// Gets the X component of the gyroscope rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the gyroscope rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the gyroscope rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Gets the W component of the gyroscope rotation vector. + /// + /// 3 + /// W + public float W { get; private set; } = float.MinValue; + + /// + /// Gets the Accuracy of the gyroscope rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + + /// + /// Returns true or false based on whether gyroscope rotation vector sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the GyroscopeRotationVectorSensor is supported"); + return CheckIfSupported(SensorType.GyroscopeRotationVectorSensor, GyroscopeRVKey); + } + } + + /// + /// Returns the number of gyroscope rotation vector sensors available on the device. + /// + /// 3 + /// The count of accelerometer rotation vector sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of gyroscope rotation vector sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gyroscope_rotation_vector + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular gyroscope rotation vector sensor in case of multiple sensors + /// + public GyroscopeRotationVectorSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating GyroscopeRotationVectorSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.GyroscopeRotationVectorSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in gyroscope rotation vector sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.GyroscopeRotationVectorSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for gyroscope rotation vector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + W = sensorData.values[3]; + Accuracy = sensorData.accuracy; + + DataUpdated?.Invoke(this, new GyroscopeRotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for gyroscope rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for gyroscope rotation vector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for gyroscope rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for gyroscope rotation vector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/HeartRateMonitor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/HeartRateMonitor.cs new file mode 100755 index 0000000..0e254ea --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/HeartRateMonitor.cs @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// HeartRateMonitor Class. Used for registering callbacks for heart rate monitor and getting heart rate data + /// + public sealed class HeartRateMonitor : Sensor + { + private const string HRMKey = "http://tizen.org/feature/sensor.heart_rate_monitor"; + + /// + /// Gets the value of the heart rate monitor. + /// + /// 3 + /// Heart rate + public int HeartRate { get; private set; } = int.MinValue; + + /// + /// Returns true or false based on whether heart rate monitor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the HeartRateMonitor is supported"); + return CheckIfSupported(SensorType.HeartRateMonitor, HRMKey); + } + } + + /// + /// Returns the number of heart rate monitors available on the device. + /// + /// 3 + /// The count of heart rate monitors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of heart rate monitors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/privilege/healthinfo + /// public + /// http://tizen.org/feature/sensor.heart_rate_monitor + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the app has no privilege to use the sensor + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular heart rate monitor in case of multiple sensors + /// + public HeartRateMonitor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating HeartRateMonitor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.HeartRateMonitor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in heart rate monitor data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.HeartRateMonitor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for heart rate"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + HeartRate = (int)sensorData.values[0]; + + DataUpdated?.Invoke(this, new HeartRateMonitorDataUpdatedEventArgs((int)sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for heart rate monitor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for heart rate"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for heart rate monitor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for heart rate"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/HumiditySensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/HumiditySensor.cs new file mode 100755 index 0000000..3ef6def --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/HumiditySensor.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// HumiditySensor Class. Used for registering callbacks for humidity sensor and getting humidity data + /// + public sealed class HumiditySensor : Sensor + { + private const string HumiditySensorKey = "http://tizen.org/feature/sensor.humidity"; + + /// + /// Gets the value of the humidity sensor. + /// + /// 3 + /// Humidity + public float Humidity { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether humidity sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the HumiditySensor is supported"); + return CheckIfSupported(SensorType.HumiditySensor, HumiditySensorKey); + } + } + + /// + /// Returns the number of humidity sensors available on the device. + /// + /// 3 + /// The count of humidity sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of humidity sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.humidity + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular humidity sensor in case of multiple sensors + /// + public HumiditySensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating HumiditySensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.HumiditySensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in humidity sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.HumiditySensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for humidity"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Humidity = sensorData.values[0]; + + DataUpdated?.Invoke(this, new HumiditySensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for humidity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for humidity"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for humidity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for humidity"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/InVehicleActivityDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/InVehicleActivityDetector.cs new file mode 100755 index 0000000..0d6aa55 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/InVehicleActivityDetector.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// InVehicleActivityDetector Class. Used for registering callbacks for in vehicle activity detector and getting the in vehicle state + /// + public sealed class InVehicleActivityDetector : ActivityDetector + { + private const string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition"; + + /// + /// Gets the state of in-vehicle activity detector + /// + /// 3 + /// In-vehicle state + public DetectorState InVehicle { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether in-vehicle activity detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the in-vehicle activity detector is supported"); + return CheckIfSupported(SensorType.InVehicleActivityDetector, ActivityDetectorKey); + } + } + + /// + /// Returns the number of in-vehicle activity detectors available on the device. + /// + /// 3 + /// The count of in-vehicle activity detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of in-vehicle activity detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.activity_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular in-vehicle activity detector in case of multiple sensors. + /// + public InVehicleActivityDetector(uint index = 0) : base(index) + { + SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.InVehicle); + Log.Info(Globals.LogTag, "Creating in-vehicle activity detector object"); + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.InVehicleActivityDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for in-vehicle activity detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in in-vehicle activity detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + InVehicle = (DetectorState)sensorData.values[0]; + ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy; + + DataUpdated?.Invoke(this, new InVehicleActivityDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for invehicle activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for invehicle activity detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for invehicle activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for invehicle activity detector"); + } + } + + internal override SensorType GetSensorType() + { + return SensorType.InVehicleActivityDetector; + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/LightSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/LightSensor.cs new file mode 100755 index 0000000..2ec7c43 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/LightSensor.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// LightSensor Class. Used for registering callbacks for light sensor and getting light data + /// + public sealed class LightSensor : Sensor + { + private const string LightSensorKey = "http://tizen.org/feature/sensor.photometer"; + + /// + /// Gets the Level of the light. + /// + /// 3 + /// Light level + public float Level { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether light sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the LightSensor is supported"); + return CheckIfSupported(SensorType.LightSensor, LightSensorKey); + } + } + + /// + /// Returns the number of light sensors available on the device. + /// + /// 3 + /// The count of light sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of light sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.photometer + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular light sensor in case of multiple sensors + /// + public LightSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating LightSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.LightSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in light sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.LightSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for light"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Level = sensorData.values[0]; + + DataUpdated?.Invoke(this, new LightSensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for light sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for light"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for light sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for light"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/LinearAccelerationSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/LinearAccelerationSensor.cs new file mode 100755 index 0000000..6fbf056 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/LinearAccelerationSensor.cs @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// LinearAccelerationSensor Class. Used for registering callbacks for linear acceleration sensor and getting linear acceleration data + /// + public sealed class LinearAccelerationSensor : Sensor + { + private const string LinearAccelerationSensorKey = "http://tizen.org/feature/sensor.linear_acceleration"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the linear acceleration. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the linear acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the linear acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether linear acceleration sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the LinearAccelerationSensor is supported"); + return CheckIfSupported(SensorType.LinearAccelerationSensor, LinearAccelerationSensorKey); + } + } + + /// + /// Returns the number of linear acceleration sensors available on the device. + /// + /// 3 + /// The count of linear acceleration sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of linear acceleration sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.linear_acceleration + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular linear acceleration sensor in case of multiple sensors + /// + public LinearAccelerationSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating LinearAccelerationSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.LinearAccelerationSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in linear acceleration sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.LinearAccelerationSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for linear acceleration sensor"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + + DataUpdated?.Invoke(this, new LinearAccelerationSensorDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for linear acceleration sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for linear acceleration sensor"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for linear acceleration sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for linear acceleration"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for linear acceleration sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for linear acceleration sensor"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for linear acceleration sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for linear acceleration sensor"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/Magnetometer.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Magnetometer.cs new file mode 100755 index 0000000..83dd226 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Magnetometer.cs @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Magnetometer Class. Used for registering callbacks for magnetometer and getting magnetometer data + /// + public sealed class Magnetometer : Sensor + { + private static string MagnetometerKey = "http://tizen.org/feature/sensor.magnetometer"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the magnetometer. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the magnetometer. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the magnetometer. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether magnetometer is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the Magnetometer is supported"); + return CheckIfSupported(SensorType.Magnetometer, MagnetometerKey); + } + } + + /// + /// Returns the number of magnetometers available on the device. + /// + /// 3 + /// The count of magnetometers + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of magnetometers"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.magnetometer + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular magnetometer in case of multiple sensors + /// + public Magnetometer(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating Magnetometer object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.Magnetometer; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in magnetometer data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.Magnetometer, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for magnetometer"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + + DataUpdated?.Invoke(this, new MagnetometerDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for magnetometer"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for magnetometer"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for magnetometer"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for magnetometer"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/MagnetometerRotationVectorSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/MagnetometerRotationVectorSensor.cs new file mode 100755 index 0000000..02afa13 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/MagnetometerRotationVectorSensor.cs @@ -0,0 +1,234 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// MagnetometerRotationVectorSensor Class. Used for registering callbacks for magnetometer rotation vector sensor and getting magnetometer rotation vector data + /// + public sealed class MagnetometerRotationVectorSensor : Sensor + { + private static string MagnetometerRVKey = "http://tizen.org/feature/sensor.geomagnetic_rotation_vector"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the magnetometer rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the magnetometer rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the magnetometer rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Gets the W component of the magnetometer rotation vector. + /// + /// 3 + /// W + public float W { get; private set; } = float.MinValue; + + /// + /// Gets the Accuracy of the magnetometer rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } + + /// + /// Returns true or false based on whether magnetometer rotation vector sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the MagnetometerRotationVectorSensor is supported"); + return CheckIfSupported(SensorType.MagnetometerRotationVectorSensor, MagnetometerRVKey); + } + } + + /// + /// Returns the number of magnetometer rotation vector sensors available on the device. + /// + /// 3 + /// The count of magnetometer rotation vector sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of magnetometer rotation vector sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.geomagnetic_rotation_vector + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular magnetometer rotation vector sensor in case of multiple sensors + /// + public MagnetometerRotationVectorSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating MagnetometerRotationVectorSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.MagnetometerRotationVectorSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in magnetometer rotation vector sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static bool CheckIfSupported() + { + bool isSupported; + int error = Interop.SensorManager.SensorIsSupported(SensorType.MagnetometerRotationVectorSensor, out isSupported); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error checking if magnetometer rotation vector sensor is supported"); + isSupported = false; + } + return isSupported; + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.MagnetometerRotationVectorSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for magnetometer rotation vector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + W = sensorData.values[3]; + Accuracy = sensorData.accuracy; + + DataUpdated?.Invoke(this, new MagnetometerRotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for magnetometer rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for magnetometer rotation vector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for magnetometer rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for magnetometer rotation vector"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + Accuracy = accuracy; + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for magnetometer rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for magnetometer rotation vector"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for magnetometer rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for magnetometer rotation vector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/OrientationSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/OrientationSensor.cs new file mode 100755 index 0000000..2bba50a --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/OrientationSensor.cs @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// OrientationSensor Class. Used for registering callbacks for orientation sensor and getting orientation data + /// + public sealed class OrientationSensor : Sensor + { + private static string OrientationSensorKey = "http://tizen.org/feature/sensor.tiltmeter"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the Azimuth component of the orientation. + /// + /// 3 + /// Azimuth + public float Azimuth { get; private set; } = float.MinValue; + + /// + /// Gets the Pitch component of the orientation. + /// + /// 3 + /// Pitch + public float Pitch { get; private set; } = float.MinValue; + + /// + /// Gets the Roll component of the orientation. + /// + /// 3 + /// Roll + public float Roll { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether orientation sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the OrientationSensor is supported"); + return CheckIfSupported(SensorType.OrientationSensor, OrientationSensorKey); + } + } + + /// + /// Returns the number of orientation sensors available on the device. + /// + /// 3 + /// The count of orientation sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of orientation sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.tiltmeter + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular orientation sensor in case of multiple sensors + /// + public OrientationSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating OrientationSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.OrientationSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in orientation sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.OrientationSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for orientation"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Azimuth = sensorData.values[0]; + Pitch = sensorData.values[1]; + Roll = sensorData.values[2]; + + DataUpdated?.Invoke(this, new OrientationSensorDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for orientation sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for orientation"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for orientation sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for orientation"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for orientation sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy accuracy event callback for orientation"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for orientation sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for orientation"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs new file mode 100755 index 0000000..8f39050 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/Pedometer.cs @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// Pedometer Sensor Class. Used for registering callbacks for pedometer and getting pedometer data + /// + public sealed class Pedometer : Sensor + { + private static string PedometerKey = "http://tizen.org/feature/sensor.pedometer"; + + /// + /// Gets the step count + /// + /// 3 + /// Step count + public uint StepCount { get; private set; } = 0; + + /// + /// Gets the walking step count + /// + /// 3 + /// Walk step count + public uint WalkStepCount { get; private set; } = 0; + + /// + /// Gets the running step count + /// + /// 3 + /// Run step count + public uint RunStepCount { get; private set; } = 0; + + /// + /// Gets the moving distance + /// + /// 3 + /// Moving distance + public float MovingDistance { get; private set; } = 0; + + /// + /// Gets the calorie burned + /// + /// 3 + /// Calorie Burned + public float CalorieBurned { get; private set; } = 0; + + /// + /// Gets the last speed + /// + /// 3 + /// Last speed + public float LastSpeed { get; private set; } = 0; + + /// + /// Gets the last stepping frequency + /// + /// 3 + /// Last stepping frequency + public float LastSteppingFrequency { get; private set; } = 0; + + /// + /// Gets the last step status + /// + /// 3 + /// Last step status + public PedometerState LastStepStatus { get; private set; } = PedometerState.Unknown; + + /// + /// Returns true or false based on whether pedometer sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the Pedometer sensor is supported"); + return CheckIfSupported(SensorType.Pedometer, PedometerKey); + } + } + + /// + /// Returns the number of pedometer sensors available on the device. + /// + /// 3 + /// The count of pedometer sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of pedometer sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/privilege/healthinfo + /// public + /// http://tizen.org/feature/sensor.pedometer + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the app has no privilege to use the sensor + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular pedometer sensor in case of multiple sensors + /// + public Pedometer(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating Pedometer object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.Pedometer; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in pedometer sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.Pedometer, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for pedometer"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + StepCount = (uint)sensorData.values[0]; + WalkStepCount = (uint)sensorData.values[1]; + RunStepCount = (uint)sensorData.values[2]; + MovingDistance = sensorData.values[3]; + CalorieBurned = sensorData.values[4]; + LastSpeed = sensorData.values[5]; + LastSteppingFrequency = sensorData.values[6]; + LastStepStatus = (PedometerState)sensorData.values[7]; + + DataUpdated?.Invoke(this, new PedometerDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for pedometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pedometer"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for pedometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pedometer"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/PickUpGestureDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/PickUpGestureDetector.cs new file mode 100755 index 0000000..f0a870b --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/PickUpGestureDetector.cs @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// PickUpGestureDetector Class. Used for registering callbacks for pick up activity detector and getting the pick up state + /// + public sealed class PickUpGestureDetector : Sensor + { + private static string GestureDetectorKey = "http://tizen.org/feature/sensor.gesture_recognition"; + + /// + /// Gets the state of the pick up gesture. + /// + /// 3 + /// Pick up state + public DetectorState PickUp { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether pick up gesture detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the pick up gesture detector is supported"); + return CheckIfSupported(SensorType.PickUpGestureDetector, GestureDetectorKey); + } + } + + /// + /// Returns the number of pick up gesture detectors available on the device. + /// + /// 3 + /// The count of pick up gesture detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of pick up gesture detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gesture_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular pick up gesture detector in case of multiple sensors. + /// + public PickUpGestureDetector(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating pick up gesture detector object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.PickUpGestureDetector; + } + + private static bool CheckIfSupported() + { + bool isSupported; + int error = Interop.SensorManager.SensorIsSupported(SensorType.PickUpGestureDetector, out isSupported); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error checking if pick up gesture detector is supported"); + isSupported = false; + } + return isSupported; + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.PickUpGestureDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for pick up gesture detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in pick up gesture detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + PickUp = (DetectorState) sensorData.values[0]; + + DataUpdated?.Invoke(this, new PickUpGestureDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for pick up gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pick up gesture detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for pick up gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pick up gesture detector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/PressureSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/PressureSensor.cs new file mode 100755 index 0000000..f17c590 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/PressureSensor.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// PressureSensor Class. Used for registering callbacks for pressure sensor and getting pressure data + /// + public sealed class PressureSensor : Sensor + { + private static string PressureSensorKey = "http://tizen.org/feature/sensor.barometer"; + + /// + /// Gets the value of the pressure sensor. + /// + /// 3 + /// Pressure + public float Pressure { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether pressure sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the PressureSensor is supported"); + return CheckIfSupported(SensorType.PressureSensor, PressureSensorKey); + } + } + + /// + /// Returns the number of pressure sensors available on the device. + /// + /// 3 + /// The count of pressure sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of pressure sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.barometer + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular pressure sensor in case of multiple sensors + /// + public PressureSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating PressureSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.PressureSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in pressure sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.PressureSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for pressure"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Pressure = sensorData.values[0]; + + DataUpdated?.Invoke(this, new PressureSensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for pressure sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for pressure"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for pressure sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for pressure"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/ProximitySensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/ProximitySensor.cs new file mode 100755 index 0000000..927087a --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/ProximitySensor.cs @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// ProximitySensor Class. Used for registering callbacks for proximity sensor and getting proximity data + /// + public sealed class ProximitySensor : Sensor + { + private static string ProximitySensorKey = "http://tizen.org/feature/sensor.proximity"; + + /// + /// Gets the proximity state. + /// + /// 3 + /// Proximity state + public ProximitySensorState Proximity { get; private set; } = ProximitySensorState.Unknown; + + /// + /// Returns true or false based on whether proximity sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the ProximitySensor is supported"); + return CheckIfSupported(SensorType.ProximitySensor, ProximitySensorKey); + } + } + + /// + /// Returns the number of proximity sensors available on the device. + /// + /// 3 + /// The count of proximity sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of proximity sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.proximity + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular proximity sensor in case of multiple sensors + /// + public ProximitySensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating ProximitySensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.ProximitySensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in proximity sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.ProximitySensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for proximity"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Proximity = (ProximitySensorState) sensorData.values[0]; + + DataUpdated?.Invoke(this, new ProximitySensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for proximity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for proximity"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for proximity sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for proximity"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/RotationVectorSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/RotationVectorSensor.cs new file mode 100755 index 0000000..8489d11 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/RotationVectorSensor.cs @@ -0,0 +1,222 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// RotationVectorSensor Class. Used for registering callbacks for rotation vector sensor and getting rotation vector data + /// + public sealed class RotationVectorSensor : Sensor + { + private static string RotationVectorKey = "http://tizen.org/feature/sensor.rotation_vector"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the rotation vector. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the rotation vector. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the rotation vector. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Gets the W component of the rotation vector. + /// + /// 3 + /// W + public float W { get; private set; } = float.MinValue; + + /// + /// Gets the Accuracy of the rotation vector data. + /// + /// 3 + /// Accuracy + public SensorDataAccuracy Accuracy { get; private set; } = SensorDataAccuracy.Undefined; + + /// + /// Returns true or false based on whether rotation vector sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the RotationVectorSensor is supported"); + return CheckIfSupported(SensorType.RotationVectorSensor, RotationVectorKey); + } + } + + /// + /// Returns the number of rotation vector sensors available on the device. + /// + /// 3 + /// The count of rotation vector sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of rotation vector sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.rotation_vector + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular rotation vector sensor in case of multiple sensors + /// + public RotationVectorSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating RotationVectorSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.RotationVectorSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in rotation vector sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.RotationVectorSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for rotation vector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + W = sensorData.values[3]; + Accuracy = sensorData.accuracy; + + DataUpdated?.Invoke(this, new RotationVectorSensorDataUpdatedEventArgs(sensorData.values, sensorData.accuracy)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for rotation vector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for rotation vector"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + Accuracy = accuracy; + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for rotation vector"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for rotation vector sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for rotation vector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/RunningActivityDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/RunningActivityDetector.cs new file mode 100755 index 0000000..fc2ec5b --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/RunningActivityDetector.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// RunningActivityDetector Class. Used for registering callbacks for running activity detector and getting the running state + /// + public sealed class RunningActivityDetector : ActivityDetector + { + private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition"; + + /// + /// Gets the state of running activity detector + /// + /// 3 + /// Running state + public DetectorState Running { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether running activity detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the running activity detector is supported"); + return CheckIfSupported(SensorType.RunningActivityDetector, ActivityDetectorKey); + } + } + + /// + /// Returns the number of running activity detector available on the device. + /// + /// 3 + /// The count of running activity detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of running activity detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.activity_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular running activity detector in case of multiple sensors. + /// + public RunningActivityDetector(uint index = 0) : base(index) + { + SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Running); + Log.Info(Globals.LogTag, "Creating running activity detector object"); + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.RunningActivityDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for running activity detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in running activity detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Running = (DetectorState)sensorData.values[0]; + ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy; + + DataUpdated?.Invoke(this, new RunningActivityDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for running activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for running activity detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for running activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for running activity detector"); + } + } + + internal override SensorType GetSensorType() + { + return SensorType.RunningActivityDetector; + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/SleepMonitor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/SleepMonitor.cs new file mode 100755 index 0000000..8291cfa --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/SleepMonitor.cs @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// SleepMonitor Class. Used for registering callbacks for sleep monitor and getting sleep data + /// + public sealed class SleepMonitor : Sensor + { + private static string SleepMonitorKey = "http://tizen.org/feature/sensor.sleep_monitor"; + + /// + /// Gets the value of the sleep state. + /// + /// 3 + /// Sleep state + public SleepMonitorState SleepState { get; private set; } = SleepMonitorState.Unknown; + + /// + /// Returns true or false based on whether sleep monitor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the SleepMonitor is supported"); + return CheckIfSupported(SensorType.SleepMonitor, SleepMonitorKey); + } + } + + /// + /// Returns the number of sleep monitors available on the device. + /// + /// 3 + /// The count of sleep monitors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of sleep monitors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/privilege/healthinfo + /// public + /// http://tizen.org/feature/sensor.sleep_monitor + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the app has no privilege to use the sensor + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular sleep monitor in case of multiple sensors + /// + public SleepMonitor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating SleepMonitor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.SleepMonitor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in sleep monitor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.SleepMonitor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for sleep"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + SleepState = (SleepMonitorState)sensorData.values[0]; + + DataUpdated?.Invoke(this, new SleepMonitorDataUpdatedEventArgs((int)sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for sleep monitor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for sleep"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for sleep monitor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for sleep"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/StationaryActivityDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/StationaryActivityDetector.cs new file mode 100755 index 0000000..c8b0251 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/StationaryActivityDetector.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// StationaryActivityDetector Class. Used for registering callbacks for stationary activity detector and getting the stationary state + /// + public sealed class StationaryActivityDetector : ActivityDetector + { + private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition"; + + /// + /// Gets the state of stationary activity detector + /// + /// 3 + /// Stationary state + public DetectorState Stationary { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether stationary activity detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the stationary activity detector is supported"); + return CheckIfSupported(SensorType.StationaryActivityDetector, ActivityDetectorKey); + } + } + + /// + /// Returns the number of stationary activity detectors available on the device. + /// + /// 3 + /// The count of stationary activity detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of stationary activity detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.activity_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular stationary activity detector in case of multiple sensors. + /// + public StationaryActivityDetector(uint index = 0) : base(index) + { + SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Stationary); + Log.Info(Globals.LogTag, "Creating stationary activity detector object"); + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.StationaryActivityDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for stationary activity detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in stationary activity detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + internal static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Stationary = (DetectorState)sensorData.values[0]; + ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy; + + DataUpdated?.Invoke(this, new StationaryActivityDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for stationary activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for stationary activity detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for stationary activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for stationary activity detector"); + } + } + + internal override SensorType GetSensorType() + { + return SensorType.StationaryActivityDetector; + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/TemperatureSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/TemperatureSensor.cs new file mode 100755 index 0000000..b90b1bc --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/TemperatureSensor.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// TemperatureSensor Class. Used for registering callbacks for temperature sensor and getting temperature data + /// + public sealed class TemperatureSensor : Sensor + { + private static string TemperatureSensorKey = "http://tizen.org/feature/sensor.temperature"; + + /// + /// Gets the value of the temperature sensor. + /// + /// 3 + /// Temperature (Celsius) + public float Temperature { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether temperature sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the TemperatureSensor is supported"); + return CheckIfSupported(SensorType.TemperatureSensor, TemperatureSensorKey); + } + } + + /// + /// Returns the number of temperature sensors available on the device. + /// + /// 3 + /// The count of temperature sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of temperature sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.temperature + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular temperature sensor in case of multiple sensors + /// + public TemperatureSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating TemperatureSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.TemperatureSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in temperature sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.TemperatureSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for temperature"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Temperature = sensorData.values[0]; + + DataUpdated?.Invoke(this, new TemperatureSensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for temperature sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for temperature"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for temperature sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for temperature"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/UltravioletSensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UltravioletSensor.cs new file mode 100755 index 0000000..07c3d2e --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UltravioletSensor.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UltravioletSensor Class. Used for registering callbacks for ultraviolet sensor and getting ultraviolet data + /// + public sealed class UltravioletSensor : Sensor + { + private static string UltravioletSensorKey = "http://tizen.org/feature/sensor.ultraviolet"; + + /// + /// Gets the value of the ultraviolet sensor. + /// + /// 3 + /// Ultraviolet index + public float UltravioletIndex { get; private set; } = float.MinValue; + + /// + /// Returns true or false based on whether ultraviolet sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the UltravioletSensor is supported"); + return CheckIfSupported(SensorType.UltravioletSensor, UltravioletSensorKey); + } + } + + /// + /// Returns the number of ultraviolet sensors available on the device. + /// + /// 3 + /// The count of ultraviolet sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of ultraviolet sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.ultraviolet + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular ultraviolet sensor in case of multiple sensors + /// + public UltravioletSensor(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating UltravioletSensor object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.UltravioletSensor; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in ultraviolet sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.UltravioletSensor, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for ultraviolet"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + UltravioletIndex = sensorData.values[0]; + + DataUpdated?.Invoke(this, new UltravioletSensorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for ultraviolet sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for ultraviolet"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for ultraviolet sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for ultraviolet"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedGyroscope.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedGyroscope.cs new file mode 100755 index 0000000..18900d5 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedGyroscope.cs @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UncalibratedGyroscope Sensor Class. Used for registering callbacks for uncalibrated gyroscope and getting uncalibrated gyroscope data + /// + public sealed class UncalibratedGyroscope : Sensor + { + private static string UncalibratedGyroscopeKey = "http://tizen.org/feature/sensor.gyroscope.uncalibrated"; + + /// + /// Gets the X component of the acceleration. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Gets the BiasX component of the uncalibrated gyroscope data. + /// + /// 3 + /// X bias + public float BiasX { get; private set; } = 0; + + /// + /// Gets the BiasY component of the uncalibrated gyroscope data. + /// + /// 3 + /// Y bias + public float BiasY { get; private set; } = 0; + + /// + /// Gets the BiasZ component of the uncalibrated gyroscope data. + /// + /// 3 + /// Z bias + public float BiasZ { get; private set; } = 0; + + /// + /// Returns true or false based on whether uncalibrated gyroscope sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the UncalibratedGyroscope sensor is supported"); + return CheckIfSupported(SensorType.UncalibratedGyroscope, UncalibratedGyroscopeKey); + } + } + + /// + /// Returns the number of uncalibrated gyroscope sensors available on the device. + /// + /// 3 + /// The count of uncalibrated gyroscope sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of uncalibrated gyroscope sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.gyroscope.uncalibrated + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular uncalibrated gyroscope sensor in case of multiple sensors + /// + public UncalibratedGyroscope(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating UncalibratedGyroscope object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.UncalibratedGyroscope; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in uncalibrated gyroscope sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.UncalibratedGyroscope, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for uncalibrated gyroscope"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + BiasX = sensorData.values[3]; + BiasY = sensorData.values[4]; + BiasZ = sensorData.values[5]; + + DataUpdated?.Invoke(this, new UncalibratedGyroscopeDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for uncalibrated gyroscope sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for uncalibrated gyroscope"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for uncalibrated gyroscope sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for uncalibrated gyroscope"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedMagnetometer.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedMagnetometer.cs new file mode 100755 index 0000000..04709e7 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/UncalibratedMagnetometer.cs @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// UncalibratedMagnetometer Sensor Class. Used for registering callbacks for uncalibrated magnetometer and getting uncalibrated magnetometer data + /// + public sealed class UncalibratedMagnetometer : Sensor + { + private static string UncalibratedMagnetometerKey = "http://tizen.org/feature/sensor.magnetometer.uncalibrated"; + + private event EventHandler _accuracyChanged; + /// + /// Gets the X component of the acceleration. + /// + /// 3 + /// X + public float X { get; private set; } = float.MinValue; + + /// + /// Gets the Y component of the acceleration. + /// + /// 3 + /// Y + public float Y { get; private set; } = float.MinValue; + + /// + /// Gets the Z component of the acceleration. + /// + /// 3 + /// Z + public float Z { get; private set; } = float.MinValue; + + /// + /// Gets the BiasX component of the uncalibrated magnetometer data. + /// + /// 3 + /// X bias + public float BiasX { get; private set; } = 0; + + /// + /// Gets the BiasY component of the uncalibrated magnetometer data. + /// + /// 3 + /// Y bias + public float BiasY { get; private set; } = 0; + + /// + /// Gets the BiasZ component of the uncalibrated magnetometer data. + /// + /// 3 + /// Z bias + public float BiasZ { get; private set; } = 0; + + /// + /// Returns true or false based on whether uncalibrated magnetometer sensor is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the UncalibratedMagnetometer sensor is supported"); + return CheckIfSupported(SensorType.UncalibratedMagnetometer, UncalibratedMagnetometerKey); + } + } + + /// + /// Returns the number of uncalibrated magnetometer sensors available on the device. + /// + /// 3 + /// The count of uncalibrated magnetometer sensors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of uncalibrated magnetometer sensors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.magnetometer.uncalibrated + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular uncalibrated magnetometer sensor in case of multiple sensors + /// + public UncalibratedMagnetometer(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating UncalibratedMagnetometer object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.UncalibratedMagnetometer; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in uncalibrated magnetometer sensor data. + /// + /// 3 + + public event EventHandler DataUpdated; + + /// + /// Event handler for accuracy changed events. + /// + /// 3 + public event EventHandler AccuracyChanged + { + add + { + if (_accuracyChanged == null) + { + AccuracyListenStart(); + } + _accuracyChanged += value; + } + remove + { + _accuracyChanged -= value; + if (_accuracyChanged == null) + { + AccuracyListenStop(); + } + } + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.UncalibratedMagnetometer, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for uncalibrated magnetometer"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + X = sensorData.values[0]; + Y = sensorData.values[1]; + Z = sensorData.values[2]; + BiasX = sensorData.values[3]; + BiasY = sensorData.values[4]; + BiasZ = sensorData.values[5]; + + DataUpdated?.Invoke(this, new UncalibratedMagnetometerDataUpdatedEventArgs(sensorData.values)); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for uncalibrated magnetometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for uncalibrated magnetometer"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for uncalibrated magnetometer sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for uncalibrated magnetometer"); + } + } + + private static Interop.SensorListener.SensorAccuracyCallback _accuracyCallback; + + private void AccuracyListenStart() + { + _accuracyCallback = (IntPtr sensorHandle, UInt64 timestamp, SensorDataAccuracy accuracy, IntPtr data) => { + TimeSpan = new TimeSpan((Int64)timestamp); + _accuracyChanged?.Invoke(this, new SensorAccuracyChangedEventArgs(new TimeSpan((Int64)timestamp), accuracy)); + }; + + int error = Interop.SensorListener.SetAccuracyCallback(ListenerHandle, _accuracyCallback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting accuracy event callback for uncalibrated magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set accuracy event callback for uncalibrated magnetometer"); + } + } + + private void AccuracyListenStop() + { + int error = Interop.SensorListener.UnsetAccuracyCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting accuracy event callback for uncalibrated magnetometer"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset accuracy event callback for uncalibrated magnetometer"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/WalkingActivityDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/WalkingActivityDetector.cs new file mode 100755 index 0000000..8fd5960 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/WalkingActivityDetector.cs @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// WalkingActivityDetector Class. Used for registering callbacks for walking activity detector and getting the walking state + /// + public sealed class WalkingActivityDetector : ActivityDetector + { + private static string ActivityDetectorKey = "http://tizen.org/feature/sensor.activity_recognition"; + + /// + /// Gets the state of walking activity detector + /// + /// 3 + /// Walking state + public DetectorState Walking { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether walking activity detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the walking activity detector is supported"); + return CheckIfSupported(SensorType.WalkingActivityDetector, ActivityDetectorKey); + } + } + + /// + /// Returns the number of walking activity detectors available on the device. + /// + /// 3 + /// The count of walking activity detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of walking activity detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.activity_recognition + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular walking activity detector in case of multiple sensors. + /// + public WalkingActivityDetector(uint index = 0) : base(index) + { + SetAttribute((SensorAttribute)ActivityAttribute, (int)ActivityType.Walking); + Log.Info(Globals.LogTag, "Creating walking activity gesture detector object"); + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.WalkingActivityDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for walking activity detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in walking activity gesture detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + internal static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + Walking = (DetectorState)sensorData.values[0]; + ActivityAccuracy = (SensorDataAccuracy) sensorData.accuracy; + + DataUpdated?.Invoke(this, new WalkingActivityDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for walking activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for walking activity detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for walking activity detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for walking activity detector"); + } + } + + internal override SensorType GetSensorType() + { + return SensorType.WalkingActivityDetector; + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Plugins/WristUpGestureDetector.cs b/src/Tizen.Sensor/Tizen.Sensor/Plugins/WristUpGestureDetector.cs new file mode 100755 index 0000000..761e374 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Plugins/WristUpGestureDetector.cs @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// WristUpGestureDetector Class. Used for registering callbacks for wrist up gesture detector and getting the wrist up state + /// + public sealed class WristUpGestureDetector : Sensor + { + private static string WristUpKey = "http://tizen.org/feature/sensor.wrist_up"; + + /// + /// Gets the state of the wrist up gesture. + /// + /// 3 + /// Wrist up state + public DetectorState WristUp { get; private set; } = DetectorState.Unknown; + + /// + /// Returns true or false based on whether wrist up gesture detector is supported by device. + /// + /// 3 + /// true if supported; otherwise, false. + public static bool IsSupported + { + get + { + Log.Info(Globals.LogTag, "Checking if the wrist up gesture detector is supported"); + return CheckIfSupported(SensorType.WristUpGestureDetector, WristUpKey); + } + } + + /// + /// Returns the number of wrist up gesture detectors available on the device. + /// + /// 3 + /// The count of wrist up gesture detectors + public static int Count + { + get + { + Log.Info(Globals.LogTag, "Getting the count of wrist up gesture detectors"); + return GetCount(); + } + } + + /// + /// Initializes a new instance of the class. + /// + /// 3 + /// http://tizen.org/feature/sensor.wrist_up + /// Thrown when an invalid argument is used + /// Thrown when the sensor is not supported + /// Thrown when the operation is invalid for the current state + /// + /// Index. Default value for this is 0. Index refers to a particular wrist up gesture detector in case of multiple sensors. + /// + public WristUpGestureDetector(uint index = 0) : base(index) + { + Log.Info(Globals.LogTag, "Creating wrist up gesture detector object"); + } + + internal override SensorType GetSensorType() + { + return SensorType.WristUpGestureDetector; + } + + private static int GetCount() + { + IntPtr list; + int count; + int error = Interop.SensorManager.GetSensorList(SensorType.WristUpGestureDetector, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list for wrist up gesture detector"); + count = 0; + } + else + Interop.Libc.Free(list); + return count; + } + + /// + /// Event Handler for storing the callback functions for event corresponding to change in wrist up gesture detector data. + /// + /// 3 + public event EventHandler DataUpdated; + + private static Interop.SensorListener.SensorEventCallback _callback; + + internal override void EventListenStart() + { + _callback = (IntPtr sensorHandle, IntPtr eventPtr, IntPtr data) => { + Interop.SensorEventStruct sensorData = Interop.IntPtrToEventStruct(eventPtr); + + TimeSpan = new TimeSpan((Int64)sensorData.timestamp); + WristUp = (DetectorState) sensorData.values[0]; + + DataUpdated?.Invoke(this, new WristUpGestureDetectorDataUpdatedEventArgs(sensorData.values[0])); + }; + + int error = Interop.SensorListener.SetEventCallback(ListenerHandle, Interval, _callback, IntPtr.Zero); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting event callback for wrist up gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to set event callback for wrist up gesture detector"); + } + } + + internal override void EventListenStop() + { + int error = Interop.SensorListener.UnsetEventCallback(ListenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error unsetting event callback for wrist up gesture detector"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to unset event callback for wrist up gesture detector"); + } + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/Sensor.cs b/src/Tizen.Sensor/Tizen.Sensor/Sensor.cs new file mode 100755 index 0000000..fa512c2 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/Sensor.cs @@ -0,0 +1,533 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.System; + +namespace Tizen.Sensor +{ + internal static class Globals + { + internal const string LogTag = "Tizen.Sensor"; + } + + /// + /// Sensor class for storing hardware information about a particular sensor + /// + public abstract class Sensor : IDisposable + { + private string _name; + private string _vendor; + private float _minValue; + private float _maxValue; + private float _resolution; + private int _minInterval; + private int _fifoCount; + private int _maxBatchCount; + private bool _isSensing = false; + private bool _disposed = false; + private TimeSpan _timeSpan; + private uint _interval = 0; + private uint _maxBatchLatency = 0; + private SensorPausePolicy _pausePolicy = SensorPausePolicy.None; + private IntPtr _sensorHandle = IntPtr.Zero; + private IntPtr _listenerHandle = IntPtr.Zero; + + internal abstract SensorType GetSensorType(); + internal abstract void EventListenStart(); + internal abstract void EventListenStop(); + + internal Sensor(uint index) + { + SensorType type = GetSensorType(); + GetHandleList(type, index); + if (CheckSensorHandle()) + { + CreateListener(); + GetProperty(); + } + } + + ~Sensor() + { + Dispose(false); + } + + /// + /// Property: For getting the name of the sensor + /// + /// 3 + /// The name of sensor + public string Name + { + get + { + Log.Info(Globals.LogTag, "Getting the sensor name"); + return _name; + } + } + + /// + /// Property: Gets the vendor. + /// + /// 3 + /// The vendor name of sensor + public string Vendor + { + get + { + Log.Info(Globals.LogTag, "Getting the sensor vendor name"); + return _vendor; + } + } + + /// + /// Property: Gets the minimum value of range of sensor data. + /// + /// 3 + /// The lower bound of range of sensor reading + public float MinValue + { + get + { + Log.Info(Globals.LogTag, "Getting the min value of the sensor"); + return _minValue; + } + } + + /// + /// Property: Gets the maximum value of range of sensor data. + /// + /// 3 + /// The upper bound of range of sensor reading + public float MaxValue + { + get + { + Log.Info(Globals.LogTag, "Getting the max value of the sensor"); + return _maxValue; + } + } + + /// + /// Property: Gets the resolution. + /// + /// 3 + /// The resolution + public float Resolution + { + get + { + Log.Info(Globals.LogTag, "Getting the resolution of the sensor"); + return _resolution; + } + } + + /// + /// Property: Gets the minimum interval. + /// + /// 3 + /// The minimum update interval + public int MinInterval + { + get + { + Log.Info(Globals.LogTag, "Getting the min interval for the sensor"); + return _minInterval; + } + } + + /// + /// Property: Gets the fifo count. + /// + /// 3 + /// The size of the hardware FIFO + public int FifoCount + { + get + { + Log.Info(Globals.LogTag, "Getting the fifo count of the sensor"); + return _fifoCount; + } + } + + /// + /// Property: Gets the maximum batch count. + /// + /// 3 + /// The maximum batch count + public int MaxBatchCount + { + get + { + Log.Info(Globals.LogTag, "Getting the max batch count of the sensor"); + return _maxBatchCount; + } + } + + /// + /// Sets the interval of the sensor for sensor data event + /// Callbacks will be called at frequency of this interval + /// + /// 3 + /// Thrown when the operation is invalid for the current state + /// The interval of the sensor + public uint Interval + { + set + { + Log.Info(Globals.LogTag, "Setting the interval of the sensor"); + _interval = value; + SetInterval(); + } + get + { + Log.Info(Globals.LogTag, "Getting the interval of the sensor"); + return _interval; + } + } + + /// + /// Sets the max batch latency for the sensor corresponding to the sensor data event. + /// + /// 3 + /// Thrown when the operation is invalid for the current state + /// The max batch latency + public uint MaxBatchLatency + { + set + { + Log.Info(Globals.LogTag, "Setting the max batch latency of the sensor"); + _maxBatchLatency = value; + SetMaxBatchLatency(); + } + get + { + Log.Info(Globals.LogTag, "Getting the max batch latency of the sensor"); + return _maxBatchLatency; + } + } + + /// + /// Sets the pause policy of the sensor. + /// + /// 3 + /// The pause policy + /// Thrown when the operation is invalid for the current state + /// The pause policy + public SensorPausePolicy PausePolicy + { + set + { + Log.Info(Globals.LogTag, "Setting the pause policy of the sensor"); + _pausePolicy = value; + SetAttribute(SensorAttribute.PausePolicy, (int)_pausePolicy); + } + get + { + Log.Info(Globals.LogTag, "Getting the pause policy of the sensor"); + return _pausePolicy; + } + } + + /// + /// Gets or sets the time span. + /// + /// 3 + /// The time span + public TimeSpan TimeSpan + { + set + { + Log.Info(Globals.LogTag, "Setting the timespan of the sensor values"); + _timeSpan = value; + } + get + { + Log.Info(Globals.LogTag, "Getting the timespan of the sensor values"); + return _timeSpan; + } + } + + /// + /// Indicates whether this sensor is sensing. + /// + /// 3 + /// true if this sensor is sensing; otherwise, false. + public bool IsSensing + { + get + { + Log.Info(Globals.LogTag, "Checking if the sensor is started"); + return _isSensing; + } + } + + internal IntPtr ListenerHandle + { + get + { + return _listenerHandle; + } + } + + internal static bool CheckIfSupported(SensorType type, String key) + { + bool isSupported = false; + bool error = SystemInfo.TryGetValue(key, out isSupported); + + if (!error || !isSupported) + { + Log.Error(Globals.LogTag, "Error checking if sensor is supported(systeminfo)"); + return false; + } + + int ret = Interop.SensorManager.SensorIsSupported(type, out isSupported); + if (ret != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error checking if sensor is supported"); + isSupported = false; + } + + return isSupported; + } + + /// + /// Starts the sensor. + /// After this the event handlers will start receiving events. + /// + /// 3 + /// Thrown when the operation is invalid for the current state + public void Start() + { + Log.Info(Globals.LogTag, "Starting the sensor"); + if (CheckListenerHandle()) + { + int error = Interop.SensorListener.StartListener(_listenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error starting sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Start Sensor Listener"); + } + EventListenStart(); + _isSensing = true; + Log.Info(Globals.LogTag, "Sensor started"); + } + } + + /// + /// Stop the sensor. + /// After this the event handlers will stop receiving the events + /// + /// 3 + /// Thrown when the operation is invalid for the current state + public void Stop() + { + Log.Info(Globals.LogTag, "Stopping the sensor"); + if (_isSensing) + { + int error = Interop.SensorListener.StopListener(_listenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error stopping the sensor"); + throw SensorErrorFactory.CheckAndThrowException(error, "Unable to Stop Sensor Listener"); + } + EventListenStop(); + _isSensing = false; + Log.Info(Globals.LogTag, "Sensor stopped"); + } + } + + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (_disposed) + return; + + DestroyHandles(); + _disposed = true; + } + + internal void SetAttribute(SensorAttribute attribute, int option) + { + if (CheckListenerHandle()) + { + int error = Interop.SensorListener.SetAttribute(_listenerHandle, attribute, option); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting sensor pause policy"); + throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.PausePolicy Failed"); + } + } + } + + private void GetHandleList(SensorType type, uint index) + { + IntPtr list; + IntPtr[] sensorList; + int count; + int error = Interop.SensorManager.GetSensorList(type, out list, out count); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor list"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.GetSensorList Failed"); + } + sensorList = Interop.IntPtrToIntPtrArray(list, count); + _sensorHandle = sensorList[index]; + Interop.Libc.Free(list); + } + + private void GetProperty() + { + int error = (int)SensorError.None; + + error = Interop.Sensor.GetName(_sensorHandle, out _name); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor name"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Name Failed"); + } + + error = Interop.Sensor.GetVendor(_sensorHandle, out _vendor); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor vendor name"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Vendor Failed"); + } + + error = Interop.Sensor.GetMinRange(_sensorHandle, out _minValue); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor min value"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinValue Failed"); + } + + error = Interop.Sensor.GetMaxRange(_sensorHandle, out _maxValue); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor max value"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxValue Failed"); + } + + error = Interop.Sensor.GetResolution(_sensorHandle, out _resolution); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor resolution"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.Resolution Failed"); + } + + error = Interop.Sensor.GetMinInterval(_sensorHandle, out _minInterval); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor min interval"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MinInterval Failed"); + } + + error = Interop.Sensor.GetFifoCount(_sensorHandle, out _fifoCount); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor fifo count"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.FifoCount Failed"); + } + + error = Interop.Sensor.GetMaxBatchCount(_sensorHandle, out _maxBatchCount); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error getting sensor max batch count"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.MaxBatchCount Failed"); + } + } + + private void CreateListener() + { + int error = Interop.SensorListener.CreateListener(_sensorHandle, out _listenerHandle); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error cerating sensor listener handle"); + throw SensorErrorFactory.CheckAndThrowException(error, "Sensor.CreateListener Failed"); + } + } + + private void SetInterval() + { + if (CheckListenerHandle()) + { + if (_isSensing) + { + int error = Interop.SensorListener.SetInterval(_listenerHandle, _interval); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting sensor interval"); + throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.SetInterval Failed"); + } + } + } + } + + private void SetMaxBatchLatency() + { + if (CheckListenerHandle()) + { + int error = Interop.SensorListener.SetMaxBatchLatency(_listenerHandle, _maxBatchLatency); + if (error != (int)SensorError.None) + { + Log.Error(Globals.LogTag, "Error setting max batch latency"); + throw SensorErrorFactory.CheckAndThrowException(error, "Setting Sensor.MaxBatchLatency Failed"); + } + } + } + + private bool CheckListenerHandle() + { + bool result = false; + if (_listenerHandle != IntPtr.Zero) + { + result = true; + } + else + { + Log.Error(Globals.LogTag, "Sensor listener handle is null"); + throw new ArgumentException("Invalid Parameter: Sensor is null"); + } + return result; + } + + private bool CheckSensorHandle() + { + bool result = false; + if (_sensorHandle != IntPtr.Zero) + { + result = true; + } + else + { + Log.Error(Globals.LogTag, "Sensor handle is null"); + throw new ArgumentException("Invalid Parameter: Sensor is null"); + } + return result; + } + + private void DestroyHandles() + { + Interop.SensorListener.DestroyListener(_listenerHandle); + } + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs b/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs new file mode 100755 index 0000000..84e2571 --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/SensorEnumerations.cs @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Sensor +{ + /// + /// The SensorType Enum defintion for all sensor types. + /// + internal enum SensorType + { + /// + /// All sensors. This can be used to retrieve Sensor class object for all available sensors. + /// + All = -1, + /// + /// Accelerometer sensor. + /// + Accelerometer = 0, + /// + /// Gravity sensor. + /// + GravitySensor = 1, + /// + /// Linear Acceleration sensor. + /// + LinearAccelerationSensor = 2, + /// + /// Magnetometer sensor. + /// + Magnetometer = 3, + /// + /// Rotation Vector sensor. + /// + RotationVectorSensor = 4, + /// + /// Orientation sensor. + /// + OrientationSensor = 5, + /// + /// Gyroscope sensor. + /// + Gyroscope = 6, + /// + /// Light sensor. + /// + LightSensor = 7, + /// + /// Proximity sensor. + /// + ProximitySensor = 8, + /// + /// Pressure sensor. + /// + PressureSensor = 9, + /// + /// Ultraviolet sensor. + /// + UltravioletSensor = 10, + /// + /// Temperature sensor. + /// + TemperatureSensor = 11, + /// + /// Humidity sensor. + /// + HumiditySensor = 12, + /// + /// Hear rate monitor sensor. + /// + HeartRateMonitor = 13, + /// + /// Uncalibrated Gyroscope sensor. + /// + UncalibratedGyroscope = 17, + /// + /// Uncalibrated Geomagnetic sensor. + /// + UncalibratedMagnetometer = 18, + /// + /// Gyroscope-based rotation vector sensor. + /// + GyroscopeRotationVectorSensor = 19, + /// + /// Geomagnetic-based rotation vector sensor. + /// + MagnetometerRotationVectorSensor = 20, + /// + /// Pedometer sensor. + /// + Pedometer = 0x300, + /// + /// Sleep monitor sensor. + /// + SleepMonitor = 0x301, + /// + /// Walking activity detector. + /// + WalkingActivityDetector = 0x1A00, + /// + /// Running activity detector. + /// + RunningActivityDetector = 0x1A00, + /// + /// Stationary activity detector. + /// + StationaryActivityDetector = 0x1A00, + /// + /// InVehicle activity detector. + /// + InVehicleActivityDetector = 0x1A00, + /// + /// Wrist up gesture detector. + /// + WristUpGestureDetector = 0x1201, + /// + /// Pick up gesture detector. + /// + PickUpGestureDetector = 0x1204, + /// + /// Face down gesture detector. + /// + FaceDownGestureDetector = 0x1205 + } + + /// + /// Sensor attribute. + /// + internal enum SensorAttribute + { + /// + /// The axis orientation. + /// + AxisOrientation, + + /// + /// The pause policy. + /// + PausePolicy + } + + /// + /// SensorDataAccuracy Enum definition for all possible sensor data accuracy Values. + /// + /// 3 + public enum SensorDataAccuracy + { + /// + /// Undefined sensor data accuracy. + /// + /// 3 + Undefined = -1, + /// + /// Sensor data not accurate. + /// + /// 3 + Bad = 0, + /// + /// Moderately accurate sensor data. + /// + /// 3 + Normal = 1, + /// + /// Highly accurate sensor data. + /// + /// 3 + Good = 2, + /// + /// Very highly accurate sensor data. + /// + /// 3 + VeryGood = 3 + } + + /// + /// Sensor Option Enum definition for sensor option Values + /// + /// 3 + public enum SensorPausePolicy + { + /// + /// Does not receive data when the LCD is off and in the power save mode. + /// + /// 3 + None, + /// + /// Receives data when the LCD is off. + /// + /// 3 + DisplayOff, + /// + /// Receives data in the power save mode. + /// + /// 3 + PowerSaveMode, + /// + /// Receives data when the LCD is off and in the power save mode. + /// + /// 3 + All + } + + /// + /// Pedometer state. + /// + /// 3 + public enum PedometerState + { + /// + /// Unknown. + /// + /// 3 + Unknown = -1, + + /// + /// Stop state. + /// + /// 3 + Stop, + + /// + /// Walking state. + /// + /// 3 + Walk, + + /// + /// Running state. + /// + /// 3 + Run + } + + /// + /// Sleep monitor state. + /// + /// 3 + public enum SleepMonitorState + { + /// + /// Unknown. + /// + /// 3 + Unknown = -1, + + /// + /// The wake state. + /// + /// 3 + Wake, + + /// + /// The sleeping state. + /// + /// 3 + Sleep + } + + /// + /// Proximity sensor state. + /// + /// 3 + public enum ProximitySensorState + { + /// + /// Unknown. + /// + /// 3 + Unknown = -1, + + /// + /// Near sate. + /// + /// 3 + Near = 0, + + /// + /// Far state. + /// + /// 3 + Far = 5 + } + + /// + /// Detector sensor state. + /// + /// 3 + public enum DetectorState + { + /// + /// Unknown. + /// + /// 3 + Unknown = -1, + + /// + /// None sate. + /// + /// 3 + NotDetected = 0, + + /// + /// Detected state. + /// + /// 3 + Detected = 1 + } +} diff --git a/src/Tizen.Sensor/Tizen.Sensor/SensorErrorFactory.cs b/src/Tizen.Sensor/Tizen.Sensor/SensorErrorFactory.cs new file mode 100644 index 0000000..67cf82b --- /dev/null +++ b/src/Tizen.Sensor/Tizen.Sensor/SensorErrorFactory.cs @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using Tizen.Internals.Errors; + +namespace Tizen.Sensor +{ + internal enum SensorError + { + None = ErrorCode.None, + IOError = ErrorCode.IoError, + InvalidParameter = ErrorCode.InvalidParameter, + NotSupported = ErrorCode.NotSupported, + PermissionDenied = ErrorCode.PermissionDenied, + OutOfMemory = ErrorCode.OutOfMemory, + NotNeedCalibration = -0x02440000 | 0x03, + OperationFailed = -0x02440000 | 0x06 + } + + internal static class SensorErrorFactory + { + static internal Exception CheckAndThrowException(int error, string msg) + { + SensorError e = (SensorError)error; + switch (e) + { + case SensorError.None: + return null; + case SensorError.IOError: + return new InvalidOperationException("I/O Error: " + msg); + case SensorError.InvalidParameter: + return new ArgumentException("Invalid Parameter: " + msg); + case SensorError.NotSupported: + return new NotSupportedException("Not Supported: " + msg); + case SensorError.PermissionDenied: + return new UnauthorizedAccessException("Permission Denied: " + msg); + case SensorError.OutOfMemory: + return new InvalidOperationException("Out of Memory: " + msg); + case SensorError.NotNeedCalibration: + return new InvalidOperationException("Sensor doesn't need calibration: " + msg); + case SensorError.OperationFailed: + return new InvalidOperationException("Operation Failed: " + msg); + default: + return new InvalidOperationException("Unknown Error Code: " + msg); + } + } + } +} diff --git a/src/Tizen.System.Feedback/Feedback/Feedback.cs b/src/Tizen.System.Feedback/Feedback/Feedback.cs new file mode 100644 index 0000000..5bd1d0c --- /dev/null +++ b/src/Tizen.System.Feedback/Feedback/Feedback.cs @@ -0,0 +1,375 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; + + +namespace Tizen.System +{ + /// + /// Class for constants + /// + internal static class Constants + { + internal const int NumberOfPattern = 39; + } + + /// + /// The Feedback API provides functions to control haptic and sound. + /// The Feedback API provides the way to play and stop feedback and get the information whether specific pattern is supported. + /// Below is supported pattern string. + /// Tap + /// SoftInputPanel + /// Key0 + /// Key1 + /// Key2 + /// Key3 + /// Key4 + /// Key5 + /// Key6 + /// Key7 + /// Key8 + /// Key9 + /// KeyStar + /// KeySharp + /// KeyBack + /// Hold + /// HardwareKeyPressed + /// HardwareKeyHold + /// Message + /// Email + /// WakeUp + /// Schedule + /// Timer + /// General + /// PowerOn + /// PowerOff + /// ChargerConnected + /// ChargingError + /// FullyCharged + /// LowBattery + /// Lock + /// UnLock + /// VibrationModeAbled + /// SilentModeDisabled + /// BluetoothDeviceConnected + /// BluetoothDeviceDisconnected + /// ListReorder + /// ListSlider + /// VolumeKeyPressed + /// + /// + /// For controlling haptic device: + /// http://tizen.org/privilege/haptic + /// For controlling sound, previlege is not needed. + /// + /// + /// Feedback feedback = new Feedback(); + /// bool res = feedback.IsSupportedPattern(FeedbackType.Vibration, "Tap"); + /// + public class Feedback + { + private const string LogTag = "Tizen.System.Feedback"; + + private readonly FeedbackPattern[] Pattern = new FeedbackPattern[39]; + public Feedback() + { + Pattern[0].PatternNumber = 0; + Pattern[0].PatternString = "Tap"; + Pattern[1].PatternNumber = 1; + Pattern[1].PatternString = "SoftInputPanel"; + Pattern[2].PatternNumber = 6; + Pattern[2].PatternString = "Key0"; + Pattern[3].PatternNumber = 7; + Pattern[3].PatternString = "Key1"; + Pattern[4].PatternNumber = 8; + Pattern[4].PatternString = "Key2"; + Pattern[5].PatternNumber = 9; + Pattern[5].PatternString = "Key3"; + Pattern[6].PatternNumber = 10; + Pattern[6].PatternString = "Key4"; + Pattern[7].PatternNumber = 11; + Pattern[7].PatternString = "Key5"; + Pattern[8].PatternNumber = 12; + Pattern[8].PatternString = "Key6"; + Pattern[9].PatternNumber = 13; + Pattern[9].PatternString = "Key7"; + Pattern[10].PatternNumber = 14; + Pattern[10].PatternString = "Key8"; + Pattern[11].PatternNumber = 15; + Pattern[11].PatternString = "Key9"; + Pattern[12].PatternNumber = 16; + Pattern[12].PatternString = "KeyStar"; + Pattern[13].PatternNumber = 17; + Pattern[13].PatternString = "KeySharp"; + Pattern[14].PatternNumber = 18; + Pattern[14].PatternString = "KeyBack"; + Pattern[15].PatternNumber = 19; + Pattern[15].PatternString = "Hold"; + Pattern[16].PatternNumber = 21; + Pattern[16].PatternString = "HardwareKeyPressed"; + Pattern[17].PatternNumber = 22; + Pattern[17].PatternString = "HardwareKeyHold"; + Pattern[18].PatternNumber = 23; + Pattern[18].PatternString = "Message"; + Pattern[19].PatternNumber = 25; + Pattern[19].PatternString = "Email"; + Pattern[20].PatternNumber = 27; + Pattern[20].PatternString = "WakeUp"; + Pattern[21].PatternNumber = 29; + Pattern[21].PatternString = "Schedule"; + Pattern[22].PatternNumber = 31; + Pattern[22].PatternString = "Timer"; + Pattern[23].PatternNumber = 33; + Pattern[23].PatternString = "General"; + Pattern[24].PatternNumber = 36; + Pattern[24].PatternString = "PowerOn"; + Pattern[25].PatternNumber = 37; + Pattern[25].PatternString = "PowerOff"; + Pattern[26].PatternNumber = 38; + Pattern[26].PatternString = "ChargerConnected"; + Pattern[27].PatternNumber = 40; + Pattern[27].PatternString = "ChargingError"; + Pattern[28].PatternNumber = 42; + Pattern[28].PatternString = "FullyCharged"; + Pattern[29].PatternNumber = 44; + Pattern[29].PatternString = "LowBattery"; + Pattern[30].PatternNumber = 46; + Pattern[30].PatternString = "Lock"; + Pattern[31].PatternNumber = 47; + Pattern[31].PatternString = "UnLock"; + Pattern[32].PatternNumber = 55; + Pattern[32].PatternString = "VibrationModeAbled"; + Pattern[33].PatternNumber = 56; + Pattern[33].PatternString = "SilentModeDisabled"; + Pattern[34].PatternNumber = 57; + Pattern[34].PatternString = "BluetoothDeviceConnected"; + Pattern[35].PatternNumber = 58; + Pattern[35].PatternString = "BluetoothDeviceDisconnected"; + Pattern[36].PatternNumber = 62; + Pattern[36].PatternString = "ListReorder"; + Pattern[37].PatternNumber = 63; + Pattern[37].PatternString = "ListSlider"; + Pattern[38].PatternNumber = 64; + Pattern[38].PatternString = "VolumeKeyPressed"; + + Interop.Feedback.FeedbackError res = (Interop.Feedback.FeedbackError)Interop.Feedback.Initialize(); + if (res != Interop.Feedback.FeedbackError.None) + { + Log.Warn(LogTag, string.Format("Failed to initialize feedback. err = {0}", res)); + switch (res) + { + case Interop.Feedback.FeedbackError.NotSupported: + throw new NotSupportedException("Device is not supported"); + default: + throw new InvalidOperationException("Failed to initialize"); + } + } + } + + ~Feedback() + { + Interop.Feedback.FeedbackError res = (Interop.Feedback.FeedbackError)Interop.Feedback.Deinitialize(); + if (res != Interop.Feedback.FeedbackError.None) + { + Log.Warn(LogTag, string.Format("Failed to deinitialize feedback. err = {0}", res)); + switch (res) + { + case Interop.Feedback.FeedbackError.NotInitialized: + throw new Exception("Not initialized"); + default: + throw new InvalidOperationException("Failed to initialize"); + } + } + } + + /// + /// Get supported information about specific type and pattern + /// + /// + /// Now, IsSupportedPattern is not working for FeedbackType.All. + /// This API is working for FeedbackType.Sound and FeedbackType.Vibration only. + /// If you use FeedbackType.All for type parameter, this API will throw ArgumentException. + /// To get supported information for Vibration type, app should have http://tizen.org/privilege/haptic privilege. + /// + /// 3 + /// Feedback type + /// Feedback pattern string + /// Information whether pattern is supported + /// Thrown when failed because feedback is not initialized + /// Thrown when failed because of a invalid arguament + /// Thrown when failed becuase device(haptic, sound) is not supported + /// Thrown when failed because access is not granted(No privilege) + /// Thrown when failed because of system error + /// http://tizen.org/privilege/haptic + /// + /// + /// Feedback feedback = new Feedback(); + /// bool res = feedback.IsSupportedPattern(FeedbackType.Vibration, "Tap"); + /// + /// + public bool IsSupportedPattern(FeedbackType type, String pattern) + { + bool supported = false; + bool found = false; + int i = 0; + Interop.Feedback.FeedbackError res; + + for (i = 0; i < Constants.NumberOfPattern; i++) + { + if (String.Compare(pattern, Pattern[i].PatternString) == 0) + { + found = true; + break; + } + } + + if (!found) + throw new ArgumentException("Invalid Arguments"); + + res = (Interop.Feedback.FeedbackError)Interop.Feedback.IsSupportedPattern((Interop.Feedback.FeedbackType)type, Pattern[i].PatternNumber, out supported); + + + if (res != Interop.Feedback.FeedbackError.None) + { + Log.Warn(LogTag, string.Format("Failed to get supported information. err = {0}", res)); + switch (res) + { + case Interop.Feedback.FeedbackError.NotInitialized: + throw new Exception("Not initialized"); + case Interop.Feedback.FeedbackError.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.Feedback.FeedbackError.NotSupported: + throw new NotSupportedException("Device is not supported"); + case Interop.Feedback.FeedbackError.PermissionDenied: + throw new UnauthorizedAccessException("Access is not granted"); + case Interop.Feedback.FeedbackError.OperationFailed: + default: + throw new InvalidOperationException("Failed to get supported information"); + } + } + return supported; + } + + /// + /// Play specific feedback pattern + /// + /// + /// To play Vibration type, app should have http://tizen.org/privilege/haptic privilege. + /// + /// 3 + /// Feedback type + /// Feedback pattern string + /// Thrown when failed because feedback is not initialized + /// Thrown when failed because of a invalid arguament + /// Thrown when failed because device(haptic, sound) or specific pattern is not supported + /// Thrown when failed because access is not granted(No privilege) + /// Thrown when failed because of system error + /// http://tizen.org/privilege/haptic + /// + /// + /// Feedback feedback = new Feedback(); + /// feedback.Play(FeedbackType.All, "Tap"); + /// + /// + public void Play(FeedbackType type, String pattern) + { + bool found = false; + int i = 0; + Interop.Feedback.FeedbackError res; + + for (i = 0; i < Constants.NumberOfPattern; i++) + { + if (String.Compare(pattern, Pattern[i].PatternString) == 0) + { + found = true; + break; + } + } + + if (!found) + throw new ArgumentException("Invalid Arguments"); + + if (type == FeedbackType.All) + res = (Interop.Feedback.FeedbackError)Interop.Feedback.Play(Pattern[i].PatternNumber); + else + res = (Interop.Feedback.FeedbackError)Interop.Feedback.PlayType((Interop.Feedback.FeedbackType)type, Pattern[i].PatternNumber); + + if (res != Interop.Feedback.FeedbackError.None) + { + Log.Warn(LogTag, string.Format("Failed to play feedback. err = {0}", res)); + switch (res) + { + case Interop.Feedback.FeedbackError.NotInitialized: + throw new Exception("Not initialized"); + case Interop.Feedback.FeedbackError.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.Feedback.FeedbackError.NotSupported: + throw new NotSupportedException("Not supported"); + case Interop.Feedback.FeedbackError.PermissionDenied: + throw new UnauthorizedAccessException("Access is not granted"); + case Interop.Feedback.FeedbackError.OperationFailed: + default: + throw new InvalidOperationException("Failed to play pattern"); + } + } + } + + /// + /// Stop to play feedback + /// + /// + /// To stop vibration, app should have http://tizen.org/privilege/haptic privilege. + /// + /// 3 + /// Thrown when failed because feedback is not initialized + /// Thrown when failed because of a invalid arguament + /// Thrown when failed because device(haptic, sound) or specific pattern is not supported + /// Thrown when failed because access is not granted(No privilege) + /// Thrown when failed because of system error + /// http://tizen.org/privilege/haptic + /// + /// + /// Feedback Feedback1 = new Feedback(); + /// Feedback1.Stop(); + /// + /// + public void Stop() + { + Interop.Feedback.FeedbackError res = (Interop.Feedback.FeedbackError)Interop.Feedback.Stop(); + + if (res != Interop.Feedback.FeedbackError.None) + { + Log.Warn(LogTag, string.Format("Failed to stop feedback. err = {0}", res)); + switch (res) + { + case Interop.Feedback.FeedbackError.NotInitialized: + throw new Exception("Not initialized"); + case Interop.Feedback.FeedbackError.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.Feedback.FeedbackError.NotSupported: + throw new NotSupportedException("Not supported"); + case Interop.Feedback.FeedbackError.PermissionDenied: + throw new UnauthorizedAccessException("Access is not granted"); + case Interop.Feedback.FeedbackError.OperationFailed: + default: + throw new InvalidOperationException("Failed to stop pattern"); + } + } + } + } +} diff --git a/src/Tizen.System.Feedback/Feedback/FeedbackPattern.cs b/src/Tizen.System.Feedback/Feedback/FeedbackPattern.cs new file mode 100644 index 0000000..2ebc82f --- /dev/null +++ b/src/Tizen.System.Feedback/Feedback/FeedbackPattern.cs @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.System +{ + /// + /// String and Enumeration for feedback patterns. + /// + internal struct FeedbackPattern + { + internal int PatternNumber; + internal string PatternString; + + internal FeedbackPattern(int n, string s) + { + PatternNumber = n; + PatternString = s; + } + } +} diff --git a/src/Tizen.System.Feedback/Feedback/FeedbackType.cs b/src/Tizen.System.Feedback/Feedback/FeedbackType.cs new file mode 100644 index 0000000..e387b1c --- /dev/null +++ b/src/Tizen.System.Feedback/Feedback/FeedbackType.cs @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.System +{ + /// + /// Enumeration for feedback device types. + /// + /// 3 + public enum FeedbackType + { + /// + /// Sound and Vibration + /// + /// 3 + All = 0, + /// + /// Sound feedback + /// + /// 3 + Sound = Interop.Feedback.FeedbackType.Sound, + /// + /// Vibration + /// /// + /// 3 + Vibration = Interop.Feedback.FeedbackType.Vibration, + } +} diff --git a/src/Tizen.System.Feedback/Interop/Interop.Feedback.cs b/src/Tizen.System.Feedback/Interop/Interop.Feedback.cs new file mode 100644 index 0000000..6b3e572 --- /dev/null +++ b/src/Tizen.System.Feedback/Interop/Interop.Feedback.cs @@ -0,0 +1,59 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Feedback + { + internal enum FeedbackError + { + None = Tizen.Internals.Errors.ErrorCode.None, + OperationFailed = Tizen.Internals.Errors.ErrorCode.NotPermitted, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + NotSupported = Tizen.Internals.Errors.ErrorCode.NoSuchDevice, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + NotInitialized = -0x00020000 | 0x12, + } + + // Any change here might require changes in Tizen.System.FeedbackType enum + internal enum FeedbackType + { + Sound = 1, + Vibration = 2, + } + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_initialize")] + internal static extern int Initialize(); + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_deinitialize")] + internal static extern int Deinitialize(); + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_play")] + internal static extern int Play(int pattern); + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_play_type")] + internal static extern int PlayType(FeedbackType type, int pattern); + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_stop")] + internal static extern int Stop(); + + [DllImport(Libraries.Feedback, EntryPoint = "feedback_is_supported_pattern")] + internal static extern int IsSupportedPattern(FeedbackType type, int pattern, out bool supported); + } +} diff --git a/src/Tizen.System.Feedback/Interop/Interop.Libraries.cs b/src/Tizen.System.Feedback/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..c84daae --- /dev/null +++ b/src/Tizen.System.Feedback/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +internal static partial class Interop +{ + internal static partial class Libraries + { + internal const string Feedback = "libfeedback.so.0"; + } +} diff --git a/src/Tizen.System.Feedback/Tizen.System.Feedback.csproj b/src/Tizen.System.Feedback/Tizen.System.Feedback.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.System.Feedback/Tizen.System.Feedback.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.System.Feedback/Tizen.System.Feedback.sln b/src/Tizen.System.Feedback/Tizen.System.Feedback.sln new file mode 100755 index 0000000..ebf5716 --- /dev/null +++ b/src/Tizen.System.Feedback/Tizen.System.Feedback.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Feedback", "Tizen.System.Feedback.csproj", "{07D88466-8BF2-4477-96C9-84C066C7AB81}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{82ED038B-DF94-4EF8-B4C2-03342C580A57}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{85B9CB65-3AEA-475D-A86D-DC4A9C1DF13E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {07D88466-8BF2-4477-96C9-84C066C7AB81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {07D88466-8BF2-4477-96C9-84C066C7AB81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {07D88466-8BF2-4477-96C9-84C066C7AB81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {07D88466-8BF2-4477-96C9-84C066C7AB81}.Release|Any CPU.Build.0 = Release|Any CPU + {82ED038B-DF94-4EF8-B4C2-03342C580A57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82ED038B-DF94-4EF8-B4C2-03342C580A57}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82ED038B-DF94-4EF8-B4C2-03342C580A57}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82ED038B-DF94-4EF8-B4C2-03342C580A57}.Release|Any CPU.Build.0 = Release|Any CPU + {85B9CB65-3AEA-475D-A86D-DC4A9C1DF13E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85B9CB65-3AEA-475D-A86D-DC4A9C1DF13E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85B9CB65-3AEA-475D-A86D-DC4A9C1DF13E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85B9CB65-3AEA-475D-A86D-DC4A9C1DF13E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.Information/.vs/Tizen.System.Information/v14/.suo b/src/Tizen.System.Information/.vs/Tizen.System.Information/v14/.suo new file mode 100644 index 0000000000000000000000000000000000000000..e542b8945427e4b511ac3cacf511397820003f0c GIT binary patch literal 3584 zcmca`Uhu)fjZzO8(10BSGsD0CoD6J8;*3Bx6O1pwz`z1zgT(&*|NkE(%nZap<|r6K zA@CRIR#5znf{_^lK@9moSi+#d;L4B(q>C6TL0Oq-AjZIolIMxh2rDm$QA>;(J>Ln13p#X~j$eqCI3k-r8l7SH7iZX^wh7^WWpo{bvf`M+yVJHRWh)f_W4=CaT zq!WSi&Oo{poL4{w*a2%qki9SfF_kb0synF#V0MFOQq6?v1?5RtT`*c7z(QsC)1bH> qjql+f&$xU@sLUo*p8PE>T(-MO%PrS;uSUgtmmoswN96}s2mk + /// The structure for CPU usage. + /// + public class CpuUsage + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal CpuUsage(Interop.RuntimeInfo.CpuUsage usage) + { + IoWait = usage.IoWait; + Nice = usage.IoWait; + System = usage.System; + User = usage.User; + } + /// + /// Running time of un-niced user processes (Percent). + /// + public double User { get; internal set; } + /// + /// Running time of kernel processes (Percent). + /// + public double System { get; internal set; } + /// + /// Running time of niced user processes (Percent). + /// + public double Nice { get; internal set; } + /// + /// Time waiting for I/O completion (Percent). + /// + public double IoWait { get; internal set; } + } + + /// + /// The structure for CPU usage per process. + /// + public class ProcessCpuUsage + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal ProcessCpuUsage(Interop.RuntimeInfo.ProcessCpuUsage usage) + { + UTime = usage.UTime; + STime = usage.STime; + } + /// + /// The amount of time this process has been scheduled in user mode (clock ticks). + /// + public uint UTime { get; internal set; } + /// + /// The amount of time this process has been scheduled in kernel mode (clock ticks). + /// + public uint STime { get; internal set; } + } +} diff --git a/src/Tizen.System.Information/RuntimeInfo/Enumerations.cs b/src/Tizen.System.Information/RuntimeInfo/Enumerations.cs new file mode 100755 index 0000000..8b2fcf0 --- /dev/null +++ b/src/Tizen.System.Information/RuntimeInfo/Enumerations.cs @@ -0,0 +1,143 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.System +{ + /// + /// Enumeration for the runtime information key. + /// + public enum RuntimeInformationKey + { + /// + /// Indicates whether Bluetooth is enabled. + /// + Bluetooth = 2, + /// + /// Indicates whether Wi-Fi hotspot is enabled. + /// + /// + WifiHotspot = 3, + /// + /// Indicates whether Bluetooth tethering is enabled. + /// + BluetoothTethering = 4, + /// + /// Indicates whether USB tethering is enabled. + /// + UsbTethering = 5, + /// + /// Indicates whether packet data through 3G network is enabled. + /// + PacketData = 9, + /// + /// Indicates whether data roaming is enabled. + /// + DataRoaming = 10, + /// + /// Indicates whether vibration is enabled. + /// + Vibration = 12, + /// + /// Indicates whether audio jack is connected. + /// + AudioJack = 17, + /// + /// Indicates the current status of GPS. + /// + /// + Gps = 18, + /// + /// Indicates whether the battery is currently charging. + /// + BatteryIsCharging = 19, + /// + /// Indicates whether TV out is connected. + /// + TvOut = 20, + /// + /// Indicates change in the audio jack connector type. + /// + /// + AudioJackConnector = 21, + /// + /// Indicates whether the charger is connected. + /// + Charger = 24, + /// + /// Indicates whether auto rotation is enabled. + /// + AutoRotation = 26 + } + + /// + /// Enumeration for the Wi-Fi status. + /// + public enum WifiStatus + { + /// + /// The Wi-Fi is disabled. + /// + Disabled, + /// + /// The Wi-Fi is enabled and the network connection is not established. + /// + Unconnected, + /// + /// The network connection is established in a Wi-Fi network. + /// + Connected + } + + /// + /// Enumeration for the GPS status. + /// + public enum GpsStatus + { + /// + /// The GPS is disabled. + /// + Disabled, + /// + /// The GPS is searching for satellites. + /// + Searching, + /// + /// The GPS connection is established. + /// + Connected + } + + /// + /// Enumeration for the type of audio jack connected. + /// + public enum AudioJackConnectionType + { + /// + /// The audio jack is not connected. + /// + Unconnected, + /// + /// The 3-conductor wire is connected. + /// + ThreeWireConnected, + /// + /// The 4-conductor wire is connected. + /// + FourWireConnected + } +} diff --git a/src/Tizen.System.Information/RuntimeInfo/MemoryInformation.cs b/src/Tizen.System.Information/RuntimeInfo/MemoryInformation.cs new file mode 100755 index 0000000..fa38d06 --- /dev/null +++ b/src/Tizen.System.Information/RuntimeInfo/MemoryInformation.cs @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.ComponentModel; + +namespace Tizen.System +{ + /// + /// Memory information. + /// + public class SystemMemoryInformation + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal SystemMemoryInformation(Interop.RuntimeInfo.MemoryInfo info) + { + Total = info.Total; + Used = info.Used; + Cache = info.Cache; + Free = info.Free; + Swap = info.Swap; + } + /// + /// Total memory (KiB). + /// + public int Total { get; internal set; } + /// + /// Used memory (KiB). + /// + public int Used { get; internal set; } + /// + /// Free memory (KiB). + /// + public int Free { get; internal set; } + /// + /// Cache memory (KiB). + /// + public int Cache { get; internal set; } + /// + /// Swap memory (KiB). + /// + public int Swap { get; internal set; } + } + + /// + /// Memory information per process. + /// + public class ProcessMemoryInformation + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal ProcessMemoryInformation(Interop.RuntimeInfo.ProcessMemoryInfo info) + { + PrivateClean = info.PrivateClean; + PrivateDirty = info.PrivateDirty; + Pss = info.Pss; + Rss = info.Rss; + SharedClean = info.SharedClean; + SharedDirty = info.SharedDirty; + Vsz = info.Vsz; + } + /// + /// Virtual memory size (KiB). + /// + public int Vsz { get; internal set; } + /// + /// Resident set size (KiB). + /// + public int Rss { get; internal set; } + /// + /// Proportional set size (KiB). + /// + public int Pss { get; internal set; } + /// + /// Not modified and mapped by other processes (KiB). + /// + public int SharedClean { get; internal set; } + /// + /// Modified and mapped by other processes (KiB). + /// + public int SharedDirty { get; internal set; } + /// + /// Not modified and available only to that process (KiB). + /// + public int PrivateClean { get; internal set; } + /// + /// Modified and available only to that process (KiB). + /// + public int PrivateDirty { get; internal set; } + } +} diff --git a/src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs b/src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs new file mode 100644 index 0000000..e9fee57 --- /dev/null +++ b/src/Tizen.System.Information/RuntimeInfo/RuntimeInfoErrorFactory.cs @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.IO; +using System.ComponentModel; +using Tizen.Internals.Errors; + +namespace Tizen.System +{ + [EditorBrowsable(EditorBrowsableState.Never)] + internal enum RuntimeInfoError + { + None = ErrorCode.None, + InvalidParameter = ErrorCode.InvalidParameter, + OutOfMemory = ErrorCode.OutOfMemory, + Io = ErrorCode.IoError, + RemoteIo = ErrorCode.RemoteIo, + PermissionDenied = ErrorCode.PermissionDenied, + NotSupported = ErrorCode.NotSupported, + NoData = ErrorCode.NoData + } + + [EditorBrowsable(EditorBrowsableState.Never)] + internal static class RuntimeInfoErrorFactory + { + internal const string LogTag = "Tizen.System.RuntimeInformation"; + + internal static void ThrowException(int err) + { + RuntimeInfoError error = (RuntimeInfoError)err; + if (error == RuntimeInfoError.InvalidParameter) + { + throw new ArgumentException("Invalid parameter"); + } + else if (error == RuntimeInfoError.OutOfMemory) + { + throw new OutOfMemoryException("Out of memory"); + } + else if (error == RuntimeInfoError.Io) + { + throw new IOException("I/O Error"); + } + else if (error == RuntimeInfoError.RemoteIo) + { + throw new IOException("Remote I/O Error"); + } + else if (error == RuntimeInfoError.PermissionDenied) + { + throw new UnauthorizedAccessException("Permission denied"); + } + else if (error == RuntimeInfoError.NotSupported) + { + throw new NotSupportedException("Not supported"); + } + else if (error == RuntimeInfoError.NoData) + { + throw new NotSupportedException("No data"); + } + } + } +} diff --git a/src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs b/src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs new file mode 100755 index 0000000..93c76c3 --- /dev/null +++ b/src/Tizen.System.Information/RuntimeInfo/RuntimeInformation.cs @@ -0,0 +1,891 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.ComponentModel; + +namespace Tizen.System +{ + /// + /// The RuntimeInformation provides functions to obtain the runtime information of various system preferences. + /// + public static class RuntimeInformation + { + private static event EventHandler s_bluetoothEnabled; + private static event EventHandler s_wifiHotspotEnabled; + private static event EventHandler s_bluetoothTetheringEnabled; + private static event EventHandler s_usbTetheringEnabled; + private static event EventHandler s_packetDataEnabled; + private static event EventHandler s_dataRoamingEnabled; + private static event EventHandler s_vibrationEnabled; + private static event EventHandler s_audioJackConnected; + private static event EventHandler s_gpsStatusChanged; + private static event EventHandler s_batteryIsCharging; + private static event EventHandler s_tvOutConnected; + private static event EventHandler s_audioJackConnectorChanged; + private static event EventHandler s_chargerConnected; + private static event EventHandler s_autoRotationEnabled; + + private static readonly Interop.RuntimeInfo.RuntimeInformationChangedCallback s_runtimeInfoChangedCallback = (RuntimeInformationKey key, IntPtr userData) => + { + RuntimeKeyStatusChangedEventArgs eventArgs = new RuntimeKeyStatusChangedEventArgs() + { + Key = key + }; + switch (key) + { + case RuntimeInformationKey.Bluetooth: + { + s_bluetoothEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.WifiHotspot: + { + s_wifiHotspotEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.BluetoothTethering: + { + s_bluetoothTetheringEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.UsbTethering: + { + s_usbTetheringEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.PacketData: + { + s_packetDataEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.DataRoaming: + { + s_dataRoamingEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.Vibration: + { + s_vibrationEnabled?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.AudioJack: + { + s_audioJackConnected?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.Gps: + { + s_gpsStatusChanged?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.BatteryIsCharging: + { + s_batteryIsCharging?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.TvOut: + { + s_tvOutConnected?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.AudioJackConnector: + { + s_audioJackConnectorChanged?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.Charger: + { + s_chargerConnected?.Invoke(null, eventArgs); + break; + }; + case RuntimeInformationKey.AutoRotation: + { + s_autoRotationEnabled?.Invoke(null, eventArgs); + break; + }; + default: + break; + }; + }; + + internal static readonly Dictionary s_keyDataTypeMapping = new Dictionary + { + [RuntimeInformationKey.Bluetooth] = typeof(bool), + [RuntimeInformationKey.WifiHotspot] = typeof(bool), + [RuntimeInformationKey.BluetoothTethering] = typeof(bool), + [RuntimeInformationKey.UsbTethering] = typeof(bool), + [RuntimeInformationKey.PacketData] = typeof(bool), + [RuntimeInformationKey.DataRoaming] = typeof(bool), + [RuntimeInformationKey.Vibration] = typeof(bool), + [RuntimeInformationKey.AudioJack] = typeof(bool), + [RuntimeInformationKey.BatteryIsCharging] = typeof(bool), + [RuntimeInformationKey.TvOut] = typeof(bool), + [RuntimeInformationKey.Charger] = typeof(bool), + [RuntimeInformationKey.AutoRotation] = typeof(bool), + [RuntimeInformationKey.Gps] = typeof(int), + [RuntimeInformationKey.AudioJackConnector] = typeof(int) + }; + + internal static readonly Dictionary s_keyTVkeyMapping = new Dictionary + { + [RuntimeInformationKey.Bluetooth] = 5, + [RuntimeInformationKey.WifiHotspot] = 6, + [RuntimeInformationKey.BluetoothTethering] = 7, + [RuntimeInformationKey.UsbTethering] = 8, + [RuntimeInformationKey.PacketData] = 13, + [RuntimeInformationKey.DataRoaming] = 14, + [RuntimeInformationKey.Vibration] = 16, + [RuntimeInformationKey.AudioJack] = 20, + [RuntimeInformationKey.BatteryIsCharging] = 22, + [RuntimeInformationKey.TvOut] = 18, + [RuntimeInformationKey.Charger] = 26, + [RuntimeInformationKey.AutoRotation] = 28, + [RuntimeInformationKey.Gps] = 21, + [RuntimeInformationKey.AudioJackConnector] = 20 + }; + + internal static int is_TV_product = -1; + + [EditorBrowsable(EditorBrowsableState.Never)] + /// This function is for a TV product. It will be removed. + internal static RuntimeInformationKey ConvertKeyIfTvProduct(RuntimeInformationKey key) + { + bool is_key_existed = false; + string profile; + int key_TV = -1; + + if (is_TV_product == -1) + { + is_key_existed = SystemInfo.TryGetValue("http://com.samsung/build_config/product_type", out profile); + if (is_key_existed && String.Compare(profile, "TV") == 0) + { + is_TV_product = 1; + } + else + { + is_TV_product = 0; + } + } + + if (is_TV_product == 0) + { + return key; + } + else + { + if (!s_keyTVkeyMapping.TryGetValue(key, out key_TV)) + { + RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter); + } + return (RuntimeInformationKey)key_TV; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + internal static object GetStatus(RuntimeInformationKey key) + { + Type value; + if (!s_keyDataTypeMapping.TryGetValue(key, out value)) + { + RuntimeInfoErrorFactory.ThrowException((int)RuntimeInfoError.InvalidParameter); + } + + if (s_keyDataTypeMapping[key] == typeof(int)) + { + int status; + int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString()); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + return status; + } + else + { + bool status; + int ret = Interop.RuntimeInfo.GetValue(ConvertKeyIfTvProduct(key), out status); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get value for key {0}", key.ToString()); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + return status; + } + } + + /// + /// Validates the data type of the status represented by the runtime key. + /// Note that this is a generic method. + /// + /// 3 + /// The generic type to validate. + /// The runtime information key for which the status type is validated. + /// True if the data type matches. + /// Thrown when the is invalid. + public static bool Is(RuntimeInformationKey key) + { + if (!s_keyDataTypeMapping.ContainsKey(key)) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Invalid data type"); + throw new ArgumentException("Invalid parameter"); + } + + return s_keyDataTypeMapping[key] == typeof(T); + } + + /// + /// Gets the status of runtime key. + /// Note that this is a generic method. + /// + /// 3 + /// The generic type to return. + /// The runtime information key for which the current should be read. + /// The current status of the given key.. + /// Thrown when the is invalid. + /// Thrown when I/O error occurs while reading from the system. + /// Thrown when the feature related is not supported. + public static T GetStatus(RuntimeInformationKey key) + { + return (T)GetStatus(key); + } + + /// + /// Gets the system memory information. + /// + /// 3 + /// The system memory information structure. + /// Thrown when I/O error occurs while reading from the system. + public static SystemMemoryInformation GetSystemMemoryInformation() + { + Interop.RuntimeInfo.MemoryInfo info = new Interop.RuntimeInfo.MemoryInfo(); + int ret = Interop.RuntimeInfo.GetSystemMemoryInfo(out info); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get System memory information"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + return new SystemMemoryInformation(info); + } + + /// + /// Gets the memory information per process. + /// + /// 3 + /// List of unique process ids. + /// List of memory information per process. + /// http://tizen.org/privilege/systemmonitor + /// Thrown when the is empty. + /// Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon. + /// Thrown when the memory is not enough to allocate. + /// Thrown when the caller does not have privilege to use this method. + public static IDictionary GetProcessMemoryInformation(IEnumerable pid) + { + int[] processArray = pid.ToArray(); + Interop.RuntimeInfo.ProcessMemoryInfo[] processMemoryArray = new Interop.RuntimeInfo.ProcessMemoryInfo[pid.Count()]; + Dictionary map = new Dictionary(); + int ret = Interop.RuntimeInfo.GetProcessMemoryInfo(processArray, pid.Count(), out processMemoryArray); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process memory information"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + int idx = 0; + foreach (Interop.RuntimeInfo.ProcessMemoryInfo cur in processMemoryArray) + { + ProcessMemoryInformation processMemory = new ProcessMemoryInformation(cur); + map.Add(processArray[idx], processMemory); + idx++; + } + + return map; + } + + /// + /// Gets the system CPU usage time. + /// + /// 3 + /// The system CPU usage time structure. + /// Thrown when an I/O error occurs while reading from the system. + public static CpuUsage GetCpuUsage() + { + Interop.RuntimeInfo.CpuUsage usage = new Interop.RuntimeInfo.CpuUsage(); + int ret = Interop.RuntimeInfo.GetCpuUsage(out usage); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get cpu usage"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + return new CpuUsage(usage); + } + + /// + /// Gets the CPU usage time per process. + /// + /// 3 + /// List of unique process ids. + /// List of CPU usage information per process. + /// http://tizen.org/privilege/systemmonitor + /// Thrown when the is empty. + /// Thrown when an I/O error occurs while reading from the system or requesting to the resource management daemon. + /// Thrown when the memory is not enough to allocate. + /// Thrown when the caller does not have privilege to use this method. + public static IDictionary GetProcessCpuUsage(IEnumerable pid) + { + int[] processArray = pid.ToArray(); + Interop.RuntimeInfo.ProcessCpuUsage[] processCpuUsageArray = new Interop.RuntimeInfo.ProcessCpuUsage[pid.Count()]; + Dictionary map = new Dictionary(); + int ret = Interop.RuntimeInfo.GetProcessCpuUsage(processArray, pid.Count(), out processCpuUsageArray); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Process cpu usage"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + int idx = 0; + foreach (Interop.RuntimeInfo.ProcessCpuUsage cur in processCpuUsageArray) + { + ProcessCpuUsage processUsage = new ProcessCpuUsage(cur); + map.Add(processArray[idx], processUsage); + idx++; + } + + return map; + } + + /// + /// Gets the number of processors. + /// + /// The number of processors. + /// Thrown when an I/O error occurs while reading from system. + public static int ProcessorCount + { + get + { + int count; + int ret = Interop.RuntimeInfo.GetProcessorCount(out count); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor count"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + + return count; + } + } + + /// + /// Gets the current frequency of the processor. + /// + /// 3 + /// The index (from 0) of the CPU core that you want to know the frequency of. + /// The current frequency(MHz) of processor. + /// Thrown when the is invalid. + /// Thrown when an I/O error occurs while reading from system. + /// Thrown when this system does not store the current CPU frequency. + public static int GetProcessorCurrentFrequency(int coreId) + { + int frequency; + int ret = Interop.RuntimeInfo.GetProcessorCurrentFrequency(coreId, out frequency); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor current frequency"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + return frequency; + } + + /// + /// Gets the max frequency of the processor. + /// + /// 3 + /// The index (from 0) of CPU core that you want to know the frequency of. + /// The max frequency(MHz) of processor. + /// Thrown when the is invalid. + /// Thrown when an I/O error occurs while reading from system. + /// Thrown when this system does not store the max CPU frequency. + public static int GetProcessorMaxFrequency(int coreId) + { + int frequency; + int ret = Interop.RuntimeInfo.GetProcessorMaxFrequency(coreId, out frequency); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to get Processor max frequency"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + return frequency; + } + + /// + /// (event) BluetoothEnabled is raised when the system preference for Bluetooth is changed. + /// + public static event EventHandler BluetoothEnabled + { + add + { + if (s_bluetoothEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_bluetoothEnabled += value; + } + remove + { + s_bluetoothEnabled -= value; + if (s_bluetoothEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Bluetooth)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) WifiHotspotEnabled is raised when the system preference for Wi-Fi is changed. + /// + public static event EventHandler WifiHotspotEnabled + { + add + { + if (s_wifiHotspotEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_wifiHotspotEnabled += value; + } + remove + { + s_wifiHotspotEnabled -= value; + if (s_wifiHotspotEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.WifiHotspot)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) BluetoothTetheringEnabled is raised when the system preference for bluetooth tethering is changed. + /// + public static event EventHandler BluetoothTetheringEnabled + { + add + { + if (s_bluetoothTetheringEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_bluetoothTetheringEnabled += value; + } + remove + { + s_bluetoothTetheringEnabled -= value; + if (s_bluetoothTetheringEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BluetoothTethering)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) UsbTetheringEnabled is raised when the system preference for USB tethering is changed. + /// + public static event EventHandler UsbTetheringEnabled + { + add + { + if (s_usbTetheringEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_usbTetheringEnabled += value; + } + remove + { + s_usbTetheringEnabled -= value; + if (s_usbTetheringEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.UsbTethering)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) PacketDataEnabled is raised when the system preference for package data through 3G network is changed. + /// + public static event EventHandler PacketDataEnabled + { + add + { + if (s_packetDataEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_packetDataEnabled += value; + } + remove + { + s_packetDataEnabled -= value; + if (s_packetDataEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.PacketData)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) DataRoamingEnabled is raised when the system preference for data roaming is changed. + /// + public static event EventHandler DataRoamingEnabled + { + add + { + if (s_dataRoamingEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_dataRoamingEnabled += value; + } + remove + { + s_dataRoamingEnabled -= value; + if (s_dataRoamingEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.DataRoaming)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) VibrationEnabled is raised when the system preference for vibration is changed. + /// + public static event EventHandler VibrationEnabled + { + add + { + if (s_vibrationEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_vibrationEnabled += value; + } + remove + { + s_vibrationEnabled -= value; + if (s_vibrationEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Vibration)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) AudioJackConnected is raised when the audio jack is connected/disconnected. + /// + public static event EventHandler AudioJackConnected + { + add + { + if (s_audioJackConnected == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_audioJackConnected += value; + } + remove + { + s_audioJackConnected -= value; + if (s_audioJackConnected == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJack)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) GpsStatusChanged is raised when the status of GPS is changed. + /// + public static event EventHandler GpsStatusChanged + { + add + { + if (s_gpsStatusChanged == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_gpsStatusChanged += value; + } + remove + { + s_gpsStatusChanged -= value; + if (s_gpsStatusChanged == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Gps)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) BatteryIsCharging is raised when the battery is currently charging. + /// + public static event EventHandler BatteryIsCharging + { + add + { + if (s_batteryIsCharging == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_batteryIsCharging += value; + } + remove + { + s_batteryIsCharging -= value; + if (s_batteryIsCharging == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.BatteryIsCharging)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) TvOutConnected is raised when TV out is connected/disconnected. + /// + public static event EventHandler TvOutConnected + { + add + { + if (s_tvOutConnected == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_tvOutConnected += value; + } + remove + { + s_tvOutConnected -= value; + if (s_tvOutConnected == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.TvOut)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) AudioJackConnectorChanged is raised when the audio jack connection changes. + /// + public static event EventHandler AudioJackConnectorChanged + { + add + { + if (s_audioJackConnectorChanged == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_audioJackConnectorChanged += value; + } + remove + { + s_audioJackConnectorChanged -= value; + if (s_audioJackConnectorChanged == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AudioJackConnector)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) ChargerConnected is raised when the charger is connected/disconnected. + /// + public static event EventHandler ChargerConnected + { + add + { + if (s_chargerConnected == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_chargerConnected += value; + } + remove + { + s_chargerConnected -= value; + if (s_chargerConnected == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.Charger)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + /// + /// (event) AutoRotationEnabled is raised when the system preference for auto rotation is changed. + /// + public static event EventHandler AutoRotationEnabled + { + add + { + if (s_autoRotationEnabled == null) + { + int ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation), s_runtimeInfoChangedCallback, IntPtr.Zero); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + s_autoRotationEnabled += value; + } + remove + { + s_autoRotationEnabled -= value; + if (s_autoRotationEnabled == null) + { + int ret = Interop.RuntimeInfo.UnsetRuntimeInfoChangedCallback(ConvertKeyIfTvProduct(RuntimeInformationKey.AutoRotation)); + if (ret != (int)RuntimeInfoError.None) + { + Log.Error(RuntimeInfoErrorFactory.LogTag, "Interop failed to add event handler"); + RuntimeInfoErrorFactory.ThrowException(ret); + } + } + } + } + } +} diff --git a/src/Tizen.System.Information/RuntimeInfo/RuntimeKeyStatusChangedEventArgs.cs b/src/Tizen.System.Information/RuntimeInfo/RuntimeKeyStatusChangedEventArgs.cs new file mode 100755 index 0000000..c145c93 --- /dev/null +++ b/src/Tizen.System.Information/RuntimeInfo/RuntimeKeyStatusChangedEventArgs.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.System +{ + /// + /// RuntimeInfoChangedEventArgs is an extended EventArgs class. This class contains event arguments for runtime event listeners. + /// + public class RuntimeKeyStatusChangedEventArgs : EventArgs + { + /// + /// The key indicating the runtime system preference which was changed. + /// + public RuntimeInformationKey Key { get; internal set; } + } +} diff --git a/src/Tizen.System.Information/SystemInfo/SystemInfo.cs b/src/Tizen.System.Information/SystemInfo/SystemInfo.cs new file mode 100755 index 0000000..b551c1b --- /dev/null +++ b/src/Tizen.System.Information/SystemInfo/SystemInfo.cs @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.ComponentModel; + +namespace Tizen.System +{ + /// + /// System Information class. This class has methods which can be used to obtain device information. + /// + public static class SystemInfo + { + private const string LogTag = "Tizen.System"; + + [EditorBrowsable(EditorBrowsableState.Never)] + private static Interop.SystemInfo.SystemInfoType GetValueType(string key, out Interop.SystemInfo.SystemInfoValueType valueType) + { + Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.SystemInfoGetPlatformType(key, out valueType); + if (err == Interop.SystemInfo.ErrorCode.None) + { + return Interop.SystemInfo.SystemInfoType.platform; + } + + Log.Debug(LogTag, string.Format("Key {0} not in platform system info", key)); + err = Interop.SystemInfo.SystemInfoGetCustomType(key, out valueType); + if (err == Interop.SystemInfo.ErrorCode.None) + { + return Interop.SystemInfo.SystemInfoType.Custom; + } + + Log.Debug(LogTag, string.Format("Key {0} not in custom system info", key)); + return Interop.SystemInfo.SystemInfoType.None; + } + + /// + /// Checks if the type of value for the given feature is T. + /// + /// 3 + /// Type of value for the feature key. + /// The name of the feature. + /// True if type of value for the given feature is T, otherwise false. + public static bool Is(string key) + { + Interop.SystemInfo.SystemInfoValueType valueType; + Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType); + if (keyType == Interop.SystemInfo.SystemInfoType.None) + { + return false; + } + + switch (valueType) + { + case Interop.SystemInfo.SystemInfoValueType.Bool: + return typeof(T) == typeof(bool); + case Interop.SystemInfo.SystemInfoValueType.Double: + return typeof(T) == typeof(double); + case Interop.SystemInfo.SystemInfoValueType.Int: + return typeof(T) == typeof(int); + case Interop.SystemInfo.SystemInfoValueType.String: + return typeof(T) == typeof(string); + } + return false; + } + + /// + /// Checks if the given key is a valid feature. + /// + /// 3 + /// The name of the feature. + /// True if the key is valid, otherwise false. + public static bool IsValidKey(string key) + { + Interop.SystemInfo.SystemInfoValueType valueType; + return GetValueType(key, out valueType) != Interop.SystemInfo.SystemInfoType.None; + } + + /// + /// Gets the value of the feature. + /// + /// 3 + /// Type of key value. + /// The name of the feature. + /// The value of the given feature. + /// Returns true on success, otherwise false. + public static bool TryGetValue(string key, out T value) + { + bool res = false; + if (typeof(T) == typeof(bool)) + { + bool val; + res = TryGetValue(key, out val); + value = (T)(object)val; + } + else if (typeof(T) == typeof(int)) + { + int val; + res = TryGetValue(key, out val); + value = (T)(object)val; + } + else if (typeof(T) == typeof(double)) + { + double val; + res = TryGetValue(key, out val); + value = (T)(object)val; + } + else if (typeof(T) == typeof(string)) + { + string val; + res = TryGetValue(key, out val); + value = (T)(object)val; + } + else + { + value = default(T); + } + return res; + } + + /// + /// Gets the bool value of the feature. + /// + /// 3 + /// The name of the feature. + /// The value of the given feature. + /// Returns true on success, otherwise false. + public static bool TryGetValue(string key, out bool value) + { + Interop.SystemInfo.SystemInfoValueType valueType; + Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType); + + Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter; + if (keyType == Interop.SystemInfo.SystemInfoType.platform) + { + err = Interop.SystemInfo.SystemInfoGetPlatformBool(key, out value); + } + else if (keyType == Interop.SystemInfo.SystemInfoType.Custom) + { + err = Interop.SystemInfo.SystemInfoGetCustomBool(key, out value); + } else + { + value = false; + } + + if (err != Interop.SystemInfo.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err)); + return false; + } + + return true; + } + + /// + /// Gets the int value of the feature. + /// + /// 3 + /// The name of the feature. + /// The value of the given feature. + /// Returns true on success, otherwise false. + public static bool TryGetValue(string key, out int value) + { + Interop.SystemInfo.SystemInfoValueType valueType; + Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType); + + Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter; + if (keyType == Interop.SystemInfo.SystemInfoType.platform) + { + err = Interop.SystemInfo.SystemInfoGetPlatformInt(key, out value); + } + else if (keyType == Interop.SystemInfo.SystemInfoType.Custom) + { + err = Interop.SystemInfo.SystemInfoGetCustomInt(key, out value); + } + else + { + value = 0; + } + + if (err != Interop.SystemInfo.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err)); + return false; + } + + return true; + } + + /// + /// Gets the double value of the feature. + /// + /// 3 + /// The name of the feature. + /// The value of the given feature. + /// Returns true on success, otherwise false. + public static bool TryGetValue(string key, out double value) + { + Interop.SystemInfo.SystemInfoValueType valueType; + Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType); + + Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter; + if (keyType == Interop.SystemInfo.SystemInfoType.platform) + { + err = Interop.SystemInfo.SystemInfoGetPlatformDouble(key, out value); + } + else if (keyType == Interop.SystemInfo.SystemInfoType.Custom) + { + err = Interop.SystemInfo.SystemInfoGetCustomDouble(key, out value); + } + else + { + value = 0; + } + + if (err != Interop.SystemInfo.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err)); + return false; + } + + return true; + } + + /// + /// Gets the string value of the feature. + /// + /// 3 + /// The name of the feature. + /// The value of the given feature. + /// Returns true on success, otherwise false. + public static bool TryGetValue(string key, out string value) + { + Interop.SystemInfo.SystemInfoValueType valueType; + Interop.SystemInfo.SystemInfoType keyType = GetValueType(key, out valueType); + + Interop.SystemInfo.ErrorCode err = Interop.SystemInfo.ErrorCode.InvalidParameter; + if (keyType == Interop.SystemInfo.SystemInfoType.platform) + { + err = Interop.SystemInfo.SystemInfoGetPlatformString(key, out value); + } + else if (keyType == Interop.SystemInfo.SystemInfoType.Custom) + { + err = Interop.SystemInfo.SystemInfoGetCustomString(key, out value); + } + else + { + value = string.Empty; + } + + if (err != Interop.SystemInfo.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get value for key: {0}. err = {1}", key, err)); + return false; + } + + return true; + } + } +} diff --git a/src/Tizen.System.Information/Tizen.System.Information.csproj b/src/Tizen.System.Information/Tizen.System.Information.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.System.Information/Tizen.System.Information.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.System.Information/Tizen.System.Information.sln b/src/Tizen.System.Information/Tizen.System.Information.sln new file mode 100755 index 0000000..edea34d --- /dev/null +++ b/src/Tizen.System.Information/Tizen.System.Information.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "Tizen.System.Information.csproj", "{6FFC2F92-C7D9-4D58-8A3A-8C239803350A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{FABBAE4F-EA7A-424F-8497-DBB3A2F9F229}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E334BCA3-BF7F-4981-A814-299ADF54D37C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6FFC2F92-C7D9-4D58-8A3A-8C239803350A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FFC2F92-C7D9-4D58-8A3A-8C239803350A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FFC2F92-C7D9-4D58-8A3A-8C239803350A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FFC2F92-C7D9-4D58-8A3A-8C239803350A}.Release|Any CPU.Build.0 = Release|Any CPU + {FABBAE4F-EA7A-424F-8497-DBB3A2F9F229}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FABBAE4F-EA7A-424F-8497-DBB3A2F9F229}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FABBAE4F-EA7A-424F-8497-DBB3A2F9F229}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FABBAE4F-EA7A-424F-8497-DBB3A2F9F229}.Release|Any CPU.Build.0 = Release|Any CPU + {E334BCA3-BF7F-4981-A814-299ADF54D37C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E334BCA3-BF7F-4981-A814-299ADF54D37C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E334BCA3-BF7F-4981-A814-299ADF54D37C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E334BCA3-BF7F-4981-A814-299ADF54D37C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.MediaKey/Interop/Interop.Libraries.cs b/src/Tizen.System.MediaKey/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..9902c9f --- /dev/null +++ b/src/Tizen.System.MediaKey/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string MediaKey = "libcapi-system-media-key.so.0"; + } +} diff --git a/src/Tizen.System.MediaKey/Interop/Interop.MediaKey.cs b/src/Tizen.System.MediaKey/Interop/Interop.MediaKey.cs new file mode 100755 index 0000000..d18aa9d --- /dev/null +++ b/src/Tizen.System.MediaKey/Interop/Interop.MediaKey.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class MediaKey + { + internal enum KeyValue + { + Play, + Stop, + Pause, + Previous, + Next, + FastForward, + Rewind, + PlayPause, + Media, + Unknown + } + + internal enum KeyStatus + { + Pressed, + Released, + Unknown + } + + internal enum ErrorCode : int + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OperationFailed = -0x02420000 | 0x01 + } + + internal delegate void EventCallback(KeyValue value, KeyStatus status, IntPtr userData); + + [DllImport(Libraries.MediaKey, EntryPoint = "media_key_reserve")] + internal static extern ErrorCode Reserve(EventCallback callback, IntPtr userData); + + [DllImport(Libraries.MediaKey, EntryPoint = "media_key_release")] + internal static extern ErrorCode Release(); + } +} diff --git a/src/Tizen.System.MediaKey/Tizen.System.MediaKey.csproj b/src/Tizen.System.MediaKey/Tizen.System.MediaKey.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.System.MediaKey/Tizen.System.MediaKey.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.System.MediaKey/Tizen.System.MediaKey.sln b/src/Tizen.System.MediaKey/Tizen.System.MediaKey.sln new file mode 100755 index 0000000..0a5e2cb --- /dev/null +++ b/src/Tizen.System.MediaKey/Tizen.System.MediaKey.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.MediaKey", "Tizen.System.MediaKey.csproj", "{9856F9DA-1E0B-4CE2-91A9-F68F7366901C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{86463940-1D9C-416E-9928-6B85B4BF3A5F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{2AD70B7D-131C-42D5-9C5D-63C1DD47E93F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9856F9DA-1E0B-4CE2-91A9-F68F7366901C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9856F9DA-1E0B-4CE2-91A9-F68F7366901C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9856F9DA-1E0B-4CE2-91A9-F68F7366901C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9856F9DA-1E0B-4CE2-91A9-F68F7366901C}.Release|Any CPU.Build.0 = Release|Any CPU + {86463940-1D9C-416E-9928-6B85B4BF3A5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86463940-1D9C-416E-9928-6B85B4BF3A5F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86463940-1D9C-416E-9928-6B85B4BF3A5F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86463940-1D9C-416E-9928-6B85B4BF3A5F}.Release|Any CPU.Build.0 = Release|Any CPU + {2AD70B7D-131C-42D5-9C5D-63C1DD47E93F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2AD70B7D-131C-42D5-9C5D-63C1DD47E93F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2AD70B7D-131C-42D5-9C5D-63C1DD47E93F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2AD70B7D-131C-42D5-9C5D-63C1DD47E93F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.MediaKey/Tizen.System/MediaKey.cs b/src/Tizen.System.MediaKey/Tizen.System/MediaKey.cs new file mode 100755 index 0000000..abe96b7 --- /dev/null +++ b/src/Tizen.System.MediaKey/Tizen.System/MediaKey.cs @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.System +{ + /// + /// Class for event arguments of the media key. + /// + public class MediaKeyEventArgs : EventArgs + { + /// + /// Enumeration for Key value. + /// + /// 3 + public enum KeyValue + { + /// + /// Play key. + /// + Play, + + /// + /// Stop key. + /// + Stop, + + /// + /// Pause key. + /// + Pause, + + /// + /// Previous key. + /// + Previous, + + /// + /// Next key. + /// + Next, + + /// + /// Fast forward key. + /// + FastForward, + + /// + /// Rewind key. + /// + Rewind, + + /// + /// Play-pause key. + /// + PlayPause, + + /// + /// Media key for earjack. + /// + Media, + + /// + /// Unknown key. + /// + Unknown + } + + /// + /// Enumeration for Key status. + /// + /// 3 + public enum KeyStatus + { + /// + /// Pressed status. + /// + Pressed, + + /// + /// Released status. + /// + Released, + + /// + /// Unknown status. + /// + Unknown + } + + /// + /// Key value. + /// + /// 3 + public KeyValue Value { get; internal set; } + + /// + /// Key status. + /// + /// 3 + public KeyStatus Status { get; internal set; } + } + + /// + /// Class for receiving events of media keys. + /// + public static class MediaKey + { + private static EventHandler s_eventHandler; + private static Interop.MediaKey.EventCallback s_callback; + + private static void OnEvent(Interop.MediaKey.KeyValue value, Interop.MediaKey.KeyStatus status, IntPtr userData) + { + s_eventHandler?.Invoke(null, new MediaKeyEventArgs() + { + Value = (MediaKeyEventArgs.KeyValue)value, + Status = (MediaKeyEventArgs.KeyStatus)status + }); + } + + /// + /// Adds or removes events for all media keys. + /// + /// 3 + /// Failed to reserve or release key. + public static event EventHandler Event + { + add + { + if (s_eventHandler == null) + { + if (s_callback == null) + s_callback = new Interop.MediaKey.EventCallback(OnEvent); + Interop.MediaKey.ErrorCode err = Interop.MediaKey.Reserve(s_callback, IntPtr.Zero); + + if (err != Interop.MediaKey.ErrorCode.None) + { + throw new InvalidOperationException("Failed to reserve key. err = " + err); + } + + } + s_eventHandler += value; + + } + remove + { + s_eventHandler -= value; + if (s_eventHandler == null) + { + Interop.MediaKey.ErrorCode err = Interop.MediaKey.Release(); + + if (err != Interop.MediaKey.ErrorCode.None) + { + throw new InvalidOperationException("Failed to release key. err = " + err); + } + s_callback = null; + } + } + } + } +} + diff --git a/src/Tizen.System.PlatformConfig/Interop/Interop.PlatformConfig.cs b/src/Tizen.System.PlatformConfig/Interop/Interop.PlatformConfig.cs new file mode 100755 index 0000000..bdcdf7b --- /dev/null +++ b/src/Tizen.System.PlatformConfig/Interop/Interop.PlatformConfig.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using System; + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string PlatformConfig = "libtzplatform-config-2.0.so.2"; + } + + internal static partial class PlatformConfig + { + [DllImport(Libraries.PlatformConfig, EntryPoint = "tzplatform_getenv", CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr _GetEnv(int id); + + [DllImport(Libraries.PlatformConfig, EntryPoint = "tzplatform_getid", CallingConvention = CallingConvention.Cdecl)] + internal static extern int GetId(string name); + + internal static string GetEnv(int id) + { + var text = _GetEnv(id); + return Marshal.PtrToStringAnsi(text); + } + } +} diff --git a/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.csproj b/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.sln b/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.sln new file mode 100755 index 0000000..16b928d --- /dev/null +++ b/src/Tizen.System.PlatformConfig/Tizen.System.PlatformConfig.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.PlatformConfig", "Tizen.System.PlatformConfig.csproj", "{E2CDAE3B-9A1E-4BCA-9420-6E23225CA661}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{5DF94605-55E3-432D-A830-FF1920796A75}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B2F4BFB5-B446-418C-A4F4-351B660BEB14}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E2CDAE3B-9A1E-4BCA-9420-6E23225CA661}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2CDAE3B-9A1E-4BCA-9420-6E23225CA661}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2CDAE3B-9A1E-4BCA-9420-6E23225CA661}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2CDAE3B-9A1E-4BCA-9420-6E23225CA661}.Release|Any CPU.Build.0 = Release|Any CPU + {5DF94605-55E3-432D-A830-FF1920796A75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5DF94605-55E3-432D-A830-FF1920796A75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5DF94605-55E3-432D-A830-FF1920796A75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5DF94605-55E3-432D-A830-FF1920796A75}.Release|Any CPU.Build.0 = Release|Any CPU + {B2F4BFB5-B446-418C-A4F4-351B660BEB14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2F4BFB5-B446-418C-A4F4-351B660BEB14}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2F4BFB5-B446-418C-A4F4-351B660BEB14}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2F4BFB5-B446-418C-A4F4-351B660BEB14}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.PlatformConfig/Tizen.System/PlatformConfig.cs b/src/Tizen.System.PlatformConfig/Tizen.System/PlatformConfig.cs new file mode 100755 index 0000000..093f3b2 --- /dev/null +++ b/src/Tizen.System.PlatformConfig/Tizen.System/PlatformConfig.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.IO; +using System.Runtime.CompilerServices; +using System.ComponentModel; + +namespace Tizen.System +{ + [EditorBrowsable(EditorBrowsableState.Never)] + public class PlatformConfig + { + private static int GetId(string name) + { + return Interop.PlatformConfig.GetId(name); + } + + public static string GetEnv(string name) + { + return Interop.PlatformConfig.GetEnv(Interop.PlatformConfig.GetId(name)); + } + } +} diff --git a/src/Tizen.System.Storage/Interop/Interop.Libraries.cs b/src/Tizen.System.Storage/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..0180f70 --- /dev/null +++ b/src/Tizen.System.Storage/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +internal static partial class Interop +{ + internal static partial class Libraries + { + internal const string Storage = "libstorage.so.0.1"; + } +} diff --git a/src/Tizen.System.Storage/Interop/Interop.Storage.cs b/src/Tizen.System.Storage/Interop/Interop.Storage.cs new file mode 100644 index 0000000..5f04e08 --- /dev/null +++ b/src/Tizen.System.Storage/Interop/Interop.Storage.cs @@ -0,0 +1,96 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Storage + { + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + NotSupported = Tizen.Internals.Errors.ErrorCode.NoSuchDevice, + OperationFailed = -0x00020000 | 0x12, + } + + // Any change here might require changes in Tizen.System.StorageArea enum + internal enum StorageArea + { + Internal = 0, + External = 1, + } + + // Any change here might require changes in Tizen.System.StorageState enum + internal enum StorageState + { + Unmountable = -2, + Removed = -1, + Mounted = 0, + MountedReadOnly = 1, + } + + // Any change here might require changes in Tizen.System.directoryType enum + internal enum DirectoryType + { + Images = 0, + Sounds = 1, + Videos = 2, + Camera = 3, + Downloads = 4, + Music = 5, + Documents = 6, + Others = 7, + Ringtones = 8, + } + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void StorageStateChangedCallback(int id, StorageState state, IntPtr userData); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_root_directory")] + internal static extern ErrorCode StorageGetRootDirectory(int id, out string path); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_directory")] + internal static extern ErrorCode StorageGetAbsoluteDirectory(int id, DirectoryType type, out string path); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_state")] + internal static extern ErrorCode StorageGetState(int id, out StorageState state); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_type")] + internal static extern ErrorCode StorageGetType(int id, out StorageArea type); + + [DllImport(Libraries.Storage, EntryPoint = "storage_set_state_changed_cb")] + internal static extern ErrorCode StorageSetStateChanged(int id, StorageStateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Storage, EntryPoint = "storage_unset_state_changed_cb")] + internal static extern ErrorCode StorageUnsetStateChanged(int id, StorageStateChangedCallback callback); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_total_space")] + internal static extern ErrorCode StorageGetTotalSpace(int id, out ulong bytes); + + [DllImport(Libraries.Storage, EntryPoint = "storage_get_available_space")] + internal static extern ErrorCode StorageGetAvailableSpace(int id, out ulong bytes); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate bool StorageDeviceSupportedCallback(int storageID, StorageArea type, StorageState state, string rootDirectory, IntPtr userData); + + [DllImport(Libraries.Storage, EntryPoint = "storage_foreach_device_supported")] + public static extern ErrorCode StorageManagerGetForeachDeviceSupported(StorageDeviceSupportedCallback callback, IntPtr userData); + } +} diff --git a/src/Tizen.System.Storage/Storage/DirectoryType.cs b/src/Tizen.System.Storage/Storage/DirectoryType.cs new file mode 100644 index 0000000..e3b996f --- /dev/null +++ b/src/Tizen.System.Storage/Storage/DirectoryType.cs @@ -0,0 +1,71 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.System +{ + /// + /// Enumeration for the DirectoryType storage. + /// + /// 3 + public enum DirectoryType + { + /// + /// Image directory. + /// + /// 3 + Images = Interop.Storage.DirectoryType.Images, + /// + /// Sounds directory. + /// + /// 3 + Sounds = Interop.Storage.DirectoryType.Sounds, + /// + /// Videos directory. + /// + /// 3 + Videos = Interop.Storage.DirectoryType.Videos, + /// + /// Camera directory. + /// + /// 3 + Camera = Interop.Storage.DirectoryType.Camera, + /// + /// Downloads directory. + /// + /// 3 + Downloads = Interop.Storage.DirectoryType.Downloads, + /// + /// Music directory. + /// + /// 3 + Music = Interop.Storage.DirectoryType.Music, + /// + /// Documents directory. + /// + /// 3 + Documents = Interop.Storage.DirectoryType.Documents, + /// + /// Others directory. + /// + /// 3 + Others = Interop.Storage.DirectoryType.Others, + /// + /// System ringtones directory is only available for an internal storage. + /// + /// 3 + Ringtones = Interop.Storage.DirectoryType.Ringtones, + } +} diff --git a/src/Tizen.System.Storage/Storage/Storage.cs b/src/Tizen.System.Storage/Storage/Storage.cs new file mode 100644 index 0000000..adc6359 --- /dev/null +++ b/src/Tizen.System.Storage/Storage/Storage.cs @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.System +{ + /// + /// The class to access the storage device information. + /// + public class Storage + { + private const string LogTag = "Tizen.System"; + private Interop.Storage.StorageState _state; + private ulong _totalSpace; + + internal Storage(int storageID, Interop.Storage.StorageArea storageType, Interop.Storage.StorageState storagestate, string rootDirectory) + { + Id = storageID; + StorageType = (StorageArea)storageType; + RootDirectory = rootDirectory; + _state = storagestate; + + Interop.Storage.ErrorCode err = Interop.Storage.StorageGetTotalSpace(Id, out _totalSpace); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get total storage space for storage Id: {0}. err = {1}", Id, err)); + } + + s_stateChangedEventCallback = (id, state, userData) => + { + if (id == Id) + { + _state = state; + s_stateChangedEventHandler?.Invoke(this, EventArgs.Empty); + } + }; + } + + private EventHandler s_stateChangedEventHandler; + private Interop.Storage.StorageStateChangedCallback s_stateChangedEventCallback; + + private void RegisterStateChangedEvent() + { + Interop.Storage.ErrorCode err = Interop.Storage.StorageSetStateChanged(Id, s_stateChangedEventCallback, IntPtr.Zero); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to Register state changed event callback for storage Id: {0}. err = {1}", Id, err)); + } + } + + private void UnregisterStateChangedEvent() + { + Interop.Storage.ErrorCode err = Interop.Storage.StorageUnsetStateChanged(Id, s_stateChangedEventCallback); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to Register state changed event callback for storage Id: {0}. err = {1}", Id, err)); + } + } + + /// + /// StorageStateChanged event. This event is occurred when a storage state changes. + /// + /// + /// The storage state will be updated before calling the event handler. + /// + /// 3 + /// + /// + /// myStorage.StorageStateChanged += (s, e) => + /// { + /// var storage = s as Storage; + /// Console.WriteLine(string.Format("State Changed to {0}", storage.State)); + /// } + /// + /// + public event EventHandler StorageStateChanged + { + add + { + if (s_stateChangedEventHandler == null) + { + _state = (Interop.Storage.StorageState)State; + RegisterStateChangedEvent(); + } + s_stateChangedEventHandler += value; + } + remove + { + if (s_stateChangedEventHandler != null) + { + s_stateChangedEventHandler -= value; + if (s_stateChangedEventHandler == null) + { + UnregisterStateChangedEvent(); + } + } + } + } + + /// + /// The storage ID. + /// + /// 3 + public int Id { get; } + /// + /// The type of storage. + /// + /// 3 + public StorageArea StorageType { get; } + /// + /// The root directory for the storage. + /// + /// 3 + public string RootDirectory { get; } + /// + /// The total storage size in bytes. + /// + /// 3 + public ulong TotalSpace { get { return _totalSpace; } } + + /// + /// The StorageState. + /// + /// 3 + public StorageState State + { + get + { + if (s_stateChangedEventHandler == null) + { + Interop.Storage.ErrorCode err = Interop.Storage.StorageGetState(Id, out _state); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get storage state for storage Id: {0}. err = {1}", Id, err)); + } + } + return (StorageState)_state; + } + } + + /// + /// The available storage size in bytes. + /// + /// 3 + public ulong AvaliableSpace + { + get + { + ulong available; + Interop.Storage.ErrorCode err = Interop.Storage.StorageGetAvailableSpace(Id, out available); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get available storage stace for storage Id: {0}. err = {1}", Id, err)); + } + + return available; + } + } + + /// + /// Absolute path for a given directory type in the storage. + /// + /// + /// The returned directory path may not exist, so you must make sure that it exists before using it. + /// For accessing internal storage except the ringtones directory, the application should have http://tizen.org/privilege/mediastorage privilege. + /// For accessing ringtones directory, the application should have http://tizen.org/privilege/systemsettings privilege. + /// For accessing external storage, the application should have http://tizen.org/privilege/externalstorage privilege. + /// + /// 3 + /// Directory type. + /// Absolute path for a given directory type in the storage. + /// Thrown when failed because of an invalid argument. + /// Thrown when failed due to out of memory exception. + /// Thrown when failed if the storage is not supported or the application does not have the permission to access the directory path. + /// http://tizen.org/privilege/mediastorage + /// http://tizen.org/privilege/systemsettings + /// http://tizen.org/privilege/externalstorage + /// + /// + /// // To get the video directories for all the supported storage, + /// var storageList = StorageManager.Storages as List<Storage>; + /// foreach (var storage in storageList) + /// { + /// string pathForVideoDir = storage.GetAbsolutePath(DirectoryType.Videos); + /// } + /// + /// + public string GetAbsolutePath(DirectoryType dirType) + { + string path; + Interop.Storage.ErrorCode err = Interop.Storage.StorageGetAbsoluteDirectory(Id, (Interop.Storage.DirectoryType)dirType, out path); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get package Id. err = {0}", err)); + switch (err) + { + case Interop.Storage.ErrorCode.InvalidParameter: + throw new ArgumentException("Invalid Arguments"); + case Interop.Storage.ErrorCode.OutOfMemory: + throw new OutOfMemoryException("Out of Memory"); + case Interop.Storage.ErrorCode.NotSupported: + throw new NotSupportedException("Operation Not Supported"); + default: + throw new InvalidOperationException("Error = " + err); + } + } + return path; + } + } +} diff --git a/src/Tizen.System.Storage/Storage/StorageArea.cs b/src/Tizen.System.Storage/Storage/StorageArea.cs new file mode 100644 index 0000000..2d9a26b --- /dev/null +++ b/src/Tizen.System.Storage/Storage/StorageArea.cs @@ -0,0 +1,36 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.System +{ + /// + /// Enumeration for the storage area types. + /// + /// 3 + public enum StorageArea + { + /// + /// Internal device storage (built-in storage in a device, non-removable). + /// + /// 3 + Internal = Interop.Storage.StorageArea.Internal, + /// + /// External storage. + /// + /// 3 + External = Interop.Storage.StorageArea.External, + } +} diff --git a/src/Tizen.System.Storage/Storage/StorageManager.cs b/src/Tizen.System.Storage/Storage/StorageManager.cs new file mode 100644 index 0000000..0335b2e --- /dev/null +++ b/src/Tizen.System.Storage/Storage/StorageManager.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; + +namespace Tizen.System +{ + /// + /// The StorageManager provides the properties or methods to access storage in the device. + /// + public static class StorageManager + { + private const string LogTag = "Tizen.System"; + + /// + /// List of all storage in the device. + /// + /// 3 + public static IEnumerable Storages + { + get + { + List storageList = new List(); + Interop.Storage.StorageDeviceSupportedCallback cb = (int storageID, Interop.Storage.StorageArea type, Interop.Storage.StorageState state, string rootDirectory, IntPtr userData) => + { + storageList.Add(new Storage(storageID, type, state, rootDirectory)); + return true; + }; + + Interop.Storage.ErrorCode err = Interop.Storage.StorageManagerGetForeachDeviceSupported(cb, IntPtr.Zero); + if (err != Interop.Storage.ErrorCode.None) + { + Log.Warn(LogTag, string.Format("Failed to get storage list. err = {0}", err)); + } + return storageList; + } + } + } +} diff --git a/src/Tizen.System.Storage/Storage/StorageState.cs b/src/Tizen.System.Storage/Storage/StorageState.cs new file mode 100644 index 0000000..fc60550 --- /dev/null +++ b/src/Tizen.System.Storage/Storage/StorageState.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.System +{ + /// + /// Enumeration for the state of storage devices. + /// + /// 3 + public enum StorageState + { + /// + /// The storage is present but cannot be mounted. Typically, it happens if the file system of the storage is corrupted. + /// + /// 3 + Unmountable = Interop.Storage.StorageState.Unmountable, + /// + /// The storage is not present or removed. + /// + /// 3 + Removed = Interop.Storage.StorageState.Removed, + /// + /// The storage is mounted with read/write access. + /// + /// 3 + Mounted = Interop.Storage.StorageState.Mounted, + /// + /// The storage is mounted with read-only access. + /// + /// 3 + MountedReadOnly = Interop.Storage.StorageState.MountedReadOnly, + } +} diff --git a/src/Tizen.System.Storage/Tizen.System.Storage.csproj b/src/Tizen.System.Storage/Tizen.System.Storage.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.System.Storage/Tizen.System.Storage.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.System.Storage/Tizen.System.Storage.sln b/src/Tizen.System.Storage/Tizen.System.Storage.sln new file mode 100755 index 0000000..ba236b6 --- /dev/null +++ b/src/Tizen.System.Storage/Tizen.System.Storage.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Storage", "Tizen.System.Storage.csproj", "{D12EC4B0-E131-4B3A-8195-1E4B29F06323}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{B8571691-4533-4CD5-8FD9-8F0F7E100923}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{4FD8A49E-BE20-4138-81F4-732A281197E5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D12EC4B0-E131-4B3A-8195-1E4B29F06323}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D12EC4B0-E131-4B3A-8195-1E4B29F06323}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D12EC4B0-E131-4B3A-8195-1E4B29F06323}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D12EC4B0-E131-4B3A-8195-1E4B29F06323}.Release|Any CPU.Build.0 = Release|Any CPU + {B8571691-4533-4CD5-8FD9-8F0F7E100923}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B8571691-4533-4CD5-8FD9-8F0F7E100923}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B8571691-4533-4CD5-8FD9-8F0F7E100923}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B8571691-4533-4CD5-8FD9-8F0F7E100923}.Release|Any CPU.Build.0 = Release|Any CPU + {4FD8A49E-BE20-4138-81F4-732A281197E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FD8A49E-BE20-4138-81F4-732A281197E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FD8A49E-BE20-4138-81F4-732A281197E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FD8A49E-BE20-4138-81F4-732A281197E5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.SystemSettings/Interop/Interop.SystemSettings.cs b/src/Tizen.System.SystemSettings/Interop/Interop.SystemSettings.cs new file mode 100644 index 0000000..3925cd5 --- /dev/null +++ b/src/Tizen.System.SystemSettings/Interop/Interop.SystemSettings.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.System; + +internal static partial class Interop +{ + internal static partial class Settings + { + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_set_value_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsSetValueInt(SystemSettingsKeys key, int value); + + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_set_value_bool", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsSetValueBool(SystemSettingsKeys key, bool value); + + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_set_value_string", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsSetValueString(SystemSettingsKeys key, string value); + + + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_get_value_int", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsGetValueInt(SystemSettingsKeys key, out int value); + + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_get_value_bool", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsGetValueBool(SystemSettingsKeys key, out bool value); + + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_get_value_string", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsGetValueString(SystemSettingsKeys key, out string value); + + // Callback + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void SystemSettingsChangedCallback(SystemSettingsKeys key, IntPtr data); + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_set_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsSetCallback(SystemSettingsKeys systemSettingsKey, SystemSettingsChangedCallback cb, IntPtr data); + [DllImport("capi-system-system-settings.so.0", EntryPoint = "system_settings_unset_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern int SystemSettingsRemoveCallback(SystemSettingsKeys systemSettingsKey); + } +} diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.csproj b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.csproj new file mode 100644 index 0000000..5ed2f1f --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.sln b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.sln new file mode 100755 index 0000000..bd62df9 --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.SystemSettings", "Tizen.System.SystemSettings.csproj", "{608ECBF5-4D2F-4B89-9EB1-B435017A46EC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{6A20C62F-B0B8-4C28-8477-E1608654DD8F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{91413DDA-947D-40CA-B757-7CC7A651E257}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {608ECBF5-4D2F-4B89-9EB1-B435017A46EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {608ECBF5-4D2F-4B89-9EB1-B435017A46EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {608ECBF5-4D2F-4B89-9EB1-B435017A46EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {608ECBF5-4D2F-4B89-9EB1-B435017A46EC}.Release|Any CPU.Build.0 = Release|Any CPU + {6A20C62F-B0B8-4C28-8477-E1608654DD8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6A20C62F-B0B8-4C28-8477-E1608654DD8F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6A20C62F-B0B8-4C28-8477-E1608654DD8F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6A20C62F-B0B8-4C28-8477-E1608654DD8F}.Release|Any CPU.Build.0 = Release|Any CPU + {91413DDA-947D-40CA-B757-7CC7A651E257}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91413DDA-947D-40CA-B757-7CC7A651E257}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91413DDA-947D-40CA-B757-7CC7A651E257}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91413DDA-947D-40CA-B757-7CC7A651E257}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs new file mode 100755 index 0000000..1b4398f --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettings.cs @@ -0,0 +1,1929 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.System +{ + /// + /// The System Settings API provides APIs for sharing configuration over a system + /// + /// + /// System Settings API provides functions for getting the system configuration related to user preferences. + /// The main features of the System Settings API include accessing system-wide configurations, such as ringtones, wallpapers, and etc + /// + public static class SystemSettings + { + /// + /// The file path of the current ringtone + /// + public static string IncomingCallRingtone + { + get + { + string filePath; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.IncomingCallRingtone, out filePath); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get IncomingCallRingtone system setting."); + } + return filePath; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.IncomingCallRingtone, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set IncomingCallRingtone system setting."); + } + } + } + + /// + /// The file path of the current home screen wallpaper + /// + public static string WallpaperHomeScreen + { + get + { + string filePath; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperHomeScreen, out filePath); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperHomeScreen system setting."); + } + return filePath; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperHomeScreen, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperHomeScreen system setting."); + } + } + } + + /// + /// The file path of the current lock screen wallpaper + /// + public static string WallpaperLockScreen + { + get + { + string filePath; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.WallpaperLockScreen, out filePath); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get WallpaperLockScreen system setting."); + } + return filePath; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.WallpaperLockScreen, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set WallpaperLockScreen system setting."); + } + } + } + + /// + /// The current system font size + /// + public static SystemSettingsFontSize FontSize + { + get + { + int fontSize; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.FontSize, out fontSize); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontSize system setting."); + } + return (SystemSettingsFontSize)fontSize; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.FontSize, (int)value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontSize system setting."); + } + } + } + + /// + /// The current system font type + /// + public static string FontType + { + get + { + string fontType; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.FontType, out fontType); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get FontType system setting."); + } + return fontType; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.FontType, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set FontType system setting."); + } + } + } + + /// + /// Indicates whether the motion service is activated + /// + public static bool MotionActivationEnabled + { + get + { + bool isMotionServiceActivated; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionActivationEnabled, out isMotionServiceActivated); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionActivation system setting."); + } + return isMotionServiceActivated; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.MotionActivationEnabled, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set MotionActivation system setting."); + } + } + } + + /// + /// The file path of the current email alert ringtone + /// + public static string EmailAlertRingtone + { + get + { + string filePath; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.EmailAlertRingtone, out filePath); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get EmailAlertRingtone system setting."); + } + return filePath; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.EmailAlertRingtone, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set EmailAlertRingtone system setting."); + } + } + } + /// + /// Indicates whether the USB debugging is enabled + /// + public static bool UsbDebuggingEnabled + { + get + { + bool isusbDebuggingEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, out isusbDebuggingEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UsbDebuggingEnabled system setting."); + } + return isusbDebuggingEnabled; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.UsbDebuggingEnabled, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set UsbDebuggingEnabled system setting."); + } + } + } + + /// + /// Indicates whether the 3G data network is enabled + /// + public static bool Data3GNetworkEnabled + { + get + { + bool is3GDataEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, out is3GDataEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Data3GNetworkEnabled system setting."); + } + return is3GDataEnabled; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.Data3GNetworkEnabled, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set Data3GNetworkEnabled system setting."); + } + } + } + + /// + /// Indicates lockscreen app pkg name + /// + public static string LockscreenApp + { + get + { + string pkgName; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LockscreenApp, out pkgName); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockscreenApp system setting."); + } + return pkgName; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LockscreenApp, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockscreenApp system setting."); + } + } + } + + /// + /// The current system default font type (only support Get) + /// + public static string DefaultFontType + { + get + { + string defaultFontType; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DefaultFontType, out defaultFontType); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DefaultFontType system setting value."); + } + return defaultFontType; + } + } + + /// + /// Indicates the current country setting in the <LANGUAGE>_<REGION> syntax. + /// The country setting is in the ISO 639-2 format, + /// and the region setting is in the ISO 3166-1 alpha-2 format + /// + public static string LocaleCountry + { + get + { + string countrySetting; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleCountry, out countrySetting); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleCountry system setting."); + } + return countrySetting; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleCountry, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleCountry system setting."); + } + } + } + + /// + /// Indicates the current language setting in the <LANGUAGE>_<REGION> syntax. + /// The language setting is in the ISO 639-2 format + /// and the region setting is in the ISO 3166-1 alpha-2 format. + /// + public static string LocaleLanguage + { + get + { + string languageSetting; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleLanguage, out languageSetting); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleLanguage system setting."); + } + return languageSetting; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleLanguage, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleLanguage system setting."); + } + } + } + + /// + /// Indicates whether the 24-hour clock is used. + /// If the value is false, the 12-hour clock is used. + /// + public static bool LocaleTimeFormat24HourEnabled + { + get + { + bool is24HrFormat; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, out is24HrFormat); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeFormat24Hour system setting."); + } + return is24HrFormat; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueBool(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeFormat24Hour system setting."); + } + } + } + + /// + /// Indicates the current time zone. Eg. "Pacific/Tahiti" + /// + public static string LocaleTimeZone + { + get + { + string timeZone; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.LocaleTimeZone, out timeZone); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LocaleTimeZone system setting."); + } + return timeZone; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.LocaleTimeZone, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LocaleTimeZone system setting."); + } + } + } + + /// + /// Once System changes time, this event occurs to notify time change. + /// + public static int Time + { + get + { + int time; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.Time, out time); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get Time system setting."); + } + return time; + } + } + /// + /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound + /// + public static bool SoundLockEnabled + { + get + { + bool isSoundLockEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundLockEnabled, out isSoundLockEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundLock system setting."); + } + return isSoundLockEnabled; + } + } + + /// + /// Indicates whether the device is in the silent mode. + /// + public static bool SoundSilentModeEnabled + { + get + { + bool isSilent; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundSilentModeEnabled, out isSilent); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundSilentMode system setting."); + } + return isSilent; + } + } + + /// + /// Indicates whether the screen touch sound is enabled on the device. + /// + public static bool SoundTouchEnabled + { + get + { + bool isTouchSoundEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.SoundTouchEnabled, out isTouchSoundEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundTouch system setting value."); + } + return isTouchSoundEnabled; + } + } + + /// + /// Indicates whether rotation control is automatic. + /// + public static bool DisplayScreenRotationAutoEnabled + { + get + { + bool isRotationAutomatic; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, out isRotationAutomatic); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DisplayScreenRotationAuto system setting."); + } + return isRotationAutomatic; + } + } + + /// + /// Indicates device name. + /// + public static string DeviceName + { + get + { + string deviceName; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.DeviceName, out deviceName); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get DeviceName system setting value."); + } + return deviceName; + } + } + /// + /// Indicates whether the device user has enabled motion feature. + /// + public static bool MotionEnabled + { + get + { + bool isMotionEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.MotionEnabled, out isMotionEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get MotionEnabled system setting value."); + } + return isMotionEnabled; + } + } + + /// + /// Indicates whether Wi-Fi-related notifications are enabled on the device. + /// + public static bool NetworkWifiNotificationEnabled + { + get + { + bool isWifiNotificationEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkWifiNotificationEnabled, out isWifiNotificationEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkWifiNotification system setting."); + } + return isWifiNotificationEnabled; + } + } + + /// + /// Indicates whether the device is in the flight mode. + /// + public static bool NetworkFlightModeEnabled + { + get + { + bool isFlightModeEnabled; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueBool(SystemSettingsKeys.NetworkFlightModeEnabled, out isFlightModeEnabled); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get NetworkFlightMode system setting."); + } + return isFlightModeEnabled; + } + } + + /// + /// Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600. + /// + public static int ScreenBacklightTime + { + get + { + int backlightTime; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.ScreenBacklightTime, out backlightTime); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get ScreenBacklightTime system setting."); + } + return backlightTime; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.ScreenBacklightTime, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set ScreenBacklightTime system setting."); + } + } + } + + /// + /// Indicates the file path of the current notification tone set by the user. + /// + public static string SoundNotification + { + get + { + string filePath; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.SoundNotification, out filePath); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotification system setting."); + } + return filePath; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.SoundNotification, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotification system setting."); + } + } + } + + /// + /// Indicates the time period for notification repetitions. + /// + public static int SoundNotificationRepetitionPeriod + { + get + { + int notificationRepetitionPeriod; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, out notificationRepetitionPeriod); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get SoundNotificationRepetitionPeriod system setting."); + } + return notificationRepetitionPeriod; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.SoundNotificationRepetitionPeriod, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set SoundNotificationRepetitionPeriod system setting."); + } + } + } + + /// + /// Indicates the current lock state + /// + public static SystemSettingsIdleLockState LockState + { + get + { + int LockState; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.LockState, out LockState); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get LockState system setting."); + } + return (SystemSettingsIdleLockState)LockState; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueInt(SystemSettingsKeys.LockState, (int)value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set LockState system setting."); + } + } + } + + /// + /// The current system ADS ID + /// + public static string AdsId + { + get + { + string adsId; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueString(SystemSettingsKeys.AdsId, out adsId); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get AdsId system setting."); + } + return adsId; + } + set + { + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsSetValueString(SystemSettingsKeys.AdsId, value); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to set AdsId system setting."); + } + } + } + + + /// + /// Indicates the time period for notification repetitions. + /// + public static SystemSettingsUdsState UltraDataSave + { + get + { + int UltraDataSave; + SystemSettingsError res = (SystemSettingsError)Interop.Settings.SystemSettingsGetValueInt(SystemSettingsKeys.UltraDataSave, out UltraDataSave); + if (res != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(res, "unable to get UltraDataSave system setting."); + } + return (SystemSettingsUdsState)UltraDataSave; + } + } + + + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_incomingCallRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string path = SystemSettings.IncomingCallRingtone; + IncomingCallRingtoneChangedEventArgs eventArgs = new IncomingCallRingtoneChangedEventArgs(path); + s_incomingCallRingtoneChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_incomingCallRingtoneChanged; + /// + /// IncomingCallRingtoneChanged event is triggered when the file path of the incoming ringtone is changed + /// + /// + /// A IncomingCallRingtoneChangedEventArgs object that contains the key & changed value + public static event EventHandler IncomingCallRingtoneChanged + { + add + { + if (s_incomingCallRingtoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.IncomingCallRingtone, s_incomingCallRingtoneChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_incomingCallRingtoneChanged += value; + } + + remove + { + s_incomingCallRingtoneChanged -= value; + if (s_incomingCallRingtoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.IncomingCallRingtone); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperHomeScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string path = SystemSettings.WallpaperHomeScreen; + WallpaperHomeScreenChangedEventArgs eventArgs = new WallpaperHomeScreenChangedEventArgs(path); + s_wallpaperHomeScreenChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_wallpaperHomeScreenChanged; + /// + /// WallpaperHomeScreenChanged event is triggered when the file path of the current home screen wallpaper is changed + /// + /// + /// A WallpaperHomeScreenChangedEventArgs object that contains the key & changed value + public static event EventHandler WallpaperHomeScreenChanged + { + add + { + if (s_wallpaperHomeScreenChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperHomeScreen, s_wallpaperHomeScreenChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_wallpaperHomeScreenChanged += value; + } + + remove + { + s_wallpaperHomeScreenChanged -= value; + if (s_wallpaperHomeScreenChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperHomeScreen); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_wallpaperLockScreenChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string path = SystemSettings.WallpaperLockScreen; + WallpaperLockScreenChangedEventArgs eventArgs = new WallpaperLockScreenChangedEventArgs(path); + s_wallpaperLockScreenChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_wallpaperLockScreenChanged; + /// + /// WallpaperLockScreenChanged event is triggered when the file path of the current lock screen wallpaper is changed + /// + /// + /// A WallpaperLockScreenChangedEventArgs object that contains the key & changed value + public static event EventHandler WallpaperLockScreenChanged + { + add + { + if (s_wallpaperLockScreenChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.WallpaperLockScreen, s_wallpaperLockScreenChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_wallpaperLockScreenChanged += value; + } + + remove + { + s_wallpaperLockScreenChanged -= value; + if (s_wallpaperLockScreenChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.WallpaperLockScreen); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontSizeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + SystemSettingsFontSize fontSize = SystemSettings.FontSize; + FontSizeChangedEventArgs eventArgs = new FontSizeChangedEventArgs(fontSize); + s_fontSizeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_fontSizeChanged; + /// + /// FontSizeChanged event is triggered when the current system font size is changed + /// + /// + /// A FontSizeChangedEventArgs object that contains the key & changed value + public static event EventHandler FontSizeChanged + { + add + { + if (s_fontSizeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontSize, s_fontSizeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_fontSizeChanged += value; + } + + remove + { + s_fontSizeChanged -= value; + if (s_fontSizeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontSize); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_fontTypeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string fontType = SystemSettings.FontType; + FontTypeChangedEventArgs eventArgs = new FontTypeChangedEventArgs(fontType); + s_fontTypeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_fontTypeChanged; + /// + /// FontTypeChanged event is triggered when the current system font type is changed + /// + /// + /// A FontTypeChangedEventArgs object that contains the key & changed value + public static event EventHandler FontTypeChanged + { + add + { + if (s_fontTypeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.FontType, s_fontTypeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_fontTypeChanged += value; + } + + remove + { + s_fontTypeChanged -= value; + if (s_fontTypeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.FontType); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionActivationChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool motionActivation = SystemSettings.MotionActivationEnabled; + MotionActivationSettingChangedEventArgs eventArgs = new MotionActivationSettingChangedEventArgs(motionActivation); + s_motionActivationChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_motionActivationChanged; + /// + /// MotionActivationChanged event is triggered when the motion service status is changed + /// + /// + /// A MotionActivationChangedEventArgs object that contains the key & changed value + public static event EventHandler MotionActivationSettingChanged + { + add + { + if (s_motionActivationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionActivationEnabled, s_motionActivationChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_motionActivationChanged += value; + } + + remove + { + s_motionActivationChanged -= value; + if (s_motionActivationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionActivationEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_emailAlertRingtoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string emailAlertRingtone = SystemSettings.EmailAlertRingtone; + EmailAlertRingtoneChangedEventArgs eventArgs = new EmailAlertRingtoneChangedEventArgs(emailAlertRingtone); + s_emailAlertRingtoneChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_emailAlertRingtoneChanged; + /// + /// EmailAlertRingtoneChanged event is triggered when the file path of the current email alert ringtone is changed + /// + /// + /// A EmailAlertRingtoneChangedEventArgs object that contains the key & changed value + public static event EventHandler EmailAlertRingtoneChanged + { + add + { + if (s_emailAlertRingtoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.EmailAlertRingtone, s_emailAlertRingtoneChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_emailAlertRingtoneChanged += value; + } + + remove + { + s_emailAlertRingtoneChanged -= value; + if (s_emailAlertRingtoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.EmailAlertRingtone); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_usbDebuggingSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool usbDebuggingEnabled = SystemSettings.UsbDebuggingEnabled; + UsbDebuggingSettingChangedEventArgs eventArgs = new UsbDebuggingSettingChangedEventArgs(usbDebuggingEnabled); + s_usbDebuggingSettingChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_usbDebuggingSettingChanged; + /// + /// UsbDebuggingSettingChangedEventArgs event is triggered when the USB debugging status is changed + /// + /// + /// A UsbDebuggingSettingChangedEventArgs object that contains the key & changed value + public static event EventHandler UsbDebuggingSettingChanged + { + add + { + if (s_usbDebuggingSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UsbDebuggingEnabled, s_usbDebuggingSettingChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_usbDebuggingSettingChanged += value; + } + + remove + { + s_usbDebuggingSettingChanged -= value; + if (s_usbDebuggingSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UsbDebuggingEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_data3GNetworkSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool data3GEnabled = SystemSettings.Data3GNetworkEnabled; + Data3GNetworkSettingChangedEventArgs eventArgs = new Data3GNetworkSettingChangedEventArgs(data3GEnabled); + s_data3GNetworkSettingChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_data3GNetworkSettingChanged; + /// + /// Data3GNetworkSettingChanged event is triggered when the 3G data network status is changed + /// + /// + /// A Data3GNetworkSettingChangedEventArgs object that contains the key & changed value + public static event EventHandler Data3GNetworkSettingChanged + { + add + { + if (s_data3GNetworkSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Data3GNetworkEnabled, s_data3GNetworkSettingChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_data3GNetworkSettingChanged += value; + } + + remove + { + s_data3GNetworkSettingChanged -= value; + if (s_data3GNetworkSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Data3GNetworkEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockscreenAppChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string lockScreenApp = SystemSettings.LockscreenApp; + LockscreenAppChangedEventArgs eventArgs = new LockscreenAppChangedEventArgs(lockScreenApp); + s_lockscreenAppChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_lockscreenAppChanged; + /// + /// LockscreenAppChanged event is triggered when the lockscreen app pkg name is changed + /// + /// + /// A LockscreenAppChangedEventArgs object that contains the key & changed value + public static event EventHandler LockscreenAppChanged + { + add + { + if (s_lockscreenAppChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockscreenApp, s_lockscreenAppChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_lockscreenAppChanged += value; + } + + remove + { + s_lockscreenAppChanged -= value; + if (s_lockscreenAppChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockscreenApp); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeCountryChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string localeCountry = SystemSettings.LocaleCountry; + LocaleCountryChangedEventArgs eventArgs = new LocaleCountryChangedEventArgs(localeCountry); + s_localeCountryChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_localeCountryChanged; + /// + /// LocaleCountryChanged event is triggered when the current country setting in the <LANGUAGE>_<REGION> syntax, is changed + /// + /// + /// A LocaleCountryChangedEventArgs object that contains the key & changed value + public static event EventHandler LocaleCountryChanged + { + add + { + if (s_localeCountryChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleCountry, s_localeCountryChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_localeCountryChanged += value; + } + + remove + { + s_localeCountryChanged -= value; + if (s_localeCountryChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleCountry); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeLanguageChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string localeLanguage = SystemSettings.LocaleLanguage; + LocaleLanguageChangedEventArgs eventArgs = new LocaleLanguageChangedEventArgs(localeLanguage); + s_localeLanguageChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_localeLanguageChanged; + /// + /// LocaleLanguageChanged event is triggered when the current language setting in the <LANGUAGE>_<REGION> syntax, is changed + /// + /// + /// A LocaleLanguageChangedEventArgs object that contains the key & changed value + public static event EventHandler LocaleLanguageChanged + { + add + { + if (s_localeLanguageChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleLanguage, s_localeLanguageChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_localeLanguageChanged += value; + } + + remove + { + s_localeLanguageChanged -= value; + if (s_localeLanguageChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleLanguage); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeFormat24HourChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool localeTimeFormat24Hour = SystemSettings.LocaleTimeFormat24HourEnabled; + LocaleTimeFormat24HourSettingChangedEventArgs eventArgs = new LocaleTimeFormat24HourSettingChangedEventArgs(localeTimeFormat24Hour); + s_localeTimeFormat24HourChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_localeTimeFormat24HourChanged; + /// + /// LocaleTimeFormat24HourChanged event is triggered when the time format is changed + /// + /// + /// A LocaleTimeFormat24HourChangedEventArgs object that contains the key & changed value + public static event EventHandler LocaleTimeFormat24HourSettingChanged + { + add + { + if (s_localeTimeFormat24HourChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled, s_localeTimeFormat24HourChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_localeTimeFormat24HourChanged += value; + } + + remove + { + s_localeTimeFormat24HourChanged -= value; + if (s_localeTimeFormat24HourChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeFormat24HourEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_localeTimeZoneChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string localeTimeZone = SystemSettings.LocaleTimeZone; + LocaleTimeZoneChangedEventArgs eventArgs = new LocaleTimeZoneChangedEventArgs(localeTimeZone); + s_localeTimeZoneChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_localeTimeZoneChanged; + /// + /// LocaleTimeZoneChanged event is triggered when the current time zone is changed + /// + /// + /// A LocaleTimeZoneChangedEventArgs object that contains the key & changed value + public static event EventHandler LocaleTimeZoneChanged + { + add + { + if (s_localeTimeZoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LocaleTimeZone, s_localeTimeZoneChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_localeTimeZoneChanged += value; + } + + remove + { + s_localeTimeZoneChanged -= value; + if (s_localeTimeZoneChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LocaleTimeZone); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_timeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + + int time = SystemSettings.Time; + TimeChangedEventArgs eventArgs = new TimeChangedEventArgs(time); + s_timeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_timeChanged; + /// + /// TimeChanged event is triggered when the system time is changed + /// + /// + /// A TimeChangedEventArgs object that contains the key & changed value + public static event EventHandler TimeChanged + { + add + { + if (s_timeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.Time, s_timeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_timeChanged += value; + } + + remove + { + s_timeChanged -= value; + if (s_timeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.Time); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundLockChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool soundLock = SystemSettings.SoundLockEnabled; + SoundLockSettingChangedEventArgs eventArgs = new SoundLockSettingChangedEventArgs(soundLock); + s_soundLockChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_soundLockChanged; + /// + /// SoundLockChanged event is triggered when the screen lock sound enabled status is changed + /// + /// + /// A SoundLockChangedEventArgs object that contains the key & changed value + public static event EventHandler SoundLockSettingChanged + { + add + { + if (s_soundLockChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundLockEnabled, s_soundLockChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_soundLockChanged += value; + } + + remove + { + s_soundLockChanged -= value; + if (s_soundLockChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundLockEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundSilentModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool soundSilentMode = SystemSettings.SoundSilentModeEnabled; + SoundSilentModeSettingChangedEventArgs eventArgs = new SoundSilentModeSettingChangedEventArgs(soundSilentMode); + s_soundSilentModeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_soundSilentModeChanged; + /// + /// SoundSilentModeChanged event is triggered when the silent mode status is changed + /// + /// + /// A SoundSilentModeChangedEventArgs object that contains the key & changed value + public static event EventHandler SoundSilentModeSettingChanged + { + add + { + if (s_soundSilentModeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundSilentModeEnabled, s_soundSilentModeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_soundSilentModeChanged += value; + } + + remove + { + s_soundSilentModeChanged -= value; + if (s_soundSilentModeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundSilentModeEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundTouchChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool soundTouch = SystemSettings.SoundTouchEnabled; + SoundTouchSettingChangedEventArgs eventArgs = new SoundTouchSettingChangedEventArgs(soundTouch); + s_soundTouchChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_soundTouchChanged; + /// + /// SoundTouchChanged event is triggered when the screen touch sound enabled status is changed + /// + /// + /// A SoundTouchChangedEventArgs object that contains the key & changed value + public static event EventHandler SoundTouchSettingChanged + { + add + { + if (s_soundTouchChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundTouchEnabled, s_soundTouchChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_soundTouchChanged += value; + } + + remove + { + s_soundTouchChanged -= value; + if (s_soundTouchChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundTouchEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_displayScreenRotationAutoChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool displayScreenRotationAuto = SystemSettings.DisplayScreenRotationAutoEnabled; + DisplayScreenRotationAutoSettingChangedEventArgs eventArgs = new DisplayScreenRotationAutoSettingChangedEventArgs(displayScreenRotationAuto); + s_displayScreenRotationAutoChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_displayScreenRotationAutoChanged; + /// + /// DisplayScreenRotationAutoChanged event is triggered when the automatic rotation control status is changed + /// + /// + /// A DisplayScreenRotationAutoChangedEventArgs object that contains the key & changed value + public static event EventHandler DisplayScreenRotationAutoSettingChanged + { + add + { + if (s_displayScreenRotationAutoChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled, s_displayScreenRotationAutoChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_displayScreenRotationAutoChanged += value; + } + + remove + { + s_displayScreenRotationAutoChanged -= value; + if (s_displayScreenRotationAutoChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DisplayScreenRotationAutoEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_deviceNameChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string deviceName = SystemSettings.DeviceName; + DeviceNameChangedEventArgs eventArgs = new DeviceNameChangedEventArgs(deviceName); + s_deviceNameChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_deviceNameChanged; + /// + /// DeviceNameChanged event is triggered when the device name is changed + /// + /// + /// A DeviceNameChangedEventArgs object that contains the key & changed value + public static event EventHandler DeviceNameChanged + { + add + { + if (s_deviceNameChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.DeviceName, s_deviceNameChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_deviceNameChanged += value; + } + + remove + { + s_deviceNameChanged -= value; + if (s_deviceNameChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.DeviceName); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_motionSettingChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool motionEnabled = SystemSettings.MotionEnabled; + MotionSettingChangedEventArgs eventArgs = new MotionSettingChangedEventArgs(motionEnabled); + s_motionSettingChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_motionSettingChanged; + /// + /// MotionSettingChanged event is triggered when the motion feature enabled status is changed + /// + /// + /// A MotionSettingChangedEventArgs object that contains the key & changed value + public static event EventHandler MotionSettingChanged + { + add + { + if (s_motionSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.MotionEnabled, s_motionSettingChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_motionSettingChanged += value; + } + + remove + { + s_motionSettingChanged -= value; + if (s_motionSettingChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.MotionEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkWifiNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool networkWifiNotification = SystemSettings.NetworkWifiNotificationEnabled; + NetworkWifiNotificationSettingChangedEventArgs eventArgs = new NetworkWifiNotificationSettingChangedEventArgs(networkWifiNotification); + s_networkWifiNotificationChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_networkWifiNotificationChanged; + /// + /// NetworkWifiNotificationChanged event is triggered when the Wi-Fi-related notifications enabled status is changed + /// + /// + /// A NetworkWifiNotificationChangedEventArgs object that contains the key & changed value + public static event EventHandler NetworkWifiNotificationSettingChanged + { + add + { + if (s_networkWifiNotificationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled, s_networkWifiNotificationChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_networkWifiNotificationChanged += value; + } + + remove + { + s_networkWifiNotificationChanged -= value; + if (s_networkWifiNotificationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkWifiNotificationEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_networkFlightModeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + bool networkFlightMode = SystemSettings.NetworkFlightModeEnabled; + NetworkFlightModeSettingChangedEventArgs eventArgs = new NetworkFlightModeSettingChangedEventArgs(networkFlightMode); + s_networkFlightModeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_networkFlightModeChanged; + /// + /// NetworkFlightModeChanged event is triggered when the flight mode status is changed + /// + /// + /// A NetworkFlightModeChangedEventArgs object that contains the key & changed value + public static event EventHandler NetworkFlightModeSettingChanged + { + add + { + if (s_networkFlightModeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.NetworkFlightModeEnabled, s_networkFlightModeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_networkFlightModeChanged += value; + } + + remove + { + s_networkFlightModeChanged -= value; + if (s_networkFlightModeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.NetworkFlightModeEnabled); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_screenBacklightTimeChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + int screenBacklightTime = SystemSettings.ScreenBacklightTime; + ScreenBacklightTimeChangedEventArgs eventArgs = new ScreenBacklightTimeChangedEventArgs(screenBacklightTime); + s_screenBacklightTimeChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_screenBacklightTimeChanged; + /// + /// ScreenBacklightTimeChanged event is triggered when the backlight time is changed. + /// + /// + /// A ScreenBacklightTimeChangedEventArgs object that contains the key & changed value + public static event EventHandler ScreenBacklightTimeChanged + { + add + { + if (s_screenBacklightTimeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.ScreenBacklightTime, s_screenBacklightTimeChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_screenBacklightTimeChanged += value; + } + + remove + { + s_screenBacklightTimeChanged -= value; + if (s_screenBacklightTimeChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.ScreenBacklightTime); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string soundNotification = SystemSettings.SoundNotification; + SoundNotificationChangedEventArgs eventArgs = new SoundNotificationChangedEventArgs(soundNotification); + s_soundNotificationChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_soundNotificationChanged; + /// + /// SoundNotificationChanged event is triggered when the file path of the current notification tone set by the user is changed + /// + /// + /// A SoundNotificationChangedEventArgs object that contains the key & changed value + public static event EventHandler SoundNotificationChanged + { + add + { + if (s_soundNotificationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotification, s_soundNotificationChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_soundNotificationChanged += value; + } + + remove + { + s_soundNotificationChanged -= value; + if (s_soundNotificationChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotification); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_soundNotificationRepetitionPeriodChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + int soundNotificationRepetitionPeriod = SystemSettings.SoundNotificationRepetitionPeriod; + SoundNotificationRepetitionPeriodChangedEventArgs eventArgs = new SoundNotificationRepetitionPeriodChangedEventArgs(soundNotificationRepetitionPeriod); + s_soundNotificationRepetitionPeriodChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_soundNotificationRepetitionPeriodChanged; + /// + /// SoundNotificationRepetitionPeriodChanged event is triggered when the time period for notification repetitions is changed + /// + /// + /// A SoundNotificationRepetitionPeriodChangedEventArgs object that contains the key & changed value + public static event EventHandler SoundNotificationRepetitionPeriodChanged + { + add + { + if (s_soundNotificationRepetitionPeriodChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod, s_soundNotificationRepetitionPeriodChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_soundNotificationRepetitionPeriodChanged += value; + } + + remove + { + s_soundNotificationRepetitionPeriodChanged -= value; + if (s_soundNotificationRepetitionPeriodChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.SoundNotificationRepetitionPeriod); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_lockStateChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + SystemSettingsIdleLockState lockState = SystemSettings.LockState; + LockStateChangedEventArgs eventArgs = new LockStateChangedEventArgs(lockState); + s_lockStateChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_lockStateChanged; + /// + /// LockStateChanged event is triggered when the current lock state is changed + /// + /// + /// A LockStateChangedEventArgs object that contains the key & changed value + public static event EventHandler LockStateChanged + { + add + { + if (s_lockStateChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.LockState, s_lockStateChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_lockStateChanged += value; + } + + remove + { + s_lockStateChanged -= value; + if (s_lockStateChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.LockState); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_adsIdChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string adsId = SystemSettings.AdsId; + AdsIdChangedEventArgs eventArgs = new AdsIdChangedEventArgs(adsId); + s_adsIdChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_adsIdChanged; + /// + /// AdsIdChanged event is triggered when the current ADS ID state is changed + /// + /// + /// A AdsIdChangedEventArgs object that contains the key & changed value + public static event EventHandler AdsIdChanged + { + add + { + if (s_adsIdChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.AdsId, s_adsIdChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_adsIdChanged += value; + } + + remove + { + s_adsIdChanged -= value; + if (s_adsIdChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.AdsId); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSaveChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + SystemSettingsUdsState ultraDataSave = SystemSettings.UltraDataSave; + UltraDataSaveChangedEventArgs eventArgs = new UltraDataSaveChangedEventArgs(ultraDataSave); + s_ultraDataSaveChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_ultraDataSaveChanged; + /// + /// UltraDataSaveChanged event is triggered when the current Ultra Data Save state is changed + /// + /// + /// A UltraDataSaveChangedEventArgs object that contains the key & changed value + public static event EventHandler UltraDataSaveChanged + { + add + { + if (s_ultraDataSaveChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSave, s_ultraDataSaveChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_ultraDataSaveChanged += value; + } + + remove + { + s_ultraDataSaveChanged -= value; + if (s_ultraDataSaveChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSave); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + + private static readonly Interop.Settings.SystemSettingsChangedCallback s_ultraDataSavePackageListChangedCallback = (SystemSettingsKeys key, IntPtr userData) => + { + string ultraDataSavePackageList = "None"; + UltraDataSavePackageListChangedEventArgs eventArgs = new UltraDataSavePackageListChangedEventArgs(ultraDataSavePackageList); + s_ultraDataSavePackageListChanged?.Invoke(null, eventArgs); + }; + private static event EventHandler s_ultraDataSavePackageListChanged; + /// + /// UltraDataSavePackageListChanged event is triggered when the current ADS ID state is changed + /// + /// + /// A UltraDataSavePackageListChangedEventArgs object that contains the key & changed value + public static event EventHandler UltraDataSavePackageListChanged + { + add + { + if (s_ultraDataSavePackageListChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsSetCallback(SystemSettingsKeys.UltraDataSavePackageList, s_ultraDataSavePackageListChangedCallback, IntPtr.Zero); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + s_ultraDataSavePackageListChanged += value; + } + + remove + { + s_ultraDataSavePackageListChanged -= value; + if (s_ultraDataSavePackageListChanged == null) + { + SystemSettingsError ret = (SystemSettingsError)Interop.Settings.SystemSettingsRemoveCallback(SystemSettingsKeys.UltraDataSavePackageList); + if (ret != SystemSettingsError.None) + { + throw SystemSettingsExceptionFactory.CreateException(ret, "Error in callback handling"); + } + } + } + } + } +} + diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEnums.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEnums.cs new file mode 100755 index 0000000..e935db5 --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEnums.cs @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.System +{ + /// + /// Enumeration for all available system settings + /// + public enum SystemSettingsKeys : int + { + /// + /// (string) The file path of the current ringtone + /// + IncomingCallRingtone = 0, + /// + /// (string) The file path of the current home screen wallpaper + /// + WallpaperHomeScreen, + /// + /// (string) The file path of the current lock screen wallpaper + /// + WallpaperLockScreen, + /// + /// (int) The current system font size + /// + FontSize, + /// + /// (string) The current system font type + /// + FontType, + /// + /// (bool) Indicates whether the motion service is activated + /// + MotionActivationEnabled, + /// + /// (string) The file path of the current email alert ringtone + /// + EmailAlertRingtone, + /// + /// (bool) Indicates whether the USB debugging is enabled + /// + UsbDebuggingEnabled, + /// + /// (bool) Indicates whether the 3G data network is enabled + /// + Data3GNetworkEnabled, + /// + /// (string) Indicates lockscreen app pkg name + /// + LockscreenApp = Data3GNetworkEnabled + 2, + /// + /// (string) The current system default font type (only support Get) + /// + DefaultFontType, + /// + /// (string) Indicates the current country setting in the <LANGUAGE>_<REGION> syntax. + /// The country setting is in the ISO 639-2 format, + /// and the region setting is in the ISO 3166-1 alpha-2 format + /// + LocaleCountry, + /// + /// (string) Indicates the current language setting in the <LANGUAGE>_<REGION> syntax. + /// The language setting is in the ISO 639-2 format + /// and the region setting is in the ISO 3166-1 alpha-2 format. + /// + LocaleLanguage, + /// + /// (bool) Indicates whether the 24-hour clock is used. + /// If the value is false, the 12-hour clock is used. + /// + LocaleTimeFormat24HourEnabled, + /// + /// (string) Indicates the current time zone. Eg. Pacific/Tahiti + /// + LocaleTimeZone, + /// + /// (int) Once System changes time, this event occurs to notify time change. + /// + Time, + /// + /// GET (bool) Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound + /// + SoundLockEnabled, + /// + /// GET (bool) Indicates whether the device is in the silent mode. + /// + SoundSilentModeEnabled, + /// + /// GET (bool) Indicates whether the screen touch sound is enabled on the device. + /// + SoundTouchEnabled, + /// + /// GET (bool) Indicates whether rotation control is automatic. + /// + DisplayScreenRotationAutoEnabled, + /// + /// GET (string) Indicates device name. + /// + DeviceName, + /// + /// GET (bool) Indicates whether the device user has enabled motion feature. + /// + MotionEnabled, + /// + /// GET (bool) Indicates whether Wi-Fi-related notifications are enabled on the device. + /// + NetworkWifiNotificationEnabled, + /// + /// GET (bool) Indicates whether the device is in the flight mode. + /// + NetworkFlightModeEnabled, + /// + /// (int) Indicates the backlight time (in seconds). The following values can be used: 15, 30, 60, 120, 300, and 600. + /// + ScreenBacklightTime, + /// + /// (string) Indicates the file path of the current notification tone set by the user. + /// + SoundNotification, + /// + /// (int) Indicates the time period for notification repetitions. + /// + SoundNotificationRepetitionPeriod, + /// + /// (int) Indicates the current lock state + /// + LockState, + /// + /// (string) Indicates Ads ID for each device + /// + AdsId, + /// + /// (int) Indicates Ultra Data Save status, one of #SystemSettingsUdsState values + /// + UltraDataSave, + /// + /// (string) Indicates Ultra Data Save Package List (Since 4.0), the list is a string containing whitelisted package names separated with semicolons (;) + /// + UltraDataSavePackageList + } + /// + /// Enumeration for Idle Lock State. + /// + public enum SystemSettingsIdleLockState : int + { + /// + /// Device is unlocked + /// + Unlock = 0, + /// + /// Device is locked + /// + Lock, + /// + /// Device is being locked + /// + LaunchingLock + } + /// + /// Enumeration for font size. + /// + public enum SystemSettingsFontSize : int + { + /// + /// A small size + /// + Small = 0, + /// + /// A normal size + /// + Normal, + /// + /// A large size + /// + Large, + /// + /// A huge size + /// + Huge, + /// + /// A giant size + /// + Giant + } + /// + /// Enumeration for ultra data save + /// + public enum SystemSettingsUdsState : int + { + /// + /// UDS Off + /// + UdsOff = 0, + /// + /// UDS On + /// + UdsOn, + /// + /// UDS On and the app is whitelisted + /// + UdsOnWhitelisted, + } +} diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs new file mode 100755 index 0000000..0cdd7ae --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsEventArgs.cs @@ -0,0 +1,712 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.System +{ + /// + /// EventArgs type for the event IncomingCallRingtoneChanged + /// + public class IncomingCallRingtoneChangedEventArgs : EventArgs + { + private readonly string _incomingCallRingtone = null; + internal IncomingCallRingtoneChangedEventArgs(string val) + { + _incomingCallRingtone = val; + } + + /// + /// The file path of the current ringtone + /// + public string Value + { + get + { + return _incomingCallRingtone; + } + } + } + + /// + /// EventArgs type for the event WallpaperHomeScreenChanged + /// + public class WallpaperHomeScreenChangedEventArgs : EventArgs + { + private readonly string _wallpaperHomeScreen = null; + internal WallpaperHomeScreenChangedEventArgs(string val) + { + _wallpaperHomeScreen = val; + } + + /// + /// The file path of the current home screen wallpaper + /// + public string Value + { + get + { + return _wallpaperHomeScreen; + } + } + } + + /// + /// EventArgs type for the event WallpaperLockScreenChanged + /// + public class WallpaperLockScreenChangedEventArgs : EventArgs + { + private readonly string _wallpaperLockScreen = null; + internal WallpaperLockScreenChangedEventArgs(string val) + { + _wallpaperLockScreen = val; + } + + /// + /// The file path of the current lock screen wallpaper + /// + public string Value + { + get + { + return _wallpaperLockScreen; + } + } + } + + /// + /// EventArgs type for the event FontSizeChanged + /// + public class FontSizeChangedEventArgs : EventArgs + { + private readonly SystemSettingsFontSize _fontSize; + internal FontSizeChangedEventArgs(SystemSettingsFontSize val) + { + _fontSize = val; + } + + /// + /// The current system font size + /// + public SystemSettingsFontSize Value + { + get + { + return _fontSize; + } + } + } + + /// + /// EventArgs type for the event FontTypeChanged + /// + public class FontTypeChangedEventArgs : EventArgs + { + private readonly string _fontType = null; + internal FontTypeChangedEventArgs(string val) + { + _fontType = val; + } + + /// + /// The current system font type + /// + public string Value + { + get + { + return _fontType; + } + } + } + + /// + /// EventArgs type for the event MotionActivationChanged + /// + public class MotionActivationSettingChangedEventArgs : EventArgs + { + private readonly bool _motionActivation; + internal MotionActivationSettingChangedEventArgs(bool val) + { + _motionActivation = val; + } + + /// + /// Indicates whether the motion service is activated + /// + public bool Value + { + get + { + return _motionActivation; + } + } + } + + /// + /// EventArgs type for the event EmailAlertRingtoneChanged + /// + public class EmailAlertRingtoneChangedEventArgs : EventArgs + { + private readonly string _emailAlertRingtone = null; + internal EmailAlertRingtoneChangedEventArgs(string val) + { + _emailAlertRingtone = val; + } + + /// + /// The file path of the current email alert ringtone + /// + public string Value + { + get + { + return _emailAlertRingtone; + } + } + } + + /// + /// EventArgs type for the event UsbDebuggingSettingChanged + /// + public class UsbDebuggingSettingChangedEventArgs : EventArgs + { + private readonly bool _usbDebuggingEnabled; + internal UsbDebuggingSettingChangedEventArgs(bool val) + { + _usbDebuggingEnabled = val; + } + + /// + /// Indicates whether the USB debugging is enabled + /// + public bool Value + { + get + { + return _usbDebuggingEnabled; + } + } + } + + /// + /// EventArgs type for the event Data3GNetworkSettingChanged + /// + public class Data3GNetworkSettingChangedEventArgs : EventArgs + { + private readonly bool _data3GNetworkEnabled; + internal Data3GNetworkSettingChangedEventArgs(bool val) + { + _data3GNetworkEnabled = val; + } + + /// + /// Indicates whether the 3G data network is enabled + /// + public bool Value + { + get + { + return _data3GNetworkEnabled; + } + } + } + + /// + /// EventArgs type for the event LockscreenAppChanged + /// + public class LockscreenAppChangedEventArgs : EventArgs + { + private readonly string _lockscreenApp = null; + internal LockscreenAppChangedEventArgs(string val) + { + _lockscreenApp = val; + } + + /// + /// Indicates lockscreen app pkg name + /// + public string Value + { + get + { + return _lockscreenApp; + } + } + } + + /// + /// EventArgs type for the event LocaleCountryChanged + /// + public class LocaleCountryChangedEventArgs : EventArgs + { + private readonly string _localeCountry = null; + internal LocaleCountryChangedEventArgs(string val) + { + _localeCountry = val; + } + + /// + /// Indicates the current country setting in the <LANGUAGE>_<REGION> syntax. + /// The country setting is in the ISO 639-2 format, and the region setting is in the ISO 3166-1 alpha-2 format + /// + public string Value + { + get + { + return _localeCountry; + } + } + } + + /// + /// EventArgs type for the event LocaleLanguageChanged + /// + public class LocaleLanguageChangedEventArgs : EventArgs + { + private readonly string _localeLanguage = null; + internal LocaleLanguageChangedEventArgs(string val) + { + _localeLanguage = val; + } + + /// + /// Indicates the current language setting in the <LANGUAGE>_<REGION> syntax. + /// The language setting is in the ISO 639-2 format and the region setting is in the ISO 3166-1 alpha-2 format + /// + public string Value + { + get + { + return _localeLanguage; + } + } + } + + /// + /// EventArgs type for the event LocaleTimeFormat24HourChanged + /// + public class LocaleTimeFormat24HourSettingChangedEventArgs : EventArgs + { + private readonly bool _localeTimeFormat24Hour; + internal LocaleTimeFormat24HourSettingChangedEventArgs(bool val) + { + _localeTimeFormat24Hour = val; + } + + /// + /// Indicates whether the 24-hour clock is used. If the value is false, the 12-hour clock is used. + /// + public bool Value + { + get + { + return _localeTimeFormat24Hour; + } + } + } + + /// + /// EventArgs type for the event LocaleTimeZoneChanged + /// + public class LocaleTimeZoneChangedEventArgs : EventArgs + { + private readonly string _localeTimeZone = null; + internal LocaleTimeZoneChangedEventArgs(string val) + { + _localeTimeZone = val; + } + + /// + /// Indicates the current time zone + /// + public string Value + { + get + { + return _localeTimeZone; + } + } + } + + /// + /// EventArgs type for the event TimeChanged + /// + public class TimeChangedEventArgs : EventArgs + { + private readonly int _time; + internal TimeChangedEventArgs(int val) + { + _time = val; + } + + /// + /// Indicates the current time + /// + public int Value + { + get + { + return _time; + } + } + } + + /// + /// EventArgs type for the event SoundLockChanged + /// + public class SoundLockSettingChangedEventArgs : EventArgs + { + private readonly bool _soundLock; + internal SoundLockSettingChangedEventArgs(bool val) + { + _soundLock = val; + } + + /// + /// Indicates whether the screen lock sound is enabled on the device. ex) LCD on/off sound + /// + public bool Value + { + get + { + return _soundLock; + } + } + } + + /// + /// EventArgs type for the event SoundSilentModeChanged + /// + public class SoundSilentModeSettingChangedEventArgs : EventArgs + { + private readonly bool _soundSilentMode; + internal SoundSilentModeSettingChangedEventArgs(bool val) + { + _soundSilentMode = val; + } + + /// + /// Indicates whether the device is in the silent mode. + /// + public bool Value + { + get + { + return _soundSilentMode; + } + } + } + + /// + /// EventArgs type for the event SoundTouchChanged + /// + public class SoundTouchSettingChangedEventArgs : EventArgs + { + private readonly bool _soundTouch; + internal SoundTouchSettingChangedEventArgs(bool val) + { + _soundTouch = val; + } + + /// + /// Indicates whether the screen touch sound is enabled on the device. + /// + public bool Value + { + get + { + return _soundTouch; + } + } + } + + /// + /// EventArgs type for the event DisplayScreenRotationAutoChanged + /// + public class DisplayScreenRotationAutoSettingChangedEventArgs : EventArgs + { + private readonly bool _displayScreenRotationAuto; + internal DisplayScreenRotationAutoSettingChangedEventArgs(bool val) + { + _displayScreenRotationAuto = val; + } + + /// + /// Indicates whether rotation control is automatic + /// + public bool Value + { + get + { + return _displayScreenRotationAuto; + } + } + } + + /// + /// EventArgs type for the event DeviceNameChanged + /// + public class DeviceNameChangedEventArgs : EventArgs + { + private readonly string _deviceName = null; + internal DeviceNameChangedEventArgs(string val) + { + _deviceName = val; + } + + /// + /// Indicates device name + /// + public string Value + { + get + { + return _deviceName; + } + } + } + + /// + /// EventArgs type for the event MotionSettingChanged + /// + public class MotionSettingChangedEventArgs : EventArgs + { + private readonly bool _motionEnabled; + internal MotionSettingChangedEventArgs(bool val) + { + _motionEnabled = val; + } + + /// + /// Indicates whether the device user has enabled motion feature + /// + public bool Value + { + get + { + return _motionEnabled; + } + } + } + + /// + /// EventArgs type for the event NetworkWifiNotificationChanged + /// + public class NetworkWifiNotificationSettingChangedEventArgs : EventArgs + { + private readonly bool _networkWifiNotification; + internal NetworkWifiNotificationSettingChangedEventArgs(bool val) + { + _networkWifiNotification = val; + } + + /// + /// Indicates whether Wi-Fi-related notifications are enabled on the device + /// + public bool Value + { + get + { + return _networkWifiNotification; + } + } + } + + /// + /// EventArgs type for the event NetworkFlightModeChanged + /// + public class NetworkFlightModeSettingChangedEventArgs : EventArgs + { + private readonly bool _networkFlightMode; + internal NetworkFlightModeSettingChangedEventArgs(bool val) + { + _networkFlightMode = val; + } + + /// + /// Indicates whether the device is in the flight mode + /// + public bool Value + { + get + { + return _networkFlightMode; + } + } + } + + /// + /// EventArgs type for the event ScreenBacklightTimeChanged + /// + public class ScreenBacklightTimeChangedEventArgs : EventArgs + { + private readonly int _screenBacklightTime; + internal ScreenBacklightTimeChangedEventArgs(int val) + { + _screenBacklightTime = val; + } + + /// + /// Indicates the backlight time (in seconds) + /// + public int Value + { + get + { + return _screenBacklightTime; + } + } + } + + /// + /// EventArgs type for the event SoundNotificationChanged + /// + public class SoundNotificationChangedEventArgs : EventArgs + { + private readonly string _soundNotification = null; + internal SoundNotificationChangedEventArgs(string val) + { + _soundNotification = val; + } + + /// + /// Indicates the file path of the current notification tone set by the user + /// + public string Value + { + get + { + return _soundNotification; + } + } + } + + /// + /// EventArgs type for the event SoundNotificationRepetitionPeriodChanged + /// + public class SoundNotificationRepetitionPeriodChangedEventArgs : EventArgs + { + private readonly int _soundNotificationRepetitionPeriod; + internal SoundNotificationRepetitionPeriodChangedEventArgs(int val) + { + _soundNotificationRepetitionPeriod = val; + } + + /// + /// Indicates the time period for notification repetitions + /// + public int Value + { + get + { + return _soundNotificationRepetitionPeriod; + } + } + } + + /// + /// EventArgs type for the event LockStateChanged + /// + public class LockStateChangedEventArgs : EventArgs + { + private readonly SystemSettingsIdleLockState _lockState; + internal LockStateChangedEventArgs(SystemSettingsIdleLockState val) + { + _lockState = val; + } + + /// + /// Indicates the current lock state + /// + public SystemSettingsIdleLockState Value + { + get + { + return _lockState; + } + } + } + + /// + /// EventArgs type for the event AdsIdChanged + /// + public class AdsIdChangedEventArgs : EventArgs + { + private readonly string _adsId = null; + internal AdsIdChangedEventArgs(string val) + { + _adsId = val; + } + + /// + /// Indicates the current lock state + /// + public string Value + { + get + { + return _adsId; + } + } + } + + /// + /// EventArgs type for the event UltraDataSaveChanged + /// + public class UltraDataSaveChangedEventArgs : EventArgs + { + private readonly SystemSettingsUdsState _ultraDataSave = SystemSettingsUdsState.UdsOff; + internal UltraDataSaveChangedEventArgs(SystemSettingsUdsState val) + { + _ultraDataSave = val; + } + + /// + /// Indicates the current lock state + /// + public SystemSettingsUdsState Value + { + get + { + return _ultraDataSave; + } + } + } + + /// + /// EventArgs type for the event UltraDataSavePackageListChanged + /// + public class UltraDataSavePackageListChangedEventArgs : EventArgs + { + private readonly string _ultraDataSavePackageList = null; + internal UltraDataSavePackageListChangedEventArgs(string val) + { + _ultraDataSavePackageList = val; + } + + /// + /// Indicates the current lock state + /// + public string Value + { + get + { + return _ultraDataSavePackageList; + } + } + } +} diff --git a/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs new file mode 100644 index 0000000..039ff41 --- /dev/null +++ b/src/Tizen.System.SystemSettings/Tizen.System.SystemSettings/SystemSettingsExceptionFactory.cs @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.System +{ + internal enum SystemSettingsError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + IoError = Tizen.Internals.Errors.ErrorCode.IoError, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + LockScreenAppPasswordMode = -0x01140000 | 0x01 + }; + internal class SystemSettingsExceptionFactory + { + internal const string LogTag = "Tizen.System.SystemSettings"; + + internal static Exception CreateException(SystemSettingsError err, string msg) + { + Exception exp; + switch (err) + { + case SystemSettingsError.InvalidParameter: + exp = new ArgumentException(msg); + break; + case SystemSettingsError.NotSupported: + exp = new NotSupportedException(msg); + break; + case SystemSettingsError.OutOfMemory: + //fall through + case SystemSettingsError.IoError: + //fall through + case SystemSettingsError.PermissionDenied: + //fall through + case SystemSettingsError.LockScreenAppPasswordMode: + //fall through + default: + exp = new InvalidOperationException(msg); + break; + } + return exp; + } + } +} diff --git a/src/Tizen.System/Device/Battery.cs b/src/Tizen.System/Device/Battery.cs new file mode 100755 index 0000000..27d5d5d --- /dev/null +++ b/src/Tizen.System/Device/Battery.cs @@ -0,0 +1,339 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.System +{ + /// + /// Enumeration for the battery levels. + /// + /// 3 + public enum BatteryLevelStatus + { + /// + /// The battery goes empty. + /// Prepare for the safe termination of the application, + /// because the device starts a shutdown process soon + /// after entering this level. + /// + /// 3 + Empty = 0, + /// + /// The battery charge is at a critical state. + /// You may have to stop using the multimedia features, + /// because they are not guaranteed to work correctly + /// with this battery status. + /// + /// 3 + Critical, + /// + /// The battery has little charge left. + /// + /// 3 + Low, + /// + /// The battery status is not to be careful. + /// + /// 3 + High, + /// + /// The battery status is full. + /// + /// 3 + Full + } + + /// + /// The Battery class provides the properties and events for the device battery. + /// + /// + /// The Battery API provides the way to get the current battery capacity value (Percent), + /// the battery state, and the charging state. It also provides the events for an application + /// to receive the battery status change events from the device. + /// To receive the battery event, the application should register with the respective EventHandler. + /// + /// + /// Console.WriteLine("battery Charging state is: {0}", Tizen.System.Battery.IsCharging); + /// Console.WriteLine("battery Percent is: {0}", Tizen.System.Battery.Percent); + /// + public static class Battery + { + private static readonly object s_lock = new object(); + /// + /// Gets the battery charge percentage. + /// + /// 3 + /// It returns an integer value from 0 to 100 that indicates the remaining + /// battery charge as a percentage of the maximum level. + public static int Percent + { + get + { + int percent = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceBatteryGetPercent(out percent); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get battery percentage."); + } + return percent; + } + } + /// + /// Gets the current battery level. + /// + /// 3 + public static BatteryLevelStatus Level + { + get + { + int level = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceBatteryGetLevelStatus(out level); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get battery status."); + } + return (BatteryLevelStatus)level; + } + } + /// + /// Gets the current charging state. + /// + /// 3 + public static bool IsCharging + { + get + { + bool charging; + DeviceError res = (DeviceError)Interop.Device.DeviceBatteryIsCharging(out charging); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get battery charging state."); + } + return charging; + } + } + + private static EventHandler s_capacityChanged; + /// + /// CapacityChanged is triggered when the battery charge percentage is changed. + /// + /// 3 + /// + /// BatteryCapacityChangedEventArgs is an object that contains the changed battery capacity (Percent). + /// + /// public static async Task BatteryEventHandler() + /// { + /// EventHandler handler = null; + /// handler = (object sender, BatteryChargingStateChangedEventArgs args) => + /// { + /// Console.WriteLine("battery Percent is: {0}", args.Percent); + /// } + /// Battery.PercentChanged += handler; + /// await Task.Delay(20000); + /// } + /// + public static event EventHandler PercentChanged + { + add + { + lock (s_lock) + { + if (s_capacityChanged == null) + { + EventListenerStart(EventType.BatteryPercent); + } + s_capacityChanged += value; + } + } + remove + { + lock (s_lock) + { + s_capacityChanged -= value; + if (s_capacityChanged == null) + { + EventListenerStop(EventType.BatteryPercent); + } + } + } + } + + private static event EventHandler s_levelChanged; + + /// + /// LevelChanged is triggered when the battery level is changed. + /// + /// 3 + /// + /// BatteryLevelChangedEventArgs is an object that contains the changed battery level. + /// + /// public static async Task BatteryEventHandler() + /// { + /// EventHandler handler = null; + /// handler = (object sender, BatteryLevelChangedEventArgs args) => + /// { + /// Console.WriteLine("battery Level is: {0}", args.Level); + /// } + /// Battery.LevelChanged += handler; + /// await Task.Delay(20000); + /// } + /// + public static event EventHandler LevelChanged + { + add + { + lock (s_lock) + { + if (s_levelChanged == null) + { + EventListenerStart(EventType.BatteryLevel); + } + s_levelChanged += value; + } + } + remove + { + lock (s_lock) + { + s_levelChanged -= value; + if (s_levelChanged == null) + { + EventListenerStop(EventType.BatteryLevel); + } + } + } + } + + private static event EventHandler s_chargingStateChanged; + /// + /// ChargingStatusChanged is triggered when the battery charging status is changed. + /// This event is triggered when the charger is connected/disconnected. + /// + /// 3 + /// + /// BatteryChargingStateChangedEventArgs is an object that contains the changed battery charging state. + /// + /// public static async Task BatteryEventHandler() + /// { + /// EventHandler handler = null; + /// handler = (object sender, BatteryChargingStateChangedEventArgs args) => + /// { + /// Console.WriteLine("battery Level is: {0}", args.IsCharging); + /// } + /// Battery.ChargingStateChanged += handler; + /// await Task.Delay(20000); + /// } + /// + public static event EventHandler ChargingStateChanged + { + add + { + lock (s_lock) + { + if (s_chargingStateChanged == null) + { + EventListenerStart(EventType.BatteryCharging); + } + s_chargingStateChanged += value; + } + } + remove + { + lock (s_lock) + { + s_chargingStateChanged -= value; + if (s_chargingStateChanged == null) + { + EventListenerStop(EventType.BatteryCharging); + } + } + } + } + + private static Interop.Device.deviceCallback s_cpacityHandler; + private static Interop.Device.deviceCallback s_levelHandler; + private static Interop.Device.deviceCallback s_chargingHandler; + + private static void EventListenerStart(EventType eventType) + { + switch (eventType) + { + case EventType.BatteryPercent: + s_cpacityHandler = (int type, IntPtr value, IntPtr data) => + { + int val = value.ToInt32(); + BatteryPercentChangedEventArgs e = new BatteryPercentChangedEventArgs() + { + Percent = val + }; + s_capacityChanged?.Invoke(null, e); + return true; + }; + + Interop.Device.DeviceAddCallback(eventType, s_cpacityHandler, IntPtr.Zero); + break; + + case EventType.BatteryLevel: + s_levelHandler = (int type, IntPtr value, IntPtr data) => + { + int val = value.ToInt32(); + BatteryLevelChangedEventArgs e = new BatteryLevelChangedEventArgs() + { + Level = (BatteryLevelStatus)val + }; + s_levelChanged?.Invoke(null, e); + return true; + }; + + Interop.Device.DeviceAddCallback(eventType, s_levelHandler, IntPtr.Zero); + break; + + case EventType.BatteryCharging: + s_chargingHandler = (int type, IntPtr value, IntPtr data) => + { + bool val = (value.ToInt32() == 1); + BatteryChargingStateChangedEventArgs e = new BatteryChargingStateChangedEventArgs() + { + IsCharging = val + }; + s_chargingStateChanged?.Invoke(null, e); + return true; + }; + Interop.Device.DeviceAddCallback(eventType, s_chargingHandler, IntPtr.Zero); + break; + } + } + + private static void EventListenerStop(EventType eventType) + { + switch (eventType) + { + case EventType.BatteryPercent: + Interop.Device.DeviceRemoveCallback(eventType, s_cpacityHandler); + break; + + case EventType.BatteryLevel: + Interop.Device.DeviceRemoveCallback(eventType, s_levelHandler); + break; + + case EventType.BatteryCharging: + Interop.Device.DeviceRemoveCallback(eventType, s_chargingHandler); + break; + } + } + } +} diff --git a/src/Tizen.System/Device/DeviceEventArgs.cs b/src/Tizen.System/Device/DeviceEventArgs.cs new file mode 100644 index 0000000..53a75bb --- /dev/null +++ b/src/Tizen.System/Device/DeviceEventArgs.cs @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.System +{ + /// + /// BatteryPercentChangedEventArgs is an extended EventArgs class. This class contains event arguments for the BatteryPercentChanged event from the battery class. + /// + public class BatteryPercentChangedEventArgs : EventArgs + { + internal BatteryPercentChangedEventArgs(){} + /// + /// The current capacity of the battery. + /// Capacity is an integer value from 0 to 100 that indicates the remaining battery charge as a percentage of the maximum level. + /// + /// 3 + public int Percent { get; internal set; } + } + + /// + /// BatteryLevelChangedEventArgs is an extended EventArgs class. This class contains event arguments for the BatteryLevelChanged event from the battery class. + /// + public class BatteryLevelChangedEventArgs : EventArgs + { + internal BatteryLevelChangedEventArgs(){} + /// + /// The level indicates the current battery level status which is a type of the BatteryLevelStatus. + /// + /// 3 + public BatteryLevelStatus Level { get; internal set; } + } + + /// + /// BatteryChargingStateChangedEventArgs is an extended EventArgs class. This class contains event arguments for the BatteryChargingStateChanged event from the battery class. + /// + public class BatteryChargingStateChangedEventArgs : EventArgs + { + internal BatteryChargingStateChangedEventArgs() {} + /// + /// The charging state of the battery. Charging is a type of a boolean which indicates true/false based on the current charging status. + /// + /// 3 + public bool IsCharging { get; internal set; } + } + + /// + /// DisplayStateChangedEventArgs is an extended EventArgs class. This class contains event arguments for the DisplayStateChanged event from the display class. + /// + public class DisplayStateChangedEventArgs : EventArgs + { + internal DisplayStateChangedEventArgs() {} + /// + /// The state indicates the current display state of the device which is an enumeration of the type DisplayState. + /// + /// 3 + public DisplayState State { get; internal set; } + } + + /// + /// LedBrightnessChangedEventArgs is an extended EventArgs class. This class contains event arguments for the LedBrightnessChanged event from the LED class. + /// + public class LedBrightnessChangedEventArgs : EventArgs + { + internal LedBrightnessChangedEventArgs() {} + /// + /// Brightness indicates the current brightness level of the display as an integer. + /// + /// 3 + public int Brightness { get; internal set; } + } +} diff --git a/src/Tizen.System/Device/DeviceExceptionFactory.cs b/src/Tizen.System/Device/DeviceExceptionFactory.cs new file mode 100644 index 0000000..96c1eeb --- /dev/null +++ b/src/Tizen.System/Device/DeviceExceptionFactory.cs @@ -0,0 +1,73 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Tizen.System +{ + internal enum DeviceError + { + None = Tizen.Internals.Errors.ErrorCode.None, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + InvalidOperation = Tizen.Internals.Errors.ErrorCode.InvalidOperation, + AlreadyInProgress = Tizen.Internals.Errors.ErrorCode.NowInProgress, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, + OperationFailed = -0x01140000 | 0x01, + NotInitialized = -0x01140000 | 0x02 + }; + + class DeviceExceptionFactory + { + internal const string LogTag = "Tizen.System.Device"; + + internal static Exception CreateException(DeviceError err, string msg) + { + Exception exp; + switch (err) + { + case DeviceError.InvalidParameter: + case DeviceError.NotInitialized: + //fall through + exp = new ArgumentException(msg); + break; + case DeviceError.NotSupported: + exp = new NotSupportedException(msg +" : Device does not support the Operation."); + break; + case DeviceError.AlreadyInProgress: + //fall through + case DeviceError.ResourceBusy: + //fall through + case DeviceError.OperationFailed: + //fall through + case DeviceError.InvalidOperation: + exp = new InvalidOperationException(msg); + break; + case DeviceError.PermissionDenied: + exp = new UnauthorizedAccessException(msg); + break; + default: + exp = new InvalidOperationException("Unknown error occured."); + break; + } + return exp; + } + } +} diff --git a/src/Tizen.System/Device/Display.cs b/src/Tizen.System/Device/Display.cs new file mode 100644 index 0000000..4ee57c0 --- /dev/null +++ b/src/Tizen.System/Device/Display.cs @@ -0,0 +1,255 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +namespace Tizen.System +{ + /// + /// Enumeration for the available display states. + /// An application cannot put the device into the power off state or the suspend state. + /// + /// 3 + public enum DisplayState + { + /// + /// Normal state. + /// + /// 3 + Normal = 0, + /// + /// Screen dim state. + /// + /// 3 + Dim, + /// + /// Screen off state. + /// + /// 3 + Off + } + + /// + /// The Display class provides the properties and events to control the display status and brightness. + /// + /// + /// The Display API provides the way to get the current display brightness value, + /// the display state, and the total number of available displays. + /// It also provides the events for an application to receive the display state change events from the device. + /// To receive the display event, the application should register with an associated EventHandler. + /// + /// + /// http://tizen.org/privilege/display + /// + /// + /// Console.WriteLine("Display current state is: {0}", Tizen.System.Display.State); + /// Console.WriteLine("Total number of Displays are: {0}", Tizen.System.Display.NumberOfDisplays); + /// + public class Display + { + private readonly int _displayId; + private static readonly object s_lock = new object(); + private static Lazy> _lazyDisplays; + private Display(int deviceNumber) + { + _displayId = deviceNumber; + } + + /// + /// The number of available display devices. + /// + /// 3 + public static int NumberOfDisplays + { + get + { + int number = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetNumbers(out number); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get number of displays."); + } + return number; + } + } + /// + /// Gets all the available displays. + /// The display at the index zero is always assigned to the main display. + /// + /// 3 + public static IReadOnlyList Displays + { + get + { + _lazyDisplays = new Lazy>(() => GetAllDisplayes()); + return _lazyDisplays.Value; + } + } + + + private static IReadOnlyList GetAllDisplayes() + { + List displays = new List(); + + for (int i = 0; i < NumberOfDisplays; i++) + { + displays.Add(new Display(i)); + } + return displays; + + } + /// + /// The maximum brightness value that can be set for the specific display. + /// + /// 3 + /// + /// Display display = Display.Displays[0]; + /// Console.WriteLine("Display MaxBrightness is: {0}", display.MaxBrightness); + /// + public int MaxBrightness + { + get + { + int max = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetMaxBrightness(_displayId, out max); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get max brightness."); + } + return max; + } + } + + /// + /// The brightness value of the display. + /// + /// + /// The brightness value should be less than or equal to the MaxBrightness value. + /// + /// 3 + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// + /// Display display = Display.Displays[0]; + /// Console.WriteLine("Display current Brightness is: {0}", display.Brightness); + /// + public int Brightness + { + get + { + int brightness = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetBrightness(_displayId, out brightness); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get brightness."); + } + return brightness; + } + set + { + //TODO: Check for maximum throw exception.. + DeviceError res = (DeviceError)Interop.Device.DeviceDisplaySetBrightness(_displayId, value); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to set brightness value"); + } + } + } + /// + /// The current device display state. + /// + /// 3 + public static DisplayState State + { + get + { + int state = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceDisplayGetState(out state); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get Display state."); + } + return (DisplayState)state; + } + } + + private static event EventHandler s_stateChanged; + /// + /// StateChanged is raised when the state of the display is changed. + /// + /// 3 + /// + /// DisplayStateChangedEventArgs is an object that contains the changed state. + /// + /// public static async Task DisplayEventHandler() + /// { + /// EventHandler handler = null; + /// handler = (object sender, DisplayStateChangedEventArgs args) => + /// { + /// Console.WriteLine("Display State is: {0}", args.State); + /// } + /// Battery.StateChanged += handler; + /// await Task.Delay(20000); + /// } + /// + public static event EventHandler StateChanged + { + add + { + lock (s_lock) + { + if (s_stateChanged == null) + { + EventListenerStart(); + } + s_stateChanged += value; + } + } + remove + { + lock (s_lock) + { + s_stateChanged -= value; + if (s_stateChanged == null) + { + EventListenerStop(); + } + } + } + } + + private static Interop.Device.deviceCallback s_handler; + private static void EventListenerStart() + { + s_handler = (int type, IntPtr value, IntPtr data) => + { + int val = value.ToInt32(); + DisplayStateChangedEventArgs e = new DisplayStateChangedEventArgs() + { + State = (DisplayState)val + }; + s_stateChanged?.Invoke(null, e); + return true; + }; + Interop.Device.DeviceAddCallback(EventType.DisplayState, s_handler, IntPtr.Zero); + } + + private static void EventListenerStop() + { + Interop.Device.DeviceRemoveCallback(EventType.DisplayState, s_handler); + } + } +} diff --git a/src/Tizen.System/Device/Haptic.cs b/src/Tizen.System/Device/Haptic.cs new file mode 100644 index 0000000..c8543e6 --- /dev/null +++ b/src/Tizen.System/Device/Haptic.cs @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +namespace Tizen.System +{ + /// + /// The Vibrator class provides the properties and methods to control a vibrator. + /// + /// + /// The Vibrator API provides the way to access the vibrators in the device. + /// It allows the management of the device's vibrator parameters, such as the vibration count and level. + /// It provides the methods to vibrate and stop the vibration. + /// + /// + /// http://tizen.org/privilege/haptic + /// + /// + /// Console.WriteLine("Total number of Vibrators are: {0}", Tizen.System.Vibrator.NumberOfVibrators); + /// + public class Vibrator : IDisposable + { + private readonly int _vibratorId; + private IntPtr _hapticHandle = IntPtr.Zero; + private bool _disposedValue = false; + private static Lazy> _lazyVibrators; + private static int _maxcount = 0; + private Vibrator(int id) + { + _vibratorId = id; + DeviceError res = (DeviceError)Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to create Vibrator for given Id"); + } + res = (DeviceError)Interop.Device.DeviceHapticGetCount(out _maxcount); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get Vibrators count."); + } + + } + + ~Vibrator() + { + Dispose(false); + } + /// + /// Gets the number of the available vibrators. + /// + /// 3 + public static int NumberOfVibrators + { + get + { + int count = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceHapticGetCount(out count); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get Vibrators count."); + } + return count; + } + } + /// + /// Gets all the available vibrators. + /// + /// 3 + public static IReadOnlyList Vibrators + { + get + { + _lazyVibrators = new Lazy>(() => GetAllVibrators()); + return _lazyVibrators.Value; + } + } + private static IReadOnlyList GetAllVibrators() + { + int count = 0; + List vibrators = new List(); + DeviceError res = (DeviceError)Interop.Device.DeviceHapticGetCount(out count); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to get Vibrators count."); + } + for (int i = 0; i < NumberOfVibrators; i++) + { + vibrators.Add(new Vibrator(i)); + } + return vibrators; + + } + /// + /// Vibrates during the specified time with a constant intensity. + /// This function can be used to start monotonous vibration for the specified time. + /// + /// 3 + /// The play duration in milliseconds. + /// The amount of the intensity variation (0 ~ 100). + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case of any system error. + /// In case the device does not support this behavior. + /// + /// Vibrator vibrator = Vibrator.Vibrators[0]; + /// try + /// { + /// vibrator.Vibrate(2000, 70); + /// } + /// Catch(Exception e) + /// { + /// } + /// + + public void Vibrate(int duration, int feedback) + { + IntPtr effect; + DeviceError res = DeviceError.None; + if (_hapticHandle == IntPtr.Zero) + { + res = (DeviceError)Interop.Device.DeviceHapticOpen(_vibratorId, out _hapticHandle); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to get vibrator."); + } + } + + res = (DeviceError)Interop.Device.DeviceHapticVibrate(_hapticHandle, duration, feedback, out effect); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to vibrate the current vibrator."); + } + } + /// + /// Stops all the vibration effects which are being played. + /// This function can be used to stop all the effects started by Vibrate(). + /// + /// 3 + /// In case an invalid vibrator instance is used. + /// If the privilege is not set. + /// In case of any system error. + /// In case the device does not support this behavior. + /// + /// Vibrator vibrator = Vibrator.Vibrators[0]; + /// try + /// { + /// vibrator.Stop(); + /// } + /// Catch(Exception e) + /// { + /// } + /// + public void Stop() + { + if (_hapticHandle != IntPtr.Zero) + { + DeviceError res = (DeviceError)Interop.Device.DeviceHapticStop(_hapticHandle, IntPtr.Zero); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to stop the current vibrator."); + } + } + } + /// + /// Dispose API for closing the internal resources. + /// This function can be used to stop all the effects started by Vibrate(). + /// + /// 3 + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) + { + if (!_disposedValue) + { + if (_hapticHandle != IntPtr.Zero) + { + Interop.Device.DeviceHapticClose(_hapticHandle); + _hapticHandle = IntPtr.Zero; + } + _disposedValue = true; + } + } + } +} diff --git a/src/Tizen.System/Device/IR.cs b/src/Tizen.System/Device/IR.cs new file mode 100644 index 0000000..5a41b09 --- /dev/null +++ b/src/Tizen.System/Device/IR.cs @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Tizen.System +{ + /// + /// The IR API provides the functions to control the IR transmitter. + /// The IR API provides the way to get the information if IR is available and then transmit the IR command. + /// + /// + /// http://tizen.org/privilege/use_ir + /// + /// + /// Console.WriteLine("IR availability for this device is: {0}", IR.IsAvailable); + /// + public static class IR + { + /// + /// Gets the information whether the IR module is available. + /// + /// 3 + public static bool IsAvailable + { + get + { + bool available = false; + DeviceError res = (DeviceError)Interop.Device.DeviceIRIsAvailable(out available); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get ir status."); + } + return available; + } + } + + /// + /// Transmits the IR command. + /// + /// 3 + /// + /// The carrier frequency to transmit the IR command (Hertz). + /// + /// + /// The IR command list of type integer. + /// + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case of any system error. + /// In case the device does not support this behavior. + /// + /// try + /// { + /// List pattern = new List(); + /// pattern.Add(10); + /// pattern.Add(50); + /// IR.Transmit(60657, pattern); + /// } + /// catch(Exception e) + /// { + /// } + /// + public static void Transmit(int carrierFreequency, IList pattern) + { + int[] patternArray = pattern.ToArray(); + DeviceError res = (DeviceError)Interop.Device.DeviceIRTransmit(carrierFreequency, patternArray, pattern.Count()); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to trasmit IR command."); + } + } + } +} diff --git a/src/Tizen.System/Device/Led.cs b/src/Tizen.System/Device/Led.cs new file mode 100644 index 0000000..e61118d --- /dev/null +++ b/src/Tizen.System/Device/Led.cs @@ -0,0 +1,220 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +using Tizen.Common; + +namespace Tizen.System +{ + /// + /// The LED class provides the properties and methods to control the attached LED device. + /// + /// + /// The LED API provides the way to control the attached LED device, such as the camera flash and service LED. It supports to turn on the camera flash and set the pattern to the service LED which is located at the front of the device. + /// Related features: + /// http://tizen.org/feature/led + /// http://tizen.org/feature/camera.back.flash + /// It is recommended to design the feature related codes in your application for reliability. + /// You can check if a device supports the related features for this API by using system information, thereby controlling the procedure of your application. + /// + /// + /// http://tizen.org/privilege/led + /// + /// + /// Console.WriteLine("Led MaxBrightness is: {0}", Tizen.System.Led.MaxBrightness); + /// Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness); + /// + public static class Led + { + /// + /// Gets the maximum brightness value of the LED that is located next to the camera. + /// 3 + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case the device does not support this behavior. + /// + public static int MaxBrightness + { + get + { + int max = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceFlashGetMaxBrightness(out max); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get max brightness value."); + } + return max; + } + } + + private static readonly object s_lock = new object(); + + /// + /// Gets the brightness value of the LED that is located next to the camera. + /// + /// The brightness value range of the LED is 0 to Tizen.System.Led.MaxBrightness value. + /// Changing the brightness value will invoke the registered EventHandler for the LED BrightnessChanged (if any). + /// + /// 3 + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case the device does not support this behavior. + /// + /// Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness); + /// Tizen.System.Led.Brightness = 50; + /// Console.WriteLine("Led current Brightness is: {0}", Tizen.System.Led.Brightness); + /// + + public static int Brightness + { + get + { + int brightness = 0; + DeviceError res = (DeviceError)Interop.Device.DeviceFlashGetBrightness(out brightness); + if (res != DeviceError.None) + { + Log.Warn(DeviceExceptionFactory.LogTag, "unable to get brightness value."); + } + return brightness; + } + set + { + DeviceError res = (DeviceError) Interop.Device.DeviceFlashSetBrightness(value); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to set brightness value"); + } + } + } + + /// + /// Plays the LED that is located at the front of the device. + /// + /// 3 + /// Turn on time in milliseconds. + /// Turn off time in milliseconds. + /// + /// The Color value + /// The first byte means opaque and the other 3 bytes are the RGB values. + /// + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case of any system error. + /// In case the device does not support this behavior. + /// + /// try + /// { + /// Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1)); + /// } + /// Catch(Exception e) + /// { + /// } + /// + public static void Play(int on, int off, Color color) + { + //looks like only blink option is supported. So hard coded to default blink option. + DeviceError res = (DeviceError)Interop.Device.DeviceLedPlayCustom(on, off, Convert.ToUInt32(color.GetArgb()), 1); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "failed to play Led."); + } + } + + /// + /// Stops the LED that is located at the front of the device. + /// + /// 3 + /// If the privilege is not set. + /// In case of any system error. + /// In case the device does not support this behavior. + /// + /// try + /// { + /// Led.Play(500, 200, Color.FromRgba(255, 255, 255, 1)); + /// //wait for a while and stop... + /// Led.Stop(); + /// } + /// Catch(Exception e) + /// { + /// } + /// + + public static void Stop() + { + DeviceError res = (DeviceError)Interop.Device.DeviceLedStopCustom(); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "failed to stop Led."); + } + } + + + private static EventHandler s_brightnessChanged; + /// + /// StateChanged is raised when the LED state is changed. + /// + /// 3 + /// The source of the event. + /// LedBrightnessChangedEventArgs is an object that contains the changed brightness. + public static event EventHandler BrightnessChanged + { + add + { + lock (s_lock) + { + if (s_brightnessChanged == null) + { + EventListenerStart(); + } + s_brightnessChanged += value; + } + } + remove + { + lock (s_lock) + { + s_brightnessChanged -= value; + if (s_brightnessChanged == null) + { + EventListenerStop(); + } + } + } + } + + private static Interop.Device.deviceCallback s_handler; + private static void EventListenerStart() + { + s_handler = (int type, IntPtr value, IntPtr data) => + { + int val = value.ToInt32(); + LedBrightnessChangedEventArgs e = new LedBrightnessChangedEventArgs() + { + Brightness = val + }; + s_brightnessChanged?.Invoke(null, e); + return true; + }; + Interop.Device.DeviceAddCallback(EventType.FlashBrightness, s_handler, IntPtr.Zero); + } + + private static void EventListenerStop() + { + Interop.Device.DeviceRemoveCallback(EventType.FlashBrightness, s_handler); + } + } +} diff --git a/src/Tizen.System/Device/Power.cs b/src/Tizen.System/Device/Power.cs new file mode 100644 index 0000000..bc0c589 --- /dev/null +++ b/src/Tizen.System/Device/Power.cs @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.System +{ + /// + /// The Power class provides methods to control the power service. + /// + /// + /// The Power API provides the way to control the power service. + /// It can be made to hold the specific state to avoid the CPU state internally. + /// + /// + /// http://tizen.org/privilege/display + /// + public static class Power + { + /// + /// Locks the CPU for a specified time. + /// After the given timeout (in milliseconds), unlock the given lock state automatically. + /// + /// + /// If the process dies, then every lock will be removed. + /// + /// 3 + /// + /// The positive number in milliseconds or 0 for the permanent lock. + /// So you must release the permanent lock of the power state with ReleaseCpuLock() if timeout_ms is zero. + /// + /// When an invalid parameter value is set. + /// If the privilege is not set. + /// In case of any system error. + /// + /// Tizen.System.Power.RequestCpuLock(2000); + /// + + public static void RequestCpuLock(int timeout) + { + DeviceError res = (DeviceError)Interop.Device.DevicePowerRequestLock(0, timeout); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to acquire power lock."); + } + } + /// + /// Releases the CPU lock state. + /// + /// 3 + /// If the privilege is not set. + /// In case of any system error. + /// + /// Tizen.System.Power.ReleaseCpuLock(); + /// + public static void ReleaseCpuLock() + { + DeviceError res = (DeviceError)Interop.Device.DevicePowerReleaseLock(0); + if (res != DeviceError.None) + { + throw DeviceExceptionFactory.CreateException(res, "unable to release power lock."); + } + } + } +} diff --git a/src/Tizen.System/Interop/Interop.Device.cs b/src/Tizen.System/Interop/Interop.Device.cs new file mode 100644 index 0000000..3862edd --- /dev/null +++ b/src/Tizen.System/Interop/Interop.Device.cs @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.System +{ + internal enum EventType + { + BatteryPercent, + BatteryLevel, + BatteryCharging, + DisplayState, + FlashBrightness + } +} +internal static partial class Interop +{ + internal static partial class Device + { + // Battery + [DllImport(Libraries.Device, EntryPoint = "device_battery_get_percent", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceBatteryGetPercent(out int percent); + [DllImport(Libraries.Device, EntryPoint = "device_battery_is_charging", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceBatteryIsCharging(out bool charging); + [DllImport(Libraries.Device, EntryPoint = "device_battery_get_level_status", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceBatteryGetLevelStatus(out int status); + + // Display + [DllImport(Libraries.Device, EntryPoint = "device_display_get_numbers", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplayGetNumbers(out int device_number); + [DllImport(Libraries.Device, EntryPoint = "device_display_get_max_brightness", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplayGetMaxBrightness(int index, out int max_brightness); + [DllImport(Libraries.Device, EntryPoint = "device_display_get_brightness", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplayGetBrightness(int index, out int status); + [DllImport(Libraries.Device, EntryPoint = "device_display_set_brightness", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplaySetBrightness(int index, int brightness); + [DllImport(Libraries.Device, EntryPoint = "device_display_get_state", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplayGetState(out int state); + [DllImport(Libraries.Device, EntryPoint = "device_display_change_state", CallingConvention = CallingConvention.Cdecl)] + public static extern int DeviceDisplayChangeState(int state); + + // Haptic + [DllImport(Libraries.Device, EntryPoint = "device_haptic_get_count", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceHapticGetCount(out int device_number); + [DllImport(Libraries.Device, EntryPoint = "device_haptic_open", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceHapticOpen(int index, out IntPtr handle); + [DllImport(Libraries.Device, EntryPoint = "device_haptic_close", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceHapticClose(IntPtr handle); + [DllImport(Libraries.Device, EntryPoint = "device_haptic_vibrate", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceHapticVibrate(IntPtr handle, int duration, int feedback, out IntPtr effect); + [DllImport(Libraries.Device, EntryPoint = "device_haptic_stop", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceHapticStop(IntPtr handle, IntPtr effect); + + // Led + [DllImport(Libraries.Device, EntryPoint = "device_flash_get_max_brightness", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceFlashGetMaxBrightness(out int max_brightness); + [DllImport(Libraries.Device, EntryPoint = "device_flash_get_brightness", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceFlashGetBrightness(out int brightness); + [DllImport(Libraries.Device, EntryPoint = "device_flash_set_brightness", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceFlashSetBrightness(int brightness); + [DllImport(Libraries.Device, EntryPoint = "device_led_play_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceLedPlayCustom(int on, int off, uint color, uint flags); + [DllImport(Libraries.Device, EntryPoint = "device_led_stop_custom", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceLedStopCustom(); + + // Power + [DllImport(Libraries.Device, EntryPoint = "device_power_request_lock", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DevicePowerRequestLock(int type, int timeout_ms); + [DllImport(Libraries.Device, EntryPoint = "device_power_release_lock", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DevicePowerReleaseLock(int type); + + //IR + [DllImport(Libraries.Device, EntryPoint = "device_ir_is_available", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceIRIsAvailable(out bool available); + [DllImport(Libraries.Device, EntryPoint = "device_ir_transmit", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceIRTransmit(int carrierFreequency, int[] pattern, int size); + + // Callback + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool deviceCallback(int type, IntPtr value, IntPtr data); + [DllImport(Libraries.Device, EntryPoint = "device_add_callback", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceAddCallback(Tizen.System.EventType type, deviceCallback cb, IntPtr data); + [DllImport(Libraries.Device, EntryPoint = "device_remove_callback", CallingConvention = CallingConvention.Cdecl)] + internal static extern int DeviceRemoveCallback(Tizen.System.EventType type, deviceCallback cb); + } +} diff --git a/src/Tizen.System/Interop/Interop.Libraries.cs b/src/Tizen.System/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..a2252c4 --- /dev/null +++ b/src/Tizen.System/Interop/Interop.Libraries.cs @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +internal static partial class Interop +{ + internal static partial class Libraries + { + internal const string Device = "libcapi-system-device.so.0"; + } +} diff --git a/src/Tizen.System/Tizen.System.csproj b/src/Tizen.System/Tizen.System.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.System/Tizen.System.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.System/Tizen.System.sln b/src/Tizen.System/Tizen.System.sln new file mode 100755 index 0000000..1d2c3d5 --- /dev/null +++ b/src/Tizen.System/Tizen.System.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System", "Tizen.System.csproj", "{C746BBD5-97D6-476F-BD3D-7B3A1AAA06DE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F919D01F-1707-4D81-9C57-8E09CE48804C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{2992FC24-7B41-4765-8A9C-559CCB922A99}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C746BBD5-97D6-476F-BD3D-7B3A1AAA06DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C746BBD5-97D6-476F-BD3D-7B3A1AAA06DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C746BBD5-97D6-476F-BD3D-7B3A1AAA06DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C746BBD5-97D6-476F-BD3D-7B3A1AAA06DE}.Release|Any CPU.Build.0 = Release|Any CPU + {F919D01F-1707-4D81-9C57-8E09CE48804C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F919D01F-1707-4D81-9C57-8E09CE48804C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F919D01F-1707-4D81-9C57-8E09CE48804C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F919D01F-1707-4D81-9C57-8E09CE48804C}.Release|Any CPU.Build.0 = Release|Any CPU + {2992FC24-7B41-4765-8A9C-559CCB922A99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2992FC24-7B41-4765-8A9C-559CCB922A99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2992FC24-7B41-4765-8A9C-559CCB922A99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2992FC24-7B41-4765-8A9C-559CCB922A99}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Tapi/Interop/Interop.Libraries.cs b/src/Tizen.Tapi/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..242a922 --- /dev/null +++ b/src/Tizen.Tapi/Interop/Interop.Libraries.cs @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Tapi = "libSLP-tapi.so.0"; + public const string Glib = "libglib-2.0.so.0"; + public const string Libc = "libc.so.6"; + } +} diff --git a/src/Tizen.Tapi/Interop/Interop.Tapi.cs b/src/Tizen.Tapi/Interop/Interop.Tapi.cs new file mode 100755 index 0000000..9881c98 --- /dev/null +++ b/src/Tizen.Tapi/Interop/Interop.Tapi.cs @@ -0,0 +1,371 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Tapi; + +/// +/// Interop class for Tapi +/// +internal static partial class Interop +{ + /// + /// Tapi Native Apis + /// + internal static partial class Tapi + { + //Callback for event + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TapiNotificationCallback(IntPtr handle, IntPtr id, IntPtr data, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TapiResponseCallback(IntPtr handle, int result, IntPtr data, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TapiStateCallback(int state, IntPtr userData); + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void CallStatusCallback(ref CallStatusStruct info, IntPtr userData); + + //Tapi-common + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_cp_name_list")] + internal static extern IntPtr GetCpNames(); + [DllImport(Libraries.Tapi, EntryPoint = "tel_init")] + internal static extern IntPtr InitTapi(string cpName); + [DllImport(Libraries.Tapi, EntryPoint = "tel_deinit")] + internal static extern int DeinitTapi(IntPtr handle); + [DllImport(Libraries.Tapi, EntryPoint = "tel_register_noti_event")] + internal static extern int RegisterNotiEvent(IntPtr handle, string notificationId, TapiNotificationCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_deregister_noti_event")] + internal static extern int DeregisterNotiEvent(IntPtr handle, string notificationId); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_property_int")] + internal static extern int GetIntProperty(IntPtr handle, string property, out int result); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_property_string")] + internal static extern int GetStringProperty(IntPtr handle, string property, out string result); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_ready_state")] + internal static extern int GetReadyState(out int state); + [DllImport(Libraries.Tapi, EntryPoint = "tel_register_ready_state_cb")] + internal static extern int RegisterReadyStateCb(TapiStateCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_deregister_ready_state_cb")] + internal static extern int DeregisterReadyStateCb(TapiStateCallback cb); + + //Phonebook + internal static class Phonebook + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_pb_init_info")] + internal static extern int GetPhonebookInitInfo(IntPtr handle, out int initCompleted, out SimPhonebookListStruct pbList); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_pb_count")] + internal static extern int GetPhonebookStorage(IntPtr handle, PhonebookType pbType, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_pb_meta_info")] + internal static extern int GetPhonebookMetaInfo(IntPtr handle, PhonebookType pbType, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_pb_usim_meta_info")] + internal static extern int GetPhonebookMetaInfo3G(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_read_sim_pb_record")] + internal static extern int ReadPhonebookRecord(IntPtr handle, PhonebookType pbType, ushort pbIndex, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_update_sim_pb_record")] + internal static extern int UpdatePhonebookRecord(IntPtr handle, ref PhonebookRecordStruct data, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_delete_sim_pb_record")] + internal static extern int DeletePhonebookRecord(IntPtr handle, PhonebookType pbType, ushort pbIndex, TapiResponseCallback cb, IntPtr userData); + } + + //Sat + internal static class Sat + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_select_sat_menu")] + internal static extern int SatSendSelectMenu(IntPtr handle, ref SatMenuSelectionInfoStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_download_sat_event")] + internal static extern int SatDownloadEvent(IntPtr handle, ref SatEventDownloadInfoStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_sat_ui_display_status")] + internal static extern int SatSendUiDisplayStatus(IntPtr handle, int commandId, SatUiDisplayStatus status); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_sat_ui_user_confirm")] + internal static extern int SatSendUiUserConfim(IntPtr handle, ref SatUiUserConfirmInfoStruct confirmInfo); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sat_main_menu_info")] + internal static extern int SatGetMainMenuInfo(IntPtr handle, out SatMainMenuInfoStruct mainMenuInfo); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_sat_app_exec_result")] + internal static extern int SatExecutionResult(IntPtr handle, out SatResultDataStruct resultData); + } + + //Sim + internal static class Sim + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_init_info")] + internal static extern int SimGetInitInfo(IntPtr handle, out SimCardStatus status, out int cardChanged); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_type")] + internal static extern int SimGetType(IntPtr handle, out SimCardType type); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_imsi")] + internal static extern int SimGetImsi(IntPtr handle, out SimImsiInfoStruct imsiInfo); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_ecc")] + internal static extern int SimGetEcc(IntPtr handle, out SimEccInfoListStruct eccInfo); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_iccid")] + internal static extern int SimGetIccId(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_language")] + internal static extern int SimGetLanguage(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_language")] + internal static extern int SimSetLanguage(IntPtr handle, SimLanguagePreference language, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_callforwarding_info")] + internal static extern int SimGetCallForwardingInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_callforwarding_info")] + internal static extern int SimSetCallForwardingInfo(IntPtr handle, ref SimCallForwardRequestStruct request, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_messagewaiting_info")] + internal static extern int SimGetMessageWaitingInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_messagewaiting_info")] + internal static extern int SimSetMessageWaitingInfo(IntPtr handle, ref SimMessageWaitingRequestStruct request, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_mailbox_info")] + internal static extern int SimGetMailboxInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_mailbox_info")] + internal static extern int SimSetMailboxInfo(IntPtr handle, ref SimMailboxNumberStruct mailbox, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_cphs_info")] + internal static extern int SimGetCphsInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_service_table")] + internal static extern int SimGetServiceTable(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_msisdn")] + internal static extern int SimGetMsisdn(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_oplmnwact")] + internal static extern int SimGetOplmnwact(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_spn")] + internal static extern int SimGetSpn(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_cphs_netname")] + internal static extern int SimGetCphsNetName(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_req_sim_authentication")] + internal static extern int SimExecuteAuthentication(IntPtr handle, ref SimAuthenticationDataStruct authenticationData, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_verifiy_sim_pins")] + internal static extern int SimVerifyPins(IntPtr handle, ref SimPinDataStruct pinData, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_verify_sim_puks")] + internal static extern int SimVerifyPuks(IntPtr handle, ref SimPinDataStruct pukData, ref SimPinDataStruct newPinData, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_change_sim_pins")] + internal static extern int SimChangePins(IntPtr handle, ref SimPinDataStruct oldPin, ref SimPinDataStruct newPin, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_disable_sim_facility")] + internal static extern int SimDisableFacility(IntPtr handle, ref SimFacilityStruct facility, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_enable_sim_facility")] + internal static extern int SimEnableFacility(IntPtr handle, ref SimFacilityStruct facility, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_facility")] + internal static extern int SimGetFacility(IntPtr handle, SimLockType lockType, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_lock_info")] + internal static extern int SimGetLockInfo(IntPtr handle, SimLockType lockType, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sim_power_state")] + internal static extern int SimSetPowerState(IntPtr handle, SimPowerState state, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_req_sim_apdu")] + internal static extern int SimRequestApdu(IntPtr handle, ref SimApduStruct apdu, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_req_sim_atr")] + internal static extern int SimRequestAtr(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_application_list")] + internal static extern int SimGetApplicationList(IntPtr handle, out byte appList); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_impi")] + internal static extern int SimGetImpi(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_impu")] + internal static extern int SimGetImpu(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_domain")] + internal static extern int SimGetDomain(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_pcscf")] + internal static extern int SimGetPcscf(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sim_isim_service_table")] + internal static extern int SimGetIsimServiceTable(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + + } + + //Ss + internal static class Ss + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_ss_barring")] + internal static extern int SsSetBarring(IntPtr handle, ref SsBarringInfoStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_ss_barring_status")] + internal static extern int SsGetBarringStatus(IntPtr handle, SsClass ssClass, SsBarringType type, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_change_ss_barring_password")] + internal static extern int SsChangeBarringPassword(IntPtr handle, string oldPassword, string newPassword, string newPasswordAgain, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_ss_forward")] + internal static extern int SsSetForward(IntPtr handle, ref SsForwardInfoStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_ss_forward_status")] + internal static extern int SsGetForwardStatus(IntPtr handle, SsClass ssClass, SsForwardCondition condition, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_ss_waiting")] + internal static extern int SsSetWaiting(IntPtr handle, ref SsWaitingInfoStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_ss_waiting_status")] + internal static extern int SsGetWaitingStatus(IntPtr handle, SsClass ssClass, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_ss_cli_status")] + internal static extern int SsSetCliStatus(IntPtr handle, SsCliType type, SsCliStatus status, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_ss_cli_status")] + internal static extern int SsGetCliStatus(IntPtr handle, SsCliType type, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_ss_ussd_request")] + internal static extern int SsSendUssdRequest(IntPtr handle, ref SsUssdMsgInfoStruct info, TapiResponseCallback cb, IntPtr userData); + } + + //Call + internal static class Call + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_dial_call")] + internal static extern int DialCall(IntPtr handle, ref CallInformationStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_answer_call")] + internal static extern int AnswerCall(IntPtr handle, uint callHandle, CallAnswerType type, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_end_call")] + internal static extern int EndCall(IntPtr handle, uint callHandle, CallEndType type, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_hold_call")] + internal static extern int HoldCall(IntPtr handle, uint callHandle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_active_call")] + internal static extern int ActiveCall(IntPtr handle, uint callHandle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_swap_call")] + internal static extern int SwapCall(IntPtr handle, uint callHandle1, uint callHandle2, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_start_call_cont_dtmf")] + internal static extern int StartContDtmfCall(IntPtr handle, byte dtmfDigit, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_stop_call_cont_dtmf")] + internal static extern int StopContDtmfCall(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_call_burst_dtmf")] + internal static extern int SendBurstDtmfCall(IntPtr handle, ref CallBurstDtmfStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_join_call")] + internal static extern int JoinCall(IntPtr handle, uint callHandle1, uint callHandle2, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_split_call")] + internal static extern int SplitCall(IntPtr handle, uint callHandle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_transfer_call")] + internal static extern int TransferCall(IntPtr handle, uint callHandle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_status")] + internal static extern int GetCallStatus(IntPtr handle, int callId, out CallStatusStruct statusInfo); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_status_all")] + internal static extern int GetAllCallStatus(IntPtr handle, CallStatusCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_deflect_call")] + internal static extern int DeflectCall(IntPtr handle, uint callHandle, ref CallDeflectDestStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_volume_info")] + internal static extern int GetCallVolumeInfo(IntPtr handle, SoundDevice device, SoundType type, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_call_volume_info")] + internal static extern int SetCallVolumeInfo(IntPtr handle, ref CallVolumeRecordStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_call_sound_path")] + internal static extern int SetCallSoundPath(IntPtr handle, ref CallSoundPathStruct path, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_call_mute_status")] + internal static extern int SetCallMuteStatus(IntPtr handle, SoundMuteStatus status, SoundMutePath path, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_mute_status")] + internal static extern int GetCallMuteStatus(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_privacy_mode")] + internal static extern int GetCallPrivacyMode(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_call_privacy_mode")] + internal static extern int SetCallPrivacyMode(IntPtr handle, CallPrivacyMode mode, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_call_preferred_voice_subscription")] + internal static extern int SetCallPreferredVoiceSubs(IntPtr handle, CallPreferredVoiceSubscription subscription, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_call_preferred_voice_subscription")] + internal static extern int GetCallPreferredVoiceSubs(IntPtr handle, out CallPreferredVoiceSubscription subscription); + } + + //Oem + internal static class Oem + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_oem_data")] + internal static extern int SendOemData(IntPtr handle, int id, IntPtr data, uint length); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_oem_data_sync")] + internal static extern int SendOemDataSync(IntPtr handle, int id, IntPtr data, uint length, out OemDataStruct info); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_oem_data_async")] + internal static extern int SendOemDataAsync(IntPtr handle, int id, IntPtr data, uint length, TapiResponseCallback cb, IntPtr userData); + } + + //Modem + internal static class Modem + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_process_power_command")] + internal static extern int ProcessPowerCommand(IntPtr handle, PhonePowerCommand cmd, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_flight_mode")] + internal static extern int SetFlightMode(IntPtr handle, PowerFlightModeRequest mode, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_flight_mode")] + internal static extern int GetFlightMode(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_version")] + internal static extern int GetMiscMeVersion(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_version_sync")] + internal static extern IntPtr GetMiscMeVersionSync(IntPtr handle); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_sn")] + internal static extern int GetMiscMeSn(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_sn_sync")] + internal static extern IntPtr GetMiscMeSnSync(IntPtr handle); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_imei")] + internal static extern int GetMiscMeImei(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_misc_me_imei_sync")] + internal static extern string GetMiscMeImeiSync(IntPtr handle); + [DllImport(Libraries.Tapi, EntryPoint = "tel_check_modem_power_status")] + internal static extern int CheckPowerStatus(IntPtr handle, out int result); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_device_info")] + internal static extern int GetDeviceInfo(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + } + + //Sms + internal static class Sms + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_sms")] + internal static extern int SendSms(IntPtr handle, ref SmsDataPackageStruct info, int moreMsg, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_read_sms_in_sim")] + internal static extern int ReadSmsSim(IntPtr handle, int index, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_write_sms_in_sim")] + internal static extern int WriteSmsSim(IntPtr handle, ref SmsDataStruct data, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_delete_sms_in_sim")] + internal static extern int DeleteSmsSim(IntPtr handle, int index, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sms_count")] + internal static extern int GetSmsCount(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sms_cb_config")] + internal static extern int SetSmsCbconfig(IntPtr handle, ref SmsCbConfigStruct config, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sms_cb_config")] + internal static extern int GetSmsCbconfig(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sms_parameters")] + internal static extern int GetSmsParams(IntPtr handle, int index, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sms_parameters")] + internal static extern int SetSmsParams(IntPtr handle, ref SmsParamsStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_send_sms_deliver_report")] + internal static extern int SendSmsDeliverReport(IntPtr handle, ref SmsDataPackageStruct info, SmsResponse response, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sms_sca")] + internal static extern int SetSmsSca(IntPtr handle, ref SmsAddressStruct info, int index, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sms_sca")] + internal static extern int GetSmsSca(IntPtr handle, int index, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sms_memory_status")] + internal static extern int SetSmsMemoryStatus(IntPtr handle, int status, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_sms_message_status")] + internal static extern int SetSmsMsgStatus(IntPtr handle, int index, SmsMessageStatus status, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_sms_parameter_count")] + internal static extern int GetSmsParamCount(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_check_sms_device_status")] + internal static extern int CheckSmsDeviceStatus(IntPtr handle, out int readyStatus); + } + + //Network + internal static class Network + { + [DllImport(Libraries.Tapi, EntryPoint = "tel_select_network_automatic")] + internal static extern int SelectAutoNetwork(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_select_network_manual")] + internal static extern int SelectManualNetwork(IntPtr handle, string plmn, int act, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_search_network")] + internal static extern int SearchNetwork(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_selection_mode")] + internal static extern int GetNetworkSelectMode(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_preferred_plmn")] + internal static extern int SetNetworkPreferredPlmn(IntPtr handle, NetworkPreferredPlmnOp operation, ref NetworkPreferredPlmnStruct info, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_preferred_plmn")] + internal static extern int GetNetworkPreferredPlmn(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_cancel_network_manual_search")] + internal static extern int CancelNetworkManualSearch(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_serving")] + internal static extern int GetNetworkServing(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_mode")] + internal static extern int SetNetworkMode(IntPtr handle, int mode, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_mode")] + internal static extern int GetNetworkMode(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_neighboring_cell_info")] + internal static extern int GetNetworkNeighborCell(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_emergency_callback_mode")] + internal static extern int SetNetworkEmergencyCallback(IntPtr handle, NetworkEmergencyCallbackMode mode, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_roaming_preference")] + internal static extern int SetNetworkRoamPreference(IntPtr handle, NetworkPreferred prefRoam, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_roaming_preference")] + internal static extern int GetNetworkRoamPreference(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_default_data_subscription")] + internal static extern int SetNetworkDefaultDataSubs(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_default_data_subscription")] + internal static extern int GetNetworkDefaultDataSubs(IntPtr handle, out NetworkDefaultDataSubscription subscription); + [DllImport(Libraries.Tapi, EntryPoint = "tel_set_network_default_subscription")] + internal static extern int SetNetworkDefaultSubs(IntPtr handle, TapiResponseCallback cb, IntPtr userData); + [DllImport(Libraries.Tapi, EntryPoint = "tel_get_network_default_subscription")] + internal static extern int GetNetworkDefaultSubs(IntPtr handle, out NetworkDefaultSubscription subscription); + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi.csproj b/src/Tizen.Tapi/Tizen.Tapi.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Tapi/Tizen.Tapi.sln b/src/Tizen.Tapi/Tizen.Tapi.sln new file mode 100755 index 0000000..c699156 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Tapi", "Tizen.Tapi.csproj", "{77F9FF6F-DF82-4A48-AFF8-9031B5065AA5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{79F086CB-DB6C-452F-A15C-274676452682}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{29669E98-429B-4FDD-8E21-85D78B07346F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {77F9FF6F-DF82-4A48-AFF8-9031B5065AA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77F9FF6F-DF82-4A48-AFF8-9031B5065AA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77F9FF6F-DF82-4A48-AFF8-9031B5065AA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77F9FF6F-DF82-4A48-AFF8-9031B5065AA5}.Release|Any CPU.Build.0 = Release|Any CPU + {79F086CB-DB6C-452F-A15C-274676452682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {79F086CB-DB6C-452F-A15C-274676452682}.Debug|Any CPU.Build.0 = Debug|Any CPU + {79F086CB-DB6C-452F-A15C-274676452682}.Release|Any CPU.ActiveCfg = Release|Any CPU + {79F086CB-DB6C-452F-A15C-274676452682}.Release|Any CPU.Build.0 = Release|Any CPU + {29669E98-429B-4FDD-8E21-85D78B07346F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {29669E98-429B-4FDD-8E21-85D78B07346F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {29669E98-429B-4FDD-8E21-85D78B07346F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {29669E98-429B-4FDD-8E21-85D78B07346F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Tapi/Tizen.Tapi/Call.cs b/src/Tizen.Tapi/Tizen.Tapi/Call.cs new file mode 100755 index 0000000..c33adb6 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Call.cs @@ -0,0 +1,1187 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Tapi +{ + /// + /// This class provides functions to manage call related setup and methods. + /// + public class Call + { + private IntPtr _handle; + private Dictionary _response_map = new Dictionary(); + private Interop.Tapi.CallStatusCallback _callStatusCb; + private int _requestId = 0; + + /// + /// A public constructor for Call class to create a Call instance for the given tapi handle. + /// + /// The tapi handle. + public Call(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("TapiHandle parameter is null"); + } + + _handle = handle._handle; + } + + /// + /// Setup the call to be dialled asynchronously. + /// + /// Information of call type and number. + /// A task indicating whether the DialCall method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when CallInformation argument is null. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task DialCall(CallInformation info) + { + if (info != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during call dial setup, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during call dial setup, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + CallInformationStruct callInfoStruct = CallClassConversions.ConvertCallInformationToStruct(info); + int ret = Interop.Tapi.Call.DialCall(_handle, ref callInfoStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to dial call and do the call setup, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("CallInformation argument is null"); + } + } + + /// + /// Supports answering the incoming call by accepting or rejecting the call asynchronously. + /// + /// Unique handle that refer to the call. + /// The answer type. + /// The call id of answer call. This call handle is available to the application through an incoming call(IncomingVoiceCall) event. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// There can be a maximum of one existing call. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task AnswerCall(uint callHandle, CallAnswerType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during answering call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during answering call, " + (TapiError)result)); + return; + } + + CallOperationsStruct ansStruct = Marshal.PtrToStructure(data); + task.SetResult(ansStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.AnswerCall(_handle, callHandle, type, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to answer the incoming call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Releases the call asynchronously irrespective of whether the call is in the hold or active state. + /// + /// Unique handle that refer to the call. + /// The end call type. + /// Instance of CallEndData. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// There should be an existing call in the active/hold state. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task EndCall(uint callHandle, CallEndType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during ending call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during ending call, " + (TapiError)result)); + return; + } + + CallEndStruct endStruct = Marshal.PtrToStructure(data); + CallEndData endDataClass = new CallEndData(endStruct.type, endStruct.id); + task.SetResult(endDataClass); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.EndCall(_handle, callHandle, type, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to end the call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Puts the given call on hold asynchoronously. + /// + /// Unique handle for referring the call. + /// The call id of hold call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// The call should be in the active state. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task HoldCall(uint callHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during putting call on hold, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during putting call on hold, " + (TapiError)result)); + return; + } + + CallOperationsStruct holdStruct = Marshal.PtrToStructure(data); + task.SetResult(holdStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.HoldCall(_handle, callHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to put the call on hold, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Retrieves the call being held asynchoronously. + /// + /// Unique handle for referring the call. + /// The call id of active call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// Call should be in the held state in order to retrieve it into the active state unless no active call is present. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task ActiveCall(uint callHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during retrieving the hold call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during retrieving the hold call, " + (TapiError)result)); + return; + } + + CallOperationsStruct activeStruct = Marshal.PtrToStructure(data); + task.SetResult(activeStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.ActiveCall(_handle, callHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to retrieve the call which was on hold, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Swaps calls asynchoronously. This is only for calls dialed or answered with Telephony. + /// + /// Active call. + /// Held call. + /// The call id of swap call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SwapCall(uint activeCallHandle, uint heldCallHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during swapping calls, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during swapping calls, " + (TapiError)result)); + return; + } + + CallOperationsStruct activeStruct = Marshal.PtrToStructure(data); + task.SetResult(activeStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.SwapCall(_handle, activeCallHandle, heldCallHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to swap the active and held calls, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Starts continuous dtmf by sending a single digit during the call asynchronously. + /// + /// The dtmf digit to be sent. + /// A task indicating whether the StartContDtmfCall method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// An active call should be present. This is to be invoked in the following cases: + /// i. Key Release (post key press) during on-going call. + /// ii. Dtmf digits passed with PAUSE(,) or WAIT(;). + /// In case of PAUSE and WAIT, every StartContDtmfCall() call needs to be followed by StopContDtmfCall() sequentially (for every digit) without waiting for response from StartContDtmfCall(). + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task StartContDtmfCall(byte digit) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during starting continuous dtmf, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during starting continuous dtmf, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.StartContDtmfCall(_handle, digit, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to start continuous dtmf during the call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Stops continuous dtmf during the call asynchronously. + /// + /// A task indicating whether the StopContDtmfCall method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// An active call should be present. This is to be invoked in the following cases: + /// i. Key Release (post key press) during on-going call. + /// ii. Dtmf digits passed with PAUSE(,) or WAIT(;). + /// Every StartContDtmfCall() call needs to be followed by StopContDtmfCall() sequentially. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task StopContDtmfCall() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during stopping continuous dtmf, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during stopping continuous dtmf, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.StopContDtmfCall(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to stop continuous dtmf during the call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Send one or more dtmf digits during the call asynchronously. + /// + /// A burst dtmf info containing dtmf string, pulse width, and inter digit interval. + /// A task indicating whether the SendBurstDtmfCall method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// There will be a single asynchronous notification for all the dtmf digits sent. If the users of this API need an asynchronous + /// response for each dtmf digit then the user has to call this API multiple times passing each single dtmf digit in CallBurstDtmfData. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when CallBurstDtmfData argument is null. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SendBurstDtmfCall(CallBurstDtmfData dtmfData) + { + if (dtmfData != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs while sending dtmf digits, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs while sending dtmf digits, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + CallBurstDtmfStruct callBurstStruct = CallClassConversions.ConvertCallBurstToStruct(dtmfData); + int ret = Interop.Tapi.Call.SendBurstDtmfCall(_handle, ref callBurstStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to send dtmf digits during the call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("CallBurstDtmfData argument is null"); + } + } + + /// + /// Joins the given two calls (one call in the active conversation state and the other call in the held state) into conference asynchronously. + /// + /// Unique handle which is either an active call or a held call. + /// Unique call handle. + /// The call id of join call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// For a multiparty call or for joining two calls into conference, there should be one call in the active state and another call in the held state. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task JoinCall(uint activeCallhandle, uint callHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during joining the two calls, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during joining the two calls, " + (TapiError)result)); + return; + } + + CallOperationsStruct joinStruct = Marshal.PtrToStructure(data); + task.SetResult(joinStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.JoinCall(_handle, activeCallhandle, callHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to join the given two calls into conference, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Triggers splitting a private call from a multiparty call asynchronously. + /// + /// The handle of the call to be made private. The call handle referring to the call that is to be split from the conference. + /// The call id of split call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// The call should be in a multiparty conference call.The split call will be the active call and the conference call will be the held call. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SplitCall(uint callHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during splitting a private call from a multiparty call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during splitting a private call from a multiparty call, " + (TapiError)result)); + return; + } + + CallOperationsStruct splitStruct = Marshal.PtrToStructure(data); + task.SetResult(splitStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.SplitCall(_handle, callHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to split a private call from a multiparty call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Triggers making an explicit call transfer by connecting the two parties where one party is being active(active state) and another party is being held(held state) asynchronously. + /// + /// The call handle of an active call. + /// The call id of transferred call. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// + /// In order to transfer call, served mobile subscriber should have 2 calls, one in the active state and another one in the held state. + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task TransferCall(uint activeCallHandle) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during transferring call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during transferring call, " + (TapiError)result)); + return; + } + + CallOperationsStruct splitStruct = Marshal.PtrToStructure(data); + task.SetResult(splitStruct.id); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.TransferCall(_handle, activeCallHandle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to make explicit call transfer by connecting two calls - active call and held call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Redirects the incoming call to another subscriber asynchronously. + /// + /// Incoming call handle. + /// The destination number. + /// A task indicating whether the DeflectCall method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when destinationNumber argument is invalid. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task DeflectCall(uint incomingCallHandle, byte[] destinationNumber) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + CallDeflectDestStruct deflectStruct = CallClassConversions.ConvertByteDestinationToStruct(destinationNumber); + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during deflecting incoming call, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during deflecting incoming call, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + Marshal.FreeHGlobal(deflectStruct.DestinationNumber); + }; + + int ret = Interop.Tapi.Call.DeflectCall(_handle, incomingCallHandle, ref deflectStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to redirect the incoming call to another subscriber, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets the status of the current call. + /// + /// A unique handle for referring the call. + /// The call status information like destination number, call direction, call type, whether call is in the conference state or not. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public CallStatus GetCallStatus(int callId) + { + CallStatusStruct statusStruct; + int ret = Interop.Tapi.Call.GetCallStatus(_handle, callId, out statusStruct); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the status of the current call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + CallStatus statusData = CallStructConversions.ConvertStatusStruct(statusStruct); + return statusData; + } + + /// + /// Get the list of status of the current call. + /// + /// List of CallStatus. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public IEnumerable GetAllCallStatus() + { + List callStatusList = new List(); + _callStatusCb = (ref CallStatusStruct info, IntPtr userData) => + { + if (!info.Equals(null)) + { + callStatusList.Add(CallStructConversions.ConvertStatusStruct(info)); + } + }; + + int ret = Interop.Tapi.Call.GetAllCallStatus(_handle, _callStatusCb, IntPtr.Zero); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get all status of the current call, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return callStatusList; + } + + /// + /// Get the call volume asynchronously. + /// + /// The sound device. + /// The sound type. + /// Instance of CallVolumeInfo. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task GetCallVolumeInfo(SoundDevice device, SoundType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the call volume, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the call volume, " + (TapiError)result)); + return; + } + + CallVolumeStruct volumeStruct = Marshal.PtrToStructure(data); + CallVolumeInfo volumeInfo = CallStructConversions.ConvertVolumeStruct(volumeStruct); + task.SetResult(volumeInfo); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.GetCallVolumeInfo(_handle, device, type, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the call volume, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Set the call volume asynchronously. + /// + /// The call volume information. + /// A task indicating whether the SetCallVolumeInfo method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when CallVolumeRecord argument is null. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SetCallVolumeInfo(CallVolumeRecord record) + { + if (record != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the call volume, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the call volume, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + CallVolumeRecordStruct volumeStruct = CallClassConversions.ConvertVolumeRecordToStruct(record); + int ret = Interop.Tapi.Call.SetCallVolumeInfo(_handle, ref volumeStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the call volume, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("CallVolumeRecord argument is null"); + } + } + + /// + /// Set the call sound path asynchronously. + /// + /// The call sound path information. + /// A task indicating whether the SetCallSoundPath method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when CallSoundPathInfo argument is null. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SetCallSoundPath(CallSoundPathInfo path) + { + if (path != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the call sound path, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the call sound path, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + CallSoundPathStruct pathStruct = CallClassConversions.ConvertSoundPathToStruct(path); + int ret = Interop.Tapi.Call.SetCallSoundPath(_handle, ref pathStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the call sound path, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("CallSoundPathInfo argument is null"); + } + } + + /// + /// Set the call mute state asynchronously. + /// + /// The call mute status information. + /// A task indicating whether the SetCallMuteStatus method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when CallMuteStatusRecord argument is null. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SetCallMuteStatus(CallMuteStatusRecord record) + { + if (record != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the call mute state, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the call mute state, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.SetCallMuteStatus(_handle, record.Status, record.Path, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the call mute state, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("CallMuteStatusRecord argument is null"); + } + } + + /// + /// Get the call mute state asynchronously. + /// + /// Instance of CallMuteStatusRecord. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task GetCallMuteStatus() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the call mute state, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the call mute state, " + (TapiError)result)); + return; + } + + CallMuteStatusStruct muteStruct = Marshal.PtrToStructure(data); + CallMuteStatusRecord muteStatusRecord = new CallMuteStatusRecord(muteStruct.Path, muteStruct.Status); + task.SetResult(muteStatusRecord); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.GetCallMuteStatus(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the call mute state, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Get the voice privacy mode in the phone asynchronously. + /// + /// CallPrivacyMode value. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task GetCallPrivacyMode() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the voice privacy mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the voice privacy mode, " + (TapiError)result)); + return; + } + + CallPrivacyModeStruct privacyStruct = Marshal.PtrToStructure(data); + CallPrivacyMode mode = privacyStruct.Mode; + task.SetResult(mode); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.GetCallMuteStatus(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the voice privacy mode in the phone, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Set the voice privacy mode in the phone asynchronously. It is available only where a call exists. + /// + /// Voice privacy option mode value. + /// A task indicating whether the SetCallPrivacyMode method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Register the telephony event with proper Notification enum value which is to be listened using RegisterNotiEvent. + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SetCallPrivacyMode(CallPrivacyMode mode) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the voice privacy mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the voice privacy mode, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.SetCallPrivacyMode(_handle, mode, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the voice privacy mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Set the preferred voice subscription asynchronously. + /// + /// Preferred voice subscription value. + /// A task indicating whether the SetCallPreferredVoiceSubscription method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SetCallPreferredVoiceSubscription(CallPreferredVoiceSubscription subscription) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting preferred voice subscription, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting preferred voice subscription, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Call.SetCallPreferredVoiceSubs(_handle, subscription, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set preferred voice subscription, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the preferred voice subscription. + /// + /// CallPreferredVoiceSubscription value. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public CallPreferredVoiceSubscription GetCallPreferredVoiceSubscription() + { + CallPreferredVoiceSubscription subscription; + int ret = Interop.Tapi.Call.GetCallPreferredVoiceSubs(_handle, out subscription); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get preferred voice subscription, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return subscription; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/CallData.cs b/src/Tizen.Tapi/Tizen.Tapi/CallData.cs new file mode 100755 index 0000000..a47b120 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/CallData.cs @@ -0,0 +1,928 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class containing information about call idle status notification data. + /// + public class CallIdleStatusNotificationData + { + internal uint Id; + internal CallEndCause Cause; + + internal CallIdleStatusNotificationData() + { + } + + /// + /// Notification id. + /// + /// Notificatio id in unsigned integer format. + public uint NotiId + { + get + { + return Id; + } + } + + /// + /// End cause for the call indicates whether the call is released normally or due to some other cause. + /// + /// En cause enum value. + public CallEndCause EndCause + { + get + { + return Cause; + } + } + } + + /// + /// A class which contains calling name information. + /// + public class CallerNameInfo + { + internal CallNameMode Mode; + internal string NameData; + + internal CallerNameInfo() + { + } + + /// + /// Display mode of the name. + /// + /// Enum value for call name mode + public CallNameMode NameMode + { + get + { + return Mode; + } + } + + /// + /// Calling party name string. + /// + /// String value representing calling party name. + public string Name + { + get + { + return NameData; + } + } + } + + /// + /// A class which contains details about call information. + /// + public class CallIncomingInfo + { + internal uint Handle; + internal CallType Type; + internal string Number; + internal CallerNameInfo Name; + internal CallCliMode Cli; + internal CallNoCliCause Cause; + internal bool IsFwded; + internal CallActiveLine Line; + + internal CallIncomingInfo() + { + } + + /// + /// Call handle indicates the handle of the call for the application. + /// + /// Call handle represented in unsigned integer format. + public uint CallHandle + { + get + { + return Handle; + } + } + + /// + /// Call type. + /// + /// Call type indicating whether the requested call is a voice or video call. + public CallType CallType + { + get + { + return Type; + } + } + + /// + /// Caller number, null terminated ASCII. + /// + /// A string representing calling party number. + public string CallerNumber + { + get + { + return Number; + } + } + + /// + /// Call name info. If there is no information from the network, this information will be null. + /// + /// A CallerNameInfo which contains information about the calling party name. + public CallerNameInfo NameInfo + { + get + { + return Name; + } + } + + /// + /// CLI mode. + /// + /// Enum value representing CLI mode. + public CallCliMode CliMode + { + get + { + return Cli; + } + } + + /// + /// No CLI cause. + /// + /// Enum value representing the cause for no CLI. + public CallNoCliCause CliCause + { + get + { + return Cause; + } + } + + /// + /// Checks whether the incoming call is a forwarded call or not. + /// + /// True or false. If the incoming call is a forwarded call, then true else false. + public bool IsForwarded + { + get + { + return IsFwded; + } + } + + /// + /// Current Active Line. + /// + /// Enum value representing call active line. + public CallActiveLine ActiveLine + { + get + { + return Line; + } + } + } + + /// + /// A class which contains information about call line control. + /// + public class CallRecordLineControl + { + internal byte PolarityInc; + internal byte Toggle; + internal byte ReversePol; + internal byte PowerTime; + + internal CallRecordLineControl() + { + } + + /// + /// Polarity included. + /// + /// Polarity value represented in byte format. + public byte PolarityIncluded + { + get + { + return PolarityInc; + } + } + + /// + /// Toggle mode. + /// + /// Toggle mode represented in byte format. + public byte ToggleMode + { + get + { + return Toggle; + } + } + + /// + /// Reverse polarity. + /// + /// Reverse polarity value represented in byte format. + public byte ReversePolarity + { + get + { + return ReversePol; + } + } + + /// + /// Power denial time. + /// + /// Time value in byte which represents power denial time. + public byte PowerDenialTime + { + get + { + return PowerTime; + } + } + } + + /// + /// A class which contains information about call record. + /// + public class CallRecord + { + internal uint Id; + internal CallRecordType Type; + internal string Name; + internal string Number; + internal CallRecordLineControl LineCtrl; + + internal CallRecord() + { + } + + /// + /// Call id + /// + /// Call id which is represented in unsigned integer format. + public uint CallId + { + get + { + return Id; + } + } + + /// + /// Call record type. + /// + /// An enum value representing the call record type. + public CallRecordType CallRecordType + { + get + { + return Type; + } + } + + /// + /// Name record. + /// + /// + /// This value will be filled only if CallRecordType is Name, otherwise it is null. + /// + /// Name record represented in string. + public string NameRecord + { + get + { + return Name; + } + } + + /// + /// Number record. + /// + /// + /// This value will be filled only if CallRecordType is Record, otherwise it is null. + /// + /// Number record reprensented in string. + public string NumberRecord + { + get + { + return Number; + } + } + + /// + /// Gets the line control info. + /// + /// + /// This value will be filled only if CallRecordType is LineControl, otherwise it is null. + /// + /// An instance of CallRecordLineControl class. + public CallRecordLineControl LineControlInfo + { + get + { + return LineCtrl; + } + } + } + + /// + /// A class which contains information about call signal notification. + /// + public class CallSignalNotification + { + internal CallAlertSignal Signal; + internal CallAlertPitch Pitch; + internal CallToneSignal Tone; + internal CallIsdnAlertSignal Isdn; + internal CallIs54bAlertSignal Is54b; + + internal CallSignalNotification() + { + } + + /// + /// Gets the call signal type. + /// + /// Signal type of the call represented as CallAlertSignal enum. + public CallAlertSignal SignalType + { + get + { + return Signal; + } + } + + /// + /// Gets the call pitch type. + /// + /// Pitch type of the call represented as CallAlertPitch enum. + public CallAlertPitch PitchType + { + get + { + return Pitch; + } + } + + /// + /// Gets the call signal tone type. + /// + /// + /// This value will be filled only if SignalType is Tone. + /// + /// Signal tone type of the call represented in CallToneSignal enum. + public CallToneSignal ToneType + { + get + { + return Tone; + } + } + + /// + /// Gets the signal ISDN Alert type. + /// + /// + /// This value will be filled only if SignalType is IsdnAlert. + /// + /// Signal ISDN alert type of the call represented in CallIsdnAlertSignal enum. + public CallIsdnAlertSignal IsdnAlertType + { + get + { + return Isdn; + } + } + + /// + /// Gets the signal IS54B alert type. + /// + /// + /// This value will be filled only if SignalType is Is54bAlert. + /// + /// Signal IS54B alerty type of the call represented in CallIs54bAlertSignal enum. + public CallIs54bAlertSignal Is54bAlertType + { + get + { + return Is54b; + } + } + } + + /// + /// A class which contains information about call upgrade/downgrade request of VoLTE call. + /// + public class CallUpgradeDowngradeRequestNoti + { + internal int Handle; + internal CallConfigType Type; + + internal CallUpgradeDowngradeRequestNoti() + { + } + + /// + /// Gets the call handle. + /// + /// Call handle value represented in integer format. + public int CallHandle + { + get + { + return Handle; + } + } + + /// + /// Gets the call upgrade/downgrade config type. + /// + /// Call upgrade/downgrade type represented in CallConfigType enum. + public CallConfigType UpgradeType + { + get + { + return Type; + } + } + } + + /// + /// A class which contains information about an outgoing call. + /// + public class CallInformation + { + private CallType _type; + private EmergencyType _etype; + private string _number; + private CallInformation() + { + } + + /// + /// A parameterized constructor of CallInformation. + /// + /// Type of call(voice, data, video, emergency). + /// Emergency category. + /// Destination phone number. + public CallInformation(CallType type, EmergencyType etype, string phoneNumber) + { + _type = type; + _etype = etype; + _number = phoneNumber; + } + + internal CallType Type + { + get + { + return _type; + } + } + + internal EmergencyType EType + { + get + { + return _etype; + } + } + + internal string PhoneNumber + { + get + { + return _number; + } + } + } + + /// + /// A class which contains information about call end response data. + /// + public class CallEndData + { + private CallEndType _type; + private uint _id; + + private CallEndData() + { + } + + internal CallEndData(CallEndType type, uint id) + { + _type = type; + _id = id; + } + + /// + /// End type. + /// + public CallEndType Type + { + get + { + return _type; + } + } + + /// + /// Id. + /// + public uint Id + { + get + { + return _id; + } + } + } + + /// + /// A class which contains information about burst DTMF in CDMA. + /// + public class CallBurstDtmfData + { + private string _dtmf; + private CallDtmfPulseWidth _width; + private CallDtmfDigitInterval _interval; + + private CallBurstDtmfData() + { + } + + /// + /// A parameterized constructor of CallBurstDtmfData. + /// + /// Burst DTMF string. + /// DTMF Pulse Width. + /// DTMF Inter Digit Interval. + public CallBurstDtmfData(string dtmf, CallDtmfPulseWidth width, CallDtmfDigitInterval interval) + { + _dtmf = dtmf; + _width = width; + _interval = interval; + } + + internal string Dtmf + { + get + { + return _dtmf; + } + } + + internal CallDtmfPulseWidth Width + { + get + { + return _width; + } + } + + internal CallDtmfDigitInterval Interval + { + get + { + return _interval; + } + } + } + + /// + /// A class which contains information about call status. + /// + public class CallStatus + { + private int _handle; + private bool _isMoCall; + private string _number; + private CallType _type; + private CallState _state; + private bool _isConferenceState; + private bool _isVolteCall; + internal CallStatus() + { + } + + /// + /// Call handle. + /// + public int CallHandle + { + get + { + return _handle; + } + + internal set + { + _handle = value; + } + } + + /// + /// Status will be true for MO calls. If MT call, then its false. + /// + public bool IsMoCall + { + get + { + return _isMoCall; + } + + internal set + { + _isMoCall = value; + } + } + + /// + /// Mobile number. + /// + public string PhoneNumber + { + get + { + return _number; + } + + internal set + { + _number = value; + } + } + + /// + /// Type of call(voice, data, emergency). + /// + public CallType Type + { + get + { + return _type; + } + + internal set + { + _type = value; + } + } + + /// + /// Current call state. + /// + public CallState State + { + get + { + return _state; + } + + internal set + { + _state = value; + } + } + + /// + /// Whether call is in conference state. + /// + public bool IsConferenceState + { + get + { + return _isConferenceState; + } + + internal set + { + _isConferenceState = value; + } + } + + /// + /// Whether call is volte call. + /// + public bool IsVolteCall + { + get + { + return _isVolteCall; + } + + internal set + { + _isVolteCall = value; + } + } + } + + /// + /// A class that contains call volume info. + /// + public class CallVolumeRecord + { + private SoundDevice _device; + private SoundType _type; + private SoundVolume _volume; + private CallVolumeRecord() + { + } + + /// + /// A parameterized constructor of CallVolumeRecord. + /// + /// Call sound device. + /// Call sound type. + /// Call sound volume. + public CallVolumeRecord(SoundDevice device, SoundType type, SoundVolume volume) + { + _device = device; + _type = type; + _volume = volume; + } + + /// + /// Call sound device info. + /// + public SoundDevice Device + { + get + { + return _device; + } + } + + /// + /// Call sound type info. + /// + public SoundType Type + { + get + { + return _type; + } + } + + /// + /// Call sound volume info. + /// + public SoundVolume Volume + { + get + { + return _volume; + } + } + } + + /// + /// A class which contains call volume info reponse data. + /// + public class CallVolumeInfo + { + private uint _id; + private IEnumerable _recordList; + + private CallVolumeInfo() + { + } + + internal CallVolumeInfo(uint id, IEnumerable list) + { + _id = id; + _recordList = list; + } + + /// + /// Record number. + /// + public uint RecordId + { + get + { + return _id; + } + } + + /// + /// Volume info record. + /// + public IEnumerable Records + { + get + { + return _recordList; + } + } + } + + /// + /// A class which contains call sound path and volume information. + /// + public class CallSoundPathInfo + { + private SoundPath _path; + private ExtraVolume _exVolume; + private CallSoundPathInfo() + { + } + + /// + /// A parameterized constructor of CallSoundPathInfo. + /// + /// Sound path. + /// Extra volume status. + public CallSoundPathInfo(SoundPath path, ExtraVolume exVolume) + { + _path = path; + _exVolume = exVolume; + } + + internal SoundPath Path + { + get + { + return _path; + } + } + + internal ExtraVolume ExVolume + { + get + { + return _exVolume; + } + } + } + + /// + /// A class which contains call mute status reponse data. + /// + public class CallMuteStatusRecord + { + private SoundMutePath _path; + private SoundMuteStatus _status; + private CallMuteStatusRecord() + { + } + + /// + /// A parameterized constructor of CallMuteStatusRecord. + /// + /// Mute path. + /// Mute status. + public CallMuteStatusRecord(SoundMutePath path, SoundMuteStatus status) + { + _path = path; + _status = status; + } + + public SoundMutePath Path + { + get + { + return _path; + } + } + + public SoundMuteStatus Status + { + get + { + return _status; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/CallEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/CallEnumerations.cs new file mode 100755 index 0000000..37b7671 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/CallEnumerations.cs @@ -0,0 +1,1597 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for call end cause. + /// + public enum CallEndCause + { + /// + /// No Cause. + /// + None = 0x00, + /// + /// Unassigned Number. + /// + UnassignedNumber, + /// + /// No Route to Destination. + /// + NoRouteToDestination, + /// + /// Channel Unacceptable. + /// + ChannelUnaccept, + /// + /// Operator Determined Barring. + /// + OperatorBarring, + /// + /// Normal Call Clearing. + /// + NormalCallClearing, + /// + /// User Busy. + /// + UserBusy, + /// + /// No user responding. + /// + NoUserRespond, + /// + /// User Alerting no Answer. + /// + UserAlertNoAnswer, + /// + /// Call Rejected. + /// + CallRejected, + /// + /// Number Changed. + /// + NumberChanged, + /// + /// Non Selected User Clearing. + /// + NonSelectUserClearing, + /// + /// Destination out of Order. + /// + DestinationOutOfOrder, + /// + /// Invalid Number Format. + /// + InvalidNumberFormat, + /// + /// Facility Rejected. + /// + FacilityRejected, + /// + /// Response to Status Enquiry. + /// + ResponseStatusEnquiry, + /// + /// Normal Unspecified. + /// + NormalUnspecified, + /// + /// No Circuit Channel Available. + /// + NoAvailableChannel, + /// + /// Network out of Order. + /// + NetworkOutOfOrder, + /// + /// Temporary Failure. + /// + TemporaryFailure, + /// + /// Switching Equipment Congestion. + /// + SwitchEquipmentCongestion, + /// + /// Access Information Discarded. + /// + AccessInfoDiscarded, + /// + /// Requested Circuit channel not available. + /// + NotAvailableRequestedChannel, + /// + /// Resources unavailable and unspecified. + /// + ResourceUnavailableUnspecified, + /// + /// Quality of service unavailable. + /// + ServiceQualityUnavailable, + /// + /// Requested facility not subscribed. + /// + NotSubscribedRequestedFacility, + /// + /// Incoming call barred within CUG. + /// + IncomingCallBarredWithinCug, + /// + /// Bearer capability not Authorised. + /// + BearerCapabilityUnauthorised, + /// + /// Bearer capability not presently Available. + /// + BearerCapabilityNotAvailable, + /// + /// Service or Option not available. + /// + ServiceOptionNotAvailable, + /// + /// Service not implemented. + /// + BearerServiceNotImplemented, + /// + /// ACM GEQ ACMAX. + /// + AcmGeqAcmax, + /// + /// Requested facility not implemented. + /// + RequestedFacilityNotImplemented, + /// + /// Restricted digital info BC not available + /// + OnlyRestrictedDigitalBcInfoAvailable, + /// + /// Service or Option not Implemented. + /// + ServiceOptionNotImplemented, + /// + /// Transaction ID value. + /// + TransactionIdValue, + /// + /// Not a member of CUG. + /// + UserNotCugMember, + /// + /// Incompatible Destination. + /// + IncompatibleDestination, + /// + /// Transit Network selection. + /// + TransitNetworkSelect, + /// + /// Semantically Incorrect message. + /// + SemanticIncorrectMessage, + /// + /// Invalid Mandatory Message. + /// + InvalidMandatoryInfo, + /// + /// Message Type Non Existent. + /// + MessageTypeNotExist, + /// + /// Message type not compatible with Prot state. + /// + MessageTypeNotCompatibleWithProtState, + /// + /// IE non exitent or not implemented. + /// + IeNotExistOrNotImplemented, + /// + /// Conditional IE error. + /// + ConditionalIeError, + /// + /// Not Compatible with protocol state. + /// + NotCompatibleWithProtocolState, + /// + /// Recovery on timer expiry. + /// + RecoveryOnTimeExpiry, + /// + /// Protocol error unspecified. + /// + ProtocolErrorUnspecified, + /// + /// Interworking unspecified. + /// + InterworkingUnspecified, + /// + /// Reorder. + /// + Reorder, + /// + /// End unspecified. + /// + EndUnspecified = 128, + /// + /// IMSI unknown in HLR. + /// + RejectCauseImsiUnknownInHlr, + /// + /// Illegal MS. + /// + RejectCauseIllegalMs, + /// + /// IMSI unknown in VLR. + /// + RejectCauseImsiUnknownInVlr, + /// + /// IMEI not accepted. + /// + RejectCauseImeiNotAccepted, + /// + /// Illegal ME. + /// + RejectCauseIllegalMe, + /// + /// GPRS service not allowed. + /// + RejectCauseGprsServiceNotAllowed, + /// + /// GPRS services and Non-GPRS services not allowed. + /// + RejectCauseGprsAndNonGprsServiceNotAllowed, + /// + /// MS device cannot be derived by the network. + /// + RejectCauseMsIdentityNotDerivedByNetwork, + /// + /// Implicitly detached. + /// + RejectCauseImplicitlyDetached, + /// + /// PLMN not allowed. + /// + RejectCausePlmnNotAllowed, + /// + /// LA not allowed. + /// + RejectCauseLaNotAllowed, + /// + /// National roaming not allowed. + /// + RejectCauseNationalRoamingNotAllowed, + /// + /// GPRS services not allowed in this PLMN. + /// + RejectCauseGprsServiceNotAllowedInPlmn, + /// + /// No suitable cells in the LA. + /// + RejectCauseNoSuitableCellsInLa, + /// + /// MSC temporarily not reachable. + /// + RejectCauseMscTempNotReachable, + /// + /// Network unavailable. + /// + RejectCauseNetworkFailure, + /// + /// MAC failure. + /// + RejectCauseMacFailure, + /// + /// SYNCH failure. + /// + RejectCauseSynchFailure, + /// + /// Congestion. + /// + RejectCauseCongestion, + /// + /// GSM Auth unaccepted. + /// + RejectCauseGsmAuthUnaccepted, + /// + /// Service option not supported. + /// + RejectCauseServiceOptionNotSupported, + /// + /// REQ_SERV option not suscribed. + /// + RejectCauseReqServOptionNotSubscribed, + /// + /// Service OPT out of order. + /// + RejectCauseServiceOptOutOfOrder, + /// + /// Call cannot be identified. + /// + RejectCauseCallUnidentified, + /// + /// No PDP context Activated. + /// + RejectCauseNoPdpContextActivated, + /// + /// Retry upon entry into a new call min value. + /// + RejectCauseRetryUponEntryToNewCallMinValue, + /// + /// Retry upon entry into a new call max value. + /// + RejectCauseRetryUponEntryToNewCallMaxValue, + /// + /// Semantically incorret message. + /// + RejectCauseSemanticIncorrectMessage, + /// + /// Invalid mandatory information. + /// + RejectCauseInvalidMandatoryInfo, + /// + /// Message type non-existant. + /// + RejectCauseMessageTypeNotExist, + /// + /// Message type not COMP PRT ST. + /// + RejectCauseMessageTypeNotCompPrtSt, + /// + /// IE non existent. + /// + RejectCauseIeNotExist, + /// + /// MSG not compatible protocol state. + /// + RejectCauseMessageNotCompatibleProtocolState, + /// + /// REJ unspecified. + /// + RejectCauseUnspecified, + /// + /// RR release indication. + /// + RejectCauseRrReleaseInd, + /// + /// Random Access Failure. + /// + RejectCauseRandomAccessFailure, + /// + /// RRC release indication. + /// + RejectCauseRrcReleaseInd, + /// + /// RRC close session indication. + /// + RejectCasueRrcCloseInd, + /// + /// RRC open session failure. + /// + RejectCauseRrcOpenSessionFailure, + /// + /// Low level failure. + /// + RejectCauseLowLevelFail, + /// + /// Low level failure redial not alowed. + /// + RejectCauseLowLevelFailRedialNotAllowed, + /// + /// Low level immediate retry. + /// + RejectCauseLowLevelRetry, + /// + /// Invalid SIM. + /// + RejectCauseInvalidSim, + /// + /// No service. + /// + RejectCauseNoService, + /// + /// Timer T3230 expiry. + /// + RejectCauseTimerT3230Expiry, + /// + /// No cell available. + /// + RejectCauseNoCellAvailable, + /// + /// Wrong state. + /// + RejectCauseWrongState, + /// + /// Access class blocked. + /// + RejectCauseAccessClassBlocked, + /// + /// Abort Message received. + /// + RejectCauseAbortMessageReceived, + /// + /// Other cause. + /// + OtherCause, + /// + /// Timer T303 expiry. + /// + RejectCauseTimerT303Expiry, + /// + /// Rejected due to unavailibilty of resources. + /// + RejectCauseNoResources, + /// + /// MM release pending. + /// + RejectCauseMmReleasePending, + /// + /// Invalid user data. + /// + RejectCauseInvalidUserData, + /// + /// Maximum End Cause limit for GSM/WCDMA. + /// + EndCauseMax = 255, + /// + /// Call Released by User. + /// + CdmaEndCauseReleasedByUser = 0x1001, + /// + /// Call Released by Network. + /// + CdmaEndCauseReleasedByNet, + /// + /// Call Released because the network is busy. + /// + CdmaEndCauseNetworkBusy, + /// + /// Call Released because of No Service area. + /// + CdmaEndCauseNoService, + /// + /// Call Released because of Fading. + /// + CdmaEndCauseFading, + /// + /// Call Released because of reorder. + /// + CdmaEndCauseReleaseByReorder, + /// + /// Call Released because of intercept. + /// + CdmaEndCauseReleaseByIntercept, + /// + /// Call Released because of silent zone retry. + /// + CdmaEndCauseSilentZoneRetry, + /// + /// Call Released because of OTA call failure. + /// + CdmaEndCauseOtaCallFail, + /// + /// Call Released because phone is offline. + /// + CdmaEndCausePhoneOffline, + /// + /// Call Released because CDMA is locked. + /// + CdmaEndCauseCdmaLocked, + /// + /// Call Released because of the flash-is-in-progress error. + /// + CdmaEndCauseFlashInProgressError, + /// + /// Call Released because of the e911 mode. + /// + CdmaEndCauseE911ModeError, + /// + /// Call Released by Others. + /// + CdmaEndCauseOthers, + /// + /// Maximum End Cause limit for CDMA. + /// + CdmaEndCauseMax + } + + /// + /// Enumeration for call type to be used by applications. + /// + public enum CallType + { + /// + /// Voice call type. + /// + Voice, + /// + /// Data call type - (for modem, fax, packet, and other such calls). + /// + Data, + /// + /// Emergency call type. + /// + Emergency + } + + /// + /// Enumeration for the call name mode. + /// + public enum CallNameMode + { + /// + /// This identifier refers to presenting the calling party's name identity to the called party. + /// + Available = 0, + /// + /// This identifier refers to restricting the name identity of the calling party from being presented to the called party. + /// + Restricted = 1, + /// + /// This identifier refers to the unavailability of the calling party's name identity from being offered to the called party. + /// + Unavailable = 2, + /// + /// This identifier refers to offering the calling party's name identity to the called party with which the presentation restriction is overridden. + /// + AvailRestricted = 3 + } + + /// + /// Enumeration for the "Cli mode" value. + /// + public enum CallCliMode + { + /// + /// Presentation Allowed. + /// + PresentationAvailable, + /// + /// Presentation Restricted. + /// + PresentationRestricted, + /// + /// Number not available. + /// + NumberUnavailable, + /// + /// Presentation default. + /// + PresentationDefault + } + + /// + /// Enumeration for "No Cli cause" value. + /// + public enum CallNoCliCause + { + /// + /// None. + /// + None = -1, + /// + /// Unavailable. + /// + Unavailable = 0x00, + /// + /// Rejected by user. + /// + RejectByUser = 0x01, + /// + /// Other services. + /// + InteractionOtherServices = 0x02, + /// + /// Coin line phone. + /// + CoinLinePayPhone = 0x03 + } + + /// + /// Enumeration for call active line(IN GSM ONLY: call identification number). + /// + public enum CallActiveLine + { + /// + /// Line 1. + /// + Line1, + /// + /// Line 2. + /// + Line2 + } + + /// + /// Enumeration for the call record info type. + /// + public enum CallRecordType + { + /// + /// Name type. + /// + Name, + /// + /// Number type. + /// + Number, + /// + /// Line control type. + /// + LineControl + } + + /// + /// Enumeration for the voice privacy option mode. (CDMA only). + /// + public enum CallPrivacyMode + { + /// + /// Standard mode. + /// + Standard = 0x00, + /// + /// Enhanced mode. + /// + Enhanced + } + + /// + /// Enumeration for the OTASP Status. (CDMA only) + /// + public enum CallOtaspStatus + { + /// + /// SPL unlocked ok. + /// + SplUnlockedOk = 0x01, + /// + /// A-Key excess ok. + /// + AKeyExcessOk, + /// + /// SSD update ok. + /// + SsdUpdateOk, + /// + /// NAM download ok. + /// + NamDownloadOk, + /// + /// MDN download ok. + /// + MdnDownloadOk, + /// + /// IMSI download ok. + /// + ImsiDownloadOk, + /// + /// PRL download ok. + /// + PrlDownloadOk, + /// + /// Commit ok. + /// + CommitOk, + /// + /// Programming ok. + /// + ProgrammingOk, + /// + /// Success. + /// + Success, + /// + /// Unsuccess. + /// + Unsuccess, + /// + /// OTAPA verify ok. + /// + OtapaVerifyOk, + /// + /// Progress. + /// + Progress, + /// + /// SPC excess failure. + /// + SpcExcessFailure, + /// + /// Lock code password set. + /// + LockCodePasswordSet + } + + /// + /// Enumeration for the OTAPA status. (CDMA only) + /// + public enum CallOtapaStatus + { + /// + /// Stop. + /// + Stop = 0x00, + /// + /// Start. + /// + Start + } + + /// + /// Enumeration for call sound path. + /// + public enum SoundPath + { + /// + /// Audio path is handset. + /// + Handset = 0x01, + /// + /// Audio path is handset. + /// + Headset = 0x02, + /// + /// Audio path is Handsfree. + /// + Handsfree = 0x03, + /// + /// Audio path is bluetooth. + /// + Bluetooth = 0x04, + /// + /// Audio path is stereo bluetooth. + /// + StereoBluetooth = 0x05, + /// + /// Audio path is speaker phone. + /// + SpeakerPhone = 0x06, + /// + /// Audio path is headset_3_5PI. + /// + Headset35Pi = 0x07, + /// + /// Audio path Bluetooth NSEC is off. + /// + BluetoothNsecOff = 0x08, + /// + /// Audio path Mic one. + /// + Mic1 = 0x09, + /// + /// Audio path Bluetooth Mic two. + /// + Mic2 = 0x0A, + /// + /// Audio path is Bluetooth WB. + /// + BluetoothWb = 0x0B, + /// + /// Audio path is BT nsec off WB. + /// + BluetoothNsecOffWb = 0x0C, + /// + /// Audio path is headset HAC. + /// + HeadsetHac = 0x0D, + /// + /// Audio path is Bikemode Near. + /// + BikemodeNear = 0x17, + /// + /// Audio path is Bikemode Far. + /// + BikemodeFar = 0x18, + /// + /// Audio path is VoLTE handset. + /// + VolteHandset = 0x1F, + /// + /// Audio path is VoLTE headset. + /// + VolteHeadset = 0x20, + /// + /// Audio path is VoLTE Handsfree. + /// + VolteSpeaker = 0x21, + /// + /// Audio path is VoLTE bluetooth. + /// + VolteBluetooth = 0x22, + /// + /// Audio path is VoLTE stereo bluetooth. + /// + VolteStereoBluetooth = 0x23, + /// + /// Audio path is VoLTE speaker phone. + /// + VolteHeadPhone = 0x24, + /// + /// Audio path is VoLTE headset_3_5PI. + /// + VolteHeadset35Pi = 0x25, + /// + /// Audio path VoLTE Bluetooth NSEC is off. + /// + VolteBluetoothNsecOff = 0x26, + /// + /// Audio path is VoLTE Bluetooth WB. + /// + VolteBluetoothWb = 0x27, + /// + /// Audio path is VoLTE BT nsec off WB. + /// + VolteBluetoothNsecOffWb = 0x28, + /// + /// Audio path is VoLTE handset HAC. + /// + VolteHandsetHac = 0x29, + /// + /// Audio path is call forwarding. + /// + CallForward = 0x32, + /// + /// Audio path is Loopback Mic1+Ear. + /// + HeadsetMic1 = 0x33, + /// + /// Audio path is Loopback Mic2+Ear. + /// + HeadsetMic2 = 0x34, + /// + /// Audio path is Loopback Mic3+Ear. + /// + HeadsetMic3 = 0x35 + } + + /// + /// Enumeration for the Alert Signal Type. (CDMA only) + /// + public enum CallAlertSignal + { + /// + /// Tone. + /// + Tone = 0x00, + /// + /// ISDN Alerting. + /// + IsdnAlert, + /// + /// IS54B Alerting. + /// + Is54bAlert, + /// + /// Reserved. + /// + Reserved + } + + /// + /// Enumeration for the Alert Pitch Type. (CDMA only) + /// + public enum CallAlertPitch + { + /// + /// Alert Pitch Medium. + /// + Medium = 0x00, + /// + /// Alert Pitch High. + /// + High, + /// + /// Alert Pitch Low. + /// + Low, + /// + /// Reserved. + /// + Reserved + } + + /// + /// Enumeration for the signals specific to the alert signal type. (CDMA only) + /// + public enum CallToneSignal + { + /// + /// Dial. + /// + Dial = 0x00, + /// + /// Ringback Tone ON. + /// + RingbackToneOn, + /// + /// Intercept Tone ON. + /// + InterceptToneOn, + /// + /// Abbreviation Tone. + /// + AbbreviationTone, + /// + /// Network Congestion Tone ON. + /// + NetworkCongestionToneOn, + /// + /// Abbreviation Network Congestion. + /// + AbbreviationNetworkCongestion, + /// + /// Busy Tone ON> + /// + BusyToneOn, + /// + /// CFRM Tone ON. + /// + CfrmToneOn, + /// + /// Answer Tone ON. + /// + AnswerToneOn, + /// + /// Call Waiting Tone ON. + /// + CallWaitingToneOn, + /// + /// Pipe Tone ON. + /// + PipeToneOn, + /// + /// Tone OFF. + /// + Off + } + + /// + /// Enumeration for the call ISDN Alert signal. (CDMA only) + /// + public enum CallIsdnAlertSignal + { + /// + /// Normal. + /// + Normal = 0x00, + /// + /// Inter group. + /// + InterGroup, + /// + /// Special Priority. + /// + SpecialPriority, + /// + /// ISDN Reserved1. + /// + IsdnReserved1, + /// + /// Ping Ring. + /// + PingRing, + /// + /// ISDN Reserved2. + /// + IsdnReserved2, + /// + /// ISDN Reserved3. + /// + IsdnReserved3, + /// + /// ISDN Reserved4. + /// + IsdnReserved4, + /// + /// Alert OFF. + /// + Off + } + + /// + /// Enumeration for the call IS54B Alert signal types. + /// + public enum CallIs54bAlertSignal + { + /// + /// No Tone. + /// + NoTone = 0x00, + /// + /// Long. + /// + Long, + /// + /// Short Short. + /// + ShortShort, + /// + /// Short Short Long. + /// + ShortShortLong, + /// + /// Short Short 2. + /// + ShortShort2, + /// + /// Short Long Short. + /// + ShortLongShort, + /// + /// Short Short Short Short. + /// + ShortShortShortShort, + /// + /// PBX Long. + /// + PbxLong, + /// + /// PBX(Private Branch Exchange) Short Short. + /// + PbxShortShort, + /// + /// PBX Short Short Long. + /// + PbxShortShortLong, + /// + /// PBX Short Long Short. + /// + PbxShortLongShort, + /// + /// PBX Short Short Short Short. + /// + PbxShortShortShortShort, + /// + /// PIP PIP PIP PIP. + /// + PipPipPipPip + } + + /// + /// Enumeration for call sound ringback tone notification data. + /// + public enum CallSoundRingbackNoti + { + /// + /// Ringback Tone End. + /// + End, + /// + /// Ringback Tone Start. + /// + Start + } + + /// + /// Enumeration for call sound WBAMR notification data. + /// + public enum CallSoundWbamrNoti + { + /// + /// Status OFF. + /// + Off, + /// + /// Status ON. + /// + On, + /// + /// Status OFF 16k. + /// + Off16k, + /// + /// Status ON 8k. + /// + On8k + } + + /// + /// Enumeration for call sound noise reduction. + /// + public enum CallSoundNoiseReduction + { + /// + /// Sound noise reduction off. + /// + Off, + /// + /// Sound noise reduction on. + /// + On + } + + /// + /// Enumeration for call preferred voice subscription. + /// + public enum CallPreferredVoiceSubscription + { + /// + /// Unknown status. + /// + Unknown = -1, + /// + /// Current network. + /// + CurrentNetwork = 0, + /// + /// Ask Always. + /// + AskAlways, + /// + /// Sim 1. + /// + Sim1, + /// + /// Sim 2. + /// + Sim2 + } + + /// + /// Enumeration for specifying type for call upgrade/downgrade. + /// + public enum CallConfigType + { + /// + /// Call type is invalid. + /// + Invalid = -1, + /// + /// Call type is Audio. + /// + Audio = 2, + /// + /// Call type is Video Share TX. + /// + VideoShareTx = 3, + /// + /// Call type is Video Share RX. + /// + VideoShareRx = 4, + /// + /// Call type is Inbound Video Call. + /// + InboundVideoCall = 5, + /// + /// Call type is HD Video. + /// + HdVideo = 6, + /// + /// Call type is Video Conference. + /// + VideoConference = 7, + /// + /// Call type is QCIF Video Conference. + /// + QcifVideoConference = 8, + /// + /// Call type is QVGA. + /// + QvgaVideo = 9, + /// + /// Call type is QCIF Video. + /// + QcifVideo = 10, + /// + /// Call type is tty Full. + /// + TtyFull = 11, + /// + /// Call type is tty HCO. + /// + TtyHco = 12, + /// + /// Call type is tty VCO. + /// + TtyVco = 13, + /// + /// Call type USSD. + /// + Ussd = 14, + /// + /// Call type is HDVideo Land. + /// + HdVideoLand = 15, + /// + /// Call type is E911 - Emergency Call. + /// + E911 = 20, + /// + /// Call type is Audio conference. + /// + AudioConference = 21, + /// + /// Call type is E911 Emergency video call. + /// + E911Video = 22, + /// + /// Call type is E911 Emergency video call HD. + /// + E911VideoHd = 23, + /// + /// Call type is E911 Emergency video call HD Land. + /// + E911VideoHdLand = 24, + /// + /// Call type is E911 Emergency video call Land. + /// + E911VideoLand = 25, + /// + /// Call type is E911 Emergency video call HD QVGA Land. + /// + E911VideoHdQvgaLand = 26, + /// + /// Call type is CIF Video Call. + /// + CifVideo = 27, + /// + /// Call type is HD 720 video call. + /// + Hd720Video = 28, + /// + /// Call type is E911 video hold call. + /// + VideoHold = 29, + /// + /// Call type is switch VOIP to VT call. + /// + VoipToVtInProgress = 30 + } + + /// + /// Enumeration for the emergency call category type. + /// + public enum EmergencyType + { + /// + /// Default case + /// + Default = 0x00, + /// + /// Police emergency + /// + Police = 0x01, + /// + /// Ambulance emergency + /// + Ambulance = 0x02, + /// + /// Firebrigade emergency + /// + FireBrigade = 0x04, + /// + /// Marineguard emergency + /// + MarineGuard = 0x08, + /// + /// Mountain rescue emergency + /// + MountainRescue = 0x10, + /// + /// Manual emergency call + /// + ManualECall = 0x20, + /// + /// Automatic emergency call + /// + AutoECall = 0x40, + /// + /// Unspecified emergency + /// + None = 0xff + } + + /// + /// Enumeration for the call answer type. + /// + public enum CallAnswerType + { + /// + /// Answer an incoming call when there are no current active calls. + /// + Accept, + /// + /// Reject the incoming call. + /// + Reject, + /// + /// Release current active call and accept the waiting call. + /// + Replace, + /// + /// Hold the current active call, and accept the waiting call. + /// + HoldAndAccept + } + + /// + /// Enumeration for the call end type. + /// + public enum CallEndType + { + /// + /// End specific call. + /// + End, + /// + /// End all calls. + /// + EndAll, + /// + /// End all active calls. + /// + ActiveAll, + /// + /// End all held calls. + /// + HoldAll + } + + /// + /// Enumeration for the onlength to send DTMF. + /// + public enum CallDtmfPulseWidth + { + /// + /// 95 ms. + /// + OnLength95ms, + /// + /// 150 ms. + /// + OnLength150ms, + /// + /// 200 ms. + /// + OnLength200ms, + /// + /// 250 ms. + /// + OnLength250ms, + /// + /// 300 ms. + /// + OnLength300ms, + /// + /// 350 ms. + /// + OnLength350ms, + /// + /// Sms. + /// + OnLengthSms + } + + /// + /// Enumeration for the offlength to send DTMF. + /// + public enum CallDtmfDigitInterval + { + /// + /// 60 ms. + /// + OffLength60ms, + /// + /// 100 ms. + /// + OffLength100ms, + /// + /// 150 ms. + /// + OffLength150ms, + /// + /// 200 ms. + /// + OffLength200ms + } + + /// + /// Enumeration for call states. + /// + public enum CallState + { + /// + /// Idle state - i.e. no call. + /// + Idle, + /// + /// Connected and conversation state. + /// + Active, + /// + /// Held State. + /// + Held, + /// + /// Dialing state. + /// + Dialing, + /// + /// Alerting state. + /// + Alert, + /// + /// Incoming state. + /// + Incoming, + /// + /// Answered state, and waiting for connected indication event. + /// + Waiting, + /// + /// Unknown state. + /// + Unknown + } + + /// + /// Enumeration for call sound device type. + /// + public enum SoundDevice + { + /// + /// Device type receiver. + /// + Receiver, + /// + /// Device type speaker. + /// + Speaker, + /// + /// Device type handsfree. + /// + HandsFree, + /// + /// Device type headset. + /// + Headset, + /// + /// Device type bluetooth. + /// + Bluetooth, + /// + /// Device type external. + /// + External + } + + /// + /// Enumeration for call sound type. + /// + public enum SoundType + { + /// + /// Sound type voice. + /// + Voice, + /// + /// Sound type keytone. + /// + Keytone, + /// + /// Sound type bell. + /// + Bell, + /// + /// Sound type message + /// + Message, + /// + /// Sound type alarm + /// + Alarm, + /// + /// Sound type PDA miscellaneous. + /// + PDAMisc + } + + /// + /// Enumeration for call sound volume level. + /// + public enum SoundVolume + { + /// + /// Sound is mute. + /// + Mute = 0x00, + /// + /// Volume level is 1. + /// + Level1 = 0x01, + /// + /// Volume level is 2. + /// + Level2 = 0x02, + /// + /// Volume level is 3. + /// + Level3 = 0x03, + /// + /// Volume level is 4. + /// + Level4 = 0x04, + /// + /// Volume level is 5. + /// + Level5 = 0x05, + /// + /// Volume level is 6. + /// + Level6 = 0x06, + /// + /// Volume level is 7. + /// + Level7 = 0x07, + /// + /// Volume level is 8. + /// + Level8 = 0x08, + /// + /// Volume level is 9. + /// + Level9 = 0x09 + } + + /// + /// Enumeration for call extra volume. + /// + public enum ExtraVolume + { + /// + /// Off. + /// + Off, + /// + /// On. + /// + On + } + + /// + /// Enumeration for call sound mute status. + /// + public enum SoundMuteStatus + { + /// + /// Off. + /// + MuteOff, + /// + /// On. + /// + MuteOn + } + + /// + /// Enumeration for call sound mute path. + /// + public enum SoundMutePath + { + /// + /// Transmit. + /// + TX, + /// + /// Receiver. + /// + RX, + /// + /// All. + /// + All + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/CallStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/CallStructs.cs new file mode 100755 index 0000000..f36f1d5 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/CallStructs.cs @@ -0,0 +1,362 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct CallIdleStatusNotiStruct + { + internal uint Id; + internal CallEndCause Cause; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallIncomingInfoStruct + { + internal uint Handle; + internal CallType Type; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.CallDialNumberMaxLen)] + internal string CallerNumber; + internal CallerName NameData; + internal CallCliMode CliMode; + internal CallNoCliCause CliCause; + internal int IsForwarded; + internal CallActiveLine ActiveLine; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallerName + { + internal CallNameMode NameMode; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.CallNameMaxSize)] + internal string Name; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallRecordLineControlStruct + { + internal byte PolarityIncluded; + internal byte ToggleMode; + internal byte ReversePolarity; + internal byte PowerDenialTime; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct CallRecordDataStruct + { + [MarshalAs(UnmanagedType.LPStr)] + [FieldOffset(0)] + internal IntPtr Name; + [MarshalAs(UnmanagedType.LPStr)] + [FieldOffset(0)] + internal IntPtr Number; + [FieldOffset(0)] + internal CallRecordLineControlStruct LineCtrl; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallRecordStruct + { + internal uint Id; + internal CallRecordType Type; + internal CallRecordDataStruct Data; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct CallSignalStruct + { + [FieldOffset(0)] + internal CallToneSignal SignalTone; + [FieldOffset(0)] + internal CallIsdnAlertSignal IsdnAlert; + [FieldOffset(0)] + internal CallIs54bAlertSignal Is54bAlert; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallSignalInfoStruct + { + internal CallAlertSignal SignalType; + internal CallAlertPitch PitchType; + internal CallSignalStruct CallSignal; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallInformationStruct + { + internal CallType Type; + internal EmergencyType EType; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.CallDialNumberMaxLen)] + internal string PhoneNumber; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallBurstDtmfStruct + { + [MarshalAs(UnmanagedType.LPStr)] + internal string Dtmf; + internal CallDtmfPulseWidth Width; + internal CallDtmfDigitInterval Interval; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallStatusStruct + { + internal int CallHandle; + internal int BMoCall; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.CallDialNumberMaxLen)] + internal string PhoneNumber; + internal CallType Type; + internal CallState State; + internal int BConferenceState; + internal int BVolteCall; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallDeflectDestStruct + { + internal IntPtr DestinationNumber; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallVolumeRecordStruct + { + internal SoundDevice Device; + internal SoundType Type; + internal SoundVolume Volume; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallSoundPathStruct + { + internal SoundPath Path; + internal ExtraVolume ExVolume; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallUpgradeDowngradeNotiStruct + { + internal int CallHandle; + internal CallConfigType ConfigType; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallOperationsStruct + { + internal uint id; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallEndStruct + { + internal CallEndType type; + internal uint id; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallVolumeStruct + { + internal uint number; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.LPStruct)] + internal CallVolumeRecordStruct[] recordList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallMuteStatusStruct + { + internal SoundMutePath Path; + internal SoundMuteStatus Status; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct CallPrivacyModeStruct + { + internal CallPrivacyMode Mode; + } + + internal static class CallStructConversions + { + internal static CallIdleStatusNotificationData ConvertCallIdleStatusNoti(CallIdleStatusNotiStruct idleStatusNoti) + { + CallIdleStatusNotificationData idleStatusNotiData = new CallIdleStatusNotificationData(); + idleStatusNotiData.Id = idleStatusNoti.Id; + idleStatusNotiData.Cause = idleStatusNoti.Cause; + return idleStatusNotiData; + } + + internal static CallIncomingInfo ConvertIncomingCallInfo(CallIncomingInfoStruct incomingInfo) + { + CallIncomingInfo callIncoming = new CallIncomingInfo(); + callIncoming.Handle = incomingInfo.Handle; + callIncoming.Type = incomingInfo.Type; + callIncoming.Number = incomingInfo.CallerNumber; + CallerNameInfo nameData = new CallerNameInfo(); + nameData.Mode = incomingInfo.NameData.NameMode; + nameData.NameData = incomingInfo.NameData.Name; + + callIncoming.Name = nameData; + callIncoming.Cli = incomingInfo.CliMode; + callIncoming.Cause = incomingInfo.CliCause; + if (incomingInfo.IsForwarded == 1) + { + callIncoming.IsFwded = true; + } + + else if (incomingInfo.IsForwarded == 0) + { + callIncoming.IsFwded = false; + } + + callIncoming.Line = incomingInfo.ActiveLine; + + return callIncoming; + } + + internal static CallRecord ConvertCallRecordStruct(CallRecordStruct record) + { + CallRecord recordData = new CallRecord(); + recordData.Id = record.Id; + recordData.Type = record.Type; + if (record.Type == CallRecordType.Name) + { + recordData.Name = Marshal.PtrToStringAnsi(record.Data.Name); + } + + else if (record.Type == CallRecordType.Number) + { + recordData.Number = Marshal.PtrToStringAnsi(record.Data.Number); + } + + else if (record.Type == CallRecordType.LineControl) + { + CallRecordLineControl lineCtrl = new CallRecordLineControl(); + lineCtrl.PolarityInc = record.Data.LineCtrl.PolarityIncluded; + lineCtrl.Toggle = record.Data.LineCtrl.ToggleMode; + lineCtrl.ReversePol = record.Data.LineCtrl.ReversePolarity; + lineCtrl.PowerTime = record.Data.LineCtrl.PowerDenialTime; + recordData.LineCtrl = lineCtrl; + } + + return recordData; + } + + internal static CallSignalNotification ConvertCallSignalInfo(CallSignalInfoStruct signalInfo) + { + CallSignalNotification signalNoti = new CallSignalNotification(); + signalNoti.Signal = signalInfo.SignalType; + signalNoti.Pitch = signalInfo.PitchType; + if (signalInfo.SignalType == CallAlertSignal.Tone) + { + signalNoti.Tone = signalInfo.CallSignal.SignalTone; + } + + else if (signalInfo.SignalType == CallAlertSignal.IsdnAlert) + { + signalNoti.Isdn = signalInfo.CallSignal.IsdnAlert; + } + + else if (signalInfo.SignalType == CallAlertSignal.Is54bAlert) + { + signalNoti.Is54b = signalInfo.CallSignal.Is54bAlert; + } + + return signalNoti; + } + + internal static CallUpgradeDowngradeRequestNoti ConvertCallUpgradeNoti(CallUpgradeDowngradeNotiStruct notiStruct) + { + CallUpgradeDowngradeRequestNoti requestNoti = new CallUpgradeDowngradeRequestNoti(); + requestNoti.Handle = notiStruct.CallHandle; + requestNoti.Type = notiStruct.ConfigType; + return requestNoti; + } + + internal static CallStatus ConvertStatusStruct(CallStatusStruct statusStruct) + { + CallStatus statusData = new CallStatus(); + statusData.CallHandle = statusStruct.CallHandle; + statusData.IsMoCall = Convert.ToBoolean(statusStruct.BMoCall); + statusData.PhoneNumber = statusStruct.PhoneNumber; + statusData.Type = statusStruct.Type; + statusData.State = statusStruct.State; + statusData.IsConferenceState = Convert.ToBoolean(statusStruct.BConferenceState); + statusData.IsVolteCall = Convert.ToBoolean(statusStruct.BVolteCall); + return statusData; + } + + internal static CallVolumeInfo ConvertVolumeStruct(CallVolumeStruct volumeStruct) + { + List records = new List(); + foreach(CallVolumeRecordStruct record in volumeStruct.recordList) + { + records.Add(new CallVolumeRecord(record.Device, record.Type, record.Volume)); + } + + CallVolumeInfo volumeInfo = new CallVolumeInfo(volumeStruct.number, records); + return volumeInfo; + } + } + + internal static class CallClassConversions + { + internal static CallInformationStruct ConvertCallInformationToStruct(CallInformation info) + { + CallInformationStruct callInfoStruct = new CallInformationStruct(); + callInfoStruct.Type = info.Type; + callInfoStruct.EType = info.EType; + callInfoStruct.PhoneNumber = info.PhoneNumber; + return callInfoStruct; + } + + internal static CallBurstDtmfStruct ConvertCallBurstToStruct(CallBurstDtmfData data) + { + CallBurstDtmfStruct callBurstStruct = new CallBurstDtmfStruct(); + callBurstStruct.Dtmf = data.Dtmf; + callBurstStruct.Width = data.Width; + callBurstStruct.Interval = data.Interval; + return callBurstStruct; + } + + internal static CallDeflectDestStruct ConvertByteDestinationToStruct(byte[] number) + { + CallDeflectDestStruct callDeflectStruct = new CallDeflectDestStruct(); + callDeflectStruct.DestinationNumber = Marshal.AllocHGlobal(83); + Marshal.Copy(number, 0, callDeflectStruct.DestinationNumber, Math.Min(83, number.Length)); + return callDeflectStruct; + } + + internal static CallVolumeRecordStruct ConvertVolumeRecordToStruct(CallVolumeRecord record) + { + CallVolumeRecordStruct volumeStruct = new CallVolumeRecordStruct(); + volumeStruct.Device = record.Device; + volumeStruct.Type = record.Type; + volumeStruct.Volume = record.Volume; + return volumeStruct; + } + + internal static CallSoundPathStruct ConvertSoundPathToStruct(CallSoundPathInfo info) + { + CallSoundPathStruct pathStruct = new CallSoundPathStruct(); + pathStruct.Path = info.Path; + pathStruct.ExVolume = info.ExVolume; + return pathStruct; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Modem.cs b/src/Tizen.Tapi/Tizen.Tapi/Modem.cs new file mode 100755 index 0000000..2408faa --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Modem.cs @@ -0,0 +1,442 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Tizen.Tapi +{ + /// + /// This class provides functions for modem services. + /// + public class Modem + { + private IntPtr _handle; + private Dictionary _response_map = new Dictionary(); + private int _requestId = 0; + + /// + /// A public constructor for Modem class to create a Modem instance for the given tapi handle. + /// + /// The tapi handle. + public Modem(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("TapiHandle parameter is null"); + } + + _handle = handle._handle; + } + + /// + /// Turn the modem on/off asynchronously. + /// + /// Power command value. + /// A task indicating whether the ProcessPowerCommand method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task ProcessPowerCommand(PhonePowerCommand cmd) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during turning modem on/off, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during turning modem on/off, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.ProcessPowerCommand(_handle, cmd, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to turn the modem on/off, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Switch the flight mode on/off asynchronously. + /// + /// Flight mode request value. + /// A task indicating whether the SetFlightMode method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task SetFlightMode(PowerFlightModeRequest mode) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if ((mode == PowerFlightModeRequest.Leave && result != (int)PowerFlightModeResponse.Off) || + (mode == PowerFlightModeRequest.Enter && result != (int)PowerFlightModeResponse.On)) + { + Log.Error(TapiUtility.LogTag, "Error occurs during switching flight mode on/off, " + (PowerFlightModeResponse)result); + task.SetException(new InvalidOperationException("Error occurs during switching flight mode on/off, " + (PowerFlightModeResponse)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.SetFlightMode(_handle, mode, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to switch the flight mode on/off, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the flight mode asynchronously. + /// + /// If flight mode is On, it returns true else it returns false. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task GetFlightMode() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the flight mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the flight mode, " + (TapiError)result)); + return; + } + + int mode = Marshal.ReadInt32(data); + if (mode == 1) + { + task.SetResult(true); + } + + else + { + task.SetResult(false); + } + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.GetFlightMode(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the flight mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Get Me version information asynchronously. + /// + /// Instance of MiscVersionInformation. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task GetMiscMeVersion() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the Me version, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the Me version, " + (TapiError)result)); + return; + } + + MiscVersionInfoStruct infoStruct = Marshal.PtrToStructure(data); + MiscVersionInformation versionInfoClass = ModemStructConversions.ConvertVersionStruct(infoStruct); + task.SetResult(versionInfoClass); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.GetMiscMeVersion(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the Me version information, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Misc me version information. + /// + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Returns null in case of failure. + public MiscVersionInformation MiscMeVersionSync + { + get + { + IntPtr info = Interop.Tapi.Modem.GetMiscMeVersionSync(_handle); + MiscVersionInfoStruct infoStruct = Marshal.PtrToStructure(info); + if (infoStruct.Equals(null)) + { + return null; + } + + MiscVersionInformation versionInfoClass = ModemStructConversions.ConvertVersionStruct(infoStruct); + return versionInfoClass; + } + } + + /// + /// Get the Me Esn/Meid for each phone type asynchronously. + /// + /// Instance of MiscSerialNumberInformation. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task GetMiscMeSn() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the Me Esn/Meid, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the Me Esn/Meid, " + (TapiError)result)); + return; + } + + MiscSerialNumInfoStruct infoStruct = Marshal.PtrToStructure(data); + MiscSerialNumberInformation serialNumberClass = ModemStructConversions.ConvertSerialNumberStruct(infoStruct); + task.SetResult(serialNumberClass); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.GetMiscMeSn(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the Me Esn/Meid information for each phone type, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Misc me serial number information. + /// + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Returns null in case of failure. + public MiscSerialNumberInformation MiscMeSnSync + { + get + { + IntPtr info = Interop.Tapi.Modem.GetMiscMeSnSync(_handle); + MiscSerialNumInfoStruct infoStruct = Marshal.PtrToStructure(info); + if (infoStruct.Equals(null)) + { + return null; + } + + MiscSerialNumberInformation versionInfoClass = ModemStructConversions.ConvertSerialNumberStruct(infoStruct); + return versionInfoClass; + } + } + + /// + /// Get the Misc Me Imei asynchronously. + /// + /// The imei string. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task GetMiscMeImei() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the Misc Me Imei, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the Misc Me Imei, " + (TapiError)result)); + return; + } + + task.SetResult(Marshal.PtrToStringAnsi(data)); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.GetMiscMeImei(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the Misc Me Imei information, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Misc me Imei information. + /// + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Returns null in case of failure. + public string MiscMeImeiSync + { + get + { + string imei = Interop.Tapi.Modem.GetMiscMeImeiSync(_handle); + if (imei == null) + { + return null; + } + + return imei; + } + } + + /// + /// Check the modem power status. + /// + /// Phone power status value. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public PhonePowerStatus CheckPowerStatus() + { + int result; + int ret = Interop.Tapi.Modem.CheckPowerStatus(_handle, out result); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to check the modem power status, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return (PhonePowerStatus)result; + } + + /// + /// Get device vendor name and device name of cellular dongle. + /// + /// Instance of MiscDeviceInfo. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// + /// Result can be delivered with only cellular dongle insertion. + /// + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when modem instance is invalid or when method failed due to invalid operation. + public Task GetDeviceInfo() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the device name and vendor name, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the device name and vendor name, " + (TapiError)result)); + return; + } + + MiscDeviceInfoStruct infoStruct = Marshal.PtrToStructure(data); + MiscDeviceInfo deviceInfo = ModemStructConversions.ConvertMiscInfoStruct(infoStruct); + task.SetResult(deviceInfo); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Modem.GetDeviceInfo(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the device vendor name and device name, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/ModemData.cs b/src/Tizen.Tapi/Tizen.Tapi/ModemData.cs new file mode 100755 index 0000000..a7dfe24 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/ModemData.cs @@ -0,0 +1,228 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.Tapi +{ + /// + /// A class containing information about mobile equipment version. + /// + public class MiscVersionInformation + { + internal byte Version; + internal string SwVers; + internal string HwVers; + internal string CalcDate; + internal string ProdCode; + internal string Model; + internal byte PrlNamNum; + internal string PrlVers; + internal byte EriNamNum; + internal string EriVers; + internal MiscVersionInformation() + { + } + + /// + /// Version mask. + /// + public byte VersionMask + { + get + { + return Version; + } + } + + /// + /// Software version. + /// + public string SwVersion + { + get + { + return SwVers; + } + } + + /// + /// Hardware version. + /// + public string HwVersion + { + get + { + return HwVers; + } + } + + /// + /// Calculation date. + /// + public string CalculationDate + { + get + { + return CalcDate; + } + } + + /// + /// Product code. + /// + public string ProductCode + { + get + { + return ProdCode; + } + } + + /// + /// Model id. + /// + public string ModelId + { + get + { + return Model; + } + } + + /// + /// Number of prl nam fields. + /// + public byte PrlNam + { + get + { + return PrlNamNum; + } + } + + /// + /// Prl version (only for CDMA). + /// + public string PrlVersion + { + get + { + return PrlVers; + } + } + + /// + /// Number of Eri nam fields. + /// + public byte EriNam + { + get + { + return EriNamNum; + } + } + + /// + /// Eri version. + /// + public string EriVersion + { + get + { + return EriVers; + } + } + } + + /// + /// A class containing information about mobile serial number. + /// + public class MiscSerialNumberInformation + { + internal string SzEsn; + internal string SzMeid; + internal string SzImei; + internal string SzImeiSv; + internal MiscSerialNumberInformation() + { + } + + /// + /// Esn number. + /// + public string Esn + { + get + { + return SzEsn; + } + } + + /// + /// Meid number. + /// + public string MeId + { + get + { + return SzMeid; + } + } + + /// + /// Imei number. + /// + public string Imei + { + get + { + return SzImei; + } + } + + /// + /// Imeisv number. + /// + public string ImeiSv + { + get + { + return SzImeiSv; + } + } + } + + /// + /// A class containing device information of cellular dongle. + /// + public class MiscDeviceInfo + { + internal string Vendor; + internal string Device; + internal MiscDeviceInfo() + { + } + + /// + /// Vendor name. + /// + public string VendorName + { + get + { + return Vendor; + } + } + + /// + /// Device name. + /// + public string DeviceName + { + get + { + return Device; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/ModemEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/ModemEnumerations.cs new file mode 100755 index 0000000..2b253a4 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/ModemEnumerations.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the phone power status values. + /// + public enum PhonePowerStatus + { + /// + /// Unknown. + /// + Unknown = -1, + /// + /// Power on. + /// + On, + /// + /// Power off. + /// + Off, + /// + /// Power reset. + /// + Reset, + /// + /// Power low. + /// + Low, + /// + /// Error. + /// + Error + } + + /// + /// Enumeration for the phone power reset commands. + /// + public enum PhonePowerCommand + { + /// + /// On. + /// + On = 0, + /// + /// Off. + /// + Off, + /// + /// Reset. + /// + Reset, + /// + /// Low value. + /// + Low, + /// + /// Max value. + /// + Max = Low + } + + /// + /// Enumeration for flight mode request type. + /// + public enum PowerFlightModeRequest + { + /// + /// Off. + /// + Enter = 0x01, + /// + /// On. + /// + Leave, + /// + /// Max value. + /// + Max + } + + /// + /// Enumeration for flight mode request type. + /// + public enum PowerFlightModeResponse + { + /// + /// Flight mode on success. + /// + On = 0x01, + /// + /// Flight mode off success. + /// + Off, + /// + /// Flight mode request fail. + /// + Fail, + /// + /// Max value. + /// + Max + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/ModemStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/ModemStructs.cs new file mode 100755 index 0000000..fbba5d4 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/ModemStructs.cs @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct MiscVersionInfoStruct + { + internal byte Mask; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)] + internal string SwVersion; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)] + internal string HwVersion; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MaxVersionLen)] + internal string CalDate; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscProdCodeMaxLen)] + internal string ProductCode; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.ModelIdMaxLen)] + internal string ModelId; + internal byte PrlNam; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen*3)] + internal string PrlVersion; + internal byte EriNam; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscPrlEriVersionMaxLen * 3)] + internal string EriVersion; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct MiscSerialNumInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)] + internal string Esn; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)] + internal string MeId; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)] + internal string Imei; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeSnMaxLen)] + internal string ImeiSv; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct MiscDeviceInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)] + internal string Vendor; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = TapiUtility.MiscMeDeviceNameMaxLen + 1)] + internal string Device; + } + + internal class ModemStructConversions + { + internal static MiscVersionInformation ConvertVersionStruct(MiscVersionInfoStruct infoStruct) + { + MiscVersionInformation versionInfo = new MiscVersionInformation(); + versionInfo.CalcDate = infoStruct.CalDate; + versionInfo.EriNamNum = infoStruct.EriNam; + versionInfo.EriVers = infoStruct.EriVersion; + versionInfo.HwVers = infoStruct.HwVersion; + versionInfo.SwVers = infoStruct.SwVersion; + versionInfo.PrlNamNum = infoStruct.PrlNam; + versionInfo.PrlVers = infoStruct.PrlVersion; + versionInfo.ProdCode = infoStruct.ProductCode; + versionInfo.Version = infoStruct.Mask; + versionInfo.Model = infoStruct.ModelId; + return versionInfo; + } + + internal static MiscSerialNumberInformation ConvertSerialNumberStruct(MiscSerialNumInfoStruct infoStruct) + { + MiscSerialNumberInformation serialNumberInfo = new MiscSerialNumberInformation(); + serialNumberInfo.SzEsn = infoStruct.Esn; + serialNumberInfo.SzImei = infoStruct.Imei; + serialNumberInfo.SzImeiSv = infoStruct.ImeiSv; + serialNumberInfo.SzMeid = infoStruct.MeId; + return serialNumberInfo; + } + + internal static MiscDeviceInfo ConvertMiscInfoStruct(MiscDeviceInfoStruct infoStruct) + { + MiscDeviceInfo deviceInfo = new MiscDeviceInfo(); + deviceInfo.Vendor = infoStruct.Vendor; + deviceInfo.Device = infoStruct.Device; + return deviceInfo; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Network.cs b/src/Tizen.Tapi/Tizen.Tapi/Network.cs new file mode 100755 index 0000000..886261d --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Network.cs @@ -0,0 +1,812 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Tapi +{ + /// + /// This class provides functions for managing telephony service network. + /// + public class Network + { + private IntPtr _handle; + private Dictionary _response_map = new Dictionary(); + private int _requestId = 0; + + /// + /// A public constructor for Network class to create a Network instance for the given tapi handle. + /// + /// The tapi handle. + public Network(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("TapiHandle parameter is null"); + } + + _handle = handle._handle; + } + + /// + /// Request the lower layers to select the network automatically asynchronously. + /// + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SelectNetworkAutomatic() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during selecting the network, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during selecting the network, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SelectAutoNetwork(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to select the network automatically, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Request the lower layers to select the network which is selected by the user from the network list asynchronously. + /// + /// The user selected plmn. + /// The user selected access technology. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SelectNetworkManual(string plmn, int act) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr data, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during selecting the network, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during selecting the network, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SelectManualNetwork(_handle, plmn, act, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to select the network manually, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Sends a request to do manual search for the available networks and provides the Network List to the user asynchronously. + /// + /// Instance of NetworkPlmnList. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SearchNetwork() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during manual search for the available networks, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during manual search for the available networks, " + (TapiError)result)); + return; + } + + NetworkPlmnListStruct listStruct = Marshal.PtrToStructure(dataResponse); + NetworkPlmnList plmnClass = NetworkStructConversions.ConvertNetworkPlmnListStruct(listStruct); + task.SetResult(plmnClass); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SearchNetwork(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to do manual search for the available networks, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the present network selection mode i.e. automatic or manual asynchronously. + /// + /// Value of NetworkSelectionMode. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task GetNetworkSelectionMode() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the present network selection mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the present network selection mode, " + (TapiError)result)); + return; + } + + task.SetResult((NetworkSelectionMode)Marshal.ReadInt32(dataResponse)); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkSelectMode(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the present network selection mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Set the network preferred plmn asynchronously. + /// + /// The operation to be done on the preferred plmn. + /// The preferred plmn info. + /// A task indicating whether the SetNetworkPreferredPlmn method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when NetworkPreferredPlmnInfo argument is null. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetNetworkPreferredPlmn(NetworkPreferredPlmnOp operation, NetworkPreferredPlmnInfo info) + { + if (info != null) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the network preferred plmn, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the network preferred plmn, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + NetworkPreferredPlmnStruct plmnStruct = NetworkClassConversions.ConvertNetworkPreferredPlmn(info); + int ret = Interop.Tapi.Network.SetNetworkPreferredPlmn(_handle, operation, ref plmnStruct, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the network preferred plmn, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + else + { + throw new ArgumentNullException("NetworkPreferredPlmnInfo argument is null"); + } + } + + /// + /// Get the preferred plmn list asynchronously. + /// + /// List of NetworkPreferredPlmnInfo. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task> GetNetworkPreferredPlmn() + { + TaskCompletionSource> task = new TaskCompletionSource>(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the preferred plmn list, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the preferred plmn list, " + (TapiError)result)); + return; + } + + NetworkPreferredPlmnListStruct plmnStruct = Marshal.PtrToStructure(dataResponse); + IEnumerable plmnInfo = NetworkStructConversions.ConvertNetworkPreferredPlmnStruct(plmnStruct); + task.SetResult(plmnInfo); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkPreferredPlmn(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the preferred plmn list, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Cancel the triggered manual network search asynchronously. + /// + /// A task indicating whether the CancelNetworkManualSearch method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task CancelNetworkManualSearch() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during cancelling the network manual search, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during cancelling the network manual search, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.CancelNetworkManualSearch(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to cancel the network manual search, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the network serving information asynchronously. + /// + /// Instance of NetworkServing. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task GetNetworkServing() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the network serving information, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the network serving information, " + (TapiError)result)); + return; + } + + NetworkServingStruct servStruct = Marshal.PtrToStructure(dataResponse); + NetworkServing servingInfo = NetworkStructConversions.ConvertNetworkServingStruct(servStruct); + task.SetResult(servingInfo); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkServing(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the network serving information, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Set the network mode asynchronously. + /// + /// The network mode. + /// A task indicating whether the SetNetworkMode method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetNetworkMode(NetworkMode mode) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the network mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the network mode, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SetNetworkMode(_handle, (int)mode, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the network mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the network mode asynchronously. + /// + /// Value of NetworkMode. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task GetNetworkMode() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the network mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the network mode, " + (TapiError)result)); + return; + } + + task.SetResult((NetworkMode)Marshal.ReadInt32(dataResponse)); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkMode(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the network mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Get the neighboring cell info asynchronously. + /// + /// Instance of NetworkNeighboringCell. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task GetNeighborCellNetwork() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the neigboring cell info, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the neigboring cell info, " + (TapiError)result)); + return; + } + + NetworkNeighboringCellStruct cellStruct = Marshal.PtrToStructure(dataResponse); + NetworkNeighboringCell cell = NetworkStructConversions.ConvertNeighborCellStruct(cellStruct); + task.SetResult(cell); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkNeighborCell(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the neigboring cell info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Enters or exits the emergency callback mode asynchronously. + /// + /// The emergency callback mode. + /// A task indicating whether the SetEmergencyCallbackMode method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetEmergencyCallbackMode(NetworkEmergencyCallbackMode mode) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the emergency callback mode, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the emergency callback mode, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SetNetworkEmergencyCallback(_handle, mode, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the emergency callback mode, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Set the network roaming preference asynchronously. + /// + /// The network roaming preference. + /// A task indicating whether the SetRoamingPreference method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetRoamingPreference(NetworkPreferred roamPref) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the network roaming preference, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the network roaming preference, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SetNetworkRoamPreference(_handle, roamPref, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the network roaming preference, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the network roaming preference asynchronously. + /// + /// Value of NetworkPreferred. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task GetRoamingPreference() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting the network roaming preference, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during getting the network roaming preference, " + (TapiError)result)); + return; + } + + task.SetResult((NetworkPreferred)Marshal.ReadInt32(dataResponse)); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.GetNetworkRoamPreference(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the network roaming preference, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Set the default data subscription asynchronously. + /// + /// A task indicating whether the SetDefaultDataSubscription method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetDefaultDataSubscription() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the default data subscription, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the default data subscription, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SetNetworkDefaultDataSubs(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the default data subscription, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the default data subscription. + /// + /// Value of NetworkDefaultDataSubscription. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public NetworkDefaultDataSubscription GetDefaultDataSubscription() + { + NetworkDefaultDataSubscription defaultDataSubs; + int ret = Interop.Tapi.Network.GetNetworkDefaultDataSubs(_handle, out defaultDataSubs); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the default data subscription, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return defaultDataSubs; + } + + /// + /// Set the default subscription for voice asynchronously. + /// + /// A task indicating whether the SetNetworkDefaultSubscription method is done or not. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public Task SetNetworkDefaultSubscription() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting the default subscription for voice, " + (TapiError)result); + task.SetException(new InvalidOperationException("Error occurs during setting the default subscription for voice, " + (TapiError)result)); + return; + } + + task.SetResult(true); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int ret = Interop.Tapi.Network.SetNetworkDefaultDataSubs(_handle, _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set the default subscription for voice, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Get the default subscription for voice. + /// + /// Value of NetworkDefaultSubscription. + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when network instance is invalid or when method failed due to invalid operation. + public NetworkDefaultSubscription GetNetworkDefaultSubscription() + { + NetworkDefaultSubscription defaultSubs; + int ret = Interop.Tapi.Network.GetNetworkDefaultSubs(_handle, out defaultSubs); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get the default subscription, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return defaultSubs; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/NetworkData.cs b/src/Tizen.Tapi/Tizen.Tapi/NetworkData.cs new file mode 100755 index 0000000..ed4a3ba --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/NetworkData.cs @@ -0,0 +1,1275 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines network registration status. + /// + public class NetworkRegistrationStatus + { + internal NetworkServiceLevel Cs; + internal NetworkServiceLevel Ps; + internal NetworkServiceType SvcType; + internal bool Roaming; + + internal NetworkRegistrationStatus() + { + } + + /// + /// Circuit Switched status. + /// + /// Status of circuit switched data. + public NetworkServiceLevel CircuitStatus + { + get + { + return Cs; + } + } + + /// + /// Packet Switched status. + /// + /// Status of packet switched data. + public NetworkServiceLevel PacketStatus + { + get + { + return Ps; + } + } + + /// + /// Registration service type. + /// + /// Service type represented in NetworkServiceType enum. + public NetworkServiceType Type + { + get + { + return SvcType; + } + } + + /// + /// Roaming status + /// + /// Boolean value to check the roaming status. + public bool IsRoaming + { + get + { + return Roaming; + } + } + } + + /// + /// A class which defines network cell info notification. + /// + public class NetworkCellNoti + { + internal int Location; + internal int Id; + + internal NetworkCellNoti() + { + } + + /// + /// Location Area Code (In case of LTE network, it represents Tracking Area Code). + /// + /// Location area code represented in integer. + public int Lac + { + get + { + return Location; + } + } + + /// + /// Cell ID. + /// + /// Cell id represented in integer. + public int CellId + { + get + { + return Id; + } + } + } + + /// + /// A class which defines network change notification. + /// + public class NetworkChangeNoti + { + internal NetworkSystemType Type; + internal string NwPlmn; + + internal NetworkChangeNoti() + { + } + + /// + /// Access technology. + /// + /// Access technology represented in NetworkSystemType enum. + public NetworkSystemType Act + { + get + { + return Type; + } + } + + /// + /// Network PLMN. + /// + /// Plmn value represented as string. + public string Plmn + { + get + { + return NwPlmn; + } + } + } + + /// + /// A class which defines network time notification. + /// + public class NetworkTimeNoti + { + internal DateTime TimeInfo; + internal int WDayInfo; + internal int GmtOffInfo; + internal int DstOffInfo; + internal bool Dst; + internal string NetworkPlmn; + + internal NetworkTimeNoti() + { + } + + /// + /// Date time information. + /// + /// An instance of DateTime representing date time information. + public DateTime Time + { + get + { + return TimeInfo; + } + } + + /// + /// Wday information. + /// + /// Wday info represented in integer. + public int WDay + { + get + { + return WDayInfo; + } + } + + /// + /// GMT Off. + /// + /// GMT off info represented in integer. + public int GmtOff + { + get + { + return GmtOffInfo; + } + } + + /// + /// DST Off. + /// + /// DST off info represented in integer. + public int DstOff + { + get + { + return DstOffInfo; + } + } + + /// + /// Flag for checking if it is DST. + /// + /// Boolean value to check if the time is DST or not. + public bool IsDst + { + get + { + return Dst; + } + } + + /// + /// Network PLMN. + /// + /// PLMN value represented in string. + public string Plmn + { + get + { + return NetworkPlmn; + } + } + } + + /// + /// A class which defines network identity notification. + /// + public class NetworkIdentityNoti + { + internal string NwPlmn; + internal string NwShortName; + internal string NwFullName; + + internal NetworkIdentityNoti() + { + } + + /// + /// Network PLMN. + /// + /// Plmn value represented in string. + public string Plmn + { + get + { + return NwPlmn; + } + } + + /// + /// Short network name. + /// + /// Short name of the network in string. + public string ShortName + { + get + { + return NwShortName; + } + } + + /// + /// Full network name. + /// + /// Full name of the network in string. + public string FullName + { + get + { + return NwFullName; + } + } + } + + /// + /// A class which defines network VoLTE status notification. + /// + public class NetworkVolteStatus + { + internal bool NwIsRegistered; + internal int NwFeatureMask; + internal VolteNetworkType NwType; + + internal NetworkVolteStatus() + { + } + + /// + /// VoLTE status. + /// + /// Boolean value to check if it is registered. + public bool IsRegistered + { + get + { + return NwIsRegistered; + } + } + + /// + /// Services registered for. + /// + /// Service mask represented in integer. + public int FeatureMask + { + get + { + return NwFeatureMask; + } + } + + /// + /// Network on which VoLTE is registered. + /// + /// Type of VoLTE network represented in VolteNetworkType enum. + public VolteNetworkType Type + { + get + { + return NwType; + } + } + } + + /// + /// A class which defines network identity. + /// + public class NetworkIdentity + { + internal string IdName; + internal string SvcProviderName; + internal string PlmnName; + internal uint Id; + internal NetworkPlmnType PlmnNwType; + internal NetworkSystemType SysType; + internal NetworkIdentity() + { + } + + /// + /// Network name. + /// + public string Name + { + get + { + return IdName; + } + } + + /// + /// Service provider name. + /// + public string ServiceProviderName + { + get + { + return SvcProviderName; + } + } + + /// + /// Network plmn. + /// + public string Plmn + { + get + { + return PlmnName; + } + } + + /// + /// Plmn Id. + /// + public uint PlmnId + { + get + { + return Id; + } + } + + /// + /// Plmn type. + /// + public NetworkPlmnType PlmnType + { + get + { + return PlmnNwType; + } + } + + /// + /// Access technology. + /// + public NetworkSystemType SystemType + { + get + { + return SysType; + } + } + } + + /// + /// A class for the network plmn list. + /// + public class NetworkPlmnList + { + internal byte NwCount; + internal IEnumerable NwList; + + internal NetworkPlmnList() + { + } + + /// + /// Network plmn count. + /// + /// Count of the network plmn. + public byte NetworkCount + { + get + { + return NwCount; + } + } + + /// + /// Network list. + /// + /// List of NetworkIdentity. + public IEnumerable NetworkList + { + get + { + return NwList; + } + } + } + + /// + /// A class which defines the preferred plmn information. + /// + public class NetworkPreferredPlmnInfo + { + internal byte idex; + internal string NwPlmn; + internal string NwName; + internal string SvcProvName; + internal NetworkSystemType SysType; + + /// + /// Preferred plmn list index. + /// + ///Index of preferred plmn list. + public byte Index + { + get + { + return idex; + } + + set + { + idex = value; + } + } + + /// + /// Preferred plmn. + /// + /// Plmn string. + public string Plmn + { + get + { + return NwPlmn; + } + + set + { + NwPlmn = value; + } + } + + /// + /// Network name. + /// + /// Name of network. + public string NetworkName + { + get + { + return NwName; + } + + set + { + NwName = value; + } + } + + /// + /// Service provider name. + /// + /// Name of service provider. + public string ServiceProviderName + { + get + { + return SvcProvName; + } + + set + { + SvcProvName = value; + } + } + + /// + /// System type of network. + /// + /// System type of network. + public NetworkSystemType SystemType + { + get + { + return SysType; + } + + set + { + SysType = value; + } + } + } + + /// + /// A class containing information related to a cdma system. + /// + public class NetworkCdmaSysInfo + { + internal int Car; + internal uint SysId; + internal uint NwId; + internal uint BaseStnId; + internal int BaseStnLatitude; + internal int BaseStnLongitude; + internal uint RegZone; + internal uint Offset; + internal NetworkCdmaSysInfo() + { + } + + /// + /// Cdma carrier. + /// + /// Cdma carrier. + public int Carrier + { + get + { + return Car; + } + } + + /// + /// System Id. + /// + /// System Id. + public uint SystemId + { + get + { + return SysId; + } + } + + /// + /// Network Id. + /// + /// Id of network. + public uint NetworkId + { + get + { + return NwId; + } + } + + /// + /// Base station Id. + /// + /// Id of base station. + public uint BaseStationId + { + get + { + return BaseStnId; + } + } + + /// + /// Latitude of the current base station. + /// + /// Latitude of the current base station. + public int BaseStationLatitude + { + get + { + return BaseStnLatitude; + } + } + + /// + /// Longitude of the current base station. + /// + /// Longitude of the current base station. + public int BaseStationLongitude + { + get + { + return BaseStnLongitude; + } + } + + /// + /// Registration zone. + /// + /// Registration zone. + public uint RegistrationZone + { + get + { + return RegZone; + } + } + + /// + /// Pilot offset. + /// + /// Offset of pilot. + public uint PilotOffset + { + get + { + return Offset; + } + } + } + + /// + /// A class containing information about network area. + /// + public class NetworkAreaInfo + { + internal int Code; + internal NetworkCdmaSysInfo Cdma; + internal NetworkAreaInfo() + { + } + + /// + /// Location area code. + /// + /// Area code of location. + public int Lac + { + get + { + return Code; + } + } + + /// + /// Instance of NetworkCdmaSysInfo. + /// + /// Instance of NetworkCdmaSysInfo. + public NetworkCdmaSysInfo CdmaInfo + { + get + { + return Cdma; + } + } + } + + /// + /// A class containing information of serving network. + /// + public class NetworkServing + { + internal NetworkSystemType Type; + internal string NwPlmn; + internal NetworkAreaInfo Area; + internal NetworkServing() + { + } + + /// + /// Access technology. + /// + /// System type of network. + public NetworkSystemType SystemType + { + get + { + return Type; + } + } + + /// + /// Network plmn. + /// + /// Plmn of network. + public string Plmn + { + get + { + return NwPlmn; + } + } + + /// + /// Area information of network. + /// + /// Instance of NetworkAreaInfo. + public NetworkAreaInfo AreaInfo + { + get + { + return Area; + } + } + } + + /// + /// A class containing information of cdma cell. + /// + public class NetworkCdmaCell + { + internal uint SysId; + internal uint NwId; + internal uint BaseStnId; + internal uint RefPn; + internal int BaseStnLatitude; + internal int BaseStnLongitude; + internal NetworkCdmaCell() + { + } + + /// + /// System Id info. + /// + /// System Id. + public uint SystemId + { + get + { + return SysId; + } + } + + /// + /// Network Id. + /// + /// Network Id. + public uint NetworkId + { + get + { + return NwId; + } + } + + /// + /// Base station Id. + /// + /// Base station id. + public uint BaseStationId + { + get + { + return BaseStnId; + } + } + + /// + /// Reference pn. + /// + /// Reference pn. + public uint ReferencePn + { + get + { + return RefPn; + } + } + + /// + /// Latitude of the current base station. + /// + /// Latitude of the current base station. + public int BaseStationLatitude + { + get + { + return BaseStnLatitude; + } + } + + /// + /// Longitude of the current base station. + /// + /// Longitude of the current base station. + public int BaseStationLongitude + { + get + { + return BaseStnLongitude; + } + } + } + + /// + /// A class containing information of lte cell. + /// + public class NetworkLteCell + { + internal int Id; + internal int Lc; + internal int PId; + internal int Erf; + internal int Tc; + internal int Rs; + internal NetworkLteCell() + { + } + + /// + /// Value of cell Id. -1 indicates that cell Id information is not present. + /// + /// Cell Id. + public int CellId + { + get + { + return Id; + } + } + + /// + /// Location area code. This field is ignored when CellId is not present. + /// + /// Code of area. + public int Lac + { + get + { + return Lc; + } + } + + /// + /// Physical cell id info. + /// + /// Physical cell id. + public int PhysicalId + { + get + { + return PId; + } + } + + /// + /// E-Utra absolute rf channel number. + /// + /// E-Utra absolute rf channel number. + public int Earfcn + { + get + { + return Erf; + } + } + + /// + /// Tracking area code. + /// + /// Area code for tracking. + public int Tac + { + get + { + return Tc; + } + } + + /// + /// Rssi in dBm(signed) + /// + /// Rssi in dBm. + public int Rssi + { + get + { + return Rs; + } + } + } + + /// + /// A class containing information of umts cell. + /// + public class NetworkUmtsCell + { + internal int Id; + internal int Lc; + internal int Arf; + internal int Ps; + internal int Rsc; + internal NetworkUmtsCell() + { + } + + /// + /// Ucid. -1 indicates that cell Id information is not present. + /// + /// RNCID + Cell ID(16 bit). + public int CellId + { + get + { + return Id; + } + } + + /// + /// Location area code. This field is ignored when CellId is not present. + /// + /// Code of area. + public int Lac + { + get + { + return Lc; + } + } + + /// + /// Utra absolute rf channel number. + /// + /// Utra absolute rf channel number. + public int Arfcn + { + get + { + return Arf; + } + } + + /// + /// Primary scrambling code. + /// + /// Primary scrambling code. + public int Psc + { + get + { + return Ps; + } + } + + /// + /// Received signal code power. Valid values are (0-96, 255). + /// + /// Power of received signal code. + public int Rscp + { + get + { + return Rsc; + } + } + + } + + /// + /// A class containing information of geran cell. + /// + public class NetworkGeranCell + { + internal int Id; + internal int Lc; + internal int Bc; + internal int Bs; + internal int Rx; + internal NetworkGeranCell() + { + } + + /// + /// Value of cell Id. -1 indicates that cell Id information is not present. + /// + /// Cell Id. + public int CellId + { + get + { + return Id; + } + } + + /// + /// Location area code. This field is ignored when CellId is not present. + /// + /// Code of area. + public int Lac + { + get + { + return Lc; + } + } + + /// + /// Broadcast control channel frequency number. + /// + /// Broadcast control channel frequency number. + public int Bcch + { + get + { + return Bc; + } + } + + /// + /// Base station identification code. + /// + /// Id code of base station. + public int Bsic + { + get + { + return Bs; + } + } + + /// + /// Received signal strength level. Valid values are (0-63, 99). + /// + /// Strength of received signal. + public int Rxlev + { + get + { + return Rx; + } + } + } + + /// + /// A class which contains geran, umts, cdma and lte cell information. + /// + public class Cell + { + internal NetworkGeranCell Geran; + internal NetworkCdmaCell Cdma; + internal NetworkUmtsCell Umts; + internal NetworkLteCell Lte; + internal Cell() + { + } + + /// + /// Geran cell information. + /// + /// Instance of NetworkGeranCell. + public NetworkGeranCell GeranCell + { + get + { + return Geran; + } + } + + /// + /// Cdma cell information. + /// + /// Instance of NetworkCdmaCell. + public NetworkCdmaCell CdmaCell + { + get + { + return Cdma; + } + } + + /// + /// Umts cell information. + /// + /// Instance of NetworkUmtsCell. + public NetworkUmtsCell UmtsCell + { + get + { + return Umts; + } + } + + /// + /// Lte cell information. + /// + /// Instance of NetworkLteCell. + public NetworkLteCell LteCell + { + get + { + return Lte; + } + } + } + + /// + /// A class which contains serving cell information. + /// + public class NetworkServingCell + { + internal NetworkSystemType SysType; + internal int MCountryCode; + internal int MNwCode; + internal Cell Info; + internal NetworkServingCell() + { + } + + /// + /// Access technology. + /// + /// Network system type. + public NetworkSystemType SystemType + { + get + { + return SysType; + } + } + + /// + /// Mobile country code. + /// + /// Country code of the mobile. + public int MobileCountryCode + { + get + { + return MCountryCode; + } + } + + /// + /// Mobile network code. + /// + /// Network code of the mobile. + public int MobileNetworkCode + { + get + { + return MNwCode; + } + } + + /// + /// Information of cell. + /// + ///Instance of Cell. + public Cell CellInfo + { + get + { + return Info; + } + } + } + + /// + /// A class which contains neighboring cell information. + /// + public class NetworkNeighboringCell + { + internal NetworkServingCell ServCell; + internal IEnumerable GrList; + internal IEnumerable UmtList; + internal IEnumerable LtList; + internal NetworkNeighboringCell() + { + } + + /// + /// Serving cell information. + /// + /// Instance of NetworkServingCell. + public NetworkServingCell ServingCell + { + get + { + return ServCell; + } + } + + /// + /// Geran cell info list. + /// + /// List of NetworkGeranCell. + public IEnumerable GeranList + { + get + { + return GrList; + } + } + + /// + /// Umts cell info list. + /// + /// List of NetworkUmtsCell. + public IEnumerable UmtsList + { + get + { + return UmtList; + } + } + + /// + /// Lte cell info list. + /// + /// List of NetworkLteCell. + public IEnumerable LteList + { + get + { + return LtList; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/NetworkEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/NetworkEnumerations.cs new file mode 100755 index 0000000..f047dfb --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/NetworkEnumerations.cs @@ -0,0 +1,490 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the status of the network service. + /// + public enum NetworkServiceLevel + { + /// + /// No service available in the network ME is camped. + /// + No, + /// + /// Only emergency service available in the network ME is camped. + /// + Emergency, + /// + /// FULL service available in the network ME is camped + /// + Full, + /// + /// Searching for service. + /// + Search + } + + /// + /// Enumeration for the service types of TAPI. + /// + public enum NetworkServiceType + { + /// + /// Service type is Unknown. + /// + Unknown = 0x0, + /// + /// No Service available. + /// + NoService, + /// + /// Service type is Emergency. + /// + Emergency, + /// + /// Service type is Searching. + /// + Search, + /// + /// Service type is 2G. In case of CDMA, service type is set to 2G when System Type is IS95A/IS95B/CDMA_1X. + /// + Type2G, + /// + /// Service type is 2.5G. + /// + Type2And5G, + /// + /// Service type is 2.5G (EDGE). + /// + TypeAnd5GEdge, + /// + /// Service type is 3G. In case of CDMA, service type is set to 3G when System Type is EVDO_REV_0/REV_A/REV_B/EHRPD. + /// + Type3G, + /// + /// Service type is HSDPA. + /// + Hsdpa, + /// + /// Service type is LTE. + /// + Lte + } + + /// + /// Enumeration for the system types of network. + /// + public enum NetworkSystemType + { + /// + /// No Service available. + /// + NoService = 0x01, + /// + /// Available service is GSM. + /// + Gsm, + /// + /// Available service is GPRS. + /// + Gprs, + /// + /// Available service is EGPRS. + /// + EGprs, + /// + /// Available service is PCS1900 band. + /// + Pcs1900, + /// + /// Available service is UMTS. + /// + Umts, + /// + /// Both GSM and UMTS systems available. + /// + GsmandUmts, + /// + /// Available service is HSDPA. + /// + Hsdpa, + /// + /// Available service is IS95A. + /// + Is95A, + /// + /// Available service is IS95B. + /// + Is95B, + /// + /// Available service is CDMA 1X. + /// + Cdma1x, + /// + /// Available service is EV-DO rev0. + /// + EvdoRev0, + /// + /// Available service is 1X and EV-DO rev0. + /// + Hybrid1xandEvdoRev0, + /// + /// Available service is EV-DO revA. + /// + EvdoRevA, + /// + /// Available service is 1X and EV-DO revA. + /// + Hybrid1xandEvdoRevA, + /// + /// Available service is EV-DO revB. + /// + EvdoRevB, + /// + /// Available service is 1X and EV-DO revB. + /// + Hybrid1xandEvdoRevB, + /// + /// Available service is EV-DV. + /// + Evdv, + /// + /// Available service is EHRPD. + /// + Ehrpd, + /// + /// Available service is LTE. + /// + Lte + } + + /// + /// Enumeration for the network emergency callback mode states (3GPP2 specific enum). + /// + public enum NetworkEmergencyCallbackMode + { + /// + /// Enter emergency callback mode. + /// + Enter, + /// + /// Exit emergency callback mode. + /// + Exit + } + + /// + /// Enumeration for the possible default Data Subscriptions. + /// + public enum NetworkDefaultDataSubscription + { + /// + /// Unknown status. + /// + Unknown = -1, + /// + /// SIM 1. + /// + Sim1 = 0, + /// + /// SIM 2. + /// + Sim2 + } + + /// + /// Enumeration for the possible default Subscriptions for CS (Voice). + /// + public enum NetworkDefaultSubscription + { + /// + /// Unknown status. + /// + Unknown = -1, + /// + /// SIM 1 network. + /// + Sim1 = 0, + /// + /// SIM 2 network. + /// + Sim2 + } + + /// + /// Enumeration for type of network on which VoLTE is registered. + /// + public enum VolteNetworkType + { + /// + /// Unknown. + /// + Unknown, + /// + /// Mobile. + /// + Mobile, + /// + /// WiFi. + /// + Wifi + } + + /// + /// Enumeration for the packet service protocol type. + /// + public enum NetworkPsType + { + /// + /// Unknown PS type. + /// + Unknown, + /// + /// HSDPA. + /// + Hsdpa, + /// + /// HSUPA. + /// + Hsupa, + /// + /// HSPA. + /// + Hspa, + /// + /// HSPAP. + /// + Hspap + } + + /// + /// Enumeration for the network name display condition type. + /// + public enum NetworkNameDisplayCondition + { + /// + /// Invalid Display Condition. + /// + Invalid = 0x00, + /// + /// Display Condition is SPN. + /// + Spn = 0x01, + /// + /// Display Condition is PLMN. + /// + Plmn = 0x02, + /// + /// Display Condition is SPN or PLMN. + /// + SpnOrPlmn = 0x03 + } + + /// + /// Enumeration for the different serving network LTE band type. + /// + public enum NetworkLteBandType + { + /// + /// Unknown. + /// + Unknown = 0x00, + /// + /// FDD. + /// + Fdd, + /// + /// TDD. + /// + Tdd + } + + /// + /// Enumeration for the operation that can be done on a preferred PLMN. + /// + public enum NetworkPreferredPlmnOp + { + /// + /// Addition to the Network Preferred PLMN list. + /// + Add = 0x01, + /// + /// Edit the network Preferred PLMN list. + /// + Edit, + /// + /// Delete the entry to the network Preferred PLMN list. + /// + Delete + } + + /// + /// Enumeration for the CDMA Preferred Network Type(CDMA only). + /// + public enum NetworkPreferred + { + /// + /// Home only. + /// + HomeOnly, + /// + /// Affiliated. + /// + Affiliated, + /// + /// Automatic. + /// + Automatic, + /// + /// Automatic-A. + /// + AutomaticA, + /// + /// Automatic-B. + /// + AutomaticB, + /// + /// Roam domestic. + /// + RoamDomestic, + /// + /// Roam international. + /// + RoamInternational, + /// + /// Roam dual. + /// + RoamDual, + /// + /// Blank. + /// + Blank + } + + /// + /// Enumeration for the different network operation causes. + /// + public enum NetworkOperationCause + { + /// + /// No error for any operation. + /// + NoError, + /// + /// Aborted. + /// + Aborted, + /// + /// Error. + /// + Failed, + /// + /// Phone is in use(eg: Voice / Data call in progress). + /// + PhoneInUse, + /// + /// Phone is in offline mode. + /// + Offline, + /// + /// Modem is unable to process the config settings information. + /// + ConfigSettingsFailure, + /// + /// Internal failure. + /// + InternalFailure, + /// + /// Memory is full. + /// + MemoryFull + } + + /// + /// Enumeration for the network plmn type. + /// + public enum NetworkPlmnType + { + /// + /// Unknown. + /// + Unknown, + /// + /// Home plmn. + /// + Home, + /// + /// Available. + /// + Available, + /// + /// Forbidden. + /// + Forbidden + } + + /// + /// Enumeration for the network selection mode. + /// + public enum NetworkSelectionMode + { + /// + /// Automatic selection mode. + /// + Auto, + /// + /// Manual selection mode (Not applicable to CDMA). + /// + Manual + } + + /// + /// Enumeration for the different network modes. + /// + public enum NetworkMode + { + /// + /// Auto. + /// + Auto = 0x00, + /// + /// Gsm. + /// + Gsm = 0x01, + /// + /// Wcdma. + /// + Wcdma = 0x02, + /// + /// Rtt1x. + /// + Rtt1x = 0x04, + /// + /// Lte. + /// + Lte = 0x08, + /// + /// Evdo. + /// + Evdo = 0x10, + /// + /// Cdma. + /// + Cdma = 0x14 + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/NetworkStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/NetworkStructs.cs new file mode 100755 index 0000000..5d180f5 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/NetworkStructs.cs @@ -0,0 +1,506 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkRegistrationStatusStruct + { + internal NetworkServiceLevel Cs; + internal NetworkServiceLevel Ps; + internal NetworkServiceType Type; + internal int IsRoaming; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkCellNotiStruct + { + internal int Lac; + internal int CellId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkChangeNotiStruct + { + internal NetworkSystemType Act; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Plmn; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkTimeNotiStruct + { + internal int Year; + internal int Month; + internal int Day; + internal int Hour; + internal int Minute; + internal int Second; + internal int WDay; + internal int GmtOff; + internal int DstOff; + internal int IsDst; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Plmn; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkIdentityNotiStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Plmn; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 17)] + internal string ShortName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 33)] + internal string FullName; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkVolteStatusStruct + { + internal int IsRegistered; + internal int FeatureMask; + internal VolteNetworkType NetworkType; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkPreferredPlmnStruct + { + internal byte Index; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=7)] + internal string Plmn; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=41)] + internal string NetworkName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=41)] + internal string SnName; + internal NetworkSystemType Type; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkIdentityStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + internal string NwName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + internal string SvcName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string NwPlmn; + internal uint PlmnId; + internal NetworkPlmnType Type; + internal NetworkSystemType Act; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkPlmnListStruct + { + internal byte NwCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20, ArraySubType = UnmanagedType.LPStruct)] + internal NetworkIdentityStruct[] NwList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkPreferredPlmnListStruct + { + internal uint Count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 150, ArraySubType = UnmanagedType.LPStruct)] + internal NetworkPreferredPlmnStruct[] PlmnList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkCdmaSysStruct + { + internal int Carrier; + internal uint SysId; + internal uint NwId; + internal uint BaseStnId; + internal int BaseStnLatitude; + internal int BaseStnLongitude; + internal uint RegZone; + internal uint Offset; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct NetworkAreaStruct + { + [FieldOffset(0)] + internal int Lac; + [FieldOffset(0)] + internal NetworkCdmaSysStruct Cdma; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkServingStruct + { + internal NetworkSystemType SysType; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Plmn; + internal NetworkAreaStruct Area; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkGeranCellStruct + { + internal int CellId; + internal int Lac; + internal int Bcch; + internal int Bsic; + internal int Rxlev; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkUmtsCellStruct + { + internal int CellId; + internal int Lac; + internal int Arfcn; + internal int Psc; + internal int Rscp; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkLteCellStruct + { + internal int CellId; + internal int Lac; + internal int Pcid; + internal int Earfcn; + internal int Tac; + internal int Rssi; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkCdmaCellStruct + { + internal uint SystemId; + internal uint NetworkId; + internal uint BaseId; + internal uint RefPn; + internal int BaseStnLatitude; + internal int BaseStnLongitude; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct CellStruct + { + [FieldOffset(0)] + internal NetworkGeranCellStruct Geran; + [FieldOffset(0)] + internal NetworkUmtsCellStruct Umts; + [FieldOffset(0)] + internal NetworkLteCellStruct Lte; + [FieldOffset(0)] + internal NetworkCdmaCellStruct Cdma; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkServingCellStruct + { + internal NetworkSystemType SystemType; + internal int MobileCountryCode; + internal int MobileNetworkCode; + internal CellStruct Cell; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct NetworkNeighboringCellStruct + { + internal NetworkServingCellStruct ServCell; + internal int GeranCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6, ArraySubType = UnmanagedType.LPStruct)] + internal NetworkGeranCellStruct[] GeranList; + internal int UmtsCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.LPStruct)] + internal NetworkUmtsCellStruct[] UmtsList; + internal int LteCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 24, ArraySubType = UnmanagedType.LPStruct)] + internal NetworkLteCellStruct[] LteList; + } + + internal static class NetworkStructConversions + { + internal static NetworkRegistrationStatus ConvertNetworkRegistrationStruct(NetworkRegistrationStatusStruct statusStruct) + { + NetworkRegistrationStatus status = new NetworkRegistrationStatus(); + status.Cs = statusStruct.Cs; + status.Ps = statusStruct.Ps; + status.SvcType = statusStruct.Type; + if (statusStruct.IsRoaming == 1) + { + status.Roaming = true; + } + + else if (statusStruct.IsRoaming == 0) + { + status.Roaming = false; + } + + return status; + } + + internal static NetworkCellNoti ConvertNetworkCellNotiStruct(NetworkCellNotiStruct notiStruct) + { + NetworkCellNoti noti = new NetworkCellNoti(); + noti.Location = notiStruct.Lac; + noti.Id = notiStruct.CellId; + return noti; + } + + internal static NetworkChangeNoti ConvertNetworkChangeStruct(NetworkChangeNotiStruct changeStruct) + { + NetworkChangeNoti changeNoti = new NetworkChangeNoti(); + changeNoti.Type = changeStruct.Act; + changeNoti.NwPlmn = changeStruct.Plmn; + return changeNoti; + } + + internal static NetworkTimeNoti ConvertNetworkTimeNotiStruct(NetworkTimeNotiStruct notiStruct) + { + NetworkTimeNoti time = new NetworkTimeNoti(); + time.TimeInfo = new DateTime(notiStruct.Year, notiStruct.Month, notiStruct.Day, notiStruct.Hour, notiStruct.Minute, notiStruct.Second); + time.WDayInfo = notiStruct.WDay; + time.GmtOffInfo = notiStruct.GmtOff; + time.DstOffInfo = notiStruct.DstOff; + if (notiStruct.IsDst == 1) + { + time.Dst = true; + } + + else if (notiStruct.IsDst == 0) + { + time.Dst = false; + } + + time.NetworkPlmn = notiStruct.Plmn; + return time; + } + + internal static NetworkIdentityNoti ConvertNetworkIdentityStruct(NetworkIdentityNotiStruct notiStruct) + { + NetworkIdentityNoti identity = new NetworkIdentityNoti(); + identity.NwPlmn = notiStruct.Plmn; + identity.NwShortName = notiStruct.ShortName; + identity.NwFullName = notiStruct.FullName; + return identity; + } + + internal static NetworkVolteStatus ConvertNetworkVolteStruct(NetworkVolteStatusStruct notiStruct) + { + NetworkVolteStatus volteStatus = new NetworkVolteStatus(); + if (notiStruct.IsRegistered == 1) + { + volteStatus.NwIsRegistered = true; + } + + else if (notiStruct.IsRegistered == 0) + { + volteStatus.NwIsRegistered = false; + } + + volteStatus.NwFeatureMask = notiStruct.FeatureMask; + volteStatus.NwType = notiStruct.NetworkType; + return volteStatus; + } + + internal static NetworkPlmnList ConvertNetworkPlmnListStruct(NetworkPlmnListStruct listStruct) + { + NetworkPlmnList plmnList = new NetworkPlmnList(); + List records = new List(); + + foreach (NetworkIdentityStruct idStruct in listStruct.NwList) + { + NetworkIdentity identity = new NetworkIdentity(); + identity.Id = idStruct.PlmnId; + identity.SvcProviderName = idStruct.SvcName; + identity.IdName = idStruct.NwName; + identity.PlmnName = idStruct.NwPlmn; + identity.PlmnNwType = idStruct.Type; + identity.SysType = idStruct.Act; + records.Add(identity); + } + + plmnList.NwCount = listStruct.NwCount; + plmnList.NwList = records; + return plmnList; + } + + internal static IEnumerable ConvertNetworkPreferredPlmnStruct(NetworkPreferredPlmnListStruct plmnStruct) + { + List plmnList = new List(); + + for (int i = 0; i <= plmnStruct.Count; i++) + { + NetworkPreferredPlmnInfo plmnInfo = new NetworkPreferredPlmnInfo(); + plmnInfo.idex = plmnStruct.PlmnList[i].Index; + plmnInfo.NwName = plmnStruct.PlmnList[i].NetworkName; + plmnInfo.NwPlmn = plmnStruct.PlmnList[i].Plmn; + plmnInfo.SvcProvName = plmnStruct.PlmnList[i].SnName; + plmnInfo.SysType = plmnStruct.PlmnList[i].Type; + plmnList.Add(plmnInfo); + } + + return plmnList; + } + + internal static NetworkCdmaSysInfo ConvertCdmaStruct(NetworkCdmaSysStruct cdmaStruct) + { + NetworkCdmaSysInfo cdmaInfo = new NetworkCdmaSysInfo(); + cdmaInfo.Car = cdmaStruct.Carrier; + cdmaInfo.BaseStnId = cdmaStruct.BaseStnId; + cdmaInfo.BaseStnLatitude = cdmaStruct.BaseStnLatitude; + cdmaInfo.BaseStnLongitude = cdmaStruct.BaseStnLongitude; + cdmaInfo.NwId = cdmaStruct.NwId; + cdmaInfo.Offset = cdmaStruct.Offset; + cdmaInfo.RegZone = cdmaStruct.RegZone; + cdmaInfo.SysId = cdmaStruct.SysId; + return cdmaInfo; + } + + internal static NetworkServing ConvertNetworkServingStruct(NetworkServingStruct servStruct) + { + NetworkServing servingInfo = new NetworkServing(); + NetworkAreaStruct areaStruct = servStruct.Area; + NetworkCdmaSysStruct cdmaStruct = areaStruct.Cdma; + NetworkCdmaSysInfo cdmaInfo = ConvertCdmaStruct(cdmaStruct); + + NetworkAreaInfo areaInfo = new NetworkAreaInfo(); + areaInfo.Code = areaStruct.Lac; + areaInfo.Cdma = cdmaInfo; + + servingInfo.NwPlmn = servStruct.Plmn; + servingInfo.Type = servStruct.SysType; + servingInfo.Area = areaInfo; + + return servingInfo; + } + + internal static NetworkGeranCell ConvertGeranStruct(NetworkGeranCellStruct geranStruct) + { + NetworkGeranCell geranCell = new NetworkGeranCell(); + geranCell.Bc = geranStruct.Bcch; + geranCell.Bs = geranStruct.Bsic; + geranCell.Id = geranStruct.CellId; + geranCell.Lc = geranStruct.Lac; + geranCell.Rx = geranStruct.Rxlev; + return geranCell; + } + + internal static NetworkUmtsCell ConvertUmtsStruct(NetworkUmtsCellStruct umtsStruct) + { + NetworkUmtsCell umtsCell = new NetworkUmtsCell(); + umtsCell.Arf = umtsStruct.Arfcn; + umtsCell.Id = umtsStruct.CellId; + umtsCell.Lc = umtsStruct.Lac; + umtsCell.Ps = umtsStruct.Psc; + umtsCell.Rsc = umtsStruct.Rscp; + return umtsCell; + } + + internal static NetworkLteCell ConvertLteStruct(NetworkLteCellStruct lteStruct) + { + NetworkLteCell lteCell = new NetworkLteCell(); + lteCell.Id = lteStruct.CellId; + lteCell.Erf = lteStruct.Earfcn; + lteCell.Lc = lteStruct.Lac; + lteCell.PId = lteStruct.Pcid; + lteCell.Tc = lteStruct.Tac; + lteCell.Rs = lteStruct.Rssi; + return lteCell; + } + + internal static NetworkNeighboringCell ConvertNeighborCellStruct(NetworkNeighboringCellStruct neighborStruct) + { + NetworkNeighboringCell neighborCell = new NetworkNeighboringCell(); + NetworkServingCellStruct servStruct = neighborStruct.ServCell; + CellStruct cellStruct = servStruct.Cell; + NetworkGeranCellStruct geranStruct = cellStruct.Geran; + NetworkCdmaCellStruct cdmaStruct = cellStruct.Cdma; + NetworkUmtsCellStruct umtsStruct = cellStruct.Umts; + NetworkLteCellStruct lteStruct = cellStruct.Lte; + + NetworkGeranCell geranCell = ConvertGeranStruct(geranStruct); + + NetworkCdmaCell cdmaCell = new NetworkCdmaCell(); + cdmaCell.BaseStnId = cdmaStruct.BaseId; + cdmaCell.BaseStnLatitude = cdmaStruct.BaseStnLatitude; + cdmaCell.BaseStnLongitude = cdmaStruct.BaseStnLongitude; + cdmaCell.NwId = cdmaStruct.NetworkId; + cdmaCell.RefPn = cdmaStruct.RefPn; + cdmaCell.SysId = cdmaStruct.SystemId; + + NetworkUmtsCell umtsCell = ConvertUmtsStruct(umtsStruct); + + NetworkLteCell lteCell = ConvertLteStruct(lteStruct); + + Cell cell = new Cell(); + cell.Geran = geranCell; + cell.Cdma = cdmaCell; + cell.Umts = umtsCell; + cell.Lte = lteCell; + + NetworkServingCell servingCell = new NetworkServingCell(); + servingCell.SysType = servStruct.SystemType; + servingCell.MCountryCode = servStruct.MobileCountryCode; + servingCell.MNwCode = servStruct.MobileNetworkCode; + servingCell.Info = cell; + + neighborCell.ServCell = servingCell; + List geranCellList = new List(); + for(int i=0;i umtsCellList = new List(); + for (int i = 0; i < neighborStruct.UmtsCount; i++) + { + NetworkUmtsCell umts = ConvertUmtsStruct(neighborStruct.UmtsList[i]); + umtsCellList.Add(umts); + } + + List lteCellList = new List(); + for (int i = 0; i < neighborStruct.GeranCount; i++) + { + NetworkLteCell lte = ConvertLteStruct(neighborStruct.LteList[i]); + lteCellList.Add(lte); + } + + neighborCell.GrList = geranCellList; + neighborCell.UmtList = umtsCellList; + neighborCell.LtList = lteCellList; + return neighborCell; + + } + } + + internal static class NetworkClassConversions + { + internal static NetworkPreferredPlmnStruct ConvertNetworkPreferredPlmn(NetworkPreferredPlmnInfo plmnInfo) + { + NetworkPreferredPlmnStruct plmnStruct = new NetworkPreferredPlmnStruct(); + plmnStruct.Index = plmnInfo.idex; + plmnStruct.NetworkName = plmnInfo.NwName; + plmnStruct.Plmn = plmnInfo.NwPlmn; + plmnStruct.SnName = plmnInfo.SvcProvName; + plmnStruct.Type = plmnInfo.SysType; + return plmnStruct; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Oem.cs b/src/Tizen.Tapi/Tizen.Tapi/Oem.cs new file mode 100755 index 0000000..3aa69ac --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Oem.cs @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Threading.Tasks; + +namespace Tizen.Tapi +{ + /// + /// This class provides functions for sending oem related data. + /// + public class Oem + { + private IntPtr _handle; + private Dictionary _response_map = new Dictionary(); + private int _requestId = 0; + + /// + /// A public constructor for Oem class to create a Oem instance for the given tapi handle. + /// + /// The tapi handle. + public Oem(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("TapiHandle parameter is null"); + } + + _handle = handle._handle; + } + + /// + /// Sends oem data directly. + /// + /// Oem id for user specification. + /// Oem data for sending. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when oem instance is invalid or when method failed due to invalid operation. + public void SendOemData(int oemId, byte[] data) + { + int length = data.Length; + IntPtr oemData = Marshal.AllocHGlobal(length); + Marshal.Copy(data, 0, oemData, length); + int ret = Interop.Tapi.Oem.SendOemData(_handle, oemId, oemData, Convert.ToUInt32(length)); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to send oem data directly, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + } + + /// + /// Sends oem data directly. + /// + /// Oem id for user specification. + /// Oem data for sending. + /// The oem data which is sent. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public OemData SendOemDataSync(int oemId, byte[] data) + { + OemDataStruct oemStruct; + int length = data.Length; + IntPtr oemData = Marshal.AllocHGlobal(length); + Marshal.Copy(data, 0, oemData, length); + int ret = Interop.Tapi.Oem.SendOemDataSync(_handle, oemId, oemData, Convert.ToUInt32(length), out oemStruct); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to send oem data directly, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + OemData oemDataSend = OemStructConversions.ConvertOemStruct(oemStruct); + return oemDataSend; + } + + /// + /// Sends oem data directly. + /// + /// Oem id for user specification. + /// Oem data for sending. + /// The oem data which is sent. + /// http://tizen.org/privilege/telephony.admin + /// platform + /// http://tizen.org/feature/network.telephony + /// Thrown when feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call instance is invalid or when method failed due to invalid operation. + public Task SendOemDataAsync(int oemId, byte[] data) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id; + id = (IntPtr)_requestId++; + _response_map[id] = (IntPtr handle, int result, IntPtr dataResponse, IntPtr key) => + { + Task resultTask = new Task(() => + { + if (result != (int)NetworkOperationCause.NoError) + { + Log.Error(TapiUtility.LogTag, "Error occurs during sending oem data, " + (NetworkOperationCause)result); + task.SetException(new InvalidOperationException("Error occurs during sending oem data, " + (NetworkOperationCause)result)); + return; + } + + OemDataStruct oemStruct = Marshal.PtrToStructure(dataResponse); + OemData oemClass = OemStructConversions.ConvertOemStruct(oemStruct); + task.SetResult(oemClass); + }); + + resultTask.Start(); + resultTask.Wait(); + _response_map.Remove(key); + }; + + int length = data.Length; + IntPtr oemData = Marshal.AllocHGlobal(length); + Marshal.Copy(data, 0, oemData, length); + int ret = Interop.Tapi.Oem.SendOemDataAsync(_handle, oemId, oemData, Convert.ToUInt32(length), _response_map[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to send oem data, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Tapi/Tizen.Tapi/OemData.cs b/src/Tizen.Tapi/Tizen.Tapi/OemData.cs new file mode 100755 index 0000000..f008d96 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/OemData.cs @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Tapi +{ + /// + /// A class which defines OEM data base structure. + /// + public class OemData + { + internal uint OemId; + internal byte[] OemDataInfo; + internal OemData() + { + } + + /// + /// Oem ID. + /// + /// Oem id represented in unsigned integer. + public uint Id + { + get + { + return OemId; + } + } + + /// + /// Oem data. + /// + /// Oem data represented in byte array. + public byte[] Data + { + get + { + return OemDataInfo; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/OemStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/OemStructs.cs new file mode 100755 index 0000000..903fb1c --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/OemStructs.cs @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct OemDataStruct + { + internal uint OemId; + internal uint Length; + internal IntPtr Data; + } + + internal static class OemStructConversions + { + internal static OemData ConvertOemStruct(OemDataStruct info) + { + OemData data = new OemData(); + data.OemId = info.OemId; + int length = Convert.ToInt32(info.Length); + data.OemDataInfo = new byte[length]; + Marshal.Copy(info.Data, data.OemDataInfo, 0, length); + return data; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Phonebook.cs b/src/Tizen.Tapi/Tizen.Tapi/Phonebook.cs new file mode 100755 index 0000000..217d390 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Phonebook.cs @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which manages sim phonebook record information. + /// + public class Phonebook + { + private IntPtr _handle = IntPtr.Zero; + private Dictionary _callbackMap = new Dictionary(); + private int _requestId = 0; + + private Phonebook() + { + } + + /// + /// Gets the instance of Phonebook class. + /// + /// An instance of TapiHandle obtained from InitTapi in TapiManager API. + /// Thrown when handle is passed as null. + public Phonebook(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("Handle is null"); + } + + _handle = handle._handle; + } + + /// + /// Gets the current inserted SIM phonebook init status, available phonebook list, and first valid index in case of FDN, ADN, and 3G phonebook. + /// + /// An instance of SimPhonebookStatus containing init status and phonebook list information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public SimPhonebookStatus GetPhonebookInitInfo() + { + SimPhonebookStatusStruct pbStatus; + int ret = Interop.Tapi.Phonebook.GetPhonebookInitInfo(_handle, out int isInitCompleted, out SimPhonebookListStruct pbList); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get phonebook init info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + pbStatus.IsInitCompleted = isInitCompleted; + pbStatus.PbList = pbList; + return PhonebookStructConversions.ConvertSimPhonebookStatusStruct(pbStatus); + } + + /// + /// Gets the number of used records and total records of a specific SIM phonebook type. + /// + /// The different storage types to be selected in the SIM. + /// A task containing an instance of PhonebookStorageInfo. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task GetPhonebookStorage(PhonebookType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting phone book storage: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during getting phone book storage, " + (PhonebookAccessResult)result)); + return; + } + + PhonebookStorageInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(PhonebookStructConversions.ConvertPhonebookStorageStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Phonebook.GetPhonebookStorage(_handle, type, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get phonebook storage info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the max text length and max number length supported by the SIM phone book elementary file. + /// + /// The different storage types to be selected in the SIM. + /// A task containing an instance of PhonebookMetaInfo. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task GetPhonebookMetaInfo(PhonebookType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting phone book meta info: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during getting phone book meta info, " + (PhonebookAccessResult)result)); + return; + } + + PhonebookMetaInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(PhonebookStructConversions.ConvertPhonebookMetaInfoStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Phonebook.GetPhonebookMetaInfo(_handle, type, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get phonebook meta info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM 3G phonebook supported EFs like ANR, SNE, GRP, EMAIL and the corresponding EFs max text length, number length, and size. + /// + /// A task containing an instance of PhonebookMetaInfo3G. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task GetPhonebookMetaInfo3G() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during getting 3G phone book meta info: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during getting 3G phone book meta info, " + (PhonebookAccessResult)result)); + return; + } + + PhonebookMetaInfo3GStruct metaInfo = Marshal.PtrToStructure(data); + task.SetResult(PhonebookStructConversions.ConvertPhonebookMetaInfo3GStruct(metaInfo)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Phonebook.GetPhonebookMetaInfo3G(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get 3G phonebook meta info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Reads SIM phone book entry information from the given storage type and index. + /// + /// The different storage types to be selected in the SIM. + /// The index for accessing the SIM data. + /// A task containing an instance of PhonebookRecord. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task ReadPhonebookRecord(PhonebookType type, ushort index) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during reading phone book record: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during reading phone book record, " + (PhonebookAccessResult)result)); + return; + } + + PhonebookRecordStruct record = Marshal.PtrToStructure(data); + task.SetResult(PhonebookStructConversions.ConvertPhonebookRecordStruct(record)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (index == 0) + { + throw new ArgumentException("Index should not be zero"); + } + + int ret = Interop.Tapi.Phonebook.ReadPhonebookRecord(_handle, type, index, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to read phonebook record, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Adds or edits SIM phone book record entry information. + /// + /// The phonebook data to be updated or added. + /// A task indicating whether the updation is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when record is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task UpdatePhonebookRecord(PhonebookRecord record) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during updation of phone book record: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during updation of phone book record, " + (PhonebookAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (record == null) + { + throw new ArgumentNullException("Phonebook record is null"); + } + + if (record.Index == 0) + { + throw new ArgumentException("Index in phonebook record is zero"); + } + + PhonebookRecordStruct recordStruct = PhonebookClassConversions.ConvertPhonebookrecord(record); + int ret = Interop.Tapi.Phonebook.UpdatePhonebookRecord(_handle, ref recordStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to update phonebook record, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Deletes a SIM phonebook record. + /// + /// The different storage types to be selected in the SIM. + /// The index of the record to be deleted. + /// A task indicating whether deletion is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task DeletePhonebookRecord(PhonebookType type, ushort index) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)PhonebookAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during deletion of phone book record: " + (PhonebookAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs during deletion of phone book record, " + (PhonebookAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (index == 0) + { + throw new ArgumentException("Index of the record is zero"); + } + + int ret = Interop.Tapi.Phonebook.DeletePhonebookRecord(_handle, type, index, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to delete phonebook record, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/PhonebookData.cs b/src/Tizen.Tapi/Tizen.Tapi/PhonebookData.cs new file mode 100755 index 0000000..f28cd93 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/PhonebookData.cs @@ -0,0 +1,816 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines the list of phone book availability of the current SIM. + /// + public class SimPhonebookList + { + internal int PbFdn; + internal int PbAdn; + internal int PbSdn; + internal int PbUsim; + internal int PbAas; + internal int PbGas; + + internal SimPhonebookList() + { + } + + /// + /// Fixed Dialing Number. + /// + /// Fdn represented in integer format. + public int Fdn + { + get + { + return PbFdn; + } + } + + /// + /// SIM - ADN(2G phonebook, Under DF phonebook). + /// + /// Adn represented in integer format. + public int Adn + { + get + { + return PbAdn; + } + } + + /// + /// Service Dialing Number. + /// + /// Sdn represented in integer format. + public int Sdn + { + get + { + return PbSdn; + } + } + + /// + /// USIM - 3G phonebook. + /// + /// Usim represented in integer format. + public int Usim + { + get + { + return PbUsim; + } + } + + /// + /// Additional number Alpha String phonebook. + /// + /// Aas represented in integer format. + public int Aas + { + get + { + return PbAas; + } + } + + /// + /// Grouping information Alpha String phonebook. + /// + /// Gas represented in integer format. + public int Gas + { + get + { + return PbGas; + } + } + } + + /// + /// A class which defines phone book status of the current SIM. + /// + public class SimPhonebookStatus + { + internal bool InitStatus; + internal SimPhonebookList List; + + internal SimPhonebookStatus() + { + } + + /// + /// Init completed or not. + /// + /// Boolean value to check the status of Init. + public bool IsInitCompleted + { + get + { + return InitStatus; + } + } + + /// + /// List of phonebook. + /// + /// An instance of SimPhonebookList containing the list of available phone book. + public SimPhonebookList PbList + { + get + { + return List; + } + } + } + + /// + /// A class which defines phonebook contact change information. + /// + public class PhonebookContactChangeInfo + { + internal PhonebookType PbType; + internal ushort ChangedIndex; + internal PhonebookOperationType OpType; + + internal PhonebookContactChangeInfo() + { + } + + /// + /// Storage file type. + /// + /// Type of phonebook storage represented as PhonebookType enum. + public PhonebookType Type + { + get + { + return PbType; + } + } + + /// + /// Changed index. + /// + /// Index value represented in unsigned short. + public ushort Index + { + get + { + return ChangedIndex; + } + } + + /// + /// Phonebook operation. + /// + /// Operation indicating the action on phonebook contact. + public PhonebookOperationType Operation + { + get + { + return OpType; + } + } + } + + /// + /// A class which defines phone book storage count information. + /// + public class PhonebookStorageInfo + { + internal PhonebookType PbType; + internal ushort PbTotalRecord; + internal ushort PbUsedRecord; + internal PhonebookStorageInfo() + { + } + + /// + /// Storage file type. + /// + /// Type of phone book storage file. + public PhonebookType Type + { + get + { + return PbType; + } + } + + /// + /// Total record count. + /// + /// Count of total phonebook record. + public ushort TotalRecord + { + get + { + return PbTotalRecord; + } + } + + /// + /// Used record count. + /// + /// Number of used phonebook record. + public ushort UsedRecord + { + get + { + return PbUsedRecord; + } + } + } + + /// + /// A class which defines phone book entry information. + /// + public class PhonebookMetaInfo + { + internal PhonebookType MetaType; + internal ushort MinIdx; + internal ushort MaxIdx; + internal ushort NumMaxLength; + internal ushort TextMaxLen; + internal ushort UsedRecCount; + internal PhonebookMetaInfo() + { + } + + /// + /// Storage file type. + /// + /// Type of phonebook storage. + public PhonebookType Type + { + get + { + return MetaType; + } + } + + /// + /// Phone book minimum index. + /// + /// Minimum index value of the phone book record. + public ushort MinIndex + { + get + { + return MinIdx; + } + } + + /// + /// Phone book maximum index. + /// + /// Maximum index value of the phone book record. + public ushort MaxIndex + { + get + { + return MaxIdx; + } + } + + /// + /// Phone number's maximum length + /// + /// Maximum length of the phone number. + public ushort NumberMaxLength + { + get + { + return NumMaxLength; + } + } + + /// + /// Text's maximum length. + /// + /// Maximum length of the text. + public ushort TextMaxLength + { + get + { + return TextMaxLen; + } + } + + /// + /// Phone book used record count. + /// + /// Number of used phone book record. + public ushort UsedCount + { + get + { + return UsedRecCount; + } + } + } + + /// + /// A class which defines 3G phone book capability information. + /// + public class FileTypeCapabilityInfo3G + { + internal PhonebookFileType3G Type; + internal ushort MaxIdx; + internal ushort TextMaxLen; + internal ushort UsedRecCount; + internal FileTypeCapabilityInfo3G() + { + } + + /// + /// 3G phonebook file type. + /// + /// File type of the 3G phonebook. + public PhonebookFileType3G FileType + { + get + { + return Type; + } + } + + /// + /// Max index. + /// + /// Maximum index value present in 3G phonebook. + public ushort MaxIndex + { + get + { + return MaxIdx; + } + } + + /// + /// Max text length. + /// + /// Maximum text length in unsigned short. + public ushort TextMaxLength + { + get + { + return TextMaxLen; + } + } + + /// + /// Used record count. + /// + /// Number of used record in 3G phonebook. + public ushort UsedCount + { + get + { + return UsedRecCount; + } + } + } + + /// + /// A class which manages Sim phonebook and its capabilities information. + /// + public class PhonebookMetaInfo3G + { + internal ushort FileCount; + internal IEnumerable FileInfo; + internal PhonebookMetaInfo3G() + { + } + + /// + /// Phonebook file type count. + /// + /// Filetype count of the 3G phonebook. + public ushort FileTypeCount + { + get + { + return FileCount; + } + } + + /// + /// Phonebook file type information. + /// + /// A list of FileTypeCapabilityInfo3G instances. + public IEnumerable FileTypeInfo + { + get + { + return FileInfo; + } + } + } + + /// + /// A class which contains information about phonebook record. + /// + public class PhonebookRecord + { + private PhonebookType _type; + private ushort _index; + private ushort _nextIndex; + private string _name; + private TextEncryptionType _dcs; + private string _number; + private SimTypeOfNumber _ton; + private string _sne; + private TextEncryptionType _sneDcs; + private string _anr1; + private SimTypeOfNumber _anr1Ton; + private string _anr2; + private SimTypeOfNumber _anr2Ton; + private string _anr3; + private SimTypeOfNumber _anr3Ton; + private string _email1; + private string _email2; + private string _email3; + private string _email4; + private ushort _groupIndex; + private ushort _pbControl; + + /// + /// Phonebook type. + /// + /// Type of the phonebook used. + public PhonebookType Type + { + get + { + return _type; + } + + set + { + _type = value; + } + } + + /// + /// Index. + /// + /// Index value represented in unsigned short. + public ushort Index + { + get + { + return _index; + } + + set + { + _index = value; + } + } + + /// + /// Next index (This field is not used in the add/update case). + /// + /// Next index represented in unsigned short. + public ushort NextIndex + { + get + { + return _nextIndex; + } + + set + { + _nextIndex = value; + } + } + + /// + /// Name. + /// + /// Name in phonebook record. + public string Name + { + get + { + return _name; + } + + set + { + _name = value; + } + } + + /// + /// Dcs. + /// + /// Sim encryption type. + public TextEncryptionType Dcs + { + get + { + return _dcs; + } + + set + { + _dcs = value; + } + } + + /// + /// Number. + /// + /// Number in phonebook record. + public string Number + { + get + { + return _number; + } + + set + { + _number = value; + } + } + + /// + /// Ton. + /// + /// Sim type of number. + public SimTypeOfNumber Ton + { + get + { + return _ton; + } + + set + { + _ton = value; + } + } + + /// + /// SNE(Second Name Entry). + /// + /// Second name entry in byte array. + public string Sne + { + get + { + return _sne; + } + + set + { + _sne = value; + } + } + + /// + /// SNE DCS. + /// + /// SNE text encryption type. + public TextEncryptionType SneDcs + { + get + { + return _sneDcs; + } + + set + { + _sneDcs = value; + } + } + + /// + /// Additional Number1. + /// + /// Additional number1 represented in byte array. + public string Anr1 + { + get + { + return _anr1; + } + + set + { + _anr1 = value; + } + } + + /// + /// ANR1 TON. + /// + /// Additional number1 type of number. + public SimTypeOfNumber Anr1Ton + { + get + { + return _anr1Ton; + } + + set + { + _anr1Ton = value; + } + } + + /// + /// Additional Number2. + /// + /// Additional number2 represented in byte array. + public string Anr2 + { + get + { + return _anr2; + } + + set + { + _anr2 = value; + } + } + + /// + /// ANR2 TON. + /// + /// Additional number2 type of number. + public SimTypeOfNumber Anr2Ton + { + get + { + return _anr2Ton; + } + + set + { + _anr2Ton = value; + } + } + + /// + /// Additional number3. + /// + /// Additional number3 represented in byte array. + public string Anr3 + { + get + { + return _anr3; + } + + set + { + _anr3 = value; + } + } + + /// + /// ANR3 TON. + /// + /// Additional number3 type of number. + public SimTypeOfNumber Anr3Ton + { + get + { + return _anr3Ton; + } + + set + { + _anr3Ton = value; + } + } + + /// + /// Email1. + /// + /// Email1 represented in byte array. + public string Email1 + { + get + { + return _email1; + } + + set + { + _email1 = value; + } + } + + /// + /// Email2. + /// + /// Email2 represented in byte array. + public string Email2 + { + get + { + return _email2; + } + + set + { + _email2 = value; + } + } + + /// + /// Email3. + /// + /// Email3 represented in byte array. + public string Email3 + { + get + { + return _email3; + } + + set + { + _email3 = value; + } + } + + /// + /// Email4. + /// + /// Email4 reprensented in byte array. + public string Email4 + { + get + { + return _email4; + } + + set + { + _email4 = value; + } + } + + /// + /// Group index. + /// + /// Group index represented in unsigned short. + public ushort GroupIndex + { + get + { + return _groupIndex; + } + + set + { + _groupIndex = value; + } + } + + /// + /// Phonebook control. + /// + /// Phonebook control represented in unsigned short. + public ushort PbControl + { + get + { + return _pbControl; + } + + set + { + _pbControl = value; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/PhonebookEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/PhonebookEnumerations.cs new file mode 100755 index 0000000..414ecbc --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/PhonebookEnumerations.cs @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the storage types to be selected in the SIM or USIM. + /// + public enum PhonebookType + { + /// + /// Fixed Dialing Number. + /// + Fdn, + /// + /// Sim - ADN. + /// + Adn, + /// + /// Service Dialing Number. + /// + Sdn, + /// + /// USIM - 3G phone book. + /// + Usim, + /// + /// Additional number Alpha String. + /// + Aas, + /// + /// Grouping identifier Alpha String. + /// + Gas, + /// + /// Unknown file type. + /// + Unknown = 0xFF + } + + /// + /// Enumeration for the phonebook operation types. + /// + public enum PhonebookOperationType + { + /// + /// Contact added or updated. + /// + Update, + /// + /// Existing contact deleted. + /// + Delete, + /// + /// Max value. + /// + Max + } + + /// + /// Enumeration for the storage field types in the 3G Phone book. + /// + public enum PhonebookFileType3G + { + /// + /// Name. + /// + Name = 0x01, + /// + /// Number. + /// + Number, + /// + /// First Another number. + /// + Anr1, + /// + /// Second Another number. + /// + Anr2, + /// + /// Third Another number. + /// + Anr3, + /// + /// First Email. + /// + Email1, + /// + /// Second Email. + /// + Email2, + /// + /// Third Email. + /// + Email3, + /// + /// Fourth Email. + /// + Email4, + /// + /// Second name entry of the main name. + /// + Sne, + /// + /// Group. + /// + Group, + /// + /// 1 byte control info and 1 byte hidden info. + /// + Pbc + } + + /// + /// Enumeration for the text encryption type. + /// + public enum TextEncryptionType + { + /// + /// ASCII Encoding. + /// + Ascii, + /// + /// GSM 7 Bit Encoding. + /// + Gsm7Bit, + /// + /// UCS2 Encoding. + /// + Ucs2, + /// + /// HEX Encoding. + /// + Hex + } + + /// + /// Enumeration for the phonebook access result. + /// + public enum PhonebookAccessResult + { + /// + /// SIM phonebook operation successful. + /// + Success, + /// + /// SIM phonebook operation failure. + /// + Fail, + /// + /// The index passed is not a valid index. + /// + InvalidIndex, + /// + /// The number length exceeds the max length allowed (or 0). + /// + InvalidNumberLength, + /// + /// The name length exceeds the max length allowed (or 0). + /// + InvalidNameLength, + /// + /// Access condition for PB file is not satisfied. + /// + AccessConditionNotSatisfied + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/PhonebookStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/PhonebookStructs.cs new file mode 100755 index 0000000..74d8cf5 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/PhonebookStructs.cs @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using System.Text; +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct PhonebookRecordStruct + { + internal PhonebookType Type; + internal ushort Index; + internal ushort NextIndex; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Name; + internal TextEncryptionType Dcs; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Number; + internal SimTypeOfNumber Ton; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Sne; + internal TextEncryptionType SneDcs; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Anr1; + internal SimTypeOfNumber Anr1Ton; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Anr2; + internal SimTypeOfNumber Anr2Ton; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Anr3; + internal SimTypeOfNumber Anr3Ton; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Email1; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Email2; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Email3; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Email4; + internal ushort GroupIndex; + internal ushort PbControl; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPhonebookListStruct + { + internal int Fdn; + internal int Adn; + internal int Sdn; + internal int Usim; + internal int Aas; + internal int Gas; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPhonebookStatusStruct + { + internal int IsInitCompleted; + internal SimPhonebookListStruct PbList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct PhonebookContactChangeInfoStruct + { + internal PhonebookType Type; + internal ushort Index; + internal PhonebookOperationType Operation; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct PhonebookStorageInfoStruct + { + internal PhonebookType Type; + internal ushort TotalRecord; + internal ushort UsedRecord; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct PhonebookMetaInfoStruct + { + internal PhonebookType Type; + internal ushort MinIndex; + internal ushort MaxIndex; + internal ushort NumMaxLength; + internal ushort TextMaxLength; + internal ushort UsedCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct FileTypeCapabilityInfo3GStruct + { + internal PhonebookFileType3G FileType; + internal ushort MaxIndex; + internal ushort MaxTextLen; + internal ushort UsedCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct PhonebookMetaInfo3GStruct + { + internal ushort FileTypeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 13, ArraySubType = UnmanagedType.LPStruct)] + internal FileTypeCapabilityInfo3GStruct[] FileTypeInfo; + } + + internal static class PhonebookStructConversions + { + internal static SimPhonebookList ConvertSimPhonebookListStruct(SimPhonebookListStruct listStruct) + { + SimPhonebookList list = new SimPhonebookList(); + list.PbFdn = listStruct.Fdn; + list.PbAdn = listStruct.Adn; + list.PbSdn = listStruct.Sdn; + list.PbUsim = listStruct.Usim; + list.PbAas = listStruct.Aas; + list.PbGas = listStruct.Gas; + return list; + } + + internal static SimPhonebookStatus ConvertSimPhonebookStatusStruct(SimPhonebookStatusStruct statusStruct) + { + SimPhonebookStatus status = new SimPhonebookStatus(); + if (statusStruct.IsInitCompleted == 1) + { + status.InitStatus = true; + } + + else if (statusStruct.IsInitCompleted == 0) + { + status.InitStatus = false; + } + + status.List = ConvertSimPhonebookListStruct(statusStruct.PbList); + return status; + } + + internal static PhonebookStorageInfo ConvertPhonebookStorageStruct(PhonebookStorageInfoStruct storageStruct) + { + PhonebookStorageInfo storageInfo = new PhonebookStorageInfo(); + storageInfo.PbType = storageStruct.Type; + storageInfo.PbTotalRecord = storageStruct.TotalRecord; + storageInfo.PbUsedRecord = storageStruct.UsedRecord; + return storageInfo; + } + + internal static PhonebookMetaInfo ConvertPhonebookMetaInfoStruct(PhonebookMetaInfoStruct metaStruct) + { + PhonebookMetaInfo info = new PhonebookMetaInfo(); + info.MetaType = metaStruct.Type; + info.MinIdx = metaStruct.MinIndex; + info.MaxIdx = metaStruct.MaxIndex; + info.NumMaxLength = metaStruct.NumMaxLength; + info.TextMaxLen = metaStruct.TextMaxLength; + info.UsedRecCount = metaStruct.UsedCount; + return info; + } + + internal static FileTypeCapabilityInfo3G ConvertFileTypeCapabilityInfo3GStruct(FileTypeCapabilityInfo3GStruct infoStruct) + { + FileTypeCapabilityInfo3G info = new FileTypeCapabilityInfo3G(); + info.Type = infoStruct.FileType; + info.MaxIdx = infoStruct.MaxIndex; + info.TextMaxLen = infoStruct.MaxTextLen; + info.UsedRecCount = infoStruct.UsedCount; + return info; + } + + internal static PhonebookMetaInfo3G ConvertPhonebookMetaInfo3GStruct(PhonebookMetaInfo3GStruct infoStruct) + { + PhonebookMetaInfo3G info = new PhonebookMetaInfo3G(); + info.FileCount = infoStruct.FileTypeCount; + List capabilityList = new List(); + foreach (FileTypeCapabilityInfo3GStruct capabilityInfo in infoStruct.FileTypeInfo) + { + capabilityList.Add(ConvertFileTypeCapabilityInfo3GStruct(capabilityInfo)); + } + + info.FileInfo = capabilityList; + return info; + } + + internal static PhonebookContactChangeInfo ConvertPhonebookContactChangeStruct(PhonebookContactChangeInfoStruct infoStruct) + { + PhonebookContactChangeInfo info = new PhonebookContactChangeInfo(); + info.PbType = infoStruct.Type; + info.ChangedIndex = infoStruct.Index; + info.OpType = infoStruct.Operation; + return info; + } + + internal static PhonebookRecord ConvertPhonebookRecordStruct(PhonebookRecordStruct recordStruct) + { + PhonebookRecord record = new PhonebookRecord(); + record.Type = recordStruct.Type; + record.Index = recordStruct.Index; + record.NextIndex = recordStruct.NextIndex; + record.Name = recordStruct.Name; + record.Dcs = recordStruct.Dcs; + record.Number = recordStruct.Number; + record.Ton = recordStruct.Ton; + record.Sne = recordStruct.Sne; + record.SneDcs = recordStruct.SneDcs; + record.Anr1 = recordStruct.Anr1; + record.Anr1Ton = recordStruct.Anr1Ton; + record.Anr2 = recordStruct.Anr2; + record.Anr2Ton = recordStruct.Anr2Ton; + record.Anr3 = recordStruct.Anr3; + record.Anr3Ton = recordStruct.Anr3Ton; + record.Email1 = recordStruct.Email1; + record.Email2 = recordStruct.Email2; + record.Email3 = recordStruct.Email3; + record.Email4 = recordStruct.Email4; + record.GroupIndex = recordStruct.GroupIndex; + record.PbControl = recordStruct.PbControl; + return record; + } + } + + internal static class PhonebookClassConversions + { + internal static PhonebookRecordStruct ConvertPhonebookrecord(PhonebookRecord record) + { + PhonebookRecordStruct recordStruct = new PhonebookRecordStruct(); + recordStruct.Type = record.Type; + recordStruct.Index = record.Index; + recordStruct.NextIndex = record.NextIndex; + recordStruct.Name = record.Name; + recordStruct.Dcs = record.Dcs; + recordStruct.Number = record.Number; + recordStruct.Ton = record.Ton; + recordStruct.Sne = record.Sne; + recordStruct.SneDcs = record.SneDcs; + recordStruct.Anr1 = record.Anr1; + recordStruct.Anr1Ton = record.Anr1Ton; + recordStruct.Anr2 = record.Anr2; + recordStruct.Anr2Ton = record.Anr2Ton; + recordStruct.Anr3 = record.Anr3; + recordStruct.Anr3Ton = record.Anr3Ton; + recordStruct.Email1 = record.Email1; + recordStruct.Email2 = record.Email2; + recordStruct.Email3 = record.Email3; + recordStruct.Email4 = record.Email4; + recordStruct.GroupIndex = record.GroupIndex; + recordStruct.PbControl = record.PbControl; + return recordStruct; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SatData.cs b/src/Tizen.Tapi/Tizen.Tapi/SatData.cs new file mode 100755 index 0000000..0a2f215 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SatData.cs @@ -0,0 +1,2097 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines SAT main menu info. + /// + public class SatMainMenuInfo + { + internal int Id; + internal bool IsPresent; + internal string Title; + internal IEnumerable Items; + internal ushort Num; + internal bool IsHelpInfo; + internal bool IsUpdated; + internal SatIconIdInfo IcnId; + internal SatIconIdListInfo IdList; + + internal SatMainMenuInfo() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command number represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Flag for checking whether main menu is present or not. + /// + /// Boolean value checking the presence of main menu. + public bool IsMainMenuPresent + { + get + { + return IsPresent; + } + } + + /// + /// Menu title text. + /// + /// Title text of the menu item represented in string. + public string MenuTitle + { + get + { + return Title; + } + } + + /// + /// Menu items. + /// + /// List of SatMenuInfo objects. + public IEnumerable MenuItems + { + get + { + return Items; + } + } + + /// + /// Number of menu itmes. + /// + /// An unsigned value representing the number of menu items. + public ushort MainMenuCount + { + get + { + return Num; + } + } + + /// + /// Flag for a help information request. + /// + /// Boolean value for checking the flag for help information request. + public bool IsMainMenuHelpInfo + { + get + { + return IsHelpInfo; + } + } + + /// + /// Updated Sat main menu or not. + /// + /// Boolean value to check whether Sat main menu is updated or not. + public bool IsUpdatedMainMenu + { + get + { + return IsUpdated; + } + } + + /// + /// Icon Identifier. + /// + /// An instance of SatIconIdInfo class representing the icon identifier. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + + /// + /// List of Icon Identifiers. + /// + /// An instance of SatIconIdListInfo class representing the icon identifier list. + public SatIconIdListInfo IconIdList + { + get + { + return IdList; + } + } + } + + + /// + /// A class which contains menu item information for the setup menu. + /// + public class SatMenuInfo + { + internal string Item; + internal char Id; + + internal SatMenuInfo() + { + } + + /// + /// Menu item character data. + /// + /// Menu item data represented in string. + public string MenuItem + { + get + { + return Item; + } + } + + /// + /// Identifies the item on the menu that the user selected. + /// + /// Item identifier value represented as a character. + public char ItemId + { + get + { + return Id; + } + } + } + + /// + /// A class defining the icon data object. + /// + public class SatIconIdInfo + { + internal bool IsPresent; + internal SatIconQualifierType Qualifier; + internal byte Id; + internal SatIconInfo Info; + + internal SatIconIdInfo() + { + } + + /// + /// Flag for checking whether the icon identifier exists. + /// + /// Boolean value representing if the icon exists or not. + public bool IsIconPresent + { + get + { + return IsPresent; + } + } + + /// + /// Icon qualifier type. + /// + /// Icon qualifier type represented as SatIconQualifierType enum. + public SatIconQualifierType IconQualifier + { + get + { + return Qualifier; + } + } + + /// + /// Icon identifier. + /// + /// A byte value representing the icon identifier. + public byte IconId + { + get + { + return Id; + } + } + + /// + /// Icon info. + /// + /// An instance of SatIconInfo class. + public SatIconInfo IconInfo + { + get + { + return Info; + } + } + } + + /// + /// A class containing the definition of icon info object. + /// + public class SatIconInfo + { + internal byte IconWidth; + internal byte IconHeight; + internal SatImageCodingScheme Scheme; + internal ushort IconLength; + internal ushort ClutLength; + internal string IcnFile; + internal string CltFile; + + internal SatIconInfo() + { + } + + /// + /// Icon width. + /// + /// Width of the icon represented in byte. + public byte Width + { + get + { + return IconWidth; + } + } + + /// + /// Icon height. + /// + /// Height of the icon represented in byte. + public byte Height + { + get + { + return IconHeight; + } + } + + /// + /// Image coding scheme. + /// + /// Image coding scheme represented as SatImageCodingScheme enum. + public SatImageCodingScheme Ics + { + get + { + return Scheme; + } + } + + /// + /// Icon data length. + /// + /// Data length of the icon represented in ushort. + public ushort IconDataLength + { + get + { + return IconLength; + } + } + + /// + /// Clut data length. + /// + /// Data length of the clut represented in ushort. + public ushort ClutDataLength + { + get + { + return ClutLength; + } + } + + /// + /// Icon file. + /// + /// Icon file string. + public string IconFile + { + get + { + return IcnFile; + } + } + + /// + /// Clut file. + /// + /// Clut file string. + public string ClutFile + { + get + { + return CltFile; + } + } + } + + /// + /// A class which defines the icon identifier data object. + /// + public class SatIconIdListInfo + { + internal bool IsPresent; + internal SatIconQualifierType Qualifier; + internal byte Count; + internal byte[] IconList; + internal IEnumerable Info; + + internal SatIconIdListInfo() + { + } + + /// + /// Flag for checking whether the icon identifier exists. + /// + /// Boolean value indicating the presence of icon. + public bool IsIconPresent + { + get + { + return IsPresent; + } + } + + /// + /// Icon list qualifier. + /// + /// Icon list qualifier represented in SatIconQualifierType enum. + public SatIconQualifierType IconListQualifier + { + get + { + return Qualifier; + } + } + + /// + /// Number of icons. + /// + /// Byte value indicating the number of icons. + public byte IconCount + { + get + { + return Count; + } + } + + /// + /// Icon identifier list. + /// + /// A byte array containing the list of Icon identifier. + public byte[] IconIdList + { + get + { + return IconList; + } + } + + /// + /// Icon list info. + /// + /// List of icon info. + public IEnumerable IconInfo + { + get + { + return Info; + } + } + } + + /// + /// A class containing display text proactive command for SAT UI. + /// + public class SatDisplayTextData + { + internal int Id; + internal SatTextInfo Text; + internal uint Drtn; + internal bool IsPrtyHigh; + internal bool IsRespRequired; + internal bool IsImmediateResp; + internal SatIconIdInfo IcnId; + + internal SatDisplayTextData() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command id in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Character data to display on screen. + /// + /// An instance of SatTextInfo containing text information. + public SatTextInfo TextInfo + { + get + { + return Text; + } + } + + /// + /// Duration of the display. + /// + /// Duration in integer format. + public uint Duration + { + get + { + return Drtn; + } + } + + /// + /// Flag that indicates whether text is to be displayed if some other app is using the screen. + /// + /// Boolean value checking the priority of the display. + public bool IsPriorityHigh + { + get + { + return IsPrtyHigh; + } + } + + /// + /// Flag that indicates whether user response is required. + /// + /// Boolean value to check the need of user response. + public bool IsUserResponseRequired + { + get + { + return IsRespRequired; + } + } + + /// + /// Flag for checking whether immediate response is required. + /// + /// Boolean value to check the immediate response status. + public bool IsImmediateResponse + { + get + { + return IsImmediateResp; + } + } + + /// + /// Icon Identifier. + /// + /// An instance of SatIconIdInfo class. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + } + + /// + /// A class defining character data for the SAT engine data structure. + /// + public class SatTextInfo + { + internal ushort Length; + internal byte[] Data; + + internal SatTextInfo() + { + } + + /// + /// Character data length. + /// + /// An unsigned short value representing the string length. + public ushort StringLength + { + get + { + return Length; + } + } + + /// + /// Character data. + /// + /// A byte array representing the string data. + public byte[] StringData + { + get + { + return Data; + } + } + } + + /// + /// A class which defines select item proactive command data for SAT UI. + /// + public class SatSelectItemData + { + internal int Id; + internal bool IsHelpAvailable; + internal SatTextInfo Text; + internal char DefaultIndex; + internal char ItemCount; + internal IEnumerable Items; + internal SatIconIdInfo IcnId; + internal SatIconIdListInfo IdList; + + internal SatSelectItemData() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Flag for a help information request. + /// + /// Boolean value to check whether help information is availale or not. + public bool IsHelpInfoAvailable + { + get + { + return IsHelpAvailable; + } + } + + /// + /// Menu title text. + /// + /// An instance of SatTextInfo class containing the text information. + public SatTextInfo TextInfo + { + get + { + return Text; + } + } + + /// + /// Selected default item. + /// + /// Default item index of the given items. + public char DefaultItemIndex + { + get + { + return DefaultIndex; + } + } + + /// + /// Number of menu items. + /// + /// Menu items count represented as a character. + public char MenuItemCount + { + get + { + return ItemCount; + } + } + + /// + /// Menu items. + /// + /// A list of SatMenuItemInfo objects. + public IEnumerable MenuItems + { + get + { + return Items; + } + } + + /// + /// Icon Identifier. + /// + /// An instance of SatIconIdInfo class. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + + /// + /// List of Icon Identifiers. + /// + /// An instance of SatIconIdListInfo class containing the list of icon identifiers. + public SatIconIdListInfo IconIdList + { + get + { + return IdList; + } + } + } + + /// + /// A class which defines the menu item data object. + /// + public class SatMenuItemInfo + { + internal byte Id; + internal byte Length; + internal byte[] Txt; + + internal SatMenuItemInfo() + { + } + + /// + /// Item identifier. + /// + /// Item Id represented in byte. + public byte ItemId + { + get + { + return Id; + } + } + + /// + /// Text length. + /// + /// Length of the text represented in byte. + public byte TextLength + { + get + { + return Length; + } + } + + /// + /// Text information. + /// + /// A byte array of length TextLength containing the text information. + public byte[] Text + { + get + { + return Txt; + } + } + } + + /// + /// A class which defines get inkey proactive command data for SAT UI. + /// + public class SatGetInKeyData + { + internal int Id; + internal SatInKeyType Type; + internal SatInputAlphabetType AlphabetType; + internal bool IsNumericFlag; + internal bool IsHelpAvailable; + internal SatTextInfo Text; + internal uint Duratn; + internal SatIconIdInfo IcnId; + + internal SatGetInKeyData() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Input Type. + /// + /// Character Set or Yes/No. + public SatInKeyType KeyType + { + get + { + return Type; + } + } + + /// + /// Input character mode. + /// + /// SMS default, UCS2. + public SatInputAlphabetType InputAlphabetType + { + get + { + return AlphabetType; + } + } + + /// + /// Flag for checking whether input character is numeric. + /// + /// Boolean value for checking whether input character is numeric or not. + public bool IsNumeric + { + get + { + return IsNumericFlag; + } + } + + /// + /// Help info request flag. + /// + /// Boolean value for checking whether help info is available or not. + public bool IsHelpInfoAvailable + { + get + { + return IsHelpAvailable; + } + } + + /// + /// Character data to display on the screen. + /// + /// An instance of SatTextInfo class containing the text information. + public SatTextInfo TextInfo + { + get + { + return Text; + } + } + + /// + /// Duration of the display. + /// + /// Display duration represented in unsigned integer. + public uint Duration + { + get + { + return Duratn; + } + } + + /// + /// Icon identifier. + /// + /// An instance of SatIconIdInfo class containing the Icon identifier information. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + } + + /// + /// A class which defines get input proactive command data for SAT UI. + /// + public class SatGetInputData + { + internal int Id; + internal SatInputAlphabetType Type; + internal bool IsNumericFlag; + internal bool IsHelpAvailable; + internal bool IsEcho; + internal SatTextInfo Text; + internal SatResponseLengthInfo RespLength; + internal SatTextInfo Default; + internal SatIconIdInfo IcnId; + + internal SatGetInputData() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Input character mode. + /// + /// SMS default, UCS2. + public SatInputAlphabetType AlphabetType + { + get + { + return Type; + } + } + + /// + /// Flag to check whether input character is numeric. + /// + /// Boolean value to check the nature of input character. + public bool IsNumeric + { + get + { + return IsNumericFlag; + } + } + + /// + /// Help info request flag. + /// + /// Boolean value to check help information availability. + public bool IsHelpInfoAvailable + { + get + { + return IsHelpAvailable; + } + } + + /// + /// Flag that indicates whether to show input data on the screen. + /// + /// Boolean value to check the availability of input data on the screen. + public bool IsEchoInput + { + get + { + return IsEcho; + } + } + + /// + /// Character data to display on the screen. + /// + /// An instance of SatTextInfo. + public SatTextInfo TextInfo + { + get + { + return Text; + } + } + + /// + /// Input data min, max length. + /// + /// An instance of SatResponseLengthInfo. + public SatResponseLengthInfo ResponseLength + { + get + { + return RespLength; + } + } + + /// + /// Default input character data. + /// + /// An instance of SatTextInfo. + public SatTextInfo DefualtText + { + get + { + return Default; + } + } + + /// + /// Icon identifier. + /// + /// An instance of SatIconIdInfo. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + } + + /// + /// A class which defines expected user response length. + /// + public class SatResponseLengthInfo + { + internal byte Min; + internal byte Max; + + internal SatResponseLengthInfo() + { + } + + /// + /// User response length's minimum value. + /// + /// Minimum value represented in byte. + public byte Minimum + { + get + { + return Min; + } + } + + /// + /// User response length's maximum value. + /// + /// Maximum value represented in byte. + public byte Maximum + { + get + { + return Max; + } + } + } + + /// + /// A class which defines refresh proactive command data for applications that are concerned with files residing on USIM. + /// + public class SatRefreshData + { + internal int Id; + internal SatRefreshAppType Type; + internal SatCmdQualiRefresh Mode; + internal byte Count; + internal IEnumerable IdList; + + internal SatRefreshData() + { + } + + /// + /// Proactive command number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Concerned application type. + /// + /// Refresh app type represented in SatRefreshAppType enum. + public SatRefreshAppType AppType + { + get + { + return Type; + } + } + + /// + /// Refresh mode. + /// + /// Refresh mode represented in SatCmdQualiRefresh enum. + public SatCmdQualiRefresh RefreshMode + { + get + { + return Mode; + } + } + + /// + /// Refresh file count. + /// + /// File count represented in byte. + public byte FileCount + { + get + { + return Count; + } + } + + /// + /// Refresh file identifiers. + /// + /// A list of SimFileId enums. + public IEnumerable FileId + { + get + { + return IdList; + } + } + } + + /// + /// A class which defines send SMS proactive command data for the SMS application. + /// + public class SatSendSmsData + { + internal int Id; + internal bool IsPackRequired; + internal SatAddressData Addr; + internal SatSmsTpduInfo Info; + + internal SatSendSmsData() + { + } + + /// + /// Proactive Command Number sent by USIM. + /// + /// Command id represented in integer. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Flag to check if packing is required for SMS Tpdu. + /// + /// Boolean value to check the need of packing in SMS Tpdu data. + public bool IsPackingRequired + { + get + { + return IsPackRequired; + } + } + + /// + /// Destination address. + /// + /// An instance of SatAddressData containing the address info. + public SatAddressData Address + { + get + { + return Addr; + } + } + + /// + /// SMS Tpdu data. + /// + /// An instance of SatSmsTpduInfo. + public SatSmsTpduInfo TpduInfo + { + get + { + return Info; + } + } + } + + /// + /// A class which defines SAT address data object. + /// + public class SatAddressData + { + internal SimTypeOfNumber Type; + internal SimNumberPlanIdentity NumId; + internal byte NumLen; + internal string Number; + + internal SatAddressData() + { + } + + /// + /// Type of number. + /// + /// Sim type of number represented in SimTypeOfNumber enum. + public SimTypeOfNumber Ton + { + get + { + return Type; + } + } + + /// + /// Number plan identity. + /// + /// Sim number plan represented in SimNumberPlanIdentity enum. + public SimNumberPlanIdentity Npi + { + get + { + return NumId; + } + } + + /// + /// Length of dialling number. + /// + /// Dialling number length represented in byte. + public byte DiallingNumberLength + { + get + { + return NumLen; + } + } + + /// + /// Dialling number. + /// + /// Dialling number represented in string. + public string DiallingNumber + { + get + { + return Number; + } + } + } + + /// + /// A class which defines the Result data object. + /// + public class SatSmsTpduInfo + { + internal SatSmsTpduType Type; + internal byte Length; + internal byte[] Data; + + internal SatSmsTpduInfo() + { + } + + /// + /// SMS TPDU type. + /// + /// Tpdu type represented in SatSmsTpduType. + public SatSmsTpduType TpduType + { + get + { + return Type; + } + } + + /// + /// SMS TPDU data length. + /// + /// Length of Tpdu data represented in byte. + public byte DataLength + { + get + { + return Length; + } + } + + /// + /// SMS TPDU data. + /// + /// An array of bytes representing TPDU data. + public byte[] TpduData + { + get + { + return Data; + } + } + } + + /// + /// A class which defines Event list info. + /// + public class SatEventListData + { + internal bool IsDownloadActive; + internal bool IsCallEvent; + internal bool IsConnected; + internal bool IsDisconnected; + internal bool IsStatus; + internal bool IsUsrActivity; + internal bool IsIdleScreen; + internal bool IsReaderStatus; + internal bool IsLanguageSelect; + internal bool IsBrowserTerminate; + internal bool IsDataPresent; + internal bool IsCnlStatus; + + internal SatEventListData() + { + } + + /// + /// Flag to check if the event download is acive. + /// + /// Boolean value to check for active event download. + public bool IsEventDownloadActive + { + get + { + return IsDownloadActive; + } + } + + /// + /// Flag to check if the event is about Mt call event. + /// + /// Boolean value to check the event for Mt call event. + public bool IsMtCallEvent + { + get + { + return IsCallEvent; + } + } + + /// + /// Flag to check if the call is connected. + /// + /// Boolean value to check the connection of call. + public bool IsCallConnected + { + get + { + return IsConnected; + } + } + + /// + /// Flag to check if the call is disconnected. + /// + /// Boolean value to check the call disconnection. + public bool IsCallDisconnected + { + get + { + return IsDisconnected; + } + } + + /// + /// Flag to check if the event is aboout locaion status. + /// + /// Boolean value to check the presence of location status in the event. + public bool IsLocationStatus + { + get + { + return IsStatus; + } + } + + /// + /// Flag to check if the event is about user activity. + /// + /// Boolean value to check the presence of user activity. + public bool IsUserActivity + { + get + { + return IsUsrActivity; + } + } + + /// + /// Flag to check if idle screen is available. + /// + /// Boolean value to check the availability of idle screen. + public bool IsIdleScreenAvailable + { + get + { + return IsIdleScreen; + } + } + + /// + /// Flag to check if the event is about card reader status. + /// + /// Boolean value to check the status of card reader. + public bool IsCardReaderStatus + { + get + { + return IsReaderStatus; + } + } + + /// + /// Flag to check if the event is about language selection. + /// + /// Boolean value to check if the event is language selection. + public bool IsLanguageSelection + { + get + { + return IsLanguageSelect; + } + } + + /// + /// Flag to check if the browser is terminated. + /// + /// Boolean value to check the termination of browser. + public bool IsBrowserTermination + { + get + { + return IsBrowserTerminate; + } + } + + /// + /// Flag to check if the data is available. + /// + /// Boolean value to check availablility of data. + public bool IsDataAvailable + { + get + { + return IsDataPresent; + } + } + + /// + /// Flag to check if the event has channel status. + /// + /// Boolean value to check if this field is a channel status. + public bool IsChannelStatus + { + get + { + return IsCnlStatus; + } + } + } + + /// + /// A class which defines send DTMF proactive command data for the DTMF application. + /// + public class SatSendDtmfData + { + internal int Id; + internal bool IsHidden; + internal SatTextInfo Dtmf; + + internal SatSendDtmfData() + { + } + + /// + /// Proactive Command Number sent by USIM + /// + /// Command id represented in integer. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Hidden mode flag. + /// + /// Flag to check if the data is in hidden mode. + public bool IsHiddenMode + { + get + { + return IsHidden; + } + } + + /// + /// DTMF string data. + /// + /// An instance of SatTextInfo containing DTMF string data. + public SatTextInfo DtmfString + { + get + { + return Dtmf; + } + } + } + + /// + /// A class which defines call control confirm data for Call/Ss. + /// + public class SatCallCtrlData + { + internal SatTextInfo Addr; + internal SatTextInfo SubAddr; + internal SatBcRepeatIndicatorType RepeatIndicator; + internal SatTextInfo Ccparam1; + internal SatTextInfo Ccparam2; + + internal SatCallCtrlData() + { + } + + /// + /// Call destination address. + /// + /// An instance of SatTextInfo class. + public SatTextInfo Address + { + get + { + return Addr; + } + } + + /// + /// Call SUB address. + /// + /// An instance of SatTextInfo class. + public SatTextInfo SubAddress + { + get + { + return SubAddr; + } + } + + /// + /// BC repeat indicator. + /// + /// SatBcRepeatIndicatorType enum representing Bc repeat indicator. + public SatBcRepeatIndicatorType BcRepeatIndicator + { + get + { + return RepeatIndicator; + } + } + + /// + /// Configuration Capability Parameter 1. + /// + /// An instance of SatTextInfo class. + public SatTextInfo Ccp1 + { + get + { + return Ccparam1; + } + } + + /// + /// Configuration Capability Parameter 2. + /// + /// An instance of SatTextInfo class. + public SatTextInfo Ccp2 + { + get + { + return Ccparam2; + } + } + } + + /// + /// A class which defines common call control confirm data. + /// + public class SatCallCtrlConfirmData + { + internal SatCallType Type; + internal SatCallCtrlResultType Result; + internal SatTextInfo Data; + internal bool IsUserInfoEnabled; + internal SatCallCtrlData CallData; + internal SatCallCtrlData SsData; + internal SatTextInfo Ussd; + + internal SatCallCtrlConfirmData() + { + } + + /// + /// Call control confirm type - call, SS or USSD. + /// + /// Type of call represented in SatCallType enum. + public SatCallType CallType + { + get + { + return Type; + } + } + + /// + /// Call control result type. + /// + /// Type of call control result represented in SatCallCtrlResultType enum. + public SatCallCtrlResultType CallCtrlResult + { + get + { + return Result; + } + } + + /// + /// Call control display data. + /// + /// An instance of SatTextInfo class containing information about call control display data. + public SatTextInfo DisplayData + { + get + { + return Data; + } + } + + /// + /// Flag for checking existence of call control display. + /// + /// Boolean value to check existence of user info display. + public bool IsUserInfoDisplayEnabled + { + get + { + return IsUserInfoEnabled; + } + } + + /// + /// Call control call address. + /// + /// + /// This value will be filled only if CallType is MoVoice. Otherwise it will be null. + /// + /// An instance of SatCallCtrlData containing call control call address. + public SatCallCtrlData CallCtrlCallData + { + get + { + return CallData; + } + } + + /// + /// Call control SS string. + /// + /// + /// This value will be filled only if CallType is Ss. Otherwise it will be null. + /// + /// An instance of SatCallCtrlData containing call control SS string. + public SatCallCtrlData CallCtrlSsData + { + get + { + return SsData; + } + } + + /// + /// Call control USSD string. + /// + /// + /// This value will be filled only if CallType is Ussd. Otherwise it will be null. + /// + /// An instance of SatTextInfo class containing call control USSD string. + public SatTextInfo UssdString + { + get + { + return Ussd; + } + } + } + + /// + /// A class which defines the data coding scheme object. + /// + public class SatDataCodingScheme + { + internal bool IsCompressed; + internal SatAlphabetFormat Alphabet; + internal SatMsgClassType Msg; + internal byte Dcs; + + internal SatDataCodingScheme() + { + } + + /// + /// Flag to verify the compressed format. + /// + /// Boolean value to check the compressed value. + public bool IsCompressedFormat + { + get + { + return IsCompressed; + } + } + + /// + /// Alphabet format type. + /// + /// Represented in SatAlphabetFormat enum. + public SatAlphabetFormat AlphabetFormat + { + get + { + return Alphabet; + } + } + + /// + /// Type of message class. + /// + /// Message class represented in SatMsgClassType enum. + public SatMsgClassType MsgClass + { + get + { + return Msg; + } + } + + /// + /// Raw DCS info. + /// + /// Dcs info stored in byte. + public byte RawDcs + { + get + { + return Dcs; + } + } + } + + /// + /// A class which defines text string data object. + /// + public class SatTextTypeInfo + { + internal bool IsDigit; + internal SatDataCodingScheme CodingScheme; + internal ushort StringLen; + internal string Text; + + internal SatTextTypeInfo() + { + } + + /// + /// Flag for checking whether only digits are used. + /// + /// Boolean value for checking the usage of only digits. + public bool IsDigitOnly + { + get + { + return IsDigit; + } + } + + /// + /// Data coding scheme. + /// + /// An instance of SatDataCodingScheme class. + public SatDataCodingScheme DCS + { + get + { + return CodingScheme; + } + } + + /// + /// Text length. + /// + /// Length of the string in unsigned short format. + public ushort StringLength + { + get + { + return StringLen; + } + } + + /// + /// Text string. + /// + /// Text represented in string. + public string TextString + { + get + { + return Text; + } + } + } + + /// + /// A class which defines MO SMS control confirm data. + /// + public class SatMoSmsCtrlData + { + internal SatCallCtrlResultType Result; + internal bool IsUserInfo; + internal SatTextTypeInfo Data; + internal SatTextTypeInfo RpAddr; + internal SatTextTypeInfo TpAddr; + + internal SatMoSmsCtrlData() + { + } + + /// + /// Envelope result. + /// + /// Result of MO SMS control confirm data. + public SatCallCtrlResultType MoResult + { + get + { + return Result; + } + } + + /// + /// Display present flag. + /// + /// Boolean value to check the presence of user information display. + public bool IsUserInfoDisplayEnabled + { + get + { + return IsUserInfo; + } + } + + /// + /// Display data for sending SMS. + /// + /// An instance of SatTextTypeInfo containing display data for sending SMS. + public SatTextTypeInfo DisplayData + { + get + { + return Data; + } + } + + /// + /// The RP destination address of the service center. + /// + /// An instance of SatTextTypeInfo containing RP destination address. + public SatTextTypeInfo RpDestAddress + { + get + { + return RpAddr; + } + } + + /// + /// The TP destinationn address. + /// + /// An instance of SatTextTypeInfo containing TP destination address. + public SatTextTypeInfo TpDestAddress + { + get + { + return TpAddr; + } + } + } + + /// + /// A class which defines setup call proactive command data for the call application. + /// + public class SatSetupCallData + { + internal int Id; + internal SatCmdQualiSetupCall Type; + internal SatTextInfo Text; + internal SatTextInfo Number; + internal uint Duratn; + internal SatIconIdInfo IcnId; + + internal SatSetupCallData() + { + } + + /// + /// Proactive Command Number sent by USIM. + /// + /// Command Id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Call type + /// + /// Type of call represented in SatCmdQualiSetupCall enum. + public SatCmdQualiSetupCall CallType + { + get + { + return Type; + } + } + + /// + /// Display data for calling. + /// + /// An instance of SatTextInfo containing display data for calling. + public SatTextInfo DisplayText + { + get + { + return Text; + } + } + + /// + /// Call number. + /// + /// An instance of SatTextInfo containing call number information. + public SatTextInfo CallNumber + { + get + { + return Number; + } + } + + /// + /// Maximum repeat duration. + /// + /// Max repeat duration represented in unsigned integer format. + public uint Duration + { + get + { + return Duratn; + } + } + + /// + /// Icon identifier for the call application. + /// + /// An instance of SatIconIdInfo containing Icon id information. + public SatIconIdInfo IconId + { + get + { + return IcnId; + } + } + } + + /// + /// A class which defines Send SS notification proactive command data for the applicaiton. + /// + public class SatSendSsData + { + internal int Id; + internal SimTypeOfNumber NumType; + internal SimNumberPlanIdentity Identity; + internal byte StringLen; + internal string Ss; + + internal SatSendSsData() + { + } + + /// + /// Proactive Command Number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Type of Number. + /// + /// TON represented in SimTypeOfNumber enum. + public SimTypeOfNumber Ton + { + get + { + return NumType; + } + } + + /// + /// Numbering Plan Identity. + /// + /// NPI reprensented in SimNumberPlanIdentity enum. + public SimNumberPlanIdentity Npi + { + get + { + return Identity; + } + } + + /// + /// SS string length. + /// + /// Length of SS string represented in byte. + public byte StringLength + { + get + { + return StringLen; + } + } + + /// + /// SS string. + /// + /// Text string represented in string. + public string SsString + { + get + { + return Ss; + } + } + } + + /// + /// A class which defines send USSD notification proactive command data for the application. + /// + public class SatSetupUssdData + { + internal int Id; + internal byte Dcs; + internal byte StringLen; + internal string Ussd; + + internal SatSetupUssdData() + { + } + + /// + /// Proactive Command Number sent by USIM. + /// + /// Command id represented in integer format. + public int CommandId + { + get + { + return Id; + } + } + + /// + /// Raw DCS info. + /// + /// Raw DCS information represented in byte. + public byte RawDcs + { + get + { + return Dcs; + } + } + + /// + /// USSD string length. + /// + /// Length of USSD string in byte. + public byte UssdStringLength + { + get + { + return StringLen; + } + } + + /// + /// USSD string. + /// + /// Ussd text represented in string format. + public string UssdString + { + get + { + return Ussd; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SatEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/SatEnumerations.cs new file mode 100755 index 0000000..f3477c0 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SatEnumerations.cs @@ -0,0 +1,471 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the UI display status. + /// + public enum SatUiDisplayStatus + { + /// + /// Infoms about UI display success. + /// + Success = 0x00, + /// + /// Informs about UI display failure. + /// + Fail = 0x01 + } + + /// + /// Enumeration for the command qualifier values of the refresh command. + /// + public enum SatCmdQualiRefresh + { + /// + /// Command qualifier for Refresh SIM Init And Full File Change Notification. + /// + SimInitAndFullFcn = 0x00, + /// + /// Command qualifier for Refresh File Change Notification. + /// + Fcn = 0x01, + /// + /// Command qualifier for Refresh SIM Init And File Change Notification. + /// + SimInitAndFcn = 0x02, + /// + /// Command qualifier for Refresh Sim Init. + /// + SimInit = 0x03, + /// + /// Command qualifier for Refresh Sim Reset. + /// + SimReset = 0x04, + /// + /// Command qualifier for Refresh 3G Application Reset. + /// + ApplicationReset3G = 0x05, + /// + /// Command qualifier for Refresh 3G Session Reset. + /// + SessionReset = 0x06, + /// + /// Command qualifier for Refresh Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the icon qualifier. + /// + public enum SatIconQualifierType + { + /// + /// Icon Quali Self Explanatory. + /// + SelfExplanatory = 0, + /// + /// Icon Quali Not Self Explanatory. + /// + NotSelfExplanatory = 1, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the SIM image coding scheme type. + /// + public enum SatImageCodingScheme + { + /// + /// Basic coding scheme. + /// + Basic = 0x11, + /// + /// Colour coding scheme. + /// + Colour = 0x21, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the inkey type. + /// + public enum SatInKeyType + { + /// + /// Command qualifier for Inkey type character set enabled. + /// + CharacterSetEnabled = 0, + /// + /// Command qualifier for Inkey type Yes No requested. + /// + YesNoRequested = 1 + } + + /// + /// Enumeration for the user input type. + /// + public enum SatInputAlphabetType + { + /// + /// SMS default. + /// + SmsDefault = 1, + /// + /// UCS2 alphabet type. + /// + Ucs2 = 2 + } + + /// + /// Enumeration for the refresh application type. + /// + public enum SatRefreshAppType + { + /// + /// Phonebook type. + /// + Contact = 0x00, + /// + /// SMS type. + /// + Msg, + /// + /// Other. + /// + Other, + /// + /// Maximum value. + /// + Max + } + + /// + /// Enumeration for the SMS TPDU type. + /// + public enum SatSmsTpduType + { + /// + /// Deliver TPDU type. + /// + DeliverTpdu = 0, + /// + /// Deliver RPT type. + /// + DeliverRpt = 1, + /// + /// Submit TPDU type. + /// + SubmitTpdu = 2, + /// + /// Submit RPT type. + /// + SubmitRpt = 3, + /// + /// Status RPT type. + /// + StatusRpt = 4, + /// + /// TPDU CMD type. + /// + TpduCmd = 5 + } + + /// + /// Enumeration for the type of command and the next action indicator. + /// + public enum SatCommandType + { + /// + /// None. + /// + None = 0x00, + /// + /// Refresh. + /// + Refresh = 0x01, + /// + /// More time. + /// + MoreTime = 0x02, + /// + /// Setup event list. + /// + SetupEventList = 0x05, + /// + /// Setup call. + /// + SetupCall = 0x10, + /// + /// Send SS. + /// + SendSs = 0x11, + /// + /// Send USSD. + /// + SendUssd = 0x12, + /// + /// Send SMS. + /// + SendSms = 0x13, + /// + /// Send DTMF. + /// + SendDtmf = 0x14, + /// + /// Launch browser. + /// + LaunchBrowser = 0x15, + /// + /// Play tone. + /// + PlayTone = 0x20, + /// + /// Display text. + /// + DisplayText = 0x21, + /// + /// Get inkey. + /// + GetInKey = 0x22, + /// + /// Get input. + /// + GetInput = 0x23, + /// + /// Select item. + /// + SelectItem = 0x24, + /// + /// Setup menu. + /// + SetupMenu = 0x25, + /// + /// Provide local info. + /// + ProvideLocalInfo = 0x26, + /// + /// Setup idle mode text. + /// + SetupIdleModeText = 0x28, + /// + /// Language notification. + /// + LanguageNotification = 0x35, + /// + /// Open channel - class e. + /// + OpenChannel = 0x40, + /// + /// Close channel - class e. + /// + CloseChannel = 0x41, + /// + /// Receive data - class e. + /// + ReceiveData = 0x42, + /// + /// Send data. + /// + SendData = 0x43, + /// + /// Get channel status - class e. + /// + GetChannelStatus = 0x44, + /// + /// Inform to end the execution of a proactive command. + /// + EndOfAppExec = 0xFD, + /// + /// Inform end proactive session. + /// + EndProactiveSession = 0xFE, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the SAT call type. + /// + public enum SatCallType + { + /// + /// MO voice. + /// + MoVoice = 0x00, + /// + /// MO SMS. + /// + MoSms, + /// + /// SS. + /// + Ss, + /// + /// USSD. + /// + Ussd, + /// + /// PDP context action. + /// + PdpContextAct, + /// + /// Max. + /// + Max + } + + /// + /// Enumeration for the result of call control by SIM. + /// + public enum SatCallCtrlResultType + { + /// + /// Allowed with no mod. + /// + AllowedNoMod = 0, + /// + /// Not allowed. + /// + NotAllowed = 1, + /// + /// Allowed with mod. + /// + AllowedWithMod = 2, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the SIM ATK BC repeat indicator type. + /// + public enum SatBcRepeatIndicatorType + { + /// + /// Alternate mode. + /// + AlternateMode = 0x01, + /// + /// Sequential mode. + /// + SequentialMode = 0x03, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for alphabet format. + /// + public enum SatAlphabetFormat + { + /// + /// SMS default. + /// + SmsDefault = 0x00, + /// + /// 8Bit data. + /// + Data8Bit = 0x01, + /// + /// UCS2. + /// + Ucs2 = 0x02, + /// + /// Reserved. + /// + Reserved = 0x03 + } + + /// + /// Enumeration for the message class. + /// + public enum SatMsgClassType + { + /// + /// None. + /// + None = 0x00, + /// + /// Class 0. + /// + Class0 = 0x01, + /// + /// Class 1 Default meaning: ME - specific. + /// + Class1, + /// + /// Class 2 SIM specific message. + /// + Class2, + /// + /// Class 3 Default meaning : TE specific. + /// + Class3, + /// + /// Reserved. + /// + Reserved = 0xFF + } + + /// + /// Enumeration for the command qualifier values of the setup call command. + /// + public enum SatCmdQualiSetupCall + { + /// + /// Command qualifier for setup call if another call is not busy. + /// + AnotherCallNotBusy = 0x00, + /// + /// Command qualifier for setup call if another call is not busy with redial. + /// + AnotherCallNotBusyWithRedial = 0x01, + /// + /// Command qualifier for setup call putting all other calls on hold. + /// + PutAllOtherCallsOnHold = 0x02, + /// + /// Command qualifier for setup call putting all other calls on hold with redial. + /// + PutAllOtherCallsOnHoldWithRedial = 0x03, + /// + /// Command qualifier for setup call disconnecting all other calls. + /// + DisconnectAllOtherCalls = 0x04, + /// + /// Command qualifier for setup call disconnecting all other calls with redial. + /// + DisconnectAllOtherCallsWithRedial = 0x05, + /// + /// Reserved. + /// + Reserved = 0xFF + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SatStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/SatStructs.cs new file mode 100755 index 0000000..cac7b82 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SatStructs.cs @@ -0,0 +1,947 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Text; +using System; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct SatMenuSelectionInfoStruct + { + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatEventDownloadInfoStruct + { + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatUiUserConfirmInfoStruct + { + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatMainMenuInfoStruct + { + internal int CommandId; + internal int IsMainMenuPresent; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Title; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.LPStruct)] + internal SatMenuInfoStruct[] MenuItem; + internal ushort NumOfMenuItems; + internal int IsMainMenuHelpInfo; + internal int IsUpdatedMainMenu; + internal SatIconIdentifierStruct IconId; + internal SatIconIdentifierListStruct IconIdList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatMenuInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 261)] + internal string Item; + internal char ItemId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatIconIdentifierStruct + { + internal int IsPresent; + internal SatIconQualifierType IconQualifier; + internal byte IconIdentifier; + internal SatIconInfoStruct IconInfo; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatIconInfoStruct + { + internal byte Width; + internal byte Height; + internal SatImageCodingScheme Ics; + internal ushort IconDataLength; + internal ushort ClutDataLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)] + internal string IconFile; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)] + internal string ClutFile; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatIconIdentifierListStruct + { + internal int IsPresent; + internal SatIconQualifierType IconListQualifier; + internal byte IconCount; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 50)] + internal string IconIdentifierList; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50, ArraySubType = UnmanagedType.LPStruct)] + internal SatIconInfoStruct[] IconInfoList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatDisplayTextStruct + { + internal int CommandId; + internal SatTextInfoStruct Text; + internal uint Duration; + internal int IsPriorityHigh; + internal int IsUserResponseRequired; + internal int IsImmediateResponse; + internal SatIconIdentifierStruct IconId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatTextInfoStruct + { + internal ushort Length; + internal IntPtr DataString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSelectItemStruct + { + internal int commandId; + internal int IsHelpInfoAvailable; + internal SatTextInfoStruct Text; + internal char DefaultItemIndex; + internal char MenuItemCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 40, ArraySubType = UnmanagedType.LPStruct)] + internal SatMenuItemInfoStruct[] MenuItems; + internal SatIconIdentifierStruct IconId; + internal SatIconIdentifierListStruct IconIdList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatMenuItemInfoStruct + { + internal byte ItemId; + internal byte TextLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string Text; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatGetInKeyStruct + { + internal int CommandId; + internal SatInKeyType KeyType; + internal SatInputAlphabetType InputType; + internal int IsNumeric; + internal int IsHelpInfoAvailable; + internal SatTextInfoStruct Text; + internal uint Duration; + internal SatIconIdentifierStruct IconId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatGetInputStruct + { + internal int CommandId; + internal SatInputAlphabetType Type; + internal int IsNumeric; + internal int IsHelpInfoAvailable; + internal int IsEchoInput; + internal SatTextInfoStruct Text; + internal SatResponseLengthStruct RespLength; + internal SatTextInfoStruct DefaultText; + internal SatIconIdentifierStruct IconId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatResponseLengthStruct + { + internal byte Min; + internal byte Max; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatRefreshStruct + { + internal int CommandId; + internal SatRefreshAppType AppType; + internal SatCmdQualiRefresh RefreshMode; + internal byte FileCount; + [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.U4, SizeConst = 20)] + internal SimFileId[] fileId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSendSmsStruct + { + internal int CommandId; + internal int IsPackingRequired; + internal SatAddressStruct Address; + internal SatSmsTpduStruct SmsTpdu; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatAddressStruct + { + internal SimTypeOfNumber Ton; + internal SimNumberPlanIdentity Npi; + internal byte DiallingNumLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 200)] + internal string DiallingNumber; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSmsTpduStruct + { + internal SatSmsTpduType TpduType; + internal byte DataLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 175)] + internal string Data; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatEventListDataStruct + { + internal int IsEventDownloadActive; + internal int IsMtCallEvent; + internal int IsCallConnected; + internal int IsCallDisconnected; + internal int IsLocationStatus; + internal int IsUserActivity; + internal int IsIdleScreenAvailable; + internal int IsCardReaderStatus; + internal int IsLanguageSelection; + internal int IsBrowserTermination; + internal int IsDataAvailable; + internal int IsChannelStatus; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSendDtmfDataStruct + { + internal int CommandId; + internal int IsHiddenMode; + internal SatTextInfoStruct DtmfString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatCallCtrlIndCallSsDataStruct + { + internal SatTextInfoStruct Address; + internal SatTextInfoStruct SubAddress; + internal SatBcRepeatIndicatorType BcRepeatIndicator; + internal SatTextInfoStruct Ccp1; + internal SatTextInfoStruct Ccp2; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatCallCtrlIndUssdDataStruct + { + internal SatTextInfoStruct UssdString; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct SatCallCtrlIndStruct + { + [FieldOffset(0)] + internal SatCallCtrlIndCallSsDataStruct CallCtrlCnfCallData; + [FieldOffset(0)] + internal SatCallCtrlIndCallSsDataStruct CallCtrlCnfSsData; + [FieldOffset(0)] + internal SatCallCtrlIndUssdDataStruct CallCtrlCnfUssdData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatCallCtrlIndDataStruct + { + internal SatCallType CallCtrlCnfType; + internal SatCallCtrlResultType CallCtrlResult; + internal SatTextInfoStruct DisplayData; + internal int IsUserInfoDispEnabled; + internal SatCallCtrlIndStruct CallCtrlIndData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatTextTypeInfoStruct + { + internal int IsDigitOnly; + internal SatDataCodingSchemeStruct Dcs; + internal ushort StringLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 501)] + internal string TextString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatDataCodingSchemeStruct + { + internal int IsCompressedFormat; + internal SatAlphabetFormat AlphabetFormat; + internal SatMsgClassType MsgClass; + internal byte RawDcs; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatMoSmsCtrlDataStruct + { + internal SatCallCtrlResultType Result; + internal int IsUserInfoDisplayEnabled; + internal SatTextTypeInfoStruct DisplayData; + internal SatTextTypeInfoStruct RpDestAddr; + internal SatTextTypeInfoStruct TpDestAddr; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSetupCallDataStruct + { + internal int CommandId; + internal SatCmdQualiSetupCall CallType; + internal SatTextInfoStruct DisplayText; + internal SatTextInfoStruct CallNumber; + internal uint Duration; + internal SatIconIdentifierStruct IconId; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSendSsDataStruct + { + internal int CommandId; + internal SimTypeOfNumber Ton; + internal SimNumberPlanIdentity Npi; + internal byte StringLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 161)] + internal string SsString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatSetupUssdDataStruct + { + internal int CommandId; + internal byte RawDcs; + internal byte UssdStringLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 266)] + internal string UssdString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SatResultDataStruct + { + } + + internal static class SatStructConversions + { + internal static SatTextInfo ConvertSatTextInfoStruct(SatTextInfoStruct textStruct) + { + SatTextInfo textInfo = new SatTextInfo(); + textInfo.Length = textStruct.Length; + Marshal.Copy(textStruct.DataString, textInfo.Data, 0, 501); + return textInfo; + } + + internal static SatIconInfo ConvertSatIconInfoStruct(SatIconInfoStruct iconStruct) + { + SatIconInfo iconInfo = new SatIconInfo(); + iconInfo.IconWidth = iconStruct.Width; + iconInfo.IconHeight = iconStruct.Height; + iconInfo.Scheme = iconStruct.Ics; + iconInfo.IconLength = iconStruct.IconDataLength; + iconInfo.ClutLength = iconStruct.ClutDataLength; + iconInfo.IcnFile = iconStruct.IconFile; + iconInfo.CltFile = iconStruct.ClutFile; + return iconInfo; + } + + internal static SatIconIdInfo ConvertSatIconIdentifierStruct(SatIconIdentifierStruct idStruct) + { + SatIconIdInfo iconId = new SatIconIdInfo(); + if (idStruct.IsPresent == 1) + { + iconId.IsPresent = true; + } + + else if (idStruct.IsPresent == 0) + { + iconId.IsPresent = false; + } + + iconId.Qualifier = idStruct.IconQualifier; + iconId.Id = idStruct.IconIdentifier; + iconId.Info = ConvertSatIconInfoStruct(idStruct.IconInfo); + return iconId; + } + + internal static SatIconIdListInfo ConvertSatIconIdListStruct(SatIconIdentifierListStruct listStruct) + { + SatIconIdListInfo iconIdList = new SatIconIdListInfo(); + if (listStruct.IsPresent == 1) + { + iconIdList.IsPresent = true; + } + + else if (listStruct.IsPresent == 0) + { + iconIdList.IsPresent = false; + } + + iconIdList.Qualifier = listStruct.IconListQualifier; + iconIdList.Count = listStruct.IconCount; + iconIdList.IconList = Encoding.ASCII.GetBytes(listStruct.IconIdentifierList); + List iconInfoList = new List(); + foreach (SatIconInfoStruct info in listStruct.IconInfoList) + { + iconInfoList.Add(ConvertSatIconInfoStruct(info)); + } + + iconIdList.Info = iconInfoList; + return iconIdList; + } + + internal static SatMainMenuInfo ConvertSatMainMenuInfoStruct(SatMainMenuInfoStruct infoStruct) + { + SatMainMenuInfo mainMenuInfo = new SatMainMenuInfo(); + mainMenuInfo.Id = infoStruct.CommandId; + if (infoStruct.IsMainMenuPresent == 1) + { + mainMenuInfo.IsPresent = true; + } + + else if (infoStruct.IsMainMenuPresent == 0) + { + mainMenuInfo.IsPresent = false; + } + + mainMenuInfo.Title = infoStruct.Title; + List menuInfoList = new List(); + foreach (SatMenuInfoStruct menu in infoStruct.MenuItem) + { + SatMenuInfo menuInfo = new SatMenuInfo(); + menuInfo.Item = menu.Item; + menuInfo.Id = menu.ItemId; + menuInfoList.Add(menuInfo); + } + + mainMenuInfo.Items = menuInfoList; + mainMenuInfo.Num = infoStruct.NumOfMenuItems; + if (infoStruct.IsMainMenuHelpInfo == 1) + { + mainMenuInfo.IsHelpInfo = true; + } + + else if (infoStruct.IsMainMenuHelpInfo == 0) + { + mainMenuInfo.IsHelpInfo = false; + } + + if (infoStruct.IsUpdatedMainMenu == 1) + { + mainMenuInfo.IsUpdated = true; + } + + else if (infoStruct.IsUpdatedMainMenu == 0) + { + mainMenuInfo.IsUpdated = false; + } + + mainMenuInfo.IcnId = ConvertSatIconIdentifierStruct(infoStruct.IconId); + mainMenuInfo.IdList = ConvertSatIconIdListStruct(infoStruct.IconIdList); + return mainMenuInfo; + } + + internal static SatDisplayTextData ConvertSatDisplayTextStruct(SatDisplayTextStruct textStruct) + { + SatDisplayTextData textData = new SatDisplayTextData(); + textData.Id = textStruct.CommandId; + textData.Text = ConvertSatTextInfoStruct(textStruct.Text); + textData.Drtn = textStruct.Duration; + if (textStruct.IsPriorityHigh == 1) + { + textData.IsPrtyHigh = true; + } + + else if (textStruct.IsPriorityHigh == 0) + { + textData.IsPrtyHigh = false; + } + + if (textStruct.IsUserResponseRequired == 1) + { + textData.IsRespRequired = true; + } + + else if (textStruct.IsUserResponseRequired == 0) + { + textData.IsRespRequired = false; + } + + if (textStruct.IsImmediateResponse == 1) + { + textData.IsImmediateResp = true; + } + + else if (textStruct.IsImmediateResponse == 0) + { + textData.IsImmediateResp = false; + } + + textData.IcnId = ConvertSatIconIdentifierStruct(textStruct.IconId); + return textData; + } + + internal static SatSelectItemData ConvertSatSelectItemStruct(SatSelectItemStruct itemStruct) + { + SatSelectItemData itemData = new SatSelectItemData(); + itemData.Id = itemStruct.commandId; + if (itemStruct.IsHelpInfoAvailable == 1) + { + itemData.IsHelpAvailable = true; + } + + else if (itemStruct.IsHelpInfoAvailable == 0) + { + itemData.IsHelpAvailable = false; + } + + itemData.Text = ConvertSatTextInfoStruct(itemStruct.Text); + itemData.DefaultIndex = itemStruct.DefaultItemIndex; + itemData.ItemCount = itemStruct.MenuItemCount; + + List items = new List(); + foreach(SatMenuItemInfoStruct infoStruct in itemStruct.MenuItems) + { + SatMenuItemInfo menuItem = new SatMenuItemInfo(); + menuItem.Id = infoStruct.ItemId; + menuItem.Length = infoStruct.TextLength; + menuItem.Txt = Encoding.ASCII.GetBytes(infoStruct.Text); + items.Add(menuItem); + } + + itemData.Items = items; + itemData.IcnId = ConvertSatIconIdentifierStruct(itemStruct.IconId); + itemData.IdList = ConvertSatIconIdListStruct(itemStruct.IconIdList); + return itemData; + } + + internal static SatGetInKeyData ConvertSatGetInKeyStruct(SatGetInKeyStruct inKeyStruct) + { + SatGetInKeyData inKeyData = new SatGetInKeyData(); + inKeyData.Id = inKeyStruct.CommandId; + inKeyData.Type = inKeyStruct.KeyType; + inKeyData.AlphabetType = inKeyStruct.InputType; + if (inKeyStruct.IsNumeric == 1) + { + inKeyData.IsNumericFlag = true; + } + + else if (inKeyStruct.IsNumeric == 0) + { + inKeyData.IsNumericFlag = false; + } + + if (inKeyStruct.IsHelpInfoAvailable == 1) + { + inKeyData.IsHelpAvailable = true; + } + + else if (inKeyStruct.IsHelpInfoAvailable == 0) + { + inKeyData.IsHelpAvailable = false; + } + + inKeyData.Text = ConvertSatTextInfoStruct(inKeyStruct.Text); + inKeyData.Duratn = inKeyStruct.Duration; + inKeyData.IcnId = ConvertSatIconIdentifierStruct(inKeyStruct.IconId); + return inKeyData; + } + + internal static SatGetInputData ConvertSatGetInputStruct(SatGetInputStruct inputStruct) + { + SatGetInputData inputData = new SatGetInputData(); + inputData.Id = inputStruct.CommandId; + inputData.Type = inputStruct.Type; + if (inputStruct.IsNumeric == 1) + { + inputData.IsNumericFlag = true; + } + + else if (inputStruct.IsNumeric == 0) + { + inputData.IsNumericFlag = false; + } + + if (inputStruct.IsHelpInfoAvailable == 1) + { + inputData.IsHelpAvailable = true; + } + + else if (inputStruct.IsHelpInfoAvailable == 0) + { + inputData.IsHelpAvailable = false; + } + + if (inputStruct.IsEchoInput == 1) + { + inputData.IsEcho = true; + } + + else if (inputStruct.IsEchoInput == 0) + { + inputData.IsEcho = false; + } + + inputData.Text = ConvertSatTextInfoStruct(inputStruct.Text); + + SatResponseLengthInfo responseLength = new SatResponseLengthInfo(); + responseLength.Min = inputStruct.RespLength.Min; + responseLength.Max = inputStruct.RespLength.Max; + + inputData.RespLength = responseLength; + inputData.Default = ConvertSatTextInfoStruct(inputStruct.DefaultText); + inputData.IcnId = ConvertSatIconIdentifierStruct(inputStruct.IconId); + return inputData; + } + + internal static SatRefreshData ConvertSatRefreshStruct(SatRefreshStruct refreshStruct) + { + SatRefreshData refreshData = new SatRefreshData(); + refreshData.Id = refreshStruct.CommandId; + refreshData.Type = refreshStruct.AppType; + refreshData.Mode = refreshStruct.RefreshMode; + refreshData.Count = refreshStruct.FileCount; + List fileId = new List(); + foreach(SimFileId id in refreshStruct.fileId) + { + fileId.Add(id); + } + refreshData.IdList = fileId; + return refreshData; + } + + internal static SatAddressData ConvertSatAddressStruct(SatAddressStruct addressStruct) + { + SatAddressData addressData = new SatAddressData(); + addressData.Type = addressStruct.Ton; + addressData.NumId = addressStruct.Npi; + addressData.NumLen = addressStruct.DiallingNumLength; + addressData.Number = addressStruct.DiallingNumber; + return addressData; + } + + internal static SatSmsTpduInfo ConvertSatSmsTpduStruct(SatSmsTpduStruct tpduStruct) + { + SatSmsTpduInfo tpduInfo = new SatSmsTpduInfo(); + tpduInfo.Type = tpduStruct.TpduType; + tpduInfo.Length = tpduStruct.DataLength; + tpduInfo.Data = Encoding.ASCII.GetBytes(tpduStruct.Data); + return tpduInfo; + } + + internal static SatSendSmsData ConvertSatSendSmsStruct(SatSendSmsStruct smsStruct) + { + SatSendSmsData smsData = new SatSendSmsData(); + smsData.Id = smsStruct.CommandId; + if (smsStruct.IsPackingRequired == 1) + { + smsData.IsPackRequired = true; + } + + else if (smsStruct.IsPackingRequired == 0) + { + smsData.IsPackRequired = false; + } + + smsData.Addr = ConvertSatAddressStruct(smsStruct.Address); + smsData.Info = ConvertSatSmsTpduStruct(smsStruct.SmsTpdu); + return smsData; + } + + internal static SatEventListData ConvertSatEventListStruct(SatEventListDataStruct listStruct) + { + SatEventListData listData = new SatEventListData(); + if (listStruct.IsEventDownloadActive == 1) + { + listData.IsDownloadActive = true; + } + + else if (listStruct.IsEventDownloadActive == 0) + { + listData.IsDownloadActive = false; + } + + if (listStruct.IsMtCallEvent == 1) + { + listData.IsCallEvent = true; + } + + else if (listStruct.IsMtCallEvent == 0) + { + listData.IsCallEvent = false; + } + + if (listStruct.IsCallConnected == 1) + { + listData.IsConnected = true; + } + + else if (listStruct.IsCallConnected == 0) + { + listData.IsConnected = false; + } + + if (listStruct.IsCallDisconnected == 1) + { + listData.IsDisconnected = true; + } + + else if (listStruct.IsCallDisconnected == 0) + { + listData.IsDisconnected = false; + } + + if (listStruct.IsLocationStatus == 1) + { + listData.IsStatus = true; + } + + else if (listStruct.IsLocationStatus == 0) + { + listData.IsStatus = false; + } + + if (listStruct.IsUserActivity == 1) + { + listData.IsUsrActivity = true; + } + + else if (listStruct.IsUserActivity == 0) + { + listData.IsUsrActivity = false; + } + + if (listStruct.IsIdleScreenAvailable == 1) + { + listData.IsIdleScreen = true; + } + + else if (listStruct.IsIdleScreenAvailable == 0) + { + listData.IsIdleScreen = false; + } + + if (listStruct.IsCardReaderStatus == 1) + { + listData.IsReaderStatus = true; + } + + else if (listStruct.IsCardReaderStatus == 0) + { + listData.IsReaderStatus = false; + } + + if (listStruct.IsLanguageSelection == 1) + { + listData.IsLanguageSelect = true; + } + + else if (listStruct.IsLanguageSelection == 0) + { + listData.IsLanguageSelect = false; + } + + if (listStruct.IsBrowserTermination == 1) + { + listData.IsBrowserTerminate = true; + } + + else if (listStruct.IsBrowserTermination == 0) + { + listData.IsBrowserTerminate = false; + } + + if (listStruct.IsDataAvailable == 1) + { + listData.IsDataPresent = true; + } + + else if (listStruct.IsDataAvailable == 0) + { + listData.IsDataPresent = false; + } + + if (listStruct.IsChannelStatus == 1) + { + listData.IsCnlStatus = true; + } + + else if (listStruct.IsChannelStatus == 0) + { + listData.IsCnlStatus = false; + } + + return listData; + } + + internal static SatSendDtmfData ConvertSatSendDtmfStruct(SatSendDtmfDataStruct dtmfStruct) + { + SatSendDtmfData dtmfData = new SatSendDtmfData(); + dtmfData.Id = dtmfStruct.CommandId; + if (dtmfStruct.IsHiddenMode == 1) + { + dtmfData.IsHidden = true; + } + + else if (dtmfStruct.IsHiddenMode == 0) + { + dtmfData.IsHidden = false; + } + + dtmfData.Dtmf = ConvertSatTextInfoStruct(dtmfStruct.DtmfString); + return dtmfData; + } + + internal static SatCallCtrlData ConvertSatCallCtrlIndCallSsDataStruct(SatCallCtrlIndCallSsDataStruct dataStruct) + { + SatCallCtrlData data = new SatCallCtrlData(); + data.Addr = ConvertSatTextInfoStruct(dataStruct.Address); + data.SubAddr = ConvertSatTextInfoStruct(dataStruct.SubAddress); + data.RepeatIndicator = dataStruct.BcRepeatIndicator; + data.Ccparam1 = ConvertSatTextInfoStruct(dataStruct.Ccp1); + data.Ccparam2 = ConvertSatTextInfoStruct(dataStruct.Ccp2); + return data; + } + + internal static SatCallCtrlConfirmData ConvertSatCallCtrlIndDataStruct(SatCallCtrlIndDataStruct dataStruct) + { + SatCallCtrlConfirmData data = new SatCallCtrlConfirmData(); + data.Type = dataStruct.CallCtrlCnfType; + data.Result = dataStruct.CallCtrlResult; + data.Data = ConvertSatTextInfoStruct(dataStruct.DisplayData); + if (dataStruct.IsUserInfoDispEnabled == 1) + { + data.IsUserInfoEnabled = true; + } + + else if (dataStruct.IsUserInfoDispEnabled == 0) + { + data.IsUserInfoEnabled = false; + } + + if (dataStruct.CallCtrlCnfType == SatCallType.MoVoice) + { + data.CallData = ConvertSatCallCtrlIndCallSsDataStruct(dataStruct.CallCtrlIndData.CallCtrlCnfCallData); + } + + else if (dataStruct.CallCtrlCnfType == SatCallType.Ss) + { + data.SsData = ConvertSatCallCtrlIndCallSsDataStruct(dataStruct.CallCtrlIndData.CallCtrlCnfSsData); + } + + else if (dataStruct.CallCtrlCnfType == SatCallType.Ussd) + { + data.Ussd = ConvertSatTextInfoStruct(dataStruct.CallCtrlIndData.CallCtrlCnfUssdData.UssdString); + } + + return data; + } + + internal static SatDataCodingScheme ConvertSatDataCodingSchemeStruct(SatDataCodingSchemeStruct dataStruct) + { + SatDataCodingScheme codingScheme = new SatDataCodingScheme(); + if (dataStruct.IsCompressedFormat == 1) + { + codingScheme.IsCompressed = true; + } + + else if (dataStruct.IsCompressedFormat == 0) + { + codingScheme.IsCompressed = false; + } + + codingScheme.Alphabet = dataStruct.AlphabetFormat; + codingScheme.Msg = dataStruct.MsgClass; + codingScheme.Dcs = dataStruct.RawDcs; + return codingScheme; + } + + internal static SatTextTypeInfo ConvertSatTextTypeInfoStruct(SatTextTypeInfoStruct infoStruct) + { + SatTextTypeInfo info = new SatTextTypeInfo(); + if (infoStruct.IsDigitOnly == 1) + { + info.IsDigit = true; + } + + else if (infoStruct.IsDigitOnly == 0) + { + info.IsDigit = false; + } + + info.CodingScheme = ConvertSatDataCodingSchemeStruct(infoStruct.Dcs); + info.StringLen = infoStruct.StringLength; + info.Text = infoStruct.TextString; + return info; + } + + internal static SatMoSmsCtrlData ConvertSatMoSmsCtrlDataStruct(SatMoSmsCtrlDataStruct dataStruct) + { + SatMoSmsCtrlData data = new SatMoSmsCtrlData(); + data.Result = dataStruct.Result; + if (dataStruct.IsUserInfoDisplayEnabled == 1) + { + data.IsUserInfo = true; + } + + else if (dataStruct.IsUserInfoDisplayEnabled == 0) + { + data.IsUserInfo = false; + } + + data.Data = ConvertSatTextTypeInfoStruct(dataStruct.DisplayData); + data.RpAddr = ConvertSatTextTypeInfoStruct(dataStruct.RpDestAddr); + data.TpAddr = ConvertSatTextTypeInfoStruct(dataStruct.TpDestAddr); + return data; + } + + internal static SatSetupCallData ConvertSatSetupCallDataStruct(SatSetupCallDataStruct dataStruct) + { + SatSetupCallData callData = new SatSetupCallData(); + callData.Id = dataStruct.CommandId; + callData.Type = dataStruct.CallType; + callData.Text = ConvertSatTextInfoStruct(dataStruct.DisplayText); + callData.Number = ConvertSatTextInfoStruct(dataStruct.CallNumber); + callData.Duratn = dataStruct.Duration; + callData.IcnId = ConvertSatIconIdentifierStruct(dataStruct.IconId); + return callData; + } + + internal static SatSendSsData ConvertSatSendSsDataStruct(SatSendSsDataStruct dataStruct) + { + SatSendSsData ssData = new SatSendSsData(); + ssData.Id = dataStruct.CommandId; + ssData.NumType = dataStruct.Ton; + ssData.Identity = dataStruct.Npi; + ssData.StringLen = dataStruct.StringLength; + ssData.Ss = dataStruct.SsString; + return ssData; + } + + internal static SatSetupUssdData ConvertSatSetupUssdDataStruct(SatSetupUssdDataStruct ussdStruct) + { + SatSetupUssdData ussdData = new SatSetupUssdData(); + ussdData.Id = ussdStruct.CommandId; + ussdData.Dcs = ussdStruct.RawDcs; + ussdData.StringLen = ussdStruct.UssdStringLength; + ussdData.Ussd = ussdStruct.UssdString; + return ussdData; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Sim.cs b/src/Tizen.Tapi/Tizen.Tapi/Sim.cs new file mode 100755 index 0000000..4400737 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Sim.cs @@ -0,0 +1,1595 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.Tapi +{ + /// + /// A class which manages SIM card services. + /// + public class Sim + { + private IntPtr _handle = IntPtr.Zero; + private Dictionary _callbackMap = new Dictionary(); + private int _requestId = 0; + private Sim() + { + } + + /// + /// A constructor to instantiate Sim class using the Tapi handle. + /// + /// An instance of TapiHandle obtained from InitTapi in TapiManager API. + /// Thrown when handle is passed as null. + public Sim(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("Handle is null"); + } + + _handle = handle._handle; + } + + /// + /// Gets SIM card initialization status and SIM card identification. + /// + /// An instance of SimInitInfo class in case of success. Null in case of failure. + public SimInitInfo InitInfo + { + get + { + SimCardStatus status; + int isCardChanged; + int ret = Interop.Tapi.Sim.SimGetInitInfo(_handle, out status, out isCardChanged); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM init info, Error: " + (TapiError)ret); + return null; + } + + SimInitInfo initInfo = new SimInitInfo(); + initInfo.SimStatus = status; + if (isCardChanged == 1) + { + initInfo.IsChanged = true; + } + + else if (isCardChanged == 0) + { + initInfo.IsChanged = false; + } + + return initInfo; + } + } + + /// + /// Gets the card type (SIM/USIM). + /// + public SimCardType SimType + { + get + { + SimCardType type; + int ret = Interop.Tapi.Sim.SimGetType(_handle, out type); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM card type, Error: " + (TapiError)ret); + return default(SimCardType); + } + + return type; + } + } + + /// + /// Gets SIM IMSI information. + /// + public SimImsiInfo Imsi + { + get + { + SimImsiInfoStruct imsi; + int ret = Interop.Tapi.Sim.SimGetImsi(_handle, out imsi); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM IMSI info, Error: " + (TapiError)ret); + return null; + } + + return SimStructConversions.ConvertSimImsiInfoStruct(imsi); + } + } + + /// + /// Gets ECC(SIM) or UECC(USIM) data. + /// + public SimEccInfoList Ecc + { + get + { + SimEccInfoListStruct eccInfo; + int ret = Interop.Tapi.Sim.SimGetEcc(_handle, out eccInfo); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM ECC info, Error: " + (TapiError)ret); + return null; + } + + return SimStructConversions.ConvertSimEccInfoListStruct(eccInfo); + } + } + + /// + /// Gets the list of application on UICC. + /// + /// A byte containing the masking value for SimAppType. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public byte SimGetApplicationList() + { + byte appList; + int ret = Interop.Tapi.Sim.SimGetApplicationList(_handle, out appList); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get list of applications, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return appList; + } + + /// + /// Gets the unique identification number of the (U)ICC. + /// + /// A task containing ICCID information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetIccId() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting ICCID info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting ICCID info, " + (SimAccessResult)result)); + return; + } + + SimIccIdInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimIccIdInfoStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetIccId(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM ICCID info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets language preference(indication) information. + /// + /// A task containing information about SIM language preference. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetLanguagePreference() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting language preference: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting language preference, " + (SimAccessResult)result)); + return; + } + + task.SetResult((SimLanguagePreference)Marshal.ReadInt32(data)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetLanguage(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM language preference, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Updates language preference information to the SIM card. + /// + /// The language preference information. + /// A task indicating whether setting of language preference is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimSetLanguagePreference(SimLanguagePreference language) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting language preference: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in setting language preference, " + (SimAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimSetLanguage(_handle, language, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SIM language preference, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets SIM call forwarding indication related data(EF-CFIS and CPHS case). + /// + /// A task containing call forward response information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetCallForwardInfo() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting call forward info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting call forward info, " + (SimAccessResult)result)); + return; + } + + SimCallForwardResponseStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimCallForwardResponseStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetCallForwardingInfo(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM call forward info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Sets SIM call forwarding indication related data(EF-CFIS and CPHS case). + /// + /// The data requesting for call forwarding. + /// A task indicating whether setting call forward info is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when call forward request is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimSetCallForwardInfo(SimCallForwardRequest request) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting call forward info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in setting call forward info, " + (SimAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (request == null) + { + throw new ArgumentNullException("SIM call forward request is null"); + } + + SimCallForwardRequestStruct requestStruct = SimClassConversions.ConvertSimCallForwardRequest(request); + int ret = Interop.Tapi.Sim.SimSetCallForwardingInfo(_handle, ref requestStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SIM call forward info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets SIM message waiting indication related data(EF-MWIS and CPHS case). + /// + /// A task containing message waiting response information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetMessageWaitingInfo() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting message waiting info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting message waiting info, " + (SimAccessResult)result)); + return; + } + + SimMessageWaitingResponseStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimMessageWaitingRespStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetMessageWaitingInfo(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM message waiting info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Sets SIM message waiting indication related data(EF-MWIS and CPHS case). + /// + /// The data requesting for message waiting. + /// A task indicating whether setting message waiting info is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when message waiting request is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimSetMessageWaitingInfo(SimMessageWaitingRequest request) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting message waiting info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in setting message waiting info, " + (SimAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (request == null) + { + throw new ArgumentNullException("SIM message waiting request is null"); + } + + SimMessageWaitingRequestStruct requestStruct = SimClassConversions.ConvertSimMessageWaitingRequest(request); + int ret = Interop.Tapi.Sim.SimSetMessageWaitingInfo(_handle, ref requestStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SIM message waiting info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets SIM mailbox related data(EF-MBDN, MBDI, and CPHS case). + /// + /// A task containing SimMailboxList information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetMailboxInfo() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting mailbox info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting mailbox info, " + (SimAccessResult)result)); + return; + } + + SimMailboxListStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimMailboxListStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetMailboxInfo(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM mailbox info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Sets SIM mailbox related data(EF-MBDN, MBDI and CPHS case). + /// + /// The data requesting for mailbox info. + /// A task indicating whether setting mailbox info is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when mailbox number is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimSetMailboxInfo(SimMailboxNumber mailboxNumber) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting mailbox info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in setting mailbox info, " + (SimAccessResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (mailboxNumber == null) + { + throw new ArgumentNullException("SIM mailbox number is null"); + } + + SimMailboxNumberStruct mbStruct = SimClassConversions.ConvertSimMailboxNumber(mailboxNumber); + int ret = Interop.Tapi.Sim.SimSetMailboxInfo(_handle, ref mbStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SIM mailbox info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets SIM CPHS specific data. + /// + /// A task containing SimCphs information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetCphsInfo() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting CPHS info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting CPHS info, " + (SimAccessResult)result)); + return; + } + + SimCphsInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimCphsInfoStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetCphsInfo(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM CPHS info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the SIM Service Table. + /// + /// A task containing SIM service table information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetServiceTable() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting service table: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting service table, " + (SimAccessResult)result)); + return; + } + + SimServiceTableStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimServiceTableStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetServiceTable(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM service table, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM MSISDN data. + /// + /// A task containing SimMsisdnList information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetMsisdn() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting MSISDN info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting MSISDN info, " + (SimAccessResult)result)); + return; + } + + SimMsisdnListStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimMsisdnListStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetMsisdn(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM MSISDN data, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM OPLMNWACT(Operator controlled PLMN Selector with Access Technology) data. + /// + /// A task containing SimOplmnwactList information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetOplmnwact() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting OPLMNWACT info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting OPLMNWACT info, " + (SimAccessResult)result)); + return; + } + + SimOplmnwactListStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimOplmnwactListStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetOplmnwact(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM OPLMNWACT info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM SPN data. + /// + /// A task containing SimSpn information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetSpn() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SPN info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SPN info, " + (SimAccessResult)result)); + return; + } + + SimSpnStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimSpnStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetSpn(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM SPN info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM CPHS NETNAME data. + /// + /// A task containing SimCphsNetName information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetCphsNetName() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting CPHS netname info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting CPHS netname info, " + (SimAccessResult)result)); + return; + } + + SimCphsNetNameStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimCphsNetNameStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetCphsNetName(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM CPHS netname info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Executes an authentication procedure by using SIM. + /// + /// The authentication code to be validated by the ISIM, 3G, and GSM application in the SIM card. + /// A task containing SimAuthenticationResponse information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when authentication data is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimExecuteAuthentication(SimAuthenticationData authenticationData) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in executing authentication procedure: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in executing authentication procedure, " + (SimAccessResult)result)); + return; + } + + SimAuthenticationResponseStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimAuthenticationResponseStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (authenticationData == null) + { + throw new ArgumentNullException("SIM authentication data is null"); + } + + SimAuthenticationDataStruct authStruct = SimClassConversions.ConvertSimAuthenticationDataStruct(authenticationData); + int ret = Interop.Tapi.Sim.SimExecuteAuthentication(_handle, ref authStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to execute authentication procedure, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Performs PIN1/PIN2/SIM LOCK verification. + /// + /// The PIN code. + /// A task containing SimPinResult information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when pin data is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimVerifyPins(SimPinData pinData) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM pins: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in verifying SIM pins, " + (SimAccessResult)result)); + return; + } + + SimPinResultStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (pinData == null) + { + throw new ArgumentNullException("SIM PIN data is null"); + } + + SimPinDataStruct pinStruct = SimClassConversions.ConvertSimPinData(pinData); + int ret = Interop.Tapi.Sim.SimVerifyPins(_handle, ref pinStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to verify SIM PIN, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Performs PIN1/PIN2 unblocking operation based on PUK information. + /// + /// The unblocking PIN password. + /// The PIN password to use after the unblocking operation. + /// A task containing SimPinResult information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when either of pukData or newPinData is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimVerifyPuks(SimPinData pukData, SimPinData newPinData) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in verifying SIM puks: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in verifying SIM puks, " + (SimAccessResult)result)); + return; + } + + SimPinResultStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (pukData == null || newPinData == null) + { + throw new ArgumentNullException("SIM PIN/PUK data is null"); + } + + SimPinDataStruct pukStruct = SimClassConversions.ConvertSimPinData(pukData); + SimPinDataStruct pinStruct = SimClassConversions.ConvertSimPinData(newPinData); + int ret = Interop.Tapi.Sim.SimVerifyPuks(_handle, ref pukStruct, ref pinStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to verify SIM puks, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Changes the PIN1/PIN2 code based on the PIN type passed along with old PIN data and new PIN data. + /// + /// The old PIN code entered by the user. + /// The new PIN code entered by the user. + /// A task containing SimPinResult information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when either of oldPin or newPin is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimChangePins(SimPinData oldPin, SimPinData newPin) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in changing SIM pins: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in changing SIM pins, " + (SimAccessResult)result)); + return; + } + + SimPinResultStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimPinResultStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (oldPin == null || newPin == null) + { + throw new ArgumentNullException("Old/new PIN data is null"); + } + + SimPinDataStruct oldPinStruct = SimClassConversions.ConvertSimPinData(oldPin); + SimPinDataStruct newPinStruct = SimClassConversions.ConvertSimPinData(newPin); + int ret = Interop.Tapi.Sim.SimChangePins(_handle, ref oldPinStruct, ref newPinStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to change SIM pins, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Disables the SIM facility. + /// + /// An object which contains the facility type and password. + /// A task containing SIM facility result information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when SIM facility info is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimDisableFacility(SimFacility facility) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in disabling SIM facility: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in disabling SIM facility, " + (SimAccessResult)result)); + return; + } + + SimFacilityResultStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimFacilityResultStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (facility == null) + { + throw new ArgumentNullException("SIM facility info is null"); + } + + SimFacilityStruct facilityStruct = SimClassConversions.ConvertSimFacility(facility); + int ret = Interop.Tapi.Sim.SimDisableFacility(_handle, ref facilityStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to disable SIM facility, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Enables the SIM facility. + /// + /// An object which contains the facility type and password. + /// A task containing SIM facility result information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when SIM facility info is passed as null. + /// Thrown when the system runs out of memory. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimEnableFacility(SimFacility facility) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in enabling SIM facility: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in enabling SIM facility, " + (SimAccessResult)result)); + return; + } + + SimFacilityResultStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimFacilityResultStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (facility == null) + { + throw new ArgumentNullException("SIM facility info is null"); + } + + SimFacilityStruct facilityStruct = SimClassConversions.ConvertSimFacility(facility); + int ret = Interop.Tapi.Sim.SimEnableFacility(_handle, ref facilityStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to enable SIM facility, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets the SIM facility. + /// + /// The type of security lock. + /// A task containing SIM facility information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetFacility(SimLockType lockType) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM facility: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM facility, " + (SimAccessResult)result)); + return; + } + + SimFacilityInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimFacilityInfoStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetFacility(_handle, lockType, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM facility, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets SIM lock type info. + /// + /// The type of security lock. + /// A task containing SIM lock information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetLockInfo(SimLockType lockType) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM lock info: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM lock info, " + (SimAccessResult)result)); + return; + } + + SimLockInfoStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimLockInfoStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetLockInfo(_handle, lockType, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM lock info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Sets the SIM power state. + /// + /// The state of SIM to be set. + /// A task indicating whether setting SIM power state is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimSetPowerState(SimPowerState state) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimPowerSetResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting SIM power state: " + (SimPowerSetResult)result); + task.SetException(new InvalidOperationException("Error occurs in setting SIM power state, " + (SimPowerSetResult)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimSetPowerState(_handle, state, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SIM power state, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Provides a common interface for accessing SIM data. + /// + /// The APDU data. + /// A task containing SIM APDU response information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when SIM APDU is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimRequestApdu(SimApdu apdu) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM APDU: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in requesting SIM APDU, " + (SimAccessResult)result)); + return; + } + + SimApduResponseStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimApduResponseStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (apdu == null) + { + throw new ArgumentNullException("SIM APDU is null"); + } + + SimApduStruct apduStruct = SimClassConversions.ConvertSimApdu(apdu); + int ret = Interop.Tapi.Sim.SimRequestApdu(_handle, ref apduStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to request SIM APDU, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Provides a common interface to get the SIM ATR(Answer To Reset) value. + /// + /// A task containing SIM ATR response information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimRequestAtr() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in requesting SIM ATR: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in requesting SIM ATR, " + (SimAccessResult)result)); + return; + } + + SimAtrResponseStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimAtrResponseStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimRequestAtr(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to request SIM ATR, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the IMPI(IMS private user identity). (ISIM only). + /// + /// A task containing IMPI string. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetImpi() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPI: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPI, " + (SimAccessResult)result)); + return; + } + + task.SetResult(Marshal.PtrToStringAnsi(data)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetImpi(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM IMPI, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the IMPU(IMS public user identity). (ISIM only). + /// + /// A task containing SIM IMPU list information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetImpu() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM IMPU: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM IMPU, " + (SimAccessResult)result)); + return; + } + + SimImpuListStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimImpuListStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetImpu(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM IMPU, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the Domain(Home Network Domain Name). (ISIM only) + /// + /// A task containing domain string. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetDomain() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM domain: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM domain, " + (SimAccessResult)result)); + return; + } + + task.SetResult(Marshal.PtrToStringAnsi(data)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetDomain(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM domain, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the P-CSCF(Proxy Call Session Control Function). (ISIM only) + /// + /// A task containing SIM PCSCF list information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetPcscf() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SIM PCSCF: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting SIM PCSCF, " + (SimAccessResult)result)); + return; + } + + SimPcscfListStruct info = Marshal.PtrToStructure(data); + task.SetResult(SimStructConversions.ConvertSimPcscfListStruct(info)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetPcscf(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get SIM PCSCF, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Gets the ISIM service table. (ISIM only). + /// + /// A task containing a byte array in which mask value of SimIsimService enum will be stored. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SimGetIsimServiceTable() + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SimAccessResult.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting ISIM service table: " + (SimAccessResult)result); + task.SetException(new InvalidOperationException("Error occurs in getting ISIM service table, " + (SimAccessResult)result)); + return; + } + + task.SetResult(Encoding.ASCII.GetBytes(Marshal.PtrToStringAnsi(data))); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Sim.SimGetIsimServiceTable(_handle, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get ISIM service table, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SimData.cs b/src/Tizen.Tapi/Tizen.Tapi/SimData.cs new file mode 100755 index 0000000..96a3cdb --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SimData.cs @@ -0,0 +1,2236 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines SIM card initialization information. + /// + public class SimInitInfo + { + internal SimCardStatus SimStatus; + internal bool IsChanged; + internal SimInitInfo() + { + } + + /// + /// The SIM initialization status from the Telephony server boot up time. + /// + public SimCardStatus Status + { + get + { + return SimStatus; + } + } + + /// + /// The SIM card identification value. It will be true when the current inserted SIM card differs from the previous SIM. False otherwise. + /// + public bool IsCardChanged + { + get + { + return IsChanged; + } + } + } + + /// + /// A class which defines data for IMSI information. + /// + public class SimImsiInfo + { + internal string CountryCode; + internal string NetworkCode; + internal string StationId; + internal SimImsiInfo() + { + } + + /// + /// Mobile Country Code. + /// + public string Mcc + { + get + { + return CountryCode; + } + } + + /// + /// Mobile Network Code. + /// + public string Mnc + { + get + { + return NetworkCode; + } + } + + /// + /// Mobile Station Identification Number. + /// + public string Msin + { + get + { + return StationId; + } + } + } + + /// + /// A class which defines data for ECC information of GSM/USIM/CDMA SIM. + /// + public class SimEccInfo + { + internal string NameInfo; + internal string NumberInfo; + internal SimEccEmergencyServiceType TypeInfo; + internal SimEccInfo() + { + } + + /// + /// Name. Applicable only for USIM(3G) SIM. + /// + public string Name + { + get + { + return NameInfo; + } + } + + /// + /// Number. + /// + public string Number + { + get + { + return NumberInfo; + } + } + + /// + /// Emergency service type. Applicable only for USIM(3G) SIM. + /// + public SimEccEmergencyServiceType Category + { + get + { + return TypeInfo; + } + } + } + + /// + /// A class which defines ECC information list. + /// + public class SimEccInfoList + { + internal int EccCount; + internal IEnumerable List; + internal SimEccInfoList() + { + } + + /// + /// ECC count. + /// + public int Count + { + get + { + return EccCount; + } + } + + /// + /// List of ECC. + /// + public IEnumerable EccList + { + get + { + return List; + } + } + } + + /// + /// A class which defines ICCID(Integrated Circuit Card Identifier). + /// + public class SimIccIdInfo + { + internal int Length; + internal string Number; + internal SimIccIdInfo() + { + } + + /// + /// Integrated Circuit Card number length. + /// + public int IccLength + { + get + { + return Length; + } + } + + /// + /// Integrated Circuit Card number. + /// + public string IccNumber + { + get + { + return Number; + } + } + } + + /// + /// A class which defines call forwarding indication status data. + /// + public class SimCfis + { + private int _recIndex; + private byte _mspNum; + private byte _cfuStatus; + private SimTypeOfNumber _ton; + private SimNumberPlanIdentity _npi; + private string _cfuNum; + private byte _cc2Id; + private byte _ext7Id; + + /// + /// Record index. + /// + public int RecIndex + { + get + { + return _recIndex; + } + + set + { + _recIndex = value; + } + } + + /// + /// MSP number. + /// + public byte MspNum + { + get + { + return _mspNum; + } + + set + { + _mspNum = value; + } + } + + /// + /// Call forwarding unconditional indication status. + /// + public byte CfuStatus + { + get + { + return _cfuStatus; + } + + set + { + _cfuStatus = value; + } + } + + /// + /// SIM Type of number. + /// + public SimTypeOfNumber Ton + { + get + { + return _ton; + } + + set + { + _ton = value; + } + } + + /// + /// SIM numbering plan identity. + /// + public SimNumberPlanIdentity Npi + { + get + { + return _npi; + } + + set + { + _npi = value; + } + } + + /// + /// Dialing Number/SSC String. + /// + public string CfuNum + { + get + { + return _cfuNum; + } + + set + { + _cfuNum = value; + } + } + + /// + /// Capability/Configuration 2 Record Identifier. + /// + public byte Cc2Id + { + get + { + return _cc2Id; + } + + set + { + _cc2Id = value; + } + } + + /// + /// Extension 7 Record Identifier. + /// + public byte Ext7Id + { + get + { + return _ext7Id; + } + + set + { + _ext7Id = value; + } + } + } + + /// + /// A class which defines call forwarding indication status list. + /// + public class SimCfisList + { + internal int Count; + internal IEnumerable List; + internal SimCfisList() + { + } + + /// + /// Profile count. + /// + public int ProfileCount + { + get + { + return Count; + } + } + + /// + /// List of CFIS. + /// + public IEnumerable CfisList + { + get + { + return List; + } + } + } + + /// + /// A class which defines CPHS call forwarding status data. + /// + public class SimCphsCf + { + private int _line1; + private int _line2; + private int _fax; + private int _data; + + /// + /// CallForwardUnconditionalLine 1. + /// + public int Line1 + { + get + { + return _line1; + } + + set + { + _line1 = value; + } + } + + /// + /// CallForwardUnconditionalLine 2. + /// + public int Line2 + { + get + { + return _line2; + } + + set + { + _line2 = value; + } + } + + /// + /// CallForwardUnconditional Fax. + /// + public int Fax + { + get + { + return _fax; + } + + set + { + _fax = value; + } + } + + /// + /// CallForwardUnconditional data. + /// + public int Data + { + get + { + return _data; + } + + set + { + _data = value; + } + } + } + + /// + /// A class which defines call forwarding response. + /// + public class SimCallForwardResponse + { + internal bool IsCphsCf; + internal SimCfisList List; + internal SimCphsCf CphsCfInfo; + internal SimCallForwardResponse() + { + } + + /// + /// CPHS or not. + /// + public bool IsCphs + { + get + { + return IsCphsCf; + } + } + + /// + /// List of CFIS. + /// + public SimCfisList CfList + { + get + { + return List; + } + } + + /// + /// CPHS CF. + /// + public SimCphsCf CphsCf + { + get + { + return CphsCfInfo; + } + } + } + + /// + /// A class which defines call forwarding request. + /// + public class SimCallForwardRequest + { + private bool _isCphs; + private SimCfis _cfis; + private SimCphsCf _cphsCf; + + /// + /// CPHS or not. + /// + public bool IsCphs + { + get + { + return _isCphs; + } + + set + { + _isCphs = value; + } + } + + /// + /// CFIS. + /// + /// + /// This should be filled only if IsCphs is false. + /// + public SimCfis Cfis + { + get + { + return _cfis; + } + + set + { + _cfis = value; + } + } + + /// + /// CPHS CF. + /// + /// + /// This should be filled only if IsCphs is true. + /// + public SimCphsCf CphsCf + { + get + { + return _cphsCf; + } + + set + { + _cphsCf = value; + } + } + } + + /// + /// A class which defines message waiting indication status data. + /// + public class SimMwis + { + private int _recIndex; + private byte _indicatorStatus; + private int _voiceCount; + private int _faxCount; + private int _emailCount; + private int _otherCount; + private int _videoCount; + + /// + /// Record index. + /// + public int RecIndex + { + get + { + return _recIndex; + } + + set + { + _recIndex = value; + } + } + + /// + /// Indicator type. + /// + public byte IndicatorStatus + { + get + { + return _indicatorStatus; + } + + set + { + _indicatorStatus = value; + } + } + + /// + /// VoiceMail count. + /// + public int VoiceCount + { + get + { + return _voiceCount; + } + + set + { + _voiceCount = value; + } + } + + /// + /// Fax count. + /// + public int FaxCount + { + get + { + return _faxCount; + } + + set + { + _faxCount = value; + } + } + + /// + /// Email count. + /// + public int EmailCount + { + get + { + return _emailCount; + } + + set + { + _emailCount = value; + } + } + + /// + /// Other count. + /// + public int OtherCount + { + get + { + return _otherCount; + } + + set + { + _otherCount = value; + } + } + + /// + /// VideoMail count. + /// + public int VideoCount + { + get + { + return _videoCount; + } + + set + { + _videoCount = value; + } + } + } + + /// + /// A class which defines message waiting indication status list. + /// + public class SimMwisList + { + internal int Count; + internal IEnumerable List; + internal SimMwisList() + { + } + + /// + /// Profile count. + /// + public int ProfileCount + { + get + { + return Count; + } + } + + /// + /// List of MWIS. + /// + public IEnumerable MwList + { + get + { + return List; + } + } + } + + /// + /// A class which defines CPHS message waiting status data. + /// + public class SimCphsMw + { + private bool _isVoice1; + private bool _isVoice2; + private bool _isFax; + private bool _isData; + + /// + /// VoiceMsgLine1 message waiting flag. + /// + public bool IsVoice1 + { + get + { + return _isVoice1; + } + + set + { + _isVoice1 = value; + } + } + + /// + /// VoiceMsgLine2 message waiting flag. + /// + public bool IsVoice2 + { + get + { + return _isVoice2; + } + + set + { + _isVoice2 = value; + } + } + + /// + /// FAX message waiting flag. + /// + public bool IsFax + { + get + { + return _isFax; + } + + set + { + _isFax = value; + } + } + + /// + /// Data message waiting flag. + /// + public bool IsData + { + get + { + return _isData; + } + + set + { + _isData = value; + } + } + } + + /// + /// A class which defines message waiting reponse. + /// + public class SimMessageWaitingResponse + { + internal bool IsCphsMw; + internal SimMwisList List; + internal SimCphsMw CphsMwInfo; + internal SimMessageWaitingResponse() + { + } + + /// + /// CPHS or not. + /// + public bool IsCphs + { + get + { + return IsCphsMw; + } + } + + /// + /// List of MWIS. + /// + public SimMwisList MwList + { + get + { + return List; + } + } + + /// + /// CPHS MW. + /// + public SimCphsMw CphsMw + { + get + { + return CphsMwInfo; + } + } + } + + /// + /// A class which defines message waiting request. + /// + public class SimMessageWaitingRequest + { + private bool _isCphs; + private SimMwis _mwis; + private SimCphsMw _cphsMw; + + /// + /// CPHS or not. + /// + public bool IsCphs + { + get + { + return _isCphs; + } + + set + { + _isCphs = value; + } + } + + /// + /// MWIS. + /// + /// + /// This should be filled only if IsCphs is false. + /// + public SimMwis Mwis + { + get + { + return _mwis; + } + + set + { + _mwis = value; + } + } + + /// + /// CPHS MW. + /// + /// + /// This should be filled only if IsCphs is true. + /// + public SimCphsMw CphsMw + { + get + { + return _cphsMw; + } + + set + { + _cphsMw = value; + } + } + } + + /// + /// A class which defines mailbox dialing number data. + /// + public class SimMailboxNumber + { + private bool _isCphs; + private int _recIndex; + private int _profileNumber; + private SimMailboxType _mbType; + private int _alphaMaxLength; + private string _alphaId; + private SimTypeOfNumber _ton; + private SimNumberPlanIdentity _npi; + private string _number; + private byte _ccId; + private byte _ext1Id; + + /// + /// CPHS or not. + /// + public bool IsCphs + { + get + { + return _isCphs; + } + + set + { + _isCphs = value; + } + } + + /// + /// Index which stands for the location where the record is saved in SIM. + /// + public int RecIndex + { + get + { + return _recIndex; + } + + set + { + _recIndex = value; + } + } + + /// + /// SIM profile index. + /// + public int ProfileNumber + { + get + { + return _profileNumber; + } + + set + { + _profileNumber = value; + } + } + + /// + /// Mailbox type. + /// + public SimMailboxType MbType + { + get + { + return _mbType; + } + + set + { + _mbType = value; + } + } + + /// + /// Alpha max length in SIM. + /// + public int AlphaMaxLength + { + get + { + return _alphaMaxLength; + } + + set + { + _alphaMaxLength = value; + } + } + + /// + /// Alpha Identifier. + /// + public string AlphaId + { + get + { + return _alphaId; + } + + set + { + _alphaId = value; + } + } + + /// + /// Type Of Number. + /// + public SimTypeOfNumber Ton + { + get + { + return _ton; + } + + set + { + _ton = value; + } + } + + /// + /// Number Plan Identity. + /// + public SimNumberPlanIdentity Npi + { + get + { + return _npi; + } + + set + { + _npi = value; + } + } + + /// + /// Dialing Number/SSC String. + /// + public string Number + { + get + { + return _number; + } + + set + { + _number = value; + } + } + + /// + /// Capability/Configuration Identifier. + /// + public byte CcId + { + get + { + return _ccId; + } + + set + { + _ccId = value; + } + } + + /// + /// Extension 1 Record Identifier. + /// + public byte Ext1Id + { + get + { + return _ext1Id; + } + + set + { + _ext1Id = value; + } + } + } + + /// + /// A class which defines mailbox dialing number list. + /// + public class SimMailboxList + { + internal int MbCount; + internal IEnumerable MbList; + internal SimMailboxList() + { + } + + /// + /// Mailbox count. + /// + public int Count + { + get + { + return MbCount; + } + } + + /// + /// List of mailbox. + /// + public IEnumerable List + { + get + { + return MbList; + } + } + } + + /// + /// A class which defines available optional CPHS SIM files. + /// + public class SimCphsServiceTable + { + internal int CustomerSvcProfile; + internal int SvcStringTable; + internal int MbNumbers; + internal int OperatorNameShort; + internal int InformationNum; + internal SimCphsServiceTable() + { + } + + /// + /// Customer Service Profile (CSP). + /// + public int CustomerServiceProfile + { + get + { + return CustomerSvcProfile; + } + } + + /// + /// Service String Table (SST). + /// + public int ServiceStringTable + { + get + { + return SvcStringTable; + } + } + + /// + /// MailBoxNumbers. + /// + public int MailboxNumbers + { + get + { + return MbNumbers; + } + } + + /// + /// Short form of operator name. + /// + public int OperatorNameShortForm + { + get + { + return OperatorNameShort; + } + } + + /// + /// Information numbers. + /// + public int InformationNumbers + { + get + { + return InformationNum; + } + } + } + + /// + /// A class which defines CPHS information data. + /// + public class SimCphsInfo + { + internal SimCphsPhaseType Phase; + internal SimCphsServiceTable CphsSvcTable; + internal SimCphsInfo() + { + } + + /// + /// CPHS phase type. + /// + public SimCphsPhaseType CphsPhase + { + get + { + return Phase; + } + } + + /// + /// CPHS service table. + /// + public SimCphsServiceTable CphsServiceTable + { + get + { + return CphsSvcTable; + } + } + } + + /// + /// A class which defines CSIM service table. + /// + public class SimCst + { + internal SimCdmaServiceTable CdmaSvc; + internal byte[] Cdma; + internal byte[] Csim; + internal SimCst() + { + } + + /// + /// Cdma service table; + /// + public SimCdmaServiceTable CdmaSvcTable + { + get + { + return CdmaSvc; + } + } + + /// + /// Cdma service. Gives mask value of SimCdmaService enum. + /// + /// + /// This will be filled only if CdmaSvcTable is Cdma. + /// + public byte[] CdmaService + { + get + { + return Cdma; + } + } + + /// + /// Csim service. Gives mask value of SimCsimService enum. + /// + /// + /// This will be filled only if CdmaSvcTable is Csim. + /// + public byte[] CsimService + { + get + { + return Csim; + } + } + } + + /// + /// A class which defines SIM service table. + /// + public class SimServiceTable + { + internal SimCardType Type; + internal byte[] Sst; + internal byte[] Ust; + internal SimCst Cst; + internal SimServiceTable() + { + } + + /// + /// SIM card type. + /// + public SimCardType SimType + { + get + { + return Type; + } + } + + /// + /// SIM service table. Gives mask value of SimSstService enum. + /// + /// + /// This will be filled only if SimType is Gsm. + /// + public byte[] SstService + { + get + { + return Sst; + } + } + + /// + /// USIM service table. Gives mask value of SimUstService enum. + /// + /// + /// This will be filled only if SimType is Usim. + /// + public byte[] UstService + { + get + { + return Ust; + } + } + + /// + /// CSIM service table. + /// + /// + /// This will be filled only if SimType is Ruim. + /// + public SimCst CstService + { + get + { + return Cst; + } + } + } + + /// + /// A class which defines MSISDN information of the GSM/CDMA SIM. + /// + public class SimSubscriberInfo + { + internal string MsisdnNum; + internal string MsisdnName; + internal SimSubscriberInfo() + { + } + + /// + /// MSISDN number. If it does not exist, a null string will be returned + /// + public string Number + { + get + { + return MsisdnNum; + } + } + + /// + /// MSISDN name. If it does not exist, a null string will be returned. Not applicable for CDMA. + /// + public string Name + { + get + { + return MsisdnName; + } + } + } + + /// + /// A class which defines MSISDN list. + /// + public class SimMsisdnList + { + internal int MsisdnCount; + internal IEnumerable SubscriberList; + internal SimMsisdnList() + { + } + + /// + /// Count. + /// + public int Count + { + get + { + return MsisdnCount; + } + } + + /// + /// List of subscriber info. + /// + public IEnumerable List + { + get + { + return SubscriberList; + } + } + } + + /// + /// A class which defines OPLMNwACT data. + /// + public class SimOplmnwact + { + internal string PlmnString; + internal bool UmtsFlag; + internal bool GsmFlag; + internal SimOplmnwact() + { + } + + /// + /// PLMN. + /// + public string Plmn + { + get + { + return PlmnString; + } + } + + /// + /// UMTS or not. + /// + public bool IsUmts + { + get + { + return UmtsFlag; + } + } + + /// + /// GSM or not. + /// + public bool IsGsm + { + get + { + return GsmFlag; + } + } + } + + /// + /// A class which defines OPLMNwACT list. + /// + public class SimOplmnwactList + { + internal int OplmnCount; + internal IEnumerable OplmnList; + internal SimOplmnwactList() + { + } + + /// + /// Count. + /// + public int Count + { + get + { + return OplmnCount; + } + } + + /// + /// List of OPLMNWACT. + /// + public IEnumerable List + { + get + { + return OplmnList; + } + } + } + + /// + /// A class which defines SPN(Service Provider Name). + /// + public class SimSpn + { + internal byte Condition; + internal string SpName; + internal SimSpn() + { + } + + /// + /// Display condition. + /// + public byte DisplayCondition + { + get + { + return Condition; + } + } + + /// + /// Service Provider Name. + /// + public string Spn + { + get + { + return SpName; + } + } + } + + /// + /// A class which defines CPHS network name. + /// + public class SimCphsNetName + { + internal string Full; + internal string Short; + internal SimCphsNetName() + { + } + + /// + /// Full name. + /// + public string FullName + { + get + { + return Full; + } + } + + /// + /// Short name. + /// + public string ShortName + { + get + { + return Short; + } + } + } + + /// + /// A class which defines authentication request data. + /// + public class SimAuthenticationData + { + private SimAuthenticationType _authType; + private int _randLength; + private int _autnLength; + private byte[] _randData; + private byte[] _autnData; + private SimAuthenticationData() + { + } + + /// + /// A constructor to instantiate SimAuthenticationData class with necessary parameters. + /// + /// Authentication type. + /// The length of RAND. + /// The length of AUTN. It is not used in case of GSM AUTH. + /// RAND data. + /// AUTN data. It is not used in case of GSM AUTH. + public SimAuthenticationData(SimAuthenticationType authType, int randLength, int autnLength, byte[] randData, byte[] autnData) + { + _authType = authType; + _randLength = randLength; + _autnLength = autnLength; + _randData = randData; + _autnData = autnData; + } + + internal SimAuthenticationType AuthType + { + get + { + return _authType; + } + } + + internal int RandLength + { + get + { + return _randLength; + } + } + + internal int AutnLength + { + get + { + return _autnLength; + } + } + + internal byte[] RandData + { + get + { + return _randData; + } + } + + internal byte[] AutnData + { + get + { + return _autnData; + } + } + } + + /// + /// A class which defines authentication result data. + /// + public class SimAuthenticationResponse + { + internal SimAuthenticationType Type; + internal SimAuthenticationResult Result; + internal int RespLength; + internal string RespData; + internal int AuthKeyLen; + internal string Key; + internal int CipherLen; + internal string Cipher; + internal int IntegrityLen; + internal string Integrity; + internal SimAuthenticationResponse() + { + } + + /// + /// Authentication type. + /// + public SimAuthenticationType AuthType + { + get + { + return Type; + } + } + + /// + /// Authentication result. + /// + public SimAuthenticationResult AuthResult + { + get + { + return Result; + } + } + + /// + /// Response length. + /// + public int ResponseLength + { + get + { + return RespLength; + } + } + + /// + /// Response data. + /// + public string ResponseData + { + get + { + return RespData; + } + } + + /// + /// The length of the authentication key. + /// + public int AuthKeyLength + { + get + { + return AuthKeyLen; + } + } + + /// + /// The data of the authentication key. + /// + public string AuthKey + { + get + { + return Key; + } + } + + /// + /// The length of the cipher key. + /// + public int CipherLength + { + get + { + return CipherLen; + } + } + + /// + /// Cipher key. + /// + public string CipherData + { + get + { + return Cipher; + } + } + + /// + /// The length of the integrity key. + /// + public int IntegrityLength + { + get + { + return IntegrityLen; + } + } + + /// + /// Integrity key. + /// + public string IntegrityData + { + get + { + return Integrity; + } + } + } + + /// + /// A class which defines information about SIM PIN data. + /// + public class SimPinData + { + private SimPinType _type; + private string _pin; + private uint _pinLength; + private SimPinData() + { + } + + /// + /// A constructor to instantiate SimPinData class which necessary parameters. + /// + /// PIN type. + /// PIN code. + /// PIN code length. + public SimPinData(SimPinType type, string pin, uint pinLength) + { + _type = type; + _pin = pin; + _pinLength = pinLength; + } + + internal SimPinType Type + { + get + { + return _type; + } + } + + internal string Pin + { + get + { + return _pin; + } + } + + internal uint PinLength + { + get + { + return _pinLength; + } + } + } + + /// + /// A class which defines PIN information. + /// + public class SimPinResult + { + internal SimPinType PinType; + internal int Retry; + internal SimPinResult() + { + } + + /// + /// Specifies the PIN or PUK type. + /// + public SimPinType Type + { + get + { + return PinType; + } + } + + /// + /// Number of attempts remaining for PIN/PUK verification. + /// + public int RetryCount + { + get + { + return Retry; + } + } + } + + /// + /// A class which is used to used to enable/disable facility. + /// + public class SimFacility + { + private SimLockType _lockType; + private string _password; + private int _passwordLength; + private SimFacility() + { + } + + /// + /// A constructor to instantiate SimFacility class with necessary parameters. + /// + /// Facility type. + /// Password. + /// Password length. + public SimFacility(SimLockType lockType, string password, int passwordLength) + { + _lockType = lockType; + _password = password; + _passwordLength = passwordLength; + } + + internal SimLockType LockType + { + get + { + return _lockType; + } + } + + internal string Password + { + get + { + return _password; + } + } + + internal int PasswordLength + { + get + { + return _passwordLength; + } + } + } + + /// + /// A class which defines facility result data. + /// + public class SimFacilityResult + { + internal SimLockType LockType; + internal int Count; + internal SimFacilityResult() + { + } + + /// + /// Specifies the PIN or PUK type. + /// + public SimLockType Type + { + get + { + return LockType; + } + } + + /// + /// Number of attempts remaining for PIN/PUK verification. + /// + public int RetryCount + { + get + { + return Count; + } + } + } + + /// + /// A class which defines facility info data. + /// + public class SimFacilityInfo + { + internal SimLockType LockType; + internal SimFacilityStatus FacilityStatus; + internal SimFacilityInfo() + { + } + + /// + /// Lock type. + /// + public SimLockType Type + { + get + { + return LockType; + } + } + + /// + /// Facility status. + /// + public SimFacilityStatus Status + { + get + { + return FacilityStatus; + } + } + } + + /// + /// A class which defines information about lock type. + /// + public class SimLockInfo + { + internal SimLockType LockType; + internal SimLockStatus LockStatus; + internal int Count; + internal SimLockInfo() + { + } + + /// + /// Lock type. + /// + public SimLockType Type + { + get + { + return LockType; + } + } + + /// + /// Lock status. + /// + public SimLockStatus Status + { + get + { + return LockStatus; + } + } + + /// + /// Retry counts. + /// + public int RetryCount + { + get + { + return Count; + } + } + } + + /// + /// A class which defines APDU information. + /// + public class SimApdu + { + private byte[] _apdu; + private SimApdu() + { + } + + /// + /// A constructor to instantiate SimApdu class with necessary parameters. + /// + /// APDU. + public SimApdu(byte[] apdu) + { + _apdu = apdu; + } + + internal byte[] Apdu + { + get + { + return _apdu; + } + } + } + + /// + /// A class which defines the response of sending APDU. + /// + public class SimApduResponse + { + internal ushort ApduLen; + internal byte[] ApduResp; + internal SimApduResponse() + { + } + + /// + /// Length of response APDU. + /// + public ushort ApduLength + { + get + { + return ApduLen; + } + } + + /// + /// Response APDU. + /// + public byte[] ApduResponse + { + get + { + return ApduResp; + } + } + } + + /// + /// A class which defines the response of sending ATR. + /// + public class SimAtrResponse + { + internal ushort AtrRespLen; + internal byte[] AtrResp; + internal SimAtrResponse() + { + } + + /// + /// Length of response ATR. + /// + public ushort AtrRespLength + { + get + { + return AtrRespLen; + } + } + + /// + /// Response ATR. + /// + public byte[] AtrResponse + { + get + { + return AtrResp; + } + } + } + + /// + /// A class which defines ISIM IMPU list data. + /// + public class SimImpuList + { + internal uint DataCount; + internal IEnumerable ImpuList; + internal SimImpuList() + { + } + + /// + /// ISIM IMPU data count. + /// + public uint Count + { + get + { + return DataCount; + } + } + + /// + /// ISIM IMPU list. + /// + public IEnumerable List + { + get + { + return ImpuList; + } + } + } + + /// + /// A class which defines ISIM P-CSCF data. + /// + public class SimPcscf + { + internal SimPcscfType PcscfType; + internal string PcscfData; + internal SimPcscf() + { + } + + /// + /// ISIM P-CSCF type. + /// + public SimPcscfType Type + { + get + { + return PcscfType; + } + } + + /// + /// ISIM P-CSCF data. + /// + public string Pcscf + { + get + { + return PcscfData; + } + } + } + + /// + /// A class which defines ISIM P-CSCF list data. + /// + public class SimPcscfList + { + internal uint DataCount; + internal IEnumerable PcscfList; + internal SimPcscfList() + { + } + + /// + /// ISIM P-CSCF data count. + /// + public uint Count + { + get + { + return DataCount; + } + } + + /// + /// ISIM P-CSCF list. + /// + public IEnumerable List + { + get + { + return PcscfList; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SimEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/SimEnumerations.cs new file mode 100755 index 0000000..7c115cd --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SimEnumerations.cs @@ -0,0 +1,1779 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the SIM card status. + /// + public enum SimCardStatus + { + /// + /// Bad card / On the fly SIM gone bad. + /// + Error = 0x00, + /// + /// Card not present. + /// + NotPresent = 0x01, + /// + /// SIM is in the Initializing state. + /// + Initializing = 0x02, + /// + /// SIM Initialization ok. + /// + InitCompleted = 0x03, + /// + /// PIN required state. + /// + PinRequired = 0x04, + /// + /// PUK required state. + /// + PukRequired = 0x05, + /// + /// PIN/PUK blocked(permanently blocked- All the attempts for PIN/PUK failed). + /// + Blocked = 0x06, + /// + /// Network Control Key required state. + /// + NckRequired = 0x07, + /// + /// Network Subset Control Key required state. + /// + NsckRequired = 0x08, + /// + /// Service Provider Control Key required state. + /// + SpckRequired = 0x09, + /// + /// Corporate Control Key required state. + /// + CckRequired = 0x0a, + /// + /// Card removed. + /// + Removed = 0x0b, + /// + /// PH-SIM (phone-SIM) locked state. + /// + LockRequired = 0x0c, + /// + /// Runtime SIM card error. + /// + Crashed = 0x0d, + /// + /// SIM card Powered OFF. + /// + PowerOff = 0x0e, + /// + /// Unknown status. It can be the initial status. + /// + Unknown = 0xff + } + + /// + /// Enumeration for the SIM card type. + /// + public enum SimCardType + { + /// + /// Unknown card. + /// + Unknown, + /// + /// SIM(GSM) card. + /// + Gsm, + /// + /// USIM card. + /// + Usim, + /// + /// CDMA card. + /// + Ruim, + /// + /// CDMA NV SIM. + /// + Nvsim, + /// + /// IMS card. + /// + Ims + } + + /// + /// Enumeration for the language preference code. + /// + public enum SimLanguagePreference + { + /// + /// German. + /// + German = 0x00, + /// + /// English. + /// + English = 0x01, + /// + /// Italian. + /// + Italian = 0x02, + /// + /// French. + /// + French = 0x03, + /// + /// Spanish. + /// + Spanish = 0x04, + /// + /// Dutch. + /// + Dutch = 0x05, + /// + /// Swedish. + /// + Swedish = 0x06, + /// + /// Danish. + /// + Danish = 0x07, + /// + /// Portuguese. + /// + Portuguese = 0x08, + /// + /// Finnish. + /// + Finnish = 0x09, + /// + /// Norwegian. + /// + Norwegian = 0x0A, + /// + /// Greek. + /// + Greek = 0x0B, + /// + /// Turkish. + /// + Turkish = 0x0C, + /// + /// Hungarian. + /// + Hungarian = 0x0D, + /// + /// Polish. + /// + Polish = 0x0E, + /// + /// Korean. + /// + Korean = 0x0F, + /// + /// Chinese. + /// + Chinese = 0x10, + /// + /// Russian. + /// + Russian = 0x11, + /// + /// Japanese. + /// + Japanese = 0x12, + /// + /// Unspecified. + /// + Unspecified = 0xFF + } + + /// + /// Enumeration for the security lock type. + /// + public enum SimLockType + { + /// + /// PH-SIM (phone-SIM) locked. Lock Phone to SIM/UICC card. + /// + PS = 0x01, + /// + /// PH-FSIM (phone-first-SIM) Lock Phone to the very first inserted SIM/UICC card. + /// + PF, + /// + /// SIM Lock (PIN, PIN2, PUK, PUK2) Lock SIM/UICC card. + /// + SC, + /// + /// FDN - SIM card or active application in the UICC (GSM or USIM). + /// + FD, + /// + /// Network Personalization. + /// + PN, + /// + /// Network subset Personalization. + /// + PU, + /// + /// Service Provider Personalization. + /// + PP, + /// + /// Corporate Personalization. + /// + PC + } + + /// + /// Enumeration for the power state of the SIM. + /// + public enum SimPowerState + { + /// + /// Off state. + /// + Off = 0x00, + /// + /// On state. + /// + On = 0x01, + /// + /// Unspecified state. + /// + Unspecified = 0xFF + } + /// + /// Enumeration for the file ID. + /// + public enum SimFileId + { + /// + /// Root Directory for the USIM. + /// + Dir = 0x2F00, + /// + /// The ICC Identification file. + /// + IccId = 0x2FE2, + /// + /// The IMSI file. + /// + Imsi = 0x6F07, + /// + /// The SIM Service Table file. + /// + Sst = 0x6F38, + /// + /// The Enabled Service Table file. + /// + Est = 0x6F56, + /// + /// The OPLMN List file. + /// + OplmnAct = 0x6F61, + /// + /// The Group Identifier Level 1. + /// + Gid1 = 0x6F3E, + /// + /// The Group Identifier Level 2. + /// + Gid2 = 0x6F3F, + /// + /// The Extended Language Preference file. + /// + Elp = 0x2F05, + /// + /// SIM: Language preference. + /// + Lp = 0x6F05, + /// + /// The Emergency Call Codes. + /// + Ecc = 0x6FB7, + /// + /// The Service Provider Name. + /// + Spn = 0x6F46, + /// + /// The Service provider display information. + /// + Spdi = 0x6FCD, + /// + /// The PLMN Network Name File. + /// + Pnn = 0x6FC5, + /// + /// The Operator PLMN List File. + /// + Opl = 0x6FC6, + /// + /// MSISDN. + /// + Msisdn = 0x6F40, + /// + /// Short Messages file. + /// + Sms = 0x6F3C, + /// + /// SMS Parameter. + /// + Smsp = 0x6F42, + /// + /// SMS Status. + /// + Smss = 0x6F43, + /// + /// Cell Broadcast Message Identifier. + /// + Cbmi = 0x6F45, + /// + /// SIM Mail Box Dialing Number file. + /// + Mbdn = 0x6FC7, + /// + /// Mailbox Identifier - linear fixed. + /// + UsimMbi = 0x6FC9, + /// + /// Message Waiting Indication Status - linear fixed. + /// + UsimMwis = 0x6FCA, + /// + /// Call forward indication status - linear fixed. + /// + UsimCfis = 0x6FCB, + /// + /// CPHS voice MSG waiting indication. + /// + CphsVoiceMsgWaiting = 0x6F11, + /// + /// CPHS service string table. + /// + CphsServiceStringTable = 0x6F12, + /// + /// CPHS call forward flags. + /// + CphsCallForwardFlags = 0x6F13, + /// + /// CPHS operator name string. + /// + CphsOperatorNameString = 0x6F14, + /// + /// CPHS customer service profile. + /// + CphsCustomerServiceProfile = 0x6F15, + /// + /// CPHS information. + /// + CphsInfo = 0x6F16, + /// + /// CPHS mail box numbers. + /// + CphsMailboxNumbers = 0x6F17, + /// + /// CPHS operator name short form string. + /// + CphsOperatorNameShortFormString = 0x6F18, + /// + /// CPHS information numbers. + /// + CphsInformationNumbers = 0x6F19, + /// + /// CPHS Dynamics flags. + /// + CphsDynamicFlags = 0x6F9F, + /// + /// CPHS Dynamics2 flags. + /// + CphsDynamic2Flag = 0x6F92, + /// + /// CPHS CSP2. + /// + CphsCustomerServiceProfileLine2 = 0x6F98, + /// + /// Invalid file. + /// + Invalid = 0xFFFF, + /// + /// Element to indicate an unknown file. + /// + Others + } + + /// + /// Enumeration for the SIM number type. + /// + public enum SimTypeOfNumber + { + /// + /// Unknown. + /// + Unknown = 0, + /// + /// International number. + /// + International, + /// + /// National number. + /// + National, + /// + /// Network specific number. + /// + NetworkSpecific, + /// + /// Subscriber number. + /// + DedicatedAccess, + /// + /// Alphanumeric, GSM 7-bit default alphabet. + /// + AlphaNumeric, + /// + /// Abbreviated number + /// + AbbreviatedNumber, + /// + /// Reserved for extension. + /// + ReservedForExt + } + + /// + /// Enumeration for the numbering plan identifier. + /// + public enum SimNumberPlanIdentity + { + /// + /// Unknown. + /// + Unknown, + /// + /// ISDN/Telephone numbering plan. + /// + IsdnTelephone, + /// + /// Data numbering plan + /// + Data, + /// + /// Telex numbering plan + /// + Telex, + /// + /// Service Center Specific plan. + /// + ServiceCenterSpecific, + /// + /// Service Center Specific plan 2. + /// + ServiceCenterSpecific2, + /// + /// National numbering plan. + /// + National, + /// + /// Private numbering plan. + /// + Private, + /// + /// ERMES numbering plan. + /// + Ermes, + /// + /// Reserved for extension. + /// + ReservedForExt + } + + /// + /// Enumeration for the emergency service type. + /// + public enum SimEccEmergencyServiceType + { + /// + /// Police. + /// + Police = 0x01, + /// + /// Ambulance. + /// + Ambulance = 0x02, + /// + /// Fire brigade. + /// + FireBrigade = 0x04, + /// + /// Marine guard. + /// + MarineGuard = 0x08, + /// + /// Mountain rescue. + /// + MountainRescue = 0x10, + /// + /// Spare. + /// + Spare = 0x00 + } + + /// + /// Enumeration for the SIM app type. + /// + public enum SimAppType + { + /// + /// SIM application. + /// + Sim = 0x01, + /// + /// USIM application. + /// + Usim = 0x02, + /// + /// CSIM application. + /// + Csim = 0x04, + /// + /// ISIM application. + /// + Isim = 0x08 + } + + /// + /// Enumeration for the SIM access result from the lower layers. + /// + public enum SimAccessResult + { + /// + /// Access to file is successful. + /// + Success, + /// + /// SIM card error. + /// + CardError, + /// + /// File not found. + /// + FileNotFound, + /// + /// Access condition is not fulfilled. + /// + ConditionNotSatisfied, + /// + /// Access failed. + /// + Failed + } + + /// + /// Enumeration for the mailbox type. + /// + public enum SimMailboxType + { + /// + /// Voicemail. + /// + Voice = 0x01, + /// + /// Fax. + /// + Fax = 0x02, + /// + /// Email. + /// + Email = 0x03, + /// + /// Other. + /// + Other = 0x04, + /// + /// Videomail. + /// + Video = 0x05, + /// + /// Data. + /// + Data = 0x06 + } + + /// + /// Enumeration for the current CPHS phase of the SIM card. + /// + public enum SimCphsPhaseType + { + /// + /// Phase 1. + /// + Phase1 = 0x01, + /// + /// Phase 2. + /// + Phase2 = 0x02, + /// + /// RFU. + /// + Rfu = 0xff + } + + /// + /// Enumeration for CDMA service table. + /// + public enum SimCdmaServiceTable + { + /// + /// CDMA service table. + /// + Cdma = 0, + /// + /// CSIM service table. + /// + Csim, + /// + /// MAX value. + /// + Max + } + + /// + /// Enumeration for the SIM Authentication type. + /// + public enum SimAuthenticationType + { + /// + /// IMS Authentication. + /// + Ims = 0x00, + /// + /// GSM Authentication. + /// + Gsm, + /// + /// 3G Authentication. + /// + Auth3G, + /// + /// CDMA CAVE Authentication. + /// + RuimCave, + /// + /// CDMA CHAP Authentication. + /// + RuimChap, + /// + /// CDMA MNHA Authentication. + /// + RuimMnha, + /// + /// CDMA MIPRRQ Authentication. + /// + RuimMiprrq, + /// + /// CDMA MNAAA Authentication. + /// + RuimMnaaa, + /// + /// CDMA HRPD Authentication. + /// + RuimHrpd, + /// + /// MAX value. + /// + Max + } + + /// + /// Enumeration for the SIM Authentication result. + /// + public enum SimAuthenticationResult + { + /// + /// Status - no error. + /// + NoError = 0x00, + /// + /// Status - can't perform authentication. + /// + CannotPerform, + /// + /// Status - skip authentication response. + /// + SkipResponse, + /// + /// Status - MAK(Multiple Activation Key) code failure. + /// + MakCodeFailure, + /// + /// Status - SQN(SeQuenceNumber) failure. + /// + SqnFailure, + /// + /// Status - synch failure. + /// + SynchFailure, + /// + /// Status - unsupported context. + /// + UnsupportedContext, + /// + /// Status - default error. + /// + Error, + /// + /// MAX value. + /// + Max + } + + /// + /// Enumeration for the PIN type. + /// + public enum SimPinType + { + /// + /// PIN 1 code. + /// + Pin1 = 0x00, + /// + /// PIN 2 code. + /// + Pin2 = 0x01, + /// + /// PUK 1 code. + /// + Puk1 = 0x02, + /// + /// PUK 2 code. + /// + Puk2 = 0x03, + /// + /// Universal PIN - Unused now. + /// + Upin = 0x04, + /// + /// Administrator - Unused now. + /// + Adm = 0x05, + /// + /// SIM Lock code. + /// + Sim = 0x06 + } + + /// + /// Enumeration for the PIN status. + /// + public enum SimFacilityStatus + { + /// + /// Facility disabled. + /// + Disabled = 0x00, + /// + /// Facility enabled. + /// + Enabled = 0x01, + /// + /// Facility unknown. + /// + Unknown = 0xFF + } + + /// + /// Enumeration for the security lock key information. + /// + public enum SimLockStatus + { + /// + /// Key not needed. + /// + NotNeeded = 0x00, + /// + /// PIN required. + /// + Pin = 0x01, + /// + /// PUK required. + /// + Puk = 0x02, + /// + /// PIN2 required. + /// + Pin2 = 0x03, + /// + /// PUK2 required. + /// + Puk2 = 0x04, + /// + /// Permanent block SIM. + /// + PermanentBlocked = 0x05 + } + + /// + /// Enumeration for P-CSCF type. + /// + public enum SimPcscfType + { + /// + /// Fully Qualified Domain Name. + /// + Fqdn, + /// + /// IPv4. + /// + IPv4, + /// + /// IPv6. + /// + IPv6 + } + + /// + /// Enumeration for the SIM power set result from the lower layers. + /// + public enum SimPowerSetResult + { + /// + /// Power Set is successful. + /// + Success, + /// + /// Power Set failure. + /// + Failure + } + + /// + /// Enumeration for the list of IST services in the ISIM Service Table (ISIM). + /// + public enum SimIsimService + { + /// + /// P-CSCF address. + /// + PcscfAddr = 0, + /// + /// Generic Bootstrapping Architecture. + /// + Gba, + /// + /// HTTP Digest. + /// + HttpDigest, + /// + /// GBA-based Local Key Establishment Mechanism. + /// + GbaLocalKey, + /// + /// Support of P-CSCF discovery for IMS Local Break Out. + /// + PcscfLocalBreakOut, + /// + /// Short Message Storage. + /// + Sms, + /// + /// Short Message Status Reports. + /// + Smsr, + /// + /// Support for SM-over-IP including data download via SMS-PP as defined in TS 31.111 [31] + /// + SmOverIP, + /// + /// Communication Control for IMS by ISIM. + /// + CommunicationControl = 8, + /// + /// Support of UICC access to IMS. + /// + AccessToIms, + /// + /// URI support by UICC. + /// + UriSupport + } + + /// + /// Enumeration for the list of SST services in the SIM Service Table (GSM). + /// + public enum SimSstService + { + /// + /// CHV1 disable function. + /// + Chv1DisableFunc = 0, + /// + /// Abbreviated Dialing number. + /// + Adn, + /// + /// Fixed Dialing number. + /// + Fdn, + /// + /// Short message storage. + /// + Sms, + /// + /// Advice of charge. + /// + Aoc, + /// + /// Capability configuration parameters. + /// + Ccp, + /// + /// PLMN selector. + /// + PlmnSelector, + /// + /// RFU. + /// + Rfu1, + /// + /// MSISDN. + /// + Msisdn = 8, + /// + /// Extension 1. + /// + Ext1, + /// + /// Extension 2. + /// + Ext2, + /// + /// SMS parameters. + /// + SmsParams, + /// + /// Last number dialed. + /// + Lnd, + /// + /// Cell broadcast message identifier. + /// + CellBroadcastMsgId, + /// + /// Group identifier level 1. + /// + GidLv1, + /// + /// Group identifier level 2. + /// + GidLv2, + /// + /// Service provider name. + /// + Spn = 16, + /// + /// Service Dialing number. + /// + Sdn, + /// + /// Extension3. + /// + Ext3, + /// + /// RFU. + /// + RFu2, + /// + /// VGCS group identifier (EF-VGCS, EF-VGCSS). + /// + VgcsGidList, + /// + /// VBS group identifier (EF-VBS, EF-VBSS). + /// + VbsGidList, + /// + /// Enhanced multi-level precedence and pre-emption service. + /// + EnhancedMultiLvPrecedencePreemptionSrvc, + /// + /// Automatic answer for EMLPP. + /// + AutoAnswerForEmlpp, + /// + /// Data download via SMS-CB. + /// + DataDownloadViaSmsCb = 24, + /// + /// Data download via SMS-PP. + /// + DataDownloadViaSmsPp, + /// + /// Menu selection. + /// + MenuSelection, + /// + /// Call control. + /// + CallCtrl, + /// + /// Proactive SIM command. + /// + ProactiveSim, + /// + /// Cell broadcast message identifier ranges. + /// + CellBroadcastMsgIdRanges, + /// + /// Barred Dialing numbers. + /// + Bdn, + /// + /// Extension 4. + /// + Ext4, + /// + /// De-personalization control keys. + /// + DepersonalizationCtrlKeys = 32, + /// + /// Co-operative network list. + /// + CooperativeNetworkList, + /// + /// Short message status reports. + /// + SmsStatusReports, + /// + /// Network's indication of alerting in the MS (NIA). + /// + Nia, + /// + /// Mobile-originated short message control by SIM. + /// + MoSmsCtrlBySim, + /// + /// GPRS. + /// + Gprs, + /// + /// Image. + /// + Img, + /// + /// Support of local service area. + /// + Solsa, + /// + /// USSD string data object supported in call control. + /// + UssdStrDataObjectSupportedInCallCtrl = 40, + /// + /// Run at COMMAND command. + /// + RunAtCmdCmd, + /// + /// User controlled PLMN selector with Access technology. + /// + UserCtrledPlmnSelectorWact, + /// + /// Operator controlled PLMN selector with Access technology. + /// + OperatorCtrledPlmnSelectorWact, + /// + /// HPLMN selector with access technology. + /// + HplmnSelectorWact, + /// + /// CPBCCH information. + /// + CpbcchInfo, + /// + /// Investigation scan. + /// + InvestigationScan, + /// + /// Extended capability configuration parameters. + /// + ExtendedCapaConfParams, + /// + /// MExE. + /// + Mexe = 48, + /// + /// RPLMN last used access technology. + /// + RplmnLastUsedAccessTech, + /// + /// PLMN Network Name. + /// + PlmnNetworkName, + /// + /// Operator PLMN List. + /// + OperatorPlmnList, + /// + /// Mailbox Dialling Numbers. + /// + Mbdn, + /// + /// Message Waiting Indication Status. + /// + Mwis, + /// + /// Call Forwarding Indication Status. + /// + Cfis, + /// + /// Service Provider Display Information. + /// + Spdi + } + + /// + /// Enumeration for the list of UST services in the SIM Service Table (USIM). + /// + public enum SimUstService + { + /// + /// Local phone book. + /// + LocalPb = 0, + /// + /// Fixed Dialing number. + /// + Fdn, + /// + /// Extension 2. + /// + Ext2, + /// + /// Service Dialing number. + /// + Sdn, + /// + /// Extension 3. + /// + Ext3, + /// + /// Barred Dialing numbers. + /// + Bdn, + /// + /// Extension 4. + /// + Ext4, + /// + /// Outgoing call information. + /// + OutgoingCallInfo, + /// + /// Incoming call information. + /// + IncomingCallInfo = 8, + /// + /// Short message storage. + /// + Sms, + /// + /// Short message status reports. + /// + SmsStatusReports, + /// + /// SMS parameters. + /// + SmsParams, + /// + /// Advice of charge. + /// + Aoc, + /// + /// Capability configuration parameters. + /// + Ccp, + /// + /// Cell broadcast message identifier. + /// + CellBroadcastMsgId, + /// + /// Cell broadcast message identifier ranges. + /// + CellBroadcastMsgIdRanges, + /// + /// Group identifier level 1. + /// + GidLv1 = 16, + /// + /// Group identifier level 2. + /// + GidLv2, + /// + /// Service provider name. + /// + Spn, + /// + /// User controlled PLMN selector with Access technology. + /// + UserCtrledPlmnSelectorWact, + /// + /// MSISDN. + /// + Msisdn, + /// + /// Image. + /// + Img, + /// + /// Support of local service area. + /// + Solsa, + /// + /// Enhanced multi-level precedence and pre-emption service. + /// + EnhancedMultiLvPrecedencePreemptionSrvc, + /// + /// Automatic answer for EMLPP. + /// + AutoAnswerForEmlpp = 24, + /// + /// RFU. + /// + Rfu1, + /// + /// GSM access. + /// + GsmAccess, + /// + /// Data download via SMS-PP. + /// + DataDownloadViaSmsPp, + /// + /// Data download via SMS-CB. + /// + DataDownloadViaSmsCb, + /// + /// Call control by USIM. + /// + CallCtrl, + /// + /// Mobile-originated short message control by USIM. + /// + MoSmsCtrl, + /// + /// Run at COMMAND command. + /// + RunAtCmdCmd, + /// + /// Shall be set to 1. + /// + ShallBeSetToOne = 32, + /// + /// Enabled service table. + /// + EnabledSrvcTable, + /// + /// APN control list. + /// + Acl, + /// + /// De-personalization control keys. + /// + DepersonalizationCtrlKeys, + /// + /// Co-operative network list. + /// + CooperativeNetworkList, + /// + /// GSM security context. + /// + GsmSecContext, + /// + /// CPBCCH information. + /// + CpbcchInfo, + /// + /// Investigation scan. + /// + InvestigationScan, + /// + /// MExE. + /// + Mexe = 40, + /// + /// Operator controlled PLMN selector with Access technology. + /// + OperatorCtrledPlmnSelectorWact, + /// + /// HPLMN selector with access technology. + /// + HplmnSelectorWact, + /// + /// Extension 5. + /// + Ext5, + /// + /// PLMN Network Name. + /// + PlmnNetworkName, + /// + /// Operator PLMN List. + /// + OperatorPlmnList, + /// + /// Mailbox Dialling Numbers. + /// + Mbdn, + /// + /// Message Waiting Indication Status. + /// + Mwis, + /// + /// Call Forwarding Indication Status. + /// + Cfis = 48, + /// + /// RPLMN last used access technology. + /// + RplmnLastUsedAccessTech, + /// + /// Service Provider Display Information. + /// + Spdi, + /// + /// Multi media messaging service. + /// + Mms, + /// + /// Extension 8. + /// + Ext8, + /// + /// Call control on GPRS by USIM. + /// + CallCtrlOnGprs, + /// + /// MMS user connectivity parameters. + /// + MmsUserConnectivityParams, + /// + /// Network's indication of alerting in the MS (NIA). + /// + Nia, + /// + /// VGCS group identifier List (EF-VGCS, EF-VGCSS). + /// + VgcsGidList = 56, + /// + /// VBS group identifier List (EF-VBS, EF-VBSS). + /// + VbsGidList, + /// + /// Pseudonym. + /// + Pseudonym, + /// + /// User controlled PLMN selector for I-WLAN access. + /// + UserCtrledPlmnSelectorIwlan, + /// + /// Operator controlled PLMN selector for I-WLAN access. + /// + OperatorCtrledPlmnSelectorIwlan, + /// + /// User controlled WSID list. + /// + UserCtrledWsidList, + /// + /// Opertor controlled Wsid list. + /// + OperatorCtrledWsidList, + /// + /// VGCS security. + /// + VgcsSec + } + + /// + /// Enumeration for the list of CST services in the CDMA Service Table. + /// + public enum SimCdmaService + { + /// + /// CHV Disable Option. + /// + ChvDisable = 0, + /// + /// Abbreviated Dialing number. + /// + Adn, + /// + /// Fixed Dialing number. + /// + Fdn, + /// + /// Short message storage. + /// + Sms, + /// + /// HRPD. + /// + Hrpd, + /// + /// Enhanced Phone Book. + /// + Epb, + /// + /// Multimedia domain. + /// + Mmd, + /// + /// SF_EUIMID- based EUIMID. + /// + Euimid, + /// + /// MEID. + /// + Meid = 8, + /// + /// Extension 1. + /// + Ext1, + /// + /// Extension 2. + /// + Ext2, + /// + /// SMS parameters. + /// + Smsp, + /// + /// Last number dialled. + /// + Lnd, + /// + /// Service Category Program for BC-SMS. + /// + Scp, + /// + /// RFU. + /// + Rfu1, + /// + /// RFU. + /// + Rfu2, + /// + /// CDMA Home Service Provider Name. + /// + Hspn = 16, + /// + /// Service Dialing number. + /// + Sdn, + /// + /// Extension 3. + /// + Ext3, + /// + /// 3GPD-SIP. + /// + St3GpdSip, + /// + /// RFU. + /// + Rfu3, + /// + /// RFU. + /// + Rfu4, + /// + /// RFU. + /// + Rfu5, + /// + /// RFU. + /// + Rfu6, + /// + /// Data download by SMS broadcast. + /// + Ddsmsb = 24, + /// + /// Data download by SMS PP. + /// + Ddsmspp, + /// + /// Menu Selection. + /// + Menu, + /// + /// Call Control. + /// + Callc, + /// + /// Proactive RUIM. + /// + Proactive, + /// + /// AKA. + /// + Aka, + /// + /// RFU. + /// + Rfu7, + /// + /// RFU. + /// + Rfu8, + /// + /// RFU. + /// + Rfu9 = 32, + /// + /// RFU. + /// + Rfu10, + /// + /// RFU. + /// + Rfu11, + /// + /// RFU. + /// + Rfu12, + /// + /// RFU. + /// + Rfu13, + /// + /// 3GPD- MIP. + /// + St3GpdMip, + /// + /// BCMCS. + /// + Bcmcs, + /// + /// Multimedia messaging service. + /// + Mms, + /// + /// Extension 8. + /// + Ext8 = 40, + /// + /// MMS User Connectivity Parameters. + /// + Mmsucp, + /// + /// Application Authentication. + /// + Aa, + /// + /// Group Identifier Level 1. + /// + Gil1, + /// + /// Group Identifier Level 2. + /// + Gil2, + /// + /// Depersonalisation control keys. + /// + Deperso, + /// + /// Co-operative Network List. + /// + Cnl + } + + /// + /// Enumeration for the list of CST services in the CSIM Service Table (CSIM). + /// + public enum SimCsimService + { + /// + /// Local Phone book. + /// + LocalPhonebook = 0, + /// + /// Fixed Dialing Numbers (FDN). + /// + Fdn, + /// + /// Extension 2. + /// + Ext2, + /// + /// Service Dialing Numbers (SDN). + /// + Sdn, + /// + /// Extension 3. + /// + Ext3, + /// + /// Short Message Storage (SMS). + /// + Sms, + /// + /// Short Message Parameters. + /// + Smsp, + /// + /// HRPD. + /// + Hrpd, + /// + /// Service Category Program for BC-SMS. + /// + Scp = 8, + /// + /// CDMA Home Service Provider Name. + /// + Hspn, + /// + /// Data Download via SMS Broadcast. + /// + DdSmsb, + /// + /// Data Download via SMS-PP. + /// + DdSmsPp, + /// + /// Call Control. + /// + Callc, + /// + /// 3GPD-SIP. + /// + St3GpdSip, + /// + /// 3GPD-MIP. + /// + St3GpdMip, + /// + /// AKA. + /// + Aka, + /// + /// IP-based Location Services (LCS). + /// + IPLcs = 16, + /// + /// BCMCS. + /// + Bcmcs, + /// + /// Multimedia Messaging Service (MMS). + /// + Mms, + /// + /// Extension 8. + /// + Ext8, + /// + /// MMS User Connectivity Parameters. + /// + Mmsucp, + /// + /// Application Authentication. + /// + Aa, + /// + /// Group Identifier Level 1. + /// + Gil1, + /// + /// Group Identifier Level 2. + /// + Gil2, + /// + /// De-Personalization Control Keys. + /// + Deperso = 24, + /// + /// Cooperative Network List. + /// + Cnl, + /// + /// Outgoing Call Information (OCI). + /// + Oci, + /// + /// Incoming Call Information (ICI). + /// + Ici, + /// + /// Extension 5. + /// + Ext5, + /// + /// Multimedia Storage. + /// + MmStorage, + /// + /// Image (EFIMG). + /// + Img, + /// + /// Enabled Services Table. + /// + Est, + /// + /// Capability Configuration Parameters (CCP). + /// + Ccp = 32, + /// + /// SF_EUIMID-based EUIMID. + /// + Euimidl, + /// + /// Messaging and 3GPD Extensions. + /// + St3GpdExt, + /// + /// Root Certificates. + /// + RootCerti, + /// + /// WAP Browser. + /// + Wap, + /// + /// Java. + /// + Java, + /// + /// Reserved for CDG. + /// + RsvdCdg1, + /// + /// Reserved for CDG. + /// + RsvdCdg2, + /// + /// IPv6. + /// + IPv6 = 40 + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SimStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/SimStructs.cs new file mode 100755 index 0000000..24a38a6 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SimStructs.cs @@ -0,0 +1,1083 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct SimImsiInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] + internal string Mcc; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] + internal string Mnc; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] + internal string Msin; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimEccInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + internal string Name; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Number; + internal SimEccEmergencyServiceType Type; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimEccInfoListStruct + { + internal int Count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15, ArraySubType = UnmanagedType.LPStruct)] + internal SimEccInfoStruct[] ListInfo; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct CfDataStruct + { + [FieldOffset(0)] + internal SimCfisStruct Cfis; + [FieldOffset(0)] + internal SimCphsCfStruct CphsCf; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCallForwardRequestStruct + { + internal int IsCphs; + internal CfDataStruct CfData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCfisStruct + { + internal int RecIndex; + internal byte MspNum; + internal byte CfuStatus; + internal SimTypeOfNumber Ton; + internal SimNumberPlanIdentity Npi; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] + internal string CfuNum; + internal byte Cc2Id; + internal byte Ext7Id; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCfisListStruct + { + internal int ProfileCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.LPStruct)] + internal SimCfisStruct[] CfisList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCphsCfStruct + { + internal int Line1; + internal int Line2; + internal int Fax; + internal int Data; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCallForwardResponseStruct + { + internal int IsCphs; + internal SimCfisListStruct CfList; + internal SimCphsCfStruct CphsCf; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct MwData + { + [FieldOffset(0)] + internal SimMwisStruct Mwis; + [FieldOffset(0)] + internal SimCphsMwStruct CphsMw; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMessageWaitingRequestStruct + { + internal int IsCphs; + internal MwData Mw; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMwisStruct + { + internal int RecIndex; + internal byte IndicatorStatus; + internal int VoiceCount; + internal int FaxCount; + internal int EmailCount; + internal int OtherCount; + internal int VideoCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMwisListStruct + { + internal int ProfileCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2, ArraySubType = UnmanagedType.LPStruct)] + internal SimMwisStruct[] MwList; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCphsMwStruct + { + internal int Voice1; + internal int Voice2; + internal int Fax; + internal int Data; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMessageWaitingResponseStruct + { + internal int IsCphs; + internal SimMwisListStruct MwList; + internal SimCphsMwStruct CphsMw; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMailboxNumberStruct + { + internal int IsCphs; + internal int RecIndex; + internal int ProfileNum; + internal SimMailboxType MbType; + internal int AlphaMaxLen; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + internal string AlphaId; + internal SimTypeOfNumber Ton; + internal SimNumberPlanIdentity Npi; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 21)] + internal string Number; + internal byte CcId; + internal byte Ext1Id; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMailboxListStruct + { + internal int Count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10, ArraySubType = UnmanagedType.LPStruct)] + internal SimMailboxNumberStruct[] List; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimAuthenticationDataStruct + { + internal SimAuthenticationType AuthType; + internal int RandLength; + internal int AutnLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string RandData; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string AutnData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimAuthenticationResponseStruct + { + internal SimAuthenticationType AuthType; + internal SimAuthenticationResult AuthResult; + internal int RespLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + internal string RespData; + internal int AuthKeyLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + internal string AuthKey; + internal int CipherLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + internal string CipherData; + internal int IntegrityLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)] + internal string IntegrityData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPinDataStruct + { + internal SimPinType Type; + [MarshalAs(UnmanagedType.LPStr)] + internal string Pin; + internal uint PinLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimFacilityStruct + { + internal SimLockType LockType; + [MarshalAs(UnmanagedType.LPStr)] + internal string Password; + internal int PasswordLength; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimFacilityResultStruct + { + internal SimLockType Type; + internal int RetryCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimFacilityInfoStruct + { + internal SimLockType Type; + internal SimFacilityStatus Status; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimApduStruct + { + internal ushort ApduLen; + [MarshalAs(UnmanagedType.LPStr)] + internal string Apdu; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimApduResponseStruct + { + internal ushort RespLen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5120)] + internal byte[] ApduResp; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimIccIdInfoStruct + { + internal int IccLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] + internal string IccNumber; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCphsServiceTableStruct + { + internal int CustomerServiceProfile; + internal int ServiceStringTable; + internal int MailboxNumbers; + internal int OperatorNameShortForm; + internal int InformationNumbers; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCphsInfoStruct + { + internal SimCphsPhaseType CphsPhase; + internal SimCphsServiceTableStruct CphsServiceTable; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct CstServiceStrct + { + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 47)] + internal string CdmaService; + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + internal string CsimService; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCstStrct + { + internal SimCdmaServiceTable CdmaSvcTable; + internal CstServiceStrct Cst; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct ServiceTable + { + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)] + internal string SimSstService; + [FieldOffset(0)] + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)] + internal string SimUstService; + [FieldOffset(0)] + internal SimCstStrct Cst; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimServiceTableStruct + { + internal SimCardType SimType; + internal ServiceTable Table; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimSubscriberInfoStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 27)] + internal string Number; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 31)] + internal string Name; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimMsisdnListStruct + { + internal int Count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3, ArraySubType = UnmanagedType.LPStruct)] + internal SimSubscriberInfoStruct[] List; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimOplmnwactStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 7)] + internal string Plmn; + internal int IsUmts; + internal int IsGsm; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimOplmnwactListStruct + { + internal int Count; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100, ArraySubType = UnmanagedType.LPStruct)] + internal SimOplmnwactStruct[] List; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimSpnStruct + { + internal byte DisplayCondition; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + internal string Spn; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimCphsNetNameStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 41)] + internal string FullName; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] + internal string ShortName; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPinResultStruct + { + internal SimPinType Type; + internal int RetryCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimLockInfoStruct + { + internal SimLockType Type; + internal SimLockStatus Status; + internal int RetryCount; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimAtrResponseStruct + { + internal ushort AtrRespLen; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5120)] + internal byte[] AtrResp; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimImpuListStruct + { + internal uint Count; + internal IntPtr List; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPcscfStruct + { + internal SimPcscfType Type; + [MarshalAs(UnmanagedType.LPStr)] + internal string Pcscf; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SimPcscfListStruct + { + internal uint Count; + internal IntPtr List; + } + + internal static class SimStructConversions + { + internal static SimImsiInfo ConvertSimImsiInfoStruct(SimImsiInfoStruct imsiStruct) + { + SimImsiInfo imsi = new SimImsiInfo(); + imsi.CountryCode = imsiStruct.Mcc; + imsi.NetworkCode = imsiStruct.Mnc; + imsi.StationId = imsiStruct.Msin; + return imsi; + } + + internal static SimEccInfo ConvertSimEccInfoStruct(SimEccInfoStruct eccStruct) + { + SimEccInfo ecc = new SimEccInfo(); + ecc.NameInfo = eccStruct.Name; + ecc.NumberInfo = eccStruct.Number; + ecc.TypeInfo = eccStruct.Type; + return ecc; + } + + internal static SimEccInfoList ConvertSimEccInfoListStruct(SimEccInfoListStruct listStruct) + { + SimEccInfoList eccList = new SimEccInfoList(); + eccList.EccCount = listStruct.Count; + List eccInfoList = new List(); + foreach (SimEccInfoStruct info in listStruct.ListInfo) + { + eccInfoList.Add(ConvertSimEccInfoStruct(info)); + } + + eccList.List = eccInfoList; + return eccList; + } + + internal static SimIccIdInfo ConvertSimIccIdInfoStruct(SimIccIdInfoStruct iccStruct) + { + SimIccIdInfo iccId = new SimIccIdInfo(); + iccId.Length = iccStruct.IccLength; + iccId.Number = iccStruct.IccNumber; + return iccId; + } + + internal static SimCfis ConvertSimCfisStruct(SimCfisStruct cfisStruct) + { + SimCfis cfis = new SimCfis(); + cfis.RecIndex = cfisStruct.RecIndex; + cfis.MspNum = cfisStruct.MspNum; + cfis.CfuStatus = cfisStruct.CfuStatus; + cfis.Ton = cfisStruct.Ton; + cfis.Npi = cfisStruct.Npi; + cfis.CfuNum = cfisStruct.CfuNum; + cfis.Cc2Id = cfisStruct.Cc2Id; + cfis.Ext7Id = cfisStruct.Ext7Id; + return cfis; + } + + internal static SimCfisList ConvertSimCfisListStruct(SimCfisListStruct listStruct) + { + SimCfisList cfisList = new SimCfisList(); + cfisList.Count = listStruct.ProfileCount; + List cfis = new List(); + foreach (SimCfisStruct cfStruct in listStruct.CfisList) + { + cfis.Add(ConvertSimCfisStruct(cfStruct)); + } + + cfisList.List = cfis; + return cfisList; + } + + internal static SimCphsCf ConvertSimCphsCfStruct(SimCphsCfStruct cphsCfStruct) + { + SimCphsCf cphs = new SimCphsCf(); + cphs.Line1 = cphsCfStruct.Line1; + cphs.Line2 = cphsCfStruct.Line2; + cphs.Fax = cphsCfStruct.Fax; + cphs.Data = cphsCfStruct.Data; + return cphs; + } + + internal static SimCallForwardResponse ConvertSimCallForwardResponseStruct(SimCallForwardResponseStruct respStruct) + { + SimCallForwardResponse resp = new SimCallForwardResponse(); + if (respStruct.IsCphs == 1) + { + resp.IsCphsCf = true; + } + + else if (respStruct.IsCphs == 0) + { + resp.IsCphsCf = false; + } + + resp.List = ConvertSimCfisListStruct(respStruct.CfList); + resp.CphsCfInfo = ConvertSimCphsCfStruct(respStruct.CphsCf); + return resp; + } + + internal static SimMwis ConvertSimMwisStruct(SimMwisStruct mwisStruct) + { + SimMwis mwis = new SimMwis(); + mwis.RecIndex = mwisStruct.RecIndex; + mwis.IndicatorStatus = mwisStruct.IndicatorStatus; + mwis.VoiceCount = mwisStruct.VoiceCount; + mwis.FaxCount = mwisStruct.FaxCount; + mwis.EmailCount = mwisStruct.EmailCount; + mwis.OtherCount = mwisStruct.OtherCount; + mwis.VideoCount = mwisStruct.VideoCount; + return mwis; + } + + internal static SimMwisList ConvertSimMwisListStruct(SimMwisListStruct mwStruct) + { + SimMwisList mwList = new SimMwisList(); + mwList.Count = mwStruct.ProfileCount; + List mwisList = new List(); + foreach (SimMwisStruct mwisStruct in mwStruct.MwList) + { + mwisList.Add(ConvertSimMwisStruct(mwisStruct)); + } + + mwList.List = mwisList; + return mwList; + } + + internal static SimCphsMw ConvertSimCphsMwStruct(SimCphsMwStruct cphsStruct) + { + SimCphsMw cphsMw = new SimCphsMw(); + if (cphsStruct.Voice1 == 1) + { + cphsMw.IsVoice1 = true; + } + + else + { + cphsMw.IsVoice1 = false; + } + + if (cphsStruct.Voice2 == 1) + { + cphsMw.IsVoice2 = true; + } + + else + { + cphsMw.IsVoice2 = false; + } + + if (cphsStruct.Fax == 1) + { + cphsMw.IsFax = true; + } + + else + { + cphsMw.IsFax = false; + } + + if (cphsStruct.Data == 1) + { + cphsMw.IsData = true; + } + + else + { + cphsMw.IsData = false; + } + + return cphsMw; + } + + internal static SimMessageWaitingResponse ConvertSimMessageWaitingRespStruct(SimMessageWaitingResponseStruct responseStruct) + { + SimMessageWaitingResponse waitingResp = new SimMessageWaitingResponse(); + if (responseStruct.IsCphs == 1) + { + waitingResp.IsCphsMw = true; + } + + else + { + waitingResp.IsCphsMw = false; + } + + waitingResp.List = ConvertSimMwisListStruct(responseStruct.MwList); + waitingResp.CphsMwInfo = ConvertSimCphsMwStruct(responseStruct.CphsMw); + return waitingResp; + } + + internal static SimMailboxNumber ConvertSimMailboxNumberStruct(SimMailboxNumberStruct mbStruct) + { + SimMailboxNumber mbNumber = new SimMailboxNumber(); + if (mbStruct.IsCphs == 1) + { + mbNumber.IsCphs = true; + } + + else if (mbStruct.IsCphs == 0) + { + mbNumber.IsCphs = false; + } + + mbNumber.RecIndex = mbStruct.RecIndex; + mbNumber.ProfileNumber = mbStruct.ProfileNum; + mbNumber.MbType = mbStruct.MbType; + mbNumber.AlphaMaxLength = mbStruct.AlphaMaxLen; + mbNumber.AlphaId = mbStruct.AlphaId; + mbNumber.Ton = mbStruct.Ton; + mbNumber.Npi = mbStruct.Npi; + mbNumber.Number = mbStruct.Number; + mbNumber.CcId = mbStruct.CcId; + mbNumber.Ext1Id = mbStruct.Ext1Id; + return mbNumber; + } + + internal static SimMailboxList ConvertSimMailboxListStruct(SimMailboxListStruct mbListStruct) + { + SimMailboxList mbList = new SimMailboxList(); + mbList.MbCount = mbListStruct.Count; + List mbNumList = new List(); + foreach (SimMailboxNumberStruct mbStruct in mbListStruct.List) + { + mbNumList.Add(ConvertSimMailboxNumberStruct(mbStruct)); + } + + mbList.MbList = mbNumList; + return mbList; + } + + internal static SimCphsServiceTable ConvertSimCphsServiceTableStruct(SimCphsServiceTableStruct svcStruct) + { + SimCphsServiceTable svcTable = new SimCphsServiceTable(); + svcTable.CustomerSvcProfile = svcStruct.CustomerServiceProfile; + svcTable.SvcStringTable = svcStruct.ServiceStringTable; + svcTable.MbNumbers = svcStruct.MailboxNumbers; + svcTable.OperatorNameShort = svcStruct.OperatorNameShortForm; + svcTable.InformationNum = svcStruct.InformationNumbers; + return svcTable; + } + + internal static SimCphsInfo ConvertSimCphsInfoStruct(SimCphsInfoStruct cphsStruct) + { + SimCphsInfo cphsInfo = new SimCphsInfo(); + cphsInfo.Phase = cphsStruct.CphsPhase; + cphsInfo.CphsSvcTable = ConvertSimCphsServiceTableStruct(cphsStruct.CphsServiceTable); + return cphsInfo; + } + + internal static SimCst ConvertSimCstStruct(SimCstStrct cstStruct) + { + SimCst cst = new SimCst(); + cst.CdmaSvc = cstStruct.CdmaSvcTable; + if (cstStruct.CdmaSvcTable == SimCdmaServiceTable.Cdma) + { + cst.Cdma = Encoding.ASCII.GetBytes(cstStruct.Cst.CdmaService); + } + + else if (cstStruct.CdmaSvcTable == SimCdmaServiceTable.Csim) + { + cst.Csim = Encoding.ASCII.GetBytes(cstStruct.Cst.CsimService); + } + + return cst; + } + + internal static SimServiceTable ConvertSimServiceTableStruct(SimServiceTableStruct svcTableStruct) + { + SimServiceTable svcTable = new SimServiceTable(); + svcTable.Type = svcTableStruct.SimType; + if (svcTableStruct.SimType == SimCardType.Gsm) + { + svcTable.Sst = Encoding.ASCII.GetBytes(svcTableStruct.Table.SimSstService); + } + + else if (svcTableStruct.SimType == SimCardType.Usim) + { + svcTable.Ust = Encoding.ASCII.GetBytes(svcTableStruct.Table.SimUstService); + } + + else if (svcTableStruct.SimType == SimCardType.Ruim) + { + svcTable.Cst = ConvertSimCstStruct(svcTableStruct.Table.Cst); + } + + return svcTable; + } + + internal static SimSubscriberInfo ConvertSimSubscriberInfoStruct(SimSubscriberInfoStruct infoStruct) + { + SimSubscriberInfo subscriber = new SimSubscriberInfo(); + subscriber.MsisdnNum = infoStruct.Number; + subscriber.MsisdnName = infoStruct.Name; + return subscriber; + } + + internal static SimMsisdnList ConvertSimMsisdnListStruct(SimMsisdnListStruct msisdnStruct) + { + SimMsisdnList list = new SimMsisdnList(); + list.MsisdnCount = msisdnStruct.Count; + List subsList = new List(); + foreach (SimSubscriberInfoStruct subsStruct in msisdnStruct.List) + { + subsList.Add(ConvertSimSubscriberInfoStruct(subsStruct)); + } + + list.SubscriberList = subsList; + return list; + } + + internal static SimOplmnwact ConvertSimOplmnwactStruct(SimOplmnwactStruct oplmnStruct) + { + SimOplmnwact oplmn = new SimOplmnwact(); + oplmn.PlmnString = oplmnStruct.Plmn; + if (oplmnStruct.IsUmts == 1) + { + oplmn.UmtsFlag = true; + } + + else if (oplmnStruct.IsUmts == 0) + { + oplmn.UmtsFlag = false; + } + + if (oplmnStruct.IsGsm == 1) + { + oplmn.GsmFlag = true; + } + + else if (oplmnStruct.IsGsm == 0) + { + oplmn.GsmFlag = false; + } + + return oplmn; + } + + internal static SimOplmnwactList ConvertSimOplmnwactListStruct(SimOplmnwactListStruct listStruct) + { + SimOplmnwactList oplmnList = new SimOplmnwactList(); + oplmnList.OplmnCount = listStruct.Count; + List wactList = new List(); + foreach (SimOplmnwactStruct wactStruct in listStruct.List) + { + wactList.Add(ConvertSimOplmnwactStruct(wactStruct)); + } + + oplmnList.OplmnList = wactList; + return oplmnList; + } + + internal static SimSpn ConvertSimSpnStruct(SimSpnStruct spnStruct) + { + SimSpn spn = new SimSpn(); + spn.Condition = spnStruct.DisplayCondition; + spn.SpName = spnStruct.Spn; + return spn; + } + + internal static SimCphsNetName ConvertSimCphsNetNameStruct(SimCphsNetNameStruct cphsStruct) + { + SimCphsNetName cphsName = new SimCphsNetName(); + cphsName.Full = cphsStruct.FullName; + cphsName.Short = cphsStruct.ShortName; + return cphsName; + } + + internal static SimAuthenticationResponse ConvertSimAuthenticationResponseStruct(SimAuthenticationResponseStruct respStruct) + { + SimAuthenticationResponse response = new SimAuthenticationResponse(); + response.Type = respStruct.AuthType; + response.Result = respStruct.AuthResult; + response.RespLength = respStruct.RespLength; + response.RespData = respStruct.RespData; + response.AuthKeyLen = respStruct.AuthKeyLength; + response.Key = respStruct.AuthKey; + response.CipherLen = respStruct.CipherLength; + response.Cipher = respStruct.CipherData; + response.IntegrityLen = respStruct.IntegrityLength; + response.Integrity = respStruct.IntegrityData; + return response; + } + + internal static SimPinResult ConvertSimPinResultStruct(SimPinResultStruct resultStruct) + { + SimPinResult pinResult = new SimPinResult(); + pinResult.PinType = resultStruct.Type; + pinResult.Retry = resultStruct.RetryCount; + return pinResult; + } + + internal static SimFacilityResult ConvertSimFacilityResultStruct(SimFacilityResultStruct resultStruct) + { + SimFacilityResult facilityResult = new SimFacilityResult(); + facilityResult.LockType = resultStruct.Type; + facilityResult.Count = resultStruct.RetryCount; + return facilityResult; + } + + internal static SimFacilityInfo ConvertSimFacilityInfoStruct(SimFacilityInfoStruct infoStruct) + { + SimFacilityInfo facilityInfo = new SimFacilityInfo(); + facilityInfo.LockType = infoStruct.Type; + facilityInfo.FacilityStatus = infoStruct.Status; + return facilityInfo; + } + + internal static SimLockInfo ConvertSimLockInfoStruct(SimLockInfoStruct infoStruct) + { + SimLockInfo lockInfo = new SimLockInfo(); + lockInfo.LockType = infoStruct.Type; + lockInfo.LockStatus = infoStruct.Status; + lockInfo.Count = infoStruct.RetryCount; + return lockInfo; + } + + internal static SimApduResponse ConvertSimApduResponseStruct(SimApduResponseStruct respStruct) + { + SimApduResponse response = new SimApduResponse(); + response.ApduLen = respStruct.RespLen; + response.ApduResp = respStruct.ApduResp; + return response; + } + + internal static SimAtrResponse ConvertSimAtrResponseStruct(SimAtrResponseStruct respStruct) + { + SimAtrResponse atrResp = new SimAtrResponse(); + atrResp.AtrRespLen = respStruct.AtrRespLen; + atrResp.AtrResp = respStruct.AtrResp; + return atrResp; + } + + internal static SimImpuList ConvertSimImpuListStruct(SimImpuListStruct listStruct) + { + SimImpuList impuList = new SimImpuList(); + impuList.DataCount = listStruct.Count; + IntPtr[] ptrList = new IntPtr[listStruct.Count]; + Marshal.Copy(listStruct.List, ptrList, 0, (int)listStruct.Count); + List list = new List(); + for (int i = 0; i < listStruct.Count; i++) + { + list.Add(Marshal.PtrToStringAnsi(ptrList[i])); + } + + impuList.ImpuList = list; + return impuList; + } + + internal static SimPcscf ConvertSimPcscfStruct(SimPcscfStruct pcscfStruct) + { + SimPcscf pcscf = new SimPcscf(); + pcscf.PcscfType = pcscfStruct.Type; + pcscf.PcscfData = pcscfStruct.Pcscf; + return pcscf; + } + + internal static SimPcscfList ConvertSimPcscfListStruct(SimPcscfListStruct listStruct) + { + SimPcscfList pcscfList = new SimPcscfList(); + pcscfList.DataCount = listStruct.Count; + IntPtr[] ptrList = new IntPtr[listStruct.Count]; + Marshal.Copy(listStruct.List, ptrList, 0, (int)listStruct.Count); + List list = new List(); + for (int i = 0; i < listStruct.Count; i++) + { + list.Add(ConvertSimPcscfStruct(Marshal.PtrToStructure(ptrList[i]))); + } + + pcscfList.PcscfList = list; + return pcscfList; + } + } + + internal static class SimClassConversions + { + internal static SimCallForwardRequestStruct ConvertSimCallForwardRequest(SimCallForwardRequest request) + { + SimCallForwardRequestStruct cfStruct = new SimCallForwardRequestStruct(); + if (request.IsCphs == true) + { + cfStruct.IsCphs = 1; + } + + else if (request.IsCphs == false) + { + cfStruct.IsCphs = 0; + } + + if (request.IsCphs == true) + { + cfStruct.CfData.CphsCf.Line1 = request.CphsCf.Line1; + cfStruct.CfData.CphsCf.Line2 = request.CphsCf.Line2; + cfStruct.CfData.CphsCf.Fax = request.CphsCf.Fax; + cfStruct.CfData.CphsCf.Data = request.CphsCf.Data; + } + + else + { + cfStruct.CfData.Cfis.RecIndex = request.Cfis.RecIndex; + cfStruct.CfData.Cfis.MspNum = request.Cfis.MspNum; + cfStruct.CfData.Cfis.CfuStatus = request.Cfis.CfuStatus; + cfStruct.CfData.Cfis.Ton = request.Cfis.Ton; + cfStruct.CfData.Cfis.Npi = request.Cfis.Npi; + cfStruct.CfData.Cfis.CfuNum = request.Cfis.CfuNum; + cfStruct.CfData.Cfis.Cc2Id = request.Cfis.Cc2Id; + cfStruct.CfData.Cfis.Ext7Id = request.Cfis.Ext7Id; + } + + return cfStruct; + } + + internal static SimMwisStruct ConvertSimMwis(SimMwis mwis) + { + SimMwisStruct mwisStruct = new SimMwisStruct(); + mwisStruct.RecIndex = mwis.RecIndex; + mwisStruct.IndicatorStatus = mwis.IndicatorStatus; + mwisStruct.VoiceCount = mwis.VoiceCount; + mwisStruct.FaxCount = mwis.FaxCount; + mwisStruct.EmailCount = mwis.EmailCount; + mwisStruct.OtherCount = mwis.OtherCount; + mwisStruct.VideoCount = mwis.VideoCount; + return mwisStruct; + } + + internal static SimCphsMwStruct ConvertSimCphsMw(SimCphsMw cphsMw) + { + SimCphsMwStruct cphsStruct = new SimCphsMwStruct(); + if (cphsMw.IsVoice1 == true) + { + cphsStruct.Voice1 = 1; + } + + else + { + cphsStruct.Voice1 = 0; + } + + if (cphsMw.IsVoice2 == true) + { + cphsStruct.Voice2 = 1; + } + + else + { + cphsStruct.Voice2 = 0; + } + + if (cphsMw.IsFax == true) + { + cphsStruct.Fax = 1; + } + + else + { + cphsStruct.Fax = 0; + } + + if (cphsMw.IsData == true) + { + cphsStruct.Data = 1; + } + + else + { + cphsStruct.Data = 0; + } + + return cphsStruct; + } + + internal static SimMessageWaitingRequestStruct ConvertSimMessageWaitingRequest(SimMessageWaitingRequest request) + { + SimMessageWaitingRequestStruct requestStruct = new SimMessageWaitingRequestStruct(); + if (request.IsCphs == true) + { + requestStruct.IsCphs = 1; + } + + else + { + requestStruct.IsCphs = 0; + } + + if (request.IsCphs == true) + { + requestStruct.Mw.CphsMw = ConvertSimCphsMw(request.CphsMw); + } + + else + { + requestStruct.Mw.Mwis = ConvertSimMwis(request.Mwis); + } + + return requestStruct; + } + + internal static SimMailboxNumberStruct ConvertSimMailboxNumber(SimMailboxNumber mbNumber) + { + SimMailboxNumberStruct mbStruct = new SimMailboxNumberStruct(); + if (mbNumber.IsCphs) + { + mbStruct.IsCphs = 1; + } + + else + { + mbStruct.IsCphs = 0; + } + + mbStruct.RecIndex = mbNumber.RecIndex; + mbStruct.ProfileNum = mbNumber.ProfileNumber; + mbStruct.MbType = mbNumber.MbType; + mbStruct.AlphaMaxLen = mbNumber.AlphaMaxLength; + mbStruct.AlphaId = mbNumber.AlphaId; + mbStruct.Ton = mbNumber.Ton; + mbStruct.Npi = mbNumber.Npi; + mbStruct.Number = mbNumber.Number; + mbStruct.CcId = mbNumber.CcId; + mbStruct.Ext1Id = mbNumber.Ext1Id; + return mbStruct; + } + + internal static SimPinDataStruct ConvertSimPinData(SimPinData data) + { + SimPinDataStruct pinStruct = new SimPinDataStruct(); + pinStruct.Type = data.Type; + pinStruct.Pin = data.Pin; + pinStruct.PinLength = data.PinLength; + return pinStruct; + } + + internal static SimFacilityStruct ConvertSimFacility(SimFacility facility) + { + SimFacilityStruct facilityStruct = new SimFacilityStruct(); + facilityStruct.LockType = facility.LockType; + facilityStruct.Password = facility.Password; + facilityStruct.PasswordLength = facility.PasswordLength; + return facilityStruct; + } + + internal static SimApduStruct ConvertSimApdu(SimApdu apdu) + { + SimApduStruct apduStruct = new SimApduStruct(); + apduStruct.ApduLen = (ushort)apdu.Apdu.Length; + apduStruct.Apdu = Encoding.UTF8.GetString(apdu.Apdu); + return apduStruct; + } + + internal static SimAuthenticationDataStruct ConvertSimAuthenticationDataStruct(SimAuthenticationData authData) + { + SimAuthenticationDataStruct authStruct = new SimAuthenticationDataStruct(); + authStruct.AuthType = authData.AuthType; + authStruct.RandLength = authData.RandLength; + authStruct.AutnLength = authData.AutnLength; + authStruct.RandData = Encoding.UTF8.GetString(authData.RandData); + authStruct.AutnData = Encoding.UTF8.GetString(authData.AutnData); + return authStruct; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SmsData.cs b/src/Tizen.Tapi/Tizen.Tapi/SmsData.cs new file mode 100755 index 0000000..f17e09d --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SmsData.cs @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Text; +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines incoming SMS message notification data. + /// + public class SmsIncomingMessageNoti + { + internal string ScaVal; + internal int MsgLength; + internal string Data; + internal SmsNetType FormatType; + + internal SmsIncomingMessageNoti() + { + } + + /// + /// SCA. + /// + /// Sca value represented in string. + public string Sca + { + get + { + return ScaVal; + } + } + + /// + /// Message length. + /// + /// Length of incoming message. + public int MessageLength + { + get + { + return MsgLength; + } + } + + /// + /// Data. + /// + /// Data representing incoming message information. + public string SzData + { + get + { + return Data; + } + } + + /// + /// SMS format. + /// + /// Format of the incoming SMS. + public SmsNetType Format + { + get + { + return FormatType; + } + } + } + + /// + /// A class which defines incoming CB message notification data. + /// + public class SmsIncomingCbMessageNoti + { + internal SmsCbMsgType CbType; + internal short Len; + internal string Data; + + internal SmsIncomingCbMessageNoti() + { + } + + /// + /// Cell Broadcast message type. + /// + /// Type of cell broadcast message. + public SmsCbMsgType Type + { + get + { + return CbType; + } + } + + /// + /// Size of MsgData (which is the actual TPDU message). + /// + /// Length of message data. + public short Length + { + get + { + return Len; + } + } + + /// + /// Cell broadcast message data. + /// + /// Message data representing cell broadcast message. + public string SzMsgData + { + get + { + return Data; + } + } + } + + /// + /// A class which defines incoming ETWS message notification data. + /// + public class SmsIncomingEtwsMessageNoti + { + internal SmsEtwsMsgType EtwsType; + internal short Len; + internal string Data; + + internal SmsIncomingEtwsMessageNoti() + { + } + + /// + /// ETWS message type. + /// + /// Type of ETWS message. + public SmsEtwsMsgType Type + { + get + { + return EtwsType; + } + } + + /// + /// Size of MsgData (which is the actual TPDU message). + /// + /// Length of message data. + public short Length + { + get + { + return Len; + } + } + + /// + /// ETWS message data. + /// + /// Message data representing ETWS message. + public string SzMsgData + { + get + { + return Data; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SmsEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/SmsEnumerations.cs new file mode 100755 index 0000000..d79e30f --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SmsEnumerations.cs @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the type of sms network. + /// + public enum SmsNetType + { + /// + /// Network type is 3gpp. + /// + Net3GPP = 0x01, + /// + /// Network type is 3gpp2 (CDMA). + /// + Net3GPP2 = 0x02 + } + + /// + /// Enumeration for different CB message types. + /// + public enum SmsCbMsgType + { + /// + /// GSM Cell broadcast message. + /// + Gsm = 1, + /// + /// UMTSCell broadcast message. + /// + Umts, + /// + /// CDMA broadcast message. + /// + Cdma + } + + /// + /// Enumeration for different ETWS message types. + /// + public enum SmsEtwsMsgType + { + /// + /// Primary ETWS message. + /// + Primary = 0, + /// + /// GSM Secondary ETWS message. + /// + SecondaryGsm, + /// + /// UMTS Secondary ETWS message. + /// + SecondaryUmts, + /// + /// CDMA Seconday ETWS message. + /// + SecondaryCdma + } + + /// + /// Enumeration for memory status type. + /// + public enum SmsMemoryStatus + { + /// + /// PDA memory is available. + /// + PdaAvailable = 0x01, + /// + /// PDA memory is full. + /// + PdaFull = 0x02, + /// + /// Phone memory is available. + /// + PhoneAvailable = 0x03, + /// + /// Phone memory is full. + /// + PhoneFull = 0x04 + } + + /// + /// Enumeration for the sms ready status type. + /// + public enum SmsReadyStatus + { + /// + /// Non Ready Status. + /// + StatusNone = 0x00, + /// + /// SMS 3GPP Ready. + /// + Status3GPP = 0x01, + /// + /// SMS 3GPP2 Ready. + /// + Status3GPP2 = 0x02, + /// + /// SMS 3GPP and 3GPP2 Ready. + /// + Status3GPPAnd3GPP2 = 0x03 + } + + /// + /// Enumeration for sms status type. + /// + public enum SmsMessageStatus + { + /// + /// MT message, stored and read. + /// + Read, + /// + /// MT message, stored and unread. + /// + Unread, + /// + /// MO message, stored and sent. + /// + Sent, + /// + /// MO message, stored but not sent. + /// + Unsent, + /// + /// Delivered at destination. + /// + Delivered, + /// + /// Service centre forwarded message but is unable to confirm delivery. + /// + DeliveryUnconfirmed, + /// + /// Message has been replaced. + /// + MessageReplaced, + /// + /// Reserved for future use. + /// + Reserved + } + + /// + /// Enumeration for different response types that come in the sent status acknowledgement/notification after sending a message to the network. + /// + public enum SmsResponse + { + /// + /// Message sent successfully. + /// + Success, + /// + /// Message routing not available. + /// + NotAvailable, + /// + /// Invalid parameter present in TPDU + /// + InvalidParameter, + /// + /// Device failure. + /// + DeviceFail, + /// + /// Reserved Service. + /// + ServiceReserved, + /// + /// Invalid location. + /// + InvalidLocation, + /// + /// No SIM error. + /// + NoSim, + /// + /// SIM not ready error. + /// + SimNotReady, + /// + /// No response from network. + /// + NoNetworkResponse, + /// + /// Destination address restricted. + /// + DestinationAddressRestricted, + /// + /// Service center address restricted. + /// + SCAAddressRestricted, + /// + /// Resend an already done operation. + /// + ResendDone, + /// + /// SCA address not available. + /// + SCANotAvailable, + /// + /// Unassigned number. + /// + UnassignedNumber, + /// + /// Operator determined barring. + /// + OperatorBarring, + /// + /// Call barred. + /// + CallBarred, + /// + /// Message transfer rejected. + /// + MessageTransferRejected, + /// + /// Message capacity exceeded/memory full. + /// + MemoryCapacityExceeded, + /// + /// Destination number out of service. + /// + DestinationOutOfService, + /// + /// Unspecified subscriber. + /// + UnspecifiedSubscriber, + /// + /// Facility rejected. + /// + FacilityRejected, + /// + /// Unknown subscriber. + /// + UnknownSubscriber, + /// + /// Network out of order. + /// + NetworkOutOfOrder, + /// + /// Temporary failure. + /// + TemporaryFail, + /// + /// Congestion occured. + /// + Congestion, + /// + /// Resource unavilable. + /// + ResourceUnavailable, + /// + /// Facility not subscribed by the user. + /// + FacilityNotSubscribed, + /// + /// Facility not implemented. + /// + FacilityNotImplemented, + /// + /// Invalid reference value. + /// + InvalidReference, + /// + /// Invalid message. + /// + InvalidMessage, + /// + /// Invalid mandatory information. + /// + InvalidMandatoryInfo, + /// + /// Message type not implemented. + /// + MessageTypeNotImplemented, + /// + /// Message not compact protocol. + /// + MessageNotCompactProtocol, + /// + /// Information element not implemented. + /// + IENotImplemented, + /// + /// Protocol error. + /// + ProtocolError, + /// + /// Networking error. + /// + Interworking, + /// + /// Sms ME full. + /// + MeFull, + /// + /// Sms sim full. + /// + SimFull, + /// + /// Timeout error. + /// + Timeout + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SmsStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/SmsStructs.cs new file mode 100755 index 0000000..0b47e12 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SmsStructs.cs @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct SmsIncomingMsgNotiStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 20)] + internal string Sca; + internal int MsgLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + internal string SzData; + internal SmsNetType Format; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsIncomingCbMsgNotiStruct + { + internal SmsCbMsgType CbMsgType; + internal short Length; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1253)] + internal string SzMsgData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsIncomingEtwsMsgNotiStruct + { + internal SmsEtwsMsgType EtwsMsgType; + internal short Length; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1253)] + internal string SzMsgData; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsDataPackageStruct + { + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)] + internal string Sca; + internal int Length; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)] + internal string SzData; + internal SmsNetType Format; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsDataStruct + { + internal int Index; + internal SmsMessageStatus Status; + internal SmsDataPackageStruct Data; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsCbConfigStruct + { + internal int Net3gppType; + internal int CbEnabled; + internal byte MsgIdMaxCount; + internal int MsgIdRangeCount; + [MarshalAs(UnmanagedType.ByValArray, SizeConst=50, ArraySubType = UnmanagedType.LPStruct)] + internal SmsCbMsgStruct[] MsgIds; + } + + [StructLayout(LayoutKind.Explicit)] + internal struct SmsCbMsgStruct + { + [FieldOffset(0)] + internal SmsCbMsg3gppStruct Net3gpp; + [FieldOffset(0)] + internal SmsCbMsg3gpp2Struct Net3gpp2; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsCbMsg3gppStruct + { + internal ushort FromMsgId; + internal ushort ToMsgId; + internal byte Selected; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsCbMsg3gpp2Struct + { + internal ushort CbCategory; + internal ushort CbLanguage; + internal byte Selected; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsParamsStruct + { + internal byte RecordIndex; + internal byte RecordLength; + internal ulong AlphaIdLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=129)] + internal string AlphaId; + internal byte ParamIndicator; + internal SmsAddressStruct DestinationAddress; + internal SmsAddressStruct ServiceCenterAddress; + internal ushort TpProtocolId; + internal ushort TpDataCodingScheme; + internal ushort TpValidityPeriod; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SmsAddressStruct + { + internal uint DialNumLength; + internal SimTypeOfNumber Type; + internal SimNumberPlanIdentity Identity; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst=21)] + internal string DiallingNumber; + } + + internal static class SmsStructConversions + { + internal static SmsIncomingMessageNoti ConvertSmsIncomingStruct(SmsIncomingMsgNotiStruct msgStruct) + { + SmsIncomingMessageNoti msgNoti = new SmsIncomingMessageNoti(); + msgNoti.ScaVal = msgStruct.Sca; + msgNoti.MsgLength = msgStruct.MsgLength; + msgNoti.FormatType = msgStruct.Format; + msgNoti.Data = msgStruct.SzData; + return msgNoti; + } + + internal static SmsIncomingCbMessageNoti ConvertSmsIncomingCbStruct(SmsIncomingCbMsgNotiStruct msgStruct) + { + SmsIncomingCbMessageNoti msgNoti = new SmsIncomingCbMessageNoti(); + msgNoti.Len = msgStruct.Length; + msgNoti.CbType = msgStruct.CbMsgType; + msgNoti.Data = msgStruct.SzMsgData; + return msgNoti; + } + + internal static SmsIncomingEtwsMessageNoti ConvertSmsIncomingEtwsStruct(SmsIncomingEtwsMsgNotiStruct msgStruct) + { + SmsIncomingEtwsMessageNoti msgNoti = new SmsIncomingEtwsMessageNoti(); + msgNoti.Len = msgStruct.Length; + msgNoti.EtwsType = msgStruct.EtwsMsgType; + msgNoti.Data = msgStruct.SzMsgData; + return msgNoti; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/Ss.cs b/src/Tizen.Tapi/Tizen.Tapi/Ss.cs new file mode 100755 index 0000000..4d33974 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/Ss.cs @@ -0,0 +1,534 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Threading.Tasks; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which manages Supplementary Services of the SIM. + /// + public class Ss + { + private IntPtr _handle = IntPtr.Zero; + private Dictionary _callbackMap = new Dictionary(); + private int _requestId = 0; + private Ss() + { + } + + /// + /// A constructor to instantiate Ss class using the Tapi handle. + /// + /// An instance of TapiHandle obtained from InitTapi in TapiManager API. + /// Thrown when handle is passed as null. + public Ss(TapiHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException("Handle is null"); + } + + _handle = handle._handle; + } + + /// + /// Sends a request to activate/deactivate call barring. + /// + /// The information about call barring. + /// A task containing an instance of SsBarringResponse which contains information about barring response. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when barring info is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsSetBarring(SsBarringInfo info) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs during setting SS barring info: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs during setting SS barring info, " + (SsCause)result)); + return; + } + + SsBarringResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertBarringRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (info == null) + { + throw new ArgumentNullException("Ss barring info is null"); + } + + SsBarringInfoStruct infoStruct = SsClassConversions.ConvertSsBarringInfo(info); + int ret = Interop.Tapi.Ss.SsSetBarring(_handle, ref infoStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set barring info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets call barring status. + /// + /// The type of call. + /// The barring type. + /// A task containing information about barring response. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsGetBarringStatus(SsClass ssClass, SsBarringType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting barring status: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in getting barring status, " + (SsCause)result)); + return; + } + + SsBarringResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertBarringRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Ss.SsGetBarringStatus(_handle, ssClass, type, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get barring status, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Allows changing of the barring password in the network. + /// + /// The old password set for Barring in the Network. + /// The new password set for Barring in the Network. + /// The new password again. + /// A task indicating whether the change of password is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when any of the parameter is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsChangeBarringPassword(string oldPassword, string newPassword, string newPasswordAgain) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in changing barring password: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in changing barring password, " + (SsCause)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (oldPassword == null || newPassword == null || newPasswordAgain == null) + { + throw new ArgumentNullException("Old password/new password is null"); + } + + int ret = Interop.Tapi.Ss.SsChangeBarringPassword(_handle, oldPassword, newPassword, newPasswordAgain, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to change barring password, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Allows to set the (register/erase/activate/deactivate) call forwarding option at the network. + /// + /// The Call forward information such as a forward mode, a forward type, and so on. + /// A task containing information about SS forward response. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when forward info is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsSetForwardInfo(SsForwardInfo info) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting SS forward info: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in setting SS forward info, " + (SsCause)result)); + return; + } + + SsForwardResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertForwardRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (info == null) + { + throw new ArgumentNullException("Ss forward info is null"); + } + + SsForwardInfoStruct infoStruct = SsClassConversions.ConvertSsForwardInfo(info); + int ret = Interop.Tapi.Ss.SsSetForward(_handle, ref infoStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set forward info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Provides an option to get the call forwarding status of different calls from the Network. + /// + /// The Forward call type. + /// The forward condition. + /// A task containing SS forward response information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsGetForwardStatus(SsClass ssClass, SsForwardCondition condition) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SS forward status: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in getting SS forward status, " + (SsCause)result)); + return; + } + + SsForwardResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertForwardRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Ss.SsGetForwardStatus(_handle, ssClass, condition, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get forward status, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Activates/deactivates the call waiting service. + /// + /// The status of call-waiting service. + /// A task containing SS waiting response information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when waiting info is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsSetWaitingInfo(SsWaitingInfo info) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting SS waiting info: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in setting SS waiting info, " + (SsCause)result)); + return; + } + + SsWaitingResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertWaitingRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (info == null) + { + throw new ArgumentNullException("Ss waiting info is null"); + } + + SsWaitingInfoStruct infoStruct = SsClassConversions.ConvertSsWaitingInfo(info); + int ret = Interop.Tapi.Ss.SsSetWaiting(_handle, ref infoStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set waiting info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets the status of the call waiting service. + /// + /// The call types. + /// A task containing information about SS waiting response. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsGetWaitingInfo(SsClass ssClass) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SS waiting info: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in getting SS waiting info, " + (SsCause)result)); + return; + } + + SsWaitingResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertWaitingRspStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Ss.SsGetWaitingStatus(_handle, ssClass, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get waiting info, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Activates/deactivates the status of the calling line identity service. + /// + /// The Cli service type. + /// The Cli Status. + /// A task indicating whether setting of CLI status is done or not. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsSetCliStatus(SsCliType type, SsCliStatus status) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in setting SS CLI status: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in setting SS CLI status, " + (SsCause)result)); + return; + } + + task.SetResult(true); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Ss.SsSetCliStatus(_handle, type, status, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to set SS CLI status, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + + /// + /// Gets the status of the calling line identity service. + /// + /// The Cli service type. + /// A task containing SS CLI response information. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsGetCliStatus(SsCliType type) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in getting SS CLI status: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in getting SS CLI status, " + (SsCause)result)); + return; + } + + SsCliResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertSsCliResponseStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + int ret = Interop.Tapi.Ss.SsGetCliStatus(_handle, type, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get CLI status, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return task.Task; + } + + /// + /// Sends a USSD string or User response to the Network. + /// + /// The data coding scheme used + /// A task containing SS USSD response information. + /// http://tizen.org/feature/network.telephony + /// platform + /// http://tizen.org/privilege/telephony.admin + /// Thrown when telephony feature is not supported. + /// Thrown when privilege access is denied. + /// Thrown when Ussd message info is passed as null. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public Task SsSendUssdRequest(SsUssdMsgInfo info) + { + TaskCompletionSource task = new TaskCompletionSource(); + IntPtr id = (IntPtr)_requestId++; + _callbackMap[id] = (handle, result, data, key) => + { + Task taskResult = new Task(() => + { + if (result != (int)SsCause.Success) + { + Log.Error(TapiUtility.LogTag, "Error occurs in sending USSD request: " + (SsCause)result); + task.SetException(new InvalidOperationException("Error occurs in sending USSD request, " + (SsCause)result)); + return; + } + + SsUssdResponseStruct response = Marshal.PtrToStructure(data); + task.SetResult(SsStructConversions.ConvertSsUssdResponseStruct(response)); + }); + taskResult.Start(); + taskResult.Wait(); + _callbackMap.Remove(key); + }; + + if (info == null) + { + throw new ArgumentNullException("Ussd message info is null"); + } + + SsUssdMsgInfoStruct msgStruct = SsClassConversions.ConvertSsUssdMsgInfo(info); + int ret = Interop.Tapi.Ss.SsSendUssdRequest(_handle, ref msgStruct, _callbackMap[id], id); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to send USSD request, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony.admin"); + } + + return task.Task; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SsData.cs b/src/Tizen.Tapi/Tizen.Tapi/SsData.cs new file mode 100755 index 0000000..9901405 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SsData.cs @@ -0,0 +1,784 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; + +namespace Tizen.Tapi +{ + /// + /// A class which defines values for USSD request type. Applicable to 3GPP(GSM/UMTS/LET) only. + /// + public class SsUssdMsgInfo + { + private SsUssdType _type; + private byte _dcs; + private int _length; + private string _ussdString; + + /// + /// USSD type. + /// + /// Type of USSD represented in SsUssdType enum. + public SsUssdType Type + { + get + { + return _type; + } + + set + { + _type = value; + } + } + + /// + /// DCS. + /// + /// Dcs value represented in byte. + public byte Dcs + { + get + { + return _dcs; + } + + set + { + _dcs = value; + } + } + + /// + /// USSD string length. + /// + /// Length of USSD string in integer. + public int Length + { + get + { + return _length; + } + + set + { + _length = value; + } + } + + /// + /// USSD string. + /// + /// Ussd string represented in string. + public string UssdString + { + get + { + return _ussdString; + } + + set + { + _ussdString = value; + } + } + } + + /// + /// A class which defines release complete message notification type. + /// + public class SsReleaseCompleteMsgInfo + { + internal byte Length; + internal byte[] Msg; + + internal SsReleaseCompleteMsgInfo() + { + } + + /// + /// Specifies the Release complete messageg length. + /// + /// Length of release complete message in byte. + public byte MsgLength + { + get + { + return Length; + } + } + + /// + /// Specifies the release complete message. + /// + /// Release complete message represented in byte array. + public byte[] Message + { + get + { + return Msg; + } + } + } + + /// + /// A class which defines SS forward record information. + /// + public class SsForwardRecord + { + internal SsClass SsClass; + internal SsStatus SsStatus; + internal SsForwardCondition Condition; + internal bool IsNumPresent; + internal SsNoReplyTime NoReply; + internal SsForwardTypeOfNumber Type; + internal SsForwardNumberingPlanIdentity NumIdPlan; + internal string ForwardNum; + + internal SsForwardRecord() + { + } + + /// + /// SS class + /// + /// SS class type. + public SsClass Class + { + get + { + return SsClass; + } + } + + /// + /// Call forwarding SS status. + /// + /// Status of SS call forwarding. + public SsStatus Status + { + get + { + return SsStatus; + } + } + + /// + /// Call forward types providing various conditions when a call can be forwarded. + /// + /// Forwarding condition of SS call forward. + public SsForwardCondition ForwardCondition + { + get + { + return Condition; + } + } + + /// + /// Flag that indicates whether call forwarding number is present. + /// + /// Boolean value to check the presence of call forwarding number. + public bool IsForwardingNumberPresent + { + get + { + return IsNumPresent; + } + } + + /// + /// No reply time. + /// + /// Waiting time when there is no reply. + public SsNoReplyTime NoReplyTime + { + get + { + return NoReply; + } + } + + /// + /// Type of number. + /// + /// SS call forward type of number. + public SsForwardTypeOfNumber Ton + { + get + { + return Type; + } + } + + /// + /// Numbering Plan Identity. + /// + /// SS call forward numbering plan identity. + public SsForwardNumberingPlanIdentity Npi + { + get + { + return NumIdPlan; + } + } + + /// + /// Forwarded number. + /// + /// Call forwarding number. + public string ForwardingNumber + { + get + { + return ForwardNum; + } + } + } + + /// + /// A class which defines values for SS call forwarding record. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public class SsForwardResponse + { + internal int RecordNum; + internal IEnumerable RecordList; + + internal SsForwardResponse() + { + } + + /// + /// Record number. + /// + /// Record value represented in integer. + public int RecordNumber + { + get + { + return RecordNum; + } + } + + /// + /// Specifies the maximum of SS forward records. + /// + /// A list of instances of SsForwardRecord. + public IEnumerable Record + { + get + { + return RecordList; + } + } + } + + /// + /// A class which defines SS call barring record information. + /// + public class SsBarringRecord + { + internal SsClass SsClass; + internal SsStatus SsStatus; + internal SsBarringType SsType; + + internal SsBarringRecord() + { + } + + /// + /// SS class + /// + /// SS class type. + public SsClass Class + { + get + { + return SsClass; + } + } + + /// + /// SS status. + /// + /// Status of SS call barring. + public SsStatus Status + { + get + { + return SsStatus; + } + } + + /// + /// Call barring types providing various barring conditions on which calls are barred. + /// + /// Type of SS call barring. + public SsBarringType BarringType + { + get + { + return SsType; + } + } + } + + /// + /// A class which defines values for SS call barring record. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public class SsBarringResponse + { + internal int RecordNum; + internal IEnumerable RecordList; + + internal SsBarringResponse() + { + } + + /// + /// Record number. + /// + /// Record value represented in integer. + public int RecordNumber + { + get + { + return RecordNum; + } + } + + /// + /// Specifies the maximum of SS barring records. + /// + /// A list of instances of SsBarringRecord. + public IEnumerable Record + { + get + { + return RecordList; + } + } + } + + /// + /// A class which defines SS waiting record information. + /// + public class SsWaitingRecord + { + internal SsClass SsClass; + internal SsStatus SsStatus; + + internal SsWaitingRecord() + { + } + + /// + /// SS class + /// + /// SS class type. + public SsClass Class + { + get + { + return SsClass; + } + } + + /// + /// SS status. + /// + /// Status of SS call waiting. + public SsStatus Status + { + get + { + return SsStatus; + } + } + } + + /// + /// A class which defines values for SS call waiting record. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public class SsWaitingResponse + { + internal int RecordNum; + internal IEnumerable RecordList; + + internal SsWaitingResponse() + { + } + + /// + /// Record number. + /// + /// Record value represented in integer. + public int RecordNumber + { + get + { + return RecordNum; + } + } + + /// + /// Specifies the maximum of SS waiting records. + /// + /// A list of instances of SsWaitingRecord. + public IEnumerable Record + { + get + { + return RecordList; + } + } + } + + /// + /// A class which defines SUPS information message notification type. + /// + public class SsInfo + { + internal SsCause Cse; + internal SsInfoType Type; + + internal SsInfo() + { + } + + /// + /// SS error cause. + /// + /// Ss request result. + public SsCause Cause + { + get + { + return Cse; + } + } + + /// + /// SUPS information. + /// + /// Ss information type. + public SsInfoType SsType + { + get + { + return Type; + } + } + } + + /// + /// A class which defines parameters related to call barring. + /// + public class SsBarringInfo + { + private SsClass _class; + private SsBarringMode _mode; + private SsBarringType _type; + private string _password; + private SsBarringInfo() + { + } + + /// + /// A constructor for instantiating SsBarringInfo class with the necessary parameters. + /// + /// Call type. + /// Barring mode. + /// Barring type. + /// Password (3GPP(GSM/UMTS/LTE) Specific). + public SsBarringInfo(SsClass classType, SsBarringMode mode, SsBarringType type, string password) + { + _class = classType; + _mode = mode; + _type = type; + _password = password; + } + + internal SsClass Class + { + get + { + return _class; + } + } + + internal SsBarringMode Mode + { + get + { + return _mode; + } + } + + internal SsBarringType Type + { + get + { + return _type; + } + } + + internal string Password + { + get + { + return _password; + } + } + } + + /// + /// A class which defines the parameters related to forward info. + /// + public class SsForwardInfo + { + private SsClass _class; + private SsForwardMode _mode; + private SsForwardCondition _condition; + private SsNoReplyTime _noReplyTimer; + private SsForwardTypeOfNumber _ton; + private SsForwardNumberingPlanIdentity _npi; + private string _phoneNumber; + private SsForwardInfo() + { + } + + /// + /// A constructor for instantiating SsForwardInfo class with the necessary parameters. + /// + /// SS Class. + /// Forward Mode. + /// Forward Condition. + /// No reply wait time 5-30 secs in intervals of 5(3GPP(GSM/UMTS/LTE) Specific). + /// Type of number. + /// Numbering plan identity. + /// Phone number. + public SsForwardInfo(SsClass classType, SsForwardMode mode, SsForwardCondition condition, SsNoReplyTime time, SsForwardTypeOfNumber ton, SsForwardNumberingPlanIdentity npi, string number) + { + _class = classType; + _mode = mode; + _condition = condition; + _noReplyTimer = time; + _ton = ton; + _npi = npi; + _phoneNumber = number; + } + + internal SsClass Class + { + get + { + return _class; + } + } + + internal SsForwardMode Mode + { + get + { + return _mode; + } + } + + internal SsForwardCondition Condition + { + get + { + return _condition; + } + } + + internal SsNoReplyTime NoReplyTimer + { + get + { + return _noReplyTimer; + } + } + + internal SsForwardTypeOfNumber Ton + { + get + { + return _ton; + } + } + + internal SsForwardNumberingPlanIdentity Npi + { + get + { + return _npi; + } + } + + internal string PhoneNumber + { + get + { + return _phoneNumber; + } + } + } + + /// + /// A class which defines parameters related to call waiting. + /// + public class SsWaitingInfo + { + private SsClass _class; + private SsCallWaitingMode _mode; + private SsWaitingInfo() + { + } + + /// + /// A constructor for instantiating SsWaitingInfo class with necessary parameters. + /// + /// Call type. + /// Call waiting mode. + public SsWaitingInfo(SsClass ssClass, SsCallWaitingMode mode) + { + _class = ssClass; + _mode = mode; + } + + internal SsClass Class + { + get + { + return _class; + } + } + + internal SsCallWaitingMode Mode + { + get + { + return _mode; + } + } + } + + /// + /// A class which defines values for calling line identity service. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public class SsCliResponse + { + internal SsLineIdentificationType LineType; + internal SsCliStatus CliStatus; + internal SsCliResponse() + { + } + + /// + /// Various line identification types. + /// + public SsLineIdentificationType Type + { + get + { + return LineType; + } + } + + /// + /// Line identification status from the network. + /// + public SsCliStatus Status + { + get + { + return CliStatus; + } + } + } + + /// + /// A class which defines USSD response data. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public class SsUssdResponse + { + internal SsUssdType UssdType; + internal SsUssdStatus UssdStatus; + internal byte DcsInfo; + internal int UssdLength; + internal string UssdInfo; + internal SsUssdResponse() + { + } + + /// + /// USSD Type. + /// + public SsUssdType Type + { + get + { + return UssdType; + } + } + + /// + /// USSD Status. + /// + public SsUssdStatus Status + { + get + { + return UssdStatus; + } + } + + /// + /// DCS. + /// + public byte Dcs + { + get + { + return DcsInfo; + } + } + + /// + /// USSD string length. + /// + public int Length + { + get + { + return UssdLength; + } + } + + /// + /// USSD String. + /// + public string UssdString + { + get + { + return UssdInfo; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SsEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/SsEnumerations.cs new file mode 100755 index 0000000..9d9e4ac --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SsEnumerations.cs @@ -0,0 +1,836 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumeration for the SS class type. + /// + public enum SsClass + { + /// + /// All Teleservices. + /// + AllTele = 0x10, + /// + /// Voice (Telephony). + /// + Voice = 0x11, + /// + /// All Data Teleservices. + /// + AllDataTele = 0x12, + /// + /// Fax Service. + /// + Fax = 0x13, + /// + /// SMS Service. + /// + Sms = 0x16, + /// + /// Voice Group Call Service. + /// + Vgcs = 0x17, + /// + /// Voice Broadcast. + /// + Vbs = 0x18, + /// + /// All teleservices except SMS. + /// + AllTeleExceptSms = 0x19, + /// + /// All Bearer services. + /// + AllBearer = 0x20, + /// + /// All Async services. + /// + AllAsync = 0x21, + /// + /// All Sync services. + /// + AllSync = 0x22, + /// + /// All Circuit switched sync services. + /// + AllCsSync = 0x24, + /// + /// All Circuit switched async services. + /// + AllCsAsync = 0x25, + /// + /// All Dedicated Packet Access. + /// + AllDedicatedPacketAccess = 0x26, + /// + /// All Dedicated PAD Access. + /// + AllDedicatedPadAccess = 0x27, + /// + /// All Data CDA. + /// + AllDataCda = 0x28, + /// + /// All PLMN specific teleservices. + /// + PlmnTeleAll = 0x50, + /// + /// PLMN specific teleservice 1. + /// + PlmnTele1 = 0x51, + /// + /// PLMN specific teleservice 2. + /// + PlmnTele2 = 0x52, + /// + /// PLMN specific teleservice 3. + /// + PlmnTele3 = 0x53, + /// + /// PLMN specific teleservice 4. + /// + PlmnTele4 = 0x54, + /// + /// PLMN specific teleservice 5. + /// + PlmnTele5 = 0x55, + /// + /// PLMN specific teleservice 6. + /// + PlmnTele6 = 0x56, + /// + /// PLMN specific teleservice 7. + /// + PlmnTele7 = 0x57, + /// + /// PLMN specific teleservice 8. + /// + PlmnTele8 = 0x58, + /// + /// PLMN specific teleservice 9. + /// + PlmnTele9 = 0x59, + /// + /// PLMN specific teleservice 10. + /// + PlmnTeleA = 0x60, + /// + /// PLMN specific teleservice 11. + /// + PlmnTeleB = 0x61, + /// + /// PLMN specific teleservice 12. + /// + PlmnTeleC = 0x62, + /// + /// PLMN specific teleservice 13. + /// + PlmnTeleD = 0x63, + /// + /// PLMN specific teleservice 14. + /// + PlmnTeleE = 0x64, + /// + /// PLMN specific teleservice 15. + /// + PlmnTeleF = 0x65, + /// + /// All PLMN specific bearer services. + /// + PlmnBearAll = 0x70, + /// + /// PLMN specific bearer service 1. + /// + PlmnBear1 = 0x71, + /// + /// PLMN specific bearer service 2. + /// + PlmnBear2 = 0x72, + /// + /// PLMN specific bearer service 3. + /// + PlmnBear3 = 0x73, + /// + /// PLMN specific bearer service 4. + /// + PlmnBear4 = 0x74, + /// + /// PLMN specific bearer service 5. + /// + PlmnBear5 = 0x75, + /// + /// PLMN specific bearer service 6. + /// + PlmnBear6 = 0x76, + /// + /// PLMN specific bearer service 7. + /// + PlmnBear7 = 0x77, + /// + /// PLMN specific bearer service 8. + /// + PlmnBear8 = 0x78, + /// + /// PLMN specific bearer service 9. + /// + PlmnBear9 = 0x79, + /// + /// PLMN specific bearer service 10. + /// + PlmnBearA = 0x80, + /// + /// PLMN specific bearer service 11. + /// + PlmnBearB = 0x81, + /// + /// PLMN specific bearer service 12. + /// + PlmnBearC = 0x82, + /// + /// PLMN specific bearer service 13. + /// + PlmnBearD = 0x83, + /// + /// PLMN specific bearer service 14. + /// + PlmnBearE = 0x84, + /// + /// PLMN specific bearer service 15. + /// + PlmnBearF = 0x85, + /// + /// Auxiliary Voice (Auxiliary telephony). + /// + AuxVoice = 0x89, + /// + /// All GPRS bearer services. + /// + AllGprsBearer = 0x99, + /// + /// All tele and bearer services. + /// + AllTeleBearer = 0xFF + } + + /// + /// Enumeration for various types of call barring. + /// + public enum SsBarringType + { + /// + /// Barring All Outgoing Calls. + /// + Baoc = 0x01, + /// + /// Barring Outgoing International Calls. + /// + Boic, + /// + /// Barring Outgoing International Calls except Home Country. + /// + BoicNotHc, + /// + /// Barring All Incoming Calls. + /// + Baic, + /// + /// Barring Incoming Calls when roaming outside the Home Country. + /// + BicRoam, + /// + /// All Barring Services. + /// + Ab, + /// + /// All Outgoing Barring Services. + /// + Aob, + /// + /// All Incoming Barring Services. + /// + Aib, + /// + /// Barring Incoming Calls which is not stored in the SIM memory. + /// + BicNotSim, + /// + /// Maximum Barring type. + /// + Max + } + + /// + /// Enumeration for the CLI service type. + /// + public enum SsCliType + { + /// + /// Calling Line Identification Presentation. + /// + Clip = 0x01, + /// + /// Calling Line Identification Restriction. + /// + Clir = 0x02, + /// + /// Connected Line Identification Presentation. 3GPP(GSM/UMTS/LTE) Specific. + /// + Colp = 0x03, + /// + /// Connected Line Identification Restriction. 3GPP(GSM/UMTS/LTE) Specific. + /// + Colr = 0x04, + /// + /// Called Line Identification Presentation. 3GPP(GSM/UMTS/LTE) Specific. + /// + Cdip = 0x05, + /// + /// Calling Name Presentation. 3GPP(GSM/UMTS/LTE) Specific. + /// + Cnap = 0x06 + } + + /// + /// Enumeration for the CLI service status. + /// + public enum SsCliStatus + { + /// + /// Service not provided by the service provider. + /// + NotProvisioned = 0x01, + /// + /// Service is provided by the service provider. + /// + Provisioned, + /// + /// Service is activated at the network. + /// + Activated, + /// + /// Service status is unknown. + /// + Unknown, + /// + /// Service is temporarily restricted. + /// + TempRestricted, + /// + /// Service is temporarily allowed. + /// + TempAllowed + } + + /// + /// Enumeration for the call forwarding condition. + /// + public enum SsForwardCondition + { + /// + /// Call Forwarding Unconditional. + /// + Unconditional = 0x01, + /// + /// Call Forwarding Mobile Busy. + /// + MobileBusy, + /// + /// Call Forwarding No Reply. + /// + NoReply, + /// + /// Call Forwarding Not Reachable. + /// + NotReachable, + /// + /// All Call Forwarding. + /// + All, + /// + /// All Conditional Call Forwarding. + /// + AllConditional, + /// + /// Max. + /// + Max + } + + /// + /// Enumeration for the USSD type. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public enum SsUssdType + { + /// + /// USSD request type - User Initiated. + /// + UserInit = 0x01, + /// + /// USSD request type - User Response. + /// + UserResponse, + /// + /// USSD request type - User Release. + /// + UserRelease + } + + /// + /// Enumeration for the status of a supplementary service feature (e.g. call forwarding or call barring). + /// + /// + /// These enumerated values should be used as masks. + /// + public enum SsStatus + { + /// + /// Provisioned & registered (but not active/active-quiescent). + /// + Registered = 0x01, + /// + /// Provisioned but not registered (or active/active-quiescent). + /// + Provisioned, + /// + /// Provisioned & registered & active. + /// + Active, + /// + /// Provisioned & registered & active but quiescent. + /// + Quiescent, + /// + /// Not provisioned. + /// + Nothing + } + + /// + /// Enumeration for no-reply time. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public enum SsNoReplyTime + { + /// + /// Timer value set to 5secs. + /// + Time5Secs = 5, + /// + /// Timer value set to 10secs. + /// + Time10Secs = 10, + /// + /// Timer value set to 15secs. + /// + Time15Secs = 15, + /// + /// Timer value set to 20secs. + /// + Time20Secs = 20, + /// + /// Timer value set to 25secs. + /// + Time25Secs = 25, + /// + /// Timer value set to 30secs. + /// + Time30Secs = 30 + } + + /// + /// Enumeration for the call forwarding type of number. + /// + public enum SsForwardTypeOfNumber + { + /// + /// Unknown. + /// + Unknown = 0, + /// + /// International number. + /// + International = 1, + /// + /// National number. + /// + National = 2, + /// + /// Network specific number. + /// + NetworkSpecific = 3, + /// + /// Subscriber number. + /// + DedicatedAccess = 4, + /// + /// Alphanumeric, GSM 7-bit default alphabet. + /// + AlphaNumeric = 5, + /// + /// Abbreviated number. + /// + AbbreviatedNumber = 6, + /// + /// Reserved for extension. + /// + ReservedForExt = 7 + } + + /// + /// Enumeration for the call forward numbering plan identity. + /// + public enum SsForwardNumberingPlanIdentity + { + /// + /// Unknown. + /// + Unknown = 0, + /// + /// ISDN/Telephone numbering plan. + /// + IsdnTel = 1, + /// + /// Data numbering plan. + /// + DataNumPlan = 3, + /// + /// Telex numbering plan. + /// + Telex = 4, + /// + /// Service Center Specific plan. + /// + ServiceCenterSpecificPlan = 5, + /// + /// Service Center Specific plan2. + /// + ServiceCenterSpecificPlan2 = 6, + /// + /// National numbering plan. + /// + National = 8, + /// + /// Private numbering plan. + /// + Private = 9, + /// + /// ERMES numbering plan. + /// + ErmesNumPlan = 10, + /// + /// Reserved for extension. + /// + ReservedForExt = 0xF + } + + /// + /// Enumeration for the supplementary service request results. + /// + public enum SsCause + { + /// + /// SS operation is successful. + /// + Success = 0x0, + /// + /// SS error indicating unknown/illegal subscriber + /// + UnknownSubscriber = 0x01, + /// + /// This error is returned when illegality of the access has been established by use of an authentication procedure. + /// + IllegalSubscriber = 0x09, + /// + /// The network returns this error when it is requested to perform an operation on a supplementary service. + /// + BearerServiceNotProvisioned = 0x0a, + /// + /// The network returns this error when it is requested to perform an operation on a supplementary service. + /// + TeleServiceNotProvisioned = 0x0b, + /// + /// This error is returned when the IMEI check procedure has shown that the IMEI is blacklisted or it is not whitelisted. + /// + IllegalEquipment = 0x0c, + /// + /// This error is returned by the network to the MS when call independent subscriber control procedures are barred by the operator. + /// + CallBarred = 0x0d, + /// + /// This error is returned by the network when it is requested to perform an illegal operation which is defined as not applicable for the relevant supplementary service. + /// + IllegalSsOperation = 0x10, + /// + /// This error is returned by the network when it is requested to perform an operation which is not compatible with the current status of the relevant supplementary service. + /// + ErrorStatus = 0x11, + /// + /// SS not available in the network. + /// + Unavailable = 0x12, + /// + /// SS service subscription violation. + /// + SubscriptionViolation = 0x13, + /// + /// This error is returned by the network when it is requested for a supplementary service operation that is incompatible with the status of another supplementary service or with the teleservice or bearer service for which the operation is requested. + /// + Incompatibility = 0x14, + /// + /// SS service facility not supported. + /// + FacilityNotSupported = 0x15, + /// + /// This error is returned when the subscriber has activated the detach service or the system detects the absence condition. + /// + AbsentSubscriber = 0x1b, + /// + /// This error is returned by the network, when it cannot perform an operation because of a failure in the network. + /// + SystemFailure = 0x22, + /// + /// This error is returned by the network when an optional parameter is missing in an invoke component or an inner data structure, while it is required by the context of the request. + /// + DataMissing = 0x23, + /// + /// SS error indicating an unexpected data value on the network side. + /// + UnexpectedDataValue = 0x24, + /// + /// SS error indicating a change password failure. + /// + PasswordRegistrationFailure = 0x25, + /// + /// SS error indicating a negative password check. + /// + NegativePasswordCheck = 0x26, + /// + /// SS error indicating violation in barring password attempts. + /// + PasswordAttemptsViolation = 0x2b, + /// + /// SS error indicating unknown SS data coding of an alphabet. + /// + UnknownAlphabet = 0x47, + /// + /// SS error indicating USSD Busy(Already SS / USSD is ongoing). + /// + UssdBusy = 0x48, + /// + /// SS error indicating Dialing number is not FDN. + /// + FdnOnly = 0x5F, + /// + /// SS operation rejected by the user. + /// + RejectedByUser = 0x79, + /// + /// SS operation rejected by the network. + /// + RejectedByNetwork = 0x7a, + /// + /// This error is returned if a diversion to the served subscriber's number is requested. + /// + DeflectionToServedSubscriber = 0x7b, + /// + /// This error is returned if a diversion to a special service code is requested. + /// + SpecialServiceCode = 0x7c, + /// + /// SS error indicating invalid deflected to a number. + /// + InvalidDeflectedToNumber = 0x7d, + /// + /// SS error indicating Maximum MPTY is reached. + /// + MaxMptyExceeded = 0x7e, + /// + /// SS error indicating resources not available in the network. + /// + ResourceUnavailable = 0x7f, + /// + /// SS error indicating resources not available in the network. + /// + RejectedByCallControl = 0x80, + /// + /// SS operation timer expired on the network. + /// + TimerExpire, + /// + /// SS operation is not allowed by the network. + /// + NotAllowed, + /// + /// SS error indicating an unknown error. + /// + UnknownError, + /// + /// If OEM does not support any SS requests, then this error will be returned. + /// + OemNotSupported + } + + /// + /// Enumeration for SS info type. + /// + public enum SsInfoType + { + /// + /// Barring. + /// + Barring = 0x00, + /// + /// Forwarding. + /// + Forwarding, + /// + /// Waiting. + /// + Waiting, + /// + /// CLI. + /// + Cli, + /// + /// Send Ussd. + /// + SendUssd, + /// + /// Max value. + /// + Max + } + + /// + /// Enumeration for the call barring operation mode. + /// + public enum SsBarringMode + { + /// + /// Activate call barring. + /// + Activate, + /// + /// Deactivate call barring. + /// + Deactivate + } + + /// + /// Enumeration for the forward mode. + /// + public enum SsForwardMode + { + /// + /// Deactivate call forwarding. + /// + Disable, + /// + /// Activate call forwarding. + /// + Enable, + /// + /// Register call forwarding. + /// + Registration, + /// + /// Deregister call forwarding. + /// + Erasure + } + + /// + /// Enumeration for the call waiting mode. + /// + public enum SsCallWaitingMode + { + /// + /// Activate call waiting. + /// + Activate, + /// + /// Deactivate call waiting. + /// + Deactivate + } + + /// + /// Enumeration for the types of identity presentation / restriction services. + /// + public enum SsLineIdentificationType + { + /// + /// Identify the party calling this phone. + /// + CallingLinePresentation = 0x01, + /// + /// Hide the identity of this phone when calling others. + /// + CallingLineRestriction, + /// + /// Identify the party to whom the calling party (this phone) is connected. 3GPP(GSM/UMTS/LTE) Specific. + /// + ConnectedLinePresentation, + /// + /// Restrict yourself from being identified by incoming calls, such as forwarded calls. 3GPP(GSM/UMTS/LTE) Specific. + /// + ConnectedLineRestriction, + /// + /// Called line identity presentation. 3GPP(GSM/UMTS/LTE) Specific. + /// + CalledLinePresentation, + /// + /// Calling Name Presentation. 3GPP(GSM/UMTS/LTE) Specific. + /// + CallingNamePresentation + } + + /// + /// Enumeration for the USSD indication type. Applicable to 3GPP(GSM/UMTS/LTE) only. + /// + public enum SsUssdStatus + { + /// + /// Notify : to display USSD data to the user. + /// + Notify = 0x00, + /// + /// No further user action required. + /// + NoActionRequire = 0x01, + /// + /// Further user action required. + /// + ActionRequire = 0x02, + /// + /// USSD terminated by the network. + /// + TerminatedByNetwork = 0x03, + /// + /// Other local client has responded. + /// + OtherClient = 0x04, + /// + /// Operation not supported. + /// + NotSupport = 0x05, + /// + /// Time out when there is no response from the network. + /// + TimeOut = 0x06 + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/SsStructs.cs b/src/Tizen.Tapi/Tizen.Tapi/SsStructs.cs new file mode 100755 index 0000000..302a6b5 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/SsStructs.cs @@ -0,0 +1,312 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Text; + +namespace Tizen.Tapi +{ + [StructLayout(LayoutKind.Sequential)] + internal struct SsBarringInfoStruct + { + internal SsClass Class; + internal SsBarringMode Mode; + internal SsBarringType Type; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] + internal string Password; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsBarringRecordStruct + { + internal SsClass Class; + internal SsStatus Status; + internal SsBarringType Type; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsBarringResponseStruct + { + internal int RecordNum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.LPStruct)] + internal SsBarringRecordStruct[] Record; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsUssdMsgInfoStruct + { + internal SsUssdType Type; + internal byte Dcs; + internal int Length; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 208)] + internal string UssdString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsUssdResponseStruct + { + internal SsUssdType Type; + internal SsUssdStatus Status; + internal byte Dcs; + internal int Length; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 208)] + internal string UssdString; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsReleaseCompleteMsgStruct + { + internal byte MsgLength; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] + internal string Message; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsWaitingInfoStruct + { + internal SsClass Class; + internal SsCallWaitingMode Mode; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsWaitingRecordStruct + { + internal SsClass Class; + internal SsStatus Status; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsWaitingResponseStruct + { + internal int RecordNum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.LPStruct)] + internal SsWaitingRecordStruct[] Record; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsForwardInfoStruct + { + internal SsClass Class; + internal SsForwardMode Mode; + internal SsForwardCondition Condition; + internal SsNoReplyTime NoReplyTimer; + internal SsForwardTypeOfNumber Ton; + internal SsForwardNumberingPlanIdentity Npi; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 82)] + internal string PhoneNumber; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsForwardRecordStruct + { + internal SsClass Class; + internal SsStatus Status; + internal SsForwardCondition Condition; + internal int IsForwardingNumPresent; + internal SsNoReplyTime NoReplyTime; + internal SsForwardTypeOfNumber Ton; + internal SsForwardNumberingPlanIdentity Npi; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 83)] + internal string ForwardingNum; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsForwardResponseStruct + { + internal int RecordNum; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5, ArraySubType = UnmanagedType.LPStruct)] + internal SsForwardRecordStruct[] Record; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsInfoStruct + { + internal SsCause Cause; + internal SsInfoType Type; + } + + [StructLayout(LayoutKind.Sequential)] + internal struct SsCliResponseStruct + { + internal SsLineIdentificationType Type; + internal SsCliStatus Status; + } + + internal static class SsStructConversions + { + internal static SsForwardRecord ConvertSsForwardRecordStruct(SsForwardRecordStruct recordStruct) + { + SsForwardRecord record = new SsForwardRecord(); + record.SsClass = recordStruct.Class; + record.SsStatus = recordStruct.Status; + record.Condition = recordStruct.Condition; + if (recordStruct.IsForwardingNumPresent == 1) + { + record.IsNumPresent = true; + } + + else if (recordStruct.IsForwardingNumPresent == 0) + { + record.IsNumPresent = false; + } + + record.NoReply = recordStruct.NoReplyTime; + record.Type = recordStruct.Ton; + record.NumIdPlan = recordStruct.Npi; + record.ForwardNum = recordStruct.ForwardingNum; + return record; + } + + internal static SsUssdMsgInfo ConvertSsMsgStruct(SsUssdMsgInfoStruct msgStruct) + { + SsUssdMsgInfo info = new SsUssdMsgInfo(); + info.Length = msgStruct.Length; + info.Dcs = msgStruct.Dcs; + info.UssdString = msgStruct.UssdString; + info.Type = msgStruct.Type; + return info; + } + + internal static SsReleaseCompleteMsgInfo ConvertReleaseMsgStruct(SsReleaseCompleteMsgStruct msgStruct) + { + SsReleaseCompleteMsgInfo info = new SsReleaseCompleteMsgInfo(); + info.Length = msgStruct.MsgLength; + info.Msg = Encoding.ASCII.GetBytes(msgStruct.Message); + return info; + } + + internal static SsForwardResponse ConvertForwardRspStruct(SsForwardResponseStruct responseStruct) + { + SsForwardResponse info = new SsForwardResponse(); + List recordList = new List(); + foreach (SsForwardRecordStruct item in responseStruct.Record) + { + recordList.Add(ConvertSsForwardRecordStruct(item)); + } + + info.RecordNum = responseStruct.RecordNum; + info.RecordList = recordList; + return info; + } + + internal static SsBarringResponse ConvertBarringRspStruct(SsBarringResponseStruct responseStruct) + { + SsBarringResponse info = new SsBarringResponse(); + List barringList = new List(); + foreach (SsBarringRecordStruct item in responseStruct.Record) + { + SsBarringRecord record = new SsBarringRecord(); + record.SsClass = item.Class; + record.SsStatus = item.Status; + record.SsType = item.Type; + barringList.Add(record); + } + + info.RecordNum = responseStruct.RecordNum; + info.RecordList = barringList; + return info; + } + + internal static SsWaitingResponse ConvertWaitingRspStruct(SsWaitingResponseStruct responseStruct) + { + SsWaitingResponse info = new SsWaitingResponse(); + List waitingList = new List(); + foreach (SsWaitingRecordStruct item in responseStruct.Record) + { + SsWaitingRecord record = new SsWaitingRecord(); + record.SsClass = item.Class; + record.SsStatus = item.Status; + waitingList.Add(record); + } + + info.RecordNum = responseStruct.RecordNum; + info.RecordList = waitingList; + return info; + } + + internal static SsInfo ConvertInfoStruct(SsInfoStruct infoStruct) + { + SsInfo info = new SsInfo(); + info.Cse = infoStruct.Cause; + info.Type = infoStruct.Type; + return info; + } + + internal static SsCliResponse ConvertSsCliResponseStruct(SsCliResponseStruct responseStruct) + { + SsCliResponse response = new SsCliResponse(); + response.LineType = responseStruct.Type; + response.CliStatus = responseStruct.Status; + return response; + } + + internal static SsUssdResponse ConvertSsUssdResponseStruct(SsUssdResponseStruct responseStruct) + { + SsUssdResponse response = new SsUssdResponse(); + response.UssdType = responseStruct.Type; + response.UssdStatus = responseStruct.Status; + response.DcsInfo = responseStruct.Dcs; + response.UssdLength = responseStruct.Length; + response.UssdInfo = responseStruct.UssdString; + return response; + } + } + + internal static class SsClassConversions + { + internal static SsBarringInfoStruct ConvertSsBarringInfo(SsBarringInfo info) + { + SsBarringInfoStruct barringStruct = new SsBarringInfoStruct(); + barringStruct.Class = info.Class; + barringStruct.Mode = info.Mode; + barringStruct.Type = info.Type; + barringStruct.Password = info.Password; + return barringStruct; + } + + internal static SsForwardInfoStruct ConvertSsForwardInfo(SsForwardInfo info) + { + SsForwardInfoStruct forwardStruct = new SsForwardInfoStruct(); + forwardStruct.Class = info.Class; + forwardStruct.Mode = info.Mode; + forwardStruct.Condition = info.Condition; + forwardStruct.NoReplyTimer = info.NoReplyTimer; + forwardStruct.Ton = info.Ton; + forwardStruct.Npi = info.Npi; + forwardStruct.PhoneNumber = info.PhoneNumber; + return forwardStruct; + } + + internal static SsWaitingInfoStruct ConvertSsWaitingInfo(SsWaitingInfo info) + { + SsWaitingInfoStruct waitingStruct = new SsWaitingInfoStruct(); + waitingStruct.Class = info.Class; + waitingStruct.Mode = info.Mode; + return waitingStruct; + } + + internal static SsUssdMsgInfoStruct ConvertSsUssdMsgInfo(SsUssdMsgInfo info) + { + SsUssdMsgInfoStruct msgStruct = new SsUssdMsgInfoStruct(); + msgStruct.Type = info.Type; + msgStruct.Dcs = info.Dcs; + msgStruct.Length = info.Length; + msgStruct.UssdString = info.UssdString; + return msgStruct; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/TapiEnumerations.cs b/src/Tizen.Tapi/Tizen.Tapi/TapiEnumerations.cs new file mode 100755 index 0000000..f08e736 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/TapiEnumerations.cs @@ -0,0 +1,621 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Tapi +{ + /// + /// Enumerations for the types of Notification. + /// + public enum Notification + { + /// + /// Voice call idle status notification. + /// + /// Instance of CallIdleStatusNotificationData will be stored in Data property of NotificationChangedEventArgs. + IdleVoiceCall, + /// + /// Voice call active status notification. + /// + /// Active call Id will be stored in Data property of NotificationChangedEventArgs. + ActiveVoiceCall, + /// + /// Voice call held status notification. + /// + /// Held call Id will be stored in Data property of NotificationChangedEventArgs. + HeldVoiceCall, + /// + /// Voice call dialing status notification. + /// + /// Dialing call Id will be stored in Data property of NotificationChangedEventArgs. + DialingVoiceCall, + /// + /// Voice call alerting status notification. + /// + /// Alert call Id will be stored in Data property of NotificationChangedEventArgs. + AlertVoiceCall, + /// + /// Voice call incoming status notification. + /// + /// Instance of CallIncomingInfo will be stored in Data property of NotificationChangedEventArgs. + IncomingVoiceCall, + /// + /// Video call idle status notification. + /// + /// Instance of CallIdleStatusNotificationData will be stored in Data property of NotificationChangedEventArgs. + IdleVideoCall, + /// + /// Video call active status notification. + /// + /// Active call Id will be stored in Data property of NotificationChangedEventArgs. + ActiveVideoCall, + /// + /// Video call dialing status notification. + /// + /// Dialing call Id will be stored in Data property of NotificationChangedEventArgs. + DialingVideoCall, + /// + /// Video call alerting status notification. + /// + /// Alert call Id will be stored in Data property of NotificationChangedEventArgs. + AlertVideoCall, + /// + /// Video call incoming status notification. + /// + /// Instance of CallIncomingInfo will be stored in Data property of NotificationChangedEventArgs. + IncomingVideoCall, + /// + /// Outgoing call waiting nofificaiton. + /// + /// Waiting call Id will be stored in Data property of NotificationChangedEventArgs. + WaitingCallInfo, + /// + /// Outgoing call forwarded notification. + /// + /// Forward call Id will be stored in Data property of NotificationChangedEventArgs. + ForwardCallInfo, + /// + /// Incoming call barred notification. + /// + /// Barred incoming call Id will be stored in Data property of NotificationChangedEventArgs. + BarredIncomingCallInfo, + /// + /// Outgoing call barred notification. + /// + /// Barred outgoing call Id will be stored in Data property of NotificationChangedEventArgs. + BarredOutgoingCallInfo, + /// + /// Mo call deflected notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + DeflectCallInfo, + /// + /// CLIR suppression reject notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + ClirCallInfo, + /// + /// Unconditional call forward active notification. + /// + /// Unconditional forward call Id will be stored in Data property of NotificationChangedEventArgs. + ForwardUnconditionalCallInfo, + /// + /// Conditional call forward active notification. + /// + /// Conditional forward call Id will be stored in Data property of NotificationChangedEventArgs. + ForwardConditionalCallInfo, + /// + /// Incoming call forwarded notification. + /// + /// Forward call Id will be stored in Data property of NotificationChangedEventArgs. + ForwardedCallInfo, + /// + /// MT deflected call notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + DeflectedCallInfo, + /// + /// MT transferred call notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + TransferredCallInfo, + /// + /// Call is in held notification. + /// + /// Held call Id will be stored in Data property of NotificationChangedEventArgs. + HeldCallInfo, + /// + /// Call is in retrieved notificaiton. + /// + /// Active call Id will be stored in Data property of NotificationChangedEventArgs. + ActiveCallInfo, + /// + /// Call in in multiparty notificaiton. + /// + /// Joined call Id will be stored in Data property of NotificationChangedEventArgs. + JoinedCallInfo, + /// + /// Call transfer alerting notificaiton. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + TransferAlertCallInfo, + /// + /// Call forward check message notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + CfCheckMessageCallInfo, + /// + /// New call information notification (CDMA only). + /// + /// Instance of CallRecord will be stored in Data property of NotificationChangedEventArgs. + RecCallInfo, + /// + /// Call info fallback notification. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + FallbackCallInfo, + /// + /// Voice privacy mode change notification (CDMA only). + /// + /// CallPrivacyMode will be stored in Data property of NotificationChangedEventArgs. + PrivacyModeCall, + /// + /// OTASP(Over The Air Service Provisioning) status notification (CDMA only). + /// + /// CallOtaspStatus will be stored in Data property of NotificationChangedEventArgs. + OtaspCall, + /// + /// OTAPA(Over The Air Parameter Administration) status notification (CDMA only). + /// + /// CallOtapaStatus will be stored in Data property of NotificationChangedEventArgs. + OtapaCall, + /// + /// Call signal information notification (CDMA only). + /// + /// Instance of CallSignalNotification will be stored in Data property of NotificationChangedEventArgs. + CallSignalInfo, + /// + /// Call sound patch change notification. + /// + /// SoundPath will be stored in Data property of NotificationChangedEventArgs. + CallSoundPath, + /// + /// Call ringback tone sound patch change notification. + /// + /// CallSoundRingbackNoti will be stored in Data property of NotificationChangedEventArgs. + CallSoundRingbackTone, + /// + /// Call sound WB-AMR(Wide Band Adaptive Multi-Rate) status notification. + /// + /// CallSoundWbamrNoti will be stored in Data property of NotificationChangedEventArgs. + CallSoundWbamr, + /// + /// Call sound noise reduction notification. + /// + /// CallSoundNoiseReduction will be stored in Data property of NotificationChangedEventArgs. + CallSoundNoiceReduction, + /// + /// Call sound clock status notification. + /// + /// Boolean status value will be stored in Data property of NotificationChangedEventArgs. + CallSoundClock, + /// + /// Preferred voice subscription notification. + /// + /// CallPreferredVoiceSubscription will be stored in Data property of NotificationChangedEventArgs. + CallPreferredVoiceSubscription, + /// + /// VoLTE call which can provide upgrade/downgrade - caller/callee are all in VoLTE call. + /// + /// Nothing is stored in Data property of NotificationChangedEventArgs. + CallModifiableInfo, + /// + /// VoLTE call for which upgrade call request is initiated from MT. + /// + /// CallUpgradeDowngradeRequestNoti will be stored in Data property of NotificationChangedEventArgs. + CallupgradeRequested, + /// + /// VoLTE call for which downgrade call request is initiated from MT. + /// + /// CallUpgradeDowngradeRequestNoti will be stored in Data property of NotificationChangedEventArgs. + CallDowngraded, + /// + /// Modem power notification. + /// + /// PhonePowerStatus will be stored in Data property of NotificationChangedEventArgs. + ModemPower, + /// + /// SIM status notification. + /// + /// SimCardStatus will be stored in Data property of NotificationChangedEventArgs. + SimStatus, + /// + /// SIM refresh notification. + /// + /// SatCmdQualiRefresh will be stored in Data property of NotificationChangedEventArgs. + SimRefreshed, + /// + /// Sap card status notification. + /// + /// SatCmdQualiRefresh will be stored in Data property of NotificationChangedEventArgs. + SapStatus, + /// + /// Sap disconnect type notification. + /// + SapDisconnect, + /// + /// Sat setup menu notification. + /// + /// Instance of SatMainMenuInfo will be stored in Data property of NotificationChangedEventArgs. + SatSetupMenu, + /// + /// Sat display text notification. + /// + /// Instance of SatDisplayTextData will be stored in Data property of NotificationChangedEventArgs. + SatDisplayText, + /// + /// Sat select item notification. + /// + /// Instance of SatSelectItemData will be stored in Data property of NotificationChangedEventArgs. + SatSelectItem, + /// + /// Sat get inkey notification. + /// + /// Instance of SatGetInKeyData will be stored in Data property of NotificationChangedEventArgs. + SatGetInKey, + /// + /// Sat get input notification. + /// + /// Instance of SatGetInputData will be stored in Data property of NotificationChangedEventArgs. + SatGetInput, + /// + /// Sat refresh notification. + /// + /// Instance of SatRefreshData will be stored in Data property of NotificationChangedEventArgs. + SatRefresh, + /// + /// Sat send sms notification. + /// + /// Instance of SatSendSmsData will be stored in Data property of NotificationChangedEventArgs. + SatSendSms, + /// + /// Sat setup event list notification. + /// + /// Instance of SatEventListData will be stored in Data property of NotificationChangedEventArgs. + SatSetupEventList, + /// + /// Sat send dtmf notification. + /// + /// Instance of SatSendDtmfData will be stored in Data property of NotificationChangedEventArgs. + SatSendDtmf, + /// + /// Sat end proactive session notification. + /// + /// SatCommandType will be stored in Data property of NotificationChangedEventArgs. + SatEndProactiveSession, + /// + /// Sat call control result notification. + /// + /// Instance of SatCallCtrlConfirmData will be stored in Data property of NotificationChangedEventArgs. + SatCallControlResult, + /// + /// Sat mo sms control result notification. + /// + /// Instance of SatMoSmsCtrlData will be stored in Data property of NotificationChangedEventArgs. + SatMoSmControlResult, + /// + /// Sat setup call notification. + /// + /// Instance of SatSetupCallData will be stored in Data property of NotificationChangedEventArgs. + SatSetupCall, + /// + /// Sat send SS notification. + /// + /// Instance of SatSendSsData will be stored in Data property of NotificationChangedEventArgs. + SatSendSs, + /// + /// Sat setup USSD notification. + /// + /// Instance of SatSetupUssdData will be stored in Data property of NotificationChangedEventArgs. + SatSetupUssd, + /// + /// Phonebook status notification. + /// + /// Instance of SimPhonebookStatus will be stored in Data property of NotificationChangedEventArgs. + PhonebookStatus, + /// + /// Phonebook change notification. + /// + /// Instance of PhonebookContactChangeInfo will be stored in Data property of NotificationChangedEventArgs. + PhonebookContactChange, + /// + /// Network registration status notification. + /// + /// Instance of NetworkRegistrationStatus will be stored in Data property of NotificationChangedEventArgs. + NetworkRegistrationStatus, + /// + /// Network cell information notification. + /// + /// Instance of NetworkCellNoti will be stored in Data property of NotificationChangedEventArgs. + NetworkCellInfo, + /// + /// Network change notification. + /// + /// Instance of NetworkChangeNoti will be stored in Data property of NotificationChangedEventArgs. + NetworkChange, + /// + /// Network time information notification. + /// + /// Instance of NetworkTimeNoti will be stored in Data property of NotificationChangedEventArgs. + NetworkTimeInfo, + /// + /// Network identity notification. + /// + /// Instance of NetworkIdentityNoti will be stored in Data property of NotificationChangedEventArgs. + NetworkIdentity, + /// + /// Network signal strength notification. + /// + /// Signal Strength in dBm will be stored in Data property of NotificationChangedEventArgs. + NetworkSignalStrength, + /// + /// Network emergency callback mode notification. + /// + /// NetworkEmergencyCallbackMode will be stored in Data property of NotificationChangedEventArgs. + NetworkEmergencyCallbackMode, + /// + /// Network default data subscription notification. + /// + /// NetworkDefaultDataSubscription will be stored in Data property of NotificationChangedEventArgs. + NetworkDefaultDataSubscription, + /// + /// Network default subscription notification. + /// + /// NetworkDefaultSubscription will be stored in Data property of NotificationChangedEventArgs. + NetworkDefaultSubscription, + /// + /// Network cell ID. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkCellId, + /// + /// Network LAC (Location Area Code). + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkLac, + /// + /// Network TAC (Tracking Area Code). + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkTac, + /// + /// Network system ID. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkSystemId, + /// + /// Network network ID. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkNetworkId, + /// + /// Network base station ID. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkBsId, + /// + /// Network base station latitude. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkBsLatitude, + /// + /// Network base station longitude. + /// + /// Int value will be stored in Data property of NotificationChangedEventArgs. + NetworkBsLongitude, + /// + /// Network VoLTE status notification. + /// + /// Instance of NetworkVolteStatus will be stored in Data property of NotificationChangedEventArgs. + NetworkVolteStatus, + /// + /// Network EPDG status notification. + /// + /// Boolean value will be stored in Data property of NotificationChangedEventArgs. + NetworkEpdgStatus, + /// + /// Ss ussd receive notification. + /// + /// Instance of SsUssdMsgInfo will be stored in Data property of NotificationChangedEventArgs. + SsUssd, + /// + /// Ss release complete notification. + /// + /// Instance of SsReleaseCompleteMsgInfo will be stored in Data property of NotificationChangedEventArgs. + SsReleaseComplete, + /// + /// Ss call forwarding status notification. + /// + /// Instance of SsForwardResponse will be stored in Data property of NotificationChangedEventArgs. + SsNotifyForwarding, + /// + /// Ss call barring status notification. + /// + /// Instance of SsBarringResponse will be stored in Data property of NotificationChangedEventArgs. + SsNotifyBarring, + /// + /// Ss call waiting status notification. + /// + /// Instance of SsWaitingResponse will be stored in Data property of NotificationChangedEventArgs. + SsNotifyWaiting, + /// + /// Ss information notification. + /// + /// Instance of SsInfo will be stored in Data property of NotificationChangedEventArgs. + SsNotifyInfo, + /// + /// Sms incoming message notification. + /// + /// Instance of SmsIncomingMessageNoti will be stored in Data property of NotificationChangedEventArgs. + SmsIncomingMsg, + /// + /// Sms cell broadcast message incoming notification. + /// + /// Instance of SmsIncomingCbMessageNoti will be stored in Data property of NotificationChangedEventArgs. + SmsIncomingCbMsg, + /// + /// Sms ETWS(Earthquake and Tsunami Warning System) message incoming notification. + /// + /// Instance of SmsIncomingEtwsMessageNoti will be stored in Data property of NotificationChangedEventArgs. + SmsIncomingEtwsMsg, + /// + /// Sms device memory status notification. + /// + /// SmsMemoryStatus will be stored in Data property of NotificationChangedEventArgs. + SmsMemoryStatus, + /// + /// Sms ready notification. + /// + /// SmsReadyStatus will be stored in Data property of NotificationChangedEventArgs. + SmsReady, + /// + /// Oem data notification. + /// + /// Instance of OemData will be stored in Data property of NotificationChangedEventArgs. + OemData + } + + /// + /// Enumerations for the types of property definition. + /// + public enum Property + { + /// + /// Modem power property. + /// + /// PhonePowerStatus will be stored in Property property of PropertyChangedEventArgs. + ModemPower, + /// + /// Modem dongle status property. + /// + /// Boolean value will be stored in Property property of PropertyChangedEventArgs. + ModemDongleStatus, + /// + /// Modem dongle login property. + /// + /// Boolean value will be stored in Property property of PropertyChangedEventArgs. + ModemDongleLogin, + /// + /// SIM call forward state property. + /// + /// Boolean value will be stored in Property property of PropertyChangedEventArgs. + SimCallForwardState, + /// + /// Network LAC (Location Area Code) property. + /// + /// Unsigned int value will be stored in Property property of PropertyChangedEventArgs. + NetworkLac, + /// + /// Network TAC (Tracking Area Code) property (for LTE network). + /// + /// Unsigned int value will be stored in Property property of PropertyChangedEventArgs. + NetworkTac, + /// + /// Network PLMN property. + /// + /// String value will be stored in Property property of PropertyChangedEventArgs. + NetworkPlmn, + /// + /// Network cell-id property. + /// + /// Unsigned int value will be stored in Property property of PropertyChangedEventArgs. + NetworkCellId, + /// + /// Network physical cell-id property. + /// + /// Unsigned int value will be stored in Property property of PropertyChangedEventArgs. + NetworkPhysicalCellId, + /// + /// Network service type property. + /// + /// NetworkServiceType will be stored in Property property of PropertyChangedEventArgs. + NetworkServiceType, + /// + /// Network access technology property. + /// + /// NetworkSystemType will be stored in Property property of PropertyChangedEventArgs. + NetworkAct, + /// + /// Network ps type property. + /// + /// NetworkPsType will be stored in Property property of PropertyChangedEventArgs. + NetworkPsType, + /// + /// Network circuit status property. + /// + /// NetworkServiceLevel will be stored in Property property of PropertyChangedEventArgs. + NetworkCircuitStatus, + /// + /// Network packet status property. + /// + /// NetworkServiceLevel will be stored in Property property of PropertyChangedEventArgs. + NetworkPacketStatus, + /// + /// Network roaming status property. + /// + /// Boolean value will be stored in Property property of PropertyChangedEventArgs. + NetworkRoamingStatus, + /// + /// Network name option property. + /// + /// NetworkNameDisplayCondition will be stored in Property property of PropertyChangedEventArgs. + NetworkNameOption, + /// + /// Network name property. + /// + /// String value will be stored in Property property of PropertyChangedEventArgs. + NetworkName, + /// + /// SPN name property stored in SIM card. + /// + /// String value will be stored in Property property of PropertyChangedEventArgs. + NetworkSpnName, + /// + /// Network signal dbm property. + /// + /// Int value will be stored in Property property of PropertyChangedEventArgs. + NetworkSignalDbm, + /// + /// Network signal level property. + /// + /// Int value will be stored in Property property of PropertyChangedEventArgs. + NetworkSignalLevel, + /// + /// Network ims voice support status property. + /// + /// Boolean value will be stored in Property property of PropertyChangedEventArgs. + NetworkImsVoiceStatus, + /// + /// Network volte enable status notification. + /// + /// VolteNetworkType will be stored in Property property of PropertyChangedEventArgs. + NetworkVolteEnable, + /// + /// Network serving LTE band property. + /// + /// NetworkLteBandType will be stored in Property property of PropertyChangedEventArgs. + NetworkLteBand + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/TapiEventArgs.cs b/src/Tizen.Tapi/Tizen.Tapi/TapiEventArgs.cs new file mode 100755 index 0000000..08d5520 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/TapiEventArgs.cs @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Tapi +{ + /// + /// An extended EventArgs class which contains changed tapi state. + /// + public class StateChangedEventArgs : EventArgs + { + private int _state; + + internal StateChangedEventArgs(int state) + { + _state = state; + } + + /// + /// Tapi ready state. + /// + public int State + { + get + { + return _state; + } + } + } + + /// + /// An extended EventArgs class which contains changed TAPI notification. + /// + public class NotificationChangedEventArgs : EventArgs + { + private Notification _id; + private object _data; + + internal NotificationChangedEventArgs(Notification id, object data) + { + _id = id; + _data = data; + } + + /// + /// Notification Id. + /// + public Notification Id + { + get + { + return _id; + } + } + + /// + /// Notification data. + /// + public object Data + { + get + { + return _data; + } + } + } + + /// + /// An extended EventArgs class which contains changed TAPI property. + /// + public class PropertyChangedEventArgs : EventArgs + { + private Property _property; + private object _data; + + internal PropertyChangedEventArgs(Property property, object data) + { + _property = property; + _data = data; + } + + /// + /// Property definition type. + /// + public Property Property + { + get + { + return _property; + } + } + + /// + /// Property data. + /// + public object Data + { + get + { + return _data; + } + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/TapiHandle.cs b/src/Tizen.Tapi/Tizen.Tapi/TapiHandle.cs new file mode 100755 index 0000000..51b1a2e --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/TapiHandle.cs @@ -0,0 +1,685 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Tapi +{ + /// + /// This class is used for managing event callbacks for notifications and properties. + /// + public class TapiHandle + { + internal IntPtr _handle = IntPtr.Zero; + private event EventHandler _notificationChanged; + private event EventHandler _propertyChanged; + + private List _notificationChangedCbList = new List(); + private Interop.Tapi.TapiNotificationCallback _notificationChangedCb; + + /// + /// This event is called for the TAPI notification change. + /// + public event EventHandler NotificationChanged + { + add + { + _notificationChanged += value; + } + + remove + { + _notificationChanged -= value; + } + } + + /// + /// This event is called for the TAPI property change. + /// + public event EventHandler PropertyChanged + { + add + { + _propertyChanged += value; + } + + remove + { + _propertyChanged -= value; + } + } + + internal TapiHandle(IntPtr handle) + { + _handle = handle; + } + + /// + /// Registers a notification callback for notification change events on DBus interface. + /// + /// Notification id for which a callback has to be registered. + /// http://tizen.org/feature/network.telephony + /// Thrown when telephony feature is not supported. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public void RegisterNotiEvent(Notification id) + { + _notificationChangedCb = (IntPtr handle, IntPtr notiIdPtr, IntPtr data, IntPtr userData) => + { + if (_notificationChanged != null) + { + string notiId = null; + object notiData = null; + Notification noti = default(Notification); + if (notiIdPtr != IntPtr.Zero) + { + notiId = Marshal.PtrToStringAnsi(notiIdPtr); + foreach (Notification n in Enum.GetValues(typeof(Notification))) + { + if (notiId == TapiUtility.ConvertNotiToString(n)) + { + noti = n; + break; + } + } + } + + switch (noti) + { + case Notification.IdleVoiceCall: + CallIdleStatusNotiStruct voiceIdleStatusNoti = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallIdleStatusNoti(voiceIdleStatusNoti); + break; + case Notification.ActiveVoiceCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.HeldVoiceCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.DialingVoiceCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.AlertVoiceCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.IncomingVoiceCall: + CallIncomingInfoStruct callIncomingInfo = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertIncomingCallInfo(callIncomingInfo); + break; + case Notification.IdleVideoCall: + CallIdleStatusNotiStruct videoIdleStatus = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallIdleStatusNoti(videoIdleStatus); + break; + case Notification.ActiveVideoCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.DialingVideoCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.AlertVideoCall: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.IncomingVideoCall: + CallIncomingInfoStruct videoIncomingInfo = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertIncomingCallInfo(videoIncomingInfo); + break; + case Notification.WaitingCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.ForwardCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.BarredIncomingCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.BarredOutgoingCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.ForwardUnconditionalCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.ForwardConditionalCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.ForwardedCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.HeldCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.ActiveCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.JoinedCallInfo: + notiData = (uint)Marshal.ReadInt32(data); + break; + case Notification.RecCallInfo: + CallRecordStruct recordStruct = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallRecordStruct(recordStruct); + break; + case Notification.PrivacyModeCall: + notiData = (CallPrivacyMode)Marshal.ReadInt32(data); + break; + case Notification.OtaspCall: + notiData = (CallOtaspStatus)Marshal.ReadInt32(data); + break; + case Notification.OtapaCall: + notiData = (CallOtapaStatus)Marshal.ReadInt32(data); + break; + case Notification.CallSignalInfo: + CallSignalInfoStruct signalInfoStruct = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallSignalInfo(signalInfoStruct); + break; + case Notification.CallSoundPath: + notiData = (SoundPath)Marshal.ReadInt32(data); + break; + case Notification.CallSoundRingbackTone: + notiData = (CallSoundRingbackNoti)Marshal.ReadInt32(data); + break; + case Notification.CallSoundWbamr: + notiData = (CallSoundWbamrNoti)Marshal.ReadInt32(data); + break; + case Notification.CallSoundNoiceReduction: + notiData = (CallSoundNoiseReduction)Marshal.ReadInt32(data); + break; + case Notification.CallSoundClock: + int status = Marshal.ReadInt32(data); + if (status == 1) + { + notiData = true; + } + + else if (status == 0) + { + notiData = false; + } + + break; + case Notification.CallPreferredVoiceSubscription: + notiData = (CallPreferredVoiceSubscription)Marshal.ReadInt32(data); + break; + case Notification.CallupgradeRequested: + CallUpgradeDowngradeNotiStruct upgradeNotiStruct = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallUpgradeNoti(upgradeNotiStruct); + break; + case Notification.CallDowngraded: + CallUpgradeDowngradeNotiStruct downgradeNotiStruct = Marshal.PtrToStructure(data); + notiData = CallStructConversions.ConvertCallUpgradeNoti(downgradeNotiStruct); + break; + case Notification.ModemPower: + notiData = (PhonePowerStatus)Marshal.ReadInt32(data); + break; + case Notification.SimStatus: + notiData = (SimCardStatus)Marshal.ReadInt32(data); + break; + case Notification.SimRefreshed: + notiData = (SatCmdQualiRefresh)Marshal.ReadInt32(data); + break; + case Notification.SatSetupMenu: + SatMainMenuInfoStruct mainMenuStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatMainMenuInfoStruct(mainMenuStruct); + break; + case Notification.SatDisplayText: + SatDisplayTextStruct textStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatDisplayTextStruct(textStruct); + break; + case Notification.SatSelectItem: + SatSelectItemStruct itemStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSelectItemStruct(itemStruct); + break; + case Notification.SatGetInKey: + SatGetInKeyStruct inKeyStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatGetInKeyStruct(inKeyStruct); + break; + case Notification.SatGetInput: + SatGetInputStruct inputStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatGetInputStruct(inputStruct); + break; + case Notification.SatRefresh: + SatRefreshStruct refreshStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatRefreshStruct(refreshStruct); + break; + case Notification.SatSendSms: + SatSendSmsStruct smsStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSendSmsStruct(smsStruct); + break; + case Notification.SatSetupEventList: + SatEventListDataStruct eventStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatEventListStruct(eventStruct); + break; + case Notification.SatSendDtmf: + SatSendDtmfDataStruct dtmfStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSendDtmfStruct(dtmfStruct); + break; + case Notification.SatEndProactiveSession: + notiData = (SatCommandType)Marshal.ReadInt32(data); + break; + case Notification.SatCallControlResult: + SatCallCtrlIndDataStruct dataStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatCallCtrlIndDataStruct(dataStruct); + break; + case Notification.SatMoSmControlResult: + SatMoSmsCtrlDataStruct moStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatMoSmsCtrlDataStruct(moStruct); + break; + case Notification.SatSetupCall: + SatSetupCallDataStruct callDataStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSetupCallDataStruct(callDataStruct); + break; + case Notification.SatSendSs: + SatSendSsDataStruct ssStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSendSsDataStruct(ssStruct); + break; + case Notification.SatSetupUssd: + SatSetupUssdDataStruct ussdStruct = Marshal.PtrToStructure(data); + notiData = SatStructConversions.ConvertSatSetupUssdDataStruct(ussdStruct); + break; + case Notification.PhonebookStatus: + SimPhonebookStatusStruct statusStruct = Marshal.PtrToStructure(data); + notiData = PhonebookStructConversions.ConvertSimPhonebookStatusStruct(statusStruct); + break; + case Notification.PhonebookContactChange: + PhonebookContactChangeInfoStruct contactStruct = Marshal.PtrToStructure(data); + notiData = PhonebookStructConversions.ConvertPhonebookContactChangeStruct(contactStruct); + break; + case Notification.NetworkRegistrationStatus: + NetworkRegistrationStatusStruct nwStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkRegistrationStruct(nwStruct); + break; + case Notification.NetworkCellInfo: + NetworkCellNotiStruct notiStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkCellNotiStruct(notiStruct); + break; + case Notification.NetworkChange: + NetworkChangeNotiStruct changeStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkChangeStruct(changeStruct); + break; + case Notification.NetworkTimeInfo: + NetworkTimeNotiStruct timeStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkTimeNotiStruct(timeStruct); + break; + case Notification.NetworkIdentity: + NetworkIdentityNotiStruct idStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkIdentityStruct(idStruct); + break; + case Notification.NetworkSignalStrength: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkEmergencyCallbackMode: + notiData = (NetworkEmergencyCallbackMode)Marshal.ReadInt32(data); + break; + case Notification.NetworkDefaultDataSubscription: + notiData = (NetworkDefaultDataSubscription)Marshal.ReadInt32(data); + break; + case Notification.NetworkDefaultSubscription: + notiData = (NetworkDefaultSubscription)Marshal.ReadInt32(data); + break; + case Notification.NetworkCellId: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkLac: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkTac: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkSystemId: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkNetworkId: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkBsId: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkBsLatitude: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkBsLongitude: + notiData = Marshal.ReadInt32(data); + break; + case Notification.NetworkVolteStatus: + NetworkVolteStatusStruct volteStruct = Marshal.PtrToStructure(data); + notiData = NetworkStructConversions.ConvertNetworkVolteStruct(volteStruct); + break; + case Notification.NetworkEpdgStatus: + int epdgStatus = Marshal.ReadInt32(data); + if (epdgStatus == 1) + { + notiData = true; + } + + else if (epdgStatus == 0) + { + notiData = false; + } + + break; + case Notification.SsUssd: + SsUssdMsgInfoStruct ussdInfoStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertSsMsgStruct(ussdInfoStruct); + break; + case Notification.SsReleaseComplete: + SsReleaseCompleteMsgStruct msgStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertReleaseMsgStruct(msgStruct); + break; + case Notification.SsNotifyForwarding: + SsForwardResponseStruct responseStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertForwardRspStruct(responseStruct); + break; + case Notification.SsNotifyBarring: + SsBarringResponseStruct barringStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertBarringRspStruct(barringStruct); + break; + case Notification.SsNotifyWaiting: + SsWaitingResponseStruct waitingStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertWaitingRspStruct(waitingStruct); + break; + case Notification.SsNotifyInfo: + SsInfoStruct ssInfoStruct = Marshal.PtrToStructure(data); + notiData = SsStructConversions.ConvertInfoStruct(ssInfoStruct); + break; + case Notification.SmsIncomingMsg: + SmsIncomingMsgNotiStruct smsNotiStruct = Marshal.PtrToStructure(data); + notiData = SmsStructConversions.ConvertSmsIncomingStruct(smsNotiStruct); + break; + case Notification.SmsIncomingCbMsg: + SmsIncomingCbMsgNotiStruct smsCbStruct = Marshal.PtrToStructure(data); + notiData = SmsStructConversions.ConvertSmsIncomingCbStruct(smsCbStruct); + break; + case Notification.SmsIncomingEtwsMsg: + SmsIncomingEtwsMsgNotiStruct etwsStruct = Marshal.PtrToStructure(data); + notiData = SmsStructConversions.ConvertSmsIncomingEtwsStruct(etwsStruct); + break; + case Notification.SmsMemoryStatus: + notiData = (SmsMemoryStatus)Marshal.ReadInt32(data); + break; + case Notification.SmsReady: + notiData = (SmsReadyStatus)Marshal.ReadInt32(data); + break; + case Notification.OemData: + OemDataStruct oemStruct = Marshal.PtrToStructure(data); + notiData = OemStructConversions.ConvertOemStruct(oemStruct); + break; + } + + _notificationChanged(null, new NotificationChangedEventArgs(noti, notiData)); + } + }; + + _notificationChangedCbList.Add(_notificationChangedCb); + + int ret = Interop.Tapi.RegisterNotiEvent(_handle, TapiUtility.ConvertNotiToString(id), _notificationChangedCb, IntPtr.Zero); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to register notification event, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle); + } + } + + /// + /// Registers a notification callback for property change events on DBus interface. + /// + /// Property definition for which a callback has to be registered. + /// http://tizen.org/feature/network.telephony + /// Thrown when telephony feature is not supported. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public void RegisterPropEvent(Property property) + { + _notificationChangedCb = (IntPtr handle, IntPtr propPtr, IntPtr data, IntPtr userData) => + { + if (_propertyChanged != null) + { + string prop = null; + object propData = null; + Property propertyId = default(Property); + if (propPtr != IntPtr.Zero) + { + prop = Marshal.PtrToStringAnsi(propPtr); + foreach (Property p in Enum.GetValues(typeof(Property))) + { + if (prop == TapiUtility.ConvertPropToString(p)) + { + propertyId = p; + break; + } + } + } + + switch (propertyId) + { + case Property.ModemPower: + propData = (PhonePowerStatus)Marshal.ReadInt32(data); + break; + case Property.ModemDongleStatus: + int dongleStatus = Marshal.ReadInt32(data); + if (dongleStatus == 1) + { + propData = true; + } + + else if (dongleStatus == 0) + { + propData = false; + } + + break; + case Property.ModemDongleLogin: + int loginStatus = Marshal.ReadInt32(data); + if (loginStatus == 1) + { + propData = true; + } + + else if (loginStatus == 0) + { + propData = false; + } + + break; + case Property.SimCallForwardState: + int forwardState = Marshal.ReadInt32(data); + if (forwardState == 1) + { + propData = true; + } + + else if (forwardState == 0) + { + propData = false; + } + + break; + case Property.NetworkLac: + propData = (uint)Marshal.ReadInt32(data); + break; + case Property.NetworkTac: + propData = (uint)Marshal.ReadInt32(data); + break; + case Property.NetworkPlmn: + propData = Marshal.PtrToStringAnsi(data); + break; + case Property.NetworkCellId: + propData = (uint)Marshal.ReadInt32(data); + break; + case Property.NetworkPhysicalCellId: + propData = (uint)Marshal.ReadInt32(data); + break; + case Property.NetworkServiceType: + propData = (NetworkServiceType)Marshal.ReadInt32(data); + break; + case Property.NetworkAct: + propData = (NetworkSystemType)Marshal.ReadInt32(data); + break; + case Property.NetworkPsType: + propData = (NetworkPsType)Marshal.ReadInt32(data); + break; + case Property.NetworkCircuitStatus: + propData = (NetworkServiceLevel)Marshal.ReadInt32(data); + break; + case Property.NetworkPacketStatus: + propData = (NetworkServiceLevel)Marshal.ReadInt32(data); + break; + case Property.NetworkRoamingStatus: + int roamingStatus = Marshal.ReadInt32(data); + if (roamingStatus == 1) + { + propData = true; + } + + else if (roamingStatus == 0) + { + propData = false; + } + + break; + case Property.NetworkNameOption: + propData = (NetworkNameDisplayCondition)Marshal.ReadInt32(data); + break; + case Property.NetworkName: + propData = Marshal.PtrToStringAnsi(data); + break; + case Property.NetworkSpnName: + propData = Marshal.PtrToStringAnsi(data); + break; + case Property.NetworkSignalDbm: + propData = Marshal.ReadInt32(data); + break; + case Property.NetworkSignalLevel: + propData = Marshal.ReadInt32(data); + break; + case Property.NetworkImsVoiceStatus: + int imsStatus = Marshal.ReadInt32(data); + if (imsStatus == 1) + { + propData = true; + } + + else if (imsStatus == 0) + { + propData = false; + } + + break; + case Property.NetworkVolteEnable: + propData = (VolteNetworkType)Marshal.ReadInt32(data); + break; + case Property.NetworkLteBand: + propData = (NetworkLteBandType)Marshal.ReadInt32(data); + break; + } + + _propertyChanged(null, new PropertyChangedEventArgs(propertyId, propData)); + } + }; + + _notificationChangedCbList.Add(_notificationChangedCb); + int ret = Interop.Tapi.RegisterNotiEvent(_handle, TapiUtility.ConvertPropToString(property), _notificationChangedCb, IntPtr.Zero); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to register notification event for property change, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle); + } + } + + /// + /// Deregisters notification callback for notification change events on DBus interface. + /// + /// Notification id for which the callback has to be de-registered. + /// http://tizen.org/feature/network.telephony + /// Thrown when telephony feature is not supported. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public void DeregisterNotiEvent(Notification id) + { + int ret = Interop.Tapi.DeregisterNotiEvent(_handle, TapiUtility.ConvertNotiToString(id)); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to deregister notification event, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle); + } + } + + /// + /// Deregisters notification callback for property change events on DBus interface. + /// + /// Property definition for which the callback has to be de-registered. + /// http://tizen.org/feature/network.telephony + /// Thrown when telephony feature is not supported. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public void DeregisterPropEvent(Property property) + { + int ret = Interop.Tapi.DeregisterNotiEvent(_handle, TapiUtility.ConvertPropToString(property)); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to deregister notification event for property change, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle); + } + } + + /// + /// Gets the property value in an integer format for the given property. + /// + /// The property to be retrieved from Dbus. + /// The property value in integer format. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when permission is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public int GetIntProperty(Property property) + { + int result; + int ret = Interop.Tapi.GetIntProperty(_handle, TapiUtility.ConvertPropToString(property), out result); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get property in integer format, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return result; + } + + /// + /// Gets the property value in a string format for the given property. + /// + /// The property to be retrieved from Dbus. + /// The property value in string format. + /// http://tizen.org/feature/network.telephony + /// http://tizen.org/privilege/telephony + /// Thrown when telephony feature is not supported. + /// Thrown when permission is denied. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public string GetStringProperty(Property property) + { + string result; + int ret = Interop.Tapi.GetStringProperty(_handle, TapiUtility.ConvertPropToString(property), out result); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get property in string format, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, _handle, "http://tizen.org/privilege/telephony"); + } + + return result; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/TapiManager.cs b/src/Tizen.Tapi/Tizen.Tapi/TapiManager.cs new file mode 100755 index 0000000..589e540 --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/TapiManager.cs @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using Tizen; + +namespace Tizen.Tapi +{ + /// + /// This class is used for initializing/deinitializing Tapi and manages the state of it. + /// + public static class TapiManager + { + private static event EventHandler s_stateChanged; + private static Interop.Tapi.TapiStateCallback s_stateChangedCb; + + /// + /// Gets the state value if tapi is ready. + /// + /// The State value in integer format - 0 is False and 1 is True. Returns -1 in case of error. + public static int State + { + get + { + int state; + int ret = Interop.Tapi.GetReadyState(out state); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to get ready state of tapi, Error: " + (TapiError)ret); + return -1; + } + + return state; + } + } + + /// + /// This event is raised when Tapi ready state changes. + /// + public static event EventHandler StateChanged + { + add + { + if (s_stateChanged == null) + { + RegisterStateChangedEvent(); + } + + s_stateChanged += value; + } + + remove + { + s_stateChanged -= value; + if (s_stateChanged == null) + { + UnregisterStateChangedEvent(); + } + } + } + + private static void RegisterStateChangedEvent() + { + s_stateChangedCb = (int state, IntPtr userData) => + { + s_stateChanged?.Invoke(null, new StateChangedEventArgs(state)); + }; + int ret = Interop.Tapi.RegisterReadyStateCb(s_stateChangedCb, IntPtr.Zero); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to register tapi state changed callback, Error: " + (TapiError)ret); + } + } + + private static void UnregisterStateChangedEvent() + { + int ret = Interop.Tapi.DeregisterReadyStateCb(s_stateChangedCb); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to deregister tapi state changed callback, Error: " + (TapiError)ret); + } + } + + /// + /// Fetches a list of available CPs. + /// + /// List of available CPs in case of success. Null in case of failure. + /// http://tizen.org/feature/network.telephony + public static IEnumerable GetCpNames() + { + IntPtr cpNames = Interop.Tapi.GetCpNames(); + if(cpNames == IntPtr.Zero) + { + return null; + } + + else + { + List cpList = new List(); + int offset = 0; + IntPtr cp = Marshal.ReadIntPtr(cpNames, offset); + if(cp != IntPtr.Zero) + { + do + { + string cpString = Marshal.PtrToStringAnsi(cp); + offset += Marshal.SizeOf(cp); + cpList.Add(cpString); + } + + while ((cp = Marshal.ReadIntPtr(cpNames, offset)) != IntPtr.Zero); + } + + return cpList; + } + } + + /// + /// Acquires a TAPI Handle for the specified CP name. + /// + /// The CP Name against which a TAPI handle is required (A NULL CP Name will return a #TapiHandle bound to the first CP in the list of available CPs). + /// Instance of TapiHandle on success, null on failure. + /// http://tizen.org/feature/network.telephony + public static TapiHandle InitTapi(string cpName) + { + IntPtr handle = Interop.Tapi.InitTapi(cpName); + if (handle == IntPtr.Zero) + { + return null; + } + + return new TapiHandle(handle); + } + + /// + /// Deinitializes the TAPI Handle. + /// + /// http://tizen.org/feature/network.telephony + /// Thrown when telephony feature is not supported. + /// Thrown when it is failed due to invalid parameter. + /// Thrown when it is failed due to invalid operation. + public static void DeinitTapi(TapiHandle handle) + { + int ret = Interop.Tapi.DeinitTapi(handle._handle); + if (ret != (int)TapiError.Success) + { + Log.Error(TapiUtility.LogTag, "Failed to deinitialize tapi, Error: " + (TapiError)ret); + TapiUtility.ThrowTapiException(ret, handle._handle); + } + + handle._handle = IntPtr.Zero; + } + } +} diff --git a/src/Tizen.Tapi/Tizen.Tapi/TapiUtility.cs b/src/Tizen.Tapi/Tizen.Tapi/TapiUtility.cs new file mode 100755 index 0000000..9e68e1b --- /dev/null +++ b/src/Tizen.Tapi/Tizen.Tapi/TapiUtility.cs @@ -0,0 +1,382 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Tapi +{ + internal enum TapiError + { + Success = 0, + InvalidInput = -1, + InvalidPtr = -2, + NotSupported = -3, + Depricated = -4, + SystemOutOfMemory = -5, + SystemRpcLinkDown = -6, + ServiceNotReady = -7, + ServerFailure = -8, + OemPluginFailure = -9, + TransportLayerFailure = -10, + InvalidDataLength = -11, + RequestMaxInProgress = -12, + OfflineModeError = -13, + EventClassUnknown = -14, + EventUnknown = -15, + RegistrationOpFailed = -16, + OperationFailed = -17, + InvalidOperation = -18, + AccessDenied = -19, + SystemRpcLinkNotEst = -100, + ApiNotSupported = -101, + ServerLayerFailure = -102, + InvalidCallId = -200, + CallContextOverflow = -201, + CouldNotGetCallContext = -202, + ContextSearchRetNonCallContext = -203, + CouldNotDestroyContext = -204, + InvalidLineId = -205, + InvalidCallHandle = -206, + InvalidCallState = -207, + CallPreCondFailed = -208, + CallSameReqPending = -209, + ModemPoweredOff = -300, + ModemAlreadyOn = -301, + ModemAlreadyOff = -302, + NetTextDeviceNotReady = -400, + NetTextScaAddrNotSet = -401, + NetTextInvalidDataLength = -402, + NetTextScaAddressNotSet = -403, + SimCardError = -500, + SimNotFound = -501, + SimNotInitialized = -502, + SimLocked = -503, + SimPermBlocked = -504, + SimServiceDisabled = -505, + SatInvalidCommandId = -600, + SatCommandTypeMismatch = -601, + SatEventNotRequiredByUsim = -602, + NetworkInvalidContext = -700, + NetworkPlmnNotAllowed = -701, + NetworkRoamingNotAllowed = -702, + MiscReturnNull = -800, + MiscvalidityError = -801, + MiscInputParamError = -802, + MiscOutParamNull = -803 + } + + internal static class TapiUtility + { + internal const string LogTag = "Tizen.Tapi"; + internal const int MaxVersionLen = 32; + internal const int MiscProdCodeMaxLen = 32; + internal const int ModelIdMaxLen = 17; + internal const int MiscPrlEriVersionMaxLen = 17; + internal const int MiscMeSnMaxLen = 32; + internal const int MiscMeDeviceNameMaxLen = 32; + internal const int CallDialNumberMaxLen = 83; + internal const int CallNameMaxSize = 97; + + internal static string ConvertNotiToString(Notification noti) + { + switch(noti) + { + case Notification.IdleVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusIdle"; + case Notification.ActiveVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusActive"; + case Notification.HeldVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusHeld"; + case Notification.DialingVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusDialing"; + case Notification.AlertVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusAlert"; + case Notification.IncomingVoiceCall: + return "org.tizen.telephony.Call:VoiceCallStatusIncoming"; + case Notification.IdleVideoCall: + return "org.tizen.telephony.Call:VideoCallStatusIdle"; + case Notification.ActiveVideoCall: + return "org.tizen.telephony.Call:VideoCallStatusActive"; + case Notification.DialingVideoCall: + return "org.tizen.telephony.Call:VideoCallStatusDialing"; + case Notification.AlertVideoCall: + return "org.tizen.telephony.Call:VideoCallStatusAlert"; + case Notification.IncomingVideoCall: + return "org.tizen.telephony.Call:VideoCallStatusIncoming"; + case Notification.WaitingCallInfo: + return "org.tizen.telephony.Call:Waiting"; + case Notification.ForwardCallInfo: + return "org.tizen.telephony.Call:Forwarded"; + case Notification.BarredIncomingCallInfo: + return "org.tizen.telephony.Call:BarredIncoming"; + case Notification.BarredOutgoingCallInfo: + return "org.tizen.telephony.Call:BarredOutgoing"; + case Notification.DeflectCallInfo: + return "org.tizen.telephony.Call:Deflected"; + case Notification.ClirCallInfo: + return "org.tizen.telephony.Call:ClirSuppressionReject"; + case Notification.ForwardUnconditionalCallInfo: + return "org.tizen.telephony.Call:ForwardUnconditional"; + case Notification.ForwardConditionalCallInfo: + return "org.tizen.telephony.Call:ForwardConditional"; + case Notification.ForwardedCallInfo: + return "org.tizen.telephony.Call:ForwardedCall"; + case Notification.DeflectedCallInfo: + return "org.tizen.telephony.Call:DeflectedCall"; + case Notification.TransferredCallInfo: + return "org.tizen.telephony.Call:TransferedCall"; + case Notification.HeldCallInfo: + return "org.tizen.telephony.Call:CallHeld"; + case Notification.ActiveCallInfo: + return "org.tizen.telephony.Call:CallActive"; + case Notification.JoinedCallInfo: + return "org.tizen.telephony.Call:CallJoined"; + case Notification.TransferAlertCallInfo: + return "org.tizen.telephony.Call:TransferAlert"; + case Notification.CfCheckMessageCallInfo: + return "org.tizen.telephony.Call:CfCheckMessage"; + case Notification.RecCallInfo: + return "org.tizen.telephony.Call:CallInfoRec"; + case Notification.FallbackCallInfo: + return "org.tizen.telephony.Call:CallFallback"; + case Notification.PrivacyModeCall: + return "org.tizen.telephony.Call:CallPrivacyMode"; + case Notification.OtaspCall: + return "org.tizen.telephony.Call:CallOtaspStatus"; + case Notification.OtapaCall: + return "org.tizen.telephony.Call:CallOtapaStatus"; + case Notification.CallSignalInfo: + return "org.tizen.telephony.Call:CallSignalInfo"; + case Notification.CallSoundPath: + return "org.tizen.telephony.Call:CallSoundPath"; + case Notification.CallSoundRingbackTone: + return "org.tizen.telephony.Call:CallSoundRingbackTone"; + case Notification.CallSoundWbamr: + return "org.tizen.telephony.Call:CallSoundWbamr"; + case Notification.CallSoundNoiceReduction: + return "org.tizen.telephony.Call:CallSoundNoiseReduction"; + case Notification.CallSoundClock: + return "org.tizen.telephony.Call:CallSoundClockStatus"; + case Notification.CallPreferredVoiceSubscription: + return "org.tizen.telephony.Call:CallPreferredVoiceSubscription"; + case Notification.CallModifiableInfo: + return "org.tizen.telephony.Call:Modifiable"; + case Notification.CallupgradeRequested: + return "org.tizen.telephony.Call:CallUpgradeRequested"; + case Notification.CallDowngraded: + return "org.tizen.telephony.Call:CallDowngraded"; + case Notification.ModemPower: + return "org.tizen.telephony.Modem:Power"; + case Notification.SimStatus: + return "org.tizen.telephony.Sim:Status"; + case Notification.SimRefreshed: + return "org.tizen.telephony.Sim:Refreshed"; + case Notification.SapStatus: + return "org.tizen.telephony.Sap:Status"; + case Notification.SapDisconnect: + return "org.tizen.telephony.Sap:Disconnect"; + case Notification.SatSetupMenu: + return "org.tizen.telephony.SAT:SetupMenu"; + case Notification.SatDisplayText: + return "org.tizen.telephony.SAT:DisplayText"; + case Notification.SatSelectItem: + return "org.tizen.telephony.SAT:SelectItem"; + case Notification.SatGetInKey: + return "org.tizen.telephony.SAT:GetInkey"; + case Notification.SatGetInput: + return "org.tizen.telephony.SAT:GetInput"; + case Notification.SatRefresh: + return "org.tizen.telephony.SAT:Refresh"; + case Notification.SatSendSms: + return "org.tizen.telephony.SAT:SendSMS"; + case Notification.SatSetupEventList: + return "org.tizen.telephony.SAT:SetupEventList"; + case Notification.SatSendDtmf: + return "org.tizen.telephony.SAT:SendDtmf"; + case Notification.SatEndProactiveSession: + return "org.tizen.telephony.SAT:EndProactiveSession"; + case Notification.SatCallControlResult: + return "org.tizen.telephony.SAT:CallControlResult"; + case Notification.SatMoSmControlResult: + return "org.tizen.telephony.SAT:MoSmControlResult"; + case Notification.SatSetupCall: + return "org.tizen.telephony.SAT:SetupCall"; + case Notification.SatSendSs: + return "org.tizen.telephony.SAT:SendSS"; + case Notification.SatSetupUssd: + return "org.tizen.telephony.SAT:SetupUSSD"; + case Notification.PhonebookStatus: + return "org.tizen.telephony.Phonebook:Status"; + case Notification.PhonebookContactChange: + return "org.tizen.telephony.Phonebook:ContactChange"; + case Notification.NetworkRegistrationStatus: + return "org.tizen.telephony.Network:RegistrationStatus"; + case Notification.NetworkCellInfo: + return "org.tizen.telephony.Network:CellInfo"; + case Notification.NetworkChange: + return "org.tizen.telephony.Network:Change"; + case Notification.NetworkTimeInfo: + return "org.tizen.telephony.Network:TimeInfo"; + case Notification.NetworkIdentity: + return "org.tizen.telephony.Network:Identity"; + case Notification.NetworkSignalStrength: + return "org.tizen.telephony.Network:SignalStrength"; + case Notification.NetworkEmergencyCallbackMode: + return "org.tizen.telephony.Network:EmergencyCallbackMode"; + case Notification.NetworkDefaultDataSubscription: + return "org.tizen.telephony.Network:DefaultDataSubscription"; + case Notification.NetworkDefaultSubscription: + return "org.tizen.telephony.Network:DefaultSubscription"; + case Notification.NetworkCellId: + return "org.tizen.telephony.Network:CellId"; + case Notification.NetworkLac: + return "org.tizen.telephony.Network:Lac"; + case Notification.NetworkTac: + return "org.tizen.telephony.Network:Tac"; + case Notification.NetworkSystemId: + return "org.tizen.telephony.Network:SystemId"; + case Notification.NetworkNetworkId: + return "org.tizen.telephony.Network:NetworkId"; + case Notification.NetworkBsId: + return "org.tizen.telephony.Network:BsId"; + case Notification.NetworkBsLatitude: + return "org.tizen.telephony.Network:BsLatitude"; + case Notification.NetworkBsLongitude: + return "org.tizen.telephony.Network:BsLongitude"; + case Notification.NetworkVolteStatus: + return "org.tizen.telephony.Network:VolteStatus"; + case Notification.NetworkEpdgStatus: + return "org.tizen.telephony.Network:EpdgStatus"; + case Notification.SsUssd: + return "org.tizen.telephony.Ss:NotifyUSSD"; + case Notification.SsReleaseComplete: + return "org.tizen.telephony.Ss:ReleaseComplete"; + case Notification.SsNotifyForwarding: + return "org.tizen.telephony.Ss:NotifyForwarding"; + case Notification.SsNotifyBarring: + return "org.tizen.telephony.Ss:NotifyBarring"; + case Notification.SsNotifyWaiting: + return "org.tizen.telephony.Ss:NotifyWaiting"; + case Notification.SsNotifyInfo: + return "org.tizen.telephony.Ss:NotifySsInfo"; + case Notification.SmsIncomingMsg: + return "org.tizen.telephony.sms:IncommingMsg"; + case Notification.SmsIncomingCbMsg: + return "org.tizen.telephony.sms:IncommingCbMsg"; + case Notification.SmsIncomingEtwsMsg: + return "org.tizen.telephony.sms:IncommingEtwsMsg"; + case Notification.SmsMemoryStatus: + return "org.tizen.telephony.sms:MemoryStatus"; + case Notification.SmsReady: + return "org.tizen.telephony.sms:SmsReady"; + case Notification.OemData: + return "org.tizen.telephony.OEM:OemData"; + default: + return null; + } + } + + internal static string ConvertPropToString(Property prop) + { + switch(prop) + { + case Property.ModemPower: + return "org.tizen.telephony.Modem:power"; + case Property.ModemDongleStatus: + return "org.tizen.telephony.Modem:dongle_status"; + case Property.ModemDongleLogin: + return "org.tizen.telephony.Modem:dongle_login"; + case Property.SimCallForwardState: + return "org.tizen.telephony.Sim:cf_state"; + case Property.NetworkLac: + return "org.tizen.telephony.Network:lac"; + case Property.NetworkTac: + return "org.tizen.telephony.Network:tac"; + case Property.NetworkPlmn: + return "org.tizen.telephony.Network:plmn"; + case Property.NetworkCellId: + return ".tizen.telephony.Network:cell_id"; + case Property.NetworkPhysicalCellId: + return "org.tizen.telephony.Network:physical_cell_id"; + case Property.NetworkServiceType: + return "org.tizen.telephony.Network:service_type"; + case Property.NetworkAct: + return "org.tizen.telephony.Network:access_technology"; + case Property.NetworkPsType: + return "org.tizen.telephony.Network:ps_type"; + case Property.NetworkCircuitStatus: + return "org.tizen.telephony.Network:circuit_status"; + case Property.NetworkPacketStatus: + return "org.tizen.telephony.Network:packet_status"; + case Property.NetworkRoamingStatus: + return "org.tizen.telephony.Network:roaming_status"; + case Property.NetworkNameOption: + return "org.tizen.telephony.Network:name_option"; + case Property.NetworkName: + return "org.tizen.telephony.Network:network_name"; + case Property.NetworkSpnName: + return "org.tizen.telephony.Network:spn_name"; + case Property.NetworkSignalDbm: + return "org.tizen.telephony.Network:sig_dbm"; + case Property.NetworkSignalLevel: + return "org.tizen.telephony.Network:sig_level"; + case Property.NetworkImsVoiceStatus: + return "org.tizen.telephony.Network:ims_voice_status"; + case Property.NetworkVolteEnable: + return "org.tizen.telephony.Network:volte_enable"; + case Property.NetworkLteBand: + return "org.tizen.telephony.Network:lte_band_type"; + default: + return null; + } + } + + internal static void ThrowTapiException(int exception, IntPtr handle) + { + ThrowException(exception, (handle == IntPtr.Zero), ""); + } + + internal static void ThrowTapiException(int exception, IntPtr handle, string message) + { + ThrowException(exception, (handle == IntPtr.Zero), message); + } + + private static void ThrowException(int exception, bool isHandleNull, string message) + { + TapiError _error = (TapiError)exception; + switch (_error) + { + case TapiError.NotSupported: + throw new NotSupportedException("Unsupported feature http://tizen.org/feature/network.telephony"); + case TapiError.AccessDenied: + throw new UnauthorizedAccessException("Permission denied " + message); + case TapiError.SystemOutOfMemory: + throw new OutOfMemoryException("System out of memory"); + case TapiError.InvalidPtr: + if (isHandleNull) + { + throw new InvalidOperationException("Invalid instance (object may have been disposed or released)"); + } + else + throw new ArgumentException("Invalid parameter"); + case TapiError.InvalidInput: + throw new ArgumentException("Invalid parameter"); + default: + throw new InvalidOperationException(_error.ToString()); + } + } + } +} diff --git a/src/Tizen.Telephony/Interop/Interop.Call.cs b/src/Tizen.Telephony/Interop/Interop.Call.cs new file mode 100755 index 0000000..c5cf929 --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Call.cs @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Telephony; +using static Tizen.Telephony.CallHandle; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Call Interop Class + /// + internal static partial class Call + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_preferred_voice_subscription")] + internal static extern Telephony.TelephonyError GetPreferredVoiceSubscription(IntPtr handle, out CallPreferredVoiceSubscription callSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_call_list")] + internal static extern Telephony.TelephonyError GetCallList(IntPtr handle, out uint count, out IntPtr callList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_release_call_list")] + internal static extern Telephony.TelephonyError ReleaseCallList(uint count, IntPtr callList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_handle_id")] + internal static extern Telephony.TelephonyError GetHandleId(IntPtr callHandle, out uint handleId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_number")] + internal static extern Telephony.TelephonyError GetNumber(IntPtr callHandle, out string number); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_type")] + internal static extern Telephony.TelephonyError GetType(IntPtr callHandle, out CallType type); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_status")] + internal static extern Telephony.TelephonyError GetStatus(IntPtr callHandle, out CallStatus status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_direction")] + internal static extern Telephony.TelephonyError GetDirection(IntPtr callHandle, out CallDirection direction); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_call_get_conference_status")] + internal static extern Telephony.TelephonyError GetConferenceStatus(IntPtr callHandle, out bool conferenceStatus); + + internal sealed class SafeCallList : SafeHandle + { + public SafeCallList() + : base(IntPtr.Zero, true) + { + } + + public SafeCallList(IntPtr handle, uint count) + : base(handle, true) + { + Count = count; + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + ReleaseCallList(Count, this.handle); + this.SetHandle(IntPtr.Zero); + return true; + } + + internal uint Count; + } + } +} diff --git a/src/Tizen.Telephony/Interop/Interop.Libraries.cs b/src/Tizen.Telephony/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..b98e7d0 --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Libraries.cs @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Libraries Interop Class + /// + internal static partial class Libraries + { + public const string Telephony = "libcapi-telephony.so.0"; + } +} \ No newline at end of file diff --git a/src/Tizen.Telephony/Interop/Interop.Modem.cs b/src/Tizen.Telephony/Interop/Interop.Modem.cs new file mode 100755 index 0000000..19034b0 --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Modem.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Modem Interop Class + /// + internal static partial class Modem + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_imei")] + internal static extern Telephony.TelephonyError GetImei(IntPtr handle, out string imei); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_power_status")] + internal static extern Telephony.TelephonyError GetPowerStatus(IntPtr handle, out Tizen.Telephony.Modem.PowerStatus status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_modem_get_meid")] + internal static extern Telephony.TelephonyError GetMeid(IntPtr handle, out string meid); + } +} diff --git a/src/Tizen.Telephony/Interop/Interop.Network.cs b/src/Tizen.Telephony/Interop/Interop.Network.cs new file mode 100755 index 0000000..e8bbaf0 --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Network.cs @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Network Interop Class + /// + internal static partial class Network + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_lac")] + internal static extern Telephony.TelephonyError GetLac(IntPtr handle, out int lac); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_cell_id")] + internal static extern Telephony.TelephonyError GetCellId(IntPtr handle, out int cellId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_rssi")] + internal static extern Telephony.TelephonyError GetRssi(IntPtr handle, out Tizen.Telephony.Network.Rssi rssi); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_roaming_status")] + internal static extern Telephony.TelephonyError GetRoamingStatus(IntPtr handle, out bool status); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_mcc")] + internal static extern Telephony.TelephonyError GetMcc(IntPtr handle, out string mcc); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_mnc")] + internal static extern Telephony.TelephonyError GetMnc(IntPtr handle, out string mnc); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_name")] + internal static extern Telephony.TelephonyError GetNetworkName(IntPtr handle, out string networkName); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_type")] + internal static extern Telephony.TelephonyError GetType(IntPtr handle, out Tizen.Telephony.Network.Type networkType); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_ps_type")] + internal static extern Telephony.TelephonyError GetPsType(IntPtr handle, out Tizen.Telephony.Network.PsType psType); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_name_option")] + internal static extern Telephony.TelephonyError GetNetworkNameOption(IntPtr handle, out Tizen.Telephony.Network.NameOption networkNameOption); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_service_state")] + internal static extern Telephony.TelephonyError GetServiceState(IntPtr handle, out Tizen.Telephony.Network.ServiceState networkServiceState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_default_data_subscription")] + internal static extern Telephony.TelephonyError GetDefaultDataSubscription(IntPtr handle, out Tizen.Telephony.Network.DefaultDataSubscription defaultSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_default_subscription")] + internal static extern Telephony.TelephonyError GetDefaultSubscription(IntPtr handle, out Tizen.Telephony.Network.DefaultSubscription defaultSub); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_selection_mode")] + internal static extern Telephony.TelephonyError GetSelectionMode(IntPtr handle, out Tizen.Telephony.Network.SelectionMode mode); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_tac")] + internal static extern Telephony.TelephonyError GetTac(IntPtr handle, out int tac); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_system_id")] + internal static extern Telephony.TelephonyError GetSystemId(IntPtr handle, out int sid); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_network_id")] + internal static extern Telephony.TelephonyError GetNetworkId(IntPtr handle, out int nid); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_id")] + internal static extern Telephony.TelephonyError GetBaseStationId(IntPtr handle, out int bsId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_latitude")] + internal static extern Telephony.TelephonyError GetBaseStationLatitude(IntPtr handle, out int bsLatitude); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_network_get_base_station_longitude")] + internal static extern Telephony.TelephonyError GetBaseStationLongitude(IntPtr handle, out int bsLongitude); + } +} diff --git a/src/Tizen.Telephony/Interop/Interop.Sim.cs b/src/Tizen.Telephony/Interop/Interop.Sim.cs new file mode 100755 index 0000000..7e8c9f2 --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Sim.cs @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Sim Interop Class + /// + internal static partial class Sim + { + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_icc_id")] + internal static extern Telephony.TelephonyError GetIccId(IntPtr handle, out string iccId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_operator")] + internal static extern Telephony.TelephonyError GetOperator(IntPtr handle, out string simOperator); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_msin")] + internal static extern Telephony.TelephonyError GetMsin(IntPtr handle, out string msin); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_spn")] + internal static extern Telephony.TelephonyError GetSpn(IntPtr handle, out string spn); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_is_changed")] + internal static extern Telephony.TelephonyError IsChanged(IntPtr handle, out int isChanged); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_state")] + internal static extern Telephony.TelephonyError GetState(IntPtr handle, out Tizen.Telephony.Sim.State simState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_application_list")] + internal static extern Telephony.TelephonyError GetApplicationList(IntPtr handle, out uint appList); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_subscriber_number")] + internal static extern Telephony.TelephonyError GetSubscriberNumber(IntPtr handle, out string subscriberNumber); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_subscriber_id")] + internal static extern Telephony.TelephonyError GetSubscriberId(IntPtr handle, out string subscriberId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_lock_state")] + internal static extern Telephony.TelephonyError GetLockState(IntPtr handle, out Tizen.Telephony.Sim.LockState lockState); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_group_id1")] + internal static extern Telephony.TelephonyError GetGroupId1(IntPtr handle, out string gid1); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_sim_get_call_forwarding_indicator_state")] + internal static extern Telephony.TelephonyError GetCallForwardingIndicatorState(IntPtr handle, out bool state); + } +} diff --git a/src/Tizen.Telephony/Interop/Interop.Telephony.cs b/src/Tizen.Telephony/Interop/Interop.Telephony.cs new file mode 100755 index 0000000..446703d --- /dev/null +++ b/src/Tizen.Telephony/Interop/Interop.Telephony.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using Tizen.Telephony; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Telephony Interop Class + /// + internal static class Telephony + { + private const int TIZEN_ERROR_TELEPHONY = -0x02600000; + internal static string LogTag = "Tizen.Telephony"; + internal enum TelephonyError + { + None = Tizen.Internals.Errors.ErrorCode.None, + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, + OperationFailed = TIZEN_ERROR_TELEPHONY | 0x0001, + SIMNotAvailable = TIZEN_ERROR_TELEPHONY | 0x1001 + }; + + [StructLayout(LayoutKind.Sequential)] + internal struct HandleList + { + internal uint Count; + internal IntPtr HandleArrayPointer; + }; + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_set_noti_cb")] + internal static extern TelephonyError TelephonySetNotiCb(IntPtr handle, Tizen.Telephony.ChangeNotificationEventArgs.Notification notiId, NotificationCallback cb, IntPtr userData); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_unset_noti_cb")] + internal static extern TelephonyError TelephonyUnsetNotiCb(IntPtr handle, Tizen.Telephony.ChangeNotificationEventArgs.Notification notiId); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_init")] + internal static extern TelephonyError TelephonyInit(out HandleList list); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_deinit")] + internal static extern TelephonyError TelephonyDeinit(ref HandleList list); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_get_state")] + internal static extern TelephonyError TelephonyGetState(out State state); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_set_state_changed_cb")] + internal static extern TelephonyError TelephonySetStateChangedCb(StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Telephony, EntryPoint = "telephony_unset_state_changed_cb")] + internal static extern TelephonyError TelephonyUnsetStateChangedCb(StateChangedCallback callback); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void NotificationCallback(IntPtr handle, ChangeNotificationEventArgs.Notification notiId, IntPtr data, IntPtr userData); + + [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(State state, IntPtr userData); + } +} \ No newline at end of file diff --git a/src/Tizen.Telephony/Tizen.Telephony.csproj b/src/Tizen.Telephony/Tizen.Telephony.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Telephony/Tizen.Telephony.sln b/src/Tizen.Telephony/Tizen.Telephony.sln new file mode 100755 index 0000000..5496d16 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Telephony", "Tizen.Telephony.csproj", "{EF90160B-8DCD-4E41-84D2-0E600DE11A2B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{5EEFBC22-B72B-4691-8374-54B68A69427D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{E0AB6C62-2F27-4DD0-A7B9-CF6D35343124}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EF90160B-8DCD-4E41-84D2-0E600DE11A2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF90160B-8DCD-4E41-84D2-0E600DE11A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF90160B-8DCD-4E41-84D2-0E600DE11A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF90160B-8DCD-4E41-84D2-0E600DE11A2B}.Release|Any CPU.Build.0 = Release|Any CPU + {5EEFBC22-B72B-4691-8374-54B68A69427D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EEFBC22-B72B-4691-8374-54B68A69427D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EEFBC22-B72B-4691-8374-54B68A69427D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EEFBC22-B72B-4691-8374-54B68A69427D}.Release|Any CPU.Build.0 = Release|Any CPU + {E0AB6C62-2F27-4DD0-A7B9-CF6D35343124}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0AB6C62-2F27-4DD0-A7B9-CF6D35343124}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0AB6C62-2F27-4DD0-A7B9-CF6D35343124}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0AB6C62-2F27-4DD0-A7B9-CF6D35343124}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Telephony/Tizen.Telephony/Call.cs b/src/Tizen.Telephony/Tizen.Telephony/Call.cs new file mode 100644 index 0000000..3171005 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/Call.cs @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// The Call API's allows you to get the voice and video call states. + /// It provides the List of CallHandle which can be used to get the information about call related actions. + /// + public class Call + { + internal IntPtr _handle; + private List _callHandle = new List(); + private List _list = new List(); + private IntPtr _callList; + private Interop.Call.SafeCallList _safeCallList; + + /// + /// Public Constructor + /// + /// 3 + /// + /// SlotHandle received in the Manager.Init API + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This exception occurs if handle provided is null + /// + public Call(SlotHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException(); + } + + _handle = handle._handle; + } + + /// + /// Gets the current value for the preferred voice call subscription. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The currently set preferred voicecall subscription value. + /// + public CallPreferredVoiceSubscription PreferredVoiceSubscription + { + get + { + CallPreferredVoiceSubscription subs = CallPreferredVoiceSubscription.Unknown; + TelephonyError error = Interop.Call.GetPreferredVoiceSubscription(_handle, out subs); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetPreferredVoiceSubscription Failed with error " + error); + return CallPreferredVoiceSubscription.Unknown; + } + + return subs; + } + } + + /// + /// Gets the list of the current call. + /// + /// 3 + /// + /// List of CallHandle for existing calls. + /// + /// http://tizen.org/privilege/telephony + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// Incase of Invalid parameter + /// Incase of any System error + /// Incase of Privileges are not defined + /// Incase of Out of Memory + public IEnumerable GetCallHandleList() + { + uint count; + _callList = new IntPtr(); + _list.Clear(); + TelephonyError error = Interop.Call.GetCallList(_handle, out count, out _callList); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCallList Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + _callHandle.Clear(); + if (count > 0) + { + IntPtr[] handleArray = new IntPtr[count]; + Marshal.Copy(_callList, handleArray, 0, (int)count); + foreach (IntPtr handle in handleArray) + { + CallHandle info = new CallHandle(handle); + _list.Add(info); + } + + _safeCallList = new Interop.Call.SafeCallList(_callList, count); + } + return _list; + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs b/src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs new file mode 100644 index 0000000..7d6de9c --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/CallHandle.cs @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// This Class provides API's to get the information about calls. + /// + public class CallHandle + { + private IntPtr _callHandle; + + /// + /// Enumeration for the call status. + /// + public enum CallStatus + { + /// + /// Idle status + /// + Idle, + /// + /// Active status + /// + Active, + /// + /// Held status + /// + Held, + /// + /// Dialing status + /// + Dialing, + /// + /// Alerting status + /// + Alerting, + /// + /// Incoming status + /// + Incoming, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the call type. + /// + public enum CallType + { + /// + /// Voice call + /// + Voice, + /// + /// Video call + /// + Video, + /// + /// Emergency call + /// + E911, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the call direction. + /// + public enum CallDirection + { + /// + /// MO(Mobile Originated) call + /// + Mo, + /// + /// MT(Mobile Terminated) call + /// + Mt, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Gets the call handle ID. + /// + /// 3 + /// + /// The id of the call handle + /// 0 if unable to complete the operation + /// + public uint HandleId + { + get + { + uint handleId; + TelephonyError error = Interop.Call.GetHandleId(_callHandle, out handleId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetHandleId Failed with Error " + error); + return 0; + } + + return handleId; + } + } + + /// + /// Gets the call number. + /// + /// 3 + /// + /// The number of the call + /// empty string if unable to complete the operation + /// + public string Number + { + get + { + string number; + TelephonyError error = Interop.Call.GetNumber(_callHandle, out number); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNumber Failed with Error " + error); + return ""; + } + + return number; + } + } + + /// + /// Gets the call type. + /// + /// 3 + /// + /// The type of the call + /// + public CallType Type + { + get + { + CallType callType; + TelephonyError error = Interop.Call.GetType(_callHandle, out callType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetType Failed with Error " + error); + return CallType.Unavailable; + } + + return callType; + } + } + + /// + /// Gets the call status. + /// + /// 3 + /// + /// The status of the call + /// + public CallStatus Status + { + get + { + CallStatus callStatus; + TelephonyError error = Interop.Call.GetStatus(_callHandle, out callStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetStatus Failed with Error " + error); + return CallStatus.Unavailable; + } + + return callStatus; + } + } + + /// + /// Gets whether the call is MO(Mobile Originated) call or MT(Mobile Terminated). + /// + /// 3 + /// + /// The direction of the call + /// + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// + public CallDirection Direction + { + get + { + CallDirection callDirection; + TelephonyError error = Interop.Call.GetDirection(_callHandle, out callDirection); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDirection Failed with Error " + error); + return CallDirection.Unavailable; + } + + return callDirection; + } + + } + + /// + /// Gets whether the call is conference call or not. + /// + /// 3 + /// + /// The value whether the call is conference call or not. (true: Conference call, false: Single call) + /// + public bool ConferenceStatus + { + get + { + bool callConfStatus; + TelephonyError error = Interop.Call.GetConferenceStatus(_callHandle, out callConfStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetConferenceStatus Failed with Error " + error); + return false; + } + + return callConfStatus; + } + + } + + internal CallHandle(IntPtr handle) + { + _callHandle = handle; + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs b/src/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs new file mode 100644 index 0000000..da04afe --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/ChangeNotificationEventArgs.cs @@ -0,0 +1,319 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace Tizen.Telephony +{ + /// + /// This Class contains the data related to the Notification event + /// + public class ChangeNotificationEventArgs : EventArgs + { + internal ChangeNotificationEventArgs(Notification noti, object data) + { + NotificationType = noti; + NotificationData = data; + } + + /// + /// Enumeration for Telephony notification. + /// + public enum Notification + { + /// + /// Notification to be invoked when the SIM card state changes. + /// SIM.State will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + SimStatus = 0x10, + /// + /// Notification to be invoked when the SIM call forwarding indicator state changes. + /// 'state(bool)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + SimCallForwardingIndicatorState, + /// + /// Notification to be invoked when the network service state changes. + /// Network.ServiceState will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkServiceState = 0x20, + /// + /// Notification to be invoked when the cell ID changes. + /// 'cell_id(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkCellid, + /// + /// Notification to be invoked when the roaming status changes. + /// 'roaming_status(bool)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkRoamingStatus, + /// + /// Notification to be invoked when the signal strength changes. + /// Network.Rssi will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkSignalstrengthLevel, + /// + /// Notification to be invoked when the network name changes. + /// 'network_name(string)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkNetworkName, + /// + /// Notification to be invoked when the ps type changes. + /// Network.PSType will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkPsType, + /// + /// Notification to be invoked when the default data subscription changes. + /// Network.DefaultDataSubscription will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkDefaultDataSubscription, + /// + /// Notification to be invoked when the default subscription changes. + /// Network.DefaultSubscription will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + NetworkDefaultSubscription, + /// + /// Notification to be invoked when the LAC (Location Area Code) changes. + /// 'lac(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkLac, + /// + /// Notification to be invoked when the TAC (Tracking Area Code) changes. + /// 'tac(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkTac, + /// + /// Notification to be invoked when the system ID changes. + /// 'sid(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkSystemId, + /// + /// Notification to be invoked when the network ID changes. + /// 'nid(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkId, + /// + /// Notification to be invoked when the base station ID changes. + /// 'id(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsId, + /// + /// Notification to be invoked when the base station latitude changes. + /// 'latitude(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsLatitude, + /// + /// Notification to be invoked when the base station longitude changes. + /// 'longitue(int)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/location.coarse + /// + NetworkBsLongitude, + /// + /// Notification to be invoked when a voice call is in idle status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusIdle, + /// + /// Notification to be invoked when a voice call is in active status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusActive, + /// + /// Notification to be invoked when a voice call is in held status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusHeld, + /// + /// Notification to be invoked when a voice call is in dialing status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusDialing, + /// + /// Notification to be invoked when a voice call is in alertingstatus. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusAlerting, + /// + /// Notification to be invoked when a voice call is in incoming status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VoiceCallStatusIncoming, + /// + /// Notification to be invoked when a video call is in idle status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusIdle, + /// + /// Notification to be invoked when a video call is in active status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusActive, + /// + /// Notification to be invoked when a video call is in dialing status. + /// 'handle id(uint)' will be delivered in notification data. + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusDialing, + /// + /// Notification to be invoked when a video call is in alerting status. + /// 'handle id(uint)' will be delivered in notification data + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusAlerting, + /// + /// Notification to be invoked when a video call is in incoming status. + /// 'handle id(uint)' will be delivered in notification data + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + VideoCallStatusIncoming, + /// + /// Notification to be invoked when the preferred voice subscription changes. + /// CallPreferredVoiceSubscription will be delivered in notification data + /// + /// 3 + /// + /// http://tizen.org/privilege/telephony + /// + CallPreferredVoiceSubscription + }; + + /// + /// Telephony notification type + /// + /// 3 + public Notification NotificationType + { + get; + internal set; + } + + /// + /// Data as per the Notification type + /// + /// 3 + public object NotificationData + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs b/src/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs new file mode 100644 index 0000000..885b138 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/ExceptionFactory.cs @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Telephony +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(Interop.Telephony.TelephonyError err) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "Error " + err); + Exception exp; + switch (err) + { + case Interop.Telephony.TelephonyError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case Interop.Telephony.TelephonyError.NotSupported: + { + exp = new NotSupportedException("Not Supported"); + break; + } + + case Interop.Telephony.TelephonyError.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case Interop.Telephony.TelephonyError.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case Interop.Telephony.TelephonyError.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + case Interop.Telephony.TelephonyError.SIMNotAvailable: + { + exp = new InvalidOperationException("SIM is Not Available"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + } + + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/Modem.cs b/src/Tizen.Telephony/Tizen.Telephony/Modem.cs new file mode 100644 index 0000000..b689eb9 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/Modem.cs @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Telephony; +namespace Tizen.Telephony +{ + /// + /// This Class provides API's to obtain information from the modem. + /// + public class Modem + { + internal IntPtr _handle; + + /// + /// Modem Class Constructor + /// + /// 3 + /// + /// SlotHandle received in the Manager.Init API + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This exception occurs if handle provided is null + /// + public Modem(SlotHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException(); + } + + _handle = handle._handle; + } + + /// + /// Enumeration for Modem Power Status. + /// + public enum PowerStatus + { + /// + /// Unknown + /// + Unknown = -1, + /// + /// Modem power ON + /// + On, + /// + /// Modem power OFF + /// + Off, + /// + /// Modem power RESET + /// + Reset, + /// + /// Modem power LOW + /// + Low + }; + + /// + /// Gets the IMEI (International Mobile Station Equipment Identity) of a mobile phone. + /// The IMEI number is used by a GSM network to identify valid devices and therefore can be used for stopping a stolen phone from accessing that network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The International Mobile Station Equipment Identity + /// empty string if unable to complete the operation + /// + public string Imei + { + get + { + string imei; + TelephonyError error = Interop.Modem.GetImei(_handle, out imei); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error); + return ""; + } + + return imei; + } + } + + /// + /// Gets the power status of the modem. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Modem power status (0=on,1=off,2=reset,3=low) + /// + public PowerStatus CurrentPowerStatus + { + get + { + PowerStatus status; + TelephonyError error = Interop.Modem.GetPowerStatus(_handle, out status); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetImei Failed with error " + error); + return PowerStatus.Unknown; + } + + return status; + } + + } + + /// + /// Gets the MEID (Mobile Equipment Identifier) of a mobile phone. (for CDMA) + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Mobile Equipment Identifier + /// empty string if unable to complete the operation + /// + public string Meid + { + get + { + string meid; + TelephonyError error = Interop.Modem.GetMeid(_handle, out meid); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMeid Failed with error " + error); + return ""; + } + + return meid; + } + + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/Network.cs b/src/Tizen.Telephony/Tizen.Telephony/Network.cs new file mode 100644 index 0000000..f8e072a --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/Network.cs @@ -0,0 +1,831 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Telephony; +namespace Tizen.Telephony +{ + /// + /// The Network class provides API's to obtain information about the current telephony service network. + /// + public class Network + { + internal IntPtr _handle; + + /// + /// Network Class Constructor + /// + /// 3 + /// + /// SlotHandle received in the Manager.Init API + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This exception occurs if handle provided is null + /// + public Network(SlotHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException(); + } + + _handle = handle._handle; + } + + /// + /// Enumeration for RSSI (Receive Signal Strength Indicator). + /// Rssi6 indicates the highest strength. + /// + public enum Rssi + { + /// + /// Strength 0 + /// + Rssi0, + /// + /// Strength 1 + /// + Rssi1, + /// + /// Strength 2 + /// + Rssi2, + /// + /// Strength 3 + /// + Rssi3, + /// + /// Strength 4 + /// + Rssi4, + /// + /// Strength 5 + /// + Rssi5, + /// + /// Strength 6 + /// + Rssi6, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Enumeration for Network Type. + /// + public enum Type + { + /// + /// Unknown + /// + Unknown, + /// + /// 2G GSM network type + /// + Gsm, + /// + /// 2.5G GPRS network type + /// + Gprs, + /// + /// 2.5G EDGE network type + /// + Edge, + /// + /// 3G UMTS network type + /// + Umts, + /// + /// HSDPA network type + /// + Hsdpa, + /// + /// LTE network type + /// + Lte, + /// + /// IS95A network type + /// + Is95a, + /// + /// IS95B network type + /// + Is95b, + /// + /// CDMA 1x network type + /// + Cdma1X, + /// + /// EVDO revision 0 network type + /// + EvdoRev0, + /// + /// EVDO revision A network type + /// + EvdoRevA, + /// + /// EVDO revision B network type + /// + EvdoRevB, + /// + /// EVDV network type + /// + Evdv, + /// + /// EHRPD network type + /// + Ehrpd + } + + /// + /// Enumeration for PS Type. + /// + public enum PsType + { + /// + /// Unknown + /// + Unknown, + /// + /// HSDPA ps type + /// + Hsdpa, + /// + /// HSUPA ps type + /// + Hsupa, + /// + /// HSPA ps type + /// + Hspa, + /// + /// HSPAP ps type + /// + Hspap + } + + /// + /// Enumeration for Network Service State. + /// + public enum ServiceState + { + /// + /// In service + /// + InService, + /// + /// Out of service + /// + OutOfService, + /// + /// Only emergency call is allowed + /// + EmergencyOnly, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Enumeration for Network Name Priority. + /// + public enum NameOption + { + /// + /// Unknown + /// + Unknown, + /// + /// Network name displayed by SPN + /// + Spn, + /// + /// Network name displayed by Network + /// + Network, + /// + /// Network name displayed by SPN or Network + /// + Any + } + + /// + /// Enumeration for the possible 'default' Data Subscriptions for Packet Switched(PS). + /// + public enum DefaultDataSubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// SIM 1 + /// + Sim1, + /// + /// SIM 2 + /// + Sim2 + } + + /// + /// Enumeration defines possible 'default' Subscriptions for Circuit Switched(CS). + /// + public enum DefaultSubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// SIM 1 network + /// + Sim1, + /// + /// SIM 2 network + /// + Sim2 + } + + /// + /// Enumeration for network selection mode. + /// + public enum SelectionMode + { + /// + /// Automatic mode + /// + Automatic, + /// + /// Manual mode + /// + Manual, + /// + /// Unavailable + /// + Unavailable + } + + /// + /// Gets the LAC (Location Area Code) of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in GSM / WCDMA network. + /// + /// + /// The Location Area Code, -1 if unknown + /// + public int Lac + { + get + { + int lac; + TelephonyError error = Interop.Network.GetLac(_handle, out lac); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetLac Failed with error " + error); + return -1; + } + + Log.Info(Interop.Telephony.LogTag, "Lac Value " + lac); + return lac; + } + + } + + /// + /// Gets the cell ID of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The cell identification number, -1 if unknown + /// + public int CellId + { + get + { + int cellId; + TelephonyError error = Interop.Network.GetCellId(_handle, out cellId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCellId Failed with error " + error); + return -1; + } + + Log.Info(Interop.Telephony.LogTag, "CellId Value " + cellId); + return cellId; + } + } + + /// + /// Gets the RSSI (Received Signal Strength Indicator). + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Received Signal Strength Indicator + /// Higher the received number, the stronger the signal strength. + /// + public Rssi CurrentRssi + { + get + { + Rssi currentRssi; + TelephonyError error = Interop.Network.GetRssi(_handle, out currentRssi); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetRssi Failed with error " + error); + return Rssi.Unavailable; + } + + Log.Info(Interop.Telephony.LogTag, "CurrentRssi Value " + currentRssi); + return currentRssi; + } + } + + /// + /// Gets the roaming state of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// true if roaming, otherwise false if not roaming + /// + public bool RoamingStatus + { + get + { + bool roamingStatus; + TelephonyError error = Interop.Network.GetRoamingStatus(_handle, out roamingStatus); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetRoamingStatus Failed with error " + error); + return false; + } + + return roamingStatus; + } + } + + /// + /// Gets the MCC (Mobile Country Code) of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The Mobile Country Code (three digits) Mobile Country Code (MCC) identifies the country where the cell is being used. + /// empty string if unknown. + /// + public string Mcc + { + get + { + string mcc; + TelephonyError error = Interop.Network.GetMcc(_handle, out mcc); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMcc Failed with error " + error); + return ""; + } + + return mcc; + } + } + + /// + /// Gets the MNC (Mobile Network Code) of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The Mobile Network Code (three digits) The Mobile Network Code (MNC) identifies the mobile phone operator and network provider. + /// empty string if unknown. + /// + public string Mnc + { + get + { + string mnc; + TelephonyError error = Interop.Network.GetMnc(_handle, out mnc); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMnc Failed with error " + error); + return ""; + } + + return mnc; + } + } + + /// + /// Gets the name of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// This API can be used in GSM / WCDMA / LTE network. + /// + /// + /// The name of the current registered network + /// empty string if unknown. + /// + public string NetworkName + { + get + { + string networkName; + TelephonyError error = Interop.Network.GetNetworkName(_handle, out networkName); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkName Failed with error " + error); + return ""; + } + + return networkName; + } + } + + /// + /// Gets the network service type of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// This API can be used in case network is in service. + /// + /// + /// The network service type + /// + public Type NetworkType + { + get + { + Type networkType; + TelephonyError error = Interop.Network.GetType(_handle, out networkType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetType Failed with error " + error); + return Type.Unknown; + } + + return networkType; + } + } + + /// + /// Gets the packet service type of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// This API can be used in HSDPA network. + /// + /// + /// The type of packet service + /// + public PsType NetworkPsType + { + get + { + PsType networkPsType; + TelephonyError error = Interop.Network.GetPsType(_handle, out networkPsType); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetPsType Failed with error " + error); + return PsType.Unknown; + } + + return networkPsType; + } + + } + + /// + /// Gets the network name option of the current registered network. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The network name display option + /// + public NameOption NetworkNameOption + { + get + { + NameOption networkNameOption; + TelephonyError error = Interop.Network.GetNetworkNameOption(_handle, out networkNameOption); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkNameOption Failed with error " + error); + return NameOption.Unknown; + } + + return networkNameOption; + } + + } + + /// + /// Gets the current network state of the telephony service. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The current network state + /// + public ServiceState NetworkServiceState + { + get + { + ServiceState networkServiceState; + TelephonyError error = Interop.Network.GetServiceState(_handle, out networkServiceState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetServiceState Failed with error " + error); + return ServiceState.Unavailable; + } + + return networkServiceState; + } + + } + + /// + /// Gets the current default subscription for data service (Packet Switched). + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The current default data subscription + /// + public DefaultDataSubscription NetworkDefaultDataSubscription + { + get + { + DefaultDataSubscription networkDefaultDataSubs; + TelephonyError error = Interop.Network.GetDefaultDataSubscription(_handle, out networkDefaultDataSubs); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDefaultDataSubscription Failed with error " + error); + return DefaultDataSubscription.Unknown; + } + + return networkDefaultDataSubs; + } + + } + + /// + /// Gets the current default subscription for voice service (Circuit Switched). + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The current default voice subscription + /// + public DefaultSubscription NetworkDefaultSubscription + { + get + { + DefaultSubscription networkDefaultSubscription; + TelephonyError error = Interop.Network.GetDefaultSubscription(_handle, out networkDefaultSubscription); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetDefaultSubscription Failed with error " + error); + return DefaultSubscription.Unknown; + } + + return networkDefaultSubscription; + } + + } + + /// + /// Gets the network selection mode. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The network selection mode. + /// + public SelectionMode NetworkSelectionMode + { + get + { + SelectionMode networkSelectionMode; + TelephonyError error = Interop.Network.GetSelectionMode(_handle, out networkSelectionMode); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSelectionMode Failed with error " + error); + return SelectionMode.Unavailable; + } + + return networkSelectionMode; + } + + } + + /// + /// Gets the TAC (Tracking Area Code) of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in LTE network. + /// + /// + /// The Tracking Area Code + /// -1 if unknown + /// + public int Tac + { + get + { + int tac; + TelephonyError error = Interop.Network.GetTac(_handle, out tac); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetTac Failed with error " + error); + return -1; + } + + return tac; + } + + } + + /// + /// Gets the system ID of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in CDMA network. + /// + /// + /// The system ID + /// -1 if unknown + /// + public int SystemId + { + get + { + int systemId; + TelephonyError error = Interop.Network.GetSystemId(_handle, out systemId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSystemId Failed with error " + error); + return -1; + } + + return systemId; + } + + } + + /// + /// Gets the network ID of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in CDMA network. + /// + /// + /// The network ID + /// -1 if unknown + /// + public int NetworkId + { + get + { + int networkId; + TelephonyError error = Interop.Network.GetNetworkId(_handle, out networkId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetNetworkId Failed with error " + error); + return -1; + } + + return networkId; + } + + } + + /// + /// Gets the base station ID of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse> + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station ID + /// -1 if unknown + /// + + public int BaseStationId + { + get + { + int baseStationId; + TelephonyError error = Interop.Network.GetBaseStationId(_handle, out baseStationId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationId Failed with error " + error); + return -1; + } + + return baseStationId; + } + + } + + /// + /// Gets the base station latitude of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station latitude + /// 0x7FFFFFFF if unknown + /// + public int BaseStationLatitude + { + get + { + int baseStationLatitude; + TelephonyError error = Interop.Network.GetBaseStationLatitude(_handle, out baseStationLatitude); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationLatitude Failed with error " + error); + return 0x7FFFFFFF; + } + + return baseStationLatitude; + } + } + + /// + /// Gets the base station longitude of the current location. + /// + /// 3 + /// http://tizen.org/privilege/location.coarse + /// + /// This API can be used in CDMA network. + /// + /// + /// The base station latitude + /// 0x7FFFFFFF if unknown + /// + public int BaseStationLongitude + { + get + { + int baseStationLongitude; + TelephonyError error = Interop.Network.GetBaseStationLongitude(_handle, out baseStationLongitude); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetBaseStationLongitude Failed with error " + error); + return 0x7FFFFFFF; + } + + return baseStationLongitude; + } + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/Sim.cs b/src/Tizen.Telephony/Tizen.Telephony/Sim.cs new file mode 100644 index 0000000..f00383f --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/Sim.cs @@ -0,0 +1,465 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// This Class provides API's that allows you to extract information stored on a SIM card + /// + public class Sim + { + internal IntPtr _handle; + + /// + /// Sim Class Constructor + /// + /// 3 + /// + /// SlotHandle received in the Manager.Init API + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This exception occurs if handle provided is null + /// + public Sim(SlotHandle handle) + { + if (handle == null) + { + throw new ArgumentNullException(); + } + + _handle = handle._handle; + } + + /// + /// Enumeration for the state of SIM card. + /// + public enum State + { + /// + /// SIM is not available on this device + /// + Unavailable, + /// + /// SIM is locked + /// + Locked, + /// + /// SIM is available on this device (SIM is not locked) + /// + Available, + /// + /// SIM is in transition between states + /// + Unknown + } + + /// + /// Enumeration for the lock state of SIM card. + /// + public enum LockState + { + /// + /// SIM is not in lock + /// + Unknown, + /// + /// SIM is PIN(Personal Identification Number) locked + /// + PinRequired, + /// + /// SIM is PUK(Personal Unblocking Code) locked + /// + PukRequired, + /// + /// SIM is permanently blocked(All the attempts for PIN/PUK failed) + /// + PermLocked, + /// + /// SIM is NCK(Network Control Key) locked + /// + NckRequired + } + + /// + /// Enumeration for the type of SIM card. + /// + public enum ApplicationType + { + /// + /// SIM(GSM) Application + /// + Sim = 0x01, + /// + /// USIM Application + /// + Usim = 0x02, + /// + /// CDMA Application + /// + Csim = 0x04, + /// + /// ISIM Application + /// + Isim = 0x08 + } + + /// + /// Gets the Integrated Circuit Card IDentification (ICC-ID). + /// The Integrated Circuit Card Identification number internationally identifies SIM cards. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Integrated Circuit Card Identification + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string IccId + { + get + { + string iccId; + TelephonyError error = Interop.Sim.GetIccId(_handle, out iccId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetIccId Failed with error " + error); + return ""; + } + + return iccId; + } + } + + /// + /// Gets the SIM Operator (MCC [3 digits] + MNC [2~3 digits]). + /// The Operator is embedded in the SIM card. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The SIM Operator + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Operator + { + get + { + string simOperator; + TelephonyError error = Interop.Sim.GetOperator(_handle, out simOperator); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetOperator Failed with error " + error); + return ""; + } + + return simOperator; + } + } + + /// + /// Gets the Mobile Subscription Identification Number (MSIN [9~10 digits]) of the SIM provider. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Mobile Subscription Identification Number + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Msin + { + get + { + string msin; + TelephonyError error = Interop.Sim.GetMsin(_handle, out msin); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetMsin Failed with error " + error); + return ""; + } + + return msin; + } + } + + /// + /// Gets the Service Provider Name (SPN) of the SIM card. + /// Gets Service Provider Name embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The Service Provider Name + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string Spn + { + get + { + string spn; + TelephonyError error = Interop.Sim.GetSpn(_handle, out spn); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSpn Failed with error " + error); + return ""; + } + + return spn; + } + } + + /// + /// Checks whether the current SIM card is different from the previous SIM card. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// true if the current SIM card is different from the previous SIM card, otherwise false if the SIM card is not changed + /// + /// + /// The SIM state must be Available + /// + public bool IsChanged + { + get + { + int ischanged; + bool isChanged = false; ; + TelephonyError error = Interop.Sim.IsChanged(_handle, out ischanged); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "IsChanged Failed with error " + error); + return false; + } + + if (ischanged > 0) + { + isChanged = true; + } + + return isChanged; + } + } + + /// + /// Gets the state of the SIM. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The current state of the SIM + /// + public State CurrentState + { + get + { + State currentState; + TelephonyError error = Interop.Sim.GetState(_handle, out currentState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with error " + error); + return State.Unavailable; + } + + return currentState; + } + } + + /// + /// Gets the count of application on UICC. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The masking value for below values are provided by the enum ApplicationType + /// 0 if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public uint ApplicationList + { + get + { + uint appList; + TelephonyError error = Interop.Sim.GetApplicationList(_handle, out appList); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetApplicationList Failed with error " + error); + return 0; + } + + return appList; + } + } + + /// + /// Gets subscriber number embedded in the SIM card. This value contains MSISDN related to the subscriber. + /// If this value is not stored in SIM card, empty string will be returned. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The subscriber number in the SIM + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string SubscriberNumber + { + get + { + string subscriberNumber; + TelephonyError error = Interop.Sim.GetSubscriberNumber(_handle, out subscriberNumber); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSubscriberNumber Failed with error " + error); + return ""; + } + + return subscriberNumber; + } + } + + /// + /// Gets the Subscriber ID. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The subscriber ID + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string SubscriberId + { + get + { + string subscriberId; + TelephonyError error = Interop.Sim.GetSubscriberId(_handle, out subscriberId); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetSubscriberId Failed with error " + error); + return ""; + } + + return subscriberId; + } + } + + /// + /// Gets the lock state of the SIM. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The current lock state of the SIM + /// + /// + /// The SIM state must be Available + /// + public LockState CurrentLockState + { + get + { + LockState currentLockState; + TelephonyError error = Interop.Sim.GetLockState(_handle, out currentLockState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetLockState Failed with error " + error); + return LockState.Unknown; + } + + return currentLockState; + } + } + + /// + /// Gets the GID1 (Group Identifier Level 1). + /// Gets Group Identifier Level 1(GID1) embedded in the SIM card.If this value is not stored in SIM card, empty string will be returned. + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The GID1 (Group Identifier Level 1) + /// empty string if unable to complete the operation + /// + /// + /// The SIM state must be Available + /// + public string GroupId1 + { + get + { + string groupId1; + TelephonyError error = Interop.Sim.GetGroupId1(_handle, out groupId1); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetGroupId1 Failed with error " + error); + return ""; + } + + return groupId1; + } + } + + /// + /// Gets the call forwarding indicator state of the SIM. + /// If the state is true, incoming call will be forwarded to the selected number.state indicates the CFU(Call Forwarding Unconditional) indicator status - Voice. (3GPP TS 31.102 4.2.64 EF CFIS) + /// + /// 3 + /// http://tizen.org/privilege/telephony + /// + /// The value whether incoming call will be forwarded or not. (true: forwarded, false: not forwarded) + /// + /// + /// The SIM state must be Available + /// + public bool CallForwardingIndicatorState + { + get + { + bool callForwardingIndicatorState; + TelephonyError error = Interop.Sim.GetCallForwardingIndicatorState(_handle, out callForwardingIndicatorState); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetCallForwardingIndicatorState Failed with error " + error); + return false; + } + + return callForwardingIndicatorState; + } + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs b/src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs new file mode 100644 index 0000000..967f781 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/SlotHandle.cs @@ -0,0 +1,309 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.Telephony +{ + /// + /// This Class provides API's that provides functionality related to slot handle. + /// + public class SlotHandle + { + internal IntPtr _handle; + private List _changeNotificationList = new List(); + + internal SlotHandle(IntPtr handle) + { + _handle = handle; + } + + /// + /// Event Handler for Receiving the Telephony State Changes + /// this event will be triggered for the NotificationId's given in the SetNotificationId API + /// + public event EventHandler ChangeNotification; + + internal IntPtr Handle + { + get + { + return _handle; + } + } + + /// + /// The Notification Id's for which the ChangeNotification event will be triggered + /// + /// 3 + /// + /// The List of Notification Id's for which the ChangeNotification event will be triggered + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// 2. Operation Failed + /// + public void SetNotificationId(IEnumerable list) + { + try + { + foreach (ChangeNotificationEventArgs.Notification n in list) + { + SetCallback(n); + } + } + catch (Exception e) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "SetNotificationId Failed with Error " + e.ToString()); + throw e; + } + } + + /// + /// The Notification Id's for which the ChangeNotification event will not be triggered + /// + /// 3 + /// + /// The List of Notification Id's for which the ChangeNotification event will be not be triggered + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This Exception can occur due to: + /// 1. Operation Not Supported + /// 2. Operation Failed + /// + public void RemoveNotificationId(IEnumerable list) + { + foreach (ChangeNotificationEventArgs.Notification n in list) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonyUnsetNotiCb(_handle, n); + if (error != Interop.Telephony.TelephonyError.None) + { + throw ExceptionFactory.CreateException(error); + } + } + } + + private void SetCallback(ChangeNotificationEventArgs.Notification n) + { + Interop.Telephony.NotificationCallback NotificationDelegate = (IntPtr handle, ChangeNotificationEventArgs.Notification notiId, IntPtr data, IntPtr userData) => + { + SlotHandle simHandle = Manager.FindHandle(handle); + object notiData = null; + switch (notiId) + { + case ChangeNotificationEventArgs.Notification.SimStatus: + { + notiData = (Sim.State)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.SimCallForwardingIndicatorState: + { + notiData = ((Marshal.ReadInt32(data) == 0) ? false : true); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkServiceState: + { + notiData = (Network.ServiceState)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkCellid: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkRoamingStatus: + { + notiData = (Marshal.ReadInt32(data) == 0) ? false : true; + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkSignalstrengthLevel: + { + notiData = (Network.Rssi)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkNetworkName: + { + notiData = Marshal.PtrToStringAnsi(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkPsType: + { + notiData = (Network.PsType)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkDefaultDataSubscription: + { + notiData = (Network.DefaultDataSubscription)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkDefaultSubscription: + { + notiData = (Network.DefaultSubscription)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkLac: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkTac: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkSystemId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsId: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsLatitude: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.NetworkBsLongitude: + { + notiData = Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusIdle: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusActive: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusHeld: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusDialing: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusAlerting: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VoiceCallStatusIncoming: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusIdle: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusActive: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusDialing: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusAlerting: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.VideoCallStatusIncoming: + { + notiData = (uint)Marshal.ReadInt32(data); + break; + } + + case ChangeNotificationEventArgs.Notification.CallPreferredVoiceSubscription: + { + notiData = (CallPreferredVoiceSubscription)Marshal.ReadInt32(data); + break; + } + + } + + ChangeNotificationEventArgs args = new ChangeNotificationEventArgs(notiId, notiData); + ChangeNotification?.Invoke(simHandle, args); + }; + _changeNotificationList.Add(NotificationDelegate); + + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonySetNotiCb(_handle, n, NotificationDelegate, IntPtr.Zero); + if (error != Interop.Telephony.TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(error); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs b/src/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs new file mode 100644 index 0000000..a7b4e4c --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/StateEventArgs.cs @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +namespace Tizen.Telephony +{ + /// + /// This class contain the data related to the State changed event + /// + public class StateEventArgs : EventArgs + { + internal StateEventArgs(State s) + { + CurrentState = s; + } + + /// + /// The Current State + /// + /// 3 + public State CurrentState + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Telephony/Tizen.Telephony/Telephony.cs b/src/Tizen.Telephony/Tizen.Telephony/Telephony.cs new file mode 100644 index 0000000..203e2c6 --- /dev/null +++ b/src/Tizen.Telephony/Tizen.Telephony/Telephony.cs @@ -0,0 +1,241 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Telephony; + +namespace Tizen.Telephony +{ + /// + /// Enumeration for the telephony state. + /// + public enum State + { + /// + /// Telephony state is not ready + /// + NotReady, + /// + /// Telephony state is ready + /// + Ready, + /// + /// Unavailable + /// + Unavailable + }; + + /// + /// Enumeration for the preferred voice call subscription. + /// + public enum CallPreferredVoiceSubscription + { + /// + /// Unknown status + /// + Unknown = -1, + /// + /// Current network + /// + CurrentNetwork = 0, + /// + /// ASK Always + /// + AskAlways, + /// + /// SIM 1 + /// + Sim1, + /// + /// SIM 2 + /// + Sim2 + }; + + /// + /// This Class provides API's to Initialize and Deinitialize the framework + /// it also provides API's to get the SlotHandle's which can then be used to get other Network/Sim/Call/Modem Information. + /// + public static class Manager + { + internal static List _telephonyHandle = new List(); + private static HandleList _handleList; + private static bool _isInitialized = false; + private static event EventHandler _stateChanged; + private static StateChangedCallback stateDelegate = delegate(State state, IntPtr userData) + { + StateEventArgs args = new StateEventArgs(state); + _stateChanged?.Invoke(null, args); + }; + + /// + /// Event Handler to be invoked when the telephony state changes. + /// + /// 3 + public static event EventHandler StateChanged + { + add + { + if (_stateChanged == null) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonySetStateChangedCb(stateDelegate, IntPtr.Zero); + if (error != TelephonyError.None) + { + Log.Error(LogTag, "Add StateChanged Failed with Error: " + error); + } + + else + { + _stateChanged += value; + } + + } + } + + remove + { + _stateChanged -= value; + if (_stateChanged == null) + { + Interop.Telephony.TelephonyError error = Interop.Telephony.TelephonyUnsetStateChangedCb(stateDelegate); + if (error != TelephonyError.None) + { + Log.Error(LogTag, "Remove StateChanged Failed with Error: " + error); + } + } + } + } + + /// + /// Acquires the telephony state value. + /// + /// 3 + /// + /// The state value of telephony. + /// + public static State CurrentState + { + get + { + State state = State.NotReady; + TelephonyError error = Interop.Telephony.TelephonyGetState(out state); + if (error != TelephonyError.None) + { + Tizen.Log.Error(Interop.Telephony.LogTag, "GetState Failed with Error " + error); + return State.Unavailable; + } + + return state; + } + } + + /// + /// Acquires the Number of available handles to use the telephony API. + /// + /// 3 + /// + /// A List of Telephony handles. + /// You will get 2 SlotHandles in case of dual SIM device. + /// where,SlotHandle at Index '0' represents Primary SIM and Index '1' represents Secondary SIM. + /// + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This Exception can will be generated in the following cases + /// 1. System is out of memory + /// 2. If the operation is not supported on device + /// 3. If the Operation Failed + /// + public static IEnumerable Init() + { + //DeInitialize Previous Handles if present + if (_isInitialized) + { + Deinit(); + } + + TelephonyError err = Interop.Telephony.TelephonyInit(out _handleList); + if (err != TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(err); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + + int offset = 0; + for (int i = 0; i < _handleList.Count; i++) + { + _telephonyHandle.Add(new SlotHandle(Marshal.ReadIntPtr(_handleList.HandleArrayPointer, offset))); + offset += Marshal.SizeOf(_handleList.HandleArrayPointer); + } + + _isInitialized = true; + //Tizen.Log.Info(Interop.Telephony.LogTag, "Returning the number of sims " + _handleList.Count); + return _telephonyHandle; + } + + /// + /// Deinitializes the telephony handles. + /// + /// 3 + /// http://tizen.org/feature/network.telephony + /// The required feature is not supported. + /// + /// This Exception can be generated in the following cases + /// 1. If the operation is not supported on device + /// 2. If the Operation Failed + /// + public static void Deinit() + { + TelephonyError error = Interop.Telephony.TelephonyDeinit(ref _handleList); + if (error != TelephonyError.None) + { + Exception e = ExceptionFactory.CreateException(error); + // Check if error is Invalid Parameter then hide the error + if (e is ArgumentException) + { + e = new InvalidOperationException("Internal Error Occured"); + } + + throw e; + } + + _isInitialized = false; + _telephonyHandle.Clear(); + } + + internal static SlotHandle FindHandle(IntPtr handle) + { + SlotHandle temp = _telephonyHandle[0]; + foreach (SlotHandle simHandle in _telephonyHandle) + { + if (simHandle._handle == handle) + { + temp = simHandle; + } + } + + return temp; + } + } +} diff --git a/src/Tizen.Tracer/Interop/Interop.Libraries.cs b/src/Tizen.Tracer/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..cee5a29 --- /dev/null +++ b/src/Tizen.Tracer/Interop/Interop.Libraries.cs @@ -0,0 +1,15 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string ttrace = "libttrace.so.1"; + } +} diff --git a/src/Tizen.Tracer/Interop/Interop.Tracer.cs b/src/Tizen.Tracer/Interop/Interop.Tracer.cs new file mode 100755 index 0000000..cd35b1b --- /dev/null +++ b/src/Tizen.Tracer/Interop/Interop.Tracer.cs @@ -0,0 +1,31 @@ +// Copyright 2016 by Samsung Electronics, Inc., +// +// This software is the confidential and proprietary information +// of Samsung Electronics, Inc. ("Confidential Information"). You +// shall not disclose such Confidential Information and shall use +// it only in accordance with the terms of the license agreement +// you entered into with Samsung. + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Tracer + { + [DllImport(Libraries.ttrace, EntryPoint = "trace_begin")] + internal static extern void Begin (String name); + + [DllImport(Libraries.ttrace, EntryPoint = "trace_end")] + internal static extern void End (); + + [DllImport(Libraries.ttrace, EntryPoint = "trace_async_begin")] + internal static extern void AsyncBegin (int cookie, String name); + + [DllImport(Libraries.ttrace, EntryPoint = "trace_async_end")] + internal static extern void AsyncEnd (int cookie, String name); + + [DllImport(Libraries.ttrace, EntryPoint = "trace_update_counter")] + internal static extern void TraceValue (int value, String name); + } +} diff --git a/src/Tizen.Tracer/Tizen.Tracer.csproj b/src/Tizen.Tracer/Tizen.Tracer.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Tracer/Tizen.Tracer.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Tracer/Tizen.Tracer.sln b/src/Tizen.Tracer/Tizen.Tracer.sln new file mode 100755 index 0000000..0050342 --- /dev/null +++ b/src/Tizen.Tracer/Tizen.Tracer.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Tracer", "Tizen.Tracer.csproj", "{3B1A591D-0DBD-4456-9602-7039ED731C8C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{F0F11E63-929A-4B32-92D0-736B84A1E910}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{64B4C36E-29ED-4C51-BD81-E673B925A2EF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3B1A591D-0DBD-4456-9602-7039ED731C8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B1A591D-0DBD-4456-9602-7039ED731C8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B1A591D-0DBD-4456-9602-7039ED731C8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B1A591D-0DBD-4456-9602-7039ED731C8C}.Release|Any CPU.Build.0 = Release|Any CPU + {F0F11E63-929A-4B32-92D0-736B84A1E910}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F0F11E63-929A-4B32-92D0-736B84A1E910}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F0F11E63-929A-4B32-92D0-736B84A1E910}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F0F11E63-929A-4B32-92D0-736B84A1E910}.Release|Any CPU.Build.0 = Release|Any CPU + {64B4C36E-29ED-4C51-BD81-E673B925A2EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {64B4C36E-29ED-4C51-BD81-E673B925A2EF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {64B4C36E-29ED-4C51-BD81-E673B925A2EF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {64B4C36E-29ED-4C51-BD81-E673B925A2EF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Tracer/Tizen/Tracer.cs b/src/Tizen.Tracer/Tizen/Tracer.cs new file mode 100755 index 0000000..e00bfce --- /dev/null +++ b/src/Tizen.Tracer/Tizen/Tracer.cs @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen +{ + /// + /// Provides functions for writing trace message to the system trace buffer. + /// + public static class Tracer + { + /// + /// Writes a trace event to indicate that a synchronous event has begun. + /// + /// + /// The specific error code can be obtained using the Tizen.Internals.Errors.ErrorFacts.GetLastResult() method. + /// + /// The name of event (optionally containing format specifiers) + /// + public static void Begin (String name) + { + Interop.Tracer.Begin (name); + } + + /// + /// Writes a trace event to indicate that the synchronous event has ended. + /// + /// + /// Tizen.Tracer.End() ends the most recently called Tizen.Tracer.Begin(). + /// The specific error code can be obtained using the Tizen.Internals.Errors.ErrorFacts.GetLastResult() method. + /// + /// + public static void End () + { + Interop.Tracer.End (); + } + + /// + /// Writes a trace event to indicate that an asynchronous event has begun. + /// + /// + /// The specific error code can be obtained using the Tizen.Internals.Errors.ErrorFacts.GetLastResult() method. + /// + /// An unique identifier for distinguishing simultaneous events + /// The name of event (optionally containing format specifiers) + /// + public static void AsyncBegin (int cookie, String name) + { + Interop.Tracer.AsyncBegin (cookie, name); + } + + /// + /// Writes a trace event to indicate that the asynchronous event has ended. + /// + /// + /// Tizen.Tracer.AsyncEnd() ends matched Tizen.Tracer.AsyncBegin() which has same cookie and name. + /// The specific error code can be obtained using the Tizen.Internals.Errors.ErrorFacts.GetLastResult() method. + /// + /// An unique identifier for distinguishing simultaneous events + /// The name of event (optionally containing format specifiers) + /// + public static void AsyncEnd (int cookie, String name) + { + Interop.Tracer.AsyncEnd (cookie, name); + } + + /// + /// Writes a trace event to track change of integer value. + /// + /// + /// The specific error code can be obtained using the Tizen.Internals.Errors.ErrorFacts.GetLastResult() method. + /// + /// The integer variable to trace + /// The name of event (optionally containing format specifiers) + public static void TraceValue (int value, String name) + { + Interop.Tracer.TraceValue (value, name); + } + } +} + diff --git a/src/Tizen.Uix.InputMethod/Interop/Interop.EinaList.cs b/src/Tizen.Uix.InputMethod/Interop/Interop.EinaList.cs new file mode 100755 index 0000000..50a64ad --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Interop/Interop.EinaList.cs @@ -0,0 +1,35 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.InputMethod; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// EinaList Interop Class + /// + internal static class EinaList + { + [DllImport(Libraries.Eina, EntryPoint = "eina_list_append")] + internal static extern IntPtr EinaListAppend(IntPtr list, IntPtr data); + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs b/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs new file mode 100755 index 0000000..ba421a0 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Interop/Interop.InputMethod.cs @@ -0,0 +1,327 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.InputMethod; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// InputMethod Interop Class + /// + internal static class InputMethod + { + internal static string LogTag = "Tizen.Uix.InputMethod"; + + private const int ErrorInputMethod = -0x02F20000; + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + NoCallbackFunction = ErrorInputMethod | 0x0001, /**< Necessary callback function is not set */ + NotRunning = ErrorInputMethod | 0x0002, /**< IME main loop isn't started yet */ + OperationFailed = ErrorInputMethod | 0x0010, /**< Operation failed */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory /**< out of memory */ + }; + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + internal struct ImeCallbackStruct + { + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ImeCreateCb create; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ImeTerminateCb terminate; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ImeShowCb show; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ImeHideCb hide; + }; + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + internal struct ImePreEditAttributeStruct + { + internal uint start; + internal uint length; + internal int type; + internal uint value; + }; + + internal sealed class ImeCallbackStructGCHandle : IDisposable + { + internal ImeCallbackStruct _imeCallbackStruct; + internal GCHandle _imeCallbackStructHandle; + public ImeCallbackStructGCHandle() + { + _imeCallbackStruct = new ImeCallbackStruct(); + _imeCallbackStructHandle = GCHandle.Alloc(_imeCallbackStruct); + } + + #region IDisposable Support + private bool disposedValue = false; + + void Dispose(bool disposing) + { + Tizen.Log.Info(LogTag, "In Dispose"); + if (!disposedValue) + { + if (disposing) + { + Tizen.Log.Info(LogTag, "In Dispose free called"); + _imeCallbackStructHandle.Free(); + } + + disposedValue = true; + } + } + + public void Dispose() + { + Dispose(true); + } + #endregion + } + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeRunCb(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_run")] + internal static extern ErrorCode ImeRun(ref ImeCallbackStruct basicCB, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_focus_in_cb")] + internal static extern ErrorCode ImeEventSetFocusedInCb(ImeFocusedInCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_focus_out_cb")] + internal static extern ErrorCode ImeEventSetFocusedOutCb(ImeFocusedOutCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_surrounding_text_updated_cb")] + internal static extern ErrorCode ImeEventSetSurroundingTextUpdatedCb(ImeSurroundingTextUpdatedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_input_context_reset_cb")] + internal static extern ErrorCode ImeEventSetInputContextResetCb(ImeInputContextResetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_cursor_position_updated_cb")] + internal static extern ErrorCode ImeEventSetCursorPositionitionUpdatedCb(ImeCursorPositionitionUpdatedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_language_requested_cb")] + internal static extern ErrorCode ImeEventSetLanguageRequestedCallbackCb(ImeLanguageRequestedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_language_set_cb")] + internal static extern ErrorCode ImeEventSetLanguageSetCb(ImeLanguageSetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_imdata_set_cb")] + internal static extern ErrorCode ImeEventSetImdataSetCb(ImeImdataSetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_imdata_requested_cb")] + internal static extern ErrorCode ImeEventSetImdataRequestedCb(ImeImdataRequestedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_layout_set_cb")] + internal static extern ErrorCode ImeEventSetLayoutSetCb(ImeLayoutSetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_return_key_type_set_cb")] + internal static extern ErrorCode ImeEventSetReturnKeySetCb(ImeReturnKeySetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_return_key_state_set_cb")] + internal static extern ErrorCode ImeEventSetReturnKeyStateSetCb(ImeReturnKeyStateSetCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_geometry_requested_cb")] + internal static extern ErrorCode ImeEventSetGeometryRequestedCallbackCb(ImeGeometryRequestedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_process_key_event_cb")] + internal static extern ErrorCode ImeEventSetProcessKeyEventCb(ImeProcessKeyEventCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_display_language_changed_cb")] + internal static extern ErrorCode ImeEventSetDisplayLanguageChangedCb(ImeDisplayLanguageChangedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_rotation_degree_changed_cb")] + internal static extern ErrorCode ImeEventSetRotationChangedCb(ImeRotationChangedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_accessibility_state_changed_cb")] + internal static extern ErrorCode ImeEventSetAccessibilityStateChangedCb(ImeAccessibilityStateChangedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_option_window_created_cb")] + internal static extern ErrorCode ImeEventSetOptionWindowCreatedCb(ImeOptionWindowCreatedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_event_set_option_window_destroyed_cb")] + internal static extern ErrorCode ImeEventSetOptionWindowDestroyedCb(ImeOptionWindowDestroyedCb callbackFunction, IntPtr userData); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_send_key_event")] + internal static extern ErrorCode ImeSendKeyEvent(KeyCode keycode, KeyMask keymask, bool forwardKey); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_commit_string")] + internal static extern ErrorCode ImeCommitString(string str); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_show_preedit_string")] + internal static extern ErrorCode ImeShowPreeditString(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_hide_preedit_string")] + internal static extern ErrorCode ImeHidePreeditString(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_update_preedit_string")] + internal static extern ErrorCode ImeUpdatePreeditString(string str, IntPtr attrs); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_request_surrounding_text")] + internal static extern ErrorCode ImeRequestSurroundingText(int maxlenBefore, int maxlenAfter); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_delete_surrounding_text")] + internal static extern ErrorCode ImeDeleteSurroundingText(int offset, int len); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_get_surrounding_text")] + internal static extern ErrorCode ImeGetSurroundingText(int maxlenBefore, int maxlenAfter, out IntPtr text, out int cursorPos); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_selection")] + internal static extern ErrorCode ImeSetSelection(int start, int end); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_get_main_window")] + internal static extern IntPtr ImeGetMainWindow(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_prepare")] + internal static extern ErrorCode ImePrepare(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_initialize")] + internal static extern ErrorCode ImeInitialize(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_finalize")] + internal static extern ErrorCode ImeFinalize(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_set_size")] + internal static extern ErrorCode ImeSetSize(int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_create_option_window")] + internal static extern ErrorCode ImeCreateOptionWindow(); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_destroy_option_window")] + internal static extern ErrorCode ImeDestroyOptionWindow(IntPtr window); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_layout")] + internal static extern ErrorCode ImeContextGetLayout(IntPtr context, out InputPanelLayout layout); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_layout_variation")] + internal static extern ErrorCode ImeContextGetLayoutVariation(IntPtr context, out LayoutVariation layoutVariation); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_cursor_position")] + internal static extern ErrorCode ImeContextGetCursorPositionition(IntPtr context, out int cursorPos); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_autocapital_type")] + internal static extern ErrorCode ImeContextGetAutocapitalType(IntPtr context, out AutoCapitalization autocapitalType); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_return_key_type")] + internal static extern ErrorCode ImeContextGetReturnKey(IntPtr context, out InputPanelReturnKey returnKeyType); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_return_key_state")] + internal static extern ErrorCode ImeContextGetReturnKeyState(IntPtr context, out bool returnKeyState); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_prediction_mode")] + internal static extern ErrorCode ImeContextGetPredictionMode(IntPtr context, out bool predictionMode); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_password_mode")] + internal static extern ErrorCode ImeContextGetPasswordMode(IntPtr context, out bool passwordMode); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_input_hint")] + internal static extern ErrorCode ImeContextGetInputHint(IntPtr context, out InputHints inputHint); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_bidi_direction")] + internal static extern ErrorCode ImeContextGetBidiDirection(IntPtr context, out BiDirection bidi); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_context_get_language")] + internal static extern ErrorCode ImeContextGetLanguage(IntPtr context, out InputPanelLanguage language); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_device_info_get_name")] + internal static extern ErrorCode ImeDeviceInfoGetName(IntPtr dev_info, out string devName); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_device_info_get_class")] + internal static extern ErrorCode ImeDeviceInfoGetClass(IntPtr dev_info, out DeviceClass devClass); + + [DllImport(Libraries.InputMethod, EntryPoint = "ime_device_info_get_subclass")] + internal static extern ErrorCode ImeDeviceInfoGetSubclass(IntPtr dev_info, out DeviceSubclass devSubClass); + + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeCreateCb(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeTerminateCb(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeShowCb(int contextId, IntPtr context, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeHideCb(int contextId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeFocusedInCb(int contextId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeFocusedOutCb(int contextId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeSurroundingTextUpdatedCb(int contextId, IntPtr text, int cursorPos, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeInputContextResetCb(IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeCursorPositionitionUpdatedCb(int cursorPos, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeLanguageRequestedCb(IntPtr userData, out IntPtr langCode); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeLanguageSetCb(InputPanelLanguage language, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeImdataSetCb(IntPtr data, uint dataLength, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeImdataRequestedCb(IntPtr userData, out IntPtr data, out uint dataLength); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeLayoutSetCb(InputPanelLayout layout, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeReturnKeySetCb(InputPanelReturnKey type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeReturnKeyStateSetCb(bool disabled, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeGeometryRequestedCb(IntPtr userData, out int x, out int y, out int w, out int h); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ImeProcessKeyEventCb(KeyCode keycode, KeyMask keymask, IntPtr devInfo, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeDisplayLanguageChangedCb(IntPtr language, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeRotationChangedCb(int degree, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeAccessibilityStateChangedCb(bool state, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeOptionWindowCreatedCb(IntPtr window, OptionWindowType type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ImeOptionWindowDestroyedCb(IntPtr window, IntPtr userData); + } +} diff --git a/src/Tizen.Uix.InputMethod/Interop/Interop.Libraries.cs b/src/Tizen.Uix.InputMethod/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..888641a --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Interop/Interop.Libraries.cs @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Partial Libraries Class + /// + internal static partial class Libraries + { + internal const string InputMethod = "libcapi-ui-inputmethod.so.0"; + internal const string Eina = "libeina.so.1"; + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.csproj b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.csproj new file mode 100644 index 0000000..a8b52c3 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.csproj @@ -0,0 +1,15 @@ + + + + + netstandard1.6 + + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.sln b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.sln new file mode 100755 index 0000000..862abe2 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod.sln @@ -0,0 +1,40 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.InputMethod", "Tizen.Uix.InputMethod.csproj", "{20D10C62-6D3C-4B63-9136-7CEEC564E02F}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{4C740EB3-26AB-49C8-B25B-3568FBAB5067}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{AEB3A15E-F174-4436-84CD-3AAF4D6B91A3}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{88A7DD62-995F-4772-A6D5-97CE462631EA}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {20D10C62-6D3C-4B63-9136-7CEEC564E02F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20D10C62-6D3C-4B63-9136-7CEEC564E02F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20D10C62-6D3C-4B63-9136-7CEEC564E02F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20D10C62-6D3C-4B63-9136-7CEEC564E02F}.Release|Any CPU.Build.0 = Release|Any CPU + {4C740EB3-26AB-49C8-B25B-3568FBAB5067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4C740EB3-26AB-49C8-B25B-3568FBAB5067}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4C740EB3-26AB-49C8-B25B-3568FBAB5067}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4C740EB3-26AB-49C8-B25B-3568FBAB5067}.Release|Any CPU.Build.0 = Release|Any CPU + {AEB3A15E-F174-4436-84CD-3AAF4D6B91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AEB3A15E-F174-4436-84CD-3AAF4D6B91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AEB3A15E-F174-4436-84CD-3AAF4D6B91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AEB3A15E-F174-4436-84CD-3AAF4D6B91A3}.Release|Any CPU.Build.0 = Release|Any CPU + {88A7DD62-995F-4772-A6D5-97CE462631EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88A7DD62-995F-4772-A6D5-97CE462631EA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88A7DD62-995F-4772-A6D5-97CE462631EA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88A7DD62-995F-4772-A6D5-97CE462631EA}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/AccessibilityStateChangedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/AccessibilityStateChangedEventArgs.cs new file mode 100755 index 0000000..45277e4 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/AccessibilityStateChangedEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to AccessibilityStateChanged Event + /// + public class AccessibilityStateChangedEventArgs + { + internal AccessibilityStateChangedEventArgs(bool state) + { + State = state; + } + + /// + /// Accessibility option state + /// + public bool State + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/CursorPositionUpdatedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/CursorPositionUpdatedEventArgs.cs new file mode 100755 index 0000000..afbf445 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/CursorPositionUpdatedEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to CursorPositionitionUpdated Event + /// + public class CursorPositionitionUpdatedEventArgs + { + internal CursorPositionitionUpdatedEventArgs(int cursorPos) + { + CursorPosition = cursorPos; + } + + /// + /// The cursor position + /// + public int CursorPosition + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DataSetEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DataSetEventArgs.cs new file mode 100755 index 0000000..c1a722d --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DataSetEventArgs.cs @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to DataSet Event + /// + public class SetDataEventArgs + { + internal SetDataEventArgs(byte[] destination, uint dataLength) + { + Data = destination; + DataLength = dataLength; + } + + /// + /// The specific data to be set to the input panel + /// + public byte[] Data + { + get; + internal set; + } + + /// + /// The length of data, in bytes, to send to the input panel + /// + public uint DataLength + { + get; + internal set; + } + + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DisplayLanaguageChangedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DisplayLanaguageChangedEventArgs.cs new file mode 100755 index 0000000..b0712f3 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/DisplayLanaguageChangedEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to DisplayLanaguageChanged Event + /// + public class DisplayLanaguageChangedEventArgs + { + internal DisplayLanaguageChangedEventArgs(string langauage) + { + Langauage = langauage; + } + + /// + /// The language code + /// + public string Langauage + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs new file mode 100755 index 0000000..82153a7 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/EditorWindow.cs @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using Tizen; +using System; +using ElmSharp; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + /// + /// The Editor window class + /// + public class EditorWindow : Window + { + internal static IntPtr _handle = IntPtr.Zero; + private IntPtr _realHandle = IntPtr.Zero; + + internal EditorWindow():base("Edit") + { + _realHandle = _handle; + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return _handle; + } + + public IntPtr GetHandle() + { + return _handle; + } + + /// + /// This API updates the input panel window's size information. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The width in portrait mode + /// The height in portrait mode + /// The width in landscape mode + /// The height in landscape mode + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + public static void SetSize(int portraitWidth, int portraitHeight, int landscapeWidth, int landscapeHeight) + { + ErrorCode error = ImeSetSize(portraitWidth, portraitHeight, landscapeWidth, landscapeHeight); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetSize Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedInEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedInEventArgs.cs new file mode 100755 index 0000000..77dad6d --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedInEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to FocusedIn Event + /// + public class FocusedInEventArgs + { + internal FocusedInEventArgs(int contextId) + { + ContextId = contextId; + } + + /// + /// The input context identification value of an associated text input UI control + /// + public int ContextId + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedOutEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedOutEventArgs.cs new file mode 100755 index 0000000..9990cea --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/FocusedOutEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to FocusedOut Event + /// + public class FocusedOutEventArgs + { + internal FocusedOutEventArgs(int contextId) + { + ContextId = contextId; + } + + /// + /// The input context identification value of an associated text input UI control + /// + public int ContextId + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodContext.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodContext.cs new file mode 100755 index 0000000..d5e4ba0 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodContext.cs @@ -0,0 +1,493 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + /// + /// Enumeration for Input Panel Layout + /// + public enum InputPanelLayout + { + /// + /// Normal + /// + LayoutNormal, + /// + /// Number + /// + LayoutNumber, + /// + /// Email + /// + LayoutEMail, + /// + /// URL + /// + LayoutURL, + /// + /// Phone Number + /// + LayoutPhoneNumber, + /// + /// IP + /// + LayoutIP, + /// + /// Month + /// + LayoutMonth, + /// + /// Number Only + /// + LayoutNumberOnly, + /// + /// Invalid + /// + LayoutInvalid, + /// + /// HEX + /// + LayoutHEX, + /// + /// Terminal + /// + LayoutTerminal, + /// + /// Password + /// + LayoutPassword, + /// + /// Date Time + /// + LayoutDateTime, + /// + /// Emoticon + /// + LayoutEmoticon, + /// + /// Voice + /// + LayoutVoice, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for Layout Variation + /// + public enum LayoutVariation + { + /// + /// The plain normal layout + /// + NormalNormal = 0, + /// + /// Filename layout; symbols such as '/', '\*', '\', '|', '<', '>', '?', '"' and ':' should be disabled + /// + NormalFileName, + /// + /// The name of a person + /// + NormalPersonName, + /// + /// The plain normal number layout + /// + NumberOnlyNormal = 0, + /// + /// The number layout to allow a negative sign + /// + NumberOnlySigned, + /// + /// The number layout to allow decimal point to provide fractional value + /// + NumberOnlyDecimal, + /// + /// The number layout to allow decimal point and negative sign + /// + NumberOnlySignedAndDecimal, + /// + /// The normal password layout + /// + PasswordNormal = 0, + /// + /// The password layout to allow only number + /// + PasswordNumberOnly, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for AutoCapital Type + /// + public enum AutoCapitalization + { + /// + /// None + /// + None, + /// + /// Word + /// + Word, + /// + /// Sentence + /// + Sentence, + /// + /// All Character + /// + AllCharacter, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for InputPanel ReturnKey Type + /// + public enum InputPanelReturnKey + { + /// + /// Default + /// + Default, + /// + /// Done + /// + Done, + /// + /// Go + /// + Go, + /// + /// Join + /// + Join, + /// + /// Login + /// + Login, + /// + /// Next + /// + Next, + /// + /// Search + /// + Search, + /// + /// Send + /// + Send, + /// + /// SignIn + /// + SignIn, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for InputHints + /// + public enum InputHints + { + /// + /// None + /// + None, + /// + /// AutoComplete + /// + AutoComplete, + /// + /// SensitiveData + /// + SensitiveData, + /// + /// Multiline + /// + Multiline, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for BiDi Direction + /// + public enum BiDirection + { + /// + /// Neutral + /// + Neutral, + /// + /// LTR + /// + LTR, + /// + /// RTL + /// + RTL, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for InputPanel Language + /// + public enum InputPanelLanguage + { + /// + /// Automatic + /// + Automatic, + /// + /// Alphabet + /// + Alphabet, + /// + /// Undefined + /// + Undefined + }; + + /// + /// This class represents the context of InputMethodEditor + /// + public class InputMethodContext + { + private IntPtr _handle; + internal InputMethodContext(IntPtr handle) + { + _handle = handle; + } + + /// + /// Gets the layout information. + /// + public InputPanelLayout Layout + { + get + { + InputPanelLayout layout; + ErrorCode error = ImeContextGetLayout(_handle, out layout); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetLayout Failed with error " + error); + return InputPanelLayout.Undefined; + } + return layout; + } + } + + /// + /// Gets the layout variation information. + /// + public LayoutVariation LayoutVariation + { + get + { + LayoutVariation layoutVariation; + ErrorCode error = ImeContextGetLayoutVariation(_handle, out layoutVariation); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetLayoutVariation Failed with error " + error); + return LayoutVariation.Undefined; + } + return layoutVariation; + } + } + + /// + /// Gets the cursor position information. + /// + public int CursorPositionition + { + get + { + int cursorPosition; + ErrorCode error = ImeContextGetCursorPositionition(_handle, out cursorPosition); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetCursorPositionition Failed with error " + error); + return -1; + } + return cursorPosition; + } + } + + /// + /// Gets the autocapital type information. + /// + public AutoCapitalization AutoCapitalization + { + get + { + AutoCapitalization autoCapitalType; + ErrorCode error = ImeContextGetAutocapitalType(_handle, out autoCapitalType); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetAutoCapitalization Failed with error " + error); + return AutoCapitalization.Undefined; + } + return autoCapitalType; + } + } + + /// + /// Gets the Return key label type information. + /// + public InputPanelReturnKey ReturnKey + { + get + { + InputPanelReturnKey returnKeyType; + ErrorCode error = ImeContextGetReturnKey(_handle, out returnKeyType); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetReturnKey Failed with error " + error); + return InputPanelReturnKey.Undefined; + } + return returnKeyType; + } + } + + /// + /// Gets the Return key state information. + /// + public bool ReturnKeyState + { + get + { + bool returnKeyState; + ErrorCode error = ImeContextGetReturnKeyState(_handle, out returnKeyState); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetReturnKeyState Failed with error " + error); + return false; + } + return returnKeyState; + } + } + + /// + /// Gets the prediction mode information. + /// + public bool PredictionMode + { + get + { + bool predictionMode; + ErrorCode error = ImeContextGetPredictionMode(_handle, out predictionMode); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetPredictionMode Failed with error " + error); + return false; + } + return predictionMode; + } + } + + /// + /// Gets the password mode information. + /// + public bool PasswordMode + { + get + { + bool passwordMode; + ErrorCode error = ImeContextGetPasswordMode(_handle, out passwordMode); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetPasswordMode Failed with error " + error); + return false; + } + return passwordMode; + } + } + + /// + /// Gets the input hint information. + /// + public InputHints InputHint + { + get + { + InputHints inputHint; + ErrorCode error = ImeContextGetInputHint(_handle, out inputHint); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetInputHint Failed with error " + error); + return InputHints.Undefined; + } + return inputHint; + } + } + + /// + /// Gets the text bidirectional information. + /// + public BiDirection BiDirection + { + get + { + BiDirection biDiDirection; + ErrorCode error = ImeContextGetBidiDirection(_handle, out biDiDirection); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetBiDirection Failed with error " + error); + return BiDirection.Undefined; + } + return biDiDirection; + } + } + + /// + /// Gets the preferred language information. + /// + public InputPanelLanguage Language + { + get + { + InputPanelLanguage langauge; + ErrorCode error = ImeContextGetLanguage(_handle, out langauge); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetLanguage Failed with error " + error); + return InputPanelLanguage.Undefined; + } + return langauge; + } + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodDeviceInformation.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodDeviceInformation.cs new file mode 100755 index 0000000..6f3d788 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodDeviceInformation.cs @@ -0,0 +1,187 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Text; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + /// + /// Enumeration for Device Class + /// + public enum DeviceClass + { + /// + /// None + /// + None, + /// + /// Seat + /// + Seat, + /// + /// Keyboard + /// + Keyboard, + /// + /// Mouse + /// + Mouse, + /// + /// Touch + /// + Touch, + /// + /// Pen + /// + Pen, + /// + /// Pointer + /// + Pointer, + /// + /// Gamepad + /// + Gamepad, + /// + /// Undefined + /// + Undefined + }; + + /// + /// Enumeration for Device SubClass + /// + public enum DeviceSubclass + { + /// + /// None + /// + None, + /// + /// Finger + /// + Finger, + /// + /// FingerNail + /// + FingerNail, + /// + /// Knuckle + /// + Knuckle, + /// + /// Palm + /// + Palm, + /// + /// HandSIze + /// + HandSIze, + /// + /// HandFlat + /// + HandFlat, + /// + /// PenTip + /// + PenTip, + /// + /// Trackpad + /// + Trackpad, + /// + /// Trackpoint + /// + Trackpoint, + /// + /// Trackball + /// + Trackball, + /// + /// Undefined + /// + Undefined + }; + + /// + /// this class gives the device information, like the name, class and subclass + /// + public class VoiceControlDeviceInformation + { + private IntPtr _handle; + internal VoiceControlDeviceInformation(IntPtr handle) + { + _handle = handle; + } + + /// + /// Gets the device name of the key event. + /// + public string Name + { + get + { + string name; + ErrorCode error = ImeDeviceInfoGetName(_handle, out name); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetName Failed with error " + error); + return ""; + } + return name; + } + } + + /// + /// Gets the device class of the key event. + /// + public DeviceClass DeviceClass + { + get + { + DeviceClass devClass; + ErrorCode error = ImeDeviceInfoGetClass(_handle, out devClass); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetClass Failed with error " + error); + return DeviceClass.Undefined; + } + return devClass; + } + } + + /// + /// Gets the device subclass of the key event. + /// + public DeviceSubclass DeviceSubclass + { + get + { + DeviceSubclass subclass; + ErrorCode error = ImeDeviceInfoGetSubclass(_handle, out subclass); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetSubclass Failed with error " + error); + return DeviceSubclass.Undefined; + } + return subclass; + } + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs new file mode 100755 index 0000000..1473c8c --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodEditor.cs @@ -0,0 +1,2133 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + /// + /// Enumeration of the key codes. + /// If keycode & 0xff000000 == 0x01000000 then this key code is directly encoded 24-bit UCS character.The UCS value is keycode & 0x00ffffff. + /// Defines the list of keys supported by the system.Note that certain keys may not be available on all devices. + /// + public enum KeyCode + { + /// + /// The backspace key + /// + BackSpace = 0xFF08, + /// + /// The tab key + /// + Tab = 0xFF09, + /// + /// The linefeed key + /// + Linefeed = 0xFF0A, + /// + /// The clear key + /// + Clear = 0xFF0B, + /// + /// The return key + /// + Return = 0xFF0D, + /// + /// The pause key + /// + Pause = 0xFF13, + /// + /// The scroll lock key + /// + ScrollLock = 0xFF14, + /// + /// The sys req key + /// + SysReq = 0xFF15, + /// + /// The escape key + /// + Escape = 0xFF1B, + /// + /// The delete key + /// + Delete = 0xFFFF, + + /* Cursor control & motion */ + /// + /// The home key + /// + Home = 0xFF50, + /// + /// The left directional key + /// + Left = 0xFF51, + /// + /// The up directional key + /// + Up = 0xFF52, + /// + /// The right directional key + /// + Right = 0xFF53, + /// + /// The down directional key + /// + Down = 0xFF54, + /// + /// The prior, previous key + /// + Prior = 0xFF55, + /// + /// The page up key + /// + Page_Up = 0xFF55, + /// + /// The next key + /// + Next = 0xFF56, + /// + /// The page down key + /// + Page_Down = 0xFF56, + /// + /// The end key + /// + End = 0xFF57, + /// + /// The begin key + /// + Begin = 0xFF58, + + /* Misc Functions */ + /// + /// The select key + /// + Select = 0xFF60, + /// + /// The print key + /// + Print = 0xFF61, + /// + /// The execute, run, do key + /// + Execute = 0xFF62, + /// + /// The insert key + /// + Insert = 0xFF63, + /// + /// The undo key + /// + Undo = 0xFF65, + /// + /// The redo key + /// + Redo = 0xFF66, + /// + /// The menu key + /// + Menu = 0xFF67, + /// + /// The find key + /// + Find = 0xFF68, + /// + /// The cancel, stop, abort, exit key + /// + Cancel = 0xFF69, + /// + /// The help key + /// + Help = 0xFF6A, + /// + /// The break key + /// + Break = 0xFF6B, + /// + /// The character set switch key + /// + Mode_switch = 0xFF7E, + /// + /// The num lock key + /// + Num_Lock = 0xFF7F, + + /* Keypad */ + /// + /// The Numpad space key + /// + KPSpace = 0xFF80, + /// + /// The Numpad tab key + /// + KPTab = 0xFF89, + /// + /// The Numpad enter key + /// + KPEnter = 0xFF8D, + /// + /// The Numpad function 1 key + /// + KPF1 = 0xFF91, + /// + /// The Numpad function 2 key + /// + KPF2 = 0xFF92, + /// + /// The Numpad function 3 key + /// + KPF3 = 0xFF93, + /// + /// The Numpad function 4 key + /// + KPF4 = 0xFF94, + /// + /// The Numpad home key + /// + KPHome = 0xFF95, + /// + /// The Numpad left key + /// + KPLeft = 0xFF96, + /// + /// The Numpad up key + /// + KPUp = 0xFF97, + /// + /// The Numpad right key + /// + KPRight = 0xFF98, + /// + /// The Numpad down key + /// + KPDown = 0xFF99, + /// + /// The Numpad prior, previous key + /// + KPPrior = 0xFF9A, + /// + /// The Numpad page up key + /// + KPPage_Up = 0xFF9A, + /// + /// The Numpad next key + /// + KPNext = 0xFF9B, + /// + /// The Numpad page down key + /// + KPPage_Down = 0xFF9B, + /// + /// The Numpad end key + /// + KPEnd = 0xFF9C, + /// + /// The Numpad begin key + /// + KPBegin = 0xFF9D, + /// + /// The Numpad insert key + /// + KPInsert = 0xFF9E, + /// + /// The Numpad delete key + /// + KPDelete = 0xFF9F, + /// + /// The Numpad equal key + /// + KPEqual = 0xFFBD, + /// + /// The Numpad multiply key + /// + KPMultiply = 0xFFAA, + /// + /// The Numpad add key + /// + KPAdd = 0xFFAB, + /// + /// The Numpad separator key + /// + KPSeparator = 0xFFAC, + /// + /// The Numpad subtract key + /// + KPSubtract = 0xFFAD, + /// + /// The Numpad decimal key + /// + KPDecimal = 0xFFAE, + /// + /// The Numpad divide key + /// + KPDivide = 0xFFAF, + /// + /// The Numpad 0 key + /// + KP0 = 0xFFB0, + /// + /// The Numpad 1 key + /// + KP1 = 0xFFB1, + /// + /// The Numpad 2 key + /// + KP2 = 0xFFB2, + /// + /// The Numpad 3 key + /// + KP3 = 0xFFB3, + /// + /// The Numpad 4 key + /// + KP4 = 0xFFB4, + /// + /// The Numpad 5 key + /// + KP5 = 0xFFB5, + /// + /// The Numpad 6 key + /// + KP6 = 0xFFB6, + /// + /// The Numpad 7 key + /// + KP7 = 0xFFB7, + /// + /// The Numpad 8 key + /// + KP8 = 0xFFB8, + /// + /// The Numpad 9 key + /// + KP9 = 0xFFB9, + + /* Auxilliary Functions */ + /// + /// The function 1 key + /// + F1 = 0xFFBE, + /// + /// The function 2 key + /// + F2 = 0xFFBF, + /// + /// The function 3 key + /// + F3 = 0xFFC0, + /// + /// The function 4 key + /// + F4 = 0xFFC1, + /// + /// The function 5 key + /// + F5 = 0xFFC2, + /// + /// The function 6 key + /// + F6 = 0xFFC3, + /// + /// The function 7 key + /// + F7 = 0xFFC4, + /// + /// The function 8 key + /// + F8 = 0xFFC5, + /// + /// The function 9 key + /// + F9 = 0xFFC6, + /// + /// The function 10 key + /// + F10 = 0xFFC7, + /// + /// The function 11 key + /// + F11 = 0xFFC8, + /// + /// The function 12 key + /// + F12 = 0xFFC9, + /// + /// The function 13 key + /// + F13 = 0xFFCA, + /// + /// The function 14 key + /// + F14 = 0xFFCB, + /// + /// The function 15 key + /// + F15 = 0xFFCC, + /// + /// The function 16 key + /// + F16 = 0xFFCD, + /// + /// The function 17 key + /// + F17 = 0xFFCE, + /// + /// The function 18 key + /// + F18 = 0xFFCF, + /// + /// The function 19 key + /// + F19 = 0xFFD0, + /// + /// The function 20 key + /// + F20 = 0xFFD1, + /// + /// The function 21 key + /// + F21 = 0xFFD2, + /// + /// The function 22 key + /// + F22 = 0xFFD3, + /// + /// The function 23 key + /// + F23 = 0xFFD4, + /// + /// The function 24 key + /// + F24 = 0xFFD5, + /// + /// The function 25 key + /// + F25 = 0xFFD6, + /// + /// The function 26 key + /// + F26 = 0xFFD7, + /// + /// The function 27 key + /// + F27 = 0xFFD8, + /// + /// The function 28 key + /// + F28 = 0xFFD9, + /// + /// The function 29 key + /// + F29 = 0xFFDA, + /// + /// The function 30 key + /// + F30 = 0xFFDB, + /// + /// The function 31 key + /// + F31 = 0xFFDC, + /// + /// The function 32 key + /// + F32 = 0xFFDD, + /// + /// The function 33 key + /// + F33 = 0xFFDE, + /// + /// The function 34 key + /// + F34 = 0xFFDF, + /// + /// The function 35 key + /// + F35 = 0xFFE0, + + /* Modifier keys */ + /// + /// The left shift key + /// + ShiftL = 0xFFE1, + /// + /// The right shift key + /// + ShiftR = 0xFFE2, + /// + /// The left control key + /// + ControlL = 0xFFE3, + /// + /// The right control key + /// + ControlR = 0xFFE4, + /// + /// The caps lock key + /// + CapsLock = 0xFFE5, + /// + /// The shift lock key + /// + ShiftLock = 0xFFE6, + /// + /// The left meta key + /// + MetaL = 0xFFE7, + /// + /// The right meta key + /// + MetaR = 0xFFE8, + /// + /// The left alt key + /// + AltL = 0xFFE9, + /// + /// The right alt key + /// + AltR = 0xFFEA, + /// + /// The left super key + /// + SuperL = 0xFFEB, + /// + /// The right super key + /// + SuperR = 0xFFEC, + /// + /// The left hyper key + /// + HyperL = 0xFFED, + /// + /// The right hyper key + /// + HyperR = 0xFFEE, + + /* Latin 1 */ + /// + /// The space key + /// + Space = 0x020, + /// + /// The exclamation key + /// + Exclam = 0x021, + /// + /// The quotedbl key + /// + Quotedbl = 0x022, + /// + /// The number sign key + /// + NumberSign = 0x023, + /// + /// The dollar key + /// + Dollar = 0x024, + /// + /// The percent key + /// + Percent = 0x025, + /// + /// The ampersand key + /// + Ampersand = 0x026, + /// + /// The apostrophe key + /// + Apostrophe = 0x027, + /// + /// The parenleft key + /// + Parenleft = 0x028, + /// + /// The parenright key + /// + Parenright = 0x029, + /// + /// The asterisk key + /// + Asterisk = 0x02a, + /// + /// The plus key + /// + Plus = 0x02b, + /// + /// The comma key + /// + Comma = 0x02c, + /// + /// The minus key + /// + Minus = 0x02d, + /// + /// The period key + /// + Period = 0x02e, + /// + /// The slash key + /// + Slash = 0x02f, + /// + /// The 0 key + /// + Keypad0 = 0x030, + /// + /// The 1 key + /// + Keypad1 = 0x031, + /// + /// The 2 key + /// + Keypad2 = 0x032, + /// + /// The 3 key + /// + Keypad3 = 0x033, + /// + /// The 4 key + /// + Keypad4 = 0x034, + /// + /// The 5 key + /// + Keypad5 = 0x035, + /// + /// The 6 key + /// + Keypad6 = 0x036, + /// + /// The 7 key + /// + Keypad7 = 0x037, + /// + /// The 8 key + /// + Keypad8 = 0x038, + /// + /// The 9 key + /// + Keypad9 = 0x039, + /// + /// The colon key + /// + Colon = 0x03a, + /// + /// The semicolon key + /// + Semicolon = 0x03b, + /// + /// The less key + /// + Less = 0x03c, + /// + /// The equal key + /// + Equal = 0x03d, + /// + /// The greater key + /// + Greater = 0x03e, + /// + /// The question key + /// + Question = 0x03f, + /// + /// The at key + /// + At = 0x040, + /// + /// The A key + /// + KeypadA = 0x041, + /// + /// The B key + /// + KeypadB = 0x042, + /// + /// The C key + /// + KeypadC = 0x043, + /// + /// The D key + /// + KeypadD = 0x044, + /// + /// The E key + /// + KeypadE = 0x045, + /// + /// The F key + /// + KeypadF = 0x046, + /// + /// The G key + /// + KeypadG = 0x047, + /// + /// The H key + /// + KeypadH = 0x048, + /// + /// The I key + /// + KeypadI = 0x049, + /// + /// The J key + /// + KeypadJ = 0x04a, + /// + /// The K key + /// + KeypadK = 0x04b, + /// + /// The L key + /// + KeypadL = 0x04c, + /// + /// The M key + /// + KeypadM = 0x04d, + /// + /// The N key + /// + KeypadN = 0x04e, + /// + /// The O key + /// + KeypadO = 0x04f, + /// + /// The P key + /// + KeypadP = 0x050, + /// + /// The Q key + /// + KeypadQ = 0x051, + /// + /// The R key + /// + KeypadR = 0x052, + /// + /// The S key + /// + KeypadS = 0x053, + /// + /// The T key + /// + KeypadT = 0x054, + /// + /// The U key + /// + KeypadU = 0x055, + /// + /// The V key + /// + KeypadV = 0x056, + /// + /// The W key + /// + KeypadW = 0x057, + /// + /// The X key + /// + KeypadX = 0x058, + /// + /// The Y key + /// + KeypadY = 0x059, + /// + /// The Z key + /// + KeypadZ = 0x05a, + /// + /// The left bracket key + /// + BracketLeft = 0x05b, + /// + /// The backslash key + /// + Backslash = 0x05c, + /// + /// The right bracket key + /// + BracketRight = 0x05d, + /// + /// The circumflex key + /// + AsciiCircum = 0x05e, + /// + /// The underscore key + /// + Underscore = 0x05f, + /// + /// The grave key + /// + Grave = 0x060, + /// + /// The a key + /// + Keypada = 0x061, + /// + /// The b key + /// + Keypadb = 0x062, + /// + /// The c key + /// + Keypadc = 0x063, + /// + /// The d key + /// + Keypadd = 0x064, + /// + /// The e key + /// + Keypade = 0x065, + /// + /// The f key + /// + Keypadf = 0x066, + /// + /// The g key + /// + Keypadg = 0x067, + /// + /// The h key + /// + Keypadh = 0x068, + /// + /// The i key + /// + Keypadi = 0x069, + /// + /// The j key + /// + Keypadj = 0x06a, + /// + /// The k key + /// + Keypadk = 0x06b, + /// + /// The l key + /// + Keypadl = 0x06c, + /// + /// The m key + /// + Keypadm = 0x06d, + /// + /// The n key + /// + Keypadn = 0x06e, + /// + /// The o key + /// + Keypado = 0x06f, + /// + /// The p key + /// + Keypadp = 0x070, + /// + /// The q key + /// + Keypadq = 0x071, + /// + /// The r key + /// + Keypadr = 0x072, + /// + /// The s key + /// + Keypads = 0x073, + /// + /// The t key + /// + Keypadt = 0x074, + /// + /// The u key + /// + Keypadu = 0x075, + /// + /// The v key + /// + Keypadv = 0x076, + /// + /// The w key + /// + Keypadw = 0x077, + /// + /// The x key + /// + Keypadx = 0x078, + /// + /// The y key + /// + Keypady = 0x079, + /// + /// The z key + /// + Keypadz = 0x07a, + /// + /// The left brace key + /// + BraceLeft = 0x07b, + /// + /// The bar key + /// + Bar = 0x07c, + /// + /// The right brace key + /// + BraceRight = 0x07d, + /// + /// The tilde key + /// + AsciiTilde = 0x07e, + }; + + /// + /// Enumeration of the key masks. + /// The key masks indicate which modifier keys is pressed down during the keyboard hit.The special MASK_RELEASED indicates the key release event. + /// + public enum KeyMask + { + /// + /// Key press event without modifier key + /// + Pressed = 0, + /// + /// The Shift key is pressed down + /// + Shift = (1 << 0), + /// + /// The CapsLock key is pressed down + /// + CapsLock = (1 << 1), + /// + /// The Control key is pressed down + /// + Control = (1 << 2), + /// + /// The Alt key is pressed down + /// + Alt = (1 << 3), + /// + /// The Meta key is pressed down + /// + Meta = (1 << 4), + /// + /// The Win (between Control and Alt) is pressed down + /// + Win = (1 << 5), + /// + /// The Hyper key is pressed down + /// + Hyper = (1 << 6), + /// + /// The NumLock key is pressed down + /// + NumLock = (1 << 7), + /// + /// Key release event + /// + Released = (1 << 15), + } + + /// + /// This class contains api's related to IME(Input method editor) + /// + public static class InputMethodEditor + { + private static Object thisLock = new Object(); + private static ImeCallbackStructGCHandle _imeCallbackStructGCHandle = new ImeCallbackStructGCHandle(); + private static event EventHandler _focusIn; + private static ImeFocusedInCb _imeFocusedInDelegate; + private static event EventHandler _focusOut; + private static ImeFocusedOutCb _imeFocusedOutDelegate; + private static event EventHandler _surroundingTextUpdated; + private static ImeSurroundingTextUpdatedCb _imeSurroundingTextUpdatedDelegate; + private static event EventHandler _inputContextReset; + private static ImeInputContextResetCb _imeInputContextResetDelegate; + private static event EventHandler _cursorPositionUpdated; + private static ImeCursorPositionitionUpdatedCb _imeCursorPositionitionUpdatedDelegate; + private static event EventHandler _langaugeSet; + private static ImeLanguageSetCb _imeLanguageSetDelegate; + private static event EventHandler _imDataSet; + private static ImeImdataSetCb _imeDataSetDelegate; + private static event EventHandler _layoutSet; + private static ImeLayoutSetCb _imeLayoutSetDelegate; + private static event EventHandler _returnKeyTypeSet; + private static ImeReturnKeySetCb _imeReturnKeySetDelegate; + private static event EventHandler _returnKeyStateSet; + private static ImeReturnKeyStateSetCb _imeReturnKeyStateSetDelegate; + private static ImeProcessKeyEventCb _imeProcessKeyDelegate; + private static event EventHandler _displayLanaguageChanged; + private static ImeDisplayLanguageChangedCb _imeDisplayLanaguageChangedDelegate; + private static event EventHandler _rotationDegreeChanged; + private static ImeRotationChangedCb _imeRotationChangedDelegate; + private static event EventHandler _accessibilityStateChanged; + private static ImeAccessibilityStateChangedCb _imeAccessibilityStateChangedDelegate; + private static event EventHandler _optionWindowCreated; + private static ImeOptionWindowCreatedCb _imeOptionWindowCreatedDelegate; + private static event EventHandler _optionWindowDestroyed; + private static ImeOptionWindowDestroyedCb _imeOptionWindowDestroyedDelegate; + private static ImeLanguageRequestedCb _imeLanguageRequestedDelegate; + private static OutAction _languageRequestedDelegate; + private static BoolAction _processKeyDelagate; + private static ImeImdataRequestedCb _imeImDataRequestedDelegate; + private static OutArrayAction _imDataRequestedDelegate; + private static ImeGeometryRequestedCb _imeGeometryRequestedDelegate; + private static OutAction _geometryRequestedDelegate; + private static Action _userCreate; + private static Action _userTerminate; + private static Action _userShow; + private static Action _userHide; + private static ImeCreateCb _create = (IntPtr userData) => + { + Log.Info(LogTag, "In Create Delegate"); + _userCreate?.Invoke(); + }; + private static ImeTerminateCb _terminate = (IntPtr userData) => + { + Log.Info(LogTag, "In terminate Delegate"); + _userTerminate?.Invoke(); + _imeCallbackStructGCHandle.Dispose(); + }; + private static ImeShowCb _show = (int contextId, IntPtr context, IntPtr userData) => + { + Log.Info(LogTag, "In Show Delegate"); + _userShow?.Invoke(new ContextId(contextId), new InputMethodContext(context)); + }; + private static ImeHideCb _hide = (int contextId, IntPtr userData) => + { + Log.Info(LogTag, "In Hide Delegate"); + _userHide?.Invoke(new ContextId(contextId)); + }; + + /// + /// Structure representing ContextId + /// + public struct ContextId : IEquatable + { + internal ContextId(int id) + { + Id = id; + } + + internal int Id + { + get; + private set; + } + + public bool Equals(ContextId other) + { + return this.Id == other.Id; + } + } + + /// + /// rectangle representing the position and size of UI Control + /// + public struct Rect + { + /// + /// The x position in screen + /// + public int x; + + /// + /// The y position in screen + /// + public int y; + + /// + /// The window width + /// + public int w; + + /// + /// The window height + /// + public int h; + } + + /// + /// An Action with 1 out parameter + /// + /// Generic Type + /// The out parameter + public delegate void OutAction(out T a); + + /// + /// An Action with an array out parameter + /// + /// Generic Type + /// The out parameter 1 + public delegate void OutArrayAction(out T[] a); + + /// + /// An Action with 3 Input Parameter returning a bool + /// + /// Generic Type for Parameter 1 + /// Generic Type for Parameter 2 + /// Generic Type for Parameter 3 + /// The Input Parameter 1 + /// The Input Parameter 2 + /// The Input Parameter 3 + /// + public delegate bool BoolAction(T a, T1 b, T2 c); + + /// + /// Called when an associated text input UI control has focus. + /// + public static event EventHandler FocusedIn + { + add + { + lock (thisLock) + { + _imeFocusedInDelegate = (int contextId, IntPtr userData) => + { + FocusedInEventArgs args = new FocusedInEventArgs(contextId); + _focusIn?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetFocusedInCb(_imeFocusedInDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add FocusedIn Failed with error " + error); + } + else + { + _focusIn += value; + } + } + } + remove + { + lock (thisLock) + { + _focusIn -= value; + } + } + } + + /// + /// Called when an associated text input UI control loses focus. + /// + public static event EventHandler FocusedOut + { + add + { + lock (thisLock) + { + _imeFocusedOutDelegate = (int contextId, IntPtr userData) => + { + FocusedOutEventArgs args = new FocusedOutEventArgs(contextId); + _focusOut?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetFocusedOutCb(_imeFocusedOutDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add FocusedOut Failed with error " + error); + } + else + { + _focusOut += value; + } + } + } + remove + { + lock (thisLock) + { + _focusOut -= value; + } + } + } + + /// + /// Called when an associated text input UI control responds to a request with the surrounding text. + /// + public static event EventHandler SurroundingTextUpdated + { + add + { + lock (thisLock) + { + _imeSurroundingTextUpdatedDelegate = (int contextId, IntPtr text, int cursorPos, IntPtr userData) => + { + SurroundingTextUpdatedEventArgs args = new SurroundingTextUpdatedEventArgs(contextId, Marshal.PtrToStringAnsi(text), cursorPos); + _surroundingTextUpdated?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetSurroundingTextUpdatedCb(_imeSurroundingTextUpdatedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add SurroundingTextUpdated Failed with error " + error); + } + else + { + _surroundingTextUpdated += value; + } + } + } + remove + { + lock (thisLock) + { + _surroundingTextUpdated -= value; + } + } + } + + /// + /// Called to reset the input context of an associated text input UI control. + /// + public static event EventHandler InputContextReset + { + add + { + lock (thisLock) + { + _imeInputContextResetDelegate = (IntPtr userData) => + { + _inputContextReset?.Invoke(null, EventArgs.Empty); + }; + ErrorCode error = ImeEventSetInputContextResetCb(_imeInputContextResetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add InputContextReset Failed with error " + error); + } + else + { + _inputContextReset += value; + } + } + } + remove + { + lock (thisLock) + { + _inputContextReset -= value; + } + } + } + + /// + /// Called when the position of the cursor in an associated text input UI control changes. + /// + public static event EventHandler CursorPositionitionUpdated + { + add + { + lock (thisLock) + { + _imeCursorPositionitionUpdatedDelegate = (int cursorPos, IntPtr userData) => + { + CursorPositionitionUpdatedEventArgs args = new CursorPositionitionUpdatedEventArgs(cursorPos); + _cursorPositionUpdated?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetCursorPositionitionUpdatedCb(_imeCursorPositionitionUpdatedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add CursorPositionitionUpdated Failed with error " + error); + } + else + { + _cursorPositionUpdated += value; + } + } + } + remove + { + lock (thisLock) + { + _cursorPositionUpdated -= value; + } + } + } + + /// + /// Called to set the preferred language to the input panel. + /// It will be only called when the client application changes the edit field's language attribute after the input panel is shown. + /// + public static event EventHandler LanguageSet + { + add + { + lock (thisLock) + { + _imeLanguageSetDelegate = (InputPanelLanguage language, IntPtr userData) => + { + LanguageSetEventArgs args = new LanguageSetEventArgs(language); + _langaugeSet?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetLanguageSetCb(_imeLanguageSetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add LanguageSet Failed with error " + error); + } + else + { + _langaugeSet += value; + } + } + } + remove + { + lock (thisLock) + { + _langaugeSet -= value; + } + } + } + + /// + /// Called to set the application specific data to deliver to the input panel. + /// + public static event EventHandler DataSet + { + add + { + lock (thisLock) + { + _imeDataSetDelegate = (IntPtr data, uint dataLength, IntPtr userData) => + { + byte[] destination = new byte[dataLength]; + Marshal.Copy(data, destination, 0, (int)dataLength); + SetDataEventArgs args = new SetDataEventArgs(destination, dataLength); + _imDataSet?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetImdataSetCb(_imeDataSetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add DataSet Failed with error " + error); + } + else + { + _imDataSet += value; + } + } + } + remove + { + lock (thisLock) + { + _imDataSet -= value; + } + } + } + + /// + /// Called when an associated text input UI control requests the input panel to set its layout. + /// It will be only called when the client application changes the edit field's layout attribute after the input panel is shown. + /// + public static event EventHandler LayoutSet + { + add + { + lock (thisLock) + { + _imeLayoutSetDelegate = (InputPanelLayout layout, IntPtr userData) => + { + LayoutSetEventArgs args = new LayoutSetEventArgs(layout); + _layoutSet?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetLayoutSetCb(_imeLayoutSetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add LayoutSet Failed with error " + error); + } + else + { + _layoutSet += value; + } + } + } + remove + { + lock (thisLock) + { + _layoutSet -= value; + } + } + } + + /// + /// Called when an associated text input UI control requests the input panel to set the Return key label. + /// The input panel can show text or image on the Return button according to the Return key action. + /// + public static event EventHandler ReturnKeySet + { + add + { + lock (thisLock) + { + _imeReturnKeySetDelegate = (InputPanelReturnKey type, IntPtr userData) => + { + ReturnKeySetEventArgs args = new ReturnKeySetEventArgs(type); + _returnKeyTypeSet?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetReturnKeySetCb(_imeReturnKeySetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add ReturnKeySet Failed with error " + error); + } + else + { + _returnKeyTypeSet += value; + } + } + } + remove + { + lock (thisLock) + { + _returnKeyTypeSet -= value; + } + } + } + + /// + /// Called when an associated text input UI control requests the input panel to enable or disable the Return key state. + /// + public static event EventHandler ReturnKeyStateSet + { + add + { + lock (thisLock) + { + _imeReturnKeyStateSetDelegate = (bool state, IntPtr userData) => + { + ReturnKeyStateSetEventArgs args = new ReturnKeyStateSetEventArgs(state); + _returnKeyStateSet?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetReturnKeyStateSetCb(_imeReturnKeyStateSetDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add ReturnKeyStateSet Failed with error " + error); + } + else + { + _returnKeyStateSet += value; + } + } + } + remove + { + lock (thisLock) + { + _returnKeyStateSet -= value; + } + } + } + + /// + /// Called when the system display language is changed. + /// + public static event EventHandler DisplayLanaguageChanged + { + add + { + lock (thisLock) + { + _imeDisplayLanaguageChangedDelegate = (IntPtr language, IntPtr userData) => + { + DisplayLanaguageChangedEventArgs args = new DisplayLanaguageChangedEventArgs(Marshal.PtrToStringAnsi(language)); + _displayLanaguageChanged?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetDisplayLanguageChangedCb(_imeDisplayLanaguageChangedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add DisplayLanaguageChanged Failed with error " + error); + } + else + { + _displayLanaguageChanged += value; + } + } + } + remove + { + lock (thisLock) + { + _displayLanaguageChanged -= value; + } + } + } + + /// + /// Called when the device is rotated. + /// + public static event EventHandler RotationChanged + { + add + { + lock (thisLock) + { + _imeRotationChangedDelegate = (int degree, IntPtr userData) => + { + RotationChangedEventArgs args = new RotationChangedEventArgs(degree); + _rotationDegreeChanged?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetRotationChangedCb(_imeRotationChangedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add RotationChanged Failed with error " + error); + } + else + { + _rotationDegreeChanged += value; + } + } + } + remove + { + lock (thisLock) + { + _rotationDegreeChanged -= value; + } + } + } + + /// + /// Called when Accessibility in Settings application is on or off. + /// + public static event EventHandler AccessibilityStateChanged + { + add + { + lock (thisLock) + { + _imeAccessibilityStateChangedDelegate = (bool state, IntPtr userData) => + { + AccessibilityStateChangedEventArgs args = new AccessibilityStateChangedEventArgs(state); + _accessibilityStateChanged?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetAccessibilityStateChangedCb(_imeAccessibilityStateChangedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add AccessibilityStateChanged Failed with error " + error); + } + else + { + _accessibilityStateChanged += value; + } + } + } + remove + { + lock (thisLock) + { + _accessibilityStateChanged -= value; + } + } + } + + /// + /// Called to create the option window. + /// + /// + /// if Input panel requests to open the option window, type will be OptionWindowType.Keyboard. + /// And if Settings application requests to open it, type will be OptionWindowType.SettingApplication. + /// + public static event EventHandler OptionWindowCreated + { + add + { + lock (thisLock) + { + _imeOptionWindowCreatedDelegate = (IntPtr window, OptionWindowType type, IntPtr userData) => + { + OptionWindow._handle = window; + OptionWindowCreatedEventArgs args = new OptionWindowCreatedEventArgs(new OptionWindow(), type); + _optionWindowCreated?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetOptionWindowCreatedCb(_imeOptionWindowCreatedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add OptionWindowCreated Failed with error " + error); + } + else + { + _optionWindowCreated += value; + } + } + } + remove + { + lock (thisLock) + { + _optionWindowCreated -= value; + } + } + } + + /// + /// Called to destroy the option window. + /// + public static event EventHandler OptionWindowDestroyed + { + add + { + lock (thisLock) + { + _imeOptionWindowDestroyedDelegate = (IntPtr window, IntPtr userData) => + { + OptionWindow._handle = window; + OptionWindowDestroyedEventArgs args = new OptionWindowDestroyedEventArgs(new OptionWindow()); + _optionWindowDestroyed?.Invoke(null, args); + }; + ErrorCode error = ImeEventSetOptionWindowDestroyedCb(_imeOptionWindowDestroyedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add OptionWindowDestroyed Failed with error " + error); + } + else + { + _optionWindowDestroyed += value; + } + } + } + remove + { + lock (thisLock) + { + _optionWindowDestroyed -= value; + } + } + } + + /// + /// Sets the languageRequested Action + /// + /// + /// Called when an associated text input UI control requests the language from the input panel, requesting for language code. + /// + public static void SetLanguageRequestedCallback(OutAction languageRequested) + { + _imeLanguageRequestedDelegate = (IntPtr userData, out IntPtr langCode) => + { + string langauage; + _languageRequestedDelegate(out langauage); + char[] languageArray = langauage.ToCharArray(); + langCode = new IntPtr(); + Marshal.Copy(languageArray, 0, langCode, languageArray.Length); + }; + ErrorCode error = ImeEventSetLanguageRequestedCallbackCb(_imeLanguageRequestedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add SetLanguageRequestedCallback Failed with error " + error); + } + _languageRequestedDelegate = languageRequested; + } + + /// + /// Sets the processKey Action + /// If the key event is from the external device, DeviceInfo will have its name, class and subclass information. + /// + /// + /// The Action is alled when the key event is received from the external devices or SendKey function. + /// This Event processes the key event before an associated text input UI control does. + /// + public static void SetProcessKeyCallback(BoolAction processKey) + { + _imeProcessKeyDelegate = (KeyCode keyCode, KeyMask keyMask, IntPtr devInfo, IntPtr userData) => + { + return _processKeyDelagate(keyCode, keyMask, new VoiceControlDeviceInformation(devInfo)); + }; + ErrorCode error = ImeEventSetProcessKeyEventCb(_imeProcessKeyDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add ProcessKey Failed with error " + error); + } + _processKeyDelagate = processKey; + } + + /// + /// Sets the imDataRequested Action + /// + /// + /// Called when an associated text input UI control requests the application specific data from the input panel, requesting for data array and it's length. + /// + public static void SetDataRequestedCallback(OutArrayAction imDataRequested) + { + _imeImDataRequestedDelegate = (IntPtr userData, out IntPtr data, out uint dataLength) => + { + byte[] dataArr; + _imDataRequestedDelegate(out dataArr); + data = new IntPtr(); + Marshal.Copy(dataArr, 0, data, dataArr.Length); + dataLength = (uint)dataArr.Length; + }; + ErrorCode error = ImeEventSetImdataRequestedCb(_imeImDataRequestedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add SetDataRequestedCallback Failed with error " + error); + } + _imDataRequestedDelegate = imDataRequested; + } + + /// + /// Sets the GeometryRequested Action + /// + /// + /// Called when an associated text input UI control requests the position and size from the input panel, requesting for x,y,w,h values. + /// + public static void SetGeometryRequestedCallback(OutAction geometryRequested) + { + _imeGeometryRequestedDelegate = (IntPtr userData, out int x, out int y, out int w, out int h) => + { + Rect rect = new Rect(); + _geometryRequestedDelegate(out rect); + x = rect.x; + y = rect.y; + w = rect.w; + h = rect.h; + }; + ErrorCode error = ImeEventSetGeometryRequestedCallbackCb(_imeGeometryRequestedDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add SetGeometryRequestedCallback Failed with error " + error); + } + _geometryRequestedDelegate = geometryRequested; + } + + /// + /// Runs the main loop of IME application. + /// This function starts to run IME application's main loop. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This API is a blocking call, as it starts the main loop of the application. + /// + /// This is called to initialize IME application before the main loop starts up + /// This is called when IME application is terminated + /// + /// This is called when IME application is shown + /// It provides the Context Inofrmation and the Context Id + /// + /// + /// This is called when IME application is hidden + /// It provides the Context Id + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) Operation failed + /// + public static void Run(Action create, Action terminate, Action show, Action hide) + { + _userCreate = create; + _userTerminate = terminate; + _userShow = show; + _userHide = hide; + _imeCallbackStructGCHandle._imeCallbackStruct.create = _create; + _imeCallbackStructGCHandle._imeCallbackStruct.terminate = _terminate; + _imeCallbackStructGCHandle._imeCallbackStruct.hide = _hide; + _imeCallbackStructGCHandle._imeCallbackStruct.show = _show; + + ErrorCode error = ImeRun(ref _imeCallbackStructGCHandle._imeCallbackStruct, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Run Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + + } + + /// + /// Sends a key event to the associated text input UI control. + /// + /// + /// This function sends key down or up event with key mask to the client application. If forwardKey is true, this key event goes to the edit filed directly. + /// And if forwardKey is false, the ProcessKey event receives the key event before the edit field. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The key code to be sent + /// The modifier key mask + /// The flag to send the key event directly to the edit field + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + public static void SendKeyEvent(KeyCode keyCode, KeyMask keyMask, bool forwardKey = false) + { + ErrorCode error = ImeSendKeyEvent(keyCode, keyMask, forwardKey); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SendEvent Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Sends the text to the associated text input UI control. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The string to be committed + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + public static void CommitString(string str) + { + ErrorCode error = ImeCommitString(str); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "CommitString Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to show preedit string. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + public static void ShowPreEditString() + { + ErrorCode error = ImeShowPreeditString(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ShowPreEditString Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to hide preedit string. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + public static void HidePreEditString() + { + ErrorCode error = ImeHidePreeditString(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "HidePreEditString Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Updates a new preedit string. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The string to be updated in preedit + /// + /// The list which has ime_preedit_attribute lists, strings can be composed of multiple string attributes: underline, highlight color and reversal color. + /// The attrs list can be empty if no attributes to set + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// 3) Invalid Parameter + /// + public static void UpdatePreEditString(string str, IEnumerable attrs) + { + IntPtr einaList = IntPtr.Zero; + List attributeHandleList = new List(); + foreach (PreEditAttribute attribute in attrs) + { + ImePreEditAttributeStruct imePreEditAttribute = new ImePreEditAttributeStruct(); + imePreEditAttribute.start = attribute.Start; + imePreEditAttribute.length = attribute.Length; + imePreEditAttribute.type = (int)attribute.Type; + imePreEditAttribute.value = attribute.Value; + GCHandle attributeHandle = GCHandle.Alloc(imePreEditAttribute, GCHandleType.Pinned); + attributeHandleList.Add(attributeHandle); + einaList = Interop.EinaList.EinaListAppend(einaList, attributeHandle.AddrOfPinnedObject()); + } + ErrorCode error = ImeUpdatePreeditString(str, einaList); + foreach (GCHandle handle in attributeHandleList) + { + handle.Free(); + } + if (error != ErrorCode.None) + { + Log.Error(LogTag, "UpdatePreEditString Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests the surrounding text from the position of the cursor, asynchronously. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The maximum length of string to be retrieved before the cursor, -1 means unlimited + /// The maximum length of string to be retrieved after the cursor, -1 means unlimited + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// + /// + /// The requested surrounding text can be received using the SurroundingTextUpdated Event, only if it is set. + /// + public static void RequestSurroundingText(int maxLenBefore, int maxLenAfter) + { + ErrorCode error = ImeRequestSurroundingText(maxLenBefore, maxLenAfter); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "RequestSurroundingText Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to delete surrounding text. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The offset value from the cursor position + /// The length of the text to delete + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// 3) Invalid Parameter + /// + public static void DeleteSurroundingText(int offset, int len) + { + ErrorCode error = ImeDeleteSurroundingText(offset, len); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "DeleteSurroundingText Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Gets the surrounding text from the position of the cursor, synchronously. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The maximum length of string to be retrieved before the cursor, -1 means unlimited + /// The maximum length of string to be retrieved after the cursor, -1 means unlimited + /// The surrounding text + /// The cursor position + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// 3) Invalid Parameter + /// 4) Failed to obtain text due to out of memory + /// + public static void GetSurroundingText(int maxLenBefore, int maxLenAfter, out string text, out int cursorPosition) + { + IntPtr txt; + ErrorCode error = ImeGetSurroundingText(maxLenBefore, maxLenAfter, out txt, out cursorPosition); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetSurroundingText Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + text = Marshal.PtrToStringAnsi(txt); + } + + /// + /// Requests to set selection. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The start cursor position in text (in characters not bytes) + /// The end cursor position in text (in characters not bytes) + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// 3) Invalid Parameter + /// + public static void SetSelection(int start, int end) + { + ErrorCode error = ImeSetSelection(start, end); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetSelection Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// This API returns the input panel main window. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The input panel main window object on success, otherwise null + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) IME main loop isn't started yet + /// 3) Operation Failed + /// + public static EditorWindow GetMainWindow() + { + EditorWindow._handle = ImeGetMainWindow(); + EditorWindow obj = new EditorWindow(); + ErrorCode error = (ErrorCode)Tizen.Internals.Errors.ErrorFacts.GetLastResult(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetMainWindow Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + return obj; + } + + /// + /// This API requests the InputMethodEditor to initialize + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) Operation Failed + /// + public static void Create() + { + ErrorCode error = ImeInitialize(); + Log.Info(LogTag, "ImeInitialize result : " + error); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ImeInitialize Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + + error = ImePrepare(); + Log.Info(LogTag, "ImePrepare result : " + error); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ImePrepare Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// This API requests the InputMethodEditor to finalize + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) Operation Failed + /// + public static void Destroy() + { + ErrorCode error = ImeFinalize(); + Log.Info(LogTag, "ImeFinalize result : " + error); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ImeFinalize Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to create an option window from the input panel. + /// The input panel can call this function to open the option window. This function calls OptionWindowCreated Event with OptionWindowType.Keyboard. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) Operation failed + /// 3) IME main loop isn't started yet + /// 4) OptionWindowCreated event has not been set + /// + /// + /// OptionWindowCreated and OptionWindowDestroyed event should be set + /// + public static void CreateOptionWindow() + { + ErrorCode error = ImeCreateOptionWindow(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "CreapteOptionWindow Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to destroy an option window. + /// The input panel can call this function to close the option window which is created from either the input panel or Settings application. + /// + /// + /// http://tizen.org/privilege/ime + /// + /// The option window to destroy + /// + /// This can occur due to the following reasons: + /// 1) The application does not have the privilege to call this function + /// 2) Invalid Parameter + /// 3) IME main loop isn't started yet + /// + /// + /// OptionWindowDestroyed Event must be set. + /// + /// + /// This function triggers the OptionWindowDestroyed Event if it is set. + /// + public static void DestroyOptionWindow(OptionWindow window) + { + ErrorCode error = ImeDestroyOptionWindow(window); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "DestroyOptionWindow Failed with error " + error); + throw InputMethodExceptionFactory.CreateException(error); + } + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs new file mode 100755 index 0000000..b4ed8bf --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/InputMethodExceptionFactory.cs @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + internal static class InputMethodExceptionFactory + { + internal static Exception CreateException(ErrorCode err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case ErrorCode.OutOfMemory: + { + exp = new InvalidOperationException("Out Of Memory"); + break; + } + + + case ErrorCode.InvalidParameter: + { + exp = new InvalidOperationException("Invalid Parameters Provided"); + break; + } + + + case ErrorCode.PermissionDenied: + { + exp = new InvalidOperationException("Permission Denied"); + break; + } + + + case ErrorCode.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + + case ErrorCode.NotRunning: + { + exp = new InvalidOperationException("IME main loop isn't started yet"); + break; + } + + case ErrorCode.NoCallbackFunction: + { + exp = new InvalidOperationException("Necessary callback/events is not set"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LanguageSetSetEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LanguageSetSetEventArgs.cs new file mode 100755 index 0000000..9cbf06b --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LanguageSetSetEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to LanguageSet Event + /// + public class LanguageSetEventArgs + { + internal LanguageSetEventArgs(InputPanelLanguage language) + { + Language = language; + } + + /// + /// The preferred language that the client application wants + /// + public InputPanelLanguage Language + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LayoutSetEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LayoutSetEventArgs.cs new file mode 100755 index 0000000..8257701 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/LayoutSetEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to LayoutSet Event + /// + public class LayoutSetEventArgs + { + internal LayoutSetEventArgs(InputPanelLayout layout) + { + Layout = layout; + } + + /// + /// The input panel layout + /// + public InputPanelLayout Layout + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindow.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindow.cs new file mode 100755 index 0000000..ca7510e --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindow.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using Tizen; +using System; +using ElmSharp; +using static Interop.InputMethod; + +namespace Tizen.Uix.InputMethod +{ + /// + /// Option window Class + /// + public class OptionWindow : Window + { + internal static IntPtr _handle = IntPtr.Zero; + private IntPtr _realHandle = IntPtr.Zero; + + internal OptionWindow():base("Option") + { + _realHandle = _handle; + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + return _handle; + } + + /// + /// The type of option window + /// + public OptionWindowType Type + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowCreatedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowCreatedEventArgs.cs new file mode 100755 index 0000000..0a32723 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowCreatedEventArgs.cs @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// Enumeration of the option window type. + /// + public enum OptionWindowType + { + /// + /// Open from Keyboard + /// + Keyboard, + /// + /// Open from Setting application + /// + SettingApplication + }; + + /// + /// This class contains information related to OptionWindowCreated event + /// + public class OptionWindowCreatedEventArgs + { + internal OptionWindowCreatedEventArgs(OptionWindow window, OptionWindowType type) + { + Window = window; + Window.Type = type; + } + + /// + /// The created window object + /// + public OptionWindow Window + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowDestroyedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowDestroyedEventArgs.cs new file mode 100755 index 0000000..975f661 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/OptionWindowDestroyedEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This class contains information related to the OptionWindowDestroyed event + /// + public class OptionWindowDestroyedEventArgs + { + internal OptionWindowDestroyedEventArgs(OptionWindow window) + { + Window = window; + } + + /// + /// The window object to destroy + /// + public OptionWindow Window + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/PreEditAttribute.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/PreEditAttribute.cs new file mode 100755 index 0000000..e10dbf3 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/PreEditAttribute.cs @@ -0,0 +1,78 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.Uix.InputMethod +{ + /// + /// Enumeration for Attribute Type + /// + public enum AttributeType + { + /// + /// No attribute + /// + None, + /// + /// A font style attribute, e.g., underline, etc. + /// + FontStyle + }; + /// + /// This class represents the attributes for preedit string. + /// + public class PreEditAttribute + { + /// + /// The start position in the string of this attribute + /// + public uint Start + { + get; + set; + } + + /// + /// The character length of this attribute, the range is [Start, Start+Length] + /// + public uint Length + { + get; + set; + } + + /// + /// The type of this attribute + /// + public AttributeType Type + { + get; + set; + } + + /// + /// The value of this attribute + /// + public uint Value + { + get; + set; + } + } +} diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyStateSetEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyStateSetEventArgs.cs new file mode 100755 index 0000000..57894aa --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyStateSetEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to ReturnKeyStateSet Event + /// + public class ReturnKeyStateSetEventArgs + { + internal ReturnKeyStateSetEventArgs(bool state) + { + State = state; + } + + /// + /// The bool state to disable Return key. The Return key is enabled by default + /// + public bool State + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyTypeSetEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyTypeSetEventArgs.cs new file mode 100755 index 0000000..339f4a0 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/ReturnKeyTypeSetEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to ReturnKeySet Event + /// + public class ReturnKeySetEventArgs + { + internal ReturnKeySetEventArgs(InputPanelReturnKey type) + { + Type = type; + } + + /// + /// The type of Return key on the input panel + /// + public InputPanelReturnKey Type + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/RotationChangedEventArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/RotationChangedEventArgs.cs new file mode 100755 index 0000000..de4b207 --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/RotationChangedEventArgs.cs @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to RotationChanged Event + /// + public class RotationChangedEventArgs + { + internal RotationChangedEventArgs(int degree) + { + Degree = degree; + } + + /// + /// The rotation degree + /// + public int Degree + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/SurroundingTextUpdatedArgs.cs b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/SurroundingTextUpdatedArgs.cs new file mode 100755 index 0000000..90b533b --- /dev/null +++ b/src/Tizen.Uix.InputMethod/Tizen.Uix.InputMethod/SurroundingTextUpdatedArgs.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.InputMethod +{ + /// + /// This Class contains data related to SurroundingTextUpdated Event + /// + public class SurroundingTextUpdatedEventArgs + { + internal SurroundingTextUpdatedEventArgs(int contextId, string text, int cursorPos) + { + ContextId = contextId; + Text = text; + CursorPosition = cursorPos; + } + + /// + /// The input context identification value of an associated text input UI control + /// + public int ContextId + { + get; + internal set; + } + + /// + /// The cursor position + /// + public int CursorPosition + { + get; + internal set; + } + + /// + /// The string requested + /// + public string Text + { + get; + internal set; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethodManager/Interop/Interop.InputMethodManager.cs b/src/Tizen.Uix.InputMethodManager/Interop/Interop.InputMethodManager.cs new file mode 100755 index 0000000..d9a4347 --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Interop/Interop.InputMethodManager.cs @@ -0,0 +1,58 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial interop class. +/// +internal static partial class Interop +{ + /// + /// InputMethodManager interop class. + /// + internal static class InputMethodManager + { + internal static string LogTag = "Tizen.Uix.InputMethodManager"; + + private const int ErrorInputMethodManager = -0x02F20000; + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + OperationFailed = ErrorInputMethodManager | 0x0010, /**< Operation failed */ + }; + + [DllImport(Libraries.InputMethodManager, EntryPoint = "ime_manager_show_ime_list")] + internal static extern ErrorCode ImeManagerShowImeList(); + + [DllImport(Libraries.InputMethodManager, EntryPoint = "ime_manager_show_ime_selector")] + internal static extern ErrorCode ImeManagerShowImeSelector(); + + [DllImport(Libraries.InputMethodManager, EntryPoint = "ime_manager_is_ime_enabled")] + internal static extern ErrorCode ImeManagerIsImeEnabled(string appId, out bool isEnabled); + + [DllImport(Libraries.InputMethodManager, EntryPoint = "ime_manager_get_active_ime")] + internal static extern ErrorCode ImeManagerGetActiveIme(out string app_id); + + [DllImport(Libraries.InputMethodManager, EntryPoint = "ime_manager_get_enabled_ime_count")] + internal static extern int ImeManagerGetEnabledImeCount(); + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethodManager/Interop/Interop.Libraries.cs b/src/Tizen.Uix.InputMethodManager/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..1dc0112 --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Interop/Interop.Libraries.cs @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +/// +/// Partial interop class. +/// +internal static partial class Interop +{ + /// + /// Partial libraries class. + /// + internal static partial class Libraries + { + public const string InputMethodManager = "libcapi-ui-inputmethod-manager.so.0"; + } +} diff --git a/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.csproj b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.sln b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.sln new file mode 100755 index 0000000..49a6f2f --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.InputMethodManager", "Tizen.Uix.InputMethodManager.csproj", "{2599421D-2A39-4EB1-B2C8-41126B6EE803}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{9853E1C3-E95E-4AE9-855A-0B32C36DCB80}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{A9FA0DB6-0919-4E3A-92F5-186486B8928D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2599421D-2A39-4EB1-B2C8-41126B6EE803}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2599421D-2A39-4EB1-B2C8-41126B6EE803}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2599421D-2A39-4EB1-B2C8-41126B6EE803}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2599421D-2A39-4EB1-B2C8-41126B6EE803}.Release|Any CPU.Build.0 = Release|Any CPU + {9853E1C3-E95E-4AE9-855A-0B32C36DCB80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9853E1C3-E95E-4AE9-855A-0B32C36DCB80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9853E1C3-E95E-4AE9-855A-0B32C36DCB80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9853E1C3-E95E-4AE9-855A-0B32C36DCB80}.Release|Any CPU.Build.0 = Release|Any CPU + {A9FA0DB6-0919-4E3A-92F5-186486B8928D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A9FA0DB6-0919-4E3A-92F5-186486B8928D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A9FA0DB6-0919-4E3A-92F5-186486B8928D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A9FA0DB6-0919-4E3A-92F5-186486B8928D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManager.cs b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManager.cs new file mode 100755 index 0000000..f260b59 --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManager.cs @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using static Interop.InputMethodManager; + +namespace Tizen.Uix.InputMethodManager +{ + /// + /// This class provides the function for launching the input method editor (IME) list and selector settings. A user can manage the installed IMEs in the system. + /// The input method editor (IME) is an input panel that lets users provide an input and the platform to receive the text data entered. + /// The manager is a module for managing the installed IMEs. + /// IME developers can use this module to open the installed IME list or the selector menu after their IME installation, and then guide to select the installed IME. + /// + public static class Manager + { + /// + /// Requests to open the installed IME list menu. + /// This API provides the installed IME list menu for IME developers who might want to open it to enable their IME. + /// + /// + /// http://tizen.org/privilege/imemanager + /// + /// + /// This exception can occur if: + /// 1) The application does not have the privilege to call this function. + /// 2) Operation failed. + /// + public static void ShowIMEList() + { + ErrorCode error = ImeManagerShowImeList(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ShowIMEList Failed with error " + error); + throw InputMethodManagerExceptionFactory.CreateException(error); + } + } + + /// + /// Requests to open the IME selector menu. + /// This API provides the IME selector menu for the IME or other application developers who might want to change the default IME. + /// + /// + /// http://tizen.org/privilege/imemanager + /// + /// + /// This exception can occur if: + /// 1) The application does not have the privilege to call this function. + /// 2) Operation failed. + /// + public static void ShowIMESelector() + { + ErrorCode error = ImeManagerShowImeSelector(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ShowIMESelector Failed with error " + error); + throw InputMethodManagerExceptionFactory.CreateException(error); + } + } + + /// + /// Checks if the specific IME is enabled or disabled in the system keyboard setting. + /// The IME developers can use this property to check if their IME is enabled or not. + /// + /// + /// http://tizen.org/privilege/imemanager + /// + /// The application ID of the IME. + /// The On (enabled) and Off (disabled) state of the IME. + /// + /// This exception can occur if an invalid parameter is provided. + /// + /// + /// This exception can occur if: + /// 1) The application does not have the privilege to call this function. + /// 2) Operation failed. + /// + public static bool IsIMEEnabled(string appId) + { + bool isIMEEnabled; + ErrorCode error = ImeManagerIsImeEnabled(appId, out isIMEEnabled); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "IsIMEEnabled Failed with error " + error); + throw InputMethodManagerExceptionFactory.CreateException(error); + } + + return isIMEEnabled; + } + + /// + /// Checks which IME is the current activated (selected) IME. + /// + /// + /// http://tizen.org/privilege/imemanager + /// + /// + /// The current activated (selected) IME. + /// + /// + /// This exception can occur if: + /// 1) The application does not have the privilege to call this function. + /// 2) Operation failed. + /// + public static string GetActiveIME() + { + string activeIME; + ErrorCode error = ImeManagerGetActiveIme(out activeIME); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetActiveIME Failed with error " + error); + throw InputMethodManagerExceptionFactory.CreateException(error); + } + + return activeIME; + } + + /// + /// Gets the number of IMEs that are enabled (usable). + /// + /// + /// http://tizen.org/privilege/imemanager + /// + /// + /// The number of enabled IMEs. + /// + /// + /// This exception can occur if: + /// 1) The application does not have the privilege to call this function. + /// 2) Operation failed. + /// + public static int GetEnabledIMECount() + { + int activeIME = ImeManagerGetEnabledImeCount(); + ErrorCode error = (ErrorCode)Tizen.Internals.Errors.ErrorFacts.GetLastResult(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetEnabledIMECount Failed with error " + error); + throw InputMethodManagerExceptionFactory.CreateException(error); + } + + return activeIME; + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManagerExceptionFactory.cs b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManagerExceptionFactory.cs new file mode 100755 index 0000000..283b633 --- /dev/null +++ b/src/Tizen.Uix.InputMethodManager/Tizen.Uix.InputMethodManager/InputMethodManagerExceptionFactory.cs @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.InputMethodManager; + +namespace Tizen.Uix.InputMethodManager +{ + internal static class InputMethodManagerExceptionFactory + { + internal static Exception CreateException(ErrorCode err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + + case ErrorCode.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + + case ErrorCode.PermissionDenied: + { + exp = new InvalidOperationException("Permission Denied"); + break; + } + + + case ErrorCode.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + + } + } +} diff --git a/src/Tizen.Uix.Stt/Interop/Interop.Libraries.cs b/src/Tizen.Uix.Stt/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..52501fb --- /dev/null +++ b/src/Tizen.Uix.Stt/Interop/Interop.Libraries.cs @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Partial Libraries Class + /// + internal static partial class Libraries + { + public const string Stt = "libstt.so"; + } +} diff --git a/src/Tizen.Uix.Stt/Interop/Interop.Stt.cs b/src/Tizen.Uix.Stt/Interop/Interop.Stt.cs new file mode 100755 index 0000000..cbf6f0d --- /dev/null +++ b/src/Tizen.Uix.Stt/Interop/Interop.Stt.cs @@ -0,0 +1,188 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Stt Interop Class + /// + internal static class Stt + { + internal static string LogTag = "Tizen.Uix.Stt"; + + private const int ErrorStt = -0x02F00000; + + internal enum SttError + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< I/O error */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, /**< No answer from the STT service */ + RecorderBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, /**< Device or resource busy */ + OutOfNetwork = Tizen.Internals.Errors.ErrorCode.Networkdown, /**< Network is down */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< STT NOT supported */ + InvalidState = ErrorStt | 0x01, /**< Invalid state */ + InvalidLanguage = ErrorStt | 0x02, /**< Invalid language */ + EngineNotFound = ErrorStt | 0x03, /**< No available engine */ + OperationFailed = ErrorStt | 0x04, /**< Operation failed */ + NotSupportedFeature = ErrorStt | 0x05, /**< Not supported feature of current engine */ + RecordingTimedOut = ErrorStt | 0x06, /**< Recording timed out */ + NoSpeech = ErrorStt | 0x07, /**< No speech while recording*/ + InProgressToReady = ErrorStt | 0x08, /**< Progress to ready is not finished*/ + InProgressToRecording = ErrorStt | 0x09, /**< Progress to recording is not finished*/ + InProgressToProcessing = ErrorStt | 0x10, /**< Progress to processing is not finished*/ + ServiceReset = ErrorStt | 0x11 /**< Service reset*/ + }; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportedEngineCallback(IntPtr handle, IntPtr engineId, IntPtr engineName, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void RecognitionResultCallback(IntPtr handle, Tizen.Uix.Stt.ResultEvent e, IntPtr data, int dataCount, IntPtr msg, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool ResultTimeCallback(IntPtr handle, int index, Tizen.Uix.Stt.TimeEvent e, IntPtr text, IntPtr startTime, IntPtr endTime, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void StateChangedCallback(IntPtr handle, Tizen.Uix.Stt.State previous, Tizen.Uix.Stt.State current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void ErrorCallback(IntPtr handle, SttError reason, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportedLanguageCallback(IntPtr handle, IntPtr language, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void DefaultLanguageChangedCallback(IntPtr handle, IntPtr previousLanguage, IntPtr currentLanguage, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void EngineChangedCallback(IntPtr handle, IntPtr engineId, IntPtr language, bool supportSilence, bool needCredential, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttCreate(out IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttDestroy(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_foreach_supported_engines", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttForeEachSupportedEngines(IntPtr handle, SupportedEngineCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_engine", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetEngine(IntPtr handle, out string engineId); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_engine", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetEngine(IntPtr handle, string engineId); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_credential", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetcredential(IntPtr handle, string credential); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_private_data", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetPrivateData(IntPtr handle, string key, string data); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_private_data", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetPrivateData(IntPtr handle, string key, out string data); + + [DllImport(Libraries.Stt, EntryPoint = "stt_prepare", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttPrepare(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unprepare", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnprepare(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_foreach_supported_languages", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttForeachSupportedLanguages(IntPtr handle, SupportedLanguageCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_default_language", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetDefaultLanguage(IntPtr handle, out string language); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_state", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetState(IntPtr handle, out Tizen.Uix.Stt.State state); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_error_message", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetErrorMessage(IntPtr handle, out string err_msg); + + [DllImport(Libraries.Stt, EntryPoint = "stt_is_recognition_type_supported", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttIsRecognitionTypeSupported(IntPtr handle, string type, out bool support); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_silence_detection", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetSilenceDetection(IntPtr handle, Tizen.Uix.Stt.SilenceDetection type); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_start_sound", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetStartSound(IntPtr handle, string filename); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_start_sound", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetStartSound(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_stop_sound", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetStopSound(IntPtr handle, string filename); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_stop_sound", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetStopSound(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_start", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttStart(IntPtr handle, string language, string type); + + [DllImport(Libraries.Stt, EntryPoint = "stt_stop", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttStop(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_cancel", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttCancel(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_get_recording_volume", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttGetRecordingVolume(IntPtr handle, out float volume); + + [DllImport(Libraries.Stt, EntryPoint = "stt_foreach_detailed_result", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttForeachDetailedResult(IntPtr handle, ResultTimeCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_recognition_result_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetRecognitionResultCB(IntPtr handle, RecognitionResultCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_recognition_result_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetRecognitionResultCB(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_state_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetStateChangedCB(IntPtr handle, StateChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_state_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetStateChangedCB(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_error_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetErrorCB(IntPtr handle, ErrorCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_error_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetErrorCB(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_default_language_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetDefaultLanguageChangedCB(IntPtr handle, DefaultLanguageChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_default_language_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetDefaultLanguageChangedCB(IntPtr handle); + + [DllImport(Libraries.Stt, EntryPoint = "stt_set_engine_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttSetEngineChangedCB(IntPtr handle, EngineChangedCallback callback, IntPtr userData); + + [DllImport(Libraries.Stt, EntryPoint = "stt_unset_engine_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern SttError SttUnsetEngineChangedCB(IntPtr handle); + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt.csproj b/src/Tizen.Uix.Stt/Tizen.Uix.Stt.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt.sln b/src/Tizen.Uix.Stt/Tizen.Uix.Stt.sln new file mode 100755 index 0000000..1436712 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.Stt", "Tizen.Uix.Stt.csproj", "{F1D65BEF-6F84-4F6B-A4E8-24BE38776F62}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{7E3F1F2B-9EA3-4C2D-98F6-C5D97ACE201B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{82C686B6-E509-458A-950D-3DE2E8E09AF9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F1D65BEF-6F84-4F6B-A4E8-24BE38776F62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F1D65BEF-6F84-4F6B-A4E8-24BE38776F62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F1D65BEF-6F84-4F6B-A4E8-24BE38776F62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F1D65BEF-6F84-4F6B-A4E8-24BE38776F62}.Release|Any CPU.Build.0 = Release|Any CPU + {7E3F1F2B-9EA3-4C2D-98F6-C5D97ACE201B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E3F1F2B-9EA3-4C2D-98F6-C5D97ACE201B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E3F1F2B-9EA3-4C2D-98F6-C5D97ACE201B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E3F1F2B-9EA3-4C2D-98F6-C5D97ACE201B}.Release|Any CPU.Build.0 = Release|Any CPU + {82C686B6-E509-458A-950D-3DE2E8E09AF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82C686B6-E509-458A-950D-3DE2E8E09AF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82C686B6-E509-458A-950D-3DE2E8E09AF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82C686B6-E509-458A-950D-3DE2E8E09AF9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/DefaultLanguageChangedEventArgs.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/DefaultLanguageChangedEventArgs.cs new file mode 100755 index 0000000..7031f5d --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/DefaultLanguageChangedEventArgs.cs @@ -0,0 +1,53 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +namespace Tizen.Uix.Stt +{ + /// + /// This class holds information about the DefaultLanguageChanged Event + /// + /// 3 + public class DefaultLanguageChangedEventArgs + { + internal DefaultLanguageChangedEventArgs(string previous, string current) + { + PreviousLanguage = previous; + CurrentLanguage = current; + } + + /// + /// The previous language + /// + /// 3 + public string PreviousLanguage + { + get; + internal set; + } + + /// + /// The current language + /// + /// 3 + public string CurrentLanguage + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/EngineChangedEventArgs.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/EngineChangedEventArgs.cs new file mode 100755 index 0000000..c6b5eee --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/EngineChangedEventArgs.cs @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Stt +{ + /// + /// This class holds information related to Engine Changed Event + /// + /// 3 + public class EngineChangedEventArgs + { + internal EngineChangedEventArgs(string engineId, string language, bool supportSilence, bool needCredential) + { + this.EngineId = engineId; + this.Language = language; + this.SupportSilence = supportSilence; + this.NeedCredential = needCredential; + } + + /// + /// Engine Id + /// + /// 3 + public string EngineId + { + get; + internal set; + } + + /// + /// Default Language + /// + /// 3 + public string Language + { + get; + internal set; + } + + /// + /// The necessity of credential + /// + /// 3 + public bool NeedCredential + { + get; + internal set; + } + + /// + /// Whether the silence detection is supported or not + /// + /// 3 + public bool SupportSilence + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ErrorOccurredEventArgs.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ErrorOccurredEventArgs.cs new file mode 100755 index 0000000..f479c2e --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ErrorOccurredEventArgs.cs @@ -0,0 +1,193 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.Stt; + +namespace Tizen.Uix.Stt +{ + /// + /// This class holds information related to the STT ErrorOccurred Event + /// + /// 3 + public class ErrorOccurredEventArgs + { + private IntPtr _handle; + + internal ErrorOccurredEventArgs(IntPtr handle, Interop.Stt.SttError error) + { + this._handle = handle; + switch (error) + { + case Interop.Stt.SttError.None: + { + ErrorValue = Error.None; + break; + } + + case Interop.Stt.SttError.OutOfMemory: + { + ErrorValue = Error.OutOfMemory; + break; + } + + case Interop.Stt.SttError.IoError: + { + ErrorValue = Error.IoError; + break; + } + + case Interop.Stt.SttError.InvalidParameter: + { + ErrorValue = Error.InvalidParameter; + break; + } + + case Interop.Stt.SttError.TimedOut: + { + ErrorValue = Error.TimedOut; + break; + } + + case Interop.Stt.SttError.RecorderBusy: + { + ErrorValue = Error.RecorderBusy; + break; + } + + case Interop.Stt.SttError.OutOfNetwork: + { + ErrorValue = Error.OutOfNetwork; + break; + } + + case Interop.Stt.SttError.PermissionDenied: + { + ErrorValue = Error.PermissionDenied; + break; + } + + case Interop.Stt.SttError.NotSupported: + { + ErrorValue = Error.NotSupported; + break; + } + + case Interop.Stt.SttError.InvalidState: + { + ErrorValue = Error.InvalidState; + break; + } + + case Interop.Stt.SttError.InvalidLanguage: + { + ErrorValue = Error.InvalidLanguage; + break; + } + + case Interop.Stt.SttError.EngineNotFound: + { + ErrorValue = Error.EngineNotFound; + break; + } + + case Interop.Stt.SttError.OperationFailed: + { + ErrorValue = Error.OperationFailed; + break; + } + + case Interop.Stt.SttError.NotSupportedFeature: + { + ErrorValue = Error.NotSupportedFeature; + break; + } + + case Interop.Stt.SttError.RecordingTimedOut: + { + ErrorValue = Error.RecordingTimedOut; + break; + } + + case Interop.Stt.SttError.NoSpeech: + { + ErrorValue = Error.NoSpeech; + break; + } + + case Interop.Stt.SttError.InProgressToReady: + { + ErrorValue = Error.InProgressToReady; + break; + } + + case Interop.Stt.SttError.InProgressToRecording: + { + ErrorValue = Error.InProgressToRecording; + break; + } + + case Interop.Stt.SttError.InProgressToProcessing: + { + ErrorValue = Error.InProgressToProcessing; + break; + } + + case Interop.Stt.SttError.ServiceReset: + { + ErrorValue = Error.ServiceReset; + break; + } + + } + } + + /// + /// The Error Value + /// + /// 3 + public Error ErrorValue + { + get; + internal set; + } + + /// + /// Gets the current error message. + /// + /// 3 + /// + /// string error message + /// + public string ErrorMessage + { + get + { + string errorMesage = ""; + SttError error = SttGetErrorMessage(_handle, out errorMesage); + if (error != SttError.None) + { + Log.Error(LogTag, "GetErrorMessage Failed with error " + error); + return ""; + } + + return errorMesage; + } + + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ExceptionFactory.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ExceptionFactory.cs new file mode 100755 index 0000000..6636ec3 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ExceptionFactory.cs @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.Stt; + +namespace Tizen.Uix.Stt +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(SttError err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case SttError.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case SttError.IoError: + { + exp = new InvalidOperationException("I/O Error Occurred"); + break; + } + + case SttError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case SttError.TimedOut: + { + exp = new TimeoutException("No answer from the STT service"); + break; + } + + case SttError.OutOfNetwork: + { + exp = new InvalidOperationException("Network is down"); + break; + } + + case SttError.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + case SttError.NotSupported: + { + exp = new NotSupportedException("STT NOT supported"); + break; + } + + case SttError.InvalidState: + { + exp = new InvalidOperationException("Invalid state"); + break; + } + + case SttError.InvalidLanguage: + { + exp = new InvalidOperationException("Invalid language"); + break; + } + + case SttError.EngineNotFound: + { + exp = new InvalidOperationException("No available engine"); + break; + } + + case SttError.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case SttError.NotSupportedFeature: + { + exp = new InvalidOperationException("Not supported feature of current engine"); + break; + } + + case SttError.RecordingTimedOut: + { + exp = new InvalidOperationException("Recording timed out"); + break; + } + + case SttError.NoSpeech: + { + exp = new InvalidOperationException("No speech while recording"); + break; + } + + case SttError.InProgressToReady: + { + exp = new InvalidOperationException("Progress to ready is not finished"); + break; + } + + case SttError.InProgressToRecording: + { + exp = new InvalidOperationException("Progress to recording is not finished"); + break; + } + + case SttError.InProgressToProcessing: + { + exp = new InvalidOperationException("Progress to processing is not finished"); + break; + } + + case SttError.ServiceReset: + { + exp = new InvalidOperationException("Service reset"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/RecognitionResultEventArgs.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/RecognitionResultEventArgs.cs new file mode 100755 index 0000000..2618585 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/RecognitionResultEventArgs.cs @@ -0,0 +1,149 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Stt; +using static Tizen.Uix.Stt.ResultTime; + +namespace Tizen.Uix.Stt +{ + /// + /// The recognition result from the engine. + /// + /// 3 + public class RecognitionResultEventArgs + { + private ResultEvent _result; + private List _data = new List(); + private ResultMessage _msg; + private int _dataCount; + + internal RecognitionResultEventArgs(ResultEvent e, IntPtr data, int count, string msg) + { + _result = e; + switch (msg) + { + case "stt.result.message.none": + { + _msg = ResultMessage.None; + break; + } + + case "stt.result.message.error.too.soon": + { + _msg = ResultMessage.TooSoon; + break; + } + + case "stt.result.message.error.too.short": + { + _msg = ResultMessage.TooShort; + break; + } + + case "stt.result.message.error.too.long": + { + _msg = ResultMessage.TooLong; + break; + } + + case "stt.result.message.error.too.quiet": + { + _msg = ResultMessage.TooQuiet; + break; + } + + case "stt.result.message.error.too.loud": + { + _msg = ResultMessage.TooLoud; + break; + } + + case "stt.result.message.error.too.fast": + { + _msg = ResultMessage.TooFast; + break; + } + + } + + this._dataCount = count; + + _data.Clear(); + if (count > 0) + { + IntPtr[] dataArray = new IntPtr[count]; + Marshal.Copy(data, dataArray, 0, count); + foreach (IntPtr handle in dataArray) + { + string info = Marshal.PtrToStringAnsi(handle); + _data.Add(info); + } + } + } + + /// + /// The result event + /// + /// 3 + public ResultEvent Result + { + get + { + return _result; + } + } + + /// + /// Result texts. + /// + /// 3 + public IEnumerable Data + { + get + { + return _data; + } + } + + /// + /// Returns the Result text count. + /// + /// 3 + public int DataCount + { + get + { + return _dataCount; + } + } + + /// + /// Engine message + /// + /// 3 + public ResultMessage Message + { + get + { + return _msg; + } + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ResultTime.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ResultTime.cs new file mode 100755 index 0000000..ecf0b91 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/ResultTime.cs @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using static Interop.Stt; + +namespace Tizen.Uix.Stt +{ + /// + /// This Class represents the result of recognition result from the engine. + /// + /// 3 + public class ResultTime + { + internal ResultTime(int index, TimeEvent e, string text, long startTime, long endTime) + { + Index = index; + TokenEvent = e; + Text = text; + StartTime = startTime; + EndTime = endTime; + } + + /// + /// The result index + /// + /// 3 + public int Index + { + get; + internal set; + } + + /// + /// The token event + /// + /// 3 + public TimeEvent TokenEvent + { + get; + internal set; + } + + /// + /// The result text + /// + /// 3 + public string Text + { + get; + internal set; + } + + /// + /// The start time of result text + /// + /// 3 + public long StartTime + { + get; + internal set; + } + + /// + /// The end time of result text + /// + /// 3 + public long EndTime + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/StateChangedEventArgs.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/StateChangedEventArgs.cs new file mode 100755 index 0000000..eb55c4c --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/StateChangedEventArgs.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Stt +{ + /// + /// This class holds information related to the STT StateChanged event + /// + /// 3 + public class StateChangedEventArgs + { + internal StateChangedEventArgs(State previous, State current) + { + Previous = previous; + Current = current; + } + + /// + /// A previous state + /// + /// 3 + public State Previous + { + get; + internal set; + } + /// + /// A current state + /// + /// 3 + public State Current + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SttClient.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SttClient.cs new file mode 100644 index 0000000..c08f390 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SttClient.cs @@ -0,0 +1,1519 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Stt; + +namespace Tizen.Uix.Stt +{ + /// + /// The token event + /// + /// 3 + public enum ResultEvent + { + /// + /// Event when the recognition full or last result is ready + /// + /// 3 + FinalResult = 0, + /// + /// Event when the recognition partial result is ready + /// + /// 3 + PartialResult, + /// + /// Event when the recognition has failed + /// + /// 3 + Error + }; + + /// + /// Enumeration representing the result message + /// + /// 3 + public enum ResultMessage + { + /// + /// No Error + /// + /// 3 + None, + /// + /// Recognition failed because the speech started too soon. + /// + /// 3 + TooSoon, + /// + /// Recognition failed because the speech is too short. + /// + /// 3 + TooShort, + /// + /// Recognition failed because the speech is too long. + /// + /// 3 + TooLong, + /// + /// Recognition failed because the speech is too quiet to listen. + /// + /// 3 + TooQuiet, + /// + /// Recognition failed because the speech is too loud to listen. + /// + /// 3 + TooLoud, + /// + /// Recognition failed because the speech is too fast to listen. + /// + /// 3 + TooFast + }; + + /// + /// Enumeration for the Token type + /// + /// 3 + public enum TimeEvent + { + /// + /// Event when the token is beginning type + /// + /// 3 + Beginning = 0, + /// + /// Event when the token is middle type + /// + /// 3 + Middle = 1, + /// + /// Event when the token is end type + /// + /// 3 + End = 2 + }; + + /// + /// Enum for Error values that can occur + /// + /// 3 + public enum Error + { + /// + /// Successful, No error + /// + /// 3 + None, + /// + /// Out of Memory + /// + /// 3 + OutOfMemory, + /// + /// I/O error + /// + /// 3 + IoError, + /// + /// Invalid parameter + /// + /// 3 + InvalidParameter, + /// + /// No answer from the STT service + /// + /// 3 + TimedOut, + /// + /// Device or resource busy + /// + /// 3 + RecorderBusy, + /// + /// Network is down + /// + /// 3 + OutOfNetwork, + /// + /// Permission denied + /// + /// 3 + PermissionDenied, + /// + /// STT NOT supported + /// + /// 3 + NotSupported, + /// + /// Invalid state + /// + /// 3 + InvalidState, + /// + /// Invalid language + /// + /// 3 + InvalidLanguage, + /// + /// No available engine + /// + /// 3 + EngineNotFound, + /// + /// Operation failed + /// + /// 3 + OperationFailed, + /// + /// Not supported feature of current engine + /// + /// 3 + NotSupportedFeature, + /// + /// Recording timed out + /// + /// 3 + RecordingTimedOut, + /// + /// No speech while recording + /// + /// 3 + NoSpeech, + /// + /// Progress to ready is not finished + /// + /// 3 + InProgressToReady, + /// + /// Progress to recording is not finished + /// + /// 3 + InProgressToRecording, + /// + /// Progress to processing is not finished + /// + /// 3 + InProgressToProcessing, + /// + /// Service reset + /// + /// 3 + ServiceReset + }; + + /// + /// Enumeration for Recognition Types + /// + /// 3 + public enum RecognitionType + { + /// + /// Free form dictation + /// + /// 3 + Free, + /// + /// Continuous free dictation. + /// + /// 3 + Partial, + /// + /// Search + /// + /// 3 + Search, + /// + /// Web Search + /// + /// 3 + WebSearch, + /// + /// Map + /// + /// 3 + Map + }; + + /// + /// Enumeration for the State types + /// + /// 3 + public enum State + { + /// + /// Created state + /// + /// 3 + Created = 0, + /// + /// Ready state + /// + /// 3 + Ready = 1, + /// + /// Recording state + /// + /// 3 + Recording = 2, + /// + /// Processing state + /// + /// 3 + Processing = 3, + /// + /// Unavailable + /// + /// 3 + Unavailable + }; + + /// + /// Enumeration for the Silence Detection types + /// + /// 3 + public enum SilenceDetection + { + /// + /// Silence detection type - False + /// + /// 3 + False = 0, + /// + /// Silence detection type - True + /// + /// 3 + True = 1, + /// + /// Silence detection type - Auto + /// + /// 3 + Auto = 2 + }; + + /// + /// A main function of Speech-To-Text (below STT) API recognizes sound data recorded by users. + /// After choosing a language, applications will start recording and recognizing. + /// After recording, the applications will receive the recognized result. + /// The STT has a client-server for the service of multi-applications. + /// The STT service always works in the background as a server. If the service is not working, client library will invoke it and client will communicate with it. + /// The service has engines and the recorder so client does not have the recorder itself. Only the client request commands to the STT service for using STT. + /// + /// 3 + public class SttClient : IDisposable + { + private IntPtr _handle; + private Object thisLock = new Object(); + private event EventHandler _recognitionResult; + private event EventHandler _stateChanged; + private event EventHandler _errorOccurred; + private event EventHandler _defaultLanguageChanged; + private event EventHandler _engineChanged; + private bool disposedValue = false; + private Interop.Stt.RecognitionResultCallback _resultDelegate; + private Interop.Stt.StateChangedCallback _stateDelegate; + private Interop.Stt.ErrorCallback _errorDelegate; + private Interop.Stt.DefaultLanguageChangedCallback _languageDelegate; + private Interop.Stt.EngineChangedCallback _engineDelegate; + private ResultTime _result; + private ResultTimeCallback _resultTimeDelegate; + + /// + /// Constructor to create a STT instance. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Out of Memory. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + public SttClient() + { + IntPtr handle; + SttError error = SttCreate(out handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Create Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + _handle = handle; + } + + /// + /// Event to be invoked when the recognition is done. + /// + /// 3 + public event EventHandler RecognitionResult + { + add + { + lock (thisLock) + { + _resultDelegate = (IntPtr handle, ResultEvent e, IntPtr data, int dataCount, IntPtr msg, IntPtr userData) => + { + Log.Info(LogTag, "Recognition Result Event Triggered"); + if (data != null && msg != null) + { + RecognitionResultEventArgs args = new RecognitionResultEventArgs(e, data, dataCount, Marshal.PtrToStringAnsi(msg)); + _recognitionResult?.Invoke(this, args); + } + else + { + Log.Info(LogTag, "Recognition Result Event null received"); + } + }; + SttError error = SttSetRecognitionResultCB(_handle, _resultDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Add RecognitionResult Failed with error " + error); + } + else + { + _recognitionResult += value; + } + } + } + + remove + { + lock (thisLock) + { + SttError error = SttUnsetRecognitionResultCB(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Remove RecognitionResult Failed with error " + error); + } + + _recognitionResult -= value; + } + } + } + + /// + /// Event to be invoked when STT state changes. + /// + /// 3 + public event EventHandler StateChanged + { + add + { + lock (thisLock) + { + SttClient obj = this; + _stateDelegate = (IntPtr handle, State previous, State current, IntPtr userData) => + { + StateChangedEventArgs args = new StateChangedEventArgs(previous, current); + _stateChanged?.Invoke(obj, args); + }; + SttError error = SttSetStateChangedCB(_handle, _stateDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Add StateChanged Failed with error " + error); + } + else + { + _stateChanged += value; + } + + } + } + + remove + { + lock (thisLock) + { + SttError error = SttUnsetStateChangedCB(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Remove StateChanged Failed with error " + error); + } + + _stateChanged -= value; + } + } + + } + + /// + /// Event to be invoked when an error occurs. + /// + /// 3 + public event EventHandler ErrorOccurred + { + add + { + lock (thisLock) + { + _errorDelegate = (IntPtr handle, SttError reason, IntPtr userData) => + { + ErrorOccurredEventArgs args = new ErrorOccurredEventArgs(handle, reason); + _errorOccurred?.Invoke(this, args); + }; + SttError error = SttSetErrorCB(_handle, _errorDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Add ErrorOccurred Failed with error " + error); + } + + else + { + _errorOccurred += value; + } + } + + } + + remove + { + lock (thisLock) + { + SttError error = SttUnsetErrorCB(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Remove ErrorOccurred Failed with error " + error); + } + + _errorOccurred -= value; + } + } + } + + /// + /// Event to be invoked when default language change. + /// + /// 3 + public event EventHandler DefaultLanguageChanged + { + add + { + lock (thisLock) + { + _languageDelegate = (IntPtr handle, IntPtr previousLanguage, IntPtr currentLanguage, IntPtr userData) => + { + string previousLanguageString = Marshal.PtrToStringAnsi(previousLanguage); + string currentLanguageString = Marshal.PtrToStringAnsi(currentLanguage); + DefaultLanguageChangedEventArgs args = new DefaultLanguageChangedEventArgs(previousLanguageString, currentLanguageString); + _defaultLanguageChanged?.Invoke(this, args); + }; + SttError error = SttSetDefaultLanguageChangedCB(_handle, _languageDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Add DefaultLanguageChanged Failed with error " + error); + } + + else + { + _defaultLanguageChanged += value; + } + } + + } + + remove + { + lock (thisLock) + { + SttError error = SttUnsetDefaultLanguageChangedCB(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Remove DefaultLanguageChanged Failed with error " + error); + } + + _defaultLanguageChanged -= value; + } + } + + } + + /// + /// Event to be invoked to detect engine change. + /// + /// 3 + public event EventHandler EngineChanged + { + add + { + lock (thisLock) + { + _engineDelegate = (IntPtr handle, IntPtr engineId, IntPtr language, bool supportSilence, bool needCredential, IntPtr userData) => + { + string engineIdString = Marshal.PtrToStringAnsi(engineId); + string languageString = Marshal.PtrToStringAnsi(language); + EngineChangedEventArgs args = new EngineChangedEventArgs(engineIdString, languageString, supportSilence, needCredential); + _engineChanged?.Invoke(this, args); + }; + SttError error = SttSetEngineChangedCB(_handle, _engineDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Add EngineChanged Failed with error " + error); + } + else + { + _engineChanged += value; + } + } + } + + remove + { + lock (thisLock) + { + SttError error = SttUnsetEngineChangedCB(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Remove EngineChanged Failed with error " + error); + } + + _engineChanged -= value; + } + } + } + + /// + /// Gets the default language set by the user. + /// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English. + /// + /// 3 + /// + /// Default language in STT. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// Default Language string value. + /// + public string DefaultLanguage + { + get + { + string language; + lock (thisLock) + { + SttError error = SttGetDefaultLanguage(_handle, out language); + if (error != SttError.None) + { + Log.Error(LogTag, "DefaultLanguage Failed with error " + error); + return ""; + } + } + + return language; + } + } + + /// + /// Gets the microphone volume during recording. + /// + /// 3 + /// + /// Recording volume in STT. + /// + /// + /// http://tizen.org/privilege/recorder + /// + ///
+        /// The State must be Recording.
+        /// 
+ public float RecordingVolume + { + get + { + float volume; + lock (thisLock) + { + SttError error = SttGetRecordingVolume(_handle, out volume); + if (error != SttError.None) + { + Log.Error(LogTag, "GetRecordingVolume Failed with error " + error); + return 0.0f; + } + + } + + return volume; + } + + } + + /// + /// Gets the current STT state. + /// + /// 3 + /// + /// Current state of STT. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// Current STT State value. + /// + public State CurrentState + { + get + { + State state; + lock (thisLock) + { + SttError error = SttGetState(_handle, out state); + if (error != SttError.None) + { + Log.Error(LogTag, "GetState Failed with error " + error); + return State.Unavailable; + } + } + + return state; + } + + } + + /// + /// This property can be used to get and set the current engine id. + /// + /// 3 + /// + /// Current STT engine id. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// This Exception can occur while setting due to the following reasons + /// 1. Operation Failed + /// 2. Invalid State + /// + /// This Exception can be due to Out of Memory. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + /// This can happen if Improper EngineId is provided while setting the value. + ///
+        /// The State must be Created.
+        /// 
+ public string Engine + { + get + { + string engineId; + lock (thisLock) + { + SttError error = SttGetEngine(_handle, out engineId); + if (error != SttError.None) + { + Log.Error(LogTag, "Get EngineId Failed with error " + error); + return ""; + } + } + + return engineId; + } + set + { + lock (thisLock) + { + SttError error = SttSetEngine(_handle, value); + if (error != SttError.None) + { + Log.Error(LogTag, "Set EngineId Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + } + } + + /// + /// Retrieves the time stamp of the current recognition result + /// + /// 3 + /// + /// list of ResultTime + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This function should only be called in RecognitionResult Event + /// + /// This Exception can be due to Operation Failed. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + public IEnumerable GetDetailedResult() + { + List list = new List(); + _resultTimeDelegate = (IntPtr handle, int index, TimeEvent e, IntPtr text, IntPtr startTime, IntPtr endTime, IntPtr userData) => + { + _result = new ResultTime(index, e, Marshal.PtrToStringAnsi(text), (long)startTime, (long)endTime); + list.Add(_result); + return true; + }; + SttError error = SttForeachDetailedResult(_handle, _resultTimeDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "GetDetailedResult Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + return list; + } + + + /// + /// Gets the private data from stt engine. + /// + /// 3 + /// + /// The key string + /// + /// + /// The Data Corresponding to the Key provided + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to No Answer from STT Service. + ///
+        /// The State must be Ready.
+        /// 
+ public string GetPrivateData(string key) + { + string data; + lock (thisLock) + { + SttError error = SttGetPrivateData(_handle, key, out data); + if (error != SttError.None) + { + Log.Error(LogTag, "GetPrivateData Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + return data; + } + + /// + /// Sets the private data to stt engine. + /// + /// 3 + /// + /// The key string + /// + /// + /// The data string + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to No Answer from STT Service. + /// This can happen if Improper value is provided while setting the value. + ///
+        /// The State must be Ready.
+        /// 
+ public void SetPrivateData(string key, string data) + { + lock (thisLock) + { + SttError error = SttSetPrivateData(_handle, key, data); + if (error != SttError.None) + { + Log.Error(LogTag, "SetPrivateData Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Gets the list of Supported Engine + /// + /// 3 + /// + /// IEnumerable<SupportedEngine> list of supported engines + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Out of Memory. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + public IEnumerable GetSupportedEngines() + { + List engineList = new List(); + lock (thisLock) + { + SupportedEngineCallback supportedEngineDelegate = (IntPtr handle, IntPtr engineId, IntPtr engineName, IntPtr userData) => + { + string id = Marshal.PtrToStringAnsi(engineId); + string name = Marshal.PtrToStringAnsi(engineName); + SupportedEngine engine = new SupportedEngine(id, name); + engineList.Add(engine); + return true; + }; + SttError error = SttForeEachSupportedEngines(_handle, supportedEngineDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "Create Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + return engineList; + } + + /// + /// Sets the app credential + /// + /// 3 + /// + /// The credential string + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Operation Failed + /// 2. Invalid State + /// + /// This Exception can be due to Out of Memory. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + /// This can happen if Improper value is provided while setting the value. + ///
+        /// The State must be Created.
+        /// 
+ public void SetCredential(string credential) + { + lock (thisLock) + { + SttError error = SttSetcredential(_handle, credential); + if (error != SttError.None) + { + Log.Error(LogTag, "SetCredential Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Connects to the STT service asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State must be Created.
+        /// 
+ /// + /// If this function is successful, the STT state will be Ready + /// If this function is unsuccessful, ErrorOccurred event will be invoked + /// + public void Prepare() + { + lock (thisLock) + { + SttError error = SttPrepare(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "SetEngine Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Disconnects from the STT service. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State must be Ready.
+        /// 
+ /// + /// If this function is successful, the STT state will be Created + /// + public void Unprepare() + { + lock (thisLock) + { + SttError error = SttUnprepare(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Unprepare Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Retrieves all supported languages of current engine. + /// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// list of strings of supported languages. + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Engine Not Found. + /// 2. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + public IEnumerable GetSupportedLanguages() + { + List languageList = new List(); + lock (thisLock) + { + SupportedLanguageCallback supportedLanguageDelegate = (IntPtr handle, IntPtr language, IntPtr userData) => + { + string lang = Marshal.PtrToStringAnsi(language); + languageList.Add(lang); + return true; + }; + + SttError error = SttForeachSupportedLanguages(_handle, supportedLanguageDelegate, IntPtr.Zero); + if (error != SttError.None) + { + Log.Error(LogTag, "GetSupportedLanguages Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + return languageList; + } + + /// + /// Checks whether the recognition type is supported. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// RecognitionType value. + /// + /// + /// bool value indicating whether the recognition type is supported. + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State + /// 2. Engine Not Found. + /// 3. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + ///
+        /// The state should be Ready.
+        /// 
+ public bool IsRecognitionTypeSupported(RecognitionType type) + { + bool supported; + lock (thisLock) + { + string recType = "stt.recognition.type.FREE"; + switch (type) + { + case RecognitionType.Free: + { + recType = "stt.recognition.type.FREE"; + break; + } + + case RecognitionType.Partial: + { + recType = "stt.recognition.type.FREE.PARTIAL"; + break; + } + + case RecognitionType.Search: + { + recType = "stt.recognition.type.SEARCH"; + break; + } + + case RecognitionType.WebSearch: + { + recType = "stt.recognition.type.WEB_SEARCH"; + break; + } + + case RecognitionType.Map: + { + recType = "stt.recognition.type.MAP"; + break; + } + + } + + SttError error = SttIsRecognitionTypeSupported(_handle, recType, out supported); + if (error != SttError.None) + { + Log.Error(LogTag, "IsRecognitionTypeSupported Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + } + + return supported; + } + + /// + /// Sets the silence detection. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// SilenceDetection value. + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State + /// 2. Not supported feature of current engine. + /// 3. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + ///
+        /// The state should be Ready.
+        /// 
+ public void SetSilenceDetection(SilenceDetection type) + { + lock (thisLock) + { + SttError error = SttSetSilenceDetection(_handle, type); + if (error != SttError.None) + { + Log.Error(LogTag, "SetSilenceDetection Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Sets the sound to start recording. + /// Sound file type should be wav type. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// File Path for the sound. + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + /// If an Invalid Parameter is provided. + ///
+        /// The state should be Ready.
+        /// 
+ public void SetStartSound(string filePath) + { + lock (thisLock) + { + SttError error = SttSetStartSound(_handle, filePath); + if (error != SttError.None) + { + Log.Error(LogTag, "SetStartSound Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Unsets the sound to start recording. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The state should be Ready.
+        /// 
+ public void UnsetStartSound() + { + lock (thisLock) + { + SttError error = SttUnsetStartSound(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "UnsetStartSound Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Sets the sound to stop recording. + /// Sound file type should be wav type. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// File Path for the sound. + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + /// If an Invalid Parameter is provided. + ///
+        /// The state should be Ready.
+        /// 
+ public void SetStopSound(string filePath) + { + lock (thisLock) + { + SttError error = SttSetStopSound(_handle, filePath); + if (error != SttError.None) + { + Log.Error(LogTag, "SetStopSound Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Unsets the sound to stop recording. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The state should be Ready.
+        /// 
+ public void UnsetStopSound() + { + lock (thisLock) + { + SttError error = SttUnsetStopSound(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "UnsetStopSound Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Starts recording and recognition asynchronously. + /// This function starts recording in the STT service and sending recording data to engine. + /// This work continues until Stop, Cancel or silence detected by engine + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// The language selected + /// + /// + /// The type for recognition + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// 3. Recorder Busy. + /// 4. Progress to recording is not finished + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + /// If an Invalid Language is provided. + ///
+        /// The state should be Ready.
+        /// 
+ /// + /// It will invoke StateChanged Event if registered. + /// If this function succeeds, the STT state will be Recording. + /// If you call this function again before state changes, you will receive ErrorINProgressToRecording. + /// + public void Start(string language, RecognitionType type) + { + lock (thisLock) + { + string recType = "stt.recognition.type.FREE"; + switch (type) + { + case RecognitionType.Free: + { + recType = "stt.recognition.type.FREE"; + break; + } + + case RecognitionType.Partial: + { + recType = "stt.recognition.type.FREE.PARTIAL"; + break; + } + + case RecognitionType.Search: + { + recType = "stt.recognition.type.SEARCH"; + break; + } + + case RecognitionType.WebSearch: + { + recType = "stt.recognition.type.WEB_SEARCH"; + break; + } + + case RecognitionType.Map: + { + recType = "stt.recognition.type.MAP"; + break; + } + + } + + SttError error = SttStart(_handle, language, recType); + if (error != SttError.None) + { + Log.Error(LogTag, "Start Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Finishes the recording and starts recognition processing in engine asynchronously. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// 3. Progress to ready is not finished. + /// 4. Progress to recording is not finished. + /// 5. Progress to processing is not finished. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The state should be Recording.
+        /// 
+ /// + /// It will invoke StateChanged Event if registered. + /// If this function succeeds, the STT state will be Processing. + /// If you call this function again before state changes, you will receive ErrorINProgressToProcessing. + /// After processing of engine, RecognitionResult event is invoked + /// + public void Stop() + { + lock (thisLock) + { + SttError error = SttStop(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Stop Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Cancels processing recognition and recording asynchronously. + /// This function cancels recording and engine cancels recognition processing. + /// After successful cancel, StateChanged event is invoked otherwise if error is occurred, ErrorOccurred event is invoked. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// http://tizen.org/feature/speech.recognition + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reasons + /// 1. Invalid State. + /// 2. Operation Failed. + /// 3. Progress to ready is not finished. + /// 4. Progress to recording is not finished. + /// 5. Progress to processing is not finished. + /// + /// This Exception can be due to STT Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The state should be Recording or Processing.
+        /// 
+ /// + /// It will invoke StateChanged Event if registered. + /// If this function succeeds, the STT state will be Ready. + /// If you call this function again before state changes, you will receive ErrorINProgressToReady. + /// + public void Cancel() + { + lock (thisLock) + { + SttError error = SttCancel(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Cancel Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Method to release resources + /// + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + SttError error = SttDestroy(_handle); + if (error != SttError.None) + { + Log.Error(LogTag, "Destroy Failed with error " + error); + } + } + + disposedValue = true; + } + } + } +} diff --git a/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SupportedEngine.cs b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SupportedEngine.cs new file mode 100755 index 0000000..d2129e8 --- /dev/null +++ b/src/Tizen.Uix.Stt/Tizen.Uix.Stt/SupportedEngine.cs @@ -0,0 +1,64 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Stt +{ + /// + /// This Class provideds the Information related to STT Engine. + /// + /// 3 + public class SupportedEngine + { + private string _engineId; + private string _engineName; + + internal SupportedEngine(string id, string name) + { + this._engineId = id; + this._engineName = name; + } + /// + /// The Engine Id + /// + /// 3 + /// + /// The string Engine Id + /// + public string EngineId + { + get + { + return _engineId; + } + } + + /// + /// The Engine Name + /// + /// 3 + /// + /// The string Engine Name + /// + public string EngineName + { + get + { + return _engineName; + } + } + } +} diff --git a/src/Tizen.Uix.SttEngine/Interop/Interop.Libraries.cs b/src/Tizen.Uix.SttEngine/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..83566e5 --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Interop/Interop.Libraries.cs @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Partial Libraries Class + /// + internal static partial class Libraries + { + internal const string SttEngine = "libstt_engine.so"; + } +} diff --git a/src/Tizen.Uix.SttEngine/Interop/Interop.SttEngine.cs b/src/Tizen.Uix.SttEngine/Interop/Interop.SttEngine.cs new file mode 100755 index 0000000..dc07ccf --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Interop/Interop.SttEngine.cs @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.SttEngine; +using static Tizen.Uix.SttEngine.Engine; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// SttEngine Interop Class + /// + internal static class SttEngine + { + internal static string LogTag = "Tizen.Uix.SttEngine"; + + private const int ErrorStt = -0x02F00000; + + public enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< I/O error */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + NetworkDown = Tizen.Internals.Errors.ErrorCode.Networkdown, /**< Network down(Out of network) */ + InvalidState = ErrorStt | 0x01, /**< Invalid state */ + InvalidLanguage = ErrorStt | 0x02, /**< Invalid language */ + OperationFailed = ErrorStt | 0x04, /**< Operation failed */ + NotSupportedFeature = ErrorStt | 0x05, /**< Not supported feature of current engine */ + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< Device or resource busy */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + RecordingTimedOut = ErrorStt | 0x06, /**< Recording timed out */ + }; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error InitializeCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error DeinitializeCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error ForEachSupportedLangsCb(SupportedLanguages cb, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error IsValidLanguageCb(IntPtr language, IntPtr isValid); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool SupportSilenceDetectionCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error SupportRecognitionTypeCb(string type, out bool isSupported); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error GetRecordingFormatCb(out AudioType types, out int rate, out int channels); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error SetSilenceDetectionCb(bool isSet); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error CheckAppAgreedCb(string appid, out bool isAgreed); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool NeedAppCredentialCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error ForEachResultTimeCb(IntPtr timeInfo, ResultTime callback, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error StartCb(IntPtr language, IntPtr type, IntPtr appid, IntPtr credential, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error SetRecordingDataCb(string data, uint length); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error StopCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error CancelCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error GetInfoCb(out IntPtr engineUuid, out IntPtr engineName, out IntPtr engineSetting, out IntPtr useNetwork); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error PrivateDataSetCb(string key, string data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error PrivateDataRequestedCb(string key, out string data); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + internal struct RequestCallbackStruct + { + internal int version; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal GetInfoCb getInfo; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal InitializeCb initialize; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal DeinitializeCb deinitialize; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ForEachSupportedLangsCb supportedLanaguge; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal IsValidLanguageCb validLanaguage; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal SupportSilenceDetectionCb silence; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal SupportRecognitionTypeCb recognitionType; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal GetRecordingFormatCb recordingFormat; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ForEachResultTimeCb resultTime; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal SetSilenceDetectionCb silenceDetection; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal StartCb start; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal SetRecordingDataCb recordingData; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal StopCb stop; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal CancelCb cancel; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal CheckAppAgreedCb checkAppAgreed; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal NeedAppCredentialCb needAppCredential; + }; + + internal sealed class CallbackStructGCHandle : IDisposable + { + internal RequestCallbackStruct CallbackStruct; + internal GCHandle CallbackStructHandle; + public CallbackStructGCHandle() + { + CallbackStruct = new RequestCallbackStruct(); + CallbackStructHandle = GCHandle.Alloc(CallbackStruct); + } + + #region IDisposable Support + private bool disposedValue = false; + + void Dispose(bool disposing) + { + Tizen.Log.Info(LogTag, "In Dispose"); + if (!disposedValue) + { + if (disposing) + { + Tizen.Log.Info(LogTag, "In Dispose free called"); + CallbackStructHandle.Free(); + } + + disposedValue = true; + } + } + + public void Dispose() + { + Dispose(true); + } + #endregion + } + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_main")] + internal static extern Error STTEMain(int argc, string[] argv, IntPtr callback); + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_send_result")] + internal static extern Error STTESendResult(ResultEvent resultEvent, string type, string[] result, int resultCount, string msg, IntPtr timeInfo, IntPtr userData); + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_send_error")] + internal static extern Error STTESendError(Error error, string msg); + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_send_speech_status")] + internal static extern Error STTESendSpeechStatus(SpeechStatus status, IntPtr userData); + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_set_private_data_set_cb")] + internal static extern Error STTESetPrivateDataSetCb(PrivateDataSetCb callbackFunc); + + [DllImport(Libraries.SttEngine, EntryPoint = "stte_set_private_data_requested_cb")] + internal static extern Error STTESetPrivateDataRequestedCb(PrivateDataRequestedCb callbackFunc); + } +} diff --git a/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.csproj b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.csproj new file mode 100755 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.sln b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.sln new file mode 100755 index 0000000..4b499e7 --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.SttEngine", "Tizen.Uix.SttEngine.csproj", "{EBBE8616-439A-4C62-8E4A-F0777502AC82}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{CB914098-FA2E-47CE-8B1B-CE5E319AEF37}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{CBF2A756-AFBE-406F-84F9-CFAA8EF96E4B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBBE8616-439A-4C62-8E4A-F0777502AC82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EBBE8616-439A-4C62-8E4A-F0777502AC82}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EBBE8616-439A-4C62-8E4A-F0777502AC82}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EBBE8616-439A-4C62-8E4A-F0777502AC82}.Release|Any CPU.Build.0 = Release|Any CPU + {CB914098-FA2E-47CE-8B1B-CE5E319AEF37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB914098-FA2E-47CE-8B1B-CE5E319AEF37}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB914098-FA2E-47CE-8B1B-CE5E319AEF37}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB914098-FA2E-47CE-8B1B-CE5E319AEF37}.Release|Any CPU.Build.0 = Release|Any CPU + {CBF2A756-AFBE-406F-84F9-CFAA8EF96E4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBF2A756-AFBE-406F-84F9-CFAA8EF96E4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBF2A756-AFBE-406F-84F9-CFAA8EF96E4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBF2A756-AFBE-406F-84F9-CFAA8EF96E4B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/ExceptionFactory.cs b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/ExceptionFactory.cs new file mode 100755 index 0000000..29db48d --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/ExceptionFactory.cs @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.SttEngine; + + +namespace Tizen.Uix.SttEngine +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(ErrorCode err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case ErrorCode.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case ErrorCode.IoError: + { + exp = new InvalidOperationException("I/O Error Occured"); + break; + } + + case ErrorCode.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case ErrorCode.NetworkDown: + { + exp = new InvalidOperationException("Network down(Out of network)"); + break; + } + + case ErrorCode.InvalidState: + { + exp = new InvalidOperationException("Invalid state"); + break; + } + + case ErrorCode.InvalidLanguage: + { + exp = new InvalidOperationException("Invalid language"); + break; + } + + case ErrorCode.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case ErrorCode.NotSupportedFeature: + { + exp = new InvalidOperationException("Not supported feature"); + break; + } + + case ErrorCode.NotSupported: + { + exp = new NotSupportedException("Not supported"); + break; + } + + case ErrorCode.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + case ErrorCode.RecordingTimedOut: + { + exp = new TimeoutException("Recording timed out"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + } + + return exp; + } + } +} diff --git a/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/SttEngine.cs b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/SttEngine.cs new file mode 100755 index 0000000..219c3c2 --- /dev/null +++ b/src/Tizen.Uix.SttEngine/Tizen.Uix.SttEngine/SttEngine.cs @@ -0,0 +1,801 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using static Interop.SttEngine; + +namespace Tizen.Uix.SttEngine +{ + /// + /// Enumeration for audio type. + /// + public enum AudioType + { + /// + /// Signed 16bit audio type, Little endian + /// + PcmS16Le = 0, + /// + /// Unsigned 8bit audio type + /// + PcmU8 + }; + + /// + /// Enumeration for result. + /// + public enum ResultEvent + { + /// + /// Event when either the full matched or the final result is delivered + /// + FinalResult = 0, + /// + /// Event when the partial matched result is delivered + /// + PartialResult, + /// + /// Event when the recognition has failed + /// + Error + }; + + /// + /// Enumeration for result time. + /// + public enum TimeEvent + { + /// + /// Event when the token is beginning type + /// + Beginning = 0, + /// + /// Event when the token is middle type + /// + Middle = 1, + /// + /// Event when the token is end type + /// + End = 2 + }; + + /// + /// Enumeration for speech status. + /// + public enum SpeechStatus + { + /// + /// Beginning point of speech is detected + /// + BeginningPointDetected = 0, + /// + /// End point of speech is detected + /// + EndPointDetected + }; + + /// + /// Enumeration representing the result message + /// + public enum ResultMessage + { + /// + /// No Error + /// + None, + /// + /// Recognition failed because the speech started too soon. + /// + TooSoon, + /// + /// Recognition failed because the speech is too short. + /// + TooShort, + /// + /// Recognition failed because the speech is too long. + /// + TooLong, + /// + /// Recognition failed because the speech is too quiet to listen. + /// + TooQuiet, + /// + /// Recognition failed because the speech is too loud to listen. + /// + TooLoud, + /// + /// Recognition failed because the speech is too fast to listen. + /// + TooFast + }; + + + /// + /// Enum for Error values that can occur + /// + public enum Error + { + /// + /// Successful, No error + /// + None = ErrorCode.None, + /// + /// Out of Memory + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// I/O error + /// + IoError = ErrorCode.IoError, + /// + /// Invalid parameter + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Network down(Out of network) + /// + NetworkDown = ErrorCode.NetworkDown, + /// + /// Invalid state + /// + InvalidState = ErrorCode.InvalidState, + /// + /// Invalid language + /// + InvalidLanguage = ErrorCode.InvalidLanguage, + /// + /// Operation failed + /// + OperationFailed = ErrorCode.OperationFailed, + /// + /// Not supported feature of current engine + /// + NotSupportedFeature = ErrorCode.NotSupportedFeature, + /// + /// NOT supported + /// + NotSupported = ErrorCode.NotSupported, + /// + /// Permission denied + /// + PermissionDenied = ErrorCode.PermissionDenied, + /// + /// Recording timed out + /// + RecordingTimedOut = ErrorCode.RecordingTimedOut + }; + + /// + /// This Class represents the Stt Engine which has to be inherited to make the engine. + /// + public abstract class Engine + { + private CallbackStructGCHandle _callbackStructGCHandle = new CallbackStructGCHandle(); + private PrivateDataSetCb _privateDataSetCb; + private Action _privateDatacallback; + private PrivateDataRequestedCb _privateDataRequestedCb; + private OutAction _privateDataRequestedCallback; + private static Engine _engine; + private IntPtr _structIntPtrHandle; + + /// + /// An Action with 2 Input Parameter returning a Error + /// + /// Generic Type for Parameter 1 + /// The Input Parameter 1 + /// The Input Parameter 2 + /// Error Value + public delegate Error Action(T a, T b); + + /// + /// An Action with 2 Out Parameter returning a Error + /// + /// Generic Type for Parameter 1 + /// The Input Parameter 1 + /// The Input Parameter 2 + /// Error Value + public delegate Error OutAction(T a, out T b); + + /// + /// Called when Stt engine provides the time stamp of result to the engine service user. + /// This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. + /// + /// The result index + /// The token event + /// The result text + /// The time started speaking the result text + /// The time finished speaking the result text + /// The User data + /// true to continue with the next iteration of the loop, false to break out of the loop + /// SendResult() should be called. + public delegate bool ResultTime(int index, TimeEvent resultEvent, string text, long startTime, long endTime, IntPtr userData); + + /// + /// Called when Stt engine informs the engine service user about whole supported language list. + /// This callback function is implemented by the engine service user. Therefore, the engine developer does NOT have to implement this callback function. + /// + /// The language is specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code + /// for example, "ko_KR" for Korean, "en_US" for American English + /// The User data + /// true to continue with the next iteration of the loop, false to break out of the loop + /// ForEachSupportedLanguages() should be called + public delegate bool SupportedLanguages(string language, IntPtr userData); + + /// + /// Called when the engine service user requests the basic information of Stt engine. + /// + /// + /// In order to upload the engine at Tizen Appstore, both a service app and a ui app are necessary. Therefore, engineSetting must be transferred to the engine service user. + /// + /// UUID of engine + /// Name of engine + /// The engine setting application(ui app)'s app ID + /// A variable for checking whether the network is used or not + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. OperationFailed + /// 3. InvalidParameter + /// + public abstract Error GetInformation(out string engineUuid, out string engineName, out string engineSetting, out bool useNetwork); + + /// + /// Called when the engine service user initializes Stt engine. + /// This callback function is called by the engine service user to request for Stt engine to be started. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// 3. InvalidState + /// 4. OperationFailed + /// + public abstract Error Initialize(); + + /// + /// Called when the engine service user deinitializes Stt engine. + /// This callback function is called by the engine service user to request for Stt engine to be deinitialized. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + public abstract Error Deinitialize(); + + /// + /// Called when the engine service user gets the whole supported language list. + /// + /// + /// In this function, the engine service user's callback function 'SupportedLanguages' is invoked repeatedly for getting all supported languages + /// and user_data must be transferred to 'SupportedLanguages'. If 'SupportedLanguages' returns false, it should be stopped to call 'SupportedLanguages'. + /// + /// The callback function + /// The user data which must be passed to the callback delegate 'SupportedLanguages' + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. InvalidParameter + /// + /// + /// This callback function invokes SupportedLanguages repeatedly for getting supported languages. + /// + public abstract Error ForEachSupportedLanguages(SupportedLanguages callback, IntPtr userData); + + /// + /// Called when the engine service user checks whether the corresponding language is valid or not in Stt engine. + /// + /// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code + /// For example, "ko_KR" for Korean, "en_US" for American English + /// A variable for checking whether the corresponding language is valid or not. true to be valid, false to be invalid + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// + public abstract Error IsValidLanguage(string language, out bool isValid); + + /// + /// Called when the engine service user checks whether Stt engine supports silence detection. + /// + /// true to support silence detection, false not to support silence detection + public abstract bool SupportSilenceDetection(); + + /// + /// Called when the engine service user checks whether Stt engine supports the corresponding recognition type. + /// + /// The type for recognition, "stt.recognition.type.FREE" or "stt.recognition.type.FREE.PARTIAL" + /// A variable for checking whether Stt engine supports the corresponding recognition type. + /// true to support recognition type, false not to support recognition type + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// + public abstract Error SupportRecognitionType(string type, out bool isSupported); + + /// + /// Called when the engine service user gets the proper recording format of Stt engine. + /// The recording format is used for creating the recorder. + /// + /// The format used by the recorder + /// The sample rate used by the recorder + /// The number of channels used by the recorder + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + public abstract Error GetRecordingFormat(out AudioType types, out int rate, out int channels); + + /// + /// Called when the engine service user sets the silence detection. + /// If the engine service user sets this option as 'TRUE', Stt engine will detect the silence (EPD) and send the callback event about it. + /// + /// A variable for setting the silence detection. true to detect the silence, false not to detect the silence + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. NotSupportedFeature + /// + public abstract Error SetSilenceDetection(bool isSet); + + /// + /// Called when the engine service user requests for Stt engine to check whether the application agreed the usage of Stt engine. + /// This callback function is called when the engine service user requests for Stt engine to check the application's agreement about using the engine. + /// According to the need, the engine developer can provide some user interfaces to check the agreement. + /// + /// The Application ID + /// A variable for checking whether the application agreed to use Stt engine or not. true to agree, false to disagree + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. NotSupportedFeature + /// + public abstract Error CheckAppAgreed(string appid, out bool isAgreed); + + /// + /// Called when the engine service user checks whether Stt engine needs the application's credential. + /// + /// true if Stt engine needs the application's credential, otherwise false + public abstract bool NeedAppCredential(); + + /// + /// Called when the engine service user gets the result time information(stamp). + /// + /// + /// In this function, the engine service user's callback delegate 'ResultTime' is invoked repeatedly for sending the time information to the engine service user + /// and user_data must be transferred to 'ResultTime'. If 'ResultTime' returns false, it should be stopped to call 'ResultTime'. + /// timeInfo is transferred from SendResult. The type of timeInfo is up to the Stt engine developer. + /// + /// The time information + /// The callback function + /// The user data which must be passed to the callback function ResultTime + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. InvalidParameter + /// + /// + /// SendResult will invoke this function + /// + /// + /// This function invokes ResultTime repeatedly for getting result time information. + /// + public abstract Error ForEachResultTime(IntPtr timeInfo, ResultTime callback, IntPtr userData); + + /// + /// Called when the engine service user starts to recognize the recording data. + /// In this callback function, Stt engine must transfer the recognition result and userData to the engine service user using SendResult(). + /// Also, if Stt engine needs the application's credential, it sets the credential granted to the application. + /// + /// The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The recognition type, "stt.recognition.type.FREE" or "stt.recognition.type.FREE.PARTIAL" + /// The Application ID + /// The credential granted to the application + /// The user data to be passed to the callback function + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. InvalidParameter + /// 4. InvalidLanguage + /// 5. OperationFailed + /// 6. NetworkDown + /// + /// + /// The engine is not in recognition processing. + /// + public abstract Error Start(string language, string type, string appid, string credential, IntPtr userData); + + /// + /// Called when the engine service user sets and sends the recording data for speech recognition. + /// This callback function is called by the engine service user to send the recording data to Stt engine.The engine receives the recording data and uses for speech recognition. + /// this function should be returned immediately after recording data copy. + /// + /// The recording data + /// The length of recording data + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. InvalidParameter + /// 4. OperationFailed + /// + /// + /// Start should succeed + /// + /// If the engine supports partial result, SendResult() should be invoked. + public abstract Error SetRecordingData(string data, uint length); + + /// + /// Called when the engine service user stops to recognize the recording data. + /// This callback function is called by the engine service user to stop recording and to get the recognition result. + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. OperationFailed + /// 4. NetworkDown + /// + /// + /// Start should succeed + /// + /// After processing of the engine, , SendResult() should be invoked. + public abstract Error Stop(); + + /// + /// Called when the engine service user cancels to recognize the recording data. + /// This callback function is called by the engine service user to cancel to recognize the recording data.Also, when starting the recorder is failed, this function is called. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + /// Stt engine is in recognition processing or recording. + public abstract Error Cancel(); + + /// + /// Public Constructor + /// + public Engine() + { + _engine = this; + } + + /// + /// Main function for Speech-To-Text (STT) engine. + /// This function is the main function for operating Stt engine. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// ServiceAppMain should be used for working the engine after this function. + /// + /// The Number of Arguments + /// The Arguments Array + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + public void EngineMain(int argc, string[] argv) + { + _callbackStructGCHandle.CallbackStruct.version = 1; + _callbackStructGCHandle.CallbackStruct.getInfo = _getInfoCb; + _callbackStructGCHandle.CallbackStruct.initialize = Initialize; + _callbackStructGCHandle.CallbackStruct.deinitialize = _deinitializeCb; + _callbackStructGCHandle.CallbackStruct.supportedLanaguge = ForEachSupportedLanguages; + _callbackStructGCHandle.CallbackStruct.validLanaguage = _isValidLanguageCb; + _callbackStructGCHandle.CallbackStruct.silence = SupportSilenceDetection; + _callbackStructGCHandle.CallbackStruct.recognitionType = SupportRecognitionType; + _callbackStructGCHandle.CallbackStruct.recordingFormat = GetRecordingFormat; + _callbackStructGCHandle.CallbackStruct.resultTime = ForEachResultTime; + _callbackStructGCHandle.CallbackStruct.silenceDetection = SetSilenceDetection; + _callbackStructGCHandle.CallbackStruct.start = _startCb; + _callbackStructGCHandle.CallbackStruct.recordingData = SetRecordingData; + _callbackStructGCHandle.CallbackStruct.stop = Stop; + _callbackStructGCHandle.CallbackStruct.cancel = Cancel; + _callbackStructGCHandle.CallbackStruct.checkAppAgreed = CheckAppAgreed; + _callbackStructGCHandle.CallbackStruct.needAppCredential = NeedAppCredential; + _structIntPtrHandle = Marshal.AllocHGlobal(Marshal.SizeOf(_callbackStructGCHandle.CallbackStruct)); + Marshal.StructureToPtr(_callbackStructGCHandle.CallbackStruct, _structIntPtrHandle, false); + Error error = STTEMain(argc, argv, _structIntPtrHandle); + if (error != Error.None) + { + Log.Error(LogTag, "STTEMain Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + Log.Info(LogTag, "After STTEMain"); + } + + /// + /// Sends the recognition result to the engine service user. + /// + /// + /// This API is used in SetRecordingData() and Stop(), when Stt engine sends the recognition result to the engine service user. + /// This function is called in the following situations; 1) after Stop() is called, 2) the end point of speech is detected from recording, or 3) partial result is occurred. + /// The recognition result must be transferred to the engine service user through this function. Also, timeInfo must be transferred to ForEachResultTime(). + /// The type of timeInfo is up to the Stt engine developer. + /// + /// The result event + /// The recognition type, "stt.recognition.type.FREE" or "stt.recognition.type.FREE.PARTIAL" + /// Result texts + /// Result text count + /// Engine message + /// The time information + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// EngineMain function should be invoked before this function is called. Stop will invoke this function. + /// + /// + /// This function invokes ForEachResultTime + /// + public void SendResult(ResultEvent resultEvent, string type, string[] result, int resultCount, ResultMessage msg, IntPtr timeInfo) + { + if ((result != null) && (result.Length != 0)) + { + + string message = "stt.result.message.none"; + switch (msg) + { + case ResultMessage.None: + message = "stt.result.message.none"; + break; + + case ResultMessage.TooFast: + message = "stt.result.message.error.too.fast"; + break; + + case ResultMessage.TooLong: + message = "stt.result.message.error.too.long"; + break; + + case ResultMessage.TooLoud: + message = "stt.result.message.error.too.loud"; + break; + + case ResultMessage.TooQuiet: + message = "stt.result.message.error.too.quiet"; + break; + + case ResultMessage.TooShort: + message = "stt.result.message.error.too.short"; + break; + + case ResultMessage.TooSoon: + message = "stt.result.message.error.too.soon"; + break; + } + + Error error = STTESendResult(resultEvent, type, result, resultCount, message, timeInfo, IntPtr.Zero); + if (error != Error.None) + { + Log.Error(LogTag, "STTESendResult Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + else + { + throw new ArgumentNullException("result", "is null or empty"); + } + } + + /// + /// Sends the error to the engine service user. + /// + /// The Error Reason + /// The error message + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. + /// + public void SendError(Error error, string msg) + { + Error err = STTESendError(error, msg); + if (err != Error.None) + { + Log.Error(LogTag, "SendError Failed with error " + err); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sends the speech status to the engine service user when Stt engine notifies the change of the speech status. + /// + /// + /// This API is invoked when Stt engine wants to notify the change of the speech status anytime. NOTE that this API can be invoked for recognizing the speech. + /// + /// SpeechStatus + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. Start() and SetRecordingData() will invoke this function. + /// + public void SendSpeechStatus(SpeechStatus status) + { + Error error = STTESendSpeechStatus(status, IntPtr.Zero); + if (error != Error.None) + { + Log.Error(LogTag, "SendSpeechStatus Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sets a callback function for setting the private data. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// Called when Stt engine receives the private data from the engine service user. + /// This callback function is called when the engine service user sends the private data to Stt engine. + /// In Parameters: + /// a = Key -- The key field of private data + /// b = data -- The data field of private data + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// 3. OperationFailed + /// + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. + /// + public void SetPrivateDataSetDelegate(Action callback) + { + _privateDatacallback = callback; + _privateDataSetCb = (string key, string data) => + { + return _privateDatacallback.Invoke(key, data); + }; + Error error = STTESetPrivateDataSetCb(_privateDataSetCb); + if (error != Error.None) + { + Log.Error(LogTag, "SetPrivateDataSetDelegate Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sets a callback delegate for requesting the private data. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// callback function + /// Called when Stt engine provides the engine service user with the private data. + /// This callback function is called when the engine service user gets the private data from Stt engine. + /// Out Parameters: + /// a = Key -- The key field of private data + /// b = data -- The data field of private data + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// 3. OperationFailed + /// + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. + /// + public void SetPrivateDataRequestedDelegate(OutAction callback) + { + _privateDataRequestedCallback = callback; + _privateDataRequestedCb = (string key, out string data) => + { + return _privateDataRequestedCallback.Invoke(key, out data); + }; + Error error = STTESetPrivateDataRequestedCb(_privateDataRequestedCb); + if (error != Error.None) + { + Log.Error(LogTag, "SetPrivateDataRequestedDelegate Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + private StartCb _startCb = (IntPtr language, IntPtr type, IntPtr appid, IntPtr credential, IntPtr userData) => + { + string lan = null; + string typ = null; + string apid = null; + string cre = null; + if (language != null) + lan = Marshal.PtrToStringAnsi(language); + if (type != null) + typ = Marshal.PtrToStringAnsi(type); + if (appid != null) + apid = Marshal.PtrToStringAnsi(appid); + if (credential != null) + cre = Marshal.PtrToStringAnsi(credential); + return _engine.Start(lan, typ, apid, cre, IntPtr.Zero); + }; + + private IsValidLanguageCb _isValidLanguageCb = (IntPtr langauge, IntPtr isValid) => + { + string langaugeStr = Marshal.PtrToStringAnsi(langauge); + bool valid; + Error err = _engine.IsValidLanguage(langaugeStr, out valid); + if (valid == true) + { + Marshal.WriteByte(isValid, 0, 1); + } + else + { + Marshal.WriteByte(isValid, 0, 0); + } + return err; + }; + + private GetInfoCb _getInfoCb = (out IntPtr engineUuid, out IntPtr engineName, out IntPtr engineSetting, out IntPtr useNetwork) => + { + string uuid; + string name; + string setting; + bool network; + Error err = _engine.GetInformation(out uuid, out name, out setting, out network); + int size = Marshal.SizeOf(); + IntPtr pBool = Marshal.AllocHGlobal(size); + if (network == true) + { + Marshal.WriteInt32(pBool, 0, 1); + } + else + { + Marshal.WriteInt32(pBool, 0, 0); + } + engineUuid = Marshal.StringToHGlobalAnsi(uuid); + engineName = Marshal.StringToHGlobalAnsi(name); + engineSetting = Marshal.StringToHGlobalAnsi(setting); + useNetwork = pBool; + return err; + }; + + private DeinitializeCb _deinitializeCb = () => + { + Marshal.FreeHGlobal(_engine._structIntPtrHandle); + return _engine.Deinitialize(); + }; + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.Tts/Interop/Interop.Libraries.cs b/src/Tizen.Uix.Tts/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..2161d63 --- /dev/null +++ b/src/Tizen.Uix.Tts/Interop/Interop.Libraries.cs @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/// +/// Partial interop class. +/// +internal static partial class Interop +{ + /// + /// Partial libraries class. + /// + internal static partial class Libraries + { + public const string Tts = "libtts.so"; + } +} diff --git a/src/Tizen.Uix.Tts/Interop/Interop.Tts.cs b/src/Tizen.Uix.Tts/Interop/Interop.Tts.cs new file mode 100755 index 0000000..32b49ba --- /dev/null +++ b/src/Tizen.Uix.Tts/Interop/Interop.Tts.cs @@ -0,0 +1,172 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.Tts; + +/// +/// Partial interop class. +/// +internal static partial class Interop +{ + /// + /// Tts interop class. + /// + internal static class Tts + { + internal static string LogTag = "Tizen.Uix.Tts"; + + private const int ErrorTts = -0x02F10000; + + internal enum TtsError + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< I/O error */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + OutOfNetwork = Tizen.Internals.Errors.ErrorCode.Networkdown, /**< Network is down */ + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, /**< No answer from the STT service */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< STT NOT supported */ + InvalidState = ErrorTts | 0x01, /**< Invalid state */ + InvalidVoice = ErrorTts | 0x02, /**< Invalid language */ + EngineNotFound = ErrorTts | 0x03, /**< No available engine */ + OperationFailed = ErrorTts | 0x04, /**< Operation failed */ + AudioPolicyBlocked = ErrorTts | 0x05, /**< Audio policy blocked */ + NotSupportedFeature = ErrorTts | 0x06, /**< Not supported feature of current engine*/ + ServiceReset = ErrorTts | 0x07 /**< Service reset*/ + }; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsStateChangedCB(IntPtr handle, State previous, State current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsUtteranceStartedCB(IntPtr handle, int uttId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsUtteranceCompletedCB(IntPtr handle, int uttId, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsErrorCB(IntPtr handle, int uttId, TtsError reason, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool TtsSupportedVoiceCB(IntPtr handle, IntPtr language, int voiceType, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsDefaultVoiceChangedCB(IntPtr handle, IntPtr previous_language, int previous_voice_type, IntPtr current_language, int current_voice_type, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void TtsEngineChangedCB(IntPtr handle, IntPtr engine_id, IntPtr language, int voice_type, bool need_credential, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_create", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsCreate(out IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_destroy", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsDestroy(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_mode", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetMode(IntPtr handle, Mode m); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_mode", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetMode(IntPtr handle, out Mode m); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_credential", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetCredential(IntPtr handle, string credential); + + [DllImport(Libraries.Tts, EntryPoint = "tts_prepare", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsPrepare(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unprepare", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnprepare(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_foreach_supported_voices", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsForeachSupportedVoices(IntPtr handle, TtsSupportedVoiceCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_default_voice", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetDefaultVoice(IntPtr handle, out string language, out int voice_type); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_private_data", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetPrivateData(IntPtr handle, string key, string data); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_private_data", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetPrivateData(IntPtr handle, string key, out string data); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_max_text_size", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetMaxTextSize(IntPtr handle, out uint size); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_state", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetState(IntPtr handle, out State state); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_speed_range", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetSpeedRange(IntPtr handle, out int min, out int normal, out int max); + + [DllImport(Libraries.Tts, EntryPoint = "tts_get_error_message", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsGetErrorMessage(IntPtr handle, out string err_msg); + + [DllImport(Libraries.Tts, EntryPoint = "tts_is_recognition_type_supported", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsIsRecognitionTypeSupported(IntPtr handle, string type, out bool support); + + [DllImport(Libraries.Tts, EntryPoint = "tts_add_text", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsAddText(IntPtr handle, string text, string language, int voice_type, int speed, out int uttId); + + [DllImport(Libraries.Tts, EntryPoint = "tts_play", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsPlay(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_stop", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsStop(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_pause", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsPause(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_state_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetStateChangedCB(IntPtr handle, TtsStateChangedCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_state_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetStateChangedCB(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_utterance_started_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetUtteranceStartedCB(IntPtr handle, TtsUtteranceStartedCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_utterance_started_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetUtteranceStartedCB(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_utterance_completed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetUtteranceCompletedCB(IntPtr handle, TtsUtteranceCompletedCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_utterance_completed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetUtteranceCompletedCB(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_error_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetErrorCB(IntPtr handle, TtsErrorCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_error_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetErrorCB(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_default_voice_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetDefaultVoiceChangedCB(IntPtr handle, TtsDefaultVoiceChangedCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_default_voice_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetDefaultVoiceChangedCB(IntPtr handle); + + [DllImport(Libraries.Tts, EntryPoint = "tts_set_engine_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsSetEngineChangedCB(IntPtr handle, TtsEngineChangedCB callback, IntPtr userData); + + [DllImport(Libraries.Tts, EntryPoint = "tts_unset_engine_changed_cb", CallingConvention = CallingConvention.Cdecl)] + internal static extern TtsError TtsUnsetEngineChangedCB(IntPtr handle); + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts.csproj b/src/Tizen.Uix.Tts/Tizen.Uix.Tts.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts.sln b/src/Tizen.Uix.Tts/Tizen.Uix.Tts.sln new file mode 100755 index 0000000..35fdcdd --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.Tts", "Tizen.Uix.Tts.csproj", "{D82A5965-D75B-4E58-B569-115B08241957}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{FB391E59-A54B-40A5-BD1F-9A06FA8E3A76}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{B2D8270C-90AA-4E16-9A3E-D6988789A93C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D82A5965-D75B-4E58-B569-115B08241957}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D82A5965-D75B-4E58-B569-115B08241957}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D82A5965-D75B-4E58-B569-115B08241957}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D82A5965-D75B-4E58-B569-115B08241957}.Release|Any CPU.Build.0 = Release|Any CPU + {FB391E59-A54B-40A5-BD1F-9A06FA8E3A76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FB391E59-A54B-40A5-BD1F-9A06FA8E3A76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FB391E59-A54B-40A5-BD1F-9A06FA8E3A76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FB391E59-A54B-40A5-BD1F-9A06FA8E3A76}.Release|Any CPU.Build.0 = Release|Any CPU + {B2D8270C-90AA-4E16-9A3E-D6988789A93C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B2D8270C-90AA-4E16-9A3E-D6988789A93C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B2D8270C-90AA-4E16-9A3E-D6988789A93C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B2D8270C-90AA-4E16-9A3E-D6988789A93C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/DefaultVoiceChangedEventArgs.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/DefaultVoiceChangedEventArgs.cs new file mode 100755 index 0000000..1cfd40c --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/DefaultVoiceChangedEventArgs.cs @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information related to the DefaultVoiceChanged event. + /// + /// 3 + public class DefaultVoiceChangedEventArgs + { + internal DefaultVoiceChangedEventArgs(string previousLanguage, int previousVoiceType, string currentLanguage, int currentVoiceType) + { + this.Previous = new SupportedVoice(previousLanguage, previousVoiceType); + this.Current = new SupportedVoice(currentLanguage, currentVoiceType); + } + + /// + /// The previous SupportedVoice. + /// + /// 3 + public SupportedVoice Previous + { + get; + internal set; + } + + /// + /// The current SupportedVoice. + /// + /// 3 + public SupportedVoice Current + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/EngineChangedEventArgs.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/EngineChangedEventArgs.cs new file mode 100755 index 0000000..5a3c00a --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/EngineChangedEventArgs.cs @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using static Tizen.Uix.Tts.SupportedVoice; + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information related to the EngineChanged event. + /// + /// 3 + public class EngineChangedEventArgs + { + internal EngineChangedEventArgs(string engineId, string language, int voiceType, bool needCredential) + { + this.EngineId = engineId; + this.VoiceType = new SupportedVoice(language, voiceType); + this.NeedCredential = needCredential; + } + + /// + /// The engine ID. + /// + /// 3 + public string EngineId + { + get; + internal set; + } + + /// + /// The necessity of the credential. + /// + /// 3 + public bool NeedCredential + { + get; + internal set; + } + + /// + /// The supported voice. + /// + /// 3 + public SupportedVoice VoiceType + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ErrorOccurredEventArgs.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ErrorOccurredEventArgs.cs new file mode 100755 index 0000000..0a184db --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ErrorOccurredEventArgs.cs @@ -0,0 +1,161 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.Tts; + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information related to the TTS ErrorOccurred event. + /// + /// 3 + public class ErrorOccurredEventArgs + { + private IntPtr _handle; + + internal ErrorOccurredEventArgs(IntPtr handle, int utteranceId, Interop.Tts.TtsError error) + { + this._handle = handle; + this.UtteranceId = utteranceId; + switch (error) + { + case Interop.Tts.TtsError.None: + { + ErrorValue = Error.None; + break; + } + + case Interop.Tts.TtsError.OutOfMemory: + { + ErrorValue = Error.OutOfMemory; + break; + } + + case Interop.Tts.TtsError.IoError: + { + ErrorValue = Error.IoError; + break; + } + + case Interop.Tts.TtsError.InvalidParameter: + { + ErrorValue = Error.InvalidParameter; + break; + } + + case Interop.Tts.TtsError.TimedOut: + { + ErrorValue = Error.TimedOut; + break; + } + + case Interop.Tts.TtsError.OutOfNetwork: + { + ErrorValue = Error.OutOfNetwork; + break; + } + + case Interop.Tts.TtsError.PermissionDenied: + { + ErrorValue = Error.PermissionDenied; + break; + } + + case Interop.Tts.TtsError.NotSupported: + { + ErrorValue = Error.NotSupported; + break; + } + + case Interop.Tts.TtsError.InvalidState: + { + ErrorValue = Error.InvalidState; + break; + } + + case Interop.Tts.TtsError.InvalidVoice: + { + ErrorValue = Error.InvalidVoice; + break; + } + + case Interop.Tts.TtsError.EngineNotFound: + { + ErrorValue = Error.EngineNotFound; + break; + } + + case Interop.Tts.TtsError.OperationFailed: + { + ErrorValue = Error.OperationFailed; + break; + } + + case Interop.Tts.TtsError.AudioPolicyBlocked: + { + ErrorValue = Error.AudioPolicyBlocked; + break; + } + } + } + + /// + /// The utterance ID. + /// + /// 3 + public int UtteranceId + { + get; + internal set; + } + + /// + /// The error value. + /// + /// 3 + public Error ErrorValue + { + get; + internal set; + } + + /// + /// Gets the current error message. + /// + /// 3 + /// + /// String error message. + /// + public string ErrorMessage + { + get + { + string errorMesage = ""; + TtsError error = TtsGetErrorMessage(_handle, out errorMesage); + if (error != TtsError.None) + { + Log.Error(LogTag, "GetErrorMessage Failed with error " + error); + return ""; + } + + return errorMesage; + } + + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ExceptionFactory.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ExceptionFactory.cs new file mode 100755 index 0000000..a471f7d --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/ExceptionFactory.cs @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using static Interop.Tts; + +namespace Tizen.Uix.Tts +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(TtsError err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case TtsError.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case TtsError.IoError: + { + exp = new InvalidOperationException("I/O Error Occurred"); + break; + } + + case TtsError.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case TtsError.TimedOut: + { + exp = new TimeoutException("No answer from the TTS service"); + break; + } + + case TtsError.OutOfNetwork: + { + exp = new InvalidOperationException("Network is down"); + break; + } + + case TtsError.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + case TtsError.NotSupported: + { + exp = new NotSupportedException("TTS NOT supported"); + break; + } + + case TtsError.InvalidState: + { + exp = new InvalidOperationException("Invalid state"); + break; + } + + case TtsError.InvalidVoice: + { + exp = new InvalidOperationException("Invalid Voice"); + break; + } + + case TtsError.EngineNotFound: + { + exp = new InvalidOperationException("No available engine"); + break; + } + + case TtsError.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case TtsError.AudioPolicyBlocked: + { + exp = new InvalidOperationException("AudioPolicyBlocked"); + break; + } + + case TtsError.NotSupportedFeature: + { + exp = new InvalidOperationException("Feature NotSupported"); + break; + } + + case TtsError.ServiceReset: + { + exp = new InvalidOperationException("Service Reset"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + + } + + return exp; + + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SpeedRange.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SpeedRange.cs new file mode 100755 index 0000000..2ed55c3 --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SpeedRange.cs @@ -0,0 +1,63 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds the speed range values. + /// + /// 3 + public class SpeedRange + { + internal SpeedRange(int min, int normal, int max) + { + this.Min = min; + this.Normal = normal; + this.Max = max; + } + + /// + /// The max speed range value. + /// + /// 3 + public int Max + { + get; + internal set; + } + + /// + /// The min speed range value. + /// + /// 3 + public int Min + { + get; + internal set; + } + + /// + /// The normal speed range value. + /// + /// 3 + public int Normal + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/StateChangedEventArgs.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/StateChangedEventArgs.cs new file mode 100755 index 0000000..8339eb5 --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/StateChangedEventArgs.cs @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information related to the TTS StateChanged event. + /// + /// 3 + public class StateChangedEventArgs + { + internal StateChangedEventArgs(State previous, State current) + { + Previous = previous; + Current = current; + } + + /// + /// The previous state. + /// + /// 3 + public State Previous + { + get; + internal set; + } + + /// + /// The current state. + /// + /// 3 + public State Current + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SupportedVoice.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SupportedVoice.cs new file mode 100755 index 0000000..e99108b --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/SupportedVoice.cs @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information about the supported voices. + /// + /// 3 + public class SupportedVoice + { + internal SupportedVoice(string lang, int voiceType) + { + this.Language = lang; + if (voiceType == 0) + { + this.VoiceType = Voice.Auto; + } + + else if (voiceType == 1) + { + this.VoiceType = Voice.Male; + } + + else if (voiceType == 2) + { + this.VoiceType = Voice.Female; + } + + else if (voiceType == 3) + { + this.VoiceType = Voice.Child; + } + } + + internal SupportedVoice() + { + this.Language = ""; + this.VoiceType = Voice.Auto; + } + + /// + /// Language specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code (for example, "ko_KR" for Korean, "en_US" for American English). + /// + /// 3 + public string Language + { + get; + internal set; + } + + public Voice VoiceType + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/TtsClient.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/TtsClient.cs new file mode 100755 index 0000000..f8af3a1 --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/TtsClient.cs @@ -0,0 +1,1069 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.Tts; + +namespace Tizen.Uix.Tts +{ + /// + /// Enumeration for the states. + /// + /// 3 + public enum State + { + /// + /// Created state. + /// + /// 3 + Created = 0, + + /// + /// Ready state. + /// + /// 3 + Ready = 1, + + /// + /// Playing state. + /// + /// 3 + Playing = 2, + + /// + /// Paused state. + /// + /// 3 + Paused = 3, + + /// + /// Unavailable state. + /// + /// 3 + Unavailable + }; + + /// + /// Enumeration for TTS mode. + /// + /// 3 + public enum Mode + { + /// + /// Default mode for normal application. + /// + /// 3 + Default = 0, + + /// + /// Notification mode. + /// + /// 3 + Notification = 1, + + /// + /// Accessibility mode. + /// + /// 3 + ScreenReader = 2 + }; + + /// + /// Enumeration for error values that can occur. + /// + /// 3 + public enum Error + { + /// + /// Successful, no error. + /// + /// 3 + None, + /// + /// Out of memory. + /// + /// 3 + OutOfMemory, + /// + /// I/O error. + /// + /// 3 + IoError, + /// + /// Invalid parameter. + /// + /// 3 + InvalidParameter, + /// + /// No answer from the STT service. + /// + /// 3 + TimedOut, + /// + /// Network is down. + /// + /// 3 + OutOfNetwork, + /// + /// Permission denied. + /// + /// 3 + PermissionDenied, + /// + /// STT not supported. + /// + /// 3 + NotSupported, + /// + /// Invalid state. + /// + /// 3 + InvalidState, + /// + /// Invalid voice. + /// + /// 3 + InvalidVoice, + /// + /// No available engine. + /// + /// 3 + EngineNotFound, + /// + /// Operation failed. + /// + /// 3 + OperationFailed, + /// + /// Audio policy blocked. + /// + /// 3 + AudioPolicyBlocked + }; + + /// + /// Enumeration for the voice types. + /// + /// 3 + public enum Voice + { + /// + /// The automatic voice type. + /// + /// 3 + Auto, + + /// + /// The male voice type. + /// + /// 3 + Male, + + /// + /// The female voice type. + /// + /// 3 + Female, + + /// + /// The child voice type. + /// + /// 3 + Child + }; + + /// + /// You can use Text-To-Speech (TTS) API's to read sound data transformed by the engine from input texts. + /// Applications can add input-text to queue for reading continuously and control the player that can play, pause, and stop sound data synthesized from text. + /// + /// 3 + public class TtsClient : IDisposable + { + private IntPtr _handle; + private event EventHandler _stateChanged; + private event EventHandler _utteranceStarted; + private event EventHandler _utteranceCompleted; + private event EventHandler _errorOccurred; + private event EventHandler _defaultVoiceChanged; + private event EventHandler _engineChanged; + private bool disposedValue = false; + private Object thisLock = new Object(); + private TtsStateChangedCB _stateDelegate; + private TtsUtteranceStartedCB _utteranceStartedResultDelegate; + private TtsUtteranceCompletedCB _utteranceCompletedResultDelegate; + private TtsErrorCB _errorDelegate; + private TtsDefaultVoiceChangedCB _voiceChangedDelegate; + private TtsEngineChangedCB _engineDelegate; + private TtsSupportedVoiceCB _supportedvoiceDelegate; + + /// + /// Constructor to create a TTS instance. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Operation Failed + /// 2. Engine Not Found + /// + /// This exception can be due to out Of memory. + /// This exception can be due to TTS not supported. + public TtsClient() + { + IntPtr handle; + TtsError error = TtsCreate(out handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Create Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + _handle = handle; + } + + /// + /// Event to be invoked when TTS state changes. + /// + /// 3 + public event EventHandler StateChanged + { + add + { + lock (thisLock) + { + _stateDelegate = (IntPtr handle, State previous, State current, IntPtr userData) => + { + StateChangedEventArgs args = new StateChangedEventArgs(previous, current); + _stateChanged?.Invoke(this, args); + }; + TtsError error = TtsSetStateChangedCB(_handle, _stateDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add StateChanged Failed with error " + error); + } + else + { + _stateChanged += value; + } + } + + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetStateChangedCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove StateChanged Failed with error " + error); + } + + _stateChanged -= value; + } + } + + } + + /// + /// Event to be invoked when the utterance starts. + /// + /// 3 + public event EventHandler UtteranceStarted + { + add + { + lock (thisLock) + { + _utteranceStartedResultDelegate = (IntPtr handle, int uttId, IntPtr userData) => + { + UtteranceEventArgs args = new UtteranceEventArgs(uttId); + _utteranceStarted?.Invoke(this, args); + }; + TtsError error = TtsSetUtteranceStartedCB(_handle, _utteranceStartedResultDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add UtteranceStarted Failed with error " + error); + } + else + { + _utteranceStarted += value; + } + } + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetUtteranceStartedCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove UtteranceStarted Failed with error " + error); + } + + _utteranceStarted -= value; + } + } + } + + /// + /// Event to be invoked when the utterance completes. + /// + /// 3 + public event EventHandler UtteranceCompleted + { + add + { + lock (thisLock) + { + _utteranceCompletedResultDelegate = (IntPtr handle, int uttId, IntPtr userData) => + { + UtteranceEventArgs args = new UtteranceEventArgs(uttId); + _utteranceCompleted?.Invoke(this, args); + }; + TtsError error = TtsSetUtteranceCompletedCB(_handle, _utteranceCompletedResultDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add UtteranceCompleted Failed with error " + error); + } + else + { + _utteranceCompleted += value; + } + } + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetUtteranceCompletedCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove UtteranceCompleted Failed with error " + error); + } + + _utteranceCompleted -= value; + } + } + } + + /// + /// Event to be invoked when an error occurs. + /// + /// 3 + public event EventHandler ErrorOccurred + { + add + { + lock (thisLock) + { + _errorDelegate = (IntPtr handle, int uttId, TtsError reason, IntPtr userData) => + { + ErrorOccurredEventArgs args = new ErrorOccurredEventArgs(handle, uttId, reason); + _errorOccurred?.Invoke(this, args); + }; + TtsError error = TtsSetErrorCB(_handle, _errorDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add ErrorOccurred Failed with error " + error); + } + + else + { + _errorOccurred += value; + } + } + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetErrorCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove ErrorOccurred Failed with error " + error); + } + + _errorOccurred -= value; + } + } + } + + /// + /// Event to be invoked when an error occurs. + /// + /// 3 + public event EventHandler DefaultVoiceChanged + { + add + { + lock (thisLock) + { + _voiceChangedDelegate = (IntPtr handle, IntPtr previousLanguage, int previousVoiceType, IntPtr currentLanguage, int currentVoiceType, IntPtr userData) => + { + string previousLanguageString = Marshal.PtrToStringAnsi(previousLanguage); + string currentLanguageString = Marshal.PtrToStringAnsi(currentLanguage); + DefaultVoiceChangedEventArgs args = new DefaultVoiceChangedEventArgs(previousLanguageString, previousVoiceType, currentLanguageString, currentVoiceType); + _defaultVoiceChanged?.Invoke(this, args); + }; + TtsError error = TtsSetDefaultVoiceChangedCB(_handle, _voiceChangedDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add DefaultVoiceChanged Failed with error " + error); + } + + else + { + _defaultVoiceChanged += value; + } + } + + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetDefaultVoiceChangedCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove DefaultVoiceChanged Failed with error " + error); + } + + _defaultVoiceChanged -= value; + } + } + } + + /// + /// Event to be invoked to detect engine change. + /// + /// 3 + public event EventHandler EngineChanged + { + add + { + lock (thisLock) + { + _engineDelegate = (IntPtr handle, IntPtr engineId, IntPtr language, int voiceType, bool needCredential, IntPtr userData) => + { + string engineIdString = Marshal.PtrToStringAnsi(engineId); + string languageString = Marshal.PtrToStringAnsi(language); + EngineChangedEventArgs args = new EngineChangedEventArgs(engineIdString, languageString, voiceType, needCredential); + _engineChanged?.Invoke(this, args); + }; + TtsError error = TtsSetEngineChangedCB(_handle, _engineDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "Add EngineChanged Failed with error " + error); + } + else + { + _engineChanged += value; + } + } + } + + remove + { + lock (thisLock) + { + TtsError error = TtsUnsetEngineChangedCB(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Remove EngineChanged Failed with error " + error); + } + + _engineChanged -= value; + } + } + } + + /// + /// Gets the default voice set by the user. + /// + /// 3 + /// + /// The default voice in TTS. + /// + /// + /// The default voice SupportedVoice value. + /// + public SupportedVoice DefaultVoice + { + get + { + lock (thisLock) + { + string language; + int voiceType; + TtsError error = TtsGetDefaultVoice(_handle, out language, out voiceType); + if (error != TtsError.None) + { + Log.Error(LogTag, "DefaultVoice Failed with error " + error); + return new SupportedVoice(); + } + + return new SupportedVoice(language, voiceType); + } + } + } + + /// + /// Gets the maximum byte size for text. + /// + /// 3 + /// + /// The Maximum byte size for text. + /// + /// + /// The Default Voice SupportedVoice value, 0 if unable to get the value. + /// + ///
+        /// The State should be ready.
+        /// 
+ public uint MaxTextSize + { + get + { + uint maxTextSize; + lock (thisLock) + { + TtsError error = TtsGetMaxTextSize(_handle, out maxTextSize); + if (error != TtsError.None) + { + Log.Error(LogTag, "MaxTextSize Failed with error " + error); + return 0; + } + + } + + return maxTextSize; + } + + } + + /// + /// Gets the current TTS state. + /// + /// 3 + /// + /// The current state of TTS. + /// + /// + /// Current TTS State value. + /// + public State CurrentState + { + get + { + State state; + lock (thisLock) + { + TtsError error = TtsGetState(_handle, out state); + if (error != TtsError.None) + { + Log.Error(LogTag, "CurrentState Failed with error " + error); + return State.Unavailable; + } + + } + + return state; + } + + } + + /// + /// The TTS Mode can be set using this property. + /// + /// 3 + /// + /// The current TTS mode (default, screen-reader, notification). + /// + /// + /// The Mode value. + /// + /// + /// This exception can be due to the following reasons while setting the value: + /// 1. Operation Failed + /// 2. Engine Not Found + /// + /// This exception can be due to out Of memory. + /// This exception can be due to TTS not supported. + ///
+        /// The State should be created.
+        /// 
+ public Mode CurrentMode + { + get + { + Mode mode = Mode.Default; + lock (thisLock) + { + TtsError error = TtsGetMode(_handle, out mode); + if (error != TtsError.None) + { + Log.Error(LogTag, "Get Mode Failed with error " + error); + return Mode.Default; + } + } + + return mode; + } + set + { + TtsError error; + lock (thisLock) + { + error = TtsSetMode(_handle, value); + } + + if (error != TtsError.None) + { + Log.Error(LogTag, "Set Mode Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Sets the application credential. + /// + /// 3 + /// . + /// The credential string. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// This exception can be due to an invalid state. + /// This exception can be due to TTS not supported. + /// This exception can be due to improper value provided while setting the value. + ///
+        /// The State should be created or ready.
+        /// 
+ public void SetCredential(string credential) + { + lock (thisLock) + { + TtsError error = TtsSetCredential(_handle, credential); + if (error != TtsError.None) + { + Tizen.Log.Error(LogTag, "SetCredential Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Connects to the TTS service asynchronously. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// This exception can be due to an invalid state. + /// This exception can be due to TTS not supported. + ///
+        /// The State must be Created.
+        /// 
+ /// + /// If this function is successful, the TTS state will be ready. + /// If this function is unsuccessful, ErrorOccurred event will be invoked. + /// + public void Prepare() + { + lock (thisLock) + { + TtsError error = TtsPrepare(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Prepare Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Disconnects from the STT service. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// This exception can be due to an invalid state. + /// This exception can be due to TTS not supported. + ///
+        /// The state must be ready.
+        /// 
+ /// + /// If this function is successful, the TTS state will be created. + /// + public void Unprepare() + { + lock (thisLock) + { + TtsError error = TtsUnprepare(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Unprepare Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Retrieves all supported voices of the current engine. + /// + /// 3 + /// + /// The list of SupportedVoice. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Engine Not Found + /// 2. Operation Failed + /// + /// This exception can be due to TTS not supported. + public IEnumerable GetSupportedVoices() + { + List voicesList = new List(); + lock (thisLock) + { + _supportedvoiceDelegate = (IntPtr handle, IntPtr language, int voiceType, IntPtr userData) => + { + string lang = Marshal.PtrToStringAnsi(language); + SupportedVoice voice = new SupportedVoice(lang, voiceType); + voicesList.Add(voice); + return true; + }; + TtsError error = TtsForeachSupportedVoices(_handle, _supportedvoiceDelegate, IntPtr.Zero); + if (error != TtsError.None) + { + Log.Error(LogTag, "GetSupportedVoices Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + } + + return voicesList; + } + + /// + /// Gets the private data from TTS engine. + /// + /// 3 + /// + /// The key string. + /// + /// + /// The data corresponding to the provided key. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Engine Not found + /// 3. Operation Failure + /// + /// This exception can be due to TTS not supported. + ///
+        /// The state must be ready.
+        /// 
+ public string GetPrivateData(string key) + { + string data; + lock (thisLock) + { + TtsError error = TtsGetPrivateData(_handle, key, out data); + if (error != TtsError.None) + { + Log.Error(LogTag, "GetPrivateData Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + } + + return data; + } + + /// + /// Sets the private data to tts engine. + /// + /// 3 + /// + /// The key string. + /// + /// + /// The data string. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Engine Not found + /// 3. Operation Failure + /// + /// This exception can be due to TTS not supported. + /// This exception can be due to improper value provided while setting the value. + ///
+        /// The state must be ready.
+        /// 
+ public void SetPrivateData(string key, string data) + { + lock (thisLock) + { + TtsError error = TtsSetPrivateData(_handle, key, data); + if (error != TtsError.None) + { + Log.Error(LogTag, "SetPrivateData Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Gets the speed range. + /// + /// 3 + /// + /// The SpeedRange value. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Operation Failure + /// + /// This exception can be due to TTS not supported. + ///
+        /// The state must be created.
+        /// 
+ public SpeedRange GetSpeedRange() + { + int min = 0, max = 0, normal = 0; + lock (thisLock) + { + TtsError error = TtsGetSpeedRange(_handle, out min, out normal, out max); + if (error != TtsError.None) + { + Log.Error(LogTag, "GetSpeedRange Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + } + + return new SpeedRange(min, normal, max); + } + + /// + /// Adds a text to the queue. + /// + /// 3 + /// + /// Locale MUST be set for UTF-8 text validation check. + /// + /// + /// An input text based UTF-8. + /// + /// + /// The language selected from the SupportedVoice.Language Property obtained from GetSupportedVoices()(e.g. 'NULL'(Automatic),'en_US'). + /// + /// + /// The voice type selected from the SupportedVoice.VoiceType Property obtained from GetSupportedVoices(). + /// + /// + /// A speaking speed (e.g.0 for Auto or the value from SpeedRange Property). + /// + /// + /// The utterance ID. + /// + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Operation Failure + /// 3. Invalid Voice + /// + /// This exception can be due to TTS not supported. + /// This exception can be due to permission denied. + /// This exception can be due to improper value provided while setting the value. + ///
+        /// The state must be ready or playing or paused.
+        /// 
+ public int AddText(string text, string language, int voiceType, int speed) + { + int id; + lock (thisLock) + { + TtsError error = TtsAddText(_handle, text, language, voiceType, speed, out id); + if (error != TtsError.None) + { + Log.Error(LogTag, "AddText Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + } + + return id; + } + + /// + /// Starts synthesizing voice from the text and plays the synthesized audio data. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Operation Failure + /// 3. Out of Network + /// + /// This exception can be due to TTS not supported. + /// This exception can be due to permission denied. + ///
+        /// The state must be ready or paused.
+        /// 
+ /// + /// If this function succeeds, the TTS state will be playing. + /// + public void Play() + { + lock (thisLock) + { + TtsError error = TtsPlay(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Play Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Stops playing the utterance and clears the queue. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid Stat + /// 2. Operation Failure + /// + /// This exception can be due to TTS not supported. + ///
+        /// The state must be ready or playing or paused.
+        /// 
+ /// + /// If this function succeeds, the TTS state will be ready. + /// This function will remove all text added via AddText() and synthesized sound data. + /// + public void Stop() + { + lock (thisLock) + { + TtsError error = TtsStop(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Stop Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Pauses the currently playing utterance. + /// + /// 3 + /// + /// http://tizen.org/feature/speech.synthesis + /// + /// + /// This exception can be due to the following reasons: + /// 1. Invalid State + /// 2. Operation Failure + /// + /// This exception can be due to TTS not supported. + ///
+        /// The state must be playing.
+        /// 
+ /// + /// If this function succeeds, the TTS state will be Paused. + /// + public void Pause() + { + lock (thisLock) + { + TtsError error = TtsPause(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Pause Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } + + /// + /// Method to release resources. + /// + /// 3 + public void Dispose() + { + Dispose(true); + } + + protected virtual void Dispose(bool disposing) + { + if (!disposedValue) + { + if (disposing) + { + TtsError error = TtsDestroy(_handle); + if (error != TtsError.None) + { + Log.Error(LogTag, "Destroy Failed with error " + error); + } + } + + disposedValue = true; + } + } + } +} diff --git a/src/Tizen.Uix.Tts/Tizen.Uix.Tts/UtteranceEventArgs.cs b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/UtteranceEventArgs.cs new file mode 100755 index 0000000..a37c336 --- /dev/null +++ b/src/Tizen.Uix.Tts/Tizen.Uix.Tts/UtteranceEventArgs.cs @@ -0,0 +1,41 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +namespace Tizen.Uix.Tts +{ + /// + /// This class holds information related to UtteranceStared and UtteranceCompleted events. + /// + /// 3 + public class UtteranceEventArgs + { + internal UtteranceEventArgs(int uttId) + { + this.UtteranceId = uttId; + } + + /// + /// The utterance ID. + /// + /// 3 + public int UtteranceId + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.TtsEngine/Interop/Interop.Libraries.cs b/src/Tizen.Uix.TtsEngine/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..178808e --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Interop/Interop.Libraries.cs @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Partial Libraries Class + /// + internal static partial class Libraries + { + internal const string TtsEngine = "libtts_engine.so"; + } +} diff --git a/src/Tizen.Uix.TtsEngine/Interop/Interop.TtsEngine.cs b/src/Tizen.Uix.TtsEngine/Interop/Interop.TtsEngine.cs new file mode 100755 index 0000000..0a2a962 --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Interop/Interop.TtsEngine.cs @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.TtsEngine; +using static Tizen.Uix.TtsEngine.Engine; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// TtsEngine Interop Class + /// + internal static class TtsEngine + { + internal static string LogTag = "Tizen.Uix.TtsEngine"; + + private const int ErrorTts = -0x02F10000; + + public enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< I/O error */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + NetworkDown = Tizen.Internals.Errors.ErrorCode.Networkdown, /**< Network down(Out of network) */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + InvalidState = ErrorTts | 0x01, /**< Invalid state */ + InvalidVoice = ErrorTts | 0x02, /**< Invalid voice */ + OperationFailed = ErrorTts | 0x04, /**< Operation failed */ + NotSupportedFeature = ErrorTts | 0x06, /**< Not supported feature of current engine */ + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< Device or resource busy */ + }; + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error InitializeCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error DeinitializeCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error ForEachSupportedVoicesCb(SupportedVoice cb, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error IsValidVoiceCb(string language, int type, out bool isValid); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error SetPitchCb(int pitch); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error LoadVoiceCb(string langauge, int type); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error UnloadVoiceCb(string language, int type); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error CheckAppAgreedCb(string appid, out bool isAgreed); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool NeedAppCredentialCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error StartSynthesisCb(IntPtr language, int type, IntPtr text, int speed, IntPtr appid, IntPtr credential, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error CancelSynthesisCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error GetInfoCb(out IntPtr engineUuid, out IntPtr engineName, out IntPtr engineSetting, out int useNetwork); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error PrivateDataSetCb(string key, string data); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate Error PrivateDataRequestedCb(string key, out string data); + + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] + internal struct RequestCallbackStruct + { + internal int version; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal GetInfoCb getInfo; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal InitializeCb initialize; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal DeinitializeCb deinitialize; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal ForEachSupportedVoicesCb supportedVoice; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal IsValidVoiceCb validVoice; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal SetPitchCb pitch; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal LoadVoiceCb loadVoice; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal UnloadVoiceCb unloadVoice; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal StartSynthesisCb startSynthesis; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal CancelSynthesisCb cancelSynthesis; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal CheckAppAgreedCb checkAppAgreed; + [MarshalAs(UnmanagedType.FunctionPtr)] + internal NeedAppCredentialCb needAppCredential; + }; + + internal sealed class CallbackStructGCHandle : IDisposable + { + internal RequestCallbackStruct CallbackStruct; + internal GCHandle CallbackStructHandle; + public CallbackStructGCHandle() + { + CallbackStruct = new RequestCallbackStruct(); + CallbackStructHandle = GCHandle.Alloc(CallbackStruct); + } + + #region IDisposable Support + private bool disposedValue = false; + + void Dispose(bool disposing) + { + Tizen.Log.Info(LogTag, "In Dispose"); + if (!disposedValue) + { + if (disposing) + { + Tizen.Log.Info(LogTag, "In Dispose free called"); + CallbackStructHandle.Free(); + } + + disposedValue = true; + } + } + + public void Dispose() + { + Dispose(true); + } + #endregion + } + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_main")] + internal static extern Error TTSEMain(int argc, string[] argv, IntPtr callback); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_get_speed_range")] + internal static extern Error TTSEGetSpeedRange(out int min, out int normal, out int max); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_get_pitch_range")] + internal static extern Error TTSEGetPitchRange(out int min, out int normal, out int max); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_send_result")] + internal static extern Error TTSESendResult(ResultEvent resultEvent, IntPtr data, int dataSize, AudioType audioType, int rate, IntPtr userData); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_send_error")] + internal static extern Error TTSESendError(Error error, string msg); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_set_private_data_set_cb")] + internal static extern Error TTSESetPrivateDataSetCb(PrivateDataSetCb callbackFunc); + + [DllImport(Libraries.TtsEngine, EntryPoint = "ttse_set_private_data_requested_cb")] + internal static extern Error TTSESetPrivateDataRequestedCb(PrivateDataRequestedCb callbackFunc); + } +} diff --git a/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.csproj b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.csproj new file mode 100755 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.sln b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.sln new file mode 100755 index 0000000..6ebf29e --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.TtsEngine", "Tizen.Uix.TtsEngine.csproj", "{D3C68E4C-8017-4832-A2ED-C17F81339521}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{92801CFC-EC18-4F1B-9702-6B3C4CD5430A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{FD365530-2EF1-4A2D-974C-D6BB12AE2361}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3C68E4C-8017-4832-A2ED-C17F81339521}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3C68E4C-8017-4832-A2ED-C17F81339521}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3C68E4C-8017-4832-A2ED-C17F81339521}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3C68E4C-8017-4832-A2ED-C17F81339521}.Release|Any CPU.Build.0 = Release|Any CPU + {92801CFC-EC18-4F1B-9702-6B3C4CD5430A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {92801CFC-EC18-4F1B-9702-6B3C4CD5430A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {92801CFC-EC18-4F1B-9702-6B3C4CD5430A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {92801CFC-EC18-4F1B-9702-6B3C4CD5430A}.Release|Any CPU.Build.0 = Release|Any CPU + {FD365530-2EF1-4A2D-974C-D6BB12AE2361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD365530-2EF1-4A2D-974C-D6BB12AE2361}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD365530-2EF1-4A2D-974C-D6BB12AE2361}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD365530-2EF1-4A2D-974C-D6BB12AE2361}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/ExceptionFactory.cs b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/ExceptionFactory.cs new file mode 100755 index 0000000..0795150 --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/ExceptionFactory.cs @@ -0,0 +1,101 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.TtsEngine; + + +namespace Tizen.Uix.TtsEngine +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(ErrorCode err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case ErrorCode.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case ErrorCode.IoError: + { + exp = new InvalidOperationException("I/O Error Occured"); + break; + } + + case ErrorCode.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case ErrorCode.NetworkDown: + { + exp = new InvalidOperationException("Network down(Out of network)"); + break; + } + + case ErrorCode.InvalidState: + { + exp = new InvalidOperationException("Invalid state"); + break; + } + + case ErrorCode.InvalidVoice: + { + exp = new InvalidOperationException("Invalid Voice"); + break; + } + + case ErrorCode.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case ErrorCode.NotSupportedFeature: + { + exp = new InvalidOperationException("Not supported feature"); + break; + } + + case ErrorCode.NotSupported: + { + exp = new NotSupportedException("Not supported"); + break; + } + + case ErrorCode.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + } + + return exp; + } + } +} diff --git a/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/TtsEngine.cs b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/TtsEngine.cs new file mode 100755 index 0000000..d568e7a --- /dev/null +++ b/src/Tizen.Uix.TtsEngine/Tizen.Uix.TtsEngine/TtsEngine.cs @@ -0,0 +1,626 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Runtime.InteropServices; +using static Interop.TtsEngine; + +namespace Tizen.Uix.TtsEngine +{ + /// + /// Enumeration for audio type. + /// + public enum AudioType + { + /// + /// Signed 16-bit audio type + /// + RawS16 = 0, + /// + /// Unsigned 8-bit audio type + /// + RawU8, + /// + /// Maximum Value + /// + Max + }; + + /// + /// Enumeration for result. + /// + public enum ResultEvent + { + /// + /// Event when the voice synthesis is failed + /// + Fail = -1, + /// + /// Event when the sound data is first data by callback function + /// + Start = 1, + /// + /// Event when the next sound data exist, not first and not last + /// + Continue = 2, + /// + /// Event when the sound data is last data or sound data is only one result + /// + Finish = 3 + }; + + /// + /// Enumeration for Voice Type + /// + public enum VoiceType + { + /// + /// male voice type. + /// + Male = 1, + /// + /// female voice type. + /// + Female = 2, + /// + /// child's voice type. + /// + Child = 3 + } + + /// + /// Enum for Error values that can occur + /// + public enum Error + { + /// + /// Successful, No error + /// + None = ErrorCode.None, + /// + /// Out of Memory + /// + OutOfMemory = ErrorCode.OutOfMemory, + /// + /// I/O error + /// + IoError = ErrorCode.IoError, + /// + /// Invalid parameter + /// + InvalidParameter = ErrorCode.InvalidParameter, + /// + /// Network down(Out of network) + /// + NetworkDown = ErrorCode.NetworkDown, + /// + /// Invalid state + /// + InvalidState = ErrorCode.InvalidState, + /// + /// Invalid voice + /// + InvalidVoice = ErrorCode.InvalidVoice, + /// + /// Operation failed + /// + OperationFailed = ErrorCode.OperationFailed, + /// + /// Not supported feature of current engine + /// + NotSupportedFeature = ErrorCode.NotSupportedFeature, + /// + /// NOT supported + /// + NotSupported = ErrorCode.NotSupported, + /// + /// Permission denied + /// + PermissionDenied = ErrorCode.PermissionDenied + }; + + /// + /// This Class represents the Tts Engine which has to be inherited to make the engine. + /// + public abstract class Engine + { + private CallbackStructGCHandle _callbackStructGCHandle = new CallbackStructGCHandle(); + private PrivateDataSetCb _privateDataSetCb; + private Action _privateDatacallback; + private PrivateDataRequestedCb _privateDataRequestedCb; + private OutAction _privateDataRequestedCallback; + private static Engine _engine; + private IntPtr _structIntPtrHandle; + + /// + /// An Action with 2 Input Parameter returning a Error + /// + /// Generic Type for Parameter 1 + /// The Input Parameter 1 + /// The Input Parameter 2 + /// Error Value + public delegate Error Action(T a, T b); + + /// + /// An Action with 2 Out Parameter returning a Error + /// + /// Generic Type for Parameter 1 + /// The Input Parameter 1 + /// The Input Parameter 2 + /// Error Value + public delegate Error OutAction(T a, out T b); + + /// + /// Called when TTS engine informs the engine service user about whole supported language and voice type list. + /// This callback function is implemented by the engine service user.Therefore, the engine developer does NOT have to implement this callback function. + /// + /// + /// This callback function is called by ForEachSupportedVoices() to inform the whole supported voice list. userData must be transferred from ForEachSupportedVoices(). + /// + /// The language is specified as an ISO 3166 alpha-2 two-letter country code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The voice type + /// The user data passed from ForEachSupportedVoices() + /// true to continue with the next iteration of the loop false to break out of the loop + /// ForEachSupportedVoices() will invoke this callback function. + public delegate bool SupportedVoice(string language, VoiceType type, IntPtr userData); + + /// + /// Called when the engine service user starts to synthesize a voice, asynchronously. + /// + /// + /// In this callback function, TTS engine must transfer the synthesized result to the engine service user using SendResult(). + /// Also, if TTS engine needs the application's credential, it can set the credential granted to the application. + /// + /// The language is specified as an ISO 3166 alpha-2 two-letter country code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The voice type + /// Texts + /// The speed of speaking + /// The Application ID + /// The credential granted to the application + /// The user data which must be passed to SendResult() function + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. InvalidParameter + /// 4. InvalidVoice + /// 5. OperationFailed + /// 6. NetworkDown + /// 7. PermissionDenied + /// + /// This function invokes SendResult() + public abstract Error StartSynthesis(string language, int type, string text, int speed, string appid, string credential, IntPtr userData); + + /// + /// Called when the engine service user requests the basic information of TTS engine. + /// + /// + /// The allocated engineUuid, engineName, and engineSetting will be released internally. + /// In order to upload the engine at Tizen Appstore, both a service app and a ui app are necessary. + /// Therefore, engineSetting must be transferred to the engine service user. + /// + /// UUID of engine + /// Name of engine + /// The engine setting application(ui app)'s app ID + /// The status for using network + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + public abstract Error GetInformation(out string engineUuid, out string engineName, out string engineSetting, out bool useNetwork); + + /// + /// Called when the engine service user initializes TTS engine. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. NotSupportedFeature + /// 4. PermissionDenied + /// + public abstract Error Initialize(); + + /// + /// Called when the engine service user deinitializes TTS engine. + /// + /// + /// NOTE that the engine may be terminated automatically. When this callback function is invoked, the release of resources is necessary. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + public abstract Error Deinitialize(); + + /// + /// Called when the engine service user gets the whole supported voice list. + /// + /// + /// In this function, the engine service user's callback function 'SupportedVoice()' is invoked repeatedly for getting all supported voices, + /// and userData must be transferred to 'SupportedVoice()'. If 'SupportedVoice()' returns false, it should be stopped to call 'SupportedVoice()'. + /// The callback function + /// The user data which must be passed to SupportedVoice() + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. OperationFailed + /// + /// This callback function invokes SupportedVoice() repeatedly for getting all supported voices. + public abstract Error ForEachSupportedVoices(SupportedVoice callback, IntPtr userData); + + /// + /// Called when the engine service user checks whether the voice is valid or not in TTS engine. + /// + /// The language is specified as an ISO 3166 alpha-2 two-letter country code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The voice type + /// A variable for checking whether the corresponding voice is valid or not. true to be valid, false to be invalid + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// + public abstract Error IsValidVoice(string language, int type, out bool isValid); + + /// + /// Called when the engine service user sets the default pitch of TTS engine. + /// + /// The default pitch + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. OperationFailed + /// 4. InvalidParameter + /// + public abstract Error SetPitch(int pitch); + + /// + /// Called when the engine service user requests to load the corresponding voice type for the first time. + /// + /// The language is specified as an ISO 3166 alpha-2 two-letter country code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The voice type + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. OperationFailed + /// 4. InvalidVoice + /// 5. InvalidParameter + /// 6. OutOfMemory + /// + public abstract Error LoadVoice(string language, int type); + + /// + /// Called when the engine service user requests to unload the corresponding voice type or to stop using voice. + /// + /// The language is specified as an ISO 3166 alpha-2 two-letter country code followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English + /// The voice type + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. OperationFailed + /// 4. InvalidVoice + /// 5. InvalidParameter + /// + public abstract Error UnloadVoice(string language, int type); + + /// + /// Called when the engine service user requests for TTS engine to check whether the application agreed the usage of TTS engine. + /// This callback function is called when the engine service user requests for TTS engine to check the application's agreement about using the engine. + /// According to the need, the engine developer can provide some user interfaces to check the agreement. + /// + /// + /// If the TTS engine developer wants not to check the agreement, the developer has need to return proper values as isAgreed in accordance with the intention. + /// true if the developer regards that every application agreed the usage of the engine, false if the developer regards that every application disagreed. + /// NOTE that, however, there may be any legal issue unless the developer checks the agreement. + /// Therefore, we suggest that the engine developers should provide a function to check the agreement. + /// + /// The Application ID + /// A variable for checking whether the application agreed to use TTS engine or not. true to agree, false to disagree + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// 3. NotSupportedFeature + /// 4. InvalidParameter + /// + public abstract Error CheckAppAgreed(string appid, out bool isAgreed); + + /// + /// Called when the engine service user checks whether TTS engine needs the application's credential. + /// + /// true if TTS engine needs the application's credential, otherwise false + public abstract bool NeedAppCredential(); + + /// + /// Called when the engine service user cancels to synthesize a voice. + /// + /// + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidState + /// + /// + /// StartSynthesis should be performed + /// + public abstract Error CancelSynthesis(); + + /// + /// Public Constructor + /// + public Engine() + { + _engine = this; + } + + /// + /// Main function for Text-To-Speech (TTS) engine. + /// This function is the main function for operating TTS engine. + /// + /// + /// ServiceAppMain should be used for working the engine after this function. + /// + /// The argument count(original) + /// The argument(original) + /// Thrown in case of Invalid Parameter + /// Thrown in case of Not supported + /// thrown in case of Operation failure + public void EngineMain(int argc, string[] argv) + { + _callbackStructGCHandle.CallbackStruct.version = 1; + _callbackStructGCHandle.CallbackStruct.getInfo = _getInfoCb; + _callbackStructGCHandle.CallbackStruct.initialize = Initialize; + _callbackStructGCHandle.CallbackStruct.deinitialize = _deinitializeCb; + _callbackStructGCHandle.CallbackStruct.supportedVoice = ForEachSupportedVoices; + _callbackStructGCHandle.CallbackStruct.validVoice = IsValidVoice; + _callbackStructGCHandle.CallbackStruct.pitch = SetPitch; + _callbackStructGCHandle.CallbackStruct.loadVoice = LoadVoice; + _callbackStructGCHandle.CallbackStruct.unloadVoice = UnloadVoice; + _callbackStructGCHandle.CallbackStruct.startSynthesis = _startSynthesisCb; + _callbackStructGCHandle.CallbackStruct.cancelSynthesis = CancelSynthesis; + _callbackStructGCHandle.CallbackStruct.checkAppAgreed = CheckAppAgreed; + _callbackStructGCHandle.CallbackStruct.needAppCredential = NeedAppCredential; + _structIntPtrHandle = Marshal.AllocHGlobal(Marshal.SizeOf(_callbackStructGCHandle.CallbackStruct)); + Marshal.StructureToPtr(_callbackStructGCHandle.CallbackStruct, _structIntPtrHandle, false); + Error error = TTSEMain(argc, argv, _structIntPtrHandle); + if (error != Error.None) + { + Log.Error(LogTag, "TTSEMain Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + Log.Info(LogTag, "After TTSEMain"); + } + + /// + /// Gets the speed range from Tizen platform + /// + /// + /// This API is used when TTS engine wants to get the speed range from Tizen platform + /// + /// The minimum speed value + /// The normal speed value + /// The maximum speed value + /// Thrown in case of Not supported + /// thrown in case of Operation failure + public void GetSpeedRange(out int min, out int normal, out int max) + { + Error error = TTSEGetSpeedRange(out min, out normal, out max); + if (error != Error.None) + { + Log.Error(LogTag, "TTSEGetSpeedRange Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Gets the pitch range from Tizen platform. + /// + /// + /// This API is used when TTS engine wants to get the pitch range from Tizen platform. + /// + /// The minimum pitch value + /// The normal pitch value + /// The maximum pitch value + /// Thrown in case of Not supported + /// thrown in case of Operation failure + public void GetPitchRange(out int min, out int normal, out int max) + { + Error error = TTSEGetPitchRange(out min, out normal, out max); + if (error != Error.None) + { + Log.Error(LogTag, "TTSEGetPitchRange Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sends the synthesized result to the engine service user. + /// + /// + /// This API is used in StartSynthesis(), when TTS engine sends the synthesized result to the engine service user. + /// The synthesized result must be transferred to the engine service user through this function. + /// + /// The result event + /// Result data + /// Result data size + /// The audio type + /// The sample rate + /// Thrown in case of Invalid Parameter + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// EngineMain function should be invoked before this function is called. StartSynthesis() will invoke this function. + /// + public void SendResult(ResultEvent resultEvent, IntPtr data, int dataSize, AudioType audioType, int rate) + { + Error error = TTSESendResult(resultEvent, data, dataSize, audioType, rate, IntPtr.Zero); + if (error != Error.None) + { + Log.Error(LogTag, "TTSESendResult Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + } + + /// + /// Sends the error to the engine service user. + /// + /// The error reason + /// The error message + /// + /// EngineMain function should be invoked before this function is called. + /// + public void SendError(Error error, string msg) + { + Error err = TTSESendError(error, msg); + if (err != Error.None) + { + Log.Error(LogTag, "SendError Failed with error " + err); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sets a callback function for setting the private data. + /// + /// + /// Called when the engine service user gets the private data from Tts engine. + /// In Parameters: + /// a = Key -- The key field of private data + /// b = data -- The data field of private data + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// 3. OperationFailed + /// 4. NotSupported + /// + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. + /// + public void SetPrivateDataSetDelegate(Action callback) + { + _privateDatacallback = callback; + _privateDataSetCb = (string key, string data) => + { + return _privateDatacallback.Invoke(key, data); + }; + Error error = TTSESetPrivateDataSetCb(_privateDataSetCb); + if (error != Error.None) + { + Log.Error(LogTag, "SetPrivateDataSetDelegate Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + + /// + /// Sets a callback function for setting the private data. + /// + /// callback function + /// Called when TTS engine receives the private data from the engine service user. + /// This callback function is called when the engine service user sends the private data to TTS engine. + /// Out Parameters: + /// a = Key -- The key field of private data + /// b = data -- The data field of private data + /// Following Error Codes can be returned + /// 1. None + /// 2. InvalidParameter + /// 3. OperationFailed + /// 4. NotSupported + /// + /// Thrown in case of Invalid Parameter + /// Thrown in case of Permission denied + /// Thrown in case of Not supported + /// thrown in case of Operation failure + /// + /// Main function should be invoked before this function is called. + /// + public void SetPrivateDataRequestedDelegate(OutAction callback) + { + _privateDataRequestedCallback = callback; + _privateDataRequestedCb = (string key, out string data) => + { + return _privateDataRequestedCallback.Invoke(key, out data); + }; + Error error = TTSESetPrivateDataRequestedCb(_privateDataRequestedCb); + if (error != Error.None) + { + Log.Error(LogTag, "SetPrivateDataRequestedDelegate Failed with error " + error); + throw ExceptionFactory.CreateException((ErrorCode)error); + } + + } + private StartSynthesisCb _startSynthesisCb = (IntPtr language, int type, IntPtr text, int speed, IntPtr appid, IntPtr credential, IntPtr userData) => + { + string lan = null; + string txt = null; + string apid = null; + string cre = null; + if (language != null) + lan = Marshal.PtrToStringAnsi(language); + if (text != null) + txt = Marshal.PtrToStringAnsi(text); + if (appid != null) + apid = Marshal.PtrToStringAnsi(appid); + if (credential != null) + cre = Marshal.PtrToStringAnsi(credential); + return _engine.StartSynthesis(lan, type, txt, speed, apid, cre, IntPtr.Zero); + }; + + private GetInfoCb _getInfoCb = (out IntPtr engineUuid, out IntPtr engineName, out IntPtr engineSetting, out int useNetwork) => + { + string uuid; + string name; + string setting; + bool network; + Error err = _engine.GetInformation(out uuid, out name, out setting, out network); + if (network == true) + { + useNetwork = 1; + } + else + { + useNetwork = 0; + } + engineUuid = Marshal.StringToHGlobalAnsi(uuid); + engineName = Marshal.StringToHGlobalAnsi(name); + engineSetting = Marshal.StringToHGlobalAnsi(setting); + return err; + }; + + private DeinitializeCb _deinitializeCb = () => + { + Marshal.FreeHGlobal(_engine._structIntPtrHandle); + return _engine.Deinitialize(); + }; + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.VoiceControl/Interop/Interop.Libraries.cs b/src/Tizen.Uix.VoiceControl/Interop/Interop.Libraries.cs new file mode 100755 index 0000000..22f391b --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Interop/Interop.Libraries.cs @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// Partial Libraries Class + /// + internal static partial class Libraries + { + internal const string VoiceControl = "libvc.so"; + } +} diff --git a/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControl.cs b/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControl.cs new file mode 100755 index 0000000..edc20f6 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControl.cs @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen.Uix.VoiceControl; +using static Interop.VoiceControlCommand; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// VoiceControl Interop Class + /// + internal static class VoiceControl + { + internal static string LogTag = "Tizen.Uix.VoiceControl"; + + private const int ErrorVoiceControl = -0x02F50000; + + internal enum ErrorCode + { + None = Tizen.Internals.Errors.ErrorCode.None, /**< Successful */ + OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory, /**< Out of Memory */ + IoError = Tizen.Internals.Errors.ErrorCode.IoError, /**< I/O error */ + InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter, /**< Invalid parameter */ + TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut, /**< No answer from service */ + RecorderBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy, /**< Busy recorder */ + PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied, /**< Permission denied */ + NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported, /**< VC NOT supported */ + InvalidState = ErrorVoiceControl | 0x011, /**< Invalid state */ + InvalidLanguage = ErrorVoiceControl | 0x012, /**< Invalid language */ + EngineNotFound = ErrorVoiceControl | 0x013, /**< No available engine */ + OperationFailed = ErrorVoiceControl | 0x014, /**< Operation failed */ + OperationRejected = ErrorVoiceControl | 0x015, /**< Operation rejected */ + IterationEnd = ErrorVoiceControl | 0x016, /**< List reached end */ + Empty = ErrorVoiceControl | 0x017, /**< List empty */ + ServiceReset = ErrorVoiceControl | 0x018, /**< Service daemon reset (Since 3.0) */ + InProgressToReady = ErrorVoiceControl | 0x019, /**< In progress to ready (Since 3.0) */ + InProgressToRecording = ErrorVoiceControl | 0x020, /**< In progress to recording (Since 3.0) */ + InProgressToProcessing = ErrorVoiceControl | 0x021 /**< In progress to processing (Since 3.0) */ + }; + + internal enum VoiceCommandType + { + Foreground = 1, /* Foreground command type. */ + BackGround = 2 /* background command type. */ + }; + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_initialize")] + internal static extern ErrorCode VcInitialize(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_deinitialize")] + internal static extern ErrorCode VcDeinitialize(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_prepare")] + internal static extern ErrorCode VcPrepare(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unprepare")] + internal static extern ErrorCode VcUnprepare(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_foreach_supported_languages")] + internal static extern ErrorCode VcForeachSupportedLanguages(VcSupportedLanguageCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_get_current_language")] + internal static extern ErrorCode VcGetCurrentLanguage(out string language); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_get_state")] + internal static extern ErrorCode VcGetState(out State state); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_get_service_state")] + internal static extern ErrorCode VcGetServiceState(out ServiceState state); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_get_system_command_list")] + internal static extern ErrorCode VcGetSystemCommandList(out IntPtr vc_sys_cmd_list); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_invocation_name")] + internal static extern ErrorCode VcSetInvocationName(string name); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_request_dialog")] + internal static extern ErrorCode VcRequestDialog(string dispText, string uttText, bool autoStart); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_command_list")] + internal static extern ErrorCode VcSetCommandList(SafeCommandListHandle cmdList, VoiceCommandType type); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_command_list")] + internal static extern ErrorCode VcUnsetCommandList(VoiceCommandType type); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_get_result")] + internal static extern ErrorCode VcGetResult(VcResultCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_result_cb")] + internal static extern ErrorCode VcSetResultCb(VcResultCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_result_cb")] + internal static extern ErrorCode VcUnsetResultCb(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_service_state_changed_cb")] + internal static extern ErrorCode VcSetServiceStateChangedCb(VcServiceStateChangedCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_service_state_changed_cb")] + internal static extern ErrorCode VcUnsetServiceStateChangedCb(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_state_changed_cb")] + internal static extern ErrorCode VcSetStateChangedCb(VcStateChangedCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_state_changed_cb")] + internal static extern ErrorCode VcUnsetStateChangedCb(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_current_language_changed_cb")] + internal static extern ErrorCode VcSetCurrentLanguageChangedCb(VcCurrentLanguageChangedCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_current_language_changed_cb")] + internal static extern ErrorCode VcUnsetCurrentLanguageChangedCb(); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_set_error_cb")] + internal static extern ErrorCode VcSetErrorCb(VcErrorCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_unset_error_cb")] + internal static extern ErrorCode VcUnsetErrorCb(); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VcResultCb(ResultEvent evt, IntPtr cmdList, IntPtr result, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VcCurrentLanguageChangedCb(IntPtr previous, IntPtr current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VcSupportedLanguageCb(IntPtr language, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VcStateChangedCb(State previous, State current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VcServiceStateChangedCb(ServiceState previous, ServiceState current, IntPtr userData); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate void VcErrorCb(ErrorCode reason, IntPtr userData); + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControlCommand.cs b/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControlCommand.cs new file mode 100755 index 0000000..c29057a --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Interop/Interop.VoiceControlCommand.cs @@ -0,0 +1,169 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + +using System; +using System.Runtime.InteropServices; +using Tizen; +using Tizen.Uix.VoiceControl; + +/// +/// Partial Interop Class +/// +internal static partial class Interop +{ + /// + /// VoiceControlCommand Interop Class + /// + internal static class VoiceControlCommand + { + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_create")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListCreate(out SafeCommandListHandle cmdList); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_destroy")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListDestroy(IntPtr cmdList, bool freeCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_get_count")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListGetCount(SafeCommandListHandle cmdList, out int count); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_add")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListAdd(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_remove")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListRemove(SafeCommandListHandle cmdList, SafeCommandHandle vcCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_foreach_commands")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListForeachCommands(SafeCommandListHandle cmdList, VcCmdListCb callback, IntPtr userData); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_first")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListFirst(SafeCommandListHandle cmdList); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_last")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListLast(SafeCommandListHandle cmdList); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_next")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListNext(SafeCommandListHandle cmdList); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_prev")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListPrev(SafeCommandListHandle cmdList); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_list_get_current")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdListGetCurrent(SafeCommandListHandle cmdList, out SafeCommandHandle vcCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_create")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdCreate(out SafeCommandHandle vcCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_destroy")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdDestroy(IntPtr vcCommand); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_set_command")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdSetCommand(SafeCommandHandle vcCommand, string command); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_get_command")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdGetCommand(SafeCommandHandle vcCommand, out string command); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_get_unfixed_command")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdGetUnfixedCommand(SafeCommandHandle vcCommand, out string command); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_set_type")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdSetType(SafeCommandHandle vcCommand, CommandType type); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_get_type")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdGetType(SafeCommandHandle vcCommand, out int type); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_set_format")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdSetFormat(SafeCommandHandle vcCommand, CommandFormat format); + + [DllImport(Libraries.VoiceControl, EntryPoint = "vc_cmd_get_format")] + internal static extern Interop.VoiceControl.ErrorCode VcCmdGetFormat(SafeCommandHandle vcCommand, out CommandFormat format); + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + internal delegate bool VcCmdListCb(IntPtr vcCommand, IntPtr userData); + + internal sealed class SafeCommandListHandle : SafeHandle + { + internal bool _ownership; + + public SafeCommandListHandle(IntPtr handle) + : base(handle, true) + { + _ownership = true; + } + + public SafeCommandListHandle() + : base(IntPtr.Zero, true) + { + _ownership = true; + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + if (_ownership && !IsInvalid) + { + Interop.VoiceControl.ErrorCode error = VcCmdListDestroy(this.handle, false); + if (error != Interop.VoiceControl.ErrorCode.None) + { + Log.Error(VoiceControl.LogTag, "Destroy Failed with error " + error); + } + } + this.SetHandle(IntPtr.Zero); + return true; + } + } + + internal sealed class SafeCommandHandle : SafeHandle + { + internal bool _ownership; + + public SafeCommandHandle(IntPtr handle) + : base(handle, true) + { + _ownership = true; + } + + public SafeCommandHandle() + : base(IntPtr.Zero, true) + { + _ownership = true; + } + + public override bool IsInvalid + { + get { return this.handle == IntPtr.Zero; } + } + + protected override bool ReleaseHandle() + { + Interop.VoiceControl.ErrorCode error = VoiceControl.ErrorCode.None; + if (_ownership && !IsInvalid) + { + error = VcCmdDestroy(this.handle); + if (error != Interop.VoiceControl.ErrorCode.None) + { + Log.Error(VoiceControl.LogTag, "Destroy Failed with error " + error); + } + } + this.SetHandle(IntPtr.Zero); + return true; + } + } + } +} \ No newline at end of file diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.csproj b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.csproj new file mode 100644 index 0000000..598a431 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.csproj @@ -0,0 +1,14 @@ + + + + + netstandard1.6 + + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.sln b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.sln new file mode 100755 index 0000000..2b6df86 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Uix.VoiceControl", "Tizen.Uix.VoiceControl.csproj", "{5CEF41F8-A2B9-4C32-BB6B-91D7FF261120}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "..\Tizen\Tizen.csproj", "{90B368FB-387B-4822-9161-854A59FCF749}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Log", "..\Tizen.Log\Tizen.Log.csproj", "{44082C95-BC74-48AE-B7C3-F6F6DB759D15}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5CEF41F8-A2B9-4C32-BB6B-91D7FF261120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5CEF41F8-A2B9-4C32-BB6B-91D7FF261120}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5CEF41F8-A2B9-4C32-BB6B-91D7FF261120}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5CEF41F8-A2B9-4C32-BB6B-91D7FF261120}.Release|Any CPU.Build.0 = Release|Any CPU + {90B368FB-387B-4822-9161-854A59FCF749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {90B368FB-387B-4822-9161-854A59FCF749}.Debug|Any CPU.Build.0 = Debug|Any CPU + {90B368FB-387B-4822-9161-854A59FCF749}.Release|Any CPU.ActiveCfg = Release|Any CPU + {90B368FB-387B-4822-9161-854A59FCF749}.Release|Any CPU.Build.0 = Release|Any CPU + {44082C95-BC74-48AE-B7C3-F6F6DB759D15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44082C95-BC74-48AE-B7C3-F6F6DB759D15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44082C95-BC74-48AE-B7C3-F6F6DB759D15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44082C95-BC74-48AE-B7C3-F6F6DB759D15}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/CurrentLanguageChangedEventArgs.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/CurrentLanguageChangedEventArgs.cs new file mode 100755 index 0000000..8ab933d --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/CurrentLanguageChangedEventArgs.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.VoiceControl +{ + /// + /// This class holds information about the CurrentLanguageChanged Event + /// + /// 3 + public class CurrentLanguageChangedEventArgs + { + internal CurrentLanguageChangedEventArgs(string previous, string current) + { + PreviousLanguage = previous; + CurrentLanguage = current; + } + + /// + /// The previous language + /// + /// 3 + public string PreviousLanguage + { + get; + internal set; + } + + /// + /// The current language + /// + /// 3 + public string CurrentLanguage + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ErrorOccuredEventArgs.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ErrorOccuredEventArgs.cs new file mode 100755 index 0000000..ce5de7b --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ErrorOccuredEventArgs.cs @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.VoiceControl; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// This class holds information related to the VoiceControl ErrorOccured Event + /// + /// 3 + public class ErrorOccuredEventArgs + { + internal ErrorOccuredEventArgs(ErrorCode error) + { + switch (error) + { + case ErrorCode.None: + { + ErrorValue = Error.None; + break; + } + + case ErrorCode.OutOfMemory: + { + ErrorValue = Error.OutOfMemory; + break; + } + + case ErrorCode.IoError: + { + ErrorValue = Error.IoError; + break; + } + + case ErrorCode.InvalidParameter: + { + ErrorValue = Error.InvalidParameter; + break; + } + + case ErrorCode.TimedOut: + { + ErrorValue = Error.TimedOut; + break; + } + + case ErrorCode.RecorderBusy: + { + ErrorValue = Error.RecorderBusy; + break; + } + + case ErrorCode.PermissionDenied: + { + ErrorValue = Error.PermissionDenied; + break; + } + + case ErrorCode.NotSupported: + { + ErrorValue = Error.NotSupported; + break; + } + + case ErrorCode.InvalidState: + { + ErrorValue = Error.InvalidState; + break; + } + + case ErrorCode.InvalidLanguage: + { + ErrorValue = Error.InvalidLanguage; + break; + } + + case ErrorCode.EngineNotFound: + { + ErrorValue = Error.EngineNotFound; + break; + } + + case ErrorCode.OperationFailed: + { + ErrorValue = Error.OperationFailed; + break; + } + + case ErrorCode.OperationRejected: + { + ErrorValue = Error.OperationRejected; + break; + } + + case ErrorCode.IterationEnd: + { + ErrorValue = Error.IterationEnd; + break; + } + + case ErrorCode.Empty: + { + ErrorValue = Error.Empty; + break; + } + + case ErrorCode.InProgressToReady: + { + ErrorValue = Error.InProgressToReady; + break; + } + + case ErrorCode.InProgressToRecording: + { + ErrorValue = Error.InProgressToRecording; + break; + } + + case ErrorCode.InProgressToProcessing: + { + ErrorValue = Error.InProgressToProcessing; + break; + } + + case ErrorCode.ServiceReset: + { + ErrorValue = Error.ServiceReset; + break; + } + } + } + + /// + /// The Error Value + /// + /// 3 + public Error ErrorValue + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ExceptionFactory.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ExceptionFactory.cs new file mode 100755 index 0000000..8c6e35f --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ExceptionFactory.cs @@ -0,0 +1,148 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.VoiceControl; + +namespace Tizen.Uix.VoiceControl +{ + internal static class ExceptionFactory + { + internal static Exception CreateException(ErrorCode err) + { + Tizen.Log.Error(LogTag, "Error " + err); + Exception exp; + switch (err) + { + case ErrorCode.OutOfMemory: + { + exp = new OutOfMemoryException("Out Of Memory"); + break; + } + + case ErrorCode.IoError: + { + exp = new InvalidOperationException("I/O Error Occured"); + break; + } + + case ErrorCode.InvalidParameter: + { + exp = new ArgumentException("Invalid Parameters Provided"); + break; + } + + case ErrorCode.TimedOut: + { + exp = new TimeoutException("No answer from service"); + break; + } + + case ErrorCode.RecorderBusy: + { + exp = new InvalidOperationException("Recorder is Busy "); + break; + } + + case ErrorCode.PermissionDenied: + { + exp = new UnauthorizedAccessException("Permission Denied"); + break; + } + + case ErrorCode.NotSupported: + { + exp = new NotSupportedException("VC NOT supported"); + break; + } + + case ErrorCode.InvalidState: + { + exp = new InvalidOperationException("Invalid state"); + break; + } + + case ErrorCode.InvalidLanguage: + { + exp = new InvalidOperationException("Invalid language"); + break; + } + + case ErrorCode.EngineNotFound: + { + exp = new InvalidOperationException("No available engine"); + break; + } + + case ErrorCode.OperationFailed: + { + exp = new InvalidOperationException("Operation Failed"); + break; + } + + case ErrorCode.OperationRejected: + { + exp = new InvalidOperationException("Operation Rejected"); + break; + } + + case ErrorCode.IterationEnd: + { + exp = new InvalidOperationException("List Reached End"); + break; + } + + case ErrorCode.Empty: + { + exp = new InvalidOperationException("List Empty"); + break; + } + + case ErrorCode.InProgressToReady: + { + exp = new InvalidOperationException("Progress to ready is not finished"); + break; + } + + case ErrorCode.InProgressToRecording: + { + exp = new InvalidOperationException("Progress to recording is not finished"); + break; + } + + case ErrorCode.InProgressToProcessing: + { + exp = new InvalidOperationException("Progress to processing is not finished"); + break; + } + + case ErrorCode.ServiceReset: + { + exp = new InvalidOperationException("Service reset"); + break; + } + + default: + { + exp = new Exception(""); + break; + } + } + + return exp; + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResult.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResult.cs new file mode 100755 index 0000000..d3e3103 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResult.cs @@ -0,0 +1,83 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.VoiceControl; +using static Interop.VoiceControlCommand; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// The recognition result from the engine. + /// If the duplicated commands are recognized, the event(e.g. Result.Rejected) of command may be rejected + /// for selecting command as priority.If you set similar or same commands or the recognized results are multi-results, CommandList has the multi commands. + /// + /// 3 + public class RecognitionResult + { + private ResultEvent _resultEvent; + private VoiceCommandList _list; + private string _result; + + internal RecognitionResult(ResultEvent evt, IntPtr cmdList, IntPtr result) + { + _resultEvent = evt; + SafeCommandListHandle handle = new SafeCommandListHandle(cmdList); + handle._ownership = false; + _list = new VoiceCommandList(handle); + _result = Marshal.PtrToStringAnsi(result); + } + + /// + /// The result event + /// + /// 3 + public ResultEvent Result + { + get + { + return _resultEvent; + } + } + + /// + /// The spoken text + /// + /// 3 + public string ResultMessage + { + get + { + return _result; + } + } + + + /// + /// The recognized command list + /// + /// 3 + public VoiceCommandList CommandList + { + get + { + return _list; + } + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResultEventArgs.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResultEventArgs.cs new file mode 100755 index 0000000..c3fc3dc --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/RecognitionResultEventArgs.cs @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// The recognition result from the engine. + /// + /// 3 + public class RecognitionResultEventArgs : EventArgs + { + private RecognitionResult _result; + internal RecognitionResultEventArgs(RecognitionResult result) + { + _result = result; + } + + /// + /// Gets the Recognition result + /// + /// 3 + public RecognitionResult Result + { + get + { + return _result; + } + } + + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ServiceStateChangedEventArgs.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ServiceStateChangedEventArgs.cs new file mode 100755 index 0000000..077c623 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/ServiceStateChangedEventArgs.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.VoiceControl +{ + /// + /// This class holds information related to the VoiceControl service ServiceStateChanged event + /// + /// 3 + public class ServiceStateChangedEventArgs + { + internal ServiceStateChangedEventArgs(ServiceState previous, ServiceState current) + { + Previous = previous; + Current = current; + } + + /// + /// A previous state + /// + /// 3 + public ServiceState Previous + { + get; + internal set; + } + + /// + /// A current state + /// + /// 3 + public ServiceState Current + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/StateChangedEventArgs.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/StateChangedEventArgs.cs new file mode 100755 index 0000000..d69e2fe --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/StateChangedEventArgs.cs @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +namespace Tizen.Uix.VoiceControl +{ + /// + /// This class holds information related to the VoiceControl client StateChanged event + /// + /// 3 + public class StateChangedEventArgs + { + internal StateChangedEventArgs(State previous, State current) + { + Previous = previous; + Current = current; + } + + /// + /// A previous state + /// + /// 3 + public State Previous + { + get; + internal set; + } + + /// + /// A current state + /// + /// 3 + public State Current + { + get; + internal set; + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommand.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommand.cs new file mode 100755 index 0000000..b6be557 --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommand.cs @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using static Interop.VoiceControl; +using static Interop.VoiceControlCommand; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// Enumeration for Command Format + /// + /// 3 + public enum CommandFormat + { + /// + /// fixed command format. + /// + Fixed = 0, + /// + /// fixed and variable fixed command format. + /// + FixedAndVFixed = 1, + /// + /// variable fixed and fixed command format. + /// + VFixedAndFixed = 2, + /// + /// fixed and non-fixed command format. + /// + FixedAndNonFixed = 3, + /// + /// non-fixed and fixed command format. + /// + NonFixedAndFixed = 4, + /// + /// Undefined + /// + Undefined = 5 + }; + + /// + /// This class represents a Voice Command + /// + /// 3 + public class VoiceCommand + { + internal SafeCommandHandle _handle; + + /// + /// Public Constructor + /// + /// 3 + /// This Exception can be due to Invalid State. + /// This Exception can be due to Out Of Memory. + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public VoiceCommand() + { + SafeCommandHandle handle; + ErrorCode error = VcCmdCreate(out handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Create Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + _handle = handle; + } + + internal VoiceCommand(SafeCommandHandle handle) + { + _handle = handle; + } + + /// + /// Gets the unfixed command. + /// This property should be used for commands which have non-fixed format. + /// empty string will be returned in case of some internal error + /// + /// 3 + public string UnfixedCommand + { + get + { + string unfixedCommand; + ErrorCode error = VcCmdGetUnfixedCommand(_handle, out unfixedCommand); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "UnfixedCommand Failed with error " + error); + return ""; + } + + return unfixedCommand; + } + } + + /// + /// Gets/Sets command type. + /// + /// 3 + /// If you do not set the command type, the default value is Undefined. You should set type if command is valid + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public CommandType Type + { + get + { + CommandType cmdType = CommandType.Undefined; + int type; + ErrorCode error = VcCmdGetType(_handle, out type); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetType Failed with error " + error); + return CommandType.Undefined; + } + + if (type != -1) + { + cmdType = (CommandType)type; + } + + return cmdType; + } + set + { + ErrorCode error = VcCmdSetType(_handle, value); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetType Failed with error " + error); + } + } + } + + /// + /// Gets/Sets the command format. + /// + /// 3 + /// The default format is Fixed + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public CommandFormat Format + { + get + { + CommandFormat format; + ErrorCode error = VcCmdGetFormat(_handle, out format); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetFormat Failed with error " + error); + return CommandFormat.Undefined; + } + + return format; + } + set + { + ErrorCode error = VcCmdSetFormat(_handle, value); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetFormat Failed with error " + error); + } + } + } + + /// + /// Gets/Sets command + /// in case of get empty string will be returned in case of some internal error + /// + /// 3 + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public string Command + { + get + { + string command; + ErrorCode error = VcCmdGetCommand(_handle, out command); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetCommand Failed with error " + error); + return ""; + } + + return command; + } + set + { + ErrorCode error = VcCmdSetCommand(_handle, value); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetCommand Failed with error " + error); + } + } + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs new file mode 100755 index 0000000..f3b962f --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceCommandList.cs @@ -0,0 +1,337 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using static Interop.VoiceControl; +using static Interop.VoiceControlCommand; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// this class represents list of Voice Commands + /// + /// 3 + public class VoiceCommandList + { + internal SafeCommandListHandle _handle; + private List _list; + private VcCmdListCb _callback; + + /// + /// Public Constructor + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Out of memory. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public VoiceCommandList() + { + SafeCommandListHandle handle; + ErrorCode error = VcCmdListCreate(out handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Create Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + _handle = handle; + } + + internal VoiceCommandList(SafeCommandListHandle handle) + { + _handle = handle; + } + + /// + /// Gets command count of list. + /// -1 is returned in case of internal failure. + /// + /// 3 + /// + /// Command counts of the list. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + public int Count + { + get + { + int count; + ErrorCode error = VcCmdListGetCount(_handle, out count); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Count Failed with error " + error); + return -1; + } + + return count; + } + } + + /// + /// Get current command from command list by index. + /// null will be returned in case of Empty List + /// + /// 3 + /// + /// Current command from the command list. + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + public VoiceCommand Current + { + get + { + SafeCommandHandle current; + ErrorCode error = VcCmdListGetCurrent(_handle, out current); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Current Failed with error " + error); + return null; + } + current._ownership = false; + return new VoiceCommand(current); + } + } + + /// + /// Adds command to command list. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// The command + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + /// This will occur if the provide parameter is null. + public void Add(VoiceCommand command) + { + ErrorCode error = VcCmdListAdd(_handle, command._handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Removes command from command list. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// The command + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + /// This will occur if the provide parameter is null. + public void Remove(VoiceCommand command) + { + ErrorCode error = VcCmdListRemove(_handle, command._handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Retrieves all commands of command list. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public IEnumerable GetAllCommands() + { + _list = new List(); + _callback = (IntPtr vcCommand, IntPtr userData) => + { + SafeCommandHandle handle = new SafeCommandHandle(vcCommand); + handle._ownership = false; + _list.Add(new VoiceCommand(handle)); + return true; + }; + ErrorCode error = VcCmdListForeachCommands(_handle, _callback, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetAllCommands Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + return _list; + } + + /// + /// Moves index to first command. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to List Empty. + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public void First() + { + ErrorCode error = VcCmdListFirst(_handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "First Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Moves index to last command. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to List Empty. + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public void Last() + { + ErrorCode error = VcCmdListLast(_handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Last Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Moves index to next command. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reaons + /// 1. List Empty + /// 2. List reached end + /// + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public void Next() + { + ErrorCode error = VcCmdListNext(_handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Next Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Moves index to previous command. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// This Exception can be due to the following reaons + /// 1. List Empty + /// 2. List reached end + /// + /// This Exception can be due to Permission Denied. + /// This Exception can be due to Not Supported. + public void Previous() + { + ErrorCode error = VcCmdListPrev(_handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Previous Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + } +} diff --git a/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceControlClient.cs b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceControlClient.cs new file mode 100755 index 0000000..4b8638d --- /dev/null +++ b/src/Tizen.Uix.VoiceControl/Tizen.Uix.VoiceControl/VoiceControlClient.cs @@ -0,0 +1,958 @@ +/* +* Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the License); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an AS IS BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using static Interop.VoiceControl; +using static Interop.VoiceControlCommand; + +namespace Tizen.Uix.VoiceControl +{ + /// + /// Enum for Error values that can occur + /// + /// 3 + public enum Error + { + /// + /// Successful, No error + /// + None, + /// + /// Out of Memory + /// + OutOfMemory, + /// + /// I/O error + /// + IoError, + /// + /// Invalid parameter + /// + InvalidParameter, + /// + /// No answer from the STT service + /// + TimedOut, + /// + /// Device or resource busy + /// + RecorderBusy, + /// + /// Permission denied + /// + PermissionDenied, + /// + /// VC NOT supported + /// + NotSupported, + /// + /// Invalid state + /// + InvalidState, + /// + /// Invalid language + /// + InvalidLanguage, + /// + /// No available engine + /// + EngineNotFound, + /// + /// Operation failed + /// + OperationFailed, + /// + /// Operation Rejected + /// + OperationRejected, + /// + /// List reached end + /// + IterationEnd, + /// + /// List Empty + /// + Empty, + /// + /// Service reset + /// + ServiceReset, + /// + /// Progress to ready is not finished + /// + InProgressToReady, + /// + /// Progress to recording is not finished + /// + InProgressToRecording, + /// + /// Progress to processing is not finished + /// + InProgressToProcessing + }; + + /// + /// Enumeration for the client state. + /// + /// 3 + public enum State + { + /// + /// 'None' state + /// + None = 0, + /// + /// 'Initialized' state + /// + Initialized = 1, + /// + /// 'Ready' state + /// + Ready = 2, + /// + /// state cannot be determined + /// + Unavailable + }; + + /// + /// Enumerations of service state. + /// + /// 3 + public enum ServiceState + { + /// + /// 'None' state + /// + None = 0, + /// + /// 'Ready' state + /// + Ready = 1, + /// + /// 'Recording' state + /// + Recording = 2, + /// + /// 'Processing' state + /// + Processing = 3, + /// + /// state cannot be determined + /// + Unavailable + }; + + /// + /// Enumerations of result event. + /// + /// 3 + public enum ResultEvent + { + /// + /// Normal result + /// + Success = 0, + /// + /// Rejected result + /// + Rejected = 1 + }; + + /// + /// Enumerations of command type. + /// + /// 3 + public enum CommandType + { + /// + /// Foreground command by client + /// + Foreground = 1, + /// + /// Background command by client + /// + Background = 2, + /// + /// Undefined command + /// + Undefined = -1 + }; + + /// + /// A main function of Voice Control API register command and gets notification for recognition result. + /// Applications can add their own commands and be provided result when their command is recognized by user voice input. + /// + /// 3 + public static class VoiceControlClient + { + /// + /// Called when client gets the recognition result. + /// + /// 3 + /// + /// If the duplicated commands are recognized, the event(e.g. Result.Rejected) of command may be rejected + /// for selecting command as priority.If you set similar or same commands or the recognized results are multi-results, cmdList has the multi commands. + /// + /// The ResultEvent + /// Command List + /// Result + + private static event EventHandler _recognitionResult; + private static event EventHandler _stateChanged; + private static event EventHandler _serviceStateChanged; + private static event EventHandler _errorOccured; + private static event EventHandler _currentLanguageChanged; + private static VcResultCb s_resultDelegate; + private static VcStateChangedCb s_stateDelegate; + private static VcServiceStateChangedCb s_serviceStateDelegate; + private static VcErrorCb s_errorDelegate; + private static VcCurrentLanguageChangedCb s_languageDelegate; + private static List s_supportedLanguages; + private static VcSupportedLanguageCb s_supportedLanguagesCb; + private static VcResultCb s_resultCb; + private static RecognitionResult s_recognitionResult; + + /// + /// Gets current language. + /// A language is specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English. + /// Empty string is returned incase of some internal error + /// + /// 3 + /// + /// Current language in voice control. + /// + /// + /// http://tizen.org/privilege/recorder + /// + ///
+        /// The State must be Initialized or Ready.
+        /// 
+ public static string CurrentLanguage + { + get + { + string currentLanguage; + + ErrorCode error = VcGetCurrentLanguage(out currentLanguage); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "CurrentLanguage Failed with error " + error); + return ""; + } + + return currentLanguage; + } + } + + /// + /// Gets current state of voice control client. + /// + /// 3 + /// + /// Current state of voice control client. + /// + /// + /// http://tizen.org/privilege/recorder + /// + ///
+        /// The State must be Initialized or Ready.
+        /// 
+ public static State State + { + get + { + State state; + + ErrorCode error = VcGetState(out state); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "State Failed with error " + error); + return State.Unavailable; + } + + return state; + } + } + + /// + /// Gets current state of voice control service. + /// + /// 3 + /// + /// Current state of voice control service. + /// + /// + /// http://tizen.org/privilege/recorder + /// + ///
+        /// The State must be Ready.
+        /// 
+ public static ServiceState ServiceState + { + get + { + ServiceState state; + + ErrorCode error = VcGetServiceState(out state); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "ServiceState Failed with error " + error); + return ServiceState.Unavailable; + } + + return state; + } + } + + /// + /// Sets the invocation name. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// Invocation name is used to activate background commands. The invocation name can be the same as the application name or any other phrase. + /// For example, an application "Tizen Sample" has a background command, "Play music", and the invocation name of the application is set to "Tizen Sample". + /// In order to activate the background command, users can say "Tizen Sample, Play music". The invocation name is dependent on the current language. + /// For example, if the current language is "en_US"(English), the invocation name is also "en_US". + /// If the current language is "ja_JP"(Japanese) and the invocation name is "en_US", the invocation name will not be recognized. + /// This function should be called before SetCommandList(). + /// + /// Invocation name that an application wants to be invoked by + /// This Exception can be due to Invalid State. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State must be Ready.
+        /// 
+ public static void SetInvocationName(string name) + { + ErrorCode error = VcSetInvocationName(name); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetInvocationName Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Initializes voice control. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Out Of Memory. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + /// + /// The State will be Initialized. + /// + public static void Initialize() + { + ErrorCode error = VcInitialize(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Initialize Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Deinitializes voice control. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + public static void Deinitialize() + { + ErrorCode error = VcDeinitialize(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Deinitialize Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Connects the voice control service. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Initialized
+        /// 
+ /// + /// The State will be Ready + /// + public static void Prepare() + { + ErrorCode error = VcPrepare(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Prepare Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Disconnects the voice control service. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready
+        /// 
+ /// + /// The State should be Initialized + /// + public static void Unprepare() + { + ErrorCode error = VcUnprepare(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Unprepare Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Retrieves all supported languages. + /// A language is specified as an ISO 3166 alpha-2 two letter country-code + /// followed by ISO 639-1 for the two-letter language code. + /// For example, "ko_KR" for Korean, "en_US" for American English. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready or Initialized
+        /// 
+ public static IEnumerable GetSupportedLanguages() + { + s_supportedLanguages = new List(); + s_supportedLanguagesCb = (IntPtr language, IntPtr userData) => + { + string languageStr = Marshal.PtrToStringAnsi(language); + s_supportedLanguages.Add(languageStr); + return true; + }; + ErrorCode error = VcForeachSupportedLanguages(s_supportedLanguagesCb, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetSupportedLanguages Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + return s_supportedLanguages; + } + + /// + /// Gets the system command list. + /// + /// 3 + /// + /// The Command List else null in case of no System Commands + /// + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// In the system command list, there are system commands predefined by product manufacturers. + /// Those commands have the highest priority. Therefore, the user can not set any commands same with the system commands. + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Operation Failed. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready
+        /// 
+ public static VoiceCommandList GetSystemCommandList() + { + IntPtr handle = IntPtr.Zero; + ErrorCode error = VcGetSystemCommandList(out handle); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetSystemCommandList Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + if (handle == IntPtr.Zero) + { + Log.Error(LogTag, "GetSystemCommandList handle is null"); + return null; + } + + SafeCommandListHandle list = new SafeCommandListHandle(handle); + return new VoiceCommandList(list); + } + + /// + /// Requests to start the dialogue. + /// Using this function, the developer can request starting the dialogue to the framework. + /// When the developer requests the dialogue, two types of texts, dispText and uttText, can be sent by this function.dispText is a text for displaying, and uttText is that for uttering. + /// For example, if dispText is "October 10th" and uttText is "Today is October 10th.", "October 10th" will be displayed on the screen and "Today is October 10th." will be spoken. + /// Also, the developer can set whether the dialogue starts automatically or not, using autoStart. + /// If the developer sets autoStart as true, the framework will start to record next speech and continue the dialogue. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// If autoStart is true, the recognition will start again. In this case, it can be restarted up to 4 times. + /// + /// Text to be displayed on the screen/// + /// Text to be spoken + /// A variable for setting whether the dialog session will be restarted automatically or not + /// This Exception can be due to Invalid State. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready
+        /// 
+ public static void RequestDialog(string dispText, string uttText, bool autoStart) + { + ErrorCode error = VcRequestDialog(dispText, uttText, autoStart); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "RequestDialog Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + /// + /// Sets command list. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// + /// The command type is valid for CommandType 'Foreground' or 'Background'. + /// The matched commands of command list should be set and they should include type and command text at least. + /// + /// Command list + /// Command type + /// This Exception can be due to Invalid State. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready
+        /// 
+ public static void SetCommandList(VoiceCommandList list, CommandType type) + { + if ((type == CommandType.Foreground) || (type == CommandType.Background)) + { + ErrorCode error = VcSetCommandList(list._handle, (VoiceCommandType)type); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "SetCommandList Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + else + { + throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter); + } + } + + /// + /// Unsets command list. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// Command type + /// This Exception can be due to Invalid State. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Not Supported. + /// This Exception can be due to Permission Denied. + ///
+        /// The State should be Ready
+        /// 
+ public static void UnsetCommandList(CommandType type) + { + if ((type == CommandType.Foreground) || (type == CommandType.Background)) + { + VoiceCommandType commandType = VoiceCommandType.Foreground; + if (type == CommandType.Background) + commandType = VoiceCommandType.BackGround; + ErrorCode error = VcUnsetCommandList(commandType); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "UnsetCommandList Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + } + + else + { + throw ExceptionFactory.CreateException(ErrorCode.InvalidParameter); + } + } + + /// + /// Gets the recognition result. + /// + /// 3 + /// + /// http://tizen.org/privilege/recorder + /// + /// + /// public + /// + /// + /// http://tizen.org/feature/speech.control + /// http://tizen.org/feature/microphone + /// + /// This Exception can be due to Invalid State. + /// This Exception can be due to Invalid Parameter. + /// This Exception can be due to Not Supported. + /// The Recognition Result if possible else a null object + ///
+        /// The State should be Ready
+        /// 
+ public static RecognitionResult GetResult() + { + s_recognitionResult = null; + s_resultCb = (ResultEvent evt, IntPtr cmdList, IntPtr result, IntPtr userData) => + { + s_recognitionResult = new RecognitionResult(evt, cmdList, result); + }; + ErrorCode error = VcGetResult(s_resultCb, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "GetResult Failed with error " + error); + throw ExceptionFactory.CreateException(error); + } + + return s_recognitionResult; + } + + /// + /// Event to be invoked when the recognition is done. + /// + /// 3 + ///
+        /// The State should be Initialized
+        /// 
+ public static event EventHandler RecognitionResult + { + add + { + s_resultDelegate = (ResultEvent evt, IntPtr cmdList, IntPtr result, IntPtr userData) => + { + Log.Info(LogTag, "Recognition Result Event Triggered"); + if ((cmdList != null) && (result != null)) + { + RecognitionResultEventArgs args = new RecognitionResultEventArgs(new RecognitionResult( evt, cmdList, result)); + _recognitionResult?.Invoke(null, args); + } + else + { + Log.Info(LogTag, "Recognition Result Event null received"); + } + }; + ErrorCode error = VcSetResultCb(s_resultDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add RecognitionResult Failed with error " + error); + } + else + { + _recognitionResult += value; + } + } + + remove + { + ErrorCode error = VcUnsetResultCb(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove RecognitionResult Failed with error " + error); + } + + _recognitionResult -= value; + } + } + + /// + /// Event to be invoked when VoiceControl service state changes. + /// + /// 3 + ///
+        /// The State should be Initialized
+        /// 
+ public static event EventHandler ServiceStateChanged + { + add + { + s_serviceStateDelegate = (ServiceState previous, ServiceState current, IntPtr userData) => + { + ServiceStateChangedEventArgs args = new ServiceStateChangedEventArgs(previous, current); + _serviceStateChanged?.Invoke(null, args); + }; + ErrorCode error = VcSetServiceStateChangedCb(s_serviceStateDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add ServiceStateChanged Failed with error " + error); + } + else + { + _serviceStateChanged += value; + } + } + + remove + { + ErrorCode error = VcUnsetServiceStateChangedCb(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove ServiceStateChanged Failed with error " + error); + } + + _serviceStateChanged -= value; + } + } + + /// + /// Event to be invoked when VoiceControl client state changes. + /// + /// 3 + ///
+        /// The State should be Initialized
+        /// 
+ public static event EventHandler StateChanged + { + add + { + s_stateDelegate = (State previous, State current, IntPtr userData) => + { + StateChangedEventArgs args = new StateChangedEventArgs(previous, current); + _stateChanged?.Invoke(null, args); + }; + ErrorCode error = VcSetStateChangedCb(s_stateDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add StateChanged Failed with error " + error); + } + else + { + _stateChanged += value; + } + } + + remove + { + ErrorCode error = VcUnsetStateChangedCb(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove StateChanged Failed with error " + error); + } + + _stateChanged -= value; + } + } + + /// + /// Event to be invoked when an error occurs. + /// + /// 3 + ///
+        /// The State should be Initialized
+        /// 
+ public static event EventHandler ErrorOccured + { + add + { + s_errorDelegate = (ErrorCode reason, IntPtr userData) => + { + ErrorOccuredEventArgs args = new ErrorOccuredEventArgs(reason); + _errorOccured?.Invoke(null, args); + }; + ErrorCode error = VcSetErrorCb(s_errorDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add ErrorOccured Failed with error " + error); + } + + else + { + _errorOccured += value; + } + } + + + remove + { + ErrorCode error = VcUnsetErrorCb(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove ErrorOccured Failed with error " + error); + } + + _errorOccured -= value; + } + } + + /// + /// Event to be invoked when default laungage change. + /// + /// 3 + ///
+        /// The State should be Initialized
+        /// 
+ public static event EventHandler CurrentLanguageChanged + { + add + { + s_languageDelegate = (IntPtr previousLanguage, IntPtr currentLanguage, IntPtr userData) => + { + string previousLanguageString = Marshal.PtrToStringAnsi(previousLanguage); + string currentLanguageString = Marshal.PtrToStringAnsi(currentLanguage); + CurrentLanguageChangedEventArgs args = new CurrentLanguageChangedEventArgs(previousLanguageString, currentLanguageString); + _currentLanguageChanged?.Invoke(null, args); + }; + ErrorCode error = VcSetCurrentLanguageChangedCb(s_languageDelegate, IntPtr.Zero); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Add CurrentLanguageChanged Failed with error " + error); + } + + else + { + _currentLanguageChanged += value; + } + } + + remove + { + ErrorCode error = VcUnsetCurrentLanguageChangedCb(); + if (error != ErrorCode.None) + { + Log.Error(LogTag, "Remove CurrentLanguageChanged Failed with error " + error); + } + + _currentLanguageChanged -= value; + } + } + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Context.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Context.cs new file mode 100644 index 0000000..7930e1c --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Context.cs @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + public enum CacheModel + { + DocumentViewer, + DocumentBrowser, + PrimaryWebBrowser + } + + [DllImport(Libraries.ChromiumEwk)] + internal static extern IntPtr ewk_context_cookie_manager_get(IntPtr context); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_context_cache_model_set(IntPtr context, CacheModel model); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern CacheModel ewk_context_cache_model_get(IntPtr context); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.CookieManager.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.CookieManager.cs new file mode 100644 index 0000000..23fb70e --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.CookieManager.cs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + public enum CookieAcceptPolicy + { + Always, + Never, + NoThirdParty + } + + public enum CookiePersistentStorage + { + Text, + SqlLite + } + + [DllImport(Libraries.ChromiumEwk)] + internal static extern void ewk_cookie_manager_accept_policy_set(IntPtr manager, CookieAcceptPolicy policy); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern void ewk_cookie_manager_cookies_clear(IntPtr manager); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern void ewk_cookie_manager_persistent_storage_set(IntPtr manager, string path, CookiePersistentStorage storage); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Error.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Error.cs new file mode 100644 index 0000000..7d22a3d --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Error.cs @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_error_url_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_error_url_get(IntPtr error); + + internal static string ewk_error_url_get(IntPtr error) + { + IntPtr ptr = _ewk_error_url_get(error); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk)] + internal static extern int ewk_error_code_get(IntPtr error); + + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_error_description_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_error_description_get(IntPtr error); + + internal static string ewk_error_description_get(IntPtr error) + { + IntPtr ptr = _ewk_error_description_get(error); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_error_cancellation_get(IntPtr error); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Settings.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Settings.cs new file mode 100644 index 0000000..ab7a5ef --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.Settings.cs @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_javascript_enabled_set(IntPtr settings, bool enable); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_javascript_enabled_get(IntPtr settings); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_loads_images_automatically_set(IntPtr settings, bool enable); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_loads_images_automatically_get(IntPtr settings); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_default_text_encoding_name_set(IntPtr settings, string encoding); + + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_settings_default_text_encoding_name_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_settings_default_text_encoding_name_get(IntPtr settings); + + internal static string ewk_settings_default_text_encoding_name_get(IntPtr settings) + { + IntPtr ptr = _ewk_settings_default_text_encoding_name_get(settings); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_settings_default_font_size_set(IntPtr settings, int size); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern int ewk_settings_default_font_size_get(IntPtr settings); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.View.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.View.cs new file mode 100644 index 0000000..0f8a17c --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.View.cs @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + [DllImport(Libraries.ChromiumEwk)] + internal static extern IntPtr ewk_view_add(IntPtr evas); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern IntPtr ewk_view_context_get(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern IntPtr ewk_view_settings_get(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_url_set(IntPtr obj, string url); + + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_view_url_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_view_url_get(IntPtr obj); + + internal static string ewk_view_url_get(IntPtr obj) + { + IntPtr ptr = _ewk_view_url_get(obj); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_html_string_load(IntPtr obj, string html, string baseUrl, string unreachableUrl); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_reload(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_stop(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_back(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_forward(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_back_possible(IntPtr obj); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_forward_possible(IntPtr obj); + + internal delegate void ScriptExcuteCallback(IntPtr obj, IntPtr resultValue, IntPtr userData); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_script_execute(IntPtr obj, string script, ScriptExcuteCallback callback, IntPtr userData); + + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_view_title_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_view_title_get(IntPtr obj); + + internal static string ewk_view_title_get(IntPtr obj) + { + IntPtr ptr = _ewk_view_url_get(obj); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk, EntryPoint = "ewk_view_user_agent_get", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true, CharSet = CharSet.Ansi)] + internal static extern IntPtr _ewk_view_user_agent_get(IntPtr obj); + + internal static string ewk_view_user_agent_get(IntPtr obj) + { + IntPtr ptr = _ewk_view_user_agent_get(obj); + return Marshal.PtrToStringAnsi(ptr); + } + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_user_agent_set(IntPtr obj, string userAgent); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_focus_set(IntPtr obj, bool focused); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_focus_get(IntPtr obj); + + [StructLayout(LayoutKind.Sequential, CharSet =CharSet.Ansi)] + internal struct ScriptMessage + { + public IntPtr name; + public IntPtr body; + } + + internal delegate void ScriptMessageCallback(IntPtr obj, ScriptMessage message); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_javascript_message_handler_add(IntPtr obj, ScriptMessageCallback callback, string name); + + [DllImport(Libraries.ChromiumEwk)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool ewk_view_evaluate_javascript(IntPtr obj, string name, string result); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.ChromiumEwk.cs b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.cs new file mode 100644 index 0000000..cd9ca31 --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.ChromiumEwk.cs @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class ChromiumEwk + { + [DllImport(Libraries.ChromiumEwk)] + internal static extern int ewk_init(); + + [DllImport(Libraries.ChromiumEwk)] + internal static extern int ewk_shutdown(); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.Elementary.cs b/src/Tizen.WebView/Interop/Interop.Elementary.cs new file mode 100644 index 0000000..e981fe2 --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.Elementary.cs @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Elementary + { + [DllImport(Libraries.Elementary)] + internal static extern IntPtr elm_layout_add(IntPtr obj); + + [DllImport(Libraries.Elementary)] + [return: MarshalAs(UnmanagedType.U1)] + internal static extern bool elm_layout_theme_set(IntPtr obj, string klass, string group, string style); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_part_content_set(IntPtr obj, string part, IntPtr content); + + [DllImport(Libraries.Elementary)] + internal static extern void elm_object_focus_allow_set(IntPtr obj, bool enable); + } +} \ No newline at end of file diff --git a/src/Tizen.WebView/Interop/Interop.Evas.cs b/src/Tizen.WebView/Interop/Interop.Evas.cs new file mode 100644 index 0000000..52eef2c --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.Evas.cs @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Evas + { + [DllImport(Libraries.Evas)] + internal static extern IntPtr evas_object_evas_get(IntPtr obj); + } +} diff --git a/src/Tizen.WebView/Interop/Interop.Libraries.cs b/src/Tizen.WebView/Interop/Interop.Libraries.cs new file mode 100644 index 0000000..7dab1c4 --- /dev/null +++ b/src/Tizen.WebView/Interop/Interop.Libraries.cs @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +internal static partial class Interop +{ + private static class Libraries + { + internal const string ChromiumEwk = "libchromium-ewk.so"; + internal const string Elementary = "libelementary.so.1"; + internal const string Evas = "libevas.so.1"; + } +} diff --git a/src/Tizen.WebView/Tizen.WebView.csproj b/src/Tizen.WebView/Tizen.WebView.csproj new file mode 100644 index 0000000..6d55012 --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView.csproj @@ -0,0 +1,13 @@ + + + + + netstandard1.6 + + + + + + + + \ No newline at end of file diff --git a/src/Tizen.WebView/Tizen.WebView.sln b/src/Tizen.WebView/Tizen.WebView.sln new file mode 100755 index 0000000..d4a4aad --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView.sln @@ -0,0 +1,28 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.WebView", "Tizen.WebView.csproj", "{8A77A6CA-543D-48CB-BBD8-1706EC47D57A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElmSharp", "..\ElmSharp\ElmSharp.csproj", "{2F66C9E2-BE24-4096-96DA-F86CCFBBB059}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8A77A6CA-543D-48CB-BBD8-1706EC47D57A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A77A6CA-543D-48CB-BBD8-1706EC47D57A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A77A6CA-543D-48CB-BBD8-1706EC47D57A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A77A6CA-543D-48CB-BBD8-1706EC47D57A}.Release|Any CPU.Build.0 = Release|Any CPU + {2F66C9E2-BE24-4096-96DA-F86CCFBBB059}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2F66C9E2-BE24-4096-96DA-F86CCFBBB059}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2F66C9E2-BE24-4096-96DA-F86CCFBBB059}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2F66C9E2-BE24-4096-96DA-F86CCFBBB059}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/Tizen.WebView/Tizen.WebView/Chromium.cs b/src/Tizen.WebView/Tizen.WebView/Chromium.cs new file mode 100644 index 0000000..8511dcd --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/Chromium.cs @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.WebView +{ + public static class Chromium + { + /// + /// Initializes Chromium's instance + /// + /// A reference count of Chromium's instance + public static int Initialize() + { + return Interop.ChromiumEwk.ewk_init(); + } + + /// + /// Decreases a reference count of WebKit's instance, possibly destroying it + /// + /// A reference count of Chromium's instance + public static int Shutdown() + { + return Interop.ChromiumEwk.ewk_shutdown(); + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/Context.cs b/src/Tizen.WebView/Tizen.WebView/Context.cs new file mode 100644 index 0000000..6e58cad --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/Context.cs @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.WebView +{ + /// + /// Enumeration that contains option for cache model. + /// + public enum CacheModel + { + DocumentViewer, /* Use the smallest cache capacity */ + DocumentBrowser, /* Use bigger cache capacity than DocumentBrowser */ + PrimaryWebBrowser /* Use the biggest cache capacity. */ + } + + public class Context + { + private IntPtr _handle; + private CookieManager _cookieManager; + + internal Context(IntPtr handle) + { + _handle = handle; + } + + /// + /// The cache model. + /// + /// + /// The default cache model is DocumentViewer. + /// + public CacheModel CacheModel + { + get + { + return (CacheModel)Interop.ChromiumEwk.ewk_context_cache_model_get(_handle); + } + + set + { + Interop.ChromiumEwk.ewk_context_cache_model_set(_handle, (Interop.ChromiumEwk.CacheModel)value); + } + } + + /// + /// Gets the CookieManager object for this context. + /// + /// The CookieManager object + public CookieManager GetCookieManager() + { + if (_cookieManager == null) + { + IntPtr cookieManagerHandle = Interop.ChromiumEwk.ewk_context_cookie_manager_get(_handle); + if (cookieManagerHandle == IntPtr.Zero) + { + return null; + } + _cookieManager = new CookieManager(cookieManagerHandle); + } + return _cookieManager; + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/CookieManager.cs b/src/Tizen.WebView/Tizen.WebView/CookieManager.cs new file mode 100644 index 0000000..487e88b --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/CookieManager.cs @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +using System; + +namespace Tizen.WebView +{ + /// + /// Enumeration that contains accept policies for the cookies. + /// + public enum CookieAcceptPolicy + { + Always, /* Accepts every cookie sent from any page */ + Never, /* Rejects all cookies */ + NoThirdParty /* Accepts only cookies set by the main document loaded */ + } + + /// + /// Enumeration that creates a type name for the storage of persistent cookies. + /// + public enum CookiePersistentStorage + { + Text, /* Cookies are stored in a text file in the Mozilla "cookies.txt" format */ + SqlLite /* Cookies are stored in a SQLite file in the current Mozilla format. */ + } + + public class CookieManager + { + private IntPtr _handle; + + internal CookieManager(IntPtr handle) + { + _handle = handle; + } + + /// + /// Sets the cookie acceptance policy. + /// + /// + /// By default, only cookies set by the main document loaded are accepted. + /// + /// The cookie acceptance policy + public void SetCookieAcceptPolicy(CookieAcceptPolicy policy) + { + Interop.ChromiumEwk.ewk_cookie_manager_accept_policy_set(_handle, (Interop.ChromiumEwk.CookieAcceptPolicy)policy); + } + + /// + /// Deletes all the cookies. + /// + public void ClearCookies() + { + Interop.ChromiumEwk.ewk_cookie_manager_cookies_clear(_handle); + } + + /// + /// Sets the storage where non-session cookies are stored persistently to read/write the cookies. + /// + /// + /// http://tizen.org/privilege/mediastorage + /// http://tizen.org/privilege/externalstorage + /// + /// The path where to read/write Cookies + /// The type of storage + public void SetPersistentStorage(string path, CookiePersistentStorage storage) + { + Interop.ChromiumEwk.ewk_cookie_manager_persistent_storage_set(_handle, path, (Interop.ChromiumEwk.CookiePersistentStorage)storage); + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/JavaScriptMessage.cs b/src/Tizen.WebView/Tizen.WebView/JavaScriptMessage.cs new file mode 100644 index 0000000..07454ed --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/JavaScriptMessage.cs @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; +using System.Text; + +namespace Tizen.WebView +{ + public delegate void JavaScriptMessageHandler(JavaScriptMessage message); + + /// + /// A Script message contains information that sent from JavaScript runtime. + /// + public class JavaScriptMessage + { + private string _name; + private IntPtr _body; + + internal JavaScriptMessage(Interop.ChromiumEwk.ScriptMessage message) + { + _name = Marshal.PtrToStringAnsi(message.name); + _body = message.body; + } + + /// + /// Obect name in JavaScript. + /// + public string Name + { + get + { + return _name; + } + } + + /// + /// Gets the value of body as integer type. + /// + /// The value of body as integer type + public int GetBodyAsInteger() + { + if (_body == IntPtr.Zero) + { + return 0; + } + return Marshal.ReadInt32(_body, 0); + } + + /// + /// Gets the value of body as double type. + /// + /// The value of body as double type + public double GetBodyAsDouble() + { + if (_body == IntPtr.Zero) + { + return 0d; + } + double[] ret = new double[1] ; + Marshal.Copy(_body, ret, 0, 1); + return ret[0]; + } + + /// + /// Gets the value of body as boolean type. + /// + /// The value of body as boolean type + public bool GetBodyAsBoolean() + { + if (_body == IntPtr.Zero) + { + return false; + } + return Marshal.ReadByte(_body) != (byte)0; + } + + /// + /// Gets the value of body as string type. + /// + /// The value of body as string type + public string GetBodyAsString() + { + if (_body == IntPtr.Zero) + { + return string.Empty; + } + return Marshal.PtrToStringAnsi(_body); + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/Settings.cs b/src/Tizen.WebView/Tizen.WebView/Settings.cs new file mode 100644 index 0000000..8e1f349 --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/Settings.cs @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.WebView +{ + public class Settings + { + private IntPtr _handle; + + internal Settings(IntPtr handle) + { + _handle = handle; + } + + /// + /// Whether JavaScript can be executable. + /// + public bool JavaScriptEnabled + { + get + { + return Interop.ChromiumEwk.ewk_settings_javascript_enabled_get(_handle); + } + + set + { + Interop.ChromiumEwk.ewk_settings_javascript_enabled_set(_handle, value); + } + } + + /// + /// Whether images can be loaded automatically. + /// + public bool LoadImageAutomatically + { + get + { + return Interop.ChromiumEwk.ewk_settings_loads_images_automatically_get(_handle); + } + + set + { + Interop.ChromiumEwk.ewk_settings_loads_images_automatically_set(_handle, value); + } + } + + /// + /// The default text encoding name. + /// + public string DefaultTextEncodingName + { + get + { + return Interop.ChromiumEwk.ewk_settings_default_text_encoding_name_get(_handle); + } + + set + { + Interop.ChromiumEwk.ewk_settings_default_text_encoding_name_set(_handle, value); + } + } + + /// + /// The default font size of a pixel. + /// + public int DefaultFontSize + { + get + { + return Interop.ChromiumEwk.ewk_settings_default_font_size_get(_handle); + } + + set + { + Interop.ChromiumEwk.ewk_settings_default_font_size_set(_handle, value); + } + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/SmartCallbackArgs.cs b/src/Tizen.WebView/Tizen.WebView/SmartCallbackArgs.cs new file mode 100644 index 0000000..9e0f01d --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/SmartCallbackArgs.cs @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.WebView +{ + /// + /// Argument from the SmartCallback. + /// + public class SmartCallbackArgs : EventArgs + { + private IntPtr _arg; + + internal SmartCallbackArgs(IntPtr arg) + { + _arg = arg; + } + + /// + /// Gets argument as integer type. + /// + /// Argument as integer type + public int GetAsInteger() + { + if (_arg == IntPtr.Zero) + { + return 0; + } + return Marshal.ReadInt32(_arg, 0); + } + + /// + /// Gets argument as double type. + /// + /// Argument as double type + public double GetAsDouble() + { + if (_arg == IntPtr.Zero) + { + return 0d; + } + double[] ret = new double[1]; + Marshal.Copy(_arg, ret, 0, 1); + return ret[0]; + } + + /// + /// Gets argument as boolean type. + /// + /// Argument as boolean type + public bool GetAsBoolean() + { + if (_arg == IntPtr.Zero) + { + return false; + } + return Marshal.ReadByte(_arg) != (byte)0; + } + + /// + /// Gets argument as string type. + /// + /// Argument as string type + public string GetAsString() + { + if (_arg == IntPtr.Zero) + { + return string.Empty; + } + return Marshal.PtrToStringAnsi(_arg); + } + + internal static SmartCallbackArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + return new SmartCallbackArgs(info); + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/SmartCallbackLoadErrorArgs.cs b/src/Tizen.WebView/Tizen.WebView/SmartCallbackLoadErrorArgs.cs new file mode 100644 index 0000000..8aa6704 --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/SmartCallbackLoadErrorArgs.cs @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.WebView +{ + /// + /// Enumeration that provides an option to error codes. + /// + public enum LoadErrorCode + { + /// + /// Unknown + /// + Unknown = 0, + /// + /// User canceled + /// + Canceled, + /// + /// Can't show page for this MIME Type + /// + CantSupportMimetype, + /// + /// File IO error + /// + FailedFileIo, + /// + /// Cannot connect to network + /// + CantConnect, + /// + /// Fail to look up host from DNS + /// + CantLookupHost, + /// + /// Fail to SSL/TLS handshake + /// + FailedTlsHandshake, + /// + /// Received certificate is invalid + /// + InvalidCertificate, + /// + /// Connection timeout + /// + RequestTimeout, + /// + /// Too many redirects + /// + TooManyRedirects, + /// + /// Too many requests during this load + /// + TooManyRequests, + /// + /// Malformed url + /// + BadUrl, + /// + /// Unsupported scheme + /// + UnsupportedScheme, + /// + /// User authentication failed on server + /// + Authentication, + /// + /// Web server has internal server error + /// + InternalServer, + } + + /// + /// Argument from the LoadError SmartCallback. + /// + public class SmartCallbackLoadErrorArgs : EventArgs + { + IntPtr _handle; + + internal SmartCallbackLoadErrorArgs(IntPtr handle) + { + _handle = handle; + } + + /// + /// Failing URL for the error. + /// + public string Url + { + get + { + return Interop.ChromiumEwk.ewk_error_url_get(_handle); + } + } + + /// + /// The error code. + /// + public LoadErrorCode Code + { + get + { + return (LoadErrorCode)Interop.ChromiumEwk.ewk_error_code_get(_handle); + } + } + + /// + /// The description for the error. + /// + public string Description + { + get + { + return Interop.ChromiumEwk.ewk_error_description_get(_handle); + } + } + + /// + /// Whether the error should be treated as a cancellation. + /// + public bool Cancellation + { + get + { + return Interop.ChromiumEwk.ewk_error_cancellation_get(_handle); + } + } + + internal static SmartCallbackLoadErrorArgs CreateFromSmartEvent(IntPtr data, IntPtr obj, IntPtr info) + { + return new SmartCallbackLoadErrorArgs(info); + } + } +} diff --git a/src/Tizen.WebView/Tizen.WebView/WebView.cs b/src/Tizen.WebView/Tizen.WebView/WebView.cs new file mode 100644 index 0000000..3b30cd8 --- /dev/null +++ b/src/Tizen.WebView/Tizen.WebView/WebView.cs @@ -0,0 +1,342 @@ +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using ElmSharp; +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Tizen.WebView +{ + /// + /// A view used to render web contents. + /// + public class WebView: EvasObject + { + private static IDictionary _javaScriptMessageHandlerMap = new Dictionary(); + + private IntPtr _handle; + private IntPtr _realHandle; + private Context _context; + private Settings _settings; + + // focus dummy + private SmartEvent _focusIn; + private SmartEvent _focusOut; + + // Smart events + private SmartEvent _loadStarted; + private SmartEvent _loadFinished; + private SmartEvent _loadError; + private SmartEvent _titleChanged; + private SmartEvent _urlChanged; + + + + /// + /// Event that occurs when load started. + /// + public event EventHandler LoadStarted; + + /// + /// Event that occurs when load finished. + /// + public event EventHandler LoadFinished; + + /// + /// Event that occurs when load error. + /// + public event EventHandler LoadError; + + /// + /// Event that occurs when title of main frame was changed. + /// + public event EventHandler TitleChanged; + + /// + /// Event that occurs when URL of main frame was changed. + /// + public event EventHandler UrlChanged; + + /// + /// Current URL of the main frame. + /// + public string Url + { + get + { + return Interop.ChromiumEwk.ewk_view_url_get(_realHandle); + } + } + + /// + /// Current title of the main frame. + /// + public string Title + { + get + { + return Interop.ChromiumEwk.ewk_view_title_get(_realHandle); + } + } + + /// + /// Current user agent string of this view. + /// + public string UserAgent + { + get + { + return Interop.ChromiumEwk.ewk_view_user_agent_get(_realHandle); + } + + set + { + Interop.ChromiumEwk.ewk_view_user_agent_set(_realHandle, value); + } + } + + /// + /// Whether a view has the focus. + /// + public bool HasFocus + { + get + { + return Interop.ChromiumEwk.ewk_view_focus_get(_realHandle); + } + } + + /// + /// Create a WebView object. + /// + /// Parent object of WebView + public WebView(EvasObject parent) : base(parent) + { + InitializeSmartEvent(); + } + + /// + /// Gets the Context object of this view. + /// + /// The Context object of this view + public Context GetContext() + { + if (_context == null) + { + IntPtr contextHandle = Interop.ChromiumEwk.ewk_view_context_get(_realHandle); + if (contextHandle == IntPtr.Zero) + { + return null; + } + _context = new Context(contextHandle); + } + return _context; + } + + /// + /// Gets the Settings object of this view. + /// + /// The Settings object of this view + public Settings GetSettings() + { + if (_settings == null) + { + IntPtr settingsHandle = Interop.ChromiumEwk.ewk_view_settings_get(_realHandle); + if (settingsHandle == IntPtr.Zero) + { + return null; + } + _settings = new Settings(settingsHandle); + } + return _settings; + } + + /// + /// Asks the object to load the given URL. + /// + /// + /// You can only be sure that url changed after UrlChanged event. + /// + /// The uniform resource identifier to load + public void LoadUrl(string url) + { + Interop.ChromiumEwk.ewk_view_url_set(_realHandle, url); + } + + /// + /// Loads the specified html string as the content of the view. + /// + /// HTML data to load + /// Base URL used for relative paths to external objects + public void LoadHtml(string html, string baseUrl) + { + Interop.ChromiumEwk.ewk_view_html_string_load(_realHandle, html, baseUrl, null); + } + + /// + /// Asks the main frame to stop loading. + /// + public void StopLoading() + { + Interop.ChromiumEwk.ewk_view_stop(_realHandle); + } + + /// + /// Asks the main frame to reload the current document. + /// + public void Reload() + { + Interop.ChromiumEwk.ewk_view_reload(_realHandle); + } + + /// + /// Asks the main frame to navigate back in history. + /// + public void GoBack() + { + Interop.ChromiumEwk.ewk_view_back(_realHandle); + } + + /// + /// Asks the main frame to navigate forward in history. + /// + public void GoForward() + { + Interop.ChromiumEwk.ewk_view_forward(_realHandle); + } + + /// + /// Checks whether it is possible to navigate backwards one item in history. + /// + /// Whether it is possible to navigate backwards one item in history + public bool CanGoBack() + { + return Interop.ChromiumEwk.ewk_view_back_possible(_realHandle); + } + + /// + /// Checks whether it is possible to navigate forwards one item in history. + /// + /// Whether it is possible to navigate forwards one item in history + public bool CanGoForward() + { + return Interop.ChromiumEwk.ewk_view_forward_possible(_realHandle); + } + + /// + /// Injects the supplied javascript message handler into the view. + /// + /// The message callback + /// The name used to expose the object in JavaScript + /// 'true' on success, otherwise 'false' + public bool AddJavaScriptMessageHandler(string name, JavaScriptMessageHandler handler) + { + lock (_javaScriptMessageHandlerMap) + { + if (_javaScriptMessageHandlerMap.ContainsKey(name)) + { + return false; + } + _javaScriptMessageHandlerMap[name] = handler; + } + Interop.ChromiumEwk.ScriptMessageCallback callback = (handle, message) => + { + JavaScriptMessage convertedMessage = new JavaScriptMessage(message); + lock (_javaScriptMessageHandlerMap) + { + if (_javaScriptMessageHandlerMap.ContainsKey(convertedMessage.Name)) + { + _javaScriptMessageHandlerMap[convertedMessage.Name](convertedMessage); + } + } + }; + if (!Interop.ChromiumEwk.ewk_view_javascript_message_handler_add(_realHandle, callback, name)) + { + lock (_javaScriptMessageHandlerMap) + { + _javaScriptMessageHandlerMap.Remove(name); + return false; + } + } + return true; + } + + /// + /// Requests the execution of given name and result to the JavaScript runtime. + /// + /// The name used to expose the object in JavaScript + /// The result to the JavaScript runtime + public void EvalWithResult(string name, string result) + { + Interop.ChromiumEwk.ewk_view_evaluate_javascript(_realHandle, name, result); + } + + /// + /// Requests the execution of the given script. + /// + /// The JavaScript code string to execute + public void Eval(string script) + { + Interop.ChromiumEwk.ewk_view_script_execute(_realHandle, script, null, IntPtr.Zero); + } + + /// + /// Requests to set or unset a view as the currently focused one. + /// + /// 'true' to set the focus on the view, 'false' to remove the focus from the view + public void SetFocus(bool focused) + { + Interop.ChromiumEwk.ewk_view_focus_set(_realHandle, focused); + } + + protected override IntPtr CreateHandle(EvasObject parent) + { + // focus dummy + _handle = Interop.Elementary.elm_layout_add((IntPtr)parent); + Interop.Elementary.elm_layout_theme_set(_handle, "layout", "elm_widget", "default"); + Interop.Elementary.elm_object_focus_allow_set(_handle, true); + + IntPtr evas = Interop.Evas.evas_object_evas_get(parent); + _realHandle = Interop.ChromiumEwk.ewk_view_add(evas); + Interop.Elementary.elm_object_part_content_set(_handle, "elm.swallow.content", _realHandle); + + return _handle; + } + + private void InitializeSmartEvent() + { + // focus dummy + _focusIn = new SmartEvent(this, "focused"); + _focusOut = new SmartEvent(this, "unfocused"); + + _focusIn.On += (s, e) => { ((WebView)s).SetFocus(true); }; + _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); }; + + _loadStarted = new SmartEvent(this, _realHandle, "load,started"); + _loadFinished = new SmartEvent(this, _realHandle, "load,finished"); + _loadError = new SmartEvent(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent); + _titleChanged = new SmartEvent(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent); + _urlChanged = new SmartEvent(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent); + + _loadStarted.On += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); }; + _loadFinished.On += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); }; + _loadError.On += (s, e) => { LoadError?.Invoke(this, e); }; + _titleChanged.On += (s, e) => { TitleChanged?.Invoke(this, e); }; + _urlChanged.On += (s, e) => { UrlChanged?.Invoke(this, e); }; + } + } +} diff --git a/src/Tizen/Interop/Interop.CommonError.cs b/src/Tizen/Interop/Interop.CommonError.cs new file mode 100644 index 0000000..284ba22 --- /dev/null +++ b/src/Tizen/Interop/Interop.CommonError.cs @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Base = "libcapi-base-common.so.0"; + } + + internal static partial class CommonError + { + [DllImport(Libraries.Base, EntryPoint = "get_last_result")] + internal static extern int GetLastResult(); + + [DllImport(Libraries.Base, EntryPoint = "get_error_message")] + internal static extern IntPtr GetErrorMessage(int errorCode); + } +} diff --git a/src/Tizen/Interop/Interop.Dlog.cs b/src/Tizen/Interop/Interop.Dlog.cs new file mode 100644 index 0000000..697daa1 --- /dev/null +++ b/src/Tizen/Interop/Interop.Dlog.cs @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.InteropServices; + +internal static partial class Interop +{ + internal static partial class Libraries + { + public const string Dlog = "libdlog.so.0"; + } + + internal static partial class Dlog + { + internal enum LogPriority + { + DLOG_UNKNOWN = 0, + DLOG_DEFAULT, + DLOG_VERBOSE, + DLOG_DEBUG, + DLOG_INFO, + DLOG_WARN, + DLOG_ERROR, + DLOG_FATAL, + DLOG_SILENT, + DLOG_PRIO_MAX, + } + [DllImportAttribute(Libraries.Dlog, EntryPoint = "dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Print(LogPriority prio, string tag, string fmt, string msg); + + [DllImportAttribute(Libraries.Dlog, EntryPoint = "dlog_print", CallingConvention = CallingConvention.Cdecl)] + internal static extern int Print(LogPriority prio, string tag, string fmt, string file, string func, int line, string msg); + } +} + diff --git a/src/Tizen/Tizen.Common/Color.cs b/src/Tizen/Tizen.Common/Color.cs new file mode 100644 index 0000000..53224ae --- /dev/null +++ b/src/Tizen/Tizen.Common/Color.cs @@ -0,0 +1,349 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; + +namespace Tizen.Common +{ + /// + /// Structure that represents a color as RGBA. + /// + public struct Color : IEquatable + { + /// + /// Empty color instance. All components are 0. + /// + public static readonly Color Empty = FromRgba(0, 0, 0, 0); + + /// + /// Transparent color instance. All components are 0. + /// + public static readonly Color Transparent = FromRgba(0, 0, 0, 0); + + /// + /// Aqua color instance. Its RGB value is (0, 255, 255). + /// + public static readonly Color Aqua = FromRgb(0, 255, 255); + + /// + /// Black color instance. Its RGB value is (0, 0, 0). + /// + public static readonly Color Black = FromRgb(0, 0, 0); + + /// + /// Blue color instance. Its RGB value is (0, 0, 255). + /// + public static readonly Color Blue = FromRgb(0, 0, 255); + + /// + /// Fuchsia color instance. Its RGB value is (255, 0, 255). + /// + public static readonly Color Fuchsia = FromRgb(255, 0, 255); + + /// + /// Gray color instance. Its RGB value is (128, 128, 128). + /// + public static readonly Color Gray = FromRgb(128, 128, 128); + + /// + /// Green color instance. Its RGB value is (0, 128, 0). + /// + public static readonly Color Green = FromRgb(0, 128, 0); + + /// + /// Lime color instance. Its RGB value is (0, 255, 0). + /// + public static readonly Color Lime = FromRgb(0, 255, 0); + + /// + /// Maroon color instance. Its RGB value is (128, 0, 0). + /// + public static readonly Color Maroon = FromRgb(128, 0, 0); + + /// + /// Navy color instance. Its RGB value is (0, 0, 128). + /// + public static readonly Color Navy = FromRgb(0, 0, 128); + + /// + /// Olive color instance. Its RGB value is (128, 128, 0). + /// + public static readonly Color Olive = FromRgb(128, 128, 0); + + /// + /// Purple color instance. Its RGB value is (128, 0, 128). + /// + public static readonly Color Purple = FromRgb(128, 0, 128); + + /// + /// Pink color instance. Its RGB value is (255, 102, 255). + /// + public static readonly Color Pink = FromRgb(255, 102, 255); + + /// + /// Red color instance. Its RGB value is (255, 0, 0). + /// + public static readonly Color Red = FromRgb(255, 0, 0); + + /// + /// Silver color instance. Its RGB value is (192, 192, 192). + /// + public static readonly Color Silver = FromRgb(192, 192, 192); + + /// + /// Teal color instance. Its RGB value is (0, 128, 128). + /// + public static readonly Color Teal = FromRgb(0, 128, 128); + + /// + /// White color instance. Its RGB value is (255, 255, 255). + /// + public static readonly Color White = FromRgb(255, 255, 255); + + /// + /// Yellow color instance. Its RGB value is (255, 255, 0). + /// + public static readonly Color Yellow = FromRgb(255, 255, 0); + + private int _value; + + /// + /// Initiates new Color with r,g,b,a components. + /// + /// Red (0 ~ 255) + /// Green (0 ~ 255) + /// Blue (0 ~ 255) + /// Alpha (0 ~ 255) + public Color(int r, int g, int b, int a) + { + if (r > 255 || r < 0) + throw CreateColorArgumentException(r, "red"); + if (g > 255 || g < 0) + throw CreateColorArgumentException(g, "green"); + if (b > 255 || b < 0) + throw CreateColorArgumentException(b, "blue"); + if (a > 255 || a < 0) + throw CreateColorArgumentException(a, "alpha"); + + _value = (int)(((uint)r << 24) + ((uint)g << 16) + ((uint)b << 8) + (uint)a); + } + + /// + /// Initiates new Color with r,g,b components. The alpha value will be 255 as default. + /// + /// Red (0 ~ 255) + /// Green (0 ~ 255) + /// Blue (0 ~ 255) + public Color(int r, int g, int b) : this(r, g, b, 255) + { + } + + #region Properties + + /// + /// Gets the Red component of the color. + /// + public int R + { + get { return (byte)(_value >> 24); } + } + + /// + /// Gets the Green component of the color. + /// + public int G + { + get { return (byte)(_value >> 16); } + } + + /// + /// Gets the blue component of the color. + /// + public int B + { + get { return (byte)(_value >> 8); } + } + + /// + /// Gets the alpha component of the color. + /// + public int A + { + get { return (byte)_value; } + } + + #endregion // Properties + + #region Static Methods + + /// + /// Returns a boolean indicating whether the two given Colors are equal. + /// + /// The first Color to compare. + /// The second Color to compare. + /// True if the Colors are equal; False otherwise. + public static bool operator ==(Color color1, Color color2) + { + return color1.Equals(color2); + } + + /// + /// Returns a boolean indicating whether the two given Colors are not equal. + /// + /// The first Color to compare. + /// The second Color to compare. + /// True if the Colors are not equal; False if they are equal. + public static bool operator !=(Color color1, Color color2) + { + return !color1.Equals(color2); + } + + /// + /// Returns a new RGB color instance. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// + public static Color FromRgb(int r, int g, int b) + { + return new Color(r, g, b); + } + + /// + /// Returns a new RGBA color instance. + /// + /// The red component of the color. + /// The green component of the color. + /// The blue component of the color. + /// The alpha component of the color. + /// the RGBA color instance. + public static Color FromRgba(int r, int g, int b, int a) + { + return new Color(r, g, b, a); + } + + /// + /// Returns a new RGB Color instance with the requested Red, Green, and Blue channels. The Alpha channel is set if hex contains one. + /// + /// A string that contains the hexadecimal RGB(A) color representation. + /// the RGBA color instance. + public static Color FromHex(string hex) + { + if (hex == null) + { + throw new ArgumentNullException("hex"); + } + + // #fff + // #ffffff + // #ffff + // #ffffffff + if (hex.Length > 0 && hex[0] == '#') hex = hex.Substring(1); + if (hex.Length == 3) hex += "F"; + if (hex.Length == 4) + hex = new String(new char[] { hex[0], hex[0], hex[1], hex[1], hex[2], hex[2], hex[3], hex[3] }); + if (hex.Length == 6) hex += "FF"; + if (hex.Length != 8) + { + throw new ArgumentException(@"Hex string is not valid color. length of hex should be 3, 4, 6, 8"); + } + Color c = new Color(); + c._value = Convert.ToInt32(hex, 16); + return c; + } + + private static ArgumentException CreateColorArgumentException(int value, string color) + { + return new ArgumentException(string.Format("'{0}' is not a valid" + + " value for '{1}'. '{1}' should be greater or equal to 0 and" + + " less than or equal to 255.", value, color)); + } + + #endregion // Static Methods + + #region Methods + + /// + /// Gets the 32-bits RGBA value of the color. + /// + public int GetRgba() + { + return _value; + } + + /// + /// Gets the 32-bits ARGB value of the color. + /// + public int GetArgb() + { + return (int)((uint)A << 24 | (uint)R << 16 | (uint)G << 8 | (uint)B); + } + + /// + /// Returns a string representation in Hex. (ex: \#FFFFFFFF in RGBA order) + /// + /// The string representation in Hex. + public string ToHex() + { + return "#" + _value.ToString("X8"); + } + + /// + /// Returns a boolean indicating whether the given Color is equal to this Color instance. + /// + /// The Color to compare this instance to. + /// True if the other Color is equal to this instance; False otherwise. + public bool Equals(Color other) + { + return _value == other._value; + } + + /// + /// Returns a boolean indicating whether the given Object is equal to this Color instance. + /// + /// The Object to compare against. + /// True if the Object is equal to this Color; False otherwise. + public override bool Equals(object obj) + { + if (obj is Color) + { + return Equals((Color)obj); + } + return false; + } + + /// + /// Returns a string representation of the Color. + /// + /// The string representation. + public override string ToString() + { + return string.Format("Color [R={0}, G={1}, B={2}, A={3}]", R, G, B, A); + } + + /// + /// Returns the hash code for this instance. + /// + /// The hash code. + public override int GetHashCode() + { + return _value.GetHashCode(); + } + + #endregion // Methods + } +} diff --git a/src/Tizen/Tizen.Internals.Errors/ErrorCode.cs b/src/Tizen/Tizen.Internals.Errors/ErrorCode.cs new file mode 100644 index 0000000..c21dc60 --- /dev/null +++ b/src/Tizen/Tizen.Internals.Errors/ErrorCode.cs @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Tizen.Internals.Errors +{ + public enum ErrorCode : int + { + None = 0, // 0, /**< Successful */ + NotPermitted = -1, // -EPERM, /**< Operation not permitted */ + NoSuchFile = -2, // -ENOENT, /**< No such file or directory */ + NoSuchProcess = -3, // -ESRCH, /**< No such process */ + InterruptedSysCall = -4, // -EINTR, /**< Interrupted system call */ + IoError = -5, // -EIO, /**< I/O error */ + NoSuchDevice = -6, // -ENXIO, /**< No such device or address */ + ArgumentListTooLong = -7, // -E2BIG, /**< Argument list too long */ + ExecFormatError = -8, // -ENOEXEC, /**< Exec format error */ + BadFileNumber = -9, // -EBADF, /**< Bad file number */ + TryAgain = -11, // -EAGAIN, /**< Try again */ + OutOfMemory = -12, // -ENOMEM, /**< Out of memory */ + PermissionDenied = -13, // -EACCES, /**< Permission denied */ + BadAddress = -14, // -EFAULT, /**< Bad address */ + BlockDeviceRequired = -15, // -ENOTBLK, /**< Block device required */ + ResourceBusy = -16, // -EBUSY, /**< Device or resource busy */ + FileExists = -17, // -EEXIST, /**< File exists */ + CrossDeviceLink = -18, // -EXDEV, /**< Cross-device link */ + NotaDirectory = -20, // -ENOTDIR, /**< Not a directory */ + IsADirectory = -21, // -EISDIR, /**< Is a directory */ + InvalidParameter = -22, // -EINVAL, /**< Invalid function parameter */ + FileTableOverflow = -23, // -ENFILE, /**< File table overflow */ + TooManyOpenFiles = -24, // -EMFILE, /**< Too many open files */ + TooNotaTerminal = -25, // -ENOTTY, /**< Not a terminal */ + TooTextFileBusy = -26, // -ETXTBSY, /**< Not a terminal */ + FileTooLarge = -27, // -EFBIG, /**< File too large */ + FileNoSpaceOnDevice = -28, // -ENOSPC, /**< No space left on device */ + IllegalSeek = -29, // -ESPIPE, /**< Illegal seek */ + ReadOnlyFilesystem = -30, // -EROFS, /**< Read-only file system */ + NoData = -61, // -ENODATA, /**< No data available */ + TooManyLinks = -31, // -EMLINK, /**< Too many links */ + BrokenPipe = -32, // -EPIPE, /**< Broken pipe */ + ArgumentOutOfDomain = -33, // -EDOM, /**< Math argument out of domain of func */ + ResultOutOfRange = -34, // -ERANGE, /**< Math result not representable */ + WouldCauseDeadlock = -35, // -EDEADLK, /**< Resource deadlock would occur */ + FileNameTooLong = -36, // -ENAMETOOLONG,/**< File name too long */ + FileNoLocksAvailable = -37, // -ENOLCK, /**< No record locks available */ + InvalidOperation = -38, // -ENOSYS, /**< Function not implemented */ + DirNotEmpty = -39, // -ENOTEMPTY, /**< Directory not empty */ + TooManySymbolicLinks = -40, // -ELOOP, /**< Too many symbolic links encountered */ + WouldBlock = -11, // TryAgain (-EAGAIN), /**< Operation would block */ + CorruptedSharedLib = -80, // -ELIBBAD, /**< Accessing a corrupted shared library */ + LibSectionCorrupted = -81, // -ELIBSCN, /**< .lib section in a.out corrupted */ + LinkTooManySharedLib = -82, // -ELIBMAX, /**< Attempting to link in too many shared libraries */ + SharedLibExec = -83, // -ELIBEXEC, /**< Cannot exec a shared library directly */ + IllegalByteSeq = -84, // -EILSEQ, /**< Illegal byte sequence */ + SystemCallRestart = -85, // -ERESTART, /**< Interrupted system call should be restarted */ + StreamsPipe = -86, // -ESTRPIPE, /**< Streams pipe error */ + TooManyUsers = -87, // -EUSERS, /**< Too many users */ + NonSocket = -88, // -ENOTSOCK, /**< Socket operation on non-socket */ + NoDestAddress = -89, // -EDESTADDRREQ, /**< Destination address required */ + MsgTooLong = -90, // -EMSGSIZE, /**< Message too long */ + ProtocolWrongType = -91, // -EPROTOTYPE, /**< Protocol wrong type for socket */ + ProtocolNotAvaliable = -92, // -ENOPROTOOPT, /**< Protocol not available */ + ProtocolNotSupported = -93, // -EPROTONOSUPPORT, /**< Protocol not supported */ + SocketTypeNotSupported = -94, // -ESOCKTNOSUPPORT, /**< Socket type not supported */ + EndpointOperatinNotSupported = -95, // -EOPNOTSUPP, /**< Operation not supported on transport endpoint */ + ProtocolFamilyNotSupported = -96, // -EPFNOSUPPORT, /**< Protocol family not supported */ + AddressFamilyNotSupported = -97, // -EAFNOSUPPORT, /**< Address family not supported by protocol */ + AddresInUse = -98, // -EADDRINUSE, /**< Address already in use */ + CannotAssignAddress = -99, // -EADDRNOTAVAIL, /**< Cannot assign requested address */ + Networkdown = -100, // -ENETDOWN, /**< Network is down */ + NetworkUnreachable = -101, // -ENETUNREACH, /**< Network is unreachable */ + NetworkReset = -102, // -ENETRESET, /**< Network dropped connection because of reset */ + ConnectionAborted = -103, // -ECONNABORTED, /**< Software caused connection abort */ + ConnectionResetByPeer = -104, // -ECONNRESET, /**< Connection reset by peer */ + BufferSpace = -105, // -ENOBUFS, /**< No buffer space available */ + EndpointConnected = -106, // -EISCONN, /**< Transport endpoint is already connected */ + EndpointNotConnected = -107, // -ENOTCONN, /**< Transport endpoint is not connected */ + EndpointShutdown = -108, // -ESHUTDOWN, /**< Cannot send after transport endpoint shutdown */ + TooManyReferences = -109, // -ETOOMANYREFS, /**< Too many references: cannot splice */ + ConnectionTimeout = -110, // -ETIMEDOUT, /**< Connection timed out */ + ConnectionRefused = -111, // -ECONNREFUSED, /**< Connection refused */ + Hostdown = -112, // -EHOSTDOWN, /**< Host is down */ + NoRouteToHost = -113, // -EHOSTUNREACH, /**< No route to host */ + AlreadyInProgress = -114, // -EALREADY, /**< Operation already in progress */ + NowInProgress = -115, // -EINPROGRESS, /**< Operation now in progress */ + StaleNfsFileHandle = -116, // -ESTALE, /**< Stale NFS file handle */ + StructureUnclean = -117, // -EUCLEAN, /**< Structure needs cleaning */ + NotXenixNamedTypeFile = -118, // -ENOTNAM, /**< Not a XENIX named type file */ + NoXenixSemaphoresAvailable = -119, // -ENAVAIL, /**< No XENIX semaphores available */ + IsNamedTypeFile = -120, // -EISNAM, /**< Is a named type file */ + RemoteIo = -121, // -EREMOTEIO, /**< Remote I/O error */ + QuotaExceeded = -122, // -EDQUOT, /**< Quota exceeded */ + NoMedium = -123, // -ENOMEDIUM, /**< No medium found */ + WrongMediumType = -124, // -EMEDIUMTYPE, /**< Wrong medium type */ + Canceled = -125, // -ECANCELED, /**< Operation Canceled */ + KeyNotAvailable = -126, // -ENOKEY, /**< Required key not available */ + KeyExpired = -127, // -EKEYEXPIRED, /**< Key has expired */ + KeyRevoked = -128, // -EKEYREVOKED, /**< Key has been revoked */ + KeyRejected = -129, // -EKEYREJECTED, /**< Key was rejected by service */ + + OwnerDead = -130, // -EOWNERDEAD, /**< Owner died (for robust mutexes) */ + + Unknown = -1073741824, // TIZEN_ERROR_MIN_PLATFORM_ERROR, /**< Unknown error */ + + TimedOut, // /**< Time out */ + NotSupported, // /**< Not Supported */ + UserNotConsented,// /**< Not Consented */ + EndofCollection // + } +} diff --git a/src/Tizen/Tizen.Internals.Errors/ErrorFacts.cs b/src/Tizen/Tizen.Internals.Errors/ErrorFacts.cs new file mode 100644 index 0000000..f5ec90d --- /dev/null +++ b/src/Tizen/Tizen.Internals.Errors/ErrorFacts.cs @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System; +using System.Runtime.InteropServices; + +namespace Tizen.Internals.Errors +{ + /// + /// + /// + public static class ErrorFacts + { + /// + /// + /// + /// + public static int GetLastResult() + { + return Interop.CommonError.GetLastResult(); + } + + /// + /// + /// + /// + /// + public static string GetErrorMessage(int errorCode) + { + IntPtr errorPtr = Interop.CommonError.GetErrorMessage(errorCode); + return Marshal.PtrToStringAnsi(errorPtr); + } + } +} diff --git a/src/Tizen/Tizen.csproj b/src/Tizen/Tizen.csproj new file mode 100644 index 0000000..88c3f81 --- /dev/null +++ b/src/Tizen/Tizen.csproj @@ -0,0 +1,9 @@ + + + + + netstandard1.6 + + + + diff --git a/src/Tizen/Tizen.sln b/src/Tizen/Tizen.sln new file mode 100755 index 0000000..8ad9426 --- /dev/null +++ b/src/Tizen/Tizen.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26430.12 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen", "Tizen.csproj", "{891C5B11-36F1-405A-8935-E1ABBD1D5C81}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {891C5B11-36F1-405A-8935-E1ABBD1D5C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {891C5B11-36F1-405A-8935-E1ABBD1D5C81}.Debug|Any CPU.Build.0 = Debug|Any CPU + {891C5B11-36F1-405A-8935-E1ABBD1D5C81}.Release|Any CPU.ActiveCfg = Release|Any CPU + {891C5B11-36F1-405A-8935-E1ABBD1D5C81}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal -- 2.7.4